From 5a5defb9d804fdcda24922637998ec7c6067c33d Mon Sep 17 00:00:00 2001 From: gbeauche <> Date: Sun, 27 Nov 2005 23:54:26 +0000 Subject: [PATCH] Build Windows GUI with GTK --- SheepShaver/Makefile | 2 +- SheepShaver/src/Windows/Makefile.in | 44 +++++++++++++++--- SheepShaver/src/Windows/SheepShaverGUI.ico | Bin 0 -> 1078 bytes SheepShaver/src/Windows/SheepShaverGUI.rc | 2 + SheepShaver/src/Windows/configure.ac | 20 ++++++-- .../src/Windows/user_strings_windows.cpp | 26 +++++++++++ .../src/Windows/user_strings_windows.h | 26 +++++++++++ SheepShaver/src/include/user_strings.h | 3 ++ SheepShaver/src/user_strings.cpp | 3 ++ 9 files changed, 113 insertions(+), 13 deletions(-) create mode 100755 SheepShaver/src/Windows/SheepShaverGUI.ico create mode 100644 SheepShaver/src/Windows/SheepShaverGUI.rc diff --git a/SheepShaver/Makefile b/SheepShaver/Makefile index b7248d1b..42e4bac2 100644 --- a/SheepShaver/Makefile +++ b/SheepShaver/Makefile @@ -75,7 +75,7 @@ links: Windows/kernel_windows.h Windows/kernel_windows.cpp \ Windows/serial_windows.cpp Windows/router Windows/b2ether \ Windows/ether_windows.h Windows/ether_windows.cpp \ - Windows/serial_windows.cpp'; \ + Windows/serial_windows.cpp Windows/prefs_editor_gtk.cpp'; \ PREFIX="`pwd`/"; case $(B2_TOPDIR) in /*) PREFIX="";; esac; \ for i in $$list; do \ echo $$i; \ diff --git a/SheepShaver/src/Windows/Makefile.in b/SheepShaver/src/Windows/Makefile.in index 826fa1cc..a8623119 100755 --- a/SheepShaver/src/Windows/Makefile.in +++ b/SheepShaver/src/Windows/Makefile.in @@ -13,12 +13,18 @@ man1dir = $(mandir)/man1 DESTDIR = +SDL_CFLAGS = @SDL_CFLAGS@ +SDL_LIBS = @SDL_LIBS@ +WANT_GTK = @WANT_GTK@ +GTK_CFLAGS = @GTK_CFLAGS@ +GTK_LIBS = @GTK_LIBS@ + LN_S = @LN_S@ WINDRES = @WINDRES@ CC = @CC@ CXX = @CXX@ -CFLAGS = @CFLAGS@ -CXXFLAGS = @CXXFLAGS@ +CFLAGS = @CFLAGS@ $(SDL_CFLAGS) +CXXFLAGS = @CXXFLAGS@ $(SDL_CFLAGS) CPPFLAGS = @CPPFLAGS@ -I../include -I. DEFS = @DEFS@ LDFLAGS = @LDFLAGS@ @@ -55,14 +61,24 @@ SRCS = ../main.cpp main_windows.cpp ../prefs.cpp ../prefs_items.cpp prefs_window about_window_windows.cpp ../user_strings.cpp user_strings_windows.cpp \ ../dummy/prefs_editor_dummy.cpp clip_windows.cpp util_windows.cpp kernel_windows.cpp \ vm_alloc.cpp sigsegv.cpp posix_emu.cpp SheepShaver.rc $(CPUSRCS) $(ROUTERSRCS) + +UI_SRCS = ../prefs.cpp prefs_windows.cpp prefs_editor_gtk.cpp xpram_windows.cpp \ + ../prefs_items.cpp ../user_strings.cpp user_strings_windows.cpp SheepShaverGUI.rc + +UI_APP = SheepShaverGUI.exe + APP = SheepShaver.exe +ifeq ($(WANT_GTK),yes) +PROGS += $(UI_APP) +endif + ## Rules .PHONY: clean distclean .SUFFIXES: .SUFFIXES: .c .cpp .S .o .h -all: $(APP) +all: $(PROGS) $(UNIXSRCS): %: ../Unix/% $(LN_S) $< $@ @@ -77,6 +93,12 @@ define SRCS_LIST_TO_OBJS endef OBJS = $(SRCS_LIST_TO_OBJS) +define UI_SRCS_LIST_TO_OBJS + $(addprefix $(OBJ_DIR)/, $(addsuffix .o, $(foreach file, $(UI_SRCS), \ + $(basename $(notdir $(file)))))) +endef +UI_OBJS = $(UI_SRCS_LIST_TO_OBJS) + define DYNGENSRCS_LIST_TO_OBJS $(addprefix $(OBJ_DIR)/, $(addsuffix .ho, $(foreach file, $(DYNGENSRCS), \ $(basename $(notdir $(file)))))) @@ -88,15 +110,21 @@ VPATH := VPATH += $(addprefix :, $(subst ,:, $(filter-out $($(subst, :, ,$(VPATH))), $(SRC_PATHS)))) $(APP): $(UNIXSRCS) $(OBJ_DIR) $(OBJS) - $(CXX) -o $(APP) $(LDFLAGS) $(OBJS) $(LIBS) + $(CXX) -o $(APP) $(LDFLAGS) $(OBJS) $(LIBS) $(SDL_LIBS) -clean: +$(UI_APP): $(UNIXSRCS) $(OBJ_DIR) $(UI_OBJS) + $(CXX) -o $@ $(LDFLAGS) $(UI_OBJS) $(LIBS) $(GTK_LIBS) -mwindows -mno-cygwin + +mostlyclean: + rm -f $(APP) $(UI_APP) $(OBJ_DIR)/* core* *.core *~ *.bak + +clean: mostlyclean rm -f $(UNIXSRCS) - rm -f $(APP) $(OBJ_DIR)/* core* *.core *~ *.bak ppc-execute-impl.cpp - rm -f dyngen basic-dyngen-ops.hpp ppc-dyngen-ops.hpp + rm -f dyngen basic-dyngen-ops.hpp ppc-dyngen-ops.hpp ppc-execute-impl.cpp distclean: clean rm -rf $(OBJ_DIR) + rm -rf autom4te.cache rm -f Makefile rm -f config.cache config.log config.status config.h @@ -117,6 +145,8 @@ $(OBJ_DIR)/%.o : %.S $(CPP) $(CPPFLAGS) -D__ASSEMBLY__ $< -o $*.out.s $(AS) $(ASFLAGS) -o $@ $*.out.s rm $*.out.s +$(OBJ_DIR)/prefs_editor_gtk.o: prefs_editor_gtk.cpp + $(CXX) -O2 -mno-cygwin -mms-bitfields $(CPPFLAGS) $(DEFS) $(GTK_CFLAGS) -c $< -o $@ # Windows resources $(OBJ_DIR)/%.o: %.rc diff --git a/SheepShaver/src/Windows/SheepShaverGUI.ico b/SheepShaver/src/Windows/SheepShaverGUI.ico new file mode 100755 index 0000000000000000000000000000000000000000..67d4c55fab03db3146193a2c8fcfc69907eaabc3 GIT binary patch literal 1078 zcmchWJ#vIF422(?%(zQ90##;@kt4aI_0fEslqu7ZPqGc(#SJMUkfo~K;7@qcE31@<9aF-IC#51-QI&H>nq%`<+h!WfVQh$Ucf(}0+9O}TOLWlj#9k%d?_(vS@ zhtB_uPxal<*Ed7Oev8uSQNQgbmCE;P?Qr=cz4!c0+y9GgUz_t8Uf?$88GTHN8OOs+ zyI@7VHs?NE)M(_bp)q{oDCCYUpxD>wQo&^eIyQw6C(kdq=CwL?pBy+RocOn|vgQ2( DRT%bz literal 0 HcmV?d00001 diff --git a/SheepShaver/src/Windows/SheepShaverGUI.rc b/SheepShaver/src/Windows/SheepShaverGUI.rc new file mode 100644 index 00000000..db7ed548 --- /dev/null +++ b/SheepShaver/src/Windows/SheepShaverGUI.rc @@ -0,0 +1,2 @@ +SheepShaverGUI ICON PRELOAD "SheepShaverGUI.ico" + diff --git a/SheepShaver/src/Windows/configure.ac b/SheepShaver/src/Windows/configure.ac index 41a2ccd5..d5196d55 100755 --- a/SheepShaver/src/Windows/configure.ac +++ b/SheepShaver/src/Windows/configure.ac @@ -13,6 +13,7 @@ AC_CANONICAL_TARGET dnl Options. AC_ARG_ENABLE(jit, [ --enable-jit enable JIT compiler [default=yes]], [WANT_JIT=$enableval], [WANT_JIT=yes]) +AC_ARG_WITH(gtk, [ --with-gtk use GTK user interface [default=yes]], [WANT_GTK=$withval], [WANT_GTK=yes]) dnl Checks for programs. AC_PROG_CC @@ -24,6 +25,15 @@ AC_PROG_LN_S AC_PATH_PROG(PERL, [perl]) AC_CHECK_TOOL(WINDRES, windres) +dnl We use GTK+ if possible. +if [[ "x$WANT_GTK" = "xyes" ]]; then + AM_PATH_GTK_2_0(1.3.15, [], [ + AC_MSG_WARN([Could not find GTK+ 2.0, disabling user interface.]) + WANT_GTK=no + ]) +fi +AC_SUBST(WANT_GTK) + dnl We use 64-bit file size support if possible. AC_SYS_LARGEFILE @@ -202,11 +212,10 @@ CPUSRCS="$CPUSRCS ../kpx_cpu/sheepshaver_glue.cpp" dnl We really want SDL for now AC_CHECK_TOOL(sdl_config, sdl-config, [AC_MSG_ERROR([Sorry, you currently need SDL for this port])]) -sdl_cflags=`$sdl_config --cflags` -sdl_libs=`$sdl_config --libs` -CFLAGS="$CFLAGS $sdl_cflags" -CXXFLAGS="$CXXFLAGS $sdl_cflags" -LIBS="$LIBS $sdl_libs" +SDL_CFLAGS=`$sdl_config --cflags` +AC_SUBST(SDL_CFLAGS) +SDL_LIBS=`$sdl_config --libs` +AC_SUBST(SDL_LIBS) AC_DEFINE(USE_SDL, 1, [Define to enble SDL support]) AC_DEFINE(USE_SDL_VIDEO, 1, [Define to enable SDL video graphics support]) AC_DEFINE(USE_SDL_AUDIO, 1, [Define to enable SDL audio support]) @@ -230,5 +239,6 @@ echo echo SheepShaver configuration summary: echo echo Enable JIT compiler .............. : $WANT_JIT +echo GTK user interface ............... : $WANT_GTK echo echo "Configuration done. Now type \"make\"." diff --git a/SheepShaver/src/Windows/user_strings_windows.cpp b/SheepShaver/src/Windows/user_strings_windows.cpp index 2a794c73..61eef464 100755 --- a/SheepShaver/src/Windows/user_strings_windows.cpp +++ b/SheepShaver/src/Windows/user_strings_windows.cpp @@ -47,6 +47,32 @@ user_string_def platform_strings[] = { {STR_WINDOW_TITLE_GRABBED, "SheepShaver (mouse grabbed, press Ctrl-F5 to release)"}, {STR_NO_WIN32_NT_4, "SheepShaver does not run on Windows NT versions less than 4.0"}, + {STR_PREFS_MENU_FILE_GTK, "/_File"}, + {STR_PREFS_ITEM_START_GTK, "/File/_Start SheepShaver"}, + {STR_PREFS_ITEM_ZAP_PRAM_GTK, "/File/_Zap PRAM File"}, + {STR_PREFS_ITEM_SEPL_GTK, "/File/sepl"}, + {STR_PREFS_ITEM_QUIT_GTK, "/File/_Quit SheepShaver"}, + {STR_HELP_MENU_GTK, "/_Help"}, + {STR_HELP_ITEM_ABOUT_GTK, "/Help/_About SheepShaver"}, + + {STR_FILE_CTRL, "File"}, + {STR_BROWSE_TITLE, "Browse file"}, + {STR_BROWSE_CTRL, "Browse..."}, + {STR_SERIAL_PANE_TITLE, "Serial"}, + {STR_NETWORK_PANE_TITLE, "Network"}, + {STR_INPUT_PANE_TITLE, "Keyboard/Mouse"}, + {STR_KEYCODES_CTRL, "Use Raw Keycodes"}, + {STR_KEYCODE_FILE_CTRL, "Keycode Translation File"}, + {STR_MOUSEWHEELMODE_CTRL, "Mouse Wheel Function"}, + {STR_MOUSEWHEELMODE_PAGE_LAB, "Page Up/Down"}, + {STR_MOUSEWHEELMODE_CURSOR_LAB, "Cursor Up/Down"}, + {STR_MOUSEWHEELLINES_CTRL, "Lines To Scroll"}, + {STR_POLLMEDIA_CTRL, "Try to automatically detect new removable media (enable polling)"}, + {STR_EXTFS_ENABLE_CTRL, "Enable \"My Computer\" icon on your Mac desktop (external file system)"}, + {STR_EXTFS_DRIVES_CTRL, "Mount drives"}, + {STR_ETHER_FTP_PORT_LIST_CTRL, "FTP ports"}, + {STR_ETHER_TCP_PORT_LIST_CTRL, "Server ports"}, + {-1, NULL} // End marker }; diff --git a/SheepShaver/src/Windows/user_strings_windows.h b/SheepShaver/src/Windows/user_strings_windows.h index ec1e4032..63b9a1a4 100755 --- a/SheepShaver/src/Windows/user_strings_windows.h +++ b/SheepShaver/src/Windows/user_strings_windows.h @@ -40,6 +40,32 @@ enum { STR_OPEN_WINDOW_ERR, STR_WINDOW_TITLE_GRABBED, STR_NO_WIN32_NT_4, + + STR_PREFS_MENU_FILE_GTK, + STR_PREFS_ITEM_START_GTK, + STR_PREFS_ITEM_ZAP_PRAM_GTK, + STR_PREFS_ITEM_SEPL_GTK, + STR_PREFS_ITEM_QUIT_GTK, + STR_HELP_MENU_GTK, + STR_HELP_ITEM_ABOUT_GTK, + + STR_FILE_CTRL, + STR_BROWSE_CTRL, + STR_BROWSE_TITLE, + STR_SERIAL_PANE_TITLE, + STR_NETWORK_PANE_TITLE, + STR_INPUT_PANE_TITLE, + STR_KEYCODES_CTRL, + STR_KEYCODE_FILE_CTRL, + STR_MOUSEWHEELMODE_CTRL, + STR_MOUSEWHEELMODE_PAGE_LAB, + STR_MOUSEWHEELMODE_CURSOR_LAB, + STR_MOUSEWHEELLINES_CTRL, + STR_POLLMEDIA_CTRL, + STR_EXTFS_ENABLE_CTRL, + STR_EXTFS_DRIVES_CTRL, + STR_ETHER_FTP_PORT_LIST_CTRL, + STR_ETHER_TCP_PORT_LIST_CTRL, }; #endif diff --git a/SheepShaver/src/include/user_strings.h b/SheepShaver/src/include/user_strings.h index 24fa5f35..162ad645 100644 --- a/SheepShaver/src/include/user_strings.h +++ b/SheepShaver/src/include/user_strings.h @@ -74,6 +74,8 @@ enum { STR_PREFS_ITEM_ZAP_PRAM, STR_PREFS_ITEM_QUIT, + STR_NONE_LAB = 3100, + // Volumes pane STR_VOLUMES_PANE_TITLE = 3200, STR_ADD_VOLUME_BUTTON, @@ -99,6 +101,7 @@ enum { STR_REF_15HZ_LAB, STR_REF_30HZ_LAB, STR_REF_60HZ_LAB, + STR_REF_DYNAMIC_LAB, STR_GFXACCEL_CTRL, STR_8_BIT_CTRL, STR_16_BIT_CTRL, diff --git a/SheepShaver/src/user_strings.cpp b/SheepShaver/src/user_strings.cpp index 1ff6516f..1eb0dd9f 100644 --- a/SheepShaver/src/user_strings.cpp +++ b/SheepShaver/src/user_strings.cpp @@ -87,6 +87,8 @@ user_string_def common_strings[] = { {STR_PREFS_ITEM_ZAP_PRAM, "Zap PRAM File"}, {STR_PREFS_ITEM_QUIT, "Quit SheepShaver"}, + {STR_NONE_LAB, ""}, + {STR_VOLUMES_PANE_TITLE, "Volumes"}, {STR_ADD_VOLUME_BUTTON, "Add" ELLIPSIS}, {STR_CREATE_VOLUME_BUTTON, "Create" ELLIPSIS}, @@ -109,6 +111,7 @@ user_string_def common_strings[] = { {STR_REF_15HZ_LAB, "15 Hz"}, {STR_REF_30HZ_LAB, "30 Hz"}, {STR_REF_60HZ_LAB, "60 Hz"}, + {STR_REF_DYNAMIC_LAB, "Dynamic"}, {STR_GFXACCEL_CTRL, "QuickDraw Acceleration"}, {STR_8_BIT_CTRL, "8 Bit"}, {STR_16_BIT_CTRL, "15 Bit"},