1.1 --- a/mainwindow.cpp Wed Jul 04 11:05:11 2007 +0000
1.2 +++ b/mainwindow.cpp Wed Jul 04 11:05:15 2007 +0000
1.3 @@ -202,9 +202,9 @@
1.4 settings.setValue( "/version/builddate", vymBuildDate );
1.5
1.6 settings.setValue( "/mapeditor/autosave/use",actionSettingsAutosaveToggle->isOn() );
1.7 - settings.setValue( "/mapeditor/editmode/autoSelectHeading",actionSettingsAutoSelectHeading->isOn() );
1.8 + settings.setValue( "/mapeditor/editmode/autoSelectNewBranch",actionSettingsAutoSelectNewBranch->isOn() );
1.9 settings.setValue( "/mapeditor/editmode/autoSelectText",actionSettingsAutoSelectText->isOn() );
1.10 - settings.setValue( "/mapeditor/editmode/autoEdit",actionSettingsAutoEdit->isOn() );
1.11 + settings.setValue( "/mapeditor/editmode/autoEditNewBranch",actionSettingsAutoEditNewBranch->isOn() );
1.12 settings.setValue( "/mapeditor/editmode/useDelKey",actionSettingsUseDelKey->isOn() );
1.13 settings.setValue( "/mapeditor/editmode/useFlagGroups",actionSettingsUseFlagGroups->isOn() );
1.14 settings.setValue( "/export/useHideExport",actionSettingsUseHideExport->isOn() );
1.15 @@ -1451,16 +1451,16 @@
1.16 a = new QAction( tr( "Edit branch after adding it","Settings action" ), this );
1.17 a->setStatusTip( tr( "Edit branch after adding it" ));
1.18 a->setToggleAction(true);
1.19 - a->setOn ( settings.value ("/mapeditor/editmode/autoEdit",true).toBool());
1.20 + a->setOn ( settings.value ("/mapeditor/editmode/autoEditNewBranch",true).toBool());
1.21 settingsMenu->addAction (a);
1.22 - actionSettingsAutoEdit=a;
1.23 + actionSettingsAutoEditNewBranch=a;
1.24
1.25 a= new QAction( tr( "Select branch after adding it","Settings action" ), this );
1.26 a->setStatusTip( tr( "Select branch after adding it" ));
1.27 a->setToggleAction(true);
1.28 - a->setOn ( settings.value ("/mapeditor/editmode/autoSelectHeading",false).toBool() );
1.29 + a->setOn ( settings.value ("/mapeditor/editmode/autoSelectNewBranch",false).toBool() );
1.30 settingsMenu->addAction (a);
1.31 - actionSettingsAutoSelectHeading=a;
1.32 + actionSettingsAutoSelectNewBranch=a;
1.33
1.34 a= new QAction(tr( "Select existing heading","Settings action" ), this);
1.35 a->setStatusTip( tr( "Select heading before editing" ));
1.36 @@ -2726,7 +2726,9 @@
1.37 lineedit->hide();
1.38 setFocus();
1.39 #endif
1.40 - if (!prevSelection.isEmpty()) me->select(prevSelection);
1.41 + if (!actionSettingsAutoSelectNewBranch->isOn() &&
1.42 + !prevSelection.isEmpty())
1.43 + me->select(prevSelection);
1.44 prevSelection="";
1.45 }
1.46 }
1.47 @@ -2898,15 +2900,11 @@
1.48 else
1.49 return;
1.50
1.51 - if (actionSettingsAutoEdit->isOn())
1.52 + if (actionSettingsAutoEditNewBranch->isOn())
1.53 {
1.54 editHeading();
1.55 return;
1.56 }
1.57 - /*
1.58 - if (!actionSettingsAutoSelectHeading->isOn())
1.59 - me->select(bo->getSelectString());
1.60 - */
1.61 if (!prevSelection.isEmpty())
1.62 {
1.63 me->select(prevSelection);
1.64 @@ -2929,9 +2927,9 @@
1.65 else
1.66 return;
1.67
1.68 - if (actionSettingsAutoEdit->isOn())
1.69 + if (actionSettingsAutoEditNewBranch->isOn())
1.70 {
1.71 - if (!actionSettingsAutoSelectHeading->isOn())
1.72 + if (!actionSettingsAutoSelectNewBranch->isOn())
1.73 prevSelection=bo->getSelectString();
1.74 editHeading();
1.75 }
1.76 @@ -2951,9 +2949,9 @@
1.77 else
1.78 return;
1.79
1.80 - if (actionSettingsAutoEdit->isOn())
1.81 + if (actionSettingsAutoEditNewBranch->isOn())
1.82 {
1.83 - if (!actionSettingsAutoSelectHeading->isOn())
1.84 + if (!actionSettingsAutoSelectNewBranch->isOn())
1.85 prevSelection=bo->getSelectString();
1.86 editHeading();
1.87 }
1.88 @@ -2973,9 +2971,9 @@
1.89 else
1.90 return;
1.91
1.92 - if (actionSettingsAutoEdit->isOn())
1.93 + if (actionSettingsAutoEditNewBranch->isOn())
1.94 {
1.95 - if (!actionSettingsAutoSelectHeading->isOn())
1.96 + if (!actionSettingsAutoSelectNewBranch->isOn())
1.97 prevSelection=bo->getSelectString();
1.98 editHeading();
1.99 }
1.100 @@ -3580,14 +3578,14 @@
1.101 return ModModeNone;
1.102 }
1.103
1.104 -bool Main::autoEdit()
1.105 +bool Main::autoEditNewBranch()
1.106 {
1.107 - return actionSettingsAutoEdit->isOn();
1.108 + return actionSettingsAutoEditNewBranch->isOn();
1.109 }
1.110
1.111 -bool Main::autoSelectHeading()
1.112 +bool Main::autoSelectNewBranch()
1.113 {
1.114 - return actionSettingsAutoSelectHeading->isOn();
1.115 + return actionSettingsAutoSelectNewBranch->isOn();
1.116 }
1.117
1.118 bool Main::useFlagGroups()
1.119 @@ -3684,7 +3682,7 @@
1.120 QStringList searchList;
1.121 QDir docdir;
1.122 #if defined(Q_OS_MACX)
1.123 - searchList << "./vym.app/Contents";
1.124 + searchList << "./vym.app/Contents/Resources/doc";
1.125 #else
1.126 // default path in SUSE LINUX
1.127 searchList <<"/usr/share/doc/packages/vym/doc";
2.1 --- a/mainwindow.h Wed Jul 04 11:05:11 2007 +0000
2.2 +++ b/mainwindow.h Wed Jul 04 11:05:15 2007 +0000
2.3 @@ -189,8 +189,8 @@
2.4 void updateSatellites(MapEditor *);
2.5 void updateActions();
2.6 ModMode getModMode();
2.7 - bool autoEdit();
2.8 - bool autoSelectHeading();
2.9 + bool autoEditNewBranch();
2.10 + bool autoSelectNewBranch();
2.11 bool useFlagGroups();
2.12 void setScript(const QString &);
2.13 void runScript(const QString &);
2.14 @@ -312,8 +312,8 @@
2.15 QAction *actionViewToggleSmoothPixmapTransform;
2.16 QAction* actionViewCenter;
2.17
2.18 - QAction* actionSettingsAutoEdit;
2.19 - QAction* actionSettingsAutoSelectHeading;
2.20 + QAction* actionSettingsAutoEditNewBranch;
2.21 + QAction* actionSettingsAutoSelectNewBranch;
2.22 QAction* actionSettingsAutoSelectText;
2.23 QAction* actionSettingsUseDelKey;
2.24 QAction* actionSettingsUseFlagGroups;
3.1 --- a/mapeditor.cpp Wed Jul 04 11:05:11 2007 +0000
3.2 +++ b/mapeditor.cpp Wed Jul 04 11:05:15 2007 +0000
3.3 @@ -482,7 +482,8 @@
3.4 {
3.5 BranchObj *selb=xelection.getBranch();
3.6 QString s,t;
3.7 - int x,y;
3.8 + double x,y;
3.9 + int n;
3.10 bool b,ok;
3.11
3.12 // Split string s into command and parameters
3.13 @@ -506,11 +507,11 @@
3.14 if (parser.checkParCount(pl))
3.15 {
3.16 if (parser.parCount()==0)
3.17 - addNewBranchInt (-2);
3.18 + addNewBranch (0);
3.19 else
3.20 {
3.21 - y=parser.parInt (ok,0);
3.22 - if (ok ) addNewBranchInt (y);
3.23 + n=parser.parInt (ok,0);
3.24 + if (ok ) addNewBranch (n);
3.25 }
3.26 }
3.27 }
3.28 @@ -560,9 +561,9 @@
3.29 if (parser.checkParCount(2))
3.30 {
3.31 t=parser.parString (ok,0); // path to map
3.32 - y=parser.parInt(ok,1); // position
3.33 + n=parser.parInt(ok,1); // position
3.34 if (QDir::isRelativePath(t)) t=QDir::convertSeparators (tmpMapDir + "/"+t);
3.35 - addMapInsertInt(t,y);
3.36 + addMapInsertInt(t,n);
3.37 }
3.38 }
3.39 /////////////////////////////////////////////////////////////////////
3.40 @@ -773,20 +774,20 @@
3.41 if (typeid(*dst) == typeid(BranchObj) )
3.42 {
3.43 // Get number in parent
3.44 - x=parser.parInt (ok,1);
3.45 + n=parser.parInt (ok,1);
3.46 if (ok)
3.47 {
3.48 - selb->linkTo ((BranchObj*)(dst),x);
3.49 + selb->linkTo ((BranchObj*)(dst),n);
3.50 xelection.update();
3.51 }
3.52 } else if (typeid(*dst) == typeid(MapCenterObj) )
3.53 {
3.54 selb->linkTo ((BranchObj*)(dst),-1);
3.55 // Get coordinates of mainbranch
3.56 - x=parser.parInt (ok,2);
3.57 + x=parser.parDouble(ok,2);
3.58 if (ok)
3.59 {
3.60 - y=parser.parInt (ok,3);
3.61 + y=parser.parDouble(ok,3);
3.62 if (ok)
3.63 {
3.64 selb->move (x,y);
3.65 @@ -866,10 +867,10 @@
3.66 parser.setError (Aborted,"Type of selection is not a branch or floatimage");
3.67 } else if (parser.checkParCount(2))
3.68 {
3.69 - x=parser.parInt (ok,0);
3.70 + x=parser.parDouble (ok,0);
3.71 if (ok)
3.72 {
3.73 - y=parser.parInt (ok,1);
3.74 + y=parser.parDouble (ok,1);
3.75 if (ok) move (x,y);
3.76 }
3.77 }
3.78 @@ -886,10 +887,10 @@
3.79 parser.setError (Aborted,"Type of selection is not a branch or floatimage");
3.80 } else if (parser.checkParCount(2))
3.81 {
3.82 - x=parser.parInt (ok,0);
3.83 + x=parser.parDouble (ok,0);
3.84 if (ok)
3.85 {
3.86 - y=parser.parInt (ok,1);
3.87 + y=parser.parDouble (ok,1);
3.88 if (ok) moveRel (x,y);
3.89 }
3.90 }
3.91 @@ -907,8 +908,8 @@
3.92 parser.setError (Aborted,"Type of selection is not a branch");
3.93 } else if (parser.checkParCount(1))
3.94 {
3.95 - x=parser.parInt (ok,0);
3.96 - if (ok) pasteNoSave(x);
3.97 + n=parser.parInt (ok,0);
3.98 + if (ok) pasteNoSave(n);
3.99 }
3.100 /////////////////////////////////////////////////////////////////////
3.101 } else if (com=="qa")
3.102 @@ -1049,6 +1050,17 @@
3.103
3.104 }
3.105 /////////////////////////////////////////////////////////////////////
3.106 + } else if (com=="selectLatestAdded")
3.107 + {
3.108 + if (latestSelection.isEmpty() )
3.109 + {
3.110 + parser.setError (Aborted,"No latest added object");
3.111 + } else
3.112 + {
3.113 + if (!select (latestSelection))
3.114 + parser.setError (Aborted,"Could not select latest added object "+latestSelection);
3.115 + }
3.116 + /////////////////////////////////////////////////////////////////////
3.117 } else if (com=="setFrameType")
3.118 {
3.119 if ( xelection.type()!=Selection::Branch && xelection.type()!= Selection::MapCenter && xelection.type()!=Selection::FloatImage)
3.120 @@ -1093,8 +1105,8 @@
3.121 }
3.122 else if (parser.checkParCount(1))
3.123 {
3.124 - x=parser.parInt(ok,0);
3.125 - if (ok) setFramePadding(x);
3.126 + n=parser.parInt(ok,0);
3.127 + if (ok) setFramePadding(n);
3.128 }
3.129 /////////////////////////////////////////////////////////////////////
3.130 } else if (com=="setFrameBorderWidth")
3.131 @@ -1105,8 +1117,8 @@
3.132 }
3.133 else if (parser.checkParCount(1))
3.134 {
3.135 - x=parser.parInt(ok,0);
3.136 - if (ok) setFrameBorderWidth (x);
3.137 + n=parser.parInt(ok,0);
3.138 + if (ok) setFrameBorderWidth (n);
3.139 }
3.140 /////////////////////////////////////////////////////////////////////
3.141 } else if (com=="setMapAuthor")
3.142 @@ -2239,7 +2251,7 @@
3.143 }
3.144 }
3.145
3.146 -void MapEditor::move(const int &x, const int &y)
3.147 +void MapEditor::move(const double &x, const double &y)
3.148 {
3.149 LinkableMapObj *sel=xelection.single();
3.150 if (sel)
3.151 @@ -2257,7 +2269,7 @@
3.152
3.153 }
3.154
3.155 -void MapEditor::moveRel (const int &x, const int &y)
3.156 +void MapEditor::moveRel (const double &x, const double &y)
3.157 {
3.158 LinkableMapObj *sel=xelection.single();
3.159 if (sel)
3.160 @@ -2411,19 +2423,20 @@
3.161 {
3.162 // save scroll state. If scrolled, automatically select
3.163 // new branch in order to tmp unscroll parent...
3.164 - return bo->addBranch();
3.165 + newbo=bo->addBranch();
3.166
3.167 }else if (num==-1)
3.168 {
3.169 num=bo->getNum()+1;
3.170 bo=(BranchObj*)bo->getParObj();
3.171 + if (bo) newbo=bo->insertBranch(num);
3.172 }else if (num==-3)
3.173 {
3.174 num=bo->getNum();
3.175 bo=(BranchObj*)bo->getParObj();
3.176 + if (bo) newbo=bo->insertBranch(num);
3.177 }
3.178 - if (!bo) return bo;
3.179 - newbo=bo->insertBranch(num);
3.180 + if (!newbo) return NULL;
3.181 }
3.182 return newbo;
3.183 }
3.184 @@ -2449,18 +2462,19 @@
3.185 newbo,
3.186 "delete ()",
3.187 bo,
3.188 - QString ("addBranch (%1)").arg(pos-2),
3.189 + QString ("addBranch (%1)").arg(pos),
3.190 QString ("Add new branch to %1").arg(getName(bo)));
3.191
3.192 mapCenter->reposition();
3.193 + xelection.update();
3.194 + latestSelection=newbo->getSelectString();
3.195 // In Network mode, the client needs to know where the new branch is,
3.196 // so we have to pass on this information via saveState.
3.197 // TODO: Get rid of this positioning workaround
3.198 QString ps=qpointfToString (newbo->getAbsPos());
3.199 - sendData ("selectLastBranch ()");
3.200 + sendData ("selectLatestAdded ()");
3.201 sendData (QString("move %1").arg(ps));
3.202 sendSelection();
3.203 - xelection.update();
3.204 }
3.205 }
3.206 return newbo;
3.207 @@ -2495,6 +2509,7 @@
3.208 xelection.update();
3.209 }
3.210 }
3.211 + latestSelection=xelection.getSelectString();
3.212 return newbo;
3.213 }
3.214
3.215 @@ -4837,6 +4852,8 @@
3.216
3.217 void MapEditor::sendData(const QString &s)
3.218 {
3.219 + if (clientList.size()==0) return;
3.220 +
3.221 // Create bytearray to send
3.222 QByteArray block;
3.223 QDataStream out(&block, QIODevice::WriteOnly);
3.224 @@ -4856,7 +4873,8 @@
3.225 quint16 bs=(quint16)(block.size() - 2*sizeof(quint16));
3.226 out << bs;
3.227
3.228 - cout << "ME::sendData bs="<<bs<<" counter="<<sendCounter<<" s="<<s.ascii()<<endl;
3.229 + if (debug)
3.230 + cout << "ME::sendData bs="<<bs<<" counter="<<sendCounter<<" s="<<s.ascii()<<endl;
3.231
3.232 for (int i=0; i<clientList.size(); ++i)
3.233 {
3.234 @@ -4869,7 +4887,8 @@
3.235 {
3.236 while (clientSocket->bytesAvailable() >=(int)sizeof(quint16) )
3.237 {
3.238 - cout <<"readData bytesAvail="<<clientSocket->bytesAvailable();
3.239 + if (debug)
3.240 + cout <<"readData bytesAvail="<<clientSocket->bytesAvailable();
3.241 quint16 recCounter;
3.242 quint16 blockSize;
3.243
3.244 @@ -4881,7 +4900,8 @@
3.245
3.246 QString t;
3.247 in >>t;
3.248 - cout << " t="<<t.ascii()<<endl;
3.249 + if (debug)
3.250 + cout << " t="<<t.ascii()<<endl;
3.251 parseAtom (t);
3.252 }
3.253 return;
4.1 --- a/mapeditor.h Wed Jul 04 11:05:11 2007 +0000
4.2 +++ b/mapeditor.h Wed Jul 04 11:05:15 2007 +0000
4.3 @@ -181,12 +181,12 @@
4.4
4.5 Move absolutly to (x,y).
4.6 */
4.7 - void move (const int &x, const int &y);
4.8 + void move (const double &x, const double &y);
4.9 /*! \brief Move relativly
4.10
4.11 Move relativly to (x,y).
4.12 */
4.13 - void moveRel (const int &x, const int &y);
4.14 + void moveRel (const double &x, const double &y);
4.15 void moveBranchUp(); //!< Move branch up
4.16 void moveBranchDown(); //!< Move branch down
4.17 private:
4.18 @@ -380,6 +380,9 @@
4.19 XLinkObj* tmpXLink;
4.20
4.21 Selection xelection;
4.22 +
4.23 + QString latestSelection; // select string of latest added object
4.24 +
4.25 MapObj* movingObj; // moving a MapObj
4.26 MapObj* linkingObj_src; // part of a link
4.27 QPointF movingObj_orgPos; // org. pos of mouse before move