mirror of
https://github.com/kanjitalk755/macemu.git
synced 2025-02-20 11:29:01 +00:00
GNOME-style about box and GNOME file entries are used if libgnomeui is present
This commit is contained in:
parent
3c7535d252
commit
7385602242
@ -45,4 +45,3 @@ Unix:
|
|||||||
- ESD is also available on Solaris
|
- ESD is also available on Solaris
|
||||||
- serial_unix.cpp: provide a way to pipe input/output to programs
|
- serial_unix.cpp: provide a way to pipe input/output to programs
|
||||||
- display progress bar during disk file creation in prefs editor
|
- display progress bar during disk file creation in prefs editor
|
||||||
- add file browsing window to "Unix Root", "Keycode Translation File", "ROM File"
|
|
||||||
|
@ -71,6 +71,9 @@
|
|||||||
/* Define if <sys/mman.h> defines MAP_ANONYMOUS and mmap()'ing with MAP_ANONYMOUS works */
|
/* Define if <sys/mman.h> defines MAP_ANONYMOUS and mmap()'ing with MAP_ANONYMOUS works */
|
||||||
#undef HAVE_MMAP_ANONYMOUS
|
#undef HAVE_MMAP_ANONYMOUS
|
||||||
|
|
||||||
|
/* Define if libgnomeui is available */
|
||||||
|
#undef HAVE_GNOMEUI
|
||||||
|
|
||||||
|
|
||||||
/* Leave that blank line there!! Autoheader needs it.
|
/* Leave that blank line there!! Autoheader needs it.
|
||||||
If you're adding to this file, keep in mind:
|
If you're adding to this file, keep in mind:
|
||||||
|
@ -172,10 +172,14 @@ UISRCS=../dummy/prefs_editor_dummy.cpp
|
|||||||
if [[ "x$WANT_GTK" = "xyes" ]]; then
|
if [[ "x$WANT_GTK" = "xyes" ]]; then
|
||||||
AM_PATH_GTK(1.2.0, [
|
AM_PATH_GTK(1.2.0, [
|
||||||
AC_DEFINE(ENABLE_GTK)
|
AC_DEFINE(ENABLE_GTK)
|
||||||
CFLAGS="$CFLAGS $GTK_CFLAGS"
|
|
||||||
CXXFLAGS="$CXXFLAGS $GTK_CFLAGS"
|
CXXFLAGS="$CXXFLAGS $GTK_CFLAGS"
|
||||||
LIBS="$LIBS $GTK_LIBS"
|
LIBS="$LIBS $GTK_LIBS"
|
||||||
UISRCS=prefs_editor_gtk.cpp
|
UISRCS=prefs_editor_gtk.cpp
|
||||||
|
B2_PATH_GNOMEUI([
|
||||||
|
AC_DEFINE(HAVE_GNOMEUI)
|
||||||
|
CXXFLAGS="$CXXFLAGS $GNOMEUI_CFLAGS"
|
||||||
|
LIBS="$LIBS $GNOMEUI_LIBS"
|
||||||
|
], [])
|
||||||
], [
|
], [
|
||||||
AC_MSG_WARN([Could not find GTK+, disabling user interface.])
|
AC_MSG_WARN([Could not find GTK+, disabling user interface.])
|
||||||
WANT_GTK=no
|
WANT_GTK=no
|
||||||
|
@ -51,6 +51,9 @@ struct sigstate {
|
|||||||
#ifdef ENABLE_GTK
|
#ifdef ENABLE_GTK
|
||||||
# include <gtk/gtk.h>
|
# include <gtk/gtk.h>
|
||||||
# include <gdk/gdk.h>
|
# include <gdk/gdk.h>
|
||||||
|
# ifdef HAVE_GNOMEUI
|
||||||
|
# include <gnome.h>
|
||||||
|
# endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef ENABLE_XF86_DGA
|
#ifdef ENABLE_XF86_DGA
|
||||||
@ -222,9 +225,16 @@ int main(int argc, char **argv)
|
|||||||
printf(" %s\n", GetString(STR_ABOUT_TEXT2));
|
printf(" %s\n", GetString(STR_ABOUT_TEXT2));
|
||||||
|
|
||||||
#ifdef ENABLE_GTK
|
#ifdef ENABLE_GTK
|
||||||
|
#ifdef HAVE_GNOMEUI
|
||||||
|
// Init GNOME/GTK
|
||||||
|
char version[16];
|
||||||
|
sprintf(version, "%d.%d", VERSION_MAJOR, VERSION_MINOR);
|
||||||
|
gnome_init("Basilisk II", version, argc, argv);
|
||||||
|
#else
|
||||||
// Init GTK
|
// Init GTK
|
||||||
gtk_set_locale();
|
gtk_set_locale();
|
||||||
gtk_init(&argc, &argv);
|
gtk_init(&argc, &argv);
|
||||||
|
#endif
|
||||||
x_display_name = gdk_get_display(); // gtk_init() handles and removes the "--display" argument
|
x_display_name = gdk_get_display(); // gtk_init() handles and removes the "--display" argument
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -28,6 +28,10 @@
|
|||||||
#include <net/if.h>
|
#include <net/if.h>
|
||||||
#include <net/if_arp.h>
|
#include <net/if_arp.h>
|
||||||
|
|
||||||
|
#ifdef HAVE_GNOMEUI
|
||||||
|
#include <gnome.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "user_strings.h"
|
#include "user_strings.h"
|
||||||
#include "version.h"
|
#include "version.h"
|
||||||
#include "cdrom.h"
|
#include "cdrom.h"
|
||||||
@ -150,7 +154,7 @@ static GtkWidget *make_option_menu(GtkWidget *top, int label_id, const opt_desc
|
|||||||
return menu;
|
return menu;
|
||||||
}
|
}
|
||||||
|
|
||||||
static GtkWidget *make_entry(GtkWidget *top, int label_id, const char *prefs_item)
|
static GtkWidget *make_file_entry(GtkWidget *top, int label_id, const char *prefs_item, bool only_dirs = false)
|
||||||
{
|
{
|
||||||
GtkWidget *box, *label, *entry;
|
GtkWidget *box, *label, *entry;
|
||||||
|
|
||||||
@ -162,16 +166,33 @@ static GtkWidget *make_entry(GtkWidget *top, int label_id, const char *prefs_ite
|
|||||||
gtk_widget_show(label);
|
gtk_widget_show(label);
|
||||||
gtk_box_pack_start(GTK_BOX(box), label, FALSE, FALSE, 0);
|
gtk_box_pack_start(GTK_BOX(box), label, FALSE, FALSE, 0);
|
||||||
|
|
||||||
entry = gtk_entry_new();
|
|
||||||
gtk_widget_show(entry);
|
|
||||||
const char *str = PrefsFindString(prefs_item);
|
const char *str = PrefsFindString(prefs_item);
|
||||||
if (str == NULL)
|
if (str == NULL)
|
||||||
str = "";
|
str = "";
|
||||||
|
|
||||||
|
#ifdef HAVE_GNOMEUI
|
||||||
|
entry = gnome_file_entry_new(NULL, GetString(label_id));
|
||||||
|
if (only_dirs)
|
||||||
|
gnome_file_entry_set_directory(GNOME_FILE_ENTRY(entry), true);
|
||||||
|
gtk_entry_set_text(GTK_ENTRY(gnome_file_entry_gtk_entry(GNOME_FILE_ENTRY(entry))), str);
|
||||||
|
#else
|
||||||
|
entry = gtk_entry_new();
|
||||||
gtk_entry_set_text(GTK_ENTRY(entry), str);
|
gtk_entry_set_text(GTK_ENTRY(entry), str);
|
||||||
|
#endif
|
||||||
|
gtk_widget_show(entry);
|
||||||
gtk_box_pack_start(GTK_BOX(box), entry, TRUE, TRUE, 0);
|
gtk_box_pack_start(GTK_BOX(box), entry, TRUE, TRUE, 0);
|
||||||
return entry;
|
return entry;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static char *get_file_entry_path(GtkWidget *entry)
|
||||||
|
{
|
||||||
|
#ifdef HAVE_GNOMEUI
|
||||||
|
return gnome_file_entry_get_full_path(GNOME_FILE_ENTRY(entry), false);
|
||||||
|
#else
|
||||||
|
return gtk_entry_get_text(GTK_ENTRY(entry));
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
static GtkWidget *make_checkbox(GtkWidget *top, int label_id, const char *prefs_item, GtkSignalFunc func)
|
static GtkWidget *make_checkbox(GtkWidget *top, int label_id, const char *prefs_item, GtkSignalFunc func)
|
||||||
{
|
{
|
||||||
GtkWidget *button = gtk_check_button_new_with_label(GetString(label_id));
|
GtkWidget *button = gtk_check_button_new_with_label(GetString(label_id));
|
||||||
@ -225,7 +246,43 @@ static void dl_quit(GtkWidget *dialog)
|
|||||||
// "About" selected
|
// "About" selected
|
||||||
static void mn_about(...)
|
static void mn_about(...)
|
||||||
{
|
{
|
||||||
GtkWidget *dialog, *label, *button;
|
GtkWidget *dialog;
|
||||||
|
|
||||||
|
#ifdef HAVE_GNOMEUI
|
||||||
|
|
||||||
|
char version[32];
|
||||||
|
sprintf(version, "Version %d.%d", VERSION_MAJOR, VERSION_MINOR);
|
||||||
|
const char *authors[] = {
|
||||||
|
"Christian Bauer",
|
||||||
|
"Orlando Bassotto",
|
||||||
|
"Gwenolé Beauchesne",
|
||||||
|
"Marc Chabanas",
|
||||||
|
"Marc Hellwig",
|
||||||
|
"Biill Huey",
|
||||||
|
"Brian J. Johnson",
|
||||||
|
"Jürgen Lachmann",
|
||||||
|
"Samuel Lander",
|
||||||
|
"David Lawrence",
|
||||||
|
"Lauri Pesonen",
|
||||||
|
"Bernd Schmidt",
|
||||||
|
"and others",
|
||||||
|
NULL
|
||||||
|
};
|
||||||
|
dialog = gnome_about_new(
|
||||||
|
"Basilisk II",
|
||||||
|
version,
|
||||||
|
"Copyright (C) 1997-2002 Christian Bauer",
|
||||||
|
authors,
|
||||||
|
"Basilisk II comes with ABSOLUTELY NO WARRANTY."
|
||||||
|
"This is free software, and you are welcome to redistribute it"
|
||||||
|
"under the terms of the GNU General Public License.",
|
||||||
|
NULL
|
||||||
|
);
|
||||||
|
gnome_dialog_set_parent(GNOME_DIALOG(dialog), GTK_WINDOW(win));
|
||||||
|
|
||||||
|
#else
|
||||||
|
|
||||||
|
GtkWidget *label, *button;
|
||||||
|
|
||||||
char str[512];
|
char str[512];
|
||||||
sprintf(str,
|
sprintf(str,
|
||||||
@ -256,6 +313,9 @@ static void mn_about(...)
|
|||||||
gtk_box_pack_start(GTK_BOX(GTK_DIALOG(dialog)->action_area), button, FALSE, FALSE, 0);
|
gtk_box_pack_start(GTK_BOX(GTK_DIALOG(dialog)->action_area), button, FALSE, FALSE, 0);
|
||||||
GTK_WIDGET_SET_FLAGS(button, GTK_CAN_DEFAULT);
|
GTK_WIDGET_SET_FLAGS(button, GTK_CAN_DEFAULT);
|
||||||
gtk_widget_grab_default(button);
|
gtk_widget_grab_default(button);
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
gtk_widget_show(dialog);
|
gtk_widget_show(dialog);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -431,7 +491,7 @@ static void read_volumes_settings(void)
|
|||||||
PrefsAddString("disk", str);
|
PrefsAddString("disk", str);
|
||||||
}
|
}
|
||||||
|
|
||||||
PrefsReplaceString("extfs", gtk_entry_get_text(GTK_ENTRY(w_extfs)));
|
PrefsReplaceString("extfs", get_file_entry_path(w_extfs));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create "Volumes" pane
|
// Create "Volumes" pane
|
||||||
@ -452,7 +512,7 @@ static void create_volumes_pane(GtkWidget *top)
|
|||||||
gtk_signal_connect(GTK_OBJECT(volume_list), "select_row", GTK_SIGNAL_FUNC(cl_selected), NULL);
|
gtk_signal_connect(GTK_OBJECT(volume_list), "select_row", GTK_SIGNAL_FUNC(cl_selected), NULL);
|
||||||
char *str;
|
char *str;
|
||||||
int32 index = 0;
|
int32 index = 0;
|
||||||
while ((str = (char *)PrefsFindString("disk", index++)) != NULL)
|
while ((str = const_cast<char *>(PrefsFindString("disk", index++))) != NULL)
|
||||||
gtk_clist_append(GTK_CLIST(volume_list), &str);
|
gtk_clist_append(GTK_CLIST(volume_list), &str);
|
||||||
gtk_scrolled_window_add_with_viewport(GTK_SCROLLED_WINDOW(scroll), volume_list);
|
gtk_scrolled_window_add_with_viewport(GTK_SCROLLED_WINDOW(scroll), volume_list);
|
||||||
gtk_box_pack_start(GTK_BOX(box), scroll, TRUE, TRUE, 0);
|
gtk_box_pack_start(GTK_BOX(box), scroll, TRUE, TRUE, 0);
|
||||||
@ -467,7 +527,7 @@ static void create_volumes_pane(GtkWidget *top)
|
|||||||
make_button_box(box, 0, buttons);
|
make_button_box(box, 0, buttons);
|
||||||
make_separator(box);
|
make_separator(box);
|
||||||
|
|
||||||
w_extfs = make_entry(box, STR_EXTFS_CTRL, "extfs");
|
w_extfs = make_file_entry(box, STR_EXTFS_CTRL, "extfs", true);
|
||||||
|
|
||||||
static const opt_desc options[] = {
|
static const opt_desc options[] = {
|
||||||
{STR_BOOT_ANY_LAB, GTK_SIGNAL_FUNC(mn_boot_any)},
|
{STR_BOOT_ANY_LAB, GTK_SIGNAL_FUNC(mn_boot_any)},
|
||||||
@ -497,7 +557,7 @@ static void read_scsi_settings(void)
|
|||||||
for (int id=0; id<7; id++) {
|
for (int id=0; id<7; id++) {
|
||||||
char prefs_name[32];
|
char prefs_name[32];
|
||||||
sprintf(prefs_name, "scsi%d", id);
|
sprintf(prefs_name, "scsi%d", id);
|
||||||
const char *str = gtk_entry_get_text(GTK_ENTRY(w_scsi[id]));
|
const char *str = get_file_entry_path(w_scsi[id]);
|
||||||
if (str && strlen(str))
|
if (str && strlen(str))
|
||||||
PrefsReplaceString(prefs_name, str);
|
PrefsReplaceString(prefs_name, str);
|
||||||
else
|
else
|
||||||
@ -515,7 +575,7 @@ static void create_scsi_pane(GtkWidget *top)
|
|||||||
for (int id=0; id<7; id++) {
|
for (int id=0; id<7; id++) {
|
||||||
char prefs_name[32];
|
char prefs_name[32];
|
||||||
sprintf(prefs_name, "scsi%d", id);
|
sprintf(prefs_name, "scsi%d", id);
|
||||||
w_scsi[id] = make_entry(box, STR_SCSI_ID_0 + id, prefs_name);
|
w_scsi[id] = make_file_entry(box, STR_SCSI_ID_0 + id, prefs_name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -645,6 +705,14 @@ static void read_graphics_settings(void)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
PrefsReplaceString("screen", pref);
|
PrefsReplaceString("screen", pref);
|
||||||
|
|
||||||
|
#ifdef ENABLE_FBDEV_DGA
|
||||||
|
str = get_file_entry_path(w_fbdevice_file);
|
||||||
|
if (str && strlen(str))
|
||||||
|
PrefsReplaceString("fbdevicefile", str);
|
||||||
|
else
|
||||||
|
PrefsRemoveItem("fbdevicefile");
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create "Graphics/Sound" pane
|
// Create "Graphics/Sound" pane
|
||||||
@ -760,7 +828,7 @@ static void create_graphics_pane(GtkWidget *top)
|
|||||||
gtk_entry_set_text(GTK_ENTRY(w_fbdev_name), fbdev_name);
|
gtk_entry_set_text(GTK_ENTRY(w_fbdev_name), fbdev_name);
|
||||||
gtk_table_attach(GTK_TABLE(table), w_fbdev_name, 1, 2, 4, 5, (GtkAttachOptions)0, (GtkAttachOptions)0, 4, 4);
|
gtk_table_attach(GTK_TABLE(table), w_fbdev_name, 1, 2, 4, 5, (GtkAttachOptions)0, (GtkAttachOptions)0, 4, 4);
|
||||||
|
|
||||||
w_fbdevice_file = make_entry(box, STR_FBDEVICE_FILE_CTRL, "fbdevicefile");
|
w_fbdevice_file = make_file_entry(box, STR_FBDEVICE_FILE_CTRL, "fbdevicefile");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
make_separator(box);
|
make_separator(box);
|
||||||
@ -798,7 +866,7 @@ static void mn_wheel_cursor(...) {PrefsReplaceInt32("mousewheelmode", 1); set_in
|
|||||||
// Read settings from widgets and set preferences
|
// Read settings from widgets and set preferences
|
||||||
static void read_input_settings(void)
|
static void read_input_settings(void)
|
||||||
{
|
{
|
||||||
const char *str = gtk_entry_get_text(GTK_ENTRY(w_keycode_file));
|
const char *str = get_file_entry_path(w_keycode_file);
|
||||||
if (str && strlen(str))
|
if (str && strlen(str))
|
||||||
PrefsReplaceString("keycodefile", str);
|
PrefsReplaceString("keycodefile", str);
|
||||||
else
|
else
|
||||||
@ -816,7 +884,7 @@ static void create_input_pane(GtkWidget *top)
|
|||||||
box = make_pane(top, STR_INPUT_PANE_TITLE);
|
box = make_pane(top, STR_INPUT_PANE_TITLE);
|
||||||
|
|
||||||
make_checkbox(box, STR_KEYCODES_CTRL, "keycodes", GTK_SIGNAL_FUNC(tb_keycodes));
|
make_checkbox(box, STR_KEYCODES_CTRL, "keycodes", GTK_SIGNAL_FUNC(tb_keycodes));
|
||||||
w_keycode_file = make_entry(box, STR_KEYCODE_FILE_CTRL, "keycodefile");
|
w_keycode_file = make_file_entry(box, STR_KEYCODE_FILE_CTRL, "keycodefile");
|
||||||
|
|
||||||
make_separator(box);
|
make_separator(box);
|
||||||
|
|
||||||
@ -1072,7 +1140,7 @@ static void read_memory_settings(void)
|
|||||||
{
|
{
|
||||||
PrefsReplaceInt32("ramsize", int(GTK_ADJUSTMENT(w_ramsize_adj)->value) << 20);
|
PrefsReplaceInt32("ramsize", int(GTK_ADJUSTMENT(w_ramsize_adj)->value) << 20);
|
||||||
|
|
||||||
const char *str = gtk_entry_get_text(GTK_ENTRY(w_rom_file));
|
const char *str = get_file_entry_path(w_rom_file);
|
||||||
if (str && strlen(str))
|
if (str && strlen(str))
|
||||||
PrefsReplaceString("rom", str);
|
PrefsReplaceString("rom", str);
|
||||||
else
|
else
|
||||||
@ -1157,7 +1225,7 @@ static void create_memory_pane(GtkWidget *top)
|
|||||||
make_option_menu(box, STR_CPU_CTRL, cpu_options, active);
|
make_option_menu(box, STR_CPU_CTRL, cpu_options, active);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
w_rom_file = make_entry(box, STR_ROM_FILE_CTRL, "rom");
|
w_rom_file = make_file_entry(box, STR_ROM_FILE_CTRL, "rom");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user