Merge status panel and main window
This commit is contained in:
parent
385afe8634
commit
4f65fcf2fa
5 changed files with 21 additions and 13 deletions
|
@ -1,6 +1,8 @@
|
|||
#ifndef _plat_wxwidgets__window_mainwindow__hpp__included__
|
||||
#define _plat_wxwidgets__window_mainwindow__hpp__included__
|
||||
|
||||
#include "plat-wxwidgets/window_status.hpp"
|
||||
|
||||
#include <stack>
|
||||
|
||||
#include <wx/string.h>
|
||||
|
@ -23,6 +25,7 @@ public:
|
|||
wxwin_mainwindow();
|
||||
void request_paint();
|
||||
void notify_update() throw();
|
||||
void notify_update_status() throw();
|
||||
void notify_exit() throw();
|
||||
void on_close(wxCloseEvent& e);
|
||||
void menu_start(wxString name);
|
||||
|
@ -46,6 +49,7 @@ private:
|
|||
panel* gpanel;
|
||||
wxMenu* current_menu;
|
||||
wxMenuBar* menubar;
|
||||
wxwin_status::panel* spanel;
|
||||
std::map<int, wxMenuItem*> checkitems;
|
||||
std::stack<wxMenu*> upper;
|
||||
void* ahmenu;
|
||||
|
|
|
@ -10,10 +10,10 @@ public:
|
|||
class panel : public wxPanel
|
||||
{
|
||||
public:
|
||||
panel(wxwin_status* _parent, unsigned lines);
|
||||
panel(wxWindow* _parent, unsigned lines);
|
||||
void on_paint(wxPaintEvent& e);
|
||||
bool dirty;
|
||||
wxwin_status* parent;
|
||||
wxWindow* parent;
|
||||
};
|
||||
wxwin_status();
|
||||
~wxwin_status();
|
||||
|
|
|
@ -43,7 +43,6 @@
|
|||
#define UISERV_MODAL 9999
|
||||
|
||||
wxwin_messages* msg_window;
|
||||
wxwin_status* status_window;
|
||||
wxwin_mainwindow* main_window;
|
||||
std::string our_rom_name;
|
||||
|
||||
|
@ -123,8 +122,8 @@ namespace
|
|||
if(msg_window)
|
||||
msg_window->notify_update();
|
||||
} else if(c == UISERV_UPDATE_STATUS) {
|
||||
if(status_window)
|
||||
status_window->notify_update();
|
||||
if(main_window)
|
||||
main_window->notify_update_status();
|
||||
} else if(c == UISERV_UPDATE_SCREEN) {
|
||||
if(main_window)
|
||||
main_window->notify_update();
|
||||
|
@ -328,9 +327,6 @@ bool lsnes_app::OnInit()
|
|||
msg_window = new wxwin_messages();
|
||||
msg_window->Show();
|
||||
|
||||
status_window = new wxwin_status();
|
||||
status_window->Show();
|
||||
|
||||
wxwin_romselect* romwin = new wxwin_romselect();
|
||||
romwin->Show();
|
||||
|
||||
|
@ -341,7 +337,6 @@ int lsnes_app::OnExit()
|
|||
{
|
||||
//NULL these so no further messages will be sent.
|
||||
msg_window = NULL;
|
||||
status_window = NULL;
|
||||
main_window = NULL;
|
||||
information_dispatch::do_dump_end();
|
||||
rrdata::close();
|
||||
|
|
|
@ -779,8 +779,9 @@ wxwin_mainwindow::wxwin_mainwindow()
|
|||
{
|
||||
broadcast_listener* blistener = new broadcast_listener(this);
|
||||
Centre();
|
||||
wxFlexGridSizer* toplevel = new wxFlexGridSizer(1, 1, 0, 0);
|
||||
wxFlexGridSizer* toplevel = new wxFlexGridSizer(1, 2, 0, 0);
|
||||
toplevel->Add(gpanel = new panel(this), 1, wxGROW);
|
||||
toplevel->Add(spanel = new wxwin_status::panel(this, 20), 1, wxGROW);
|
||||
toplevel->SetSizeHints(this);
|
||||
SetSizer(toplevel);
|
||||
Fit();
|
||||
|
@ -881,6 +882,14 @@ void wxwin_mainwindow::notify_update() throw()
|
|||
}
|
||||
}
|
||||
|
||||
void wxwin_mainwindow::notify_update_status() throw()
|
||||
{
|
||||
if(!spanel->dirty) {
|
||||
spanel->dirty = true;
|
||||
spanel->Refresh();
|
||||
}
|
||||
}
|
||||
|
||||
void wxwin_mainwindow::notify_exit() throw()
|
||||
{
|
||||
join_emulator_thread();
|
||||
|
@ -1216,7 +1225,7 @@ void wxwin_mainwindow::menu_edit_jukebox(wxCommandEvent& e)
|
|||
new_jukebox.push_back(l);
|
||||
}
|
||||
runemufn([&new_jukebox]() { set_jukebox_names(new_jukebox); });
|
||||
status_window->notify_update();
|
||||
notify_update_status();
|
||||
platform::set_modal_pause(false);
|
||||
}
|
||||
|
||||
|
|
|
@ -4,14 +4,14 @@
|
|||
|
||||
#define MAXSTATUS 30
|
||||
|
||||
wxwin_status::panel::panel(wxwin_status* _parent, unsigned lines)
|
||||
wxwin_status::panel::panel(wxWindow* _parent, unsigned lines)
|
||||
: wxPanel(_parent)
|
||||
{
|
||||
parent = _parent;
|
||||
dirty = false;
|
||||
wxMemoryDC d;
|
||||
wxSize s = d.GetTextExtent(wxT("MMMMMM"));
|
||||
SetMinSize(wxSize(6 * s.x, lines * s.y));
|
||||
SetMinSize(wxSize(4 * s.x, lines * s.y));
|
||||
this->Connect(wxEVT_PAINT, wxPaintEventHandler(wxwin_status::panel::on_paint), NULL, this);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue