[Kst] kdeextragear-2/kst/kst
Rick Chern
rchern at interchange.ubc.ca
Tue Aug 3 19:41:58 CEST 2004
CVS commit by rchern:
Add/remove images from plots using data manager, add i18n to imagedialog captions
M +54 -1 kstdatamanager_i.cpp 1.68
M +2 -0 kstdatamanager_i.h 1.18
M +2 -2 kstimagedialog_i.cpp 1.9
--- kdeextragear-2/kst/kst/kstdatamanager_i.cpp #1.67:1.68
@@ -266,4 +266,22 @@ void KstObjectItem::removeFromPlot(int i
}
+void KstObjectItem::addImageToPlot(int id) {
+ Kst2DPlotPtr p = PlotMap[id];
+ KstImagePtr img = dynamic_cast<KstImage*>(dataObject().data());
+ if (p && img) {
+ p->addImage(img);
+ emit updated();
+ }
+}
+
+void KstObjectItem::removeImageFromPlot(int id) {
+ Kst2DPlotPtr p = PlotMap[id];
+ KstImagePtr img = dynamic_cast<KstImage*>(dataObject().data());
+ if (p && img) {
+ p->removeImage(img);
+ emit updated();
+ }
+}
+
KstDataManagerI::KstDataManagerI(KstDoc *in_doc, QWidget* parent, const char* name, bool modal, WFlags fl)
@@ -487,4 +505,5 @@ void KstDataManagerI::contextMenu(QListV
KstObjectItem *koi = static_cast<KstObjectItem*>(i);
KstBaseCurvePtr c;
+ KstImagePtr img;
KPopupMenu *m = new KPopupMenu(this);
@@ -557,4 +576,38 @@ void KstDataManagerI::contextMenu(QListV
id = m->insertItem(i18n("&Remove From Plot"), removeMenu);
m->setItemEnabled(id, haveRemove);
+ } else if ((img = dynamic_cast<KstImage*>(koi->dataObject().data()))) {
+ KPopupMenu *addMenu = new KPopupMenu(this);
+ KPopupMenu *removeMenu = new KPopupMenu(this);
+ PlotMap.clear();
+ id = 100;
+ bool haveAdd = false, haveRemove = false;
+
+ KstApp *app = KstApp::inst();
+ KMdiIterator<KMdiChildView*> *it = app->createIterator();
+ while (it->currentItem()) {
+ KstViewWindow *v = dynamic_cast<KstViewWindow*>(it->currentItem());
+ if (v) {
+ Kst2DPlotList plots = v->view()->findChildrenType<Kst2DPlot>();
+ for (Kst2DPlotList::Iterator i = plots.begin(); i != plots.end(); ++i) {
+ Kst2DPlotPtr plot = *i;
+ if (!plot->hasImage(img)) {
+ addMenu->insertItem(i18n("%1 - %2").arg(v->caption()).arg(plot->tagName()), koi, SLOT(addImageToPlot(int)), 0, id);
+ haveAdd = true;
+ } else {
+ removeMenu->insertItem(i18n("%1 - %2").arg(v->caption()).arg(plot->tagName()), koi, SLOT(removeImageFromPlot(int)), 0, id);
+ haveRemove = true;
+ }
+ PlotMap[id++] = plot;
+ }
+ }
+ it->next();
+ }
+
+ app->deleteIterator(it);
+
+ id = m->insertItem(i18n("&Add To Plot"), addMenu);
+ m->setItemEnabled(id, haveAdd);
+ id = m->insertItem(i18n("&Remove From Plot"), removeMenu);
+ m->setItemEnabled(id, haveRemove);
}
--- kdeextragear-2/kst/kst/kstdatamanager_i.h #1.17:1.18
@@ -76,5 +76,7 @@ class KstObjectItem : public QObject, pu
void applyFilter(int);
void addToPlot(int);
+ void addImageToPlot(int);
void removeFromPlot(int);
+ void removeImageFromPlot(int);
void makeCurve();
void reload();
--- kdeextragear-2/kst/kst/kstimagedialog_i.cpp #1.8:1.9
@@ -153,6 +153,6 @@ void KstImageDialogI::_fillFieldsForNew(
//let the image be placed in plots
_curvePlacement->update();
- _curvePlacement->_curvePlacementGroup->setTitle("Image Placement");
- _curvePlacement->_dontPlace->setText("Do not place image in any plot");
+ _curvePlacement->_curvePlacementGroup->setTitle(i18n("Image Placement"));
+ _curvePlacement->_dontPlace->setText(i18n("Do not place image in any plot"));
//for some reason the widgets need to be placed from bottom to top
buttonGroup5->hide();
More information about the Kst
mailing list