improved the doxygen documentation

git-svn-id: svn://svn.code.sf.net/p/magicseteditor/code/trunk@4 0fc631ac-6414-0410-93d0-97cfa31319b6
This commit is contained in:
twanvl
2006-10-01 15:18:40 +00:00
parent a9b6c73407
commit 50b22e9478
24 changed files with 340 additions and 122 deletions
+77
View File
@@ -0,0 +1,77 @@
//+----------------------------------------------------------------------------+
//| 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);
}
+35
View File
@@ -0,0 +1,35 @@
//+----------------------------------------------------------------------------+
//| 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
+10 -10
View File
@@ -43,11 +43,11 @@ class SymbolPointEditor : public SymbolEditorBase {
void drawHandleCircle(DC& dc, UInt px, UInt py);
enum WhichPen {
PEN_NORMAL, //^ Pen for normal handles
PEN_HOVER, //^ Pen for hovered handles
PEN_LINE, //^ Pen for the line to handles
PEN_MAIN, //^ Pen for the main handle
PEN_NEW_POINT //^ Pen for the new point
PEN_NORMAL, ///< Pen for normal handles
PEN_HOVER, ///< Pen for hovered handles
PEN_LINE, ///< Pen for the line to handles
PEN_MAIN, ///< Pen for the main handle
PEN_NEW_POINT ///< Pen for the new point
};
/// Retrieve a pen for the drawing of parts of handles
wxPen handlePen(WhichPen p, LockMode lock);
@@ -91,11 +91,11 @@ class SymbolPointEditor : public SymbolEditorBase {
// Selection
enum Selection {
SELECTED_NONE, //^ no selection
SELECTED_POINTS, //^ some points are selected
SELECTED_HANDLE, //^ a handle is selected
SELECTED_LINE, //^ a line is selected
SELECTED_NEW_POINT //^ a new point on a line (used for hovering)
SELECTED_NONE, ///< no selection
SELECTED_POINTS, ///< some points are selected
SELECTED_HANDLE, ///< a handle is selected
SELECTED_LINE, ///< a line is selected
SELECTED_NEW_POINT ///< a new point on a line (used for hovering)
};
Selection selection;
// points
+1 -1
View File
@@ -32,7 +32,7 @@ class SymbolViewer : public SymbolView {
// --------------------------------------------------- : Point translation
Rotation rotation; //^ Object that handles rotation, scaling and translation
Rotation rotation; ///< Object that handles rotation, scaling and translation
// --------------------------------------------------- : Drawing
+3 -3
View File
@@ -35,8 +35,8 @@ class SymbolWindow : public Frame {
/// Actual initialisation
void init(Window* parent, SymbolP symbol);
SymbolControl* control; //^ The control for editing/displaying the symbol
SymbolPartList* parts; //^ A list of parts in the symbol
SymbolControl* control; ///< The control for editing/displaying the symbol
SymbolPartList* parts; ///< A list of parts in the symbol
// when editing a symbol field
// SymbolValueP value
@@ -65,7 +65,7 @@ class SymbolWindow : public Frame {
/// Activating a part: open the point editor
void onActivateFromList(wxListEvent& ev);
bool inSelectionEvent; //^ Prevent recursion in onSelect...
bool inSelectionEvent; ///< Prevent recursion in onSelect...
public:
void onSelectFromControl();