Removed AuiTB, moved functions to menubar (Debug->Perspectives)
This commit is contained in:
parent
6cd0ebab93
commit
b8b72861b5
|
@ -437,6 +437,22 @@ void CCodeWindow::CreateMenu(const SCoreStartupParameter& _LocalCoreStartupParam
|
|||
pDebugMenu->Append(IDM_STEP, _("Step &Into\tF11"));
|
||||
pDebugMenu->Append(IDM_STEPOVER, _("Step &Over\tF10"));
|
||||
pDebugMenu->Append(IDM_TOGGLE_BREAKPOINT, _("Toggle &Breakpoint\tF9"));
|
||||
pDebugMenu->AppendSeparator();
|
||||
|
||||
wxMenu* pPerspectives = new wxMenu;
|
||||
Parent->m_SavedPerspectives = new wxMenu;
|
||||
pDebugMenu->AppendSubMenu(pPerspectives, _("Perspectives"), _("Edit Perspectives"));
|
||||
pPerspectives->Append(IDM_SAVE_PERSPECTIVE, _("Save perspectives"), _("Save currently-toggled perspectives"));
|
||||
pPerspectives->Append(IDM_EDIT_PERSPECTIVES, _("Edit perspectives"), _("Toggle editing of perspectives"), wxITEM_CHECK);
|
||||
pPerspectives->AppendSeparator();
|
||||
pPerspectives->Append(IDM_ADD_PERSPECTIVE, _("Create new perspective"));
|
||||
pPerspectives->AppendSubMenu(Parent->m_SavedPerspectives, _("Saved perspectives"));
|
||||
Parent->PopulateSavedPerspectives();
|
||||
pPerspectives->AppendSeparator();
|
||||
pPerspectives->Append(IDM_PERSPECTIVES_ADD_PANE, _("Add new pane"));
|
||||
pPerspectives->Append(IDM_TAB_SPLIT, _("Tab split"), "", wxITEM_CHECK);
|
||||
pPerspectives->Append(IDM_NO_DOCKING, _("Disable docking"), "Disable docking of perspective panes to main window", wxITEM_CHECK);
|
||||
|
||||
|
||||
pMenuBar->Append(pDebugMenu, _("&Debug"));
|
||||
|
||||
|
|
|
@ -41,7 +41,6 @@
|
|||
#include <wx/translation.h>
|
||||
#include <wx/window.h>
|
||||
#include <wx/windowid.h>
|
||||
#include <wx/aui/auibar.h>
|
||||
#include <wx/aui/auibook.h>
|
||||
#include <wx/aui/framemanager.h>
|
||||
|
||||
|
@ -227,16 +226,14 @@ EVT_MENU(IDM_CONFIG_PAD_PLUGIN, CFrame::OnConfigPAD)
|
|||
EVT_MENU(IDM_CONFIG_WIIMOTE_PLUGIN, CFrame::OnConfigWiimote)
|
||||
EVT_MENU(IDM_CONFIG_HOTKEYS, CFrame::OnConfigHotkey)
|
||||
|
||||
EVT_MENU(IDM_SAVE_PERSPECTIVE, CFrame::OnToolBar)
|
||||
EVT_AUITOOLBAR_TOOL_DROPDOWN(IDM_SAVE_PERSPECTIVE, CFrame::OnDropDownToolbarItem)
|
||||
EVT_MENU(IDM_EDIT_PERSPECTIVES, CFrame::OnToolBar)
|
||||
EVT_AUITOOLBAR_TOOL_DROPDOWN(IDM_EDIT_PERSPECTIVES, CFrame::OnDropDownSettingsToolbar)
|
||||
EVT_MENU(IDM_SAVE_PERSPECTIVE, CFrame::OnPerspectiveMenu)
|
||||
EVT_MENU(IDM_EDIT_PERSPECTIVES, CFrame::OnPerspectiveMenu)
|
||||
// Drop down
|
||||
EVT_MENU(IDM_PERSPECTIVES_ADD_PANE, CFrame::OnToolBar)
|
||||
EVT_MENU(IDM_PERSPECTIVES_ADD_PANE, CFrame::OnPerspectiveMenu)
|
||||
EVT_MENU_RANGE(IDM_PERSPECTIVES_0, IDM_PERSPECTIVES_100, CFrame::OnSelectPerspective)
|
||||
EVT_MENU(IDM_ADD_PERSPECTIVE, CFrame::OnDropDownToolbarSelect)
|
||||
EVT_MENU(IDM_TAB_SPLIT, CFrame::OnDropDownToolbarSelect)
|
||||
EVT_MENU(IDM_NO_DOCKING, CFrame::OnDropDownToolbarSelect)
|
||||
EVT_MENU(IDM_ADD_PERSPECTIVE, CFrame::OnPerspectiveMenu)
|
||||
EVT_MENU(IDM_TAB_SPLIT, CFrame::OnPerspectiveMenu)
|
||||
EVT_MENU(IDM_NO_DOCKING, CFrame::OnPerspectiveMenu)
|
||||
// Drop down float
|
||||
EVT_MENU_RANGE(IDM_FLOAT_LOGWINDOW, IDM_FLOAT_CODEWINDOW, CFrame::OnFloatWindow)
|
||||
|
||||
|
@ -310,7 +307,8 @@ CFrame::CFrame(wxFrame* parent,
|
|||
long style)
|
||||
: CRenderFrame(parent, id, title, pos, size, style)
|
||||
, g_pCodeWindow(nullptr), g_NetPlaySetupDiag(nullptr), g_CheatsWindow(nullptr)
|
||||
, m_ToolBar(nullptr), m_ToolBarDebug(nullptr), m_ToolBarAui(nullptr)
|
||||
, m_ToolBar(nullptr), m_ToolBarDebug(nullptr)
|
||||
, m_SavedPerspectives(nullptr)
|
||||
, m_GameListCtrl(nullptr), m_Panel(nullptr)
|
||||
, m_RenderFrame(nullptr), m_RenderParent(nullptr)
|
||||
, m_LogWindow(nullptr), m_LogConfigWindow(nullptr)
|
||||
|
|
|
@ -44,8 +44,6 @@ class wxAuiManager;
|
|||
class wxAuiManagerEvent;
|
||||
class wxAuiNotebook;
|
||||
class wxAuiNotebookEvent;
|
||||
class wxAuiToolBar;
|
||||
class wxAuiToolBarEvent;
|
||||
class wxListEvent;
|
||||
class wxMenuItem;
|
||||
class wxWindow;
|
||||
|
@ -124,6 +122,7 @@ public:
|
|||
void DoFullscreen(bool bF);
|
||||
void ToggleDisplayMode (bool bFullscreen);
|
||||
void UpdateWiiMenuChoice(wxMenuItem *WiiMenuItem=nullptr);
|
||||
void PopulateSavedPerspectives();
|
||||
static void ConnectWiimote(int wm_idx, bool connect);
|
||||
|
||||
const CGameListCtrl *GetGameListCtrl() const;
|
||||
|
@ -138,10 +137,11 @@ public:
|
|||
X11Utils::XRRConfiguration *m_XRRConfig;
|
||||
#endif
|
||||
|
||||
wxMenu* m_SavedPerspectives;
|
||||
|
||||
wxToolBar *m_ToolBar, *m_ToolBarDebug;
|
||||
// AUI
|
||||
wxAuiManager *m_Mgr;
|
||||
wxAuiToolBar *m_ToolBarAui;
|
||||
bool bFloatWindow[IDM_CODEWINDOW - IDM_LOGWINDOW + 1];
|
||||
|
||||
// Perspectives (Should find a way to make all of this private)
|
||||
|
@ -197,7 +197,6 @@ private:
|
|||
wxBitmap m_BitmapsMenu[EToolbar_Max];
|
||||
|
||||
void PopulateToolbar(wxToolBar* toolBar);
|
||||
void PopulateToolbarAui(wxAuiToolBar* toolBar);
|
||||
void RecreateToolbar();
|
||||
void CreateMenu();
|
||||
|
||||
|
@ -222,7 +221,6 @@ private:
|
|||
void ShowResizePane();
|
||||
void TogglePane();
|
||||
void SetPaneSize();
|
||||
void ResetToolbarStyle();
|
||||
void TogglePaneStyle(bool On, int EventId);
|
||||
void ToggleNotebookStyle(bool On, long Style);
|
||||
// Float window
|
||||
|
@ -241,9 +239,7 @@ private:
|
|||
void OnPaneClose(wxAuiManagerEvent& evt);
|
||||
void ReloadPanes();
|
||||
void DoLoadPerspective();
|
||||
void OnDropDownToolbarSelect(wxCommandEvent& event);
|
||||
void OnDropDownSettingsToolbar(wxAuiToolBarEvent& event);
|
||||
void OnDropDownToolbarItem(wxAuiToolBarEvent& event);
|
||||
void OnPerspectiveMenu(wxCommandEvent& event);
|
||||
void OnSelectPerspective(wxCommandEvent& event);
|
||||
|
||||
#ifdef _WIN32
|
||||
|
@ -253,8 +249,6 @@ private:
|
|||
// Event functions
|
||||
void OnQuit(wxCommandEvent& event);
|
||||
void OnHelp(wxCommandEvent& event);
|
||||
void OnToolBar(wxCommandEvent& event);
|
||||
void OnAuiToolBar(wxAuiToolBarEvent& event);
|
||||
|
||||
void OnOpen(wxCommandEvent& event); // File menu
|
||||
void DoOpen(bool Boot);
|
||||
|
|
|
@ -475,94 +475,36 @@ void CFrame::DoAddPage(wxWindow *Win, int i, bool Float)
|
|||
Win->GetName(), Win);
|
||||
}
|
||||
|
||||
// Toolbar
|
||||
void CFrame::OnDropDownSettingsToolbar(wxAuiToolBarEvent& event)
|
||||
void CFrame::PopulateSavedPerspectives()
|
||||
{
|
||||
event.Skip();
|
||||
ClearStatusBar();
|
||||
// If the perspective submenu hasn't been created yet, return
|
||||
if (!m_SavedPerspectives) return;
|
||||
|
||||
if (event.IsDropDownClicked())
|
||||
// Delete all saved perspective menu items
|
||||
while (m_SavedPerspectives->GetMenuItemCount() != 0)
|
||||
{
|
||||
wxAuiToolBar* Tb = static_cast<wxAuiToolBar*>(event.GetEventObject());
|
||||
Tb->SetToolSticky(event.GetId(), true);
|
||||
|
||||
// Create the popup menu
|
||||
wxMenu* menuPopup = new wxMenu;
|
||||
|
||||
wxMenuItem* Item = new wxMenuItem(menuPopup, IDM_PERSPECTIVES_ADD_PANE,
|
||||
_("Add new pane"));
|
||||
menuPopup->Append(Item);
|
||||
menuPopup->Append(new wxMenuItem(menuPopup));
|
||||
Item = new wxMenuItem(menuPopup, IDM_TAB_SPLIT, _("Tab split"), "", wxITEM_CHECK);
|
||||
menuPopup->Append(Item);
|
||||
Item->Check(m_bTabSplit);
|
||||
Item = new wxMenuItem(menuPopup, IDM_NO_DOCKING, _("No docking"), "", wxITEM_CHECK);
|
||||
menuPopup->Append(Item);
|
||||
Item->Check(m_bNoDocking);
|
||||
|
||||
// Line up our menu with the button
|
||||
wxRect rect = Tb->GetToolRect(event.GetId());
|
||||
wxPoint Pt = Tb->ClientToScreen(rect.GetBottomLeft());
|
||||
Pt = ScreenToClient(Pt);
|
||||
|
||||
// Show
|
||||
PopupMenu(menuPopup, Pt);
|
||||
|
||||
// Make the button un-stuck again
|
||||
if (!m_bEdit)
|
||||
{
|
||||
Tb->SetToolSticky(event.GetId(), false);
|
||||
}
|
||||
// Delete the first menu item in the list (while there are menu items)
|
||||
m_SavedPerspectives->Delete(m_SavedPerspectives->FindItemByPosition(0));
|
||||
}
|
||||
}
|
||||
|
||||
void CFrame::OnDropDownToolbarItem(wxAuiToolBarEvent& event)
|
||||
{
|
||||
event.Skip();
|
||||
ClearStatusBar();
|
||||
|
||||
if (event.IsDropDownClicked())
|
||||
if (Perspectives.size() > 0)
|
||||
{
|
||||
wxAuiToolBar* tb = static_cast<wxAuiToolBar*>(event.GetEventObject());
|
||||
tb->SetToolSticky(event.GetId(), true);
|
||||
|
||||
// create the popup menu
|
||||
wxMenu* menuPopup = new wxMenu;
|
||||
wxMenuItem* Item = new wxMenuItem(menuPopup, IDM_ADD_PERSPECTIVE,
|
||||
_("Create new perspective"));
|
||||
menuPopup->Append(Item);
|
||||
|
||||
if (Perspectives.size() > 0)
|
||||
for (u32 i = 0; i < Perspectives.size(); i++)
|
||||
{
|
||||
menuPopup->Append(new wxMenuItem(menuPopup));
|
||||
for (u32 i = 0; i < Perspectives.size(); i++)
|
||||
wxMenuItem* mItem = new wxMenuItem(m_SavedPerspectives, IDM_PERSPECTIVES_0 + i,
|
||||
StrToWxStr(Perspectives[i].Name), "", wxITEM_CHECK);
|
||||
|
||||
m_SavedPerspectives->Append(mItem);
|
||||
|
||||
if (i == ActivePerspective)
|
||||
{
|
||||
wxMenuItem* mItem = new wxMenuItem(menuPopup, IDM_PERSPECTIVES_0 + i,
|
||||
StrToWxStr(Perspectives[i].Name), "", wxITEM_CHECK);
|
||||
|
||||
menuPopup->Append(mItem);
|
||||
|
||||
if (i == ActivePerspective)
|
||||
{
|
||||
mItem->Check(true);
|
||||
}
|
||||
mItem->Check(true);
|
||||
}
|
||||
}
|
||||
|
||||
// line up our menu with the button
|
||||
wxRect rect = tb->GetToolRect(event.GetId());
|
||||
wxPoint pt = tb->ClientToScreen(rect.GetBottomLeft());
|
||||
pt = ScreenToClient(pt);
|
||||
|
||||
// show
|
||||
PopupMenu(menuPopup, pt);
|
||||
|
||||
// make sure the button is "un-stuck"
|
||||
tb->SetToolSticky(event.GetId(), false);
|
||||
}
|
||||
}
|
||||
|
||||
void CFrame::OnToolBar(wxCommandEvent& event)
|
||||
void CFrame::OnPerspectiveMenu(wxCommandEvent& event)
|
||||
{
|
||||
ClearStatusBar();
|
||||
|
||||
|
@ -583,19 +525,9 @@ void CFrame::OnToolBar(wxCommandEvent& event)
|
|||
AddPane();
|
||||
break;
|
||||
case IDM_EDIT_PERSPECTIVES:
|
||||
m_bEdit = !m_bEdit;
|
||||
m_ToolBarAui->SetToolSticky(IDM_EDIT_PERSPECTIVES, m_bEdit);
|
||||
m_bEdit = event.IsChecked();
|
||||
TogglePaneStyle(m_bEdit, IDM_EDIT_PERSPECTIVES);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void CFrame::OnDropDownToolbarSelect(wxCommandEvent& event)
|
||||
{
|
||||
ClearStatusBar();
|
||||
|
||||
switch (event.GetId())
|
||||
{
|
||||
case IDM_ADD_PERSPECTIVE:
|
||||
{
|
||||
wxTextEntryDialog dlg(this,
|
||||
|
@ -643,6 +575,7 @@ void CFrame::OnDropDownToolbarSelect(wxCommandEvent& event)
|
|||
Perspectives.push_back(Tmp);
|
||||
|
||||
UpdateCurrentPerspective();
|
||||
PopulateSavedPerspectives();
|
||||
}
|
||||
break;
|
||||
case IDM_TAB_SPLIT:
|
||||
|
@ -656,26 +589,6 @@ void CFrame::OnDropDownToolbarSelect(wxCommandEvent& event)
|
|||
}
|
||||
}
|
||||
|
||||
void CFrame::ResetToolbarStyle()
|
||||
{
|
||||
wxAuiPaneInfoArray& AllPanes = m_Mgr->GetAllPanes();
|
||||
for (int i = 0, Count = (int)AllPanes.GetCount(); i < Count; ++i)
|
||||
{
|
||||
wxAuiPaneInfo& Pane = AllPanes[i];
|
||||
if (Pane.window->IsKindOf(CLASSINFO(wxAuiToolBar)))
|
||||
{
|
||||
Pane.Show();
|
||||
|
||||
// Show all of it
|
||||
if (Pane.rect.GetLeft() > GetClientSize().GetX() - 50)
|
||||
{
|
||||
Pane.Position(GetClientSize().GetX() - Pane.window->GetClientSize().GetX());
|
||||
}
|
||||
}
|
||||
}
|
||||
m_Mgr->Update();
|
||||
}
|
||||
|
||||
void CFrame::TogglePaneStyle(bool On, int EventId)
|
||||
{
|
||||
wxAuiPaneInfoArray& AllPanes = m_Mgr->GetAllPanes();
|
||||
|
@ -798,8 +711,6 @@ void CFrame::ReloadPanes()
|
|||
|
||||
// Perspectives
|
||||
m_Mgr->LoadPerspective(Perspectives[ActivePerspective].Perspective, false);
|
||||
// Reset toolbars
|
||||
ResetToolbarStyle();
|
||||
// Restore settings
|
||||
TogglePaneStyle(m_bNoDocking, IDM_NO_DOCKING);
|
||||
TogglePaneStyle(m_bEdit, IDM_EDIT_PERSPECTIVES);
|
||||
|
@ -809,6 +720,9 @@ void CFrame::ReloadPanes()
|
|||
// Open notebook pages
|
||||
AddRemoveBlankPage();
|
||||
g_pCodeWindow->OpenPages();
|
||||
|
||||
// Repopulate perspectives
|
||||
PopulateSavedPerspectives();
|
||||
}
|
||||
|
||||
void CFrame::DoLoadPerspective()
|
||||
|
|
|
@ -41,7 +41,6 @@ Core::GetWindowHandle().
|
|||
#include <wx/translation.h>
|
||||
#include <wx/utils.h>
|
||||
#include <wx/window.h>
|
||||
#include <wx/aui/auibar.h>
|
||||
#include <wx/aui/framemanager.h>
|
||||
|
||||
#ifdef __APPLE__
|
||||
|
@ -529,21 +528,6 @@ void CFrame::PopulateToolbar(wxToolBar* ToolBar)
|
|||
ToolBar->Realize();
|
||||
}
|
||||
|
||||
void CFrame::PopulateToolbarAui(wxAuiToolBar* ToolBar)
|
||||
{
|
||||
int w = m_Bitmaps[Toolbar_FileOpen].GetWidth(),
|
||||
h = m_Bitmaps[Toolbar_FileOpen].GetHeight();
|
||||
ToolBar->SetToolBitmapSize(wxSize(w, h));
|
||||
|
||||
ToolBar->AddTool(IDM_SAVE_PERSPECTIVE, _("Save"), g_pCodeWindow->m_Bitmaps[Toolbar_GotoPC], _("Save current perspective"));
|
||||
ToolBar->AddTool(IDM_EDIT_PERSPECTIVES, _("Edit"), g_pCodeWindow->m_Bitmaps[Toolbar_GotoPC], _("Edit current perspective"));
|
||||
|
||||
ToolBar->SetToolDropDown(IDM_SAVE_PERSPECTIVE, true);
|
||||
ToolBar->SetToolDropDown(IDM_EDIT_PERSPECTIVES, true);
|
||||
|
||||
ToolBar->Realize();
|
||||
}
|
||||
|
||||
|
||||
// Delete and recreate the toolbar
|
||||
void CFrame::RecreateToolbar()
|
||||
|
@ -554,24 +538,18 @@ void CFrame::RecreateToolbar()
|
|||
m_ToolBar->Destroy();
|
||||
}
|
||||
|
||||
long TOOLBAR_STYLE = wxAUI_TB_PLAIN_BACKGROUND | wxAUI_TB_TEXT /*wxAUI_TB_OVERFLOW overflow visible*/;
|
||||
|
||||
m_ToolBar = CreateToolBar(TOOLBAR_STYLE, wxID_ANY, "TBMain");
|
||||
PopulateToolbar(m_ToolBar);
|
||||
long TOOLBAR_STYLE = wxTB_DEFAULT_STYLE | wxTB_TEXT;
|
||||
|
||||
if (g_pCodeWindow && !m_ToolBarDebug)
|
||||
{
|
||||
m_ToolBarDebug = CreateToolBar(TOOLBAR_STYLE, wxID_ANY, "TBDebug");
|
||||
g_pCodeWindow->PopulateToolbar(m_ToolBarDebug);
|
||||
|
||||
m_ToolBarAui = new wxAuiToolBar(this, ID_TOOLBAR_AUI, wxDefaultPosition, wxDefaultSize, TOOLBAR_STYLE);
|
||||
PopulateToolbarAui(m_ToolBarAui);
|
||||
m_Mgr->AddPane(m_ToolBarAui, wxAuiPaneInfo().
|
||||
Name("TBAui").Caption("TBAui").
|
||||
ToolbarPane().Top().
|
||||
LeftDockable(false).RightDockable(false).Floatable(false));
|
||||
m_ToolBarDebug->AddSeparator();
|
||||
}
|
||||
|
||||
m_ToolBar = CreateToolBar(TOOLBAR_STYLE, wxID_ANY, "TBMain");
|
||||
PopulateToolbar(m_ToolBar);
|
||||
|
||||
UpdateGUI();
|
||||
}
|
||||
|
||||
|
@ -1893,20 +1871,6 @@ void CFrame::OnToggleToolbar(wxCommandEvent& event)
|
|||
void CFrame::DoToggleToolbar(bool _show)
|
||||
{
|
||||
GetToolBar()->Show(_show);
|
||||
|
||||
if (g_pCodeWindow)
|
||||
{
|
||||
if (_show)
|
||||
{
|
||||
m_Mgr->GetPane("TBAui").Show();
|
||||
}
|
||||
else
|
||||
{
|
||||
m_Mgr->GetPane("TBAui").Hide();
|
||||
}
|
||||
}
|
||||
|
||||
m_Mgr->Update();
|
||||
}
|
||||
|
||||
// Enable and disable the status bar
|
||||
|
|
Loading…
Reference in New Issue