# HG changeset patch # User insilmaril # Date 1265809722 0 # Node ID c2ce9944148c7f0d9b32aa3cf857967a073fdee2 # Parent 4a84d7e444d89c999961efac768fa1349338e571 More fixes and sorting lexically backwards diff -r 4a84d7e444d8 -r c2ce9944148c attributeitem.cpp --- a/attributeitem.cpp Thu Jan 21 11:56:57 2010 +0000 +++ b/attributeitem.cpp Wed Feb 10 13:48:42 2010 +0000 @@ -6,7 +6,7 @@ extern bool debug; -AttributeItem::AttributeItem(const QList &data, TreeItem *parent):TreeItem (data,parent) +AttributeItem::AttributeItem(const QList &data, TreeItem *parent):BranchItem (data,parent) { TreeItem::setType (Attribute); //table=NULL; diff -r 4a84d7e444d8 -r c2ce9944148c attributeitem.h --- a/attributeitem.h Thu Jan 21 11:56:57 2010 +0000 +++ b/attributeitem.h Wed Feb 10 13:48:42 2010 +0000 @@ -4,13 +4,13 @@ #include #include -#include "treeitem.h" +#include "branchitem.h" /*! \brief A key and a value The data itself is stored in Attribute Definitions (AttributeDef). A list of these tables AttributeTable is maintained for every MapEditor. */ -class AttributeItem:public TreeItem { +class AttributeItem:public BranchItem { enum Type { Undefined, //!< Undefined type diff -r 4a84d7e444d8 -r c2ce9944148c branchitem.cpp --- a/branchitem.cpp Thu Jan 21 11:56:57 2010 +0000 +++ b/branchitem.cpp Wed Feb 10 13:48:42 2010 +0000 @@ -1,3 +1,4 @@ +#include "attributeitem.h" #include "branchitem.h" #include "branchobj.h" #include "vymmodel.h" @@ -118,7 +119,7 @@ +getMapAttr() +getGeneralAttr() +scrolledAttr - // +areaAttr // FIXME-2 + // +areaAttr // FIXME-4 not needed anymore. Wait until end of 2010 before removing... +idAttr +getIncludeImageAttr() ); @@ -290,7 +291,7 @@ return result; } -void BranchItem::sortChildren() +void BranchItem::sortChildren(bool inverse) { int childCount=branchCounter; int curChildIndex; @@ -298,15 +299,28 @@ do { madeChanges=false; - for(curChildIndex=1;curChildIndexgetHeading().compare(curChild->getHeading())>0) + if (inverse) + for(curChildIndex=1;curChildIndexmoveUp(curChild); - madeChanges=true; + BranchItem* curChild =getBranchNum(curChildIndex); + BranchItem* prevChild=getBranchNum(curChildIndex-1); + if (prevChild->getHeading().compare(curChild->getHeading())<0) + { + model->moveUp (curChild); + madeChanges=true; + } + } + else + for(curChildIndex=1;curChildIndexgetHeading().compare(curChild->getHeading())>0) + { + model->moveUp(curChild); + madeChanges=true; + } } - } }while(madeChanges); } @@ -387,7 +401,6 @@ - TreeItem* BranchItem::findMapItem (QPointF p, TreeItem* excludeTI) { // Search branches @@ -415,34 +428,24 @@ mo->isVisibleObj() ) return ii; } + + // Search attributes + AttributeItem *ai; + for (int i=0; igetLMO(); + if (mo && mo->isInClickBox(p) && + (ii != excludeTI) && + this!= excludeTI && + mo->isVisibleObj() + ) return ai; + } + return NULL; } -/* -TreeItem* BranchItem::findID (QString sid) //FIXME-3 move to TreeItem //FIXME-4 search images -{ - // Search branches - TreeItem *ti; - for (int i=0; ifindID (sid); - if (ti != NULL) return ti; - } - - // Search myself - if (sid==objID) return this; - - // Search float images - for (int i=0; iinBox(p) && - (floatimage.at(i) != excludeLMO) && - floatimage.at(i)->getParObj()!= excludeLMO && - floatimage.at(i)->isVisibleObj() - ) return floatimage.at(i); - return NULL; -} -*/ -void BranchItem::updateStyles() +void BranchItem::updateStyles(const bool &keepFrame) { // FIXME-5 compare also MapItem::initLMO... @@ -452,7 +455,7 @@ lmo->setParObj ( ((MapItem*)parentItem)->getLMO() ); else lmo->setParObj (NULL); - ((BranchObj*)lmo)->setDefAttr(BranchObj::MovedBranch); + ((BranchObj*)lmo)->setDefAttr(BranchObj::MovedBranch,keepFrame); } } diff -r 4a84d7e444d8 -r c2ce9944148c branchitem.h --- a/branchitem.h Thu Jan 21 11:56:57 2010 +0000 +++ b/branchitem.h Wed Feb 10 13:48:42 2010 +0000 @@ -35,7 +35,7 @@ virtual bool hasScrolledParent(BranchItem*); // true, if any of the parents is scrolled virtual bool tmpUnscroll(); // unscroll scrolled parents temporary e.g. during "find" process virtual bool resetTmpUnscroll(); // scroll all tmp scrolled parents again e.g. when unselecting - virtual void sortChildren(); //! Sort children + virtual void sortChildren(bool inverse=false); //! Sort children protected: bool includeImagesVer; //! include floatimages in bbox vertically @@ -58,11 +58,10 @@ public: TreeItem* findMapItem (QPointF p,TreeItem* excludeTI); //! search map for branches or images. Ignore excludeTI, where search is started -// virtual TreeItem* findID (QString sid); //! search map for object with ID string - virtual void updateStyles (); //! update related fonts, parObjects, links, ... + virtual void updateStyles (const bool &keepFrame=false); //! update related fonts, parObjects, links, ... virtual BranchObj* getBranchObj(); - virtual BranchObj* createMapObj(QGraphicsScene *scene); //! Create classic object in GraphicsView + virtual BranchObj* createMapObj(QGraphicsScene *scene); //! Create classic object in GraphicsView }; #endif diff -r 4a84d7e444d8 -r c2ce9944148c branchobj.cpp --- a/branchobj.cpp Thu Jan 21 11:56:57 2010 +0000 +++ b/branchobj.cpp Wed Feb 10 13:48:42 2010 +0000 @@ -1,5 +1,6 @@ #include "branchobj.h" +#include "attributeitem.h" #include "branchitem.h" #include "geometry.h" #include "mapeditor.h" @@ -439,26 +440,22 @@ if (changed) updateContentSize(); } -void BranchObj::setDefAttr (BranchModification mod) +void BranchObj::setDefAttr (BranchModification mod, bool keepFrame) { int fontsize; switch (treeItem->depth()) { case 0: fontsize=16; - setFrameType (FrameObj::Rectangle); break; case 1: fontsize=14; - setFrameType (FrameObj::NoFrame); break; case 2: fontsize=12; - setFrameType (FrameObj::NoFrame); break; default: fontsize=10; - setFrameType (FrameObj::NoFrame); break; } setLinkStyle(getDefLinkStyle(treeItem->parent() )); @@ -467,12 +464,20 @@ font.setPointSize(fontsize); heading->setFont(font ); + if (mod==NewBranch && !keepFrame) + if (treeItem->depth()==0) + setFrameType (FrameObj::Rectangle); + else + setFrameType (FrameObj::NoFrame); + if (mod==NewBranch) setColor (treeItem->getHeadingColor() ); else + { // Also set styles for children for (int i=0; ibranchCount(); ++i) treeItem->getBranchObjNum(i)->setDefAttr(MovedBranch); + } calcBBoxSize(); } @@ -559,7 +564,21 @@ else ref2.setY(ref.y() ); - // Align the children depending on reference point + // Align the attribute children depending on reference point + // on top like in TreeEditor + for (int i=0; iattributeCount(); ++i) + { + if (!treeItem->getAttributeNum(i)->isHidden()) + { + BranchObj *bo=(BranchObj*)(treeItem->getAttributeNum(i)->getBranchObj()); + if (!bo) break; + bo->alignRelativeTo (ref2,true); + + // append next branch below current one + ref2.setY(ref2.y() + bo->getBBoxSizeWithChildren().height() ); + } + } + // Align the branch children depending on reference point for (int i=0; ibranchCount(); ++i) { if (!treeItem->getBranchNum(i)->isHidden()) @@ -718,8 +737,22 @@ { if (!bi->getBranchNum(i)->isHidden()) { - bi->getBranchObjNum(i)->calcBBoxSizeWithChildren(); - br=bi->getBranchObjNum(i)->getBBoxSizeWithChildren(); + BranchObj *bo=bi->getBranchObjNum(i); + bo->calcBBoxSizeWithChildren(); + br=bo->getBBoxSizeWithChildren(); + r.setWidth( max (br.width(), r.width() )); + r.setHeight(br.height() + r.height() ); + if (br.y()attributeCount(); i++) + { + if (!bi->getAttributeNum(i)->isHidden()) + { + BranchObj *bo=bi->getAttributeNum(i)->getBranchObj(); + bo->calcBBoxSizeWithChildren(); + br=bo->getBBoxSizeWithChildren(); r.setWidth( max (br.width(), r.width() )); r.setHeight(br.height() + r.height() ); if (br.y()\n"; // Include image - ts<<"
\n"; + ts<<"
getMapName()<<".png\" usemap='#imagemap'>
\n"; // Main loop over all mapcenters diff -r 4a84d7e444d8 -r c2ce9944148c exportxhtmldialog.cpp --- a/exportxhtmldialog.cpp Thu Jan 21 11:56:57 2010 +0000 +++ b/exportxhtmldialog.cpp Wed Feb 10 13:48:42 2010 +0000 @@ -273,6 +273,7 @@ void ExportXHTMLDialog::doExport (const QString &mapname) { + // Save options to settings file // (but don't save at destructor, which // is called for "cancel", too) @@ -310,6 +311,12 @@ (filepath,"/export/xhtml/css",css); } + if (!saveSettingsInMap) + settings.clearLocal("/export/xhtml"); + else + settings.setLocalEntry + (filepath,"/export/xhtml/saveSettingsInMap","yes"); + // Provide a smaller URL-icon to improve Layout QPixmap pm; if (!pm.load(ipath,"PNG") ) @@ -318,11 +325,6 @@ if(!pm.save (dir + "flags/flag-url-16x16.png","PNG")) QMessageBox::warning( 0, tr( "Warning" ),tr("Could not write %1").arg(ipath)); - if (!saveSettingsInMap) - settings.clearLocal("/export/xhtml"); - else - settings.setLocalEntry - (filepath,"/export/xhtml/saveSettingsInMap","yes"); // Copy CSS file QFile css_src (css); diff -r 4a84d7e444d8 -r c2ce9944148c icons/editsortback.png Binary file icons/editsortback.png has changed diff -r 4a84d7e444d8 -r c2ce9944148c mainwindow.cpp --- a/mainwindow.cpp Thu Jan 21 11:56:57 2010 +0000 +++ b/mainwindow.cpp Wed Feb 10 13:48:42 2010 +0000 @@ -312,7 +312,7 @@ progressDialog.setValue (v+progressDialog.value()); } -void Main::removeProgressValue(int v) +void Main::removeProgressCounter() { progressMax=0; progressCounter--; @@ -691,6 +691,13 @@ editMenu->addAction (a); actionSortChildren=a; + a = new QAction( QPixmap(iconPath+"editsortback.png" ), tr( "Sort children backwards","Edit menu" ), this ); + connect( a, SIGNAL( activated() ), this, SLOT( editSortBackChildren() ) ); + a->setEnabled (true); + a->addTo( tb ); + editMenu->addAction (a); + actionSortBackChildren=a; + alt = new QAction( QPixmap(flagsPath+"flag-scrolled-right.png"), tr( "Scroll branch","Edit menu" ), this); alt->setShortcut ( Qt::Key_S ); // Scroll branch alt->setStatusTip (tr( "Scroll branch" )); @@ -2893,7 +2900,13 @@ void Main::editSortChildren() { VymModel *m=currentModel(); - if (m) m->sortChildren(); + if (m) m->sortChildren(false); +} + +void Main::editSortBackChildren() +{ + VymModel *m=currentModel(); + if (m) m->sortChildren(true); } void Main::editToggleScroll() @@ -3606,6 +3619,7 @@ actionMoveDown->setEnabled (false); actionSortChildren->setEnabled (true); + actionSortBackChildren->setEnabled (true); actionToggleHideExport->setEnabled (true); actionToggleHideExport->setChecked (selbi->hideInExport() ); @@ -3657,6 +3671,7 @@ actionMoveDown->setEnabled (false); actionFormatHideLinkUnselected->setEnabled (false); actionSortChildren->setEnabled (false); + actionSortBackChildren->setEnabled (false); actionToggleHideExport->setEnabled (false); } } // m @@ -3741,6 +3756,35 @@ void Main::testFunction1() { + + Process p; + QString script="test/sleep.sh"; + p.start (script); + if (!p.waitForStarted()) + { + cout <<"VM::getBugzillaData couldn't start "<testFunction1(); +*/ /* VymModel *m=currentModel(); diff -r 4a84d7e444d8 -r c2ce9944148c mainwindow.h --- a/mainwindow.h Thu Jan 21 11:56:57 2010 +0000 +++ b/mainwindow.h Wed Feb 10 13:48:42 2010 +0000 @@ -44,7 +44,7 @@ void setProgressMaximum (int max); void addProgressValue (float v); void setProgressCounter (int v); - void removeProgressValue (int v); + void removeProgressCounter(); public slots: void fileNew(); @@ -151,6 +151,7 @@ void editMoveDown(); void editDetach(); void editSortChildren(); + void editSortBackChildren(); void editToggleScroll(); void editExpandAll(); void editExpandOneLevel(); @@ -288,6 +289,7 @@ QAction *actionMoveDown; QAction *actionDetach; QAction *actionSortChildren; + QAction *actionSortBackChildren; QAction *actionToggleScroll; QAction *actionExpandAll; QAction *actionExpandOneLevel; diff -r 4a84d7e444d8 -r c2ce9944148c mysortfilterproxymodel.cpp --- a/mysortfilterproxymodel.cpp Thu Jan 21 11:56:57 2010 +0000 +++ b/mysortfilterproxymodel.cpp Wed Feb 10 13:48:42 2010 +0000 @@ -25,7 +25,7 @@ } */ -bool MySortFilterProxyModel::filterAcceptsRow(int sourceRow, // FIXME-2 find a way to show _all_ rows which match, independent of parent +bool MySortFilterProxyModel::filterAcceptsRow(int sourceRow, // FIXME-3 find a way to show _all_ rows which match, independent of parent const QModelIndex &sourceParent) const { QModelIndex index0 = sourceModel()->index(sourceRow, 0, sourceParent); diff -r 4a84d7e444d8 -r c2ce9944148c tex/vym.changelog --- a/tex/vym.changelog Thu Jan 21 11:56:57 2010 +0000 +++ b/tex/vym.changelog Wed Feb 10 13:48:42 2010 +0000 @@ -1,3 +1,13 @@ +------------------------------------------------------------------- +Wed Feb 10 14:47:49 CET 2010 - vym@insilmaril.de + +- Feature: Sort lexically backwards + +------------------------------------------------------------------- +Tue Feb 9 10:26:23 CET 2010 - vym@insilmaril.de + +- Bugfix: Relinking now keeps frametype + ------------------------------------------------------------------- Thu Jan 21 09:22:08 CET 2010 - vym@insilmaril.de diff -r 4a84d7e444d8 -r c2ce9944148c treeeditor.cpp --- a/treeeditor.cpp Thu Jan 21 11:56:57 2010 +0000 +++ b/treeeditor.cpp Wed Feb 10 13:48:42 2010 +0000 @@ -67,7 +67,7 @@ void TreeEditor::cursorUp() { QModelIndex ix=getSelectedIndex(); - // FIXME-2 useproxymodel ix=proxyModel->mapToSource (indexAbove(ix)); + // FIXME-3 useproxymodel ix=proxyModel->mapToSource (indexAbove(ix)); ix=indexAbove (ix); if (ix.isValid()) model->select (ix ); @@ -76,7 +76,7 @@ void TreeEditor::cursorDown() { QModelIndex ix=getSelectedIndex(); - //FIXME-2 useProxymodel ix=proxyModel->mapToSource (indexBelow(ix)); + //FIXME-3 useProxymodel ix=proxyModel->mapToSource (indexBelow(ix)); ix=indexBelow (ix); if (ix.isValid()) model->select (ix ); diff -r 4a84d7e444d8 -r c2ce9944148c treeitem.cpp --- a/treeitem.cpp Thu Jan 21 11:56:57 2010 +0000 +++ b/treeitem.cpp Wed Feb 10 13:48:42 2010 +0000 @@ -13,6 +13,8 @@ extern FlagRow* standardFlagsMaster; +uint TreeItem::idLast=0; // Create instance + TreeItem::TreeItem() { cout << "Constr. TI this="<