Commit e20e0627 authored by twanvl's avatar twanvl

added SetWindow (formerly MainWindow)

parent 70ac30cc
...@@ -64,7 +64,7 @@ void IconMenu::Append(int id, const String& text, const String& help) { ...@@ -64,7 +64,7 @@ void IconMenu::Append(int id, const String& text, const String& help) {
wxMenu::Append(item); wxMenu::Append(item);
} }
void IconMenu::Append(int id, const String& text, wxMenu* submenu, const String& help) { void IconMenu::Append(int id, const String& text, const String& help, wxMenu* submenu) {
wxMenuItem* item = new wxMenuItem (this, id, text, help, wxITEM_NORMAL, submenu); wxMenuItem* item = new wxMenuItem (this, id, text, help, wxITEM_NORMAL, submenu);
item->SetBitmap(wxNullBitmap); item->SetBitmap(wxNullBitmap);
wxMenu::Append(item); wxMenu::Append(item);
......
...@@ -26,7 +26,7 @@ class IconMenu : public wxMenu { ...@@ -26,7 +26,7 @@ class IconMenu : public wxMenu {
/// Append a menu item, without an image /// Append a menu item, without an image
void Append(int id, const String& text, const String& help); void Append(int id, const String& text, const String& help);
/// Append a menu item, without an image /// Append a menu item, without an image
void Append(int id, const String& text, wxMenu* submenu, const String& help); void Append(int id, const String& text, const String& help, wxMenu* submenu);
/// Insert a menu item, without an image /// Insert a menu item, without an image
void Insert(size_t pos, int id, const String& text, const String& help); void Insert(size_t pos, int id, const String& text, const String& help);
}; };
......
//+----------------------------------------------------------------------------+
//| Description: Magic Set Editor - Program to make Magic (tm) cards |
//| Copyright: (C) 2001 - 2006 Twan van Laarhoven |
//| License: GNU General Public License 2 or later (see file COPYING) |
//+----------------------------------------------------------------------------+
// ----------------------------------------------------------------------------- : Includes
#include <gui/set/cards_panel.hpp>
// ----------------------------------------------------------------------------- :
//+----------------------------------------------------------------------------+
//| Description: Magic Set Editor - Program to make Magic (tm) cards |
//| Copyright: (C) 2001 - 2006 Twan van Laarhoven |
//| License: GNU General Public License 2 or later (see file COPYING) |
//+----------------------------------------------------------------------------+
#ifndef HEADER_GUI_SET_CARDS_PANEL
#define HEADER_GUI_SET_CARDS_PANEL
// ----------------------------------------------------------------------------- : Includes
#include <util/prec.hpp>
#include <gui/set/panel.hpp>
// ----------------------------------------------------------------------------- : CardsPanel
/// A card list and card editor panel
class CardsPanel : public SetWindowPanel {
public:
CardsPanel(Window* parent, int id);
~CardsPanel();
void onSetChange();
// --------------------------------------------------- : Meta information
virtual String shortName();
virtual String longName();
virtual String description();
// --------------------------------------------------- : UI
virtual void initUI (wxToolBar* tb, wxMenuBar* mb);
virtual void destroyUI(wxToolBar* tb, wxMenuBar* mb);
virtual void onUpdateUI(wxUpdateUIEvent& e);
virtual void onCommand(int id);
// --------------------------------------------------- : Actions
virtual bool wantsToHandle(const Action&);
virtual void onAction(const Action&);
virtual void onRenderSettingsChange();
private:
void updateSize();
public:
// --------------------------------------------------- : Clipboard
virtual bool canCut();
virtual bool canCopy();
virtual bool canPaste();
virtual void doCut();
virtual void doCopy();
virtual void doPaste();
// --------------------------------------------------- : Searching (find/replace)
virtual bool canFind();
virtual bool canReplace();
virtual bool doFind(wxFindReplaceData& what);
virtual bool doReplace(wxFindReplaceData& what);
private:
// Functions that handle finding
/*
typedef void (CardsPanel::*FindHandler)(const CardP&, const TextValueP&, const size_t, const size_t, wxFindReplaceData&);
/// Execute a find (or replace), and start with the currently selected card and value
/** if findSame==true then find will also find the currently highlighted word
* Returns true if found
* /
bool find(FindReplaceData& what, const FindHandler& handler, bool findSame = false);
/// find handler : select found value
void handleFind(const CardP& card, const TextValueP& value, size_t start, size_t end, FindReplaceData& what);
/// replace handler : replace found value, move selection to end
void handleReplace(const CardP& card, const TextValueP& value, size_t start, size_t end, FindReplaceData& what);
/// Find in all cards
/** NOTE: this function is essentially the same as findInCard * /
bool findInCards(const CardP& firstCard, const ValueP& firstValue, int firstChar, FindReplaceData& what, const FindHandler& handler);
/// Find in a card, if firstValue is specified start searching there
/** NOTE: this function is essentially the same as findInCards * /
bool findInCard(const CardP& card, const ValueP& firstValue, int firstChar, FindReplaceData& what, const FindHandler& handler);
/// Find the current search string in the specified value
/** if searchDir = up searches from the end and only before firstChar, unless firstChar == -1 * /
bool findInValue(const CardP& crd_, virtual const ValueP& value, int firstChar, FindReplaceData& what, const FindHandler& handler);
*/
public:
// --------------------------------------------------- : Selection
virtual CardP selectedCard();
virtual void selectCard(const CardP& card);
private:
// --------------------------------------------------- : Controls
// wxSplitterWindow* splitter;
// Editor* editor;
// EditCardList* cardList;
// DataTextCtrl* notes;
// --------------------------------------------------- : Menus & tools
wxMenu* cardMenu, formatMenu;
};
// ----------------------------------------------------------------------------- : EOF
#endif
//+----------------------------------------------------------------------------+
//| Description: Magic Set Editor - Program to make Magic (tm) cards |
//| Copyright: (C) 2001 - 2006 Twan van Laarhoven |
//| License: GNU General Public License 2 or later (see file COPYING) |
//+----------------------------------------------------------------------------+
#ifndef HEADER_GUI_SET_PANEL
#define HEADER_GUI_SET_PANEL
// ----------------------------------------------------------------------------- : Includes
#include <util/prec.hpp>
#include <data/set.hpp>
class wxFindReplaceData;
// ----------------------------------------------------------------------------- : SetWindowPanel
/// A panel that is one of the panels in the set window.
/** This class is a virtual base class for all actual panels used in the set window.
*/
class SetWindowPanel : public wxPanel, public SetView {
public:
SetWindowPanel(Window* parent, int id, bool autoTabbing = false);
/// We will probably want to respond to set changes
virtual void onSetChange();
// --------------------------------------------------- : Meta information
virtual String shortName() { return _("<undefined>"); } ///< for tab bar
virtual String longName() { return shortName(); } ///< for menu
virtual String description() { return _("<undefined>"); } ///< for status bar
virtual String helpFile() { return _(""); } ///< help file to use when this panel is active
// --------------------------------------------------- : UI
/// Init extra toolbar items and menus needed for this panel.
virtual void initUI (wxToolBar* tb, wxMenuBar* mb) {}
/// Destroy the extra items added by initUI.
virtual void destroyUI(wxToolBar* tb, wxMenuBar* mb) {}
/// Update the UI by enabling/disabling items.
/** Note: copy/paste and find/replace are not handled here.
*/
virtual void onUpdateUI(wxUpdateUIEvent& e) {}
/// Respond to one of those extra menu/tool items
virtual void onCommand(int id) {}
// --------------------------------------------------- : Actions/Events
/// Should return true if this panel wants to get focus to show an action
virtual bool wantsToHandle(const Action&) { return false; }
/// The settings for rendering cards have changed, refresh card viewers/editors
virtual void onRenderSettingsChange() {}
// --------------------------------------------------- : Clipboard
virtual bool canPaste() { return false; } ///< Is pasting possible?
virtual bool canCopy() { return false; } ///< Is copying possible?
virtual bool canCut() { return canCopy(); } ///< Is cutting possible?
virtual void doPaste() {} ///< Paste the contents of the clipboard
virtual void doCopy() {} ///< Copy the selection to the clipboard
virtual void doCut() {} ///< Cut the selection to the clipboard
// --------------------------------------------------- : Searching (find/replace)
virtual bool canFind() { return false; } ///< Is finding possible?
virtual bool canReplace() { return false; } ///< Is replacing possible?
virtual bool doFind(wxFindReplaceData&) { return false; } ///< Find the next math
virtual bool doReplace(wxFindReplaceData&) { return false; } ///< Replace the next match
// --------------------------------------------------- : Selection
virtual CardP selectedCard() { return CardP(); } ///< Return the currently selected card, or CardP()
virtual void selectCard(CardP card) {} ///< Switch the view to another card
protected:
// --------------------------------------------------- : Helper functions for UI
/// Enable/disable a tool or menu item
// void enable(wxToolBar* tb, wxMenuBar* mb, int id, bool enable);
// mb->Enable(id, enable)
// tb->EnableTool(id, enable)
/// Id of the control that has the focus, or -1 if no control has the focus
int focusedControl();
// Window* focusedWindow = findFocus()
// // is this window actually inside this panel?
// if focusedWindow && findWindowById(focusedWindow->id, &this) == focusedWindow
// return focusedWindow->id
// else
// return -1 // no window has the focus, or it has a different parent/ancestor
};
// ----------------------------------------------------------------------------- : EOF
#endif
//+----------------------------------------------------------------------------+
//| Description: Magic Set Editor - Program to make Magic (tm) cards |
//| Copyright: (C) 2001 - 2006 Twan van Laarhoven |
//| License: GNU General Public License 2 or later (see file COPYING) |
//+----------------------------------------------------------------------------+
// ----------------------------------------------------------------------------- : Includes
#include <gui/set/set_info_panel.hpp>
// ----------------------------------------------------------------------------- :
//+----------------------------------------------------------------------------+
//| Description: Magic Set Editor - Program to make Magic (tm) cards |
//| Copyright: (C) 2001 - 2006 Twan van Laarhoven |
//| License: GNU General Public License 2 or later (see file COPYING) |
//+----------------------------------------------------------------------------+
#ifndef HEADER_GUI_SET_SET_INFO_PANEL
#define HEADER_GUI_SET_SET_INFO_PANEL
// ----------------------------------------------------------------------------- : Includes
#include <util/prec.hpp>
// ----------------------------------------------------------------------------- :
// ----------------------------------------------------------------------------- : EOF
#endif
//+----------------------------------------------------------------------------+
//| Description: Magic Set Editor - Program to make Magic (tm) cards |
//| Copyright: (C) 2001 - 2006 Twan van Laarhoven |
//| License: GNU General Public License 2 or later (see file COPYING) |
//+----------------------------------------------------------------------------+
// ----------------------------------------------------------------------------- : Includes
#include <gui/set/stats_panel.hpp>
// ----------------------------------------------------------------------------- : StatsPanel
//+----------------------------------------------------------------------------+
//| Description: Magic Set Editor - Program to make Magic (tm) cards |
//| Copyright: (C) 2001 - 2006 Twan van Laarhoven |
//| License: GNU General Public License 2 or later (see file COPYING) |
//+----------------------------------------------------------------------------+
#ifndef HEADER_GUI_SET_STATS_PANEL
#define HEADER_GUI_SET_STATS_PANEL
// ----------------------------------------------------------------------------- : Includes
#include <util/prec.hpp>
#include <gui/set/panel.hpp>
// ----------------------------------------------------------------------------- : StatsPanel
// ----------------------------------------------------------------------------- : EOF
#endif
//+----------------------------------------------------------------------------+
//| Description: Magic Set Editor - Program to make Magic (tm) cards |
//| Copyright: (C) 2001 - 2006 Twan van Laarhoven |
//| License: GNU General Public License 2 or later (see file COPYING) |
//+----------------------------------------------------------------------------+
// ----------------------------------------------------------------------------- : Includes
#include <gui/set/style_panel.hpp>
// ----------------------------------------------------------------------------- :
//+----------------------------------------------------------------------------+
//| Description: Magic Set Editor - Program to make Magic (tm) cards |
//| Copyright: (C) 2001 - 2006 Twan van Laarhoven |
//| License: GNU General Public License 2 or later (see file COPYING) |
//+----------------------------------------------------------------------------+
#ifndef HEADER_GUI_SET_STYLE_PANEL
#define HEADER_GUI_SET_STYLE_PANEL
// ----------------------------------------------------------------------------- : Includes
#include <util/prec.hpp>
// ----------------------------------------------------------------------------- :
// ----------------------------------------------------------------------------- : EOF
#endif
This diff is collapsed.
//+----------------------------------------------------------------------------+
//| Description: Magic Set Editor - Program to make Magic (tm) cards |
//| Copyright: (C) 2001 - 2006 Twan van Laarhoven |
//| License: GNU General Public License 2 or later (see file COPYING) |
//+----------------------------------------------------------------------------+
#ifndef HEADER_GUI_SET_WINDOW
#define HEADER_GUI_SET_WINDOW
// ----------------------------------------------------------------------------- : Includes
#include <util/prec.hpp>
#include <data/set.hpp>
#include <wx/fdrepdlg.h>
class IconMenu;
class SetWindowPanel;
class wxFindDialogEvent;
// ----------------------------------------------------------------------------- : SetWindow
/// The main window of MSE, used for editing Sets.
/** This window consists of several panels, only one panel is visible at a time.
*/
class SetWindow : public wxFrame, public SetView {
public:
/// Construct a SetWindow
SetWindow(Window* parent);
~SetWindow();
// --------------------------------------------------- : Set actions
private:
DECLARE_EVENT_TABLE();
// --------------------------------------------------- : Data
// keep scripts up to date
// ScriptUpdater scriptUpdater;
// Timer timer;
// gui items
vector<SetWindowPanel*> panels; ///< All panels on this window
SetWindowPanel* currentPanel;
/// Number of items in the recent sets list
size_t numberOfRecentSets;
// data for find/replace
wxDialog* findDialog;
wxFindReplaceData findData;
// --------------------------------------------------- : Panel managment
/// Add a panel to the window, as well as to the menu and tab bar
/** The position only determines the order in which events will be send.
*/
void addPanel(wxMenu* windowMenu, wxToolBar* tabBar, SetWindowPanel* panel, UInt pos, const String& shortcut);
/// Select a panel, based on a tab id
void selectPanel(int id);
// --------------------------------------------------- : Managing multiple main windows
/// All opened main windows
static vector<SetWindow*> setWindows;
/// Is this the first window that has this set?
/** The first window is considered the owner in many cases */
bool isFirstWithSet();
/// Is this the only window that has this set?
bool isOnlyWithSet();
// --------------------------------------------------- : Action related
protected:
/// We want to respond to set changes
virtual void onBeforeChangeSet();
/// We want to respond to set changes
virtual void onChangeSet();
/// Actions that change the set
virtual void onAction(const Action&);
private:
/// A different card has been selected
void onCardSelect(wxCommandEvent&);
/// Render settings have changed (because of editing of preferences)
void onRenderSettingsChange();
// minSize = mainSizer->getMinWindowSize(this)
// but wx made that private
void fixMinWindowSize();
// --------------------------------------------------- : Window events - close
/// Ask the user to save the set
void onClose(wxCloseEvent&);
/// Ask if the user wants to save the set
/** Returns true if the action can be continued (the set was saved, or need not be saved)
* Returns false if the action should be canceled (user pressed cancel, or save failed)
*/
bool askSaveAndContinue();
// --------------------------------------------------- : Window events - update UI
void onUpdateUI(wxUpdateUIEvent&);
// --------------------------------------------------- : Window events - menu - file
void onFileNew (wxCommandEvent&);
void onFileOpen (wxCommandEvent&);
void onFileSave (wxCommandEvent&);
void onFileSaveAs (wxCommandEvent&);
// void onFileInspect (wxCommandEvent&);
void onFileExportImage (wxCommandEvent&);
void onFileExportImages (wxCommandEvent&);
void onFileExportHTML (wxCommandEvent&);
void onFileExportApprentice(wxCommandEvent&);
void onFileExportMWS (wxCommandEvent&);
void onFilePrint (wxCommandEvent&);
void onFilePrintPreview (wxCommandEvent&);
void onFileRecent (wxCommandEvent&);
void onFileExit (wxCommandEvent&);
// --------------------------------------------------- : Window events - menu - edit
void onEditUndo (wxCommandEvent&);
void onEditRedo (wxCommandEvent&);
void onEditCut (wxCommandEvent&);
void onEditCopy (wxCommandEvent&);
void onEditPaste (wxCommandEvent&);
void onEditFind (wxCommandEvent&);
void onEditFindNext (wxCommandEvent&);
void onEditReplace (wxCommandEvent&);
void onEditPreferences (wxCommandEvent&);
void onFind (wxFindDialogEvent&);
void onFindNext (wxFindDialogEvent&);
void onReplace (wxFindDialogEvent&);
void onReplaceAll (wxFindDialogEvent&);
// --------------------------------------------------- : Window events - menu - window
void onWindowNewWindow (wxCommandEvent&);
void onWindowSelect (wxCommandEvent&);
// --------------------------------------------------- : Window events - menu - help
void onHelpIndex (wxCommandEvent&);
void onHelpAbout (wxCommandEvent&);
// --------------------------------------------------- : Window events - menu - for child panel
void onChildMenu (wxCommandEvent&);
};
// ----------------------------------------------------------------------------- : EOF
#endif
...@@ -44,7 +44,7 @@ class SymbolEditorBase { ...@@ -44,7 +44,7 @@ class SymbolEditorBase {
// --------------------------------------------------- : UI // --------------------------------------------------- : UI
/// Init extra toolbar items and menus needed for this editor /// Init extra toolbar items and menus needed for this editor
virtual void initUI(wxToolBar* tb, wxMenuBar* mb) {} virtual void initUI (wxToolBar* tb, wxMenuBar* mb) {}
/// Destroy the extra items added by initUI. /// Destroy the extra items added by initUI.
virtual void destroyUI(wxToolBar* tb, wxMenuBar* mb) {} virtual void destroyUI(wxToolBar* tb, wxMenuBar* mb) {}
/// Update the UI by enabling/disabling items /// Update the UI by enabling/disabling items
......
...@@ -13,6 +13,8 @@ ...@@ -13,6 +13,8 @@
#include <util/window_id.hpp> #include <util/window_id.hpp>
#include <util/error.hpp> #include <util/error.hpp>
DECLARE_TYPEOF_COLLECTION(ControlPointP);
// ----------------------------------------------------------------------------- : SymbolPointEditor // ----------------------------------------------------------------------------- : SymbolPointEditor
SymbolPointEditor::SymbolPointEditor(SymbolControl* control, const SymbolPartP& part) SymbolPointEditor::SymbolPointEditor(SymbolControl* control, const SymbolPartP& part)
......
...@@ -57,7 +57,7 @@ class SymbolPointEditor : public SymbolEditorBase { ...@@ -57,7 +57,7 @@ class SymbolPointEditor : public SymbolEditorBase {
public: public:
// --------------------------------------------------- : UI // --------------------------------------------------- : UI
virtual void initUI(wxToolBar* tb, wxMenuBar* mb); virtual void initUI (wxToolBar* tb, wxMenuBar* mb);
virtual void destroyUI(wxToolBar* tb, wxMenuBar* mb); virtual void destroyUI(wxToolBar* tb, wxMenuBar* mb);
virtual void onUpdateUI(wxUpdateUIEvent& e); virtual void onUpdateUI(wxUpdateUIEvent& e);
virtual void onCommand(int id); virtual void onCommand(int id);
......
...@@ -13,6 +13,8 @@ ...@@ -13,6 +13,8 @@
#include <data/action/symbol.hpp> #include <data/action/symbol.hpp>
#include <gfx/gfx.hpp> #include <gfx/gfx.hpp>
DECLARE_TYPEOF_COLLECTION(SymbolPartP);
// ----------------------------------------------------------------------------- : SymbolSelectEditor // ----------------------------------------------------------------------------- : SymbolSelectEditor
SymbolSelectEditor::SymbolSelectEditor(SymbolControl* control, bool rotate) SymbolSelectEditor::SymbolSelectEditor(SymbolControl* control, bool rotate)
......
...@@ -8,6 +8,8 @@ ...@@ -8,6 +8,8 @@
#include <gui/symbol/viewer.hpp> #include <gui/symbol/viewer.hpp>
DECLARE_TYPEOF_COLLECTION(SymbolPartP);
// ----------------------------------------------------------------------------- : Constructor // ----------------------------------------------------------------------------- : Constructor
SymbolViewer::SymbolViewer(const SymbolP& symbol, double borderRadius) SymbolViewer::SymbolViewer(const SymbolP& symbol, double borderRadius)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment