From: <vru...@us...> - 2012-01-03 20:11:21
|
Revision: 10928 http://bochs.svn.sourceforge.net/bochs/?rev=10928&view=rev Author: vruppert Date: 2012-01-03 20:11:12 +0000 (Tue, 03 Jan 2012) Log Message: ----------- - moved common status LED handling code to gui.cc and implemented new gui-specific method statusbar_setitem_specific() Modified Paths: -------------- trunk/bochs/gui/gui.cc trunk/bochs/gui/gui.h trunk/bochs/gui/rfb.cc trunk/bochs/gui/sdl.cc trunk/bochs/gui/win32.cc trunk/bochs/gui/wx.cc trunk/bochs/gui/x.cc Modified: trunk/bochs/gui/gui.cc =================================================================== --- trunk/bochs/gui/gui.cc 2012-01-03 18:14:04 UTC (rev 10927) +++ trunk/bochs/gui/gui.cc 2012-01-03 20:11:12 UTC (rev 10928) @@ -767,6 +767,25 @@ } } +void bx_gui_c::statusbar_setitem(int element, bx_bool active, bx_bool w) +{ + if (element < 0) { + for (unsigned i = 0; i < statusitem_count; i++) { + statusbar_setitem_specific(element, 0, 0); + } + } else if ((unsigned)element < statusitem_count) { + if ((active != statusitem[element].active) || + (w != statusitem[element].mode)) { + statusbar_setitem_specific(element, active, w); + statusitem[element].active = active; + statusitem[element].mode = w; + } + if (active && statusitem[element].auto_off) { + statusitem[element].counter = 5; + } + } +} + void bx_gui_c::led_timer_handler(void *this_ptr) { bx_gui_c *class_ptr = (bx_gui_c *) this_ptr; Modified: trunk/bochs/gui/gui.h =================================================================== --- trunk/bochs/gui/gui.h 2012-01-03 18:14:04 UTC (rev 10927) +++ trunk/bochs/gui/gui.h 2012-01-03 20:11:12 UTC (rev 10928) @@ -111,7 +111,7 @@ virtual int get_clipboard_text(Bit8u **bytes, Bit32s *nbytes) = 0; virtual int set_clipboard_text(char *snapshot, Bit32u len) = 0; virtual void mouse_enabled_changed_specific (bx_bool val) = 0; - virtual void statusbar_setitem(int element, bx_bool active, bx_bool w=0) {} + virtual void statusbar_setitem_specific(int element, bx_bool active, bx_bool w) {} virtual void set_tooltip(unsigned hbar_id, const char *tip) {} virtual void exit(void) = 0; // set_display_mode() changes the mode between the configuration interface @@ -150,6 +150,7 @@ void update_drive_status_buttons(void); static void mouse_enabled_changed(bx_bool val); int register_statusitem(const char *text, bx_bool auto_off=0); + void statusbar_setitem(int element, bx_bool active, bx_bool w=0); static void init_signal_handlers(); static void toggle_mouse_enable(void); bx_bool mouse_toggle_check(Bit32u key, bx_bool pressed); Modified: trunk/bochs/gui/rfb.cc =================================================================== --- trunk/bochs/gui/rfb.cc 2012-01-03 18:14:04 UTC (rev 10927) +++ trunk/bochs/gui/rfb.cc 2012-01-03 20:11:12 UTC (rev 10928) @@ -51,7 +51,7 @@ DECLARE_GUI_VIRTUAL_METHODS() DECLARE_GUI_NEW_VIRTUAL_METHODS() void get_capabilities(Bit16u *xres, Bit16u *yres, Bit16u *bpp); - void statusbar_setitem(int element, bx_bool active, bx_bool w=0); + void statusbar_setitem_specific(int element, bx_bool active, bx_bool w); #if BX_SHOW_IPS void show_ips(Bit32u ips_count); #endif @@ -331,23 +331,9 @@ rfbUpdateRegion.updated = true; } -void bx_rfb_gui_c::statusbar_setitem(int element, bx_bool active, bx_bool w) +void bx_rfb_gui_c::statusbar_setitem_specific(int element, bx_bool active, bx_bool w) { - if (element < 0) { - for (unsigned i = 0; i < statusitem_count; i++) { - rfbSetStatusText(i+1, statusitem[i].text, 0, 0); - } - } else if ((unsigned)element < statusitem_count) { - if ((active != statusitem[element].active) || - (w != statusitem[element].mode)) { - rfbSetStatusText(element+1, statusitem[element].text, active, w); - statusitem[element].active = active; - statusitem[element].mode = w; - } - if (active && statusitem[element].auto_off) { - statusitem[element].counter = 5; - } - } + rfbSetStatusText(element+1, statusitem[element].text, active, w); } #ifdef WIN32 Modified: trunk/bochs/gui/sdl.cc =================================================================== --- trunk/bochs/gui/sdl.cc 2012-01-03 18:14:04 UTC (rev 10927) +++ trunk/bochs/gui/sdl.cc 2012-01-03 20:11:12 UTC (rev 10928) @@ -49,7 +49,7 @@ DECLARE_GUI_VIRTUAL_METHODS() DECLARE_GUI_NEW_VIRTUAL_METHODS() virtual void set_display_mode(disp_mode_t newmode); - virtual void statusbar_setitem(int element, bx_bool active, bx_bool w = 0); + virtual void statusbar_setitem_specific(int element, bx_bool active, bx_bool w); #if BX_SHOW_IPS virtual void show_ips(Bit32u ips_count); #endif @@ -427,23 +427,9 @@ SDL_UpdateRect(sdl_screen, xleft,res_y+headerbar_height+1,xsize,statusbar_height-2); } -void bx_sdl_gui_c::statusbar_setitem(int element, bx_bool active, bx_bool w) +void bx_sdl_gui_c::statusbar_setitem_specific(int element, bx_bool active, bx_bool w) { - if (element < 0) { - for (unsigned i = 0; i < statusitem_count; i++) { - sdl_set_status_text(i+1, statusitem[i].text, 0, 0); - } - } else if ((unsigned)element < statusitem_count) { - if ((active != statusitem[element].active) || - (w != statusitem[element].mode)) { - sdl_set_status_text(element+1, statusitem[element].text, active, w); - statusitem[element].active = active; - statusitem[element].mode = w; - } - if (active && statusitem[element].auto_off) { - statusitem[element].counter = 5; - } - } + sdl_set_status_text(element+1, statusitem[element].text, active, w); } void bx_sdl_gui_c::text_update(Bit8u *old_text, Bit8u *new_text, Modified: trunk/bochs/gui/win32.cc =================================================================== --- trunk/bochs/gui/win32.cc 2012-01-03 18:14:04 UTC (rev 10927) +++ trunk/bochs/gui/win32.cc 2012-01-03 20:11:12 UTC (rev 10928) @@ -47,7 +47,7 @@ public: bx_win32_gui_c (void) {} DECLARE_GUI_VIRTUAL_METHODS(); - virtual void statusbar_setitem(int element, bx_bool active, bx_bool w=0); + virtual void statusbar_setitem_specific(int element, bx_bool active, bx_bool w); virtual void get_capabilities(Bit16u *xres, Bit16u *yres, Bit16u *bpp); virtual void set_tooltip(unsigned hbar_id, const char *tip); #if BX_SHOW_IPS @@ -957,23 +957,9 @@ UpdateWindow(hwndSB); } -void bx_win32_gui_c::statusbar_setitem(int element, bx_bool active, bx_bool w) +void bx_win32_gui_c::statusbar_setitem_specific(int element, bx_bool active, bx_bool w) { - if (element < 0) { - for (int i = 0; i < (int)statusitem_count; i++) { - SetStatusText(i+BX_SB_TEXT_ELEMENTS, statusitem[i].text, 0, 0); - } - } else if (element < (int)statusitem_count) { - if ((active != statusitem[element].active) || - (w != statusitem[element].mode)) { - SetStatusText(element+BX_SB_TEXT_ELEMENTS, statusitem[element].text, active, w); - statusitem[element].active = active; - statusitem[element].mode = w; - } - if (active && statusitem[element].auto_off) { - statusitem[element].counter = 5; - } - } + SetStatusText(element+BX_SB_TEXT_ELEMENTS, statusitem[element].text, active, w); } LRESULT CALLBACK mainWndProc(HWND hwnd, UINT iMsg, WPARAM wParam, LPARAM lParam) Modified: trunk/bochs/gui/wx.cc =================================================================== --- trunk/bochs/gui/wx.cc 2012-01-03 18:14:04 UTC (rev 10927) +++ trunk/bochs/gui/wx.cc 2012-01-03 20:11:12 UTC (rev 10928) @@ -67,7 +67,7 @@ bx_wx_gui_c (void) {} DECLARE_GUI_VIRTUAL_METHODS() DECLARE_GUI_NEW_VIRTUAL_METHODS() - void statusbar_setitem(int element, bx_bool active, bx_bool w=0); + void statusbar_setitem_specific(int element, bx_bool active, bx_bool w); #if BX_SHOW_IPS void show_ips(Bit32u ips_count); #endif @@ -1074,38 +1074,24 @@ num_events = 0; } -void bx_wx_gui_c::statusbar_setitem(int element, bx_bool active, bx_bool w) +void bx_wx_gui_c::statusbar_setitem_specific(int element, bx_bool active, bx_bool w) { #if defined(__WXMSW__) char status_text[10]; #endif wxMutexGuiEnter(); - if (element < 0) { - for (unsigned i = 0; i < statusitem_count; i++) { - theFrame->SetStatusText(wxT(""), i+1); - } - } else if ((unsigned)element < statusitem_count) { - if ((active != statusitem[element].active) || - (w != statusitem[element].mode)) { - if (active) { + if (active) { #if defined(__WXMSW__) - status_text[0] = 9; - strcpy(status_text+1, statusitem[element].text); - theFrame->SetStatusText(status_text, element+1); + status_text[0] = 9; + strcpy(status_text+1, statusitem[element].text); + theFrame->SetStatusText(status_text, element+1); #else - theFrame->SetStatusText(wxString(statusitem[element].text, wxConvUTF8), - element+1); + theFrame->SetStatusText(wxString(statusitem[element].text, wxConvUTF8), + element+1); #endif - } else { - theFrame->SetStatusText(wxT(""), element+1); - } - statusitem[element].active = active; - statusitem[element].mode = w; - } - if (active && statusitem[element].auto_off) { - statusitem[element].counter = 5; - } + } else { + theFrame->SetStatusText(wxT(""), element+1); } wxMutexGuiLeave(); } Modified: trunk/bochs/gui/x.cc =================================================================== --- trunk/bochs/gui/x.cc 2012-01-03 18:14:04 UTC (rev 10927) +++ trunk/bochs/gui/x.cc 2012-01-03 20:11:12 UTC (rev 10928) @@ -63,7 +63,7 @@ #endif virtual void beep_on(float frequency); virtual void beep_off(); - virtual void statusbar_setitem(int element, bx_bool active, bx_bool w=0); + virtual void statusbar_setitem_specific(int element, bx_bool active, bx_bool w); virtual void get_capabilities(Bit16u *xres, Bit16u *yres, Bit16u *bpp); #if BX_SHOW_IPS virtual void show_ips(Bit32u ips_count); @@ -708,23 +708,9 @@ } } -void bx_x_gui_c::statusbar_setitem(int element, bx_bool active, bx_bool w) +void bx_x_gui_c::statusbar_setitem_specific(int element, bx_bool active, bx_bool w) { - if (element < 0) { - for (unsigned i = 0; i < statusitem_count; i++) { - set_status_text(i+1, statusitem[i].text, 0, 0); - } - } else if ((unsigned)element < statusitem_count) { - if ((active != statusitem[element].active) || - (w != statusitem[element].mode)) { - set_status_text(element+1, statusitem[element].text, active, w); - statusitem[element].active = active; - statusitem[element].mode = w; - } - if (active && statusitem[element].auto_off) { - statusitem[element].counter = 5; - } - } + set_status_text(element+1, statusitem[element].text, active, w); } // This is called whenever the mouse_enabled parameter changes. It This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |