# HG changeset patch # User insilmaril # Date 1164289988 0 # Node ID 1c8ff1928b97d52939edd8573d2761c6dd258c18 # Parent a4532e5c2ce3201cf9347a676fd083d0781d1e17 Removed more QT3 stuff. Drag & Drop not 100% functional at the moment diff -r a4532e5c2ce3 -r 1c8ff1928b97 branchobj.cpp --- a/branchobj.cpp Mon Nov 20 12:12:05 2006 +0000 +++ b/branchobj.cpp Thu Nov 23 13:53:08 2006 +0000 @@ -8,6 +8,19 @@ extern FlagRowObj *standardFlagsDefault; +/* FIXME not needed any longer in QT4 +int BranchObjPointrList::compareItems ( Q3PtrCollection::Item i, Q3PtrCollection::Item j) +{ + // Make sure PtrList::find works + if (i==j) return 0; + + if ( ((BranchObj*)(i))->angle > ((BranchObj*)(j))->angle ) + return 1; + else + return -1; +} +*/ + ///////////////////////////////////////////////////////////////// // BranchObj ///////////////////////////////////////////////////////////////// @@ -72,22 +85,8 @@ return angle == other.angle; } -int BranchObjPtrList::compareItems ( Q3PtrCollection::Item i, Q3PtrCollection::Item j) -{ - // Make sure PtrList::find works - if (i==j) return 0; - - if ( ((BranchObj*)(i))->angle > ((BranchObj*)(j))->angle ) - return 1; - else - return -1; -} - void BranchObj::init () { - branch.setAutoDelete (false); - xlink.setAutoDelete (false); - if (parObj) { absPos=getRandPos(); @@ -110,12 +109,11 @@ OrnamentedObj::copy(other); branch.clear(); - BranchObj* b; - for (b=other->branch.first(); b;b=other->branch.next() ) + for (int i=0; ibranch.size(); ++i) // Make deep copy of b // Because addBranch again calls copy for the childs, // Those will get a deep copy, too - addBranch(b); + addBranch(other->branch.at(i) ); for (int i=0; ifloatimage.size(); ++i) addFloatImage (other->floatimage.at(i)); @@ -134,15 +132,10 @@ delete floatimage.takeFirst(); while (!xlink.isEmpty()) - deleteXLink (xlink.first() ); + delete xlink.takeFirst(); - BranchObj *bo; while (!branch.isEmpty()) - { - bo=branch.first(); - branch.removeFirst(); - delete (bo); - } + delete branch.takeFirst(); } int BranchObj::getNum() @@ -155,12 +148,7 @@ int BranchObj::getNum(BranchObj *bo) { - // keep current pointer in branch, - // otherwise saveToDir will fail - int cur=branch.at(); - int ind=branch.findRef (bo); - branch.at(cur); - return ind; + return branch.indexOf (bo); } int BranchObj::getFloatImageNum(FloatImageObj *fio) @@ -273,23 +261,18 @@ void BranchObj::toggleScroll() { - BranchObj *bo; if (scrolled) { scrolled=false; systemFlags->deactivate("scrolledright"); - for (bo=branch.first(); bo; bo=branch.next() ) - { - bo->setVisibility(true); - } + for (int i=0; isetVisibility(true); } else { scrolled=true; systemFlags->activate("scrolledright"); - for (bo=branch.first(); bo; bo=branch.next() ) - { - bo->setVisibility(false); - } + for (int i=0; isetVisibility(false); } calcBBoxSize(); positionBBox(); @@ -362,14 +345,13 @@ if (!scrolled && (depth < toDepth)) { // Now go recursivly through all childs - BranchObj* b; - for (b=branch.first(); b;b=branch.next() ) - b->setVisibility (v,toDepth); - for (int i=0; isetVisibility (v,toDepth); + for (i=0; isetVisibility (v); - XLinkObj* xlo; - for (xlo=xlink.first(); xlo;xlo=xlink.next() ) - xlo->setVisibility (); + for (i=0; isetVisibility (); } } // depth <= toDepth requestReposition(); @@ -396,9 +378,8 @@ void BranchObj::setColorChilds (QColor col) { OrnamentedObj::setColor (col); - BranchObj *bo; - for (bo=branch.first(); bo; bo=branch.next() ) - bo->setColorChilds(col); + for (int i=0; isetColorChilds(col); } BranchObj* BranchObj::first() @@ -410,28 +391,35 @@ BranchObj* BranchObj::next() { + BranchObj *bo; BranchObj *lmo; - BranchObj *bo=branch.first(); - BranchObj *po=(BranchObj*)(parObj); + BranchObj *po=(BranchObj*)parObj; + + if (branch.isEmpty()) + bo=NULL; + else + bo=branch.first(); if (!itLast) { + // no itLast, we are just beginning if (bo) - { // We are just beginning, - // return first child + { + // we have childs, return first one itLast=this; return bo; } else { - // No childs + // No childs, so there is no next itLast=this; return NULL; } } - if (itLast==parObj) - { // We come from above + // We have an itLast + if (itLast==po) + { // We come from parent if (bo) { // there are childs, go there @@ -442,7 +430,7 @@ { // no childs, try to go up again if (po) { - // go up + // go back to parent and try to find next there itLast=this; lmo=po->next(); itLast=this; @@ -451,22 +439,36 @@ } else { - // can't go up, I am mapCenter + // can't go up, I am mapCenter, no next itLast=NULL; return NULL; } } } + // We don't come from parent, but from brother or childs + // Try to find last child, where we came from, in my own childs bool searching=true; - while (bo && searching) + int i=0; + while (i0) { // proceed with my first child itLast=this; - return bo; + return branch.first(); } else { @@ -554,9 +555,8 @@ void BranchObj::moveBy (double x, double y) { OrnamentedObj::moveBy (x,y); - BranchObj* b; - for (b=branch.first(); b;b=branch.next() ) - b->moveBy (x,y); + for (int i=0; imoveBy (x,y); positionBBox(); } @@ -577,9 +577,8 @@ frame->setRect(QRect(bbox.x(),bbox.y(),bbox.width(),bbox.height() ) ); // Update links to other branches - XLinkObj *xlo; - for (xlo=xlink.first(); xlo; xlo=xlink.next() ) - xlo->updateXLink(); + for (int i=0; iupdateXLink(); } void BranchObj::calcBBoxSize() @@ -673,11 +672,10 @@ LinkableMapObj* BranchObj::findMapObj(QPoint p, LinkableMapObj* excludeLMO) { // Search branches - BranchObj *b; LinkableMapObj *lmo; - for (b=branch.first(); b; b=branch.next() ) + for (int i=0; ifindMapObj(p, excludeLMO); + lmo=branch.at(i)->findMapObj(p, excludeLMO); if (lmo != NULL) return lmo; } @@ -719,9 +717,8 @@ hidden=false; } - BranchObj *bo; - for (bo=branch.first(); bo; bo=branch.next() ) - bo->setHideTmp (mode); + for (int i=0; isetHideTmp (mode); } bool BranchObj::hasHiddenExportParent(BranchObj *start) @@ -805,17 +802,15 @@ s+=note.saveToDir(); // Save branches - BranchObj *bo; - for (bo=branch.first(); bo; bo=branch.next() ) - s+=bo->saveToDir(tmpdir,prefix,offset); + for (int i=0; isaveToDir(tmpdir,prefix,offset); // Save XLinks - XLinkObj *xlo; QString ol; // old link QString cl; // current link - for (xlo=xlink.first(); xlo; xlo=xlink.next() ) + for (int i=0; isaveToDir(); + cl=xlink.at(i)->saveToDir(); if (cl!=ol) { s+=cl; @@ -839,7 +834,7 @@ void BranchObj::removeXLinkRef (XLinkObj *xlo) { - xlink.remove (xlo); + xlink.removeAt (xlink.indexOf(xlo)); } void BranchObj::deleteXLink(XLinkObj *xlo) @@ -868,10 +863,12 @@ BranchObj* BranchObj::XLinkTargetAt (int i) { - if (xlink.at(i)) - return xlink.at(i)->otherBranch (this); - else - return NULL; + if (i>=0 && iotherBranch (this); + } + return NULL; } void BranchObj::setIncludeImagesVer(bool b) @@ -975,13 +972,8 @@ void BranchObj::savePosInAngle () { // Save position in angle - BranchObj *b; - int i=0; - for (b=branch.first(); b; b=branch.next() ) - { - b->angle=i; - i++; - } + for (int i=0; iangle=i; } void BranchObj::setDefAttr (BranchModification mod) @@ -1055,7 +1047,7 @@ // Add new bo and resort branches BranchObj *newbo=addBranch (); newbo->angle=pos-0.5; - branch.sort(); + //FIXME branch.sort(); return newbo; } @@ -1065,7 +1057,7 @@ // Add new bo and resort branches bo->angle=pos-0.5; BranchObj *newbo=addBranch (bo); - branch.sort(); + //FIXME branch.sort(); return newbo; } @@ -1080,7 +1072,7 @@ bo->setDefAttr (MovedBranch); if (scrolled) tmpUnscroll(); setLastSelectedBranch (bo); - branch.sort(); + //FIXME branch.sort(); return bo; } @@ -1109,22 +1101,30 @@ // if bo is not in branch remove returns false, we // don't care... - if (branch.remove (bo)) + int i=branch.indexOf(bo); + if (i>=0) + { delete (bo); - else + branch.removeAt (i); + } else qWarning ("BranchObj::removeBranch tried to remove non existing branch?!\n"); requestReposition(); } void BranchObj::removeBranchPtr(BranchObj* bo) { - branch.remove (bo); + int i=branch.indexOf(bo); + + if (i>=0) + branch.removeAt (i); + else + qWarning ("BranchObj::removeBranchPtr tried to remove non existing branch?!\n"); requestReposition(); } void BranchObj::setLastSelectedBranch (BranchObj* bo) { - lastSelectedBranch=branch.find(bo); + lastSelectedBranch=branch.indexOf(bo); } BranchObj* BranchObj::getLastSelectedBranch () @@ -1147,9 +1147,12 @@ return branch.last(); } -BranchObj* BranchObj::getBranchNum (const uint &i) +BranchObj* BranchObj::getBranchNum (int i) { - return branch.at(i); + if (i>=0 && i0) { // -1 if bo1 not found branch.at(i)->angle--; branch.at(i-1)->angle++; - branch.sort(); + //FIXME branch.sort(); return branch.at(i); } else return NULL; @@ -1189,14 +1192,14 @@ BranchObj* BranchObj::moveBranchDown(BranchObj* bo1)// modify my childlist { savePosInAngle(); - int i=branch.find(bo1); + int i=branch.indexOf(bo1); int j; - if (branch.next()) + if (i angle++; branch.at(j)->angle--; - branch.sort(); + //FIXME branch.sort(); return branch.at(i); } else return NULL; @@ -1305,13 +1308,12 @@ ref2.setY(ref.y() ); // Align the childs depending on reference point - BranchObj *b; - for (b=branch.first(); b; b=branch.next() ) + for (int i=0; iisHidden()) + if (!branch.at(i)->isHidden()) { - b->alignRelativeTo (ref2); - ref2.setY(ref2.y() + b->getBBoxSizeWithChilds().height() ); + branch.at(i)->alignRelativeTo (ref2); + ref2.setY(ref2.y() + branch.at(i)->getBBoxSizeWithChilds().height() ); } } } @@ -1340,7 +1342,7 @@ alignRelativeTo ( QPoint (absPos.x(), absPos.y()-(bboxTotal.height()-bbox.height())/2) ); - branch.sort(); + //FIXME branch.sort(); positionBBox(); // Reposition bbox and contents } else { @@ -1354,11 +1356,8 @@ void BranchObj::unsetAllRepositionRequests() { repositionRequest=false; - BranchObj *b; - for (b=branch.first(); b; b=branch.next() ) - { - b->unsetAllRepositionRequests(); - } + for (int i=0; iunsetAllRepositionRequests(); } @@ -1368,10 +1367,9 @@ if (scrolled) return r; - BranchObj* b; - for (b=branch.first();b ;b=branch.next() ) - if (!b->isHidden()) - r=addBBox(b->getTotalBBox(),r); + for (int i=0; iisHidden()) + r=addBBox(branch.at(i)->getTotalBBox(),r); for (int i=0; iisHidden()) @@ -1427,13 +1425,12 @@ // sum of heights // maximum of widths // minimum of y - BranchObj* b; - for (b=branch.first();b ;b=branch.next() ) + for (int i=0; iisHidden()) + if (!branch.at(i)->isHidden()) { - b->calcBBoxSizeWithChilds(); - br=b->getBBoxSizeWithChilds(); + branch.at(i)->calcBBoxSizeWithChilds(); + br=branch.at(i)->getBBoxSizeWithChilds(); r.setWidth( max (br.width(), r.width() )); r.setHeight(br.height() + r.height() ); if (br.y()updateActions(); } diff -r a4532e5c2ce3 -r 1c8ff1928b97 branchobj.h --- a/branchobj.h Mon Nov 20 12:12:05 2006 +0000 +++ b/branchobj.h Thu Nov 23 13:53:08 2006 +0000 @@ -1,19 +1,12 @@ #ifndef BRANCHOBJ_H #define BRANCHOBJ_H -#include - #include "floatimageobj.h" #include "linkablemapobj.h" #include "ornamentedobj.h" #include "xlinkobj.h" -class BranchObjPtrList : public Q3PtrList -{ - virtual int compareItems (Q3PtrCollection::Item i, Q3PtrCollection::Item j); -}; - enum BranchModification {NewBranch, MovedBranch}; enum HideTmpMode {HideNone, HideExport}; @@ -106,7 +99,7 @@ virtual BranchObj* getLastSelectedBranch(); virtual BranchObj* getFirstBranch(); virtual BranchObj* getLastBranch(); - virtual BranchObj* getBranchNum(const uint &); + virtual BranchObj* getBranchNum(int); virtual bool canMoveBranchUp(); virtual BranchObj* moveBranchUp(BranchObj*); virtual bool canMoveBranchDown(); @@ -127,9 +120,9 @@ protected: static BranchObj* itLast; // iterator for first(), next() static BranchObj* itFirst; // first iterator for first(), next() - BranchObjPtrList branch; // all child branches + QList branch; // all child branches QList floatimage;// child images - Q3PtrList xlink; // xlinks to other branches + QList xlink; // xlinks to other branches public: float angle; // used in mainbranch to reorder mainbranches protected: diff -r a4532e5c2ce3 -r 1c8ff1928b97 demos/todo.vym Binary file demos/todo.vym has changed diff -r a4532e5c2ce3 -r 1c8ff1928b97 exporthtmldialog.ui.h --- a/exporthtmldialog.ui.h Mon Nov 20 12:12:05 2006 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,218 +0,0 @@ -/**************************************************************************** -** ui.h extension file, included from the uic-generated form implementation. -** -** If you wish to add, delete or rename functions or slots use -** Qt Designer which will update this file, preserving your code. Create an -** init() function in place of a constructor, and a destroy() function in -** place of a destructor. -*****************************************************************************/ - - -extern Settings settings; - -void ExportHTMLDialog::init() -{ - dir=settings.readEntry ("/vym/export/html/dir","" ); - lineEdit1->setText(dir); - - if ( settings.readEntry ("/vym/export/html/image","yes")=="yes") - image=true; - else - image=false; - checkBox4->setChecked(image); - - if ( settings.readEntry ("/vym/export/html/imageOnly","no")=="yes") - imageOnly=true; - else - imageOnly=false; - checkBox5_2->setChecked(imageOnly); - - if ( settings.readEntry ("/vym/export/html/wiki","no")=="yes") - wikistyle=true; - else - wikistyle=false; - checkBox5->setChecked(wikistyle); - - if ( settings.readEntry ("/vym/export/html/useHeading","no")=="yes") - useHeading=true; - else - useHeading=false; - checkBox4_2->setChecked(useHeading); - - if ( settings.readEntry ("/vym/export/html/useURLImage","yes")=="yes") - useURLImage=true; - else - useURLImage=false; - checkBox6->setChecked(useURLImage); - - if ( settings.readEntry ("/vym/export/html/showOutput","no")=="yes") - showOutput=true; - else - showOutput=false; - checkBox3->setChecked(showOutput); - - stylepath=settings.readEntry - ("/vym/export/html/styles","styles"); - scriptpath=settings.readEntry - ("/vym/export/html/scripts","scripts"); - xsl=settings.readEntry - ("/vym/export/html/xsl","vym2html.xsl"); - css=settings.readEntry - ("/vym/export/html/css","vym.css"); - script=settings.readEntry - ("/vym/export/html/script","vym2html.sh"); - - proc = new QProcess( this ); - connect( proc, SIGNAL(readyReadStdout()), - this, SLOT(readOutput()) ); - - dia=new ShowTextDialog (); -} - -void ExportHTMLDialog::destroy() -{ - delete (proc); - delete (dia); -} - -void ExportHTMLDialog::browseDirectory() -{ - QFileDialog fd( this, tr("VYM - Export HTML to directory")); - fd.setMode (QFileDialog::DirectoryOnly); - fd.setCaption(tr("VYM - Export HTML to directory")); - fd.setModal (true); - fd.show(); - - if ( fd.exec() == QDialog::Accepted ) - { - dir=fd.selectedFile(); - lineEdit1->setText (dir ); - } -} - -void ExportHTMLDialog::useWIKIpressed(bool b) -{ - wikistyle=b; -} - -void ExportHTMLDialog::includeImage(bool b) -{ - image=b; -} - -void ExportHTMLDialog::imgOnly(bool b) -{ - imageOnly=b; -} - -void ExportHTMLDialog::useHeadingPressed(bool b) -{ - useHeading=b; -} - -void ExportHTMLDialog::useURLImagePressed(bool b) -{ - useURLImage=b; -} - -void ExportHTMLDialog::showOut(bool b) -{ - showOutput=b; -} - -void ExportHTMLDialog::dirChanged() -{ - dir=lineEdit1->text(); -} - - - - -void ExportHTMLDialog::doExport (const QString &mapname) -{ - // Save options to settings file - // (but don't save at destructor, which - // is called for "cancel", too) - settings.writeEntry ("/vym/export/html/dir",lineEdit1->text() ); - - if (wikistyle) - settings.writeEntry ("/vym/export/html/wiki","yes"); - else - settings.writeEntry ("/vym/export/html/wiki","no"); - - if (image) - settings.writeEntry ("/vym/export/html/image","yes"); - else - settings.writeEntry ("/vym/export/html/image","no"); - - if (imageOnly) - settings.writeEntry ("/vym/export/html/imageOnly","yes"); - else - settings.writeEntry ("/vym/export/html/imageOnly","no"); - - if (useHeading) - settings.writeEntry ("/vym/export/html/useHeading","yes"); - else - settings.writeEntry ("/vym/export/html/useHeading","no"); - - if (showOutput) - settings.writeEntry ("/vym/export/html/showOutput","yes"); - else - settings.writeEntry ("/vym/export/html/showOutput","no"); - - settings.writeEntry - ("/vym/export/html/styles",stylepath); - settings.writeEntry - ("/vym/export/html/scripts",scriptpath); - settings.writeEntry - ("/vym/export/html/xsl",xsl); - settings.writeEntry - ("/vym/export/html/css",css); - settings.writeEntry - ("/vym/export/html/script",script); - - proc->addArgument (scriptpath + "/" + script ); - proc->addArgument(dir + maskPath(mapname) + ".xml"); - proc->addArgument("-sp=" + stylepath +"/" + xsl ); - proc->addArgument("-css=" + css ); - if (image) proc->addArgument("-image" ); - if (wikistyle) proc->addArgument("-wikistyle" ); - if (useHeading) proc->addArgument("-useURLHeading" ); - if (useURLImage) - { - proc->addArgument("-useURLImage" ); - QPixmap pm (flag_url_xpm); - pm.save (dir + "/flags/url.png","PNG"); - } - - dia->append ("vym is executing: " + proc->arguments().join(" ") ); - if ( !proc->start() ) - { - // error handling - dia->show(); - QString s; - QStringList list = proc->arguments(); - QStringList::Iterator it = list.begin(); - while( it != list.end() ) - { - s+= ( *it ) + "\n"; - ++it; - } - QMessageBox::critical(0, tr("Critcal export error"),"Couldn't start script to export:\n"+s); - } else - if (showOutput) dia->exec(); - - -} - - -QString ExportHTMLDialog::getDir() -{ - return dir; -} - - -void ExportHTMLDialog::readOutput() -{ - dia->append (proc->readStdout() ); -} diff -r a4532e5c2ce3 -r 1c8ff1928b97 exportxhtmldialog.ui.h --- a/exportxhtmldialog.ui.h Mon Nov 20 12:12:05 2006 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,392 +0,0 @@ -//Added by qt3to4: -#include -#include -/**************************************************************************** -** ui.h extension file, included from the uic-generated form implementation. -** -** If you wish to add, delete or rename functions or slots use -** Qt Designer which will update this file, preserving your code. Create an -** init() function in place of a constructor, and a destroy() function in -** place of a destructor. -*****************************************************************************/ - - -extern Settings settings; -extern QDir vymBaseDir; -extern Options options; - -void ExportXHTMLDialog::init() -{ - filepath=""; - settingsChanged=false; - scriptProc=new Process; -} - -void ExportXHTMLDialog::readSettings() -{ - - dir=settings.readLocalEntry (filepath,"/export/xhtml/exportDir",vymBaseDir.currentDirPath() ); - lineEditDir->setText(dir); - - if ( settings.readLocalEntry (filepath,"/export/xhtml/useImage","yes")=="yes") - useImage=true; - else - useImage=false; - imageButton->setChecked(useImage); - - if ( settings.readLocalEntry (filepath,"/export/xhtml/useTextColor","no")=="yes") - useTextColor=true; - else - useTextColor=false; - textColorButton->setChecked(useTextColor); - -/* FIXME this was used in old html export, is not yet in new stylesheet - if ( settings.readEntry ("/export/html/useHeading","no")=="yes") - useHeading=true; - else - useHeading=false; - checkBox4_2->setChecked(useHeading); -*/ - - if ( settings.readLocalEntry (filepath,"/export/xhtml/saveSettingsInMap","no")=="yes") - saveSettingsInMap=true; - else - saveSettingsInMap=false; - saveSettingsInMapButton->setChecked(saveSettingsInMap); - - if ( settings.readEntry ("/export/xhtml/showWarnings","yes")=="yes") - showWarnings=true; - else - showWarnings=false; - warningsButton->setChecked(showWarnings); - - if ( settings.readEntry ("/export/xhtml/showOutput","no")=="yes") - showOutput=true; - else - showOutput=false; - outputButton->setChecked(showOutput); - - // For testing better use local styles - if (options.isOn ("local")) - { - xsl=vymBaseDir.path()+"/styles/vym2xhtml.xsl"; - css=vymBaseDir.path()+"/styles/vym.css"; - } else - { - xsl=settings.readLocalEntry - (filepath,"/export/xhtml/xsl","/usr/share/vym/styles/vym2xhtml.xsl"); - css=settings.readLocalEntry - (filepath,"/export/xhtml/css","/usr/share/vym/styles/vym.css"); - } - lineEditXSL->setText(xsl); - lineEditCSS->setText(css); - - prescript=settings.readLocalEntry - (filepath,"/export/xhtml/prescript",""); - lineEditPreScript->setText (prescript); - - postscript=settings.readLocalEntry - (filepath,"/export/xhtml/postscript",""); - lineEditPostScript->setText (postscript); - - if (!prescript.isEmpty() || !postscript.isEmpty()) - { - QMessageBox::warning( 0, tr( "Warning" ),tr( - "The settings saved in the map " - "would like to run scripts:\n\n" - "%1\n\n" - "Please check, if you really\n" - "want to allow this in your system!").arg(prescript+" "+postscript)); - - } -} - -void ExportXHTMLDialog::destroy() -{ -} - -void ExportXHTMLDialog::dirChanged() -{ - dir=lineEditDir->text(); - if (dir.right(1)!="/") - dir+="/"; - settingsChanged=true; -} - -void ExportXHTMLDialog::browseDirectoryPressed() -{ - Q3FileDialog fd( this, tr("VYM - Export HTML to directory")); - fd.setMode (Q3FileDialog::DirectoryOnly); - fd.setCaption(tr("VYM - Export HTML to directory")); - fd.setModal (true); - fd.show(); - - if ( fd.exec() == QDialog::Accepted ) - { - dir=fd.selectedFile(); - lineEditDir->setText (dir ); - settingsChanged=true; - } -} - -void ExportXHTMLDialog::imageButtonPressed(bool b) -{ - useImage=b; - settingsChanged=true; -} - -void ExportXHTMLDialog::textcolorButtonPressed(bool b) -{ - useTextColor=b; - settingsChanged=true; -} - -void ExportXHTMLDialog::saveSettingsInMapButtonPressed(bool b) -{ - saveSettingsInMap=b; - settingsChanged=true; -} - -void ExportXHTMLDialog::warningsButtonPressed(bool b) -{ - showWarnings=b; - settingsChanged=true; -} - - -void ExportXHTMLDialog::outputButtonPressed(bool b) -{ - showOutput=b; - settingsChanged=true; -} - -void ExportXHTMLDialog::cssChanged() -{ - css=lineEditCSS->text(); - settingsChanged=true; -} - -void ExportXHTMLDialog::browseCSSPressed() -{ - Q3FileDialog fd( this, tr("VYM - Path to CSS file")); - fd.setModal (true); - fd.addFilter ("Cascading Stylesheet (*.css)"); - fd.show(); - - if ( fd.exec() == QDialog::Accepted ) - { - css=fd.selectedFile(); - lineEditCSS->setText (css ); - settingsChanged=true; - } -} - -void ExportXHTMLDialog::xslChanged() -{ - xsl=lineEditXSL->text(); - settingsChanged=true; -} - -void ExportXHTMLDialog::prescriptChanged() -{ - prescript=lineEditPreScript->text(); - settingsChanged=true; -} - -void ExportXHTMLDialog::browseXSLPressed() -{ - Q3FileDialog fd( this, tr("VYM - Path to XSL file")); - fd.setModal (true); - fd.addFilter ("Extensible Stylesheet Language (*.xsl)"); - fd.show(); - - if ( fd.exec() == QDialog::Accepted ) - { - xsl=fd.selectedFile(); - lineEditXSL->setText (xsl ); - settingsChanged=true; - } -} - -void ExportXHTMLDialog::postscriptChanged() -{ - postscript=lineEditPostScript->text(); - settingsChanged=true; -} - -void ExportXHTMLDialog::browsePreExportButtonPressed() -{ - Q3FileDialog fd( this, tr("VYM - Path to pre export script")); - fd.setModal (true); - fd.addFilter ("Scripts (*.sh *.pl *.py *.php)"); - fd.show(); - - if ( fd.exec() == QDialog::Accepted ) - { - prescript=fd.selectedFile(); - lineEditPreScript->setText (prescript ); - settingsChanged=true; - } - -} - -void ExportXHTMLDialog::browsePostExportButtonPressed() -{ - Q3FileDialog fd( this, tr("VYM - Path to post export script")); - fd.setModal (true); - fd.addFilter ("Scripts (*.sh *.pl *.py *.php)"); - fd.show(); - - if ( fd.exec() == QDialog::Accepted ) - { - postscript=fd.selectedFile(); - lineEditPostScript->setText (postscript ); - settingsChanged=true; - } -} - - -void ExportXHTMLDialog::doExport (const QString &mapname) -{ - // Save options to settings file - // (but don't save at destructor, which - // is called for "cancel", too) - settings.setLocalEntry (filepath,"/export/xhtml/exportDir",dir); - settings.setLocalEntry (filepath,"/export/xhtml/prescript",prescript); - settings.setLocalEntry (filepath,"/export/xhtml/postscript",postscript); - - if (useImage) - settings.setLocalEntry (filepath,"/export/xhtml/useImage","yes"); - else - settings.setLocalEntry (filepath,"/export/xhtml/useImage","no"); - - if (useTextColor) - settings.setLocalEntry (filepath,"/export/xhtml/useTextColor","yes"); - else - settings.setLocalEntry (filepath,"/export/xhtml/useTextColor","no"); - - if (showWarnings) - settings.writeEntry ("/export/xhtml/showWarnings","yes"); - else - settings.writeEntry ("/export/xhtml/showWarnings","no"); - - if (showOutput) - settings.writeEntry ("/export/xhtml/showOutput","yes"); - else - settings.writeEntry ("/export/xhtml/showOutput","no"); - - QString ipath; - ipath=vymBaseDir.path()+"/flags/flag-url-16x16.png"; - if (!options.isOn ("local")) - { - settings.setLocalEntry - (filepath,"/export/xhtml/xsl",xsl); - settings.setLocalEntry - (filepath,"/export/xhtml/css",css); - } - - // Provide a smaller URL-icon to improve Layout - QPixmap pm; - if (!pm.load(ipath,"PNG") ) - QMessageBox::warning( 0, tr( "Warning" ),tr("Could not open %1").arg(ipath)); - - - 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); - QFile css_dst (dir+"vym.css"); - if (!css_src.open ( QIODevice::ReadOnly)) - QMessageBox::warning( 0, tr( "Warning" ),tr("Could not open %1").arg(css)); - else - { - if (!css_dst.open( QIODevice::WriteOnly)) - QMessageBox::warning( 0, tr( "Warning" ), tr("Could not open %1").arg(dir+"vym.css")); - else - { - - QTextStream tsout( &css_dst); - QTextStream tsin ( &css_src); - QString s= tsin.read(); - tsout << s; - css_dst.close(); - } - css_src.close(); - } - - if (!prescript.isEmpty()) runScript (prescript,dir+mapname+".xml"); - - if (useImage) - p.addStringParam ("imagemap","images/"+mapname+".png"); - if (useTextColor) - p.addStringParam ("use.textcolor","1"); - p.addStringParam ("mapname",mapname+".vym"); - - p.setOutputFile (dir+mapname+".html"); - p.setInputFile (dir+mapname+".xml"); - p.setXSLFile (xsl); - p.process(); - - if (!postscript.isEmpty()) runScript (postscript,dir+mapname+".html"); - -} - -void ExportXHTMLDialog::setFilePath(const QString &s) -{ - filepath=s; -} - -void ExportXHTMLDialog::setMapName(const QString &s) -{ - mapname=s; -} - -QString ExportXHTMLDialog::getDir() -{ - return dir; -} - -bool ExportXHTMLDialog::warnings() -{ - return showWarnings; -} - -bool ExportXHTMLDialog::hasChanged() -{ - return settingsChanged; -} - - -void ExportXHTMLDialog::runScript(QString spath, QString fpath) -{ - spath.replace ("%f",fpath); - QStringList args=QStringList::split (' ',spath,false); - - scriptProc->clearArguments(); - scriptProc->setArguments (args); - p.addOutput ("vym is executing: \n" + scriptProc->arguments().join(" ") ); - if (!scriptProc->start() ) - { - QMessageBox::critical( 0, tr( "Critical Error" ), - tr("Could not start %1").arg(spath) ); - } else - { - scriptProc->waitFinished(); - if (!scriptProc->normalExit() ) - QMessageBox::critical( 0, tr( "Critical Error" ), - tr("%1 didn't exit normally").arg(spath) + - scriptProc->getErrout() ); - else - if (scriptProc->exitStatus()>0) showOutput=true; - - } - p.addOutput ("\n"); - p.addOutput (scriptProc->getErrout()); - p.addOutput (scriptProc->getStdout()); -} diff -r a4532e5c2ce3 -r 1c8ff1928b97 flagobj.cpp --- a/flagobj.cpp Mon Nov 20 12:12:05 2006 +0000 +++ b/flagobj.cpp Thu Nov 23 13:53:08 2006 +0000 @@ -1,6 +1,4 @@ #include "flagobj.h" -//Added by qt3to4: -#include ///////////////////////////////////////////////////////////////// // FlagObj @@ -24,7 +22,7 @@ FlagObj::~FlagObj() { -// cout << "Destr FlagObj " << name << "\n"; +// cout << "Destr FlagObj " << name.ascii() << "\n"; if (icon) delete (icon); } diff -r a4532e5c2ce3 -r 1c8ff1928b97 flagrowobj.cpp --- a/flagrowobj.cpp Mon Nov 20 12:12:05 2006 +0000 +++ b/flagrowobj.cpp Thu Nov 23 13:53:08 2006 +0000 @@ -19,13 +19,13 @@ FlagRowObj::~FlagRowObj() { -// cout << "Destr FlagRowObj\n"; - flag.clear(); + // cout << "Destr FlagRowObj\n"; + while (!flag.isEmpty()) + delete flag.takeFirst(); } void FlagRowObj::init () { - flag.setAutoDelete (true); parentRow=NULL; showFlags=true; } @@ -35,9 +35,8 @@ MapObj::copy(other); parentRow=other->parentRow; flag.clear(); - FlagObj *fo; - for (fo=other->flag.first(); fo; fo=other->flag.next() ) - addFlag (fo); + for (int i=0; imove(x+dx,y); - dx+=QSize(fo->getSize() ).width(); + flag.at(i)->move(x+dx,y); + dx+=QSize(flag.at(i)->getSize() ).width(); } } @@ -71,9 +69,8 @@ void FlagRowObj::setVisibility (bool v) { MapObj::setVisibility(v); - FlagObj *fo; - for (fo=flag.first(); fo; fo=flag.next() ) - fo->setVisibility (v); + for (int i=0; isetVisibility (v); } FlagObj* FlagRowObj::addFlag (FlagObj *fo) @@ -97,10 +94,9 @@ { QSize size(0,0); QSize boxsize(0,0); - FlagObj *fo; - for (fo=flag.first(); fo; fo=flag.next() ) + for (int i=0; igetSize(); + size=flag.at(i)->getSize(); // add widths boxsize.setWidth(boxsize.width() + size.width() ); // maximize height @@ -114,9 +110,8 @@ QString FlagRowObj::getFlagName (const QPoint &p) { if (!inBox (p)) return ""; - FlagObj *fo; - for (fo=flag.first();fo; fo=flag.next() ) - if (fo->inBox (p)) return fo->getName(); + for (int i=0; iinBox (p)) return flag.at(i)->getName(); return ""; @@ -211,9 +206,8 @@ { if (!parentRow) { - FlagObj *fo; - for (fo=flag.first();fo; fo=flag.next() ) - fo->deactivate(); + for (int i=0; ideactivate(); } else qWarning ("FlagRowObj::deactivateAll mustn't be called for ordinary rows"); } @@ -226,10 +220,9 @@ QString g=keepfo->getGroup(); if (g!="undefined") { - FlagObj *fo; - for (fo=flag.first();fo; fo=flag.next() ) - if (g==fo->getGroup() && keepfo!=fo) - flag.remove(fo); + for (int i=0; igetGroup() && keepfo!=flag.at(i)) + flag.remove(flag.at(i)); } } } @@ -254,32 +247,30 @@ void FlagRowObj::resetUsedCounter() { - FlagObj *fo; - for (fo=flag.first();fo; fo=flag.next() ) - fo->setUsed (false); + for (int i=0; isetUsed (false); } QString FlagRowObj::saveToDir (const QString &tmpdir,const QString &prefix, bool writeflags) { // Build xml string QString s; - FlagObj *fo; if (parentRow) - for (fo=flag.first();fo; fo=flag.next() ) + for (int i=0; igetName() ); + s+=valueElement("standardflag",flag.at(i)->getName() ); // and tell parentRow, that this flag is used - parentRow->activate(fo->getName() ); + parentRow->activate(flag.at(i)->getName() ); } else // Save icons to dir, if verbose is set (xml export) // and I am a parentRow // and this flag is really used somewhere if (writeflags) - for (fo=flag.first();fo; fo=flag.next() ) - if (fo->isUsed()) fo->saveToDir (tmpdir,prefix); + for (int i=0; iisUsed()) flag.at(i)->saveToDir (tmpdir,prefix); return s; } @@ -291,15 +282,14 @@ void FlagRowObj::updateToolbar() { - FlagObj *fo; if (parentRow) { // We are just a branch, not the toolbar default // but state has to be copied from ourselves to parentrow! parentRow->deactivateAll(); // In parentRow activate all existing (==active) flags - for (fo=flag.first();fo; fo=flag.next() ) - parentRow->activate(fo->getName()); + for (int i=0; iactivate(flag.at(i)->getName()); parentRow->updateToolbar(); } else { @@ -307,19 +297,16 @@ if (toolbar) { // Update state of actions in toolbar - for (fo=flag.first();fo; fo=flag.next() ) - fo->updateAction(); + for (int i=0; iupdateAction(); } } } FlagObj* FlagRowObj::findFlag (const QString &name) { - FlagObj *fo; - for (fo=flag.first();fo; fo=flag.next() ) - { - if (fo->getName()==name) return fo; - } + for (int i=0; igetName()==name) return flag.at(i); return NULL; } diff -r a4532e5c2ce3 -r 1c8ff1928b97 flagrowobj.h --- a/flagrowobj.h Mon Nov 20 12:12:05 2006 +0000 +++ b/flagrowobj.h Thu Nov 23 13:53:08 2006 +0000 @@ -2,8 +2,6 @@ #define FLAGROWOBJ_H #include -//Added by qt3to4: -#include #include "mapobj.h" #include "flagobj.h" @@ -40,7 +38,7 @@ private: FlagRowObj* parentRow; // look for flags in this row FlagObj* findFlag (const QString&); - Q3PtrList flag; + QList flag; QToolBar *toolbar; QString name; bool showFlags; // FloatObjects want to hide their flags diff -r a4532e5c2ce3 -r 1c8ff1928b97 headingobj.cpp --- a/headingobj.cpp Mon Nov 20 12:12:05 2006 +0000 +++ b/headingobj.cpp Thu Nov 23 13:53:08 2006 +0000 @@ -18,12 +18,13 @@ HeadingObj::~HeadingObj() { - textline.clear(); +// cout << "Destr. HeadingObj "<boundingRect().height(); else h=2; - Q3CanvasText *t; ho=0; - for (t=textline.first(); t; t=textline.next() ) + for (int i=0; imove(x,y+ho); + textline.at(i)->move(x,y+ho); ho=ho+h; } } @@ -80,12 +80,11 @@ // then no selection would be visible, thus we prevent it in ::setText() if (!textline.isEmpty() ) { - Q3CanvasText *t; - for (t=textline.first(); t; t=textline.next() ) + for (int i=0; iboundingRect().height(); - if (wboundingRect().width() ) - w=t->boundingRect().width(); + h+=textline.at(i)->boundingRect().height(); + if (wboundingRect().width() ) + w=textline.at(i)->boundingRect().width(); } } bbox.setSize (QSize(w,h)); @@ -109,7 +108,8 @@ heading=s; // remove old textlines and prepare generating new ones - textline.clear(); + while (!textline.isEmpty()) + delete textline.takeFirst(); // prevent empty textline, so at least a small selection stays // visible for this heading @@ -220,9 +220,8 @@ if (color!=c) { color=c; - Q3CanvasText *t; - for (t=textline.first(); t; t=textline.next() ) - t->setColor(c); + for (int i=0; isetColor(c); } } @@ -234,12 +233,11 @@ void HeadingObj::setVisibility (bool v) { MapObj::setVisibility(v); - Q3CanvasText *t; - for (t=textline.first(); t; t=textline.next() ) + for (int i=0; ishow(); + textline.at(i)->show(); else - t->hide(); + textline.at(i)->hide(); } int HeadingObj::getHeight () diff -r a4532e5c2ce3 -r 1c8ff1928b97 headingobj.h --- a/headingobj.h Mon Nov 20 12:12:05 2006 +0000 +++ b/headingobj.h Thu Nov 23 13:53:08 2006 +0000 @@ -2,8 +2,6 @@ #define HEADINGOBJ_H #include "mapobj.h" -//Added by qt3to4: -#include class HeadingObj:public MapObj { public: @@ -32,7 +30,7 @@ protected: QString heading; int textwidth; // width for formatting text - Q3PtrList textline; // a part of e.g. the parabel + QList textline; // a part of e.g. the parabel QColor color; QFont font; }; diff -r a4532e5c2ce3 -r 1c8ff1928b97 linkablemapobj.cpp --- a/linkablemapobj.cpp Mon Nov 20 12:12:05 2006 +0000 +++ b/linkablemapobj.cpp Thu Nov 23 13:53:08 2006 +0000 @@ -45,7 +45,7 @@ delete (l); break; case StyleParabel: - segment.clear(); + while (!segment.isEmpty()) delete segment.takeFirst(); break; case StylePolyLine: delete (p); @@ -53,7 +53,7 @@ break; case StylePolyParabel: delete (p); - segment.clear(); + while (!segment.isEmpty()) delete segment.takeFirst(); break; default: break; @@ -76,7 +76,6 @@ thickness_start=8; style=StyleUndef; linkpos=LinkBottom; - segment.setAutoDelete (TRUE); arcsegs=13; Q3PointArray pa(arcsegs*2+2); @@ -198,8 +197,7 @@ LinkStyle LinkableMapObj::getDefLinkStyle () { - if (!mapEditor) return StyleUndef; - + if (mapEditor==0) return StyleUndef; LinkStyle ls=mapEditor->getMapLinkStyle(); switch (ls) { @@ -257,7 +255,7 @@ { cl = new Q3CanvasLine(canvas); cl->setPen( QPen(linkcolor, 1) ); - cl->setPoints( 0,0,i*10,100); + cl->setPoints( i*5,0,i*10,100); cl->setZ(Z_LINK); if (visible) cl->show(); @@ -305,7 +303,7 @@ { cl = new Q3CanvasLine(canvas); cl->setPen( QPen(linkcolor, 1) ); - cl->setPoints( 0,0,i*10,100); + cl->setPoints( 5*i,0,i*10,100); cl->setZ(Z_LINK); if (visible) cl->show(); @@ -360,15 +358,14 @@ { linkcolor=col; bottomline->setPen( QPen(linkcolor, 1) ); - Q3CanvasLine *cl; switch (style) { case StyleLine: l->setPen( QPen(col,1)); break; case StyleParabel: - for (cl=segment.first(); cl; cl=segment.next() ) - cl->setPen( QPen(col,1)); + for (int i=0; isetPen( QPen(col,1)); break; case StylePolyLine: p->setBrush( QBrush(col)); @@ -376,8 +373,8 @@ break; case StylePolyParabel: p->setBrush( QBrush(col)); - for (cl=segment.first(); cl; cl=segment.next() ) - cl->setPen( QPen(col,1)); + for (int i=0; isetPen( QPen(col,1)); break; default: break; @@ -412,7 +409,6 @@ void LinkableMapObj::setVisibility (bool v) { - Q3CanvasLine* cl; MapObj::setVisibility (v); bool visnow=visible; @@ -429,16 +425,16 @@ if (l) l->show(); break; case StyleParabel: - for (cl=segment.first(); cl; cl=segment.next() ) - cl->show(); + for (int i=0; ishow(); break; case StylePolyLine: if (p) p->show(); if (l) l->show(); break; case StylePolyParabel: - for (cl=segment.first(); cl; cl=segment.next() ) - cl->show(); + for (int i=0; ishow(); if (p) p->show(); break; default: @@ -453,16 +449,16 @@ if (l) l->hide(); break; case StyleParabel: - for (cl=segment.first(); cl; cl=segment.next() ) - cl->hide(); + for (int i=0; ihide(); break; case StylePolyLine: if (p) p->hide(); if (l) l->hide(); break; case StylePolyParabel: - for (cl=segment.first(); cl; cl=segment.next() ) - cl->hide(); + for (int i=0; ihide(); if (p) p->hide(); break; default: @@ -562,10 +558,6 @@ // "turning point" for drawing polygonal links QPoint tp (-qRound(sin (a)*thickness_start), qRound(cos (a)*thickness_start)); - Q3CanvasLine *cl; - - int i; - // Draw the link switch (style) { @@ -577,12 +569,8 @@ break; case StyleParabel: parabel (pa0, p1x,p1y,p2x,p2y); - i=0; - for (cl=segment.first(); cl; cl=segment.next() ) - { - cl->setPoints( pa0.point(i).x(), pa0.point(i).y(),pa0.point(i+1).x(),pa0.point(i+1).y()); - i++; - } + for (int i=0; isetPoints( pa0.point(i).x(), pa0.point(i).y(),pa0.point(i+1).x(),pa0.point(i+1).y()); break; case StylePolyLine: pa0[0]=QPoint (qRound(p2x+tp.x()), qRound(p2y+tp.y())); @@ -598,19 +586,15 @@ case StylePolyParabel: parabel (pa1, p1x,p1y,p2x+tp.x(),p2y+tp.y()); parabel (pa2, p1x,p1y,p2x-tp.x(),p2y-tp.y()); - for (i=0;i<=arcsegs;i++) + for (int i=0;i<=arcsegs;i++) { // Combine the arrays to a single one pa0[i]=pa1[i]; pa0[i+arcsegs+1]=pa2[arcsegs-i]; } p->setPoints (pa0); - i=0; - for (cl=segment.first(); cl; cl=segment.next() ) - { - cl->setPoints( pa1.point(i).x(), pa1.point(i).y(),pa1.point(i+1).x(),pa1.point(i+1).y()); - i++; - } + for (int i=0; isetPoints( pa1.point(i).x(), pa1.point(i).y(),pa1.point(i+1).x(),pa1.point(i+1).y()); break; default: break; @@ -646,7 +630,7 @@ break; } else if (typ=="bo:") - lmo=((BranchObj*)(lmo))->getBranchNum (num.toUInt()); + lmo=((BranchObj*)(lmo))->getBranchNum (num.toInt()); else if (typ=="fi:") lmo=((BranchObj*)(lmo))->getFloatImageNum (num.toUInt()); diff -r a4532e5c2ce3 -r 1c8ff1928b97 linkablemapobj.h --- a/linkablemapobj.h Mon Nov 20 12:12:05 2006 +0000 +++ b/linkablemapobj.h Thu Nov 23 13:53:08 2006 +0000 @@ -7,7 +7,6 @@ #include "flagrowobj.h" //Added by qt3to4: #include -#include #define MAX_DEPTH 999 @@ -121,7 +120,7 @@ Q3CanvasLine* l; // line style Q3CanvasPolygon* p; // poly styles int arcsegs; // arc: number of segments - Q3PtrList segment; // a part of e.g. the parabel + QList segment; // a part of e.g. the parabel Q3PointArray pa0; // For drawing of PolyParabel and PolyLine Q3PointArray pa1; // For drawing of PolyParabel Q3PointArray pa2; // For drawing of PolyParabel diff -r a4532e5c2ce3 -r 1c8ff1928b97 main.cpp --- a/main.cpp Mon Nov 20 12:12:05 2006 +0000 +++ b/main.cpp Thu Nov 23 13:53:08 2006 +0000 @@ -10,9 +10,9 @@ // Global variables TextEditor *textEditor; // used in Constr. of LinkableMapObj // initialized in mainwindow -QString vymName(__VYM_NAME); -QString vymVersion(__VYM_VERSION); -QString vymBuildDate(__VYM_BUILD_DATE); +QString vymName; +QString vymVersion; +QString vymBuildDate; Main *mainWindow; // used in BranchObj::select() QString tmpVymDir; // All temp files go there, created in mainwindow @@ -40,6 +40,10 @@ QApplication app(argc,argv); + vymName=__VYM_NAME; + vymVersion=__VYM_VERSION; + vymBuildDate=__VYM_BUILD_DATE; + // Reading and initializing options commandline options options.add ("version", SwitchOption, "v","version"); diff -r a4532e5c2ce3 -r 1c8ff1928b97 mainwindow.cpp --- a/mainwindow.cpp Mon Nov 20 12:12:05 2006 +0000 +++ b/mainwindow.cpp Thu Nov 23 13:53:08 2006 +0000 @@ -3161,7 +3161,6 @@ // updateActions is also called when NoteEditor is closed actionViewToggleNoteEditor->setOn (textEditor->showWithMain()); - QAction *a; if (me->getMapLinkColorHint()==HeadingColor) actionFormatLinkColorHint->setOn(true); else @@ -3281,8 +3280,8 @@ actionEditPaste->setEnabled (true); else actionEditPaste->setEnabled (false); - for (a=actionListBranches.first();a;a=actionListBranches.next()) - a->setEnabled(true); + for (int i=0; isetEnabled(true); actionEditDelete->setEnabled (true); switch (selection->getFrameType()) { @@ -3317,8 +3316,8 @@ actionEditCopy->setEnabled (true); actionEditCut->setEnabled (true); actionEditPaste->setEnabled (false); - for (a=actionListBranches.first();a;a=actionListBranches.next()) - a->setEnabled(false); + for (int i=0; isetEnabled(false); actionEditDelete->setEnabled (true); actionFormatHideLinkUnselected->setOn ( selection->getHideLinkUnselected()); @@ -3331,8 +3330,8 @@ actionEditCopy->setEnabled (false); actionEditCut->setEnabled (false); actionEditPaste->setEnabled (false); - for (a=actionListBranches.first();a;a=actionListBranches.next()) - a->setEnabled(false); + for (int i=0; isetEnabled(false); actionEditToggleScroll->setEnabled (false); actionEditOpenURL->setEnabled (false); diff -r a4532e5c2ce3 -r 1c8ff1928b97 mainwindow.h --- a/mainwindow.h Mon Nov 20 12:12:05 2006 +0000 +++ b/mainwindow.h Thu Nov 23 13:53:08 2006 +0000 @@ -197,7 +197,7 @@ HistoryWindow *historyWindow; - Q3PtrList actionListBranches; + QList actionListBranches; QColor currentColor; diff -r a4532e5c2ce3 -r 1c8ff1928b97 mapcenterobj.cpp --- a/mapcenterobj.cpp Mon Nov 20 12:12:05 2006 +0000 +++ b/mapcenterobj.cpp Thu Nov 23 13:53:08 2006 +0000 @@ -1,4 +1,4 @@ -#include +#include #include "mapcenterobj.h" #include "floatimageobj.h" @@ -20,7 +20,7 @@ MapCenterObj::~MapCenterObj() { -// cout << "Destr MapCenterObj\n"; + cout << "Destr MapCenterObj\n"; } void MapCenterObj::clear() @@ -74,9 +74,8 @@ childPos.setX( clickBox.topLeft().x() + (int)(clickBox.width())/2 ); childPos.setY( clickBox.topLeft().y() + (int)(clickBox.height())/2 ); parPos=childPos; - BranchObj *b; - for (b=branch.first(); b; b=branch.next() ) - b->updateLink(); + for (int i=0; iupdateLink(); } void MapCenterObj::updateRelPositions() @@ -84,11 +83,10 @@ if (repositionRequest) unsetAllRepositionRequests(); // update relative Positions of branches and floats - BranchObj *b; - for (b=branch.first(); b; b=branch.next() ) + for (int i=0; isetRelPos(); - b->setOrientation(); + branch.at(i)->setRelPos(); + branch.at(i)->setOrientation(); } for (int i=0; ifindMapObj(p, excludeLMO); + lmo = branch.at(i)->findMapObj(p, excludeLMO); if (lmo!= NULL) return lmo; } // is p in MapCenter? @@ -161,18 +158,16 @@ s+=note.saveToDir(); // Save branches - BranchObj *bo; - for (bo=branch.first(); bo; bo=branch.next() ) - s+=bo->saveToDir(tmpdir,prefix, offset); + for (int i=0; isaveToDir(tmpdir,prefix, offset); // Save FloatImages for (int i=0; isaveToDir (tmpdir,prefix); // Save XLinks - XLinkObj *xlo; - for (xlo=xlink.first(); xlo; xlo=xlink.next() ) - s+=xlo->saveToDir(); + for (int i=0;isaveToDir(); decIndent(); s+=endElement ("mapcenter"); diff -r a4532e5c2ce3 -r 1c8ff1928b97 mapeditor.cpp --- a/mapeditor.cpp Mon Nov 20 12:12:05 2006 +0000 +++ b/mapeditor.cpp Thu Nov 23 13:53:08 2006 +0000 @@ -1,8 +1,6 @@ #include "mapeditor.h" -#include -#include -#include +//#include #include #include @@ -310,6 +308,7 @@ standardFlagsDefault->resetUsedCounter(); // Reset the counters before saving + // TODO constr. of FIO creates lots of objects, better do this in some other way... FloatImageObj (mapCanvas).resetSaveCounter(); // Build xml recursivly @@ -3986,50 +3985,68 @@ void MapEditor::contentsDragEnterEvent(QDragEnterEvent *event) { - -// for (unsigned int i=0;event->format(i);i++) // Debug mime type -// cerr << event->format(i) << endl; - - if (selection && - (typeid(*selection) == typeid(BranchObj)) || - (typeid(*selection) == typeid(MapCenterObj))) { - - // If QImageDrag can decode mime type - if (Q3ImageDrag::canDecode(event)) { - event->accept(); - return; - } - - // If image are dragged from firefox - if (event->provides("application/x-moz-file-promise-url") && - event->provides("application/x-moz-nativeimage")) { - event->accept(true); - return; - } - - // If QUriDrag can decode mime type - if (Q3UriDrag::canDecode(event)) { - event->accept(); - return; - } - + if (selection && + (typeid(*selection) == typeid(BranchObj)) || + (typeid(*selection) == typeid(MapCenterObj))) + { + if (event->mimeData()->hasFormat("image/png")) + { + cout <<"found png in dragenterevent\n"; + event->accept(); + return; + } + + if (event->mimeData()->hasFormat("text/uri-list")) + { + cout <<"found uri-list in dragenterevent\n"; + event->accept(); + return; + } + +/* + // If QImageDrag can decode mime type + if (Q3ImageDrag::canDecode(event)) + { + cout << "dragenterevent q3imagedrag\n"; + event->accept(); + return; + } +*/ + // If image are dragged from firefox + if (event->mimeData()->hasFormat("application/x-moz-file-promise-url") && + event->mimeData()->hasFormat("application/x-moz-nativeimage")) { + event->accept(true); + cout << "dragenterevent firefox\n"; + return; + } +/* + // If QUriDrag can decode mime type + if (Q3UriDrag::canDecode(event)) { + event->accept(); + cout << "accepted uri drag\n"; + return; + } // If Uri are dragged from firefox - if (event->provides("_NETSCAPE_URL")){ - event->accept(); - return; - } - - // If QTextDrag can decode mime type - if (Q3TextDrag::canDecode(event)) { - event->accept(); - return; - } - - } - event->ignore(); + if (event->provides("_NETSCAPE_URL")){ + event->accept(); + cout << "dragenterevent NETSCAPE\n"; + return; + } + + // If QTextDrag can decode mime type + if (Q3TextDrag::canDecode(event)) { + event->accept(); + cout << "dragenterevent textdrag\n"; + return; + } +*/ + } + event->ignore(); } -bool isUnicode16(const QByteArray &d) + + +/* FIXME needed in QT4? bool isUnicode16(const QByteArray &d) { // TODO: make more precise check for unicode 16. // Guess unicode16 if any of second bytes are zero @@ -4038,7 +4055,8 @@ if (d.at(i*2+1)==0) return true; return false; } - +*/ + void MapEditor::contentsDropEvent(QDropEvent *event) { if (selection && @@ -4046,32 +4064,30 @@ (typeid(*selection) == typeid(MapCenterObj))) { bool update=false; - Q3StrList uris; + QStringList uris; + QList urls; QString heading; - if (event->provides("image/png")) + + + if (event->mimeData()->hasFormat("image/png")) { - QPixmap pix; - if (Q3ImageDrag::decode(event, pix)) - { - addFloatImageInt(pix); - event->accept(); - update=true; - } else - event->ignore(); - - } else if (event->provides("application/x-moz-file-promise-url") && - event->provides("application/x-moz-nativeimage")) + event->acceptProposedAction(); + addFloatImageInt(event->mimeData()->imageData().value()); + cout << "Drop png...\n"; + } else if (event->mimeData()->hasFormat("application/x-moz-file-promise-url")&& + event->mimeData()->hasFormat("application/x-moz-nativeimage")) { + cout << "Drop Mozilla...\n"; // Contains url to the img src in unicode16 QByteArray d = event->encodedData("application/x-moz-file-promise-url"); QString url = QString((const QChar*)d.data(),d.size()/2); fetchImage(url); - event->accept(); + event->acceptProposedAction(); update=true; - } else if (event->provides ("text/uri-list")) - { // Uris provided e.g. by konqueror - Q3UriDrag::decode (event,uris); - } else if (event->provides ("_NETSCAPE_URL")) + } else if (event->mimeData()->hasUrls()) + { + urls=event->mimeData()->urls(); + } /*else if (event->provides ("_NETSCAPE_URL")) { // Uris provided by Mozilla QStringList l = QStringList::split("\n", event->encodedData("_NETSCAPE_URL")); uris.append(l[0]); @@ -4104,7 +4120,13 @@ event->accept(); update= true; } - + */ + + for (int i=0; i0) { QStringList files; @@ -4140,7 +4162,7 @@ } update=true; } - + */ if (update) { //FIXME saveState has to be called earlier for each of the drops... @@ -4159,6 +4181,7 @@ (typeid(*selection) == typeid(MapCenterObj)) ) { BranchObj *bo=((BranchObj*)selection); + qWarning ("Warning: Image added by drop event: no undo/redo so far."); //FIXME XXX saveStateChangingPart(selection,QString("Add floatimage to %1").arg(getName(bo))); //QString fn=fd->selectedFile(); //lastImageDir=fn.left(fn.findRev ("/")); diff -r a4532e5c2ce3 -r 1c8ff1928b97 mapeditor.h --- a/mapeditor.h Mon Nov 20 12:12:05 2006 +0000 +++ b/mapeditor.h Thu Nov 23 13:53:08 2006 +0000 @@ -190,7 +190,7 @@ virtual void contentsMouseDoubleClickEvent(QMouseEvent*); virtual void contentsMouseMoveEvent(QMouseEvent*); - virtual void contentsDragEnterEvent(QDragEnterEvent *event); + virtual void contentsDragEnterEvent(QDragEnterEvent *event); virtual void contentsDropEvent(QDropEvent *event); private: Q3Canvas* mapCanvas; diff -r a4532e5c2ce3 -r 1c8ff1928b97 selection.h --- a/selection.h Mon Nov 20 12:12:05 2006 +0000 +++ b/selection.h Thu Nov 23 13:53:08 2006 +0000 @@ -1,8 +1,6 @@ #ifndef SELECTION_H #define SELECTION_H -#include - #include "linkablemapobj.h" #include "mapcenterobj.h" diff -r a4532e5c2ce3 -r 1c8ff1928b97 version.h --- a/version.h Mon Nov 20 12:12:05 2006 +0000 +++ b/version.h Thu Nov 23 13:53:08 2006 +0000 @@ -5,7 +5,7 @@ #define __VYM_NAME "VYM" #define __VYM_VERSION "1.8.59" -#define __VYM_BUILD_DATE "November 20, 2006" +#define __VYM_BUILD_DATE "November 23, 2006" bool checkVersion(const QString &); diff -r a4532e5c2ce3 -r 1c8ff1928b97 vym.pro --- a/vym.pro Mon Nov 20 12:12:05 2006 +0000 +++ b/vym.pro Thu Nov 23 13:53:08 2006 +0000 @@ -3,7 +3,7 @@ CONFIG += qt warn_on release CONFIG += x86 ppc -ICON =vym.icns +ICON =icons/vym.icns QT += qt3support diff -r a4532e5c2ce3 -r 1c8ff1928b97 xlinkobj.cpp --- a/xlinkobj.cpp Mon Nov 20 12:12:05 2006 +0000 +++ b/xlinkobj.cpp Thu Nov 23 13:53:08 2006 +0000 @@ -26,7 +26,7 @@ XLinkObj::~XLinkObj () { - // cout << "Destr XLinkObj\n"; +// cout << "Destr XLinkObj\n"; if (xLinkState!=undefinedXLink) deactivate(); delete (line); diff -r a4532e5c2ce3 -r 1c8ff1928b97 xml.cpp --- a/xml.cpp Mon Nov 20 12:12:05 2006 +0000 +++ b/xml.cpp Thu Nov 23 13:53:08 2006 +0000 @@ -636,13 +636,13 @@ } if (!a.value( "beginBranch").isEmpty() ) - { + { if (!a.value( "endBranch").isEmpty() ) { LinkableMapObj *lmo=mc->findObjBySelect (a.value( "beginBranch")); if (lmo && typeid (*lmo)==typeid (BranchObj)) { - xlo->setBegin ((BranchObj*)(lmo)); + xlo->setBegin ((BranchObj*)lmo); lmo=mc->findObjBySelect (a.value( "endBranch")); if (lmo && typeid (*lmo)==typeid (BranchObj)) {