mirror of
https://github.com/amyinspace/MagicSetEditor2.git
synced 2026-06-12 05:36:59 -04:00
Fix: separate menu for export from toolbar
This commit is contained in:
+14
-7
@@ -62,12 +62,7 @@ SetWindow::SetWindow(Window* parent, const SetP& set)
|
|||||||
menuFile->Append(ID_FILE_OPEN, _("open"), _MENU_("open set"), _HELP_("open set"));
|
menuFile->Append(ID_FILE_OPEN, _("open"), _MENU_("open set"), _HELP_("open set"));
|
||||||
menuFile->Append(ID_FILE_SAVE, _("save"), _MENU_("save set"), _HELP_("save set"));
|
menuFile->Append(ID_FILE_SAVE, _("save"), _MENU_("save set"), _HELP_("save set"));
|
||||||
menuFile->Append(ID_FILE_SAVE_AS, _MENU_("save set as"), _HELP_("save set as"));
|
menuFile->Append(ID_FILE_SAVE_AS, _MENU_("save set as"), _HELP_("save set as"));
|
||||||
menuExport = new IconMenu();
|
IconMenu* menuExport = makeExportMenu();
|
||||||
menuExport->Append(ID_FILE_EXPORT_HTML, _("export_html"), _MENU_("export html"), _HELP_("export html"));
|
|
||||||
menuExport->Append(ID_FILE_EXPORT_IMAGE, _("export_image"), _MENU_("export image"), _HELP_("export image"));
|
|
||||||
menuExport->Append(ID_FILE_EXPORT_IMAGES, _("export_images"), _MENU_("export images"), _HELP_("export images"));
|
|
||||||
menuExport->Append(ID_FILE_EXPORT_APPR, _("export_apprentice"), _MENU_("export apprentice"),_HELP_("export apprentice"));
|
|
||||||
menuExport->Append(ID_FILE_EXPORT_MWS, _("export_mws"), _MENU_("export mws"), _HELP_("export mws"));
|
|
||||||
menuFile->Append(wxID_ANY, _("export"), _MENU_("export"), _HELP_("export"), wxITEM_NORMAL, menuExport);
|
menuFile->Append(wxID_ANY, _("export"), _MENU_("export"), _HELP_("export"), wxITEM_NORMAL, menuExport);
|
||||||
menuFile->AppendSeparator();
|
menuFile->AppendSeparator();
|
||||||
menuFile->Append(ID_FILE_CHECK_UPDATES, _MENU_("check updates"), _HELP_("check updates"));
|
menuFile->Append(ID_FILE_CHECK_UPDATES, _MENU_("check updates"), _HELP_("check updates"));
|
||||||
@@ -187,6 +182,16 @@ SetWindow::SetWindow(Window* parent, const SetP& set)
|
|||||||
current_panel->Layout();
|
current_panel->Layout();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
IconMenu* SetWindow::makeExportMenu() {
|
||||||
|
IconMenu* menuExport = new IconMenu();
|
||||||
|
menuExport->Append(ID_FILE_EXPORT_HTML, _("export_html"), _MENU_("export html"), _HELP_("export html"));
|
||||||
|
menuExport->Append(ID_FILE_EXPORT_IMAGE, _("export_image"), _MENU_("export image"), _HELP_("export image"));
|
||||||
|
menuExport->Append(ID_FILE_EXPORT_IMAGES, _("export_images"), _MENU_("export images"), _HELP_("export images"));
|
||||||
|
menuExport->Append(ID_FILE_EXPORT_APPR, _("export_apprentice"), _MENU_("export apprentice"), _HELP_("export apprentice"));
|
||||||
|
menuExport->Append(ID_FILE_EXPORT_MWS, _("export_mws"), _MENU_("export mws"), _HELP_("export mws"));
|
||||||
|
return menuExport;
|
||||||
|
}
|
||||||
|
|
||||||
SetWindow::~SetWindow() {
|
SetWindow::~SetWindow() {
|
||||||
// store window size in settings
|
// store window size in settings
|
||||||
wxSize s = GetSize();
|
wxSize s = GetSize();
|
||||||
@@ -199,6 +204,7 @@ SetWindow::~SetWindow() {
|
|||||||
current_panel->destroyUI(GetToolBar(), GetMenuBar());
|
current_panel->destroyUI(GetToolBar(), GetMenuBar());
|
||||||
// cleanup (see find stuff)
|
// cleanup (see find stuff)
|
||||||
delete find_dialog;
|
delete find_dialog;
|
||||||
|
delete export_menu;
|
||||||
// remove from list of set windows
|
// remove from list of set windows
|
||||||
set_windows.erase(remove(set_windows.begin(), set_windows.end(), this));
|
set_windows.erase(remove(set_windows.begin(), set_windows.end(), this));
|
||||||
}
|
}
|
||||||
@@ -622,7 +628,8 @@ void SetWindow::onFileExportMenu(wxCommandEvent& ev) {
|
|||||||
// tool down
|
// tool down
|
||||||
tb->ToggleTool(ev.GetId(), true);
|
tb->ToggleTool(ev.GetId(), true);
|
||||||
// pop up a menu of export options
|
// pop up a menu of export options
|
||||||
tb->PopupMenu(menuExport, tool_rect.x, tool_rect.GetBottom());
|
if (!export_menu) export_menu = makeExportMenu();
|
||||||
|
tb->PopupMenu(export_menu, tool_rect.x, tool_rect.GetBottom());
|
||||||
// tool up
|
// tool up
|
||||||
tb->ToggleTool(ev.GetId(), false);
|
tb->ToggleTool(ev.GetId(), false);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ struct CardSelectEvent;
|
|||||||
/** This window consists of several panels, only one panel is visible at a time.
|
/** This window consists of several panels, only one panel is visible at a time.
|
||||||
*/
|
*/
|
||||||
class SetWindow : public wxFrame, public SetView {
|
class SetWindow : public wxFrame, public SetView {
|
||||||
public:
|
public:
|
||||||
/// Construct a SetWindow
|
/// Construct a SetWindow
|
||||||
SetWindow(Window* parent, const SetP& set);
|
SetWindow(Window* parent, const SetP& set);
|
||||||
~SetWindow();
|
~SetWindow();
|
||||||
@@ -35,7 +35,7 @@ class SetWindow : public wxFrame, public SetView {
|
|||||||
|
|
||||||
// --------------------------------------------------- : Set actions
|
// --------------------------------------------------- : Set actions
|
||||||
|
|
||||||
private:
|
private:
|
||||||
DECLARE_EVENT_TABLE();
|
DECLARE_EVENT_TABLE();
|
||||||
|
|
||||||
// --------------------------------------------------- : Data
|
// --------------------------------------------------- : Data
|
||||||
@@ -43,7 +43,7 @@ class SetWindow : public wxFrame, public SetView {
|
|||||||
// gui items
|
// gui items
|
||||||
vector<SetWindowPanel*> panels; ///< All panels on this window
|
vector<SetWindowPanel*> panels; ///< All panels on this window
|
||||||
SetWindowPanel* current_panel;
|
SetWindowPanel* current_panel;
|
||||||
IconMenu* menuExport;
|
IconMenu* export_menu = nullptr;
|
||||||
|
|
||||||
/// Number of items in the recent sets list
|
/// Number of items in the recent sets list
|
||||||
size_t number_of_recentSets;
|
size_t number_of_recentSets;
|
||||||
@@ -80,11 +80,11 @@ class SetWindow : public wxFrame, public SetView {
|
|||||||
/// Actions that change the set
|
/// Actions that change the set
|
||||||
virtual void onAction(const Action&, bool undone);
|
virtual void onAction(const Action&, bool undone);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
// minSize = mainSizer->getMinWindowSize(this)
|
// minSize = mainSizer->getMinWindowSize(this)
|
||||||
// but wx made that private
|
// but wx made that private
|
||||||
void fixMinWindowSize();
|
void fixMinWindowSize();
|
||||||
private:
|
private:
|
||||||
/// Update the window title based on the set name
|
/// Update the window title based on the set name
|
||||||
void updateTitle();
|
void updateTitle();
|
||||||
|
|
||||||
@@ -114,6 +114,8 @@ class SetWindow : public wxFrame, public SetView {
|
|||||||
UInt number_of_recent_sets;
|
UInt number_of_recent_sets;
|
||||||
void updateRecentSets();
|
void updateRecentSets();
|
||||||
|
|
||||||
|
IconMenu* makeExportMenu();
|
||||||
|
|
||||||
// --------------------------------------------------- : Window events - menu - file
|
// --------------------------------------------------- : Window events - menu - file
|
||||||
void onFileNew (wxCommandEvent&);
|
void onFileNew (wxCommandEvent&);
|
||||||
void onFileOpen (wxCommandEvent&);
|
void onFileOpen (wxCommandEvent&);
|
||||||
|
|||||||
Reference in New Issue
Block a user