Mercurial > hg > xmms-sid
changeset 177:6e350784aa57
Various cleanups. Min-playtime option now works. Configuration has more
consistent operation while graying out unavailable settings.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Wed, 18 Aug 2004 03:27:00 +0000 |
parents | d109d928ccc3 |
children | 002e314712c4 |
files | Makefile.am src/xmms-sid.c src/xs_about.c src/xs_config.c src/xs_genui.c src/xs_genui.h xmms-sid.glade |
diffstat | 7 files changed, 311 insertions(+), 51 deletions(-) [+] |
line wrap: on
line diff
--- a/Makefile.am Wed Aug 18 03:24:04 2004 +0000 +++ b/Makefile.am Wed Aug 18 03:27:00 2004 +0000 @@ -20,5 +20,5 @@ xmms-sid.spec \ xmms-1.2.10-songpos.patch -ChangeLog: +ChangeLog: CVS/Entries src/CVS/Entries cvs2cl.pl --passwd /etc/passwd --domain tnsp.org
--- a/src/xmms-sid.c Wed Aug 18 03:24:04 2004 +0000 +++ b/src/xmms-sid.c Wed Aug 18 03:27:00 2004 +0000 @@ -303,6 +303,11 @@ XSDEBUG("subtune #%i selected, initializing...\n", myStatus.currSong); songLength = myTune->subTunes[myStatus.currSong - 1].tuneLength; + if (xs_cfg.playMinTimeEnable) + { + if (songLength < xs_cfg.playMinTime) + songLength = xs_cfg.playMinTime; + } /* Initialize song */ if (!xs_player->plrInitSong(&myStatus)) @@ -490,13 +495,31 @@ /* * Pop-up subtune selector */ +#define LUW(x...) lookup_widget(xs_fileinfowin, ## x) + void xs_subctrl_update(void) { + GtkAdjustment *tmpAdj; + if (xs_subctrl) { - GTK_ADJUSTMENT(xs_subctrl_adj)->value = xs_status.currSong; - gtk_adjustment_value_changed(GTK_ADJUSTMENT(xs_subctrl_adj)); + tmpAdj = GTK_ADJUSTMENT(xs_subctrl_adj); + + tmpAdj->value = xs_status.currSong; + tmpAdj->lower = 1; + tmpAdj->upper = (xs_status.pTune) ? xs_status.pTune->nsubTunes : 1; + gtk_adjustment_value_changed(tmpAdj); } + + if (xs_fileinfowin) + { + tmpAdj = gtk_range_get_adjustment(GTK_RANGE(LUW("fileinfo_subctrl_adj"))); + + tmpAdj->value = xs_status.currSong; + tmpAdj->lower = 1; + tmpAdj->upper = xs_status.pTune->nsubTunes; + gtk_adjustment_value_changed(tmpAdj); + } } @@ -664,7 +687,7 @@ /* Let's see what we do */ switch (xs_cfg.subsongControl) { case XS_SSC_SEEK: - xs_status.lastTime = xs_plugin_ip.output->output_time() / 1000; + xs_status.lastTime = (xs_plugin_ip.output->output_time() / 1000); break; #ifdef HAVE_SONG_POSITION @@ -676,7 +699,7 @@ #endif } - /* Else, return output time reported by audio output plugin */ + /* Return output time reported by audio output plugin */ return xs_plugin_ip.output->output_time(); } @@ -689,9 +712,11 @@ t_xs_tune *pInfo; gint tmpInt; + /* Get tune information from emulation engine */ pInfo = xs_player->plrGetSIDInfo(songFilename); if (!pInfo) return; + /* Get sub-tune information, if available */ if ((pInfo->startTune >= 0) && (pInfo->startTune <= pInfo->nsubTunes)) { (*songTitle) = g_strdup(pInfo->subTunes[pInfo->startTune - 1].tuneTitle); @@ -702,7 +727,8 @@ else (*songLength) = (tmpInt * 1000); } - + + /* Free tune information */ xs_tune_free(pInfo); } @@ -764,14 +790,13 @@ /* * File-information window */ -#define LUW(x...) lookup_widget(xs_fileinfowin, ## x) - void xs_fileinfo_ok(void) { gtk_widget_destroy(xs_fileinfowin); xs_fileinfowin = NULL; } + void xs_fileinfo_subtune(GtkWidget *widget, void *data) { t_xs_stil_subnode *tmpNode; @@ -788,9 +813,10 @@ if (xs_fileinfostil) { - /* Get subtune number */ - - + /* Get subtune number */ + tmpItem = gtk_menu_get_active(GTK_MENU(data)); + tmpIndex = g_list_index(GTK_MENU_SHELL(data)->children, tmpItem); + /* Get subtune information */ tmpNode = &xs_fileinfostil->subTune[tmpIndex]; subName = tmpNode->pName; @@ -819,7 +845,10 @@ void xs_fileinfo(gchar *pcFilename) { + GtkWidget *tmpMenuItem, *tmpMenu, *tmpOptionMenu; t_xs_stil_subnode *tmpNode; + gchar tmpStr[32], *tmpS; + gint n; /* Free old info, if set */ if (xs_fileinfotune) @@ -857,9 +886,49 @@ gtk_entry_set_text(GTK_ENTRY(LUW("fileinfo_composer")), xs_fileinfotune->tuneComposer); gtk_entry_set_text(GTK_ENTRY(LUW("fileinfo_copyright")), xs_fileinfotune->tuneCopyright); - /* Set the sub-tune information */ + + /* Main tune - the pseudo tune */ + tmpOptionMenu = LUW("fileinfo_sub_tune"); + tmpMenu = GTK_OPTION_MENU(tmpOptionMenu)->menu; + + tmpMenuItem = gtk_menu_item_new_with_label ("General info"); + gtk_widget_show (tmpMenuItem); + gtk_menu_append (GTK_MENU(tmpMenu), tmpMenuItem); + gtk_signal_connect (GTK_OBJECT (tmpMenuItem), "activate", + GTK_SIGNAL_FUNC (xs_fileinfo_subtune), tmpMenu); + + /* Other menu items */ + for (n = 1; n <= xs_fileinfotune->nsubTunes; n++) + { + if (xs_fileinfostil) + { + tmpNode = &xs_fileinfostil->subTune[n]; + if (tmpNode->pName) + tmpS = tmpNode->pName; + else + if (tmpNode->pInfo) + tmpS = tmpNode->pInfo; + else + tmpS = "---"; + + snprintf(tmpStr, sizeof(tmpStr), "Tune #%i: %s", n, tmpS); + } else + snprintf(tmpStr, sizeof(tmpStr), "Tune #%i", n); + + tmpMenuItem = gtk_menu_item_new_with_label(tmpStr); + gtk_widget_show (tmpMenuItem); + gtk_menu_append (GTK_MENU(tmpMenu), tmpMenuItem); + + gtk_signal_connect (GTK_OBJECT(tmpMenuItem), "activate", + GTK_SIGNAL_FUNC(xs_fileinfo_subtune), tmpMenu); + } + + /* Set the subtune information */ xs_fileinfo_subtune(NULL, tmpMenu); + /* Update subtune controls */ + xs_subctrl_update(); + /* Show the window */ gtk_widget_show(xs_fileinfowin); }
--- a/src/xs_about.c Wed Aug 18 03:24:04 2004 +0000 +++ b/src/xs_about.c Wed Aug 18 03:27:00 2004 +0000 @@ -61,7 +61,6 @@ gtk_widget_set_name (xs_aboutwin, "xs_aboutwin"); gtk_object_set_data (GTK_OBJECT (xs_aboutwin), "xs_aboutwin", xs_aboutwin); gtk_window_set_title (GTK_WINDOW (xs_aboutwin), "About " PACKAGE_STRING); - gtk_window_set_modal (GTK_WINDOW (xs_aboutwin), TRUE); gtk_window_set_default_size (GTK_WINDOW (xs_aboutwin), 300, -1); about_vbox1 = gtk_vbox_new (FALSE, 0);
--- a/src/xs_config.c Wed Aug 18 03:24:04 2004 +0000 +++ b/src/xs_config.c Wed Aug 18 03:27:00 2004 +0000 @@ -617,12 +617,12 @@ gtk_widget_set_sensitive(LUW("cfg_oversample_grp"), isActive); gtk_widget_set_sensitive(LUW("cfg_oversample"), isActive); gtk_widget_set_sensitive(LUW("cfg_oversample_factor"), isActive); - gtk_widget_set_sensitive(LUW("cfg_overfilter_average"), isActive); - gtk_widget_set_sensitive(LUW("cfg_overfilter_sinc"), isActive); gtk_widget_set_sensitive(LUW("cfg_sidplay2_grp"), isActive); gtk_widget_set_sensitive(LUW("cfg_emu_sidplay2_opt"), isActive); + gtk_widget_set_sensitive(LUW("cfg_chn_autopan"), !isActive); + #ifdef HAVE_RESID_BUILDER gtk_widget_set_sensitive(LUW("cfg_emu_sidplay2_resid"), isActive); #else @@ -642,27 +642,91 @@ } +void xs_cfg_oversample_toggled(GtkToggleButton *togglebutton, gpointer user_data) +{ + gboolean isActive = GTK_TOGGLE_BUTTON(LUW("cfg_oversample"))->active; + + gtk_widget_set_sensitive(LUW("cfg_oversample_factor"), isActive); + gtk_widget_set_sensitive(LUW("cfg_oversample_label1"), isActive); + gtk_widget_set_sensitive(LUW("cfg_oversample_label2"), isActive); +} + + +void xs_cfg_mintime_enable_toggled(GtkToggleButton *togglebutton, gpointer user_data) +{ + gboolean isActive = GTK_TOGGLE_BUTTON(LUW("cfg_mintime_enable"))->active; + + gtk_widget_set_sensitive(LUW("cfg_mintime"), isActive); + gtk_widget_set_sensitive(LUW("cfg_mintime_label1"), isActive); + gtk_widget_set_sensitive(LUW("cfg_mintime_label2"), isActive); +} + + +void xs_cfg_maxtime_enable_toggled(GtkToggleButton *togglebutton, gpointer user_data) +{ + gboolean isActive = GTK_TOGGLE_BUTTON(LUW("cfg_maxtime_enable"))->active; + + gtk_widget_set_sensitive(LUW("cfg_maxtime_unknown"), isActive); + gtk_widget_set_sensitive(LUW("cfg_maxtime"), isActive); + gtk_widget_set_sensitive(LUW("cfg_maxtime_label1"), isActive); + gtk_widget_set_sensitive(LUW("cfg_maxtime_label2"), isActive); +} + + +void xs_cfg_sld_enable_toggled(GtkToggleButton *togglebutton, gpointer user_data) +{ + gboolean isActive = GTK_TOGGLE_BUTTON(LUW("cfg_sld_enable"))->active; + + gtk_widget_set_sensitive(LUW("cfg_sld_dbpath"), isActive); + gtk_widget_set_sensitive(LUW("cfg_sld_dbbrowse"), isActive); + gtk_widget_set_sensitive(LUW("cfg_sld_label1"), isActive); +} + + +void xs_cfg_stil_enable_toggled(GtkToggleButton *togglebutton, gpointer user_data) +{ + gboolean isActive = GTK_TOGGLE_BUTTON(LUW("cfg_stil_enable"))->active; + + gtk_widget_set_sensitive(LUW("cfg_stil_dbpath"), isActive); + gtk_widget_set_sensitive(LUW("cfg_stil_browse"), isActive); + gtk_widget_set_sensitive(LUW("cfg_stil_label1"), isActive); + + gtk_widget_set_sensitive(LUW("cfg_hvsc_path"), isActive); + gtk_widget_set_sensitive(LUW("cfg_hvsc_browse"), isActive); + gtk_widget_set_sensitive(LUW("cfg_hvsc_label1"), isActive); +} + + void xs_cfg_mintime_changed(GtkEditable *editable, gpointer user_data) { - gint tmpValue, maxValue; + gint tmpValue; + GtkAdjustment *tmpAdj; + + tmpAdj = gtk_spin_button_get_adjustment( + GTK_SPIN_BUTTON(LUW("cfg_maxtime"))); - if (tmpValue > maxValue) - - gtk_adjustment_set_value( - gtk_spin_button_get_adjustment(GTK_SPIN_BUTTON(LUW("cfg_maxtime"))), - tmpValue); + tmpValue = gtk_spin_button_get_adjustment( + GTK_SPIN_BUTTON(editable))->value; + + if (tmpValue > tmpAdj->value) + gtk_adjustment_set_value(tmpAdj, tmpValue); } void xs_cfg_maxtime_changed(GtkEditable *editable, gpointer user_data) { - gint tmpValue, minValue; + gint tmpValue; + GtkAdjustment *tmpAdj; + tmpAdj = gtk_spin_button_get_adjustment( + GTK_SPIN_BUTTON(LUW("cfg_mintime"))); - gtk_adjustment_set_value( - gtk_spin_button_get_adjustment(GTK_SPIN_BUTTON(LUW("cfg_mintime"))), - tmpValue); + tmpValue = gtk_spin_button_get_adjustment( + GTK_SPIN_BUTTON(editable))->value; + + if (tmpValue < tmpAdj->value) + gtk_adjustment_set_value(tmpAdj, tmpValue); } @@ -685,7 +749,7 @@ xs_configwin = create_xs_configwin(); - /* Based on selected emulation library, disable options */ + /* Based on available optional parts, gray out options */ #ifndef HAVE_SIDPLAY1 gtk_widget_set_sensitive(LUW("cfg_emu_sidplay1"), FALSE); #endif @@ -698,7 +762,6 @@ gtk_widget_set_sensitive(LUW("cfg_emu_nanosid"), FALSE); #endif - /* Other UI options */ #ifndef HAVE_XMMSEXTRA gtk_widget_set_sensitive(LUW("cfg_ftitle_override"), FALSE); xs_cfg.titleOverride = TRUE; @@ -714,6 +777,11 @@ xs_cfg_emu_sidplay1_toggled(NULL, NULL); xs_cfg_emu_sidplay2_toggled(NULL, NULL); xs_cfg_emu_nanosid_toggled(NULL, NULL); + xs_cfg_oversample_toggled(NULL, NULL); + xs_cfg_mintime_enable_toggled(NULL, NULL); + xs_cfg_maxtime_enable_toggled(NULL, NULL); + xs_cfg_sld_enable_toggled(NULL, NULL); + xs_cfg_stil_enable_toggled(NULL, NULL); /* Set current data to widgets */
--- a/src/xs_genui.c Wed Aug 18 03:24:04 2004 +0000 +++ b/src/xs_genui.c Wed Aug 18 03:27:00 2004 +0000 @@ -7,3 +7,4 @@ #include "xs_genui.h" #include "xs_interface.h" #include "xs_glade.h" +
--- a/src/xs_genui.h Wed Aug 18 03:24:04 2004 +0000 +++ b/src/xs_genui.h Wed Aug 18 03:27:00 2004 +0000 @@ -84,3 +84,31 @@ void xs_cfg_maxtime_changed (GtkEditable *editable, gpointer user_data); + +void +xs_subctrl_prevsong (GtkButton *button, + gpointer user_data); + +void +xs_subctrl_nextsong (GtkButton *button, + gpointer user_data); + +void +xs_cfg_oversample_toggled (GtkToggleButton *togglebutton, + gpointer user_data); + +void +xs_cfg_mintime_enable_toggled (GtkToggleButton *togglebutton, + gpointer user_data); + +void +xs_cfg_maxtime_enable_toggled (GtkToggleButton *togglebutton, + gpointer user_data); + +void +xs_cfg_sld_enable_toggled (GtkToggleButton *togglebutton, + gpointer user_data); + +void +xs_cfg_stil_enable_toggled (GtkToggleButton *togglebutton, + gpointer user_data);
--- a/xmms-sid.glade Wed Aug 18 03:24:04 2004 +0000 +++ b/xmms-sid.glade Wed Aug 18 03:27:00 2004 +0000 @@ -295,6 +295,11 @@ <name>cfg_oversample</name> <border_width>2</border_width> <can_focus>True</can_focus> + <signal> + <name>toggled</name> + <handler>xs_cfg_oversample_toggled</handler> + <last_modification_time>Wed, 18 Aug 2004 02:20:35 GMT</last_modification_time> + </signal> <label>Use oversampling</label> <active>False</active> <draw_indicator>True</draw_indicator> @@ -319,7 +324,7 @@ <widget> <class>GtkLabel</class> - <name>label42</name> + <name>cfg_oversample_label1</name> <label>Factor:</label> <justify>GTK_JUSTIFY_CENTER</justify> <wrap>False</wrap> @@ -359,7 +364,7 @@ <widget> <class>GtkLabel</class> - <name>label43</name> + <name>cfg_oversample_label2</name> <label>Large factors require more CPU-power</label> <justify>GTK_JUSTIFY_CENTER</justify> <wrap>False</wrap> @@ -1042,6 +1047,11 @@ <name>cfg_mintime_enable</name> <border_width>2</border_width> <can_focus>True</can_focus> + <signal> + <name>toggled</name> + <handler>xs_cfg_mintime_enable_toggled</handler> + <last_modification_time>Wed, 18 Aug 2004 02:51:28 GMT</last_modification_time> + </signal> <label>Play at least for specified time (adds silence)</label> <active>False</active> <draw_indicator>True</draw_indicator> @@ -1066,7 +1076,7 @@ <widget> <class>GtkLabel</class> - <name>label51</name> + <name>cfg_mintime_label1</name> <label>Playtime: </label> <justify>GTK_JUSTIFY_CENTER</justify> <wrap>False</wrap> @@ -1111,7 +1121,7 @@ <widget> <class>GtkLabel</class> - <name>label52</name> + <name>cfg_mintime_label2</name> <label>seconds</label> <justify>GTK_JUSTIFY_CENTER</justify> <wrap>False</wrap> @@ -1154,6 +1164,11 @@ <name>cfg_maxtime_enable</name> <border_width>2</border_width> <can_focus>True</can_focus> + <signal> + <name>toggled</name> + <handler>xs_cfg_maxtime_enable_toggled</handler> + <last_modification_time>Wed, 18 Aug 2004 02:51:37 GMT</last_modification_time> + </signal> <label>Play for specified time maximum</label> <active>False</active> <draw_indicator>True</draw_indicator> @@ -1193,7 +1208,7 @@ <widget> <class>GtkLabel</class> - <name>label37</name> + <name>cfg_maxtime_label1</name> <label>Playtime: </label> <justify>GTK_JUSTIFY_CENTER</justify> <wrap>False</wrap> @@ -1238,7 +1253,7 @@ <widget> <class>GtkLabel</class> - <name>label36</name> + <name>cfg_maxtime_label2</name> <label>seconds</label> <justify>GTK_JUSTIFY_CENTER</justify> <wrap>False</wrap> @@ -1282,6 +1297,11 @@ <border_width>2</border_width> <tooltip>This option enables using of XSIDPLAY compatible HVSC Song-length database. (See documentation for more information)</tooltip> <can_focus>True</can_focus> + <signal> + <name>toggled</name> + <handler>xs_cfg_sld_enable_toggled</handler> + <last_modification_time>Wed, 18 Aug 2004 02:51:47 GMT</last_modification_time> + </signal> <label>Use XSIDPLAY-compatible database</label> <active>False</active> <draw_indicator>True</draw_indicator> @@ -1306,7 +1326,7 @@ <widget> <class>GtkLabel</class> - <name>label33</name> + <name>cfg_sld_label1</name> <label>DB-file: </label> <justify>GTK_JUSTIFY_CENTER</justify> <wrap>False</wrap> @@ -1404,6 +1424,11 @@ <name>cfg_stil_enable</name> <border_width>2</border_width> <can_focus>True</can_focus> + <signal> + <name>toggled</name> + <handler>xs_cfg_stil_enable_toggled</handler> + <last_modification_time>Wed, 18 Aug 2004 02:52:39 GMT</last_modification_time> + </signal> <label>Use STIL information database</label> <active>False</active> <draw_indicator>True</draw_indicator> @@ -1427,7 +1452,7 @@ <widget> <class>GtkLabel</class> - <name>label4</name> + <name>cfg_stil_label1</name> <label>STIL-file:</label> <justify>GTK_JUSTIFY_CENTER</justify> <wrap>False</wrap> @@ -1510,7 +1535,7 @@ <widget> <class>GtkLabel</class> - <name>label49</name> + <name>cfg_hvsc_label1</name> <label>HVSC path:</label> <justify>GTK_JUSTIFY_CENTER</justify> <wrap>False</wrap> @@ -1714,7 +1739,7 @@ <class>GtkFrame</class> <name>frame28</name> <border_width>4</border_width> - <label>Sub-song control: </label> + <label>Sub-tune control: </label> <label_xalign>0</label_xalign> <shadow_type>GTK_SHADOW_ETCHED_IN</shadow_type> <child> @@ -1820,8 +1845,9 @@ <class>GtkCheckButton</class> <name>cfg_detectmagic</name> <border_width>2</border_width> + <tooltip>Determine if file is a SID-tune by checking the file contents. If NOT selected, filetype is determined by checking filename extension (.sid, .dat, ...)</tooltip> <can_focus>True</can_focus> - <label>Determine filetype by contents (slower)</label> + <label>Detect file by contents (slower)</label> <active>False</active> <draw_indicator>True</draw_indicator> <child> @@ -1902,7 +1928,6 @@ <class>GtkWindow</class> <name>xs_fileinfowin</name> <width>400</width> - <height>350</height> <title>XMMS-SID Fileinfo</title> <type>GTK_WINDOW_DIALOG</type> <position>GTK_WIN_POS_MOUSE</position> @@ -1919,6 +1944,84 @@ <widget> <class>GtkFrame</class> + <name>frame30</name> + <border_width>2</border_width> + <label_xalign>0</label_xalign> + <shadow_type>GTK_SHADOW_OUT</shadow_type> + <child> + <padding>0</padding> + <expand>False</expand> + <fill>False</fill> + </child> + + <widget> + <class>GtkHBox</class> + <name>hbox19</name> + <border_width>4</border_width> + <homogeneous>False</homogeneous> + <spacing>0</spacing> + + <widget> + <class>GtkButton</class> + <name>fileinfo_subctrl_prev</name> + <can_focus>True</can_focus> + <signal> + <name>clicked</name> + <handler>xs_subctrl_prevsong</handler> + <last_modification_time>Wed, 18 Aug 2004 01:40:46 GMT</last_modification_time> + </signal> + <label> < </label> + <relief>GTK_RELIEF_NORMAL</relief> + <child> + <padding>0</padding> + <expand>False</expand> + <fill>False</fill> + </child> + </widget> + + <widget> + <class>GtkHScale</class> + <name>fileinfo_subctrl_adj</name> + <can_focus>True</can_focus> + <draw_value>True</draw_value> + <value_pos>GTK_POS_TOP</value_pos> + <digits>0</digits> + <policy>GTK_UPDATE_CONTINUOUS</policy> + <value>0</value> + <lower>0</lower> + <upper>0</upper> + <step>0</step> + <page>0</page> + <page_size>0</page_size> + <child> + <padding>0</padding> + <expand>True</expand> + <fill>True</fill> + </child> + </widget> + + <widget> + <class>GtkButton</class> + <name>fileinfo_subctrl_next</name> + <can_focus>True</can_focus> + <signal> + <name>clicked</name> + <handler>xs_subctrl_nextsong</handler> + <last_modification_time>Wed, 18 Aug 2004 01:41:09 GMT</last_modification_time> + </signal> + <label> > </label> + <relief>GTK_RELIEF_NORMAL</relief> + <child> + <padding>0</padding> + <expand>False</expand> + <fill>False</fill> + </child> + </widget> + </widget> + </widget> + + <widget> + <class>GtkFrame</class> <name>frame14</name> <border_width>4</border_width> <label>Song Information:</label> @@ -2146,7 +2249,7 @@ <class>GtkFrame</class> <name>frame15</name> <border_width>4</border_width> - <label>Tune Information:</label> + <label>Sub-tune Information:</label> <label_xalign>0</label_xalign> <shadow_type>GTK_SHADOW_ETCHED_IN</shadow_type> <child> @@ -2191,19 +2294,11 @@ </widget> <widget> - <class>GtkHScale</class> + <class>GtkOptionMenu</class> <name>fileinfo_sub_tune</name> <can_focus>True</can_focus> - <draw_value>True</draw_value> - <value_pos>GTK_POS_TOP</value_pos> - <digits>0</digits> - <policy>GTK_UPDATE_CONTINUOUS</policy> - <value>10</value> - <lower>1</lower> - <upper>12</upper> - <step>0</step> - <page>0</page> - <page_size>0</page_size> + <items></items> + <initial_choice>0</initial_choice> <child> <padding>2</padding> <expand>True</expand>