Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
M
magicseteditor
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
MyCard
magicseteditor
Commits
3b3af165
Commit
3b3af165
authored
Jan 21, 2011
by
twanvl
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
blink console panel icon to indicate new errors/warnings/infos
parent
bfbbe02b
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
78 additions
and
2 deletions
+78
-2
src/gui/set/console_panel.cpp
src/gui/set/console_panel.cpp
+52
-2
src/gui/set/console_panel.hpp
src/gui/set/console_panel.hpp
+13
-0
src/gui/set/window.cpp
src/gui/set/window.cpp
+10
-0
src/gui/set/window.hpp
src/gui/set/window.hpp
+3
-0
No files found.
src/gui/set/console_panel.cpp
View file @
3b3af165
...
...
@@ -8,6 +8,7 @@
#include <util/prec.hpp>
#include <gui/set/console_panel.hpp>
#include <gui/set/window.hpp>
#include <gui/control/text_ctrl.hpp>
#include <gui/util.hpp>
#include <util/window_id.hpp>
...
...
@@ -268,6 +269,9 @@ END_EVENT_TABLE()
ConsolePanel
::
ConsolePanel
(
Window
*
parent
,
int
id
)
:
SetWindowPanel
(
parent
,
id
)
,
is_active_window
(
false
)
,
blinker_state
(
0
)
,
blinker_timer
(
this
)
{
// init controls
splitter
=
new
wxSplitterWindow
(
this
,
wxID_ANY
,
wxDefaultPosition
,
wxDefaultSize
,
wxTAB_TRAVERSAL
);
...
...
@@ -301,11 +305,18 @@ void ConsolePanel::initUI(wxToolBar* tb, wxMenuBar* mb) {
// Menus
// focus on entry
entry
->
SetFocus
();
// stop blinker
is_active_window
=
true
;
stop_blinker
();
}
void
ConsolePanel
::
destroyUI
(
wxToolBar
*
tb
,
wxMenuBar
*
mb
)
{
// Toolbar
// Menus
// we are no longer active, allow blinker
is_active_window
=
false
;
}
void
ConsolePanel
::
onUpdateUI
(
wxUpdateUIEvent
&
ev
)
{
...
...
@@ -334,9 +345,12 @@ void ConsolePanel::get_pending_errors() {
String
msg
;
while
(
get_queued_message
(
type
,
msg
))
{
messages
->
add_message
(
type
,
msg
);
// If this panel doesn't have the focus, then highlight it somehow
if
(
!
is_active_window
)
{
new_errors_since_last_view
=
max
(
new_errors_since_last_view
,
type
);
start_blinker
();
}
}
// If this panel doesn't have the focus, then highlight it somehow
}
void
ConsolePanel
::
exec
(
String
const
&
command
)
{
...
...
@@ -388,6 +402,7 @@ void ConsolePanel::exec(String const& command) {
BEGIN_EVENT_TABLE
(
ConsolePanel
,
wxPanel
)
EVT_TEXT_ENTER
(
wxID_ANY
,
ConsolePanel
::
onEnter
)
EVT_IDLE
(
ConsolePanel
::
onIdle
)
EVT_TIMER
(
wxID_ANY
,
ConsolePanel
::
onTimer
)
END_EVENT_TABLE
()
// ----------------------------------------------------------------------------- : Clipboard
...
...
@@ -399,3 +414,38 @@ void ConsolePanel::doCut() { entry->doCut(); }
void ConsolePanel::doCopy() { entry->doCopy(); }
void ConsolePanel::doPaste() { entry->doPaste(); }
*/
// ----------------------------------------------------------------------------- : Annoying blinking icon thing
void
ConsolePanel
::
start_blinker
()
{
if
(
new_errors_since_last_view
)
{
blinker_state
=
0
;
blinker_timer
.
Start
(
BLINK_TIME
);
update_blinker
();
}
}
void
ConsolePanel
::
stop_blinker
()
{
blinker_state
=
0
;
new_errors_since_last_view
=
static_cast
<
MessageType
>
(
0
);
blinker_timer
.
Stop
();
update_blinker
();
}
void
ConsolePanel
::
onTimer
(
wxTimerEvent
&
)
{
blinker_state
++
;
if
(
blinker_state
>
MAX_BLINKS
)
{
blinker_timer
.
Stop
();
}
update_blinker
();
}
void
ConsolePanel
::
update_blinker
()
{
SetWindow
*
parent
=
static_cast
<
SetWindow
*>
(
GetParent
());
if
(
blinker_state
%
2
==
1
||
!
new_errors_since_last_view
)
{
parent
->
setPanelIcon
(
this
,
load_resource_image
(
_
(
"tool/window_console"
)));
}
else
if
(
new_errors_since_last_view
==
MESSAGE_INFO
)
{
parent
->
setPanelIcon
(
this
,
load_resource_image
(
_
(
"message_information"
)));
}
else
if
(
new_errors_since_last_view
==
MESSAGE_WARNING
)
{
parent
->
setPanelIcon
(
this
,
load_resource_image
(
_
(
"message_warning"
)));
}
else
{
parent
->
setPanelIcon
(
this
,
load_resource_image
(
_
(
"message_error"
)));
}
}
src/gui/set/console_panel.hpp
View file @
3b3af165
...
...
@@ -55,6 +55,19 @@ class ConsolePanel : public SetWindowPanel {
void
get_pending_errors
();
void
exec
(
String
const
&
code
);
// notification of new messages
bool
is_active_window
;
MessageType
new_errors_since_last_view
;
int
blinker_state
;
wxTimer
blinker_timer
;
static
const
int
MAX_BLINKS
=
5
;
static
const
int
BLINK_TIME
=
1000
;
void
stop_blinker
();
void
start_blinker
();
void
update_blinker
();
void
onTimer
(
wxTimerEvent
&
);
};
// ----------------------------------------------------------------------------- : EOF
...
...
src/gui/set/window.cpp
View file @
3b3af165
...
...
@@ -250,6 +250,16 @@ void SetWindow::selectPanel(int id) {
current_panel
->
SetFocus
();
}
void
SetWindow
::
setPanelIcon
(
SetWindowPanel
*
panel
,
wxBitmap
const
&
icon
)
{
for
(
size_t
i
=
0
;
i
<
panels
.
size
()
;
++
i
)
{
if
(
panels
[
i
]
==
panel
)
{
wxToolBar
*
tabBar
=
(
wxToolBar
*
)
FindWindow
(
ID_TAB_BAR
);
tabBar
->
SetToolNormalBitmap
(
ID_WINDOW_MIN
+
i
,
icon
);
return
;
}
}
}
// ----------------------------------------------------------------------------- : Window managment
vector
<
SetWindow
*>
SetWindow
::
set_windows
;
...
...
src/gui/set/window.hpp
View file @
3b3af165
...
...
@@ -30,6 +30,9 @@ class SetWindow : public wxFrame, public SetView {
SetWindow
(
Window
*
parent
,
const
SetP
&
set
);
~
SetWindow
();
/// Set the icon of one of the panels
void
setPanelIcon
(
SetWindowPanel
*
panel
,
wxBitmap
const
&
icon
);
// --------------------------------------------------- : Set actions
private:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment