[Kst] extragear/graphics/kst/kst

Barth Netterfield netterfield at astro.utoronto.ca
Thu Dec 1 21:06:49 CET 2005


SVN commit 484757 by netterfield:

In text mode, set the cursor to |, except for drags, in which case it
becomes an arrow.  This provides much better feedback that, for
example, if you click on a label, you are going to create a new
label, not edit the one you clicked on.



 M  +1 -1      kst.cpp  
 M  +1 -1      ksttoplevelview.cpp  
 M  +1 -1      ksttoplevelview.h  
 M  +13 -1     kstviewwidget.cpp  


--- trunk/extragear/graphics/kst/kst/kst.cpp #484756:484757
@@ -1817,7 +1817,7 @@
     createType = "Ellipse";
   } else if (_gfxLabelAction->isChecked()) {
     action = _gfxLabelAction;
-    mode = KstTopLevelView::CreateMode;
+    mode = KstTopLevelView::LabelMode;
     createType = "Label";
   } else if (_gfxPictureAction->isChecked()) {
     action = _gfxPictureAction;
--- trunk/extragear/graphics/kst/kst/ksttoplevelview.cpp #484756:484757
@@ -274,7 +274,7 @@
   _mode = v;
   
   // change the mouse handler
-  if (_mode == CreateMode) {
+  if ((_mode == CreateMode) || (_mode == LabelMode)) {
     _activeHandler = handlerForObject(objectType);
   } else {
     _activeHandler = 0L;
--- trunk/extragear/graphics/kst/kst/ksttoplevelview.h #484756:484757
@@ -49,7 +49,7 @@
     void paint(KstPainter::PaintType type, const QRegion& boundry);
 
     void clearFocus();
-    enum ViewMode { LayoutMode = 0, DisplayMode, CreateMode, Unknown = 15 };
+    enum ViewMode { LayoutMode = 0, DisplayMode, CreateMode, LabelMode, Unknown = 15 };
     ViewMode viewMode() const { return _mode; }
     void setViewMode(ViewMode v, const QString& createType = QString::null);
 
--- trunk/extragear/graphics/kst/kst/kstviewwidget.cpp #484756:484757
@@ -177,11 +177,22 @@
     } else {
       setCursor(QCursor(Qt::ArrowCursor));
     }
-  } else { // layout mode
+  } else { 
     if ((e->state() & Qt::MouseButtonMask) == 0) {
+      switch (_view->viewMode()) {
+        case KstTopLevelView::LabelMode:
+          setCursor(QCursor(Qt::IbeamCursor));
+          break;
+        case KstTopLevelView::CreateMode:
+          setCursor(QCursor(Qt::ArrowCursor));
+          break;
+        default:
+          break;
+      }
       _view->updateFocus(e->pos());
       e->accept();
     } else if (e->state() & Qt::LeftButton) {
+      //setCursor(QCursor(Qt::ArrowCursor));
       _view->pressMove(e->pos(), e->state() & Qt::ShiftButton);
       e->accept();
     }
@@ -213,6 +224,7 @@
 
   // Layout/graphics mode
   if (e->button() & Qt::LeftButton) {
+    setCursor(QCursor(Qt::ArrowCursor));
     //kstdDebug() << "    -> left button" << endl;
     if (_view->handlePress(e->pos(), e->state() & Qt::ShiftButton)) {
       //kstdDebug() << "   -> Accepting" << endl;


More information about the Kst mailing list