Mercurial > hg > xmms-sid
diff src/xmms-sid.c @ 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 | 505da1389e5c |
children | 4406e91d2da3 |
line wrap: on
line diff
--- 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); }