[Kst] extragear/graphics/kst/src/libkstapp

Andrew Walker arwalker at sumusltd.com
Thu May 4 18:31:40 CEST 2006


SVN commit 537371 by arwalker:

CCBUG:124090 Address some of Barth's suggestions

 M  +4 -2      ksttoplevelview.h  
 M  +52 -14    kstviewmanager_i.cpp  
 M  +2 -0      kstviewmanager_i.h  


--- trunk/extragear/graphics/kst/src/libkstapp/ksttoplevelview.h #537370:537371
@@ -75,6 +75,10 @@
     bool tiedZoomMode(int zoom, bool flag, double center, int mode, int modeExtra, const QString& plotName);
     bool tiedZoom(bool x, double xmin, double xmax, bool y, double ymin, double ymax, const QString& plotName);
 
+  public slots:
+    void cleanupDefault();
+    void cleanupCustom();      
+  
   private slots:
     void menuClosed();
     void makeSameWidth();
@@ -87,8 +91,6 @@
     void packVertically();
     void packHorizontally();
     void groupSelection();
-    void cleanupDefault();
-    void cleanupCustom();
 
   protected:
     void resized(const QSize& size);
--- trunk/extragear/graphics/kst/src/libkstapp/kstviewmanager_i.cpp #537370:537371
@@ -548,6 +548,36 @@
   }
 }
 
+void KstViewManagerI::cleanupDefault_I() {
+  QListViewItem *qi = ViewView->selectedItem();
+  KstViewObjectItem *koi = static_cast<KstViewObjectItem*>(qi);
+  
+  if (koi) {
+    if (koi->rtti() == RTTI_OBJ_WINDOW) {
+      KstViewWindow *win = dynamic_cast<KstViewWindow*>(KstApp::inst()->findWindow(koi->tagName()));
+      if (win) {
+        win->view()->cleanupDefault();
+      }      
+    }
+  }  
+}
+
+
+void KstViewManagerI::cleanupCustom_I() {
+  QListViewItem *qi = ViewView->selectedItem();
+  KstViewObjectItem *koi = static_cast<KstViewObjectItem*>(qi);
+  
+  if (koi) {
+    if (koi->rtti() == RTTI_OBJ_WINDOW) {
+      KstViewWindow *win = dynamic_cast<KstViewWindow*>(KstApp::inst()->findWindow(koi->tagName()));
+      if (win) {
+        win->view()->cleanupCustom();
+      }      
+    }
+  }  
+}
+
+
 void KstViewManagerI::select_I() {
   QListViewItem *qi = ViewView->selectedItem();
   KstViewObjectItem *koi = static_cast<KstViewObjectItem*>(qi);
@@ -589,28 +619,36 @@
   
   if (i) {
     KstViewObjectItem *koi = static_cast<KstViewObjectItem*>(i);
-    KPopupMenu *m = new KPopupMenu(this);
+    KPopupMenu *menu = new KPopupMenu(this);
     int id;
     
-    m->insertTitle(koi->text(0));
+    menu->insertTitle(koi->text(0));
     
     if (koi->rtti() == RTTI_OBJ_WINDOW) {
-      id = m->insertItem(i18n("&Rename..."), this, SLOT(edit_I()));
-      id = m->insertItem(i18n("&Close"), this, SLOT(delete_I()));
-      id = m->insertItem(i18n("&Activate"), this, SLOT(activate_I()));
+      id = menu->insertItem(i18n("&Rename..."), this, SLOT(edit_I()));
+      id = menu->insertItem(i18n("&Close"), this, SLOT(delete_I()));
+      id = menu->insertItem(i18n("&Activate"), this, SLOT(activate_I()));
+      
+      KPopupMenu *submenu = new KPopupMenu(menu);
+      if (submenu) {
+        menu->insertSeparator();
+        submenu->insertItem("Default Tile", this, SLOT(cleanupDefault_I()));
+        submenu->insertItem("Custom...", this, SLOT(cleanupCustom_I()));
+        id = menu->insertItem(i18n("Cleanup Layout"), submenu);
+      }
     } else if (koi->rtti() == RTTI_OBJ_VIEW_OBJECT) {
-      id = m->insertItem(i18n("&Edit..."), this, SLOT(edit_I()));
-      id = m->insertItem(i18n("&Delete"), this, SLOT(delete_I()));
-      id = m->insertItem(i18n("&Select"), this, SLOT(select_I()));
-      m->setItemEnabled(id, KstApp::inst()->currentViewMode() == KstTopLevelView::LayoutMode);
-      id = m->insertItem(i18n("Dese&lect"), this, SLOT(deselect_I()));
-      m->setItemEnabled(id, KstApp::inst()->currentViewMode() == KstTopLevelView::LayoutMode);
+      id = menu->insertItem(i18n("&Edit..."), this, SLOT(edit_I()));
+      id = menu->insertItem(i18n("&Delete"), this, SLOT(delete_I()));
+      id = menu->insertItem(i18n("&Select"), this, SLOT(select_I()));
+      menu->setItemEnabled(id, KstApp::inst()->currentViewMode() == KstTopLevelView::LayoutMode);
+      id = menu->insertItem(i18n("Dese&lect"), this, SLOT(deselect_I()));
+      menu->setItemEnabled(id, KstApp::inst()->currentViewMode() == KstTopLevelView::LayoutMode);
     } else if (koi->rtti() == RTTI_OBJ_DATA_OBJECT) {
-      id = m->insertItem(i18n("&Edit..."), this, SLOT(edit_I()));
-      id = m->insertItem(i18n("&Delete"), this, SLOT(delete_I()));
+      id = menu->insertItem(i18n("&Edit..."), this, SLOT(edit_I()));
+      id = menu->insertItem(i18n("&Remove"), this, SLOT(delete_I()));
     }
     
-    m->popup(p);
+    menu->popup(p);
   }
 }
 
--- trunk/extragear/graphics/kst/src/libkstapp/kstviewmanager_i.h #537370:537371
@@ -74,6 +74,8 @@
     void edit_I();
     void delete_I();
     void activate_I();
+    void cleanupDefault_I();
+    void cleanupCustom_I();
     void select_I();
     void deselect_I();
 


More information about the Kst mailing list