Commit 198c01c4 authored by twanvl's avatar twanvl

improved the doxygen documentation

parent 16663f2b
//+----------------------------------------------------------------------------+
//| 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 <util/prec.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_
#define HEADER_
// ----------------------------------------------------------------------------- : Includes
#include <util/prec.hpp>
// ----------------------------------------------------------------------------- :
// ----------------------------------------------------------------------------- : EOF
#endif
...@@ -40,11 +40,11 @@ class SymbolPartMoveAction : public SymbolPartAction { ...@@ -40,11 +40,11 @@ class SymbolPartMoveAction : public SymbolPartAction {
void move(const Vector2D& delta); void move(const Vector2D& delta);
private: private:
set<SymbolPartP> parts; //^ Parts to move set<SymbolPartP> parts; ///< Parts to move
Vector2D delta; //^ How much to move Vector2D delta; ///< How much to move
Vector2D moved; //^ How much has been moved Vector2D moved; ///< How much has been moved
public: public:
bool constrain; //^ Constrain movement? bool constrain; ///< Constrain movement?
}; };
// ----------------------------------------------------------------------------- : Rotating symbol parts // ----------------------------------------------------------------------------- : Rotating symbol parts
...@@ -61,8 +61,8 @@ class SymbolPartMatrixAction : public SymbolPartAction { ...@@ -61,8 +61,8 @@ class SymbolPartMatrixAction : public SymbolPartAction {
/// Perform the transformation using the given matrix /// Perform the transformation using the given matrix
void transform(const Vector2D& mx, const Vector2D& my); void transform(const Vector2D& mx, const Vector2D& my);
set<SymbolPartP> parts; //^ Parts to transform set<SymbolPartP> parts; ///< Parts to transform
Vector2D center; //^ Center to transform around Vector2D center; ///< Center to transform around
}; };
/// Rotate some symbol parts /// Rotate some symbol parts
...@@ -80,9 +80,9 @@ class SymbolPartRotateAction : public SymbolPartMatrixAction { ...@@ -80,9 +80,9 @@ class SymbolPartRotateAction : public SymbolPartMatrixAction {
void rotateBy(double deltaAngle); void rotateBy(double deltaAngle);
private: private:
double angle; //^ How much to rotate? double angle; ///< How much to rotate?
public: public:
bool constrain; //^ Constrain movement? bool constrain; ///< Constrain movement?
}; };
...@@ -100,10 +100,10 @@ class SymbolPartShearAction : public SymbolPartMatrixAction { ...@@ -100,10 +100,10 @@ class SymbolPartShearAction : public SymbolPartMatrixAction {
void move(const Vector2D& deltaShear); void move(const Vector2D& deltaShear);
private: private:
Vector2D shear; //^ Shearing, shear.x == 0 || shear.y == 0 Vector2D shear; ///< Shearing, shear.x == 0 || shear.y == 0
void shearBy(const Vector2D& shear); void shearBy(const Vector2D& shear);
public: public:
bool constrain; //^ Constrain movement? bool constrain; ///< Constrain movement?
}; };
...@@ -123,11 +123,11 @@ class SymbolPartScaleAction : public SymbolPartAction { ...@@ -123,11 +123,11 @@ class SymbolPartScaleAction : public SymbolPartAction {
void update(); void update();
private: private:
set<SymbolPartP> parts; //^ Parts to scale set<SymbolPartP> parts; ///< Parts to scale
Vector2D oldMin, oldSize; //^ the original pos/size Vector2D oldMin, oldSize; ///< the original pos/size
Vector2D newRealMin, newRealSize; //^ the target pos/sizevoid shearBy(const Vector2D& shear) Vector2D newRealMin, newRealSize; ///< the target pos/sizevoid shearBy(const Vector2D& shear)
Vector2D newMin, newSize; //^ the target pos/size after applying constrains Vector2D newMin, newSize; ///< the target pos/size after applying constrains
int scaleX, scaleY; //^ to what corner are we attached? int scaleX, scaleY; ///< to what corner are we attached?
/// Transform everything in the parts /// Transform everything in the parts
void transformAll(); void transformAll();
/// Transform a single vector /// Transform a single vector
...@@ -135,7 +135,7 @@ class SymbolPartScaleAction : public SymbolPartAction { ...@@ -135,7 +135,7 @@ class SymbolPartScaleAction : public SymbolPartAction {
return (v - oldMin).div(oldSize).mul(newSize) + newMin; return (v - oldMin).div(oldSize).mul(newSize) + newMin;
} }
public: public:
bool constrain; //^ Constrain movement? bool constrain; ///< Constrain movement?
}; };
// ----------------------------------------------------------------------------- : Change combine mode // ----------------------------------------------------------------------------- : Change combine mode
...@@ -149,7 +149,7 @@ class CombiningModeAction : public SymbolPartListAction { ...@@ -149,7 +149,7 @@ class CombiningModeAction : public SymbolPartListAction {
virtual void perform(bool toUndo); virtual void perform(bool toUndo);
private: private:
vector<pair<SymbolPartP,SymbolPartCombine> > parts; //^ Affected parts with new combining modes vector<pair<SymbolPartP,SymbolPartCombine> > parts; ///< Affected parts with new combining modes
}; };
// ----------------------------------------------------------------------------- : Change name // ----------------------------------------------------------------------------- : Change name
...@@ -163,14 +163,13 @@ class SymbolPartNameAction : public SymbolPartListAction { ...@@ -163,14 +163,13 @@ class SymbolPartNameAction : public SymbolPartListAction {
virtual void perform(bool toUndo); virtual void perform(bool toUndo);
private: private:
SymbolPartP part; //^ Affected part SymbolPartP part; ///< Affected part
String partName; //^ New name String partName; ///< New name
}; };
// ----------------------------------------------------------------------------- : Add symbol part // ----------------------------------------------------------------------------- : Add symbol part
/// Adding a part to a symbol, added at the front of the list /// Adding a part to a symbol, added at the front of the list (drawn on top)
/// front = drawn on top
class AddSymbolPartAction : public SymbolPartListAction { class AddSymbolPartAction : public SymbolPartListAction {
public: public:
AddSymbolPartAction(Symbol& symbol, const SymbolPartP& part); AddSymbolPartAction(Symbol& symbol, const SymbolPartP& part);
...@@ -179,8 +178,8 @@ class AddSymbolPartAction : public SymbolPartListAction { ...@@ -179,8 +178,8 @@ class AddSymbolPartAction : public SymbolPartListAction {
virtual void perform(bool toUndo); virtual void perform(bool toUndo);
private: private:
Symbol& symbol; //^ Symbol to add the part to Symbol& symbol; ///< Symbol to add the part to
SymbolPartP part; //^ Part to add SymbolPartP part; ///< Part to add
}; };
// ----------------------------------------------------------------------------- : Remove symbol part // ----------------------------------------------------------------------------- : Remove symbol part
...@@ -221,8 +220,7 @@ class DuplicateSymbolPartsAction : public SymbolPartListAction { ...@@ -221,8 +220,7 @@ class DuplicateSymbolPartsAction : public SymbolPartListAction {
// ----------------------------------------------------------------------------- : Reorder symbol parts // ----------------------------------------------------------------------------- : Reorder symbol parts
/// Change the position of a part in a symbol. /// Change the position of a part in a symbol, by swapping two parts.
/// This is done by swapping two parts.
class ReorderSymbolPartsAction : public SymbolPartListAction { class ReorderSymbolPartsAction : public SymbolPartListAction {
public: public:
ReorderSymbolPartsAction(Symbol& symbol, size_t partId1, size_t partId2); ReorderSymbolPartsAction(Symbol& symbol, size_t partId1, size_t partId2);
...@@ -231,9 +229,9 @@ class ReorderSymbolPartsAction : public SymbolPartListAction { ...@@ -231,9 +229,9 @@ class ReorderSymbolPartsAction : public SymbolPartListAction {
virtual void perform(bool toUndo); virtual void perform(bool toUndo);
private: private:
Symbol& symbol; //^ Symbol to swap the parts in Symbol& symbol; ///< Symbol to swap the parts in
public: public:
size_t partId1, partId2; //^ Indeces of parts to swap size_t partId1, partId2; ///< Indeces of parts to swap
}; };
......
...@@ -253,8 +253,8 @@ class SinglePointRemoveAction : public Action { ...@@ -253,8 +253,8 @@ class SinglePointRemoveAction : public Action {
private: private:
SymbolPartP part; SymbolPartP part;
UInt position; UInt position;
ControlPointP point; //^ Removed point ControlPointP point; ///< Removed point
ControlPointUpdate point1, point2; //^ Points before/after ControlPointUpdate point1, point2; ///< Points before/after
}; };
SinglePointRemoveAction::SinglePointRemoveAction(const SymbolPartP& part, UInt position) SinglePointRemoveAction::SinglePointRemoveAction(const SymbolPartP& part, UInt position)
...@@ -327,9 +327,9 @@ DECLARE_POINTER_TYPE(SinglePointRemoveAction); ...@@ -327,9 +327,9 @@ DECLARE_POINTER_TYPE(SinglePointRemoveAction);
DECLARE_TYPEOF_COLLECTION(SinglePointRemoveActionP); DECLARE_TYPEOF_COLLECTION(SinglePointRemoveActionP);
/// Remove a set of points from a symbol part // Remove a set of points from a symbol part.
/// Internally represented as a list of Single Point Remove Actions // Internally represented as a list of Single Point Remove Actions.
/// Not all points mat be removed, at least two points must remain // Not all points mat be removed, at least two points must remain.
class ControlPointRemoveAction : public Action { class ControlPointRemoveAction : public Action {
public: public:
ControlPointRemoveAction(const SymbolPartP& part, const set<ControlPointP>& toDelete); ControlPointRemoveAction(const SymbolPartP& part, const set<ControlPointP>& toDelete);
......
...@@ -38,11 +38,11 @@ class ControlPointMoveAction : public Action { ...@@ -38,11 +38,11 @@ class ControlPointMoveAction : public Action {
void move(const Vector2D& delta); void move(const Vector2D& delta);
private: private:
set<ControlPointP> points; //^ Points to move set<ControlPointP> points; ///< Points to move
vector<Vector2D> oldValues; //^ Their old positions vector<Vector2D> oldValues; ///< Their old positions
Vector2D delta; //^ Amount we moved Vector2D delta; ///< Amount we moved
public: public:
bool constrain; //^ Constrain movement? bool constrain; ///< Constrain movement?
}; };
// ----------------------------------------------------------------------------- : Move handle // ----------------------------------------------------------------------------- : Move handle
...@@ -59,12 +59,12 @@ class HandleMoveAction : public Action { ...@@ -59,12 +59,12 @@ class HandleMoveAction : public Action {
void move(const Vector2D& delta); void move(const Vector2D& delta);
private: private:
SelectedHandle handle; //^ The handle to move SelectedHandle handle; ///< The handle to move
Vector2D oldHandle; //^ Old value of this handle Vector2D oldHandle; ///< Old value of this handle
Vector2D oldOther; //^ Old value of other handle, needed for contraints Vector2D oldOther; ///< Old value of other handle, needed for contraints
Vector2D delta; //^ Amount we moved Vector2D delta; ///< Amount we moved
public: public:
bool constrain; //^ Constrain movement? bool constrain; ///< Constrain movement?
}; };
// ----------------------------------------------------------------------------- : Segment mode // ----------------------------------------------------------------------------- : Segment mode
...@@ -108,7 +108,7 @@ class LockModeAction : public Action { ...@@ -108,7 +108,7 @@ class LockModeAction : public Action {
virtual void perform(bool toUndo); virtual void perform(bool toUndo);
private: private:
ControlPointUpdate point; //^ The affected point ControlPointUpdate point; ///< The affected point
}; };
// ----------------------------------------------------------------------------- : Move curve // ----------------------------------------------------------------------------- : Move curve
...@@ -141,10 +141,10 @@ class ControlPointAddAction : public Action { ...@@ -141,10 +141,10 @@ class ControlPointAddAction : public Action {
inline ControlPointP getNewPoint() const { return newPoint; } inline ControlPointP getNewPoint() const { return newPoint; }
private: private:
SymbolPartP part; //^ SymbolPart we are in SymbolPartP part; ///< SymbolPart we are in
ControlPointP newPoint; //^ The point to insert ControlPointP newPoint; ///< The point to insert
UInt insertAfter; //^ Insert after index .. in the array UInt insertAfter; ///< Insert after index .. in the array
ControlPointUpdate point1, point2; //^ Update the points around the new point ControlPointUpdate point1, point2; ///< Update the points around the new point
}; };
// ----------------------------------------------------------------------------- : Remove control point // ----------------------------------------------------------------------------- : Remove control point
......
...@@ -26,9 +26,9 @@ DECLARE_TYPEOF_COLLECTION(SymbolPartP); ...@@ -26,9 +26,9 @@ DECLARE_TYPEOF_COLLECTION(SymbolPartP);
/** Specificly: the relation between deltaBefore and deltaAfter /** Specificly: the relation between deltaBefore and deltaAfter
*/ */
enum LockMode enum LockMode
{ LOCK_FREE //^ no locking { LOCK_FREE ///< no locking
, LOCK_DIR //^ deltaBefore = x * deltaAfter , LOCK_DIR ///< deltaBefore = x * deltaAfter
, LOCK_SIZE //^ deltaBefore = -deltaAfter , LOCK_SIZE ///< deltaBefore = -deltaAfter
}; };
/// Is the segment between two ControlPoints a line or a curve? /// Is the segment between two ControlPoints a line or a curve?
...@@ -39,7 +39,7 @@ enum SegmentMode ...@@ -39,7 +39,7 @@ enum SegmentMode
/// To refer to a specific handle of a control point /// To refer to a specific handle of a control point
enum WhichHandle enum WhichHandle
{ HANDLE_NONE = 0 //^ point is not selected { HANDLE_NONE = 0 ///< point is not selected
, HANDLE_MAIN , HANDLE_MAIN
, HANDLE_BEFORE , HANDLE_BEFORE
, HANDLE_AFTER , HANDLE_AFTER
...@@ -48,9 +48,9 @@ enum WhichHandle ...@@ -48,9 +48,9 @@ enum WhichHandle
/// A control point (corner) of a SymbolPart (polygon/bezier-gon) /// A control point (corner) of a SymbolPart (polygon/bezier-gon)
class ControlPoint { class ControlPoint {
public: public:
Vector2D pos; //^ position of the control point itself Vector2D pos; ///< position of the control point itself
Vector2D deltaBefore; //^ delta to bezier control point, for curve before point Vector2D deltaBefore; ///< delta to bezier control point, for curve before point
Vector2D deltaAfter; //^ delta to bezier control point, for curve after point Vector2D deltaAfter; ///< delta to bezier control point, for curve after point
SegmentMode segmentBefore, segmentAfter; SegmentMode segmentBefore, segmentAfter;
LockMode lock; LockMode lock;
...@@ -80,8 +80,8 @@ class ControlPoint { ...@@ -80,8 +80,8 @@ class ControlPoint {
/// A specific handle of a ControlPoint /// A specific handle of a ControlPoint
class SelectedHandle { class SelectedHandle {
public: public:
ControlPointP point; //^ the selected point ControlPointP point; ///< the selected point
WhichHandle handle; //^ the selected handle of the point WhichHandle handle; ///< the selected handle of the point
// SelectedHandle // SelectedHandle
SelectedHandle() : handle(HANDLE_NONE) {} SelectedHandle() : handle(HANDLE_NONE) {}
......
...@@ -101,9 +101,9 @@ void drawCombineImage(DC& dc, UInt x, UInt y, const Image& img, ImageCombine com ...@@ -101,9 +101,9 @@ void drawCombineImage(DC& dc, UInt x, UInt y, const Image& img, ImageCombine com
// ----------------------------------------------------------------------------- : Utility // ----------------------------------------------------------------------------- : Utility
inline int bot(int x) { return max(0, x); } //^ bottom range check for color values inline int bot(int x) { return max(0, x); } ///< bottom range check for color values
inline int top(int x) { return min(255, x); } //^ top range check for color values inline int top(int x) { return min(255, x); } ///< top range check for color values
inline int col(int x) { return top(bot(x)); } //^ top and bottom range check for color values inline int col(int x) { return top(bot(x)); } ///< top and bottom range check for color values
// ----------------------------------------------------------------------------- : EOF // ----------------------------------------------------------------------------- : EOF
#endif #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 "icon_menu.hpp"
// ----------------------------------------------------------------------------- : generateDisabledImage
// Generate an image to use for the disabled state of menu items
Image generateDisabledImage(const Image& imgIn) {
// Some system colors
Color trans(1,2,3); // mask color used by bitmaps as 'transparent'
Color light = wxSystemSettings::GetColour(wxSYS_COLOUR_3DHIGHLIGHT);
Color shadow = wxSystemSettings::GetColour(wxSYS_COLOUR_3DSHADOW);
// generate disabled bitmap
Image imgOut(16, 16);
imgOut.SetMaskColour(1,2,3);
Byte *in = imgIn.GetData(), *out = imgOut.GetData();
// For each pixel...
for (int y = 0 ; y < 16 ; ++y) {
for (int x = 0 ; x < 16 ; ++x) {
// is the pixel mask color or white?
Color in1 = trans, in2 = trans;
if (x<15 && y<15) in1 = Color(in[0], in[1], in[2]);
// and the pixel to the left+up?
if (x>0 && y>0 ) in2 = Color(in[0 - 3*17], in[1 - 3*17], in[2 - 3*17]);
// determine output color
Color col;
if (in1 != trans && in1 != light) col = shadow;
else if (in2 != trans && in2 != light) col = light;
else col = trans;
out[0] = col.Red();
out[1] = col.Green();
out[2] = col.Blue();
in += 3;
out += 3;
}
}
return imgOut;
}
// ----------------------------------------------------------------------------- : IconMenu
void IconMenu::Append(int id, const String& resource, const String& text, const String& help, int style, wxMenu* submenu) {
// load bitmap
Bitmap bitmap(resource);
bitmap = bitmap.GetSubBitmap(wxRect(0,0,16,16));
Image disabledImage = generateDisabledImage(bitmap.ConvertToImage());
// add menu item
wxMenuItem* item = new wxMenuItem(this, id, text, help, style, submenu);
item->SetBitmaps(bitmap, bitmap);
item->SetDisabledBitmap(disabledImage);
wxMenu::Append(item);
}
void IconMenu::Append(int id, const String& text, const String& help) {
wxMenuItem* item = new wxMenuItem (this, id, text, help);
item->SetBitmap(wxNullBitmap);
wxMenu::Append(item);
}
void IconMenu::Append(int id, const String& text, wxMenu* submenu, const String& help) {
wxMenuItem* item = new wxMenuItem (this, id, text, help, wxITEM_NORMAL, submenu);
item->SetBitmap(wxNullBitmap);
wxMenu::Append(item);
}
void IconMenu::Insert(size_t pos, int id, const String& text, const String& help) {
wxMenuItem* item = new wxMenuItem (this, id, text, help);
item->SetBitmap(wxNullBitmap);
wxMenu::Insert(pos, item);
}
//+----------------------------------------------------------------------------+
//| 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_ICON_MENU
#define HEADER_GUI_ICON_MENU
// ----------------------------------------------------------------------------- : Includes
#include "../util/prec.hpp"
// ----------------------------------------------------------------------------- : IconMenu
/// Helper class for menus with icons
/** This class functions just like a normal wxMenu.
* The difference is that Append takes an extra parameter:
* the resource name of the bitmap to use.
* Bitmaps are resized (cut) to 16x16 pixels.
*/
class IconMenu : public wxMenu {
public:
/// Append a menu item, with an image (loaded from a resource)
void Append(int id, const String& resource, const String& text, const String& help, int style = wxITEM_NORMAL, wxMenu* submenu = nullptr);
/// Append a menu item, without an image
void Append(int id, const String& text, const String& help);
/// Append a menu item, without an image
void Append(int id, const String& text, wxMenu* submenu, const String& help);
/// Insert a menu item, without an image
void Insert(size_t pos, int id, const String& text, const String& help);
};
// ----------------------------------------------------------------------------- : EOF
#endif
...@@ -43,11 +43,11 @@ class SymbolPointEditor : public SymbolEditorBase { ...@@ -43,11 +43,11 @@ class SymbolPointEditor : public SymbolEditorBase {
void drawHandleCircle(DC& dc, UInt px, UInt py); void drawHandleCircle(DC& dc, UInt px, UInt py);
enum WhichPen { enum WhichPen {
PEN_NORMAL, //^ Pen for normal handles PEN_NORMAL, ///< Pen for normal handles
PEN_HOVER, //^ Pen for hovered handles PEN_HOVER, ///< Pen for hovered handles
PEN_LINE, //^ Pen for the line to handles PEN_LINE, ///< Pen for the line to handles
PEN_MAIN, //^ Pen for the main handle PEN_MAIN, ///< Pen for the main handle
PEN_NEW_POINT //^ Pen for the new point PEN_NEW_POINT ///< Pen for the new point
}; };
/// Retrieve a pen for the drawing of parts of handles /// Retrieve a pen for the drawing of parts of handles
wxPen handlePen(WhichPen p, LockMode lock); wxPen handlePen(WhichPen p, LockMode lock);
...@@ -91,11 +91,11 @@ class SymbolPointEditor : public SymbolEditorBase { ...@@ -91,11 +91,11 @@ class SymbolPointEditor : public SymbolEditorBase {
// Selection // Selection
enum Selection { enum Selection {
SELECTED_NONE, //^ no selection SELECTED_NONE, ///< no selection
SELECTED_POINTS, //^ some points are selected SELECTED_POINTS, ///< some points are selected
SELECTED_HANDLE, //^ a handle is selected SELECTED_HANDLE, ///< a handle is selected
SELECTED_LINE, //^ a line is selected SELECTED_LINE, ///< a line is selected
SELECTED_NEW_POINT //^ a new point on a line (used for hovering) SELECTED_NEW_POINT ///< a new point on a line (used for hovering)
}; };
Selection selection; Selection selection;
// points // points
......
...@@ -32,7 +32,7 @@ class SymbolViewer : public SymbolView { ...@@ -32,7 +32,7 @@ class SymbolViewer : public SymbolView {
// --------------------------------------------------- : Point translation // --------------------------------------------------- : Point translation
Rotation rotation; //^ Object that handles rotation, scaling and translation Rotation rotation; ///< Object that handles rotation, scaling and translation
// --------------------------------------------------- : Drawing // --------------------------------------------------- : Drawing
......
...@@ -35,8 +35,8 @@ class SymbolWindow : public Frame { ...@@ -35,8 +35,8 @@ class SymbolWindow : public Frame {
/// Actual initialisation /// Actual initialisation
void init(Window* parent, SymbolP symbol); void init(Window* parent, SymbolP symbol);
SymbolControl* control; //^ The control for editing/displaying the symbol SymbolControl* control; ///< The control for editing/displaying the symbol
SymbolPartList* parts; //^ A list of parts in the symbol SymbolPartList* parts; ///< A list of parts in the symbol
// when editing a symbol field // when editing a symbol field
// SymbolValueP value // SymbolValueP value
...@@ -65,7 +65,7 @@ class SymbolWindow : public Frame { ...@@ -65,7 +65,7 @@ class SymbolWindow : public Frame {
/// Activating a part: open the point editor /// Activating a part: open the point editor
void onActivateFromList(wxListEvent& ev); void onActivateFromList(wxListEvent& ev);
bool inSelectionEvent; //^ Prevent recursion in onSelect... bool inSelectionEvent; ///< Prevent recursion in onSelect...
public: public:
void onSelectFromControl(); void onSelectFromControl();
......
//+----------------------------------------------------------------------------+
//| 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 "util/prec.hpp"
#include <gui/symbol/window.hpp>
// ----------------------------------------------------------------------------- : Main function/class
/// The application class for MSE.
/** This class is used by wxWidgets as a kind of 'main function'
*/
class MSE : public wxApp {
public:
/// Main startup function of the program
bool OnInit();
/// On exit: write the settings to the config file
int OnExit();
/// On exception: display error message
bool OnExceptionInMainLoop();
};
IMPLEMENT_APP(MSE)
// ----------------------------------------------------------------------------- : Initialization
bool MSE::OnInit() {
wxInitAllImageHandlers();
//initFileFilters()
Window* wnd = new SymbolWindow(0);
wnd->Show();
return true;
}
// ----------------------------------------------------------------------------- : Exit
int MSE::OnExit() {
// settings.write();
return 0;
}
// ----------------------------------------------------------------------------- : Exception handling
bool MSE::OnExceptionInMainLoop() {
return true;
}
...@@ -347,6 +347,12 @@ ...@@ -347,6 +347,12 @@
<Filter <Filter
Name="control" Name="control"
Filter=""> Filter="">
<File
RelativePath=".\gui\control\card_list.cpp">
</File>
<File
RelativePath=".\gui\control\card_list.hpp">
</File>
</Filter> </Filter>
<Filter <Filter
Name="editor" Name="editor"
......
...@@ -26,16 +26,19 @@ class Action { ...@@ -26,16 +26,19 @@ class Action {
virtual String getName(bool toUndo) const = 0; virtual String getName(bool toUndo) const = 0;
/// Perform the action /// Perform the action
/// Must be implemented in derived class /** @param toUndo if true, undo the action instead of doing it
/** Perform will only ever be called alternatingly with toUndo = true/false, *
* Must be implemented in derived class.
*
* Perform will only ever be called alternatingly with toUndo = true/false,
* the first time with toUndo = false * the first time with toUndo = false
*/ */
/// @param toUndo if true, undo the action instead of doing it
virtual void perform(bool toUndo) = 0; virtual void perform(bool toUndo) = 0;
/// Try to merge another action to the end of this action. /// Try to merge another action to the end of this action.
/// Either: return false and do nothing /** Either: return false and do nothing
/// Or: return true and change this action to incorporate both actions * Or: return true and change this action to incorporate both actions
*/
virtual bool merge(const Action* action) { return false; } virtual bool merge(const Action* action) { return false; }
}; };
......
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
/** @file util/error.hpp /** @file util/error.hpp
* *
* Classes and functions for handling errors/exceptions * @brief Classes and functions for handling errors/exceptions.
*/ */
// ----------------------------------------------------------------------------- : Error types // ----------------------------------------------------------------------------- : Error types
...@@ -28,7 +28,7 @@ class Error { ...@@ -28,7 +28,7 @@ class Error {
virtual String what() const; virtual String what() const;
private: private:
String message; //^ The error message String message; ///< The error message
}; };
...@@ -42,7 +42,7 @@ class InternalError : public Error { ...@@ -42,7 +42,7 @@ class InternalError : public Error {
// ----------------------------------------------------------------------------- : File errors // ----------------------------------------------------------------------------- : File errors
// Errors related to packages /// Errors related to packages
class PackageError : public Error { class PackageError : public Error {
public: public:
inline PackageError(const String& str) : Error(str) {} inline PackageError(const String& str) : Error(str) {}
...@@ -50,7 +50,7 @@ class PackageError : public Error { ...@@ -50,7 +50,7 @@ class PackageError : public Error {
// ----------------------------------------------------------------------------- : Parse errors // ----------------------------------------------------------------------------- : Parse errors
// Parse errors /// Parse errors
class ParseError : public Error { class ParseError : public Error {
public: public:
inline ParseError(const String& str) : Error(str) {} inline ParseError(const String& str) : Error(str) {}
......
...@@ -9,7 +9,8 @@ ...@@ -9,7 +9,8 @@
/** @file util/for_each.hpp /** @file util/for_each.hpp
* *
* Macros to simplify looping over collections. * @brief Macros to simplify looping over collections.
*
* This header contains some evil template and macro hackery. * This header contains some evil template and macro hackery.
*/ */
...@@ -80,26 +81,30 @@ ...@@ -80,26 +81,30 @@
// ----------------------------------------------------------------------------- : Looping macros with iterators // ----------------------------------------------------------------------------- : Looping macros with iterators
/// Iterate over a collection, using an iterator it of type Type /// Iterate over a collection, using an iterator it of type Type
/// Usage: FOR_EACH_IT_T(Type,it,collect) { body-of-loop } /** Usage: FOR_EACH_IT_T(Type,it,collect) { body-of-loop }
*/
#define FOR_EACH_IT_T(Type,Iterator,Collection) \ #define FOR_EACH_IT_T(Type,Iterator,Collection) \
for(Type Iterator = Collection.begin() ; \ for(Type Iterator = Collection.begin() ; \
Iterator != Collection.end() ; \ Iterator != Collection.end() ; \
++Iterator) ++Iterator)
/// Iterate over a collection whos type must be declared with DECLARE_TYPEOF /// Iterate over a collection whos type must be declared with DECLARE_TYPEOF
/// Usage: FOR_EACH_IT(it,collect) { body-of-loop } /** Usage: FOR_EACH_IT(it,collect) { body-of-loop }
*/
#define FOR_EACH_IT(Iterator,Collection) \ #define FOR_EACH_IT(Iterator,Collection) \
FOR_EACH_IT_T(TYPEOF_IT(Collection), Iterator, Collection) FOR_EACH_IT_T(TYPEOF_IT(Collection), Iterator, Collection)
/// Iterate over a collection whos type must be declared with DECLARE_TYPEOF /// Iterate over a collection whos type must be declared with DECLARE_TYPEOF
/// Uses a const_iterator /** Uses a const_iterator
/// Usage: FOR_EACH_IT(it,collect) { body-of-loop } * Usage: FOR_EACH_IT(it,collect) { body-of-loop }
*/
#define FOR_EACH_CONST_IT(Iterator,Collection) \ #define FOR_EACH_CONST_IT(Iterator,Collection) \
FOR_EACH_IT_T(TYPEOF_CIT(Collection), Iterator, Collection) FOR_EACH_IT_T(TYPEOF_CIT(Collection), Iterator, Collection)
/// Iterate over a collection in whos type must be declared with DECLARE_TYPEOF /// Iterate over a collection in whos type must be declared with DECLARE_TYPEOF
/// Iterates using a reverse_iterator /** Iterates using a reverse_iterator
/// Usage: FOR_EACH_REVERSE_IT(it,collect) { body-of-loop } * Usage: FOR_EACH_REVERSE_IT(it,collect) { body-of-loop }
*/
#define FOR_EACH_REVERSE_IT(Iterator,Collection) \ #define FOR_EACH_REVERSE_IT(Iterator,Collection) \
for(TYPEOF_RIT(Collection) \ for(TYPEOF_RIT(Collection) \
Iterator = Collection.rbegin() ; \ Iterator = Collection.rbegin() ; \
...@@ -109,8 +114,9 @@ ...@@ -109,8 +114,9 @@
// ----------------------------------------------------------------------------- : Looping macros // ----------------------------------------------------------------------------- : Looping macros
/// Iterate over a collection, with an iterator of type TypeIt, and elements of type TypeElem /// Iterate over a collection, with an iterator of type TypeIt, and elements of type TypeElem
/// Usage: FOR_EACH_T(TypeIt,TypeElem,e,collect) { body-of-loop } /** Usage: FOR_EACH_T(TypeIt,TypeElem,e,collect) { body-of-loop }
/** We need a hack to be able to declare a local variable without needing braces. *
* We need a hack to be able to declare a local variable without needing braces.
* To do this we use a nested for loop that is only executed once, and which is optimized away. * To do this we use a nested for loop that is only executed once, and which is optimized away.
* To terminate this loop we need an extra bool, which we set to false after the first iteration. * To terminate this loop we need an extra bool, which we set to false after the first iteration.
*/ */
...@@ -123,13 +129,15 @@ ...@@ -123,13 +129,15 @@
Elem##_IT.second = false) Elem##_IT.second = false)
/// Iterate over a collection whos type must be declared with DECLARE_TYPEOF /// Iterate over a collection whos type must be declared with DECLARE_TYPEOF
/// Usage: FOR_EACH(e,collect) { body-of-loop } /** Usage: FOR_EACH(e,collect) { body-of-loop }
*/
#define FOR_EACH(Elem,Collection) \ #define FOR_EACH(Elem,Collection) \
FOR_EACH_T(TYPEOF_IT(Collection), TYPEOF_REF(Collection), Elem, Collection) FOR_EACH_T(TYPEOF_IT(Collection), TYPEOF_REF(Collection), Elem, Collection)
/// Iterate over a collection whos type must be declared with DECLARE_TYPEOF /// Iterate over a collection whos type must be declared with DECLARE_TYPEOF
/// Iterates using a reverse_iterator /** Iterates using a reverse_iterator
/// Usage: FOR_EACH_REVERSE(e,collect) { body-of-loop } * Usage: FOR_EACH_REVERSE(e,collect) { body-of-loop }
*/
#define FOR_EACH_REVERSE(Elem,Collection) \ #define FOR_EACH_REVERSE(Elem,Collection) \
for(std::pair<TYPEOF_RIT(Collection),bool> Elem##_IT(Collection.rbegin(), true) ; \ for(std::pair<TYPEOF_RIT(Collection),bool> Elem##_IT(Collection.rbegin(), true) ; \
Elem##_IT.first != Collection.rend() ; \ Elem##_IT.first != Collection.rend() ; \
...@@ -139,8 +147,9 @@ ...@@ -139,8 +147,9 @@
Elem##_IT.second = false) Elem##_IT.second = false)
/// Iterate over two collection in parallel /// Iterate over two collection in parallel
/// Usage: FOR_EACH_2_T(TypeIt1,TypeElem1,e1,collect1,TypeIt2,TypeElem2,e2,collect2) { body-of-loop } /** Usage: FOR_EACH_2_T(TypeIt1,TypeElem1,e1,collect1,TypeIt2,TypeElem2,e2,collect2) { body-of-loop }
/** Note: This has got to be one of the craziest pieces of code I have ever written :) *
* Note: This has got to be one of the craziest pieces of code I have ever written :)
* It is just an extension of the idea of FOR_EACH_T. * It is just an extension of the idea of FOR_EACH_T.
*/ */
#define FOR_EACH_2_T(TypeIt1,TypeElem1,Elem1,Coll1,TypeIt2,TypeElem2,Elem2,Coll2) \ #define FOR_EACH_2_T(TypeIt1,TypeElem1,Elem1,Coll1,TypeIt2,TypeElem2,Elem2,Coll2) \
...@@ -157,9 +166,9 @@ ...@@ -157,9 +166,9 @@
Elem1##_IT.second ; \ Elem1##_IT.second ; \
Elem1##_IT.second = false) Elem1##_IT.second = false)
/// Iterate over two collections in parallel, /// Iterate over two collections in parallel, their type must be declared with DECLARE_TYPEOF.
/// their type must be declared with DECLARE_TYPEOF. /** Usage: FOR_EACH_2(e1,collect1, e2,collect2) { body-of-loop }
/// Usage: FOR_EACH_2(e1,collect1, e2,collect2) { body-of-loop } */
#define FOR_EACH_2(Elem1,Collection1, Elem2,Collection2) \ #define FOR_EACH_2(Elem1,Collection1, Elem2,Collection2) \
FOR_EACH_2_T(TYPEOF_IT(Collection1), TYPEOF_REF(Collection1), Elem1, Collection1, \ FOR_EACH_2_T(TYPEOF_IT(Collection1), TYPEOF_REF(Collection1), Elem1, Collection1, \
TYPEOF_IT(Collection2), TYPEOF_REF(Collection2), Elem2, Collection2) TYPEOF_IT(Collection2), TYPEOF_REF(Collection2), Elem2, Collection2)
......
...@@ -156,9 +156,9 @@ class EnumReader { ...@@ -156,9 +156,9 @@ class EnumReader {
inline bool isDone() const { return done; } inline bool isDone() const { return done; }
private: private:
String read; //^ The string to match to a value name String read; ///< The string to match to a value name
bool first; //^ Has the first (default) value been matched? bool first; ///< Has the first (default) value been matched?
bool done; //^ Was anything matched? bool done; ///< Was anything matched?
}; };
// ----------------------------------------------------------------------------- : EOF // ----------------------------------------------------------------------------- : EOF
......
...@@ -124,7 +124,7 @@ class EnumWriter { ...@@ -124,7 +124,7 @@ class EnumWriter {
} }
private: private:
Writer& writer; //^ The writer to write output to Writer& writer; ///< The writer to write output to
}; };
// ----------------------------------------------------------------------------- : EOF // ----------------------------------------------------------------------------- : EOF
......
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
/** @file util/reflect.hpp /** @file util/reflect.hpp
* *
* Reflection of classes, currently reflection is used for (de)serialization. * @brief Reflection of classes, currently reflection is used for (de)serialization.
*/ */
// ----------------------------------------------------------------------------- : Includes // ----------------------------------------------------------------------------- : Includes
...@@ -41,18 +41,18 @@ ...@@ -41,18 +41,18 @@
// ----------------------------------------------------------------------------- : Implementing reflection // ----------------------------------------------------------------------------- : Implementing reflection
/// Implement the refelection of a class type Cls /// Implement the refelection of a class type Cls
/// Reflection allows the member variables of a class to be inspected at runtime. /** Reflection allows the member variables of a class to be inspected at runtime.
/// *
/// Currently creates the methods: * Currently creates the methods:
/// - Reader::handle(Cls&) * - Reader::handle(Cls&)
/// - Writer::handle(Cls&) * - Writer::handle(Cls&)
/** Usage: * Usage:
* \begincode * @code
* IMPLEMENT_REFLECTION(MyClass) { * IMPLEMENT_REFLECTION(MyClass) {
* REFLECT(a_variable_in_my_class); * REFLECT(a_variable_in_my_class);
* REFLECT(another_variable_in_my_class); * REFLECT(another_variable_in_my_class);
* } * }
* \endcode * @endcode
*/ */
#define IMPLEMENT_REFLECTION(Cls) \ #define IMPLEMENT_REFLECTION(Cls) \
REFLECT_OBJECT_READER(Cls) \ REFLECT_OBJECT_READER(Cls) \
...@@ -80,12 +80,12 @@ ...@@ -80,12 +80,12 @@
/// Implement the refelection of a enumeration type Enum /// Implement the refelection of a enumeration type Enum
/** Usage: /** Usage:
* \begincode * @code
* IMPLEMENT_REFLECTION_ENUM(MyEnum) { * IMPLEMENT_REFLECTION_ENUM(MyEnum) {
* VALUE(value_of_enum_1); * VALUE(value_of_enum_1);
* VALUE(value_of_enum_2); * VALUE(value_of_enum_2);
* } * }
* \endcode * @endcode
* *
* When reading the first value declared is the default value * When reading the first value declared is the default value
* *
......
...@@ -53,10 +53,10 @@ class Rotation { ...@@ -53,10 +53,10 @@ class Rotation {
RealPoint trInv(const RealPoint& p) const; RealPoint trInv(const RealPoint& p) const;
private: private:
int angle; //^ The angle of rotation in degrees (counterclockwise) int angle; ///< The angle of rotation in degrees (counterclockwise)
RealSize size; //^ Size of the rectangle, in external coordinates RealSize size; ///< Size of the rectangle, in external coordinates
RealPoint origin; //^ tr(0,0) RealPoint origin; ///< tr(0,0)
double zoom; //^ Zoom factor, zoom = 2.0 means that 1 internal = 2 external double zoom; ///< Zoom factor, zoom = 2.0 means that 1 internal = 2 external
/// Is the rotation sideways (90 or 270 degrees)? /// Is the rotation sideways (90 or 270 degrees)?
// Note: angle & 2 == 0 for angle in {0, 180} and != 0 for angle in {90, 270) // Note: angle & 2 == 0 for angle in {0, 180} and != 0 for angle in {90, 270)
...@@ -75,11 +75,11 @@ class Rotation { ...@@ -75,11 +75,11 @@ class Rotation {
/// An object that changes a rotation RIIA style /// An object that changes a rotation RIIA style
/** Usage: /** Usage:
* \begincode * @code
* Rotation a, b; * Rotation a, b;
* Rotater(a,b); * Rotater(a,b);
* a.tr(x) // now acts as a.tr(b.tr(x)) * a.tr(x) // now acts as a.tr(b.tr(x))
* \endcode * @endcode
*/ */
class Rotater { class Rotater {
/// Compose a rotation by onto the rotation rot /// Compose a rotation by onto the rotation rot
......
...@@ -7,9 +7,9 @@ ...@@ -7,9 +7,9 @@
#ifndef HEADER_UTIL_SMART_PTR #ifndef HEADER_UTIL_SMART_PTR
#define HEADER_UTIL_SMART_PTR #define HEADER_UTIL_SMART_PTR
/** @file util/shared_ptr.hpp /** @file util/smart_ptr.hpp
* *
* Utilities related to boost smart pointers * @brief Utilities related to boost smart pointers
*/ */
// ----------------------------------------------------------------------------- : Includes // ----------------------------------------------------------------------------- : Includes
......
...@@ -14,7 +14,6 @@ ...@@ -14,7 +14,6 @@
// ----------------------------------------------------------------------------- : Includes // ----------------------------------------------------------------------------- : Includes
#include "prec.hpp"
#include "for_each.hpp" #include "for_each.hpp"
#include <ctype.h> #include <ctype.h>
#include <boost/preprocessor/cat.hpp> #include <boost/preprocessor/cat.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) |
//+----------------------------------------------------------------------------+
// ----------------------------------------------------------------------------- : Includes
#include <vector2d.hpp>
#include "for_each.hpp"
// ----------------------------------------------------------------------------- : IO
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