$OpenBSD: patch-app_gui_c,v 1.4 2008/08/21 14:11:14 jasper Exp $ --- app/gui.c.orig Mon May 20 15:06:48 2002 +++ app/gui.c Thu Aug 21 15:54:06 2008 @@ -227,8 +227,6 @@ gui_save_wav_callback (gint reply, write(audio_ctlpipe, &i, sizeof(i)); write(audio_ctlpipe, &l, sizeof(l)); write(audio_ctlpipe, data, l + 1); - - gui_set_current_pattern(xm->pattern_order_table[0]); wait_for_player(); } } @@ -474,7 +472,7 @@ keyevent (GtkWidget *widget, sample_editor_handle_keys, modinfo_page_handle_keys, }; - gboolean pressed = (gboolean)data; + gboolean pressed = (gboolean)GPOINTER_TO_INT(data); gboolean handled = FALSE; gboolean entry_focus = GTK_IS_ENTRY(GTK_WINDOW(mainwindow)->focus_widget); @@ -529,7 +527,7 @@ static void playlist_position_changed (Playlist *p, int newpos) { - if(gui_playing_mode) { + if(gui_playing_mode != 0) { // This will only be executed when the user changes the song position manually gui_mixer_set_songpos(newpos); event_waiter_start(audio_songpos_ew); @@ -577,8 +575,18 @@ gui_editpat_changed (GtkSpinButton *spin) { int n = gtk_spin_button_get_value_as_int(spin); - if(n != editing_pat) + if(n != editing_pat) { gui_set_current_pattern(n); + + /* If we are in 'playing pattern' mode and asynchronous + * editing is disabled, make the audio thread jump to the new + * pattern, too. I think it would be cool to have this for + * 'playing song' mode, too, but then modifications in + * gui_update_player_pos() will be necessary. */ + if(gui_playing_mode == PLAYING_PATTERN && !ASYNCEDIT) { + gui_mixer_set_pattern(n); + } + } } static void @@ -870,8 +878,6 @@ play_song (void) write(audio_ctlpipe, &i, sizeof(i)); write(audio_ctlpipe, &sp, sizeof(sp)); write(audio_ctlpipe, &pp, sizeof(pp)); - - gui_set_current_pattern(xm->pattern_order_table[sp]); wait_for_player(); } @@ -1037,10 +1043,6 @@ gui_set_current_pattern (int p) gtk_spin_button_set_value(GTK_SPIN_BUTTON(spin_editpat), p); gui_update_pattern_data(); - if(!GUI_ENABLED && !ASYNCEDIT) { - gui_mixer_set_pattern(p); - } - xm_set_modified(m); } @@ -1064,13 +1066,12 @@ offset_current_pattern (int offset) int nv; nv = gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(spin_editpat)) + offset; - if(nv < 0) nv = 0; else if(nv > 255) nv = 255; - gui_set_current_pattern(nv); + gtk_spin_button_set_value(GTK_SPIN_BUTTON(spin_editpat), nv); } void @@ -1255,7 +1256,7 @@ gui_splash_set_label (const gchar *text, char buf[256]; strcpy(buf, "SoundTracker v" VERSION " - "); - strncat(buf, text, 255-sizeof(buf)); + strlcat(buf, text, sizeof buf); gtk_label_set_text(GTK_LABEL(gui_splash_label), buf);