Commit da81a7c4 authored by twanvl's avatar twanvl

blinker tweaks

parent 3b3af165
...@@ -420,8 +420,10 @@ void ConsolePanel::doPaste() { entry->doPaste(); } ...@@ -420,8 +420,10 @@ void ConsolePanel::doPaste() { entry->doPaste(); }
void ConsolePanel::start_blinker() { void ConsolePanel::start_blinker() {
if (new_errors_since_last_view) { if (new_errors_since_last_view) {
blinker_state = 0; blinker_state = 0;
blinker_timer.Start(BLINK_TIME);
update_blinker(); update_blinker();
if (blinker_state < MAX_BLINKS) {
blinker_timer.Start(BLINK_TIME);
}
} }
} }
void ConsolePanel::stop_blinker() { void ConsolePanel::stop_blinker() {
...@@ -432,7 +434,7 @@ void ConsolePanel::stop_blinker() { ...@@ -432,7 +434,7 @@ void ConsolePanel::stop_blinker() {
} }
void ConsolePanel::onTimer(wxTimerEvent&) { void ConsolePanel::onTimer(wxTimerEvent&) {
blinker_state++; blinker_state++;
if (blinker_state > MAX_BLINKS) { if (blinker_state >= MAX_BLINKS) {
blinker_timer.Stop(); blinker_timer.Stop();
} }
update_blinker(); update_blinker();
......
...@@ -61,7 +61,7 @@ class ConsolePanel : public SetWindowPanel { ...@@ -61,7 +61,7 @@ class ConsolePanel : public SetWindowPanel {
MessageType new_errors_since_last_view; MessageType new_errors_since_last_view;
int blinker_state; int blinker_state;
wxTimer blinker_timer; wxTimer blinker_timer;
static const int MAX_BLINKS = 5; static const int MAX_BLINKS = 6;
static const int BLINK_TIME = 1000; static const int BLINK_TIME = 1000;
void stop_blinker(); void stop_blinker();
......
...@@ -143,6 +143,12 @@ SetWindow::SetWindow(Window* parent, const SetP& set) ...@@ -143,6 +143,12 @@ SetWindow::SetWindow(Window* parent, const SetP& set)
wxSizer* s = new wxBoxSizer(wxVERTICAL); wxSizer* s = new wxBoxSizer(wxVERTICAL);
s->Add(tabBar, 0, wxEXPAND | wxBOTTOM, 3); s->Add(tabBar, 0, wxEXPAND | wxBOTTOM, 3);
SetSizer(s); 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 // panels
addPanel(menuWindow, tabBar, new CardsPanel (this, wxID_ANY), 0, _("window_cards"), _("cards tab")); 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) { ...@@ -255,6 +261,8 @@ void SetWindow::setPanelIcon(SetWindowPanel* panel, wxBitmap const& icon) {
if (panels[i] == panel) { if (panels[i] == panel) {
wxToolBar* tabBar = (wxToolBar*)FindWindow(ID_TAB_BAR); wxToolBar* tabBar = (wxToolBar*)FindWindow(ID_TAB_BAR);
tabBar->SetToolNormalBitmap(ID_WINDOW_MIN+i, icon); 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; return;
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment