--- np2/x11/gtk/Attic/gtk_menu.c 2004/07/28 13:53:00 1.9 +++ np2/x11/gtk/Attic/gtk_menu.c 2005/03/12 12:36:40 1.11 @@ -10,8 +10,6 @@ * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * 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 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES @@ -44,6 +42,7 @@ #include "pc9861k.h" #include "s98.h" #include "scrnbmp.h" +#include "sxsi.h" #include "kdispwin.h" #include "toolwin.h" @@ -81,6 +80,10 @@ static void fddopen(GtkMenuItem *, gpoin static void fddeject(GtkMenuItem *, gpointer); static void sasiopen(gpointer, guint, GtkWidget *); static void sasiremove(gpointer, guint, GtkWidget *); +#if defined(SUPPORT_IDEIO) +static void atapiopen(gpointer, guint, GtkWidget *); +static void atapiremove(gpointer, guint, GtkWidget *); +#endif static void change_font(gpointer, guint, GtkWidget *); @@ -223,12 +226,24 @@ static GtkItemFactoryEntry menu_items[] { "/Emulate/E_xit", NULL, f(exit_from_menu), 0, NULL }, { "/FDD", NULL, NULL, 0, "" }, { "/HardDisk", NULL, NULL, 0, "" }, +#if !defined(SUPPORT_IDEIO) { "/HardDisk/SASI-_1", NULL, NULL, 0, "" }, { "/HardDisk/SASI-1/_Open...", NULL, f(sasiopen), 0, NULL }, { "/HardDisk/SASI-1/_Remove", NULL, f(sasiremove), 0, NULL }, { "/HardDisk/SASI-_2", NULL, NULL, 0, "" }, { "/HardDisk/SASI-2/_Open...", NULL, f(sasiopen), 1, NULL }, { "/HardDisk/SASI-2/_Remove", NULL, f(sasiremove), 1, NULL }, +#else +{ "/HardDisk/IDE0-_0", NULL, NULL, 0, "" }, +{ "/HardDisk/IDE0-0/_Open...", NULL, f(sasiopen), 0, NULL }, +{ "/HardDisk/IDE0-0/_Remove", NULL, f(sasiremove), 0, NULL }, +{ "/HardDisk/IDE0-_1", NULL, NULL, 0, "" }, +{ "/HardDisk/IDE0-1/_Open...", NULL, f(sasiopen), 1, NULL }, +{ "/HardDisk/IDE0-1/_Remove", NULL, f(sasiremove), 1, NULL }, +{ "/HardDisk/_CD-ROM", NULL, NULL, 0, "" }, +{ "/HardDisk/CD-ROM/_Open...", NULL, f(atapiopen), 0x02, NULL }, +{ "/HardDisk/CD-ROM/_Remove", NULL, f(atapiremove), 0x02, NULL}, +#endif { "/Screen", NULL, NULL, 0, "" }, { "/Screen/_Window", NULL, NULL, 0, "" }, { "/Screen/_FullScreen", NULL, NULL, 0, "/Screen/Window" }, @@ -803,7 +818,7 @@ fddeject(GtkMenuItem *w, gpointer data) } -/* ----- SASI */ +/* ----- SASI/IDE */ static BOOL sasiopen_dialog_ok_cb(void *arg, const char *path) { @@ -830,7 +845,7 @@ sasiopen(gpointer data, guint action, Gt UNUSED(data); UNUSED(w); - create_file_selection("Open SASI image", hddfolder, (void *)action, + create_file_selection("Open hard disk image", hddfolder, (void *)action, sasiopen_dialog_ok_cb, NULL); } @@ -849,9 +864,52 @@ sasiremove(gpointer data, guint action, } else { diskdrv_sethdd(action, ""); } +} + +#if defined(SUPPORT_IDEIO) +/* ---- ATAPI */ +static BOOL +atapiopen_dialog_ok_cb(void *arg, const char *path) +{ + struct stat sb; + int drive = GPOINTER_TO_UINT(arg); + BOOL result = FALSE; + + if (stat(path, &sb) == 0) { + if (S_ISREG(sb.st_mode) && (sb.st_mode & S_IRUSR)) { + file_cpyname(hddfolder, path, sizeof(hddfolder)); + sxsi_devopen(drive, path); + result = TRUE; + } + } + return result; } +static void +atapiopen(gpointer data, guint action, GtkWidget *w) +{ + + UNUSED(data); + UNUSED(w); + + create_file_selection("Open CD-ROM image", hddfolder, + GUINT_TO_POINTER(action), atapiopen_dialog_ok_cb, NULL); +} + +static void +atapiremove(gpointer data, guint action, GtkWidget *w) +{ + + UNUSED(data); + UNUSED(w); + + if (action == 0x02) { + sxsi_devclose(action); + } +} +#endif + /* ---- font */ static BOOL font_change_dialog_ok_cb(void *arg, const char *path)