From c3133d761dc733b755fa1fc5804428e93d40b40a Mon Sep 17 00:00:00 2001 From: twanvl Date: Fri, 21 Jan 2011 14:23:36 +0000 Subject: [PATCH] blinker tweaks git-svn-id: svn://svn.code.sf.net/p/magicseteditor/code/trunk@1631 0fc631ac-6414-0410-93d0-97cfa31319b6 --- src/gui/set/console_panel.cpp | 6 ++++-- src/gui/set/console_panel.hpp | 2 +- src/gui/set/window.cpp | 8 ++++++++ 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/src/gui/set/console_panel.cpp b/src/gui/set/console_panel.cpp index e9cafd24..0e2a65a9 100644 --- a/src/gui/set/console_panel.cpp +++ b/src/gui/set/console_panel.cpp @@ -420,8 +420,10 @@ void ConsolePanel::doPaste() { entry->doPaste(); } void ConsolePanel::start_blinker() { if (new_errors_since_last_view) { blinker_state = 0; - blinker_timer.Start(BLINK_TIME); update_blinker(); + if (blinker_state < MAX_BLINKS) { + blinker_timer.Start(BLINK_TIME); + } } } void ConsolePanel::stop_blinker() { @@ -432,7 +434,7 @@ void ConsolePanel::stop_blinker() { } void ConsolePanel::onTimer(wxTimerEvent&) { blinker_state++; - if (blinker_state > MAX_BLINKS) { + if (blinker_state >= MAX_BLINKS) { blinker_timer.Stop(); } update_blinker(); diff --git a/src/gui/set/console_panel.hpp b/src/gui/set/console_panel.hpp index 51580b51..b90dbaa8 100644 --- a/src/gui/set/console_panel.hpp +++ b/src/gui/set/console_panel.hpp @@ -61,7 +61,7 @@ class ConsolePanel : public SetWindowPanel { MessageType new_errors_since_last_view; int blinker_state; wxTimer blinker_timer; - static const int MAX_BLINKS = 5; + static const int MAX_BLINKS = 6; static const int BLINK_TIME = 1000; void stop_blinker(); diff --git a/src/gui/set/window.cpp b/src/gui/set/window.cpp index 8de58616..0f084243 100644 --- a/src/gui/set/window.cpp +++ b/src/gui/set/window.cpp @@ -143,6 +143,12 @@ SetWindow::SetWindow(Window* parent, const SetP& set) wxSizer* s = new wxBoxSizer(wxVERTICAL); s->Add(tabBar, 0, wxEXPAND | wxBOTTOM, 3); SetSizer(s); + #if defined(__WXMSW__) && defined(TBSTYLE_EX_DOUBLEBUFFER) + // Use double buffering + HWND hWND = (HWND)tabBar->GetHWND(); + int style = ::SendMessage(hWND, TB_GETEXTENDEDSTYLE, 0, 0); + ::SendMessage(hWND, TB_SETEXTENDEDSTYLE, style | LVS_EX_DOUBLEBUFFER, 0); + #endif // panels addPanel(menuWindow, tabBar, new CardsPanel (this, wxID_ANY), 0, _("window_cards"), _("cards tab")); @@ -255,6 +261,8 @@ void SetWindow::setPanelIcon(SetWindowPanel* panel, wxBitmap const& icon) { if (panels[i] == panel) { wxToolBar* tabBar = (wxToolBar*)FindWindow(ID_TAB_BAR); tabBar->SetToolNormalBitmap(ID_WINDOW_MIN+i, icon); + // TODO: this could be done better, wx requires a full new Realize of the toolbar, but on win32 a single message would do + // if only we could set up the imagelist correctly. return; } }