[Kst] kdeextragear-2/kst/kst

Andrew Walker arwalker at sumusltd.com
Thu May 20 16:18:57 CEST 2004


CVS commit by arwalker: 

Kst2DPlot now plots based on its geometry and not the window size scaled by the aspect.


  M +4 -8      kst2dplot.cpp   1.23
  M +8 -3      kstplotgroup.cpp   1.7
  M +2 -1      kstplotgroup.h   1.6
  M +24 -21    ksttoplevelview.cpp   1.44


--- kdeextragear-2/kst/kst/kst2dplot.cpp  #1.22:1.23
@@ -163,4 +163,6 @@ void Kst2DPlot::commonConstructor(const 
                                 bool y_log) {
 
+  _standardActions |= Delete | Edit;
+
   XLog = x_log;
   YLog = y_log;
@@ -865,11 +867,6 @@ void Kst2DPlot::paint(QPainter& p, doubl
 
 
-  QRect v(0,0,
-          int(p.window().width()*_aspect.w),
-          int(p.window().height()*_aspect.h));
-  p.setViewport(int(p.window().width()*_aspect.x),
-                int(p.window().height()*_aspect.y),
-                int(p.window().width()*_aspect.w),
-                int(p.window().height()*_aspect.h));
+  QRect v(0,0,geometry().width(),geometry().height());
+  p.setViewport(geometry());
   p.setWindow(v);
 
@@ -1687,5 +1684,4 @@ void Kst2DPlot::removeCurve( int id )
 
 bool Kst2DPlot::popupMenu(KPopupMenu *menu, const QPoint& pos, KstViewObjectPtr topLevelParent) {
-  _standardActions |= Delete | Edit;
   bool bHasEntry = false;
   int n_curves = Curves.count();

--- kdeextragear-2/kst/kst/kstplotgroup.cpp  #1.6:1.7
@@ -26,5 +26,5 @@
 KstPlotGroup::KstPlotGroup() : KstMetaPlot("KstPlotGroup") {
   _standardActions |= Delete | Raise | Lower | RaiseToTop | LowerToBottom;
-  setTagName("Plot Group"); // for now anyway
+  setTagName("Plot Group");
 }
 
@@ -63,6 +63,11 @@ void KstPlotGroup::paint(QPainter& p) {
 
 
+bool KstPlotGroup::popupMenu(KPopupMenu *menu, const QPoint& pos, KstViewObjectPtr topParent) {
+  KstMetaPlot::popupMenu(menu, pos, topParent);
+  return true;
+}
+
+
 bool KstPlotGroup::layoutPopupMenu(KPopupMenu *menu, const QPoint& pos, KstViewObjectPtr topParent) {
-  // FIXME: pass to children based on pos
   KstMetaPlot::popupMenu(menu, pos, topParent);
   menu->insertItem(i18n("&Ungroup"), this, SLOT(flatten()));
@@ -70,5 +75,5 @@ bool KstPlotGroup::layoutPopupMenu(KPopu
   if (c) {
     KPopupMenu *s = new KPopupMenu(menu);
-    if (c->popupMenu(s, pos - c->position(), topParent)) {
+    if (c->layoutPopupMenu(s, pos - c->position(), topParent)) {
       menu->insertItem(c->tagName(), s);
     } else {

--- kdeextragear-2/kst/kst/kstplotgroup.h  #1.5:1.6
@@ -31,4 +31,5 @@ class KstPlotGroup : public KstMetaPlot 
     virtual void save(QTextStream& ts);
 
+    virtual bool popupMenu(KPopupMenu *menu, const QPoint& pos, KstViewObjectPtr topLevelParent);
     virtual bool layoutPopupMenu(KPopupMenu *menu, const QPoint& pos, KstViewObjectPtr topParent);
 

--- kdeextragear-2/kst/kst/ksttoplevelview.cpp  #1.43:1.44
@@ -730,11 +730,13 @@ void KstTopLevelView::alignBottom() {
 void KstTopLevelView::groupSelection() {
   KstPlotGroupPtr pg = new KstPlotGroup;
+  KstViewObjectList::Iterator it;
   QRect gg = _selectionList.first()->geometry();
 
+  if (pg) {
   pg->setBorderWidth(3);
   pg->setBorderColor(Qt::blue);
   // First build the container
-  for (KstViewObjectList::Iterator i = _selectionList.begin(); i != _selectionList.end(); ++i) {
-    gg = gg.unite((*i)->geometry());
+    for ( it = _selectionList.begin(); it != _selectionList.end(); ++it) {
+      gg |= (*it)->geometry();
   }
 
@@ -743,9 +745,9 @@ void KstTopLevelView::groupSelection() {
 
   // Then add the items
-  for (KstViewObjectList::Iterator i = _selectionList.begin(); i != _selectionList.end(); ++i) {
-    (*i)->setSelected(false);
-    (*i)->setFocus(false);
-    (*i)->detach();
-    pg->appendChild(*i);
+    for (it = _selectionList.begin(); it != _selectionList.end(); ++it) {
+      (*it)->setSelected(false);
+      (*it)->setFocus(false);
+      (*it)->detach();
+      pg->appendChild(*it);
   }
 
@@ -755,4 +757,5 @@ void KstTopLevelView::groupSelection() {
 
   paint(true);
+  }
 }
 





More information about the Kst mailing list