[Kst] kdeextragear-2/kst/kst

Andrew Walker arwalker at sumusltd.com
Fri Jun 18 00:43:20 CEST 2004


CVS commit by arwalker: 

Actually make layout mode part of the radio group.
A window will leave/enter layout mode when it is
given the focus, or if it is the active window when
the mode is changed.


  M +7 -5      kst.cpp   1.155
  M +3 -3      kst.h   1.75
  M +2 -0      kst2dplot.cpp   1.95
  M +1 -1      kst2dplot.h   1.36
  M +12 -0     kstviewwindow.cpp   1.13
  M +2 -0      kstviewwindow.h   1.12


--- kdeextragear-2/kst/kst/kst2dplot.cpp  #1.94:1.95
@@ -3172,4 +3172,6 @@ KstMouseModeType Kst2DPlot::globalZoomTy
   case KstApp::TEXT:
     return LABEL_TOOL;
+  case KstApp::LAYOUT:
+    return LAYOUT_TOOL;
   default:
     break;

--- kdeextragear-2/kst/kst/kst2dplot.h  #1.35:1.36
@@ -43,5 +43,5 @@ struct KstPlotScale {
 };
 
-typedef enum { INACTIVE, XY_ZOOMBOX, Y_ZOOMBOX, X_ZOOMBOX, LABEL_TOOL } KstMouseModeType;
+typedef enum { INACTIVE, XY_ZOOMBOX, Y_ZOOMBOX, X_ZOOMBOX, LABEL_TOOL, LAYOUT_TOOL } KstMouseModeType;
 struct KstMouse {
   KstMouse() { mode = INACTIVE; label = -1; minMove = 2; }

--- kdeextragear-2/kst/kst/kst.cpp  #1.154:1.155
@@ -368,10 +368,10 @@ void KstApp::initActions() {
 
   /************/
-  LayoutMode = new KRadioAction(i18n("Layout Mode"), "kst_layoutmode", 0,
+  LayoutAction = new KRadioAction(i18n("Layout Mode"), "kst_layoutmode", 0,
                                  this, SLOT(toggleMouseMode()),
                                  actionCollection(), "layoutmode_action");
-  LayoutMode->setExclusiveGroup("zoom");
-  LayoutMode->setWhatsThis(i18n("Layout mode."));
-  LayoutMode->setToolTip(i18n("Layout mode"));
+  LayoutAction->setExclusiveGroup("zoom");
+  LayoutAction->setToolTip(i18n("Layout mode"));
+  LayoutAction->setWhatsThis(i18n("Use this mode to move, resize, and group plots."));
 
   /************/
@@ -649,4 +649,6 @@ KstApp::KstZoomType KstApp::getZoomRadio
   } else if (TextAction->isChecked()) {
     return TEXT;
+  } else if (LayoutAction->isChecked()) {
+    return LAYOUT;
   } else {
     return XYZOOM;
@@ -1143,5 +1145,5 @@ void KstApp::toggleMouseMode() {
   KstTopLevelViewPtr pView = activeView();
   if (pView) {
-    pView->setViewMode(LayoutMode->isChecked() ? KstTopLevelView::LayoutMode : KstTopLevelView::DisplayMode);
+    pView->setViewMode(LayoutAction->isChecked() ? KstTopLevelView::LayoutMode : KstTopLevelView::DisplayMode);
   }
 }

--- kdeextragear-2/kst/kst/kst.h  #1.74:1.75
@@ -101,5 +101,5 @@ class KstApp : public KMdiMainFrm {
     bool paused() const { return PauseAction->isChecked(); }
 
-    enum KstZoomType { XYZOOM, YZOOM, XZOOM, TEXT };
+    enum KstZoomType { XYZOOM, YZOOM, XZOOM, TEXT, LAYOUT };
     /** Get XY zoom radio button state */
     KstZoomType getZoomRadio();
@@ -372,9 +372,10 @@ class KstApp : public KMdiMainFrm {
     KAction *_reloadAction;
 
-    /** Radio Collection: XY, X, Y zoom */
+    /** Radio Collection: XY, X, Y zoom, Text, Layout */
     KRadioAction *XYZoomAction;
     KRadioAction *XZoomAction;
     KRadioAction *YZoomAction;
     KRadioAction *TextAction;
+    KRadioAction *LayoutAction;
 
     /* Filter Edit Action */
@@ -408,5 +409,4 @@ class KstApp : public KMdiMainFrm {
     /* Data mode */
     KToggleAction *DataMode;
-    KToggleAction *LayoutMode;
 
     /** Change File Action: brings up the change file dialog box */

--- kdeextragear-2/kst/kst/kstviewwindow.cpp  #1.12:1.13
@@ -112,4 +112,5 @@ void KstViewWindow::commonConstructor() 
 
   connect(this, SIGNAL(settingsChanged()), this, SLOT(slotSettingsChanged()));
+  connect(this, SIGNAL(focusInEventOccurs( KMdiChildView*)), this, SLOT(slotActivated(KMdiChildView*)));
 
   QTimer::singleShot(0, this, SLOT(updateActions()));
@@ -147,4 +148,15 @@ void KstViewWindow::readProperties(KConf
 }
 
+void KstViewWindow::slotActivated(KMdiChildView*) {
+  if (KstApp::inst()->getZoomRadio() == KstApp::LAYOUT) {
+    if( view()->viewMode() == KstTopLevelView::DisplayMode ) {
+      view()->setViewMode( KstTopLevelView::LayoutMode );
+    }
+  } else {
+    if( view()->viewMode() == KstTopLevelView::LayoutMode ) {
+      view()->setViewMode( KstTopLevelView::DisplayMode );
+    }
+  }
+}
 
 void KstViewWindow::slotFileClose() {

--- kdeextragear-2/kst/kst/kstviewwindow.h  #1.11:1.12
@@ -85,4 +85,6 @@ class KstViewWindow : public KMdiChildVi
     void toggleDataMode();
 
+    void slotActivated(KMdiChildView*);
+
   public slots:
     /** asks for saving if the file is modified, then closes the actual





More information about the Kst mailing list