Mercurial > hg > xmms-sid
comparison src/xs_config.c @ 577:fdddab8f0c1b
Scrubbing through the filter configuration code; Configuration dialog
window delete event was not handled and caused problems if WM's "close window"
was used, fixed.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Tue, 20 Mar 2007 13:43:00 +0000 |
parents | cf32867a71ed |
children | d9290bd40037 |
comparison
equal
deleted
inserted
replaced
576:7d08a5adc162 | 577:fdddab8f0c1b |
---|---|
290 | 290 |
291 /* Get fields from config */ | 291 /* Get fields from config */ |
292 g_snprintf(tmpKey, sizeof(tmpKey), "filter%dNPoints", nFilter); | 292 g_snprintf(tmpKey, sizeof(tmpKey), "filter%dNPoints", nFilter); |
293 if (!XS_CFG_GET_INT(cfg, XS_CONFIG_IDENT, tmpKey, &(pResult->npoints))) | 293 if (!XS_CFG_GET_INT(cfg, XS_CONFIG_IDENT, tmpKey, &(pResult->npoints))) |
294 return FALSE; | 294 return FALSE; |
295 if (pResult->npoints > XS_SIDPLAY2_NFPOINTS) | |
296 return FALSE; | |
297 | 295 |
298 g_snprintf(tmpKey, sizeof(tmpKey), "filter%dName", nFilter); | 296 g_snprintf(tmpKey, sizeof(tmpKey), "filter%dName", nFilter); |
299 if (!XS_CFG_GET_STRING(cfg, XS_CONFIG_IDENT, tmpKey, &tmpStr)) | 297 if (!XS_CFG_GET_STRING(cfg, XS_CONFIG_IDENT, tmpKey, &tmpStr)) |
300 return FALSE; | 298 return FALSE; |
301 | 299 |
471 } | 469 } |
472 break; | 470 break; |
473 } | 471 } |
474 } | 472 } |
475 | 473 |
476 xs_filter_load_into(cfg, 0, &xs_cfg.sid2Filter); | 474 /* Filters and presets are a special case */ |
475 xs_filter_load_into(cfg, 0, &xs_cfg.sid2Filter); | |
477 | 476 |
478 XS_CONFIG_FREE(cfg); | 477 XS_CONFIG_FREE(cfg); |
479 | 478 |
480 XS_MUTEX_UNLOCK(xs_cfg); | 479 XS_MUTEX_UNLOCK(xs_cfg); |
481 XSDEBUG("OK\n"); | 480 XSDEBUG("OK\n"); |
482 } | 481 } |
483 | 482 |
484 #include "tmp.c" | |
485 | 483 |
486 /* Write the current configuration | 484 /* Write the current configuration |
487 */ | 485 */ |
488 gint xs_write_configuration(void) | 486 gint xs_write_configuration(void) |
489 { | 487 { |
496 /* Try to open the XMMS configuration file */ | 494 /* Try to open the XMMS configuration file */ |
497 cfg = XS_CONFIG_OPEN(); | 495 cfg = XS_CONFIG_OPEN(); |
498 | 496 |
499 #ifndef AUDACIOUS_PLUGIN | 497 #ifndef AUDACIOUS_PLUGIN |
500 if (!cfg) cfg = xmms_cfg_new(); | 498 if (!cfg) cfg = xmms_cfg_new(); |
499 if (!cfg) return -1; | |
501 #endif | 500 #endif |
502 | 501 |
503 /* Write the new settings to XMMS configuration file */ | 502 /* Write the new settings to XMMS configuration file */ |
504 for (i = 0; i < xs_cfgtable_max; i++) { | 503 for (i = 0; i < xs_cfgtable_max; i++) { |
505 switch (xs_cfgtable[i].itemType) { | 504 switch (xs_cfgtable[i].itemType) { |
526 xs_cfgtable[i].itemName, | 525 xs_cfgtable[i].itemName, |
527 *(gchar **) xs_cfgtable[i].itemData); | 526 *(gchar **) xs_cfgtable[i].itemData); |
528 break; | 527 break; |
529 } | 528 } |
530 } | 529 } |
531 | |
532 xs_filter_save(cfg, &testFilter6581R4, 0); | |
533 xs_filter_save(cfg, &testFilter6581R1, 1); | |
534 xs_filters_export("paske.filters", &testFilter6581R1, 1); | |
535 | 530 |
536 | 531 |
537 XS_CONFIG_WRITE(cfg); | 532 XS_CONFIG_WRITE(cfg); |
538 XS_CONFIG_FREE(cfg); | 533 XS_CONFIG_FREE(cfg); |
539 | 534 |
937 if (tmpValue < tmpAdj->value) | 932 if (tmpValue < tmpAdj->value) |
938 gtk_adjustment_set_value(tmpAdj, tmpValue); | 933 gtk_adjustment_set_value(tmpAdj, tmpValue); |
939 } | 934 } |
940 | 935 |
941 | 936 |
937 gboolean xs_configwin_delete(GtkWidget * widget, GdkEvent * event, gpointer user_data) | |
938 { | |
939 (void) widget; | |
940 (void) event; | |
941 (void) user_data; | |
942 | |
943 XSDEBUG("config::delete_event\n"); | |
944 if (xs_configwin) { | |
945 gtk_widget_destroy(xs_configwin); | |
946 xs_configwin = NULL; | |
947 } | |
948 return FALSE; | |
949 } | |
950 | |
951 | |
942 /* Execute the configuration panel | 952 /* Execute the configuration panel |
943 */ | 953 */ |
944 void xs_configure(void) | 954 void xs_configure(void) |
945 { | 955 { |
946 gint i; | 956 gint i; |
947 gfloat tmpValue; | 957 gfloat tmpValue; |
948 gchar tmpStr[32]; | 958 gchar tmpStr[32]; |
949 GtkWidget *c; | 959 GtkWidget *tmpCurve; |
950 | 960 |
951 /* Check if the window already exists */ | 961 /* Check if the window already exists */ |
952 if (xs_configwin != NULL) { | 962 if (xs_configwin) { |
953 gdk_window_raise(xs_configwin->window); | 963 gdk_window_raise(xs_configwin->window); |
954 return; | 964 return; |
955 } | 965 } |
956 | 966 |
957 /* Create the window */ | 967 /* Create the window */ |
959 | 969 |
960 /* Get lock on configuration */ | 970 /* Get lock on configuration */ |
961 XS_MUTEX_LOCK(xs_cfg); | 971 XS_MUTEX_LOCK(xs_cfg); |
962 | 972 |
963 /* Create the custom filter curve widget for libSIDPlay2 */ | 973 /* Create the custom filter curve widget for libSIDPlay2 */ |
964 c = xs_curve_new(); | 974 tmpCurve = xs_curve_new(); |
965 xs_curve_reset(XS_CURVE(c)); | 975 xs_curve_reset(XS_CURVE(tmpCurve)); |
966 xs_curve_set_range(XS_CURVE(c), | 976 xs_curve_set_range(XS_CURVE(tmpCurve), |
967 0,0, XS_SIDPLAY2_NFPOINTS, XS_SIDPLAY2_FMAX); | 977 0,0, XS_SIDPLAY2_NFPOINTS, XS_SIDPLAY2_FMAX); |
968 xs_curve_set_points(XS_CURVE(c), | 978 |
979 xs_curve_set_points(XS_CURVE(tmpCurve), | |
969 xs_cfg.sid2Filter.points, xs_cfg.sid2Filter.npoints); | 980 xs_cfg.sid2Filter.points, xs_cfg.sid2Filter.npoints); |
970 | 981 |
971 gtk_widget_set_name(c, "cfg_sp2_filter_curve"); | 982 gtk_widget_set_name(tmpCurve, "cfg_sp2_filter_curve"); |
972 gtk_widget_ref(c); | 983 gtk_widget_ref(tmpCurve); |
973 gtk_object_set_data_full(GTK_OBJECT(xs_configwin), | 984 gtk_object_set_data_full(GTK_OBJECT(xs_configwin), |
974 "cfg_sp2_filter_curve", c, (GtkDestroyNotify) gtk_widget_unref); | 985 "cfg_sp2_filter_curve", tmpCurve, (GtkDestroyNotify) gtk_widget_unref); |
975 gtk_widget_show(c); | 986 gtk_widget_show(tmpCurve); |
976 gtk_container_add(GTK_CONTAINER(LUW("cfg_sp2_filter_frame")), c); | 987 gtk_container_add(GTK_CONTAINER(LUW("cfg_sp2_filter_frame")), tmpCurve); |
977 | 988 |
978 | 989 |
979 /* Based on available optional parts, gray out options */ | 990 /* Based on available optional parts, gray out options */ |
980 #ifndef HAVE_SIDPLAY1 | 991 #ifndef HAVE_SIDPLAY1 |
981 gtk_widget_set_sensitive(LUW("cfg_emu_sidplay1"), FALSE); | 992 gtk_widget_set_sensitive(LUW("cfg_emu_sidplay1"), FALSE); |