Mercurial > hg > xmms-sid
comparison src/xs_config.c @ 589:a437571d0fc5
Work on GUI and filter config code.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Thu, 22 Mar 2007 15:55:02 +0000 |
parents | f63a50ec456c |
children | 7d94e9e5dfb7 |
comparison
equal
deleted
inserted
replaced
588:15d511ab290a | 589:a437571d0fc5 |
---|---|
52 #define XS_CFG_GET_FLOAT xmms_cfg_read_float | 52 #define XS_CFG_GET_FLOAT xmms_cfg_read_float |
53 #define XS_CFG_GET_INT xmms_cfg_read_int | 53 #define XS_CFG_GET_INT xmms_cfg_read_int |
54 #define XS_CFG_GET_BOOL xmms_cfg_read_boolean | 54 #define XS_CFG_GET_BOOL xmms_cfg_read_boolean |
55 #endif | 55 #endif |
56 #include <stdio.h> | 56 #include <stdio.h> |
57 #include <ctype.h> | |
57 #include "xs_glade.h" | 58 #include "xs_glade.h" |
58 #include "xs_interface.h" | 59 #include "xs_interface.h" |
59 #include "xs_support.h" | 60 #include "xs_support.h" |
60 | 61 |
61 | 62 |
63 * Global widgets | 64 * Global widgets |
64 */ | 65 */ |
65 static GtkWidget *xs_configwin = NULL, | 66 static GtkWidget *xs_configwin = NULL, |
66 *xs_sldb_fileselector = NULL, | 67 *xs_sldb_fileselector = NULL, |
67 *xs_stil_fileselector = NULL, | 68 *xs_stil_fileselector = NULL, |
68 *xs_hvsc_pathselector = NULL; | 69 *xs_hvsc_selector = NULL, |
70 *xs_filt_importselector = NULL, | |
71 *xs_filt_exportselector = NULL; | |
69 | 72 |
70 #define LUW(x) lookup_widget(xs_configwin, x) | 73 #define LUW(x) lookup_widget(xs_configwin, x) |
74 | |
75 #define XS_DEF_WINDOW_DELETE(ME, MV) \ | |
76 gboolean xs_ ## ME ## _delete(GtkWidget * w, GdkEvent * e, gpointer d) { \ | |
77 (void) w; (void) e; (void) d; \ | |
78 if (xs_ ## MV ) { gtk_widget_destroy(xs_ ## MV ); xs_ ## MV = NULL; } \ | |
79 return FALSE; \ | |
80 } | |
81 | |
71 | 82 |
72 | 83 |
73 /* | 84 /* |
74 * Configuration specific stuff | 85 * Configuration specific stuff |
75 */ | 86 */ |
370 * filter settings to/from SIDPlay2 INI-type files. | 381 * filter settings to/from SIDPlay2 INI-type files. |
371 */ | 382 */ |
372 static gboolean xs_filters_import(gchar *pcFilename, t_xs_sid2_filter **pFilters, gint *nFilters) | 383 static gboolean xs_filters_import(gchar *pcFilename, t_xs_sid2_filter **pFilters, gint *nFilters) |
373 { | 384 { |
374 FILE *inFile; | 385 FILE *inFile; |
386 gchar inLine[XS_BUF_SIZE]; | |
387 size_t lineNum; | |
375 t_xs_sid2_filter *f; | 388 t_xs_sid2_filter *f; |
376 | 389 |
377 if ((inFile = fopen(pcFilename, "rb")) == NULL) | 390 if ((inFile = fopen(pcFilename, "ra")) == NULL) |
378 return FALSE; | 391 return FALSE; |
379 | 392 |
380 | 393 lineNum = 0; |
394 while (fgets(inLine, XS_BUF_SIZE, inFile) != NULL) { | |
395 size_t linePos = 0; | |
396 lineNum++; | |
397 | |
398 xs_findnext(inLine, &linePos); | |
399 fprintf(stderr, ":'%s'\n", &inLine[linePos]); | |
400 if (isalpha(inLine[linePos])) { | |
401 /* A new key/value pair */ | |
402 | |
403 } else if (inLine[linePos] == '[') { | |
404 /* New filter(?) section starts */ | |
405 | |
406 } else if ((inLine[linePos] != ';') && (inLine[linePos] != 0)) { | |
407 /* Syntax error */ | |
408 return FALSE; | |
409 } | |
410 } | |
381 | 411 |
382 fclose(inFile); | 412 fclose(inFile); |
383 return FALSE; | 413 return FALSE; |
384 } | 414 } |
385 | 415 |
389 FILE *outFile; | 419 FILE *outFile; |
390 t_xs_sid2_filter *f = pFilters; | 420 t_xs_sid2_filter *f = pFilters; |
391 gint n; | 421 gint n; |
392 | 422 |
393 /* Open/create the file */ | 423 /* Open/create the file */ |
394 if ((outFile = fopen(pcFilename, "wb")) == NULL) | 424 if ((outFile = fopen(pcFilename, "wa")) == NULL) |
395 return FALSE; | 425 return FALSE; |
396 | 426 |
397 /* Write each filter spec in "INI"-style format */ | 427 /* Write each filter spec in "INI"-style format */ |
398 for (n = 0; n < nFilters; n++) { | 428 for (n = 0; n < nFilters; n++) { |
399 gint i; | 429 gint i; |
639 } | 669 } |
640 | 670 |
641 | 671 |
642 /* HVSC songlength-database file selector response-functions | 672 /* HVSC songlength-database file selector response-functions |
643 */ | 673 */ |
644 void xs_cfg_sld_dbbrowse(GtkButton * button, gpointer user_data) | 674 void xs_cfg_sldb_browse(GtkButton * button, gpointer user_data) |
645 { | 675 { |
646 (void) button; | 676 (void) button; |
647 (void) user_data; | 677 (void) user_data; |
648 | 678 |
649 if (xs_sldb_fileselector != NULL) { | 679 if (xs_sldb_fileselector != NULL) { |
650 gdk_window_raise(xs_sldb_fileselector->window); | 680 gdk_window_raise(xs_sldb_fileselector->window); |
651 return; | 681 return; |
652 } | 682 } |
653 | 683 |
654 xs_sldb_fileselector = create_xs_sldbfileselector(); | 684 xs_sldb_fileselector = create_xs_sldb_fs(); |
655 XS_MUTEX_LOCK(xs_cfg); | 685 XS_MUTEX_LOCK(xs_cfg); |
656 gtk_file_selection_set_filename(GTK_FILE_SELECTION(xs_sldb_fileselector), xs_cfg.songlenDBPath); | 686 gtk_file_selection_set_filename(GTK_FILE_SELECTION(xs_sldb_fileselector), xs_cfg.songlenDBPath); |
657 XS_MUTEX_UNLOCK(xs_cfg); | 687 XS_MUTEX_UNLOCK(xs_cfg); |
658 gtk_widget_show(xs_sldb_fileselector); | 688 gtk_widget_show(xs_sldb_fileselector); |
659 } | 689 } |
660 | 690 |
661 | 691 |
662 void xs_cfg_sldb_fs_ok(GtkButton *button, gpointer user_data) | 692 void xs_sldb_fs_ok(GtkButton *button, gpointer user_data) |
663 { | 693 { |
664 (void) button; | 694 (void) button; |
665 (void) user_data; | 695 (void) user_data; |
666 | 696 |
667 /* Selection was accepted! */ | 697 /* Selection was accepted! */ |
672 gtk_widget_destroy(xs_sldb_fileselector); | 702 gtk_widget_destroy(xs_sldb_fileselector); |
673 xs_sldb_fileselector = NULL; | 703 xs_sldb_fileselector = NULL; |
674 } | 704 } |
675 | 705 |
676 | 706 |
677 void xs_cfg_sldb_fs_cancel(GtkButton *button, gpointer user_data) | 707 void xs_sldb_fs_cancel(GtkButton *button, gpointer user_data) |
678 { | 708 { |
679 (void) button; | 709 (void) button; |
680 (void) user_data; | 710 (void) user_data; |
711 | |
681 /* Close file selector window */ | 712 /* Close file selector window */ |
682 gtk_widget_destroy(xs_sldb_fileselector); | 713 gtk_widget_destroy(xs_sldb_fileselector); |
683 xs_sldb_fileselector = NULL; | 714 xs_sldb_fileselector = NULL; |
684 } | 715 } |
685 | 716 |
686 | 717 |
718 XS_DEF_WINDOW_DELETE(sldb_fs, sldb_fileselector) | |
719 | |
720 | |
687 /* STIL-database file selector response-functions | 721 /* STIL-database file selector response-functions |
688 */ | 722 */ |
689 void xs_cfg_stil_browse(GtkButton * button, gpointer user_data) | 723 void xs_cfg_stil_browse(GtkButton * button, gpointer user_data) |
690 { | 724 { |
691 (void) button; | 725 (void) button; |
694 if (xs_stil_fileselector != NULL) { | 728 if (xs_stil_fileselector != NULL) { |
695 gdk_window_raise(xs_stil_fileselector->window); | 729 gdk_window_raise(xs_stil_fileselector->window); |
696 return; | 730 return; |
697 } | 731 } |
698 | 732 |
699 xs_stil_fileselector = create_xs_stilfileselector(); | 733 xs_stil_fileselector = create_xs_stil_fs(); |
700 XS_MUTEX_LOCK(xs_cfg); | 734 XS_MUTEX_LOCK(xs_cfg); |
701 gtk_file_selection_set_filename(GTK_FILE_SELECTION(xs_stil_fileselector), xs_cfg.stilDBPath); | 735 gtk_file_selection_set_filename(GTK_FILE_SELECTION(xs_stil_fileselector), xs_cfg.stilDBPath); |
702 XS_MUTEX_UNLOCK(xs_cfg); | 736 XS_MUTEX_UNLOCK(xs_cfg); |
703 gtk_widget_show(xs_stil_fileselector); | 737 gtk_widget_show(xs_stil_fileselector); |
704 } | 738 } |
705 | 739 |
706 | 740 |
707 void xs_cfg_stil_fs_ok(GtkButton *button, gpointer user_data) | 741 void xs_stil_fs_ok(GtkButton *button, gpointer user_data) |
708 { | 742 { |
709 (void) button; | 743 (void) button; |
710 (void) user_data; | 744 (void) user_data; |
711 | 745 |
712 /* Selection was accepted! */ | 746 /* Selection was accepted! */ |
717 gtk_widget_destroy(xs_stil_fileselector); | 751 gtk_widget_destroy(xs_stil_fileselector); |
718 xs_stil_fileselector = NULL; | 752 xs_stil_fileselector = NULL; |
719 } | 753 } |
720 | 754 |
721 | 755 |
722 void xs_cfg_stil_fs_cancel(GtkButton *button, gpointer user_data) | 756 void xs_stil_fs_cancel(GtkButton *button, gpointer user_data) |
723 { | 757 { |
724 (void) button; | 758 (void) button; |
725 (void) user_data; | 759 (void) user_data; |
726 | 760 |
727 /* Close file selector window */ | 761 /* Close file selector window */ |
728 gtk_widget_destroy(xs_stil_fileselector); | 762 gtk_widget_destroy(xs_stil_fileselector); |
729 xs_stil_fileselector = NULL; | 763 xs_stil_fileselector = NULL; |
730 } | 764 } |
731 | 765 |
732 | 766 |
767 XS_DEF_WINDOW_DELETE(stil_fs, stil_fileselector) | |
768 | |
769 | |
733 /* HVSC location selector response-functions | 770 /* HVSC location selector response-functions |
734 */ | 771 */ |
735 void xs_cfg_hvsc_browse(GtkButton * button, gpointer user_data) | 772 void xs_cfg_hvsc_browse(GtkButton * button, gpointer user_data) |
736 { | 773 { |
737 (void) button; | 774 (void) button; |
738 (void) user_data; | 775 (void) user_data; |
739 | 776 |
740 if (xs_hvsc_pathselector != NULL) { | 777 if (xs_hvsc_selector != NULL) { |
741 gdk_window_raise(xs_hvsc_pathselector->window); | 778 gdk_window_raise(xs_hvsc_selector->window); |
742 return; | 779 return; |
743 } | 780 } |
744 | 781 |
745 xs_hvsc_pathselector = create_xs_hvscpathselector(); | 782 xs_hvsc_selector = create_xs_hvsc_fs(); |
746 XS_MUTEX_LOCK(xs_cfg); | 783 XS_MUTEX_LOCK(xs_cfg); |
747 gtk_file_selection_set_filename(GTK_FILE_SELECTION(xs_hvsc_pathselector), xs_cfg.hvscPath); | 784 gtk_file_selection_set_filename(GTK_FILE_SELECTION(xs_hvsc_selector), xs_cfg.hvscPath); |
748 XS_MUTEX_UNLOCK(xs_cfg); | 785 XS_MUTEX_UNLOCK(xs_cfg); |
749 gtk_widget_show(xs_hvsc_pathselector); | 786 gtk_widget_show(xs_hvsc_selector); |
750 } | 787 } |
751 | 788 |
752 | 789 |
753 void xs_cfg_hvsc_fs_ok(GtkButton *button, gpointer user_data) | 790 void xs_hvsc_fs_ok(GtkButton *button, gpointer user_data) |
754 { | 791 { |
755 (void) button; | 792 (void) button; |
756 (void) user_data; | 793 (void) user_data; |
757 | 794 |
758 /* Selection was accepted! */ | 795 /* Selection was accepted! */ |
759 gtk_entry_set_text(GTK_ENTRY(LUW("cfg_hvsc_path")), | 796 gtk_entry_set_text(GTK_ENTRY(LUW("cfg_hvsc_path")), |
760 gtk_file_selection_get_filename(GTK_FILE_SELECTION(xs_hvsc_pathselector))); | 797 gtk_file_selection_get_filename(GTK_FILE_SELECTION(xs_hvsc_selector))); |
761 | 798 |
762 /* Close file selector window */ | 799 /* Close file selector window */ |
763 gtk_widget_destroy(xs_hvsc_pathselector); | 800 gtk_widget_destroy(xs_hvsc_selector); |
764 xs_hvsc_pathselector = NULL; | 801 xs_hvsc_selector = NULL; |
765 } | 802 } |
766 | 803 |
767 | 804 |
768 void xs_cfg_hvsc_fs_cancel(GtkButton *button, gpointer user_data) | 805 void xs_hvsc_fs_cancel(GtkButton *button, gpointer user_data) |
769 { | 806 { |
770 (void) button; | 807 (void) button; |
771 (void) user_data; | 808 (void) user_data; |
772 | 809 |
773 /* Close file selector window */ | 810 /* Close file selector window */ |
774 gtk_widget_destroy(xs_hvsc_pathselector); | 811 gtk_widget_destroy(xs_hvsc_selector); |
775 xs_hvsc_pathselector = NULL; | 812 xs_hvsc_selector = NULL; |
776 } | 813 } |
814 | |
815 | |
816 XS_DEF_WINDOW_DELETE(hvsc_fs, hvsc_selector) | |
777 | 817 |
778 | 818 |
779 /* Filter handling | 819 /* Filter handling |
780 */ | 820 */ |
781 void xs_cfg_sp1_filter_reset(GtkButton * button, gpointer user_data) | 821 void xs_cfg_sp1_filter_reset(GtkButton * button, gpointer user_data) |
787 gtk_adjustment_set_value(gtk_range_get_adjustment(GTK_RANGE(LUW("cfg_sp1_filter_fm"))), XS_SIDPLAY1_FM); | 827 gtk_adjustment_set_value(gtk_range_get_adjustment(GTK_RANGE(LUW("cfg_sp1_filter_fm"))), XS_SIDPLAY1_FM); |
788 gtk_adjustment_set_value(gtk_range_get_adjustment(GTK_RANGE(LUW("cfg_sp1_filter_ft"))), XS_SIDPLAY1_FT); | 828 gtk_adjustment_set_value(gtk_range_get_adjustment(GTK_RANGE(LUW("cfg_sp1_filter_ft"))), XS_SIDPLAY1_FT); |
789 } | 829 } |
790 | 830 |
791 | 831 |
832 void xs_cfg_sp2_filter_update(XSCurve *curve, t_xs_sid2_filter *f) | |
833 { | |
834 assert(curve); | |
835 assert(f); | |
836 | |
837 xs_curve_reset(curve); | |
838 xs_curve_set_range(curve, 0,0, XS_SIDPLAY2_NFPOINTS, XS_SIDPLAY2_FMAX); | |
839 xs_curve_set_points(curve, f->points, f->npoints); | |
840 } | |
841 | |
842 | |
843 void xs_cfg_sp2_presets_update() | |
844 { | |
845 } | |
846 | |
847 | |
792 void xs_cfg_sp2_filter_load(GtkButton *button, gpointer user_data) | 848 void xs_cfg_sp2_filter_load(GtkButton *button, gpointer user_data) |
793 { | 849 { |
794 (void) button; | 850 gchar *tmpStr; |
795 (void) user_data; | 851 gint i, j; |
796 /* | 852 |
797 1) get currently selected item from dropdown | 853 (void) button; |
798 2) set current filter to that | 854 (void) user_data; |
799 */ | 855 |
800 | 856 XS_MUTEX_LOCK(xs_cfg); |
857 | |
858 tmpStr = gtk_entry_get_text(GTK_ENTRY(LUW("cfg_sp2_filter_combo_entry"))); | |
859 for (i = 0, j = -1; i < xs_cfg.sid2NFilterPresets; i++) { | |
860 if (!strcmp(tmpStr, xs_cfg.sid2FilterPresets[i]->name)) { | |
861 j = i; | |
862 break; | |
863 } | |
864 } | |
865 | |
866 if (j != -1) { | |
867 fprintf(stderr, "Updating from '%s'\n", tmpStr); | |
868 xs_cfg_sp2_filter_update( | |
869 XS_CURVE(LUW("cfg_sp2_filter_curve")), | |
870 xs_cfg.sid2FilterPresets[i]); | |
871 } else { | |
872 /* error/warning: no such filter preset */ | |
873 fprintf(stderr, "No such filter preset '%s'!\n", tmpStr); | |
874 } | |
875 | |
876 XS_MUTEX_UNLOCK(xs_cfg); | |
801 } | 877 } |
802 | 878 |
803 | 879 |
804 void xs_cfg_sp2_filter_save(GtkButton *button, gpointer user_data) | 880 void xs_cfg_sp2_filter_save(GtkButton *button, gpointer user_data) |
805 { | 881 { |
806 (void) button; | |
807 (void) user_data; | |
808 /* | 882 /* |
809 1) check if textentry matches any current filter name | 883 1) check if textentry matches any current filter name |
810 yes) ask if saving over ok? | 884 yes) ask if saving over ok? |
811 no) ... | 885 no) ... |
812 | 886 |
813 2) save current filter to the name | 887 2) save current filter to the name |
814 */ | 888 */ |
889 | |
890 gchar *tmpStr; | |
891 gint i, j; | |
892 | |
893 (void) button; | |
894 (void) user_data; | |
895 | |
896 XS_MUTEX_LOCK(xs_cfg); | |
897 | |
898 tmpStr = gtk_entry_get_text(GTK_ENTRY(LUW("cfg_sp2_filter_combo_entry"))); | |
899 for (i = 0, j = -1; i < xs_cfg.sid2NFilterPresets; i++) { | |
900 if (!strcmp(tmpStr, xs_cfg.sid2FilterPresets[i]->name)) { | |
901 j = i; | |
902 break; | |
903 } | |
904 } | |
905 | |
906 if (j != -1) { | |
907 fprintf(stderr, "found, confirm overwrite?\n"); | |
908 } | |
909 | |
910 fprintf(stderr, "saving!\n"); | |
911 | |
912 xs_cfg_sp2_presets_update(); | |
913 | |
914 XS_MUTEX_UNLOCK(xs_cfg); | |
815 } | 915 } |
816 | 916 |
817 | 917 |
818 void xs_cfg_sp2_filter_delete(GtkButton *button, gpointer user_data) | 918 void xs_cfg_sp2_filter_delete(GtkButton *button, gpointer user_data) |
819 { | 919 { |
833 /* | 933 /* |
834 1) file selection dialog | 934 1) file selection dialog |
835 2) import | 935 2) import |
836 3) change name if already existing | 936 3) change name if already existing |
837 */ | 937 */ |
938 | |
939 if (xs_filt_importselector != NULL) { | |
940 gdk_window_raise(xs_filt_importselector->window); | |
941 return; | |
942 } | |
943 | |
944 xs_filt_importselector = create_xs_filter_import_fs(); | |
945 /* | |
946 XS_MUTEX_LOCK(xs_cfg); | |
947 gtk_file_selection_set_filename(GTK_FILE_SELECTION(xs_filt_importselector), "paska"); | |
948 XS_MUTEX_UNLOCK(xs_cfg); | |
949 */ | |
950 gtk_widget_show(xs_filt_importselector); | |
838 } | 951 } |
839 | 952 |
840 | 953 |
841 void xs_cfg_sp2_filter_export(GtkButton *button, gpointer user_data) | 954 void xs_cfg_sp2_filter_export(GtkButton *button, gpointer user_data) |
842 { | 955 { |
851 | 964 |
852 void xs_filter_import_fs_ok(GtkButton *button, gpointer user_data) | 965 void xs_filter_import_fs_ok(GtkButton *button, gpointer user_data) |
853 { | 966 { |
854 (void) button; | 967 (void) button; |
855 (void) user_data; | 968 (void) user_data; |
969 | |
970 xs_cfg_sp2_presets_update(); | |
971 | |
972 /* Close file selector window */ | |
973 gtk_widget_destroy(xs_filt_importselector); | |
974 xs_filt_importselector = NULL; | |
856 } | 975 } |
857 | 976 |
858 | 977 |
859 void xs_filter_import_fs_cancel(GtkButton *button, gpointer user_data) | 978 void xs_filter_import_fs_cancel(GtkButton *button, gpointer user_data) |
860 { | 979 { |
861 (void) button; | 980 (void) button; |
862 (void) user_data; | 981 (void) user_data; |
863 } | 982 |
983 /* Close file selector window */ | |
984 gtk_widget_destroy(xs_filt_importselector); | |
985 xs_filt_importselector = NULL; | |
986 } | |
987 | |
988 | |
989 XS_DEF_WINDOW_DELETE(filter_import_fs, filt_importselector) | |
864 | 990 |
865 | 991 |
866 void xs_filter_export_fs_ok(GtkButton *button, gpointer user_data) | 992 void xs_filter_export_fs_ok(GtkButton *button, gpointer user_data) |
867 { | 993 { |
868 (void) button; | 994 (void) button; |
869 (void) user_data; | 995 (void) user_data; |
996 | |
997 /* Close file selector window */ | |
998 gtk_widget_destroy(xs_filt_exportselector); | |
999 xs_filt_exportselector = NULL; | |
870 } | 1000 } |
871 | 1001 |
872 | 1002 |
873 void xs_filter_export_fs_cancel(GtkButton *button, gpointer user_data) | 1003 void xs_filter_export_fs_cancel(GtkButton *button, gpointer user_data) |
874 { | 1004 { |
875 (void) button; | 1005 (void) button; |
876 (void) user_data; | 1006 (void) user_data; |
877 } | 1007 |
1008 /* Close file selector window */ | |
1009 gtk_widget_destroy(xs_filt_exportselector); | |
1010 xs_filt_exportselector = NULL; | |
1011 } | |
1012 | |
1013 | |
1014 XS_DEF_WINDOW_DELETE(filter_export_fs, filt_exportselector) | |
878 | 1015 |
879 | 1016 |
880 /* Selection toggle handlers | 1017 /* Selection toggle handlers |
881 */ | 1018 */ |
882 void xs_cfg_emu_filters_toggled(GtkToggleButton * togglebutton, gpointer user_data) | 1019 void xs_cfg_emu_filters_toggled(GtkToggleButton * togglebutton, gpointer user_data) |
963 gtk_widget_set_sensitive(LUW("cfg_maxtime_unknown"), isActive); | 1100 gtk_widget_set_sensitive(LUW("cfg_maxtime_unknown"), isActive); |
964 gtk_widget_set_sensitive(LUW("cfg_maxtime_box"), isActive); | 1101 gtk_widget_set_sensitive(LUW("cfg_maxtime_box"), isActive); |
965 } | 1102 } |
966 | 1103 |
967 | 1104 |
968 void xs_cfg_sld_enable_toggled(GtkToggleButton * togglebutton, gpointer user_data) | 1105 void xs_cfg_sldb_enable_toggled(GtkToggleButton * togglebutton, gpointer user_data) |
969 { | 1106 { |
970 gboolean isActive = GTK_TOGGLE_BUTTON(togglebutton)->active; | 1107 gboolean isActive = GTK_TOGGLE_BUTTON(togglebutton)->active; |
971 | 1108 |
972 (void) user_data; | 1109 (void) user_data; |
973 | 1110 |
1038 if (tmpValue < tmpAdj->value) | 1175 if (tmpValue < tmpAdj->value) |
1039 gtk_adjustment_set_value(tmpAdj, tmpValue); | 1176 gtk_adjustment_set_value(tmpAdj, tmpValue); |
1040 } | 1177 } |
1041 | 1178 |
1042 | 1179 |
1043 gboolean xs_configwin_delete(GtkWidget * widget, GdkEvent * event, gpointer user_data) | 1180 XS_DEF_WINDOW_DELETE(configwin, configwin) |
1044 { | |
1045 (void) widget; | |
1046 (void) event; | |
1047 (void) user_data; | |
1048 | |
1049 XSDEBUG("config::delete_event\n"); | |
1050 if (xs_configwin) { | |
1051 gtk_widget_destroy(xs_configwin); | |
1052 xs_configwin = NULL; | |
1053 } | |
1054 return FALSE; | |
1055 } | |
1056 | 1181 |
1057 | 1182 |
1058 /* Execute the configuration panel | 1183 /* Execute the configuration panel |
1059 */ | 1184 */ |
1060 void xs_configure(void) | 1185 void xs_configure(void) |
1075 | 1200 |
1076 /* Get lock on configuration */ | 1201 /* Get lock on configuration */ |
1077 XS_MUTEX_LOCK(xs_cfg); | 1202 XS_MUTEX_LOCK(xs_cfg); |
1078 | 1203 |
1079 /* Create the custom filter curve widget for libSIDPlay2 */ | 1204 /* Create the custom filter curve widget for libSIDPlay2 */ |
1205 xs_cfg_sp2_presets_update(); | |
1080 tmpCurve = xs_curve_new(); | 1206 tmpCurve = xs_curve_new(); |
1081 xs_curve_reset(XS_CURVE(tmpCurve)); | 1207 xs_cfg_sp2_filter_update(XS_CURVE(tmpCurve), &xs_cfg.sid2Filter); |
1082 xs_curve_set_range(XS_CURVE(tmpCurve), | |
1083 0,0, XS_SIDPLAY2_NFPOINTS, XS_SIDPLAY2_FMAX); | |
1084 | |
1085 xs_curve_set_points(XS_CURVE(tmpCurve), | |
1086 xs_cfg.sid2Filter.points, xs_cfg.sid2Filter.npoints); | |
1087 | |
1088 gtk_widget_set_name(tmpCurve, "cfg_sp2_filter_curve"); | 1208 gtk_widget_set_name(tmpCurve, "cfg_sp2_filter_curve"); |
1089 gtk_widget_ref(tmpCurve); | 1209 gtk_widget_ref(tmpCurve); |
1090 gtk_object_set_data_full(GTK_OBJECT(xs_configwin), | 1210 gtk_object_set_data_full(GTK_OBJECT(xs_configwin), |
1091 "cfg_sp2_filter_curve", tmpCurve, (GtkDestroyNotify) gtk_widget_unref); | 1211 "cfg_sp2_filter_curve", tmpCurve, (GtkDestroyNotify) gtk_widget_unref); |
1092 gtk_widget_show(tmpCurve); | 1212 gtk_widget_show(tmpCurve); |
1125 xs_cfg_emu_sidplay1_toggled((GtkToggleButton *) LUW("cfg_emu_sidplay1"), NULL); | 1245 xs_cfg_emu_sidplay1_toggled((GtkToggleButton *) LUW("cfg_emu_sidplay1"), NULL); |
1126 xs_cfg_emu_sidplay2_toggled((GtkToggleButton *) LUW("cfg_emu_sidplay2"), NULL); | 1246 xs_cfg_emu_sidplay2_toggled((GtkToggleButton *) LUW("cfg_emu_sidplay2"), NULL); |
1127 xs_cfg_oversample_toggled((GtkToggleButton *) LUW("cfg_oversample"), NULL); | 1247 xs_cfg_oversample_toggled((GtkToggleButton *) LUW("cfg_oversample"), NULL); |
1128 xs_cfg_mintime_enable_toggled((GtkToggleButton *) LUW("cfg_mintime_enable"), NULL); | 1248 xs_cfg_mintime_enable_toggled((GtkToggleButton *) LUW("cfg_mintime_enable"), NULL); |
1129 xs_cfg_maxtime_enable_toggled((GtkToggleButton *) LUW("cfg_maxtime_enable"), NULL); | 1249 xs_cfg_maxtime_enable_toggled((GtkToggleButton *) LUW("cfg_maxtime_enable"), NULL); |
1130 xs_cfg_sld_enable_toggled((GtkToggleButton *) LUW("cfg_sld_enable"), NULL); | 1250 xs_cfg_sldb_enable_toggled((GtkToggleButton *) LUW("cfg_sld_enable"), NULL); |
1131 xs_cfg_stil_enable_toggled((GtkToggleButton *) LUW("cfg_stil_enable"), NULL); | 1251 xs_cfg_stil_enable_toggled((GtkToggleButton *) LUW("cfg_stil_enable"), NULL); |
1132 xs_cfg_subauto_enable_toggled((GtkToggleButton *) LUW("cfg_subauto_enable"), NULL); | 1252 xs_cfg_subauto_enable_toggled((GtkToggleButton *) LUW("cfg_subauto_enable"), NULL); |
1133 xs_cfg_subauto_min_only_toggled((GtkToggleButton *) LUW("cfg_subauto_min_only"), NULL); | 1253 xs_cfg_subauto_min_only_toggled((GtkToggleButton *) LUW("cfg_subauto_min_only"), NULL); |
1134 | 1254 |
1135 | 1255 |