diff --git a/bochs/gui/bitmaps/saverestore.h b/bochs/gui/bitmaps/saverestore.h new file mode 100755 index 000000000..3cbcfdc58 --- /dev/null +++ b/bochs/gui/bitmaps/saverestore.h @@ -0,0 +1,26 @@ +///////////////////////////////////////////////////////////////////////// +// $$ +///////////////////////////////////////////////////////////////////////// + +#define BX_SAVE_RESTORE_BMAP_X 32 +#define BX_SAVE_RESTORE_BMAP_Y 32 + +static const unsigned char bx_save_restore_bmap[(BX_SAVE_RESTORE_BMAP_X * BX_SAVE_RESTORE_BMAP_Y)/8] = +{ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x2e, 0xdd, 0x9d, 0x3b, + 0x22, 0x45, 0x45, 0x4a, 0x2c, 0xd9, 0x5d, 0x4a, + 0x28, 0x51, 0x44, 0x4a, 0xee, 0x5d, 0x5c, 0x3a, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0xe0, 0x01, 0x00, 0x00, 0xe0, 0x01, 0x00, + 0x00, 0xe0, 0x01, 0x00, 0x00, 0xe0, 0x01, 0x00, + 0x00, 0xec, 0x0d, 0x00, 0x00, 0xee, 0x1d, 0x00, + 0x00, 0xef, 0x3d, 0x00, 0x00, 0xe7, 0x39, 0x00, + 0x00, 0xe7, 0x39, 0x00, 0x00, 0x07, 0x38, 0x00, + 0x00, 0x07, 0x38, 0x00, 0x00, 0x07, 0x38, 0x00, + 0x00, 0x07, 0x38, 0x00, 0x00, 0x07, 0x38, 0x00, + 0x00, 0xff, 0x3f, 0x00, 0x00, 0xfe, 0x1f, 0x00, + 0x00, 0xfc, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 +}; diff --git a/bochs/gui/bitmaps/saverestore.xpm b/bochs/gui/bitmaps/saverestore.xpm new file mode 100755 index 000000000..bc4331cf7 --- /dev/null +++ b/bochs/gui/bitmaps/saverestore.xpm @@ -0,0 +1,41 @@ +/* XPM */ +static char *saverestore_xpm[] = { +/* width height num_colors chars_per_pixel */ +" 32 32 2 1", +/* colors */ +". c None", +"# c #000000", +/* pixels */ +"................................", +"................................", +"................................", +".###.#..#.###.###.###..###.###..", +".#...#..#.#...#.#.#...#..#.#..#.", +"..##.#..#..##.###.###.#..#.#..#.", +"...#.#..#...#.#...#...#..#.#..#.", +".###.####.###.#...###.#..#.###..", +"................................", +"................................", +"................................", +"................................", +".............####...............", +".............####...............", +".............####...............", +".............####...............", +"..........## #### ##............", +".........### #### ###...........", +"........#### #### ####..........", +"........###..####..###..........", +"........###..####..###..........", +"........###........###..........", +"........###........###..........", +"........###........###..........", +"........###........###..........", +"........###........###..........", +"........##############..........", +".........############...........", +"..........##########............", +"................................", +"................................", +"................................", +}; diff --git a/bochs/gui/gui.cc b/bochs/gui/gui.cc index 9b91dd776..da1e74237 100644 --- a/bochs/gui/gui.cc +++ b/bochs/gui/gui.cc @@ -1,5 +1,5 @@ ///////////////////////////////////////////////////////////////////////// -// $Id: gui.cc,v 1.95 2006-05-31 20:12:43 vruppert Exp $ +// $Id: gui.cc,v 1.96 2006-06-06 22:11:08 sshwarts Exp $ ///////////////////////////////////////////////////////////////////////// // // Copyright (C) 2002 MandrakeSoft S.A. @@ -39,6 +39,10 @@ #include "gui/bitmaps/configbutton.h" #include "gui/bitmaps/cdromd.h" #include "gui/bitmaps/userbutton.h" +#if BX_SUPPORT_SAVE_RESTORE +#include "gui/bitmaps/saverestore.h" +#endif + #if BX_WITH_MACOS # include #endif @@ -138,7 +142,6 @@ void bx_gui_c::init(int argc, char **argv, unsigned tilewidth, unsigned tileheig BX_GUI_THIS nomouse_bmap_id = create_bitmap(bx_nomouse_bmap, BX_MOUSE_BMAP_X, BX_MOUSE_BMAP_Y); - BX_GUI_THIS power_bmap_id = create_bitmap(bx_power_bmap, BX_POWER_BMAP_X, BX_POWER_BMAP_Y); BX_GUI_THIS reset_bmap_id = create_bitmap(bx_reset_bmap, BX_RESET_BMAP_X, BX_RESET_BMAP_Y); BX_GUI_THIS snapshot_bmap_id = create_bitmap(bx_snapshot_bmap, BX_SNAPSHOT_BMAP_X, BX_SNAPSHOT_BMAP_Y); @@ -147,6 +150,10 @@ void bx_gui_c::init(int argc, char **argv, unsigned tilewidth, unsigned tileheig BX_GUI_THIS config_bmap_id = create_bitmap(bx_config_bmap, BX_CONFIG_BMAP_X, BX_CONFIG_BMAP_Y); BX_GUI_THIS user_bmap_id = create_bitmap(bx_user_bmap, BX_USER_BMAP_X, BX_USER_BMAP_Y); +#if BX_SUPPORT_SAVE_RESTORE + BX_GUI_THIS save_restore_bmap_id = create_bitmap(bx_save_restore_bmap, + BX_SAVE_RESTORE_BMAP_X, BX_SAVE_RESTORE_BMAP_Y); +#endif // Add the initial bitmaps to the headerbar, and enable callback routine, for use // when that bitmap is clicked on @@ -194,6 +201,12 @@ void bx_gui_c::init(int argc, char **argv, unsigned tilewidth, unsigned tileheig BX_GUI_THIS power_hbar_id = headerbar_bitmap(BX_GUI_THIS power_bmap_id, BX_GRAVITY_RIGHT, power_handler); BX_GUI_THIS set_tooltip(BX_GUI_THIS power_hbar_id, "Turn power off"); + // Save/Restore Button +#if BX_SUPPORT_SAVE_RESTORE + BX_GUI_THIS save_restore_hbar_id = headerbar_bitmap(BX_GUI_THIS save_restore_bmap_id, + BX_GRAVITY_RIGHT, save_restore_handler); + BX_GUI_THIS set_tooltip(BX_GUI_THIS save_restore_hbar_id, "Save simulation state"); +#endif // Reset button BX_GUI_THIS reset_hbar_id = headerbar_bitmap(BX_GUI_THIS reset_bmap_id, BX_GRAVITY_RIGHT, reset_handler); @@ -233,11 +246,9 @@ void bx_gui_c::init(int argc, char **argv, unsigned tilewidth, unsigned tileheig void bx_gui_c::update_drive_status_buttons (void) { - BX_GUI_THIS floppyA_status = - DEV_floppy_get_media_status(0) + BX_GUI_THIS floppyA_status = DEV_floppy_get_media_status(0) && (SIM->get_param_enum(BXPN_FLOPPYA_STATUS)->get() == BX_INSERTED); - BX_GUI_THIS floppyB_status = - DEV_floppy_get_media_status(1) + BX_GUI_THIS floppyB_status = DEV_floppy_get_media_status(1) && (SIM->get_param_enum(BXPN_FLOPPYB_STATUS)->get() == BX_INSERTED); Bit32u handle = DEV_hd_get_first_cd_handle(); BX_GUI_THIS cdromD_status = DEV_hd_get_cd_media_status(handle); @@ -587,6 +598,13 @@ void bx_gui_c::userbutton_handler(void) } } +#if BX_SUPPORT_SAVE_RESTORE +void bx_gui_c::save_restore_handler(void) +{ + BX_INFO(("Save Restore Button Pressed !")); +} +#endif + void bx_gui_c::mouse_enabled_changed (bx_bool val) { // This is only called when SIM->get_init_done is 1. Note that VAL diff --git a/bochs/gui/gui.h b/bochs/gui/gui.h index 631d36162..14ac7034c 100644 --- a/bochs/gui/gui.h +++ b/bochs/gui/gui.h @@ -1,5 +1,5 @@ ///////////////////////////////////////////////////////////////////////// -// $Id: gui.h,v 1.50 2006-01-25 17:37:22 vruppert Exp $ +// $Id: gui.h,v 1.51 2006-06-06 22:11:08 sshwarts Exp $ ///////////////////////////////////////////////////////////////////////// // // Copyright (C) 2002 MandrakeSoft S.A. @@ -133,6 +133,7 @@ public: protected: // And these are defined and used privately in gui.cc + static Bit32s make_text_snapshot (char **snapshot, Bit32u *length); static void floppyA_handler(void); static void floppyB_handler(void); static void cdromD_handler(void); @@ -145,7 +146,9 @@ protected: static void config_handler(void); static void toggle_mouse_enable(void); static void userbutton_handler(void); - static Bit32s make_text_snapshot (char **snapshot, Bit32u *length); +#if BX_SUPPORT_SAVE_RESTORE + static void save_restore_handler(void); +#endif bx_bool floppyA_status; bx_bool floppyB_status; @@ -161,6 +164,9 @@ protected: unsigned config_bmap_id, config_hbar_id; unsigned mouse_bmap_id, nomouse_bmap_id, mouse_hbar_id; unsigned user_bmap_id, user_hbar_id; +#if BX_SUPPORT_SAVE_RESTORE + unsigned save_restore_bmap_id, save_restore_hbar_id; +#endif unsigned char vga_charmap[0x2000]; bx_bool charmap_updated; @@ -222,9 +228,15 @@ virtual void graphics_tile_update_in_place(unsigned x, unsigned y, \ unsigned w, unsigned h); /* end of DECLARE_GUI_NEW_VIRTUAL_METHODS */ +#define BX_HEADER_BAR_Y 32 + +#if BX_SUPPORT_SAVE_RESTORE +#define BX_MAX_PIXMAPS 17 +#define BX_MAX_HEADERBAR_ENTRIES 12 +#else #define BX_MAX_PIXMAPS 16 #define BX_MAX_HEADERBAR_ENTRIES 11 -#define BX_HEADER_BAR_Y 32 +#endif // align pixmaps towards left or right side of header bar #define BX_GRAVITY_LEFT 10 diff --git a/bochs/gui/wxmain.cc b/bochs/gui/wxmain.cc index e063c1176..3c6d2f545 100644 --- a/bochs/gui/wxmain.cc +++ b/bochs/gui/wxmain.cc @@ -1,5 +1,5 @@ ///////////////////////////////////////////////////////////////// -// $Id: wxmain.cc,v 1.140 2006-06-04 14:16:31 vruppert Exp $ +// $Id: wxmain.cc,v 1.141 2006-06-06 22:11:08 sshwarts Exp $ ///////////////////////////////////////////////////////////////// // // wxmain.cc implements the wxWidgets frame, toolbar, menus, and dialogs. @@ -75,6 +75,9 @@ #include "bitmaps/mouse.xpm" //#include "bitmaps/configbutton.xpm" #include "bitmaps/userbutton.xpm" +#if BX_SUPPORT_SAVE_RESTORE +#include "bitmaps/saverestore.xpm" +#endif #ifdef __WXGTK__ #include "icon_bochs.xpm" #endif @@ -519,6 +522,9 @@ MyFrame::MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size, BX_ADD_TOOL(ID_Edit_Cdrom, cdromd_xpm, wxT("Change CDROM")); BX_ADD_TOOL(ID_Toolbar_Reset, reset_xpm, wxT("Reset the system")); BX_ADD_TOOL(ID_Toolbar_Power, power_xpm, wxT("Turn power on/off")); +#if BX_SUPPORT_SAVE_RESTORE + BX_ADD_TOOL(ID_Toolbar_SaveRestore, saverestore_xpm, wxT("Save simulation state")); +#endif BX_ADD_TOOL(ID_Toolbar_Copy, copy_xpm, wxT("Copy to clipboard")); BX_ADD_TOOL(ID_Toolbar_Paste, paste_xpm, wxT("Paste from clipboard")); diff --git a/bochs/gui/wxmain.h b/bochs/gui/wxmain.h index df1686c0c..40b059ccd 100644 --- a/bochs/gui/wxmain.h +++ b/bochs/gui/wxmain.h @@ -1,5 +1,5 @@ ///////////////////////////////////////////////////////////////// -// $Id: wxmain.h,v 1.55 2006-04-12 20:51:24 vruppert Exp $ +// $Id: wxmain.h,v 1.56 2006-06-06 22:11:09 sshwarts Exp $ ///////////////////////////////////////////////////////////////// // This file defines variables and classes that the wxWidgets .cc files // share. It should be included only by wx.cc and wxmain.cc. @@ -76,6 +76,7 @@ enum ID_Toolbar_Config, ID_Toolbar_Mouse_en, ID_Toolbar_User, + ID_Toolbar_SaveRestore, // dialog box: LogMsgAskDialog ID_Continue, ID_Die,