diff --git a/tools/doc/doxygen.bat b/tools/doc/doxygen.bat
new file mode 100644
index 00000000..19408f68
--- /dev/null
+++ b/tools/doc/doxygen.bat
@@ -0,0 +1,9 @@
+@echo off
+
+REM 1. Run doxygen
+
+doxygen.exe doxygen.cfg
+
+REM 2. Do some modificatios of the output
+
+perl fix.pl
\ No newline at end of file
diff --git a/tools/doc/doxygen.cfg b/tools/doc/doxygen.cfg
new file mode 100644
index 00000000..46a42053
--- /dev/null
+++ b/tools/doc/doxygen.cfg
@@ -0,0 +1,236 @@
+# Doxyfile 1.4.7
+
+#---------------------------------------------------------------------------
+# Project related configuration options
+#---------------------------------------------------------------------------
+PROJECT_NAME = "Magic Set Editor"
+PROJECT_NUMBER =
+OUTPUT_DIRECTORY = ../../doc
+CREATE_SUBDIRS = NO
+OUTPUT_LANGUAGE = English
+USE_WINDOWS_ENCODING = YES
+BRIEF_MEMBER_DESC = YES
+REPEAT_BRIEF = YES
+ABBREVIATE_BRIEF = "The $name class" \
+ "The $name widget" \
+ "The $name file" \
+ is \
+ provides \
+ specifies \
+ contains \
+ represents \
+ a \
+ an \
+ the
+ALWAYS_DETAILED_SEC = NO
+INLINE_INHERITED_MEMB = YES
+FULL_PATH_NAMES = NO
+STRIP_FROM_PATH =
+STRIP_FROM_INC_PATH =
+SHORT_NAMES = NO
+JAVADOC_AUTOBRIEF = NO
+MULTILINE_CPP_IS_BRIEF = NO
+DETAILS_AT_TOP = NO
+INHERIT_DOCS = YES
+SEPARATE_MEMBER_PAGES = NO
+TAB_SIZE = 4
+ALIASES =
+OPTIMIZE_OUTPUT_FOR_C = YES
+OPTIMIZE_OUTPUT_JAVA = NO
+BUILTIN_STL_SUPPORT = YES
+DISTRIBUTE_GROUP_DOC = NO
+SUBGROUPING = NO
+#---------------------------------------------------------------------------
+# Build related configuration options
+#---------------------------------------------------------------------------
+EXTRACT_ALL = NO
+EXTRACT_PRIVATE = YES
+EXTRACT_STATIC = YES
+EXTRACT_LOCAL_CLASSES = YES
+EXTRACT_LOCAL_METHODS = NO
+HIDE_UNDOC_MEMBERS = NO
+HIDE_UNDOC_CLASSES = NO
+HIDE_FRIEND_COMPOUNDS = NO
+HIDE_IN_BODY_DOCS = NO
+INTERNAL_DOCS = NO
+CASE_SENSE_NAMES = YES
+HIDE_SCOPE_NAMES = NO
+SHOW_INCLUDE_FILES = NO
+INLINE_INFO = YES
+SORT_MEMBER_DOCS = YES
+SORT_BRIEF_DOCS = NO
+SORT_BY_SCOPE_NAME = NO
+GENERATE_TODOLIST = YES
+GENERATE_TESTLIST = YES
+GENERATE_BUGLIST = YES
+GENERATE_DEPRECATEDLIST= YES
+ENABLED_SECTIONS =
+MAX_INITIALIZER_LINES = 30
+SHOW_USED_FILES = YES
+SHOW_DIRECTORIES = YES
+FILE_VERSION_FILTER =
+#---------------------------------------------------------------------------
+# configuration options related to warning and progress messages
+#---------------------------------------------------------------------------
+QUIET = NO
+WARNINGS = YES
+WARN_IF_UNDOCUMENTED = YES
+WARN_IF_DOC_ERROR = YES
+WARN_NO_PARAMDOC = NO
+WARN_FORMAT = "$file:$line: $text"
+WARN_LOGFILE = docwarnings.log
+#---------------------------------------------------------------------------
+# configuration options related to the input files
+#---------------------------------------------------------------------------
+INPUT = ../../src extra
+FILE_PATTERNS = *.cpp \
+ *.hpp
+RECURSIVE = YES
+EXCLUDE =
+EXCLUDE_SYMLINKS = NO
+EXCLUDE_PATTERNS =
+EXAMPLE_PATH =
+EXAMPLE_PATTERNS =
+EXAMPLE_RECURSIVE = NO
+IMAGE_PATH =
+INPUT_FILTER =
+FILTER_PATTERNS =
+FILTER_SOURCE_FILES = NO
+#---------------------------------------------------------------------------
+# configuration options related to source browsing
+#---------------------------------------------------------------------------
+SOURCE_BROWSER = NO
+INLINE_SOURCES = NO
+STRIP_CODE_COMMENTS = YES
+REFERENCED_BY_RELATION = NO
+REFERENCES_RELATION = NO
+REFERENCES_LINK_SOURCE = YES
+USE_HTAGS = NO
+VERBATIM_HEADERS = YES
+#---------------------------------------------------------------------------
+# configuration options related to the alphabetical class index
+#---------------------------------------------------------------------------
+ALPHABETICAL_INDEX = NO
+COLS_IN_ALPHA_INDEX = 5
+IGNORE_PREFIX =
+#---------------------------------------------------------------------------
+# configuration options related to the HTML output
+#---------------------------------------------------------------------------
+GENERATE_HTML = YES
+HTML_OUTPUT = .
+HTML_FILE_EXTENSION = .html
+HTML_HEADER = header.html
+HTML_FOOTER = footer.html
+HTML_STYLESHEET = style.css
+HTML_ALIGN_MEMBERS = YES
+GENERATE_HTMLHELP = NO
+CHM_FILE =
+HHC_LOCATION =
+GENERATE_CHI = YES
+BINARY_TOC = YES
+TOC_EXPAND = NO
+DISABLE_INDEX = NO
+ENUM_VALUES_PER_LINE = 4
+GENERATE_TREEVIEW = NO
+TREEVIEW_WIDTH = 250
+#---------------------------------------------------------------------------
+# configuration options related to the LaTeX output
+#---------------------------------------------------------------------------
+GENERATE_LATEX = NO
+LATEX_OUTPUT = latex
+LATEX_CMD_NAME = latex
+MAKEINDEX_CMD_NAME = makeindex
+COMPACT_LATEX = NO
+PAPER_TYPE = a4wide
+EXTRA_PACKAGES =
+LATEX_HEADER =
+PDF_HYPERLINKS = NO
+USE_PDFLATEX = NO
+LATEX_BATCHMODE = NO
+LATEX_HIDE_INDICES = NO
+#---------------------------------------------------------------------------
+# configuration options related to the RTF output
+#---------------------------------------------------------------------------
+GENERATE_RTF = NO
+RTF_OUTPUT = rtf
+COMPACT_RTF = NO
+RTF_HYPERLINKS = NO
+RTF_STYLESHEET_FILE =
+RTF_EXTENSIONS_FILE =
+#---------------------------------------------------------------------------
+# configuration options related to the man page output
+#---------------------------------------------------------------------------
+GENERATE_MAN = NO
+MAN_OUTPUT = man
+MAN_EXTENSION = .3
+MAN_LINKS = NO
+#---------------------------------------------------------------------------
+# configuration options related to the XML output
+#---------------------------------------------------------------------------
+GENERATE_XML = NO
+XML_OUTPUT = xml
+XML_SCHEMA =
+XML_DTD =
+XML_PROGRAMLISTING = YES
+#---------------------------------------------------------------------------
+# configuration options for the AutoGen Definitions output
+#---------------------------------------------------------------------------
+GENERATE_AUTOGEN_DEF = NO
+#---------------------------------------------------------------------------
+# configuration options related to the Perl module output
+#---------------------------------------------------------------------------
+GENERATE_PERLMOD = NO
+PERLMOD_LATEX = NO
+PERLMOD_PRETTY = YES
+PERLMOD_MAKEVAR_PREFIX =
+#---------------------------------------------------------------------------
+# Configuration options related to the preprocessor
+#---------------------------------------------------------------------------
+ENABLE_PREPROCESSING = YES
+MACRO_EXPANSION = NO
+EXPAND_ONLY_PREDEF = NO
+SEARCH_INCLUDES = YES
+INCLUDE_PATH =
+INCLUDE_FILE_PATTERNS =
+PREDEFINED = UNICODE
+EXPAND_AS_DEFINED = DECLARE_POINTER_TYPE
+SKIP_FUNCTION_MACROS = YES
+#---------------------------------------------------------------------------
+# Configuration::additions related to external references
+#---------------------------------------------------------------------------
+TAGFILES =
+GENERATE_TAGFILE =
+ALLEXTERNALS = NO
+EXTERNAL_GROUPS = YES
+PERL_PATH = /usr/bin/perl
+#---------------------------------------------------------------------------
+# Configuration options related to the dot tool
+#---------------------------------------------------------------------------
+CLASS_DIAGRAMS = YES
+HIDE_UNDOC_RELATIONS = NO
+HAVE_DOT = YES
+CLASS_GRAPH = YES
+COLLABORATION_GRAPH = NO
+GROUP_GRAPHS = YES
+UML_LOOK = NO
+TEMPLATE_RELATIONS = YES
+INCLUDE_GRAPH = YES
+INCLUDED_BY_GRAPH = YES
+CALL_GRAPH = NO
+CALLER_GRAPH = NO
+GRAPHICAL_HIERARCHY = YES
+DIRECTORY_GRAPH = YES
+DOT_IMAGE_FORMAT = png
+DOT_PATH =
+DOTFILE_DIRS =
+MAX_DOT_GRAPH_WIDTH = 1024
+MAX_DOT_GRAPH_HEIGHT = 1024
+MAX_DOT_GRAPH_DEPTH = 1000
+DOT_TRANSPARENT = NO
+DOT_MULTI_TARGETS = NO
+GENERATE_LEGEND = YES
+DOT_CLEANUP = YES
+#---------------------------------------------------------------------------
+# Configuration::additions related to the search engine
+#---------------------------------------------------------------------------
+SEARCHENGINE = YES
diff --git a/tools/doc/extra/overview.hpp b/tools/doc/extra/overview.hpp
new file mode 100644
index 00000000..55e8406a
--- /dev/null
+++ b/tools/doc/extra/overview.hpp
@@ -0,0 +1,123 @@
+/** \mainpage
+
+This is the documentation of the Magic Set Editor (MSE) source code, automatically generated using doxygen.
+
+
Structure
+
+The MSE source code is subdivided into several directories, with the following meaning:
+ - util: Utility functions and classes, stuff that would work equally well in another project
+ - gfx: Graphics related functions, again mostly independent of MSE.
+ This directory contains algorithms for image blending, scaling, and bezier curve functions.
+ - data: Data structures, like sets, cards, symbols, etc.
+ These data structures are documented in the 'Extending MSE' section of the official documentation.
+ - data/action: Actions that can be applied to those data structures.
+ - gui: Graphical User Interface
+ - resource: Resource files used (icons, cursors, etc.)
+
+
+
Libraries/dependencies
+
+MSE depends on the following libraries:
+ - wxWidgets for the GUI.
+ - boost, just for shared_ptr and some preprocessor tricks.
+
+Additional tools (not needed for building MSE) also depend on:
+ - doxygen for generating the documentation.
+ - Perl for small utility scripts
+
+
+
Coding style
+
+MSE uses the following coding style:
+@code
+class ClassName {
+ public:
+ void someFunction();
+ private:
+ int someMember;
+};
+@endcode
+
+The exception to this rule are wxWidgets functions, which LookLikeThis; and classes, which look like wxSomeClass.
+As well as standard library functions.
+
+
+
Macro and template tricks
+
+The source code uses several macro/preprocessor and template tricks to make the code more readable.
+
+
Smart pointers
+
+MSE makes extensive use of boost::shared_ptr. To make the code more readable there are typedefs for these pointer types, using a suffix P.
+These are defined using a macro:
+@code
+ DECLARE_POINTER_TYPE(MyClass);
+ MyClassP someObject; // the same as boost::shared_ptr someObject
+@endcode
+
+To create new shared_ptrs the function new_shared# can be used (where # is the number of arguments):
+@code
+ MyClassP someObject;
+ someObject = new_shared2(arg1, arg2);
+@endcode
+
+Implemented in: util/smart_ptr.hpp
+
+
Iterating
+
+To iterate over containers the FOR_EACH macro is used:
+@code
+ vector cards;
+ FOR_EACH(card, cards) {
+ doSomething(card);
+ }
+@endcode
+Is equivalent to:
+@code
+ vector cards;
+ for(vector::iterator it = cards.begin() ; it != cards.end() ; ++it) {
+ CardP& card = *it;
+ doSomething(card);
+ }
+@endcode
+The iterators are completely hidden!
+There are several veriations to this macro, for using const iterators (FOR_EACH_CONST), iterating in reverse (FOR_EACH_REVERSE),
+for iterating over two collections in parallel (FOR_EACH_2), and for getting access to the iterator (FOR_EACH_IT).
+
+Each of these macros require that the collection type has been declared using:
+@code
+ DECLARE_COLLECTION_TYPE(CardP);
+@endcode
+This allows the calling of TYPEOF(cards) to evaluate to vector.
+
+Implemented in: util/for_each.hpp
+
+
Reflection
+
+The io (input/output) system is based on reflection.
+For a class to support reflection the following must be declared:
+@code
+ class SomeClass {
+ int member1, member2;
+ DECLARE_REFLECTION();
+ };
+@endcode
+Then in a source file the members of the class have to be specified:
+@code
+ IMPLEMENT_REFLECTION(SomeClass) {
+ REFLECT(member1);
+ REFLECT_N("another_name", member2);
+ }
+@endcode
+
+Simlairly for enumerations (a declaration is not necessary):
+@code
+ IMPLEMENT_REFLECTION_ENUM(MyEnum) {
+ VALUE(value_of_enum_1); // the default value
+ VALUE(value_of_enum_2);
+ }
+@endcode
+
+Implemented in: util/reflect.hpp
+
+*/
\ No newline at end of file
diff --git a/tools/doc/fix.pl b/tools/doc/fix.pl
new file mode 100644
index 00000000..920cf054
--- /dev/null
+++ b/tools/doc/fix.pl
@@ -0,0 +1,38 @@
+#! /usr/bin/perl
+
+@html = <../../doc/*.html>;
+
+# for each html file
+foreach $file (@html) {
+ # read
+ open F, "< $file";
+ $_ = join('',);
+ close F;
+
+ # cleanup : globals heading
+
+ # in globals?
+ $in_globals = m{