1.1 --- a/mapeditor.cpp Wed May 13 08:26:27 2009 +0000
1.2 +++ b/mapeditor.cpp Fri May 15 15:22:15 2009 +0000
1.3 @@ -45,7 +45,6 @@
1.4 model=vm;
1.5 model->setScene (mapScene);
1.6 model->registerEditor(this);
1.7 -// model->addMapCenter(); // FIXME-3 create this in MapEditor until BO and MCO are independent of scene
1.8 model->makeDefault(); // No changes in model so far
1.9
1.10 setScene (mapScene);
1.11 @@ -58,7 +57,7 @@
1.12 CopyCursor=QCursor ( QPixmap(iconPath+"cursorcopy.png"), 1,1 );
1.13 XLinkCursor=QCursor ( QPixmap(iconPath+"cursorxlink.png"), 1,7 );
1.14
1.15 - setFocusPolicy (Qt::StrongFocus);
1.16 + //setFocusPolicy (Qt::StrongFocus); //FIXME-3
1.17
1.18 pickingColor=false;
1.19 drawingLink=false;
1.20 @@ -75,6 +74,45 @@
1.21 //model->reposition(); //FIXME-3 really still needed?
1.22
1.23
1.24 + // Shortcuts and actions
1.25 + QAction *a;
1.26 + a = new QAction("Select upper branch", this);
1.27 + a->setShortcut (Qt::Key_Up );
1.28 + a->setShortcutContext (Qt::WidgetShortcut);
1.29 + addAction (a);
1.30 + connect( a, SIGNAL( triggered() ), this, SLOT( cursorUp() ) );
1.31 +
1.32 + a = new QAction( "Select lower branch",this);
1.33 + a->setShortcut ( Qt::Key_Down );
1.34 + a->setShortcutContext (Qt::WidgetShortcut);
1.35 + addAction (a);
1.36 + connect( a, SIGNAL( triggered() ), this, SLOT( cursorDown() ) );
1.37 +
1.38 + a = new QAction( "Select left branch", this);
1.39 + a->setShortcut (Qt::Key_Left );
1.40 +// a->setShortcutContext (Qt::WindowShortcut);
1.41 + a->setShortcutContext (Qt::WidgetWithChildrenShortcut);
1.42 + addAction (a);
1.43 + connect( a, SIGNAL( triggered() ), this, SLOT( cursorLeft() ) );
1.44 +
1.45 + a = new QAction( "Select child branch", this);
1.46 + a->setShortcut (Qt::Key_Right);
1.47 + a->setShortcutContext (Qt::WidgetWithChildrenShortcut);
1.48 + addAction (a);
1.49 + connect( a, SIGNAL( triggered() ), this, SLOT( cursorRight() ) );
1.50 +
1.51 + a = new QAction( "Select first branch", this);
1.52 + a->setShortcut (Qt::Key_Home );
1.53 + a->setShortcutContext (Qt::WidgetWithChildrenShortcut);
1.54 + addAction (a);
1.55 + connect( a, SIGNAL( triggered() ), this, SLOT( cursorFirst() ) );
1.56 +
1.57 + a = new QAction( "Select last branch",this);
1.58 + a->setShortcut ( Qt::Key_End );
1.59 + a->setShortcutContext (Qt::WidgetWithChildrenShortcut);
1.60 + addAction (a);
1.61 + connect( a, SIGNAL( triggered() ), this, SLOT( cursorLast() ) );
1.62 +
1.63 // Action to embed LineEdit for heading in Scene
1.64 editingHeading=false;
1.65 lineEdit=new QLineEdit;
1.66 @@ -82,7 +120,7 @@
1.67 QGraphicsProxyWidget *pw=scene()->addWidget (lineEdit);
1.68 pw->setZValue (100);
1.69
1.70 - QAction *a = new QAction( tr( "Edit heading","MapEditor" ), this);
1.71 + a = new QAction( tr( "Edit heading","MapEditor" ), this);
1.72 a->setShortcut ( Qt::Key_Return ); //Edit heading
1.73 addAction (a);
1.74 connect( a, SIGNAL( triggered() ), this, SLOT( editHeading() ) );
1.75 @@ -131,10 +169,6 @@
1.76 MapEditor::~MapEditor()
1.77 {
1.78 //cout <<"Destructor MapEditor for "<<model->getMapName().toStdString()<<endl;
1.79 - // No need to remove tmp files:
1.80 - // tmpMapDir is in tmpVymDir,
1.81 - // so it gets removed automagically when vym closes
1.82 -
1.83 model->unregisterEditor(this);
1.84 }
1.85
1.86 @@ -476,6 +510,38 @@
1.87 */
1.88 }
1.89
1.90 +void MapEditor::cursorUp()
1.91 +{
1.92 + model->selectUpperBranch();
1.93 +}
1.94 +
1.95 +void MapEditor::cursorDown()
1.96 +
1.97 +{
1.98 + model->selectLowerBranch();
1.99 +}
1.100 +
1.101 +void MapEditor::cursorLeft()
1.102 +{
1.103 + model->selectLeftBranch();
1.104 +}
1.105 +
1.106 +void MapEditor::cursorRight()
1.107 +{
1.108 + model->selectRightBranch();
1.109 +}
1.110 +
1.111 +void MapEditor::cursorFirst()
1.112 +{
1.113 + model->selectFirstBranch();
1.114 +}
1.115 +
1.116 +void MapEditor::cursorLast()
1.117 +{
1.118 + model->selectLastBranch();
1.119 +}
1.120 +
1.121 +
1.122 void MapEditor::editHeading()
1.123 {
1.124 if (editingHeading)