| version 1.3, 2004/08/14 03:12:51 | version 1.10, 2011/01/15 16:55:37 | 
| Line 12 | Line 12 | 
 | * 2. Redistributions in binary form must reproduce the above copyright | * 2. Redistributions in binary form must reproduce the above copyright | 
 | *    notice, this list of conditions and the following disclaimer in the | *    notice, this list of conditions and the following disclaimer in the | 
 | *    documentation and/or other materials provided with the distribution. | *    documentation and/or other materials provided with the distribution. | 
 | * 3. The name of the author may not be used to endorse or promote products |  | 
 | *    derived from this software without specific prior written permission. |  | 
 | * | * | 
 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR | 
 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES | 
| Line 67  static const struct { | Line 65  static const struct { | 
 | static GtkWidget *baseclock_entry; | static GtkWidget *baseclock_entry; | 
 | static GtkWidget *clockmult_entry; | static GtkWidget *clockmult_entry; | 
 | static GtkWidget *buffer_entry; | static GtkWidget *buffer_entry; | 
 |  | #if defined(SUPPORT_RESUME) | 
 | static GtkWidget *resume_checkbutton; | static GtkWidget *resume_checkbutton; | 
 |  | #endif | 
 | #if defined(GCC_CPU_ARCH_IA32) | #if defined(GCC_CPU_ARCH_IA32) | 
 | static GtkWidget *disablemmx_checkbutton; | static GtkWidget *disablemmx_checkbutton; | 
 | #endif | #endif | 
| Line 81  ok_button_clicked(GtkButton *b, gpointer | Line 81  ok_button_clicked(GtkButton *b, gpointer | 
 | const gchar *bufp = gtk_entry_get_text(GTK_ENTRY(buffer_entry)); | const gchar *bufp = gtk_entry_get_text(GTK_ENTRY(buffer_entry)); | 
 | const gchar *base = gtk_entry_get_text(GTK_ENTRY(baseclock_entry)); | const gchar *base = gtk_entry_get_text(GTK_ENTRY(baseclock_entry)); | 
 | const gchar *multp = gtk_entry_get_text(GTK_ENTRY(clockmult_entry)); | const gchar *multp = gtk_entry_get_text(GTK_ENTRY(clockmult_entry)); | 
 |  | #if defined(SUPPORT_RESUME) | 
 | gint resume = GTK_TOGGLE_BUTTON(resume_checkbutton)->active; | gint resume = GTK_TOGGLE_BUTTON(resume_checkbutton)->active; | 
 |  | #endif | 
 | #if defined(GCC_CPU_ARCH_IA32) | #if defined(GCC_CPU_ARCH_IA32) | 
 | gint disablemmx = GTK_TOGGLE_BUTTON(disablemmx_checkbutton)->active; | gint disablemmx = GTK_TOGGLE_BUTTON(disablemmx_checkbutton)->active; | 
 | #endif | #endif | 
| Line 90  ok_button_clicked(GtkButton *b, gpointer | Line 92  ok_button_clicked(GtkButton *b, gpointer | 
 | UINT renewal = 0; | UINT renewal = 0; | 
 | int i; | int i; | 
 |  |  | 
 | UNUSED(b); |  | 
 |  |  | 
 | if (strcmp(base, "1.9968MHz") == 0) { | if (strcmp(base, "1.9968MHz") == 0) { | 
 | if (np2cfg.baseclock != PCBASECLOCK20) { | if (np2cfg.baseclock != PCBASECLOCK20) { | 
 | np2cfg.baseclock = PCBASECLOCK20; | np2cfg.baseclock = PCBASECLOCK20; | 
| Line 162  ok_button_clicked(GtkButton *b, gpointer | Line 162  ok_button_clicked(GtkButton *b, gpointer | 
 | } | } | 
 | #endif | #endif | 
 |  |  | 
 |  | #if defined(SUPPORT_RESUME) | 
 | if (np2oscfg.resume != resume) { | if (np2oscfg.resume != resume) { | 
 | np2oscfg.resume = resume; | np2oscfg.resume = resume; | 
 | renewal |= SYS_UPDATEOSCFG; | renewal |= SYS_UPDATEOSCFG; | 
 | } | } | 
 |  | #endif | 
 |  |  | 
 | if (renewal) { | if (renewal) { | 
 | sysmng_update(renewal); | sysmng_update(renewal); | 
| Line 178  static void | Line 180  static void | 
 | dialog_destroy(GtkWidget *w, GtkWidget **wp) | dialog_destroy(GtkWidget *w, GtkWidget **wp) | 
 | { | { | 
 |  |  | 
 | UNUSED(wp); |  | 
 |  |  | 
 | install_idle_process(); | install_idle_process(); | 
 | gtk_widget_destroy(w); | gtk_widget_destroy(w); | 
 | } | } | 
| Line 188  static void | Line 188  static void | 
 | arch_radiobutton_clicked(GtkButton *b, gpointer d) | arch_radiobutton_clicked(GtkButton *b, gpointer d) | 
 | { | { | 
 |  |  | 
 | UNUSED(b); |  | 
 |  |  | 
 | arch = (char *)d; | arch = (char *)d; | 
 | } | } | 
 |  |  | 
| Line 197  static void | Line 195  static void | 
 | rate_radiobutton_clicked(GtkButton *b, gpointer d) | rate_radiobutton_clicked(GtkButton *b, gpointer d) | 
 | { | { | 
 |  |  | 
 | UNUSED(b); |  | 
 |  |  | 
 | rate = GPOINTER_TO_INT(d); | rate = GPOINTER_TO_INT(d); | 
 | } | } | 
 |  |  | 
| Line 209  clock_changed(GtkEditable *e, gpointer d | Line 205  clock_changed(GtkEditable *e, gpointer d | 
 | const gchar *multp = gtk_entry_get_text(GTK_ENTRY(clockmult_entry)); | const gchar *multp = gtk_entry_get_text(GTK_ENTRY(clockmult_entry)); | 
 | guint mult = milstr_solveINT(multp); | guint mult = milstr_solveINT(multp); | 
 | gchar buf[80]; | gchar buf[80]; | 
| gint clock; | gint clk; | 
|  |  | 
| UNUSED(e); |  | 
 |  |  | 
 | if (base[0] == '1') { | if (base[0] == '1') { | 
| clock = PCBASECLOCK20 * mult; | clk = PCBASECLOCK20 * mult; | 
 | } else { | } else { | 
| clock = PCBASECLOCK25 * mult; | clk = PCBASECLOCK25 * mult; | 
 | } | } | 
| g_snprintf(buf, sizeof(buf), "%2d.%04dMHz", | g_snprintf(buf, sizeof(buf), "%2d.%03dMHz", | 
| clock / 1000000U, (clock / 1000) % 1000); | clk / 1000000U, (clk / 1000) % 1000); | 
 | gtk_label_set_text(GTK_LABEL((GtkWidget*)d), buf); | gtk_label_set_text(GTK_LABEL((GtkWidget*)d), buf); | 
 | } | } | 
 |  |  | 
| Line 263  create_configure_dialog(void) | Line 257  create_configure_dialog(void) | 
 | gtk_container_set_border_width(GTK_CONTAINER(config_dialog), 5); | gtk_container_set_border_width(GTK_CONTAINER(config_dialog), 5); | 
 |  |  | 
 | g_signal_connect(GTK_OBJECT(config_dialog), "destroy", | g_signal_connect(GTK_OBJECT(config_dialog), "destroy", | 
| GTK_SIGNAL_FUNC(dialog_destroy), NULL); | G_CALLBACK(dialog_destroy), NULL); | 
 |  |  | 
 | main_widget = gtk_vbox_new(FALSE, 0); | main_widget = gtk_vbox_new(FALSE, 0); | 
 | gtk_widget_show(main_widget); | gtk_widget_show(main_widget); | 
| Line 351  create_configure_dialog(void) | Line 345  create_configure_dialog(void) | 
 | gtk_misc_set_alignment(GTK_MISC(realclock_label), 1.0, 0.5); | gtk_misc_set_alignment(GTK_MISC(realclock_label), 1.0, 0.5); | 
 |  |  | 
 | g_signal_connect(GTK_OBJECT(baseclock_entry), "changed", | g_signal_connect(GTK_OBJECT(baseclock_entry), "changed", | 
| GTK_SIGNAL_FUNC(clock_changed), (gpointer)realclock_label); | G_CALLBACK(clock_changed), (gpointer)realclock_label); | 
 | g_signal_connect(GTK_OBJECT(clockmult_entry), "changed", | g_signal_connect(GTK_OBJECT(clockmult_entry), "changed", | 
| GTK_SIGNAL_FUNC(clock_changed), (gpointer)realclock_label); | G_CALLBACK(clock_changed), (gpointer)realclock_label); | 
 | clock_changed(NULL, realclock_label); | clock_changed(NULL, realclock_label); | 
 |  |  | 
 | /* OK, Cancel button base widget */ | /* OK, Cancel button base widget */ | 
| Line 379  create_configure_dialog(void) | Line 373  create_configure_dialog(void) | 
 | arch_radiobutton[i] = gtk_radio_button_new_with_label_from_widget(i > 0 ? GTK_RADIO_BUTTON(arch_radiobutton[i-1]) : NULL, architecture[i].label); | arch_radiobutton[i] = gtk_radio_button_new_with_label_from_widget(i > 0 ? GTK_RADIO_BUTTON(arch_radiobutton[i-1]) : NULL, architecture[i].label); | 
 | gtk_widget_show(arch_radiobutton[i]); | gtk_widget_show(arch_radiobutton[i]); | 
 | gtk_box_pack_start(GTK_BOX(arch_hbox), arch_radiobutton[i], FALSE, FALSE, 0); | gtk_box_pack_start(GTK_BOX(arch_hbox), arch_radiobutton[i], FALSE, FALSE, 0); | 
| GTK_WIDGET_UNSET_FLAGS(arch_radiobutton[i], GTK_CAN_FOCUS); | gtk_widget_set_can_focus(arch_radiobutton[i], FALSE); | 
 | g_signal_connect(GTK_OBJECT(arch_radiobutton[i]), "clicked", | g_signal_connect(GTK_OBJECT(arch_radiobutton[i]), "clicked", | 
| GTK_SIGNAL_FUNC(arch_radiobutton_clicked), (gpointer)architecture[i].arch); | G_CALLBACK(arch_radiobutton_clicked), (gpointer)architecture[i].arch); | 
 | } | } | 
 | for (i = 0; i < NELEMENTS(architecture); i++) { | for (i = 0; i < NELEMENTS(architecture); i++) { | 
 | if (strcmp(np2cfg.model, architecture[i].arch) == 0) { | if (strcmp(np2cfg.model, architecture[i].arch) == 0) { | 
| Line 421  create_configure_dialog(void) | Line 415  create_configure_dialog(void) | 
 | rate_radiobutton[i] = gtk_radio_button_new_with_label_from_widget((i > 0) ? GTK_RADIO_BUTTON(rate_radiobutton[i-1]) : NULL, samplingrate[i].label); | rate_radiobutton[i] = gtk_radio_button_new_with_label_from_widget((i > 0) ? GTK_RADIO_BUTTON(rate_radiobutton[i-1]) : NULL, samplingrate[i].label); | 
 | gtk_widget_show(rate_radiobutton[i]); | gtk_widget_show(rate_radiobutton[i]); | 
 | gtk_box_pack_start(GTK_BOX(soundrate_hbox), rate_radiobutton[i], FALSE, FALSE, 0); | gtk_box_pack_start(GTK_BOX(soundrate_hbox), rate_radiobutton[i], FALSE, FALSE, 0); | 
| GTK_WIDGET_UNSET_FLAGS(rate_radiobutton[i], GTK_CAN_FOCUS); | gtk_widget_set_can_focus(rate_radiobutton[i], FALSE); | 
 | g_signal_connect(GTK_OBJECT(rate_radiobutton[i]), "clicked", | g_signal_connect(GTK_OBJECT(rate_radiobutton[i]), "clicked", | 
| GTK_SIGNAL_FUNC(rate_radiobutton_clicked), GINT_TO_POINTER(samplingrate[i].rate)); | G_CALLBACK(rate_radiobutton_clicked), GINT_TO_POINTER(samplingrate[i].rate)); | 
 | } | } | 
 | if (np2cfg.samplingrate == 11025) { | if (np2cfg.samplingrate == 11025) { | 
 | i = 0; | i = 0; | 
| Line 457  create_configure_dialog(void) | Line 451  create_configure_dialog(void) | 
 | g_snprintf(buf, sizeof(buf), "%d", np2cfg.delayms); | g_snprintf(buf, sizeof(buf), "%d", np2cfg.delayms); | 
 | gtk_entry_set_text(GTK_ENTRY(buffer_entry), buf); | gtk_entry_set_text(GTK_ENTRY(buffer_entry), buf); | 
 | } else { | } else { | 
| gtk_entry_set_text(GTK_ENTRY(buffer_entry), "800"); | gtk_entry_set_text(GTK_ENTRY(buffer_entry), "500"); | 
| np2cfg.delayms = 800; | np2cfg.delayms = 500; | 
 | sysmng_update(SYS_UPDATECFG|SYS_UPDATESBUF); | sysmng_update(SYS_UPDATECFG|SYS_UPDATESBUF); | 
 | soundrenewal = 1; | soundrenewal = 1; | 
 | } | } | 
| Line 467  create_configure_dialog(void) | Line 461  create_configure_dialog(void) | 
 | gtk_widget_show(ms_label); | gtk_widget_show(ms_label); | 
 | gtk_box_pack_start(GTK_BOX(soundbuffer_hbox),ms_label, FALSE, FALSE, 0); | gtk_box_pack_start(GTK_BOX(soundbuffer_hbox),ms_label, FALSE, FALSE, 0); | 
 |  |  | 
 |  | #if defined(SUPPORT_RESUME) | 
 | /* resume */ | /* resume */ | 
 | resume_checkbutton = gtk_check_button_new_with_label("Resume"); | resume_checkbutton = gtk_check_button_new_with_label("Resume"); | 
 | gtk_widget_show(resume_checkbutton); | gtk_widget_show(resume_checkbutton); | 
| Line 474  create_configure_dialog(void) | Line 469  create_configure_dialog(void) | 
 | if (np2oscfg.resume) { | if (np2oscfg.resume) { | 
 | g_signal_emit_by_name(GTK_OBJECT(resume_checkbutton), "clicked"); | g_signal_emit_by_name(GTK_OBJECT(resume_checkbutton), "clicked"); | 
 | } | } | 
 | #if defined(CPUCORE_IA32) |  | 
 | gtk_widget_set_sensitive(resume_checkbutton, FALSE); |  | 
 | #endif | #endif | 
 |  |  | 
 | #if defined(GCC_CPU_ARCH_IA32) | #if defined(GCC_CPU_ARCH_IA32) | 
| Line 496  create_configure_dialog(void) | Line 489  create_configure_dialog(void) | 
 | ok_button = gtk_button_new_from_stock(GTK_STOCK_OK); | ok_button = gtk_button_new_from_stock(GTK_STOCK_OK); | 
 | gtk_widget_show(ok_button); | gtk_widget_show(ok_button); | 
 | gtk_container_add(GTK_CONTAINER(confirm_widget), ok_button); | gtk_container_add(GTK_CONTAINER(confirm_widget), ok_button); | 
| GTK_WIDGET_SET_FLAGS(ok_button, GTK_CAN_DEFAULT); | gtk_widget_set_can_default(ok_button, TRUE); | 
| GTK_WIDGET_SET_FLAGS(ok_button, GTK_HAS_DEFAULT); | gtk_widget_has_default(ok_button); | 
 | g_signal_connect(GTK_OBJECT(ok_button), "clicked", | g_signal_connect(GTK_OBJECT(ok_button), "clicked", | 
| GTK_SIGNAL_FUNC(ok_button_clicked), (gpointer)config_dialog); | G_CALLBACK(ok_button_clicked), (gpointer)config_dialog); | 
 | gtk_widget_grab_default(ok_button); | gtk_widget_grab_default(ok_button); | 
 |  |  | 
 | cancel_button = gtk_button_new_from_stock(GTK_STOCK_CANCEL); | cancel_button = gtk_button_new_from_stock(GTK_STOCK_CANCEL); | 
 | gtk_widget_show(cancel_button); | gtk_widget_show(cancel_button); | 
 | gtk_container_add(GTK_CONTAINER(confirm_widget), cancel_button); | gtk_container_add(GTK_CONTAINER(confirm_widget), cancel_button); | 
| GTK_WIDGET_SET_FLAGS(cancel_button, GTK_CAN_DEFAULT); | gtk_widget_set_can_default(cancel_button, TRUE); | 
 | g_signal_connect_swapped(GTK_OBJECT(cancel_button), "clicked", | g_signal_connect_swapped(GTK_OBJECT(cancel_button), "clicked", | 
| GTK_SIGNAL_FUNC(gtk_widget_destroy), GTK_OBJECT(config_dialog)); | G_CALLBACK(gtk_widget_destroy), GTK_OBJECT(config_dialog)); | 
 |  |  | 
 | gtk_widget_show_all(config_dialog); | gtk_widget_show_all(config_dialog); | 
 | } | } |