mirror of
https://github.com/amyinspace/MagicSetEditor2.git
synced 2026-06-12 05:36:59 -04:00
initial checkin of C++ port (in progress)
git-svn-id: svn://svn.code.sf.net/p/magicseteditor/code/trunk@2 0fc631ac-6414-0410-93d0-97cfa31319b6
This commit is contained in:
@@ -0,0 +1,103 @@
|
||||
//+----------------------------------------------------------------------------+
|
||||
//| 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_SYMBOL_CONTROL
|
||||
#define HEADER_GUI_SYMBOL_CONTROL
|
||||
|
||||
// ----------------------------------------------------------------------------- : Includes
|
||||
|
||||
#include <util/prec.hpp>
|
||||
#include <data/symbol.hpp>
|
||||
#include <gui/symbol/viewer.hpp>
|
||||
|
||||
class SymbolWindow;
|
||||
DECLARE_POINTER_TYPE(SymbolEditorBase);
|
||||
|
||||
// ----------------------------------------------------------------------------- : SymbolControl
|
||||
|
||||
/// Control for editing symbols
|
||||
/** What kind of editing is done is determined by the contained SymbolEditorBase object
|
||||
* That object handles all events and the drawing. This class is mostly just a proxy.
|
||||
*/
|
||||
class SymbolControl : public wxControl, public SymbolViewer {
|
||||
public:
|
||||
SymbolControl(SymbolWindow* parent, int id, const SymbolP& symbol);
|
||||
|
||||
virtual void onSymbolChange();
|
||||
|
||||
virtual void onAction(const Action&);
|
||||
|
||||
// Forward command to editor
|
||||
void onExtraTool(wxCommandEvent& ev);
|
||||
|
||||
// Switch to some editing mode
|
||||
void onModeChange(wxCommandEvent& ev);
|
||||
|
||||
/// Handle UpdateUIEvents propagated from the SymbolWindow
|
||||
/** Handles events for editing mode related stuff
|
||||
*/
|
||||
void onUpdateUI(wxUpdateUIEvent& ev);
|
||||
|
||||
/// The selection has changed, tell the part list
|
||||
void signalSelectionChange();
|
||||
|
||||
/// Activate a part, open it in the point editor
|
||||
void activatePart(const SymbolPartP& part);
|
||||
|
||||
/// Select a specific part from the symbol
|
||||
/// The editor is switched to the select editor
|
||||
void selectPart(const SymbolPartP& part);
|
||||
|
||||
/// Update the selection
|
||||
void onUpdateSelection();
|
||||
|
||||
/// Are we editing?
|
||||
bool isEditing();
|
||||
|
||||
private:
|
||||
/// Switch the a different editor object
|
||||
void switchEditor(const SymbolEditorBaseP& e);
|
||||
|
||||
/// Draw the editor
|
||||
void draw(DC& dc);
|
||||
|
||||
private:
|
||||
DECLARE_EVENT_TABLE();
|
||||
|
||||
// --------------------------------------------------- : Data
|
||||
|
||||
public:
|
||||
/// What parts are selected
|
||||
set<SymbolPartP> selectedParts;
|
||||
SymbolPartP singleSelection;
|
||||
|
||||
/// Parent window
|
||||
SymbolWindow* parent;
|
||||
|
||||
private:
|
||||
/// The current editor
|
||||
SymbolEditorBaseP editor;
|
||||
|
||||
/// Last mouse position
|
||||
Vector2D lastPos;
|
||||
|
||||
// --------------------------------------------------- : Events
|
||||
|
||||
void onLeftDown (wxMouseEvent& ev);
|
||||
void onLeftUp (wxMouseEvent& ev);
|
||||
void onLeftDClick(wxMouseEvent& ev);
|
||||
void onRightDown (wxMouseEvent& ev);
|
||||
void onMotion (wxMouseEvent& ev);
|
||||
|
||||
void onPaint (wxPaintEvent& e);
|
||||
void onKeyChange(wxKeyEvent& ev);
|
||||
void onChar (wxKeyEvent& ev);
|
||||
void onSize (wxSizeEvent& ev);
|
||||
};
|
||||
|
||||
|
||||
// ----------------------------------------------------------------------------- : EOF
|
||||
#endif
|
||||
Reference in New Issue
Block a user