[Kst] extragear/graphics/kst/kst

Rick Chern rchern at interchange.ubc.ca
Sat Aug 13 01:51:58 CEST 2005


SVN commit 446268 by rchern:

When in any of the graphics mode, hold down Ctrl to temporarily enter Layout mode.  Release Ctrl to revert back to the previous graphics mode.  Ctrl+A, Ctrl+Shift, etc still work in the temporary layout mode by keeping Ctrl held and hitting the appropriate key (A, Shift, etc...).  

 M  +15 -5     kstviewwidget.cpp  
 M  +1 -0      kstviewwidget.h  


--- trunk/extragear/graphics/kst/kst/kstviewwidget.cpp #446267:446268
@@ -37,6 +37,7 @@
   setBackgroundMode(Qt::NoBackground);
   setMinimumSize(40, 25);
   _vo_datamode = 0L;
+  _lastViewMode = KstTopLevelView::LayoutMode;
 }
 
 
@@ -235,10 +236,12 @@
   // layout/graphics mode 
   if (e->button() & Qt::LeftButton) {
     // let the toplevel view handle it
-    if (_view->handleDoubleClick(e->pos(), e->state() & Qt::ShiftButton)) {
-      e->accept();
-      return;  
-    }  
+    if (_view->viewMode() == _lastViewMode) {
+      if (_view->handleDoubleClick(e->pos(), e->state() & Qt::ShiftButton)) {
+        e->accept();
+        return;  
+      }  
+    }
   }
 
   //kdDebug() << "   -> Passing up" << endl;
@@ -438,7 +441,7 @@
     if (e->key() == Qt::Key_Escape) {
       _view->cancelMouseOperations();
       return;
-    } else if (e->key() == Qt::Key_A && s & Qt::ControlButton) {
+    } else if (e->key() == Qt::Key_A && (s & Qt::ControlButton) && _view->viewMode() == KstTopLevelView::LayoutMode) {
       if (s & Qt::ShiftButton) {
         _view->unselectAll();
       } else {
@@ -449,6 +452,10 @@
     } else if (e->key() == Qt::Key_Delete) {
       _view->deleteSelectedObjects(); 
       return; 
+    } else if (e->key() == Qt::Key_Control && (_view->viewMode() != KstTopLevelView::LayoutMode)) {
+      _lastViewMode = _view->viewMode();
+      _view->setViewMode(KstTopLevelView::LayoutMode);
+      return;  
     }
   }
 
@@ -469,6 +476,9 @@
       vo->keyReleaseEvent(this, e);
     }
     return;
+  } else if (e->key() == Qt::Key_Control && _view->viewMode() == KstTopLevelView::LayoutMode) {
+    _view->setViewMode(_lastViewMode);  
+    _lastViewMode = KstTopLevelView::LayoutMode;
   }
 
   QWidget::keyReleaseEvent(e);
--- trunk/extragear/graphics/kst/kst/kstviewwidget.h #446267:446268
@@ -65,6 +65,7 @@
 
   private:
     KstTopLevelViewPtr _view;
+    KstTopLevelView::ViewMode _lastViewMode;
     KstViewObject *_vo_datamode;
     bool _dropEnabled : 1;
     bool _dragEnabled : 1;


More information about the Kst mailing list