[Kst] branches/work/kst/portto4/kst/src/libkstapp

Adam Treat treat at kde.org
Thu May 24 22:05:47 CEST 2007


SVN commit 668023 by treat:

* Stub out items


 M  +17 -3     kstplotcommand.cpp  
 M  +26 -4     kstplotcommand.h  
 M  +17 -1     kstplotview.cpp  
 M  +15 -0     kstplotview.h  


--- branches/work/kst/portto4/kst/src/libkstapp/kstplotcommand.cpp #668022:668023
@@ -13,17 +13,31 @@
 #include "kstapplication.h"
 #include "kstplotview.h"
 
-KstPlotCommand::KstPlotCommand(const QString &text, QUndoCommand *parent)
+KstPlotViewCommand::KstPlotViewCommand(const QString &text, QUndoCommand *parent)
     : QUndoCommand(text, parent), _view(kstApp->mainWindow()->currentPlotView()) {
 }
 
 
-KstPlotCommand::KstPlotCommand(KstPlotView *view, const QString &text, QUndoCommand *parent)
+KstPlotViewCommand::KstPlotViewCommand(KstPlotView *view, const QString &text, QUndoCommand *parent)
     : QUndoCommand(text, parent), _view(view) {
 }
 
 
-KstPlotCommand::~KstPlotCommand() {
+KstPlotViewCommand::~KstPlotViewCommand() {
 }
 
+
+KstPlotItemCommand::KstPlotItemCommand(const QString &text, QUndoCommand *parent)
+    : QUndoCommand(text, parent), _item(kstApp->mainWindow()->currentPlotView()->currentPlotItem()) {
+}
+
+
+KstPlotItemCommand::KstPlotItemCommand(KstPlotItem *item, const QString &text, QUndoCommand *parent)
+    : QUndoCommand(text, parent), _item(item) {
+}
+
+
+KstPlotItemCommand::~KstPlotItemCommand() {
+}
+
 // vim: ts=2 sw=2 et
--- branches/work/kst/portto4/kst/src/libkstapp/kstplotcommand.h #668022:668023
@@ -18,18 +18,40 @@
 #include "kst_export.h"
 
 class KstPlotView;
+class KstPlotItem;
 
-class KST_EXPORT KstPlotCommand : public QUndoCommand
+class KST_EXPORT KstPlotViewCommand : public QUndoCommand
 {
 public:
-  KstPlotCommand(const QString &text, QUndoCommand *parent = 0);
-  KstPlotCommand(KstPlotView *view, const QString &text, QUndoCommand *parent = 0);
-  virtual ~KstPlotCommand();
+  KstPlotViewCommand(const QString &text, QUndoCommand *parent = 0);
+  KstPlotViewCommand(KstPlotView *view, const QString &text, QUndoCommand *parent = 0);
+  virtual ~KstPlotViewCommand();
 
 protected:
   QPointer<KstPlotView> _view;
 };
 
+class KST_EXPORT KstPlotItemCommand : public QUndoCommand
+{
+public:
+  KstPlotItemCommand(const QString &text, QUndoCommand *parent = 0);
+  KstPlotItemCommand(KstPlotItem *item, const QString &text, QUndoCommand *parent = 0);
+  virtual ~KstPlotItemCommand();
+
+protected:
+  QPointer<KstPlotItem> _item;
+};
+
+/*
+  LABEL
+  BOX
+  ELLIPSE
+  LINE
+  ARROW
+  PICTURE
+  PLOT
+*/
+
 #endif
 
 // vim: ts=2 sw=2 et
--- branches/work/kst/portto4/kst/src/libkstapp/kstplotview.cpp #668022:668023
@@ -14,10 +14,21 @@
 #include "kstapplication.h"
 
 #include <QUndoStack>
+#include <QGraphicsItem>
 #include <QGraphicsScene>
 
+
+KstPlotItem::KstPlotItem(KstPlotView *parent)
+    : QObject(parent) {
+}
+
+
+KstPlotItem::~KstPlotItem() {
+}
+
+
 KstPlotView::KstPlotView()
-    : QGraphicsView(kstApp->mainWindow()) {
+    : QGraphicsView(kstApp->mainWindow()), _currentPlotItem(0) {
 
   _undoStack = new QUndoStack(this);
 
@@ -36,6 +47,11 @@
   return _undoStack;
 }
 
+
+KstPlotItem *KstPlotView::currentPlotItem() const {
+  return _currentPlotItem;
+}
+
 #include "kstplotview.moc"
 
 // vim: ts=2 sw=2 et
--- branches/work/kst/portto4/kst/src/libkstapp/kstplotview.h #668022:668023
@@ -12,12 +12,24 @@
 #ifndef KSTPLOTVIEW_H
 #define KSTPLOTVIEW_H
 
+#include <QObject>
 #include <QGraphicsView>
 
 #include "kst_export.h"
 
 class QUndoStack;
+class KstPlotView;
 
+class KST_EXPORT KstPlotItem : public QObject
+{
+  Q_OBJECT
+public:
+  KstPlotItem(KstPlotView *parent);
+  virtual ~KstPlotItem();
+
+  virtual QGraphicsItem *graphicsItem() const = 0;
+};
+
 class KST_EXPORT KstPlotView : public QGraphicsView
 {
   Q_OBJECT
@@ -27,8 +39,11 @@
 
   QUndoStack *undoStack() const;
 
+  KstPlotItem* currentPlotItem() const;
+
 private:
   QUndoStack *_undoStack;
+  KstPlotItem *_currentPlotItem;
 };
 
 #endif


More information about the Kst mailing list