1.1 Binary file demos/todo.vym has changed
2.1 --- a/mainwindow.cpp Sat Mar 31 09:28:30 2007 +0000
2.2 +++ b/mainwindow.cpp Mon Apr 09 15:42:21 2007 +0000
2.3 @@ -154,6 +154,7 @@
2.4 setupFlagActions();
2.5 setupSettingsActions();
2.6 setupContextMenus();
2.7 + setupMacros();
2.8 if (settings.value( "/mainwindow/showTestMenu",false).toBool()) setupTestActions();
2.9 setupHelpActions();
2.10
2.11 @@ -446,7 +447,7 @@
2.12 actionEditHeading=a;
2.13 a = new QAction( tr( "Edit heading","Edit menu" ), this);
2.14 a->setStatusTip (tr( "edit Heading" ));
2.15 - a->setShortcut ( Qt::Key_F2 ); //Edit heading
2.16 + //a->setShortcut ( Qt::Key_F2 ); //Edit heading
2.17 a->setShortcutContext (Qt::WindowShortcut);
2.18 addAction (a);
2.19 connect( a, SIGNAL( triggered() ), this, SLOT( editHeading() ) );
2.20 @@ -1427,12 +1428,12 @@
2.21 QAction *a;
2.22 a = new QAction( "Test function" , this);
2.23 a->setStatusTip( "Call test function" );
2.24 - a->setShortcut (Qt::Key_F4 );
2.25 + //a->setShortcut (Qt::Key_F4 );
2.26 connect( a, SIGNAL( triggered() ), this, SLOT( testFunction() ) );
2.27 testMenu->addAction (a);
2.28 a = new QAction( "Command" , this);
2.29 a->setStatusTip( "Enter command to call in editor" );
2.30 - a->setShortcut (Qt::Key_F5 );
2.31 + //a->setShortcut (Qt::Key_F5 );
2.32 connect( a, SIGNAL( triggered() ), this, SLOT( testCommand() ) );
2.33 testMenu->addAction (a);
2.34 }
2.35 @@ -1556,10 +1557,10 @@
2.36 // Create actions
2.37 for (int i = 0; i < MaxRecentFiles; ++i)
2.38 {
2.39 - recentFileActs[i] = new QAction(this);
2.40 - recentFileActs[i]->setVisible(false);
2.41 - fileLastMapsMenu->addAction(recentFileActs[i]);
2.42 - connect(recentFileActs[i], SIGNAL(triggered()),
2.43 + recentFileActions[i] = new QAction(this);
2.44 + recentFileActions[i]->setVisible(false);
2.45 + fileLastMapsMenu->addAction(recentFileActions[i]);
2.46 + connect(recentFileActions[i], SIGNAL(triggered()),
2.47 this, SLOT(fileLoadRecent()));
2.48 }
2.49 setupRecentMapsMenu();
2.50 @@ -1572,14 +1573,37 @@
2.51 int numRecentFiles = qMin(files.size(), (int)MaxRecentFiles);
2.52
2.53 for (int i = 0; i < numRecentFiles; ++i) {
2.54 - //QString text = tr("&%1 %2").arg(i + 1).arg(strippedName(files[i]));
2.55 QString text = tr("&%1 %2").arg(i + 1).arg(files[i]);
2.56 - recentFileActs[i]->setText(text);
2.57 - recentFileActs[i]->setData(files[i]);
2.58 - recentFileActs[i]->setVisible(true);
2.59 + recentFileActions[i]->setText(text);
2.60 + recentFileActions[i]->setData(files[i]);
2.61 + recentFileActions[i]->setVisible(true);
2.62 }
2.63 for (int j = numRecentFiles; j < MaxRecentFiles; ++j)
2.64 - recentFileActs[j]->setVisible(false);
2.65 + recentFileActions[j]->setVisible(false);
2.66 +}
2.67 +
2.68 +void Main::setupMacros()
2.69 +{
2.70 + for (int i = 0; i <= 11; i++)
2.71 + {
2.72 + macroActions[i] = new QAction(this);
2.73 + macroActions[i]->setData(i);
2.74 + addAction (macroActions[i]);
2.75 + connect(macroActions[i], SIGNAL(triggered()),
2.76 + this, SLOT(callMacro()));
2.77 + }
2.78 + macroActions[0]->setShortcut ( Qt::Key_F1 );
2.79 + macroActions[1]->setShortcut ( Qt::Key_F2 );
2.80 + macroActions[2]->setShortcut ( Qt::Key_F3 );
2.81 + macroActions[3]->setShortcut ( Qt::Key_F4 );
2.82 + macroActions[4]->setShortcut ( Qt::Key_F5 );
2.83 + macroActions[5]->setShortcut ( Qt::Key_F6 );
2.84 + macroActions[6]->setShortcut ( Qt::Key_F7 );
2.85 + macroActions[7]->setShortcut ( Qt::Key_F8 );
2.86 + macroActions[8]->setShortcut ( Qt::Key_F9 );
2.87 + macroActions[9]->setShortcut ( Qt::Key_F10 );
2.88 + macroActions[10]->setShortcut ( Qt::Key_F11 );
2.89 + macroActions[11]->setShortcut ( Qt::Key_F12 );
2.90 }
2.91
2.92 void Main::hideEvent (QHideEvent * )
2.93 @@ -2257,9 +2281,9 @@
2.94 QStringList fl;
2.95 QFileDialog *fd=new QFileDialog (this);
2.96 fd->setCaption (tr("Export map as image"));
2.97 + fd->setDirectory (lastImageDir);
2.98 fd->setFileMode(QFileDialog::AnyFile);
2.99 fd->setFilters (imageIO.getFilters() );
2.100 - fd->setDirectory (lastImageDir);
2.101 if (fd->exec())
2.102 {
2.103 fl=fd->selectedFiles();
2.104 @@ -3603,3 +3627,19 @@
2.105 QMessageBox::aboutQt( this, "Qt Application Example" );
2.106 }
2.107
2.108 +void Main::callMacro ()
2.109 +{
2.110 + QAction *action = qobject_cast<QAction *>(sender());
2.111 + int i=-1;
2.112 + if (action)
2.113 + {
2.114 + i=action->data().toInt();
2.115 + QString m=settings.value(QString("/macros/macro-%1").arg(i) ).toString();
2.116 + if (! m.isEmpty())
2.117 + {
2.118 + cout <<"Main::callMacro m="<<m.ascii()<<endl;
2.119 + currentMapEditor()->runScript (m);
2.120 + }
2.121 + }
2.122 +}
2.123 +
3.1 --- a/mainwindow.h Sat Mar 31 09:28:30 2007 +0000
3.2 +++ b/mainwindow.h Mon Apr 09 15:42:21 2007 +0000
3.3 @@ -43,6 +43,7 @@
3.4 void setupHelpActions();
3.5 void setupContextMenus();
3.6 void setupRecentMapsMenu();
3.7 + void setupMacros();
3.8 void hideEvent (QHideEvent * );
3.9 void showEvent (QShowEvent * );
3.10 bool reallyWriteDirectory(const QString&);
3.11 @@ -193,6 +194,7 @@
3.12 void helpAbout();
3.13 void helpAboutQT();
3.14
3.15 + void callMacro ();
3.16 private:
3.17 QTabWidget *tabWidget;
3.18 FindWindow *findWindow;
3.19 @@ -214,7 +216,10 @@
3.20
3.21 QMenu *recentFilesMenu;
3.22 enum { MaxRecentFiles = 9 };
3.23 - QAction *recentFileActs[MaxRecentFiles];
3.24 + QAction *recentFileActions[MaxRecentFiles];
3.25 +
3.26 + QAction *macroActions[12];
3.27 + QStringList macro;
3.28
3.29 QAction* actionFileSave;
3.30 QAction* actionFilePrint;
4.1 --- a/mapeditor.cpp Sat Mar 31 09:28:30 2007 +0000
4.2 +++ b/mapeditor.cpp Mon Apr 09 15:42:21 2007 +0000
4.3 @@ -523,6 +523,7 @@
4.4 }
4.5 } else if (com=="colorSubtree")
4.6 {
4.7 + cout << "atom="<< atom.ascii()<<endl;
4.8 if (xelection.isEmpty())
4.9 {
4.10 parser.setError (Aborted,"Nothing selected");
4.11 @@ -942,6 +943,20 @@
4.12 selb->updateFlagsToolbar();
4.13 }
4.14 }
4.15 + } else if (com=="setFrameType")
4.16 + {
4.17 + if (xelection.isEmpty() )
4.18 + {
4.19 + parser.setError (Aborted,"Nothing selected");
4.20 + } else if (! selb )
4.21 + {
4.22 + parser.setError (Aborted,"Type of selection is not a branch");
4.23 + } else if (parser.checkParamCount(1))
4.24 + {
4.25 + s=parser.parString(ok,0);
4.26 + if (ok)
4.27 + setFrameType (s);
4.28 + }
4.29 } else if (com=="unscroll")
4.30 {
4.31 if (xelection.isEmpty() )
4.32 @@ -991,23 +1006,10 @@
4.33
4.34 void MapEditor::runScript (QString script)
4.35 {
4.36 - // TODO "atomize" script, currently each line holds one atom
4.37 -
4.38 - QStringList list=script.split("\n");
4.39 - QString l;
4.40 - int pos;
4.41 - for (int i=0; i<list.size(); i++)
4.42 - {
4.43 - l=list.at(i);
4.44 -
4.45 - // Ignore comments
4.46 - pos=l.indexOf ("#");
4.47 - if (pos>=0) l.truncate (pos);
4.48 -
4.49 - // Try to ignore empty lines
4.50 - if (l.contains (QRegExp ("\\w")))
4.51 - parseAtom (l);
4.52 - }
4.53 + // FIXME "atomize" script, currently each line holds one atom
4.54 +
4.55 + parser.setScript (script);
4.56 + parser.runScript();
4.57
4.58 }
4.59
4.60 @@ -2513,9 +2515,9 @@
4.61 QColor oldcol=mapScene->backgroundBrush().color();
4.62 saveState(
4.63 mapCenter,
4.64 - QString ("setMapBackgroundColor (%1)").arg(oldcol.name()),
4.65 + QString ("setMapBackgroundColor (\"%1\")").arg(oldcol.name()),
4.66 mapCenter,
4.67 - QString ("setMapBackgroundColor (%1)").arg(col.name()),
4.68 + QString ("setMapBackgroundColor (\"%1\")").arg(col.name()),
4.69 QString("Set background color of map to %1").arg(col.name()));
4.70 mapScene->setBackgroundBrush(col);
4.71 }
4.72 @@ -2541,9 +2543,9 @@
4.73 {
4.74 saveState(
4.75 bo,
4.76 - QString ("colorBranch (%1)").arg(bo->getColor().name()),
4.77 + QString ("colorBranch (\"%1\")").arg(bo->getColor().name()),
4.78 bo,
4.79 - QString ("colorBranch (%1)").arg(c.name()),
4.80 + QString ("colorBranch (\"%1\")").arg(c.name()),
4.81 QString("Set color of %1 to %2").arg(getName(bo)).arg(c.name())
4.82 );
4.83 bo->setColor(c); // color branch
4.84 @@ -2558,7 +2560,7 @@
4.85 saveStateChangingPart(
4.86 bo,
4.87 bo,
4.88 - QString ("colorSubtree (%1)").arg(c.name()),
4.89 + QString ("colorSubtree (\"%1\")").arg(c.name()),
4.90 QString ("Set color of %1 and childs to %2").arg(getName(bo)).arg(c.name())
4.91 );
4.92 bo->setColorSubtree (c); // color links, color childs
4.93 @@ -3336,6 +3338,17 @@
4.94 }
4.95 }
4.96
4.97 +void MapEditor::setFrameType(const QString &s) // FIXME missing saveState
4.98 +{
4.99 + BranchObj *bo=xelection.getBranch();
4.100 + if (bo)
4.101 + {
4.102 + bo->setFrameType (s);
4.103 + mapCenter->reposition();
4.104 + bo->updateLink();
4.105 + }
4.106 +}
4.107 +
4.108 void MapEditor::setFramePenColor(const QColor &c) // FIXME missing saveState
4.109 {
4.110 BranchObj *bo=xelection.getBranch();
5.1 --- a/mapeditor.h Sat Mar 31 09:28:30 2007 +0000
5.2 +++ b/mapeditor.h Mon Apr 09 15:42:21 2007 +0000
5.3 @@ -183,6 +183,7 @@
5.4 public:
5.5 void saveFloatImage ();
5.6 void setFrameType(const FrameType &);
5.7 + void setFrameType(const QString &);
5.8 void setFramePenColor (const QColor &);
5.9 void setFrameBrushColor (const QColor &);
5.10 void setIncludeImagesVer(bool);
6.1 --- a/parser.cpp Sat Mar 31 09:28:30 2007 +0000
6.2 +++ b/parser.cpp Mon Apr 09 15:42:21 2007 +0000
6.3 @@ -214,8 +214,18 @@
6.4 QColor Parser::parColor(bool &ok,const int &index)
6.5 {
6.6 // return the QColor at index
6.7 - ok=true;
6.8 - return QColor (paramList[index]);
6.9 + ok=false;
6.10 + QString r;
6.11 + QColor c;
6.12 + QRegExp re("\"(.*)\"");
6.13 + int pos=re.search (paramList[index]);
6.14 + if (pos>=0)
6.15 + {
6.16 + r=re.cap (1);
6.17 + c.setNamedColor(r);
6.18 + ok=c.isValid();
6.19 + }
6.20 + return c;
6.21 }
6.22
6.23 void Parser::setScript(const QString &s)
6.24 @@ -228,7 +238,11 @@
6.25 return script;
6.26 }
6.27
6.28 -void Parser::startScript()
6.29 +void Parser::runScript()
6.30 {
6.31 }
6.32
6.33 +bool Parser::scriptNextAtom()
6.34 +{
6.35 +}
6.36 +
7.1 --- a/parser.h Sat Mar 31 09:28:30 2007 +0000
7.2 +++ b/parser.h Mon Apr 09 15:42:21 2007 +0000
7.3 @@ -29,8 +29,8 @@
7.4
7.5 void setScript (const QString &);
7.6 QString getScript();
7.7 - void startScript();
7.8 - bool next();
7.9 + void runScript();
7.10 + bool scriptNextAtom();
7.11
7.12
7.13 private:
8.1 --- a/version.h Sat Mar 31 09:28:30 2007 +0000
8.2 +++ b/version.h Mon Apr 09 15:42:21 2007 +0000
8.3 @@ -5,7 +5,7 @@
8.4
8.5 #define __VYM_NAME "VYM"
8.6 #define __VYM_VERSION "1.8.70"
8.7 -#define __VYM_BUILD_DATE "March 31, 2007"
8.8 +#define __VYM_BUILD_DATE "April 9, 2007"
8.9
8.10
8.11 bool checkVersion(const QString &);