Search
lxdream.org :: lxdream :: r763:b3ce4448f200
lxdream 0.9.1
released Jun 29
Download Now
changeset763:b3ce4448f200
parent762:0980359351fc
child764:44f5670ada62
authornkeynes
dateTue Jul 22 04:40:55 2008 +0000 (11 years ago)
Rename GTK UI files to follow the same scheme as the cocoa ones
src/Makefile.am
src/Makefile.in
src/gtkui/ctrl_dlg.c
src/gtkui/debug_win.c
src/gtkui/dump_win.c
src/gtkui/gdrom_menu.c
src/gtkui/gtk_ctrl.c
src/gtkui/gtk_debug.c
src/gtkui/gtk_dump.c
src/gtkui/gtk_gd.c
src/gtkui/gtk_mmio.c
src/gtkui/gtk_path.c
src/gtkui/gtk_win.c
src/gtkui/main_win.c
src/gtkui/mmio_win.c
src/gtkui/path_dlg.c
1.1 --- a/src/Makefile.am Mon Jul 21 12:21:20 2008 +0000
1.2 +++ b/src/Makefile.am Tue Jul 22 04:40:55 2008 +0000
1.3 @@ -83,9 +83,9 @@
1.4
1.5 if GUI_GTK
1.6 lxdream_SOURCES += gtkui/gtkui.c gtkui/gtkui.h \
1.7 - gtkui/main_win.c gtkui/gtkcb.c \
1.8 - gtkui/mmio_win.c gtkui/debug_win.c gtkui/dump_win.c \
1.9 - gtkui/ctrl_dlg.c gtkui/path_dlg.c gtkui/gdrom_menu.c \
1.10 + gtkui/gtk_win.c gtkui/gtkcb.c \
1.11 + gtkui/gtk_mmio.c gtkui/gtk_debug.c gtkui/gtk_dump.c \
1.12 + gtkui/gtk_ctrl.c gtkui/gtk_path.c gtkui/gtk_gd.c \
1.13 drivers/video_gtk.c
1.14 endif
1.15
2.1 --- a/src/Makefile.in Mon Jul 21 12:21:20 2008 +0000
2.2 +++ b/src/Makefile.in Tue Jul 22 04:40:55 2008 +0000
2.3 @@ -49,9 +49,9 @@
2.4
2.5 @BUILD_SH4X86_TRUE@am__append_2 = test/testsh4x86
2.6 @GUI_GTK_TRUE@am__append_3 = gtkui/gtkui.c gtkui/gtkui.h \
2.7 -@GUI_GTK_TRUE@ gtkui/main_win.c gtkui/gtkcb.c \
2.8 -@GUI_GTK_TRUE@ gtkui/mmio_win.c gtkui/debug_win.c gtkui/dump_win.c \
2.9 -@GUI_GTK_TRUE@ gtkui/ctrl_dlg.c gtkui/path_dlg.c gtkui/gdrom_menu.c \
2.10 +@GUI_GTK_TRUE@ gtkui/gtk_win.c gtkui/gtkcb.c \
2.11 +@GUI_GTK_TRUE@ gtkui/gtk_mmio.c gtkui/gtk_debug.c gtkui/gtk_dump.c \
2.12 +@GUI_GTK_TRUE@ gtkui/gtk_ctrl.c gtkui/gtk_path.c gtkui/gtk_gd.c \
2.13 @GUI_GTK_TRUE@ drivers/video_gtk.c
2.14
2.15 @GUI_COCOA_TRUE@am__append_4 = cocoaui/cocoaui.c cocoaui/cocoaui.h \
2.16 @@ -122,9 +122,9 @@
2.17 x86dasm/x86dasm.h x86dasm/i386-dis.c x86dasm/dis-init.c \
2.18 x86dasm/dis-buf.c x86dasm/ansidecl.h x86dasm/bfd.h \
2.19 x86dasm/dis-asm.h x86dasm/symcat.h x86dasm/sysdep.h \
2.20 - gtkui/gtkui.c gtkui/gtkui.h gtkui/main_win.c gtkui/gtkcb.c \
2.21 - gtkui/mmio_win.c gtkui/debug_win.c gtkui/dump_win.c \
2.22 - gtkui/ctrl_dlg.c gtkui/path_dlg.c gtkui/gdrom_menu.c \
2.23 + gtkui/gtkui.c gtkui/gtkui.h gtkui/gtk_win.c gtkui/gtkcb.c \
2.24 + gtkui/gtk_mmio.c gtkui/gtk_debug.c gtkui/gtk_dump.c \
2.25 + gtkui/gtk_ctrl.c gtkui/gtk_path.c gtkui/gtk_gd.c \
2.26 drivers/video_gtk.c cocoaui/cocoaui.c cocoaui/cocoaui.h \
2.27 cocoaui/cocoa_win.c cocoaui/cocoa_gd.c cocoaui/cocoa_prefs.c \
2.28 drivers/video_osx.c drivers/mac_keymap.h \
2.29 @@ -137,11 +137,11 @@
2.30 @BUILD_SH4X86_TRUE@am__objects_1 = sh4x86.$(OBJEXT) sh4trans.$(OBJEXT) \
2.31 @BUILD_SH4X86_TRUE@ x86dasm.$(OBJEXT) i386-dis.$(OBJEXT) \
2.32 @BUILD_SH4X86_TRUE@ dis-init.$(OBJEXT) dis-buf.$(OBJEXT)
2.33 -@GUI_GTK_TRUE@am__objects_2 = gtkui.$(OBJEXT) main_win.$(OBJEXT) \
2.34 -@GUI_GTK_TRUE@ gtkcb.$(OBJEXT) mmio_win.$(OBJEXT) \
2.35 -@GUI_GTK_TRUE@ debug_win.$(OBJEXT) dump_win.$(OBJEXT) \
2.36 -@GUI_GTK_TRUE@ ctrl_dlg.$(OBJEXT) path_dlg.$(OBJEXT) \
2.37 -@GUI_GTK_TRUE@ gdrom_menu.$(OBJEXT) video_gtk.$(OBJEXT)
2.38 +@GUI_GTK_TRUE@am__objects_2 = gtkui.$(OBJEXT) gtk_win.$(OBJEXT) \
2.39 +@GUI_GTK_TRUE@ gtkcb.$(OBJEXT) gtk_mmio.$(OBJEXT) \
2.40 +@GUI_GTK_TRUE@ gtk_debug.$(OBJEXT) gtk_dump.$(OBJEXT) \
2.41 +@GUI_GTK_TRUE@ gtk_ctrl.$(OBJEXT) gtk_path.$(OBJEXT) \
2.42 +@GUI_GTK_TRUE@ gtk_gd.$(OBJEXT) video_gtk.$(OBJEXT)
2.43 @GUI_COCOA_TRUE@am__objects_3 = cocoaui.$(OBJEXT) cocoa_win.$(OBJEXT) \
2.44 @GUI_COCOA_TRUE@ cocoa_gd.$(OBJEXT) cocoa_prefs.$(OBJEXT) \
2.45 @GUI_COCOA_TRUE@ video_osx.$(OBJEXT)
2.46 @@ -549,22 +549,18 @@
2.47 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cocoaui.Po@am__quote@
2.48 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/config.Po@am__quote@
2.49 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/controller.Po@am__quote@
2.50 -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ctrl_dlg.Po@am__quote@
2.51 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dcload.Po@am__quote@
2.52 -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/debug_win.Po@am__quote@
2.53 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dis-buf.Po@am__quote@
2.54 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dis-init.Po@am__quote@
2.55 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/display.Po@am__quote@
2.56 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dmac.Po@am__quote@
2.57 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dreamcast.Po@am__quote@
2.58 -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dump_win.Po@am__quote@
2.59 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/edc_ecc.Po@am__quote@
2.60 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eventq.Po@am__quote@
2.61 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gdi.Po@am__quote@
2.62 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gdimage.Po@am__quote@
2.63 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gdlist.Po@am__quote@
2.64 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gdrom.Po@am__quote@
2.65 -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gdrom_menu.Po@am__quote@
2.66 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gendec.Po@am__quote@
2.67 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/genglsl.Po@am__quote@
2.68 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gl_fbo.Po@am__quote@
2.69 @@ -572,6 +568,13 @@
2.70 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gl_slsrc.Po@am__quote@
2.71 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/glrender.Po@am__quote@
2.72 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/glutil.Po@am__quote@
2.73 +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gtk_ctrl.Po@am__quote@
2.74 +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gtk_debug.Po@am__quote@
2.75 +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gtk_dump.Po@am__quote@
2.76 +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gtk_gd.Po@am__quote@
2.77 +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gtk_mmio.Po@am__quote@
2.78 +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gtk_path.Po@am__quote@
2.79 +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gtk_win.Po@am__quote@
2.80 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gtkcb.Po@am__quote@
2.81 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gtkui.Po@am__quote@
2.82 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/i386-dis.Po@am__quote@
2.83 @@ -582,16 +585,13 @@
2.84 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/kbd.Po@am__quote@
2.85 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/loader.Po@am__quote@
2.86 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/main.Po@am__quote@
2.87 -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/main_win.Po@am__quote@
2.88 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/maple.Po@am__quote@
2.89 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mem.Po@am__quote@
2.90 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mmc.Po@am__quote@
2.91 -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mmio_win.Po@am__quote@
2.92 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mmu.Po@am__quote@
2.93 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mouse.Po@am__quote@
2.94 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/nrg.Po@am__quote@
2.95 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/osx_iokit.Po@am__quote@
2.96 -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/path_dlg.Po@am__quote@
2.97 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pvr2.Po@am__quote@
2.98 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pvr2mem.Po@am__quote@
2.99 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rendsave.Po@am__quote@
2.100 @@ -1424,19 +1424,19 @@
2.101 @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
2.102 @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o gtkui.obj `if test -f 'gtkui/gtkui.c'; then $(CYGPATH_W) 'gtkui/gtkui.c'; else $(CYGPATH_W) '$(srcdir)/gtkui/gtkui.c'; fi`
2.103
2.104 -main_win.o: gtkui/main_win.c
2.105 -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT main_win.o -MD -MP -MF "$(DEPDIR)/main_win.Tpo" -c -o main_win.o `test -f 'gtkui/main_win.c' || echo '$(srcdir)/'`gtkui/main_win.c; \
2.106 -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/main_win.Tpo" "$(DEPDIR)/main_win.Po"; else rm -f "$(DEPDIR)/main_win.Tpo"; exit 1; fi
2.107 -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='gtkui/main_win.c' object='main_win.o' libtool=no @AMDEPBACKSLASH@
2.108 +gtk_win.o: gtkui/gtk_win.c
2.109 +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT gtk_win.o -MD -MP -MF "$(DEPDIR)/gtk_win.Tpo" -c -o gtk_win.o `test -f 'gtkui/gtk_win.c' || echo '$(srcdir)/'`gtkui/gtk_win.c; \
2.110 +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/gtk_win.Tpo" "$(DEPDIR)/gtk_win.Po"; else rm -f "$(DEPDIR)/gtk_win.Tpo"; exit 1; fi
2.111 +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='gtkui/gtk_win.c' object='gtk_win.o' libtool=no @AMDEPBACKSLASH@
2.112 @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
2.113 -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o main_win.o `test -f 'gtkui/main_win.c' || echo '$(srcdir)/'`gtkui/main_win.c
2.114 +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o gtk_win.o `test -f 'gtkui/gtk_win.c' || echo '$(srcdir)/'`gtkui/gtk_win.c
2.115
2.116 -main_win.obj: gtkui/main_win.c
2.117 -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT main_win.obj -MD -MP -MF "$(DEPDIR)/main_win.Tpo" -c -o main_win.obj `if test -f 'gtkui/main_win.c'; then $(CYGPATH_W) 'gtkui/main_win.c'; else $(CYGPATH_W) '$(srcdir)/gtkui/main_win.c'; fi`; \
2.118 -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/main_win.Tpo" "$(DEPDIR)/main_win.Po"; else rm -f "$(DEPDIR)/main_win.Tpo"; exit 1; fi
2.119 -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='gtkui/main_win.c' object='main_win.obj' libtool=no @AMDEPBACKSLASH@
2.120 +gtk_win.obj: gtkui/gtk_win.c
2.121 +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT gtk_win.obj -MD -MP -MF "$(DEPDIR)/gtk_win.Tpo" -c -o gtk_win.obj `if test -f 'gtkui/gtk_win.c'; then $(CYGPATH_W) 'gtkui/gtk_win.c'; else $(CYGPATH_W) '$(srcdir)/gtkui/gtk_win.c'; fi`; \
2.122 +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/gtk_win.Tpo" "$(DEPDIR)/gtk_win.Po"; else rm -f "$(DEPDIR)/gtk_win.Tpo"; exit 1; fi
2.123 +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='gtkui/gtk_win.c' object='gtk_win.obj' libtool=no @AMDEPBACKSLASH@
2.124 @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
2.125 -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o main_win.obj `if test -f 'gtkui/main_win.c'; then $(CYGPATH_W) 'gtkui/main_win.c'; else $(CYGPATH_W) '$(srcdir)/gtkui/main_win.c'; fi`
2.126 +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o gtk_win.obj `if test -f 'gtkui/gtk_win.c'; then $(CYGPATH_W) 'gtkui/gtk_win.c'; else $(CYGPATH_W) '$(srcdir)/gtkui/gtk_win.c'; fi`
2.127
2.128 gtkcb.o: gtkui/gtkcb.c
2.129 @am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT gtkcb.o -MD -MP -MF "$(DEPDIR)/gtkcb.Tpo" -c -o gtkcb.o `test -f 'gtkui/gtkcb.c' || echo '$(srcdir)/'`gtkui/gtkcb.c; \
2.130 @@ -1452,89 +1452,89 @@
2.131 @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
2.132 @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o gtkcb.obj `if test -f 'gtkui/gtkcb.c'; then $(CYGPATH_W) 'gtkui/gtkcb.c'; else $(CYGPATH_W) '$(srcdir)/gtkui/gtkcb.c'; fi`
2.133
2.134 -mmio_win.o: gtkui/mmio_win.c
2.135 -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT mmio_win.o -MD -MP -MF "$(DEPDIR)/mmio_win.Tpo" -c -o mmio_win.o `test -f 'gtkui/mmio_win.c' || echo '$(srcdir)/'`gtkui/mmio_win.c; \
2.136 -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/mmio_win.Tpo" "$(DEPDIR)/mmio_win.Po"; else rm -f "$(DEPDIR)/mmio_win.Tpo"; exit 1; fi
2.137 -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='gtkui/mmio_win.c' object='mmio_win.o' libtool=no @AMDEPBACKSLASH@
2.138 +gtk_mmio.o: gtkui/gtk_mmio.c
2.139 +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT gtk_mmio.o -MD -MP -MF "$(DEPDIR)/gtk_mmio.Tpo" -c -o gtk_mmio.o `test -f 'gtkui/gtk_mmio.c' || echo '$(srcdir)/'`gtkui/gtk_mmio.c; \
2.140 +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/gtk_mmio.Tpo" "$(DEPDIR)/gtk_mmio.Po"; else rm -f "$(DEPDIR)/gtk_mmio.Tpo"; exit 1; fi
2.141 +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='gtkui/gtk_mmio.c' object='gtk_mmio.o' libtool=no @AMDEPBACKSLASH@
2.142 @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
2.143 -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o mmio_win.o `test -f 'gtkui/mmio_win.c' || echo '$(srcdir)/'`gtkui/mmio_win.c
2.144 +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o gtk_mmio.o `test -f 'gtkui/gtk_mmio.c' || echo '$(srcdir)/'`gtkui/gtk_mmio.c
2.145
2.146 -mmio_win.obj: gtkui/mmio_win.c
2.147 -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT mmio_win.obj -MD -MP -MF "$(DEPDIR)/mmio_win.Tpo" -c -o mmio_win.obj `if test -f 'gtkui/mmio_win.c'; then $(CYGPATH_W) 'gtkui/mmio_win.c'; else $(CYGPATH_W) '$(srcdir)/gtkui/mmio_win.c'; fi`; \
2.148 -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/mmio_win.Tpo" "$(DEPDIR)/mmio_win.Po"; else rm -f "$(DEPDIR)/mmio_win.Tpo"; exit 1; fi
2.149 -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='gtkui/mmio_win.c' object='mmio_win.obj' libtool=no @AMDEPBACKSLASH@
2.150 +gtk_mmio.obj: gtkui/gtk_mmio.c
2.151 +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT gtk_mmio.obj -MD -MP -MF "$(DEPDIR)/gtk_mmio.Tpo" -c -o gtk_mmio.obj `if test -f 'gtkui/gtk_mmio.c'; then $(CYGPATH_W) 'gtkui/gtk_mmio.c'; else $(CYGPATH_W) '$(srcdir)/gtkui/gtk_mmio.c'; fi`; \
2.152 +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/gtk_mmio.Tpo" "$(DEPDIR)/gtk_mmio.Po"; else rm -f "$(DEPDIR)/gtk_mmio.Tpo"; exit 1; fi
2.153 +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='gtkui/gtk_mmio.c' object='gtk_mmio.obj' libtool=no @AMDEPBACKSLASH@
2.154 @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
2.155 -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o mmio_win.obj `if test -f 'gtkui/mmio_win.c'; then $(CYGPATH_W) 'gtkui/mmio_win.c'; else $(CYGPATH_W) '$(srcdir)/gtkui/mmio_win.c'; fi`
2.156 +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o gtk_mmio.obj `if test -f 'gtkui/gtk_mmio.c'; then $(CYGPATH_W) 'gtkui/gtk_mmio.c'; else $(CYGPATH_W) '$(srcdir)/gtkui/gtk_mmio.c'; fi`
2.157
2.158 -debug_win.o: gtkui/debug_win.c
2.159 -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT debug_win.o -MD -MP -MF "$(DEPDIR)/debug_win.Tpo" -c -o debug_win.o `test -f 'gtkui/debug_win.c' || echo '$(srcdir)/'`gtkui/debug_win.c; \
2.160 -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/debug_win.Tpo" "$(DEPDIR)/debug_win.Po"; else rm -f "$(DEPDIR)/debug_win.Tpo"; exit 1; fi
2.161 -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='gtkui/debug_win.c' object='debug_win.o' libtool=no @AMDEPBACKSLASH@
2.162 +gtk_debug.o: gtkui/gtk_debug.c
2.163 +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT gtk_debug.o -MD -MP -MF "$(DEPDIR)/gtk_debug.Tpo" -c -o gtk_debug.o `test -f 'gtkui/gtk_debug.c' || echo '$(srcdir)/'`gtkui/gtk_debug.c; \
2.164 +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/gtk_debug.Tpo" "$(DEPDIR)/gtk_debug.Po"; else rm -f "$(DEPDIR)/gtk_debug.Tpo"; exit 1; fi
2.165 +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='gtkui/gtk_debug.c' object='gtk_debug.o' libtool=no @AMDEPBACKSLASH@
2.166 @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
2.167 -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o debug_win.o `test -f 'gtkui/debug_win.c' || echo '$(srcdir)/'`gtkui/debug_win.c
2.168 +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o gtk_debug.o `test -f 'gtkui/gtk_debug.c' || echo '$(srcdir)/'`gtkui/gtk_debug.c
2.169
2.170 -debug_win.obj: gtkui/debug_win.c
2.171 -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT debug_win.obj -MD -MP -MF "$(DEPDIR)/debug_win.Tpo" -c -o debug_win.obj `if test -f 'gtkui/debug_win.c'; then $(CYGPATH_W) 'gtkui/debug_win.c'; else $(CYGPATH_W) '$(srcdir)/gtkui/debug_win.c'; fi`; \
2.172 -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/debug_win.Tpo" "$(DEPDIR)/debug_win.Po"; else rm -f "$(DEPDIR)/debug_win.Tpo"; exit 1; fi
2.173 -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='gtkui/debug_win.c' object='debug_win.obj' libtool=no @AMDEPBACKSLASH@
2.174 +gtk_debug.obj: gtkui/gtk_debug.c
2.175 +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT gtk_debug.obj -MD -MP -MF "$(DEPDIR)/gtk_debug.Tpo" -c -o gtk_debug.obj `if test -f 'gtkui/gtk_debug.c'; then $(CYGPATH_W) 'gtkui/gtk_debug.c'; else $(CYGPATH_W) '$(srcdir)/gtkui/gtk_debug.c'; fi`; \
2.176 +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/gtk_debug.Tpo" "$(DEPDIR)/gtk_debug.Po"; else rm -f "$(DEPDIR)/gtk_debug.Tpo"; exit 1; fi
2.177 +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='gtkui/gtk_debug.c' object='gtk_debug.obj' libtool=no @AMDEPBACKSLASH@
2.178 @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
2.179 -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o debug_win.obj `if test -f 'gtkui/debug_win.c'; then $(CYGPATH_W) 'gtkui/debug_win.c'; else $(CYGPATH_W) '$(srcdir)/gtkui/debug_win.c'; fi`
2.180 +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o gtk_debug.obj `if test -f 'gtkui/gtk_debug.c'; then $(CYGPATH_W) 'gtkui/gtk_debug.c'; else $(CYGPATH_W) '$(srcdir)/gtkui/gtk_debug.c'; fi`
2.181
2.182 -dump_win.o: gtkui/dump_win.c
2.183 -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT dump_win.o -MD -MP -MF "$(DEPDIR)/dump_win.Tpo" -c -o dump_win.o `test -f 'gtkui/dump_win.c' || echo '$(srcdir)/'`gtkui/dump_win.c; \
2.184 -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/dump_win.Tpo" "$(DEPDIR)/dump_win.Po"; else rm -f "$(DEPDIR)/dump_win.Tpo"; exit 1; fi
2.185 -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='gtkui/dump_win.c' object='dump_win.o' libtool=no @AMDEPBACKSLASH@
2.186 +gtk_dump.o: gtkui/gtk_dump.c
2.187 +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT gtk_dump.o -MD -MP -MF "$(DEPDIR)/gtk_dump.Tpo" -c -o gtk_dump.o `test -f 'gtkui/gtk_dump.c' || echo '$(srcdir)/'`gtkui/gtk_dump.c; \
2.188 +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/gtk_dump.Tpo" "$(DEPDIR)/gtk_dump.Po"; else rm -f "$(DEPDIR)/gtk_dump.Tpo"; exit 1; fi
2.189 +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='gtkui/gtk_dump.c' object='gtk_dump.o' libtool=no @AMDEPBACKSLASH@
2.190 @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
2.191 -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o dump_win.o `test -f 'gtkui/dump_win.c' || echo '$(srcdir)/'`gtkui/dump_win.c
2.192 +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o gtk_dump.o `test -f 'gtkui/gtk_dump.c' || echo '$(srcdir)/'`gtkui/gtk_dump.c
2.193
2.194 -dump_win.obj: gtkui/dump_win.c
2.195 -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT dump_win.obj -MD -MP -MF "$(DEPDIR)/dump_win.Tpo" -c -o dump_win.obj `if test -f 'gtkui/dump_win.c'; then $(CYGPATH_W) 'gtkui/dump_win.c'; else $(CYGPATH_W) '$(srcdir)/gtkui/dump_win.c'; fi`; \
2.196 -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/dump_win.Tpo" "$(DEPDIR)/dump_win.Po"; else rm -f "$(DEPDIR)/dump_win.Tpo"; exit 1; fi
2.197 -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='gtkui/dump_win.c' object='dump_win.obj' libtool=no @AMDEPBACKSLASH@
2.198 +gtk_dump.obj: gtkui/gtk_dump.c
2.199 +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT gtk_dump.obj -MD -MP -MF "$(DEPDIR)/gtk_dump.Tpo" -c -o gtk_dump.obj `if test -f 'gtkui/gtk_dump.c'; then $(CYGPATH_W) 'gtkui/gtk_dump.c'; else $(CYGPATH_W) '$(srcdir)/gtkui/gtk_dump.c'; fi`; \
2.200 +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/gtk_dump.Tpo" "$(DEPDIR)/gtk_dump.Po"; else rm -f "$(DEPDIR)/gtk_dump.Tpo"; exit 1; fi
2.201 +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='gtkui/gtk_dump.c' object='gtk_dump.obj' libtool=no @AMDEPBACKSLASH@
2.202 @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
2.203 -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o dump_win.obj `if test -f 'gtkui/dump_win.c'; then $(CYGPATH_W) 'gtkui/dump_win.c'; else $(CYGPATH_W) '$(srcdir)/gtkui/dump_win.c'; fi`
2.204 +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o gtk_dump.obj `if test -f 'gtkui/gtk_dump.c'; then $(CYGPATH_W) 'gtkui/gtk_dump.c'; else $(CYGPATH_W) '$(srcdir)/gtkui/gtk_dump.c'; fi`
2.205
2.206 -ctrl_dlg.o: gtkui/ctrl_dlg.c
2.207 -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT ctrl_dlg.o -MD -MP -MF "$(DEPDIR)/ctrl_dlg.Tpo" -c -o ctrl_dlg.o `test -f 'gtkui/ctrl_dlg.c' || echo '$(srcdir)/'`gtkui/ctrl_dlg.c; \
2.208 -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/ctrl_dlg.Tpo" "$(DEPDIR)/ctrl_dlg.Po"; else rm -f "$(DEPDIR)/ctrl_dlg.Tpo"; exit 1; fi
2.209 -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='gtkui/ctrl_dlg.c' object='ctrl_dlg.o' libtool=no @AMDEPBACKSLASH@
2.210 +gtk_ctrl.o: gtkui/gtk_ctrl.c
2.211 +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT gtk_ctrl.o -MD -MP -MF "$(DEPDIR)/gtk_ctrl.Tpo" -c -o gtk_ctrl.o `test -f 'gtkui/gtk_ctrl.c' || echo '$(srcdir)/'`gtkui/gtk_ctrl.c; \
2.212 +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/gtk_ctrl.Tpo" "$(DEPDIR)/gtk_ctrl.Po"; else rm -f "$(DEPDIR)/gtk_ctrl.Tpo"; exit 1; fi
2.213 +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='gtkui/gtk_ctrl.c' object='gtk_ctrl.o' libtool=no @AMDEPBACKSLASH@
2.214 @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
2.215 -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o ctrl_dlg.o `test -f 'gtkui/ctrl_dlg.c' || echo '$(srcdir)/'`gtkui/ctrl_dlg.c
2.216 +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o gtk_ctrl.o `test -f 'gtkui/gtk_ctrl.c' || echo '$(srcdir)/'`gtkui/gtk_ctrl.c
2.217
2.218 -ctrl_dlg.obj: gtkui/ctrl_dlg.c
2.219 -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT ctrl_dlg.obj -MD -MP -MF "$(DEPDIR)/ctrl_dlg.Tpo" -c -o ctrl_dlg.obj `if test -f 'gtkui/ctrl_dlg.c'; then $(CYGPATH_W) 'gtkui/ctrl_dlg.c'; else $(CYGPATH_W) '$(srcdir)/gtkui/ctrl_dlg.c'; fi`; \
2.220 -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/ctrl_dlg.Tpo" "$(DEPDIR)/ctrl_dlg.Po"; else rm -f "$(DEPDIR)/ctrl_dlg.Tpo"; exit 1; fi
2.221 -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='gtkui/ctrl_dlg.c' object='ctrl_dlg.obj' libtool=no @AMDEPBACKSLASH@
2.222 +gtk_ctrl.obj: gtkui/gtk_ctrl.c
2.223 +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT gtk_ctrl.obj -MD -MP -MF "$(DEPDIR)/gtk_ctrl.Tpo" -c -o gtk_ctrl.obj `if test -f 'gtkui/gtk_ctrl.c'; then $(CYGPATH_W) 'gtkui/gtk_ctrl.c'; else $(CYGPATH_W) '$(srcdir)/gtkui/gtk_ctrl.c'; fi`; \
2.224 +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/gtk_ctrl.Tpo" "$(DEPDIR)/gtk_ctrl.Po"; else rm -f "$(DEPDIR)/gtk_ctrl.Tpo"; exit 1; fi
2.225 +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='gtkui/gtk_ctrl.c' object='gtk_ctrl.obj' libtool=no @AMDEPBACKSLASH@
2.226 @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
2.227 -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o ctrl_dlg.obj `if test -f 'gtkui/ctrl_dlg.c'; then $(CYGPATH_W) 'gtkui/ctrl_dlg.c'; else $(CYGPATH_W) '$(srcdir)/gtkui/ctrl_dlg.c'; fi`
2.228 +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o gtk_ctrl.obj `if test -f 'gtkui/gtk_ctrl.c'; then $(CYGPATH_W) 'gtkui/gtk_ctrl.c'; else $(CYGPATH_W) '$(srcdir)/gtkui/gtk_ctrl.c'; fi`
2.229
2.230 -path_dlg.o: gtkui/path_dlg.c
2.231 -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT path_dlg.o -MD -MP -MF "$(DEPDIR)/path_dlg.Tpo" -c -o path_dlg.o `test -f 'gtkui/path_dlg.c' || echo '$(srcdir)/'`gtkui/path_dlg.c; \
2.232 -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/path_dlg.Tpo" "$(DEPDIR)/path_dlg.Po"; else rm -f "$(DEPDIR)/path_dlg.Tpo"; exit 1; fi
2.233 -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='gtkui/path_dlg.c' object='path_dlg.o' libtool=no @AMDEPBACKSLASH@
2.234 +gtk_path.o: gtkui/gtk_path.c
2.235 +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT gtk_path.o -MD -MP -MF "$(DEPDIR)/gtk_path.Tpo" -c -o gtk_path.o `test -f 'gtkui/gtk_path.c' || echo '$(srcdir)/'`gtkui/gtk_path.c; \
2.236 +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/gtk_path.Tpo" "$(DEPDIR)/gtk_path.Po"; else rm -f "$(DEPDIR)/gtk_path.Tpo"; exit 1; fi
2.237 +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='gtkui/gtk_path.c' object='gtk_path.o' libtool=no @AMDEPBACKSLASH@
2.238 @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
2.239 -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o path_dlg.o `test -f 'gtkui/path_dlg.c' || echo '$(srcdir)/'`gtkui/path_dlg.c
2.240 +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o gtk_path.o `test -f 'gtkui/gtk_path.c' || echo '$(srcdir)/'`gtkui/gtk_path.c
2.241
2.242 -path_dlg.obj: gtkui/path_dlg.c
2.243 -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT path_dlg.obj -MD -MP -MF "$(DEPDIR)/path_dlg.Tpo" -c -o path_dlg.obj `if test -f 'gtkui/path_dlg.c'; then $(CYGPATH_W) 'gtkui/path_dlg.c'; else $(CYGPATH_W) '$(srcdir)/gtkui/path_dlg.c'; fi`; \
2.244 -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/path_dlg.Tpo" "$(DEPDIR)/path_dlg.Po"; else rm -f "$(DEPDIR)/path_dlg.Tpo"; exit 1; fi
2.245 -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='gtkui/path_dlg.c' object='path_dlg.obj' libtool=no @AMDEPBACKSLASH@
2.246 +gtk_path.obj: gtkui/gtk_path.c
2.247 +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT gtk_path.obj -MD -MP -MF "$(DEPDIR)/gtk_path.Tpo" -c -o gtk_path.obj `if test -f 'gtkui/gtk_path.c'; then $(CYGPATH_W) 'gtkui/gtk_path.c'; else $(CYGPATH_W) '$(srcdir)/gtkui/gtk_path.c'; fi`; \
2.248 +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/gtk_path.Tpo" "$(DEPDIR)/gtk_path.Po"; else rm -f "$(DEPDIR)/gtk_path.Tpo"; exit 1; fi
2.249 +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='gtkui/gtk_path.c' object='gtk_path.obj' libtool=no @AMDEPBACKSLASH@
2.250 @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
2.251 -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o path_dlg.obj `if test -f 'gtkui/path_dlg.c'; then $(CYGPATH_W) 'gtkui/path_dlg.c'; else $(CYGPATH_W) '$(srcdir)/gtkui/path_dlg.c'; fi`
2.252 +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o gtk_path.obj `if test -f 'gtkui/gtk_path.c'; then $(CYGPATH_W) 'gtkui/gtk_path.c'; else $(CYGPATH_W) '$(srcdir)/gtkui/gtk_path.c'; fi`
2.253
2.254 -gdrom_menu.o: gtkui/gdrom_menu.c
2.255 -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT gdrom_menu.o -MD -MP -MF "$(DEPDIR)/gdrom_menu.Tpo" -c -o gdrom_menu.o `test -f 'gtkui/gdrom_menu.c' || echo '$(srcdir)/'`gtkui/gdrom_menu.c; \
2.256 -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/gdrom_menu.Tpo" "$(DEPDIR)/gdrom_menu.Po"; else rm -f "$(DEPDIR)/gdrom_menu.Tpo"; exit 1; fi
2.257 -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='gtkui/gdrom_menu.c' object='gdrom_menu.o' libtool=no @AMDEPBACKSLASH@
2.258 +gtk_gd.o: gtkui/gtk_gd.c
2.259 +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT gtk_gd.o -MD -MP -MF "$(DEPDIR)/gtk_gd.Tpo" -c -o gtk_gd.o `test -f 'gtkui/gtk_gd.c' || echo '$(srcdir)/'`gtkui/gtk_gd.c; \
2.260 +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/gtk_gd.Tpo" "$(DEPDIR)/gtk_gd.Po"; else rm -f "$(DEPDIR)/gtk_gd.Tpo"; exit 1; fi
2.261 +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='gtkui/gtk_gd.c' object='gtk_gd.o' libtool=no @AMDEPBACKSLASH@
2.262 @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
2.263 -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o gdrom_menu.o `test -f 'gtkui/gdrom_menu.c' || echo '$(srcdir)/'`gtkui/gdrom_menu.c
2.264 +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o gtk_gd.o `test -f 'gtkui/gtk_gd.c' || echo '$(srcdir)/'`gtkui/gtk_gd.c
2.265
2.266 -gdrom_menu.obj: gtkui/gdrom_menu.c
2.267 -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT gdrom_menu.obj -MD -MP -MF "$(DEPDIR)/gdrom_menu.Tpo" -c -o gdrom_menu.obj `if test -f 'gtkui/gdrom_menu.c'; then $(CYGPATH_W) 'gtkui/gdrom_menu.c'; else $(CYGPATH_W) '$(srcdir)/gtkui/gdrom_menu.c'; fi`; \
2.268 -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/gdrom_menu.Tpo" "$(DEPDIR)/gdrom_menu.Po"; else rm -f "$(DEPDIR)/gdrom_menu.Tpo"; exit 1; fi
2.269 -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='gtkui/gdrom_menu.c' object='gdrom_menu.obj' libtool=no @AMDEPBACKSLASH@
2.270 +gtk_gd.obj: gtkui/gtk_gd.c
2.271 +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT gtk_gd.obj -MD -MP -MF "$(DEPDIR)/gtk_gd.Tpo" -c -o gtk_gd.obj `if test -f 'gtkui/gtk_gd.c'; then $(CYGPATH_W) 'gtkui/gtk_gd.c'; else $(CYGPATH_W) '$(srcdir)/gtkui/gtk_gd.c'; fi`; \
2.272 +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/gtk_gd.Tpo" "$(DEPDIR)/gtk_gd.Po"; else rm -f "$(DEPDIR)/gtk_gd.Tpo"; exit 1; fi
2.273 +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='gtkui/gtk_gd.c' object='gtk_gd.obj' libtool=no @AMDEPBACKSLASH@
2.274 @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
2.275 -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o gdrom_menu.obj `if test -f 'gtkui/gdrom_menu.c'; then $(CYGPATH_W) 'gtkui/gdrom_menu.c'; else $(CYGPATH_W) '$(srcdir)/gtkui/gdrom_menu.c'; fi`
2.276 +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o gtk_gd.obj `if test -f 'gtkui/gtk_gd.c'; then $(CYGPATH_W) 'gtkui/gtk_gd.c'; else $(CYGPATH_W) '$(srcdir)/gtkui/gtk_gd.c'; fi`
2.277
2.278 video_gtk.o: drivers/video_gtk.c
2.279 @am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT video_gtk.o -MD -MP -MF "$(DEPDIR)/video_gtk.Tpo" -c -o video_gtk.o `test -f 'drivers/video_gtk.c' || echo '$(srcdir)/'`drivers/video_gtk.c; \
3.1 --- a/src/gtkui/ctrl_dlg.c Mon Jul 21 12:21:20 2008 +0000
3.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
3.3 @@ -1,318 +0,0 @@
3.4 -/**
3.5 - * $Id$
3.6 - *
3.7 - * Define the main (emu) GTK window, along with its menubars,
3.8 - * toolbars, etc.
3.9 - *
3.10 - * Copyright (c) 2005 Nathan Keynes.
3.11 - *
3.12 - * This program is free software; you can redistribute it and/or modify
3.13 - * it under the terms of the GNU General Public License as published by
3.14 - * the Free Software Foundation; either version 2 of the License, or
3.15 - * (at your option) any later version.
3.16 - *
3.17 - * This program is distributed in the hope that it will be useful,
3.18 - * but WITHOUT ANY WARRANTY; without even the implied warranty of
3.19 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3.20 - * GNU General Public License for more details.
3.21 - */
3.22 -
3.23 -#include <assert.h>
3.24 -#include <string.h>
3.25 -#include <gtk/gtk.h>
3.26 -#include <gdk/gdkkeysyms.h>
3.27 -
3.28 -#include "lxdream.h"
3.29 -#include "display.h"
3.30 -#include "gtkui/gtkui.h"
3.31 -#include "maple/maple.h"
3.32 -
3.33 -#define MAX_DEVICES 4
3.34 -
3.35 -static void controller_device_configure(maple_device_t device);
3.36 -
3.37 -struct maple_config_class {
3.38 - const char *name;
3.39 - void (*config_func)(maple_device_t device);
3.40 -};
3.41 -
3.42 -typedef struct maple_slot_data {
3.43 - maple_device_t old_device;
3.44 - maple_device_t new_device;
3.45 - GtkWidget *button;
3.46 - GtkWidget *combo;
3.47 -} *maple_slot_data_t;
3.48 -
3.49 -static struct maple_config_class maple_device_config[] = {
3.50 - { "Sega Controller", controller_device_configure },
3.51 - { NULL, NULL } };
3.52 -
3.53 -static struct maple_slot_data maple_data[MAX_DEVICES];
3.54 -
3.55 -static void config_keysym_hook( void *data, const gchar *keysym )
3.56 -{
3.57 - GtkWidget *widget = (GtkWidget *)data;
3.58 - gtk_entry_set_text( GTK_ENTRY(widget), keysym );
3.59 - g_object_set_data( G_OBJECT(widget), "keypress_mode", GINT_TO_POINTER(FALSE) );
3.60 - input_set_keysym_hook(NULL, NULL);
3.61 -}
3.62 -
3.63 -static gboolean config_key_buttonpress( GtkWidget *widget, GdkEventButton *event, gpointer user_data )
3.64 -{
3.65 - gboolean keypress_mode = GPOINTER_TO_INT(g_object_get_data( G_OBJECT(widget), "keypress_mode"));
3.66 - if( !keypress_mode ) {
3.67 - gtk_entry_set_text( GTK_ENTRY(widget), _("<press key>") );
3.68 - g_object_set_data( G_OBJECT(widget), "keypress_mode", GINT_TO_POINTER(TRUE) );
3.69 - input_set_keysym_hook(config_keysym_hook, widget);
3.70 - }
3.71 - return FALSE;
3.72 -}
3.73 -
3.74 -static gboolean config_key_keypress( GtkWidget *widget, GdkEventKey *event, gpointer user_data )
3.75 -{
3.76 - gboolean keypress_mode = GPOINTER_TO_INT(g_object_get_data( G_OBJECT(widget), "keypress_mode"));
3.77 - if( keypress_mode ) {
3.78 - if( event->keyval == GDK_Escape ) {
3.79 - gtk_entry_set_text( GTK_ENTRY(widget), "" );
3.80 - g_object_set_data( G_OBJECT(widget), "keypress_mode", GINT_TO_POINTER(FALSE) );
3.81 - return TRUE;
3.82 - }
3.83 - GdkKeymap *keymap = gdk_keymap_get_default();
3.84 - guint keyval;
3.85 -
3.86 - gdk_keymap_translate_keyboard_state( keymap, event->hardware_keycode, 0, 0, &keyval,
3.87 - NULL, NULL, NULL );
3.88 - gtk_entry_set_text( GTK_ENTRY(widget), gdk_keyval_name(keyval) );
3.89 - g_object_set_data( G_OBJECT(widget), "keypress_mode", GINT_TO_POINTER(FALSE) );
3.90 - input_set_keysym_hook(NULL, NULL);
3.91 - return TRUE;
3.92 - } else {
3.93 - switch( event->keyval ) {
3.94 - case GDK_Return:
3.95 - case GDK_KP_Enter:
3.96 - gtk_entry_set_text( GTK_ENTRY(widget), _("<press key>") );
3.97 - g_object_set_data( G_OBJECT(widget), "keypress_mode", GINT_TO_POINTER(TRUE) );
3.98 - input_set_keysym_hook(config_keysym_hook, widget);
3.99 - return TRUE;
3.100 - case GDK_BackSpace:
3.101 - case GDK_Delete:
3.102 - gtk_entry_set_text( GTK_ENTRY(widget), "" );
3.103 - return TRUE;
3.104 - }
3.105 - return FALSE;
3.106 - }
3.107 -
3.108 -}
3.109 -
3.110 -static void controller_config_done( GtkWidget *panel, gboolean isOK )
3.111 -{
3.112 - if( isOK ) {
3.113 - maple_device_t device = (maple_device_t)gtk_object_get_data( GTK_OBJECT(panel), "maple_device" );
3.114 - lxdream_config_entry_t conf = device->get_config(device);
3.115 - int i;
3.116 - for( i=0; conf[i].key != NULL; i++ ) {
3.117 - char buf[64];
3.118 - GtkWidget *entry1, *entry2;
3.119 - const gchar *key1, *key2;
3.120 - snprintf( buf, sizeof(buf), "%s.1", conf[i].key );
3.121 - entry1 = GTK_WIDGET(g_object_get_qdata( G_OBJECT(panel), g_quark_from_string(buf)));
3.122 - key1 = gtk_entry_get_text(GTK_ENTRY(entry1));
3.123 - snprintf( buf, sizeof(buf), "%s.2", conf[i].key );
3.124 - entry2 = GTK_WIDGET(g_object_get_qdata( G_OBJECT(panel), g_quark_from_string(buf)));
3.125 - key2 = gtk_entry_get_text(GTK_ENTRY(entry2));
3.126 - if( key1 == NULL || key1[0] == '\0') {
3.127 - lxdream_set_config_value( &conf[i], key2 );
3.128 - } else if( key2 == NULL || key2[0] == '\0') {
3.129 - lxdream_set_config_value( &conf[i], key1 );
3.130 - } else {
3.131 - char buf[64];
3.132 - snprintf( buf, sizeof(buf), "%s, %s", key1, key2 );
3.133 - lxdream_set_config_value( &conf[i], buf );
3.134 - }
3.135 - }
3.136 - }
3.137 - input_set_keysym_hook(NULL, NULL);
3.138 -}
3.139 -
3.140 -static void controller_device_configure( maple_device_t device )
3.141 -{
3.142 - lxdream_config_entry_t conf = device->get_config(device);
3.143 - int count, i;
3.144 - for( count=0; conf[count].key != NULL; count++ );
3.145 -
3.146 - GtkWidget *table = gtk_table_new( (count+1)>>1, 6, FALSE );
3.147 - GList *focus_chain = NULL;
3.148 - gtk_object_set_data( GTK_OBJECT(table), "maple_device", device );
3.149 - for( i=0; i<count; i++ ) {
3.150 - GtkWidget *text, *text2;
3.151 - char buf[64];
3.152 - int x=0;
3.153 - int y=i;
3.154 - if( i >= (count+1)>>1 ) {
3.155 - x = 3;
3.156 - y -= (count+1)>>1;
3.157 - }
3.158 - gtk_table_attach( GTK_TABLE(table), gtk_label_new(conf[i].key), x, x+1, y, y+1,
3.159 - GTK_SHRINK, GTK_SHRINK, 0, 0 );
3.160 - text = gtk_entry_new();
3.161 - gtk_entry_set_width_chars( GTK_ENTRY(text), 11 );
3.162 - gtk_entry_set_editable( GTK_ENTRY(text), FALSE );
3.163 - g_signal_connect( text, "key_press_event",
3.164 - G_CALLBACK(config_key_keypress), NULL );
3.165 - g_signal_connect( text, "button_press_event",
3.166 - G_CALLBACK(config_key_buttonpress), NULL );
3.167 - snprintf( buf, sizeof(buf), "%s.1", conf[i].key );
3.168 - g_object_set_data( G_OBJECT(text), "keypress_mode", GINT_TO_POINTER(FALSE) );
3.169 - g_object_set_qdata( G_OBJECT(table), g_quark_from_string(buf), text );
3.170 - gtk_table_attach_defaults( GTK_TABLE(table), text, x+1, x+2, y, y+1);
3.171 - focus_chain = g_list_append( focus_chain, text );
3.172 - text2 = gtk_entry_new();
3.173 - gtk_entry_set_width_chars( GTK_ENTRY(text2), 11 );
3.174 - gtk_entry_set_editable( GTK_ENTRY(text2), FALSE );
3.175 - g_signal_connect( text2, "key_press_event",
3.176 - G_CALLBACK(config_key_keypress), NULL );
3.177 - g_signal_connect( text2, "button_press_event",
3.178 - G_CALLBACK(config_key_buttonpress), NULL );
3.179 - snprintf( buf, sizeof(buf), "%s.2", conf[i].key );
3.180 - g_object_set_data( G_OBJECT(text2), "keypress_mode", GINT_TO_POINTER(FALSE) );
3.181 - g_object_set_qdata( G_OBJECT(table), g_quark_from_string(buf), text2 );
3.182 - gtk_table_attach_defaults( GTK_TABLE(table), text2, x+2, x+3, y, y+1);
3.183 - focus_chain = g_list_append( focus_chain, text2 );
3.184 - if( conf[i].value != NULL ) {
3.185 - gchar **parts = g_strsplit(conf[i].value,",",3);
3.186 - if( parts[0] != NULL ) {
3.187 - gtk_entry_set_text( GTK_ENTRY(text), g_strstrip(parts[0]) );
3.188 - if( parts[1] != NULL ) {
3.189 - gtk_entry_set_text( GTK_ENTRY(text2), g_strstrip(parts[1]) );
3.190 - }
3.191 - }
3.192 - g_strfreev(parts);
3.193 - }
3.194 - }
3.195 - gtk_container_set_focus_chain( GTK_CONTAINER(table), focus_chain );
3.196 - gtk_gui_run_property_dialog( _("Controller Configuration"), table, controller_config_done );
3.197 -}
3.198 -
3.199 -gboolean maple_properties_activated( GtkButton *button, gpointer user_data )
3.200 -{
3.201 - maple_slot_data_t data = (maple_slot_data_t)user_data;
3.202 - if( data->new_device != NULL ) {
3.203 - int i;
3.204 - for( i=0; maple_device_config[i].name != NULL; i++ ) {
3.205 - if( strcmp(data->new_device->device_class->name, maple_device_config[i].name) == 0 ) {
3.206 - if( data->new_device == data->old_device ) {
3.207 - // Make a copy at this point if we haven't already
3.208 - data->new_device = data->old_device->clone(data->old_device);
3.209 - }
3.210 - maple_device_config[i].config_func(data->new_device);
3.211 - break;
3.212 - }
3.213 - }
3.214 - if( maple_device_config[i].name == NULL ) {
3.215 - gui_error_dialog( _("No configuration page available for device type") );
3.216 - }
3.217 - }
3.218 - return TRUE;
3.219 -}
3.220 -
3.221 -gboolean maple_device_changed( GtkComboBox *combo, gpointer user_data )
3.222 -{
3.223 - maple_slot_data_t data = (maple_slot_data_t)user_data;
3.224 - int active = gtk_combo_box_get_active(combo);
3.225 - gboolean has_config = FALSE;
3.226 - if( active != 0 ) {
3.227 - gchar *devname = gtk_combo_box_get_active_text(combo);
3.228 - const maple_device_class_t devclz = maple_get_device_class(devname);
3.229 - assert(devclz != NULL);
3.230 - if( data->new_device != NULL ) {
3.231 - if( data->new_device->device_class != devclz ) {
3.232 - if( data->new_device != data->old_device ) {
3.233 - data->new_device->destroy(data->new_device);
3.234 - }
3.235 - data->new_device = maple_new_device(devname);
3.236 - }
3.237 - } else {
3.238 - data->new_device = maple_new_device(devname);
3.239 - }
3.240 - has_config = data->new_device != NULL && data->new_device->get_config != NULL;
3.241 - } else {
3.242 - if( data->new_device != NULL && data->new_device != data->old_device ) {
3.243 - data->new_device->destroy(data->new_device);
3.244 - }
3.245 - data->new_device = NULL;
3.246 - }
3.247 - gtk_widget_set_sensitive(data->button, has_config);
3.248 - return TRUE;
3.249 -}
3.250 -
3.251 -void maple_dialog_done( GtkWidget *panel, gboolean isOK )
3.252 -{
3.253 - if( isOK ) {
3.254 - int i;
3.255 - for( i=0; i<MAX_DEVICES; i++ ) {
3.256 - if( maple_data[i].new_device != maple_data[i].old_device ) {
3.257 - if( maple_data[i].old_device != NULL ) {
3.258 - maple_detach_device(i,0);
3.259 - }
3.260 - if( maple_data[i].new_device != NULL ) {
3.261 - maple_attach_device(maple_data[i].new_device, i, 0 );
3.262 - }
3.263 - }
3.264 - }
3.265 - lxdream_save_config();
3.266 - } else {
3.267 - int i;
3.268 - for( i=0; i<MAX_DEVICES; i++ ) {
3.269 - if( maple_data[i].new_device != NULL &&
3.270 - maple_data[i].new_device != maple_data[i].old_device ) {
3.271 - maple_data[i].new_device->destroy(maple_data[i].new_device);
3.272 - }
3.273 - }
3.274 - }
3.275 -
3.276 -}
3.277 -
3.278 -GtkWidget *maple_panel_new()
3.279 -{
3.280 - GtkWidget *table = gtk_table_new(4, 3, TRUE);
3.281 - int i,j;
3.282 - const struct maple_device_class **devices = maple_get_device_classes();
3.283 -
3.284 - for( i=0; i< MAX_DEVICES; i++ ) {
3.285 - char buf[12];
3.286 - GtkWidget *combo, *button;
3.287 - int active = 0;
3.288 - maple_device_t device = maple_get_device(i,0);
3.289 - sprintf( buf, _("Slot %d."), i );
3.290 - gtk_table_attach_defaults( GTK_TABLE(table), gtk_label_new(buf), 0, 1, i, i+1 );
3.291 - combo = gtk_combo_box_new_text();
3.292 - gtk_combo_box_append_text( GTK_COMBO_BOX(combo), _("<empty>") );
3.293 - for( j=0; devices[j] != NULL; j++ ) {
3.294 - gtk_combo_box_append_text(GTK_COMBO_BOX(combo), devices[j]->name);
3.295 - if( device != NULL && device->device_class == devices[j] ) {
3.296 - active = j+1;
3.297 - }
3.298 - }
3.299 - gtk_combo_box_set_active(GTK_COMBO_BOX(combo), active);
3.300 - gtk_table_attach_defaults( GTK_TABLE(table), combo, 1, 2, i, i+1 );
3.301 - button = gtk_button_new_from_stock( GTK_STOCK_PROPERTIES );
3.302 - gtk_widget_set_sensitive(button, active != 0 && device->get_config != NULL);
3.303 - gtk_table_attach_defaults( GTK_TABLE(table), button, 2, 3, i, i+1 );
3.304 -
3.305 - maple_data[i].old_device = device;
3.306 - maple_data[i].new_device = device;
3.307 - maple_data[i].combo = combo;
3.308 - maple_data[i].button = button;
3.309 - g_signal_connect( button, "clicked",
3.310 - G_CALLBACK( maple_properties_activated ), &maple_data[i] );
3.311 - g_signal_connect( combo, "changed",
3.312 - G_CALLBACK( maple_device_changed ), &maple_data[i] );
3.313 -
3.314 - }
3.315 - return table;
3.316 -}
3.317 -
3.318 -void maple_dialog_run( )
3.319 -{
3.320 - gtk_gui_run_property_dialog( _("Controller Settings"), maple_panel_new(), maple_dialog_done );
3.321 -}
4.1 --- a/src/gtkui/debug_win.c Mon Jul 21 12:21:20 2008 +0000
4.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
4.3 @@ -1,454 +0,0 @@
4.4 -/**
4.5 - * $Id$
4.6 - * This file is responsible for the main debugger gui frame.
4.7 - *
4.8 - * Copyright (c) 2005 Nathan Keynes.
4.9 - *
4.10 - * This program is free software; you can redistribute it and/or modify
4.11 - * it under the terms of the GNU General Public License as published by
4.12 - * the Free Software Foundation; either version 2 of the License, or
4.13 - * (at your option) any later version.
4.14 - *
4.15 - * This program is distributed in the hope that it will be useful,
4.16 - * but WITHOUT ANY WARRANTY; without even the implied warranty of
4.17 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
4.18 - * GNU General Public License for more details.
4.19 - */
4.20 -#include <stdlib.h>
4.21 -#include <stdarg.h>
4.22 -#include <stdio.h>
4.23 -#include <string.h>
4.24 -#include <math.h>
4.25 -#include <gdk/gdkkeysyms.h>
4.26 -#include "mem.h"
4.27 -#include "cpu.h"
4.28 -#include "dreamcast.h"
4.29 -#include "gtkui/gtkui.h"
4.30 -#include "sh4/sh4dasm.h"
4.31 -#include "aica/armdasm.h"
4.32 -
4.33 -GdkColor *msg_colors[] = { &gui_colour_error, &gui_colour_error, &gui_colour_warn,
4.34 - &gui_colour_normal,&gui_colour_debug, &gui_colour_trace };
4.35 -
4.36 -const cpu_desc_t cpu_list[4] = { &sh4_cpu_desc, &arm_cpu_desc, &armt_cpu_desc, NULL };
4.37 -
4.38 -void init_register_list( debug_window_t data );
4.39 -uint32_t row_to_address( debug_window_t data, int row );
4.40 -int address_to_row( debug_window_t data, uint32_t address );
4.41 -void set_disassembly_pc( debug_window_t data, unsigned int pc, gboolean select );
4.42 -void set_disassembly_region( debug_window_t data, unsigned int page );
4.43 -void set_disassembly_cpu( debug_window_t data, const gchar *cpu );
4.44 -
4.45 -void on_mode_field_changed ( GtkEditable *editable, gpointer user_data);
4.46 -gboolean on_page_field_key_press_event( GtkWidget * widget, GdkEventKey *event,
4.47 - gpointer user_data);
4.48 -void on_jump_pc_btn_clicked( GtkButton *button, gpointer user_data);
4.49 -void on_disasm_list_select_row (GtkCList *clist, gint row, gint column,
4.50 - GdkEvent *event, gpointer user_data);
4.51 -void on_disasm_list_unselect_row (GtkCList *clist, gint row, gint column,
4.52 - GdkEvent *event, gpointer user_data);
4.53 -gboolean on_debug_delete_event(GtkWidget *widget, GdkEvent event, gpointer user_data);
4.54 -
4.55 -struct debug_window_info {
4.56 - int disasm_from;
4.57 - int disasm_to;
4.58 - int disasm_pc;
4.59 - const struct cpu_desc_struct *cpu;
4.60 - const cpu_desc_t *cpu_list;
4.61 - GtkCList *regs_list;
4.62 - GtkCList *disasm_list;
4.63 - GtkEntry *page_field;
4.64 - GtkWidget *window;
4.65 - GtkWidget *statusbar;
4.66 - char saved_regs[0];
4.67 -};
4.68 -
4.69 -debug_window_t debug_window_new( const gchar *title, GtkWidget *menubar,
4.70 - GtkWidget *toolbar, GtkAccelGroup *accel_group )
4.71 -{
4.72 - debug_window_t data = g_malloc0( sizeof(struct debug_window_info) + cpu_list[0]->regs_size );
4.73 - GtkWidget *vbox;
4.74 -
4.75 - data->window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
4.76 - gtk_window_set_default_size (GTK_WINDOW (data->window), 700, 480);
4.77 - gtk_window_set_title( GTK_WINDOW(data->window), title );
4.78 - gtk_window_add_accel_group (GTK_WINDOW (data->window), accel_group);
4.79 -
4.80 - gtk_toolbar_set_style( GTK_TOOLBAR(toolbar), GTK_TOOLBAR_ICONS );
4.81 -
4.82 - data->statusbar = gtk_statusbar_new();
4.83 -
4.84 - GtkWidget *hpaned = gtk_hpaned_new ();
4.85 - gtk_paned_set_position (GTK_PANED (hpaned), 500);
4.86 -
4.87 - GtkWidget *disasm_box = gtk_vbox_new(FALSE,0);
4.88 - gtk_paned_pack1 (GTK_PANED (hpaned), disasm_box, TRUE, TRUE);
4.89 -
4.90 - GtkWidget *hbox1 = gtk_hbox_new (FALSE, 0);
4.91 - gtk_box_pack_start (GTK_BOX (disasm_box), hbox1, FALSE, FALSE, 3);
4.92 - gtk_box_pack_start (GTK_BOX (hbox1), gtk_label_new (_("Page")), FALSE, FALSE, 4);
4.93 -
4.94 - data->page_field = GTK_ENTRY(gtk_entry_new ());
4.95 - gtk_box_pack_start (GTK_BOX (hbox1), GTK_WIDGET(data->page_field), FALSE, TRUE, 0);
4.96 -
4.97 - GtkWidget *jump_pc_btn = gtk_button_new_with_mnemonic (_(" Jump to PC "));
4.98 - gtk_box_pack_start (GTK_BOX (hbox1), jump_pc_btn, FALSE, FALSE, 4);
4.99 -
4.100 - gtk_box_pack_start (GTK_BOX (hbox1), gtk_label_new(_("Mode")), FALSE, FALSE, 5);
4.101 -
4.102 - GtkWidget *mode_box = gtk_combo_new ();
4.103 - gtk_box_pack_start (GTK_BOX (hbox1), mode_box, FALSE, FALSE, 0);
4.104 - GList *mode_box_items = NULL;
4.105 - mode_box_items = g_list_append (mode_box_items, (gpointer) _("SH4"));
4.106 - mode_box_items = g_list_append (mode_box_items, (gpointer) _("ARM7"));
4.107 - mode_box_items = g_list_append (mode_box_items, (gpointer) _("ARM7T"));
4.108 - gtk_combo_set_popdown_strings (GTK_COMBO (mode_box), mode_box_items);
4.109 - g_list_free (mode_box_items);
4.110 -
4.111 - GtkWidget *mode_field = GTK_COMBO (mode_box)->entry;
4.112 - gtk_editable_set_editable (GTK_EDITABLE (mode_field), FALSE);
4.113 -
4.114 - GtkWidget *disasm_scroll = gtk_scrolled_window_new (NULL, NULL);
4.115 - gtk_box_pack_start (GTK_BOX (disasm_box), disasm_scroll, TRUE, TRUE, 0);
4.116 - gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (disasm_scroll), GTK_SHADOW_IN);
4.117 - data->disasm_list = GTK_CLIST(gtk_clist_new (4));
4.118 - gtk_clist_set_column_width (GTK_CLIST (data->disasm_list), 0, 80);
4.119 - gtk_clist_set_column_width (GTK_CLIST (data->disasm_list), 2, 80);
4.120 - gtk_clist_set_column_width (GTK_CLIST (data->disasm_list), 3, 80);
4.121 - gtk_clist_set_column_width( data->disasm_list, 1, 16 );
4.122 - gtk_clist_column_titles_hide (GTK_CLIST (data->disasm_list));
4.123 - gtk_container_add (GTK_CONTAINER (disasm_scroll), GTK_WIDGET(data->disasm_list));
4.124 -
4.125 - GtkWidget *reg_scroll = gtk_scrolled_window_new (NULL, NULL);
4.126 - gtk_paned_pack2 (GTK_PANED (hpaned), reg_scroll, FALSE, TRUE);
4.127 - gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (reg_scroll), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
4.128 - gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (reg_scroll), GTK_SHADOW_IN);
4.129 -
4.130 - data->regs_list = GTK_CLIST(gtk_clist_new (2));
4.131 - gtk_container_add (GTK_CONTAINER (reg_scroll), GTK_WIDGET(data->regs_list));
4.132 - gtk_clist_set_column_width (GTK_CLIST (data->regs_list), 0, 80);
4.133 - gtk_clist_set_column_width (GTK_CLIST (data->regs_list), 1, 80);
4.134 - gtk_clist_column_titles_hide (GTK_CLIST (data->regs_list));
4.135 - gtk_widget_modify_font( GTK_WIDGET(data->regs_list), gui_fixed_font );
4.136 -
4.137 - vbox = gtk_vbox_new(FALSE, 0);
4.138 - gtk_container_add( GTK_CONTAINER(data->window), vbox );
4.139 - gtk_box_pack_start( GTK_BOX(vbox), menubar, FALSE, FALSE, 0 );
4.140 - gtk_box_pack_start( GTK_BOX(vbox), toolbar, FALSE, FALSE, 0 );
4.141 - gtk_box_pack_start( GTK_BOX(vbox), hpaned, TRUE, TRUE, 0 );
4.142 - gtk_box_pack_start( GTK_BOX(vbox), data->statusbar, FALSE, FALSE, 0 );
4.143 -
4.144 - g_signal_connect ((gpointer) data->page_field, "key_press_event",
4.145 - G_CALLBACK (on_page_field_key_press_event),
4.146 - data);
4.147 - g_signal_connect ((gpointer) jump_pc_btn, "clicked",
4.148 - G_CALLBACK (on_jump_pc_btn_clicked),
4.149 - data);
4.150 - g_signal_connect ((gpointer) mode_field, "changed",
4.151 - G_CALLBACK (on_mode_field_changed),
4.152 - data);
4.153 - g_signal_connect ((gpointer) data->disasm_list, "select_row",
4.154 - G_CALLBACK (on_disasm_list_select_row),
4.155 - data);
4.156 - g_signal_connect ((gpointer) data->disasm_list, "unselect_row",
4.157 - G_CALLBACK (on_disasm_list_unselect_row),
4.158 - data);
4.159 - g_signal_connect ((gpointer) data->window, "delete_event",
4.160 - G_CALLBACK (on_debug_delete_event),
4.161 - data);
4.162 -
4.163 - data->disasm_from = -1;
4.164 - data->disasm_to = -1;
4.165 - data->disasm_pc = -1;
4.166 - data->cpu = cpu_list[0];
4.167 - data->cpu_list = cpu_list;
4.168 -
4.169 - init_register_list( data );
4.170 - gtk_object_set_data( GTK_OBJECT(data->window), "debug_data", data );
4.171 - set_disassembly_pc( data, *data->cpu->pc, FALSE );
4.172 - debug_window_set_running( data, FALSE );
4.173 -
4.174 - gtk_widget_show_all( data->window );
4.175 - return data;
4.176 -}
4.177 -
4.178 -void debug_window_show( debug_window_t data, gboolean show )
4.179 -{
4.180 - if( show ) {
4.181 - gtk_widget_show( data->window );
4.182 - } else {
4.183 - gtk_widget_hide( data->window );
4.184 - }
4.185 -}
4.186 -
4.187 -int debug_window_get_selected_row( debug_window_t data )
4.188 -{
4.189 - if( data->disasm_list->selection == NULL ) {
4.190 - return -1;
4.191 - } else {
4.192 - return GPOINTER_TO_INT(data->disasm_list->selection->data);
4.193 - }
4.194 -}
4.195 -
4.196 -void init_register_list( debug_window_t data )
4.197 -{
4.198 - int i;
4.199 - char buf[20];
4.200 - char *arr[2];
4.201 -
4.202 - gtk_clist_clear( data->regs_list );
4.203 - arr[1] = buf;
4.204 - for( i=0; data->cpu->regs_info[i].name != NULL; i++ ) {
4.205 - arr[0] = data->cpu->regs_info[i].name;
4.206 - if( data->cpu->regs_info->type == REG_INT )
4.207 - sprintf( buf, "%08X", *((uint32_t *)data->cpu->regs_info[i].value) );
4.208 - else
4.209 - sprintf( buf, "%f", *((float *)data->cpu->regs_info[i].value) );
4.210 - gtk_clist_append( data->regs_list, arr );
4.211 - }
4.212 -}
4.213 -
4.214 -/*
4.215 - * Check for changed registers and update the display
4.216 - */
4.217 -void debug_window_update( debug_window_t data )
4.218 -{
4.219 - int i;
4.220 - for( i=0; data->cpu->regs_info[i].name != NULL; i++ ) {
4.221 - if( data->cpu->regs_info[i].type == REG_INT ) {
4.222 - /* Yes this _is_ probably fairly evil */
4.223 - if( *((uint32_t *)data->cpu->regs_info[i].value) !=
4.224 - *((uint32_t *)((char *)data->saved_regs + ((char *)data->cpu->regs_info[i].value - (char *)data->cpu->regs))) ) {
4.225 - char buf[20];
4.226 - sprintf( buf, "%08X", *((uint32_t *)data->cpu->regs_info[i].value) );
4.227 - gtk_clist_set_text( data->regs_list, i, 1, buf );
4.228 - gtk_clist_set_foreground( data->regs_list, i, &gui_colour_changed );
4.229 - } else {
4.230 - gtk_clist_set_foreground( data->regs_list, i, &gui_colour_normal );
4.231 - }
4.232 - } else {
4.233 - if( *((float *)data->cpu->regs_info[i].value) !=
4.234 - *((float *)((char *)data->saved_regs + ((char *)data->cpu->regs_info[i].value - (char *)data->cpu->regs))) ) {
4.235 - char buf[20];
4.236 - sprintf( buf, "%f", *((float *)data->cpu->regs_info[i].value) );
4.237 - gtk_clist_set_text( data->regs_list, i, 1, buf );
4.238 - gtk_clist_set_foreground( data->regs_list, i, &gui_colour_changed );
4.239 - } else {
4.240 - gtk_clist_set_foreground( data->regs_list, i, &gui_colour_normal );
4.241 - }
4.242 - }
4.243 - }
4.244 -
4.245 - set_disassembly_pc( data, *data->cpu->pc, TRUE );
4.246 - memcpy( data->saved_regs, data->cpu->regs, data->cpu->regs_size );
4.247 -}
4.248 -
4.249 -void set_disassembly_region( debug_window_t data, unsigned int page )
4.250 -{
4.251 - uint32_t i, posn, next;
4.252 - char buf[80];
4.253 - char addr[10];
4.254 - char opcode[16] = "";
4.255 - char *arr[4] = { addr, " ", opcode, buf };
4.256 - unsigned int from = page & 0xFFFFF000;
4.257 - unsigned int to = from + 4096;
4.258 -
4.259 - gtk_clist_clear(data->disasm_list);
4.260 -
4.261 - sprintf( addr, "%08X", from );
4.262 - gtk_entry_set_text( data->page_field, addr );
4.263 -
4.264 - if( !data->cpu->is_valid_page_func( from ) ) {
4.265 - arr[3] = _("This page is currently unmapped");
4.266 - gtk_clist_append( data->disasm_list, arr );
4.267 - gtk_clist_set_foreground( data->disasm_list, 0, &gui_colour_error );
4.268 - } else {
4.269 - for( i=from; i<to; i = next ) {
4.270 - next = data->cpu->disasm_func( i, buf, sizeof(buf), opcode );
4.271 - sprintf( addr, "%08X", i );
4.272 - posn = gtk_clist_append( data->disasm_list, arr );
4.273 - if( buf[0] == '?' )
4.274 - gtk_clist_set_foreground( data->disasm_list, posn, &gui_colour_warn );
4.275 - if( data->cpu->get_breakpoint != NULL ) {
4.276 - int type = data->cpu->get_breakpoint( i );
4.277 - switch(type) {
4.278 - case BREAK_ONESHOT:
4.279 - gtk_clist_set_background( data->disasm_list, posn, &gui_colour_temp_break );
4.280 - break;
4.281 - case BREAK_KEEP:
4.282 - gtk_clist_set_background( data->disasm_list, posn, &gui_colour_break );
4.283 - break;
4.284 - }
4.285 - }
4.286 - }
4.287 - if( data->disasm_pc != -1 && data->disasm_pc >= from && data->disasm_pc < to )
4.288 - gtk_clist_set_foreground( data->disasm_list, address_to_row(data, data->disasm_pc),
4.289 - &gui_colour_pc );
4.290 - }
4.291 -
4.292 - if( page != from ) { /* not a page boundary */
4.293 - gtk_clist_moveto( data->disasm_list, (page-from)>>1, 0, 0.5, 0.0 );
4.294 - }
4.295 - data->disasm_from = from;
4.296 - data->disasm_to = to;
4.297 -}
4.298 -
4.299 -void jump_to_disassembly( debug_window_t data, unsigned int addr, gboolean select )
4.300 -{
4.301 - int row;
4.302 -
4.303 - if( addr < data->disasm_from || addr >= data->disasm_to )
4.304 - set_disassembly_region(data,addr);
4.305 -
4.306 - row = address_to_row( data, addr );
4.307 - if(select) {
4.308 - gtk_clist_select_row( data->disasm_list, row, 0 );
4.309 - }
4.310 - if( gtk_clist_row_is_visible( data->disasm_list, row ) != GTK_VISIBILITY_FULL ){
4.311 - gtk_clist_moveto( data->disasm_list, row, 0, 0.5, 0.0 );
4.312 - }
4.313 -}
4.314 -
4.315 -void jump_to_pc( debug_window_t data, gboolean select )
4.316 -{
4.317 - jump_to_disassembly( data, *data->cpu->pc, select );
4.318 -}
4.319 -
4.320 -void set_disassembly_pc( debug_window_t data, unsigned int pc, gboolean select )
4.321 -{
4.322 - int row;
4.323 -
4.324 - jump_to_disassembly( data, pc, select );
4.325 - if( data->disasm_pc != -1 && data->disasm_pc >= data->disasm_from &&
4.326 - data->disasm_pc < data->disasm_to )
4.327 - gtk_clist_set_foreground( data->disasm_list,
4.328 - (data->disasm_pc - data->disasm_from) / data->cpu->instr_size,
4.329 - &gui_colour_normal );
4.330 - row = address_to_row( data, pc );
4.331 - gtk_clist_set_foreground( data->disasm_list, row, &gui_colour_pc );
4.332 - data->disasm_pc = pc;
4.333 -}
4.334 -
4.335 -void set_disassembly_cpu( debug_window_t data, const gchar *cpu )
4.336 -{
4.337 - int i;
4.338 - for( i=0; data->cpu_list[i] != NULL; i++ ) {
4.339 - if( strcmp( data->cpu_list[i]->name, cpu ) == 0 ) {
4.340 - if( data->cpu != data->cpu_list[i] ) {
4.341 - data->cpu = data->cpu_list[i];
4.342 - data->disasm_from = data->disasm_to = -1; /* Force reload */
4.343 - set_disassembly_pc( data, *data->cpu->pc, FALSE );
4.344 - init_register_list( data );
4.345 - }
4.346 - return;
4.347 - }
4.348 - }
4.349 -}
4.350 -
4.351 -void debug_window_toggle_breakpoint( debug_window_t data, int row )
4.352 -{
4.353 - uint32_t pc = row_to_address( data, row );
4.354 - int oldType = data->cpu->get_breakpoint( pc );
4.355 - if( oldType != BREAK_NONE ) {
4.356 - data->cpu->clear_breakpoint( pc, oldType );
4.357 - gtk_clist_set_background( data->disasm_list, row, &gui_colour_white );
4.358 - } else {
4.359 - data->cpu->set_breakpoint( pc, BREAK_KEEP );
4.360 - gtk_clist_set_background( data->disasm_list, row, &gui_colour_break );
4.361 - }
4.362 -}
4.363 -
4.364 -void debug_window_set_oneshot_breakpoint( debug_window_t data, int row )
4.365 -{
4.366 - uint32_t pc = row_to_address( data, row );
4.367 - data->cpu->clear_breakpoint( pc, BREAK_ONESHOT );
4.368 - data->cpu->set_breakpoint( pc, BREAK_ONESHOT );
4.369 - gtk_clist_set_background( data->disasm_list, row, &gui_colour_temp_break );
4.370 -}
4.371 -
4.372 -/**
4.373 - * Execute a single instruction using the current CPU mode.
4.374 - */
4.375 -void debug_window_single_step( debug_window_t data )
4.376 -{
4.377 - data->cpu->step_func();
4.378 - gtk_gui_update();
4.379 -}
4.380 -
4.381 -uint32_t row_to_address( debug_window_t data, int row ) {
4.382 - return data->cpu->instr_size * row + data->disasm_from;
4.383 -}
4.384 -
4.385 -int address_to_row( debug_window_t data, uint32_t address ) {
4.386 - if( data->disasm_from > address || data->disasm_to <= address )
4.387 - return -1;
4.388 - return (address - data->disasm_from) / data->cpu->instr_size;
4.389 -}
4.390 -
4.391 -debug_window_t get_debug_info( GtkWidget *widget ) {
4.392 -
4.393 - GtkWidget *win = gtk_widget_get_toplevel(widget);
4.394 - debug_window_t data = (debug_window_t)gtk_object_get_data( GTK_OBJECT(win), "debug_data" );
4.395 - return data;
4.396 -}
4.397 -
4.398 -void debug_window_set_running( debug_window_t data, gboolean isRunning )
4.399 -{
4.400 - if( data != NULL ) {
4.401 - gtk_gui_enable_action( "SingleStep", !isRunning );
4.402 - gtk_gui_enable_action( "RunTo", !isRunning && dreamcast_can_run() );
4.403 - }
4.404 -}
4.405 -
4.406 -void on_mode_field_changed ( GtkEditable *editable, gpointer user_data)
4.407 -{
4.408 - const gchar *text = gtk_entry_get_text( GTK_ENTRY(editable) );
4.409 - set_disassembly_cpu( gtk_gui_get_debugger(), text );
4.410 -}
4.411 -
4.412 -
4.413 -gboolean on_page_field_key_press_event( GtkWidget * widget, GdkEventKey *event,
4.414 - gpointer user_data)
4.415 -{
4.416 - if( event->keyval == GDK_Return || event->keyval == GDK_Linefeed ) {
4.417 - debug_window_t data = get_debug_info(widget);
4.418 - const gchar *text = gtk_entry_get_text( GTK_ENTRY(widget) );
4.419 - gchar *endptr;
4.420 - unsigned int val = strtoul( text, &endptr, 16 );
4.421 - if( text == endptr ) { /* invalid input */
4.422 - char buf[10];
4.423 - sprintf( buf, "%08X", row_to_address(data,0) );
4.424 - gtk_entry_set_text( GTK_ENTRY(widget), buf );
4.425 - } else {
4.426 - set_disassembly_region(data, val);
4.427 - }
4.428 - }
4.429 - return FALSE;
4.430 -}
4.431 -
4.432 -
4.433 -void on_jump_pc_btn_clicked( GtkButton *button, gpointer user_data)
4.434 -{
4.435 - debug_window_t data = get_debug_info( GTK_WIDGET(button) );
4.436 - jump_to_pc( data, TRUE );
4.437 -}
4.438 -
4.439 -void on_disasm_list_select_row (GtkCList *clist, gint row, gint column,
4.440 - GdkEvent *event, gpointer user_data)
4.441 -{
4.442 - gtk_gui_enable_action( "SetBreakpoint", TRUE );
4.443 - gtk_gui_enable_action( "RunTo", dreamcast_can_run() );
4.444 -}
4.445 -
4.446 -void on_disasm_list_unselect_row (GtkCList *clist, gint row, gint column,
4.447 - GdkEvent *event, gpointer user_data)
4.448 -{
4.449 - gtk_gui_enable_action( "SetBreakpoint", FALSE );
4.450 - gtk_gui_enable_action( "RunTo", FALSE );
4.451 -}
4.452 -
4.453 -gboolean on_debug_delete_event(GtkWidget *widget, GdkEvent event, gpointer user_data)
4.454 -{
4.455 - gtk_widget_hide( widget );
4.456 - return TRUE;
4.457 -}
5.1 --- a/src/gtkui/dump_win.c Mon Jul 21 12:21:20 2008 +0000
5.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
5.3 @@ -1,256 +0,0 @@
5.4 -/**
5.5 - * $Id$
5.6 - *
5.7 - * Implements the memory dump window.
5.8 - *
5.9 - * Copyright (c) 2005 Nathan Keynes.
5.10 - *
5.11 - * This program is free software; you can redistribute it and/or modify
5.12 - * it under the terms of the GNU General Public License as published by
5.13 - * the Free Software Foundation; either version 2 of the License, or
5.14 - * (at your option) any later version.
5.15 - *
5.16 - * This program is distributed in the hope that it will be useful,
5.17 - * but WITHOUT ANY WARRANTY; without even the implied warranty of
5.18 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
5.19 - * GNU General Public License for more details.
5.20 - */
5.21 -
5.22 -#include <ctype.h>
5.23 -#include <assert.h>
5.24 -#include <string.h>
5.25 -#include <stdlib.h>
5.26 -#include "mem.h"
5.27 -#include "gtkui/gtkui.h"
5.28 -
5.29 -#define MAX_DUMP_SIZE 4096
5.30 -
5.31 -#define DUMP_WINDOW_TAG 0xD4B9DA7A
5.32 -
5.33 -struct dump_window_info {
5.34 - uint32_t _tag;
5.35 - uint32_t start;
5.36 - uint32_t end;
5.37 - int flags;
5.38 - unsigned char *data;
5.39 -
5.40 - GtkWidget *window;
5.41 - GtkWidget *fromInput, *toInput;
5.42 - GtkWidget *textArea;
5.43 - GtkTextTag *changedTag;
5.44 - GtkTextBuffer *textBuffer;
5.45 - struct dump_window_info *next;
5.46 -};
5.47 -
5.48 -static dump_window_t dump_list_head = NULL;
5.49 -
5.50 -gboolean on_dump_window_delete_event( GtkWidget *widget, GdkEvent *event,
5.51 - gpointer user_data );
5.52 -void on_dump_window_button_view_clicked( GtkWidget *widget, gpointer user_data );
5.53 -void dump_window_set_text( dump_window_t data, unsigned char *old_data, unsigned char *new_data );
5.54 -
5.55 -
5.56 -dump_window_t dump_window_new( const gchar *title )
5.57 -{
5.58 - GtkWidget *vbox3;
5.59 - GtkWidget *hbox2;
5.60 - GtkWidget *dump_view_button;
5.61 - GtkWidget *scrolledwindow9;
5.62 -
5.63 - dump_window_t dump = g_malloc0( sizeof( struct dump_window_info ) );
5.64 -
5.65 - dump->_tag = DUMP_WINDOW_TAG;
5.66 - dump->next = dump_list_head;
5.67 - dump_list_head = dump;
5.68 - dump->data = NULL;
5.69 - dump->start = 0;
5.70 - dump->end = 0;
5.71 - dump->window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
5.72 - gtk_window_set_title (GTK_WINDOW (dump->window), _("Memory dump"));
5.73 -
5.74 - vbox3 = gtk_vbox_new (FALSE, 0);
5.75 - gtk_container_add (GTK_CONTAINER (dump->window), vbox3);
5.76 -
5.77 - hbox2 = gtk_hbox_new (FALSE, 0);
5.78 - dump->fromInput = gtk_entry_new ();
5.79 - gtk_entry_set_text( GTK_ENTRY(dump->fromInput), "" );
5.80 - dump->toInput = gtk_entry_new ();
5.81 - gtk_entry_set_text( GTK_ENTRY(dump->toInput), "" );
5.82 - dump_view_button = gtk_button_new_with_mnemonic (_("View"));
5.83 -
5.84 - gtk_box_pack_start (GTK_BOX (hbox2), gtk_label_new(_(" From ")), FALSE, FALSE, 0);
5.85 - gtk_box_pack_start (GTK_BOX (hbox2), dump->fromInput, FALSE, TRUE, 0);
5.86 - gtk_box_pack_start (GTK_BOX (hbox2), gtk_label_new(_(" To ")), FALSE, FALSE, 0);
5.87 - gtk_box_pack_start (GTK_BOX (hbox2), dump->toInput, FALSE, TRUE, 0);
5.88 - gtk_box_pack_start (GTK_BOX (hbox2), dump_view_button, FALSE, FALSE, 0);
5.89 - gtk_box_pack_start (GTK_BOX (hbox2), gtk_label_new (_(" ")), TRUE, TRUE, 0);
5.90 - gtk_box_pack_start (GTK_BOX (vbox3), hbox2, FALSE, TRUE, 3);
5.91 -
5.92 - dump->textArea = gtk_text_view_new ();
5.93 - dump->textBuffer = gtk_text_buffer_new(NULL);
5.94 - dump->changedTag = gtk_text_buffer_create_tag(dump->textBuffer, "changed",
5.95 - "foreground", "blue", NULL);
5.96 - gtk_widget_modify_font(GTK_WIDGET(dump->textArea),gui_fixed_font);
5.97 - gtk_text_view_set_editable(GTK_TEXT_VIEW(dump->textArea), FALSE);
5.98 - gtk_text_view_set_buffer(GTK_TEXT_VIEW(dump->textArea), dump->textBuffer);
5.99 - scrolledwindow9 = gtk_scrolled_window_new (NULL, NULL);
5.100 - gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (scrolledwindow9), GTK_SHADOW_IN);
5.101 - gtk_container_add (GTK_CONTAINER (scrolledwindow9), dump->textArea);
5.102 - gtk_box_pack_start (GTK_BOX (vbox3), scrolledwindow9, TRUE, TRUE, 0);
5.103 -
5.104 - g_signal_connect (dump->window, "delete_event",
5.105 - G_CALLBACK (on_dump_window_delete_event),
5.106 - dump);
5.107 - g_signal_connect (dump_view_button, "clicked",
5.108 - G_CALLBACK (on_dump_window_button_view_clicked),
5.109 - dump);
5.110 - gtk_widget_show_all( dump->window );
5.111 -
5.112 - return dump;
5.113 -}
5.114 -
5.115 -void gtk_entry_set_hex_value( GtkEntry *entry, uint32_t value )
5.116 -{
5.117 - char buf[10];
5.118 - sprintf( buf, "%08X", value );
5.119 - gtk_entry_set_text( entry, buf );
5.120 -}
5.121 -
5.122 -uint32_t gtk_entry_get_hex_value( GtkEntry *entry, uint32_t defaultValue )
5.123 -{
5.124 - const gchar *text = gtk_entry_get_text(entry);
5.125 - if( text == NULL )
5.126 - return defaultValue;
5.127 - gchar *endptr;
5.128 - uint32_t value = strtoul( text, &endptr, 16 );
5.129 - if( text == endptr ) { /* invalid input */
5.130 - value = defaultValue;
5.131 - gtk_entry_set_hex_value( entry, value );
5.132 - }
5.133 - return value;
5.134 -}
5.135 -
5.136 -gboolean on_dump_window_delete_event( GtkWidget *widget, GdkEvent *event,
5.137 - gpointer user_data )
5.138 -{
5.139 - dump_window_t data = (dump_window_t)user_data;
5.140 - if( data->data != NULL )
5.141 - free( data->data );
5.142 - dump_window_t node = dump_list_head;
5.143 - if( node == data )
5.144 - dump_list_head = data->next;
5.145 - else {
5.146 - while( node->next != data ) {
5.147 - node = node->next;
5.148 - assert( node != NULL );
5.149 - }
5.150 - node->next = data->next;
5.151 - }
5.152 - free( data );
5.153 - return FALSE;
5.154 -}
5.155 -
5.156 -void on_dump_window_button_view_clicked( GtkWidget *widget, gpointer user_data )
5.157 -{
5.158 - dump_window_t data = (dump_window_t)user_data;
5.159 - uint32_t startVal, endVal;
5.160 -
5.161 - assert( data != NULL );
5.162 - assert( data->_tag == DUMP_WINDOW_TAG );
5.163 -
5.164 - startVal = gtk_entry_get_hex_value(GTK_ENTRY(data->fromInput), data->start);
5.165 - endVal = gtk_entry_get_hex_value(GTK_ENTRY(data->toInput), data->end);
5.166 - if( startVal != data->start || endVal != data->end ) {
5.167 - if( startVal > endVal ) {
5.168 - int tmp = endVal;
5.169 - endVal = startVal;
5.170 - startVal = tmp;
5.171 - }
5.172 - if( endVal > startVal + MAX_DUMP_SIZE )
5.173 - endVal = startVal + MAX_DUMP_SIZE;
5.174 -
5.175 - gtk_entry_set_hex_value(GTK_ENTRY(data->fromInput),startVal);
5.176 - gtk_entry_set_hex_value(GTK_ENTRY(data->toInput),endVal);
5.177 - data->start = startVal;
5.178 - data->end = endVal;
5.179 -
5.180 - if( data->data != NULL ) {
5.181 - free( data->data );
5.182 - data->data = NULL;
5.183 - }
5.184 - if( startVal != endVal ) {
5.185 - data->data = malloc( endVal - startVal );
5.186 - mem_copy_from_sh4( data->data, startVal, endVal-startVal );
5.187 - dump_window_set_text( data, data->data, data->data );
5.188 - }
5.189 - }
5.190 -}
5.191 -
5.192 -void dump_window_update( dump_window_t data )
5.193 -{
5.194 - if( data->data == NULL )
5.195 - return;
5.196 - unsigned char tmp[data->end-data->start];
5.197 - int length = data->end-data->start;
5.198 - memcpy( tmp, data->data, length );
5.199 - mem_copy_from_sh4( data->data, data->start, length );
5.200 - dump_window_set_text( data, tmp, data->data );
5.201 -}
5.202 -
5.203 -void dump_window_update_all( )
5.204 -{
5.205 - dump_window_t node = dump_list_head;
5.206 - while( node != NULL ) {
5.207 - dump_window_update(node);
5.208 - node = node->next;
5.209 - }
5.210 -}
5.211 -
5.212 -void dump_window_set_text( dump_window_t data, unsigned char *old_data, unsigned char *new_data )
5.213 -{
5.214 - GtkTextBuffer *buf = data->textBuffer;
5.215 - GtkTextTag *changedTag = data->changedTag;
5.216 - GtkTextIter iter, endIter;
5.217 - int i, j, offset;
5.218 - /* Clear out the buffer */
5.219 - gtk_text_buffer_get_start_iter(buf,&iter);
5.220 - gtk_text_buffer_get_end_iter(buf,&endIter);
5.221 - gtk_text_buffer_delete(buf,&iter,&endIter);
5.222 - gtk_text_buffer_get_start_iter(buf,&iter);
5.223 -
5.224 - for( offset = 0, i=data->start; i<data->end; i+=16, offset+=16 ) {
5.225 - char text[80];
5.226 - sprintf(text, "%08X:", i );
5.227 - gtk_text_buffer_insert( buf, &iter, text, 9 );
5.228 - for( j=0; j<16; j++ ) {
5.229 - if( j%4 == 0 )
5.230 - gtk_text_buffer_insert( buf, &iter, " ", 1 );
5.231 - if( i+j < data->end ) {
5.232 - int oldVal = ((int)old_data[offset+j])&0xFF;
5.233 - int newVal = ((int)new_data[offset+j])&0xFF;
5.234 - sprintf(text, "%02X ", newVal);
5.235 - if( oldVal == newVal )
5.236 - gtk_text_buffer_insert( buf, &iter, text, 3 );
5.237 - else
5.238 - gtk_text_buffer_insert_with_tags( buf, &iter, text, 3,
5.239 - changedTag, NULL );
5.240 - } else {
5.241 - gtk_text_buffer_insert( buf, &iter, " ", 3 );
5.242 - }
5.243 - }
5.244 - gtk_text_buffer_insert( buf, &iter, " ", 2 );
5.245 - for( j=0; j<16 && i+j < data->end; j++ ) {
5.246 - int oldVal = ((int)old_data[offset+j])&0xFF;
5.247 - int newVal = ((int)new_data[offset+j])&0xFF;
5.248 - if( isprint(newVal) )
5.249 - sprintf( text, "%c", newVal );
5.250 - else strcpy( text, "." );
5.251 - if( oldVal == newVal )
5.252 - gtk_text_buffer_insert( buf, &iter, text, 1 );
5.253 - else
5.254 - gtk_text_buffer_insert_with_tags( buf, &iter, text, 1,
5.255 - changedTag, NULL );
5.256 - }
5.257 - gtk_text_buffer_insert( buf, &iter, "\n", 1 );
5.258 - }
5.259 -}
6.1 --- a/src/gtkui/gdrom_menu.c Mon Jul 21 12:21:20 2008 +0000
6.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
6.3 @@ -1,111 +0,0 @@
6.4 -/**
6.5 - * $Id$
6.6 - *
6.7 - * Creates and manages the GD-Rom attachment menu.
6.8 - *
6.9 - * Copyright (c) 2005 Nathan Keynes.
6.10 - *
6.11 - * This program is free software; you can redistribute it and/or modify
6.12 - * it under the terms of the GNU General Public License as published by
6.13 - * the Free Software Foundation; either version 2 of the License, or
6.14 - * (at your option) any later version.
6.15 - *
6.16 - * This program is distributed in the hope that it will be useful,
6.17 - * but WITHOUT ANY WARRANTY; without even the implied warranty of
6.18 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
6.19 - * GNU General Public License for more details.
6.20 - */
6.21 -
6.22 -#include <assert.h>
6.23 -#include <libgen.h>
6.24 -#include "dream.h"
6.25 -#include "dreamcast.h"
6.26 -#include "config.h"
6.27 -#include "gdlist.h"
6.28 -#include "gdrom/gdrom.h"
6.29 -#include "gtkui/gtkui.h"
6.30 -
6.31 -static gboolean gdrom_menu_adjusting = FALSE;
6.32 -
6.33 -static void gdrom_menu_open_image_callback( GtkWidget *widget, gpointer user_data )
6.34 -{
6.35 - if( !gdrom_menu_adjusting ) {
6.36 - const gchar *dir = lxdream_get_config_value(CONFIG_DEFAULT_PATH);
6.37 - open_file_dialog( _("Open..."), gdrom_mount_image, NULL, NULL, dir );
6.38 - }
6.39 -}
6.40 -
6.41 -void gdrom_menu_item_callback( GtkWidget *widget, gpointer user_data )
6.42 -{
6.43 - if( !gdrom_menu_adjusting ) {
6.44 - gdrom_list_set_selection( GPOINTER_TO_INT(user_data) );
6.45 - }
6.46 -}
6.47 -
6.48 -void gdrom_menu_build( GtkWidget *menu )
6.49 -{
6.50 - unsigned int i, len;
6.51 - GSList *group = NULL;
6.52 -
6.53 - len = gdrom_list_size();
6.54 - for( i=0; i < len; i++ ) {
6.55 - const gchar *entry = gdrom_list_get_display_name(i);
6.56 - if( entry[0] == '\0' ) { // Empty string = separator
6.57 - gtk_menu_shell_append( GTK_MENU_SHELL(menu), gtk_separator_menu_item_new() );
6.58 - } else {
6.59 - GtkWidget *item = gtk_radio_menu_item_new_with_label( group, entry );
6.60 - group = gtk_radio_menu_item_get_group( GTK_RADIO_MENU_ITEM(item) );
6.61 - g_signal_connect_after( item, "activate", G_CALLBACK(gdrom_menu_item_callback), GINT_TO_POINTER(i) );
6.62 - gtk_menu_shell_append( GTK_MENU_SHELL(menu), item );
6.63 - }
6.64 - }
6.65 -
6.66 - gtk_menu_shell_append( GTK_MENU_SHELL(menu), gtk_separator_menu_item_new() );
6.67 - GtkWidget *open = gtk_image_menu_item_new_with_label( _("Open image file...") );
6.68 - g_signal_connect_after( open, "activate", G_CALLBACK(gdrom_menu_open_image_callback), NULL );
6.69 - gtk_menu_shell_append( GTK_MENU_SHELL(menu), open );
6.70 - gtk_widget_show_all(menu);
6.71 -}
6.72 -
6.73 -void gdrom_menu_rebuild( GtkWidget *menu )
6.74 -{
6.75 - GList *children = gtk_container_get_children( GTK_CONTAINER(menu) );
6.76 - GList *listptr;
6.77 - for( listptr = children; listptr != NULL; listptr = g_list_next(listptr) ) {
6.78 - gtk_widget_destroy( GTK_WIDGET(listptr->data) );
6.79 - }
6.80 - g_list_free(children);
6.81 - gdrom_menu_build(menu);
6.82 -}
6.83 -
6.84 -gboolean gdrom_menu_update( gboolean list_changed, int selection, void *user_data )
6.85 -{
6.86 - gdrom_menu_adjusting = TRUE;
6.87 - GtkWidget *menu = GTK_WIDGET(user_data);
6.88 -
6.89 - if( list_changed ) {
6.90 - gdrom_menu_rebuild(menu);
6.91 - }
6.92 -
6.93 - GList *children = gtk_container_get_children( GTK_CONTAINER(menu) );
6.94 - GList *item = g_list_nth( children, selection );
6.95 - assert( item != NULL );
6.96 - gtk_check_menu_item_set_active( GTK_CHECK_MENU_ITEM(item->data), TRUE );
6.97 - g_list_free(children);
6.98 -
6.99 - gdrom_menu_adjusting = FALSE;
6.100 - return TRUE;
6.101 -}
6.102 -
6.103 -GtkWidget *gdrom_menu_new()
6.104 -{
6.105 - GtkWidget *menu = gtk_menu_new();
6.106 - gtk_menu_set_title( GTK_MENU(menu), _("GD-Rom Settings") );
6.107 -
6.108 - gdrom_menu_build(menu);
6.109 - register_gdrom_list_change_hook(gdrom_menu_update, menu);
6.110 - gdrom_menu_update( FALSE, gdrom_list_get_selection(), menu );
6.111 - gtk_widget_show_all(menu);
6.112 -
6.113 - return menu;
6.114 -}
7.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
7.2 +++ b/src/gtkui/gtk_ctrl.c Tue Jul 22 04:40:55 2008 +0000
7.3 @@ -0,0 +1,318 @@
7.4 +/**
7.5 + * $Id$
7.6 + *
7.7 + * Define the main (emu) GTK window, along with its menubars,
7.8 + * toolbars, etc.
7.9 + *
7.10 + * Copyright (c) 2005 Nathan Keynes.
7.11 + *
7.12 + * This program is free software; you can redistribute it and/or modify
7.13 + * it under the terms of the GNU General Public License as published by
7.14 + * the Free Software Foundation; either version 2 of the License, or
7.15 + * (at your option) any later version.
7.16 + *
7.17 + * This program is distributed in the hope that it will be useful,
7.18 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
7.19 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
7.20 + * GNU General Public License for more details.
7.21 + */
7.22 +
7.23 +#include <assert.h>
7.24 +#include <string.h>
7.25 +#include <gtk/gtk.h>
7.26 +#include <gdk/gdkkeysyms.h>
7.27 +
7.28 +#include "lxdream.h"
7.29 +#include "display.h"
7.30 +#include "gtkui/gtkui.h"
7.31 +#include "maple/maple.h"
7.32 +
7.33 +#define MAX_DEVICES 4
7.34 +
7.35 +static void controller_device_configure(maple_device_t device);
7.36 +
7.37 +struct maple_config_class {
7.38 + const char *name;
7.39 + void (*config_func)(maple_device_t device);
7.40 +};
7.41 +
7.42 +typedef struct maple_slot_data {
7.43 + maple_device_t old_device;
7.44 + maple_device_t new_device;
7.45 + GtkWidget *button;
7.46 + GtkWidget *combo;
7.47 +} *maple_slot_data_t;
7.48 +
7.49 +static struct maple_config_class maple_device_config[] = {
7.50 + { "Sega Controller", controller_device_configure },
7.51 + { NULL, NULL } };
7.52 +
7.53 +static struct maple_slot_data maple_data[MAX_DEVICES];
7.54 +
7.55 +static void config_keysym_hook( void *data, const gchar *keysym )
7.56 +{
7.57 + GtkWidget *widget = (GtkWidget *)data;
7.58 + gtk_entry_set_text( GTK_ENTRY(widget), keysym );
7.59 + g_object_set_data( G_OBJECT(widget), "keypress_mode", GINT_TO_POINTER(FALSE) );
7.60 + input_set_keysym_hook(NULL, NULL);
7.61 +}
7.62 +
7.63 +static gboolean config_key_buttonpress( GtkWidget *widget, GdkEventButton *event, gpointer user_data )
7.64 +{
7.65 + gboolean keypress_mode = GPOINTER_TO_INT(g_object_get_data( G_OBJECT(widget), "keypress_mode"));
7.66 + if( !keypress_mode ) {
7.67 + gtk_entry_set_text( GTK_ENTRY(widget), _("<press key>") );
7.68 + g_object_set_data( G_OBJECT(widget), "keypress_mode", GINT_TO_POINTER(TRUE) );
7.69 + input_set_keysym_hook(config_keysym_hook, widget);
7.70 + }
7.71 + return FALSE;
7.72 +}
7.73 +
7.74 +static gboolean config_key_keypress( GtkWidget *widget, GdkEventKey *event, gpointer user_data )
7.75 +{
7.76 + gboolean keypress_mode = GPOINTER_TO_INT(g_object_get_data( G_OBJECT(widget), "keypress_mode"));
7.77 + if( keypress_mode ) {
7.78 + if( event->keyval == GDK_Escape ) {
7.79 + gtk_entry_set_text( GTK_ENTRY(widget), "" );
7.80 + g_object_set_data( G_OBJECT(widget), "keypress_mode", GINT_TO_POINTER(FALSE) );
7.81 + return TRUE;
7.82 + }
7.83 + GdkKeymap *keymap = gdk_keymap_get_default();
7.84 + guint keyval;
7.85 +
7.86 + gdk_keymap_translate_keyboard_state( keymap, event->hardware_keycode, 0, 0, &keyval,
7.87 + NULL, NULL, NULL );
7.88 + gtk_entry_set_text( GTK_ENTRY(widget), gdk_keyval_name(keyval) );
7.89 + g_object_set_data( G_OBJECT(widget), "keypress_mode", GINT_TO_POINTER(FALSE) );
7.90 + input_set_keysym_hook(NULL, NULL);
7.91 + return TRUE;
7.92 + } else {
7.93 + switch( event->keyval ) {
7.94 + case GDK_Return:
7.95 + case GDK_KP_Enter:
7.96 + gtk_entry_set_text( GTK_ENTRY(widget), _("<press key>") );
7.97 + g_object_set_data( G_OBJECT(widget), "keypress_mode", GINT_TO_POINTER(TRUE) );
7.98 + input_set_keysym_hook(config_keysym_hook, widget);
7.99 + return TRUE;
7.100 + case GDK_BackSpace:
7.101 + case GDK_Delete:
7.102 + gtk_entry_set_text( GTK_ENTRY(widget), "" );
7.103 + return TRUE;
7.104 + }
7.105 + return FALSE;
7.106 + }
7.107 +
7.108 +}
7.109 +
7.110 +static void controller_config_done( GtkWidget *panel, gboolean isOK )
7.111 +{
7.112 + if( isOK ) {
7.113 + maple_device_t device = (maple_device_t)gtk_object_get_data( GTK_OBJECT(panel), "maple_device" );
7.114 + lxdream_config_entry_t conf = device->get_config(device);
7.115 + int i;
7.116 + for( i=0; conf[i].key != NULL; i++ ) {
7.117 + char buf[64];
7.118 + GtkWidget *entry1, *entry2;
7.119 + const gchar *key1, *key2;
7.120 + snprintf( buf, sizeof(buf), "%s.1", conf[i].key );
7.121 + entry1 = GTK_WIDGET(g_object_get_qdata( G_OBJECT(panel), g_quark_from_string(buf)));
7.122 + key1 = gtk_entry_get_text(GTK_ENTRY(entry1));
7.123 + snprintf( buf, sizeof(buf), "%s.2", conf[i].key );
7.124 + entry2 = GTK_WIDGET(g_object_get_qdata( G_OBJECT(panel), g_quark_from_string(buf)));
7.125 + key2 = gtk_entry_get_text(GTK_ENTRY(entry2));
7.126 + if( key1 == NULL || key1[0] == '\0') {
7.127 + lxdream_set_config_value( &conf[i], key2 );
7.128 + } else if( key2 == NULL || key2[0] == '\0') {
7.129 + lxdream_set_config_value( &conf[i], key1 );
7.130 + } else {
7.131 + char buf[64];
7.132 + snprintf( buf, sizeof(buf), "%s, %s", key1, key2 );
7.133 + lxdream_set_config_value( &conf[i], buf );
7.134 + }
7.135 + }
7.136 + }
7.137 + input_set_keysym_hook(NULL, NULL);
7.138 +}
7.139 +
7.140 +static void controller_device_configure( maple_device_t device )
7.141 +{
7.142 + lxdream_config_entry_t conf = device->get_config(device);
7.143 + int count, i;
7.144 + for( count=0; conf[count].key != NULL; count++ );
7.145 +
7.146 + GtkWidget *table = gtk_table_new( (count+1)>>1, 6, FALSE );
7.147 + GList *focus_chain = NULL;
7.148 + gtk_object_set_data( GTK_OBJECT(table), "maple_device", device );
7.149 + for( i=0; i<count; i++ ) {
7.150 + GtkWidget *text, *text2;
7.151 + char buf[64];
7.152 + int x=0;
7.153 + int y=i;
7.154 + if( i >= (count+1)>>1 ) {
7.155 + x = 3;
7.156 + y -= (count+1)>>1;
7.157 + }
7.158 + gtk_table_attach( GTK_TABLE(table), gtk_label_new(conf[i].key), x, x+1, y, y+1,
7.159 + GTK_SHRINK, GTK_SHRINK, 0, 0 );
7.160 + text = gtk_entry_new();
7.161 + gtk_entry_set_width_chars( GTK_ENTRY(text), 11 );
7.162 + gtk_entry_set_editable( GTK_ENTRY(text), FALSE );
7.163 + g_signal_connect( text, "key_press_event",
7.164 + G_CALLBACK(config_key_keypress), NULL );
7.165 + g_signal_connect( text, "button_press_event",
7.166 + G_CALLBACK(config_key_buttonpress), NULL );
7.167 + snprintf( buf, sizeof(buf), "%s.1", conf[i].key );
7.168 + g_object_set_data( G_OBJECT(text), "keypress_mode", GINT_TO_POINTER(FALSE) );
7.169 + g_object_set_qdata( G_OBJECT(table), g_quark_from_string(buf), text );
7.170 + gtk_table_attach_defaults( GTK_TABLE(table), text, x+1, x+2, y, y+1);
7.171 + focus_chain = g_list_append( focus_chain, text );
7.172 + text2 = gtk_entry_new();
7.173 + gtk_entry_set_width_chars( GTK_ENTRY(text2), 11 );
7.174 + gtk_entry_set_editable( GTK_ENTRY(text2), FALSE );
7.175 + g_signal_connect( text2, "key_press_event",
7.176 + G_CALLBACK(config_key_keypress), NULL );
7.177 + g_signal_connect( text2, "button_press_event",
7.178 + G_CALLBACK(config_key_buttonpress), NULL );
7.179 + snprintf( buf, sizeof(buf), "%s.2", conf[i].key );
7.180 + g_object_set_data( G_OBJECT(text2), "keypress_mode", GINT_TO_POINTER(FALSE) );
7.181 + g_object_set_qdata( G_OBJECT(table), g_quark_from_string(buf), text2 );
7.182 + gtk_table_attach_defaults( GTK_TABLE(table), text2, x+2, x+3, y, y+1);
7.183 + focus_chain = g_list_append( focus_chain, text2 );
7.184 + if( conf[i].value != NULL ) {
7.185 + gchar **parts = g_strsplit(conf[i].value,",",3);
7.186 + if( parts[0] != NULL ) {
7.187 + gtk_entry_set_text( GTK_ENTRY(text), g_strstrip(parts[0]) );
7.188 + if( parts[1] != NULL ) {
7.189 + gtk_entry_set_text( GTK_ENTRY(text2), g_strstrip(parts[1]) );
7.190 + }
7.191 + }
7.192 + g_strfreev(parts);
7.193 + }
7.194 + }
7.195 + gtk_container_set_focus_chain( GTK_CONTAINER(table), focus_chain );
7.196 + gtk_gui_run_property_dialog( _("Controller Configuration"), table, controller_config_done );
7.197 +}
7.198 +
7.199 +gboolean maple_properties_activated( GtkButton *button, gpointer user_data )
7.200 +{
7.201 + maple_slot_data_t data = (maple_slot_data_t)user_data;
7.202 + if( data->new_device != NULL ) {
7.203 + int i;
7.204 + for( i=0; maple_device_config[i].name != NULL; i++ ) {
7.205 + if( strcmp(data->new_device->device_class->name, maple_device_config[i].name) == 0 ) {
7.206 + if( data->new_device == data->old_device ) {
7.207 + // Make a copy at this point if we haven't already
7.208 + data->new_device = data->old_device->clone(data->old_device);
7.209 + }
7.210 + maple_device_config[i].config_func(data->new_device);
7.211 + break;
7.212 + }
7.213 + }
7.214 + if( maple_device_config[i].name == NULL ) {
7.215 + gui_error_dialog( _("No configuration page available for device type") );
7.216 + }
7.217 + }
7.218 + return TRUE;
7.219 +}
7.220 +
7.221 +gboolean maple_device_changed( GtkComboBox *combo, gpointer user_data )
7.222 +{
7.223 + maple_slot_data_t data = (maple_slot_data_t)user_data;
7.224 + int active = gtk_combo_box_get_active(combo);
7.225 + gboolean has_config = FALSE;
7.226 + if( active != 0 ) {
7.227 + gchar *devname = gtk_combo_box_get_active_text(combo);
7.228 + const maple_device_class_t devclz = maple_get_device_class(devname);
7.229 + assert(devclz != NULL);
7.230 + if( data->new_device != NULL ) {
7.231 + if( data->new_device->device_class != devclz ) {
7.232 + if( data->new_device != data->old_device ) {
7.233 + data->new_device->destroy(data->new_device);
7.234 + }
7.235 + data->new_device = maple_new_device(devname);
7.236 + }
7.237 + } else {
7.238 + data->new_device = maple_new_device(devname);
7.239 + }
7.240 + has_config = data->new_device != NULL && data->new_device->get_config != NULL;
7.241 + } else {
7.242 + if( data->new_device != NULL && data->new_device != data->old_device ) {
7.243 + data->new_device->destroy(data->new_device);
7.244 + }
7.245 + data->new_device = NULL;
7.246 + }
7.247 + gtk_widget_set_sensitive(data->button, has_config);
7.248 + return TRUE;
7.249 +}
7.250 +
7.251 +void maple_dialog_done( GtkWidget *panel, gboolean isOK )
7.252 +{
7.253 + if( isOK ) {
7.254 + int i;
7.255 + for( i=0; i<MAX_DEVICES; i++ ) {
7.256 + if( maple_data[i].new_device != maple_data[i].old_device ) {
7.257 + if( maple_data[i].old_device != NULL ) {
7.258 + maple_detach_device(i,0);
7.259 + }
7.260 + if( maple_data[i].new_device != NULL ) {
7.261 + maple_attach_device(maple_data[i].new_device, i, 0 );
7.262 + }
7.263 + }
7.264 + }
7.265 + lxdream_save_config();
7.266 + } else {
7.267 + int i;
7.268 + for( i=0; i<MAX_DEVICES; i++ ) {
7.269 + if( maple_data[i].new_device != NULL &&
7.270 + maple_data[i].new_device != maple_data[i].old_device ) {
7.271 + maple_data[i].new_device->destroy(maple_data[i].new_device);
7.272 + }
7.273 + }
7.274 + }
7.275 +
7.276 +}
7.277 +
7.278 +GtkWidget *maple_panel_new()
7.279 +{
7.280 + GtkWidget *table = gtk_table_new(4, 3, TRUE);
7.281 + int i,j;
7.282 + const struct maple_device_class **devices = maple_get_device_classes();
7.283 +
7.284 + for( i=0; i< MAX_DEVICES; i++ ) {
7.285 + char buf[12];
7.286 + GtkWidget *combo, *button;
7.287 + int active = 0;
7.288 + maple_device_t device = maple_get_device(i,0);
7.289 + sprintf( buf, _("Slot %d."), i );
7.290 + gtk_table_attach_defaults( GTK_TABLE(table), gtk_label_new(buf), 0, 1, i, i+1 );
7.291 + combo = gtk_combo_box_new_text();
7.292 + gtk_combo_box_append_text( GTK_COMBO_BOX(combo), _("<empty>") );
7.293 + for( j=0; devices[j] != NULL; j++ ) {
7.294 + gtk_combo_box_append_text(GTK_COMBO_BOX(combo), devices[j]->name);
7.295 + if( device != NULL && device->device_class == devices[j] ) {
7.296 + active = j+1;
7.297 + }
7.298 + }
7.299 + gtk_combo_box_set_active(GTK_COMBO_BOX(combo), active);
7.300 + gtk_table_attach_defaults( GTK_TABLE(table), combo, 1, 2, i, i+1 );
7.301 + button = gtk_button_new_from_stock( GTK_STOCK_PROPERTIES );
7.302 + gtk_widget_set_sensitive(button, active != 0 && device->get_config != NULL);
7.303 + gtk_table_attach_defaults( GTK_TABLE(table), button, 2, 3, i, i+1 );
7.304 +
7.305 + maple_data[i].old_device = device;
7.306 + maple_data[i].new_device = device;
7.307 + maple_data[i].combo = combo;
7.308 + maple_data[i].button = button;
7.309 + g_signal_connect( button, "clicked",
7.310 + G_CALLBACK( maple_properties_activated ), &maple_data[i] );
7.311 + g_signal_connect( combo, "changed",
7.312 + G_CALLBACK( maple_device_changed ), &maple_data[i] );
7.313 +
7.314 + }
7.315 + return table;
7.316 +}
7.317 +
7.318 +void maple_dialog_run( )
7.319 +{
7.320 + gtk_gui_run_property_dialog( _("Controller Settings"), maple_panel_new(), maple_dialog_done );
7.321 +}
8.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
8.2 +++ b/src/gtkui/gtk_debug.c Tue Jul 22 04:40:55 2008 +0000
8.3 @@ -0,0 +1,454 @@
8.4 +/**
8.5 + * $Id$
8.6 + * This file is responsible for the main debugger gui frame.
8.7 + *
8.8 + * Copyright (c) 2005 Nathan Keynes.
8.9 + *
8.10 + * This program is free software; you can redistribute it and/or modify
8.11 + * it under the terms of the GNU General Public License as published by
8.12 + * the Free Software Foundation; either version 2 of the License, or
8.13 + * (at your option) any later version.
8.14 + *
8.15 + * This program is distributed in the hope that it will be useful,
8.16 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
8.17 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
8.18 + * GNU General Public License for more details.
8.19 + */
8.20 +#include <stdlib.h>
8.21 +#include <stdarg.h>
8.22 +#include <stdio.h>
8.23 +#include <string.h>
8.24 +#include <math.h>
8.25 +#include <gdk/gdkkeysyms.h>
8.26 +#include "mem.h"
8.27 +#include "cpu.h"
8.28 +#include "dreamcast.h"
8.29 +#include "gtkui/gtkui.h"
8.30 +#include "sh4/sh4dasm.h"
8.31 +#include "aica/armdasm.h"
8.32 +
8.33 +GdkColor *msg_colors[] = { &gui_colour_error, &gui_colour_error, &gui_colour_warn,
8.34 + &gui_colour_normal,&gui_colour_debug, &gui_colour_trace };
8.35 +
8.36 +const cpu_desc_t cpu_list[4] = { &sh4_cpu_desc, &arm_cpu_desc, &armt_cpu_desc, NULL };
8.37 +
8.38 +void init_register_list( debug_window_t data );
8.39 +uint32_t row_to_address( debug_window_t data, int row );
8.40 +int address_to_row( debug_window_t data, uint32_t address );
8.41 +void set_disassembly_pc( debug_window_t data, unsigned int pc, gboolean select );
8.42 +void set_disassembly_region( debug_window_t data, unsigned int page );
8.43 +void set_disassembly_cpu( debug_window_t data, const gchar *cpu );
8.44 +
8.45 +void on_mode_field_changed ( GtkEditable *editable, gpointer user_data);
8.46 +gboolean on_page_field_key_press_event( GtkWidget * widget, GdkEventKey *event,
8.47 + gpointer user_data);
8.48 +void on_jump_pc_btn_clicked( GtkButton *button, gpointer user_data);
8.49 +void on_disasm_list_select_row (GtkCList *clist, gint row, gint column,
8.50 + GdkEvent *event, gpointer user_data);
8.51 +void on_disasm_list_unselect_row (GtkCList *clist, gint row, gint column,
8.52 + GdkEvent *event, gpointer user_data);
8.53 +gboolean on_debug_delete_event(GtkWidget *widget, GdkEvent event, gpointer user_data);
8.54 +
8.55 +struct debug_window_info {
8.56 + int disasm_from;
8.57 + int disasm_to;
8.58 + int disasm_pc;
8.59 + const struct cpu_desc_struct *cpu;
8.60 + const cpu_desc_t *cpu_list;
8.61 + GtkCList *regs_list;
8.62 + GtkCList *disasm_list;
8.63 + GtkEntry *page_field;
8.64 + GtkWidget *window;
8.65 + GtkWidget *statusbar;
8.66 + char saved_regs[0];
8.67 +};
8.68 +
8.69 +debug_window_t debug_window_new( const gchar *title, GtkWidget *menubar,
8.70 + GtkWidget *toolbar, GtkAccelGroup *accel_group )
8.71 +{
8.72 + debug_window_t data = g_malloc0( sizeof(struct debug_window_info) + cpu_list[0]->regs_size );
8.73 + GtkWidget *vbox;
8.74 +
8.75 + data->window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
8.76 + gtk_window_set_default_size (GTK_WINDOW (data->window), 700, 480);
8.77 + gtk_window_set_title( GTK_WINDOW(data->window), title );
8.78 + gtk_window_add_accel_group (GTK_WINDOW (data->window), accel_group);
8.79 +
8.80 + gtk_toolbar_set_style( GTK_TOOLBAR(toolbar), GTK_TOOLBAR_ICONS );
8.81 +
8.82 + data->statusbar = gtk_statusbar_new();
8.83 +
8.84 + GtkWidget *hpaned = gtk_hpaned_new ();
8.85 + gtk_paned_set_position (GTK_PANED (hpaned), 500);
8.86 +
8.87 + GtkWidget *disasm_box = gtk_vbox_new(FALSE,0);
8.88 + gtk_paned_pack1 (GTK_PANED (hpaned), disasm_box, TRUE, TRUE);
8.89 +
8.90 + GtkWidget *hbox1 = gtk_hbox_new (FALSE, 0);
8.91 + gtk_box_pack_start (GTK_BOX (disasm_box), hbox1, FALSE, FALSE, 3);
8.92 + gtk_box_pack_start (GTK_BOX (hbox1), gtk_label_new (_("Page")), FALSE, FALSE, 4);
8.93 +
8.94 + data->page_field = GTK_ENTRY(gtk_entry_new ());
8.95 + gtk_box_pack_start (GTK_BOX (hbox1), GTK_WIDGET(data->page_field), FALSE, TRUE, 0);
8.96 +
8.97 + GtkWidget *jump_pc_btn = gtk_button_new_with_mnemonic (_(" Jump to PC "));
8.98 + gtk_box_pack_start (GTK_BOX (hbox1), jump_pc_btn, FALSE, FALSE, 4);
8.99 +
8.100 + gtk_box_pack_start (GTK_BOX (hbox1), gtk_label_new(_("Mode")), FALSE, FALSE, 5);
8.101 +
8.102 + GtkWidget *mode_box = gtk_combo_new ();
8.103 + gtk_box_pack_start (GTK_BOX (hbox1), mode_box, FALSE, FALSE, 0);
8.104 + GList *mode_box_items = NULL;
8.105 + mode_box_items = g_list_append (mode_box_items, (gpointer) _("SH4"));
8.106 + mode_box_items = g_list_append (mode_box_items, (gpointer) _("ARM7"));
8.107 + mode_box_items = g_list_append (mode_box_items, (gpointer) _("ARM7T"));
8.108 + gtk_combo_set_popdown_strings (GTK_COMBO (mode_box), mode_box_items);
8.109 + g_list_free (mode_box_items);
8.110 +
8.111 + GtkWidget *mode_field = GTK_COMBO (mode_box)->entry;
8.112 + gtk_editable_set_editable (GTK_EDITABLE (mode_field), FALSE);
8.113 +
8.114 + GtkWidget *disasm_scroll = gtk_scrolled_window_new (NULL, NULL);
8.115 + gtk_box_pack_start (GTK_BOX (disasm_box), disasm_scroll, TRUE, TRUE, 0);
8.116 + gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (disasm_scroll), GTK_SHADOW_IN);
8.117 + data->disasm_list = GTK_CLIST(gtk_clist_new (4));
8.118 + gtk_clist_set_column_width (GTK_CLIST (data->disasm_list), 0, 80);
8.119 + gtk_clist_set_column_width (GTK_CLIST (data->disasm_list), 2, 80);
8.120 + gtk_clist_set_column_width (GTK_CLIST (data->disasm_list), 3, 80);
8.121 + gtk_clist_set_column_width( data->disasm_list, 1, 16 );
8.122 + gtk_clist_column_titles_hide (GTK_CLIST (data->disasm_list));
8.123 + gtk_container_add (GTK_CONTAINER (disasm_scroll), GTK_WIDGET(data->disasm_list));
8.124 +
8.125 + GtkWidget *reg_scroll = gtk_scrolled_window_new (NULL, NULL);
8.126 + gtk_paned_pack2 (GTK_PANED (hpaned), reg_scroll, FALSE, TRUE);
8.127 + gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (reg_scroll), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
8.128 + gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (reg_scroll), GTK_SHADOW_IN);
8.129 +
8.130 + data->regs_list = GTK_CLIST(gtk_clist_new (2));
8.131 + gtk_container_add (GTK_CONTAINER (reg_scroll), GTK_WIDGET(data->regs_list));
8.132 + gtk_clist_set_column_width (GTK_CLIST (data->regs_list), 0, 80);
8.133 + gtk_clist_set_column_width (GTK_CLIST (data->regs_list), 1, 80);
8.134 + gtk_clist_column_titles_hide (GTK_CLIST (data->regs_list));
8.135 + gtk_widget_modify_font( GTK_WIDGET(data->regs_list), gui_fixed_font );
8.136 +
8.137 + vbox = gtk_vbox_new(FALSE, 0);
8.138 + gtk_container_add( GTK_CONTAINER(data->window), vbox );
8.139 + gtk_box_pack_start( GTK_BOX(vbox), menubar, FALSE, FALSE, 0 );
8.140 + gtk_box_pack_start( GTK_BOX(vbox), toolbar, FALSE, FALSE, 0 );
8.141 + gtk_box_pack_start( GTK_BOX(vbox), hpaned, TRUE, TRUE, 0 );
8.142 + gtk_box_pack_start( GTK_BOX(vbox), data->statusbar, FALSE, FALSE, 0 );
8.143 +
8.144 + g_signal_connect ((gpointer) data->page_field, "key_press_event",
8.145 + G_CALLBACK (on_page_field_key_press_event),
8.146 + data);
8.147 + g_signal_connect ((gpointer) jump_pc_btn, "clicked",
8.148 + G_CALLBACK (on_jump_pc_btn_clicked),
8.149 + data);
8.150 + g_signal_connect ((gpointer) mode_field, "changed",
8.151 + G_CALLBACK (on_mode_field_changed),
8.152 + data);
8.153 + g_signal_connect ((gpointer) data->disasm_list, "select_row",
8.154 + G_CALLBACK (on_disasm_list_select_row),
8.155 + data);
8.156 + g_signal_connect ((gpointer) data->disasm_list, "unselect_row",
8.157 + G_CALLBACK (on_disasm_list_unselect_row),
8.158 + data);
8.159 + g_signal_connect ((gpointer) data->window, "delete_event",
8.160 + G_CALLBACK (on_debug_delete_event),
8.161 + data);
8.162 +
8.163 + data->disasm_from = -1;
8.164 + data->disasm_to = -1;
8.165 + data->disasm_pc = -1;
8.166 + data->cpu = cpu_list[0];
8.167 + data->cpu_list = cpu_list;
8.168 +
8.169 + init_register_list( data );
8.170 + gtk_object_set_data( GTK_OBJECT(data->window), "debug_data", data );
8.171 + set_disassembly_pc( data, *data->cpu->pc, FALSE );
8.172 + debug_window_set_running( data, FALSE );
8.173 +
8.174 + gtk_widget_show_all( data->window );
8.175 + return data;
8.176 +}
8.177 +
8.178 +void debug_window_show( debug_window_t data, gboolean show )
8.179 +{
8.180 + if( show ) {
8.181 + gtk_widget_show( data->window );
8.182 + } else {
8.183 + gtk_widget_hide( data->window );
8.184 + }
8.185 +}
8.186 +
8.187 +int debug_window_get_selected_row( debug_window_t data )
8.188 +{
8.189 + if( data->disasm_list->selection == NULL ) {
8.190 + return -1;
8.191 + } else {
8.192 + return GPOINTER_TO_INT(data->disasm_list->selection->data);
8.193 + }
8.194 +}
8.195 +
8.196 +void init_register_list( debug_window_t data )
8.197 +{
8.198 + int i;
8.199 + char buf[20];
8.200 + char *arr[2];
8.201 +
8.202 + gtk_clist_clear( data->regs_list );
8.203 + arr[1] = buf;
8.204 + for( i=0; data->cpu->regs_info[i].name != NULL; i++ ) {
8.205 + arr[0] = data->cpu->regs_info[i].name;
8.206 + if( data->cpu->regs_info->type == REG_INT )
8.207 + sprintf( buf, "%08X", *((uint32_t *)data->cpu->regs_info[i].value) );
8.208 + else
8.209 + sprintf( buf, "%f", *((float *)data->cpu->regs_info[i].value) );
8.210 + gtk_clist_append( data->regs_list, arr );
8.211 + }
8.212 +}
8.213 +
8.214 +/*
8.215 + * Check for changed registers and update the display
8.216 + */
8.217 +void debug_window_update( debug_window_t data )
8.218 +{
8.219 + int i;
8.220 + for( i=0; data->cpu->regs_info[i].name != NULL; i++ ) {
8.221 + if( data->cpu->regs_info[i].type == REG_INT ) {
8.222 + /* Yes this _is_ probably fairly evil */
8.223 + if( *((uint32_t *)data->cpu->regs_info[i].value) !=
8.224 + *((uint32_t *)((char *)data->saved_regs + ((char *)data->cpu->regs_info[i].value - (char *)data->cpu->regs))) ) {
8.225 + char buf[20];
8.226 + sprintf( buf, "%08X", *((uint32_t *)data->cpu->regs_info[i].value) );
8.227 + gtk_clist_set_text( data->regs_list, i, 1, buf );
8.228 + gtk_clist_set_foreground( data->regs_list, i, &gui_colour_changed );
8.229 + } else {
8.230 + gtk_clist_set_foreground( data->regs_list, i, &gui_colour_normal );
8.231 + }
8.232 + } else {
8.233 + if( *((float *)data->cpu->regs_info[i].value) !=
8.234 + *((float *)((char *)data->saved_regs + ((char *)data->cpu->regs_info[i].value - (char *)data->cpu->regs))) ) {
8.235 + char buf[20];
8.236 + sprintf( buf, "%f", *((float *)data->cpu->regs_info[i].value) );
8.237 + gtk_clist_set_text( data->regs_list, i, 1, buf );
8.238 + gtk_clist_set_foreground( data->regs_list, i, &gui_colour_changed );
8.239 + } else {
8.240 + gtk_clist_set_foreground( data->regs_list, i, &gui_colour_normal );
8.241 + }
8.242 + }
8.243 + }
8.244 +
8.245 + set_disassembly_pc( data, *data->cpu->pc, TRUE );
8.246 + memcpy( data->saved_regs, data->cpu->regs, data->cpu->regs_size );
8.247 +}
8.248 +
8.249 +void set_disassembly_region( debug_window_t data, unsigned int page )
8.250 +{
8.251 + uint32_t i, posn, next;
8.252 + char buf[80];
8.253 + char addr[10];
8.254 + char opcode[16] = "";
8.255 + char *arr[4] = { addr, " ", opcode, buf };
8.256 + unsigned int from = page & 0xFFFFF000;
8.257 + unsigned int to = from + 4096;
8.258 +
8.259 + gtk_clist_clear(data->disasm_list);
8.260 +
8.261 + sprintf( addr, "%08X", from );
8.262 + gtk_entry_set_text( data->page_field, addr );
8.263 +
8.264 + if( !data->cpu->is_valid_page_func( from ) ) {
8.265 + arr[3] = _("This page is currently unmapped");
8.266 + gtk_clist_append( data->disasm_list, arr );
8.267 + gtk_clist_set_foreground( data->disasm_list, 0, &gui_colour_error );
8.268 + } else {
8.269 + for( i=from; i<to; i = next ) {
8.270 + next = data->cpu->disasm_func( i, buf, sizeof(buf), opcode );
8.271 + sprintf( addr, "%08X", i );
8.272 + posn = gtk_clist_append( data->disasm_list, arr );
8.273 + if( buf[0] == '?' )
8.274 + gtk_clist_set_foreground( data->disasm_list, posn, &gui_colour_warn );
8.275 + if( data->cpu->get_breakpoint != NULL ) {
8.276 + int type = data->cpu->get_breakpoint( i );
8.277 + switch(type) {
8.278 + case BREAK_ONESHOT:
8.279 + gtk_clist_set_background( data->disasm_list, posn, &gui_colour_temp_break );
8.280 + break;
8.281 + case BREAK_KEEP:
8.282 + gtk_clist_set_background( data->disasm_list, posn, &gui_colour_break );
8.283 + break;
8.284 + }
8.285 + }
8.286 + }
8.287 + if( data->disasm_pc != -1 && data->disasm_pc >= from && data->disasm_pc < to )
8.288 + gtk_clist_set_foreground( data->disasm_list, address_to_row(data, data->disasm_pc),
8.289 + &gui_colour_pc );
8.290 + }
8.291 +
8.292 + if( page != from ) { /* not a page boundary */
8.293 + gtk_clist_moveto( data->disasm_list, (page-from)>>1, 0, 0.5, 0.0 );
8.294 + }
8.295 + data->disasm_from = from;
8.296 + data->disasm_to = to;
8.297 +}
8.298 +
8.299 +void jump_to_disassembly( debug_window_t data, unsigned int addr, gboolean select )
8.300 +{
8.301 + int row;
8.302 +
8.303 + if( addr < data->disasm_from || addr >= data->disasm_to )
8.304 + set_disassembly_region(data,addr);
8.305 +
8.306 + row = address_to_row( data, addr );
8.307 + if(select) {
8.308 + gtk_clist_select_row( data->disasm_list, row, 0 );
8.309 + }
8.310 + if( gtk_clist_row_is_visible( data->disasm_list, row ) != GTK_VISIBILITY_FULL ){
8.311 + gtk_clist_moveto( data->disasm_list, row, 0, 0.5, 0.0 );
8.312 + }
8.313 +}
8.314 +
8.315 +void jump_to_pc( debug_window_t data, gboolean select )
8.316 +{
8.317 + jump_to_disassembly( data, *data->cpu->pc, select );
8.318 +}
8.319 +
8.320 +void set_disassembly_pc( debug_window_t data, unsigned int pc, gboolean select )
8.321 +{
8.322 + int row;
8.323 +
8.324 + jump_to_disassembly( data, pc, select );
8.325 + if( data->disasm_pc != -1 && data->disasm_pc >= data->disasm_from &&
8.326 + data->disasm_pc < data->disasm_to )
8.327 + gtk_clist_set_foreground( data->disasm_list,
8.328 + (data->disasm_pc - data->disasm_from) / data->cpu->instr_size,
8.329 + &gui_colour_normal );
8.330 + row = address_to_row( data, pc );
8.331 + gtk_clist_set_foreground( data->disasm_list, row, &gui_colour_pc );
8.332 + data->disasm_pc = pc;
8.333 +}
8.334 +
8.335 +void set_disassembly_cpu( debug_window_t data, const gchar *cpu )
8.336 +{
8.337 + int i;
8.338 + for( i=0; data->cpu_list[i] != NULL; i++ ) {
8.339 + if( strcmp( data->cpu_list[i]->name, cpu ) == 0 ) {
8.340 + if( data->cpu != data->cpu_list[i] ) {
8.341 + data->cpu = data->cpu_list[i];
8.342 + data->disasm_from = data->disasm_to = -1; /* Force reload */
8.343 + set_disassembly_pc( data, *data->cpu->pc, FALSE );
8.344 + init_register_list( data );
8.345 + }
8.346 + return;
8.347 + }
8.348 + }
8.349 +}
8.350 +
8.351 +void debug_window_toggle_breakpoint( debug_window_t data, int row )
8.352 +{
8.353 + uint32_t pc = row_to_address( data, row );
8.354 + int oldType = data->cpu->get_breakpoint( pc );
8.355 + if( oldType != BREAK_NONE ) {
8.356 + data->cpu->clear_breakpoint( pc, oldType );
8.357 + gtk_clist_set_background( data->disasm_list, row, &gui_colour_white );
8.358 + } else {
8.359 + data->cpu->set_breakpoint( pc, BREAK_KEEP );
8.360 + gtk_clist_set_background( data->disasm_list, row, &gui_colour_break );
8.361 + }
8.362 +}
8.363 +
8.364 +void debug_window_set_oneshot_breakpoint( debug_window_t data, int row )
8.365 +{
8.366 + uint32_t pc = row_to_address( data, row );
8.367 + data->cpu->clear_breakpoint( pc, BREAK_ONESHOT );
8.368 + data->cpu->set_breakpoint( pc, BREAK_ONESHOT );
8.369 + gtk_clist_set_background( data->disasm_list, row, &gui_colour_temp_break );
8.370 +}
8.371 +
8.372 +/**
8.373 + * Execute a single instruction using the current CPU mode.
8.374 + */
8.375 +void debug_window_single_step( debug_window_t data )
8.376 +{
8.377 + data->cpu->step_func();
8.378 + gtk_gui_update();
8.379 +}
8.380 +
8.381 +uint32_t row_to_address( debug_window_t data, int row ) {
8.382 + return data->cpu->instr_size * row + data->disasm_from;
8.383 +}
8.384 +
8.385 +int address_to_row( debug_window_t data, uint32_t address ) {
8.386 + if( data->disasm_from > address || data->disasm_to <= address )
8.387 + return -1;
8.388 + return (address - data->disasm_from) / data->cpu->instr_size;
8.389 +}
8.390 +
8.391 +debug_window_t get_debug_info( GtkWidget *widget ) {
8.392 +
8.393 + GtkWidget *win = gtk_widget_get_toplevel(widget);
8.394 + debug_window_t data = (debug_window_t)gtk_object_get_data( GTK_OBJECT(win), "debug_data" );
8.395 + return data;
8.396 +}
8.397 +
8.398 +void debug_window_set_running( debug_window_t data, gboolean isRunning )
8.399 +{
8.400 + if( data != NULL ) {
8.401 + gtk_gui_enable_action( "SingleStep", !isRunning );
8.402 + gtk_gui_enable_action( "RunTo", !isRunning && dreamcast_can_run() );
8.403 + }
8.404 +}
8.405 +
8.406 +void on_mode_field_changed ( GtkEditable *editable, gpointer user_data)
8.407 +{
8.408 + const gchar *text = gtk_entry_get_text( GTK_ENTRY(editable) );
8.409 + set_disassembly_cpu( gtk_gui_get_debugger(), text );
8.410 +}
8.411 +
8.412 +
8.413 +gboolean on_page_field_key_press_event( GtkWidget * widget, GdkEventKey *event,
8.414 + gpointer user_data)
8.415 +{
8.416 + if( event->keyval == GDK_Return || event->keyval == GDK_Linefeed ) {
8.417 + debug_window_t data = get_debug_info(widget);
8.418 + const gchar *text = gtk_entry_get_text( GTK_ENTRY(widget) );
8.419 + gchar *endptr;
8.420 + unsigned int val = strtoul( text, &endptr, 16 );
8.421 + if( text == endptr ) { /* invalid input */
8.422 + char buf[10];
8.423 + sprintf( buf, "%08X", row_to_address(data,0) );
8.424 + gtk_entry_set_text( GTK_ENTRY(widget), buf );
8.425 + } else {
8.426 + set_disassembly_region(data, val);
8.427 + }
8.428 + }
8.429 + return FALSE;
8.430 +}
8.431 +
8.432 +
8.433 +void on_jump_pc_btn_clicked( GtkButton *button, gpointer user_data)
8.434 +{
8.435 + debug_window_t data = get_debug_info( GTK_WIDGET(button) );
8.436 + jump_to_pc( data, TRUE );
8.437 +}
8.438 +
8.439 +void on_disasm_list_select_row (GtkCList *clist, gint row, gint column,
8.440 + GdkEvent *event, gpointer user_data)
8.441 +{
8.442 + gtk_gui_enable_action( "SetBreakpoint", TRUE );
8.443 + gtk_gui_enable_action( "RunTo", dreamcast_can_run() );
8.444 +}
8.445 +
8.446 +void on_disasm_list_unselect_row (GtkCList *clist, gint row, gint column,
8.447 + GdkEvent *event, gpointer user_data)
8.448 +{
8.449 + gtk_gui_enable_action( "SetBreakpoint", FALSE );
8.450 + gtk_gui_enable_action( "RunTo", FALSE );
8.451 +}
8.452 +
8.453 +gboolean on_debug_delete_event(GtkWidget *widget, GdkEvent event, gpointer user_data)
8.454 +{
8.455 + gtk_widget_hide( widget );
8.456 + return TRUE;
8.457 +}
9.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
9.2 +++ b/src/gtkui/gtk_dump.c Tue Jul 22 04:40:55 2008 +0000
9.3 @@ -0,0 +1,256 @@
9.4 +/**
9.5 + * $Id$
9.6 + *
9.7 + * Implements the memory dump window.
9.8 + *
9.9 + * Copyright (c) 2005 Nathan Keynes.
9.10 + *
9.11 + * This program is free software; you can redistribute it and/or modify
9.12 + * it under the terms of the GNU General Public License as published by
9.13 + * the Free Software Foundation; either version 2 of the License, or
9.14 + * (at your option) any later version.
9.15 + *
9.16 + * This program is distributed in the hope that it will be useful,
9.17 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
9.18 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
9.19 + * GNU General Public License for more details.
9.20 + */
9.21 +
9.22 +#include <ctype.h>
9.23 +#include <assert.h>
9.24 +#include <string.h>
9.25 +#include <stdlib.h>
9.26 +#include "mem.h"
9.27 +#include "gtkui/gtkui.h"
9.28 +
9.29 +#define MAX_DUMP_SIZE 4096
9.30 +
9.31 +#define DUMP_WINDOW_TAG 0xD4B9DA7A
9.32 +
9.33 +struct dump_window_info {
9.34 + uint32_t _tag;
9.35 + uint32_t start;
9.36 + uint32_t end;
9.37 + int flags;
9.38 + unsigned char *data;
9.39 +
9.40 + GtkWidget *window;
9.41 + GtkWidget *fromInput, *toInput;
9.42 + GtkWidget *textArea;
9.43 + GtkTextTag *changedTag;
9.44 + GtkTextBuffer *textBuffer;
9.45 + struct dump_window_info *next;
9.46 +};
9.47 +
9.48 +static dump_window_t dump_list_head = NULL;
9.49 +
9.50 +gboolean on_dump_window_delete_event( GtkWidget *widget, GdkEvent *event,
9.51 + gpointer user_data );
9.52 +void on_dump_window_button_view_clicked( GtkWidget *widget, gpointer user_data );
9.53 +void dump_window_set_text( dump_window_t data, unsigned char *old_data, unsigned char *new_data );
9.54 +
9.55 +
9.56 +dump_window_t dump_window_new( const gchar *title )
9.57 +{
9.58 + GtkWidget *vbox3;
9.59 + GtkWidget *hbox2;
9.60 + GtkWidget *dump_view_button;
9.61 + GtkWidget *scrolledwindow9;
9.62 +
9.63 + dump_window_t dump = g_malloc0( sizeof( struct dump_window_info ) );
9.64 +
9.65 + dump->_tag = DUMP_WINDOW_TAG;
9.66 + dump->next = dump_list_head;
9.67 + dump_list_head = dump;
9.68 + dump->data = NULL;
9.69 + dump->start = 0;
9.70 + dump->end = 0;
9.71 + dump->window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
9.72 + gtk_window_set_title (GTK_WINDOW (dump->window), _("Memory dump"));
9.73 +
9.74 + vbox3 = gtk_vbox_new (FALSE, 0);
9.75 + gtk_container_add (GTK_CONTAINER (dump->window), vbox3);
9.76 +
9.77 + hbox2 = gtk_hbox_new (FALSE, 0);
9.78 + dump->fromInput = gtk_entry_new ();
9.79 + gtk_entry_set_text( GTK_ENTRY(dump->fromInput), "" );
9.80 + dump->toInput = gtk_entry_new ();
9.81 + gtk_entry_set_text( GTK_ENTRY(dump->toInput), "" );
9.82 + dump_view_button = gtk_button_new_with_mnemonic (_("View"));
9.83 +
9.84 + gtk_box_pack_start (GTK_BOX (hbox2), gtk_label_new(_(" From ")), FALSE, FALSE, 0);
9.85 + gtk_box_pack_start (GTK_BOX (hbox2), dump->fromInput, FALSE, TRUE, 0);
9.86 + gtk_box_pack_start (GTK_BOX (hbox2), gtk_label_new(_(" To ")), FALSE, FALSE, 0);
9.87 + gtk_box_pack_start (GTK_BOX (hbox2), dump->toInput, FALSE, TRUE, 0);
9.88 + gtk_box_pack_start (GTK_BOX (hbox2), dump_view_button, FALSE, FALSE, 0);
9.89 + gtk_box_pack_start (GTK_BOX (hbox2), gtk_label_new (_(" ")), TRUE, TRUE, 0);
9.90 + gtk_box_pack_start (GTK_BOX (vbox3), hbox2, FALSE, TRUE, 3);
9.91 +
9.92 + dump->textArea = gtk_text_view_new ();
9.93 + dump->textBuffer = gtk_text_buffer_new(NULL);
9.94 + dump->changedTag = gtk_text_buffer_create_tag(dump->textBuffer, "changed",
9.95 + "foreground", "blue", NULL);
9.96 + gtk_widget_modify_font(GTK_WIDGET(dump->textArea),gui_fixed_font);
9.97 + gtk_text_view_set_editable(GTK_TEXT_VIEW(dump->textArea), FALSE);
9.98 + gtk_text_view_set_buffer(GTK_TEXT_VIEW(dump->textArea), dump->textBuffer);
9.99 + scrolledwindow9 = gtk_scrolled_window_new (NULL, NULL);
9.100 + gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (scrolledwindow9), GTK_SHADOW_IN);
9.101 + gtk_container_add (GTK_CONTAINER (scrolledwindow9), dump->textArea);
9.102 + gtk_box_pack_start (GTK_BOX (vbox3), scrolledwindow9, TRUE, TRUE, 0);
9.103 +
9.104 + g_signal_connect (dump->window, "delete_event",
9.105 + G_CALLBACK (on_dump_window_delete_event),
9.106 + dump);
9.107 + g_signal_connect (dump_view_button, "clicked",
9.108 + G_CALLBACK (on_dump_window_button_view_clicked),
9.109 + dump);
9.110 + gtk_widget_show_all( dump->window );
9.111 +
9.112 + return dump;
9.113 +}
9.114 +
9.115 +void gtk_entry_set_hex_value( GtkEntry *entry, uint32_t value )
9.116 +{
9.117 + char buf[10];
9.118 + sprintf( buf, "%08X", value );
9.119 + gtk_entry_set_text( entry, buf );
9.120 +}
9.121 +
9.122 +uint32_t gtk_entry_get_hex_value( GtkEntry *entry, uint32_t defaultValue )
9.123 +{
9.124 + const gchar *text = gtk_entry_get_text(entry);
9.125 + if( text == NULL )
9.126 + return defaultValue;
9.127 + gchar *endptr;
9.128 + uint32_t value = strtoul( text, &endptr, 16 );
9.129 + if( text == endptr ) { /* invalid input */
9.130 + value = defaultValue;
9.131 + gtk_entry_set_hex_value( entry, value );
9.132 + }
9.133 + return value;
9.134 +}
9.135 +
9.136 +gboolean on_dump_window_delete_event( GtkWidget *widget, GdkEvent *event,
9.137 + gpointer user_data )
9.138 +{
9.139 + dump_window_t data = (dump_window_t)user_data;
9.140 + if( data->data != NULL )
9.141 + free( data->data );
9.142 + dump_window_t node = dump_list_head;
9.143 + if( node == data )
9.144 + dump_list_head = data->next;
9.145 + else {
9.146 + while( node->next != data ) {
9.147 + node = node->next;
9.148 + assert( node != NULL );
9.149 + }
9.150 + node->next = data->next;
9.151 + }
9.152 + free( data );
9.153 + return FALSE;
9.154 +}
9.155 +
9.156 +void on_dump_window_button_view_clicked( GtkWidget *widget, gpointer user_data )
9.157 +{
9.158 + dump_window_t data = (dump_window_t)user_data;
9.159 + uint32_t startVal, endVal;
9.160 +
9.161 + assert( data != NULL );
9.162 + assert( data->_tag == DUMP_WINDOW_TAG );
9.163 +
9.164 + startVal = gtk_entry_get_hex_value(GTK_ENTRY(data->fromInput), data->start);
9.165 + endVal = gtk_entry_get_hex_value(GTK_ENTRY(data->toInput), data->end);
9.166 + if( startVal != data->start || endVal != data->end ) {
9.167 + if( startVal > endVal ) {
9.168 + int tmp = endVal;
9.169 + endVal = startVal;
9.170 + startVal = tmp;
9.171 + }
9.172 + if( endVal > startVal + MAX_DUMP_SIZE )
9.173 + endVal = startVal + MAX_DUMP_SIZE;
9.174 +
9.175 + gtk_entry_set_hex_value(GTK_ENTRY(data->fromInput),startVal);
9.176 + gtk_entry_set_hex_value(GTK_ENTRY(data->toInput),endVal);
9.177 + data->start = startVal;
9.178 + data->end = endVal;
9.179 +
9.180 + if( data->data != NULL ) {
9.181 + free( data->data );
9.182 + data->data = NULL;
9.183 + }
9.184 + if( startVal != endVal ) {
9.185 + data->data = malloc( endVal - startVal );
9.186 + mem_copy_from_sh4( data->data, startVal, endVal-startVal );
9.187 + dump_window_set_text( data, data->data, data->data );
9.188 + }
9.189 + }
9.190 +}
9.191 +
9.192 +void dump_window_update( dump_window_t data )
9.193 +{
9.194 + if( data->data == NULL )
9.195 + return;
9.196 + unsigned char tmp[data->end-data->start];
9.197 + int length = data->end-data->start;
9.198 + memcpy( tmp, data->data, length );
9.199 + mem_copy_from_sh4( data->data, data->start, length );
9.200 + dump_window_set_text( data, tmp, data->data );
9.201 +}
9.202 +
9.203 +void dump_window_update_all( )
9.204 +{
9.205 + dump_window_t node = dump_list_head;
9.206 + while( node != NULL ) {
9.207 + dump_window_update(node);
9.208 + node = node->next;
9.209 + }
9.210 +}
9.211 +
9.212 +void dump_window_set_text( dump_window_t data, unsigned char *old_data, unsigned char *new_data )
9.213 +{
9.214 + GtkTextBuffer *buf = data->textBuffer;
9.215 + GtkTextTag *changedTag = data->changedTag;
9.216 + GtkTextIter iter, endIter;
9.217 + int i, j, offset;
9.218 + /* Clear out the buffer */
9.219 + gtk_text_buffer_get_start_iter(buf,&iter);
9.220 + gtk_text_buffer_get_end_iter(buf,&endIter);
9.221 + gtk_text_buffer_delete(buf,&iter,&endIter);
9.222 + gtk_text_buffer_get_start_iter(buf,&iter);
9.223 +
9.224 + for( offset = 0, i=data->start; i<data->end; i+=16, offset+=16 ) {
9.225 + char text[80];
9.226 + sprintf(text, "%08X:", i );
9.227 + gtk_text_buffer_insert( buf, &iter, text, 9 );
9.228 + for( j=0; j<16; j++ ) {
9.229 + if( j%4 == 0 )
9.230 + gtk_text_buffer_insert( buf, &iter, " ", 1 );
9.231 + if( i+j < data->end ) {
9.232 + int oldVal = ((int)old_data[offset+j])&0xFF;
9.233 + int newVal = ((int)new_data[offset+j])&0xFF;
9.234 + sprintf(text, "%02X ", newVal);
9.235 + if( oldVal == newVal )
9.236 + gtk_text_buffer_insert( buf, &iter, text, 3 );
9.237 + else
9.238 + gtk_text_buffer_insert_with_tags( buf, &iter, text, 3,
9.239 + changedTag, NULL );
9.240 + } else {
9.241 + gtk_text_buffer_insert( buf, &iter, " ", 3 );
9.242 + }
9.243 + }
9.244 + gtk_text_buffer_insert( buf, &iter, " ", 2 );
9.245 + for( j=0; j<16 && i+j < data->end; j++ ) {
9.246 + int oldVal = ((int)old_data[offset+j])&0xFF;
9.247 + int newVal = ((int)new_data[offset+j])&0xFF;
9.248 + if( isprint(newVal) )
9.249 + sprintf( text, "%c", newVal );
9.250 + else strcpy( text, "." );
9.251 + if( oldVal == newVal )
9.252 + gtk_text_buffer_insert( buf, &iter, text, 1 );
9.253 + else
9.254 + gtk_text_buffer_insert_with_tags( buf, &iter, text, 1,
9.255 + changedTag, NULL );
9.256 + }
9.257 + gtk_text_buffer_insert( buf, &iter, "\n", 1 );
9.258 + }
9.259 +}
10.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
10.2 +++ b/src/gtkui/gtk_gd.c Tue Jul 22 04:40:55 2008 +0000
10.3 @@ -0,0 +1,111 @@
10.4 +/**
10.5 + * $Id$
10.6 + *
10.7 + * Creates and manages the GD-Rom attachment menu.
10.8 + *
10.9 + * Copyright (c) 2005 Nathan Keynes.
10.10 + *
10.11 + * This program is free software; you can redistribute it and/or modify
10.12 + * it under the terms of the GNU General Public License as published by
10.13 + * the Free Software Foundation; either version 2 of the License, or
10.14 + * (at your option) any later version.
10.15 + *
10.16 + * This program is distributed in the hope that it will be useful,
10.17 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
10.18 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10.19 + * GNU General Public License for more details.
10.20 + */
10.21 +
10.22 +#include <assert.h>
10.23 +#include <libgen.h>
10.24 +#include "dream.h"
10.25 +#include "dreamcast.h"
10.26 +#include "config.h"
10.27 +#include "gdlist.h"
10.28 +#include "gdrom/gdrom.h"
10.29 +#include "gtkui/gtkui.h"
10.30 +
10.31 +static gboolean gdrom_menu_adjusting = FALSE;
10.32 +
10.33 +static void gdrom_menu_open_image_callback( GtkWidget *widget, gpointer user_data )
10.34 +{
10.35 + if( !gdrom_menu_adjusting ) {
10.36 + const gchar *dir = lxdream_get_config_value(CONFIG_DEFAULT_PATH);
10.37 + open_file_dialog( _("Open..."), gdrom_mount_image, NULL, NULL, dir );
10.38 + }
10.39 +}
10.40 +
10.41 +void gdrom_menu_item_callback( GtkWidget *widget, gpointer user_data )
10.42 +{
10.43 + if( !gdrom_menu_adjusting ) {
10.44 + gdrom_list_set_selection( GPOINTER_TO_INT(user_data) );
10.45 + }
10.46 +}
10.47 +
10.48 +void gdrom_menu_build( GtkWidget *menu )
10.49 +{
10.50 + unsigned int i, len;
10.51 + GSList *group = NULL;
10.52 +
10.53 + len = gdrom_list_size();
10.54 + for( i=0; i < len; i++ ) {
10.55 + const gchar *entry = gdrom_list_get_display_name(i);
10.56 + if( entry[0] == '\0' ) { // Empty string = separator
10.57 + gtk_menu_shell_append( GTK_MENU_SHELL(menu), gtk_separator_menu_item_new() );
10.58 + } else {
10.59 + GtkWidget *item = gtk_radio_menu_item_new_with_label( group, entry );
10.60 + group = gtk_radio_menu_item_get_group( GTK_RADIO_MENU_ITEM(item) );
10.61 + g_signal_connect_after( item, "activate", G_CALLBACK(gdrom_menu_item_callback), GINT_TO_POINTER(i) );
10.62 + gtk_menu_shell_append( GTK_MENU_SHELL(menu), item );
10.63 + }
10.64 + }
10.65 +
10.66 + gtk_menu_shell_append( GTK_MENU_SHELL(menu), gtk_separator_menu_item_new() );
10.67 + GtkWidget *open = gtk_image_menu_item_new_with_label( _("Open image file...") );
10.68 + g_signal_connect_after( open, "activate", G_CALLBACK(gdrom_menu_open_image_callback), NULL );
10.69 + gtk_menu_shell_append( GTK_MENU_SHELL(menu), open );
10.70 + gtk_widget_show_all(menu);
10.71 +}
10.72 +
10.73 +void gdrom_menu_rebuild( GtkWidget *menu )
10.74 +{
10.75 + GList *children = gtk_container_get_children( GTK_CONTAINER(menu) );
10.76 + GList *listptr;
10.77 + for( listptr = children; listptr != NULL; listptr = g_list_next(listptr) ) {
10.78 + gtk_widget_destroy( GTK_WIDGET(listptr->data) );
10.79 + }
10.80 + g_list_free(children);
10.81 + gdrom_menu_build(menu);
10.82 +}
10.83 +
10.84 +gboolean gdrom_menu_update( gboolean list_changed, int selection, void *user_data )
10.85 +{
10.86 + gdrom_menu_adjusting = TRUE;
10.87 + GtkWidget *menu = GTK_WIDGET(user_data);
10.88 +
10.89 + if( list_changed ) {
10.90 + gdrom_menu_rebuild(menu);
10.91 + }
10.92 +
10.93 + GList *children = gtk_container_get_children( GTK_CONTAINER(menu) );
10.94 + GList *item = g_list_nth( children, selection );
10.95 + assert( item != NULL );
10.96 + gtk_check_menu_item_set_active( GTK_CHECK_MENU_ITEM(item->data), TRUE );
10.97 + g_list_free(children);
10.98 +
10.99 + gdrom_menu_adjusting = FALSE;
10.100 + return TRUE;
10.101 +}
10.102 +
10.103 +GtkWidget *gdrom_menu_new()
10.104 +{
10.105 + GtkWidget *menu = gtk_menu_new();
10.106 + gtk_menu_set_title( GTK_MENU(menu), _("GD-Rom Settings") );
10.107 +
10.108 + gdrom_menu_build(menu);
10.109 + register_gdrom_list_change_hook(gdrom_menu_update, menu);
10.110 + gdrom_menu_update( FALSE, gdrom_list_get_selection(), menu );
10.111 + gtk_widget_show_all(menu);
10.112 +
10.113 + return menu;
10.114 +}
11.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
11.2 +++ b/src/gtkui/gtk_mmio.c Tue Jul 22 04:40:55 2008 +0000
11.3 @@ -0,0 +1,244 @@
11.4 +/**
11.5 + * $Id$
11.6 + *
11.7 + * Implements the MMIO register viewing window
11.8 + *
11.9 + * Copyright (c) 2005 Nathan Keynes.
11.10 + *
11.11 + * This program is free software; you can redistribute it and/or modify
11.12 + * it under the terms of the GNU General Public License as published by
11.13 + * the Free Software Foundation; either version 2 of the License, or
11.14 + * (at your option) any later version.
11.15 + *
11.16 + * This program is distributed in the hope that it will be useful,
11.17 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
11.18 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11.19 + * GNU General Public License for more details.
11.20 + */
11.21 +
11.22 +#include <stdint.h>
11.23 +#include <string.h>
11.24 +#include "gtkui/gtkui.h"
11.25 +#include "mem.h"
11.26 +#include "mmio.h"
11.27 +
11.28 +
11.29 +struct mmio_window_info {
11.30 + GtkWidget *window;
11.31 + GtkWidget *notebook;
11.32 +};
11.33 +
11.34 +static void printbits( char *out, int nbits, uint32_t value )
11.35 +{
11.36 + if( nbits < 32 ) {
11.37 + int i;
11.38 + for( i=32; i>nbits; i-- ) {
11.39 + if( !(i % 8) ) *out++ = ' ';
11.40 + *out++ = ' ';
11.41 + }
11.42 + }
11.43 + while( nbits > 0 ) {
11.44 + *out++ = (value&(1<<--nbits) ? '1' : '0');
11.45 + if( !(nbits % 8) ) *out++ = ' ';
11.46 + }
11.47 + *out = '\0';
11.48 +}
11.49 +
11.50 +static void printhex( char *out, int nbits, uint32_t value )
11.51 +{
11.52 + char tmp[10], *p = tmp;
11.53 + int i;
11.54 +
11.55 + sprintf( tmp, "%08X", value );
11.56 + for( i=32; i>0; i-=4, p++ ) {
11.57 + if( i <= nbits ) *out++ = *p;
11.58 + else *out++ = ' ';
11.59 + }
11.60 + *out = '\0';
11.61 +}
11.62 +
11.63 +
11.64 +
11.65 +
11.66 +gboolean
11.67 +on_mmio_delete_event (GtkWidget *widget,
11.68 + GdkEvent *event,
11.69 + gpointer user_data)
11.70 +{
11.71 + gtk_widget_hide(widget);
11.72 + return TRUE;
11.73 +}
11.74 +
11.75 +
11.76 +void on_mmio_close_clicked( GtkButton *button, gpointer user_data)
11.77 +{
11.78 + gtk_widget_hide( ((mmio_window_t)user_data)->window );
11.79 +}
11.80 +
11.81 +
11.82 +void on_trace_button_toggled (GtkToggleButton *button,
11.83 + gpointer user_data)
11.84 +{
11.85 + struct mmio_region *io_rgn = (struct mmio_region *)user_data;
11.86 + gboolean isActive = gtk_toggle_button_get_active(button);
11.87 + if( io_rgn != NULL ) {
11.88 + io_rgn->trace_flag = isActive ? 1 : 0;
11.89 + }
11.90 +}
11.91 +
11.92 +static GtkCList *mmio_window_add_page( mmio_window_t mmio, char *name, struct mmio_region *io_rgn )
11.93 +{
11.94 + GtkCList *list;
11.95 + GtkWidget *scroll;
11.96 + GtkWidget *tab;
11.97 + GtkCheckButton *trace_button;
11.98 + GtkVBox *vbox;
11.99 +
11.100 + scroll = gtk_scrolled_window_new(NULL, NULL);
11.101 + gtk_scrolled_window_set_policy( GTK_SCROLLED_WINDOW(scroll),
11.102 + GTK_POLICY_AUTOMATIC, GTK_POLICY_ALWAYS );
11.103 + list = GTK_CLIST(gtk_clist_new(5));
11.104 + gtk_clist_set_column_width(list, 0, 70);
11.105 + gtk_clist_set_column_width(list, 1, 75);
11.106 + gtk_clist_set_column_width(list, 2, 70);
11.107 + gtk_clist_set_column_width(list, 3, 280);
11.108 + gtk_clist_set_column_width(list, 4, 160);
11.109 + gtk_clist_set_column_justification(list, 0, GTK_JUSTIFY_CENTER );
11.110 + gtk_clist_set_column_justification(list, 2, GTK_JUSTIFY_CENTER );
11.111 + gtk_clist_set_column_justification(list, 3, GTK_JUSTIFY_CENTER );
11.112 + gtk_clist_set_column_title(list, 0, _("Address"));
11.113 + gtk_clist_set_column_title(list, 1, _("Register"));
11.114 + gtk_clist_set_column_title(list, 2, _("Value"));
11.115 + gtk_clist_set_column_title(list, 3, _("Bit Pattern"));
11.116 + gtk_clist_set_column_title(list, 4, _("Description"));
11.117 + gtk_clist_column_titles_show(list);
11.118 + gtk_widget_modify_font( GTK_WIDGET(list), gui_fixed_font );
11.119 + tab = gtk_label_new(_(name));
11.120 + gtk_container_add( GTK_CONTAINER(scroll), GTK_WIDGET(list) );
11.121 +
11.122 + vbox = GTK_VBOX(gtk_vbox_new( FALSE, 0 ));
11.123 + gtk_container_add( GTK_CONTAINER(vbox), GTK_WIDGET(scroll) );
11.124 +
11.125 + trace_button = GTK_CHECK_BUTTON(gtk_check_button_new_with_label(_("Trace access")));
11.126 + if( io_rgn != NULL ) {
11.127 + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(trace_button),
11.128 + io_rgn->trace_flag ? TRUE : FALSE);
11.129 + }
11.130 + gtk_container_add( GTK_CONTAINER(vbox), GTK_WIDGET(trace_button) );
11.131 + gtk_box_set_child_packing( GTK_BOX(vbox), GTK_WIDGET(trace_button),
11.132 + FALSE, FALSE, 0, GTK_PACK_START );
11.133 + gtk_notebook_append_page( GTK_NOTEBOOK(mmio->notebook), GTK_WIDGET(vbox), tab );
11.134 + gtk_object_set_data( GTK_OBJECT(mmio->window), name, list );
11.135 + g_signal_connect ((gpointer) trace_button, "toggled",
11.136 + G_CALLBACK (on_trace_button_toggled),
11.137 + io_rgn);
11.138 + return list;
11.139 +}
11.140 +
11.141 +
11.142 +
11.143 +mmio_window_t mmio_window_new( const gchar *title )
11.144 +{
11.145 + mmio_window_t mmio = g_malloc0( sizeof(struct mmio_window_info) );
11.146 +
11.147 + int i, j;
11.148 + GtkCList *all_list;
11.149 + GtkWidget *vbox1;
11.150 + GtkWidget *hbuttonbox1;
11.151 + GtkWidget *mmr_close;
11.152 +
11.153 + mmio->window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
11.154 + gtk_window_set_title (GTK_WINDOW (mmio->window), title);
11.155 + gtk_window_set_default_size (GTK_WINDOW (mmio->window), 600, 600);
11.156 +
11.157 + vbox1 = gtk_vbox_new (FALSE, 0);
11.158 + gtk_container_add (GTK_CONTAINER (mmio->window), vbox1);
11.159 +
11.160 + mmio->notebook = gtk_notebook_new ();
11.161 + gtk_box_pack_start (GTK_BOX (vbox1), mmio->notebook, TRUE, TRUE, 0);
11.162 + gtk_notebook_set_tab_pos (GTK_NOTEBOOK (mmio->notebook), GTK_POS_LEFT);
11.163 +
11.164 + hbuttonbox1 = gtk_hbutton_box_new ();
11.165 + gtk_box_pack_start (GTK_BOX (vbox1), hbuttonbox1, FALSE, TRUE, 0);
11.166 + gtk_box_set_spacing (GTK_BOX (hbuttonbox1), 30);
11.167 +
11.168 + mmr_close = gtk_button_new_with_mnemonic (_("Close"));
11.169 + gtk_container_add (GTK_CONTAINER (hbuttonbox1), mmr_close);
11.170 + GTK_WIDGET_SET_FLAGS (mmr_close, GTK_CAN_DEFAULT);
11.171 +
11.172 + /* Add the mmio register data */
11.173 + all_list = mmio_window_add_page( mmio, "All", NULL );
11.174 + for( i=0; i < num_io_rgns; i++ ) {
11.175 + GtkCList *list = mmio_window_add_page( mmio, io_rgn[i]->id, io_rgn[i] );
11.176 + for( j=0; io_rgn[i]->ports[j].id != NULL; j++ ) {
11.177 + int sz = io_rgn[i]->ports[j].width;
11.178 + char addr[10], data[10], bits[40];
11.179 + char *arr[] = { addr, io_rgn[i]->ports[j].id, data, bits,
11.180 + io_rgn[i]->ports[j].desc };
11.181 + sprintf( addr, "%08X",
11.182 + io_rgn[i]->base + io_rgn[i]->ports[j].offset );
11.183 + printhex( data, sz, *io_rgn[i]->ports[j].val );
11.184 + printbits( bits, io_rgn[i]->ports[j].width,
11.185 + *io_rgn[i]->ports[j].val );
11.186 + gtk_clist_append( list, arr );
11.187 + gtk_clist_append( all_list, arr );
11.188 + }
11.189 + }
11.190 +
11.191 + g_signal_connect ((gpointer) mmio->window, "delete_event",
11.192 + G_CALLBACK (on_mmio_delete_event),
11.193 + NULL);
11.194 + g_signal_connect ((gpointer) mmr_close, "clicked",
11.195 + G_CALLBACK (on_mmio_close_clicked),
11.196 + mmio);
11.197 +
11.198 + gtk_widget_show_all( mmio->window );
11.199 + return mmio;
11.200 +}
11.201 +
11.202 +void mmio_window_update( mmio_window_t mmio )
11.203 +{
11.204 + int i,j, count = 0;
11.205 + GtkCList *page, *all_page;
11.206 + char data[10], bits[40];
11.207 +
11.208 + all_page = GTK_CLIST(gtk_object_get_data( GTK_OBJECT(mmio->window), "All" ));
11.209 +
11.210 + for( i=0; i < num_io_rgns; i++ ) {
11.211 + page = GTK_CLIST(gtk_object_get_data( GTK_OBJECT(mmio->window),
11.212 + io_rgn[i]->id ));
11.213 + for( j=0; io_rgn[i]->ports[j].id != NULL; j++ ) {
11.214 + if( *io_rgn[i]->ports[j].val !=
11.215 + *(uint32_t *)(io_rgn[i]->save_mem+io_rgn[i]->ports[j].offset)){
11.216 + int sz = io_rgn[i]->ports[j].width;
11.217 + /* Changed */
11.218 + printhex( data, sz, *io_rgn[i]->ports[j].val );
11.219 + printbits( bits, sz, *io_rgn[i]->ports[j].val );
11.220 +
11.221 + gtk_clist_set_text( page, j, 2, data );
11.222 + gtk_clist_set_text( page, j, 3, bits );
11.223 + gtk_clist_set_foreground( page, j, &gui_colour_changed );
11.224 +
11.225 + gtk_clist_set_text( all_page, count, 2, data );
11.226 + gtk_clist_set_text( all_page, count, 3, bits );
11.227 + gtk_clist_set_foreground( all_page, count, &gui_colour_changed );
11.228 +
11.229 + } else {
11.230 + gtk_clist_set_foreground( page, j, &gui_colour_normal );
11.231 + gtk_clist_set_foreground( all_page, count, &gui_colour_normal );
11.232 + }
11.233 + count++;
11.234 + }
11.235 + memcpy( io_rgn[i]->save_mem, io_rgn[i]->mem, PAGE_SIZE );
11.236 + }
11.237 +}
11.238 +
11.239 +void mmio_window_show( mmio_window_t mmio, gboolean show )
11.240 +{
11.241 + if( show ) {
11.242 + gtk_widget_show( mmio->window );
11.243 + } else {
11.244 + gtk_widget_hide( mmio->window );
11.245 + }
11.246 +}
11.247 +
12.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
12.2 +++ b/src/gtkui/gtk_path.c Tue Jul 22 04:40:55 2008 +0000
12.3 @@ -0,0 +1,129 @@
12.4 +/**
12.5 + * $Id$
12.6 + *
12.7 + * Define the main (emu) GTK window, along with its menubars,
12.8 + * toolbars, etc.
12.9 + *
12.10 + * Copyright (c) 2005 Nathan Keynes.
12.11 + *
12.12 + * This program is free software; you can redistribute it and/or modify
12.13 + * it under the terms of the GNU General Public License as published by
12.14 + * the Free Software Foundation; either version 2 of the License, or
12.15 + * (at your option) any later version.
12.16 + *
12.17 + * This program is distributed in the hope that it will be useful,
12.18 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
12.19 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12.20 + * GNU General Public License for more details.
12.21 + */
12.22 +
12.23 +#include <assert.h>
12.24 +#include <gtk/gtk.h>
12.25 +
12.26 +#include "lxdream.h"
12.27 +#include "dreamcast.h"
12.28 +#include "config.h"
12.29 +#include "gtkui/gtkui.h"
12.30 +
12.31 +static const gchar *path_label[] = { N_("Bios rom"), N_("Flash rom"), N_("Default disc path"),
12.32 + N_("Save state path"), N_("Bootstrap IP.BIN") };
12.33 +static const int path_id[] = { CONFIG_BIOS_PATH, CONFIG_FLASH_PATH, CONFIG_DEFAULT_PATH,
12.34 + CONFIG_SAVE_PATH, CONFIG_BOOTSTRAP };
12.35 +static GtkFileChooserAction path_action[] = {
12.36 + GTK_FILE_CHOOSER_ACTION_OPEN,
12.37 + GTK_FILE_CHOOSER_ACTION_OPEN,
12.38 + GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER,
12.39 + GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER,
12.40 + GTK_FILE_CHOOSER_ACTION_OPEN };
12.41 +
12.42 +static GtkWidget *path_entry[5];
12.43 +
12.44 +static gboolean path_file_button_clicked( GtkWidget *button, gpointer user_data )
12.45 +{
12.46 + GtkWidget *entry = GTK_WIDGET(user_data);
12.47 + GtkWidget *file = gtk_file_chooser_dialog_new( _("Select file"), NULL,
12.48 + GTK_FILE_CHOOSER_ACTION_OPEN,
12.49 + GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
12.50 + GTK_STOCK_OPEN, GTK_RESPONSE_ACCEPT,
12.51 + NULL );
12.52 + const gchar *filename = gtk_entry_get_text(GTK_ENTRY(entry));
12.53 + gtk_file_chooser_set_filename( GTK_FILE_CHOOSER(file), filename );
12.54 + gtk_window_set_modal( GTK_WINDOW(file), TRUE );
12.55 + gtk_widget_show_all( file );
12.56 + gint result = gtk_dialog_run(GTK_DIALOG(file));
12.57 + if( result == GTK_RESPONSE_ACCEPT ) {
12.58 + filename = gtk_file_chooser_get_filename( GTK_FILE_CHOOSER(file) );
12.59 + gtk_entry_set_text(GTK_ENTRY(entry), filename);
12.60 + }
12.61 + gtk_widget_destroy(file);
12.62 + return TRUE;
12.63 +}
12.64 +
12.65 +static gboolean path_dir_button_clicked( GtkWidget *button, gpointer user_data )
12.66 +{
12.67 + GtkWidget *entry = GTK_WIDGET(user_data);
12.68 + GtkWidget *file = gtk_file_chooser_dialog_new( _("Select file"), NULL,
12.69 + GTK_FILE_CHOOSER_ACTION_OPEN,
12.70 + GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
12.71 + GTK_STOCK_OPEN, GTK_RESPONSE_ACCEPT,
12.72 + NULL );
12.73 + const gchar *filename = gtk_entry_get_text(GTK_ENTRY(entry));
12.74 + gtk_file_chooser_set_action( GTK_FILE_CHOOSER(file), GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER );
12.75 + gtk_file_chooser_set_filename( GTK_FILE_CHOOSER(file), filename );
12.76 + gtk_window_set_modal( GTK_WINDOW(file), TRUE );
12.77 + gtk_widget_show_all( file );
12.78 + gint result = gtk_dialog_run(GTK_DIALOG(file));
12.79 + if( result == GTK_RESPONSE_ACCEPT ) {
12.80 + filename = gtk_file_chooser_get_filename( GTK_FILE_CHOOSER(file) );
12.81 + gtk_entry_set_text(GTK_ENTRY(entry), filename);
12.82 + }
12.83 + gtk_widget_destroy(file);
12.84 + return TRUE;
12.85 +}
12.86 +
12.87 +GtkWidget *path_panel_new(void)
12.88 +{
12.89 + GtkWidget *table = gtk_table_new( 5, 3, FALSE );
12.90 + int i;
12.91 + for( i=0; i<5; i++ ) {
12.92 + GtkWidget *text = path_entry[i] = gtk_entry_new();
12.93 + GtkWidget *button = gtk_button_new();
12.94 + gtk_table_attach( GTK_TABLE(table), gtk_label_new(Q_(path_label[i])), 0, 1, i, i+1,
12.95 + GTK_SHRINK, GTK_SHRINK, 0, 0);
12.96 + gtk_entry_set_text( GTK_ENTRY(text), lxdream_get_config_value(path_id[i]) );
12.97 + gtk_entry_set_width_chars( GTK_ENTRY(text), 48 );
12.98 + gtk_table_attach_defaults( GTK_TABLE(table), text, 1, 2, i, i+1 );
12.99 + gtk_table_attach( GTK_TABLE(table), button, 2, 3, i, i+1, GTK_SHRINK, GTK_SHRINK, 0, 0 );
12.100 + if( path_action[i] == GTK_FILE_CHOOSER_ACTION_OPEN ) {
12.101 + GtkWidget *image = gtk_image_new_from_stock(GTK_STOCK_OPEN, GTK_ICON_SIZE_BUTTON);
12.102 + gtk_button_set_image( GTK_BUTTON(button), image );
12.103 + g_signal_connect( button, "clicked", G_CALLBACK(path_file_button_clicked), text );
12.104 + } else {
12.105 + GtkWidget *image = gtk_image_new_from_stock(GTK_STOCK_OPEN, GTK_ICON_SIZE_BUTTON);
12.106 + gtk_button_set_image( GTK_BUTTON(button), image );
12.107 + g_signal_connect( button, "clicked", G_CALLBACK(path_dir_button_clicked), text );
12.108 + }
12.109 + }
12.110 + return table;
12.111 +
12.112 +}
12.113 +
12.114 +void path_panel_done( GtkWidget *panel, gboolean isOK )
12.115 +{
12.116 + if( isOK ) {
12.117 + int i;
12.118 + for(i=0; i<5; i++ ) {
12.119 + const char *filename = gtk_entry_get_text( GTK_ENTRY(path_entry[i]) );
12.120 + lxdream_set_global_config_value( path_id[i], filename );
12.121 + }
12.122 +
12.123 + lxdream_save_config();
12.124 + dreamcast_config_changed();
12.125 + gtk_gui_update();
12.126 + }
12.127 +}
12.128 +
12.129 +void path_dialog_run( void )
12.130 +{
12.131 + gtk_gui_run_property_dialog( _("Path Settings"), path_panel_new(), path_panel_done );
12.132 +}
13.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
13.2 +++ b/src/gtkui/gtk_win.c Tue Jul 22 04:40:55 2008 +0000
13.3 @@ -0,0 +1,381 @@
13.4 +/**
13.5 + * $Id$
13.6 + *
13.7 + * Define the main (emu) GTK window, along with its menubars,
13.8 + * toolbars, etc.
13.9 + *
13.10 + * Copyright (c) 2005 Nathan Keynes.
13.11 + *
13.12 + * This program is free software; you can redistribute it and/or modify
13.13 + * it under the terms of the GNU General Public License as published by
13.14 + * the Free Software Foundation; either version 2 of the License, or
13.15 + * (at your option) any later version.
13.16 + *
13.17 + * This program is distributed in the hope that it will be useful,
13.18 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
13.19 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13.20 + * GNU General Public License for more details.
13.21 + */
13.22 +
13.23 +#include <assert.h>
13.24 +#include <sys/types.h>
13.25 +#include <sys/stat.h>
13.26 +#include <unistd.h>
13.27 +#include <string.h>
13.28 +#include <stdio.h>
13.29 +#include <stdlib.h>
13.30 +
13.31 +#include <gtk/gtk.h>
13.32 +#include <gdk/gdk.h>
13.33 +#include <gdk/gdkkeysyms.h>
13.34 +#include <X11/Xutil.h>
13.35 +
13.36 +#include "lxdream.h"
13.37 +#include "dreamcast.h"
13.38 +#include "display.h"
13.39 +#include "gtkui/gtkui.h"
13.40 +
13.41 +
13.42 +struct main_window_info {
13.43 + GtkWidget *window;
13.44 + GtkWidget *video;
13.45 + GtkWidget *menubar;
13.46 + GtkWidget *toolbar;
13.47 + GtkWidget *statusbar;
13.48 + GtkActionGroup *actions;
13.49 + gboolean use_grab;
13.50 + gboolean is_grabbed;
13.51 + int32_t mouse_x, mouse_y;
13.52 +};
13.53 +
13.54 +
13.55 +/******************** Video window **************************/
13.56 +
13.57 +/**
13.58 + * Adjust the mouse pointer so that it appears in the center of the video
13.59 + * window. Mainly used for when we have the mouse grab
13.60 + */
13.61 +void video_window_center_pointer( main_window_t win )
13.62 +{
13.63 + GdkDisplay *display = gtk_widget_get_display(win->video);
13.64 + GdkScreen *screen = gtk_widget_get_screen(win->video);
13.65 + int x,y;
13.66 + int width, height;
13.67 +
13.68 + gdk_window_get_origin(win->video->window, &x, &y);
13.69 + gdk_drawable_get_size(GDK_DRAWABLE(win->video->window), &width, &height);
13.70 + x += width / 2;
13.71 + y += height / 2;
13.72 +
13.73 + gdk_display_warp_pointer( display, screen, x, y );
13.74 + win->mouse_x = width/2;
13.75 + win->mouse_y = height/2;
13.76 +}
13.77 +
13.78 +/**
13.79 + * Grab the keyboard and mouse for the display. The mouse cursor is hidden and
13.80 + * moved to the centre of the window.
13.81 + *
13.82 + * @param win The window receiving the grab
13.83 + * @return TRUE if the grab was successful, FALSE on failure.
13.84 + */
13.85 +gboolean video_window_grab_display( main_window_t win )
13.86 +{
13.87 + GdkWindow *gdkwin = win->video->window;
13.88 + GdkColor color = { 0,0,0,0 };
13.89 + char bytes[32]; /* 16 * 16 / 8 */
13.90 + memset(bytes, 0, 32);
13.91 + GdkPixmap *pixmap = gdk_bitmap_create_from_data(NULL, bytes, 16, 16);
13.92 + GdkCursor *cursor = gdk_cursor_new_from_pixmap(pixmap, pixmap, &color, &color, 16, 16);
13.93 + gdk_pixmap_unref(pixmap);
13.94 +
13.95 + gboolean success =
13.96 + gdk_pointer_grab( gdkwin, FALSE,
13.97 + GDK_POINTER_MOTION_MASK|GDK_BUTTON_PRESS_MASK|GDK_BUTTON_RELEASE_MASK,
13.98 + gdkwin, cursor, GDK_CURRENT_TIME ) == GDK_GRAB_SUCCESS;
13.99 + gdk_cursor_unref(cursor);
13.100 + if( success ) {
13.101 + success = gdk_keyboard_grab( gdkwin, FALSE, GDK_CURRENT_TIME ) == GDK_GRAB_SUCCESS;
13.102 + if( !success ) {
13.103 + gdk_pointer_ungrab(GDK_CURRENT_TIME);
13.104 + }
13.105 + }
13.106 + win->is_grabbed = success;
13.107 + main_window_set_running(win, dreamcast_is_running());
13.108 + return success;
13.109 +}
13.110 +
13.111 +/**
13.112 + * Release the display grab.
13.113 + */
13.114 +void video_window_ungrab_display( main_window_t win )
13.115 +{
13.116 + gdk_pointer_ungrab(GDK_CURRENT_TIME);
13.117 + gdk_keyboard_ungrab(GDK_CURRENT_TIME);
13.118 + win->is_grabbed = FALSE;
13.119 + main_window_set_running(win, dreamcast_is_running());
13.120 +}
13.121 +
13.122 +static gboolean on_video_window_mouse_motion( GtkWidget *widget, GdkEventMotion *event,
13.123 + gpointer user_data )
13.124 +{
13.125 + main_window_t win = (main_window_t)user_data;
13.126 + int32_t x = (int32_t)event->x;
13.127 + int32_t y = (int32_t)event->y;
13.128 + if( win->is_grabbed &&
13.129 + (x != win->mouse_x || y != win->mouse_y) ) {
13.130 + uint32_t buttons = (event->state >> 8)&0x1F;
13.131 + input_event_mouse( buttons, x - win->mouse_x, y - win->mouse_y );
13.132 + video_window_center_pointer(win);
13.133 + }
13.134 + return TRUE;
13.135 +}
13.136 +
13.137 +static gboolean on_video_window_mouse_pressed( GtkWidget *widget, GdkEventButton *event,
13.138 + gpointer user_data )
13.139 +{
13.140 + main_window_t win = (main_window_t)user_data;
13.141 + if( win->is_grabbed ) {
13.142 + // Get the buttons from the event state, and remove the released button
13.143 + uint32_t buttons = ((event->state >> 8) & 0x1F) | (1<<(event->button-1));
13.144 + input_event_mouse( buttons, 0, 0 );
13.145 + }
13.146 + return TRUE;
13.147 +}
13.148 +
13.149 +static gboolean on_video_window_mouse_released( GtkWidget *widget, GdkEventButton *event,
13.150 + gpointer user_data )
13.151 +{
13.152 + main_window_t win = (main_window_t)user_data;
13.153 + if( win->is_grabbed ) {
13.154 + // Get the buttons from the event state, and remove the released button
13.155 + uint32_t buttons = ((event->state >> 8) & 0x1F) & (~(1<<(event->button-1)));
13.156 + input_event_mouse( buttons, 0, 0 );
13.157 + } else if( win->use_grab) {
13.158 + video_window_grab_display(win);
13.159 + }
13.160 + return TRUE;
13.161 +}
13.162 +
13.163 +static gboolean on_video_window_key_pressed( GtkWidget *widget, GdkEventKey *event,
13.164 + gpointer user_data )
13.165 +{
13.166 + main_window_t win = (main_window_t)user_data;
13.167 + if( win->is_grabbed ) {
13.168 +#ifdef HAVE_GTK_OSX
13.169 + /* On OSX, use the command key rather than ctrl-alt. Mainly because GTK/OSX
13.170 + * doesn't seem to be able to get ctrl-alt reliably
13.171 + **/
13.172 + if( event->keyval == GDK_Meta_L || event->keyval == GDK_Meta_R ) {
13.173 + video_window_ungrab_display(win);
13.174 + return TRUE;
13.175 + }
13.176 +#else
13.177 + /* Check for ungrab key combo (ctrl-alt). Unfortunately GDK sends it as
13.178 + * a singly-modified keypress rather than a double-modified 'null' press,
13.179 + * so we have to do a little more work.
13.180 + * Only check Ctrl/Shift/Alt for state - don't want to check numlock/capslock/
13.181 + * mouse buttons/etc
13.182 + */
13.183 + int mod = gdk_keycode_to_modifier(gtk_widget_get_display(widget), event->hardware_keycode);
13.184 + int state = event->state & gtk_accelerator_get_default_mod_mask();
13.185 + if( (state == GDK_CONTROL_MASK && mod == GDK_MOD1_MASK) ||
13.186 + (state == GDK_MOD1_MASK && mod == GDK_CONTROL_MASK) ) {
13.187 + video_window_ungrab_display(win);
13.188 + // Consume the keypress, DC doesn't get it.
13.189 + return TRUE;
13.190 + }
13.191 +#endif
13.192 + }
13.193 + input_event_keydown( NULL, gtk_get_unmodified_keyval(event), 1 );
13.194 + return TRUE;
13.195 +}
13.196 +
13.197 +static gboolean on_video_window_key_released( GtkWidget *widget, GdkEventKey *event,
13.198 + gpointer user_data )
13.199 +{
13.200 + input_event_keyup( NULL, gtk_get_unmodified_keyval(event), 0 );
13.201 + return TRUE;
13.202 +}
13.203 +
13.204 +static gboolean on_video_window_focus_changed( GtkWidget *widget, GdkEventFocus *event,
13.205 + gpointer user_data )
13.206 +{
13.207 + display_set_focused(event->in);
13.208 + return TRUE;
13.209 +}
13.210 +
13.211 +/*************************** Main window (frame) ******************************/
13.212 +
13.213 +static gboolean on_main_window_deleted( GtkWidget *widget, GdkEvent event, gpointer user_data )
13.214 +{
13.215 + dreamcast_shutdown();
13.216 + exit(0);
13.217 +}
13.218 +
13.219 +static void on_main_window_state_changed( GtkWidget *widget, GdkEventWindowState *state,
13.220 + gpointer userdata )
13.221 +{
13.222 + main_window_t win = (main_window_t)userdata;
13.223 + if( state->changed_mask & GDK_WINDOW_STATE_FULLSCREEN ) {
13.224 + gboolean fs = (state->new_window_state & GDK_WINDOW_STATE_FULLSCREEN);
13.225 + GtkWidget *frame = gtk_widget_get_parent(win->video);
13.226 + if( frame->style == NULL ) {
13.227 + gtk_widget_set_style( frame, gtk_style_new() );
13.228 + }
13.229 + if( fs ) {
13.230 + gtk_widget_hide( win->menubar );
13.231 + gtk_widget_hide( win->toolbar );
13.232 + gtk_widget_hide( win->statusbar );
13.233 +
13.234 + frame->style->xthickness = 0;
13.235 + frame->style->ythickness = 0;
13.236 + } else {
13.237 + frame->style->xthickness = 2;
13.238 + frame->style->ythickness = 2;
13.239 + gtk_widget_show( win->menubar );
13.240 + gtk_widget_show( win->toolbar );
13.241 + gtk_widget_show( win->statusbar );
13.242 + }
13.243 + gtk_widget_queue_draw( win->window );
13.244 + }
13.245 +}
13.246 +
13.247 +main_window_t main_window_new( const gchar *title, GtkWidget *menubar, GtkWidget *toolbar,
13.248 + GtkAccelGroup *accel_group )
13.249 +{
13.250 + GtkWidget *vbox;
13.251 + GtkWidget *frame;
13.252 + main_window_t win = g_malloc0( sizeof(struct main_window_info) );
13.253 +
13.254 + win->window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
13.255 + win->menubar = menubar;
13.256 + win->toolbar = toolbar;
13.257 + win->use_grab = FALSE;
13.258 + win->is_grabbed = FALSE;
13.259 + gtk_window_set_title( GTK_WINDOW(win->window), title );
13.260 + gtk_window_add_accel_group (GTK_WINDOW (win->window), accel_group);
13.261 +
13.262 + gtk_toolbar_set_style( GTK_TOOLBAR(toolbar), GTK_TOOLBAR_ICONS );
13.263 +
13.264 + win->video = video_gtk_create_drawable();
13.265 + gtk_widget_set_size_request( win->video, 640, 480 );
13.266 + gtk_widget_set_double_buffered( win->video, FALSE );
13.267 + frame = gtk_frame_new(NULL);
13.268 + gtk_frame_set_shadow_type( GTK_FRAME(frame), GTK_SHADOW_IN );
13.269 + gtk_container_add( GTK_CONTAINER(frame), win->video );
13.270 +
13.271 + win->statusbar = gtk_statusbar_new();
13.272 +
13.273 + vbox = gtk_vbox_new(FALSE, 0);
13.274 + gtk_container_add( GTK_CONTAINER(win->window), vbox );
13.275 + gtk_box_pack_start( GTK_BOX(vbox), menubar, FALSE, FALSE, 0 );
13.276 + gtk_box_pack_start( GTK_BOX(vbox), toolbar, FALSE, FALSE, 0 );
13.277 + gtk_box_pack_start( GTK_BOX(vbox), frame, TRUE, TRUE, 0 );
13.278 + gtk_box_pack_start( GTK_BOX(vbox), win->statusbar, FALSE, FALSE, 0 );
13.279 + gtk_widget_show_all( win->window );
13.280 + gtk_widget_grab_focus( win->video );
13.281 +
13.282 + gtk_statusbar_push( GTK_STATUSBAR(win->statusbar), 1, "Stopped" );
13.283 +
13.284 + g_signal_connect( win->window, "delete_event",
13.285 + G_CALLBACK(on_main_window_deleted), win );
13.286 + g_signal_connect( win->window, "window-state-event",
13.287 + G_CALLBACK(on_main_window_state_changed), win );
13.288 +
13.289 + g_signal_connect( win->video, "key-press-event",
13.290 + G_CALLBACK(on_video_window_key_pressed), win );
13.291 + g_signal_connect( win->video, "key-release-event",
13.292 + G_CALLBACK(on_video_window_key_released), win );
13.293 + g_signal_connect( win->video, "motion-notify-event",
13.294 + G_CALLBACK(on_video_window_mouse_motion), win );
13.295 + g_signal_connect( win->video, "button-press-event",
13.296 + G_CALLBACK(on_video_window_mouse_pressed), win );
13.297 + g_signal_connect( win->video, "button-release-event",
13.298 + G_CALLBACK(on_video_window_mouse_released), win );
13.299 + g_signal_connect( win->video, "focus-in-event",
13.300 + G_CALLBACK(on_video_window_focus_changed), win);
13.301 + g_signal_connect( win->video, "focus-out-event",
13.302 + G_CALLBACK(on_video_window_focus_changed), win);
13.303 +
13.304 + gtk_widget_add_events( win->video,
13.305 + GDK_KEY_PRESS_MASK | GDK_KEY_RELEASE_MASK |
13.306 + GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK |
13.307 + GDK_POINTER_MOTION_MASK | GDK_FOCUS_CHANGE_MASK );
13.308 +
13.309 + return win;
13.310 +}
13.311 +
13.312 +void main_window_set_status_text( main_window_t win, char *text )
13.313 +{
13.314 + gtk_statusbar_pop( GTK_STATUSBAR(win->statusbar), 1 );
13.315 + if( win->is_grabbed ) {
13.316 + char buf[128];
13.317 +#ifdef HAVE_GTK_OSX
13.318 + snprintf( buf, sizeof(buf), "%s %s", text, _("(Press <command> to release grab)") );
13.319 +#else
13.320 + snprintf( buf, sizeof(buf), "%s %s", text, _("(Press <ctrl><alt> to release grab)") );
13.321 +#endif
13.322 + gtk_statusbar_push( GTK_STATUSBAR(win->statusbar), 1, buf );
13.323 + } else {
13.324 + gtk_statusbar_push( GTK_STATUSBAR(win->statusbar), 1, text );
13.325 + }
13.326 +}
13.327 +
13.328 +void main_window_set_running( main_window_t win, gboolean running )
13.329 +{
13.330 + char *text = running ? _("Running") : _("Stopped");
13.331 + gtk_gui_enable_action( "Pause", running );
13.332 + gtk_gui_enable_action( "Run", !running && dreamcast_can_run() );
13.333 + main_window_set_status_text( win, text );
13.334 +}
13.335 +
13.336 +void main_window_set_framerate( main_window_t win, float rate )
13.337 +{
13.338 +
13.339 +
13.340 +}
13.341 +
13.342 +void main_window_set_speed( main_window_t win, double speed )
13.343 +{
13.344 + char buf[32];
13.345 +
13.346 + snprintf( buf, 32, "Running (%2.4f%%)", speed );
13.347 + main_window_set_status_text( win, buf );
13.348 +}
13.349 +
13.350 +GtkWidget *main_window_get_renderarea( main_window_t win )
13.351 +{
13.352 + return win->video;
13.353 +}
13.354 +
13.355 +GtkWindow *main_window_get_frame( main_window_t win )
13.356 +{
13.357 + return GTK_WINDOW(win->window);
13.358 +}
13.359 +
13.360 +void main_window_set_fullscreen( main_window_t win, gboolean fullscreen )
13.361 +{
13.362 + if( fullscreen ) {
13.363 + gtk_window_fullscreen( GTK_WINDOW(win->window) );
13.364 + } else {
13.365 + gtk_window_unfullscreen( GTK_WINDOW(win->window) );
13.366 + }
13.367 +}
13.368 +
13.369 +void main_window_set_use_grab( main_window_t win, gboolean use_grab )
13.370 +{
13.371 + if( use_grab != win->use_grab ) {
13.372 + if( use_grab ) {
13.373 + GdkCursor *cursor = gdk_cursor_new( GDK_HAND2 );
13.374 + gdk_window_set_cursor( win->video->window, cursor );
13.375 + gdk_cursor_unref( cursor );
13.376 + } else {
13.377 + gdk_window_set_cursor( win->video->window, NULL );
13.378 + if( gdk_pointer_is_grabbed() ) {
13.379 + video_window_ungrab_display(win);
13.380 + }
13.381 + }
13.382 + win->use_grab = use_grab;
13.383 + }
13.384 +}
14.1 --- a/src/gtkui/main_win.c Mon Jul 21 12:21:20 2008 +0000
14.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
14.3 @@ -1,381 +0,0 @@
14.4 -/**
14.5 - * $Id$
14.6 - *
14.7 - * Define the main (emu) GTK window, along with its menubars,
14.8 - * toolbars, etc.
14.9 - *
14.10 - * Copyright (c) 2005 Nathan Keynes.
14.11 - *
14.12 - * This program is free software; you can redistribute it and/or modify
14.13 - * it under the terms of the GNU General Public License as published by
14.14 - * the Free Software Foundation; either version 2 of the License, or
14.15 - * (at your option) any later version.
14.16 - *
14.17 - * This program is distributed in the hope that it will be useful,
14.18 - * but WITHOUT ANY WARRANTY; without even the implied warranty of
14.19 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14.20 - * GNU General Public License for more details.
14.21 - */
14.22 -
14.23 -#include <assert.h>
14.24 -#include <sys/types.h>
14.25 -#include <sys/stat.h>
14.26 -#include <unistd.h>
14.27 -#include <string.h>
14.28 -#include <stdio.h>
14.29 -#include <stdlib.h>
14.30 -
14.31 -#include <gtk/gtk.h>
14.32 -#include <gdk/gdk.h>
14.33 -#include <gdk/gdkkeysyms.h>
14.34 -#include <X11/Xutil.h>
14.35 -
14.36 -#include "lxdream.h"
14.37 -#include "dreamcast.h"
14.38 -#include "display.h"
14.39 -#include "gtkui/gtkui.h"
14.40 -
14.41 -
14.42 -struct main_window_info {
14.43 - GtkWidget *window;
14.44 - GtkWidget *video;
14.45 - GtkWidget *menubar;
14.46 - GtkWidget *toolbar;
14.47 - GtkWidget *statusbar;
14.48 - GtkActionGroup *actions;
14.49 - gboolean use_grab;
14.50 - gboolean is_grabbed;
14.51 - int32_t mouse_x, mouse_y;
14.52 -};
14.53 -
14.54 -
14.55 -/******************** Video window **************************/
14.56 -
14.57 -/**
14.58 - * Adjust the mouse pointer so that it appears in the center of the video
14.59 - * window. Mainly used for when we have the mouse grab
14.60 - */
14.61 -void video_window_center_pointer( main_window_t win )
14.62 -{
14.63 - GdkDisplay *display = gtk_widget_get_display(win->video);
14.64 - GdkScreen *screen = gtk_widget_get_screen(win->video);
14.65 - int x,y;
14.66 - int width, height;
14.67 -
14.68 - gdk_window_get_origin(win->video->window, &x, &y);
14.69 - gdk_drawable_get_size(GDK_DRAWABLE(win->video->window), &width, &height);
14.70 - x += width / 2;
14.71 - y += height / 2;
14.72 -
14.73 - gdk_display_warp_pointer( display, screen, x, y );
14.74 - win->mouse_x = width/2;
14.75 - win->mouse_y = height/2;
14.76 -}
14.77 -
14.78 -/**
14.79 - * Grab the keyboard and mouse for the display. The mouse cursor is hidden and
14.80 - * moved to the centre of the window.
14.81 - *
14.82 - * @param win The window receiving the grab
14.83 - * @return TRUE if the grab was successful, FALSE on failure.
14.84 - */
14.85 -gboolean video_window_grab_display( main_window_t win )
14.86 -{
14.87 - GdkWindow *gdkwin = win->video->window;
14.88 - GdkColor color = { 0,0,0,0 };
14.89 - char bytes[32]; /* 16 * 16 / 8 */
14.90 - memset(bytes, 0, 32);
14.91 - GdkPixmap *pixmap = gdk_bitmap_create_from_data(NULL, bytes, 16, 16);
14.92 - GdkCursor *cursor = gdk_cursor_new_from_pixmap(pixmap, pixmap, &color, &color, 16, 16);
14.93 - gdk_pixmap_unref(pixmap);
14.94 -
14.95 - gboolean success =
14.96 - gdk_pointer_grab( gdkwin, FALSE,
14.97 - GDK_POINTER_MOTION_MASK|GDK_BUTTON_PRESS_MASK|GDK_BUTTON_RELEASE_MASK,
14.98 - gdkwin, cursor, GDK_CURRENT_TIME ) == GDK_GRAB_SUCCESS;
14.99 - gdk_cursor_unref(cursor);
14.100 - if( success ) {
14.101 - success = gdk_keyboard_grab( gdkwin, FALSE, GDK_CURRENT_TIME ) == GDK_GRAB_SUCCESS;
14.102 - if( !success ) {
14.103 - gdk_pointer_ungrab(GDK_CURRENT_TIME);
14.104 - }
14.105 - }
14.106 - win->is_grabbed = success;
14.107 - main_window_set_running(win, dreamcast_is_running());
14.108 - return success;
14.109 -}
14.110 -
14.111 -/**
14.112 - * Release the display grab.
14.113 - */
14.114 -void video_window_ungrab_display( main_window_t win )
14.115 -{
14.116 - gdk_pointer_ungrab(GDK_CURRENT_TIME);
14.117 - gdk_keyboard_ungrab(GDK_CURRENT_TIME);
14.118 - win->is_grabbed = FALSE;
14.119 - main_window_set_running(win, dreamcast_is_running());
14.120 -}
14.121 -
14.122 -static gboolean on_video_window_mouse_motion( GtkWidget *widget, GdkEventMotion *event,
14.123 - gpointer user_data )
14.124 -{
14.125 - main_window_t win = (main_window_t)user_data;
14.126 - int32_t x = (int32_t)event->x;
14.127 - int32_t y = (int32_t)event->y;
14.128 - if( win->is_grabbed &&
14.129 - (x != win->mouse_x || y != win->mouse_y) ) {
14.130 - uint32_t buttons = (event->state >> 8)&0x1F;
14.131 - input_event_mouse( buttons, x - win->mouse_x, y - win->mouse_y );
14.132 - video_window_center_pointer(win);
14.133 - }
14.134 - return TRUE;
14.135 -}
14.136 -
14.137 -static gboolean on_video_window_mouse_pressed( GtkWidget *widget, GdkEventButton *event,
14.138 - gpointer user_data )
14.139 -{
14.140 - main_window_t win = (main_window_t)user_data;
14.141 - if( win->is_grabbed ) {
14.142 - // Get the buttons from the event state, and remove the released button
14.143 - uint32_t buttons = ((event->state >> 8) & 0x1F) | (1<<(event->button-1));
14.144 - input_event_mouse( buttons, 0, 0 );
14.145 - }
14.146 - return TRUE;
14.147 -}
14.148 -
14.149 -static gboolean on_video_window_mouse_released( GtkWidget *widget, GdkEventButton *event,
14.150 - gpointer user_data )
14.151 -{
14.152 - main_window_t win = (main_window_t)user_data;
14.153 - if( win->is_grabbed ) {
14.154 - // Get the buttons from the event state, and remove the released button
14.155 - uint32_t buttons = ((event->state >> 8) & 0x1F) & (~(1<<(event->button-1)));
14.156 - input_event_mouse( buttons, 0, 0 );
14.157 - } else if( win->use_grab) {
14.158 - video_window_grab_display(win);
14.159 - }
14.160 - return TRUE;
14.161 -}
14.162 -
14.163 -static gboolean on_video_window_key_pressed( GtkWidget *widget, GdkEventKey *event,
14.164 - gpointer user_data )
14.165 -{
14.166 - main_window_t win = (main_window_t)user_data;
14.167 - if( win->is_grabbed ) {
14.168 -#ifdef HAVE_GTK_OSX
14.169 - /* On OSX, use the command key rather than ctrl-alt. Mainly because GTK/OSX
14.170 - * doesn't seem to be able to get ctrl-alt reliably
14.171 - **/
14.172 - if( event->keyval == GDK_Meta_L || event->keyval == GDK_Meta_R ) {
14.173 - video_window_ungrab_display(win);
14.174 - return TRUE;
14.175 - }
14.176 -#else
14.177 - /* Check for ungrab key combo (ctrl-alt). Unfortunately GDK sends it as
14.178 - * a singly-modified keypress rather than a double-modified 'null' press,
14.179 - * so we have to do a little more work.
14.180 - * Only check Ctrl/Shift/Alt for state - don't want to check numlock/capslock/
14.181 - * mouse buttons/etc
14.182 - */
14.183 - int mod = gdk_keycode_to_modifier(gtk_widget_get_display(widget), event->hardware_keycode);
14.184 - int state = event->state & gtk_accelerator_get_default_mod_mask();
14.185 - if( (state == GDK_CONTROL_MASK && mod == GDK_MOD1_MASK) ||
14.186 - (state == GDK_MOD1_MASK && mod == GDK_CONTROL_MASK) ) {
14.187 - video_window_ungrab_display(win);
14.188 - // Consume the keypress, DC doesn't get it.
14.189 - return TRUE;
14.190 - }
14.191 -#endif
14.192 - }
14.193 - input_event_keydown( NULL, gtk_get_unmodified_keyval(event), 1 );
14.194 - return TRUE;
14.195 -}
14.196 -
14.197 -static gboolean on_video_window_key_released( GtkWidget *widget, GdkEventKey *event,
14.198 - gpointer user_data )
14.199 -{
14.200 - input_event_keyup( NULL, gtk_get_unmodified_keyval(event), 0 );
14.201 - return TRUE;
14.202 -}
14.203 -
14.204 -static gboolean on_video_window_focus_changed( GtkWidget *widget, GdkEventFocus *event,
14.205 - gpointer user_data )
14.206 -{
14.207 - display_set_focused(event->in);
14.208 - return TRUE;
14.209 -}
14.210 -
14.211 -/*************************** Main window (frame) ******************************/
14.212 -
14.213 -static gboolean on_main_window_deleted( GtkWidget *widget, GdkEvent event, gpointer user_data )
14.214 -{
14.215 - dreamcast_shutdown();
14.216 - exit(0);
14.217 -}
14.218 -
14.219 -static void on_main_window_state_changed( GtkWidget *widget, GdkEventWindowState *state,
14.220 - gpointer userdata )
14.221 -{
14.222 - main_window_t win = (main_window_t)userdata;
14.223 - if( state->changed_mask & GDK_WINDOW_STATE_FULLSCREEN ) {
14.224 - gboolean fs = (state->new_window_state & GDK_WINDOW_STATE_FULLSCREEN);
14.225 - GtkWidget *frame = gtk_widget_get_parent(win->video);
14.226 - if( frame->style == NULL ) {
14.227 - gtk_widget_set_style( frame, gtk_style_new() );
14.228 - }
14.229 - if( fs ) {
14.230 - gtk_widget_hide( win->menubar );
14.231 - gtk_widget_hide( win->toolbar );
14.232 - gtk_widget_hide( win->statusbar );
14.233 -
14.234 - frame->style->xthickness = 0;
14.235 - frame->style->ythickness = 0;
14.236 - } else {
14.237 - frame->style->xthickness = 2;
14.238 - frame->style->ythickness = 2;
14.239 - gtk_widget_show( win->menubar );
14.240 - gtk_widget_show( win->toolbar );
14.241 - gtk_widget_show( win->statusbar );
14.242 - }
14.243 - gtk_widget_queue_draw( win->window );
14.244 - }
14.245 -}
14.246 -
14.247 -main_window_t main_window_new( const gchar *title, GtkWidget *menubar, GtkWidget *toolbar,
14.248 - GtkAccelGroup *accel_group )
14.249 -{
14.250 - GtkWidget *vbox;
14.251 - GtkWidget *frame;
14.252 - main_window_t win = g_malloc0( sizeof(struct main_window_info) );
14.253 -
14.254 - win->window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
14.255 - win->menubar = menubar;
14.256 - win->toolbar = toolbar;
14.257 - win->use_grab = FALSE;
14.258 - win->is_grabbed = FALSE;
14.259 - gtk_window_set_title( GTK_WINDOW(win->window), title );
14.260 - gtk_window_add_accel_group (GTK_WINDOW (win->window), accel_group);
14.261 -
14.262 - gtk_toolbar_set_style( GTK_TOOLBAR(toolbar), GTK_TOOLBAR_ICONS );
14.263 -
14.264 - win->video = video_gtk_create_drawable();
14.265 - gtk_widget_set_size_request( win->video, 640, 480 );
14.266 - gtk_widget_set_double_buffered( win->video, FALSE );
14.267 - frame = gtk_frame_new(NULL);
14.268 - gtk_frame_set_shadow_type( GTK_FRAME(frame), GTK_SHADOW_IN );
14.269 - gtk_container_add( GTK_CONTAINER(frame), win->video );
14.270 -
14.271 - win->statusbar = gtk_statusbar_new();
14.272 -
14.273 - vbox = gtk_vbox_new(FALSE, 0);
14.274 - gtk_container_add( GTK_CONTAINER(win->window), vbox );
14.275 - gtk_box_pack_start( GTK_BOX(vbox), menubar, FALSE, FALSE, 0 );
14.276 - gtk_box_pack_start( GTK_BOX(vbox), toolbar, FALSE, FALSE, 0 );
14.277 - gtk_box_pack_start( GTK_BOX(vbox), frame, TRUE, TRUE, 0 );
14.278 - gtk_box_pack_start( GTK_BOX(vbox), win->statusbar, FALSE, FALSE, 0 );
14.279 - gtk_widget_show_all( win->window );
14.280 - gtk_widget_grab_focus( win->video );
14.281 -
14.282 - gtk_statusbar_push( GTK_STATUSBAR(win->statusbar), 1, "Stopped" );
14.283 -
14.284 - g_signal_connect( win->window, "delete_event",
14.285 - G_CALLBACK(on_main_window_deleted), win );
14.286 - g_signal_connect( win->window, "window-state-event",
14.287 - G_CALLBACK(on_main_window_state_changed), win );
14.288 -
14.289 - g_signal_connect( win->video, "key-press-event",
14.290 - G_CALLBACK(on_video_window_key_pressed), win );
14.291 - g_signal_connect( win->video, "key-release-event",
14.292 - G_CALLBACK(on_video_window_key_released), win );
14.293 - g_signal_connect( win->video, "motion-notify-event",
14.294 - G_CALLBACK(on_video_window_mouse_motion), win );
14.295 - g_signal_connect( win->video, "button-press-event",
14.296 - G_CALLBACK(on_video_window_mouse_pressed), win );
14.297 - g_signal_connect( win->video, "button-release-event",
14.298 - G_CALLBACK(on_video_window_mouse_released), win );
14.299 - g_signal_connect( win->video, "focus-in-event",
14.300 - G_CALLBACK(on_video_window_focus_changed), win);
14.301 - g_signal_connect( win->video, "focus-out-event",
14.302 - G_CALLBACK(on_video_window_focus_changed), win);
14.303 -
14.304 - gtk_widget_add_events( win->video,
14.305 - GDK_KEY_PRESS_MASK | GDK_KEY_RELEASE_MASK |
14.306 - GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK |
14.307 - GDK_POINTER_MOTION_MASK | GDK_FOCUS_CHANGE_MASK );
14.308 -
14.309 - return win;
14.310 -}
14.311 -
14.312 -void main_window_set_status_text( main_window_t win, char *text )
14.313 -{
14.314 - gtk_statusbar_pop( GTK_STATUSBAR(win->statusbar), 1 );
14.315 - if( win->is_grabbed ) {
14.316 - char buf[128];
14.317 -#ifdef HAVE_GTK_OSX
14.318 - snprintf( buf, sizeof(buf), "%s %s", text, _("(Press <command> to release grab)") );
14.319 -#else
14.320 - snprintf( buf, sizeof(buf), "%s %s", text, _("(Press <ctrl><alt> to release grab)") );
14.321 -#endif
14.322 - gtk_statusbar_push( GTK_STATUSBAR(win->statusbar), 1, buf );
14.323 - } else {
14.324 - gtk_statusbar_push( GTK_STATUSBAR(win->statusbar), 1, text );
14.325 - }
14.326 -}
14.327 -
14.328 -void main_window_set_running( main_window_t win, gboolean running )
14.329 -{
14.330 - char *text = running ? _("Running") : _("Stopped");
14.331 - gtk_gui_enable_action( "Pause", running );
14.332 - gtk_gui_enable_action( "Run", !running && dreamcast_can_run() );
14.333 - main_window_set_status_text( win, text );
14.334 -}
14.335 -
14.336 -void main_window_set_framerate( main_window_t win, float rate )
14.337 -{
14.338 -
14.339 -
14.340 -}
14.341 -
14.342 -void main_window_set_speed( main_window_t win, double speed )
14.343 -{
14.344 - char buf[32];
14.345 -
14.346 - snprintf( buf, 32, "Running (%2.4f%%)", speed );
14.347 - main_window_set_status_text( win, buf );
14.348 -}
14.349 -
14.350 -GtkWidget *main_window_get_renderarea( main_window_t win )
14.351 -{
14.352 - return win->video;
14.353 -}
14.354 -
14.355 -GtkWindow *main_window_get_frame( main_window_t win )
14.356 -{
14.357 - return GTK_WINDOW(win->window);
14.358 -}
14.359 -
14.360 -void main_window_set_fullscreen( main_window_t win, gboolean fullscreen )
14.361 -{
14.362 - if( fullscreen ) {
14.363 - gtk_window_fullscreen( GTK_WINDOW(win->window) );
14.364 - } else {
14.365 - gtk_window_unfullscreen( GTK_WINDOW(win->window) );
14.366 - }
14.367 -}
14.368 -
14.369 -void main_window_set_use_grab( main_window_t win, gboolean use_grab )
14.370 -{
14.371 - if( use_grab != win->use_grab ) {
14.372 - if( use_grab ) {
14.373 - GdkCursor *cursor = gdk_cursor_new( GDK_HAND2 );
14.374 - gdk_window_set_cursor( win->video->window, cursor );
14.375 - gdk_cursor_unref( cursor );
14.376 - } else {
14.377 - gdk_window_set_cursor( win->video->window, NULL );
14.378 - if( gdk_pointer_is_grabbed() ) {
14.379 - video_window_ungrab_display(win);
14.380 - }
14.381 - }
14.382 - win->use_grab = use_grab;
14.383 - }
14.384 -}
15.1 --- a/src/gtkui/mmio_win.c Mon Jul 21 12:21:20 2008 +0000
15.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
15.3 @@ -1,244 +0,0 @@
15.4 -/**
15.5 - * $Id$
15.6 - *
15.7 - * Implements the MMIO register viewing window
15.8 - *
15.9 - * Copyright (c) 2005 Nathan Keynes.
15.10 - *
15.11 - * This program is free software; you can redistribute it and/or modify
15.12 - * it under the terms of the GNU General Public License as published by
15.13 - * the Free Software Foundation; either version 2 of the License, or
15.14 - * (at your option) any later version.
15.15 - *
15.16 - * This program is distributed in the hope that it will be useful,
15.17 - * but WITHOUT ANY WARRANTY; without even the implied warranty of
15.18 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15.19 - * GNU General Public License for more details.
15.20 - */
15.21 -
15.22 -#include <stdint.h>
15.23 -#include <string.h>
15.24 -#include "gtkui/gtkui.h"
15.25 -#include "mem.h"
15.26 -#include "mmio.h"
15.27 -
15.28 -
15.29 -struct mmio_window_info {
15.30 - GtkWidget *window;
15.31 - GtkWidget *notebook;
15.32 -};
15.33 -
15.34 -static void printbits( char *out, int nbits, uint32_t value )
15.35 -{
15.36 - if( nbits < 32 ) {
15.37 - int i;
15.38 - for( i=32; i>nbits; i-- ) {
15.39 - if( !(i % 8) ) *out++ = ' ';
15.40 - *out++ = ' ';
15.41 - }
15.42 - }
15.43 - while( nbits > 0 ) {
15.44 - *out++ = (value&(1<<--nbits) ? '1' : '0');
15.45 - if( !(nbits % 8) ) *out++ = ' ';
15.46 - }
15.47 - *out = '\0';
15.48 -}
15.49 -
15.50 -static void printhex( char *out, int nbits, uint32_t value )
15.51 -{
15.52 - char tmp[10], *p = tmp;
15.53 - int i;
15.54 -
15.55 - sprintf( tmp, "%08X", value );
15.56 - for( i=32; i>0; i-=4, p++ ) {
15.57 - if( i <= nbits ) *out++ = *p;
15.58 - else *out++ = ' ';
15.59 - }
15.60 - *out = '\0';
15.61 -}
15.62 -
15.63 -
15.64 -
15.65 -
15.66 -gboolean
15.67 -on_mmio_delete_event (GtkWidget *widget,
15.68 - GdkEvent *event,
15.69 - gpointer user_data)
15.70 -{
15.71 - gtk_widget_hide(widget);
15.72 - return TRUE;
15.73 -}
15.74 -
15.75 -
15.76 -void on_mmio_close_clicked( GtkButton *button, gpointer user_data)
15.77 -{
15.78 - gtk_widget_hide( ((mmio_window_t)user_data)->window );
15.79 -}
15.80 -
15.81 -
15.82 -void on_trace_button_toggled (GtkToggleButton *button,
15.83 - gpointer user_data)
15.84 -{
15.85 - struct mmio_region *io_rgn = (struct mmio_region *)user_data;
15.86 - gboolean isActive = gtk_toggle_button_get_active(button);
15.87 - if( io_rgn != NULL ) {
15.88 - io_rgn->trace_flag = isActive ? 1 : 0;
15.89 - }
15.90 -}
15.91 -
15.92 -static GtkCList *mmio_window_add_page( mmio_window_t mmio, char *name, struct mmio_region *io_rgn )
15.93 -{
15.94 - GtkCList *list;
15.95 - GtkWidget *scroll;
15.96 - GtkWidget *tab;
15.97 - GtkCheckButton *trace_button;
15.98 - GtkVBox *vbox;
15.99 -
15.100 - scroll = gtk_scrolled_window_new(NULL, NULL);
15.101 - gtk_scrolled_window_set_policy( GTK_SCROLLED_WINDOW(scroll),
15.102 - GTK_POLICY_AUTOMATIC, GTK_POLICY_ALWAYS );
15.103 - list = GTK_CLIST(gtk_clist_new(5));
15.104 - gtk_clist_set_column_width(list, 0, 70);
15.105 - gtk_clist_set_column_width(list, 1, 75);
15.106 - gtk_clist_set_column_width(list, 2, 70);
15.107 - gtk_clist_set_column_width(list, 3, 280);
15.108 - gtk_clist_set_column_width(list, 4, 160);
15.109 - gtk_clist_set_column_justification(list, 0, GTK_JUSTIFY_CENTER );
15.110 - gtk_clist_set_column_justification(list, 2, GTK_JUSTIFY_CENTER );
15.111 - gtk_clist_set_column_justification(list, 3, GTK_JUSTIFY_CENTER );
15.112 - gtk_clist_set_column_title(list, 0, _("Address"));
15.113 - gtk_clist_set_column_title(list, 1, _("Register"));
15.114 - gtk_clist_set_column_title(list, 2, _("Value"));
15.115 - gtk_clist_set_column_title(list, 3, _("Bit Pattern"));
15.116 - gtk_clist_set_column_title(list, 4, _("Description"));
15.117 - gtk_clist_column_titles_show(list);
15.118 - gtk_widget_modify_font( GTK_WIDGET(list), gui_fixed_font );
15.119 - tab = gtk_label_new(_(name));
15.120 - gtk_container_add( GTK_CONTAINER(scroll), GTK_WIDGET(list) );
15.121 -
15.122 - vbox = GTK_VBOX(gtk_vbox_new( FALSE, 0 ));
15.123 - gtk_container_add( GTK_CONTAINER(vbox), GTK_WIDGET(scroll) );
15.124 -
15.125 - trace_button = GTK_CHECK_BUTTON(gtk_check_button_new_with_label(_("Trace access")));
15.126 - if( io_rgn != NULL ) {
15.127 - gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(trace_button),
15.128 - io_rgn->trace_flag ? TRUE : FALSE);
15.129 - }
15.130 - gtk_container_add( GTK_CONTAINER(vbox), GTK_WIDGET(trace_button) );
15.131 - gtk_box_set_child_packing( GTK_BOX(vbox), GTK_WIDGET(trace_button),
15.132 - FALSE, FALSE, 0, GTK_PACK_START );
15.133 - gtk_notebook_append_page( GTK_NOTEBOOK(mmio->notebook), GTK_WIDGET(vbox), tab );
15.134 - gtk_object_set_data( GTK_OBJECT(mmio->window), name, list );
15.135 - g_signal_connect ((gpointer) trace_button, "toggled",
15.136 - G_CALLBACK (on_trace_button_toggled),
15.137 - io_rgn);
15.138 - return list;
15.139 -}
15.140 -
15.141 -
15.142 -
15.143 -mmio_window_t mmio_window_new( const gchar *title )
15.144 -{
15.145 - mmio_window_t mmio = g_malloc0( sizeof(struct mmio_window_info) );
15.146 -
15.147 - int i, j;
15.148 - GtkCList *all_list;
15.149 - GtkWidget *vbox1;
15.150 - GtkWidget *hbuttonbox1;
15.151 - GtkWidget *mmr_close;
15.152 -
15.153 - mmio->window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
15.154 - gtk_window_set_title (GTK_WINDOW (mmio->window), title);
15.155 - gtk_window_set_default_size (GTK_WINDOW (mmio->window), 600, 600);
15.156 -
15.157 - vbox1 = gtk_vbox_new (FALSE, 0);
15.158 - gtk_container_add (GTK_CONTAINER (mmio->window), vbox1);
15.159 -
15.160 - mmio->notebook = gtk_notebook_new ();
15.161 - gtk_box_pack_start (GTK_BOX (vbox1), mmio->notebook, TRUE, TRUE, 0);
15.162 - gtk_notebook_set_tab_pos (GTK_NOTEBOOK (mmio->notebook), GTK_POS_LEFT);
15.163 -
15.164 - hbuttonbox1 = gtk_hbutton_box_new ();
15.165 - gtk_box_pack_start (GTK_BOX (vbox1), hbuttonbox1, FALSE, TRUE, 0);
15.166 - gtk_box_set_spacing (GTK_BOX (hbuttonbox1), 30);
15.167 -
15.168 - mmr_close = gtk_button_new_with_mnemonic (_("Close"));
15.169 - gtk_container_add (GTK_CONTAINER (hbuttonbox1), mmr_close);
15.170 - GTK_WIDGET_SET_FLAGS (mmr_close, GTK_CAN_DEFAULT);
15.171 -
15.172 - /* Add the mmio register data */
15.173 - all_list = mmio_window_add_page( mmio, "All", NULL );
15.174 - for( i=0; i < num_io_rgns; i++ ) {
15.175 - GtkCList *list = mmio_window_add_page( mmio, io_rgn[i]->id, io_rgn[i] );
15.176 - for( j=0; io_rgn[i]->ports[j].id != NULL; j++ ) {
15.177 - int sz = io_rgn[i]->ports[j].width;
15.178 - char addr[10], data[10], bits[40];
15.179 - char *arr[] = { addr, io_rgn[i]->ports[j].id, data, bits,
15.180 - io_rgn[i]->ports[j].desc };
15.181 - sprintf( addr, "%08X",
15.182 - io_rgn[i]->base + io_rgn[i]->ports[j].offset );
15.183 - printhex( data, sz, *io_rgn[i]->ports[j].val );
15.184 - printbits( bits, io_rgn[i]->ports[j].width,
15.185 - *io_rgn[i]->ports[j].val );
15.186 - gtk_clist_append( list, arr );
15.187 - gtk_clist_append( all_list, arr );
15.188 - }
15.189 - }
15.190 -
15.191 - g_signal_connect ((gpointer) mmio->window, "delete_event",
15.192 - G_CALLBACK (on_mmio_delete_event),
15.193 - NULL);
15.194 - g_signal_connect ((gpointer) mmr_close, "clicked",
15.195 - G_CALLBACK (on_mmio_close_clicked),
15.196 - mmio);
15.197 -
15.198 - gtk_widget_show_all( mmio->window );
15.199 - return mmio;
15.200 -}
15.201 -
15.202 -void mmio_window_update( mmio_window_t mmio )
15.203 -{
15.204 - int i,j, count = 0;
15.205 - GtkCList *page, *all_page;
15.206 - char data[10], bits[40];
15.207 -
15.208 - all_page = GTK_CLIST(gtk_object_get_data( GTK_OBJECT(mmio->window), "All" ));
15.209 -
15.210 - for( i=0; i < num_io_rgns; i++ ) {
15.211 - page = GTK_CLIST(gtk_object_get_data( GTK_OBJECT(mmio->window),
15.212 - io_rgn[i]->id ));
15.213 - for( j=0; io_rgn[i]->ports[j].id != NULL; j++ ) {
15.214 - if( *io_rgn[i]->ports[j].val !=
15.215 - *(uint32_t *)(io_rgn[i]->save_mem+io_rgn[i]->ports[j].offset)){
15.216 - int sz = io_rgn[i]->ports[j].width;
15.217 - /* Changed */
15.218 - printhex( data, sz, *io_rgn[i]->ports[j].val );
15.219 - printbits( bits, sz, *io_rgn[i]->ports[j].val );
15.220 -
15.221 - gtk_clist_set_text( page, j, 2, data );
15.222 - gtk_clist_set_text( page, j, 3, bits );
15.223 - gtk_clist_set_foreground( page, j, &gui_colour_changed );
15.224 -
15.225 - gtk_clist_set_text( all_page, count, 2, data );
15.226 - gtk_clist_set_text( all_page, count, 3, bits );
15.227 - gtk_clist_set_foreground( all_page, count, &gui_colour_changed );
15.228 -
15.229 - } else {
15.230 - gtk_clist_set_foreground( page, j, &gui_colour_normal );
15.231 - gtk_clist_set_foreground( all_page, count, &gui_colour_normal );
15.232 - }
15.233 - count++;
15.234 - }
15.235 - memcpy( io_rgn[i]->save_mem, io_rgn[i]->mem, PAGE_SIZE );
15.236 - }
15.237 -}
15.238 -
15.239 -void mmio_window_show( mmio_window_t mmio, gboolean show )
15.240 -{
15.241 - if( show ) {
15.242 - gtk_widget_show( mmio->window );
15.243 - } else {
15.244 - gtk_widget_hide( mmio->window );
15.245 - }
15.246 -}
15.247 -
16.1 --- a/src/gtkui/path_dlg.c Mon Jul 21 12:21:20 2008 +0000
16.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
16.3 @@ -1,129 +0,0 @@
16.4 -/**
16.5 - * $Id$
16.6 - *
16.7 - * Define the main (emu) GTK window, along with its menubars,
16.8 - * toolbars, etc.
16.9 - *
16.10 - * Copyright (c) 2005 Nathan Keynes.
16.11 - *
16.12 - * This program is free software; you can redistribute it and/or modify
16.13 - * it under the terms of the GNU General Public License as published by
16.14 - * the Free Software Foundation; either version 2 of the License, or
16.15 - * (at your option) any later version.
16.16 - *
16.17 - * This program is distributed in the hope that it will be useful,
16.18 - * but WITHOUT ANY WARRANTY; without even the implied warranty of
16.19 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16.20 - * GNU General Public License for more details.
16.21 - */
16.22 -
16.23 -#include <assert.h>
16.24 -#include <gtk/gtk.h>
16.25 -
16.26 -#include "lxdream.h"
16.27 -#include "dreamcast.h"
16.28 -#include "config.h"
16.29 -#include "gtkui/gtkui.h"
16.30 -
16.31 -static const gchar *path_label[] = { N_("Bios rom"), N_("Flash rom"), N_("Default disc path"),
16.32 - N_("Save state path"), N_("Bootstrap IP.BIN") };
16.33 -static const int path_id[] = { CONFIG_BIOS_PATH, CONFIG_FLASH_PATH, CONFIG_DEFAULT_PATH,
16.34 - CONFIG_SAVE_PATH, CONFIG_BOOTSTRAP };
16.35 -static GtkFileChooserAction path_action[] = {
16.36 - GTK_FILE_CHOOSER_ACTION_OPEN,
16.37 - GTK_FILE_CHOOSER_ACTION_OPEN,
16.38 - GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER,
16.39 - GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER,
16.40 - GTK_FILE_CHOOSER_ACTION_OPEN };
16.41 -
16.42 -static GtkWidget *path_entry[5];
16.43 -
16.44 -static gboolean path_file_button_clicked( GtkWidget *button, gpointer user_data )
16.45 -{
16.46 - GtkWidget *entry = GTK_WIDGET(user_data);
16.47 - GtkWidget *file = gtk_file_chooser_dialog_new( _("Select file"), NULL,
16.48 - GTK_FILE_CHOOSER_ACTION_OPEN,
16.49 - GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
16.50 - GTK_STOCK_OPEN, GTK_RESPONSE_ACCEPT,
16.51 - NULL );
16.52 - const gchar *filename = gtk_entry_get_text(GTK_ENTRY(entry));
16.53 - gtk_file_chooser_set_filename( GTK_FILE_CHOOSER(file), filename );
16.54 - gtk_window_set_modal( GTK_WINDOW(file), TRUE );
16.55 - gtk_widget_show_all( file );
16.56 - gint result = gtk_dialog_run(GTK_DIALOG(file));
16.57 - if( result == GTK_RESPONSE_ACCEPT ) {
16.58 - filename = gtk_file_chooser_get_filename( GTK_FILE_CHOOSER(file) );
16.59 - gtk_entry_set_text(GTK_ENTRY(entry), filename);
16.60 - }
16.61 - gtk_widget_destroy(file);
16.62 - return TRUE;
16.63 -}
16.64 -
16.65 -static gboolean path_dir_button_clicked( GtkWidget *button, gpointer user_data )
16.66 -{
16.67 - GtkWidget *entry = GTK_WIDGET(user_data);
16.68 - GtkWidget *file = gtk_file_chooser_dialog_new( _("Select file"), NULL,
16.69 - GTK_FILE_CHOOSER_ACTION_OPEN,
16.70 - GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
16.71 - GTK_STOCK_OPEN, GTK_RESPONSE_ACCEPT,
16.72 - NULL );
16.73 - const gchar *filename = gtk_entry_get_text(GTK_ENTRY(entry));
16.74 - gtk_file_chooser_set_action( GTK_FILE_CHOOSER(file), GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER );
16.75 - gtk_file_chooser_set_filename( GTK_FILE_CHOOSER(file), filename );
16.76 - gtk_window_set_modal( GTK_WINDOW(file), TRUE );
16.77 - gtk_widget_show_all( file );
16.78 - gint result = gtk_dialog_run(GTK_DIALOG(file));
16.79 - if( result == GTK_RESPONSE_ACCEPT ) {
16.80 - filename = gtk_file_chooser_get_filename( GTK_FILE_CHOOSER(file) );
16.81 - gtk_entry_set_text(GTK_ENTRY(entry), filename);
16.82 - }
16.83 - gtk_widget_destroy(file);
16.84 - return TRUE;
16.85 -}
16.86 -
16.87 -GtkWidget *path_panel_new(void)
16.88 -{
16.89 - GtkWidget *table = gtk_table_new( 5, 3, FALSE );
16.90 - int i;
16.91 - for( i=0; i<5; i++ ) {
16.92 - GtkWidget *text = path_entry[i] = gtk_entry_new();
16.93 - GtkWidget *button = gtk_button_new();
16.94 - gtk_table_attach( GTK_TABLE(table), gtk_label_new(Q_(path_label[i])), 0, 1, i, i+1,
16.95 - GTK_SHRINK, GTK_SHRINK, 0, 0);
16.96 - gtk_entry_set_text( GTK_ENTRY(text), lxdream_get_config_value(path_id[i]) );
16.97 - gtk_entry_set_width_chars( GTK_ENTRY(text), 48 );
16.98 - gtk_table_attach_defaults( GTK_TABLE(table), text, 1, 2, i, i+1 );
16.99 - gtk_table_attach( GTK_TABLE(table), button, 2, 3, i, i+1, GTK_SHRINK, GTK_SHRINK, 0, 0 );
16.100 - if( path_action[i] == GTK_FILE_CHOOSER_ACTION_OPEN ) {
16.101 - GtkWidget *image = gtk_image_new_from_stock(GTK_STOCK_OPEN, GTK_ICON_SIZE_BUTTON);
16.102 - gtk_button_set_image( GTK_BUTTON(button), image );
16.103 - g_signal_connect( button, "clicked", G_CALLBACK(path_file_button_clicked), text );
16.104 - } else {
16.105 - GtkWidget *image = gtk_image_new_from_stock(GTK_STOCK_OPEN, GTK_ICON_SIZE_BUTTON);
16.106 - gtk_button_set_image( GTK_BUTTON(button), image );
16.107 - g_signal_connect( button, "clicked", G_CALLBACK(path_dir_button_clicked), text );
16.108 - }
16.109 - }
16.110 - return table;
16.111 -
16.112 -}
16.113 -
16.114 -void path_panel_done( GtkWidget *panel, gboolean isOK )
16.115 -{
16.116 - if( isOK ) {
16.117 - int i;
16.118 - for(i=0; i<5; i++ ) {
16.119 - const char *filename = gtk_entry_get_text( GTK_ENTRY(path_entry[i]) );
16.120 - lxdream_set_global_config_value( path_id[i], filename );
16.121 - }
16.122 -
16.123 - lxdream_save_config();
16.124 - dreamcast_config_changed();
16.125 - gtk_gui_update();
16.126 - }
16.127 -}
16.128 -
16.129 -void path_dialog_run( void )
16.130 -{
16.131 - gtk_gui_run_property_dialog( _("Path Settings"), path_panel_new(), path_panel_done );
16.132 -}
.