[Kst] kdeextragear-2/kst/kst
George Staikos
staikos at kde.org
Fri Mar 18 02:37:52 CET 2005
CVS commit by staikos:
fix EPS output: mimetype is image/x-eps, not application/postscript
also draw only the dragged plots for image output
A kstplotimagedrag.cpp 1.1 [GPL (v2+)]
A kstplotimagedrag.h 1.1 [GPL (v2+)]
M +1 -0 Makefile.am 1.182
M +8 -2 kstviewwidget.cpp 1.71
M +0 -55 plotmimesource.cpp 1.7
M +0 -2 plotmimesource.h 1.3
--- kdeextragear-2/kst/kst/Makefile.am #1.181:1.182
@@ -109,4 +109,5 @@
plotmimesource.cpp \
kstplotdrag.cpp \
+ kstplotimagedrag.cpp \
kstquickprogressbar.cpp \
kstquicklabel.cpp \
--- kdeextragear-2/kst/kst/kstviewwidget.cpp #1.70:1.71
@@ -22,4 +22,5 @@
#include "kst.h"
+#include "kstplotimagedrag.h"
#include "ksttimers.h"
#include "kstviewwidget.h"
@@ -48,4 +49,5 @@ QDragObject *KstViewWidget::dragObject()
QString window;
QStringList plots;
+ KstViewObjectList vol;
#if 1
@@ -55,15 +57,19 @@ QDragObject *KstViewWidget::dragObject()
if (_view->pressTarget()) {
plots.append(_view->pressTarget()->tagName());
+ vol.append(_view->pressTarget());
}
} else {
for (size_t i=0; i<_view->selectionList().size(); i++) {
- plots.append(((_view->selectionList())[i])->tagName());
+ plots.append(_view->selectionList()[i]->tagName());
+ vol.append(_view->selectionList()[i]);
}
}
drag->addDragObject(new PlotMimeSource(window, plots, 0L));
+ KstPlotImageDrag *imd = new KstPlotImageDrag(0L);
+ imd->setPlots(vol);
+ drag->addDragObject(imd);
#else
drag->addDragObject(new KstPlotDrag(...));
- drag->addDragObject(new KstPlotImageDrag(...));
#endif
--- kdeextragear-2/kst/kst/plotmimesource.cpp #1.6:1.7
@@ -26,19 +26,4 @@
#include "plotmimesource.h"
-typedef struct formatTypes {
- const char *mime;
- const char *format;
-};
-
-static formatTypes formats[] = {
- { "image/png", "PNG" },
-#if KDE_VERSION >= KDE_MAKE_VERSION(3,2,0)
- { "image/jpeg", "JPG" },
- { "application/postscript", "EPS" },
-#endif
-};
-
-static int iNumFormats = sizeof(formats) / sizeof(formatTypes);
-
PlotMimeSource::PlotMimeSource(QString window, QStringList plots, QWidget *dragSource) :
KstDrag(mimeType(), dragSource) {
@@ -54,16 +39,4 @@ QByteArray PlotMimeSource::encodedData(c
data << _window;
data << _plots;
- } else {
- for (int i=0; i<iNumFormats; i++) {
- if (strcmp(mime, formats[i].mime) == 0) {
- KstViewWindow *window = dynamic_cast<KstViewWindow*>(KstApp::inst()->findWindow(_window));
-
- if (window) {
- window->immediatePrintToPng(&data, window->size(), formats[i].format);
- }
-
- break;
- }
- }
}
@@ -71,32 +44,4 @@ QByteArray PlotMimeSource::encodedData(c
}
-const char * PlotMimeSource::format(int i) const {
- if (i == 0) {
- return mimeType();
- } else if (i >= 1 && i <= iNumFormats) {
- return formats[i-1].mime;
- }
-
- return 0L;
-}
-
-bool PlotMimeSource::provides(const char *mime) const {
- bool rc = false;
-
- if (strcmp(mime, mimeType()) == 0) {
- rc = true;
- } else {
- for (int i=0; i<iNumFormats; i++) {
- if (strcmp(mime, formats[i].mime) == 0) {
- rc = true;
-
- break;
- }
- }
- }
-
- return rc;
-}
-
const char* PlotMimeSource::mimeType() {
return "application/x-kst-plots";
--- kdeextragear-2/kst/kst/plotmimesource.h #1.2:1.3
@@ -26,6 +26,4 @@ class PlotMimeSource : public KstDrag {
virtual QByteArray encodedData(const char*) const;
- virtual const char* format(int i = 0) const;
- virtual bool provides(const char* mime) const;
static const char* mimeType();
More information about the Kst
mailing list