|
|
| version 1.2, 2004/08/14 03:18:20 | version 1.6, 2011/01/15 18:43:13 |
|---|---|
| Line 1 | Line 1 |
| /* $Id$ */ | |
| /* | /* |
| * Copyright (c) 2004 NONAKA Kimihiro | * Copyright (c) 2004 NONAKA Kimihiro |
| * All rights reserved. | * All rights reserved. |
| Line 12 | Line 10 |
| * 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 35 | Line 31 |
| #include "np2.h" | #include "np2.h" |
| #include "dosio.h" | #include "dosio.h" |
| #include "ini.h" | #include "ini.h" |
| #include "pccore.h" | |
| #include "fddfile.h" | #include "fddfile.h" |
| #include "newdisk.h" | #include "newdisk.h" |
| Line 44 | Line 41 |
| * create hard disk image | * create hard disk image |
| */ | */ |
| static const OEMCHAR *str_hddsize = OEMTEXT(" HDD Size"); | |
| static gint | static gint |
| anex_newdisk_dialog(GtkWidget *dialog) | anex_newdisk_dialog(GtkWidget *dialog) |
| { | { |
| Line 54 anex_newdisk_dialog(GtkWidget *dialog) | Line 53 anex_newdisk_dialog(GtkWidget *dialog) |
| char buf[32]; | char buf[32]; |
| GtkWidget *dialog_table; | GtkWidget *dialog_table; |
| GtkWidget *button[NELEMENTS(hddsize)]; | GtkWidget *button[NELEMENTS(hddsize)]; |
| GtkWidget *label; | |
| int i; | int i; |
| /* dialog table */ | /* dialog table */ |
| dialog_table = gtk_table_new(3, 2, FALSE); | dialog_table = gtk_table_new(4, 2, FALSE); |
| gtk_table_set_col_spacings(GTK_TABLE(dialog_table), 5); | gtk_table_set_col_spacings(GTK_TABLE(dialog_table), 5); |
| gtk_container_add(GTK_CONTAINER(GTK_DIALOG(dialog)->vbox),dialog_table); | gtk_container_add(GTK_CONTAINER(GTK_DIALOG(dialog)->vbox),dialog_table); |
| gtk_widget_show(dialog_table); | gtk_widget_show(dialog_table); |
| /* HD size radio button */ | /* "HDD Size" label */ |
| label = gtk_label_new(str_hddsize); | |
| gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5); | |
| gtk_table_attach(GTK_TABLE(dialog_table), label, 0, 1, 0, 1, | |
| GTK_FILL|GTK_SHRINK, GTK_FILL|GTK_SHRINK, | |
| 0, 5); | |
| gtk_widget_show(label); | |
| /* HDD Size radio button */ | |
| for (i = 0; i < NELEMENTS(hddsize); ++i) { | for (i = 0; i < NELEMENTS(hddsize); ++i) { |
| g_snprintf(buf, sizeof(buf), "%dMB", hddsize[i]); | g_snprintf(buf, sizeof(buf), "%dMB", hddsize[i]); |
| button[i] = gtk_radio_button_new_with_label_from_widget( | button[i] = gtk_radio_button_new_with_label_from_widget( |
| (i > 0) ? GTK_RADIO_BUTTON(button[i-1]) : NULL, buf); | (i > 0) ? GTK_RADIO_BUTTON(button[i-1]) : NULL, buf); |
| gtk_widget_show(button[i]); | gtk_widget_show(button[i]); |
| gtk_table_attach_defaults(GTK_TABLE(dialog_table), | gtk_table_attach_defaults(GTK_TABLE(dialog_table), |
| button[i], i % 2, (i % 2) + 1, i / 2, (i / 2) + 1); | button[i], i % 2, (i % 2) + 1, (i / 2) + 1, (i / 2) + 2); |
| GTK_WIDGET_UNSET_FLAGS(button[i], GTK_CAN_FOCUS); | gtk_widget_set_can_focus(button[i], FALSE); |
| } | } |
| if (last >= NELEMENTS(hddsize)) { | if (last >= NELEMENTS(hddsize)) { |
| last = 0; | last = 0; |
| Line 130 t98_newdisk_dialog(GtkWidget *dialog, co | Line 138 t98_newdisk_dialog(GtkWidget *dialog, co |
| gtk_widget_show(dialog_table); | gtk_widget_show(dialog_table); |
| /* "HDD Size" label */ | /* "HDD Size" label */ |
| label = gtk_label_new(" HDD Size"); | label = gtk_label_new(str_hddsize); |
| gtk_misc_set_alignment(GTK_MISC(label), 0.5, 0.5); | gtk_misc_set_alignment(GTK_MISC(label), 0.5, 0.5); |
| gtk_table_attach_defaults(GTK_TABLE(dialog_table), label, 0, 1, 0, 1); | gtk_table_attach_defaults(GTK_TABLE(dialog_table), label, 0, 1, 0, 1); |
| gtk_widget_show(label); | gtk_widget_show(label); |
| Line 256 create_newdisk_fd_dialog(const char *fil | Line 264 create_newdisk_fd_dialog(const char *fil |
| GtkWidget *hbox; | GtkWidget *hbox; |
| GtkWidget *button[NELEMENTS(disktype)]; | GtkWidget *button[NELEMENTS(disktype)]; |
| const gchar *p; | const gchar *p; |
| int ndisktype; | |
| int i; | int i; |
| ndisktype = NELEMENTS(disktype); | |
| if (!np2cfg.usefd144) { | |
| ndisktype--; | |
| } | |
| dialog = gtk_dialog_new_with_buttons("Create new floppy disk image", | dialog = gtk_dialog_new_with_buttons("Create new floppy disk image", |
| GTK_WINDOW(main_window), | GTK_WINDOW(main_window), |
| GTK_DIALOG_DESTROY_WITH_PARENT|GTK_DIALOG_MODAL, | GTK_DIALOG_DESTROY_WITH_PARENT|GTK_DIALOG_MODAL, |
| Line 300 create_newdisk_fd_dialog(const char *fil | Line 314 create_newdisk_fd_dialog(const char *fil |
| hbox = gtk_hbox_new(FALSE, 3); | hbox = gtk_hbox_new(FALSE, 3); |
| gtk_table_attach_defaults(GTK_TABLE(dialog_table), hbox, 1, 2, 1, 2); | gtk_table_attach_defaults(GTK_TABLE(dialog_table), hbox, 1, 2, 1, 2); |
| gtk_widget_show(hbox); | gtk_widget_show(hbox); |
| for (i = 0; i < NELEMENTS(disktype); ++i) { | for (i = 0; i < ndisktype; ++i) { |
| button[i] = gtk_radio_button_new_with_label_from_widget( | button[i] = gtk_radio_button_new_with_label_from_widget( |
| (i > 0) ? GTK_RADIO_BUTTON(button[i-1]) : NULL, | (i > 0) ? GTK_RADIO_BUTTON(button[i-1]) : NULL, |
| disktype[i].str); | disktype[i].str); |
| gtk_widget_show(button[i]); | gtk_widget_show(button[i]); |
| gtk_box_pack_start(GTK_BOX(hbox), button[i], FALSE, FALSE, 1); | gtk_box_pack_start(GTK_BOX(hbox), button[i], FALSE, FALSE, 1); |
| GTK_WIDGET_UNSET_FLAGS(button[i], GTK_CAN_FOCUS); | gtk_widget_set_can_focus(button[i], FALSE); |
| } | } |
| for (i = 0; i < NELEMENTS(disktype); ++i) { | for (i = 0; i < ndisktype; ++i) { |
| if (disktype[i].fdtype == makefdtype) | if (disktype[i].fdtype == makefdtype) |
| break; | break; |
| } | } |
| if (i == NELEMENTS(disktype)) { | if (i == ndisktype) { |
| i = (i <= 1) ? 0 : 1; /* 2HD */ | i = (i <= 1) ? 0 : 1; /* 2HD */ |
| } | } |
| g_signal_emit_by_name(GTK_OBJECT(button[i]), "clicked"); | g_signal_emit_by_name(GTK_OBJECT(button[i]), "clicked"); |