Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/dfltcfg.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@
// gui stuff
#define K_SHOWTOOLBAR _T("ShowToolbar")
#define V_SHOWTOOLBAR true
#define K_SHOWSTATUSBAR _T("ShowStatusBar")
#define V_SHOWSTATUSBAR true
#define K_SHOWDISCOVERED _T("ShowZeroConf")
#define V_SHOWDISCOVERED true
#define K_SHOWBOOKMARKS _T("ShowBookmarks")
Expand Down
9 changes: 9 additions & 0 deletions src/gui/FrameMain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@ FrameMain::FrameMain(wxWindow* parent, wxWindowID id, const wxString& title, con
wxglade_tmp_menu = new wxMenu();
wxglade_tmp_menu->Append(ID_TOOLBAR, _("Toolbar"), wxEmptyString, wxITEM_CHECK);
Bind(wxEVT_MENU, &FrameMain::view_toggletoolbar, this, ID_TOOLBAR);
wxglade_tmp_menu->Append(ID_STATUSBAR, _("Status Bar"), wxEmptyString, wxITEM_CHECK);
Bind(wxEVT_MENU, &FrameMain::view_togglestatusbar, this, ID_STATUSBAR);
wxglade_tmp_menu->Append(ID_DISCOVERED, _("Discovered Servers"), wxEmptyString, wxITEM_CHECK);
Bind(wxEVT_MENU, &FrameMain::view_togglediscovered, this, ID_DISCOVERED);
wxglade_tmp_menu->Append(ID_BOOKMARKS, _("Bookmarks"), wxEmptyString, wxITEM_CHECK);
Expand Down Expand Up @@ -275,6 +277,13 @@ void FrameMain::view_toggletoolbar(wxCommandEvent &event) // wxGlade: FrameMain
wxLogDebug(wxT("Event handler (FrameMain::view_toggletoolbar) not implemented yet"));
}

void FrameMain::view_togglestatusbar(wxCommandEvent &event) // wxGlade: FrameMain.<event_handler>
{
event.Skip();
// notify the user that he hasn't implemented the event handler yet
wxLogDebug(wxT("Event handler (FrameMain::view_togglestatusbar) not implemented yet"));
}

void FrameMain::view_togglediscovered(wxCommandEvent &event) // wxGlade: FrameMain.<event_handler>
{
event.Skip();
Expand Down
1 change: 1 addition & 0 deletions src/gui/FrameMain.h
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ class FrameMain: public wxFrame {
virtual void machine_input_replay(wxCommandEvent &event); // wxGlade: <event_handler>
virtual void machine_exit(wxCommandEvent &event); // wxGlade: <event_handler>
virtual void view_toggletoolbar(wxCommandEvent &event); // wxGlade: <event_handler>
virtual void view_togglestatusbar(wxCommandEvent &event); // wxGlade: <event_handler>
virtual void view_togglediscovered(wxCommandEvent &event); // wxGlade: <event_handler>
virtual void view_togglebookmarks(wxCommandEvent &event); // wxGlade: <event_handler>
virtual void view_togglestatistics(wxCommandEvent &event); // wxGlade: <event_handler>
Expand Down
44 changes: 38 additions & 6 deletions src/gui/MyFrameMain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ MyFrameMain::MyFrameMain(wxWindow* parent, int id, const wxString& title,
// get default config object, created on demand if not exist
wxConfigBase *pConfig = wxConfigBase::Get();
pConfig->Read(K_SHOWTOOLBAR, &show_toolbar, V_SHOWTOOLBAR);
pConfig->Read(K_SHOWSTATUSBAR, &show_statusbar, V_SHOWSTATUSBAR);
pConfig->Read(K_SHOWDISCOVERED, &show_discovered, V_SHOWDISCOVERED);
pConfig->Read(K_SHOWBOOKMARKS, &show_bookmarks, V_SHOWBOOKMARKS);
pConfig->Read(K_SHOWSTATS, &show_stats, V_SHOWSTATS);
Expand Down Expand Up @@ -179,6 +180,8 @@ MyFrameMain::MyFrameMain(wxWindow* parent, int id, const wxString& title,
frame_main_menubar->Check(ID_BOOKMARKS, true);
if(show_stats)
frame_main_menubar->Check(ID_STATISTICS, true);
if(show_statusbar)
frame_main_menubar->Check(ID_STATUSBAR, true);

if (VNCSeamlessConnector::isSupportedByCurrentPlatform()) {
switch (show_seamless) {
Expand Down Expand Up @@ -218,6 +221,8 @@ MyFrameMain::MyFrameMain(wxWindow* parent, int id, const wxString& title,
Bind(wxEVT_AUINOTEBOOK_PAGE_CLOSE, &MyFrameMain::notebook_connections_pageclose, this, wxID_ANY);
Bind(wxEVT_AUINOTEBOOK_TAB_RIGHT_DOWN, &MyFrameMain::notebook_connections_tab_right_down, this, wxID_ANY);
Bind(wxEVT_AUINOTEBOOK_DRAG_DONE, &MyFrameMain::notebook_connections_drag_done, this, wxID_ANY);

applyStatusBarVisibility();
}


Expand Down Expand Up @@ -260,6 +265,23 @@ MyFrameMain::~MyFrameMain()
}


void MyFrameMain::applyStatusBarVisibility()
{
if(show_fullscreen || !show_statusbar)
{
if(GetStatusBar() == frame_main_statusbar)
SetStatusBar(nullptr);
frame_main_statusbar->Hide();
}
else
{
if(GetStatusBar() != frame_main_statusbar)
SetStatusBar(frame_main_statusbar);
frame_main_statusbar->Show();
}
}





Expand Down Expand Up @@ -752,9 +774,7 @@ void MyFrameMain::onFullScreenChanged(wxFullScreenEvent &event) {
splitwinlayout();
// hide toolbar labels
GetToolBar()->SetWindowStyle(GetToolBar()->GetWindowStyle() & ~wxTB_TEXT);
// hide and unlink status bar
GetStatusBar()->Hide();
SetStatusBar(nullptr);
applyStatusBarVisibility();
} else {
// untick menu item
frame_main_menubar->Check(ID_FULLSCREEN, false);
Expand All @@ -774,9 +794,7 @@ void MyFrameMain::onFullScreenChanged(wxFullScreenEvent &event) {
splitwinlayout();
// show toolbar labels
GetToolBar()->SetWindowStyle(GetToolBar()->GetWindowStyle() | wxTB_TEXT);
// reattach and status bar
SetStatusBar(frame_main_statusbar);
GetStatusBar()->Show();
applyStatusBarVisibility();
}
// needed at least on MacOS to let the status bar re-appear correctly on restore
SendSizeEvent();
Expand Down Expand Up @@ -2120,6 +2138,20 @@ void MyFrameMain::view_toggletoolbar(wxCommandEvent &event)
}


void MyFrameMain::view_togglestatusbar(wxCommandEvent &event)
{
show_statusbar = !show_statusbar;

applyStatusBarVisibility();

// this does more than Layout() which only deals with sizers
SendSizeEvent();

wxConfigBase *pConfig = wxConfigBase::Get();
pConfig->Write(K_SHOWSTATUSBAR, show_statusbar);
}



void MyFrameMain::view_togglediscovered(wxCommandEvent &event)
{
Expand Down
3 changes: 3 additions & 0 deletions src/gui/MyFrameMain.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ class MyFrameMain: public FrameMain

// gui layout stuff
bool show_toolbar;
bool show_statusbar;
bool show_discovered;
bool show_bookmarks;
bool show_stats;
Expand Down Expand Up @@ -116,6 +117,7 @@ class MyFrameMain: public FrameMain
// multi-sync input
bool multi_sync_enabled;
void updateMultiSyncTargets();
void applyStatusBarVisibility();


protected:
Expand Down Expand Up @@ -155,6 +157,7 @@ class MyFrameMain: public FrameMain
void machine_exit(wxCommandEvent &event);

void view_toggletoolbar(wxCommandEvent &event);
void view_togglestatusbar(wxCommandEvent &event);
void view_togglediscovered(wxCommandEvent &event);
void view_togglebookmarks(wxCommandEvent &event);
void view_togglestatistics(wxCommandEvent &event);
Expand Down
1 change: 1 addition & 0 deletions src/gui/evtids.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
enum
{
ID_TOOLBAR = wxID_HIGHEST + 42,
ID_STATUSBAR,
ID_DISCOVERED,
ID_BOOKMARKS,
ID_STATISTICS,
Expand Down