Allow hiding the messages window
This commit is contained in:
parent
ed55a307f3
commit
3a762759ef
5 changed files with 28 additions and 1 deletions
|
@ -81,5 +81,6 @@ void show_message_ok(wxWindow* parent, const std::string& title, const std::stri
|
||||||
extern wxwin_messages* msg_window;
|
extern wxwin_messages* msg_window;
|
||||||
extern wxwin_mainwindow* main_window;
|
extern wxwin_mainwindow* main_window;
|
||||||
extern std::string our_rom_name;
|
extern std::string our_rom_name;
|
||||||
|
extern bool wxwidgets_exiting;
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -28,6 +28,8 @@ public:
|
||||||
void on_scroll_pagedown(wxCommandEvent& e);
|
void on_scroll_pagedown(wxCommandEvent& e);
|
||||||
void on_scroll_end(wxCommandEvent& e);
|
void on_scroll_end(wxCommandEvent& e);
|
||||||
void on_execute(wxCommandEvent& e);
|
void on_execute(wxCommandEvent& e);
|
||||||
|
void on_close(wxCloseEvent& e);
|
||||||
|
void reshow();
|
||||||
private:
|
private:
|
||||||
wxTextCtrl* command;
|
wxTextCtrl* command;
|
||||||
panel* mpanel;
|
panel* mpanel;
|
||||||
|
|
|
@ -47,6 +47,7 @@ wxwin_mainwindow* main_window;
|
||||||
std::string our_rom_name;
|
std::string our_rom_name;
|
||||||
|
|
||||||
bool dummy_interface = false;
|
bool dummy_interface = false;
|
||||||
|
bool wxwidgets_exiting = false;
|
||||||
|
|
||||||
namespace
|
namespace
|
||||||
{
|
{
|
||||||
|
@ -406,6 +407,8 @@ int lsnes_app::OnExit()
|
||||||
if(settings_mode)
|
if(settings_mode)
|
||||||
return 0;
|
return 0;
|
||||||
//NULL these so no further messages will be sent.
|
//NULL these so no further messages will be sent.
|
||||||
|
auto x = msg_window;
|
||||||
|
auto y = main_window;
|
||||||
msg_window = NULL;
|
msg_window = NULL;
|
||||||
main_window = NULL;
|
main_window = NULL;
|
||||||
save_configuration();
|
save_configuration();
|
||||||
|
|
|
@ -29,6 +29,7 @@
|
||||||
#include "platform/wxwidgets/menu_dump.hpp"
|
#include "platform/wxwidgets/menu_dump.hpp"
|
||||||
#include "platform/wxwidgets/platform.hpp"
|
#include "platform/wxwidgets/platform.hpp"
|
||||||
#include "platform/wxwidgets/window_mainwindow.hpp"
|
#include "platform/wxwidgets/window_mainwindow.hpp"
|
||||||
|
#include "platform/wxwidgets/window_messages.hpp"
|
||||||
#include "platform/wxwidgets/window_status.hpp"
|
#include "platform/wxwidgets/window_status.hpp"
|
||||||
|
|
||||||
extern "C"
|
extern "C"
|
||||||
|
@ -99,6 +100,7 @@ enum
|
||||||
wxID_RELOAD_ROM_IMAGE,
|
wxID_RELOAD_ROM_IMAGE,
|
||||||
wxID_LOAD_ROM_IMAGE,
|
wxID_LOAD_ROM_IMAGE,
|
||||||
wxID_NEW_MOVIE,
|
wxID_NEW_MOVIE,
|
||||||
|
wxID_SHOW_MESSAGES,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -785,6 +787,7 @@ wxwin_mainwindow::wxwin_mainwindow()
|
||||||
menu_start(wxT("Configure"));
|
menu_start(wxT("Configure"));
|
||||||
menu_entry_check(wxID_SHOW_STATUS, wxT("Show/Hide status panel"));
|
menu_entry_check(wxID_SHOW_STATUS, wxT("Show/Hide status panel"));
|
||||||
menu_check(wxID_SHOW_STATUS, true);
|
menu_check(wxID_SHOW_STATUS, true);
|
||||||
|
menu_entry(wxID_SHOW_MESSAGES, wxT("Show messages"));
|
||||||
menu_entry(wxID_SETTINGS, wxT("Configure emulator..."));
|
menu_entry(wxID_SETTINGS, wxT("Configure emulator..."));
|
||||||
menu_entry(wxID_SETTINGS_HOTKEYS, wxT("Configure hotkeys..."));
|
menu_entry(wxID_SETTINGS_HOTKEYS, wxT("Configure hotkeys..."));
|
||||||
if(platform::sound_initialized()) {
|
if(platform::sound_initialized()) {
|
||||||
|
@ -842,6 +845,7 @@ void wxwin_mainwindow::notify_update_status() throw()
|
||||||
|
|
||||||
void wxwin_mainwindow::notify_exit() throw()
|
void wxwin_mainwindow::notify_exit() throw()
|
||||||
{
|
{
|
||||||
|
wxwidgets_exiting = true;
|
||||||
join_emulator_thread();
|
join_emulator_thread();
|
||||||
Destroy();
|
Destroy();
|
||||||
}
|
}
|
||||||
|
@ -1126,5 +1130,8 @@ void wxwin_mainwindow::handle_menu_click_cancelable(wxCommandEvent& e)
|
||||||
case wxID_NEW_MOVIE:
|
case wxID_NEW_MOVIE:
|
||||||
show_projectwindow(this);
|
show_projectwindow(this);
|
||||||
return;
|
return;
|
||||||
|
case wxID_SHOW_MESSAGES:
|
||||||
|
msg_window->reshow();
|
||||||
|
return;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,7 +18,7 @@ wxwin_messages::panel::panel(wxwin_messages* _parent, unsigned lines)
|
||||||
|
|
||||||
wxwin_messages::wxwin_messages()
|
wxwin_messages::wxwin_messages()
|
||||||
: wxFrame(NULL, wxID_ANY, wxT("lsnes: Messages"), wxDefaultPosition, wxSize(-1, -1),
|
: wxFrame(NULL, wxID_ANY, wxT("lsnes: Messages"), wxDefaultPosition, wxSize(-1, -1),
|
||||||
wxMINIMIZE_BOX | wxSYSTEM_MENU | wxCAPTION | wxCLIP_CHILDREN)
|
wxMINIMIZE_BOX | wxCLOSE_BOX | wxSYSTEM_MENU | wxCAPTION | wxCLIP_CHILDREN)
|
||||||
{
|
{
|
||||||
wxFlexGridSizer* top_s = new wxFlexGridSizer(3, 1, 0, 0);
|
wxFlexGridSizer* top_s = new wxFlexGridSizer(3, 1, 0, 0);
|
||||||
top_s->Add(mpanel = new panel(this, MAXMESSAGES));
|
top_s->Add(mpanel = new panel(this, MAXMESSAGES));
|
||||||
|
@ -58,6 +58,7 @@ wxwin_messages::wxwin_messages()
|
||||||
cmd_s->SetSizeHints(this);
|
cmd_s->SetSizeHints(this);
|
||||||
top_s->Add(cmd_s, 0, wxGROW);
|
top_s->Add(cmd_s, 0, wxGROW);
|
||||||
|
|
||||||
|
Connect(wxEVT_CLOSE_WINDOW, wxCloseEventHandler(wxwin_messages::on_close));
|
||||||
top_s->SetSizeHints(this);
|
top_s->SetSizeHints(this);
|
||||||
SetSizer(top_s);
|
SetSizer(top_s);
|
||||||
Fit();
|
Fit();
|
||||||
|
@ -89,6 +90,19 @@ void wxwin_messages::panel::on_paint(wxPaintEvent& e)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void wxwin_messages::on_close(wxCloseEvent& e)
|
||||||
|
{
|
||||||
|
if(wxwidgets_exiting)
|
||||||
|
return;
|
||||||
|
e.Veto();
|
||||||
|
Hide();
|
||||||
|
}
|
||||||
|
|
||||||
|
void wxwin_messages::reshow()
|
||||||
|
{
|
||||||
|
Show();
|
||||||
|
}
|
||||||
|
|
||||||
void wxwin_messages::on_scroll_home(wxCommandEvent& e)
|
void wxwin_messages::on_scroll_home(wxCommandEvent& e)
|
||||||
{
|
{
|
||||||
mutex::holder h(platform::msgbuf_lock());
|
mutex::holder h(platform::msgbuf_lock());
|
||||||
|
|
Loading…
Add table
Reference in a new issue