# HG changeset patch # User insilmaril # Date 1225800550 0 # Node ID a8a98a94899ac6d7e8d04f4da45bdce3db587b4f # Parent 96402b17217318a10b15ed6c9dc21dd7c94c498d Selections work (a little bit) diff -r 96402b172173 -r a8a98a94899a doxygen.config --- a/doxygen.config Wed Oct 29 17:42:34 2008 +0000 +++ b/doxygen.config Tue Nov 04 12:09:10 2008 +0000 @@ -1,4 +1,4 @@ -# Doxyfile 1.5.0 +# Doxyfile 1.5.5 # This file describes the settings to be used by the documentation system # doxygen (www.doxygen.org) for a project @@ -14,10 +14,18 @@ # Project related configuration options #--------------------------------------------------------------------------- +# This tag specifies the encoding used for all characters in the config file +# that follow. The default is UTF-8 which is also the encoding used for all +# text before the first occurrence of this tag. Doxygen uses libiconv (or the +# iconv built into libc) for the transcoding. See +# http://www.gnu.org/software/libiconv for the list of possible encodings. + +DOXYFILE_ENCODING = UTF-8 + # The PROJECT_NAME tag is a single word (or a sequence of words surrounded # by quotes) that should identify the project. -PROJECT_NAME = "VYM - View Your Mind" +PROJECT_NAME = # The PROJECT_NUMBER tag can be used to enter a project or revision number. # This could be handy for archiving the generated documentation or @@ -30,7 +38,7 @@ # If a relative path is entered, it will be relative to the location # where doxygen was started. If left blank the current directory will be used. -OUTPUT_DIRECTORY = doc +OUTPUT_DIRECTORY = # If the CREATE_SUBDIRS tag is set to YES, then doxygen will create # 4096 sub-directories (in 2 levels) under the output directory of each output @@ -46,23 +54,14 @@ # information to generate all constant output in the proper language. # The default language is English, other supported languages are: # Afrikaans, Arabic, Brazilian, Catalan, Chinese, Chinese-Traditional, -# Croatian, Czech, Danish, Dutch, Finnish, French, German, Greek, Hungarian, -# Italian, Japanese, Japanese-en (Japanese with English messages), Korean, -# Korean-en, Lithuanian, Norwegian, Polish, Portuguese, Romanian, Russian, -# Serbian, Slovak, Slovene, Spanish, Swedish, and Ukrainian. +# Croatian, Czech, Danish, Dutch, Farsi, Finnish, French, German, Greek, +# Hungarian, Italian, Japanese, Japanese-en (Japanese with English messages), +# Korean, Korean-en, Lithuanian, Norwegian, Macedonian, Persian, Polish, +# Portuguese, Romanian, Russian, Serbian, Slovak, Slovene, Spanish, Swedish, +# and Ukrainian. OUTPUT_LANGUAGE = English -# This tag can be used to specify the encoding used in the generated output. -# The encoding is not always determined by the language that is chosen, -# but also whether or not the output is meant for Windows or non-Windows users. -# In case there is a difference, setting the USE_WINDOWS_ENCODING tag to YES -# forces the Windows encoding (this is the default for the Windows binary), -# whereas setting the tag to NO uses a Unix-style encoding (the default for -# all platforms other than Windows). - -USE_WINDOWS_ENCODING = NO - # If the BRIEF_MEMBER_DESC tag is set to YES (the default) Doxygen will # include brief member descriptions after the members that are listed in # the file and class documentation (similar to JavaDoc). @@ -135,11 +134,19 @@ # If the JAVADOC_AUTOBRIEF tag is set to YES then Doxygen # will interpret the first line (until the first dot) of a JavaDoc-style # comment as the brief description. If set to NO, the JavaDoc -# comments will behave just like the Qt-style comments (thus requiring an -# explicit @brief command for a brief description. +# comments will behave just like regular Qt-style comments +# (thus requiring an explicit @brief command for a brief description.) JAVADOC_AUTOBRIEF = NO +# If the QT_AUTOBRIEF tag is set to YES then Doxygen will +# interpret the first line (until the first dot) of a Qt-style +# comment as the brief description. If set to NO, the comments +# will behave just like regular Qt-style comments (thus requiring +# an explicit \brief command for a brief description.) + +QT_AUTOBRIEF = NO + # The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make Doxygen # treat a multi-line C++ special comment block (i.e. a block of //! or /// # comments) as a brief description. This used to be the default behaviour. @@ -189,14 +196,26 @@ OPTIMIZE_OUTPUT_FOR_C = NO # Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java -# sources only. Doxygen will then generate output that is more tailored for Java. -# For instance, namespaces will be presented as packages, qualified scopes -# will look different, etc. +# sources only. Doxygen will then generate output that is more tailored for +# Java. For instance, namespaces will be presented as packages, qualified +# scopes will look different, etc. OPTIMIZE_OUTPUT_JAVA = NO -# If you use STL classes (i.e. std::string, std::vector, etc.) but do not want to -# include (a tag file for) the STL sources as input, then you should +# Set the OPTIMIZE_FOR_FORTRAN tag to YES if your project consists of Fortran +# sources only. Doxygen will then generate output that is more tailored for +# Fortran. + +OPTIMIZE_FOR_FORTRAN = NO + +# Set the OPTIMIZE_OUTPUT_VHDL tag to YES if your project consists of VHDL +# sources. Doxygen will then generate output that is tailored for +# VHDL. + +OPTIMIZE_OUTPUT_VHDL = NO + +# If you use STL classes (i.e. std::string, std::vector, etc.) but do not want +# to include (a tag file for) the STL sources as input, then you should # set this tag to YES in order to let doxygen match functions declarations and # definitions whose arguments contain STL classes (e.g. func(std::string); v.s. # func(std::string) {}). This also make the inheritance and collaboration @@ -204,6 +223,17 @@ BUILTIN_STL_SUPPORT = NO +# If you use Microsoft's C++/CLI language, you should set this option to YES to +# enable parsing support. + +CPP_CLI_SUPPORT = NO + +# Set the SIP_SUPPORT tag to YES if your project consists of sip sources only. +# Doxygen will parse them like normal C++ but will assume all classes use public +# instead of private inheritance when no explicit protection keyword is present. + +SIP_SUPPORT = NO + # If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC # tag is set to YES, then doxygen will reuse the documentation of the first # member in the group (if any) for the other members of the group. By default @@ -219,6 +249,16 @@ SUBGROUPING = YES +# When TYPEDEF_HIDES_STRUCT is enabled, a typedef of a struct, union, or enum +# is documented as struct, union, or enum with the name of the typedef. So +# typedef struct TypeS {} TypeT, will appear in the documentation as a struct +# with name TypeT. When disabled the typedef will appear as a member of a file, +# namespace, or class. And the struct will be named TypeS. This can typically +# be useful for C code in case the coding convention dictates that all compound +# types are typedef'ed and only the typedef is referenced, never the tag name. + +TYPEDEF_HIDES_STRUCT = NO + #--------------------------------------------------------------------------- # Build related configuration options #--------------------------------------------------------------------------- @@ -253,6 +293,14 @@ EXTRACT_LOCAL_METHODS = NO +# If this flag is set to YES, the members of anonymous namespaces will be +# extracted and appear in the documentation as a namespace called +# 'anonymous_namespace{file}', where file will be replaced with the base +# name of the file that contains the anonymous namespace. By default +# anonymous namespace are hidden. + +EXTRACT_ANON_NSPACES = NO + # If the HIDE_UNDOC_MEMBERS tag is set to YES, Doxygen will hide all # undocumented members of documented classes, files or namespaces. # If set to NO (the default) these members will be included in the @@ -328,6 +376,12 @@ SORT_BRIEF_DOCS = NO +# If the SORT_GROUP_NAMES tag is set to YES then doxygen will sort the +# hierarchy of group names into alphabetical order. If set to NO (the default) +# the group names will appear in their defined order. + +SORT_GROUP_NAMES = NO + # If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be # sorted by fully-qualified names, including namespaces. If set to # NO (the default), the class list will be sorted only by class name, @@ -390,8 +444,8 @@ SHOW_DIRECTORIES = NO # The FILE_VERSION_FILTER tag can be used to specify a program or script that -# doxygen should invoke to get the current version for each file (typically from the -# version control system). Doxygen will invoke the program by executing (via +# doxygen should invoke to get the current version for each file (typically from +# the version control system). Doxygen will invoke the program by executing (via # popen()) the command , where is the value of # the FILE_VERSION_FILTER tag, and is the name of an input file # provided by doxygen. Whatever the program writes to standard output @@ -461,12 +515,20 @@ INPUT = +# This tag can be used to specify the character encoding of the source files +# that doxygen parses. Internally doxygen uses the UTF-8 encoding, which is +# also the default input encoding. Doxygen uses libiconv (or the iconv built +# into libc) for the transcoding. See http://www.gnu.org/software/libiconv for +# the list of possible encodings. + +INPUT_ENCODING = UTF-8 + # If the value of the INPUT tag contains directories, you can use the # FILE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp # and *.h) to filter out the source-files in the directories. If left # blank the following patterns are tested: # *.c *.cc *.cxx *.cpp *.c++ *.java *.ii *.ixx *.ipp *.i++ *.inl *.h *.hh *.hxx -# *.hpp *.h++ *.idl *.odl *.cs *.php *.php3 *.inc *.m *.mm *.py +# *.hpp *.h++ *.idl *.odl *.cs *.php *.php3 *.inc *.m *.mm *.py *.f90 FILE_PATTERNS = @@ -494,7 +556,15 @@ # against the file with absolute path, so to exclude all test directories # for example use the pattern */test/* -EXCLUDE_PATTERNS = moc_* +EXCLUDE_PATTERNS = + +# The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names +# (namespaces, classes, functions, etc.) that should be excluded from the +# output. The symbol name can be a fully qualified name, a word, or if the +# wildcard * is used, a substring. Examples: ANamespace, AClass, +# AClass::ANamespace, ANamespace::*Test + +EXCLUDE_SYMBOLS = # The EXAMPLE_PATH tag can be used to specify one or more files or # directories that contain example code fragments that are included (see @@ -573,13 +643,13 @@ # then for each documented function all documented # functions referencing it will be listed. -REFERENCED_BY_RELATION = YES +REFERENCED_BY_RELATION = NO # If the REFERENCES_RELATION tag is set to YES (the default) # then for each documented function all documented entities # called/used by that function will be listed. -REFERENCES_RELATION = YES +REFERENCES_RELATION = NO # If the REFERENCES_LINK_SOURCE tag is set to YES (the default) # and SOURCE_BROWSER tag is set to YES, then the hyperlinks from @@ -675,11 +745,44 @@ # If the GENERATE_HTMLHELP tag is set to YES, additional index files # will be generated that can be used as input for tools like the -# Microsoft HTML help workshop to generate a compressed HTML help file (.chm) +# Microsoft HTML help workshop to generate a compiled HTML help file (.chm) # of the generated HTML documentation. GENERATE_HTMLHELP = NO +# If the GENERATE_DOCSET tag is set to YES, additional index files +# will be generated that can be used as input for Apple's Xcode 3 +# integrated development environment, introduced with OSX 10.5 (Leopard). +# To create a documentation set, doxygen will generate a Makefile in the +# HTML output directory. Running make will produce the docset in that +# directory and running "make install" will install the docset in +# ~/Library/Developer/Shared/Documentation/DocSets so that Xcode will find +# it at startup. + +GENERATE_DOCSET = NO + +# When GENERATE_DOCSET tag is set to YES, this tag determines the name of the +# feed. A documentation feed provides an umbrella under which multiple +# documentation sets from a single provider (such as a company or product suite) +# can be grouped. + +DOCSET_FEEDNAME = "Doxygen generated docs" + +# When GENERATE_DOCSET tag is set to YES, this tag specifies a string that +# should uniquely identify the documentation set bundle. This should be a +# reverse domain-name style string, e.g. com.mycompany.MyDocSet. Doxygen +# will append .docset to the name. + +DOCSET_BUNDLE_ID = org.doxygen.Project + +# If the HTML_DYNAMIC_SECTIONS tag is set to YES then the generated HTML +# documentation will contain sections that can be hidden and shown after the +# page has loaded. For this to work a browser that supports +# JavaScript and DHTML is required (for instance Mozilla 1.0+, Firefox +# Netscape 6.0+, Internet explorer 5.0+, Konqueror, or Safari). + +HTML_DYNAMIC_SECTIONS = NO + # If the GENERATE_HTMLHELP tag is set to YES, the CHM_FILE tag can # be used to specify the file name of the resulting .chm file. You # can add a path in front of the file if the result should not be @@ -744,7 +847,7 @@ # If the GENERATE_LATEX tag is set to YES (the default) Doxygen will # generate Latex output. -GENERATE_LATEX = NO +GENERATE_LATEX = YES # The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put. # If a relative path is entered the value of OUTPUT_DIRECTORY will be @@ -792,13 +895,13 @@ # contain links (just like the HTML output) instead of page references # This makes the output suitable for online browsing using a pdf viewer. -PDF_HYPERLINKS = NO +PDF_HYPERLINKS = YES # If the USE_PDFLATEX tag is set to YES, pdflatex will be used instead of # plain latex in the generated Makefile. Set this option to YES to get a # higher quality PDF documentation. -USE_PDFLATEX = NO +USE_PDFLATEX = YES # If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \\batchmode. # command to the generated LaTeX files. This will instruct LaTeX to keep @@ -1085,6 +1188,15 @@ CLASS_DIAGRAMS = YES +# You can define message sequence charts within doxygen comments using the \msc +# command. Doxygen will then run the mscgen tool (see +# http://www.mcternan.me.uk/mscgen/) to produce the chart and insert it in the +# documentation. The MSCGEN_PATH tag allows you to specify the directory where +# the mscgen tool resides. If left empty the tool is assumed to be found in the +# default search path. + +MSCGEN_PATH = + # If set to YES, the inheritance and collaboration graphs will hide # inheritance and usage relations if the target is undocumented # or is not a class. @@ -1142,19 +1254,19 @@ INCLUDED_BY_GRAPH = YES -# If the CALL_GRAPH and HAVE_DOT tags are set to YES then doxygen will -# generate a call dependency graph for every global function or class method. -# Note that enabling this option will significantly increase the time of a run. -# So in most cases it will be better to enable call graphs for selected -# functions only using the \callgraph command. +# If the CALL_GRAPH and HAVE_DOT options are set to YES then +# doxygen will generate a call dependency graph for every global function +# or class method. Note that enabling this option will significantly increase +# the time of a run. So in most cases it will be better to enable call graphs +# for selected functions only using the \callgraph command. CALL_GRAPH = NO -# If the CALLER_GRAPH and HAVE_DOT tags are set to YES then doxygen will -# generate a caller dependency graph for every global function or class method. -# Note that enabling this option will significantly increase the time of a run. -# So in most cases it will be better to enable caller graphs for selected -# functions only using the \callergraph command. +# If the CALLER_GRAPH and HAVE_DOT tags are set to YES then +# doxygen will generate a caller dependency graph for every global function +# or class method. Note that enabling this option will significantly increase +# the time of a run. So in most cases it will be better to enable caller +# graphs for selected functions only using the \callergraph command. CALLER_GRAPH = NO @@ -1187,41 +1299,33 @@ DOTFILE_DIRS = -# The MAX_DOT_GRAPH_WIDTH tag can be used to set the maximum allowed width -# (in pixels) of the graphs generated by dot. If a graph becomes larger than -# this value, doxygen will try to truncate the graph, so that it fits within -# the specified constraint. Beware that most browsers cannot cope with very -# large images. +# The MAX_DOT_GRAPH_MAX_NODES tag can be used to set the maximum number of +# nodes that will be shown in the graph. If the number of nodes in a graph +# becomes larger than this value, doxygen will truncate the graph, which is +# visualized by representing a node as a red box. Note that doxygen if the +# number of direct children of the root node in a graph is already larger than +# DOT_GRAPH_MAX_NODES then the graph will not be shown at all. Also note +# that the size of a graph can be further restricted by MAX_DOT_GRAPH_DEPTH. -MAX_DOT_GRAPH_WIDTH = 1024 - -# The MAX_DOT_GRAPH_HEIGHT tag can be used to set the maximum allows height -# (in pixels) of the graphs generated by dot. If a graph becomes larger than -# this value, doxygen will try to truncate the graph, so that it fits within -# the specified constraint. Beware that most browsers cannot cope with very -# large images. - -MAX_DOT_GRAPH_HEIGHT = 1024 +DOT_GRAPH_MAX_NODES = 50 # The MAX_DOT_GRAPH_DEPTH tag can be used to set the maximum depth of the # graphs generated by dot. A depth value of 3 means that only nodes reachable # from the root by following a path via at most 3 edges will be shown. Nodes # that lay further from the root node will be omitted. Note that setting this # option to 1 or 2 may greatly reduce the computation time needed for large -# code bases. Also note that a graph may be further truncated if the graph's -# image dimensions are not sufficient to fit the graph (see MAX_DOT_GRAPH_WIDTH -# and MAX_DOT_GRAPH_HEIGHT). If 0 is used for the depth value (the default), -# the graph is not depth-constrained. +# code bases. Also note that the size of a graph can be further restricted by +# DOT_GRAPH_MAX_NODES. Using a depth of 0 means no depth restriction. MAX_DOT_GRAPH_DEPTH = 0 # Set the DOT_TRANSPARENT tag to YES to generate images with a transparent -# background. This is disabled by default, which results in a white background. -# Warning: Depending on the platform used, enabling this option may lead to -# badly anti-aliased labels on the edges of a graph (i.e. they become hard to -# read). +# background. This is enabled by default, which results in a transparent +# background. Warning: Depending on the platform used, enabling this option +# may lead to badly anti-aliased labels on the edges of a graph (i.e. they +# become hard to read). -DOT_TRANSPARENT = NO +DOT_TRANSPARENT = YES # Set the DOT_MULTI_TARGETS tag to YES allow dot to generate multiple output # files in one run (i.e. multiple -o and -T options on the command line). This diff -r 96402b172173 -r a8a98a94899a mapeditor.cpp --- a/mapeditor.cpp Wed Oct 29 17:42:34 2008 +0000 +++ b/mapeditor.cpp Tue Nov 04 12:09:10 2008 +0000 @@ -43,7 +43,7 @@ model=vm; model->setScene (mapScene); model->registerEditor(this); - model->addMapCenter(); // FIXME create this in MapEditor until BO and MCO are independent of scene +// model->addMapCenter(); // FIXME create this in MapEditor until BO and MCO are independent of scene model->makeDefault(); // No changes in model so far setScene (mapScene); @@ -82,15 +82,18 @@ QAction *a = new QAction( tr( "Edit heading","MapEditor" ), this); a->setShortcut ( Qt::Key_Return ); //Edit heading - //a->setShortcutContext (Qt::WindowShortcut); addAction (a); connect( a, SIGNAL( triggered() ), this, SLOT( editHeading() ) ); a = new QAction( tr( "Edit heading","MapEditor" ), this); a->setShortcut ( Qt::Key_Enter); //Edit heading - //a->setShortcutContext (Qt::WindowShortcut); addAction (a); connect( a, SIGNAL( triggered() ), this, SLOT( editHeading() ) ); + // Selections + selModel=vm->getSelectionModel(); + selectionColor =QColor (255,255,0); + + // Attributes //FIXME testing only... QString k; AttributeDef *ad; @@ -273,12 +276,6 @@ } } -void MapEditor::updateSelection() -{ - // Tell selection to update geometries - model->updateSelection(); -} - AttributeTable* MapEditor::attributeTable() { return attrTable; @@ -1041,26 +1038,71 @@ event->acceptProposedAction(); } +void MapEditor::updateSelection(const QItemSelection &newsel,const QItemSelection &) +{ + cout << "ME::updateSelection\n"; + QGraphicsRectItem *sb; -bool isUnicode16(const QByteArray &d) -{ - // TODO: make more precise check for unicode 16. - // Guess unicode16 if any of second bytes are zero - unsigned int length = max(0,d.size()-2)/2; - for (unsigned int i = 0; iaddRect( + QRectF(0,0,0,0), + QPen(selectionColor), + selectionColor); + sb->setZValue(Z_SELBOX); + sb->show(); + selboxList.append (sb); + } else + sb=selboxList.first(); + + QModelIndex index=newsel.indexes().first(); // TODO no multiselections yet + + TreeItem *item = static_cast(index.internalPointer()); + LinkableMapObj *lmo=item->getLMO(); + + int w=0; // FIXME what for? + if (lmo) + { + QRectF bbox=lmo->getBBox(); + selboxList.first()->setRect ( + bbox.x()-w,bbox.y()-w, + bbox.width()+2*w, bbox.height()+2*w); + selboxList.first()->setPen (selectionColor); + selboxList.first()->setBrush (selectionColor); + } + + + } -QItemSelectionModel* MapEditor::selectionModel () +void MapEditor::updateSelectionGeometry() // FIXME VM only called from VM::animate... { - return selModel; + cout << "ME::updateSelectionGeometry\n"; + + // Tell selection to update geometries + model->updateSelection(); } + +void MapEditor::setSelectionColor (QColor col) +{ + selectionColor=col; + updateSelectionGeometry(); +} + +QColor MapEditor::getSelectionColor () +{ + return selectionColor; +} + + diff -r 96402b172173 -r a8a98a94899a mapeditor.h --- a/mapeditor.h Wed Oct 29 17:42:34 2008 +0000 +++ b/mapeditor.h Tue Nov 04 12:09:10 2008 +0000 @@ -28,7 +28,6 @@ public: void toggleStandardFlag(QString); - void updateSelection(); // update geometry of selection AttributeTable* attributeTable(); void testFunction1(); // just testing new stuff @@ -92,11 +91,21 @@ QPoint exportOffset; // set before export, used in save -public: - void setSelectionModel (QItemSelectionModel*); - QItemSelectionModel* selectionModel(); +//////////// Selection related +signals: + void selectionChanged(); // Emitted when selection or its represantion changes + private: QItemSelectionModel* selModel; // we treat MapEditor as View here... + QList selboxList; + QColor selectionColor; + +public slots: + void updateSelection(const QItemSelection &,const QItemSelection &); // update selection +public: + void updateSelectionGeometry(); // update geometry of selection + void setSelectionColor (QColor c); + QColor getSelectionColor (); }; #endif diff -r 96402b172173 -r a8a98a94899a selection.cpp --- a/selection.cpp Wed Oct 29 17:42:34 2008 +0000 +++ b/selection.cpp Tue Nov 04 12:09:10 2008 +0000 @@ -11,7 +11,6 @@ Selection::Selection() { - color= QColor(255,255,0); blocked=false; } @@ -22,7 +21,7 @@ void Selection::setModel (VymModel *m) { model=m; - scene=model->getScene(); + selModel=model->getSelectionModel(); } void Selection::copy(const Selection &other) @@ -37,36 +36,28 @@ lastSelectList.clear(); } -void Selection::update() // FIXME this needs to be adapted to several views +void Selection::update() // TODO this needs to be adapted to several views { QRectF bbox; - int w=0; + //int w=0; for (int i=0; i< selectList.count(); ++i) { bbox=selectList.at(i)->getBBox(); + /* FIXME VM move to MapEditor selboxList.at(i)->setRect ( bbox.x()-w,bbox.y()-w, bbox.width()+2*w, bbox.height()+2*w); selboxList.at(i)->setPen (color); selboxList.at(i)->setBrush (color); + */ } } -void Selection::setColor (QColor col) -{ - color=col; - update(); -} - -QColor Selection::getColor () -{ - return color; -} - bool Selection::select(LinkableMapObj *lmo) // TODO no multiselections yet { if (!selectList.isEmpty()) unselect(); selectList.append (lmo); + /* FIXME VM move to ME QGraphicsRectItem *sb = scene->addRect( QRectF(0,0,0,0), QPen(color), @@ -74,6 +65,7 @@ sb->setZValue(Z_SELBOX); sb->show(); selboxList.append (sb); + */ lmo->select(); update(); mainWindow->updateSatellites (model); @@ -114,8 +106,10 @@ selectList.at(i)->unselect(); lastSelectList=selectList; selectList.clear(); - while (!selboxList.isEmpty() ) + /* FIXME VM move to ME + while (!selboxList.isEmpty() ) delete selboxList.takeFirst(); + */ } } @@ -188,10 +182,16 @@ TreeItem* Selection::getBranchItem() { BranchObj* bo=getBranch(); - if (bo) return bo->getTreeItem(); + if (bo) return bo->getTreeItem(); // FIXME VM get directly from treemodl return NULL; } +QModelIndex Selection::getBranchIndex() +{ + return selModel->selectedIndexes().first(); // TODO no multiselections yet + +} + FloatImageObj* Selection::getFloatImage() { if (!selectList.isEmpty()) diff -r 96402b172173 -r a8a98a94899a selection.h --- a/selection.h Wed Oct 29 17:42:34 2008 +0000 +++ b/selection.h Tue Nov 04 12:09:10 2008 +0000 @@ -4,6 +4,7 @@ #include #include #include +#include #include "treeitem.h" @@ -24,8 +25,6 @@ void clear(); void setModel (VymModel *); void update(); - void setColor (QColor c); - QColor getColor (); bool select (LinkableMapObj*); bool select (const QString &); bool reselect (); @@ -40,17 +39,18 @@ LinkableMapObj * single(); // NULL, if multiple selected BranchObj* getBranch(); TreeItem* getBranchItem(); + QModelIndex getBranchIndex(); //!< Returns index of first selected branch or mapcenter FloatImageObj* getFloatImage(); QString getSelectString(); private: - void init(); QList selectList; QList lastSelectList; - QList selboxList; + VymModel *model; - QGraphicsScene *scene; + + QItemSelectionModel *selModel; //!< QSelectionModel is shared across views and initialized in setModel QColor color; bool blocked; //!< if true, no new selection possible diff -r 96402b172173 -r a8a98a94899a version.h --- a/version.h Wed Oct 29 17:42:34 2008 +0000 +++ b/version.h Tue Nov 04 12:09:10 2008 +0000 @@ -7,7 +7,7 @@ #define __VYM_VERSION "1.13.0" //#define __VYM_CODENAME "Codename: RC-1" #define __VYM_CODENAME "Codename: development version" -#define __VYM_BUILD_DATE "2008-10-29" +#define __VYM_BUILD_DATE "2008-11-04" bool checkVersion(const QString &); diff -r 96402b172173 -r a8a98a94899a vymmodel.cpp --- a/vymmodel.cpp Wed Oct 29 17:42:34 2008 +0000 +++ b/vymmodel.cpp Tue Nov 04 12:09:10 2008 +0000 @@ -86,6 +86,9 @@ // No MapEditor yet mapEditor=NULL; + // Also no scene yet (should not be needed anyway) FIXME VM + mapScene=NULL; + // History mapNum++; mapChanged=false; @@ -120,6 +123,7 @@ // selections + selModel=NULL; selection.setModel (this); selection.unselect(); @@ -223,7 +227,7 @@ xml.attribut("comment",comment) + xml.attribut("date",getDate()) + xml.attribut("backgroundColor", mapScene->backgroundBrush().color().name() ) + - xml.attribut("selectionColor", selection.getColor().name() ) + + xml.attribut("selectionColor", mapEditor->getSelectionColor().name() ) + xml.attribut("linkStyle", ls ) + xml.attribut("linkColor", defLinkColor.name() ) + xml.attribut("defXLinkColor", defXLinkColor.name() ) + @@ -1589,8 +1593,9 @@ void VymModel::setScene (QGraphicsScene *s) { - mapScene=s; - init(); // Here we have a mapScene set, + cout << "VM::setscene scene="<getParObj(); selection.unselect(); @@ -4131,7 +4139,7 @@ bo->reposition(); i++; } - mapEditor->updateSelection(); + emit (selectionChanged(selModel->selection(), selModel->selection()) ); mapScene->update(); if (!animObjList.isEmpty()) animationTimer->start(); } @@ -4305,12 +4313,12 @@ { if ( !col.isValid() ) return; saveState ( - QString("setSelectionColor (%1)").arg(selection.getColor().name()), + QString("setSelectionColor (%1)").arg(mapEditor->getSelectionColor().name()), QString("setSelectionColor (%1)").arg(col.name()), QString("Set color of selection box to %1").arg(col.name()) ); - selection.setColor (col); + mapEditor->setSelectionColor (col); } void VymModel::updateSelection() @@ -4322,7 +4330,7 @@ { if ( !col.isValid() ) return; saveState ( - QString("setSelectionColor (%1)").arg(selection.getColor().name()), + QString("setSelectionColor (%1)").arg(mapEditor->getSelectionColor().name()), QString("setSelectionColor (%1)").arg(col.name()), QString("Set color of selection box to %1").arg(col.name()) ); @@ -4331,7 +4339,7 @@ QColor VymModel::getSelectionColor() { - return selection.getColor(); + return mapEditor->getSelectionColor(); } void VymModel::setHideTmpMode (HideTmpMode mode) @@ -4359,6 +4367,12 @@ void VymModel::setSelectionModel (QItemSelectionModel *sm) { selModel=sm; + cout << "VM::setSelModel selModel="<setMinimumWidth (350); treeview->setColumnWidth (0,350); - // ItemSelectionModel selModel=treeview->selectionModel(); + model->setSelectionModel (selModel); connect ( selModel, SIGNAL (selectionChanged(const QItemSelection &, const QItemSelection &)), this,SLOT (changeSelection(const QItemSelection &,const QItemSelection &))); - model->setSelectionModel (selModel); // Create good old MapEditor MapEditor* me=model->getMapEditor(); if (!me) me=new MapEditor (model); + connect ( + selModel, SIGNAL (selectionChanged(const QItemSelection &, const QItemSelection &)), + me,SLOT (updateSelection(const QItemSelection &,const QItemSelection &))); - me->setSelectionModel (selModel); + // VymModel may want to update selection, e.g. during animation + connect ( + model, SIGNAL (selectionChanged(const QItemSelection &, const QItemSelection &)), + me,SLOT (updateSelection(const QItemSelection &,const QItemSelection &))); + //me->viewport()->setFocus(); //FIXME me->setAntiAlias (actionViewToggleAntiAlias->isOn()); @@ -41,8 +47,10 @@ QItemSelectionModel* VymView::selectionModel() { - if (treeview) return selModel; - else std::cout <<"hey, no treeview so far???\n"; + if (treeview) + return selModel; + else + std::cout <<"VymView::selectionModel: hey, no treeview so far???\n"; return NULL; }