From 3dd68d9a9c890c591b2e3da247ec5bcaa648dd7a Mon Sep 17 00:00:00 2001 From: Timothy Pearson Date: Sat, 10 Dec 2011 18:30:13 -0600 Subject: [PATCH] Initial import of kmatplot 0.4 --- AUTHORS | 1 + COPYING | 280 + ChangeLog | 37 + INSTALL | 167 + Makefile.am | 31 + Makefile.dist | 14 + NEWS | 1 + README | 21 + TODO | 1 + acconfig.h | 37 + acinclude.m4 | 4985 ++++++++++ aclocal.m4 | 5102 ++++++++++ config.guess | 1415 +++ config.h.in | 63 + config.sub | 1505 +++ configure.in | 306 + dist.sh | 6 + kmatplot.doxygen | 183 + kmatplot.kdevprj | 8732 +++++++++++++++++ kmatplot.kdevses | 53 + kmatplot.lsm | 14 + kmatplot.spec | 87 + kmatplot/Makefile.am | 60 + kmatplot/config/Makefile.am | 8 + kmatplot/demos/Makefile.am | 14 + kmatplot/demos/demo2d.cpp | 69 + kmatplot/demos/demo3d.cpp | 74 + kmatplot/dialogs/Makefile.am | 87 + kmatplot/dialogs/ksattrbtn.cpp | 457 + kmatplot/dialogs/ksattrbtn.h | 146 + kmatplot/dialogs/ksattrpanel.cpp | 1157 +++ kmatplot/dialogs/ksattrpanel.h | 244 + kmatplot/dialogs/ksattrpanelinterf.cpp | 88 + kmatplot/dialogs/ksattrpanelinterf.ui | 162 + kmatplot/dialogs/ksattrpanelinterf2.ui | 148 + kmatplot/dialogs/kschannellist.cpp | 205 + kmatplot/dialogs/kschannellist.h | 125 + kmatplot/dialogs/ksconfiguredlg.cpp | 103 + kmatplot/dialogs/ksconfiguredlg.h | 40 + kmatplot/dialogs/ksconfiguredlginterf.cpp | 153 + kmatplot/dialogs/ksconfiguredlginterf.ui | 440 + kmatplot/dialogs/ksconfiguredlginterf.ui.h | 18 + kmatplot/dialogs/ksdatasetdlg.cpp | 169 + kmatplot/dialogs/ksdatasetdlg.h | 71 + kmatplot/dialogs/ksdatasetdlginterf.cpp | 97 + kmatplot/dialogs/ksdatasetdlginterf.ui | 182 + kmatplot/dialogs/ksexportdlg.cpp | 109 + kmatplot/dialogs/ksexportdlg.h | 49 + kmatplot/dialogs/ksexportdlginterf.cpp | 111 + kmatplot/dialogs/ksexportdlginterf.ui | 255 + kmatplot/dialogs/ksexportpicturedlg.cpp | 370 + kmatplot/dialogs/ksexportpicturedlg.h | 71 + kmatplot/dialogs/ksexportpicturedlginterf.cpp | 451 + kmatplot/dialogs/ksexportpicturedlginterf.ui | 1912 ++++ kmatplot/dialogs/ksgraphwizard.cpp | 507 + kmatplot/dialogs/ksgraphwizard.h | 121 + kmatplot/dialogs/ksgraphwizardinterf.cpp | 314 + kmatplot/dialogs/ksgraphwizardinterf.ui | 639 ++ kmatplot/dialogs/ksgriddlg.cpp | 53 + kmatplot/dialogs/ksgriddlg.h | 41 + kmatplot/dialogs/ksgriddlginterf.cpp | 93 + kmatplot/dialogs/ksgriddlginterf.ui | 271 + kmatplot/dialogs/ksimportdlg.cpp | 160 + kmatplot/dialogs/ksimportdlg.h | 88 + kmatplot/dialogs/ksimportdlginterf.cpp | 110 + kmatplot/dialogs/ksimportdlginterf.ui | 220 + kmatplot/dialogs/ksmpanel.cpp | 62 + kmatplot/dialogs/ksmpanel.h | 40 + kmatplot/dialogs/ksmpanelformulainterf.cpp | 67 + kmatplot/dialogs/ksmpanelformulainterf.ui | 145 + kmatplot/dialogs/ksmpanelmatrixinterf.cpp | 88 + kmatplot/dialogs/ksmpanelmatrixinterf.ui | 218 + kmatplot/dialogs/ksmpanelrefinterf.cpp | 102 + kmatplot/dialogs/ksmpanelrefinterf.ui | 259 + kmatplot/dialogs/ksmpanels.cpp | 438 + kmatplot/dialogs/ksmpanels.h | 121 + kmatplot/dialogs/ksmpanelstringinterf.cpp | 75 + kmatplot/dialogs/ksmpanelstringinterf.ui | 167 + kmatplot/dialogs/ksobjecttreedlg.cpp | 213 + kmatplot/dialogs/ksobjecttreedlg.h | 65 + kmatplot/dialogs/ksobjecttreedlginterf.cpp | 96 + kmatplot/dialogs/ksobjecttreedlginterf.ui | 149 + kmatplot/dialogs/kspanel.cpp | 228 + kmatplot/dialogs/kspanel.h | 104 + kmatplot/dialogs/kspanelaxisinterf.cpp | 227 + kmatplot/dialogs/kspanelaxisinterf.ui | 680 ++ kmatplot/dialogs/kspanelcarrowinterf.cpp | 139 + kmatplot/dialogs/kspanelcarrowinterf.ui | 380 + kmatplot/dialogs/kspanelclabelinterf.cpp | 223 + kmatplot/dialogs/kspanelclabelinterf.ui | 534 + kmatplot/dialogs/kspanelclegendcinterf.cpp | 81 + kmatplot/dialogs/kspanelclegendcinterf.ui | 154 + kmatplot/dialogs/kspanelcontourinterf.cpp | 199 + kmatplot/dialogs/kspanelcontourinterf.ui | 542 + kmatplot/dialogs/kspanelcposinterf.cpp | 156 + kmatplot/dialogs/kspanelcposinterf.ui | 370 + kmatplot/dialogs/kspanelcrectinterf.cpp | 158 + kmatplot/dialogs/kspanelcrectinterf.ui | 376 + kmatplot/dialogs/kspanelcubeinterf.cpp | 244 + kmatplot/dialogs/kspanelcubeinterf.ui | 611 ++ kmatplot/dialogs/kspanelcurveinterf.cpp | 254 + kmatplot/dialogs/kspanelcurveinterf.ui | 675 ++ kmatplot/dialogs/kspanelfigureinterf.cpp | 165 + kmatplot/dialogs/kspanelfigureinterf.ui | 391 + kmatplot/dialogs/kspanelframeinterf.cpp | 107 + kmatplot/dialogs/kspanelframeinterf.ui | 258 + kmatplot/dialogs/kspanelgeneralinterf.cpp | 188 + kmatplot/dialogs/kspanelgeneralinterf.ui | 471 + kmatplot/dialogs/kspanelglinterf.cpp | 131 + kmatplot/dialogs/kspanelglinterf.ui | 272 + kmatplot/dialogs/kspanelgradientinterf.cpp | 104 + kmatplot/dialogs/kspanelgradientinterf.ui | 201 + kmatplot/dialogs/kspanelgridinterf.cpp | 209 + kmatplot/dialogs/kspanelgridinterf.ui | 590 ++ kmatplot/dialogs/kspanelimageinterf.cpp | 149 + kmatplot/dialogs/kspanelimageinterf.ui | 335 + kmatplot/dialogs/kspanellightinterf.cpp | 141 + kmatplot/dialogs/kspanellightinterf.ui | 304 + kmatplot/dialogs/kspanelmeshinterf.cpp | 186 + kmatplot/dialogs/kspanelmeshinterf.ui | 376 + kmatplot/dialogs/kspanelrangeinterf.cpp | 1090 ++ kmatplot/dialogs/kspanelrangeinterf.ui | 760 ++ kmatplot/dialogs/kspanels.cpp | 2547 +++++ kmatplot/dialogs/kspanels.h | 876 ++ kmatplot/dialogs/kspanelsurfaceinterf.cpp | 175 + kmatplot/dialogs/kspanelsurfaceinterf.ui | 419 + kmatplot/dialogs/kspanelviewinterf.cpp | 146 + kmatplot/dialogs/kspanelviewinterf.ui | 312 + .../dialogs/kssheetdlgcellrangeinterf.cpp | 94 + kmatplot/dialogs/kssheetdlgcellrangeinterf.ui | 271 + kmatplot/dialogs/kssheetdlgcoldatainterf.cpp | 105 + kmatplot/dialogs/kssheetdlgcoldatainterf.ui | 307 + kmatplot/dialogs/kssheetdlgs.cpp | 203 + kmatplot/dialogs/kssheetdlgs.h | 91 + kmatplot/dialogs/kssheetdlgsequenceinterf.cpp | 85 + kmatplot/dialogs/kssheetdlgsequenceinterf.ui | 217 + .../dialogs/kssheetdlgvaluerangeinterf.cpp | 79 + .../dialogs/kssheetdlgvaluerangeinterf.ui | 196 + kmatplot/dialogs/kstextedit.cpp | 539 + kmatplot/dialogs/kstextedit.h | 123 + kmatplot/dialogs/kswizarddlgs.cpp | 151 + kmatplot/dialogs/kswizarddlgs.h | 47 + kmatplot/dialogs/kswizarddlgsurfaceinterf.cpp | 146 + kmatplot/dialogs/kswizarddlgsurfaceinterf.ui | 482 + kmatplot/dialogs/templates/KSMPanel.ui | 16 + kmatplot/dialogs/templates/KSPanel.ui | 16 + kmatplot/dialogs/templates/Makefile.am | 2 + .../dialogs/templates/kmatplot_widgets.cw | 148 + kmatplot/dialogs/templates/kspanel.png | Bin 0 -> 179 bytes kmatplot/docs/Makefile.am | 1 + kmatplot/docs/en/Makefile.am | 2 + kmatplot/dtd/Makefile.am | 5 + kmatplot/dtd/kmatplot.dtd | 1 + kmatplot/examples/Makefile.am | 5 + kmatplot/examples/contour.kmp | 164 + kmatplot/examples/path3d.kmp | 267 + kmatplot/examples/shell.kmp | 2390 +++++ kmatplot/examples/simple.kmp | 720 ++ kmatplot/examples/surface.kmp | 385 + kmatplot/formula/Makefile.am | 30 + kmatplot/formula/gramdiag | Bin 0 -> 28380 bytes kmatplot/formula/make_parser.sh | 3 + kmatplot/formula/mpdelunay.cpp | 412 + kmatplot/formula/mpdelunay.h | 207 + kmatplot/formula/mpformula.cpp | 283 + kmatplot/formula/mpformula.h | 102 + kmatplot/formula/mpparser.cpp | 1161 +++ kmatplot/formula/mpparser.cpp.h | 27 + kmatplot/formula/mpparser.cpp.report | 0 kmatplot/formula/mpparser.y | 224 + kmatplot/formula/mpparsersymbol.cpp | 194 + kmatplot/formula/mpparsersymbol.h | 55 + kmatplot/formula/mpsymbol.cpp | 223 + kmatplot/formula/mpsymbol.h | 276 + kmatplot/formula/mpsymbols.cpp | 655 ++ kmatplot/formula/mpsymbols.h | 197 + kmatplot/interface/Makefile.am | 5 + kmatplot/interface/common.c | 406 + kmatplot/interface/common.h | 118 + kmatplot/interface/etype.h | 45 + kmatplot/interface/msg.h | 106 + kmatplot/kmatplotshell.cpp | 1426 +++ kmatplot/kmatplotshell.h | 335 + kmatplot/kscommands.cpp | 1850 ++++ kmatplot/kscommands.h | 628 ++ kmatplot/ksdataobjectfactory.cpp | 588 ++ kmatplot/ksdataobjectfactory.h | 92 + kmatplot/ksdatasymbolfactory.cpp | 74 + kmatplot/ksdatasymbolfactory.h | 73 + kmatplot/ksglobalmatrixlist.cpp | 345 + kmatplot/ksglobalmatrixlist.h | 240 + kmatplot/ksglobalsettings.cpp | 159 + kmatplot/ksglobalsettings.h | 113 + kmatplot/ksmatrix.cpp | 837 ++ kmatplot/ksmatrix.h | 416 + kmatplot/ksmatrixascii.cpp | 192 + kmatplot/ksmatrixascii.h | 56 + kmatplot/ksmatrixeditor.cpp | 817 ++ kmatplot/ksmatrixeditor.h | 142 + kmatplot/ksmatrixio.cpp | 207 + kmatplot/ksmatrixio.h | 177 + kmatplot/ksmatrixiohandler.cpp | 72 + kmatplot/ksmatrixiohandler.h | 123 + kmatplot/ksmatrixmat.cpp | 248 + kmatplot/ksmatrixmat.h | 151 + kmatplot/ksmatrixsheet.cpp | 24 + kmatplot/ksmatrixsheet.h | 130 + kmatplot/ksobjectfactory.cpp | 396 + kmatplot/ksobjectfactory.h | 128 + kmatplot/kspanelmanager.cpp | 646 ++ kmatplot/kspanelmanager.h | 130 + kmatplot/ksprojectxml.cpp | 2777 ++++++ kmatplot/ksprojectxml.h | 48 + kmatplot/kssocketio.cpp | 436 + kmatplot/kssocketio.h | 145 + kmatplot/kswinpageview.cpp | 1127 +++ kmatplot/kswinpageview.h | 137 + kmatplot/kswinworksheet.cpp | 684 ++ kmatplot/kswinworksheet.h | 108 + kmatplot/ksworkbook.cpp | 188 + kmatplot/ksworkbook.h | 195 + kmatplot/ksworksheetdlg.cpp | 1335 +++ kmatplot/ksworksheetdlg.h | 188 + kmatplot/ksworkspace.cpp | 301 + kmatplot/ksworkspace.h | 204 + kmatplot/main.cpp | 73 + kmatplot/octave/Makefile.am | 50 + kmatplot/octave/README.octave | 1 + kmatplot/octave/kadd.cpp | 51 + kmatplot/octave/kaddaxes.cpp | 50 + kmatplot/octave/kcontour.cpp | 99 + kmatplot/octave/kimage.cpp | 138 + kmatplot/octave/kmesh.cpp | 111 + kmatplot/octave/kplot.cpp | 119 + kmatplot/octave/kremove.cpp | 45 + kmatplot/octave/kremoveall.cpp | 40 + kmatplot/octave/kremoveaxes.cpp | 45 + kmatplot/octave/ksetapp.cpp | 49 + kmatplot/octave/ksetaxes.cpp | 39 + kmatplot/octave/ksetmatrix.cpp | 54 + kmatplot/octave/octave-common.h | 67 + kmatplot/octave/octave-core | 1 + kmatplot/pics/Makefile.am | 11 + kmatplot/pics/graph_contour.png | Bin 0 -> 1756 bytes kmatplot/pics/graph_figure.png | Bin 0 -> 2945 bytes kmatplot/pics/graph_image.png | Bin 0 -> 471 bytes kmatplot/pics/graph_ngcontour.png | Bin 0 -> 2513 bytes kmatplot/pics/graph_ngsurface.png | Bin 0 -> 3062 bytes kmatplot/pics/graph_surface.png | Bin 0 -> 3812 bytes kmatplot/pics/graph_xyplot.png | Bin 0 -> 633 bytes kmatplot/pics/hi32-app-kmatplot.png | Bin 0 -> 2172 bytes kmatplot/pics/hi48-app-kmatplot.png | Bin 0 -> 3623 bytes kmatplot/pics/lo16-app-kmatplot.png | Bin 0 -> 341 bytes kmatplot/pics/lo32-app-kmatplot.png | Bin 0 -> 805 bytes kmatplot/pixmaps/Makefile.am | 73 + kmatplot/pixmaps/action_arrow.xpm | 34 + kmatplot/pixmaps/action_contour.xpm | 30 + kmatplot/pixmaps/action_copy.xpm | 84 + kmatplot/pixmaps/action_curve.xpm | 28 + kmatplot/pixmaps/action_cut.xpm | 28 + kmatplot/pixmaps/action_delete.xpm | 90 + kmatplot/pixmaps/action_exit.xpm | 27 + kmatplot/pixmaps/action_exportpicture.xpm | 116 + kmatplot/pixmaps/action_figure.xpm | 39 + kmatplot/pixmaps/action_fullpage.xpm | 95 + kmatplot/pixmaps/action_gray.xpm | 25 + kmatplot/pixmaps/action_green.xpm | 25 + kmatplot/pixmaps/action_label.xpm | 32 + kmatplot/pixmaps/action_locate.xpm | 34 + kmatplot/pixmaps/action_lower.xpm | 94 + kmatplot/pixmaps/action_new.xpm | 105 + kmatplot/pixmaps/action_open.xpm | 120 + kmatplot/pixmaps/action_paste.xpm | 126 + kmatplot/pixmaps/action_pixmap.xpm | 30 + kmatplot/pixmaps/action_print.xpm | 96 + kmatplot/pixmaps/action_properties.xpm | 157 + kmatplot/pixmaps/action_raise.xpm | 105 + kmatplot/pixmaps/action_rectangle.xpm | 32 + kmatplot/pixmaps/action_red.xpm | 25 + kmatplot/pixmaps/action_redo.xpm | 93 + kmatplot/pixmaps/action_save.xpm | 101 + kmatplot/pixmaps/action_select.xpm | 30 + kmatplot/pixmaps/action_surface.xpm | 29 + kmatplot/pixmaps/action_textbold.xpm | 27 + kmatplot/pixmaps/action_textcenter.xpm | 26 + kmatplot/pixmaps/action_textcolor.xpm | 46 + kmatplot/pixmaps/action_textitalic.xpm | 26 + kmatplot/pixmaps/action_textjustify.xpm | 27 + kmatplot/pixmaps/action_textleft.xpm | 26 + kmatplot/pixmaps/action_textright.xpm | 26 + kmatplot/pixmaps/action_textsubscript.xpm | 28 + kmatplot/pixmaps/action_textsuperscript.xpm | 29 + kmatplot/pixmaps/action_textunderline.xpm | 26 + kmatplot/pixmaps/action_toback.xpm | 94 + kmatplot/pixmaps/action_tofront.xpm | 105 + kmatplot/pixmaps/action_undo.xpm | 93 + kmatplot/pixmaps/action_windows.xpm | 77 + kmatplot/pixmaps/action_wizard.xpm | 33 + kmatplot/pixmaps/action_worksheet.xpm | 29 + kmatplot/pixmaps/action_zoom.xpm | 92 + kmatplot/pixmaps/convert.pl | 18 + kmatplot/pixmaps/file.list | 2 + kmatplot/pixmaps/panel_arrow.xpm | 31 + kmatplot/pixmaps/panel_axes.xpm | 26 + kmatplot/pixmaps/panel_box.xpm | 29 + kmatplot/pixmaps/panel_datasets.xpm | 27 + kmatplot/pixmaps/panel_frame.xpm | 29 + kmatplot/pixmaps/panel_general.xpm | 32 + kmatplot/pixmaps/panel_gl.xpm | 30 + kmatplot/pixmaps/panel_gradient.xpm | 42 + kmatplot/pixmaps/panel_gv.xpm | 29 + kmatplot/pixmaps/panel_gx.xpm | 29 + kmatplot/pixmaps/panel_gy.xpm | 29 + kmatplot/pixmaps/panel_gz.xpm | 29 + kmatplot/pixmaps/panel_label.xpm | 27 + kmatplot/pixmaps/panel_legend.xpm | 29 + kmatplot/pixmaps/panel_light.xpm | 35 + kmatplot/pixmaps/panel_mesh.xpm | 58 + kmatplot/pixmaps/panel_more.xpm | 25 + kmatplot/pixmaps/panel_object.xpm | 29 + kmatplot/pixmaps/panel_pos1.xpm | 31 + kmatplot/pixmaps/panel_pos2.xpm | 31 + kmatplot/pixmaps/panel_position.xpm | 26 + kmatplot/pixmaps/panel_rect.xpm | 29 + kmatplot/pixmaps/panel_v.xpm | 29 + kmatplot/pixmaps/panel_view.xpm | 27 + kmatplot/pixmaps/panel_x.xpm | 29 + kmatplot/pixmaps/panel_y.xpm | 29 + kmatplot/pixmaps/panel_z.xpm | 29 + kmatplot/python/KMatplot.py | 161 + kmatplot/python/Makefile.am | 20 + kmatplot/python/README.python | 13 + kmatplot/python/_kplot.py | 231 + kmatplot/python/kplot.pth | 1 + kmatplot/python/kplot.py | 166 + kmatplot/qscobjects.cpp | 974 ++ kmatplot/qscobjects.h | 363 + kmatplot/qsctools.cpp | 1271 +++ kmatplot/qsctools.h | 210 + kmatplot/scilab/Makefile.am | 12 + kmatplot/scilab/README.Scilab | 68 + kmatplot/scilab/kcontour.sci | 28 + kmatplot/scilab/kimage.sci | 41 + kmatplot/scilab/kmesh.sci | 46 + kmatplot/scilab/kplot.sci | 31 + kmatplot/scilab/plots.c | 375 + kmatplot/scilab/plots.sci | 8 + kmatplot/widgets/Makefile.am | 69 + kmatplot/widgets/qsaxes.cpp | 1092 +++ kmatplot/widgets/qsaxes.h | 723 ++ kmatplot/widgets/qsaxes2d.cpp | 500 + kmatplot/widgets/qsaxes2d.h | 137 + kmatplot/widgets/qsaxes3d.cpp | 1279 +++ kmatplot/widgets/qsaxes3d.h | 562 ++ kmatplot/widgets/qsaxis.cpp | 1054 ++ kmatplot/widgets/qsaxis.h | 510 + kmatplot/widgets/qschildlist.h | 119 + kmatplot/widgets/qsclegend.cpp | 355 + kmatplot/widgets/qsclegend.h | 129 + kmatplot/widgets/qscobject.cpp | 946 ++ kmatplot/widgets/qscobject.h | 580 ++ kmatplot/widgets/qsconsole.cpp | 53 + kmatplot/widgets/qsconsole.h | 58 + kmatplot/widgets/qscontour.cpp | 1902 ++++ kmatplot/widgets/qscontour.h | 379 + kmatplot/widgets/qscoord.cpp | 258 + kmatplot/widgets/qscoord.h | 329 + kmatplot/widgets/qsctool.cpp | 299 + kmatplot/widgets/qsctool.h | 176 + kmatplot/widgets/qscurve.cpp | 676 ++ kmatplot/widgets/qscurve.h | 380 + kmatplot/widgets/qsdata.cpp | 169 + kmatplot/widgets/qsdata.h | 232 + kmatplot/widgets/qsdrv.cpp | 701 ++ kmatplot/widgets/qsdrv.h | 529 + kmatplot/widgets/qsdrvhittest.cpp | 192 + kmatplot/widgets/qsdrvhittest.h | 159 + kmatplot/widgets/qsdrvopengl.cpp | 739 ++ kmatplot/widgets/qsdrvopengl.h | 181 + kmatplot/widgets/qsdrvqt.cpp | 595 ++ kmatplot/widgets/qsdrvqt.h | 237 + kmatplot/widgets/qsfigure.cpp | 939 ++ kmatplot/widgets/qsfigure.h | 174 + kmatplot/widgets/qsgattr.cpp | 577 ++ kmatplot/widgets/qsgattr.h | 299 + kmatplot/widgets/qsgraphicaldata.cpp | 393 + kmatplot/widgets/qsgraphicaldata.h | 268 + kmatplot/widgets/qsimage.cpp | 663 ++ kmatplot/widgets/qsimage.h | 169 + kmatplot/widgets/qsmatrix.cpp | 169 + kmatplot/widgets/qsmatrix.h | 158 + kmatplot/widgets/qsplot.cpp | 821 ++ kmatplot/widgets/qsplot.h | 388 + kmatplot/widgets/qsplotview.cpp | 1445 +++ kmatplot/widgets/qsplotview.h | 492 + kmatplot/widgets/qsprojection.cpp | 1025 ++ kmatplot/widgets/qsprojection.h | 313 + kmatplot/widgets/qsprojection2d.cpp | 283 + kmatplot/widgets/qsprojection2d.h | 168 + kmatplot/widgets/qsprojection3d.cpp | 695 ++ kmatplot/widgets/qsprojection3d.h | 206 + kmatplot/widgets/qsruler.cpp | 479 + kmatplot/widgets/qsruler.h | 72 + kmatplot/widgets/qssegment.cpp | 432 + kmatplot/widgets/qssegment.h | 219 + kmatplot/widgets/qsserializable.cpp | 61 + kmatplot/widgets/qsserializable.h | 93 + kmatplot/widgets/qssurface.cpp | 834 ++ kmatplot/widgets/qssurface.h | 149 + kmatplot/widgets/qsworkbook.cpp | 328 + kmatplot/widgets/qsworkbook.h | 262 + stamp-h.in | 1 + subdirs | 1 + 413 files changed, 121016 insertions(+) create mode 100644 AUTHORS create mode 100644 COPYING create mode 100644 ChangeLog create mode 100644 INSTALL create mode 100644 Makefile.am create mode 100644 Makefile.dist create mode 100644 NEWS create mode 100644 README create mode 100644 TODO create mode 100644 acconfig.h create mode 100644 acinclude.m4 create mode 100644 aclocal.m4 create mode 100644 config.guess create mode 100644 config.h.in create mode 100644 config.sub create mode 100644 configure.in create mode 100755 dist.sh create mode 100644 kmatplot.doxygen create mode 100644 kmatplot.kdevprj create mode 100644 kmatplot.kdevses create mode 100644 kmatplot.lsm create mode 100644 kmatplot.spec create mode 100644 kmatplot/Makefile.am create mode 100644 kmatplot/config/Makefile.am create mode 100644 kmatplot/demos/Makefile.am create mode 100644 kmatplot/demos/demo2d.cpp create mode 100644 kmatplot/demos/demo3d.cpp create mode 100644 kmatplot/dialogs/Makefile.am create mode 100644 kmatplot/dialogs/ksattrbtn.cpp create mode 100644 kmatplot/dialogs/ksattrbtn.h create mode 100644 kmatplot/dialogs/ksattrpanel.cpp create mode 100644 kmatplot/dialogs/ksattrpanel.h create mode 100644 kmatplot/dialogs/ksattrpanelinterf.cpp create mode 100644 kmatplot/dialogs/ksattrpanelinterf.ui create mode 100644 kmatplot/dialogs/ksattrpanelinterf2.ui create mode 100644 kmatplot/dialogs/kschannellist.cpp create mode 100644 kmatplot/dialogs/kschannellist.h create mode 100644 kmatplot/dialogs/ksconfiguredlg.cpp create mode 100644 kmatplot/dialogs/ksconfiguredlg.h create mode 100644 kmatplot/dialogs/ksconfiguredlginterf.cpp create mode 100644 kmatplot/dialogs/ksconfiguredlginterf.ui create mode 100644 kmatplot/dialogs/ksconfiguredlginterf.ui.h create mode 100644 kmatplot/dialogs/ksdatasetdlg.cpp create mode 100644 kmatplot/dialogs/ksdatasetdlg.h create mode 100644 kmatplot/dialogs/ksdatasetdlginterf.cpp create mode 100644 kmatplot/dialogs/ksdatasetdlginterf.ui create mode 100644 kmatplot/dialogs/ksexportdlg.cpp create mode 100644 kmatplot/dialogs/ksexportdlg.h create mode 100644 kmatplot/dialogs/ksexportdlginterf.cpp create mode 100644 kmatplot/dialogs/ksexportdlginterf.ui create mode 100644 kmatplot/dialogs/ksexportpicturedlg.cpp create mode 100644 kmatplot/dialogs/ksexportpicturedlg.h create mode 100644 kmatplot/dialogs/ksexportpicturedlginterf.cpp create mode 100644 kmatplot/dialogs/ksexportpicturedlginterf.ui create mode 100644 kmatplot/dialogs/ksgraphwizard.cpp create mode 100644 kmatplot/dialogs/ksgraphwizard.h create mode 100644 kmatplot/dialogs/ksgraphwizardinterf.cpp create mode 100644 kmatplot/dialogs/ksgraphwizardinterf.ui create mode 100644 kmatplot/dialogs/ksgriddlg.cpp create mode 100644 kmatplot/dialogs/ksgriddlg.h create mode 100644 kmatplot/dialogs/ksgriddlginterf.cpp create mode 100644 kmatplot/dialogs/ksgriddlginterf.ui create mode 100644 kmatplot/dialogs/ksimportdlg.cpp create mode 100644 kmatplot/dialogs/ksimportdlg.h create mode 100644 kmatplot/dialogs/ksimportdlginterf.cpp create mode 100644 kmatplot/dialogs/ksimportdlginterf.ui create mode 100644 kmatplot/dialogs/ksmpanel.cpp create mode 100644 kmatplot/dialogs/ksmpanel.h create mode 100644 kmatplot/dialogs/ksmpanelformulainterf.cpp create mode 100644 kmatplot/dialogs/ksmpanelformulainterf.ui create mode 100644 kmatplot/dialogs/ksmpanelmatrixinterf.cpp create mode 100644 kmatplot/dialogs/ksmpanelmatrixinterf.ui create mode 100644 kmatplot/dialogs/ksmpanelrefinterf.cpp create mode 100644 kmatplot/dialogs/ksmpanelrefinterf.ui create mode 100644 kmatplot/dialogs/ksmpanels.cpp create mode 100644 kmatplot/dialogs/ksmpanels.h create mode 100644 kmatplot/dialogs/ksmpanelstringinterf.cpp create mode 100644 kmatplot/dialogs/ksmpanelstringinterf.ui create mode 100644 kmatplot/dialogs/ksobjecttreedlg.cpp create mode 100644 kmatplot/dialogs/ksobjecttreedlg.h create mode 100644 kmatplot/dialogs/ksobjecttreedlginterf.cpp create mode 100644 kmatplot/dialogs/ksobjecttreedlginterf.ui create mode 100644 kmatplot/dialogs/kspanel.cpp create mode 100644 kmatplot/dialogs/kspanel.h create mode 100644 kmatplot/dialogs/kspanelaxisinterf.cpp create mode 100644 kmatplot/dialogs/kspanelaxisinterf.ui create mode 100644 kmatplot/dialogs/kspanelcarrowinterf.cpp create mode 100644 kmatplot/dialogs/kspanelcarrowinterf.ui create mode 100644 kmatplot/dialogs/kspanelclabelinterf.cpp create mode 100644 kmatplot/dialogs/kspanelclabelinterf.ui create mode 100644 kmatplot/dialogs/kspanelclegendcinterf.cpp create mode 100644 kmatplot/dialogs/kspanelclegendcinterf.ui create mode 100644 kmatplot/dialogs/kspanelcontourinterf.cpp create mode 100644 kmatplot/dialogs/kspanelcontourinterf.ui create mode 100644 kmatplot/dialogs/kspanelcposinterf.cpp create mode 100644 kmatplot/dialogs/kspanelcposinterf.ui create mode 100644 kmatplot/dialogs/kspanelcrectinterf.cpp create mode 100644 kmatplot/dialogs/kspanelcrectinterf.ui create mode 100644 kmatplot/dialogs/kspanelcubeinterf.cpp create mode 100644 kmatplot/dialogs/kspanelcubeinterf.ui create mode 100644 kmatplot/dialogs/kspanelcurveinterf.cpp create mode 100644 kmatplot/dialogs/kspanelcurveinterf.ui create mode 100644 kmatplot/dialogs/kspanelfigureinterf.cpp create mode 100644 kmatplot/dialogs/kspanelfigureinterf.ui create mode 100644 kmatplot/dialogs/kspanelframeinterf.cpp create mode 100644 kmatplot/dialogs/kspanelframeinterf.ui create mode 100644 kmatplot/dialogs/kspanelgeneralinterf.cpp create mode 100644 kmatplot/dialogs/kspanelgeneralinterf.ui create mode 100644 kmatplot/dialogs/kspanelglinterf.cpp create mode 100644 kmatplot/dialogs/kspanelglinterf.ui create mode 100644 kmatplot/dialogs/kspanelgradientinterf.cpp create mode 100644 kmatplot/dialogs/kspanelgradientinterf.ui create mode 100644 kmatplot/dialogs/kspanelgridinterf.cpp create mode 100644 kmatplot/dialogs/kspanelgridinterf.ui create mode 100644 kmatplot/dialogs/kspanelimageinterf.cpp create mode 100644 kmatplot/dialogs/kspanelimageinterf.ui create mode 100644 kmatplot/dialogs/kspanellightinterf.cpp create mode 100644 kmatplot/dialogs/kspanellightinterf.ui create mode 100644 kmatplot/dialogs/kspanelmeshinterf.cpp create mode 100644 kmatplot/dialogs/kspanelmeshinterf.ui create mode 100644 kmatplot/dialogs/kspanelrangeinterf.cpp create mode 100644 kmatplot/dialogs/kspanelrangeinterf.ui create mode 100644 kmatplot/dialogs/kspanels.cpp create mode 100644 kmatplot/dialogs/kspanels.h create mode 100644 kmatplot/dialogs/kspanelsurfaceinterf.cpp create mode 100644 kmatplot/dialogs/kspanelsurfaceinterf.ui create mode 100644 kmatplot/dialogs/kspanelviewinterf.cpp create mode 100644 kmatplot/dialogs/kspanelviewinterf.ui create mode 100644 kmatplot/dialogs/kssheetdlgcellrangeinterf.cpp create mode 100644 kmatplot/dialogs/kssheetdlgcellrangeinterf.ui create mode 100644 kmatplot/dialogs/kssheetdlgcoldatainterf.cpp create mode 100644 kmatplot/dialogs/kssheetdlgcoldatainterf.ui create mode 100644 kmatplot/dialogs/kssheetdlgs.cpp create mode 100644 kmatplot/dialogs/kssheetdlgs.h create mode 100644 kmatplot/dialogs/kssheetdlgsequenceinterf.cpp create mode 100644 kmatplot/dialogs/kssheetdlgsequenceinterf.ui create mode 100644 kmatplot/dialogs/kssheetdlgvaluerangeinterf.cpp create mode 100644 kmatplot/dialogs/kssheetdlgvaluerangeinterf.ui create mode 100644 kmatplot/dialogs/kstextedit.cpp create mode 100644 kmatplot/dialogs/kstextedit.h create mode 100644 kmatplot/dialogs/kswizarddlgs.cpp create mode 100644 kmatplot/dialogs/kswizarddlgs.h create mode 100644 kmatplot/dialogs/kswizarddlgsurfaceinterf.cpp create mode 100644 kmatplot/dialogs/kswizarddlgsurfaceinterf.ui create mode 100644 kmatplot/dialogs/templates/KSMPanel.ui create mode 100644 kmatplot/dialogs/templates/KSPanel.ui create mode 100644 kmatplot/dialogs/templates/Makefile.am create mode 100644 kmatplot/dialogs/templates/kmatplot_widgets.cw create mode 100644 kmatplot/dialogs/templates/kspanel.png create mode 100644 kmatplot/docs/Makefile.am create mode 100644 kmatplot/docs/en/Makefile.am create mode 100644 kmatplot/dtd/Makefile.am create mode 100644 kmatplot/dtd/kmatplot.dtd create mode 100644 kmatplot/examples/Makefile.am create mode 100644 kmatplot/examples/contour.kmp create mode 100644 kmatplot/examples/path3d.kmp create mode 100644 kmatplot/examples/shell.kmp create mode 100644 kmatplot/examples/simple.kmp create mode 100644 kmatplot/examples/surface.kmp create mode 100644 kmatplot/formula/Makefile.am create mode 100755 kmatplot/formula/gramdiag create mode 100755 kmatplot/formula/make_parser.sh create mode 100644 kmatplot/formula/mpdelunay.cpp create mode 100644 kmatplot/formula/mpdelunay.h create mode 100644 kmatplot/formula/mpformula.cpp create mode 100644 kmatplot/formula/mpformula.h create mode 100644 kmatplot/formula/mpparser.cpp create mode 100644 kmatplot/formula/mpparser.cpp.h create mode 100644 kmatplot/formula/mpparser.cpp.report create mode 100644 kmatplot/formula/mpparser.y create mode 100644 kmatplot/formula/mpparsersymbol.cpp create mode 100644 kmatplot/formula/mpparsersymbol.h create mode 100644 kmatplot/formula/mpsymbol.cpp create mode 100644 kmatplot/formula/mpsymbol.h create mode 100644 kmatplot/formula/mpsymbols.cpp create mode 100644 kmatplot/formula/mpsymbols.h create mode 100644 kmatplot/interface/Makefile.am create mode 100644 kmatplot/interface/common.c create mode 100644 kmatplot/interface/common.h create mode 100644 kmatplot/interface/etype.h create mode 100644 kmatplot/interface/msg.h create mode 100644 kmatplot/kmatplotshell.cpp create mode 100644 kmatplot/kmatplotshell.h create mode 100644 kmatplot/kscommands.cpp create mode 100644 kmatplot/kscommands.h create mode 100644 kmatplot/ksdataobjectfactory.cpp create mode 100644 kmatplot/ksdataobjectfactory.h create mode 100644 kmatplot/ksdatasymbolfactory.cpp create mode 100644 kmatplot/ksdatasymbolfactory.h create mode 100644 kmatplot/ksglobalmatrixlist.cpp create mode 100644 kmatplot/ksglobalmatrixlist.h create mode 100644 kmatplot/ksglobalsettings.cpp create mode 100644 kmatplot/ksglobalsettings.h create mode 100644 kmatplot/ksmatrix.cpp create mode 100644 kmatplot/ksmatrix.h create mode 100644 kmatplot/ksmatrixascii.cpp create mode 100644 kmatplot/ksmatrixascii.h create mode 100644 kmatplot/ksmatrixeditor.cpp create mode 100644 kmatplot/ksmatrixeditor.h create mode 100644 kmatplot/ksmatrixio.cpp create mode 100644 kmatplot/ksmatrixio.h create mode 100644 kmatplot/ksmatrixiohandler.cpp create mode 100644 kmatplot/ksmatrixiohandler.h create mode 100644 kmatplot/ksmatrixmat.cpp create mode 100644 kmatplot/ksmatrixmat.h create mode 100644 kmatplot/ksmatrixsheet.cpp create mode 100644 kmatplot/ksmatrixsheet.h create mode 100644 kmatplot/ksobjectfactory.cpp create mode 100644 kmatplot/ksobjectfactory.h create mode 100644 kmatplot/kspanelmanager.cpp create mode 100644 kmatplot/kspanelmanager.h create mode 100644 kmatplot/ksprojectxml.cpp create mode 100644 kmatplot/ksprojectxml.h create mode 100644 kmatplot/kssocketio.cpp create mode 100644 kmatplot/kssocketio.h create mode 100644 kmatplot/kswinpageview.cpp create mode 100644 kmatplot/kswinpageview.h create mode 100644 kmatplot/kswinworksheet.cpp create mode 100644 kmatplot/kswinworksheet.h create mode 100644 kmatplot/ksworkbook.cpp create mode 100644 kmatplot/ksworkbook.h create mode 100644 kmatplot/ksworksheetdlg.cpp create mode 100644 kmatplot/ksworksheetdlg.h create mode 100644 kmatplot/ksworkspace.cpp create mode 100644 kmatplot/ksworkspace.h create mode 100644 kmatplot/main.cpp create mode 100644 kmatplot/octave/Makefile.am create mode 100644 kmatplot/octave/README.octave create mode 100644 kmatplot/octave/kadd.cpp create mode 100644 kmatplot/octave/kaddaxes.cpp create mode 100644 kmatplot/octave/kcontour.cpp create mode 100644 kmatplot/octave/kimage.cpp create mode 100644 kmatplot/octave/kmesh.cpp create mode 100644 kmatplot/octave/kplot.cpp create mode 100644 kmatplot/octave/kremove.cpp create mode 100644 kmatplot/octave/kremoveall.cpp create mode 100644 kmatplot/octave/kremoveaxes.cpp create mode 100644 kmatplot/octave/ksetapp.cpp create mode 100644 kmatplot/octave/ksetaxes.cpp create mode 100644 kmatplot/octave/ksetmatrix.cpp create mode 100644 kmatplot/octave/octave-common.h create mode 100644 kmatplot/octave/octave-core create mode 100644 kmatplot/pics/Makefile.am create mode 100644 kmatplot/pics/graph_contour.png create mode 100644 kmatplot/pics/graph_figure.png create mode 100644 kmatplot/pics/graph_image.png create mode 100644 kmatplot/pics/graph_ngcontour.png create mode 100644 kmatplot/pics/graph_ngsurface.png create mode 100644 kmatplot/pics/graph_surface.png create mode 100644 kmatplot/pics/graph_xyplot.png create mode 100644 kmatplot/pics/hi32-app-kmatplot.png create mode 100644 kmatplot/pics/hi48-app-kmatplot.png create mode 100644 kmatplot/pics/lo16-app-kmatplot.png create mode 100644 kmatplot/pics/lo32-app-kmatplot.png create mode 100644 kmatplot/pixmaps/Makefile.am create mode 100644 kmatplot/pixmaps/action_arrow.xpm create mode 100644 kmatplot/pixmaps/action_contour.xpm create mode 100644 kmatplot/pixmaps/action_copy.xpm create mode 100644 kmatplot/pixmaps/action_curve.xpm create mode 100644 kmatplot/pixmaps/action_cut.xpm create mode 100644 kmatplot/pixmaps/action_delete.xpm create mode 100644 kmatplot/pixmaps/action_exit.xpm create mode 100644 kmatplot/pixmaps/action_exportpicture.xpm create mode 100644 kmatplot/pixmaps/action_figure.xpm create mode 100644 kmatplot/pixmaps/action_fullpage.xpm create mode 100644 kmatplot/pixmaps/action_gray.xpm create mode 100644 kmatplot/pixmaps/action_green.xpm create mode 100644 kmatplot/pixmaps/action_label.xpm create mode 100644 kmatplot/pixmaps/action_locate.xpm create mode 100644 kmatplot/pixmaps/action_lower.xpm create mode 100644 kmatplot/pixmaps/action_new.xpm create mode 100644 kmatplot/pixmaps/action_open.xpm create mode 100644 kmatplot/pixmaps/action_paste.xpm create mode 100644 kmatplot/pixmaps/action_pixmap.xpm create mode 100644 kmatplot/pixmaps/action_print.xpm create mode 100644 kmatplot/pixmaps/action_properties.xpm create mode 100644 kmatplot/pixmaps/action_raise.xpm create mode 100644 kmatplot/pixmaps/action_rectangle.xpm create mode 100644 kmatplot/pixmaps/action_red.xpm create mode 100644 kmatplot/pixmaps/action_redo.xpm create mode 100644 kmatplot/pixmaps/action_save.xpm create mode 100644 kmatplot/pixmaps/action_select.xpm create mode 100644 kmatplot/pixmaps/action_surface.xpm create mode 100644 kmatplot/pixmaps/action_textbold.xpm create mode 100644 kmatplot/pixmaps/action_textcenter.xpm create mode 100644 kmatplot/pixmaps/action_textcolor.xpm create mode 100644 kmatplot/pixmaps/action_textitalic.xpm create mode 100644 kmatplot/pixmaps/action_textjustify.xpm create mode 100644 kmatplot/pixmaps/action_textleft.xpm create mode 100644 kmatplot/pixmaps/action_textright.xpm create mode 100644 kmatplot/pixmaps/action_textsubscript.xpm create mode 100644 kmatplot/pixmaps/action_textsuperscript.xpm create mode 100644 kmatplot/pixmaps/action_textunderline.xpm create mode 100644 kmatplot/pixmaps/action_toback.xpm create mode 100644 kmatplot/pixmaps/action_tofront.xpm create mode 100644 kmatplot/pixmaps/action_undo.xpm create mode 100644 kmatplot/pixmaps/action_windows.xpm create mode 100644 kmatplot/pixmaps/action_wizard.xpm create mode 100644 kmatplot/pixmaps/action_worksheet.xpm create mode 100644 kmatplot/pixmaps/action_zoom.xpm create mode 100755 kmatplot/pixmaps/convert.pl create mode 100644 kmatplot/pixmaps/file.list create mode 100644 kmatplot/pixmaps/panel_arrow.xpm create mode 100644 kmatplot/pixmaps/panel_axes.xpm create mode 100644 kmatplot/pixmaps/panel_box.xpm create mode 100644 kmatplot/pixmaps/panel_datasets.xpm create mode 100644 kmatplot/pixmaps/panel_frame.xpm create mode 100644 kmatplot/pixmaps/panel_general.xpm create mode 100644 kmatplot/pixmaps/panel_gl.xpm create mode 100644 kmatplot/pixmaps/panel_gradient.xpm create mode 100644 kmatplot/pixmaps/panel_gv.xpm create mode 100644 kmatplot/pixmaps/panel_gx.xpm create mode 100644 kmatplot/pixmaps/panel_gy.xpm create mode 100644 kmatplot/pixmaps/panel_gz.xpm create mode 100644 kmatplot/pixmaps/panel_label.xpm create mode 100644 kmatplot/pixmaps/panel_legend.xpm create mode 100644 kmatplot/pixmaps/panel_light.xpm create mode 100644 kmatplot/pixmaps/panel_mesh.xpm create mode 100644 kmatplot/pixmaps/panel_more.xpm create mode 100644 kmatplot/pixmaps/panel_object.xpm create mode 100644 kmatplot/pixmaps/panel_pos1.xpm create mode 100644 kmatplot/pixmaps/panel_pos2.xpm create mode 100644 kmatplot/pixmaps/panel_position.xpm create mode 100644 kmatplot/pixmaps/panel_rect.xpm create mode 100644 kmatplot/pixmaps/panel_v.xpm create mode 100644 kmatplot/pixmaps/panel_view.xpm create mode 100644 kmatplot/pixmaps/panel_x.xpm create mode 100644 kmatplot/pixmaps/panel_y.xpm create mode 100644 kmatplot/pixmaps/panel_z.xpm create mode 100644 kmatplot/python/KMatplot.py create mode 100644 kmatplot/python/Makefile.am create mode 100644 kmatplot/python/README.python create mode 100644 kmatplot/python/_kplot.py create mode 100644 kmatplot/python/kplot.pth create mode 100644 kmatplot/python/kplot.py create mode 100644 kmatplot/qscobjects.cpp create mode 100644 kmatplot/qscobjects.h create mode 100644 kmatplot/qsctools.cpp create mode 100644 kmatplot/qsctools.h create mode 100644 kmatplot/scilab/Makefile.am create mode 100644 kmatplot/scilab/README.Scilab create mode 100644 kmatplot/scilab/kcontour.sci create mode 100644 kmatplot/scilab/kimage.sci create mode 100644 kmatplot/scilab/kmesh.sci create mode 100644 kmatplot/scilab/kplot.sci create mode 100644 kmatplot/scilab/plots.c create mode 100644 kmatplot/scilab/plots.sci create mode 100644 kmatplot/widgets/Makefile.am create mode 100644 kmatplot/widgets/qsaxes.cpp create mode 100644 kmatplot/widgets/qsaxes.h create mode 100644 kmatplot/widgets/qsaxes2d.cpp create mode 100644 kmatplot/widgets/qsaxes2d.h create mode 100644 kmatplot/widgets/qsaxes3d.cpp create mode 100644 kmatplot/widgets/qsaxes3d.h create mode 100644 kmatplot/widgets/qsaxis.cpp create mode 100644 kmatplot/widgets/qsaxis.h create mode 100644 kmatplot/widgets/qschildlist.h create mode 100644 kmatplot/widgets/qsclegend.cpp create mode 100644 kmatplot/widgets/qsclegend.h create mode 100644 kmatplot/widgets/qscobject.cpp create mode 100644 kmatplot/widgets/qscobject.h create mode 100644 kmatplot/widgets/qsconsole.cpp create mode 100644 kmatplot/widgets/qsconsole.h create mode 100644 kmatplot/widgets/qscontour.cpp create mode 100644 kmatplot/widgets/qscontour.h create mode 100644 kmatplot/widgets/qscoord.cpp create mode 100644 kmatplot/widgets/qscoord.h create mode 100644 kmatplot/widgets/qsctool.cpp create mode 100644 kmatplot/widgets/qsctool.h create mode 100644 kmatplot/widgets/qscurve.cpp create mode 100644 kmatplot/widgets/qscurve.h create mode 100644 kmatplot/widgets/qsdata.cpp create mode 100644 kmatplot/widgets/qsdata.h create mode 100644 kmatplot/widgets/qsdrv.cpp create mode 100644 kmatplot/widgets/qsdrv.h create mode 100644 kmatplot/widgets/qsdrvhittest.cpp create mode 100644 kmatplot/widgets/qsdrvhittest.h create mode 100644 kmatplot/widgets/qsdrvopengl.cpp create mode 100644 kmatplot/widgets/qsdrvopengl.h create mode 100644 kmatplot/widgets/qsdrvqt.cpp create mode 100644 kmatplot/widgets/qsdrvqt.h create mode 100644 kmatplot/widgets/qsfigure.cpp create mode 100644 kmatplot/widgets/qsfigure.h create mode 100644 kmatplot/widgets/qsgattr.cpp create mode 100644 kmatplot/widgets/qsgattr.h create mode 100644 kmatplot/widgets/qsgraphicaldata.cpp create mode 100644 kmatplot/widgets/qsgraphicaldata.h create mode 100644 kmatplot/widgets/qsimage.cpp create mode 100644 kmatplot/widgets/qsimage.h create mode 100644 kmatplot/widgets/qsmatrix.cpp create mode 100644 kmatplot/widgets/qsmatrix.h create mode 100644 kmatplot/widgets/qsplot.cpp create mode 100644 kmatplot/widgets/qsplot.h create mode 100644 kmatplot/widgets/qsplotview.cpp create mode 100644 kmatplot/widgets/qsplotview.h create mode 100644 kmatplot/widgets/qsprojection.cpp create mode 100644 kmatplot/widgets/qsprojection.h create mode 100644 kmatplot/widgets/qsprojection2d.cpp create mode 100644 kmatplot/widgets/qsprojection2d.h create mode 100644 kmatplot/widgets/qsprojection3d.cpp create mode 100644 kmatplot/widgets/qsprojection3d.h create mode 100644 kmatplot/widgets/qsruler.cpp create mode 100644 kmatplot/widgets/qsruler.h create mode 100644 kmatplot/widgets/qssegment.cpp create mode 100644 kmatplot/widgets/qssegment.h create mode 100644 kmatplot/widgets/qsserializable.cpp create mode 100644 kmatplot/widgets/qsserializable.h create mode 100644 kmatplot/widgets/qssurface.cpp create mode 100644 kmatplot/widgets/qssurface.h create mode 100644 kmatplot/widgets/qsworkbook.cpp create mode 100644 kmatplot/widgets/qsworkbook.h create mode 100644 stamp-h.in create mode 100644 subdirs diff --git a/AUTHORS b/AUTHORS new file mode 100644 index 0000000..2a6c0bf --- /dev/null +++ b/AUTHORS @@ -0,0 +1 @@ +Kamil Dobkowski diff --git a/COPYING b/COPYING new file mode 100644 index 0000000..c7aea18 --- /dev/null +++ b/COPYING @@ -0,0 +1,280 @@ + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc. + 675 Mass Ave, Cambridge, MA 02139, USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +License is intended to guarantee your freedom to share and change free +software--to make sure the software is free for all its users. This +General Public License applies to most of the Free Software +Foundation's software and to any other program whose authors commit to +using it. (Some other Free Software Foundation software is covered by +the GNU Library General Public License instead.) You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +this service if you wish), that you receive source code or can get it +if you want it, that you can change the software or use pieces of it +in new free programs; and that you know you can do these things. + + To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if you +distribute copies of the software, or if you modify it. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must give the recipients all the rights that +you have. You must make sure that they, too, receive or can get the +source code. And you must show them these terms so they know their +rights. + + We protect your rights with two steps: (1) copyright the software, and +(2) offer you this license which gives you legal permission to copy, +distribute and/or modify the software. + + Also, for each author's protection and ours, we want to make certain +that everyone understands that there is no warranty for this free +software. If the software is modified by someone else and passed on, we +want its recipients to know that what they have is not the original, so +that any problems introduced by others will not reflect on the original +authors' reputations. + + Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that redistributors of a free +program will individually obtain patent licenses, in effect making the +program proprietary. To prevent this, we have made it clear that any +patent must be licensed for everyone's free use or not licensed at all. + + The precise terms and conditions for copying, distribution and +modification follow. + + GNU GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License applies to any program or other work which contains +a notice placed by the copyright holder saying it may be distributed +under the terms of this General Public License. The "Program", below, +refers to any such program or work, and a "work based on the Program" +means either the Program or any derivative work under copyright law: +that is to say, a work containing the Program or a portion of it, +either verbatim or with modifications and/or translated into another +language. (Hereinafter, translation is included without limitation in +the term "modification".) Each licensee is addressed as "you". + +Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running the Program is not restricted, and the output from the Program +is covered only if its contents constitute a work based on the +Program (independent of having been made by running the Program). +Whether that is true depends on what the Program does. + + 1. You may copy and distribute verbatim copies of the Program's +source code as you receive it, in any medium, provided that you +conspicuously and appropriately publish on each copy an appropriate +copyright notice and disclaimer of warranty; keep intact all the +notices that refer to this License and to the absence of any warranty; +and give any other recipients of the Program a copy of this License +along with the Program. + +You may charge a fee for the physical act of transferring a copy, and +you may at your option offer warranty protection in exchange for a fee. + + 2. You may modify your copy or copies of the Program or any portion +of it, thus forming a work based on the Program, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) You must cause the modified files to carry prominent notices + stating that you changed the files and the date of any change. + + b) You must cause any work that you distribute or publish, that in + whole or in part contains or is derived from the Program or any + part thereof, to be licensed as a whole at no charge to all third + parties under the terms of this License. + + c) If the modified program normally reads commands interactively + when run, you must cause it, when started running for such + interactive use in the most ordinary way, to print or display an + announcement including an appropriate copyright notice and a + notice that there is no warranty (or else, saying that you provide + a warranty) and that users may redistribute the program under + these conditions, and telling the user how to view a copy of this + License. (Exception: if the Program itself is interactive but + does not normally print such an announcement, your work based on + the Program is not required to print an announcement.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Program, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Program, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Program. + +In addition, mere aggregation of another work not based on the Program +with the Program (or with a work based on the Program) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may copy and distribute the Program (or a work based on it, +under Section 2) in object code or executable form under the terms of +Sections 1 and 2 above provided that you also do one of the following: + + a) Accompany it with the complete corresponding machine-readable + source code, which must be distributed under the terms of Sections + 1 and 2 above on a medium customarily used for software interchange; or, + + b) Accompany it with a written offer, valid for at least three + years, to give any third party, for a charge no more than your + cost of physically performing source distribution, a complete + machine-readable copy of the corresponding source code, to be + distributed under the terms of Sections 1 and 2 above on a medium + customarily used for software interchange; or, + + c) Accompany it with the information you received as to the offer + to distribute corresponding source code. (This alternative is + allowed only for noncommercial distribution and only if you + received the program in object code or executable form with such + an offer, in accord with Subsection b above.) + +The source code for a work means the preferred form of the work for +making modifications to it. For an executable work, complete source +code means all the source code for all modules it contains, plus any +associated interface definition files, plus the scripts used to +control compilation and installation of the executable. However, as a +special exception, the source code distributed need not include +anything that is normally distributed (in either source or binary +form) with the major components (compiler, kernel, and so on) of the +operating system on which the executable runs, unless that component +itself accompanies the executable. + +If distribution of executable or object code is made by offering +access to copy from a designated place, then offering equivalent +access to copy the source code from the same place counts as +distribution of the source code, even though third parties are not +compelled to copy the source along with the object code. + + 4. You may not copy, modify, sublicense, or distribute the Program +except as expressly provided under this License. Any attempt +otherwise to copy, modify, sublicense or distribute the Program is +void, and will automatically terminate your rights under this License. +However, parties who have received copies, or rights, from you under +this License will not have their licenses terminated so long as such +parties remain in full compliance. + + 5. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Program or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Program (or any work based on the +Program), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Program or works based on it. + + 6. Each time you redistribute the Program (or any work based on the +Program), the recipient automatically receives a license from the +original licensor to copy, distribute or modify the Program subject to +these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License. + + 7. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Program at all. For example, if a patent +license would not permit royalty-free redistribution of the Program by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Program. + +If any portion of this section is held invalid or unenforceable under +any particular circumstance, the balance of the section is intended to +apply and the section as a whole is intended to apply in other +circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system, which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 8. If the distribution and/or use of the Program is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Program under this License +may add an explicit geographical distribution limitation excluding +those countries, so that distribution is permitted only in or among +countries not thus excluded. In such case, this License incorporates +the limitation as if written in the body of this License. + + 9. The Free Software Foundation may publish revised and/or new versions +of the General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + +Each version is given a distinguishing version number. If the Program +specifies a version number of this License which applies to it and "any +later version", you have the option of following the terms and conditions +either of that version or of any later version published by the Free +Software Foundation. If the Program does not specify a version number of +this License, you may choose any version ever published by the Free Software +Foundation. + + 10. If you wish to incorporate parts of the Program into other free +programs whose distribution conditions are different, write to the author +to ask for permission. For software which is copyrighted by the Free +Software Foundation, write to the Free Software Foundation; we sometimes +make exceptions for this. Our decision will be guided by the two goals +of preserving the free status of all derivatives of our free software and +of promoting the sharing and reuse of software generally. + + NO WARRANTY + + 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY +FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN +OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES +PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED +OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS +TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE +PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, +REPAIR OR CORRECTION. + + 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR +REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, +INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING +OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED +TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY +YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER +PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGES. + + END OF TERMS AND CONDITIONS diff --git a/ChangeLog b/ChangeLog new file mode 100644 index 0000000..db83528 --- /dev/null +++ b/ChangeLog @@ -0,0 +1,37 @@ +0.3.1 + - bugfixes + - examples + - pixmap buffering + - python module +0.3 + - formulas + - cut/copy/paste, + - undo/redo, + - group/ungroup objects, + - multiple pages, + - arbitrary number of axes per graph, + - surfaces and contours can display non-gridded data ( using Delunay triangulation ), + - colored area under the surface, v-gradient, plotting 4d data ( still under development ), + - XY plots - stairs, + - custom tics values, + - fast selecting of graph elements by middle button click, + - general data storing policy has changed - vectors are stored as columns, + - many bug fixes. +0.2.2 + - bugfixes: surfaces use row index, autorun from within Octave and Scilab, + loads/saves arrow styles, no crashing when loading/saving or deleting objects, + Scilab functions updated. + - exporting(requires) to Qt Metafile, PNG, JPEG, BMP, pdf(GhostScript), + eps(Ghostscript), xfig(pstoedit) and other formats provided by + GhostScript, pstoedit or ImageMagick. + - global data sheets. + - rulers added to the page view + - 3d scatter and trajectory plots +0.2.1 + - compile problems (hopefully) fixed + - new autoconf/automake scripts + - smoother GUI + - new gradient implementation. +0.2 + - major redesign + - QGL widget is distributed with KMatplot \ No newline at end of file diff --git a/INSTALL b/INSTALL new file mode 100644 index 0000000..02a4a07 --- /dev/null +++ b/INSTALL @@ -0,0 +1,167 @@ +Basic Installation +================== + + These are generic installation instructions. + + The `configure' shell script attempts to guess correct values for +various system-dependent variables used during compilation. It uses +those values to create a `Makefile' in each directory of the package. +It may also create one or more `.h' files containing system-dependent +definitions. Finally, it creates a shell script `config.status' that +you can run in the future to recreate the current configuration, a file +`config.cache' that saves the results of its tests to speed up +reconfiguring, and a file `config.log' containing compiler output +(useful mainly for debugging `configure'). + + If you need to do unusual things to compile the package, please try +to figure out how `configure' could check whether to do them, and mail +diffs or instructions to the address given in the `README' so they can +be considered for the next release. If at some point `config.cache' +contains results you don't want to keep, you may remove or edit it. + + The file `configure.in' is used to create `configure' by a program +called `autoconf'. You only need `configure.in' if you want to change +it or regenerate `configure' using a newer version of `autoconf'. + +The simplest way to compile this package is: + + 1. `cd' to the directory containing the package's source code and type + `./configure' to configure the package for your system. If you're + using `csh' on an old version of System V, you might need to type + `sh ./configure' instead to prevent `csh' from trying to execute + `configure' itself. + + Running `configure' takes a while. While running, it prints some + messages telling which features it is checking for. + + 2. Type `make' to compile the package. + + 3. Type `make install' to install the programs and any data files and + documentation. + + 4. You can remove the program binaries and object files from the + source code directory by typing `make clean'. + +Compilers and Options +===================== + + Some systems require unusual options for compilation or linking that +the `configure' script does not know about. You can give `configure' +initial values for variables by setting them in the environment. Using +a Bourne-compatible shell, you can do that on the command line like +this: + CC=c89 CFLAGS=-O2 LIBS=-lposix ./configure + +Or on systems that have the `env' program, you can do it like this: + env CPPFLAGS=-I/usr/local/include LDFLAGS=-s ./configure + +Compiling For Multiple Architectures +==================================== + + You can compile the package for more than one kind of computer at the +same time, by placing the object files for each architecture in their +own directory. To do this, you must use a version of `make' that +supports the `VPATH' variable, such as GNU `make'. `cd' to the +directory where you want the object files and executables to go and run +the `configure' script. `configure' automatically checks for the +source code in the directory that `configure' is in and in `..'. + + If you have to use a `make' that does not supports the `VPATH' +variable, you have to compile the package for one architecture at a time +in the source code directory. After you have installed the package for +one architecture, use `make distclean' before reconfiguring for another +architecture. + +Installation Names +================== + + By default, `make install' will install the package's files in +`/usr/local/bin', `/usr/local/man', etc. You can specify an +installation prefix other than `/usr/local' by giving `configure' the +option `--prefix=PATH'. + + You can specify separate installation prefixes for +architecture-specific files and architecture-independent files. If you +give `configure' the option `--exec-prefix=PATH', the package will use +PATH as the prefix for installing programs and libraries. +Documentation and other data files will still use the regular prefix. + + If the package supports it, you can cause programs to be installed +with an extra prefix or suffix on their names by giving `configure' the +option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'. + +Optional Features +================= + + Some packages pay attention to `--enable-FEATURE' options to +`configure', where FEATURE indicates an optional part of the package. +They may also pay attention to `--with-PACKAGE' options, where PACKAGE +is something like `gnu-as' or `x' (for the X Window System). The +`README' should mention any `--enable-' and `--with-' options that the +package recognizes. + + For packages that use the X Window System, `configure' can usually +find the X include and library files automatically, but if it doesn't, +you can use the `configure' options `--x-includes=DIR' and +`--x-libraries=DIR' to specify their locations. + +Specifying the System Type +========================== + + There may be some features `configure' can not figure out +automatically, but needs to determine by the type of host the package +will run on. Usually `configure' can figure that out, but if it prints +a message saying it can not guess the host type, give it the +`--host=TYPE' option. TYPE can either be a short name for the system +type, such as `sun4', or a canonical name with three fields: + CPU-COMPANY-SYSTEM + +See the file `config.sub' for the possible values of each field. If +`config.sub' isn't included in this package, then this package doesn't +need to know the host type. + + If you are building compiler tools for cross-compiling, you can also +use the `--target=TYPE' option to select the type of system they will +produce code for and the `--build=TYPE' option to select the type of +system on which you are compiling the package. + +Sharing Defaults +================ + + If you want to set default values for `configure' scripts to share, +you can create a site shell script called `config.site' that gives +default values for variables like `CC', `cache_file', and `prefix'. +`configure' looks for `PREFIX/share/config.site' if it exists, then +`PREFIX/etc/config.site' if it exists. Or, you can set the +`CONFIG_SITE' environment variable to the location of the site script. +A warning: not all `configure' scripts look for a site script. + +Operation Controls +================== + + `configure' recognizes the following options to control how it +operates. + +`--cache-file=FILE' + Use and save the results of the tests in FILE instead of + `./config.cache'. Set FILE to `/dev/null' to disable caching, for + debugging `configure'. + +`--help' + Print a summary of the options to `configure', and exit. + +`--quiet' +`--silent' +`-q' + Do not print messages saying which checks are being made. + +`--srcdir=DIR' + Look for the package's source code in directory DIR. Usually + `configure' can determine that directory automatically. + +`--version' + Print the version of Autoconf used to generate the `configure' + script, and exit. + +`configure' also accepts some other, not widely useful, options. + diff --git a/Makefile.am b/Makefile.am new file mode 100644 index 0000000..cb8f5bc --- /dev/null +++ b/Makefile.am @@ -0,0 +1,31 @@ +####### kdevelop will overwrite this part!!! (begin)########## + +SUBDIRS = kmatplot + +EXTRA_DIST = kmatplot.kdevprj AUTHORS COPYING ChangeLog INSTALL README TODO kmatplot.lsm + +####### kdevelop will overwrite this part!!! (end)############ +# not a GNU package. You can remove this line, if +# have all needed files, that a GNU package needs +AUTOMAKE_OPTIONS = foreign + +#$(top_srcdir)/configure.in: configure.in.in $(top_srcdir)/subdirs +# cd $(top_srcdir) && $(MAKE) -f admin/Makefile.common configure.in ; + +$(top_srcdir)/subdirs: + cd $(top_srcdir) && $(MAKE) -f admin/Makefile.common subdirs + +$(top_srcdir)/acinclude.m4: $(top_srcdir)/admin/acinclude.m4.in $(top_srcdir)/admin/libtool.m4.in + @cd $(top_srcdir) && cat admin/acinclude.m4.in admin/libtool.m4.in > acinclude.m4 + +MAINTAINERCLEANFILES = subdirs configure.in acinclude.m4 configure.files + +package-messages: + $(MAKE) -f admin/Makefile.common package-messages + $(MAKE) -C po merge + +EXTRA_DIST = admin + +dist-hook: + cd $(top_distdir) && perl admin/am_edit -padmin + cd $(top_distdir) && $(MAKE) -f admin/Makefile.common subdirs diff --git a/Makefile.dist b/Makefile.dist new file mode 100644 index 0000000..be59a86 --- /dev/null +++ b/Makefile.dist @@ -0,0 +1,14 @@ +all: + @echo "This Makefile is only for the CVS repository" + @echo "This will be deleted before making the distribution" + @echo "" + @if test ! -d admin; then \ + echo "Please recheckout this module!" ;\ + echo "for cvs: use checkout once and after that update again" ;\ + echo "for cvsup: checkout kde-common from cvsup and" ;\ + echo " link kde-common/admin to ./admin" ;\ + exit 1 ;\ + fi + $(MAKE) -f admin/Makefile.common cvs + +.SILENT: diff --git a/NEWS b/NEWS new file mode 100644 index 0000000..0519ecb --- /dev/null +++ b/NEWS @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/README b/README new file mode 100644 index 0000000..e45da72 --- /dev/null +++ b/README @@ -0,0 +1,21 @@ + + +1. REQUIREMENTS + +KDE-2.1.1 +Mesa-devel-3.4-13 +Mesa-3.4-13 +kdesupport-devel-2.1-3 +kdelibs-sound-devel-2.1.1-5 +kdelibs-devel-2.1.1-5 +qt-devel-2.3.0-3 + +2. INSTALLING IN A DIFFERENT DIRECTORY + +./configure --prefix=/opt +make install + +export KDEDIR=/opt +export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/opt/lib +export PATH=$PATH:/opt/bin +kmatplot diff --git a/TODO b/TODO new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/TODO @@ -0,0 +1 @@ + diff --git a/acconfig.h b/acconfig.h new file mode 100644 index 0000000..ad0a8b7 --- /dev/null +++ b/acconfig.h @@ -0,0 +1,37 @@ +/* Define if the C++ compiler supports BOOL */ +#undef HAVE_BOOL + +#undef VERSION + +#undef PACKAGE + +/* defines if having libgif (always 1) */ +#undef HAVE_LIBGIF + +/* defines if having libjpeg (always 1) */ +#undef HAVE_LIBJPEG + +/* defines which to take for ksize_t */ +#undef ksize_t + +/* define if you have setenv */ +#undef HAVE_FUNC_SETENV + +/* Define to 1 if NLS is requested. */ +#undef ENABLE_NLS + +/* Define as 1 if you have the stpcpy function. */ +#undef HAVE_STPCPY + +/* Define if your locale.h file contains LC_MESSAGES. */ +#undef HAVE_LC_MESSAGES + +/* Define if you need the GNU extensions to compile */ +#undef _GNU_SOURCE + +#ifndef HAVE_BOOL +#define HAVE_BOOL +typedef int bool; +const bool false = 0; +const bool true = 1; +#endif diff --git a/acinclude.m4 b/acinclude.m4 new file mode 100644 index 0000000..9f6efef --- /dev/null +++ b/acinclude.m4 @@ -0,0 +1,4985 @@ +## -*- autoconf -*- + +dnl This file is part of the KDE libraries/packages +dnl Copyright (C) 1997 Janos Farkas (chexum@shadow.banki.hu) +dnl (C) 1997,98,99 Stephan Kulow (coolo@kde.org) + +dnl This file is free software; you can redistribute it and/or +dnl modify it under the terms of the GNU Library General Public +dnl License as published by the Free Software Foundation; either +dnl version 2 of the License, or (at your option) any later version. + +dnl This library is distributed in the hope that it will be useful, +dnl but WITHOUT ANY WARRANTY; without even the implied warranty of +dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +dnl Library General Public License for more details. + +dnl You should have received a copy of the GNU Library General Public License +dnl along with this library; see the file COPYING.LIB. If not, write to +dnl the Free Software Foundation, Inc., 59 Temple Place - Suite 330, +dnl Boston, MA 02111-1307, USA. + +dnl IMPORTANT NOTE: +dnl Please do not modify this file unless you expect your modifications to be +dnl carried into every other module in the repository. If you decide that you +dnl really want to modify it, contact coolo@kde.org mentioning that you have +dnl and that the modified file should be committed to every module. +dnl +dnl Single-module modifications are best placed in configure.in for kdelibs +dnl and kdebase or configure.in.in if present. + +dnl ------------------------------------------------------------------------ +dnl Forward compatibility macros (make autoconf 2.13 look like 2.50), +dnl thanks to Raja R Harinath. +dnl ------------------------------------------------------------------------ +dnl +ifdef([_AC_PATH_X_DIRECT],[], + [AC_DEFUN([_AC_PATH_X_DIRECT],[AC_PATH_X_DIRECT])]) +ifdef([_AC_PATH_X_XMKMF],[], + [AC_DEFUN([_AC_PATH_X_XMKMF],[AC_PATH_X_XMKMF])]) + +dnl ------------------------------------------------------------------------ +dnl Find a file (or one of more files in a list of dirs) +dnl ------------------------------------------------------------------------ +dnl +AC_DEFUN(AC_FIND_FILE, +[ +$3=NO +for i in $2; +do + for j in $1; + do + echo "configure: __oline__: $i/$j" >&AC_FD_CC + if test -r "$i/$j"; then + echo "taking that" >&AC_FD_CC + $3=$i + break 2 + fi + done +done +]) + +dnl KDE_FIND_PATH(programm-name, variable-name, list of directories, +dnl if-not-found, test-parameter) +AC_DEFUN(KDE_FIND_PATH, +[ + AC_MSG_CHECKING([for $1]) + if test -n "$$2"; then + kde_cv_path="$$2"; + else + kde_cache=`echo $1 | sed 'y%./+-%__p_%'` + + AC_CACHE_VAL(kde_cv_path_$kde_cache, + [ + kde_cv_path="NONE" + dirs="$3" + kde_save_IFS=$IFS + IFS=':' + for dir in $PATH; do + dirs="$dirs $dir" + done + IFS=$kde_save_IFS + + for dir in $dirs; do + if test -x "$dir/$1"; then + if test -n "$5" + then + evalstr="$dir/$1 $5 2>&1 " + if eval $evalstr; then + kde_cv_path="$dir/$1" + break + fi + else + kde_cv_path="$dir/$1" + break + fi + fi + done + + eval "kde_cv_path_$kde_cache=$kde_cv_path" + + ]) + + eval "kde_cv_path=\"`echo '$kde_cv_path_'$kde_cache`\"" + + fi + + if test -z "$kde_cv_path" || test "$kde_cv_path" = NONE; then + AC_MSG_RESULT(not found) + $4 + else + AC_MSG_RESULT($kde_cv_path) + $2=$kde_cv_path + + fi +]) + +AC_DEFUN(KDE_MOC_ERROR_MESSAGE, +[ + AC_MSG_ERROR([No Qt meta object compiler (moc) found! +Please check whether you installed Qt correctly. +You need to have a running moc binary. +configure tried to run $ac_cv_path_moc and the test didn't +succeed. If configure shouldn't have tried this one, set +the environment variable MOC to the right one before running +configure. +]) +]) + +AC_DEFUN(KDE_UIC_ERROR_MESSAGE, +[ + AC_MSG_WARN([No Qt ui compiler (uic) found! +Please check whether you installed Qt correctly. +You need to have a running uic binary. +configure tried to run $ac_cv_path_uic and the test didn't +succeed. If configure shouldn't have tried this one, set +the environment variable UIC to the right one before running +configure. +]) +]) + +dnl ------------------------------------------------------------------------ +dnl Find the meta object compiler and the ui compiler in the PATH, +dnl in $QTDIR/bin, and some more usual places +dnl ------------------------------------------------------------------------ +dnl +AC_DEFUN(AC_PATH_QT_MOC_UIC, +[ + qt_bindirs="" + for dir in $kde_qt_dirs; do + qt_bindirs="$qt_bindirs $dir/bin $dir/src/moc" + done + qt_bindirs="$qt_bindirs /usr/bin /usr/X11R6/bin /usr/local/qt/bin" + if test ! "$ac_qt_bindir" = "NO"; then + qt_bindirs="$ac_qt_bindir $qt_bindirs" + fi + + KDE_FIND_PATH(moc, MOC, [$qt_bindirs], [KDE_MOC_ERROR_MESSAGE]) + if test -z "$UIC_NOT_NEEDED"; then + KDE_FIND_PATH(uic, UIC, [$qt_bindirs], [UIC=""]) + if test -z "$UIC" ; then + KDE_UIC_ERROR_MESSAGE + exit 1 + fi + else + UIC="echo uic not available: " + fi + + AC_SUBST(MOC) + AC_SUBST(UIC) +]) + +AC_DEFUN(KDE_1_CHECK_PATHS, +[ + KDE_1_CHECK_PATH_HEADERS + + KDE_TEST_RPATH= + + if test -n "$USE_RPATH"; then + + if test -n "$kde_libraries"; then + KDE_TEST_RPATH="-R $kde_libraries" + fi + + if test -n "$qt_libraries"; then + KDE_TEST_RPATH="$KDE_TEST_RPATH -R $qt_libraries" + fi + + if test -n "$x_libraries"; then + KDE_TEST_RPATH="$KDE_TEST_RPATH -R $x_libraries" + fi + + KDE_TEST_RPATH="$KDE_TEST_RPATH $KDE_EXTRA_RPATH" + fi + +AC_MSG_CHECKING([for KDE libraries installed]) +ac_link='$LIBTOOL_SHELL --silent --mode=link ${CXX-g++} -o conftest $CXXFLAGS $all_includes $CPPFLAGS $LDFLAGS $all_libraries conftest.$ac_ext $LIBS -lkdecore $LIBQT $KDE_TEST_RPATH 1>&5' + +if AC_TRY_EVAL(ac_link) && test -s conftest; then + AC_MSG_RESULT(yes) +else + AC_MSG_ERROR([your system fails at linking a small KDE application! +Check, if your compiler is installed correctly and if you have used the +same compiler to compile Qt and kdelibs as you did use now. +For more details about this problem, look at the end of config.log.]) +fi + +if eval `KDEDIR= ./conftest 2>&5`; then + kde_result=done +else + kde_result=problems +fi + +KDEDIR= ./conftest 2> /dev/null >&5 # make an echo for config.log +kde_have_all_paths=yes + +KDE_SET_PATHS($kde_result) + +]) + +AC_DEFUN(KDE_SET_PATHS, +[ + kde_cv_all_paths="kde_have_all_paths=\"yes\" \ + kde_htmldir=\"$kde_htmldir\" \ + kde_appsdir=\"$kde_appsdir\" \ + kde_icondir=\"$kde_icondir\" \ + kde_sounddir=\"$kde_sounddir\" \ + kde_datadir=\"$kde_datadir\" \ + kde_locale=\"$kde_locale\" \ + kde_cgidir=\"$kde_cgidir\" \ + kde_confdir=\"$kde_confdir\" \ + kde_mimedir=\"$kde_mimedir\" \ + kde_toolbardir=\"$kde_toolbardir\" \ + kde_wallpaperdir=\"$kde_wallpaperdir\" \ + kde_templatesdir=\"$kde_templatesdir\" \ + kde_bindir=\"$kde_bindir\" \ + kde_servicesdir=\"$kde_servicesdir\" \ + kde_servicetypesdir=\"$kde_servicetypesdir\" \ + kde_moduledir=\"$kde_moduledir\" \ + kde_result=$1" +]) + +AC_DEFUN(KDE_SET_DEFAULT_PATHS, +[ +if test "$1" = "default"; then + + if test -z "$kde_htmldir"; then + kde_htmldir='\${prefix}/share/doc/HTML' + fi + if test -z "$kde_appsdir"; then + kde_appsdir='\${prefix}/share/applnk' + fi + if test -z "$kde_icondir"; then + kde_icondir='\${prefix}/share/icons' + fi + if test -z "$kde_sounddir"; then + kde_sounddir='\${prefix}/share/sounds' + fi + if test -z "$kde_datadir"; then + kde_datadir='\${prefix}/share/apps' + fi + if test -z "$kde_locale"; then + kde_locale='\${prefix}/share/locale' + fi + if test -z "$kde_cgidir"; then + kde_cgidir='\${exec_prefix}/cgi-bin' + fi + if test -z "$kde_confdir"; then + kde_confdir='\${prefix}/share/config' + fi + if test -z "$kde_mimedir"; then + kde_mimedir='\${prefix}/share/mimelnk' + fi + if test -z "$kde_toolbardir"; then + kde_toolbardir='\${prefix}/share/toolbar' + fi + if test -z "$kde_wallpaperdir"; then + kde_wallpaperdir='\${prefix}/share/wallpapers' + fi + if test -z "$kde_templatesdir"; then + kde_templatesdir='\${prefix}/share/templates' + fi + if test -z "$kde_bindir"; then + kde_bindir='\${exec_prefix}/bin' + fi + if test -z "$kde_servicesdir"; then + kde_servicesdir='\${prefix}/share/services' + fi + if test -z "$kde_servicetypesdir"; then + kde_servicetypesdir='\${prefix}/share/servicetypes' + fi + if test -z "$kde_moduledir"; then + kde_moduledir='\${exec_prefix}/lib/kde2' + fi + + KDE_SET_PATHS(defaults) + +else + + if test $kde_qtver = 1; then + AC_MSG_RESULT([compiling]) + KDE_1_CHECK_PATHS + else + AC_MSG_ERROR([path checking not yet supported for KDE 2]) + fi + +fi +]) + +AC_DEFUN(KDE_CHECK_PATHS_FOR_COMPLETENESS, +[ if test -z "$kde_htmldir" || test -z "$kde_appsdir" || + test -z "$kde_icondir" || test -z "$kde_sounddir" || + test -z "$kde_datadir" || test -z "$kde_locale" || + test -z "$kde_cgidir" || test -z "$kde_confdir" || + test -z "$kde_mimedir" || test -z "$kde_toolbardir" || + test -z "$kde_wallpaperdir" || test -z "$kde_templatesdir" || + test -z "$kde_bindir" || test -z "$kde_servicesdir" || + test -z "$kde_servicetypesdir" || test -z "$kde_moduledir" || + test "$kde_have_all_paths" != "yes"; then + kde_have_all_paths=no + fi +]) + +AC_DEFUN(KDE_MISSING_PROG_ERROR, +[ + AC_MSG_ERROR([The important program $1 was not found! +Please check whether you installed KDE correctly. +]) +]) + +AC_DEFUN(KDE_SUBST_PROGRAMS, +[ + + kde_default_bindirs="/usr/bin /usr/local/bin /opt/local/bin /usr/X11R6/bin /opt/kde/bin /opt/kde2/bin /usr/kde/bin /usr/local/kde/bin" + if test -n "$KDEDIRS"; then + kde_save_IFS=$IFS + IFS=: + for dir in $KDEDIRS; do + kde_default_bindirs="$dir/bin $kde_default_bindirs " + done + IFS=$kde_save_IFS + fi + kde_default_bindirs="$exec_prefix/bin $prefix/bin $kde_default_bindirs" + KDE_FIND_PATH(dcopidl, DCOPIDL, [$kde_default_bindirs], [KDE_MISSING_PROG_ERROR(dcopidl)]) + KDE_FIND_PATH(dcopidl2cpp, DCOPIDL2CPP, [$kde_default_bindirs], [KDE_MISSING_PROG_ERROR(dcopidl2cpp)]) + KDE_FIND_PATH(mcopidl, MCOPIDL, [$kde_default_bindirs], [KDE_MISSING_PROG_ERROR(mcopidl)]) + KDE_FIND_PATH(artsc-config, ARTSCCONFIG, [$kde_default_bindirs], [KDE_MISSING_PROG_ERROR(artsc-config)]) + KDE_FIND_PATH(kde-config, KDECONFIG, [$kde_default_bindirs]) + KDE_FIND_PATH(meinproc, MEINPROC, [$kde_default_bindirs]) + + if test -n "$MEINPROC" && test ! "$MEINPROC" = "compiled"; then + kde_sharedirs="/usr/share/kde /usr/local/share /usr/share /opt/kde2/share /opt/kde/share $prefix/share" + test -n "$KDEDIR" && kde_sharedirs="$KDEDIR/share $kde_sharedirs" + AC_FIND_FILE(apps/ksgmltools2/customization/kde-chunk.xsl, $kde_sharedirs, KDE_XSL_STYLESHEET) + if test "$KDE_XSL_STYLESHEET" = "NO"; then + KDE_XSL_STYLESHEET="" + else + KDE_XSL_STYLESHEET="$KDE_XSL_STYLESHEET/apps/ksgmltools2/customization/kde-chunk.xsl" + fi + fi + + DCOP_DEPENDENCIES='$(DCOPIDL)' + AC_SUBST(DCOPIDL) + AC_SUBST(DCOPIDL2CPP) + AC_SUBST(DCOP_DEPENDENCIES) + AC_SUBST(MCOPIDL) + AC_SUBST(ARTSCCONFIG) + AC_SUBST(KDECONFIG) + AC_SUBST(MEINPROC) + AC_SUBST(KDE_XSL_STYLESHEET) + + if test -x "$KDECONFIG"; then # it can be "compiled" + kde_libs_prefix=`$KDECONFIG --prefix` + if test -z "$kde_libs_prefix" || test ! -x "$kde_libs_prefix"; then + AC_MSG_ERROR([$KDECONFIG --prefix outputed the non existant prefix '$kde_libs_prefix' for kdelibs. + This means it has been moved since you installed it. + This won't work. Please recompile kdelibs for the new prefix. + ]) + fi + kde_libs_htmldir=`$KDECONFIG --install html --expandvars` + else + kde_libs_prefix='$(prefix)' + kde_libs_htmldir='$(kde_htmldir)' + fi + AC_SUBST(kde_libs_prefix) + AC_SUBST(kde_libs_htmldir) +])dnl + +AC_DEFUN(AC_CREATE_KFSSTND, +[ +AC_REQUIRE([AC_CHECK_RPATH]) + +AC_MSG_CHECKING([for KDE paths]) +kde_result="" +kde_cached_paths=yes +AC_CACHE_VAL(kde_cv_all_paths, +[ + KDE_SET_DEFAULT_PATHS($1) + kde_cached_paths=no +]) +eval "$kde_cv_all_paths" +KDE_CHECK_PATHS_FOR_COMPLETENESS +if test "$kde_have_all_paths" = "no" && test "$kde_cached_paths" = "yes"; then + # wrong values were cached, may be, we can set better ones + kde_result= + kde_htmldir= kde_appsdir= kde_icondir= kde_sounddir= + kde_datadir= kde_locale= kde_cgidir= kde_confdir= + kde_mimedir= kde_toolbardir= kde_wallpaperdir= kde_templatesdir= + kde_bindir= kde_servicesdir= kde_servicetypesdir= kde_moduledir= + kde_have_all_paths= + KDE_SET_DEFAULT_PATHS($1) + eval "$kde_cv_all_paths" + KDE_CHECK_PATHS_FOR_COMPLETENESS + kde_result="$kde_result (cache overridden)" +fi +if test "$kde_have_all_paths" = "no"; then + AC_MSG_ERROR([configure could not run a little KDE program to test the environment. +Since it had compiled and linked before, it must be a strange problem on your system. +Look at config.log for details. If you are not able to fix this, look at +http://www.kde.org/faq/installation.html or any www.kde.org mirror. +(If you're using an egcs version on Linux, you may update binutils!) +]) +else + rm -f conftest* + AC_MSG_RESULT($kde_result) +fi + +bindir=$kde_bindir + +KDE_SUBST_PROGRAMS + +]) + +AC_DEFUN(AC_SUBST_KFSSTND, +[ +AC_SUBST(kde_htmldir) +AC_SUBST(kde_appsdir) +AC_SUBST(kde_icondir) +AC_SUBST(kde_sounddir) +AC_SUBST(kde_datadir) +AC_SUBST(kde_locale) +AC_SUBST(kde_confdir) +AC_SUBST(kde_mimedir) +AC_SUBST(kde_wallpaperdir) +AC_SUBST(kde_bindir) +dnl for KDE 2 +AC_SUBST(kde_templatesdir) +AC_SUBST(kde_servicesdir) +AC_SUBST(kde_servicetypesdir) +AC_SUBST(kde_moduledir) +if test "$kde_qtver" = 1; then + kde_minidir="$kde_icondir/mini" +else +# for KDE 1 - this breaks KDE2 apps using minidir, but +# that's the plan ;-/ + kde_minidir="/dev/null" +fi +dnl AC_SUBST(kde_minidir) +dnl AC_SUBST(kde_cgidir) +dnl AC_SUBST(kde_toolbardir) +]) + +AC_DEFUN(KDE_MISC_TESTS, +[ + AC_LANG_C + dnl Checks for libraries. + AC_CHECK_LIB(util, main, [LIBUTIL="-lutil"]) dnl for *BSD + AC_SUBST(LIBUTIL) + AC_CHECK_LIB(compat, main, [LIBCOMPAT="-lcompat"]) dnl for *BSD + AC_SUBST(LIBCOMPAT) + kde_have_crypt= + AC_CHECK_LIB(crypt, crypt, [LIBCRYPT="-lcrypt"; kde_have_crypt=yes], + AC_CHECK_LIB(c, crypt, [kde_have_crypt=yes], [ + AC_MSG_WARN([you have no crypt in either libcrypt or libc. +You should install libcrypt from another source or configure with PAM +support]) + kde_have_crypt=no + ])) + AC_SUBST(LIBCRYPT) + if test $kde_have_crypt = yes; then + AC_DEFINE_UNQUOTED(HAVE_CRYPT, 1, [Defines if your system has the crypt function]) + fi + AC_CHECK_SOCKLEN_T + AC_LANG_C + AC_CHECK_LIB(dnet, dnet_ntoa, [X_EXTRA_LIBS="$X_EXTRA_LIBS -ldnet"]) + if test $ac_cv_lib_dnet_dnet_ntoa = no; then + AC_CHECK_LIB(dnet_stub, dnet_ntoa, + [X_EXTRA_LIBS="$X_EXTRA_LIBS -ldnet_stub"]) + fi + AC_CHECK_FUNC(inet_ntoa) + if test $ac_cv_func_inet_ntoa = no; then + AC_CHECK_LIB(nsl, inet_ntoa, X_EXTRA_LIBS="$X_EXTRA_LIBS -lnsl") + fi + AC_CHECK_FUNC(connect) + if test $ac_cv_func_connect = no; then + AC_CHECK_LIB(socket, connect, X_EXTRA_LIBS="-lsocket $X_EXTRA_LIBS", , + $X_EXTRA_LIBS) + fi + + AC_CHECK_FUNC(remove) + if test $ac_cv_func_remove = no; then + AC_CHECK_LIB(posix, remove, X_EXTRA_LIBS="$X_EXTRA_LIBS -lposix") + fi + + # BSDI BSD/OS 2.1 needs -lipc for XOpenDisplay. + AC_CHECK_FUNC(shmat, , + AC_CHECK_LIB(ipc, shmat, X_EXTRA_LIBS="$X_EXTRA_LIBS -lipc")) + + # Solaris 2.6 and others need -lresolv for res_init + AC_CHECK_FUNCS(res_init, , [ + kde_libs_safe="$LIBS" + LIBS="$LIBS $X_EXTRA_LIBS -lresolv" + AC_TRY_LINK( +[ +#include +], +[ +res_init(); +], + LIBRESOLV="-lresolv" + X_EXTRA_LIBS="$X_EXTRA_LIBS $LIBRESOLV" + AC_DEFINE(HAVE_RES_INIT, 1, [Define if you have the res_init function]) + ) + LIBS=$kde_libs_safe + ]) + + LIBSOCKET="$X_EXTRA_LIBS" + AC_SUBST(LIBSOCKET) + AC_SUBST(LIBRESOLV) + AC_SUBST(X_EXTRA_LIBS) + AC_CHECK_LIB(ucb, killpg, [LIBUCB="-lucb"]) dnl for Solaris2.4 + AC_SUBST(LIBUCB) + + case $host in dnl this *is* LynxOS specific + *-*-lynxos* ) + AC_MSG_CHECKING([LynxOS header file wrappers]) + [CFLAGS="$CFLAGS -D__NO_INCLUDE_WARN__"] + AC_MSG_RESULT(disabled) + AC_CHECK_LIB(bsd, gethostbyname, [LIBSOCKET="-lbsd"]) dnl for LynxOS + ;; + esac + + KDE_CHECK_TYPES + KDE_CHECK_LIBDL +]) + +dnl ------------------------------------------------------------------------ +dnl Find the header files and libraries for X-Windows. Extended the +dnl macro AC_PATH_X +dnl ------------------------------------------------------------------------ +dnl +AC_DEFUN(K_PATH_X, +[ +AC_REQUIRE([AC_PROG_CPP])dnl +AC_REQUIRE([KDE_MISC_TESTS])dnl +AC_MSG_CHECKING(for X) +AC_LANG_SAVE +AC_LANG_C +AC_CACHE_VAL(kde_cv_have_x, +[# One or both of the vars are not set, and there is no cached value. +if test "{$x_includes+set}" = set || test "$x_includes" = NONE; then + kde_x_includes=NO +else + kde_x_includes=$x_includes +fi +if test "{$x_libraries+set}" = set || test "$x_libraries" = NONE; then + kde_x_libraries=NO +else + kde_x_libraries=$x_libraries +fi + +# below we use the standard autoconf calls +ac_x_libraries=$kde_x_libraries +ac_x_includes=$kde_x_includes + +_AC_PATH_X_DIRECT +dnl AC_PATH_X_XMKMF picks /usr/lib as the path for the X libraries. +dnl Unfortunately, if compiling with the N32 ABI, this is not the correct +dnl location. The correct location is /usr/lib32 or an undefined value +dnl (the linker is smart enough to pick the correct default library). +dnl Things work just fine if you use just AC_PATH_X_DIRECT. +dnl Solaris has a similar problem. AC_PATH_X_XMKMF forces x_includes to +dnl /usr/openwin/include, which doesn't work. /usr/include does work, so +dnl x_includes should be left alone. +case "$host" in +mips-sgi-irix6*) + ;; +*-*-solaris*) + ;; +*) + _AC_PATH_X_XMKMF + if test -z "$ac_x_includes"; then + ac_x_includes="." + fi + if test -z "$ac_x_libraries"; then + ac_x_libraries="/usr/lib" + fi +esac +#from now on we use our own again + +# when the user already gave --x-includes, we ignore +# what the standard autoconf macros told us. +if test "$kde_x_includes" = NO; then + kde_x_includes=$ac_x_includes +fi + +# for --x-libraries too +if test "$kde_x_libraries" = NO; then + kde_x_libraries=$ac_x_libraries +fi + +if test "$kde_x_includes" = NO; then + AC_MSG_ERROR([Can't find X includes. Please check your installation and add the correct paths!]) +fi + +if test "$kde_x_libraries" = NO; then + AC_MSG_ERROR([Can't find X libraries. Please check your installation and add the correct paths!]) +fi + +# Record where we found X for the cache. +kde_cv_have_x="have_x=yes \ + kde_x_includes=$kde_x_includes kde_x_libraries=$kde_x_libraries" +])dnl + +eval "$kde_cv_have_x" + +if test "$have_x" != yes; then + AC_MSG_RESULT($have_x) + no_x=yes +else + AC_MSG_RESULT([libraries $kde_x_libraries, headers $kde_x_includes]) +fi + +if test -z "$kde_x_includes" || test "x$kde_x_includes" = xNONE; then + X_INCLUDES="" + x_includes="."; dnl better than nothing :- + else + x_includes=$kde_x_includes + X_INCLUDES="-I$x_includes" +fi + +if test -z "$kde_x_libraries" || test "x$kde_x_libraries" = xNONE; then + X_LDFLAGS="" + x_libraries="/usr/lib"; dnl better than nothing :- + else + x_libraries=$kde_x_libraries + X_LDFLAGS="-L$x_libraries" +fi +all_includes="$X_INCLUDES" +all_libraries="$X_LDFLAGS" + +AC_SUBST(X_INCLUDES) +AC_SUBST(X_LDFLAGS) +AC_SUBST(x_libraries) +AC_SUBST(x_includes) + +# Check for libraries that X11R6 Xt/Xaw programs need. +ac_save_LDFLAGS="$LDFLAGS" +LDFLAGS="$LDFLAGS $X_LDFLAGS" +# SM needs ICE to (dynamically) link under SunOS 4.x (so we have to +# check for ICE first), but we must link in the order -lSM -lICE or +# we get undefined symbols. So assume we have SM if we have ICE. +# These have to be linked with before -lX11, unlike the other +# libraries we check for below, so use a different variable. +# --interran@uluru.Stanford.EDU, kb@cs.umb.edu. +AC_CHECK_LIB(ICE, IceConnectionNumber, + [LIBSM="-lSM -lICE"], , $X_EXTRA_LIBS) +AC_SUBST(LIBSM) +LDFLAGS="$ac_save_LDFLAGS" + +AC_SUBST(X_PRE_LIBS) + +LIB_X11='-lX11 $(LIBSOCKET)' +AC_SUBST(LIB_X11) + +AC_MSG_CHECKING(for libXext) +AC_CACHE_VAL(kde_cv_have_libXext, +[ +kde_ldflags_safe="$LDFLAGS" +kde_libs_safe="$LIBS" + +LDFLAGS="$LDFLAGS $X_LDFLAGS $USER_LDFLAGS" +LIBS="-lXext -lX11 $LIBSOCKET" + +AC_TRY_LINK([ +#include +#ifdef STDC_HEADERS +# include +#endif +], +[ +printf("hello Xext\n"); +], +kde_cv_have_libXext=yes, +kde_cv_have_libXext=no + ) + +LDFLAGS=$kde_ldflags_safe +LIBS=$kde_libs_safe + ]) + +AC_MSG_RESULT($kde_cv_have_libXext) + +if test "$kde_cv_have_libXext" = "no"; then + AC_MSG_ERROR([We need a working libXext to proceed. Since configure +can't find it itself, we stop here assuming that make wouldn't find +them either.]) +fi + +AC_MSG_CHECKING(for Xinerama) + + AC_ARG_WITH(xinerama, + [ --with-xinerama enable support for Xinerama ], + [ + no_xinerama=no + ], [ + no_xinerama=yes + ] +) + +kde_save_LDFLAGS="$LDFLAGS" +kde_save_CFLAGS="$CFLAGS" +kde_save_LIBS="$LIBS" +LDFLAGS="$LDFLAGS $X_LDFLAGS $USER_LDFLAGS" +CFLAGS="$CFLAGS -I$x_includes" +LIBS="-lXinerama -lXext" + +if test "x$no_xinerama" = "xno"; then + + AC_CACHE_VAL(ac_cv_have_xinerama, + [ + AC_TRY_LINK([#include + #include ], + [XineramaIsActive(NULL);], + [ac_cv_have_xinerama="yes"], + [ac_cv_have_xinerama="no"]) + ]) +else + ac_cv_have_xinerama=no; +fi + +AC_MSG_RESULT($ac_cv_have_xinerama) + +LIBXINERAMA="" + +if test "$ac_cv_have_xinerama" = "yes"; then + AC_DEFINE(HAVE_XINERAMA, 1, [Define if you want Xinerama support]) + LIBXINERAMA="-lXinerama" +fi + +AC_SUBST(LIBXINERAMA) + +LDFLAGS="$kde_save_LDFLAGS" +CFLAGS="$kde_save_CFLAGS" +LIBS="$kde_save_LIBS" + +AC_LANG_RESTORE + +]) + +AC_DEFUN(KDE_PRINT_QT_PROGRAM, +[ +AC_REQUIRE([KDE_USE_QT]) +cat > conftest.$ac_ext < +#include +EOF +if test "$kde_qtver" = "2"; then +cat >> conftest.$ac_ext < +#include +#include +EOF + +if test $kde_qtsubver -gt 0; then +cat >> conftest.$ac_ext < +EOF +fi + +fi + +echo "#if ! ($kde_qt_verstring)" >> conftest.$ac_ext +cat >> conftest.$ac_ext <> conftest.$ac_ext <> conftest.$ac_ext <> conftest.$ac_ext <&AC_FD_CC + cat conftest.$ac_ext >&AC_FD_CC +fi + +rm -f conftest* +CXXFLAGS="$ac_cxxflags_safe" +LDFLAGS="$ac_ldflags_safe" +LIBS="$ac_libs_safe" + +LD_LIBRARY_PATH="$ac_LD_LIBRARY_PATH_safe" +export LD_LIBRARY_PATH +LIBRARY_PATH="$ac_LIBRARY_PATH" +export LIBRARY_PATH +AC_LANG_RESTORE +]) + +if test "$kde_cv_qt_direct" = "yes"; then + AC_MSG_RESULT(yes) + $1 +else + AC_MSG_RESULT(no) + $2 +fi +]) + +dnl ------------------------------------------------------------------------ +dnl Try to find the Qt headers and libraries. +dnl $(QT_LDFLAGS) will be -Lqtliblocation (if needed) +dnl and $(QT_INCLUDES) will be -Iqthdrlocation (if needed) +dnl ------------------------------------------------------------------------ +dnl +AC_DEFUN(AC_PATH_QT_1_3, +[ +AC_REQUIRE([K_PATH_X]) +AC_REQUIRE([KDE_USE_QT]) + +dnl ------------------------------------------------------------------------ +dnl Add configure flag to enable linking to MT version of Qt library. +dnl ------------------------------------------------------------------------ + +AC_ARG_ENABLE( + mt, + [ --enable-mt link to threaded Qt (experimental)], + kde_use_qt_mt=$enableval, + kde_use_qt_mt=no +) + +USING_QT_MT="" + +dnl ------------------------------------------------------------------------ +dnl If we got --enable-qt-mt then adjust some vars for the host. +dnl ------------------------------------------------------------------------ + +if test "x$kde_use_qt_mt" = "xyes"; then + + case $host in + *-*-linux-* | *-*-kfreebsd*-gnu) + if test "x$GCC" = "xyes"; then + CPPFLAGS="$CPPFLAGS -DQT_THREAD_SUPPORT -pthread" + X_EXTRA_LIBS="$X_EXTRA_LIBS -pthread" + else + AC_MSG_WARN([Compiler is not gcc. MT support disabled.]) + fi + ;; + *) + AC_MSG_WARN([MT not yet supported on $host - disabled.]) + ;; + esac + +fi + +kde_qt_was_given=yes + +dnl ------------------------------------------------------------------------ +dnl If we haven't been told how to link to Qt, we work it out for ourselves. +dnl ------------------------------------------------------------------------ + +if test -z "$LIBQT_GLOB"; then + + LIBQT_GLOB="libqt.*" + +fi + +if test -z "$LIBQT"; then + + LIBQT="-lqt" + kde_int_qt="-lqt" + +dnl ------------------------------------------------------------------------ +dnl If we got --enable-qt-mt then adjust the Qt library name for the host. +dnl ------------------------------------------------------------------------ + + if test "x$kde_use_qt_mt" = "xyes"; then + + case $host in + *-*-linux-* | *-*-kfreebsd*-gnu) + if test "x$GCC" = "xyes"; then + LIBQT="-lqt-mt" + kde_int_qt="-lqt-mt" + LIBQT_GLOB="libqt-mt.*" + USING_QT_MT="using -mt" + fi + ;; + esac + fi + + kde_qt_was_given=no + +else + kde_int_qt="$LIBQT" +fi + +if test $kde_qtver = 2; then + + AC_REQUIRE([AC_FIND_PNG]) + AC_REQUIRE([AC_FIND_JPEG]) + LIBQT="$LIBQT $LIBPNG $LIBJPEG" +fi + +AC_MSG_CHECKING([for Qt]) + +LIBQT="$LIBQT $X_PRE_LIBS -lXext -lX11 $LIBSM $LIBSOCKET" +ac_qt_includes=NO ac_qt_libraries=NO ac_qt_bindir=NO +qt_libraries="" +qt_includes="" +AC_ARG_WITH(qt-dir, + [ --with-qt-dir=DIR where the root of Qt is installed ], + [ ac_qt_includes="$withval"/include + ac_qt_libraries="$withval"/lib + ac_qt_bindir="$withval"/bin + ]) + +AC_ARG_WITH(qt-includes, + [ --with-qt-includes=DIR where the Qt includes are. ], + [ + ac_qt_includes="$withval" + ]) + +kde_qt_libs_given=no + +AC_ARG_WITH(qt-libraries, + [ --with-qt-libraries=DIR where the Qt library is installed.], + [ ac_qt_libraries="$withval" + kde_qt_libs_given=yes + ]) + +AC_CACHE_VAL(ac_cv_have_qt, +[#try to guess Qt locations + +qt_incdirs="" +for dir in $kde_qt_dirs; do + qt_incdirs="$qt_incdirs $dir/include $dir" +done +qt_incdirs="$QTINC $qt_incdirs /usr/local/qt/include /usr/include/qt /usr/include /usr/X11R6/include/X11/qt /usr/X11R6/include/qt /usr/X11R6/include/qt2 $x_includes" +if test ! "$ac_qt_includes" = "NO"; then + qt_incdirs="$ac_qt_includes $qt_incdirs" +fi + +if test "$kde_qtver" = "2"; then + kde_qt_header=qstyle.h +else + kde_qt_header=qglobal.h +fi + +AC_FIND_FILE($kde_qt_header, $qt_incdirs, qt_incdir) +ac_qt_includes="$qt_incdir" + +qt_libdirs="" +for dir in $kde_qt_dirs; do + qt_libdirs="$qt_libdirs $dir/lib $dir" +done +qt_libdirs="$QTLIB $qt_libdirs /usr/X11R6/lib /usr/lib /usr/local/qt/lib $x_libraries" +if test ! "$ac_qt_libraries" = "NO"; then + qt_libdir=$ac_qt_libraries +else + qt_libdirs="$ac_qt_libraries $qt_libdirs" + # if the Qt was given, the chance is too big that libqt.* doesn't exist + qt_libdir=NONE + for dir in $qt_libdirs; do + try="ls -1 $dir/${LIBQT_GLOB}" + if test -n "`$try 2> /dev/null`"; then qt_libdir=$dir; break; else echo "tried $dir" >&AC_FD_CC ; fi + done +fi + +ac_qt_libraries="$qt_libdir" + +AC_LANG_SAVE +AC_LANG_CPLUSPLUS + +ac_cxxflags_safe="$CXXFLAGS" +ac_ldflags_safe="$LDFLAGS" +ac_libs_safe="$LIBS" + +CXXFLAGS="$CXXFLAGS -I$qt_incdir $all_includes" +LDFLAGS="$LDFLAGS -L$qt_libdir $all_libraries $USER_LDFLAGS" +LIBS="$LIBS $LIBQT" + +KDE_PRINT_QT_PROGRAM + +if AC_TRY_EVAL(ac_link) && test -s conftest; then + rm -f conftest* +else + echo "configure: failed program was:" >&AC_FD_CC + cat conftest.$ac_ext >&AC_FD_CC + ac_qt_libraries="NO" +fi +rm -f conftest* +CXXFLAGS="$ac_cxxflags_safe" +LDFLAGS="$ac_ldflags_safe" +LIBS="$ac_libs_safe" + +AC_LANG_RESTORE +if test "$ac_qt_includes" = NO || test "$ac_qt_libraries" = NO; then + ac_cv_have_qt="have_qt=no" + ac_qt_notfound="" + if test "$ac_qt_includes" = NO; then + if test "$ac_qt_libraries" = NO; then + ac_qt_notfound="(headers and libraries)"; + else + ac_qt_notfound="(headers)"; + fi + else + ac_qt_notfound="(libraries)"; + fi + + AC_MSG_ERROR([Qt ($kde_qt_minversion) $ac_qt_notfound not found. Please check your installation! +For more details about this problem, look at the end of config.log.]) +else + have_qt="yes" +fi +]) + +eval "$ac_cv_have_qt" + +if test "$have_qt" != yes; then + AC_MSG_RESULT([$have_qt]); +else + ac_cv_have_qt="have_qt=yes \ + ac_qt_includes=$ac_qt_includes ac_qt_libraries=$ac_qt_libraries" + AC_MSG_RESULT([libraries $ac_qt_libraries, headers $ac_qt_includes $USING_QT_MT]) + + qt_libraries="$ac_qt_libraries" + qt_includes="$ac_qt_includes" +fi + +if test ! "$kde_qt_libs_given" = "yes"; then +KDE_CHECK_QT_DIRECT(qt_libraries= ,[]) +fi + +AC_SUBST(qt_libraries) +AC_SUBST(qt_includes) + +if test "$qt_includes" = "$x_includes" || test -z "$qt_includes"; then + QT_INCLUDES=""; +else + QT_INCLUDES="-I$qt_includes" + all_includes="$QT_INCLUDES $all_includes" +fi + +if test "$qt_libraries" = "$x_libraries" || test -z "$qt_libraries"; then + QT_LDFLAGS="" +else + QT_LDFLAGS="-L$qt_libraries" + all_libraries="$all_libraries $QT_LDFLAGS" +fi + +AC_SUBST(QT_INCLUDES) +AC_SUBST(QT_LDFLAGS) +AC_PATH_QT_MOC_UIC + +LIB_QT="$kde_int_qt "'$(LIBPNG) $(LIBJPEG) -lXext $(LIB_X11) $(LIBSM)' +AC_SUBST(LIB_QT) + +]) + +AC_DEFUN(AC_PATH_QT, +[ +AC_PATH_QT_1_3 +]) + +AC_DEFUN(KDE_CHECK_FINAL, +[ + AC_ARG_ENABLE(final, [ --enable-final build size optimized apps (experimental - needs lots of memory)], + kde_use_final=$enableval, kde_use_final=no) + + KDE_COMPILER_REPO + if test "x$kde_use_final" = "xyes"; then + KDE_USE_FINAL_TRUE="" + KDE_USE_FINAL_FALSE="#" + else + KDE_USE_FINAL_TRUE="#" + KDE_USE_FINAL_FALSE="" + fi + AC_SUBST(KDE_USE_FINAL_TRUE) + AC_SUBST(KDE_USE_FINAL_FALSE) + + AC_ARG_ENABLE(closure, [ --disable-closure don't delay template instantiation], + kde_use_closure=$enableval, kde_use_closure=yes) + + if test "x$kde_use_closure" = "xyes"; then + KDE_USE_CLOSURE_TRUE="" + KDE_USE_CLOSURE_FALSE="#" +# CXXFLAGS="$CXXFLAGS $REPO" + else + KDE_USE_CLOSURE_TRUE="#" + KDE_USE_CLOSURE_FALSE="" + fi + AC_SUBST(KDE_USE_CLOSURE_TRUE) + AC_SUBST(KDE_USE_CLOSURE_FALSE) +]) + +dnl ------------------------------------------------------------------------ +dnl Now, the same with KDE +dnl $(KDE_LDFLAGS) will be the kdeliblocation (if needed) +dnl and $(kde_includes) will be the kdehdrlocation (if needed) +dnl ------------------------------------------------------------------------ +dnl +AC_DEFUN(AC_BASE_PATH_KDE, +[ +AC_PREREQ([2.13]) +AC_REQUIRE([AC_PATH_QT])dnl +AC_CHECK_RPATH +AC_MSG_CHECKING([for KDE]) + +if test "${prefix}" != NONE; then + kde_includes=${prefix}/include + ac_kde_includes=$prefix/include + + if test "${exec_prefix}" != NONE; then + kde_libraries=${exec_prefix}/lib + ac_kde_libraries=$exec_prefix/lib + else + kde_libraries=${prefix}/lib + ac_kde_libraries=$prefix/lib + fi +else + ac_kde_includes= + ac_kde_libraries= + kde_libraries="" + kde_includes="" +fi + +AC_CACHE_VAL(ac_cv_have_kde, +[#try to guess kde locations + +if test "$kde_qtver" = 1; then + kde_check_header="ksock.h" + kde_check_lib="libkdecore.la" +else + kde_check_header="ksharedptr.h" + kde_check_lib="libkio.la" +fi + +if test -z "$1"; then + +kde_incdirs="/usr/lib/kde/include /usr/local/kde/include /usr/local/include /usr/kde/include /usr/include/kde /usr/include /opt/kde2/include /opt/kde/include $x_includes $qt_includes" +test -n "$KDEDIR" && kde_incdirs="$KDEDIR/include $KDEDIR/include/kde $KDEDIR $kde_incdirs" +kde_incdirs="$ac_kde_includes $kde_incdirs" +AC_FIND_FILE($kde_check_header, $kde_incdirs, kde_incdir) +ac_kde_includes="$kde_incdir" + +if test -n "$ac_kde_includes" && test ! -r "$ac_kde_includes/$kde_check_header"; then + AC_MSG_ERROR([ +in the prefix, you've chosen, are no KDE headers installed. This will fail. +So, check this please and use another prefix!]) +fi + +kde_libdirs="/usr/lib/kde/lib /usr/local/kde/lib /usr/kde/lib /usr/lib/kde /usr/lib /usr/X11R6/lib /usr/local/lib /opt/kde2/lib /opt/kde/lib /usr/X11R6/kde/lib" +test -n "$KDEDIR" && kde_libdirs="$KDEDIR/lib $KDEDIR $kde_libdirs" +kde_libdirs="$ac_kde_libraries $kde_libdirs" +AC_FIND_FILE($kde_check_lib, $kde_libdirs, kde_libdir) +ac_kde_libraries="$kde_libdir" + +if test -n "$ac_kde_libraries" && test ! -r "$ac_kde_libraries/$kde_check_lib"; then +AC_MSG_ERROR([ +in the prefix, you've chosen, are no KDE libraries installed. This will fail. +So, check this please and use another prefix!]) +fi +ac_kde_libraries="$kde_libdir" + +if test "$ac_kde_includes" = NO || test "$ac_kde_libraries" = NO; then + ac_cv_have_kde="have_kde=no" +else + ac_cv_have_kde="have_kde=yes \ + ac_kde_includes=$ac_kde_includes ac_kde_libraries=$ac_kde_libraries" +fi + +else dnl test -z $1 + + ac_cv_have_kde="have_kde=no" + +fi +])dnl + +eval "$ac_cv_have_kde" + +if test "$have_kde" != "yes"; then + if test "${prefix}" = NONE; then + ac_kde_prefix="$ac_default_prefix" + else + ac_kde_prefix="$prefix" + fi + if test "$exec_prefix" = NONE; then + ac_kde_exec_prefix="$ac_kde_prefix" + AC_MSG_RESULT([will be installed in $ac_kde_prefix]) + else + ac_kde_exec_prefix="$exec_prefix" + AC_MSG_RESULT([will be installed in $ac_kde_prefix and $ac_kde_exec_prefix]) + fi + + kde_libraries="${ac_kde_exec_prefix}/lib" + kde_includes=${ac_kde_prefix}/include + +else + ac_cv_have_kde="have_kde=yes \ + ac_kde_includes=$ac_kde_includes ac_kde_libraries=$ac_kde_libraries" + AC_MSG_RESULT([libraries $ac_kde_libraries, headers $ac_kde_includes]) + + kde_libraries="$ac_kde_libraries" + kde_includes="$ac_kde_includes" +fi +AC_SUBST(kde_libraries) +AC_SUBST(kde_includes) + +if test "$kde_includes" = "$x_includes" || test "$kde_includes" = "$qt_includes" || test "$kde_includes" = "/usr/include"; then + KDE_INCLUDES="" +else + KDE_INCLUDES="-I$kde_includes" + all_includes="$KDE_INCLUDES $all_includes" +fi + +KDE_LDFLAGS="-L$kde_libraries" +if test ! "$kde_libraries" = "$x_libraries" && test ! "$kde_libraries" = "$qt_libraries" ; then + all_libraries="$all_libraries $KDE_LDFLAGS" +fi + +AC_SUBST(KDE_LDFLAGS) +AC_SUBST(KDE_INCLUDES) + +AC_REQUIRE([KDE_CHECK_EXTRA_LIBS]) + +all_libraries="$all_libraries $USER_LDFLAGS" +all_includes="$all_includes $USER_INCLUDES" +AC_SUBST(all_includes) +AC_SUBST(all_libraries) + +AC_SUBST(AUTODIRS) +]) + +AC_DEFUN(KDE_CHECK_EXTRA_LIBS, +[ +AC_MSG_CHECKING(for extra includes) +AC_ARG_WITH(extra-includes, [ --with-extra-includes=DIR + adds non standard include paths], + kde_use_extra_includes="$withval", + kde_use_extra_includes=NONE +) +kde_extra_includes= +if test -n "$kde_use_extra_includes" && \ + test "$kde_use_extra_includes" != "NONE"; then + + ac_save_ifs=$IFS + IFS=':' + for dir in $kde_use_extra_includes; do + kde_extra_includes="$kde_extra_includes $dir" + USER_INCLUDES="$USER_INCLUDES -I$dir" + done + IFS=$ac_save_ifs + kde_use_extra_includes="added" +else + kde_use_extra_includes="no" +fi +AC_SUBST(USER_INCLUDES) + +AC_MSG_RESULT($kde_use_extra_includes) + +kde_extra_libs= +AC_MSG_CHECKING(for extra libs) +AC_ARG_WITH(extra-libs, [ --with-extra-libs=DIR adds non standard library paths], + kde_use_extra_libs=$withval, + kde_use_extra_libs=NONE +) +if test -n "$kde_use_extra_libs" && \ + test "$kde_use_extra_libs" != "NONE"; then + + ac_save_ifs=$IFS + IFS=':' + for dir in $kde_use_extra_libs; do + kde_extra_libs="$kde_extra_libs $dir" + KDE_EXTRA_RPATH="$KDE_EXTRA_RPATH -R $dir" + USER_LDFLAGS="$USER_LDFLAGS -L$dir" + done + IFS=$ac_save_ifs + kde_use_extra_libs="added" +else + kde_use_extra_libs="no" +fi + +AC_SUBST(USER_LDFLAGS) + +AC_MSG_RESULT($kde_use_extra_libs) + +]) + +AC_DEFUN(KDE_1_CHECK_PATH_HEADERS, +[ + AC_MSG_CHECKING([for KDE headers installed]) + AC_LANG_SAVE + AC_LANG_CPLUSPLUS +cat > conftest.$ac_ext < +#endif +#include +#include "confdefs.h" +#include + +int main() { + printf("kde_htmldir=\\"%s\\"\n", KApplication::kde_htmldir().data()); + printf("kde_appsdir=\\"%s\\"\n", KApplication::kde_appsdir().data()); + printf("kde_icondir=\\"%s\\"\n", KApplication::kde_icondir().data()); + printf("kde_sounddir=\\"%s\\"\n", KApplication::kde_sounddir().data()); + printf("kde_datadir=\\"%s\\"\n", KApplication::kde_datadir().data()); + printf("kde_locale=\\"%s\\"\n", KApplication::kde_localedir().data()); + printf("kde_cgidir=\\"%s\\"\n", KApplication::kde_cgidir().data()); + printf("kde_confdir=\\"%s\\"\n", KApplication::kde_configdir().data()); + printf("kde_mimedir=\\"%s\\"\n", KApplication::kde_mimedir().data()); + printf("kde_toolbardir=\\"%s\\"\n", KApplication::kde_toolbardir().data()); + printf("kde_wallpaperdir=\\"%s\\"\n", + KApplication::kde_wallpaperdir().data()); + printf("kde_bindir=\\"%s\\"\n", KApplication::kde_bindir().data()); + printf("kde_partsdir=\\"%s\\"\n", KApplication::kde_partsdir().data()); + printf("kde_servicesdir=\\"/tmp/dummy\\"\n"); + printf("kde_servicetypesdir=\\"/tmp/dummy\\"\n"); + printf("kde_moduledir=\\"/tmp/dummy\\"\n"); + return 0; + } +EOF + + ac_compile='${CXX-g++} -c $CXXFLAGS $all_includes $CPPFLAGS conftest.$ac_ext' + if AC_TRY_EVAL(ac_compile); then + AC_MSG_RESULT(yes) + else + AC_MSG_ERROR([your system is not able to compile a small KDE application! +Check, if you installed the KDE header files correctly. +For more details about this problem, look at the end of config.log.]) + fi + + AC_LANG_RESTORE +]) + +AC_DEFUN(KDE_CHECK_KDEQTADDON, +[ +AC_MSG_CHECKING(for kde-qt-addon) +AC_CACHE_VAL(kde_cv_have_kdeqtaddon, +[ + kde_ldflags_safe="$LDFLAGS" + kde_libs_safe="$LIBS" + kde_cxxflags_safe="$CXXFLAGS" + + LIBS="-lkde-qt-addon $LIBQT $LIBS" + CXXFLAGS="$CXXFLAGS -I$prefix/include -I$prefix/include/kde $all_includes" + LDFLAGS="$LDFLAGS $all_libraries $USER_LDFLAGS" + + AC_TRY_LINK([ + #include + ], + [ + QDomDocument doc; + ], + kde_cv_have_kdeqtaddon=yes, + kde_cv_have_kdeqtaddon=no + ) + + LDFLAGS=$kde_ldflags_safe + LIBS=$kde_libs_safe + kde_cxxflags_safe="$CXXFLAGS" +]) + +AC_MSG_RESULT($kde_cv_have_kdeqtaddon) + +if test "$kde_cv_have_kdeqtaddon" = "no"; then + AC_MSG_ERROR([Can't find libkde-qt-addon. You need to install it first. +It is a separate package (and CVS module) named kde-qt-addon.]) +fi +]) + +AC_DEFUN(KDE_CHECK_KIMGIO, +[ + AC_REQUIRE([AC_BASE_PATH_KDE]) + AC_REQUIRE([KDE_CHECK_EXTRA_LIBS]) + AC_REQUIRE([AC_FIND_TIFF]) + AC_REQUIRE([AC_FIND_JPEG]) + AC_REQUIRE([AC_FIND_PNG]) + AC_REQUIRE([KDE_CREATE_LIBS_ALIASES]) + + if test "$1" = "existance"; then + AC_LANG_SAVE + AC_LANG_CPLUSPLUS + kde_save_LIBS="$LIBS" + LIBS="$LIBS $all_libraries $LIBJPEG $LIBTIFF $LIBPNG $LIBQT -lm" + AC_CHECK_LIB(kimgio, kimgioRegister, [ + LIBKIMGIO_EXISTS=yes],LIBKIMGIO_EXISTS=no) + LIBS="$kde_save_LIBS" + AC_LANG_RESTORE + else + LIBKIMGIO_EXISTS=yes + fi + + if test "$LIBKIMGIO_EXISTS" = "yes"; then + LIB_KIMGIO='-lkimgio' + else + LIB_KIMGIO='' + fi + AC_SUBST(LIB_KIMGIO) +]) + +AC_DEFUN(KDE_CREATE_LIBS_ALIASES, +[ + AC_REQUIRE([KDE_MISC_TESTS]) + AC_REQUIRE([KDE_CHECK_LIBDL]) + AC_REQUIRE([K_PATH_X]) + +if test $kde_qtver = 2; then + LIB_KDECORE='-lkdecore' + AC_SUBST(LIB_KDECORE) + LIB_KDEUI='-lkdeui' + AC_SUBST(LIB_KDEUI) + LIB_KFORMULA='-lkformula' + AC_SUBST(LIB_KFORMULA) + LIB_KIO='-lkio' + AC_SUBST(LIB_KIO) + LIB_KSYCOCA='-lksycoca' + AC_SUBST(LIB_KSYCOCA) + LIB_SMB='-lsmb' + AC_SUBST(LIB_SMB) + LIB_KFILE='-lkfile' + AC_SUBST(LIB_KFILE) + LIB_KAB='-lkab' + AC_SUBST(LIB_KAB) + LIB_KHTML='-lkhtml' + AC_SUBST(LIB_KHTML) + LIB_KSPELL='-lkspell' + AC_SUBST(LIB_KSPELL) + LIB_KPARTS='-lkparts' + AC_SUBST(LIB_KPARTS) + LIB_KWRITE='-lkwrite' + AC_SUBST(LIB_KWRITE) +else + LIB_KDECORE='-lkdecore -lXext $(LIB_QT)' + AC_SUBST(LIB_KDECORE) + LIB_KDEUI='-lkdeui $(LIB_KDECORE)' + AC_SUBST(LIB_KDEUI) + LIB_KFM='-lkfm $(LIB_KDECORE)' + AC_SUBST(LIB_KFM) + LIB_KFILE='-lkfile $(LIB_KFM) $(LIB_KDEUI)' + AC_SUBST(LIB_KFILE) + LIB_KAB='-lkab $(LIB_KIMGIO) $(LIB_KDECORE)' + AC_SUBST(LIB_KAB) +fi +]) + +AC_DEFUN(AC_PATH_KDE, +[ + AC_BASE_PATH_KDE + AC_ARG_ENABLE(path-check, [ --disable-path-check don't try to find out, where to install], + [ + if test "$enableval" = "no"; + then ac_use_path_checking="default" + else ac_use_path_checking="" + fi + ], + [ + if test "$kde_qtver" = 1; + then ac_use_path_checking="" + else ac_use_path_checking="default" + fi + ] + ) + + AC_CREATE_KFSSTND($ac_use_path_checking) + + AC_SUBST_KFSSTND + KDE_CREATE_LIBS_ALIASES +]) + +dnl obsolete +AC_DEFUN(AC_CHECK_SETENV, +[ + AC_OBSOLETE([$0], [; instead use AC_CHECK_FUNCS([setenv unsetenv])])dnl + AC_CHECK_FUNCS([setenv unsetenv]) +]) + +AC_DEFUN(AC_CHECK_GETDOMAINNAME, +[ +AC_MSG_CHECKING(for getdomainname) +AC_CACHE_VAL(ac_cv_func_getdomainname, +[ +AC_LANG_SAVE +AC_LANG_CPLUSPLUS +save_CXXFLAGS="$CXXFLAGS" +kde_safe_LIBS="$LIBS" +LIBS="$LIBS $X_EXTRA_LIBS" +if test "$GCC" = "yes"; then +CXXFLAGS="$CXXFLAGS -pedantic-errors" +fi +AC_TRY_COMPILE([ +#include +#include +], +[ +char buffer[200]; +getdomainname(buffer, 200); +], +ac_cv_func_getdomainname=yes, +ac_cv_func_getdomainname=no) +CXXFLAGS="$save_CXXFLAGS" +LIBS=$kde_safe_LIBS +AC_LANG_RESTORE +]) +AC_MSG_RESULT($ac_cv_func_getdomainname) + +AC_MSG_CHECKING([if getdomainname needs custom prototype]) +AC_CACHE_VAL(ac_cv_proto_getdomainname, +[ +AC_LANG_SAVE +AC_LANG_CPLUSPLUS +if eval "test \"`echo $ac_cv_func_getdomainname`\" = yes"; then + ac_cv_proto_getdomainname=no +else + kde_safe_libs=$LIBS + LIBS="$LIBS $X_EXTRA_LIBS" + AC_TRY_LINK([ +#include +#include + +extern "C" int getdomainname (char *, int); +], +[ +char buffer[200]; +getdomainname(buffer, 200); +], + ac_cv_func_getdomainname=yes + ac_cv_proto_getdomainname=yes, + AC_MSG_RESULT([fatal error]) + AC_MSG_ERROR([getdomainname unavailable])) +fi +LIBS=$kde_safe_libs +AC_LANG_RESTORE +]) +AC_MSG_RESULT($ac_cv_proto_getdomainname) + +if eval "test \"`echo $ac_cv_func_getdomainname`\" = yes"; then + AC_DEFINE(HAVE_GETDOMAINNAME, 1, [Define if you have getdomainname]) +fi +if eval "test \"`echo $ac_cv_proto_getdomainname`\" = no"; then + AC_DEFINE(HAVE_GETDOMAINNAME_PROTO, 1, + [Define if you have getdomainname prototype]) +fi + +]) + +AC_DEFUN(AC_CHECK_GETHOSTNAME, +[ + +AC_MSG_CHECKING([for gethostname]) +AC_CACHE_VAL(ac_cv_func_gethostname, +[ +AC_LANG_SAVE +AC_LANG_CPLUSPLUS +save_CXXFLAGS="$CXXFLAGS" +if test "$GCC" = "yes"; then +CXXFLAGS="$CXXFLAGS -pedantic-errors" +fi +AC_TRY_LINK([ +#include +#include +], +[ +char buffer[200]; +gethostname(buffer, 200); +], +ac_cv_func_gethostname=yes, +ac_cv_func_gethostname=no) +CXXFLAGS="$save_CXXFLAGS" +AC_LANG_RESTORE +]) +AC_MSG_RESULT($ac_cv_func_gethostname) + +AC_MSG_CHECKING([if gethostname needs custom prototype]) +AC_CACHE_VAL(ac_cv_proto_gethostname, +[ +AC_LANG_SAVE +AC_LANG_CPLUSPLUS +if eval "test \"`echo $ac_cv_func_gethostname`\" = yes"; then + ac_cv_proto_gethostname=no +else + AC_TRY_LINK([ +#include +#include + +extern "C" int gethostname (char *, int); +], +[ +char buffer[200]; +gethostname(buffer, 200); +], + ac_cv_func_gethostname=yes + ac_cv_proto_gethostname=yes, + AC_MSG_RESULT([fatal error]) + AC_MSG_ERROR(gethostname unavailable)) +fi +AC_LANG_RESTORE +]) +AC_MSG_RESULT($ac_cv_proto_gethostname) + +if eval "test \"`echo $ac_cv_proto_gethostname`\" = no"; then + AC_DEFINE(HAVE_GETHOSTNAME_PROTO, 1, + [Define if you have gethostname prototype]) +fi +if eval "test \"`echo $ac_cv_func_gethostname`\" = yes"; then + AC_DEFINE(HAVE_GETHOSTNAME, 1, [Define if you have gethostname]) +fi +]) + +AC_DEFUN(AC_CHECK_USLEEP, +[ +AC_MSG_CHECKING([for usleep]) +AC_CACHE_VAL(ac_cv_func_usleep, +[ +AC_LANG_SAVE +AC_LANG_CPLUSPLUS +ac_libs_safe="$LIBS" +LIBS="$LIBS $LIBUCB" +AC_TRY_LINK([ +#include +#include +], +[ +usleep(200); +], +ac_cv_func_usleep=yes, +ac_cv_func_usleep=no) +LIBS="$ac_libs_safe" +AC_LANG_RESTORE +]) +AC_MSG_RESULT($ac_cv_func_usleep) +if eval "test \"`echo $ac_cv_func_usleep`\" = yes"; then + AC_DEFINE(HAVE_USLEEP, 1, [Define if you have the usleep function]) +fi +]) + +AC_DEFUN(AC_CHECK_RANDOM, +[ +AC_MSG_CHECKING([for random]) +AC_CACHE_VAL(ac_cv_func_random, +[ +AC_LANG_SAVE +AC_LANG_CPLUSPLUS +ac_libs_safe="$LIBS" +LIBS="$LIBS $LIBUCB" +AC_TRY_LINK([ +#include +], +[ +random(); +], +ac_cv_func_random=yes, +ac_cv_func_random=no) +LIBS="$ac_libs_safe" +AC_LANG_RESTORE +]) +AC_MSG_RESULT($ac_cv_func_random) +if eval "test \"`echo $ac_cv_func_random`\" = yes"; then + AC_DEFINE(HAVE_RANDOM, 1, [Define if you have random]) +fi +]) + +AC_DEFUN(AC_FIND_GIF, + [AC_MSG_CHECKING([for giflib]) +AC_CACHE_VAL(ac_cv_lib_gif, +[ac_save_LIBS="$LIBS" +LIBS="$all_libraries -lgif -lX11 $LIBSOCKET" +AC_TRY_LINK(dnl +[ +#ifdef __cplusplus +extern "C" { +#endif +int GifLastError(void); +#ifdef __cplusplus +} +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +], + [return GifLastError();], + eval "ac_cv_lib_gif=yes", + eval "ac_cv_lib_gif=no") +LIBS="$ac_save_LIBS" +])dnl +if eval "test \"`echo $ac_cv_lib_gif`\" = yes"; then + AC_MSG_RESULT(yes) + AC_DEFINE_UNQUOTED(HAVE_LIBGIF, 1, [Define if you have libgif]) +else + AC_MSG_ERROR(You need giflib30. Please install the kdesupport package) +fi +]) + +AC_DEFUN(KDE_FIND_JPEG_HELPER, +[ +AC_MSG_CHECKING([for libjpeg$2]) +AC_CACHE_VAL(ac_cv_lib_jpeg_$1, +[ +AC_LANG_C +ac_save_LIBS="$LIBS" +LIBS="$all_libraries $USER_LDFLAGS -ljpeg$2 -lm" +ac_save_CFLAGS="$CFLAGS" +CFLAGS="$CFLAGS $all_includes $USER_INCLUDES" +AC_TRY_LINK( +[/* Override any gcc2 internal prototype to avoid an error. */ +struct jpeg_decompress_struct; +typedef struct jpeg_decompress_struct * j_decompress_ptr; +typedef int size_t; +#ifdef __cplusplus +extern "C" { +#endif + void jpeg_CreateDecompress(j_decompress_ptr cinfo, + int version, size_t structsize); +#ifdef __cplusplus +} +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +], + [jpeg_CreateDecompress(0L, 0, 0);], + eval "ac_cv_lib_jpeg_$1=-ljpeg$2", + eval "ac_cv_lib_jpeg_$1=no") +LIBS="$ac_save_LIBS" +CFLAGS="$ac_save_CFLAGS" +]) + +if eval "test ! \"`echo $ac_cv_lib_jpeg_$1`\" = no"; then + LIBJPEG="$ac_cv_lib_jpeg_$1" + AC_MSG_RESULT($ac_cv_lib_jpeg_$1) +else + AC_MSG_RESULT(no) + $3 +fi + +]) + +AC_DEFUN(AC_FIND_JPEG, +[ +dnl first look for libraries +KDE_FIND_JPEG_HELPER(6b, 6b, + KDE_FIND_JPEG_HELPER(normal, [], + [ + LIBJPEG= + ] + ) +) + +dnl then search the headers (can't use simply AC_TRY_xxx, as jpeglib.h +dnl requires system dependent includes loaded before it) +jpeg_incdirs="/usr/include /usr/local/include $kde_extra_includes" +AC_FIND_FILE(jpeglib.h, $jpeg_incdirs, jpeg_incdir) +test "x$jpeg_incdir" = xNO && jpeg_incdir= + +dnl if headers _and_ libraries are missing, this is no error, and we +dnl continue with a warning (the user will get no jpeg support in khtml) +dnl if only one is missing, it means a configuration error, but we still +dnl only warn +if test -n "$jpeg_incdir" && test -n "$LIBJPEG" ; then + AC_DEFINE_UNQUOTED(HAVE_LIBJPEG, 1, [Define if you have libjpeg]) +else + if test -n "$jpeg_incdir" || test -n "$LIBJPEG" ; then + AC_MSG_WARN([ +There is an installation error in jpeg support. You seem to have only one +of either the headers _or_ the libraries installed. You may need to either +provide correct --with-extra-... options, or the development package of +libjpeg6b. You can get a source package of libjpeg from http://www.ijg.org/ +Disabling JPEG support. +]) + else + AC_MSG_WARN([libjpeg not found. disable JPEG support.]) + fi + jpeg_incdir= + LIBJPEG= +fi + +AC_SUBST(LIBJPEG) +]) + +AC_DEFUN(AC_FIND_ZLIB, +[ +AC_REQUIRE([KDE_CHECK_EXTRA_LIBS]) +AC_MSG_CHECKING([for libz]) +AC_CACHE_VAL(ac_cv_lib_z, +[ +AC_LANG_C +kde_save_LIBS="$LIBS" +LIBS="$all_libraries $USER_LDFLAGS -lz $LIBSOCKET" +kde_save_CFLAGS="$CFLAGS" +CFLAGS="$CFLAGS $all_includes $USER_INCLUDES" +AC_TRY_LINK(dnl +[ +#include +], + [return (zlibVersion() == ZLIB_VERSION); ], + eval "ac_cv_lib_z='-lz'", + eval "ac_cv_lib_z=no") +LIBS="$kde_save_LIBS" +CFLAGS="$kde_save_CFLAGS" +])dnl +if test ! "$ac_cv_lib_z" = no; then + AC_DEFINE_UNQUOTED(HAVE_LIBZ, 1, [Define if you have libz]) + LIBZ="$ac_cv_lib_z" + AC_SUBST(LIBZ) + AC_MSG_RESULT($ac_cv_lib_z) +else + AC_MSG_ERROR(not found. Check your installation and look into config.log) + LIBZ="" + AC_SUBST(LIBZ) +fi +]) + +AC_DEFUN(KDE_TRY_TIFFLIB, +[ +AC_MSG_CHECKING([for libtiff $1]) + +AC_CACHE_VAL(kde_cv_libtiff_$1, +[ +AC_LANG_SAVE +AC_LANG_CPLUSPLUS +kde_save_LIBS="$LIBS" +LIBS="$all_libraries $USER_LDFLAGS -l$1 $LIBJPEG $LIBZ -lX11 $LIBSOCKET -lm" +kde_save_CXXFLAGS="$CXXFLAGS" +CXXFLAGS="$CXXFLAGS $all_includes $USER_INCLUDES" + +AC_TRY_LINK(dnl +[ +#include +], + [return (TIFFOpen( "", "r") == 0); ], +[ + kde_cv_libtiff_$1="-l$1 $LIBJPEG $LIBZ" +], [ + kde_cv_libtiff_$1=no +]) + +LIBS="$kde_save_LIBS" +CXXFLAGS="$kde_save_CXXFLAGS" +AC_LANG_RESTORE +]) + +if test "$kde_cv_libtiff_$1" = "no"; then + AC_MSG_RESULT(no) + LIBTIFF="" + $3 +else + LIBTIFF="$kde_cv_libtiff_$1" + AC_MSG_RESULT(yes) + AC_DEFINE_UNQUOTED(HAVE_LIBTIFF, 1, [Define if you have libtiff]) + $2 +fi + +]) + +AC_DEFUN(AC_FIND_TIFF, +[ +AC_REQUIRE([K_PATH_X]) +AC_REQUIRE([AC_FIND_ZLIB]) +AC_REQUIRE([AC_FIND_JPEG]) +AC_REQUIRE([KDE_CHECK_EXTRA_LIBS]) + +KDE_TRY_TIFFLIB(tiff, [], + KDE_TRY_TIFFLIB(tiff34)) + +AC_SUBST(LIBTIFF) +]) + + +AC_DEFUN(AC_FIND_PNG, +[ +AC_REQUIRE([KDE_CHECK_EXTRA_LIBS]) +AC_REQUIRE([AC_FIND_ZLIB]) +AC_MSG_CHECKING([for libpng]) +AC_CACHE_VAL(ac_cv_lib_png, +[ +kde_save_LIBS="$LIBS" +LIBS="$LIBS $all_libraries $USER_LDFLAGS -lpng $LIBZ -lm -lX11 $LIBSOCKET" +kde_save_CFLAGS="$CFLAGS" +CFLAGS="$CFLAGS $all_includes $USER_INCLUDES" +AC_LANG_C +AC_TRY_LINK(dnl + [ + #include + ], + [ + png_structp png_ptr = png_create_read_struct( /* image ptr */ + PNG_LIBPNG_VER_STRING, 0, 0, 0 ); + return( png_ptr != 0 ); + ], + eval "ac_cv_lib_png='-lpng $LIBZ -lm'", + eval "ac_cv_lib_png=no" +) +LIBS="$kde_save_LIBS" +CFLAGS="$kde_save_CFLAGS" +])dnl +if eval "test ! \"`echo $ac_cv_lib_png`\" = no"; then + AC_DEFINE_UNQUOTED(HAVE_LIBPNG, 1, [Define if you have libpng]) + LIBPNG="$ac_cv_lib_png" + AC_SUBST(LIBPNG) + AC_MSG_RESULT($ac_cv_lib_png) +else + AC_MSG_RESULT(no) + LIBPNG="" + AC_SUBST(LIBPNG) +fi +]) + +AC_DEFUN(AC_CHECK_BOOL, +[ + AC_DEFINE_UNQUOTED(HAVE_BOOL, 1, [You _must_ have bool]) +]) + +AC_DEFUN(AC_CHECK_GNU_EXTENSIONS, +[ +AC_MSG_CHECKING(if you need GNU extensions) +AC_CACHE_VAL(ac_cv_gnu_extensions, +[ +cat > conftest.c << EOF +#include + +#ifdef __GNU_LIBRARY__ +yes +#endif +EOF + +if (eval "$ac_cpp conftest.c") 2>&5 | + egrep "yes" >/dev/null 2>&1; then + rm -rf conftest* + ac_cv_gnu_extensions=yes +else + ac_cv_gnu_extensions=no +fi +]) + +AC_MSG_RESULT($ac_cv_gnu_extensions) +if test "$ac_cv_gnu_extensions" = "yes"; then + AC_DEFINE_UNQUOTED(_GNU_SOURCE, 1, [Define if you need to use the GNU extensions]) +fi +]) + +AC_DEFUN(KDE_CHECK_COMPILER_FLAG, +[ +dnl AC_REQUIRE([AC_CHECK_COMPILERS]) <- breaks with autoconf 2.50 +AC_MSG_CHECKING(whether $CXX supports -$1) +kde_cache=`echo $1 | sed 'y%.=/+-%___p_%'` +AC_CACHE_VAL(kde_cv_prog_cxx_$kde_cache, +[ +echo 'int main() { return 0; }' >conftest.cc +eval "kde_cv_prog_cxx_$kde_cache=no" +if test -z "`$CXX -$1 -c conftest.cc 2>&1`"; then + if test -z "`$CXX -$1 -o conftest conftest.o 2>&1`"; then + eval "kde_cv_prog_cxx_$kde_cache=yes" + fi +fi +rm -f conftest* +]) +if eval "test \"`echo '$kde_cv_prog_cxx_'$kde_cache`\" = yes"; then + AC_MSG_RESULT(yes) + : + $2 +else + AC_MSG_RESULT(no) + : + $3 +fi +]) + +dnl AC_REMOVE_FORBIDDEN removes forbidden arguments from variables +dnl use: AC_REMOVE_FORBIDDEN(CC, [-forbid -bad-option whatever]) +dnl it's all white-space separated +AC_DEFUN(AC_REMOVE_FORBIDDEN, +[ __val=$$1 + __forbid=" $2 " + if test -n "$__val"; then + __new="" + ac_save_IFS=$IFS + IFS=" " + for i in $__val; do + case "$__forbid" in + *" $i "*) AC_MSG_WARN([found forbidden $i in $1, removing it]) ;; + *) # Careful to not add spaces, where there were none, because otherwise + # libtool gets confused, if we change e.g. CXX + if test -z "$__new" ; then __new=$i ; else __new="$__new $i" ; fi ;; + esac + done + IFS=$ac_save_IFS + $1=$__new + fi +]) + +dnl AC_VALIDIFY_CXXFLAGS checks for forbidden flags the user may have given +AC_DEFUN(AC_VALIDIFY_CXXFLAGS, +[dnl + AC_REMOVE_FORBIDDEN(CXX, [-fno-rtti -rpath]) + AC_REMOVE_FORBIDDEN(CXXFLAGS, [-fno-rtti -rpath]) +]) + +AC_DEFUN(AC_CHECK_COMPILERS, +[ + AC_ARG_ENABLE(debug,[ --enable-debug enables debug symbols [default=no]], + [ + if test $enableval = "no"; dnl + then + kde_use_debug_code="no" + kde_use_debug_define=yes + else + kde_use_debug_code="yes" + kde_use_debug_define=no + fi + ], + [kde_use_debug_code="no" + kde_use_debug_define=no + ]) + + dnl Just for configure --help + AC_ARG_ENABLE(dummyoption,[ --disable-debug disables debug output and debug symbols [default=no]],[],[]) + + AC_ARG_ENABLE(strict,[ --enable-strict compiles with strict compiler options (may not work!)], + [ + if test $enableval = "no"; then + kde_use_strict_options="no" + else + kde_use_strict_options="yes" + fi + ], [kde_use_strict_options="no"]) + + AC_ARG_ENABLE(profile,[ --enable-profile creates profiling infos [default=no]], + [kde_use_profiling=$enableval], + [kde_use_profiling="no"] + ) + + dnl this prevents stupid AC_PROG_CC to add "-g" to the default CFLAGS + CFLAGS=" $CFLAGS" + + AC_PROG_CC + + if test "$GCC" = "yes"; then + if test "$kde_use_debug_code" = "yes"; then + CFLAGS="-g -O0 $CFLAGS" + case $host in + *-*-linux-gnu) + CFLAGS="-ansi -W -Wall -pedantic -Wshadow -Wpointer-arith -Wmissing-prototypes -Wwrite-strings -D_XOPEN_SOURCE=500 -D_BSD_SOURCE $CFLAGS" + ;; + esac + else + CFLAGS="-O0 $CFLAGS" + fi + fi + + if test "$kde_use_debug_define" = "yes"; then + CFLAGS="-DNDEBUG $CFLAGS" + fi + + case "$host" in + *-*-sysv4.2uw*) CFLAGS="-D_UNIXWARE $CFLAGS";; + *-*-sysv5uw7*) CFLAGS="-D_UNIXWARE7 $CFLAGS";; + esac + + if test -z "$LDFLAGS" && test "$kde_use_debug_code" = "no" && test "$GCC" = "yes"; then + LDFLAGS="" + fi + + CXXFLAGS=" $CXXFLAGS" + + AC_PROG_CXX + + if test "$GXX" = "yes"; then + if test "$kde_use_debug_code" = "yes"; then + CXXFLAGS="-g -O0 -Wall -pedantic -W -Wpointer-arith -Wmissing-prototypes -Wwrite-strings $CXXFLAGS" + + KDE_CHECK_COMPILER_FLAG(Wno-long-long,[CXXFLAGS="-Wno-long-long $CXXFLAGS"]) + KDE_CHECK_COMPILER_FLAG(Wnon-virtual-dtor,[CXXFLAGS="-Wnon-virtual-dtor $CXXFLAGS"]) + KDE_CHECK_COMPILER_FLAG(fno-builtin,[CXXFLAGS="-fno-builtin $CXXFLAGS"]) + + case $host in dnl + *-*-linux-gnu | *-*-kfreebsd*-gnu) + CXXFLAGS="-ansi -D_XOPEN_SOURCE=500 -D_BSD_SOURCE -Wbad-function-cast -Wcast-align -Wundef -Wconversion $CXXFLAGS" + ;; + esac + + if test "$kde_use_strict_options" = "yes"; then + CXXFLAGS="-Wcast-qual -Wbad-function-cast -Wshadow -Wcast-align $CXXFLAGS" + fi + + if test "$kde_very_strict" = "yes"; then + CXXFLAGS="-Wold-style-cast -Wredundant-decls -Wconversion $CXXFLAGS" + fi + else + CXXFLAGS="-O0 $CXXFLAGS" + fi + fi + + if test "$kde_use_debug_define" = "yes"; then + CXXFLAGS="-DNDEBUG $CXXFLAGS" + fi + + if test "$kde_use_profiling" = "yes"; then + KDE_CHECK_COMPILER_FLAG(pg, + [ + CFLAGS="-pg $CFLAGS" + CXXFLAGS="-pg $CXXFLAGS" + ]) + fi + + KDE_CHECK_COMPILER_FLAG(fno-exceptions,[CXXFLAGS="$CXXFLAGS -fno-exceptions"]) + KDE_CHECK_COMPILER_FLAG(fno-check-new, [CXXFLAGS="$CXXFLAGS -fno-check-new"]) + KDE_CHECK_COMPILER_FLAG(fexceptions, [USE_EXCEPTIONS="-fexceptions"], USE_EXCEPTIONS= ) + AC_SUBST(USE_EXCEPTIONS) + dnl obsolete macro - provided to keep things going + USE_RTTI= + AC_SUBST(USE_RTTI) + + case "$host" in + *-*-irix*) test "$GXX" = yes && CXXFLAGS="-D_LANGUAGE_C_PLUS_PLUS -D__LANGUAGE_C_PLUS_PLUS $CXXFLAGS" ;; + *-*-sysv4.2uw*) CXXFLAGS="-D_UNIXWARE $CXXFLAGS";; + *-*-sysv5uw7*) CXXFLAGS="-D_UNIXWARE7 $CXXFLAGS";; + *-*-solaris*) + if test "$GXX" = yes; then + libstdcpp=`$CXX -print-file-name=libstdc++.so` + if test ! -f $libstdcpp; then + AC_MSG_ERROR([You've compiled gcc without --enable-shared. This doesn't work with KDE. Please recompile gcc with --enable-shared to receive a libstdc++.so]) + fi + fi + ;; + esac + + AC_VALIDIFY_CXXFLAGS + + AC_PROG_CXXCPP + + # the following is to allow programs, that are known to + # have problems when compiled with -O2 + if test -n "$CXXFLAGS"; then + kde_safe_IFS=$IFS + IFS=" " + NOOPT_CXXFLAGS="" + for i in $CXXFLAGS; do + case $i in + -O*) + ;; + *) + NOOPT_CXXFLAGS="$NOOPT_CXXFLAGS $i" + ;; + esac + done + IFS=$kde_safe_IFS + fi + + AC_SUBST(NOOPT_CXXFLAGS) + + KDE_CHECK_FINAL + + ifdef([AM_DEPENDENCIES], AC_REQUIRE([KDE_ADD_DEPENDENCIES]), []) + + KDE_CXXFLAGS= + AC_SUBST(KDE_CXXFLAGS) +]) + +AC_DEFUN(KDE_ADD_DEPENDENCIES, +[ + [A]M_DEPENDENCIES(CC) + [A]M_DEPENDENCIES(CXX) +]) + +dnl just a wrapper to clean up configure.in +AC_DEFUN(KDE_PROG_LIBTOOL, +[ +AC_REQUIRE([AC_CHECK_COMPILERS]) +AC_REQUIRE([AC_ENABLE_SHARED]) +AC_REQUIRE([AC_ENABLE_STATIC]) + +AC_REQUIRE([AC_LIBTOOL_DLOPEN]) + +AC_LANG_SAVE +AC_LANG_C +AC_OBJEXT +AC_EXEEXT +AC_LANG_RESTORE + +AM_PROG_LIBTOOL +AC_LIBTOOL_CXX + +LIBTOOL_SHELL="/bin/sh ./libtool" +# LIBTOOL="$LIBTOOL --silent" +KDE_PLUGIN="-avoid-version -module -no-undefined \$(KDE_RPATH)" +AC_SUBST(KDE_PLUGIN) +]) + +AC_DEFUN(KDE_CHECK_TYPES, +[ AC_CHECK_SIZEOF(int, 4)dnl + AC_CHECK_SIZEOF(long, 4)dnl + AC_CHECK_SIZEOF(char *, 4)dnl + AC_CHECK_SIZEOF(char, 1)dnl +])dnl + +AC_DEFUN(KDE_DO_IT_ALL, +[ +AC_CANONICAL_SYSTEM +AC_ARG_PROGRAM +AM_INIT_AUTOMAKE($1, $2) +AM_DISABLE_LIBRARIES +AC_PREFIX_DEFAULT(${KDEDIR:-/usr/local/kde}) +AC_CHECK_COMPILERS +KDE_PROG_LIBTOOL +AM_KDE_WITH_NLS +AC_PATH_KDE +]) + +AC_DEFUN(AC_CHECK_RPATH, +[ +AC_MSG_CHECKING(for rpath) +AC_ARG_ENABLE(rpath, + [ --disable-rpath do not use the rpath feature of ld], + USE_RPATH=$enableval, USE_RPATH=yes) + +if test -z "$KDE_RPATH" && test "$USE_RPATH" = "yes"; then + + KDE_RPATH="-R \$(kde_libraries)" + + if test -n "$qt_libraries"; then + KDE_RPATH="$KDE_RPATH -R \$(qt_libraries)" + fi + dnl $x_libraries is set to /usr/lib in case + if test -n "$X_LDFLAGS"; then + KDE_RPATH="$KDE_RPATH -R \$(x_libraries)" + fi + if test -n "$KDE_EXTRA_RPATH"; then + KDE_RPATH="$KDE_RPATH \$(KDE_EXTRA_RPATH)" + fi +fi +AC_SUBST(KDE_EXTRA_RPATH) +AC_SUBST(KDE_RPATH) +AC_MSG_RESULT($USE_RPATH) +]) + +dnl Check for the type of the third argument of getsockname +AC_DEFUN(AC_CHECK_SOCKLEN_T, [ + AC_MSG_CHECKING(for socklen_t) + AC_CACHE_VAL(ac_cv_socklen_t, [ + AC_LANG_SAVE + AC_LANG_CPLUSPLUS + AC_TRY_COMPILE([ +#include +#include + ],[ +socklen_t a=0; +getsockname(0,(struct sockaddr*)0, &a); + ], + ac_cv_socklen_t=socklen_t, + AC_TRY_COMPILE([ +#include +#include + ],[ +int a=0; +getsockname(0,(struct sockaddr*)0, &a); + ], + ac_cv_socklen_t=int, + ac_cv_socklen_t=size_t + ) + ) + AC_LANG_RESTORE + ]) + + AC_MSG_RESULT($ac_cv_socklen_t) + if test "$ac_cv_socklen_t" != "socklen_t"; then + AC_DEFINE_UNQUOTED(socklen_t, $ac_cv_socklen_t, + [Define the real type of socklen_t]) + fi + AC_DEFINE_UNQUOTED(ksize_t, socklen_t, [Compatibility define]) + +]) + +dnl This is a merge of some macros out of the gettext aclocal.m4 +dnl since we don't need anything, I took the things we need +dnl the copyright for them is: +dnl > +dnl Copyright (C) 1994, 1995, 1996, 1997, 1998 Free Software Foundation, Inc. +dnl This Makefile.in is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. + +dnl This program is distributed in the hope that it will be useful, +dnl but WITHOUT ANY WARRANTY, to the extent permitted by law; without +dnl even the implied warranty of MERCHANTABILITY or FITNESS FOR A +dnl PARTICULAR PURPOSE. +dnl > +dnl for this file it is relicensed under LGPL + +AC_DEFUN(AM_KDE_WITH_NLS, + [ + dnl If we use NLS figure out what method + + AM_PATH_PROG_WITH_TEST_KDE(MSGFMT, msgfmt, + [test -n "`$ac_dir/$ac_word --version 2>&1 | grep 'GNU gettext'`"], msgfmt) + AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT) + + if test -z "`$GMSGFMT --version 2>&1 | grep 'GNU gettext'`"; then + AC_MSG_RESULT([found msgfmt program is not GNU msgfmt; ignore it]) + GMSGFMT=":" + fi + MSGFMT=$GMSGFMT + AC_SUBST(GMSGFMT) + AC_SUBST(MSGFMT) + + AM_PATH_PROG_WITH_TEST_KDE(XGETTEXT, xgettext, + [test -z "`$ac_dir/$ac_word -h 2>&1 | grep '(HELP)'`"], :) + + dnl Test whether we really found GNU xgettext. + if test "$XGETTEXT" != ":"; then + dnl If it is no GNU xgettext we define it as : so that the + dnl Makefiles still can work. + if $XGETTEXT --omit-header /dev/null 2> /dev/null; then + : ; + else + AC_MSG_RESULT( + [found xgettext programs is not GNU xgettext; ignore it]) + XGETTEXT=":" + fi + fi + AC_SUBST(XGETTEXT) + + ]) + +# Search path for a program which passes the given test. +# Ulrich Drepper , 1996. + +# serial 1 +# Stephan Kulow: I appended a _KDE against name conflicts + +dnl AM_PATH_PROG_WITH_TEST_KDE(VARIABLE, PROG-TO-CHECK-FOR, +dnl TEST-PERFORMED-ON-FOUND_PROGRAM [, VALUE-IF-NOT-FOUND [, PATH]]) +AC_DEFUN(AM_PATH_PROG_WITH_TEST_KDE, +[# Extract the first word of "$2", so it can be a program name with args. +set dummy $2; ac_word=[$]2 +AC_MSG_CHECKING([for $ac_word]) +AC_CACHE_VAL(ac_cv_path_$1, +[case "[$]$1" in + /*) + ac_cv_path_$1="[$]$1" # Let the user override the test with a path. + ;; + *) + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" + for ac_dir in ifelse([$5], , $PATH, [$5]); do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + if [$3]; then + ac_cv_path_$1="$ac_dir/$ac_word" + break + fi + fi + done + IFS="$ac_save_ifs" +dnl If no 4th arg is given, leave the cache variable unset, +dnl so AC_PATH_PROGS will keep looking. +ifelse([$4], , , [ test -z "[$]ac_cv_path_$1" && ac_cv_path_$1="$4" +])dnl + ;; +esac])dnl +$1="$ac_cv_path_$1" +if test -n "[$]$1"; then + AC_MSG_RESULT([$]$1) +else + AC_MSG_RESULT(no) +fi +AC_SUBST($1)dnl +]) + + +# Check whether LC_MESSAGES is available in . +# Ulrich Drepper , 1995. + +# serial 1 + +AC_DEFUN(AM_LC_MESSAGES, + [if test $ac_cv_header_locale_h = yes; then + AC_CACHE_CHECK([for LC_MESSAGES], am_cv_val_LC_MESSAGES, + [AC_TRY_LINK([#include ], [return LC_MESSAGES], + am_cv_val_LC_MESSAGES=yes, am_cv_val_LC_MESSAGES=no)]) + if test $am_cv_val_LC_MESSAGES = yes; then + AC_DEFINE(HAVE_LC_MESSAGES, 1, [Define if your locale.h file contains LC_MESSAGES]) + fi + fi]) + +dnl From Jim Meyering. +dnl FIXME: migrate into libit. + +AC_DEFUN(AM_FUNC_OBSTACK, +[AC_CACHE_CHECK([for obstacks], am_cv_func_obstack, + [AC_TRY_LINK([#include "obstack.h"], + [struct obstack *mem;obstack_free(mem,(char *) 0)], + am_cv_func_obstack=yes, + am_cv_func_obstack=no)]) + if test $am_cv_func_obstack = yes; then + AC_DEFINE(HAVE_OBSTACK) + else + LIBOBJS="$LIBOBJS obstack.o" + fi +]) + +dnl From Jim Meyering. Use this if you use the GNU error.[ch]. +dnl FIXME: Migrate into libit + +AC_DEFUN(AM_FUNC_ERROR_AT_LINE, +[AC_CACHE_CHECK([for error_at_line], am_cv_lib_error_at_line, + [AC_TRY_LINK([],[error_at_line(0, 0, "", 0, "");], + am_cv_lib_error_at_line=yes, + am_cv_lib_error_at_line=no)]) + if test $am_cv_lib_error_at_line = no; then + LIBOBJS="$LIBOBJS error.o" + fi + AC_SUBST(LIBOBJS)dnl +]) + +# Macro to add for using GNU gettext. +# Ulrich Drepper , 1995. + +# serial 1 +# Stephan Kulow: I put a KDE in it to avoid name conflicts + +AC_DEFUN(AM_KDE_GNU_GETTEXT, + [AC_REQUIRE([AC_PROG_MAKE_SET])dnl + AC_REQUIRE([AC_PROG_RANLIB])dnl + AC_REQUIRE([AC_HEADER_STDC])dnl + AC_REQUIRE([AC_TYPE_OFF_T])dnl + AC_REQUIRE([AC_TYPE_SIZE_T])dnl + AC_REQUIRE([AC_FUNC_ALLOCA])dnl + AC_REQUIRE([AC_FUNC_MMAP])dnl + AC_REQUIRE([AM_KDE_WITH_NLS])dnl + AC_CHECK_HEADERS([argz.h limits.h locale.h nl_types.h string.h values.h alloca.h]) + AC_CHECK_FUNCS([getcwd munmap putenv setenv setlocale strchr strcasecmp \ +__argz_count __argz_stringify __argz_next]) + + AC_MSG_CHECKING(for stpcpy) + AC_CACHE_VAL(kde_cv_func_stpcpy, + [ + kde_safe_cxxflags=$CXXFLAGS + CXXFLAGS="-Wmissing-prototypes -Werror" + AC_LANG_SAVE + AC_LANG_CPLUSPLUS + AC_TRY_COMPILE([ + #include + ], + [ + char buffer[200]; + stpcpy(buffer, buffer); + ], + kde_cv_func_stpcpy=yes, + kde_cv_func_stpcpy=no) + AC_LANG_RESTORE + CXXFLAGS=$kde_safe_cxxflags + ]) + AC_MSG_RESULT($kde_cv_func_stpcpy) + if eval "test \"`echo $kde_cv_func_stpcpy`\" = yes"; then + AC_DEFINE(HAVE_STPCPY, 1, [Define if you have stpcpy]) + fi + + AM_LC_MESSAGES + + if test "x$CATOBJEXT" != "x"; then + if test "x$ALL_LINGUAS" = "x"; then + LINGUAS= + else + AC_MSG_CHECKING(for catalogs to be installed) + NEW_LINGUAS= + for lang in ${LINGUAS=$ALL_LINGUAS}; do + case "$ALL_LINGUAS" in + *$lang*) NEW_LINGUAS="$NEW_LINGUAS $lang" ;; + esac + done + LINGUAS=$NEW_LINGUAS + AC_MSG_RESULT($LINGUAS) + fi + + dnl Construct list of names of catalog files to be constructed. + if test -n "$LINGUAS"; then + for lang in $LINGUAS; do CATALOGS="$CATALOGS $lang$CATOBJEXT"; done + fi + fi + + ]) + +AC_DEFUN(AC_HAVE_XPM, + [AC_REQUIRE_CPP()dnl + AC_REQUIRE([KDE_CHECK_EXTRA_LIBS]) + + test -z "$XPM_LDFLAGS" && XPM_LDFLAGS= + test -z "$XPM_INCLUDE" && XPM_INCLUDE= + + AC_ARG_WITH(xpm, [ --without-xpm disable color pixmap XPM tests], + xpm_test=$withval, xpm_test="yes") + if test "x$xpm_test" = xno; then + ac_cv_have_xpm=no + else + AC_MSG_CHECKING(for XPM) + AC_CACHE_VAL(ac_cv_have_xpm, + [ + AC_LANG_C + ac_save_ldflags="$LDFLAGS" + ac_save_cflags="$CFLAGS" + LDFLAGS="$LDFLAGS $X_LDFLAGS $USER_LDFLAGS $LDFLAGS $XPM_LDFLAGS $all_libraries -lXpm -lX11 -lXext $LIBZ $LIBSOCKET" + CFLAGS="$CFLAGS $X_INCLUDES $USER_INCLUDES" + test -n "$XPM_INCLUDE" && CFLAGS="-I$XPM_INCLUDE $CFLAGS" + AC_TRY_LINK([#include ],[], + ac_cv_have_xpm="yes",ac_cv_have_xpm="no") + LDFLAGS="$ac_save_ldflags" + CFLAGS="$ac_save_cflags" + ])dnl + + if test "$ac_cv_have_xpm" = no; then + AC_MSG_RESULT(no) + XPM_LDFLAGS="" + XPMINC="" + $2 + else + AC_DEFINE(HAVE_XPM, 1, [Define if you have XPM support]) + if test "$XPM_LDFLAGS" = ""; then + XPMLIB='-lXpm $(LIB_X11)' + else + XPMLIB="-L$XPM_LDFLAGS -lXpm "'$(LIB_X11)' + fi + if test "$XPM_INCLUDE" = ""; then + XPMINC="" + else + XPMINC="-I$XPM_INCLUDE" + fi + AC_MSG_RESULT(yes) + $1 + fi + fi + AC_SUBST(XPMINC) + AC_SUBST(XPMLIB) +]) + +AC_DEFUN(AC_HAVE_DPMS, + [AC_REQUIRE_CPP()dnl + AC_REQUIRE([KDE_CHECK_EXTRA_LIBS]) + + test -z "$DPMS_LDFLAGS" && DPMS_LDFLAGS= + test -z "$DPMS_INCLUDE" && DPMS_INCLUDE= + DPMS_LIB= + + AC_ARG_WITH(dpms, [ --without-dpms disable DPMS power saving], + dpms_test=$withval, dpms_test="yes") + if test "x$dpms_test" = xno; then + ac_cv_have_dpms=no + else + AC_MSG_CHECKING(for DPMS) + dnl Note: ac_cv_have_dpms can be no, yes, or -lXdpms. + dnl 'yes' means DPMS_LIB="", '-lXdpms' means DPMS_LIB="-lXdpms". + AC_CACHE_VAL(ac_cv_have_dpms, + [ + AC_LANG_C + ac_save_ldflags="$LDFLAGS" + ac_save_cflags="$CFLAGS" + ac_save_libs="$LIBS" + LDFLAGS="$LDFLAGS $DPMS_LDFLAGS $all_libraries -lX11 -lXext $LIBSOCKET" + CFLAGS="$CFLAGS $X_INCLUDES" + test -n "$DPMS_INCLUDE" && CFLAGS="-I$DPMS_INCLUDE $CFLAGS" + AC_TRY_LINK([ + #include + #include + #include + #include + int foo_test_dpms() + { return DPMSSetTimeouts( 0, 0, 0, 0 ); }],[], + ac_cv_have_dpms="yes", [ + LDFLAGS="$ac_save_ldflags" + CFLAGS="$ac_save_cflags" + LDFLAGS="$LDFLAGS $DPMS_LDFLAGS $all_libraries -lX11 -lXext $LIBSOCKET" + LIBS="$LIBS -lXdpms" + CFLAGS="$CFLAGS $X_INCLUDES" + test -n "$DPMS_INCLUDE" && CFLAGS="-I$DPMS_INCLUDE $CFLAGS" + AC_TRY_LINK([ + #include + #include + #include + #include + int foo_test_dpms() + { return DPMSSetTimeouts( 0, 0, 0, 0 ); }],[], + [ + ac_cv_have_dpms="-lXdpms" + ],ac_cv_have_dpms="no") + ]) + LDFLAGS="$ac_save_ldflags" + CFLAGS="$ac_save_cflags" + LIBS="$ac_save_libs" + ])dnl + + if test "$ac_cv_have_dpms" = no; then + AC_MSG_RESULT(no) + DPMS_LDFLAGS="" + DPMSINC="" + $2 + else + AC_DEFINE(HAVE_DPMS, 1, [Define if you have DPMS support]) + if test "$ac_cv_have_dpms" = "-lXdpms"; then + DPMS_LIB="-lXdpms" + fi + if test "$DPMS_LDFLAGS" = ""; then + DPMSLIB="$DPMS_LIB "'$(LIB_X11)' + else + DPMSLIB="$DPMS_LDFLAGS $DPMS_LIB "'$(LIB_X11)' + fi + if test "$DPMS_INCLUDE" = ""; then + DPMSINC="" + else + DPMSINC="-I$DPMS_INCLUDE" + fi + AC_MSG_RESULT(yes) + $1 + fi + fi + AC_SUBST(DPMSINC) + AC_SUBST(DPMSLIB) +]) + +AC_DEFUN(AC_HAVE_GL, + [AC_REQUIRE_CPP()dnl + AC_REQUIRE([KDE_CHECK_EXTRA_LIBS]) + + test -z "$GL_LDFLAGS" && GL_LDFLAGS= + test -z "$GL_INCLUDE" && GL_INCLUDE= + + AC_ARG_WITH(gl, [ --without-gl disable 3D GL modes], + gl_test=$withval, gl_test="yes") + if test "x$gl_test" = xno; then + ac_cv_have_gl=no + else + AC_MSG_CHECKING(for GL) + AC_CACHE_VAL(ac_cv_have_gl, + [ + AC_LANG_C + ac_save_ldflags="$LDFLAGS" + ac_save_cflags="$CFLAGS" + LDFLAGS="$LDFLAGS $GL_LDFLAGS $X_LDFLAGS $all_libraries -lMesaGL -lMesaGLU -lX11 -lXext -lm $LIBSOCKET" + CFLAGS="$CFLAGS $X_INCLUDES" + test -n "$GL_INCLUDE" && CFLAGS="-I$GL_INCLUDE $CFLAGS" + AC_TRY_LINK([#include +#include +], [], + ac_cv_have_gl="mesa", ac_cv_have_gl="no") + if test "x$ac_cv_have_gl" = "xno"; then + LDFLAGS="$ac_save_ldflags $X_LDFLAGS $GL_LDFLAGS $all_libraries -lGL -lGLU -lX11 -lXext -lm $LIBSOCKET" + CFLAGS="$ac_save_cflags $X_INCLUDES" + test -n "$GL_INCLUDE" && CFLAGS="-I$GL_INCLUDE $CFLAGS" + AC_TRY_LINK([#include +#include +], [], + ac_cv_have_gl="yes", ac_cv_have_gl="no") + fi + LDFLAGS="$ac_save_ldflags" + CFLAGS="$ac_save_cflags" + ])dnl + + if test "$ac_cv_have_gl" = "no"; then + AC_MSG_RESULT(no) + GL_LDFLAGS="" + GLINC="" + $2 + else + AC_DEFINE(HAVE_GL, 1, [Defines if you have GL (Mesa, OpenGL, ...)]) + if test "$GL_LDFLAGS" = ""; then + if test "$ac_cv_have_gl" = "mesa"; then + GLLIB='-lMesaGL -lMesaGLU $(LIB_X11)' + else + GLLIB='-lGL -lGLU $(LIB_X11)' + fi + else + if test "$ac_cv_have_gl" = "mesa"; then + GLLIB="$GL_LDFLAGS -lMesaGL -lMesaGLU "'$(LIB_X11)' + else + GLLIB="$GL_LDFLAGS -lGL -lGLU "'$(LIB_X11)' + fi + fi + if test "$GL_INCLUDE" = ""; then + GLINC="" + else + GLINC="-I$GL_INCLUDE" + fi + AC_MSG_RESULT($ac_cv_have_gl) + $1 + fi + fi + AC_SUBST(GLINC) + AC_SUBST(GLLIB) +]) + + + dnl shadow password and PAM magic - maintained by ossi@kde.org + +AC_DEFUN(KDE_PAM, [ + AC_REQUIRE([KDE_CHECK_LIBDL]) + + AC_ARG_WITH(pam, + [ --with-pam[=ARG] enable support for PAM: ARG=[yes|no|service name]], + [ if test "x$withval" = "xyes"; then + use_pam=yes + pam_service=kde + elif test "x$withval" = "xno"; then + use_pam=no + else + use_pam=yes + pam_service=$withval + fi + ac_cv_path_pam="use_pam=$use_pam pam_service=$pam_service" + ], [ + AC_CACHE_VAL(ac_cv_path_pam, + [ use_pam=no + AC_CHECK_LIB(pam, pam_start, + [ AC_CHECK_HEADER(security/pam_appl.h, + [ use_pam=yes + pam_service=kde ]) + ], , $LIBDL) + ac_cv_path_pam="use_pam=$use_pam pam_service=$pam_service" + ]) + ]) + eval "$ac_cv_path_pam" + + AC_MSG_CHECKING(for PAM) + if test "x$use_pam" = xno; then + AC_MSG_RESULT(no) + PAMLIBS="" + else + AC_MSG_RESULT(yes) + AC_DEFINE(HAVE_PAM, 1, [Defines if you have PAM (Pluggable Authentication Modules)]) + PAMLIBS="$PAM_MISC_LIB -lpam $LIBDL" + + dnl test whether struct pam_message is const (Linux) or not (Sun) + AC_MSG_CHECKING(for const pam_message) + AC_EGREP_HEADER([struct pam_message], security/pam_appl.h, + [ AC_EGREP_HEADER([const struct pam_message], security/pam_appl.h, + [AC_MSG_RESULT([const: Linux-type PAM])], + [AC_MSG_RESULT([nonconst: Sun-type PAM]) + AC_DEFINE(PAM_MESSAGE_NONCONST, 1, [Define if your PAM support takes non-const arguments (Solaris)])] + )], + [AC_MSG_RESULT([not found - assume const, Linux-type PAM])]) + fi + + AC_SUBST(PAMLIBS) +]) + +dnl DEF_PAM_SERVICE(arg name, full name, define name) +AC_DEFUN(DEF_PAM_SERVICE, [ + AC_ARG_WITH($1-pam, + [ --with-$1-pam=[val] override PAM service from --with-pam for $2], + [ if test "x$use_pam" = xyes; then + $3_PAM_SERVICE="$withval" + else + AC_MSG_ERROR([Cannot use use --with-$1-pam, as no PAM was detected. +You may want to enforce it by using --with-pam.]) + fi + ], + [ if test "x$use_pam" = xyes; then + $3_PAM_SERVICE="$pam_service" + fi + ]) + if test -n "$$3_PAM_SERVICE"; then + AC_MSG_RESULT([The PAM service used by $2 will be $$3_PAM_SERVICE]) + AC_DEFINE_UNQUOTED($3_PAM_SERVICE, "$$3_PAM_SERVICE", [The PAM service to be used by $2]) + fi + AC_SUBST($3_PAM_SERVICE) +]) + +AC_DEFUN(KDE_SHADOWPASSWD, [ + AC_REQUIRE([KDE_PAM]) + + AC_CHECK_LIB(shadow, getspent, + [ LIBSHADOW="-lshadow" + ac_use_shadow=yes + ], + [ dnl for UnixWare + AC_CHECK_LIB(gen, getspent, + [ LIBGEN="-lgen" + ac_use_shadow=yes + ], + [ AC_CHECK_FUNC(getspent, + [ ac_use_shadow=yes ], + [ ac_use_shadow=no ]) + ]) + ]) + AC_SUBST(LIBSHADOW) + AC_SUBST(LIBGEN) + + AC_MSG_CHECKING([for shadow passwords]) + + AC_ARG_WITH(shadow, + [ --with-shadow If you want shadow password support ], + [ if test "x$withval" != "xno"; then + use_shadow=yes + else + use_shadow=no + fi + ], [ + use_shadow="$ac_use_shadow" + ]) + + if test "x$use_shadow" = xyes; then + AC_MSG_RESULT(yes) + AC_DEFINE(HAVE_SHADOW, 1, [Define if you use shadow passwords]) + else + AC_MSG_RESULT(no) + LIBSHADOW= + LIBGEN= + fi + + dnl finally make the relevant binaries setuid root, if we have shadow passwds. + dnl this still applies, if we could use it indirectly through pam. + if test "x$use_shadow" = xyes || + ( test "x$use_pam" = xyes && test "x$ac_use_shadow" = xyes ); then + case $host in + *-*-freebsd* | *-*-netbsd* | *-*-openbsd*) + SETUIDFLAGS="-m 4755 -o root";; + *) + SETUIDFLAGS="-m 4755";; + esac + fi + AC_SUBST(SETUIDFLAGS) + +]) + +AC_DEFUN(KDE_PASSWDLIBS, [ + AC_REQUIRE([KDE_MISC_TESTS]) dnl for LIBCRYPT + AC_REQUIRE([KDE_PAM]) + AC_REQUIRE([KDE_SHADOWPASSWD]) + + if test "x$use_pam" = "xyes"; then + PASSWDLIBS="$PAMLIBS" + else + PASSWDLIBS="$LIBCRYPT $LIBSHADOW $LIBGEN" + fi + + AC_SUBST(PASSWDLIBS) +]) + +AC_DEFUN(KDE_CHECK_LIBDL, +[ +AC_CHECK_LIB(dl, dlopen, [ +LIBDL="-ldl" +ac_cv_have_dlfcn=yes +]) + +AC_CHECK_LIB(dld, shl_unload, [ +LIBDL="-ldld" +ac_cv_have_shload=yes +]) + +AC_SUBST(LIBDL) +]) + +AC_DEFUN(KDE_CHECK_DLOPEN, +[ +KDE_CHECK_LIBDL +AC_CHECK_HEADERS(dlfcn.h dl.h) +if test "$ac_cv_header_dlfcn_h" = "no"; then + ac_cv_have_dlfcn=no +fi + +if test "$ac_cv_header_dl_h" = "no"; then + ac_cv_have_shload=no +fi + +dnl XXX why change enable_dlopen? its already set by autoconf's AC_ARG_ENABLE +dnl (MM) +AC_ARG_ENABLE(dlopen, +[ --disable-dlopen link statically [default=no]] , +enable_dlopen=$enableval, +enable_dlopen=yes) + +# override the user's opinion, if we know it better ;) +if test "$ac_cv_have_dlfcn" = "no" && test "$ac_cv_have_shload" = "no"; then + enable_dlopen=no +fi + +if test "$ac_cv_have_dlfcn" = "yes"; then + AC_DEFINE_UNQUOTED(HAVE_DLFCN, 1, [Define if you have dlfcn]) +fi + +if test "$ac_cv_have_shload" = "yes"; then + AC_DEFINE_UNQUOTED(HAVE_SHLOAD, 1, [Define if you have shload]) +fi + +if test "$enable_dlopen" = no ; then + test -n "$1" && eval $1 +else + test -n "$2" && eval $2 +fi + +]) + +AC_DEFUN(KDE_CHECK_DYNAMIC_LOADING, +[ +KDE_CHECK_DLOPEN(libtool_enable_shared=yes, libtool_enable_static=no) +KDE_PROG_LIBTOOL +AC_MSG_CHECKING([dynamic loading]) +eval "`egrep '^build_libtool_libs=' libtool`" +if test "$build_libtool_libs" = "yes" && test "$enable_dlopen" = "yes"; then + dynamic_loading=yes + AC_DEFINE_UNQUOTED(HAVE_DYNAMIC_LOADING) +else + dynamic_loading=no +fi +AC_MSG_RESULT($dynamic_loading) +if test "$dynamic_loading" = "yes"; then + $1 +else + $2 +fi +]) + +AC_DEFUN(KDE_ADD_INCLUDES, +[ +if test -z "$1"; then + test_include="Pix.h" +else + test_include="$1" +fi + +AC_MSG_CHECKING([for libg++ ($test_include)]) + +AC_CACHE_VAL(kde_cv_libgpp_includes, +[ +kde_cv_libgpp_includes=no + + for ac_dir in \ + \ + /usr/include/g++ \ + /usr/include \ + /usr/unsupported/include \ + /opt/include \ + $extra_include \ + ; \ + do + if test -r "$ac_dir/$test_include"; then + kde_cv_libgpp_includes=$ac_dir + break + fi + done +]) + +AC_MSG_RESULT($kde_cv_libgpp_includes) +if test "$kde_cv_libgpp_includes" != "no"; then + all_includes="-I$kde_cv_libgpp_includes $all_includes $USER_INCLUDES" +fi +]) +]) + + +AC_DEFUN(KDE_CHECK_MICO, +[ +AC_REQUIRE([KDE_CHECK_LIBDL]) +AC_REQUIRE([KDE_MISC_TESTS]) +AC_MSG_CHECKING(for MICO) + +if test -z "$MICODIR"; then + kde_micodir=/usr/local + else + kde_micodir="$MICODIR" +fi + +AC_ARG_WITH(micodir, + [ --with-micodir=micodir where mico is installed ], + kde_micodir=$withval, + kde_micodir=$kde_micodir +) + +AC_CACHE_VAL(kde_cv_mico_incdir, +[ + mico_incdirs="$kde_micodir/include /usr/include /usr/local/include /usr/local/include /opt/local/include $kde_extra_includes" +AC_FIND_FILE(CORBA.h, $mico_incdirs, kde_cv_mico_incdir) + +]) +kde_micodir=`echo $kde_cv_mico_incdir | sed -e 's#/include##'` + +if test ! -r $kde_micodir/include/CORBA.h; then + AC_MSG_ERROR([No CORBA.h found, specify another micodir]) +fi + +AC_MSG_RESULT($kde_micodir) + +MICO_INCLUDES=-I$kde_micodir/include +AC_SUBST(MICO_INCLUDES) +MICO_LDFLAGS=-L$kde_micodir/lib +AC_SUBST(MICO_LDFLAGS) +micodir=$kde_micodir +AC_SUBST(micodir) + +AC_MSG_CHECKING([for MICO version]) +AC_CACHE_VAL(kde_cv_mico_version, +[ +AC_LANG_C +cat >conftest.$ac_ext < +#include +int main() { + + printf("MICO_VERSION=%s\n",MICO_VERSION); + return (0); +} +EOF +ac_compile='${CC-gcc} $CFLAGS $MICO_INCLUDES conftest.$ac_ext -o conftest' +if AC_TRY_EVAL(ac_compile); then + if eval `./conftest 2>&5`; then + kde_cv_mico_version=$MICO_VERSION + else + AC_MSG_ERROR([your system is not able to execute a small application to + find MICO version! Check $kde_micodir/include/mico/version.h]) + fi +else + AC_MSG_ERROR([your system is not able to compile a small application to + find MICO version! Check $kde_micodir/include/mico/version.h]) +fi +]) + +dnl installed MICO version +mico_v_maj=`echo $kde_cv_mico_version | sed -e 's/^\(.*\)\..*\..*$/\1/'` +mico_v_mid=`echo $kde_cv_mico_version | sed -e 's/^.*\.\(.*\)\..*$/\1/'` +mico_v_min=`echo $kde_cv_mico_version | sed -e 's/^.*\..*\.\(.*\)$/\1/'` + +if test "x$1" = "x"; then + req_version="2.3.0" +else + req_version=$1 +fi + +dnl required MICO version +req_v_maj=`echo $req_version | sed -e 's/^\(.*\)\..*\..*$/\1/'` +req_v_mid=`echo $req_version | sed -e 's/^.*\.\(.*\)\..*$/\1/'` +req_v_min=`echo $req_version | sed -e 's/^.*\..*\.\(.*\)$/\1/'` + +if test "$mico_v_maj" -lt "$req_v_maj" || \ + ( test "$mico_v_maj" -eq "$req_v_maj" && \ + test "$mico_v_mid" -lt "$req_v_mid" ) || \ + ( test "$mico_v_mid" -eq "$req_v_mid" && \ + test "$mico_v_min" -lt "$req_v_min" ) + +then + AC_MSG_ERROR([found MICO version $kde_cv_mico_version but version $req_version \ +at least is required. You should upgrade MICO.]) +else + AC_MSG_RESULT([$kde_cv_mico_version (minimum version $req_version, ok)]) +fi + +LIBMICO="-lmico$kde_cv_mico_version $LIBCRYPT $LIBSOCKET $LIBDL" +AC_SUBST(LIBMICO) +if test -z "$IDL"; then + IDL='$(kde_bindir)/cuteidl' +fi +AC_SUBST(IDL) +IDL_DEPENDENCIES='$(kde_includes)/CUTE.h' +AC_SUBST(IDL_DEPENDENCIES) + +idldir="\$(includedir)/idl" +AC_SUBST(idldir) + +]) + +AC_DEFUN(KDE_CHECK_MINI_STL, +[ +AC_REQUIRE([KDE_CHECK_MICO]) + +AC_MSG_CHECKING(if we use mico's mini-STL) +AC_CACHE_VAL(kde_cv_have_mini_stl, +[ +AC_LANG_SAVE +AC_LANG_CPLUSPLUS +kde_save_cxxflags="$CXXFLAGS" +CXXFLAGS="$CXXFLAGS $MICO_INCLUDES" +AC_TRY_COMPILE( +[ +#include +], +[ +#ifdef HAVE_MINI_STL +#error "nothing" +#endif +], +kde_cv_have_mini_stl=no, +kde_cv_have_mini_stl=yes) +CXXFLAGS="$kde_save_cxxflags" +AC_LANG_RESTORE +]) + +if test "x$kde_cv_have_mini_stl" = "xyes"; then + AC_MSG_RESULT(yes) + $1 +else + AC_MSG_RESULT(no) + $2 +fi +]) + +]) + + +AC_DEFUN(KDE_CHECK_LIBPTHREAD, +[ +AC_CHECK_LIB(pthread, pthread_create, [LIBPTHREAD="-lpthread"] ) +AC_SUBST(LIBPTHREAD) +]) + +AC_DEFUN(KDE_CHECK_PTHREAD_OPTION, +[ + AC_ARG_ENABLE(kernel-threads, [ --enable-kernel-threads Enable the use of the LinuxThreads port on FreeBSD/i386 only.], + kde_use_kernthreads=$enableval, kde_use_kernthreads=no) + + if test "$kde_use_kernthreads" = "yes"; then + ac_save_CXXFLAGS="$CXXFLAGS" + ac_save_CFLAGS="$CXXFLAGS" + CXXFLAGS="-I/usr/local/include/pthread/linuxthreads $CXXFLAGS" + CFLAGS="-I/usr/local/include/pthread/linuxthreads $CFLAGS" + AC_CHECK_HEADERS(pthread/linuxthreads/pthread.h) + CXXFLAGS="$ac_save_CXXFLAGS" + CFLAGS="$ac_save_CFLAGS" + if test "$ac_cv_header_pthread_linuxthreads_pthread_h" = "no"; then + kde_use_kernthreads=no + else + dnl Add proper -I and -l statements + AC_CHECK_LIB(lthread, pthread_join, [LIBPTHREAD="-llthread -llgcc_r"]) dnl for FreeBSD + if test "x$LIBPTHREAD" = "x"; then + kde_use_kernthreads=no + else + USE_THREADS="-D_THREAD_SAFE -I/usr/local/include/pthread/linuxthreads" + fi + fi + else + USE_THREADS="" + if test -z "$LIBPTHREAD"; then + KDE_CHECK_COMPILER_FLAG(pthread, [USE_THREADS="-pthread"] ) + fi + fi + + case $host_os in + solaris*) + KDE_CHECK_COMPILER_FLAG(mt, [USE_THREADS="-mt"]) + CPPFLAGS="$CPPFLAGS -D_REENTRANT -D_POSIX_PTHREAD_SEMANTICS -DUSE_SOLARIS -DSVR4" + echo "Setting Solaris pthread compilation options" + ;; + freebsd*) + CPPFLAGS="$CPPFLAGS -D_THREAD_SAFE" + echo "Setting FreeBSD pthread compilation options" + ;; + aix*) + CPPFLAGS="$CPPFLAGS -D_THREAD_SAFE" + LIBPTHREAD="$LIBPTHREAD -lc_r" + echo "Setting AIX pthread compilation options" + ;; + linux*) CPPFLAGS="$CPPFLAGS -D_REENTRANT" + USE_THREADS="$USE_THREADS -DPIC -fPIC" + echo "Setting Linux pthread compilation options" + ;; + *) + ;; + esac + AC_SUBST(USE_THREADS) + AC_SUBST(LIBPTHREAD) +]) + +AC_DEFUN(KDE_CHECK_THREADING, +[ + AC_REQUIRE([KDE_CHECK_LIBPTHREAD]) + AC_REQUIRE([KDE_CHECK_PTHREAD_OPTION]) + dnl default is yes if libpthread is found and no if no libpthread is available + if test -z "$LIBPTHREAD"; then + kde_check_threading_default=no + else + kde_check_threading_default=yes + fi + AC_ARG_ENABLE(threading, [ --disable-threading disables threading even if libpthread found ], + kde_use_threading=$enableval, kde_use_threading=$kde_check_threading_default) + + if test "x$kde_use_threading" = "xyes"; then + AC_DEFINE(HAVE_LIBPTHREAD, 1, [Define if you have a working libpthread (will enable threaded code)]) + fi +]) + +AC_DEFUN(KDE_TRY_LINK_PYTHON, +[ +if test "$kde_python_link_found" = no; then + +if test "$1" = normal; then + AC_MSG_CHECKING(if a Python application links) +else + AC_MSG_CHECKING(if Python depends on $2) +fi + +AC_CACHE_VAL(kde_cv_try_link_python_$1, +[ +AC_LANG_SAVE +AC_LANG_C +kde_save_cflags="$CFLAGS" +CFLAGS="$CFLAGS $PYTHONINC" +kde_save_libs="$LIBS" +LIBS="$LIBS $LIBPYTHON $2 $LIBDL $LIBSOCKET" +kde_save_ldflags="$LDFLAGS" +LDFLAGS="$LDFLAGS $PYTHONLIB" + +AC_TRY_LINK( +[ +#include +],[ + PySys_SetArgv(1, 0); +], + [kde_cv_try_link_python_$1=yes], + [kde_cv_try_link_python_$1=no] +) +CFLAGS="$kde_save_cflags" +LIBS="$kde_save_libs" +LDFLAGS="$kde_save_ldflags" +]) + +if test "$kde_cv_try_link_python_$1" = "yes"; then + AC_MSG_RESULT(yes) + kde_python_link_found=yes + if test ! "$1" = normal; then + LIBPYTHON="$LIBPYTHON $2" + fi + $3 +else + AC_MSG_RESULT(no) + $4 +fi +AC_LANG_RESTORE + +fi + +]) + +AC_DEFUN(KDE_CHECK_PYTHON_DIR, +[ +AC_MSG_CHECKING([for Python directory]) + +AC_CACHE_VAL(kde_cv_pythondir, +[ + if test -z "$PYTHONDIR"; then + kde_cv_pythondir=/usr/local + else + kde_cv_pythondir="$PYTHONDIR" + fi +]) + +AC_ARG_WITH(pythondir, +[ --with-pythondir=pythondir use python installed in pythondir ], +[ + ac_python_dir=$withval +], ac_python_dir=$kde_cv_pythondir +) + +AC_MSG_RESULT($ac_python_dir) +]) + +AC_DEFUN(KDE_CHECK_PYTHON_INTERN, +[ +AC_REQUIRE([KDE_CHECK_LIBDL]) +AC_REQUIRE([KDE_CHECK_LIBPTHREAD]) +AC_REQUIRE([KDE_CHECK_PYTHON_DIR]) + +if test -z "$1"; then + version="1.5" +else + version="$1" +fi + +AC_MSG_CHECKING([for Python$version]) + +python_incdirs="$ac_python_dir/include /usr/include /usr/local/include/ $kde_extra_includes" +AC_FIND_FILE(Python.h, $python_incdirs, python_incdir) +if test ! -r $python_incdir/Python.h; then + AC_FIND_FILE(python$version/Python.h, $python_incdirs, python_incdir) + python_incdir=$python_incdir/python$version + if test ! -r $python_incdir/Python.h; then + python_incdir=no + fi +fi + +PYTHONINC=-I$python_incdir + +python_libdirs="$ac_python_dir/lib /usr/lib /usr/local /usr/lib $kde_extra_libs" +AC_FIND_FILE(libpython$version.a, $python_libdirs, python_libdir) +if test ! -r $python_libdir/libpython$version.a; then + AC_FIND_FILE(python$version/config/libpython$version.a, $python_libdirs, python_libdir) + python_libdir=$python_libdir/python$version/config + if test ! -r $python_libdir/libpython$version.a; then + python_libdir=no + fi +fi + +PYTHONLIB=-L$python_libdir +kde_orig_LIBPYTHON=$LIBPYTHON +if test -z "$LIBPYTHON"; then + LIBPYTHON=-lpython$version +fi + +python_libdirs="$ac_python_dir/lib /usr/lib /usr/local /usr/lib $kde_extra_libs" +AC_FIND_FILE(python$version/copy.py, $python_libdirs, python_moddir) +python_moddir=$python_moddir/python$version +if test ! -r $python_moddir/copy.py; then + python_moddir=no +fi + +PYTHONMODDIR=$python_moddir + +AC_MSG_RESULT(header $python_incdir library $python_libdir modules $python_moddir) + +if test x$python_incdir = xno || test x$python_libdir = xno || test x$python_moddir = xno; then + LIBPYTHON=$kde_orig_LIBPYTHON + test "x$PYTHONLIB" = "x-Lno" && PYTHONLIB="" + test "x$PYTHONINC" = "x-Ino" && PYTHONINC="" + $2 +else + dnl Note: this test is very weak + kde_python_link_found=no + KDE_TRY_LINK_PYTHON(normal) + KDE_TRY_LINK_PYTHON(m, -lm) + KDE_TRY_LINK_PYTHON(pthread, $LIBPTHREAD) + KDE_TRY_LINK_PYTHON(tcl, -ltcl) + KDE_TRY_LINK_PYTHON(m_and_thread, [$LIBPTHREAD -lm]) + KDE_TRY_LINK_PYTHON(m_and_thread_and_util, [$LIBPTHREAD -lm -lutil]) + KDE_TRY_LINK_PYTHON(m_and_thread_and_db3, [$LIBPTHREAD -lm -ldb-3 -lutil]) + KDE_TRY_LINK_PYTHON(pthread_and_db3, [$LIBPTHREAD -ldb-3]) + KDE_TRY_LINK_PYTHON(m_and_thread_and_db, [$LIBPTHREAD -lm -ldb -ltermcap -lutil]) + KDE_TRY_LINK_PYTHON(m_and_thread_and_db_special, [$LIBPTHREAD -lm -ldb -lutil], [], + [AC_MSG_WARN([it seems, Python depends on another library. + Pleae use \"make LIBPYTHON='-lpython$version -lotherlib'\" to fix this + and contact the authors to let them know about this problem]) + + ]) + + LIBPYTHON="$LIBPYTHON $LIBDL $LIBSOCKET" + AC_SUBST(PYTHONINC) + AC_SUBST(PYTHONLIB) + AC_SUBST(LIBPYTHON) + AC_SUBST(PYTHONMODDIR) + AC_DEFINE(HAVE_PYTHON, 1, [Define if you have the development files for python]) +fi + +]) + + +AC_DEFUN(KDE_CHECK_PYTHON, +[ + KDE_CHECK_PYTHON_INTERN("2.1", [KDE_CHECK_PYTHON_INTERN("2.0", + [ KDE_CHECK_PYTHON_INTERN($1, $2) ]) + ]) +]) + +AC_DEFUN(KDE_CHECK_STL_SGI, +[ + AC_MSG_CHECKING([if STL implementation is SGI like]) + AC_CACHE_VAL(kde_cv_stl_type_sgi, + [ + AC_TRY_COMPILE([ +#include +using namespace std; +],[ + string astring="Hallo Welt."; + astring.erase(0, 6); // now astring is "Welt" + return 0; +], kde_cv_stl_type_sgi=yes, + kde_cv_stl_type_sgi=no) +]) + + AC_MSG_RESULT($kde_cv_stl_type_sgi) + + if test "$kde_cv_stl_type_sgi" = "yes"; then + AC_DEFINE_UNQUOTED(HAVE_SGI_STL, 1, [Define if you have a STL implementation by SGI]) + fi +]) + +AC_DEFUN(KDE_CHECK_STL_HP, +[ + AC_MSG_CHECKING([if STL implementation is HP like]) + AC_CACHE_VAL(kde_cv_stl_type_hp, + [ + AC_TRY_COMPILE([ +#include +using namespace std; +],[ + string astring="Hello World"; + astring.remove(0, 6); // now astring is "World" + return 0; +], kde_cv_stl_type_hp=yes, + kde_cv_stl_type_hp=no) +]) + AC_MSG_RESULT($kde_cv_stl_type_hp) + + if test "$kde_cv_stl_type_hp" = "yes"; then + AC_DEFINE_UNQUOTED(HAVE_HP_STL, 1, [Define if you have a STL implementation by HP]) + fi +]) + +AC_DEFUN(KDE_CHECK_STL, +[ + AC_LANG_SAVE + AC_LANG_CPLUSPLUS + ac_save_CXXFLAGS="$CXXFLAGS" + CXXFLAGS="`echo $CXXFLAGS | sed s/-fno-exceptions//`" + KDE_CHECK_STL_SGI + + if test "$kde_cv_stl_type_sgi" = "no"; then + KDE_CHECK_STL_HP + + if test "$kde_cv_stl_type_hp" = "no"; then + AC_MSG_ERROR("no known STL type found") + fi + fi + + CXXFLAGS="$ac_save_CXXFLAGS" + AC_LANG_RESTORE +]) + +AC_DEFUN(AC_FIND_QIMGIO, + [AC_REQUIRE([AC_FIND_JPEG]) +AC_REQUIRE([KDE_CHECK_EXTRA_LIBS]) +AC_MSG_CHECKING([for qimgio]) +AC_CACHE_VAL(ac_cv_lib_qimgio, +[ +AC_LANG_SAVE +AC_LANG_CPLUSPLUS +ac_save_LIBS="$LIBS" +ac_save_CXXFLAGS="$CXXFLAGS" +LIBS="$all_libraries -lqimgio -lpng -lz $LIBJPEG $LIBQT" +CXXFLAGS="$CXXFLAGS -I$qt_incdir $all_includes" +AC_TRY_RUN(dnl +[ +#include +#include +int main() { + QString t = "hallo"; + t.fill('t'); + qInitImageIO(); +} +], + ac_cv_lib_qimgio=yes, + ac_cv_lib_qimgio=no, + ac_cv_lib_qimgio=no) +LIBS="$ac_save_LIBS" +CXXFLAGS="$ac_save_CXXFLAGS" +AC_LANG_RESTORE +])dnl +if eval "test \"`echo $ac_cv_lib_qimgio`\" = yes"; then + LIBQIMGIO="-lqimgio -lpng -lz $LIBJPEG" + AC_MSG_RESULT(yes) + AC_DEFINE_UNQUOTED(HAVE_QIMGIO, 1, [Define if you have the Qt extension qimgio available]) + AC_SUBST(LIBQIMGIO) +else + AC_MSG_RESULT(not found) +fi +]) + +AC_DEFUN(KDE_CHECK_ANSI, +[ +]) + +AC_DEFUN(KDE_CHECK_INSURE, +[ + AC_ARG_ENABLE(insure, [ --enable-insure use insure++ for debugging [default=no]], + [ + if test $enableval = "no"; dnl + then ac_use_insure="no" + else ac_use_insure="yes" + fi + ], [ac_use_insure="no"]) + + AC_MSG_CHECKING(if we will use Insure++ to debug) + AC_MSG_RESULT($ac_use_insure) + if test "$ac_use_insure" = "yes"; dnl + then CC="insure"; CXX="insure"; dnl CFLAGS="$CLAGS -fno-rtti -fno-exceptions "???? + fi +]) + +AC_DEFUN(AM_DISABLE_LIBRARIES, +[ + AC_PROVIDE([AM_ENABLE_STATIC]) + AC_PROVIDE([AM_ENABLE_SHARED]) + enable_static=no + enable_shared=yes +]) + + +AC_DEFUN(AC_CHECK_UTMP_FILE, +[ + AC_MSG_CHECKING([for utmp file]) + + AC_CACHE_VAL(kde_cv_utmp_file, + [ + kde_cv_utmp_file=no + + for ac_file in \ + \ + /var/run/utmp \ + /var/adm/utmp \ + /etc/utmp \ + ; \ + do + if test -r "$ac_file"; then + kde_cv_utmp_file=$ac_file + break + fi + done + ]) + + if test "$kde_cv_utmp_file" != "no"; then + AC_DEFINE_UNQUOTED(UTMP, "$kde_cv_utmp_file", [Define the file for utmp entries]) + $1 + AC_MSG_RESULT($kde_cv_utmp_file) + else + $2 + AC_MSG_RESULT([non found]) + fi +]) + + +AC_DEFUN(KDE_CREATE_SUBDIRSLIST, +[ + +DO_NOT_COMPILE="$DO_NOT_COMPILE CVS debian bsd-port admin" + +if test ! -s $srcdir/subdirs; then + dnl Note: Makefile.common creates subdirs, so this is just a fallback + TOPSUBDIRS="" + files=`cd $srcdir && ls -1` + dirs=`for i in $files; do if test -d $i; then echo $i; fi; done` + for i in $dirs; do + echo $i >> $srcdir/subdirs + done +fi + +if test -s $srcdir/inst-apps; then + ac_topsubdirs="`cat $srcdir/inst-apps`" +else + ac_topsubdirs="`cat $srcdir/subdirs`" +fi + +for i in $ac_topsubdirs; do + AC_MSG_CHECKING([if $i should be compiled]) + if test -d $srcdir/$i; then + install_it="yes" + for j in $DO_NOT_COMPILE; do + if test $i = $j; then + install_it="no" + fi + done + else + install_it="no" + fi + AC_MSG_RESULT($install_it) + if test $install_it = "yes"; then + TOPSUBDIRS="$TOPSUBDIRS $i" + fi +done + +AC_SUBST(TOPSUBDIRS) +]) + +AC_DEFUN(KDE_CHECK_NAMESPACES, +[ +AC_MSG_CHECKING(whether C++ compiler supports namespaces) +AC_LANG_SAVE +AC_LANG_CPLUSPLUS +AC_TRY_COMPILE([ +], +[ +namespace Foo { + extern int i; + namespace Bar { + extern int i; + } +} + +int Foo::i = 0; +int Foo::Bar::i = 1; +],[ + AC_MSG_RESULT(yes) + AC_DEFINE(HAVE_NAMESPACES) +], [ +AC_MSG_RESULT(no) +]) +AC_LANG_RESTORE +]) + +AC_DEFUN(KDE_CHECK_NEWLIBS, +[ + +]) + +dnl ------------------------------------------------------------------------ +dnl Check for S_ISSOCK macro. Doesn't exist on Unix SCO. faure@kde.org +dnl ------------------------------------------------------------------------ +dnl +AC_DEFUN(AC_CHECK_S_ISSOCK, +[ +AC_MSG_CHECKING(for S_ISSOCK) +AC_CACHE_VAL(ac_cv_have_s_issock, +[ +AC_LANG_SAVE +AC_LANG_C +AC_TRY_LINK( +[ +#include +], +[ +struct stat buff; +int b = S_ISSOCK( buff.st_mode ); +], +ac_cv_have_s_issock=yes, +ac_cv_have_s_issock=no) +AC_LANG_RESTORE +]) +AC_MSG_RESULT($ac_cv_have_s_issock) +if test "$ac_cv_have_s_issock" = "yes"; then + AC_DEFINE_UNQUOTED(HAVE_S_ISSOCK, 1, [Define if sys/stat.h declares S_ISSOCK.]) +fi +]) + +dnl ------------------------------------------------------------------------ +dnl Check for MAXPATHLEN macro, defines KDEMAXPATHLEN. faure@kde.org +dnl ------------------------------------------------------------------------ +dnl +AC_DEFUN(AC_CHECK_KDEMAXPATHLEN, +[ +AC_MSG_CHECKING(for MAXPATHLEN) +AC_CACHE_VAL(ac_cv_maxpathlen, +[ +AC_LANG_C +cat > conftest.$ac_ext < +#endif +#include +#include +#ifndef MAXPATHLEN +#define MAXPATHLEN 1024 +#endif + +KDE_HELLO MAXPATHLEN + +EOF + +ac_try="$ac_cpp conftest.$ac_ext 2>/dev/null | grep '^KDE_HELLO' >conftest.out" + +if AC_TRY_EVAL(ac_try) && test -s conftest.out; then + ac_cv_maxpathlen=`sed 's#KDE_HELLO ##' conftest.out` +else + ac_cv_maxpathlen=1024 +fi + +rm conftest.* + +]) +AC_MSG_RESULT($ac_cv_maxpathlen) +AC_DEFINE_UNQUOTED(KDEMAXPATHLEN,$ac_cv_maxpathlen, [Define a safe value for MAXPATHLEN] ) +]) + +dnl ------------------------------------------------------------------------- +dnl See if the compiler supports a template repository bero@redhat.de +dnl ------------------------------------------------------------------------- +AC_DEFUN(KDE_COMPILER_REPO, +[ + REPO="" + NOREPO="" + + KDE_CHECK_COMPILER_FLAG(frepo, + [ + REPO="-frepo" + NOREPO="-fno-repo" + ]) + + if test -z "$REPO"; then + KDE_CHECK_COMPILER_FLAG(instances=explicit, + [ + REPO="-instances=explicit" + NOREPO="-instances=extern" + ]) + fi + + if test -n "$REPO"; then + AC_DEFINE_UNQUOTED(HAVE_TEMPLATE_REPOSITORY, 1, + [C++ compiler supports template repository]) + $1 + fi + + AC_SUBST(REPO) + AC_SUBST(NOREPO) +]) + +AC_DEFUN(KDE_CHECK_HEADER, +[ + AC_LANG_SAVE + kde_safe_cppflags=$CPPFLAGS + CPPFLAGS="$CPPFLAGS $all_includes" + AC_LANG_CPLUSPLUS + AC_CHECK_HEADER($1, $2, $3) + CPPFLAGS=$kde_safe_cppflags + AC_LANG_RESTORE +]) + +AC_DEFUN(KDE_CHECK_QWSPRITEFIELD, +[ + KDE_CHECK_HEADER(QwSpriteField.h, , + [ + AC_MSG_WARN([you don't have QwSpriteField.h somewhere. Please install + QwSpriteField out of kdesupport.]) + $1 + ]) +]) + +AC_DEFUN(KDE_FAST_CONFIGURE, +[ + dnl makes configure fast (needs perl) + AC_ARG_ENABLE(fast-perl, [ --disable-fast-perl disable fast Makefile generation (needs perl)], + with_fast_perl=$enableval, with_fast_perl=yes) +]) + +AC_DEFUN(KDE_CONF_FILES, +[ + val= + if test -f $srcdir/configure.files ; then + val=`sed -e 's%^%\$(top_srcdir)/%' $srcdir/configure.files` + fi + CONF_FILES= + if test -n "$val" ; then + for i in $val ; do + CONF_FILES="$CONF_FILES $i" + done + fi + AC_SUBST(CONF_FILES) +])dnl + +AC_DEFUN(KDE_SET_PREFIX, +[ + unset CDPATH + dnl make $KDEDIR the default for the installation + AC_PREFIX_DEFAULT(${KDEDIR:-/usr/local/kde}) + + if test "x$prefix" = "xNONE"; then + prefix=$ac_default_prefix + ac_configure_args="$ac_configure_args --prefix $prefix" + fi + KDE_FAST_CONFIGURE + KDE_CONF_FILES +]) + +pushdef([AC_PROG_INSTALL], +[ + dnl our own version, testing for a -p flag + popdef([AC_PROG_INSTALL]) + dnl as AC_PROG_INSTALL works as it works we first have + dnl to save if the user didn't specify INSTALL, as the + dnl autoconf one overwrites INSTALL and we have no chance to find + dnl out afterwards + test -n "$INSTALL" && kde_save_INSTALL_given=$INSTALL + test -n "$INSTALL_PROGRAM" && kde_save_INSTALL_PROGRAM_given=$INSTALL_PROGRAM + test -n "$INSTALL_SCRIPT" && kde_save_INSTALL_SCRIPT_given=$INSTALL_SCRIPT + AC_PROG_INSTALL + + if test -z "$kde_save_INSTALL_given" ; then + # OK, user hasn't given any INSTALL, autoconf found one for us + # now we test, if it supports the -p flag + AC_MSG_CHECKING(for -p flag to install) + rm -f confinst.$$.* > /dev/null 2>&1 + echo "Testtest" > confinst.$$.orig + ac_res=no + if ${INSTALL} -p confinst.$$.orig confinst.$$.new > /dev/null 2>&1 ; then + if test -f confinst.$$.new ; then + # OK, -p seems to do no harm to install + INSTALL="${INSTALL} -p" + ac_res=yes + fi + fi + rm -f confinst.$$.* + AC_MSG_RESULT($ac_res) + fi + dnl the following tries to resolve some signs and wonders coming up + dnl with different autoconf/automake versions + dnl e.g.: + dnl *automake 1.4 install-strip sets A_M_INSTALL_PROGRAM_FLAGS to -s + dnl and has INSTALL_PROGRAM = @INSTALL_PROGRAM@ $(A_M_INSTALL_PROGRAM_FLAGS) + dnl it header-vars.am, so there the actual INSTALL_PROGRAM gets the -s + dnl *automake 1.4a (and above) use INSTALL_STRIP_FLAG and only has + dnl INSTALL_PROGRAM = @INSTALL_PROGRAM@ there, but changes the + dnl install-@DIR@PROGRAMS targets to explicitly use that flag + dnl *autoconf 2.13 is dumb, and thinks it can use INSTALL_PROGRAM as + dnl INSTALL_SCRIPT, which breaks with automake <= 1.4 + dnl *autoconf >2.13 (since 10.Apr 1999) has not that failure + dnl *sometimes KDE does not use the install-@DIR@PROGRAM targets from + dnl automake (due to broken Makefile.am or whatever) to install programs, + dnl and so does not see the -s flag in automake > 1.4 + dnl to clean up that mess we: + dnl +set INSTALL_PROGRAM to use INSTALL_STRIP_FLAG + dnl which cleans KDE's program with automake > 1.4; + dnl +set INSTALL_SCRIPT to only use INSTALL, to clean up autoconf's problems + dnl with automake<=1.4 + dnl note that dues to this sometimes two '-s' flags are used (if KDE + dnl properly uses install-@DIR@PROGRAMS, but I don't care + dnl + dnl And to all this comes, that I even can't write in comments variable + dnl names used by automake, because it is so stupid to think I wanted to + dnl _use_ them, therefor I have written A_M_... instead of AM_ + dnl hmm, I wanted to say something ... ahh yes: Arghhh. + + if test -z "$kde_save_INSTALL_PROGRAM_given" ; then + INSTALL_PROGRAM='${INSTALL} $(INSTALL_STRIP_FLAG)' + fi + if test -z "$kde_save_INSTALL_SCRIPT_given" ; then + INSTALL_SCRIPT='${INSTALL}' + fi +])dnl + +AC_DEFUN(KDE_LANG_CPLUSPLUS, +[AC_LANG_CPLUSPLUS +ac_link='rm -rf SunWS_cache; ${CXX-g++} -o conftest${ac_exeext} $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&AC_FD_CC' +pushdef([AC_LANG_CPLUSPLUS], [popdef([AC_LANG_CPLUSPLUS]) KDE_LANG_CPLUSPLUS]) +]) + +pushdef([AC_LANG_CPLUSPLUS], +[popdef([AC_LANG_CPLUSPLUS]) +KDE_LANG_CPLUSPLUS +]) + +AC_DEFUN(KDE_CHECK_LONG_LONG, +[ +AC_MSG_CHECKING(for long long) +AC_CACHE_VAL(kde_cv_c_long_long, +[ + AC_LANG_SAVE + AC_LANG_CPLUSPLUS + AC_TRY_LINK([], [ + long long foo = 0; + foo = foo+1; + ], + kde_cv_c_long_long=yes, kde_cv_c_long_long=no) +]) +AC_MSG_RESULT($kde_cv_c_long_long) +if test "$kde_cv_c_long_long" = yes; then + AC_DEFINE(HAVE_LONG_LONG, 1, [Define if you have long long as datatype]) +fi +]) + +AC_DEFUN(KDE_CHECK_LIB, +[ + kde_save_LIBS="$LIBS" + LIBS="$LIBS $all_libraries" + case $host_os in + aix*) LIBS="-brtl $LIBS" + test "$GCC" = yes && LIBS="-Wl,$LIBS" + ;; + esac + AC_CHECK_LIB($1, $2, $3, $4, $5) + LIBS="$kde_save_LIBS" +]) + + + + +AC_DEFUN(KDE_CHECK_INITGROUPS, +[ + AC_REQUIRE([AC_CANONICAL_HOST]) + AC_CHECK_FUNCS(initgroups) + if test "x$ac_cv_func_initgroups" = "xyes"; then + case $host_os in + aix*) AC_LANG_SAVE + AC_LANG_CPLUSPLUS + AC_MSG_CHECKING([for initgroups prototype]) + AC_CACHE_VAL(kde_cv_check_initgroups_proto, + [ AC_TRY_COMPILE( + [ #include + ], + [ char buffer[10]; + gid_t id; + int x = initgroups(buffer,id); + ], + kde_cv_check_initgroups_proto=yes, + kde_cv_check_initgroups_proto=no) + ]) + AC_MSG_RESULT($kde_cv_check_initgroups_proto) + AC_LANG_RESTORE + ;; + *) + kde_cv_check_initgroups_proto=yes + ;; + esac + else + kde_cv_check_initgroups_proto=no + fi + if test "x$kde_cv_check_initgroups_proto" = "xyes"; then + kde_check_initgroups_proto=1 + else + kde_check_initgroups_proto=0 + fi + AC_DEFINE_UNQUOTED(HAVE_INITGROUPS_PROTO,$kde_check_initgroups_proto, + [initgroups may exist but not its prototype (e.g. AIX<4.3.3:8)]) +]) + + +AC_DEFUN(KDE_CHECK_JAVA_DIR, +[ +AC_MSG_CHECKING([for Java directory]) + +AC_ARG_WITH(java, +[ --with-java=javadir use java installed in javadir, --without-java disables ], +[ ac_java_dir=$withval +], ac_java_dir="" +) + +dnl at this point ac_java_dir is either a dir, 'no' to disable, or '' to say look in $PATH +if test "x$ac_java_dir" = xno; then + kde_cv_java_bindir=no + kde_cv_java_includedir=no + kde_cv_java_libjvmdir=no + kde_cv_java_libhpidir=no +else + if test "x$ac_java_dir" = x; then + dnl No option set -> look in $PATH + AC_CACHE_VAL(kde_cv_java_bindir, + [ + dnl First look for javac in $PATH. If not found we'll look at the option. + KDE_FIND_PATH(javac, JAVAC, [], []) + if test -n "$JAVAC"; then + kde_cv_java_bindir=`echo $JAVAC | sed -e 's,/javac$,/,'` + dnl this substitution might not work - well, we test for jni.h below + kde_cv_java_includedir=`echo $kde_cv_java_bindir | sed -e 's,bin/$,include/,'` + else + kde_cv_java_bindir=no + fi + ]) + else + dnl config option set + kde_cv_java_bindir=$ac_java_dir/bin + kde_cv_java_includedir=$ac_java_dir/include + fi +fi + +dnl Look for libjvm.so +kde_cv_java_libjvmdir=`find $kde_cv_java_bindir/.. -name libjvm.so | sed 's,libjvm.so,,'|head -n 1` +dnl Look for libhpi.so and avoid green threads +kde_cv_java_libhpidir=`find $kde_cv_java_bindir/.. -name libhpi.so | grep -v green | sed 's,libhpi.so,,'` + +dnl At this point kde_cv_java_bindir and kde_cv_java_includedir are either set or "no" +if test ! "x$kde_cv_java_bindir" = xno; then + + dnl Now check everything's fine under there + + if test ! -x "$kde_cv_java_bindir/javac"; then + AC_MSG_ERROR([javac not found under $kde_cv_java_bindir - it seems you passed a wrong --with-java.]) + fi + if test ! -x "$kde_cv_java_bindir/javah"; then + AC_MSG_ERROR([javah not found under $kde_cv_java_bindir. javac was found though! Use --with-java or --without-java.]) + fi + if test ! -x "$kde_cv_java_bindir/jar"; then + AC_MSG_ERROR([jar not found under $kde_cv_java_bindir. javac was found though! Use --with-java or --without-java.]) + fi + if test ! -r "$kde_cv_java_includedir/jni.h"; then + AC_MSG_ERROR([jni.h not found under $kde_cv_java_includedir. Use --with-java or --without-java.]) + fi + if test ! -r "$kde_cv_java_libjvmdir/libjvm.so"; then + AC_MSG_ERROR([libjvm.so not found under $kde_cv_java_libjvmdir. Use --without-java.]) + fi + if test ! -r "$kde_cv_java_libhpidir/libhpi.so"; then + AC_MSG_ERROR([libhpi.so not found under $kde_cv_java_libhpidir. Use --without-java.]) + fi + + jni_includes="-I$kde_cv_java_includedir" + dnl Strange thing, jni.h requires jni_md.h which is under genunix here.. + dnl and under linux here.. + test -d "$kde_cv_java_includedir/linux" && jni_includes="$jni_includes -I$kde_cv_java_includedir/linux" + test -d "$kde_cv_java_includedir/genunix" && jni_includes="$jni_includes -I$kde_cv_java_includedir/genunix" + + dnl Check for JNI version + AC_LANG_SAVE + AC_LANG_CPLUSPLUS + ac_cxxflags_safe="$CXXFLAGS" + CXXFLAGS="$CXXFLAGS $all_includes $jni_includes" + + AC_TRY_COMPILE([ +#include + ], + [ +#ifndef JNI_VERSION_1_2 +Syntax Error +#endif + ],[ + ],[ AC_MSG_ERROR([Incorrect version of $kde_cv_java_includedir/jni.h. + You need to have Java Development Kit (JDK) version 1.2. + + Use --with-java to specify another location. + Use --without-java to configure without java support. + Or download a newer JDK and try again. + See e.g. http://java.sun.com/products/jdk/1.2 ]) + ]) + + CXXFLAGS="$ac_cxxflags_safe" + AC_LANG_RESTORE + + dnl All tests ok, inform and subst the variables + AC_MSG_RESULT([javac/javah/jar in $kde_cv_java_bindir, jni.h in $kde_cv_java_includedir]) + + JAVAC=$kde_cv_java_bindir/javac + AC_SUBST(JAVAC) + JAVAH=$kde_cv_java_bindir/javah + AC_SUBST(JAVAH) + JAR=$kde_cv_java_bindir/jar + AC_SUBST(JAR) + AC_SUBST(jni_includes) + JVMLIBS="-L$kde_cv_java_libjvmdir -ljvm -L$kde_cv_java_libhpidir -lhpi" + AC_SUBST(JVMLIBS) +fi +]) +## libtool.m4 - Configure libtool for the host system. -*-Shell-script-*- +## Copyright 1996, 1997, 1998, 1999, 2000, 2001 +## Free Software Foundation, Inc. +## Originally by Gordon Matzigkeit , 1996 +## +## This program is free software; you can redistribute it and/or modify +## it under the terms of the GNU General Public License as published by +## the Free Software Foundation; either version 2 of the License, or +## (at your option) any later version. +## +## This program is distributed in the hope that it will be useful, but +## WITHOUT ANY WARRANTY; without even the implied warranty of +## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +## General Public License for more details. +## +## You should have received a copy of the GNU General Public License +## along with this program; if not, write to the Free Software +## Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +## +## As a special exception to the GNU General Public License, if you +## distribute this file as part of a program that contains a +## configuration script generated by Autoconf, you may include it under +## the same distribution terms that you use for the rest of that program. + +# serial 46 AC_PROG_LIBTOOL +AC_DEFUN([AC_PROG_LIBTOOL], +[AC_REQUIRE([_AC_PROG_LIBTOOL])dnl +dnl If AC_PROG_CXX has already been expanded, run AC_LIBTOOL_CXX +dnl immediately, otherwise, hook it in at the end of AC_PROG_CXX. + AC_PROVIDE_IFELSE([AC_PROG_CXX], + [AC_LIBTOOL_CXX], + [define([AC_PROG_CXX], defn([AC_PROG_CXX])[AC_LIBTOOL_CXX +])]) + +dnl Quote A][M_PROG_GCJ so that aclocal doesn't bring it in needlessly. +dnl If either AC_PROG_GCJ or A][M_PROG_GCJ have already been expanded, run +dnl AC_LIBTOOL_GCJ immediately, otherwise, hook it in at the end of both. + AC_PROVIDE_IFELSE([AC_PROG_GCJ], + [AC_LIBTOOL_GCJ], + [AC_PROVIDE_IFELSE([A][M_PROG_GCJ], + [AC_LIBTOOL_GCJ], + [AC_PROVIDE_IFELSE([LT_AC_PROG_GCJ], + [AC_LIBTOOL_GCJ], + [ifdef([AC_PROG_GCJ], + [define([AC_PROG_GCJ], defn([AC_PROG_GCJ])[AC_LIBTOOL_GCJ +])]) + ifdef([A][M_PROG_GCJ], + [define([A][M_PROG_GCJ], defn([A][M_PROG_GCJ])[AC_LIBTOOL_GCJ +])]) + ifdef([LT_AC_PROG_GCJ], + [define([LT_AC_PROG_GCJ], defn([LT_AC_PROG_GCJ])[AC_LIBTOOL_GCJ +])])])])])]) + +AC_DEFUN([_AC_PROG_LIBTOOL], +[AC_REQUIRE([AC_LIBTOOL_SETUP])dnl +AC_BEFORE([$0],[AC_LIBTOOL_CXX])dnl +AC_BEFORE([$0],[AC_LIBTOOL_GCJ])dnl + +# Save cache, so that ltconfig can load it +AC_CACHE_SAVE + +# Actually configure libtool. ac_aux_dir is where install-sh is found. +AR="$AR" LTCC="$CC" CC="$CC" CFLAGS="$CFLAGS" CPPFLAGS="$CPPFLAGS" \ +MAGIC_CMD="$MAGIC_CMD" LD="$LD" LDFLAGS="$LDFLAGS" LIBS="$LIBS" \ +LN_S="$LN_S" NM="$NM" RANLIB="$RANLIB" STRIP="$STRIP" \ +AS="$AS" DLLTOOL="$DLLTOOL" OBJDUMP="$OBJDUMP" \ +objext="$OBJEXT" exeext="$EXEEXT" reload_flag="$reload_flag" \ +deplibs_check_method="$deplibs_check_method" file_magic_cmd="$file_magic_cmd" \ +${CONFIG_SHELL-/bin/sh} $ac_aux_dir/ltconfig --no-reexec \ +$libtool_flags --no-verify --build="$build" $ac_aux_dir/ltmain.sh $host \ +|| AC_MSG_ERROR([libtool configure failed]) + +# Reload cache, that may have been modified by ltconfig +AC_CACHE_LOAD + +# This can be used to rebuild libtool when needed +LIBTOOL_DEPS="$ac_aux_dir/ltconfig $ac_aux_dir/ltmain.sh $ac_aux_dir/ltcf-c.sh" + +# Always use our own libtool. +LIBTOOL='$(SHELL) $(top_builddir)/libtool' +AC_SUBST(LIBTOOL)dnl + +# Redirect the config.log output again, so that the ltconfig log is not +# clobbered by the next message. +exec 5>>./config.log +]) + +AC_DEFUN([AC_LIBTOOL_SETUP], +[AC_PREREQ(2.13)dnl +AC_REQUIRE([AC_ENABLE_SHARED])dnl +AC_REQUIRE([AC_ENABLE_STATIC])dnl +AC_REQUIRE([AC_ENABLE_FAST_INSTALL])dnl +AC_REQUIRE([AC_CANONICAL_HOST])dnl +AC_REQUIRE([AC_CANONICAL_BUILD])dnl +AC_REQUIRE([AC_PROG_CC])dnl +AC_REQUIRE([AC_PROG_LD])dnl +AC_REQUIRE([AC_PROG_LD_RELOAD_FLAG])dnl +AC_REQUIRE([AC_PROG_NM])dnl +AC_REQUIRE([AC_PROG_LN_S])dnl +AC_REQUIRE([AC_DEPLIBS_CHECK_METHOD])dnl +# Autoconf 2.13's AC_OBJEXT and AC_EXEEXT macros only works for C compilers! +AC_REQUIRE([AC_OBJEXT])dnl +AC_REQUIRE([AC_EXEEXT])dnl +dnl + +# Only perform the check for file, if the check method requires it +case $deplibs_check_method in +file_magic*) + if test "$file_magic_cmd" = '$MAGIC_CMD'; then + AC_PATH_MAGIC + fi + ;; +esac + +AC_CHECK_TOOL(RANLIB, ranlib, :) +AC_CHECK_TOOL(STRIP, strip, :) + +# Check for any special flags to pass to ltconfig. +libtool_flags="--cache-file=$cache_file" +test "$enable_shared" = no && libtool_flags="$libtool_flags --disable-shared" +test "$enable_static" = no && libtool_flags="$libtool_flags --disable-static" +test "$enable_fast_install" = no && libtool_flags="$libtool_flags --disable-fast-install" +test "$GCC" = yes && libtool_flags="$libtool_flags --with-gcc" +test "$lt_cv_prog_gnu_ld" = yes && libtool_flags="$libtool_flags --with-gnu-ld" +ifdef([AC_PROVIDE_AC_LIBTOOL_DLOPEN], +[libtool_flags="$libtool_flags --enable-dlopen"]) +ifdef([AC_PROVIDE_AC_LIBTOOL_WIN32_DLL], +[libtool_flags="$libtool_flags --enable-win32-dll"]) +AC_ARG_ENABLE(libtool-lock, + [ --disable-libtool-lock avoid locking (might break parallel builds)]) +test "x$enable_libtool_lock" = xno && libtool_flags="$libtool_flags --disable-lock" +test x"$silent" = xyes && libtool_flags="$libtool_flags --silent" + +AC_ARG_WITH(pic, + [ --with-pic try to use only PIC/non-PIC objects [default=use both]], + pic_mode="$withval", pic_mode=default) +test x"$pic_mode" = xyes && libtool_flags="$libtool_flags --prefer-pic" +test x"$pic_mode" = xno && libtool_flags="$libtool_flags --prefer-non-pic" + +# Some flags need to be propagated to the compiler or linker for good +# libtool support. +case $host in +*-*-irix6*) + # Find out which ABI we are using. + echo '[#]line __oline__ "configure"' > conftest.$ac_ext + if AC_TRY_EVAL(ac_compile); then + case `/usr/bin/file conftest.$ac_objext` in + *32-bit*) + LD="${LD-ld} -32" + ;; + *N32*) + LD="${LD-ld} -n32" + ;; + *64-bit*) + LD="${LD-ld} -64" + ;; + esac + fi + rm -rf conftest* + ;; + +*-*-sco3.2v5*) + # On SCO OpenServer 5, we need -belf to get full-featured binaries. + SAVE_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS -belf" + AC_CACHE_CHECK([whether the C compiler needs -belf], lt_cv_cc_needs_belf, + [AC_LANG_SAVE + AC_LANG_C + AC_TRY_LINK([],[],[lt_cv_cc_needs_belf=yes],[lt_cv_cc_needs_belf=no]) + AC_LANG_RESTORE]) + if test x"$lt_cv_cc_needs_belf" != x"yes"; then + # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf + CFLAGS="$SAVE_CFLAGS" + fi + ;; + +ifdef([AC_PROVIDE_AC_LIBTOOL_WIN32_DLL], +[*-*-cygwin* | *-*-mingw* | *-*-pw32*) + AC_CHECK_TOOL(DLLTOOL, dlltool, false) + AC_CHECK_TOOL(AS, as, false) + AC_CHECK_TOOL(OBJDUMP, objdump, false) + + # recent cygwin and mingw systems supply a stub DllMain which the user + # can override, but on older systems we have to supply one + AC_CACHE_CHECK([if libtool should supply DllMain function], lt_cv_need_dllmain, + [AC_TRY_LINK([], + [extern int __attribute__((__stdcall__)) DllMain(void*, int, void*); + DllMain (0, 0, 0);], + [lt_cv_need_dllmain=no],[lt_cv_need_dllmain=yes])]) + + case $host/$CC in + *-*-cygwin*/gcc*-mno-cygwin*|*-*-mingw*) + # old mingw systems require "-dll" to link a DLL, while more recent ones + # require "-mdll" + SAVE_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS -mdll" + AC_CACHE_CHECK([how to link DLLs], lt_cv_cc_dll_switch, + [AC_TRY_LINK([], [], [lt_cv_cc_dll_switch=-mdll],[lt_cv_cc_dll_switch=-dll])]) + CFLAGS="$SAVE_CFLAGS" ;; + *-*-cygwin* | *-*-pw32*) + # cygwin systems need to pass --dll to the linker, and not link + # crt.o which will require a WinMain@16 definition. + lt_cv_cc_dll_switch="-Wl,--dll -nostartfiles" ;; + esac + ;; + ]) +esac +]) + +# AC_LIBTOOL_DLOPEN - enable checks for dlopen support +AC_DEFUN([AC_LIBTOOL_DLOPEN], [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])]) + +# AC_LIBTOOL_WIN32_DLL - declare package support for building win32 dll's +AC_DEFUN([AC_LIBTOOL_WIN32_DLL], [AC_BEFORE([$0], [AC_LIBTOOL_SETUP])]) + +# AC_ENABLE_SHARED - implement the --enable-shared flag +# Usage: AC_ENABLE_SHARED[(DEFAULT)] +# Where DEFAULT is either `yes' or `no'. If omitted, it defaults to +# `yes'. +AC_DEFUN([AC_ENABLE_SHARED], +[define([AC_ENABLE_SHARED_DEFAULT], ifelse($1, no, no, yes))dnl +AC_ARG_ENABLE(shared, +changequote(<<, >>)dnl +<< --enable-shared[=PKGS] build shared libraries [default=>>AC_ENABLE_SHARED_DEFAULT], +changequote([, ])dnl +[p=${PACKAGE-default} +case $enableval in +yes) enable_shared=yes ;; +no) enable_shared=no ;; +*) + enable_shared=no + # Look at the argument we got. We use all the common list separators. + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:," + for pkg in $enableval; do + if test "X$pkg" = "X$p"; then + enable_shared=yes + fi + done + IFS="$ac_save_ifs" + ;; +esac], +enable_shared=AC_ENABLE_SHARED_DEFAULT)dnl +]) + +# AC_DISABLE_SHARED - set the default shared flag to --disable-shared +AC_DEFUN([AC_DISABLE_SHARED], [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl +AC_ENABLE_SHARED(no)]) + +# AC_ENABLE_STATIC - implement the --enable-static flag +# Usage: AC_ENABLE_STATIC[(DEFAULT)] +# Where DEFAULT is either `yes' or `no'. If omitted, it defaults to +# `yes'. +AC_DEFUN([AC_ENABLE_STATIC], +[define([AC_ENABLE_STATIC_DEFAULT], ifelse($1, no, no, yes))dnl +AC_ARG_ENABLE(static, +changequote(<<, >>)dnl +<< --enable-static[=PKGS] build static libraries [default=>>AC_ENABLE_STATIC_DEFAULT], +changequote([, ])dnl +[p=${PACKAGE-default} +case $enableval in +yes) enable_static=yes ;; +no) enable_static=no ;; +*) + enable_static=no + # Look at the argument we got. We use all the common list separators. + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:," + for pkg in $enableval; do + if test "X$pkg" = "X$p"; then + enable_static=yes + fi + done + IFS="$ac_save_ifs" + ;; +esac], +enable_static=AC_ENABLE_STATIC_DEFAULT)dnl +]) + +# AC_DISABLE_STATIC - set the default static flag to --disable-static +AC_DEFUN([AC_DISABLE_STATIC], +[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl +AC_ENABLE_STATIC(no)]) + + +# AC_ENABLE_FAST_INSTALL - implement the --enable-fast-install flag +# Usage: AC_ENABLE_FAST_INSTALL[(DEFAULT)] +# Where DEFAULT is either `yes' or `no'. If omitted, it defaults to +# `yes'. +AC_DEFUN([AC_ENABLE_FAST_INSTALL], +[define([AC_ENABLE_FAST_INSTALL_DEFAULT], ifelse($1, no, no, yes))dnl +AC_ARG_ENABLE(fast-install, +changequote(<<, >>)dnl +<< --enable-fast-install[=PKGS] optimize for fast installation [default=>>AC_ENABLE_FAST_INSTALL_DEFAULT], +changequote([, ])dnl +[p=${PACKAGE-default} +case $enableval in +yes) enable_fast_install=yes ;; +no) enable_fast_install=no ;; +*) + enable_fast_install=no + # Look at the argument we got. We use all the common list separators. + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:," + for pkg in $enableval; do + if test "X$pkg" = "X$p"; then + enable_fast_install=yes + fi + done + IFS="$ac_save_ifs" + ;; +esac], +enable_fast_install=AC_ENABLE_FAST_INSTALL_DEFAULT)dnl +]) + +# AC_DISABLE_FAST_INSTALL - set the default to --disable-fast-install +AC_DEFUN([AC_DISABLE_FAST_INSTALL], +[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl +AC_ENABLE_FAST_INSTALL(no)]) + +# AC_LIBTOOL_PICMODE - implement the --with-pic flag +# Usage: AC_LIBTOOL_PICMODE[(MODE)] +# Where MODE is either `yes' or `no'. If omitted, it defaults to +# `both'. +AC_DEFUN([AC_LIBTOOL_PICMODE], +[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl +pic_mode=ifelse($#,1,$1,default)]) + + +# AC_PATH_TOOL_PREFIX - find a file program which can recognise shared library +AC_DEFUN([AC_PATH_TOOL_PREFIX], +[AC_MSG_CHECKING([for $1]) +AC_CACHE_VAL(lt_cv_path_MAGIC_CMD, +[case $MAGIC_CMD in + /*) + lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path. + ;; + ?:/*) + lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a dos path. + ;; + *) + ac_save_MAGIC_CMD="$MAGIC_CMD" + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" +dnl $ac_dummy forces splitting on constant user-supplied paths. +dnl POSIX.2 word splitting is done only on the output of word expansions, +dnl not every word. This closes a longstanding sh security hole. + ac_dummy="ifelse([$2], , $PATH, [$2])" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$1; then + lt_cv_path_MAGIC_CMD="$ac_dir/$1" + if test -n "$file_magic_test_file"; then + case $deplibs_check_method in + "file_magic "*) + file_magic_regex="`expr \"$deplibs_check_method\" : \"file_magic \(.*\)\"`" + MAGIC_CMD="$lt_cv_path_MAGIC_CMD" + if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null | + egrep "$file_magic_regex" > /dev/null; then + : + else + cat <&2 + +*** Warning: the command libtool uses to detect shared libraries, +*** $file_magic_cmd, produces output that libtool cannot recognize. +*** The result is that libtool may fail to recognize shared libraries +*** as such. This will affect the creation of libtool libraries that +*** depend on shared libraries, but programs linked with such libtool +*** libraries will work regardless of this problem. Nevertheless, you +*** may want to report the problem to your system manager and/or to +*** bug-libtool@gnu.org + +EOF + fi ;; + esac + fi + break + fi + done + IFS="$ac_save_ifs" + MAGIC_CMD="$ac_save_MAGIC_CMD" + ;; +esac]) +MAGIC_CMD="$lt_cv_path_MAGIC_CMD" +if test -n "$MAGIC_CMD"; then + AC_MSG_RESULT($MAGIC_CMD) +else + AC_MSG_RESULT(no) +fi +]) + + +# AC_PATH_MAGIC - find a file program which can recognise a shared library +AC_DEFUN([AC_PATH_MAGIC], +[AC_REQUIRE([AC_CHECK_TOOL_PREFIX])dnl +AC_PATH_TOOL_PREFIX(${ac_tool_prefix}file, /usr/bin:$PATH) +if test -z "$lt_cv_path_MAGIC_CMD"; then + if test -n "$ac_tool_prefix"; then + AC_PATH_TOOL_PREFIX(file, /usr/bin:$PATH) + else + MAGIC_CMD=: + fi +fi +]) + + +# AC_PROG_LD - find the path to the GNU or non-GNU linker +AC_DEFUN([AC_PROG_LD], +[AC_ARG_WITH(gnu-ld, +[ --with-gnu-ld assume the C compiler uses GNU ld [default=no]], +test "$withval" = no || with_gnu_ld=yes, with_gnu_ld=no) +AC_REQUIRE([AC_PROG_CC])dnl +AC_REQUIRE([AC_CANONICAL_HOST])dnl +AC_REQUIRE([AC_CANONICAL_BUILD])dnl +ac_prog=ld +if test "$GCC" = yes; then + # Check if gcc -print-prog-name=ld gives a path. + AC_MSG_CHECKING([for ld used by GCC]) + case $host in + *-*-mingw*) + # gcc leaves a trailing carriage return which upsets mingw + ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;; + *) + ac_prog=`($CC -print-prog-name=ld) 2>&5` ;; + esac + case $ac_prog in + # Accept absolute paths. + [[\\/]* | [A-Za-z]:[\\/]*)] + re_direlt=['/[^/][^/]*/\.\./'] + # Canonicalize the path of ld + ac_prog=`echo $ac_prog| sed 's%\\\\%/%g'` + while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do + ac_prog=`echo $ac_prog| sed "s%$re_direlt%/%"` + done + test -z "$LD" && LD="$ac_prog" + ;; + "") + # If it fails, then pretend we aren't using GCC. + ac_prog=ld + ;; + *) + # If it is relative, then search for the first ld in PATH. + with_gnu_ld=unknown + ;; + esac +elif test "$with_gnu_ld" = yes; then + AC_MSG_CHECKING([for GNU ld]) +else + AC_MSG_CHECKING([for non-GNU ld]) +fi +AC_CACHE_VAL(lt_cv_path_LD, +[if test -z "$LD"; then + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}" + for ac_dir in $PATH; do + test -z "$ac_dir" && ac_dir=. + if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then + lt_cv_path_LD="$ac_dir/$ac_prog" + # Check to see if the program is GNU ld. I'd rather use --version, + # but apparently some GNU ld's only accept -v. + # Break only if it was the GNU/non-GNU ld that we prefer. + if "$lt_cv_path_LD" -v 2>&1 < /dev/null | egrep '(GNU|with BFD)' > /dev/null; then + test "$with_gnu_ld" != no && break + else + test "$with_gnu_ld" != yes && break + fi + fi + done + IFS="$ac_save_ifs" +else + lt_cv_path_LD="$LD" # Let the user override the test with a path. +fi]) +LD="$lt_cv_path_LD" +if test -n "$LD"; then + AC_MSG_RESULT($LD) +else + AC_MSG_RESULT(no) +fi +test -z "$LD" && AC_MSG_ERROR([no acceptable ld found in \$PATH]) +AC_PROG_LD_GNU +]) + +AC_DEFUN([AC_PROG_LD_GNU], +[AC_CACHE_CHECK([if the linker ($LD) is GNU ld], lt_cv_prog_gnu_ld, +[# I'd rather use --version here, but apparently some GNU ld's only accept -v. +if $LD -v 2>&1 &5; then + lt_cv_prog_gnu_ld=yes +else + lt_cv_prog_gnu_ld=no +fi]) +with_gnu_ld=$lt_cv_prog_gnu_ld +]) + +# AC_PROG_LD_RELOAD_FLAG - find reload flag for linker +# -- PORTME Some linkers may need a different reload flag. +AC_DEFUN([AC_PROG_LD_RELOAD_FLAG], +[AC_CACHE_CHECK([for $LD option to reload object files], lt_cv_ld_reload_flag, +[lt_cv_ld_reload_flag='-r']) +reload_flag=$lt_cv_ld_reload_flag +test -n "$reload_flag" && reload_flag=" $reload_flag" +]) + +# AC_DEPLIBS_CHECK_METHOD - how to check for library dependencies +# -- PORTME fill in with the dynamic library characteristics +AC_DEFUN([AC_DEPLIBS_CHECK_METHOD], +[AC_CACHE_CHECK([how to recognise dependant libraries], +lt_cv_deplibs_check_method, +[lt_cv_file_magic_cmd='$MAGIC_CMD' +lt_cv_file_magic_test_file= +lt_cv_deplibs_check_method='unknown' +# Need to set the preceding variable on all platforms that support +# interlibrary dependencies. +# 'none' -- dependencies not supported. +# `unknown' -- same as none, but documents that we really don't know. +# 'pass_all' -- all dependencies passed with no checks. +# 'test_compile' -- check by making test program. +# 'file_magic [regex]' -- check by looking for files in library path +# which responds to the $file_magic_cmd with a given egrep regex. +# If you have `file' or equivalent on your system and you're not sure +# whether `pass_all' will *always* work, you probably want this one. + +case $host_os in +aix*) + lt_cv_deplibs_check_method=pass_all + ;; + +beos*) + lt_cv_deplibs_check_method=pass_all + ;; + +bsdi4*) + lt_cv_deplibs_check_method=['file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib)'] + lt_cv_file_magic_cmd='/usr/bin/file -L' + lt_cv_file_magic_test_file=/shlib/libc.so + ;; + +cygwin* | mingw* |pw32*) + lt_cv_deplibs_check_method='file_magic file format pei*-i386(.*architecture: i386)?' + lt_cv_file_magic_cmd='$OBJDUMP -f' + ;; + +darwin* | rhapsody*) + lt_cv_deplibs_check_method='file_magic Mach-O dynamically linked shared library' + lt_cv_file_magic_cmd='/usr/bin/file -L' + case "$host_os" in + rhapsody* | darwin1.[012]) + lt_cv_file_magic_test_file='/System/Library/Frameworks/System.framework/System' + ;; + *) # Darwin 1.3 on + lt_cv_file_magic_test_file='/usr/lib/libSystem.dylib' + ;; + esac + ;; + +freebsd* ) + if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then + case $host_cpu in + i*86 ) + # Not sure whether the presence of OpenBSD here was a mistake. + # Let's accept both of them until this is cleared up. + lt_cv_deplibs_check_method=['file_magic (FreeBSD|OpenBSD)/i[3-9]86 (compact )?demand paged shared library'] + lt_cv_file_magic_cmd=/usr/bin/file + lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*` + ;; + esac + else + lt_cv_deplibs_check_method=pass_all + fi + ;; + +gnu*) + lt_cv_deplibs_check_method=pass_all + ;; + +hpux10.20*|hpux11*) + lt_cv_deplibs_check_method=['file_magic (s[0-9][0-9][0-9]|PA-RISC[0-9].[0-9]) shared library'] + lt_cv_file_magic_cmd=/usr/bin/file + lt_cv_file_magic_test_file=/usr/lib/libc.sl + ;; + +irix5* | irix6*) + case $host_os in + irix5*) + # this will be overridden with pass_all, but let us keep it just in case + lt_cv_deplibs_check_method="file_magic ELF 32-bit MSB dynamic lib MIPS - version 1" + ;; + *) + case $LD in + *-32|*"-32 ") libmagic=32-bit;; + *-n32|*"-n32 ") libmagic=N32;; + *-64|*"-64 ") libmagic=64-bit;; + *) libmagic=never-match;; + esac + # this will be overridden with pass_all, but let us keep it just in case + lt_cv_deplibs_check_method=["file_magic ELF ${libmagic} MSB mips-[1234] dynamic lib MIPS - version 1"] + ;; + esac + lt_cv_file_magic_test_file=`echo /lib${libsuff}/libc.so*` + lt_cv_deplibs_check_method=pass_all + ;; + +# This must be Linux ELF. +linux-gnu*) + case $host_cpu in + alpha* | i*86 | powerpc* | sparc* | ia64* | s390* | m68k* | arm* | mips* | hppa* | sh* ) + lt_cv_deplibs_check_method=pass_all ;; + *) + # glibc up to 2.1.1 does not perform some relocations on ARM + lt_cv_deplibs_check_method=['file_magic ELF [0-9][0-9]*-bit [LM]SB (shared object|dynamic lib )'] ;; + esac + lt_cv_file_magic_test_file=`echo /lib/libc.so* /lib/libc-*.so` + ;; + +netbsd*) + if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then + [lt_cv_deplibs_check_method='file_magic NetBSD/[a-z0-9]* demand paged shared library'] + else + [lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [LM]SB shared object'] + fi + lt_cv_file_magic_cmd='/usr/bin/file -L' + lt_cv_file_magic_test_file=`echo /usr/lib/libc.so*` + ;; + +openbsd* ) + if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then + case "$host_cpu" in + i*86 ) + changequote(,)dnl + lt_cv_deplibs_check_method='file_magic OpenBSD/i[3-9]86 demand paged shared library' + changequote([, ])dnl + lt_cv_file_magic_cmd=/usr/bin/file + lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*` + ;; + esac + else + lt_cv_deplibs_check_method=pass_all + fi + ;; + +newsos6) + [lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (executable|dynamic lib)'] + lt_cv_file_magic_cmd=/usr/bin/file + lt_cv_file_magic_test_file=/usr/lib/libnls.so + ;; + +osf3* | osf4* | osf5*) + # this will be overridden with pass_all, but let us keep it just in case + lt_cv_deplibs_check_method='file_magic COFF format alpha shared library' + lt_cv_file_magic_test_file=/shlib/libc.so + lt_cv_deplibs_check_method=pass_all + ;; + +sco3.2v5*) + lt_cv_deplibs_check_method=pass_all + ;; + +solaris*) + lt_cv_deplibs_check_method=pass_all + lt_cv_file_magic_test_file=/lib/libc.so + ;; + +sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) + case $host_vendor in + ncr) + lt_cv_deplibs_check_method=pass_all + ;; + motorola) + lt_cv_deplibs_check_method=['file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib) M[0-9][0-9]* Version [0-9]'] + lt_cv_file_magic_test_file=`echo /usr/lib/libc.so*` + ;; + esac + ;; +esac +]) +file_magic_cmd=$lt_cv_file_magic_cmd +deplibs_check_method=$lt_cv_deplibs_check_method +]) + + +# AC_PROG_NM - find the path to a BSD-compatible name lister +AC_DEFUN([AC_PROG_NM], +[AC_MSG_CHECKING([for BSD-compatible nm]) +AC_CACHE_VAL(lt_cv_path_NM, +[if test -n "$NM"; then + # Let the user override the test. + lt_cv_path_NM="$NM" +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}" + for ac_dir in $PATH /usr/ccs/bin /usr/ucb /bin; do + test -z "$ac_dir" && ac_dir=. + tmp_nm=$ac_dir/${ac_tool_prefix}nm + if test -f $tmp_nm || test -f $tmp_nm$ac_exeext ; then + # Check to see if the nm accepts a BSD-compat flag. + # Adding the `sed 1q' prevents false positives on HP-UX, which says: + # nm: unknown option "B" ignored + # Tru64's nm complains that /dev/null is an invalid object file + if ($tmp_nm -B /dev/null 2>&1 | sed '1q'; exit 0) | egrep '(/dev/null|Invalid file or object type)' >/dev/null; then + lt_cv_path_NM="$tmp_nm -B" + break + elif ($tmp_nm -p /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then + lt_cv_path_NM="$tmp_nm -p" + break + else + lt_cv_path_NM=${lt_cv_path_NM="$tmp_nm"} # keep the first match, but + continue # so that we can try to find one that supports BSD flags + fi + fi + done + IFS="$ac_save_ifs" + test -z "$lt_cv_path_NM" && lt_cv_path_NM=nm +fi]) +NM="$lt_cv_path_NM" +AC_MSG_RESULT([$NM]) +]) + +# AC_CHECK_LIBM - check for math library +AC_DEFUN([AC_CHECK_LIBM], +[AC_REQUIRE([AC_CANONICAL_HOST])dnl +LIBM= +case $host in +*-*-beos* | *-*-cygwin* | *-*-pw32*) + # These system don't have libm + ;; +*-ncr-sysv4.3*) + AC_CHECK_LIB(mw, _mwvalidcheckl, LIBM="-lmw") + AC_CHECK_LIB(m, main, LIBM="$LIBM -lm") + ;; +*) + AC_CHECK_LIB(m, main, LIBM="-lm") + ;; +esac +]) + +# AC_LIBLTDL_CONVENIENCE[(dir)] - sets LIBLTDL to the link flags for +# the libltdl convenience library and INCLTDL to the include flags for +# the libltdl header and adds --enable-ltdl-convenience to the +# configure arguments. Note that LIBLTDL and INCLTDL are not +# AC_SUBSTed, nor is AC_CONFIG_SUBDIRS called. If DIR is not +# provided, it is assumed to be `libltdl'. LIBLTDL will be prefixed +# with '${top_builddir}/' and INCLTDL will be prefixed with +# '${top_srcdir}/' (note the single quotes!). If your package is not +# flat and you're not using automake, define top_builddir and +# top_srcdir appropriately in the Makefiles. +AC_DEFUN([AC_LIBLTDL_CONVENIENCE], +[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl + case $enable_ltdl_convenience in + no) AC_MSG_ERROR([this package needs a convenience libltdl]) ;; + "") enable_ltdl_convenience=yes + ac_configure_args="$ac_configure_args --enable-ltdl-convenience" ;; + esac + LIBLTDL='${top_builddir}/'ifelse($#,1,[$1],['libltdl'])/libltdlc.la + INCLTDL='-I${top_srcdir}/'ifelse($#,1,[$1],['libltdl']) +]) + +# AC_LIBLTDL_INSTALLABLE[(dir)] - sets LIBLTDL to the link flags for +# the libltdl installable library and INCLTDL to the include flags for +# the libltdl header and adds --enable-ltdl-install to the configure +# arguments. Note that LIBLTDL and INCLTDL are not AC_SUBSTed, nor is +# AC_CONFIG_SUBDIRS called. If DIR is not provided and an installed +# libltdl is not found, it is assumed to be `libltdl'. LIBLTDL will +# be prefixed with '${top_builddir}/' and INCLTDL will be prefixed +# with '${top_srcdir}/' (note the single quotes!). If your package is +# not flat and you're not using automake, define top_builddir and +# top_srcdir appropriately in the Makefiles. +# In the future, this macro may have to be called after AC_PROG_LIBTOOL. +AC_DEFUN([AC_LIBLTDL_INSTALLABLE], +[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl + AC_CHECK_LIB(ltdl, main, + [test x"$enable_ltdl_install" != xyes && enable_ltdl_install=no], + [if test x"$enable_ltdl_install" = xno; then + AC_MSG_WARN([libltdl not installed, but installation disabled]) + else + enable_ltdl_install=yes + fi + ]) + if test x"$enable_ltdl_install" = x"yes"; then + ac_configure_args="$ac_configure_args --enable-ltdl-install" + LIBLTDL='${top_builddir}/'ifelse($#,1,[$1],['libltdl'])/libltdl.la + INCLTDL='-I${top_srcdir}/'ifelse($#,1,[$1],['libltdl']) + else + ac_configure_args="$ac_configure_args --enable-ltdl-install=no" + LIBLTDL="-lltdl" + INCLTDL= + fi +]) + +# If this macro is not defined by Autoconf, define it here. +ifdef([AC_PROVIDE_IFELSE], + [], + [define([AC_PROVIDE_IFELSE], + [ifdef([AC_PROVIDE_$1], + [$2], [$3])])]) + +# AC_LIBTOOL_CXX - enable support for C++ libraries +AC_DEFUN([AC_LIBTOOL_CXX], [AC_REQUIRE([_AC_LIBTOOL_CXX])]) + +AC_DEFUN([_AC_LIBTOOL_CXX], +[AC_REQUIRE([AC_PROG_CXX]) +AC_REQUIRE([AC_PROG_CXXCPP]) +LIBTOOL_DEPS=$LIBTOOL_DEPS" $ac_aux_dir/ltcf-cxx.sh" +lt_save_CC="$CC" +lt_save_CFLAGS="$CFLAGS" +dnl Make sure LTCC is set to the C compiler, i.e. set LTCC before CC +dnl is set to the C++ compiler. +AR="$AR" LTCC="$CC" CC="$CXX" CXX="$CXX" CFLAGS="$CXXFLAGS" CPPFLAGS="$CPPFLAGS" \ +MAGIC_CMD="$MAGIC_CMD" LD="$LD" LDFLAGS="$LDFLAGS" LIBS="$LIBS" \ +LN_S="$LN_S" NM="$NM" RANLIB="$RANLIB" STRIP="$STRIP" \ +AS="$AS" DLLTOOL="$DLLTOOL" OBJDUMP="$OBJDUMP" \ +objext="$OBJEXT" exeext="$EXEEXT" reload_flag="$reload_flag" \ +deplibs_check_method="$deplibs_check_method" \ +file_magic_cmd="$file_magic_cmd" \ +${CONFIG_SHELL-/bin/sh} $ac_aux_dir/ltconfig -o libtool $libtool_flags \ +--build="$build" --add-tag=CXX $ac_aux_dir/ltcf-cxx.sh $host \ +|| AC_MSG_ERROR([libtool tag configuration failed]) +CC="$lt_save_CC" +CFLAGS="$lt_save_CFLAGS" + +# Redirect the config.log output again, so that the ltconfig log is not +# clobbered by the next message. +exec 5>>./config.log +]) + +# AC_LIBTOOL_GCJ - enable support for GCJ libraries +AC_DEFUN([AC_LIBTOOL_GCJ],[AC_REQUIRE([_AC_LIBTOOL_GCJ])]) + +AC_DEFUN([_AC_LIBTOOL_GCJ], +[AC_REQUIRE([AC_PROG_LIBTOOL]) +AC_PROVIDE_IFELSE([AC_PROG_GCJ],[], + [AC_PROVIDE_IFELSE([A][M_PROG_GCJ],[], + [AC_PROVIDE_IFELSE([LT_AC_PROG_GCJ],[], + [ifdef([AC_PROG_GCJ],[AC_REQUIRE([AC_PROG_GCJ])], + [ifdef([A][M_PROG_GCJ],[AC_REQUIRE([A][M_PROG_GCJ])], + [AC_REQUIRE([A][C_PROG_GCJ_OR_A][M_PROG_GCJ])])])])])]) +LIBTOOL_DEPS=$LIBTOOL_DEPS" $ac_aux_dir/ltcf-gcj.sh" +lt_save_CC="$CC" +lt_save_CFLAGS="$CFLAGS" +dnl Make sure LTCC is set to the C compiler, i.e. set LTCC before CC +dnl is set to the C++ compiler. +AR="$AR" LTCC="$CC" CC="$GCJ" CFLAGS="$GCJFLAGS" CPPFLAGS="$CPPFLAGS" \ +MAGIC_CMD="$MAGIC_CMD" LD="$LD" LDFLAGS="$LDFLAGS" LIBS="$LIBS" \ +LN_S="$LN_S" NM="$NM" RANLIB="$RANLIB" STRIP="$STRIP" \ +AS="$AS" DLLTOOL="$DLLTOOL" OBJDUMP="$OBJDUMP" \ +objext="$OBJEXT" exeext="$EXEEXT" reload_flag="$reload_flag" \ +deplibs_check_method="$deplibs_check_method" \ +file_magic_cmd="$file_magic_cmd" \ +${CONFIG_SHELL-/bin/sh} $ac_aux_dir/ltconfig -o libtool $libtool_flags \ +--build="$build" --add-tag=GCJ $ac_aux_dir/ltcf-gcj.sh $host \ +|| AC_MSG_ERROR([libtool tag configuration failed]) +CC="$lt_save_CC" +CFLAGS="$lt_save_CFLAGS" + +# Redirect the config.log output again, so that the ltconfig log is not +# clobbered by the next message. +exec 5>>./config.log +]) + +dnl old names +AC_DEFUN([AM_PROG_LIBTOOL], [AC_PROG_LIBTOOL]) +AC_DEFUN([AM_ENABLE_SHARED], [AC_ENABLE_SHARED($@)]) +AC_DEFUN([AM_ENABLE_STATIC], [AC_ENABLE_STATIC($@)]) +AC_DEFUN([AM_DISABLE_SHARED], [AC_DISABLE_SHARED($@)]) +AC_DEFUN([AM_DISABLE_STATIC], [AC_DISABLE_STATIC($@)]) +AC_DEFUN([AM_PROG_LD], [AC_PROG_LD]) +AC_DEFUN([AM_PROG_NM], [AC_PROG_NM]) + +dnl This is just to silence aclocal about the macro not being used +ifelse([AC_DISABLE_FAST_INSTALL])dnl + +AC_DEFUN([LT_AC_PROG_GCJ], +[AC_CHECK_TOOL(GCJ, gcj, no) + test "x${GCJFLAGS+set}" = xset || GCJFLAGS="-g -O2" + AC_SUBST(GCJFLAGS) +]) diff --git a/aclocal.m4 b/aclocal.m4 new file mode 100644 index 0000000..fb6efba --- /dev/null +++ b/aclocal.m4 @@ -0,0 +1,5102 @@ +dnl aclocal.m4 generated automatically by aclocal 1.4-p5 + +dnl Copyright (C) 1994, 1995-8, 1999, 2001 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. + +dnl This program is distributed in the hope that it will be useful, +dnl but WITHOUT ANY WARRANTY, to the extent permitted by law; without +dnl even the implied warranty of MERCHANTABILITY or FITNESS FOR A +dnl PARTICULAR PURPOSE. + + +dnl This file is part of the KDE libraries/packages +dnl Copyright (C) 1997 Janos Farkas (chexum@shadow.banki.hu) +dnl (C) 1997,98,99 Stephan Kulow (coolo@kde.org) + +dnl This file is free software; you can redistribute it and/or +dnl modify it under the terms of the GNU Library General Public +dnl License as published by the Free Software Foundation; either +dnl version 2 of the License, or (at your option) any later version. + +dnl This library is distributed in the hope that it will be useful, +dnl but WITHOUT ANY WARRANTY; without even the implied warranty of +dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +dnl Library General Public License for more details. + +dnl You should have received a copy of the GNU Library General Public License +dnl along with this library; see the file COPYING.LIB. If not, write to +dnl the Free Software Foundation, Inc., 59 Temple Place - Suite 330, +dnl Boston, MA 02111-1307, USA. + +dnl IMPORTANT NOTE: +dnl Please do not modify this file unless you expect your modifications to be +dnl carried into every other module in the repository. If you decide that you +dnl really want to modify it, contact coolo@kde.org mentioning that you have +dnl and that the modified file should be committed to every module. +dnl +dnl Single-module modifications are best placed in configure.in for kdelibs +dnl and kdebase or configure.in.in if present. + +dnl ------------------------------------------------------------------------ +dnl Forward compatibility macros (make autoconf 2.13 look like 2.50), +dnl thanks to Raja R Harinath. +dnl ------------------------------------------------------------------------ +dnl +ifdef([_AC_PATH_X_DIRECT],[], + [AC_DEFUN([_AC_PATH_X_DIRECT],[AC_PATH_X_DIRECT])]) +ifdef([_AC_PATH_X_XMKMF],[], + [AC_DEFUN([_AC_PATH_X_XMKMF],[AC_PATH_X_XMKMF])]) + +dnl ------------------------------------------------------------------------ +dnl Find a file (or one of more files in a list of dirs) +dnl ------------------------------------------------------------------------ +dnl +AC_DEFUN(AC_FIND_FILE, +[ +$3=NO +for i in $2; +do + for j in $1; + do + echo "configure: __oline__: $i/$j" >&AC_FD_CC + if test -r "$i/$j"; then + echo "taking that" >&AC_FD_CC + $3=$i + break 2 + fi + done +done +]) + +dnl KDE_FIND_PATH(programm-name, variable-name, list of directories, +dnl if-not-found, test-parameter) +AC_DEFUN(KDE_FIND_PATH, +[ + AC_MSG_CHECKING([for $1]) + if test -n "$$2"; then + kde_cv_path="$$2"; + else + kde_cache=`echo $1 | sed 'y%./+-%__p_%'` + + AC_CACHE_VAL(kde_cv_path_$kde_cache, + [ + kde_cv_path="NONE" + dirs="$3" + kde_save_IFS=$IFS + IFS=':' + for dir in $PATH; do + dirs="$dirs $dir" + done + IFS=$kde_save_IFS + + for dir in $dirs; do + if test -x "$dir/$1"; then + if test -n "$5" + then + evalstr="$dir/$1 $5 2>&1 " + if eval $evalstr; then + kde_cv_path="$dir/$1" + break + fi + else + kde_cv_path="$dir/$1" + break + fi + fi + done + + eval "kde_cv_path_$kde_cache=$kde_cv_path" + + ]) + + eval "kde_cv_path=\"`echo '$kde_cv_path_'$kde_cache`\"" + + fi + + if test -z "$kde_cv_path" || test "$kde_cv_path" = NONE; then + AC_MSG_RESULT(not found) + $4 + else + AC_MSG_RESULT($kde_cv_path) + $2=$kde_cv_path + + fi +]) + +AC_DEFUN(KDE_MOC_ERROR_MESSAGE, +[ + AC_MSG_ERROR([No Qt meta object compiler (moc) found! +Please check whether you installed Qt correctly. +You need to have a running moc binary. +configure tried to run $ac_cv_path_moc and the test didn't +succeed. If configure shouldn't have tried this one, set +the environment variable MOC to the right one before running +configure. +]) +]) + +AC_DEFUN(KDE_UIC_ERROR_MESSAGE, +[ + AC_MSG_WARN([No Qt ui compiler (uic) found! +Please check whether you installed Qt correctly. +You need to have a running uic binary. +configure tried to run $ac_cv_path_uic and the test didn't +succeed. If configure shouldn't have tried this one, set +the environment variable UIC to the right one before running +configure. +]) +]) + +dnl ------------------------------------------------------------------------ +dnl Find the meta object compiler and the ui compiler in the PATH, +dnl in $QTDIR/bin, and some more usual places +dnl ------------------------------------------------------------------------ +dnl +AC_DEFUN(AC_PATH_QT_MOC_UIC, +[ + qt_bindirs="" + for dir in $kde_qt_dirs; do + qt_bindirs="$qt_bindirs $dir/bin $dir/src/moc" + done + qt_bindirs="$qt_bindirs /usr/bin /usr/X11R6/bin /usr/local/qt/bin" + if test ! "$ac_qt_bindir" = "NO"; then + qt_bindirs="$ac_qt_bindir $qt_bindirs" + fi + + KDE_FIND_PATH(moc, MOC, [$qt_bindirs], [KDE_MOC_ERROR_MESSAGE]) + if test -z "$UIC_NOT_NEEDED"; then + KDE_FIND_PATH(uic, UIC, [$qt_bindirs], [UIC=""]) + if test -z "$UIC" ; then + KDE_UIC_ERROR_MESSAGE + exit 1 + fi + else + UIC="echo uic not available: " + fi + + AC_SUBST(MOC) + AC_SUBST(UIC) +]) + +AC_DEFUN(KDE_1_CHECK_PATHS, +[ + KDE_1_CHECK_PATH_HEADERS + + KDE_TEST_RPATH= + + if test -n "$USE_RPATH"; then + + if test -n "$kde_libraries"; then + KDE_TEST_RPATH="-R $kde_libraries" + fi + + if test -n "$qt_libraries"; then + KDE_TEST_RPATH="$KDE_TEST_RPATH -R $qt_libraries" + fi + + if test -n "$x_libraries"; then + KDE_TEST_RPATH="$KDE_TEST_RPATH -R $x_libraries" + fi + + KDE_TEST_RPATH="$KDE_TEST_RPATH $KDE_EXTRA_RPATH" + fi + +AC_MSG_CHECKING([for KDE libraries installed]) +ac_link='$LIBTOOL_SHELL --silent --mode=link ${CXX-g++} -o conftest $CXXFLAGS $all_includes $CPPFLAGS $LDFLAGS $all_libraries conftest.$ac_ext $LIBS -lkdecore $LIBQT $KDE_TEST_RPATH 1>&5' + +if AC_TRY_EVAL(ac_link) && test -s conftest; then + AC_MSG_RESULT(yes) +else + AC_MSG_ERROR([your system fails at linking a small KDE application! +Check, if your compiler is installed correctly and if you have used the +same compiler to compile Qt and kdelibs as you did use now. +For more details about this problem, look at the end of config.log.]) +fi + +if eval `KDEDIR= ./conftest 2>&5`; then + kde_result=done +else + kde_result=problems +fi + +KDEDIR= ./conftest 2> /dev/null >&5 # make an echo for config.log +kde_have_all_paths=yes + +KDE_SET_PATHS($kde_result) + +]) + +AC_DEFUN(KDE_SET_PATHS, +[ + kde_cv_all_paths="kde_have_all_paths=\"yes\" \ + kde_htmldir=\"$kde_htmldir\" \ + kde_appsdir=\"$kde_appsdir\" \ + kde_icondir=\"$kde_icondir\" \ + kde_sounddir=\"$kde_sounddir\" \ + kde_datadir=\"$kde_datadir\" \ + kde_locale=\"$kde_locale\" \ + kde_cgidir=\"$kde_cgidir\" \ + kde_confdir=\"$kde_confdir\" \ + kde_mimedir=\"$kde_mimedir\" \ + kde_toolbardir=\"$kde_toolbardir\" \ + kde_wallpaperdir=\"$kde_wallpaperdir\" \ + kde_templatesdir=\"$kde_templatesdir\" \ + kde_bindir=\"$kde_bindir\" \ + kde_servicesdir=\"$kde_servicesdir\" \ + kde_servicetypesdir=\"$kde_servicetypesdir\" \ + kde_moduledir=\"$kde_moduledir\" \ + kde_result=$1" +]) + +AC_DEFUN(KDE_SET_DEFAULT_PATHS, +[ +if test "$1" = "default"; then + + if test -z "$kde_htmldir"; then + kde_htmldir='\${prefix}/share/doc/HTML' + fi + if test -z "$kde_appsdir"; then + kde_appsdir='\${prefix}/share/applnk' + fi + if test -z "$kde_icondir"; then + kde_icondir='\${prefix}/share/icons' + fi + if test -z "$kde_sounddir"; then + kde_sounddir='\${prefix}/share/sounds' + fi + if test -z "$kde_datadir"; then + kde_datadir='\${prefix}/share/apps' + fi + if test -z "$kde_locale"; then + kde_locale='\${prefix}/share/locale' + fi + if test -z "$kde_cgidir"; then + kde_cgidir='\${exec_prefix}/cgi-bin' + fi + if test -z "$kde_confdir"; then + kde_confdir='\${prefix}/share/config' + fi + if test -z "$kde_mimedir"; then + kde_mimedir='\${prefix}/share/mimelnk' + fi + if test -z "$kde_toolbardir"; then + kde_toolbardir='\${prefix}/share/toolbar' + fi + if test -z "$kde_wallpaperdir"; then + kde_wallpaperdir='\${prefix}/share/wallpapers' + fi + if test -z "$kde_templatesdir"; then + kde_templatesdir='\${prefix}/share/templates' + fi + if test -z "$kde_bindir"; then + kde_bindir='\${exec_prefix}/bin' + fi + if test -z "$kde_servicesdir"; then + kde_servicesdir='\${prefix}/share/services' + fi + if test -z "$kde_servicetypesdir"; then + kde_servicetypesdir='\${prefix}/share/servicetypes' + fi + if test -z "$kde_moduledir"; then + kde_moduledir='\${exec_prefix}/lib/kde2' + fi + + KDE_SET_PATHS(defaults) + +else + + if test $kde_qtver = 1; then + AC_MSG_RESULT([compiling]) + KDE_1_CHECK_PATHS + else + AC_MSG_ERROR([path checking not yet supported for KDE 2]) + fi + +fi +]) + +AC_DEFUN(KDE_CHECK_PATHS_FOR_COMPLETENESS, +[ if test -z "$kde_htmldir" || test -z "$kde_appsdir" || + test -z "$kde_icondir" || test -z "$kde_sounddir" || + test -z "$kde_datadir" || test -z "$kde_locale" || + test -z "$kde_cgidir" || test -z "$kde_confdir" || + test -z "$kde_mimedir" || test -z "$kde_toolbardir" || + test -z "$kde_wallpaperdir" || test -z "$kde_templatesdir" || + test -z "$kde_bindir" || test -z "$kde_servicesdir" || + test -z "$kde_servicetypesdir" || test -z "$kde_moduledir" || + test "$kde_have_all_paths" != "yes"; then + kde_have_all_paths=no + fi +]) + +AC_DEFUN(KDE_MISSING_PROG_ERROR, +[ + AC_MSG_ERROR([The important program $1 was not found! +Please check whether you installed KDE correctly. +]) +]) + +AC_DEFUN(KDE_SUBST_PROGRAMS, +[ + + kde_default_bindirs="/usr/bin /usr/local/bin /opt/local/bin /usr/X11R6/bin /opt/kde/bin /opt/kde2/bin /usr/kde/bin /usr/local/kde/bin" + if test -n "$KDEDIRS"; then + kde_save_IFS=$IFS + IFS=: + for dir in $KDEDIRS; do + kde_default_bindirs="$dir/bin $kde_default_bindirs " + done + IFS=$kde_save_IFS + fi + kde_default_bindirs="$exec_prefix/bin $prefix/bin $kde_default_bindirs" + KDE_FIND_PATH(dcopidl, DCOPIDL, [$kde_default_bindirs], [KDE_MISSING_PROG_ERROR(dcopidl)]) + KDE_FIND_PATH(dcopidl2cpp, DCOPIDL2CPP, [$kde_default_bindirs], [KDE_MISSING_PROG_ERROR(dcopidl2cpp)]) + KDE_FIND_PATH(mcopidl, MCOPIDL, [$kde_default_bindirs], [KDE_MISSING_PROG_ERROR(mcopidl)]) + KDE_FIND_PATH(artsc-config, ARTSCCONFIG, [$kde_default_bindirs], [KDE_MISSING_PROG_ERROR(artsc-config)]) + KDE_FIND_PATH(kde-config, KDECONFIG, [$kde_default_bindirs]) + KDE_FIND_PATH(meinproc, MEINPROC, [$kde_default_bindirs]) + + if test -n "$MEINPROC" && test ! "$MEINPROC" = "compiled"; then + kde_sharedirs="/usr/share/kde /usr/local/share /usr/share /opt/kde2/share /opt/kde/share $prefix/share" + test -n "$KDEDIR" && kde_sharedirs="$KDEDIR/share $kde_sharedirs" + AC_FIND_FILE(apps/ksgmltools2/customization/kde-chunk.xsl, $kde_sharedirs, KDE_XSL_STYLESHEET) + if test "$KDE_XSL_STYLESHEET" = "NO"; then + KDE_XSL_STYLESHEET="" + else + KDE_XSL_STYLESHEET="$KDE_XSL_STYLESHEET/apps/ksgmltools2/customization/kde-chunk.xsl" + fi + fi + + DCOP_DEPENDENCIES='$(DCOPIDL)' + AC_SUBST(DCOPIDL) + AC_SUBST(DCOPIDL2CPP) + AC_SUBST(DCOP_DEPENDENCIES) + AC_SUBST(MCOPIDL) + AC_SUBST(ARTSCCONFIG) + AC_SUBST(KDECONFIG) + AC_SUBST(MEINPROC) + AC_SUBST(KDE_XSL_STYLESHEET) + + if test -x "$KDECONFIG"; then # it can be "compiled" + kde_libs_prefix=`$KDECONFIG --prefix` + if test -z "$kde_libs_prefix" || test ! -x "$kde_libs_prefix"; then + AC_MSG_ERROR([$KDECONFIG --prefix outputed the non existant prefix '$kde_libs_prefix' for kdelibs. + This means it has been moved since you installed it. + This won't work. Please recompile kdelibs for the new prefix. + ]) + fi + kde_libs_htmldir=`$KDECONFIG --install html --expandvars` + else + kde_libs_prefix='$(prefix)' + kde_libs_htmldir='$(kde_htmldir)' + fi + AC_SUBST(kde_libs_prefix) + AC_SUBST(kde_libs_htmldir) +])dnl + +AC_DEFUN(AC_CREATE_KFSSTND, +[ +AC_REQUIRE([AC_CHECK_RPATH]) + +AC_MSG_CHECKING([for KDE paths]) +kde_result="" +kde_cached_paths=yes +AC_CACHE_VAL(kde_cv_all_paths, +[ + KDE_SET_DEFAULT_PATHS($1) + kde_cached_paths=no +]) +eval "$kde_cv_all_paths" +KDE_CHECK_PATHS_FOR_COMPLETENESS +if test "$kde_have_all_paths" = "no" && test "$kde_cached_paths" = "yes"; then + # wrong values were cached, may be, we can set better ones + kde_result= + kde_htmldir= kde_appsdir= kde_icondir= kde_sounddir= + kde_datadir= kde_locale= kde_cgidir= kde_confdir= + kde_mimedir= kde_toolbardir= kde_wallpaperdir= kde_templatesdir= + kde_bindir= kde_servicesdir= kde_servicetypesdir= kde_moduledir= + kde_have_all_paths= + KDE_SET_DEFAULT_PATHS($1) + eval "$kde_cv_all_paths" + KDE_CHECK_PATHS_FOR_COMPLETENESS + kde_result="$kde_result (cache overridden)" +fi +if test "$kde_have_all_paths" = "no"; then + AC_MSG_ERROR([configure could not run a little KDE program to test the environment. +Since it had compiled and linked before, it must be a strange problem on your system. +Look at config.log for details. If you are not able to fix this, look at +http://www.kde.org/faq/installation.html or any www.kde.org mirror. +(If you're using an egcs version on Linux, you may update binutils!) +]) +else + rm -f conftest* + AC_MSG_RESULT($kde_result) +fi + +bindir=$kde_bindir + +KDE_SUBST_PROGRAMS + +]) + +AC_DEFUN(AC_SUBST_KFSSTND, +[ +AC_SUBST(kde_htmldir) +AC_SUBST(kde_appsdir) +AC_SUBST(kde_icondir) +AC_SUBST(kde_sounddir) +AC_SUBST(kde_datadir) +AC_SUBST(kde_locale) +AC_SUBST(kde_confdir) +AC_SUBST(kde_mimedir) +AC_SUBST(kde_wallpaperdir) +AC_SUBST(kde_bindir) +dnl for KDE 2 +AC_SUBST(kde_templatesdir) +AC_SUBST(kde_servicesdir) +AC_SUBST(kde_servicetypesdir) +AC_SUBST(kde_moduledir) +if test "$kde_qtver" = 1; then + kde_minidir="$kde_icondir/mini" +else +# for KDE 1 - this breaks KDE2 apps using minidir, but +# that's the plan ;-/ + kde_minidir="/dev/null" +fi +dnl AC_SUBST(kde_minidir) +dnl AC_SUBST(kde_cgidir) +dnl AC_SUBST(kde_toolbardir) +]) + +AC_DEFUN(KDE_MISC_TESTS, +[ + AC_LANG_C + dnl Checks for libraries. + AC_CHECK_LIB(util, main, [LIBUTIL="-lutil"]) dnl for *BSD + AC_SUBST(LIBUTIL) + AC_CHECK_LIB(compat, main, [LIBCOMPAT="-lcompat"]) dnl for *BSD + AC_SUBST(LIBCOMPAT) + kde_have_crypt= + AC_CHECK_LIB(crypt, crypt, [LIBCRYPT="-lcrypt"; kde_have_crypt=yes], + AC_CHECK_LIB(c, crypt, [kde_have_crypt=yes], [ + AC_MSG_WARN([you have no crypt in either libcrypt or libc. +You should install libcrypt from another source or configure with PAM +support]) + kde_have_crypt=no + ])) + AC_SUBST(LIBCRYPT) + if test $kde_have_crypt = yes; then + AC_DEFINE_UNQUOTED(HAVE_CRYPT, 1, [Defines if your system has the crypt function]) + fi + AC_CHECK_SOCKLEN_T + AC_LANG_C + AC_CHECK_LIB(dnet, dnet_ntoa, [X_EXTRA_LIBS="$X_EXTRA_LIBS -ldnet"]) + if test $ac_cv_lib_dnet_dnet_ntoa = no; then + AC_CHECK_LIB(dnet_stub, dnet_ntoa, + [X_EXTRA_LIBS="$X_EXTRA_LIBS -ldnet_stub"]) + fi + AC_CHECK_FUNC(inet_ntoa) + if test $ac_cv_func_inet_ntoa = no; then + AC_CHECK_LIB(nsl, inet_ntoa, X_EXTRA_LIBS="$X_EXTRA_LIBS -lnsl") + fi + AC_CHECK_FUNC(connect) + if test $ac_cv_func_connect = no; then + AC_CHECK_LIB(socket, connect, X_EXTRA_LIBS="-lsocket $X_EXTRA_LIBS", , + $X_EXTRA_LIBS) + fi + + AC_CHECK_FUNC(remove) + if test $ac_cv_func_remove = no; then + AC_CHECK_LIB(posix, remove, X_EXTRA_LIBS="$X_EXTRA_LIBS -lposix") + fi + + # BSDI BSD/OS 2.1 needs -lipc for XOpenDisplay. + AC_CHECK_FUNC(shmat, , + AC_CHECK_LIB(ipc, shmat, X_EXTRA_LIBS="$X_EXTRA_LIBS -lipc")) + + # Solaris 2.6 and others need -lresolv for res_init + AC_CHECK_FUNCS(res_init, , [ + kde_libs_safe="$LIBS" + LIBS="$LIBS $X_EXTRA_LIBS -lresolv" + AC_TRY_LINK( +[ +#include +], +[ +res_init(); +], + LIBRESOLV="-lresolv" + X_EXTRA_LIBS="$X_EXTRA_LIBS $LIBRESOLV" + AC_DEFINE(HAVE_RES_INIT, 1, [Define if you have the res_init function]) + ) + LIBS=$kde_libs_safe + ]) + + LIBSOCKET="$X_EXTRA_LIBS" + AC_SUBST(LIBSOCKET) + AC_SUBST(LIBRESOLV) + AC_SUBST(X_EXTRA_LIBS) + AC_CHECK_LIB(ucb, killpg, [LIBUCB="-lucb"]) dnl for Solaris2.4 + AC_SUBST(LIBUCB) + + case $host in dnl this *is* LynxOS specific + *-*-lynxos* ) + AC_MSG_CHECKING([LynxOS header file wrappers]) + [CFLAGS="$CFLAGS -D__NO_INCLUDE_WARN__"] + AC_MSG_RESULT(disabled) + AC_CHECK_LIB(bsd, gethostbyname, [LIBSOCKET="-lbsd"]) dnl for LynxOS + ;; + esac + + KDE_CHECK_TYPES + KDE_CHECK_LIBDL +]) + +dnl ------------------------------------------------------------------------ +dnl Find the header files and libraries for X-Windows. Extended the +dnl macro AC_PATH_X +dnl ------------------------------------------------------------------------ +dnl +AC_DEFUN(K_PATH_X, +[ +AC_REQUIRE([AC_PROG_CPP])dnl +AC_REQUIRE([KDE_MISC_TESTS])dnl +AC_MSG_CHECKING(for X) +AC_LANG_SAVE +AC_LANG_C +AC_CACHE_VAL(kde_cv_have_x, +[# One or both of the vars are not set, and there is no cached value. +if test "{$x_includes+set}" = set || test "$x_includes" = NONE; then + kde_x_includes=NO +else + kde_x_includes=$x_includes +fi +if test "{$x_libraries+set}" = set || test "$x_libraries" = NONE; then + kde_x_libraries=NO +else + kde_x_libraries=$x_libraries +fi + +# below we use the standard autoconf calls +ac_x_libraries=$kde_x_libraries +ac_x_includes=$kde_x_includes + +_AC_PATH_X_DIRECT +dnl AC_PATH_X_XMKMF picks /usr/lib as the path for the X libraries. +dnl Unfortunately, if compiling with the N32 ABI, this is not the correct +dnl location. The correct location is /usr/lib32 or an undefined value +dnl (the linker is smart enough to pick the correct default library). +dnl Things work just fine if you use just AC_PATH_X_DIRECT. +dnl Solaris has a similar problem. AC_PATH_X_XMKMF forces x_includes to +dnl /usr/openwin/include, which doesn't work. /usr/include does work, so +dnl x_includes should be left alone. +case "$host" in +mips-sgi-irix6*) + ;; +*-*-solaris*) + ;; +*) + _AC_PATH_X_XMKMF + if test -z "$ac_x_includes"; then + ac_x_includes="." + fi + if test -z "$ac_x_libraries"; then + ac_x_libraries="/usr/lib" + fi +esac +#from now on we use our own again + +# when the user already gave --x-includes, we ignore +# what the standard autoconf macros told us. +if test "$kde_x_includes" = NO; then + kde_x_includes=$ac_x_includes +fi + +# for --x-libraries too +if test "$kde_x_libraries" = NO; then + kde_x_libraries=$ac_x_libraries +fi + +if test "$kde_x_includes" = NO; then + AC_MSG_ERROR([Can't find X includes. Please check your installation and add the correct paths!]) +fi + +if test "$kde_x_libraries" = NO; then + AC_MSG_ERROR([Can't find X libraries. Please check your installation and add the correct paths!]) +fi + +# Record where we found X for the cache. +kde_cv_have_x="have_x=yes \ + kde_x_includes=$kde_x_includes kde_x_libraries=$kde_x_libraries" +])dnl + +eval "$kde_cv_have_x" + +if test "$have_x" != yes; then + AC_MSG_RESULT($have_x) + no_x=yes +else + AC_MSG_RESULT([libraries $kde_x_libraries, headers $kde_x_includes]) +fi + +if test -z "$kde_x_includes" || test "x$kde_x_includes" = xNONE; then + X_INCLUDES="" + x_includes="."; dnl better than nothing :- + else + x_includes=$kde_x_includes + X_INCLUDES="-I$x_includes" +fi + +if test -z "$kde_x_libraries" || test "x$kde_x_libraries" = xNONE; then + X_LDFLAGS="" + x_libraries="/usr/lib"; dnl better than nothing :- + else + x_libraries=$kde_x_libraries + X_LDFLAGS="-L$x_libraries" +fi +all_includes="$X_INCLUDES" +all_libraries="$X_LDFLAGS" + +AC_SUBST(X_INCLUDES) +AC_SUBST(X_LDFLAGS) +AC_SUBST(x_libraries) +AC_SUBST(x_includes) + +# Check for libraries that X11R6 Xt/Xaw programs need. +ac_save_LDFLAGS="$LDFLAGS" +LDFLAGS="$LDFLAGS $X_LDFLAGS" +# SM needs ICE to (dynamically) link under SunOS 4.x (so we have to +# check for ICE first), but we must link in the order -lSM -lICE or +# we get undefined symbols. So assume we have SM if we have ICE. +# These have to be linked with before -lX11, unlike the other +# libraries we check for below, so use a different variable. +# --interran@uluru.Stanford.EDU, kb@cs.umb.edu. +AC_CHECK_LIB(ICE, IceConnectionNumber, + [LIBSM="-lSM -lICE"], , $X_EXTRA_LIBS) +AC_SUBST(LIBSM) +LDFLAGS="$ac_save_LDFLAGS" + +AC_SUBST(X_PRE_LIBS) + +LIB_X11='-lX11 $(LIBSOCKET)' +AC_SUBST(LIB_X11) + +AC_MSG_CHECKING(for libXext) +AC_CACHE_VAL(kde_cv_have_libXext, +[ +kde_ldflags_safe="$LDFLAGS" +kde_libs_safe="$LIBS" + +LDFLAGS="$LDFLAGS $X_LDFLAGS $USER_LDFLAGS" +LIBS="-lXext -lX11 $LIBSOCKET" + +AC_TRY_LINK([ +#include +#ifdef STDC_HEADERS +# include +#endif +], +[ +printf("hello Xext\n"); +], +kde_cv_have_libXext=yes, +kde_cv_have_libXext=no + ) + +LDFLAGS=$kde_ldflags_safe +LIBS=$kde_libs_safe + ]) + +AC_MSG_RESULT($kde_cv_have_libXext) + +if test "$kde_cv_have_libXext" = "no"; then + AC_MSG_ERROR([We need a working libXext to proceed. Since configure +can't find it itself, we stop here assuming that make wouldn't find +them either.]) +fi + +AC_MSG_CHECKING(for Xinerama) + + AC_ARG_WITH(xinerama, + [ --with-xinerama enable support for Xinerama ], + [ + no_xinerama=no + ], [ + no_xinerama=yes + ] +) + +kde_save_LDFLAGS="$LDFLAGS" +kde_save_CFLAGS="$CFLAGS" +kde_save_LIBS="$LIBS" +LDFLAGS="$LDFLAGS $X_LDFLAGS $USER_LDFLAGS" +CFLAGS="$CFLAGS -I$x_includes" +LIBS="-lXinerama -lXext" + +if test "x$no_xinerama" = "xno"; then + + AC_CACHE_VAL(ac_cv_have_xinerama, + [ + AC_TRY_LINK([#include + #include ], + [XineramaIsActive(NULL);], + [ac_cv_have_xinerama="yes"], + [ac_cv_have_xinerama="no"]) + ]) +else + ac_cv_have_xinerama=no; +fi + +AC_MSG_RESULT($ac_cv_have_xinerama) + +LIBXINERAMA="" + +if test "$ac_cv_have_xinerama" = "yes"; then + AC_DEFINE(HAVE_XINERAMA, 1, [Define if you want Xinerama support]) + LIBXINERAMA="-lXinerama" +fi + +AC_SUBST(LIBXINERAMA) + +LDFLAGS="$kde_save_LDFLAGS" +CFLAGS="$kde_save_CFLAGS" +LIBS="$kde_save_LIBS" + +AC_LANG_RESTORE + +]) + +AC_DEFUN(KDE_PRINT_QT_PROGRAM, +[ +AC_REQUIRE([KDE_USE_QT]) +cat > conftest.$ac_ext < +#include +EOF +if test "$kde_qtver" = "2"; then +cat >> conftest.$ac_ext < +#include +#include +EOF + +if test $kde_qtsubver -gt 0; then +cat >> conftest.$ac_ext < +EOF +fi + +fi + +echo "#if ! ($kde_qt_verstring)" >> conftest.$ac_ext +cat >> conftest.$ac_ext <> conftest.$ac_ext <> conftest.$ac_ext <> conftest.$ac_ext <&AC_FD_CC + cat conftest.$ac_ext >&AC_FD_CC +fi + +rm -f conftest* +CXXFLAGS="$ac_cxxflags_safe" +LDFLAGS="$ac_ldflags_safe" +LIBS="$ac_libs_safe" + +LD_LIBRARY_PATH="$ac_LD_LIBRARY_PATH_safe" +export LD_LIBRARY_PATH +LIBRARY_PATH="$ac_LIBRARY_PATH" +export LIBRARY_PATH +AC_LANG_RESTORE +]) + +if test "$kde_cv_qt_direct" = "yes"; then + AC_MSG_RESULT(yes) + $1 +else + AC_MSG_RESULT(no) + $2 +fi +]) + +dnl ------------------------------------------------------------------------ +dnl Try to find the Qt headers and libraries. +dnl $(QT_LDFLAGS) will be -Lqtliblocation (if needed) +dnl and $(QT_INCLUDES) will be -Iqthdrlocation (if needed) +dnl ------------------------------------------------------------------------ +dnl +AC_DEFUN(AC_PATH_QT_1_3, +[ +AC_REQUIRE([K_PATH_X]) +AC_REQUIRE([KDE_USE_QT]) + +dnl ------------------------------------------------------------------------ +dnl Add configure flag to enable linking to MT version of Qt library. +dnl ------------------------------------------------------------------------ + +AC_ARG_ENABLE( + mt, + [ --enable-mt link to threaded Qt (experimental)], + kde_use_qt_mt=$enableval, + kde_use_qt_mt=no +) + +USING_QT_MT="" + +dnl ------------------------------------------------------------------------ +dnl If we got --enable-qt-mt then adjust some vars for the host. +dnl ------------------------------------------------------------------------ + +if test "x$kde_use_qt_mt" = "xyes"; then + + case $host in + *-*-linux-*) + if test "x$GCC" = "xyes"; then + CPPFLAGS="$CPPFLAGS -DQT_THREAD_SUPPORT -pthread" + X_EXTRA_LIBS="$X_EXTRA_LIBS -pthread" + else + AC_MSG_WARN([Compiler is not gcc. MT support disabled.]) + fi + ;; + *) + AC_MSG_WARN([MT not yet supported on $host - disabled.]) + ;; + esac + +fi + +kde_qt_was_given=yes + +dnl ------------------------------------------------------------------------ +dnl If we haven't been told how to link to Qt, we work it out for ourselves. +dnl ------------------------------------------------------------------------ + +if test -z "$LIBQT_GLOB"; then + + LIBQT_GLOB="libqt.*" + +fi + +if test -z "$LIBQT"; then + + LIBQT="-lqt" + kde_int_qt="-lqt" + +dnl ------------------------------------------------------------------------ +dnl If we got --enable-qt-mt then adjust the Qt library name for the host. +dnl ------------------------------------------------------------------------ + + if test "x$kde_use_qt_mt" = "xyes"; then + + case $host in + *-*-linux-*) + if test "x$GCC" = "xyes"; then + LIBQT="-lqt-mt" + kde_int_qt="-lqt-mt" + LIBQT_GLOB="libqt-mt.*" + USING_QT_MT="using -mt" + fi + ;; + esac + fi + + kde_qt_was_given=no + +else + kde_int_qt="$LIBQT" +fi + +if test $kde_qtver = 2; then + + AC_REQUIRE([AC_FIND_PNG]) + AC_REQUIRE([AC_FIND_JPEG]) + LIBQT="$LIBQT $LIBPNG $LIBJPEG" +fi + +AC_MSG_CHECKING([for Qt]) + +LIBQT="$LIBQT $X_PRE_LIBS -lXext -lX11 $LIBSM $LIBSOCKET" +ac_qt_includes=NO ac_qt_libraries=NO ac_qt_bindir=NO +qt_libraries="" +qt_includes="" +AC_ARG_WITH(qt-dir, + [ --with-qt-dir=DIR where the root of Qt is installed ], + [ ac_qt_includes="$withval"/include + ac_qt_libraries="$withval"/lib + ac_qt_bindir="$withval"/bin + ]) + +AC_ARG_WITH(qt-includes, + [ --with-qt-includes=DIR where the Qt includes are. ], + [ + ac_qt_includes="$withval" + ]) + +kde_qt_libs_given=no + +AC_ARG_WITH(qt-libraries, + [ --with-qt-libraries=DIR where the Qt library is installed.], + [ ac_qt_libraries="$withval" + kde_qt_libs_given=yes + ]) + +AC_CACHE_VAL(ac_cv_have_qt, +[#try to guess Qt locations + +qt_incdirs="" +for dir in $kde_qt_dirs; do + qt_incdirs="$qt_incdirs $dir/include $dir" +done +qt_incdirs="$QTINC $qt_incdirs /usr/local/qt/include /usr/include/qt /usr/include /usr/X11R6/include/X11/qt /usr/X11R6/include/qt /usr/X11R6/include/qt2 $x_includes" +if test ! "$ac_qt_includes" = "NO"; then + qt_incdirs="$ac_qt_includes $qt_incdirs" +fi + +if test "$kde_qtver" = "2"; then + kde_qt_header=qstyle.h +else + kde_qt_header=qglobal.h +fi + +AC_FIND_FILE($kde_qt_header, $qt_incdirs, qt_incdir) +ac_qt_includes="$qt_incdir" + +qt_libdirs="" +for dir in $kde_qt_dirs; do + qt_libdirs="$qt_libdirs $dir/lib $dir" +done +qt_libdirs="$QTLIB $qt_libdirs /usr/X11R6/lib /usr/lib /usr/local/qt/lib $x_libraries" +if test ! "$ac_qt_libraries" = "NO"; then + qt_libdir=$ac_qt_libraries +else + qt_libdirs="$ac_qt_libraries $qt_libdirs" + # if the Qt was given, the chance is too big that libqt.* doesn't exist + qt_libdir=NONE + for dir in $qt_libdirs; do + try="ls -1 $dir/${LIBQT_GLOB}" + if test -n "`$try 2> /dev/null`"; then qt_libdir=$dir; break; else echo "tried $dir" >&AC_FD_CC ; fi + done +fi + +ac_qt_libraries="$qt_libdir" + +AC_LANG_SAVE +AC_LANG_CPLUSPLUS + +ac_cxxflags_safe="$CXXFLAGS" +ac_ldflags_safe="$LDFLAGS" +ac_libs_safe="$LIBS" + +CXXFLAGS="$CXXFLAGS -I$qt_incdir $all_includes" +LDFLAGS="$LDFLAGS -L$qt_libdir $all_libraries $USER_LDFLAGS" +LIBS="$LIBS $LIBQT" + +KDE_PRINT_QT_PROGRAM + +if AC_TRY_EVAL(ac_link) && test -s conftest; then + rm -f conftest* +else + echo "configure: failed program was:" >&AC_FD_CC + cat conftest.$ac_ext >&AC_FD_CC + ac_qt_libraries="NO" +fi +rm -f conftest* +CXXFLAGS="$ac_cxxflags_safe" +LDFLAGS="$ac_ldflags_safe" +LIBS="$ac_libs_safe" + +AC_LANG_RESTORE +if test "$ac_qt_includes" = NO || test "$ac_qt_libraries" = NO; then + ac_cv_have_qt="have_qt=no" + ac_qt_notfound="" + if test "$ac_qt_includes" = NO; then + if test "$ac_qt_libraries" = NO; then + ac_qt_notfound="(headers and libraries)"; + else + ac_qt_notfound="(headers)"; + fi + else + ac_qt_notfound="(libraries)"; + fi + + AC_MSG_ERROR([Qt ($kde_qt_minversion) $ac_qt_notfound not found. Please check your installation! +For more details about this problem, look at the end of config.log.]) +else + have_qt="yes" +fi +]) + +eval "$ac_cv_have_qt" + +if test "$have_qt" != yes; then + AC_MSG_RESULT([$have_qt]); +else + ac_cv_have_qt="have_qt=yes \ + ac_qt_includes=$ac_qt_includes ac_qt_libraries=$ac_qt_libraries" + AC_MSG_RESULT([libraries $ac_qt_libraries, headers $ac_qt_includes $USING_QT_MT]) + + qt_libraries="$ac_qt_libraries" + qt_includes="$ac_qt_includes" +fi + +if test ! "$kde_qt_libs_given" = "yes"; then +KDE_CHECK_QT_DIRECT(qt_libraries= ,[]) +fi + +AC_SUBST(qt_libraries) +AC_SUBST(qt_includes) + +if test "$qt_includes" = "$x_includes" || test -z "$qt_includes"; then + QT_INCLUDES=""; +else + QT_INCLUDES="-I$qt_includes" + all_includes="$QT_INCLUDES $all_includes" +fi + +if test "$qt_libraries" = "$x_libraries" || test -z "$qt_libraries"; then + QT_LDFLAGS="" +else + QT_LDFLAGS="-L$qt_libraries" + all_libraries="$all_libraries $QT_LDFLAGS" +fi + +AC_SUBST(QT_INCLUDES) +AC_SUBST(QT_LDFLAGS) +AC_PATH_QT_MOC_UIC + +LIB_QT="$kde_int_qt "'$(LIBPNG) $(LIBJPEG) -lXext $(LIB_X11) $(LIBSM)' +AC_SUBST(LIB_QT) + +]) + +AC_DEFUN(AC_PATH_QT, +[ +AC_PATH_QT_1_3 +]) + +AC_DEFUN(KDE_CHECK_FINAL, +[ + AC_ARG_ENABLE(final, [ --enable-final build size optimized apps (experimental - needs lots of memory)], + kde_use_final=$enableval, kde_use_final=no) + + KDE_COMPILER_REPO + if test "x$kde_use_final" = "xyes"; then + KDE_USE_FINAL_TRUE="" + KDE_USE_FINAL_FALSE="#" + else + KDE_USE_FINAL_TRUE="#" + KDE_USE_FINAL_FALSE="" + fi + AC_SUBST(KDE_USE_FINAL_TRUE) + AC_SUBST(KDE_USE_FINAL_FALSE) + + AC_ARG_ENABLE(closure, [ --disable-closure don't delay template instantiation], + kde_use_closure=$enableval, kde_use_closure=yes) + + if test "x$kde_use_closure" = "xyes"; then + KDE_USE_CLOSURE_TRUE="" + KDE_USE_CLOSURE_FALSE="#" +# CXXFLAGS="$CXXFLAGS $REPO" + else + KDE_USE_CLOSURE_TRUE="#" + KDE_USE_CLOSURE_FALSE="" + fi + AC_SUBST(KDE_USE_CLOSURE_TRUE) + AC_SUBST(KDE_USE_CLOSURE_FALSE) +]) + +dnl ------------------------------------------------------------------------ +dnl Now, the same with KDE +dnl $(KDE_LDFLAGS) will be the kdeliblocation (if needed) +dnl and $(kde_includes) will be the kdehdrlocation (if needed) +dnl ------------------------------------------------------------------------ +dnl +AC_DEFUN(AC_BASE_PATH_KDE, +[ +AC_PREREQ([2.13]) +AC_REQUIRE([AC_PATH_QT])dnl +AC_CHECK_RPATH +AC_MSG_CHECKING([for KDE]) + +if test "${prefix}" != NONE; then + kde_includes=${prefix}/include + ac_kde_includes=$prefix/include + + if test "${exec_prefix}" != NONE; then + kde_libraries=${exec_prefix}/lib + ac_kde_libraries=$exec_prefix/lib + else + kde_libraries=${prefix}/lib + ac_kde_libraries=$prefix/lib + fi +else + ac_kde_includes= + ac_kde_libraries= + kde_libraries="" + kde_includes="" +fi + +AC_CACHE_VAL(ac_cv_have_kde, +[#try to guess kde locations + +if test "$kde_qtver" = 1; then + kde_check_header="ksock.h" + kde_check_lib="libkdecore.la" +else + kde_check_header="ksharedptr.h" + kde_check_lib="libkio.la" +fi + +if test -z "$1"; then + +kde_incdirs="/usr/lib/kde/include /usr/local/kde/include /usr/local/include /usr/kde/include /usr/include/kde /usr/include /opt/kde2/include /opt/kde/include $x_includes $qt_includes" +test -n "$KDEDIR" && kde_incdirs="$KDEDIR/include $KDEDIR/include/kde $KDEDIR $kde_incdirs" +kde_incdirs="$ac_kde_includes $kde_incdirs" +AC_FIND_FILE($kde_check_header, $kde_incdirs, kde_incdir) +ac_kde_includes="$kde_incdir" + +if test -n "$ac_kde_includes" && test ! -r "$ac_kde_includes/$kde_check_header"; then + AC_MSG_ERROR([ +in the prefix, you've chosen, are no KDE headers installed. This will fail. +So, check this please and use another prefix!]) +fi + +kde_libdirs="/usr/lib/kde/lib /usr/local/kde/lib /usr/kde/lib /usr/lib/kde /usr/lib /usr/X11R6/lib /usr/local/lib /opt/kde2/lib /opt/kde/lib /usr/X11R6/kde/lib" +test -n "$KDEDIR" && kde_libdirs="$KDEDIR/lib $KDEDIR $kde_libdirs" +kde_libdirs="$ac_kde_libraries $kde_libdirs" +AC_FIND_FILE($kde_check_lib, $kde_libdirs, kde_libdir) +ac_kde_libraries="$kde_libdir" + +if test -n "$ac_kde_libraries" && test ! -r "$ac_kde_libraries/$kde_check_lib"; then +AC_MSG_ERROR([ +in the prefix, you've chosen, are no KDE libraries installed. This will fail. +So, check this please and use another prefix!]) +fi +ac_kde_libraries="$kde_libdir" + +if test "$ac_kde_includes" = NO || test "$ac_kde_libraries" = NO; then + ac_cv_have_kde="have_kde=no" +else + ac_cv_have_kde="have_kde=yes \ + ac_kde_includes=$ac_kde_includes ac_kde_libraries=$ac_kde_libraries" +fi + +else dnl test -z $1 + + ac_cv_have_kde="have_kde=no" + +fi +])dnl + +eval "$ac_cv_have_kde" + +if test "$have_kde" != "yes"; then + if test "${prefix}" = NONE; then + ac_kde_prefix="$ac_default_prefix" + else + ac_kde_prefix="$prefix" + fi + if test "$exec_prefix" = NONE; then + ac_kde_exec_prefix="$ac_kde_prefix" + AC_MSG_RESULT([will be installed in $ac_kde_prefix]) + else + ac_kde_exec_prefix="$exec_prefix" + AC_MSG_RESULT([will be installed in $ac_kde_prefix and $ac_kde_exec_prefix]) + fi + + kde_libraries="${ac_kde_exec_prefix}/lib" + kde_includes=${ac_kde_prefix}/include + +else + ac_cv_have_kde="have_kde=yes \ + ac_kde_includes=$ac_kde_includes ac_kde_libraries=$ac_kde_libraries" + AC_MSG_RESULT([libraries $ac_kde_libraries, headers $ac_kde_includes]) + + kde_libraries="$ac_kde_libraries" + kde_includes="$ac_kde_includes" +fi +AC_SUBST(kde_libraries) +AC_SUBST(kde_includes) + +if test "$kde_includes" = "$x_includes" || test "$kde_includes" = "$qt_includes" || test "$kde_includes" = "/usr/include"; then + KDE_INCLUDES="" +else + KDE_INCLUDES="-I$kde_includes" + all_includes="$KDE_INCLUDES $all_includes" +fi + +KDE_LDFLAGS="-L$kde_libraries" +if test ! "$kde_libraries" = "$x_libraries" && test ! "$kde_libraries" = "$qt_libraries" ; then + all_libraries="$all_libraries $KDE_LDFLAGS" +fi + +AC_SUBST(KDE_LDFLAGS) +AC_SUBST(KDE_INCLUDES) + +AC_REQUIRE([KDE_CHECK_EXTRA_LIBS]) + +all_libraries="$all_libraries $USER_LDFLAGS" +all_includes="$all_includes $USER_INCLUDES" +AC_SUBST(all_includes) +AC_SUBST(all_libraries) + +AC_SUBST(AUTODIRS) +]) + +AC_DEFUN(KDE_CHECK_EXTRA_LIBS, +[ +AC_MSG_CHECKING(for extra includes) +AC_ARG_WITH(extra-includes, [ --with-extra-includes=DIR + adds non standard include paths], + kde_use_extra_includes="$withval", + kde_use_extra_includes=NONE +) +kde_extra_includes= +if test -n "$kde_use_extra_includes" && \ + test "$kde_use_extra_includes" != "NONE"; then + + ac_save_ifs=$IFS + IFS=':' + for dir in $kde_use_extra_includes; do + kde_extra_includes="$kde_extra_includes $dir" + USER_INCLUDES="$USER_INCLUDES -I$dir" + done + IFS=$ac_save_ifs + kde_use_extra_includes="added" +else + kde_use_extra_includes="no" +fi +AC_SUBST(USER_INCLUDES) + +AC_MSG_RESULT($kde_use_extra_includes) + +kde_extra_libs= +AC_MSG_CHECKING(for extra libs) +AC_ARG_WITH(extra-libs, [ --with-extra-libs=DIR adds non standard library paths], + kde_use_extra_libs=$withval, + kde_use_extra_libs=NONE +) +if test -n "$kde_use_extra_libs" && \ + test "$kde_use_extra_libs" != "NONE"; then + + ac_save_ifs=$IFS + IFS=':' + for dir in $kde_use_extra_libs; do + kde_extra_libs="$kde_extra_libs $dir" + KDE_EXTRA_RPATH="$KDE_EXTRA_RPATH -R $dir" + USER_LDFLAGS="$USER_LDFLAGS -L$dir" + done + IFS=$ac_save_ifs + kde_use_extra_libs="added" +else + kde_use_extra_libs="no" +fi + +AC_SUBST(USER_LDFLAGS) + +AC_MSG_RESULT($kde_use_extra_libs) + +]) + +AC_DEFUN(KDE_1_CHECK_PATH_HEADERS, +[ + AC_MSG_CHECKING([for KDE headers installed]) + AC_LANG_SAVE + AC_LANG_CPLUSPLUS +cat > conftest.$ac_ext < +#endif +#include +#include "confdefs.h" +#include + +int main() { + printf("kde_htmldir=\\"%s\\"\n", KApplication::kde_htmldir().data()); + printf("kde_appsdir=\\"%s\\"\n", KApplication::kde_appsdir().data()); + printf("kde_icondir=\\"%s\\"\n", KApplication::kde_icondir().data()); + printf("kde_sounddir=\\"%s\\"\n", KApplication::kde_sounddir().data()); + printf("kde_datadir=\\"%s\\"\n", KApplication::kde_datadir().data()); + printf("kde_locale=\\"%s\\"\n", KApplication::kde_localedir().data()); + printf("kde_cgidir=\\"%s\\"\n", KApplication::kde_cgidir().data()); + printf("kde_confdir=\\"%s\\"\n", KApplication::kde_configdir().data()); + printf("kde_mimedir=\\"%s\\"\n", KApplication::kde_mimedir().data()); + printf("kde_toolbardir=\\"%s\\"\n", KApplication::kde_toolbardir().data()); + printf("kde_wallpaperdir=\\"%s\\"\n", + KApplication::kde_wallpaperdir().data()); + printf("kde_bindir=\\"%s\\"\n", KApplication::kde_bindir().data()); + printf("kde_partsdir=\\"%s\\"\n", KApplication::kde_partsdir().data()); + printf("kde_servicesdir=\\"/tmp/dummy\\"\n"); + printf("kde_servicetypesdir=\\"/tmp/dummy\\"\n"); + printf("kde_moduledir=\\"/tmp/dummy\\"\n"); + return 0; + } +EOF + + ac_compile='${CXX-g++} -c $CXXFLAGS $all_includes $CPPFLAGS conftest.$ac_ext' + if AC_TRY_EVAL(ac_compile); then + AC_MSG_RESULT(yes) + else + AC_MSG_ERROR([your system is not able to compile a small KDE application! +Check, if you installed the KDE header files correctly. +For more details about this problem, look at the end of config.log.]) + fi + + AC_LANG_RESTORE +]) + +AC_DEFUN(KDE_CHECK_KDEQTADDON, +[ +AC_MSG_CHECKING(for kde-qt-addon) +AC_CACHE_VAL(kde_cv_have_kdeqtaddon, +[ + kde_ldflags_safe="$LDFLAGS" + kde_libs_safe="$LIBS" + kde_cxxflags_safe="$CXXFLAGS" + + LIBS="-lkde-qt-addon $LIBQT $LIBS" + CXXFLAGS="$CXXFLAGS -I$prefix/include -I$prefix/include/kde $all_includes" + LDFLAGS="$LDFLAGS $all_libraries $USER_LDFLAGS" + + AC_TRY_LINK([ + #include + ], + [ + QDomDocument doc; + ], + kde_cv_have_kdeqtaddon=yes, + kde_cv_have_kdeqtaddon=no + ) + + LDFLAGS=$kde_ldflags_safe + LIBS=$kde_libs_safe + kde_cxxflags_safe="$CXXFLAGS" +]) + +AC_MSG_RESULT($kde_cv_have_kdeqtaddon) + +if test "$kde_cv_have_kdeqtaddon" = "no"; then + AC_MSG_ERROR([Can't find libkde-qt-addon. You need to install it first. +It is a separate package (and CVS module) named kde-qt-addon.]) +fi +]) + +AC_DEFUN(KDE_CHECK_KIMGIO, +[ + AC_REQUIRE([AC_BASE_PATH_KDE]) + AC_REQUIRE([KDE_CHECK_EXTRA_LIBS]) + AC_REQUIRE([AC_FIND_TIFF]) + AC_REQUIRE([AC_FIND_JPEG]) + AC_REQUIRE([AC_FIND_PNG]) + AC_REQUIRE([KDE_CREATE_LIBS_ALIASES]) + + if test "$1" = "existance"; then + AC_LANG_SAVE + AC_LANG_CPLUSPLUS + kde_save_LIBS="$LIBS" + LIBS="$LIBS $all_libraries $LIBJPEG $LIBTIFF $LIBPNG $LIBQT -lm" + AC_CHECK_LIB(kimgio, kimgioRegister, [ + LIBKIMGIO_EXISTS=yes],LIBKIMGIO_EXISTS=no) + LIBS="$kde_save_LIBS" + AC_LANG_RESTORE + else + LIBKIMGIO_EXISTS=yes + fi + + if test "$LIBKIMGIO_EXISTS" = "yes"; then + LIB_KIMGIO='-lkimgio' + else + LIB_KIMGIO='' + fi + AC_SUBST(LIB_KIMGIO) +]) + +AC_DEFUN(KDE_CREATE_LIBS_ALIASES, +[ + AC_REQUIRE([KDE_MISC_TESTS]) + AC_REQUIRE([KDE_CHECK_LIBDL]) + AC_REQUIRE([K_PATH_X]) + +if test $kde_qtver = 2; then + LIB_KDECORE='-lkdecore' + AC_SUBST(LIB_KDECORE) + LIB_KDEUI='-lkdeui' + AC_SUBST(LIB_KDEUI) + LIB_KFORMULA='-lkformula' + AC_SUBST(LIB_KFORMULA) + LIB_KIO='-lkio' + AC_SUBST(LIB_KIO) + LIB_KSYCOCA='-lksycoca' + AC_SUBST(LIB_KSYCOCA) + LIB_SMB='-lsmb' + AC_SUBST(LIB_SMB) + LIB_KFILE='-lkfile' + AC_SUBST(LIB_KFILE) + LIB_KAB='-lkab' + AC_SUBST(LIB_KAB) + LIB_KHTML='-lkhtml' + AC_SUBST(LIB_KHTML) + LIB_KSPELL='-lkspell' + AC_SUBST(LIB_KSPELL) + LIB_KPARTS='-lkparts' + AC_SUBST(LIB_KPARTS) + LIB_KWRITE='-lkwrite' + AC_SUBST(LIB_KWRITE) +else + LIB_KDECORE='-lkdecore -lXext $(LIB_QT)' + AC_SUBST(LIB_KDECORE) + LIB_KDEUI='-lkdeui $(LIB_KDECORE)' + AC_SUBST(LIB_KDEUI) + LIB_KFM='-lkfm $(LIB_KDECORE)' + AC_SUBST(LIB_KFM) + LIB_KFILE='-lkfile $(LIB_KFM) $(LIB_KDEUI)' + AC_SUBST(LIB_KFILE) + LIB_KAB='-lkab $(LIB_KIMGIO) $(LIB_KDECORE)' + AC_SUBST(LIB_KAB) +fi +]) + +AC_DEFUN(AC_PATH_KDE, +[ + AC_BASE_PATH_KDE + AC_ARG_ENABLE(path-check, [ --disable-path-check don't try to find out, where to install], + [ + if test "$enableval" = "no"; + then ac_use_path_checking="default" + else ac_use_path_checking="" + fi + ], + [ + if test "$kde_qtver" = 1; + then ac_use_path_checking="" + else ac_use_path_checking="default" + fi + ] + ) + + AC_CREATE_KFSSTND($ac_use_path_checking) + + AC_SUBST_KFSSTND + KDE_CREATE_LIBS_ALIASES +]) + +dnl obsolete +AC_DEFUN(AC_CHECK_SETENV, +[ + AC_OBSOLETE([$0], [; instead use AC_CHECK_FUNCS([setenv unsetenv])])dnl + AC_CHECK_FUNCS([setenv unsetenv]) +]) + +AC_DEFUN(AC_CHECK_GETDOMAINNAME, +[ +AC_MSG_CHECKING(for getdomainname) +AC_CACHE_VAL(ac_cv_func_getdomainname, +[ +AC_LANG_SAVE +AC_LANG_CPLUSPLUS +save_CXXFLAGS="$CXXFLAGS" +kde_safe_LIBS="$LIBS" +LIBS="$LIBS $X_EXTRA_LIBS" +if test "$GCC" = "yes"; then +CXXFLAGS="$CXXFLAGS -pedantic-errors" +fi +AC_TRY_COMPILE([ +#include +#include +], +[ +char buffer[200]; +getdomainname(buffer, 200); +], +ac_cv_func_getdomainname=yes, +ac_cv_func_getdomainname=no) +CXXFLAGS="$save_CXXFLAGS" +LIBS=$kde_safe_LIBS +AC_LANG_RESTORE +]) +AC_MSG_RESULT($ac_cv_func_getdomainname) + +AC_MSG_CHECKING([if getdomainname needs custom prototype]) +AC_CACHE_VAL(ac_cv_proto_getdomainname, +[ +AC_LANG_SAVE +AC_LANG_CPLUSPLUS +if eval "test \"`echo $ac_cv_func_getdomainname`\" = yes"; then + ac_cv_proto_getdomainname=no +else + kde_safe_libs=$LIBS + LIBS="$LIBS $X_EXTRA_LIBS" + AC_TRY_LINK([ +#include +#include + +extern "C" int getdomainname (char *, int); +], +[ +char buffer[200]; +getdomainname(buffer, 200); +], + ac_cv_func_getdomainname=yes + ac_cv_proto_getdomainname=yes, + AC_MSG_RESULT([fatal error]) + AC_MSG_ERROR([getdomainname unavailable])) +fi +LIBS=$kde_safe_libs +AC_LANG_RESTORE +]) +AC_MSG_RESULT($ac_cv_proto_getdomainname) + +if eval "test \"`echo $ac_cv_func_getdomainname`\" = yes"; then + AC_DEFINE(HAVE_GETDOMAINNAME, 1, [Define if you have getdomainname]) +fi +if eval "test \"`echo $ac_cv_proto_getdomainname`\" = no"; then + AC_DEFINE(HAVE_GETDOMAINNAME_PROTO, 1, + [Define if you have getdomainname prototype]) +fi + +]) + +AC_DEFUN(AC_CHECK_GETHOSTNAME, +[ + +AC_MSG_CHECKING([for gethostname]) +AC_CACHE_VAL(ac_cv_func_gethostname, +[ +AC_LANG_SAVE +AC_LANG_CPLUSPLUS +save_CXXFLAGS="$CXXFLAGS" +if test "$GCC" = "yes"; then +CXXFLAGS="$CXXFLAGS -pedantic-errors" +fi +AC_TRY_LINK([ +#include +#include +], +[ +char buffer[200]; +gethostname(buffer, 200); +], +ac_cv_func_gethostname=yes, +ac_cv_func_gethostname=no) +CXXFLAGS="$save_CXXFLAGS" +AC_LANG_RESTORE +]) +AC_MSG_RESULT($ac_cv_func_gethostname) + +AC_MSG_CHECKING([if gethostname needs custom prototype]) +AC_CACHE_VAL(ac_cv_proto_gethostname, +[ +AC_LANG_SAVE +AC_LANG_CPLUSPLUS +if eval "test \"`echo $ac_cv_func_gethostname`\" = yes"; then + ac_cv_proto_gethostname=no +else + AC_TRY_LINK([ +#include +#include + +extern "C" int gethostname (char *, int); +], +[ +char buffer[200]; +gethostname(buffer, 200); +], + ac_cv_func_gethostname=yes + ac_cv_proto_gethostname=yes, + AC_MSG_RESULT([fatal error]) + AC_MSG_ERROR(gethostname unavailable)) +fi +AC_LANG_RESTORE +]) +AC_MSG_RESULT($ac_cv_proto_gethostname) + +if eval "test \"`echo $ac_cv_proto_gethostname`\" = no"; then + AC_DEFINE(HAVE_GETHOSTNAME_PROTO, 1, + [Define if you have gethostname prototype]) +fi +if eval "test \"`echo $ac_cv_func_gethostname`\" = yes"; then + AC_DEFINE(HAVE_GETHOSTNAME, 1, [Define if you have gethostname]) +fi +]) + +AC_DEFUN(AC_CHECK_USLEEP, +[ +AC_MSG_CHECKING([for usleep]) +AC_CACHE_VAL(ac_cv_func_usleep, +[ +AC_LANG_SAVE +AC_LANG_CPLUSPLUS +ac_libs_safe="$LIBS" +LIBS="$LIBS $LIBUCB" +AC_TRY_LINK([ +#include +#include +], +[ +usleep(200); +], +ac_cv_func_usleep=yes, +ac_cv_func_usleep=no) +LIBS="$ac_libs_safe" +AC_LANG_RESTORE +]) +AC_MSG_RESULT($ac_cv_func_usleep) +if eval "test \"`echo $ac_cv_func_usleep`\" = yes"; then + AC_DEFINE(HAVE_USLEEP, 1, [Define if you have the usleep function]) +fi +]) + +AC_DEFUN(AC_CHECK_RANDOM, +[ +AC_MSG_CHECKING([for random]) +AC_CACHE_VAL(ac_cv_func_random, +[ +AC_LANG_SAVE +AC_LANG_CPLUSPLUS +ac_libs_safe="$LIBS" +LIBS="$LIBS $LIBUCB" +AC_TRY_LINK([ +#include +], +[ +random(); +], +ac_cv_func_random=yes, +ac_cv_func_random=no) +LIBS="$ac_libs_safe" +AC_LANG_RESTORE +]) +AC_MSG_RESULT($ac_cv_func_random) +if eval "test \"`echo $ac_cv_func_random`\" = yes"; then + AC_DEFINE(HAVE_RANDOM, 1, [Define if you have random]) +fi +]) + +AC_DEFUN(AC_FIND_GIF, + [AC_MSG_CHECKING([for giflib]) +AC_CACHE_VAL(ac_cv_lib_gif, +[ac_save_LIBS="$LIBS" +LIBS="$all_libraries -lgif -lX11 $LIBSOCKET" +AC_TRY_LINK(dnl +[ +#ifdef __cplusplus +extern "C" { +#endif +int GifLastError(void); +#ifdef __cplusplus +} +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +], + [return GifLastError();], + eval "ac_cv_lib_gif=yes", + eval "ac_cv_lib_gif=no") +LIBS="$ac_save_LIBS" +])dnl +if eval "test \"`echo $ac_cv_lib_gif`\" = yes"; then + AC_MSG_RESULT(yes) + AC_DEFINE_UNQUOTED(HAVE_LIBGIF, 1, [Define if you have libgif]) +else + AC_MSG_ERROR(You need giflib30. Please install the kdesupport package) +fi +]) + +AC_DEFUN(KDE_FIND_JPEG_HELPER, +[ +AC_MSG_CHECKING([for libjpeg$2]) +AC_CACHE_VAL(ac_cv_lib_jpeg_$1, +[ +AC_LANG_C +ac_save_LIBS="$LIBS" +LIBS="$all_libraries $USER_LDFLAGS -ljpeg$2 -lm" +ac_save_CFLAGS="$CFLAGS" +CFLAGS="$CFLAGS $all_includes $USER_INCLUDES" +AC_TRY_LINK( +[/* Override any gcc2 internal prototype to avoid an error. */ +struct jpeg_decompress_struct; +typedef struct jpeg_decompress_struct * j_decompress_ptr; +typedef int size_t; +#ifdef __cplusplus +extern "C" { +#endif + void jpeg_CreateDecompress(j_decompress_ptr cinfo, + int version, size_t structsize); +#ifdef __cplusplus +} +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +], + [jpeg_CreateDecompress(0L, 0, 0);], + eval "ac_cv_lib_jpeg_$1=-ljpeg$2", + eval "ac_cv_lib_jpeg_$1=no") +LIBS="$ac_save_LIBS" +CFLAGS="$ac_save_CFLAGS" +]) + +if eval "test ! \"`echo $ac_cv_lib_jpeg_$1`\" = no"; then + LIBJPEG="$ac_cv_lib_jpeg_$1" + AC_MSG_RESULT($ac_cv_lib_jpeg_$1) +else + AC_MSG_RESULT(no) + $3 +fi + +]) + +AC_DEFUN(AC_FIND_JPEG, +[ +dnl first look for libraries +KDE_FIND_JPEG_HELPER(6b, 6b, + KDE_FIND_JPEG_HELPER(normal, [], + [ + LIBJPEG= + ] + ) +) + +dnl then search the headers (can't use simply AC_TRY_xxx, as jpeglib.h +dnl requires system dependent includes loaded before it) +jpeg_incdirs="/usr/include /usr/local/include $kde_extra_includes" +AC_FIND_FILE(jpeglib.h, $jpeg_incdirs, jpeg_incdir) +test "x$jpeg_incdir" = xNO && jpeg_incdir= + +dnl if headers _and_ libraries are missing, this is no error, and we +dnl continue with a warning (the user will get no jpeg support in khtml) +dnl if only one is missing, it means a configuration error, but we still +dnl only warn +if test -n "$jpeg_incdir" && test -n "$LIBJPEG" ; then + AC_DEFINE_UNQUOTED(HAVE_LIBJPEG, 1, [Define if you have libjpeg]) +else + if test -n "$jpeg_incdir" || test -n "$LIBJPEG" ; then + AC_MSG_WARN([ +There is an installation error in jpeg support. You seem to have only one +of either the headers _or_ the libraries installed. You may need to either +provide correct --with-extra-... options, or the development package of +libjpeg6b. You can get a source package of libjpeg from http://www.ijg.org/ +Disabling JPEG support. +]) + else + AC_MSG_WARN([libjpeg not found. disable JPEG support.]) + fi + jpeg_incdir= + LIBJPEG= +fi + +AC_SUBST(LIBJPEG) +]) + +AC_DEFUN(AC_FIND_ZLIB, +[ +AC_REQUIRE([KDE_CHECK_EXTRA_LIBS]) +AC_MSG_CHECKING([for libz]) +AC_CACHE_VAL(ac_cv_lib_z, +[ +AC_LANG_C +kde_save_LIBS="$LIBS" +LIBS="$all_libraries $USER_LDFLAGS -lz $LIBSOCKET" +kde_save_CFLAGS="$CFLAGS" +CFLAGS="$CFLAGS $all_includes $USER_INCLUDES" +AC_TRY_LINK(dnl +[ +#include +], + [return (zlibVersion() == ZLIB_VERSION); ], + eval "ac_cv_lib_z='-lz'", + eval "ac_cv_lib_z=no") +LIBS="$kde_save_LIBS" +CFLAGS="$kde_save_CFLAGS" +])dnl +if test ! "$ac_cv_lib_z" = no; then + AC_DEFINE_UNQUOTED(HAVE_LIBZ, 1, [Define if you have libz]) + LIBZ="$ac_cv_lib_z" + AC_SUBST(LIBZ) + AC_MSG_RESULT($ac_cv_lib_z) +else + AC_MSG_ERROR(not found. Check your installation and look into config.log) + LIBZ="" + AC_SUBST(LIBZ) +fi +]) + +AC_DEFUN(KDE_TRY_TIFFLIB, +[ +AC_MSG_CHECKING([for libtiff $1]) + +AC_CACHE_VAL(kde_cv_libtiff_$1, +[ +AC_LANG_SAVE +AC_LANG_CPLUSPLUS +kde_save_LIBS="$LIBS" +LIBS="$all_libraries $USER_LDFLAGS -l$1 $LIBJPEG $LIBZ -lX11 $LIBSOCKET -lm" +kde_save_CXXFLAGS="$CXXFLAGS" +CXXFLAGS="$CXXFLAGS $all_includes $USER_INCLUDES" + +AC_TRY_LINK(dnl +[ +#include +], + [return (TIFFOpen( "", "r") == 0); ], +[ + kde_cv_libtiff_$1="-l$1 $LIBJPEG $LIBZ" +], [ + kde_cv_libtiff_$1=no +]) + +LIBS="$kde_save_LIBS" +CXXFLAGS="$kde_save_CXXFLAGS" +AC_LANG_RESTORE +]) + +if test "$kde_cv_libtiff_$1" = "no"; then + AC_MSG_RESULT(no) + LIBTIFF="" + $3 +else + LIBTIFF="$kde_cv_libtiff_$1" + AC_MSG_RESULT(yes) + AC_DEFINE_UNQUOTED(HAVE_LIBTIFF, 1, [Define if you have libtiff]) + $2 +fi + +]) + +AC_DEFUN(AC_FIND_TIFF, +[ +AC_REQUIRE([K_PATH_X]) +AC_REQUIRE([AC_FIND_ZLIB]) +AC_REQUIRE([AC_FIND_JPEG]) +AC_REQUIRE([KDE_CHECK_EXTRA_LIBS]) + +KDE_TRY_TIFFLIB(tiff, [], + KDE_TRY_TIFFLIB(tiff34)) + +AC_SUBST(LIBTIFF) +]) + + +AC_DEFUN(AC_FIND_PNG, +[ +AC_REQUIRE([KDE_CHECK_EXTRA_LIBS]) +AC_REQUIRE([AC_FIND_ZLIB]) +AC_MSG_CHECKING([for libpng]) +AC_CACHE_VAL(ac_cv_lib_png, +[ +kde_save_LIBS="$LIBS" +LIBS="$LIBS $all_libraries $USER_LDFLAGS -lpng $LIBZ -lm -lX11 $LIBSOCKET" +kde_save_CFLAGS="$CFLAGS" +CFLAGS="$CFLAGS $all_includes $USER_INCLUDES" +AC_LANG_C +AC_TRY_LINK(dnl + [ + #include + ], + [ + png_structp png_ptr = png_create_read_struct( /* image ptr */ + PNG_LIBPNG_VER_STRING, 0, 0, 0 ); + return( png_ptr != 0 ); + ], + eval "ac_cv_lib_png='-lpng $LIBZ -lm'", + eval "ac_cv_lib_png=no" +) +LIBS="$kde_save_LIBS" +CFLAGS="$kde_save_CFLAGS" +])dnl +if eval "test ! \"`echo $ac_cv_lib_png`\" = no"; then + AC_DEFINE_UNQUOTED(HAVE_LIBPNG, 1, [Define if you have libpng]) + LIBPNG="$ac_cv_lib_png" + AC_SUBST(LIBPNG) + AC_MSG_RESULT($ac_cv_lib_png) +else + AC_MSG_RESULT(no) + LIBPNG="" + AC_SUBST(LIBPNG) +fi +]) + +AC_DEFUN(AC_CHECK_BOOL, +[ + AC_DEFINE_UNQUOTED(HAVE_BOOL, 1, [You _must_ have bool]) +]) + +AC_DEFUN(AC_CHECK_GNU_EXTENSIONS, +[ +AC_MSG_CHECKING(if you need GNU extensions) +AC_CACHE_VAL(ac_cv_gnu_extensions, +[ +cat > conftest.c << EOF +#include + +#ifdef __GNU_LIBRARY__ +yes +#endif +EOF + +if (eval "$ac_cpp conftest.c") 2>&5 | + egrep "yes" >/dev/null 2>&1; then + rm -rf conftest* + ac_cv_gnu_extensions=yes +else + ac_cv_gnu_extensions=no +fi +]) + +AC_MSG_RESULT($ac_cv_gnu_extensions) +if test "$ac_cv_gnu_extensions" = "yes"; then + AC_DEFINE_UNQUOTED(_GNU_SOURCE, 1, [Define if you need to use the GNU extensions]) +fi +]) + +AC_DEFUN(KDE_CHECK_COMPILER_FLAG, +[ +dnl AC_REQUIRE([AC_CHECK_COMPILERS]) <- breaks with autoconf 2.50 +AC_MSG_CHECKING(whether $CXX supports -$1) +kde_cache=`echo $1 | sed 'y%.=/+-%___p_%'` +AC_CACHE_VAL(kde_cv_prog_cxx_$kde_cache, +[ +echo 'int main() { return 0; }' >conftest.cc +eval "kde_cv_prog_cxx_$kde_cache=no" +if test -z "`$CXX -$1 -c conftest.cc 2>&1`"; then + if test -z "`$CXX -$1 -o conftest conftest.o 2>&1`"; then + eval "kde_cv_prog_cxx_$kde_cache=yes" + fi +fi +rm -f conftest* +]) +if eval "test \"`echo '$kde_cv_prog_cxx_'$kde_cache`\" = yes"; then + AC_MSG_RESULT(yes) + : + $2 +else + AC_MSG_RESULT(no) + : + $3 +fi +]) + +dnl AC_REMOVE_FORBIDDEN removes forbidden arguments from variables +dnl use: AC_REMOVE_FORBIDDEN(CC, [-forbid -bad-option whatever]) +dnl it's all white-space separated +AC_DEFUN(AC_REMOVE_FORBIDDEN, +[ __val=$$1 + __forbid=" $2 " + if test -n "$__val"; then + __new="" + ac_save_IFS=$IFS + IFS=" " + for i in $__val; do + case "$__forbid" in + *" $i "*) AC_MSG_WARN([found forbidden $i in $1, removing it]) ;; + *) # Careful to not add spaces, where there were none, because otherwise + # libtool gets confused, if we change e.g. CXX + if test -z "$__new" ; then __new=$i ; else __new="$__new $i" ; fi ;; + esac + done + IFS=$ac_save_IFS + $1=$__new + fi +]) + +dnl AC_VALIDIFY_CXXFLAGS checks for forbidden flags the user may have given +AC_DEFUN(AC_VALIDIFY_CXXFLAGS, +[dnl + AC_REMOVE_FORBIDDEN(CXX, [-fno-rtti -rpath]) + AC_REMOVE_FORBIDDEN(CXXFLAGS, [-fno-rtti -rpath]) +]) + +AC_DEFUN(AC_CHECK_COMPILERS, +[ + AC_ARG_ENABLE(debug,[ --enable-debug enables debug symbols [default=no]], + [ + if test $enableval = "no"; dnl + then + kde_use_debug_code="no" + kde_use_debug_define=yes + else + kde_use_debug_code="yes" + kde_use_debug_define=no + fi + ], + [kde_use_debug_code="no" + kde_use_debug_define=no + ]) + + dnl Just for configure --help + AC_ARG_ENABLE(dummyoption,[ --disable-debug disables debug output and debug symbols [default=no]],[],[]) + + AC_ARG_ENABLE(strict,[ --enable-strict compiles with strict compiler options (may not work!)], + [ + if test $enableval = "no"; then + kde_use_strict_options="no" + else + kde_use_strict_options="yes" + fi + ], [kde_use_strict_options="no"]) + + AC_ARG_ENABLE(profile,[ --enable-profile creates profiling infos [default=no]], + [kde_use_profiling=$enableval], + [kde_use_profiling="no"] + ) + + dnl this prevents stupid AC_PROG_CC to add "-g" to the default CFLAGS + CFLAGS=" $CFLAGS" + + AC_PROG_CC + + if test "$GCC" = "yes"; then + if test "$kde_use_debug_code" = "yes"; then + CFLAGS="-g -O0 $CFLAGS" + case $host in + *-*-linux-gnu) + CFLAGS="-ansi -W -Wall -pedantic -Wshadow -Wpointer-arith -Wmissing-prototypes -Wwrite-strings -D_XOPEN_SOURCE=500 -D_BSD_SOURCE $CFLAGS" + ;; + esac + else + CFLAGS="-O0 $CFLAGS" + fi + fi + + if test "$kde_use_debug_define" = "yes"; then + CFLAGS="-DNDEBUG $CFLAGS" + fi + + case "$host" in + *-*-sysv4.2uw*) CFLAGS="-D_UNIXWARE $CFLAGS";; + *-*-sysv5uw7*) CFLAGS="-D_UNIXWARE7 $CFLAGS";; + esac + + if test -z "$LDFLAGS" && test "$kde_use_debug_code" = "no" && test "$GCC" = "yes"; then + LDFLAGS="" + fi + + CXXFLAGS=" $CXXFLAGS" + + AC_PROG_CXX + + if test "$GXX" = "yes"; then + if test "$kde_use_debug_code" = "yes"; then + CXXFLAGS="-g -O0 -Wall -pedantic -W -Wpointer-arith -Wmissing-prototypes -Wwrite-strings $CXXFLAGS" + + KDE_CHECK_COMPILER_FLAG(Wno-long-long,[CXXFLAGS="-Wno-long-long $CXXFLAGS"]) + KDE_CHECK_COMPILER_FLAG(Wnon-virtual-dtor,[CXXFLAGS="-Wnon-virtual-dtor $CXXFLAGS"]) + KDE_CHECK_COMPILER_FLAG(fno-builtin,[CXXFLAGS="-fno-builtin $CXXFLAGS"]) + + case $host in dnl + *-*-linux-gnu) + CXXFLAGS="-ansi -D_XOPEN_SOURCE=500 -D_BSD_SOURCE -Wbad-function-cast -Wcast-align -Wundef -Wconversion $CXXFLAGS" + ;; + esac + + if test "$kde_use_strict_options" = "yes"; then + CXXFLAGS="-Wcast-qual -Wbad-function-cast -Wshadow -Wcast-align $CXXFLAGS" + fi + + if test "$kde_very_strict" = "yes"; then + CXXFLAGS="-Wold-style-cast -Wredundant-decls -Wconversion $CXXFLAGS" + fi + else + CXXFLAGS="-O0 $CXXFLAGS" + fi + fi + + if test "$kde_use_debug_define" = "yes"; then + CXXFLAGS="-DNDEBUG $CXXFLAGS" + fi + + if test "$kde_use_profiling" = "yes"; then + KDE_CHECK_COMPILER_FLAG(pg, + [ + CFLAGS="-pg $CFLAGS" + CXXFLAGS="-pg $CXXFLAGS" + ]) + fi + + KDE_CHECK_COMPILER_FLAG(fno-exceptions,[CXXFLAGS="$CXXFLAGS -fno-exceptions"]) + KDE_CHECK_COMPILER_FLAG(fno-check-new, [CXXFLAGS="$CXXFLAGS -fno-check-new"]) + KDE_CHECK_COMPILER_FLAG(fexceptions, [USE_EXCEPTIONS="-fexceptions"], USE_EXCEPTIONS= ) + AC_SUBST(USE_EXCEPTIONS) + dnl obsolete macro - provided to keep things going + USE_RTTI= + AC_SUBST(USE_RTTI) + + case "$host" in + *-*-irix*) test "$GXX" = yes && CXXFLAGS="-D_LANGUAGE_C_PLUS_PLUS -D__LANGUAGE_C_PLUS_PLUS $CXXFLAGS" ;; + *-*-sysv4.2uw*) CXXFLAGS="-D_UNIXWARE $CXXFLAGS";; + *-*-sysv5uw7*) CXXFLAGS="-D_UNIXWARE7 $CXXFLAGS";; + *-*-solaris*) + if test "$GXX" = yes; then + libstdcpp=`$CXX -print-file-name=libstdc++.so` + if test ! -f $libstdcpp; then + AC_MSG_ERROR([You've compiled gcc without --enable-shared. This doesn't work with KDE. Please recompile gcc with --enable-shared to receive a libstdc++.so]) + fi + fi + ;; + esac + + AC_VALIDIFY_CXXFLAGS + + AC_PROG_CXXCPP + + # the following is to allow programs, that are known to + # have problems when compiled with -O2 + if test -n "$CXXFLAGS"; then + kde_safe_IFS=$IFS + IFS=" " + NOOPT_CXXFLAGS="" + for i in $CXXFLAGS; do + case $i in + -O*) + ;; + *) + NOOPT_CXXFLAGS="$NOOPT_CXXFLAGS $i" + ;; + esac + done + IFS=$kde_safe_IFS + fi + + AC_SUBST(NOOPT_CXXFLAGS) + + KDE_CHECK_FINAL + + ifdef([AM_DEPENDENCIES], AC_REQUIRE([KDE_ADD_DEPENDENCIES]), []) + + KDE_CXXFLAGS= + AC_SUBST(KDE_CXXFLAGS) +]) + +AC_DEFUN(KDE_ADD_DEPENDENCIES, +[ + [A]M_DEPENDENCIES(CC) + [A]M_DEPENDENCIES(CXX) +]) + +dnl just a wrapper to clean up configure.in +AC_DEFUN(KDE_PROG_LIBTOOL, +[ +AC_REQUIRE([AC_CHECK_COMPILERS]) +AC_REQUIRE([AC_ENABLE_SHARED]) +AC_REQUIRE([AC_ENABLE_STATIC]) + +AC_REQUIRE([AC_LIBTOOL_DLOPEN]) + +AC_LANG_SAVE +AC_LANG_C +AC_OBJEXT +AC_EXEEXT +AC_LANG_RESTORE + +AM_PROG_LIBTOOL +AC_LIBTOOL_CXX + +LIBTOOL_SHELL="/bin/sh ./libtool" +# LIBTOOL="$LIBTOOL --silent" +KDE_PLUGIN="-avoid-version -module -no-undefined \$(KDE_RPATH)" +AC_SUBST(KDE_PLUGIN) +]) + +AC_DEFUN(KDE_CHECK_TYPES, +[ AC_CHECK_SIZEOF(int, 4)dnl + AC_CHECK_SIZEOF(long, 4)dnl + AC_CHECK_SIZEOF(char *, 4)dnl + AC_CHECK_SIZEOF(char, 1)dnl +])dnl + +AC_DEFUN(KDE_DO_IT_ALL, +[ +AC_CANONICAL_SYSTEM +AC_ARG_PROGRAM +AM_INIT_AUTOMAKE($1, $2) +AM_DISABLE_LIBRARIES +AC_PREFIX_DEFAULT(${KDEDIR:-/usr/local/kde}) +AC_CHECK_COMPILERS +KDE_PROG_LIBTOOL +AM_KDE_WITH_NLS +AC_PATH_KDE +]) + +AC_DEFUN(AC_CHECK_RPATH, +[ +AC_MSG_CHECKING(for rpath) +AC_ARG_ENABLE(rpath, + [ --disable-rpath do not use the rpath feature of ld], + USE_RPATH=$enableval, USE_RPATH=yes) + +if test -z "$KDE_RPATH" && test "$USE_RPATH" = "yes"; then + + KDE_RPATH="-R \$(kde_libraries)" + + if test -n "$qt_libraries"; then + KDE_RPATH="$KDE_RPATH -R \$(qt_libraries)" + fi + dnl $x_libraries is set to /usr/lib in case + if test -n "$X_LDFLAGS"; then + KDE_RPATH="$KDE_RPATH -R \$(x_libraries)" + fi + if test -n "$KDE_EXTRA_RPATH"; then + KDE_RPATH="$KDE_RPATH \$(KDE_EXTRA_RPATH)" + fi +fi +AC_SUBST(KDE_EXTRA_RPATH) +AC_SUBST(KDE_RPATH) +AC_MSG_RESULT($USE_RPATH) +]) + +dnl Check for the type of the third argument of getsockname +AC_DEFUN(AC_CHECK_SOCKLEN_T, [ + AC_MSG_CHECKING(for socklen_t) + AC_CACHE_VAL(ac_cv_socklen_t, [ + AC_LANG_SAVE + AC_LANG_CPLUSPLUS + AC_TRY_COMPILE([ +#include +#include + ],[ +socklen_t a=0; +getsockname(0,(struct sockaddr*)0, &a); + ], + ac_cv_socklen_t=socklen_t, + AC_TRY_COMPILE([ +#include +#include + ],[ +int a=0; +getsockname(0,(struct sockaddr*)0, &a); + ], + ac_cv_socklen_t=int, + ac_cv_socklen_t=size_t + ) + ) + AC_LANG_RESTORE + ]) + + AC_MSG_RESULT($ac_cv_socklen_t) + if test "$ac_cv_socklen_t" != "socklen_t"; then + AC_DEFINE_UNQUOTED(socklen_t, $ac_cv_socklen_t, + [Define the real type of socklen_t]) + fi + AC_DEFINE_UNQUOTED(ksize_t, socklen_t, [Compatibility define]) + +]) + +dnl This is a merge of some macros out of the gettext aclocal.m4 +dnl since we don't need anything, I took the things we need +dnl the copyright for them is: +dnl > +dnl Copyright (C) 1994, 1995, 1996, 1997, 1998 Free Software Foundation, Inc. +dnl This Makefile.in is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. + +dnl This program is distributed in the hope that it will be useful, +dnl but WITHOUT ANY WARRANTY, to the extent permitted by law; without +dnl even the implied warranty of MERCHANTABILITY or FITNESS FOR A +dnl PARTICULAR PURPOSE. +dnl > +dnl for this file it is relicensed under LGPL + +AC_DEFUN(AM_KDE_WITH_NLS, + [ + dnl If we use NLS figure out what method + + AM_PATH_PROG_WITH_TEST_KDE(MSGFMT, msgfmt, + [test -n "`$ac_dir/$ac_word --version 2>&1 | grep 'GNU gettext'`"], msgfmt) + AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT) + + if test -z "`$GMSGFMT --version 2>&1 | grep 'GNU gettext'`"; then + AC_MSG_RESULT([found msgfmt program is not GNU msgfmt; ignore it]) + GMSGFMT=":" + fi + MSGFMT=$GMSGFMT + AC_SUBST(GMSGFMT) + AC_SUBST(MSGFMT) + + AM_PATH_PROG_WITH_TEST_KDE(XGETTEXT, xgettext, + [test -z "`$ac_dir/$ac_word -h 2>&1 | grep '(HELP)'`"], :) + + dnl Test whether we really found GNU xgettext. + if test "$XGETTEXT" != ":"; then + dnl If it is no GNU xgettext we define it as : so that the + dnl Makefiles still can work. + if $XGETTEXT --omit-header /dev/null 2> /dev/null; then + : ; + else + AC_MSG_RESULT( + [found xgettext programs is not GNU xgettext; ignore it]) + XGETTEXT=":" + fi + fi + AC_SUBST(XGETTEXT) + + ]) + +# Search path for a program which passes the given test. +# Ulrich Drepper , 1996. + +# serial 1 +# Stephan Kulow: I appended a _KDE against name conflicts + +dnl AM_PATH_PROG_WITH_TEST_KDE(VARIABLE, PROG-TO-CHECK-FOR, +dnl TEST-PERFORMED-ON-FOUND_PROGRAM [, VALUE-IF-NOT-FOUND [, PATH]]) +AC_DEFUN(AM_PATH_PROG_WITH_TEST_KDE, +[# Extract the first word of "$2", so it can be a program name with args. +set dummy $2; ac_word=[$]2 +AC_MSG_CHECKING([for $ac_word]) +AC_CACHE_VAL(ac_cv_path_$1, +[case "[$]$1" in + /*) + ac_cv_path_$1="[$]$1" # Let the user override the test with a path. + ;; + *) + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" + for ac_dir in ifelse([$5], , $PATH, [$5]); do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + if [$3]; then + ac_cv_path_$1="$ac_dir/$ac_word" + break + fi + fi + done + IFS="$ac_save_ifs" +dnl If no 4th arg is given, leave the cache variable unset, +dnl so AC_PATH_PROGS will keep looking. +ifelse([$4], , , [ test -z "[$]ac_cv_path_$1" && ac_cv_path_$1="$4" +])dnl + ;; +esac])dnl +$1="$ac_cv_path_$1" +if test -n "[$]$1"; then + AC_MSG_RESULT([$]$1) +else + AC_MSG_RESULT(no) +fi +AC_SUBST($1)dnl +]) + + +# Check whether LC_MESSAGES is available in . +# Ulrich Drepper , 1995. + +# serial 1 + +AC_DEFUN(AM_LC_MESSAGES, + [if test $ac_cv_header_locale_h = yes; then + AC_CACHE_CHECK([for LC_MESSAGES], am_cv_val_LC_MESSAGES, + [AC_TRY_LINK([#include ], [return LC_MESSAGES], + am_cv_val_LC_MESSAGES=yes, am_cv_val_LC_MESSAGES=no)]) + if test $am_cv_val_LC_MESSAGES = yes; then + AC_DEFINE(HAVE_LC_MESSAGES, 1, [Define if your locale.h file contains LC_MESSAGES]) + fi + fi]) + +dnl From Jim Meyering. +dnl FIXME: migrate into libit. + +AC_DEFUN(AM_FUNC_OBSTACK, +[AC_CACHE_CHECK([for obstacks], am_cv_func_obstack, + [AC_TRY_LINK([#include "obstack.h"], + [struct obstack *mem;obstack_free(mem,(char *) 0)], + am_cv_func_obstack=yes, + am_cv_func_obstack=no)]) + if test $am_cv_func_obstack = yes; then + AC_DEFINE(HAVE_OBSTACK) + else + LIBOBJS="$LIBOBJS obstack.o" + fi +]) + +dnl From Jim Meyering. Use this if you use the GNU error.[ch]. +dnl FIXME: Migrate into libit + +AC_DEFUN(AM_FUNC_ERROR_AT_LINE, +[AC_CACHE_CHECK([for error_at_line], am_cv_lib_error_at_line, + [AC_TRY_LINK([],[error_at_line(0, 0, "", 0, "");], + am_cv_lib_error_at_line=yes, + am_cv_lib_error_at_line=no)]) + if test $am_cv_lib_error_at_line = no; then + LIBOBJS="$LIBOBJS error.o" + fi + AC_SUBST(LIBOBJS)dnl +]) + +# Macro to add for using GNU gettext. +# Ulrich Drepper , 1995. + +# serial 1 +# Stephan Kulow: I put a KDE in it to avoid name conflicts + +AC_DEFUN(AM_KDE_GNU_GETTEXT, + [AC_REQUIRE([AC_PROG_MAKE_SET])dnl + AC_REQUIRE([AC_PROG_RANLIB])dnl + AC_REQUIRE([AC_HEADER_STDC])dnl + AC_REQUIRE([AC_TYPE_OFF_T])dnl + AC_REQUIRE([AC_TYPE_SIZE_T])dnl + AC_REQUIRE([AC_FUNC_ALLOCA])dnl + AC_REQUIRE([AC_FUNC_MMAP])dnl + AC_REQUIRE([AM_KDE_WITH_NLS])dnl + AC_CHECK_HEADERS([argz.h limits.h locale.h nl_types.h string.h values.h alloca.h]) + AC_CHECK_FUNCS([getcwd munmap putenv setenv setlocale strchr strcasecmp \ +__argz_count __argz_stringify __argz_next]) + + AC_MSG_CHECKING(for stpcpy) + AC_CACHE_VAL(kde_cv_func_stpcpy, + [ + kde_safe_cxxflags=$CXXFLAGS + CXXFLAGS="-Wmissing-prototypes -Werror" + AC_LANG_SAVE + AC_LANG_CPLUSPLUS + AC_TRY_COMPILE([ + #include + ], + [ + char buffer[200]; + stpcpy(buffer, buffer); + ], + kde_cv_func_stpcpy=yes, + kde_cv_func_stpcpy=no) + AC_LANG_RESTORE + CXXFLAGS=$kde_safe_cxxflags + ]) + AC_MSG_RESULT($kde_cv_func_stpcpy) + if eval "test \"`echo $kde_cv_func_stpcpy`\" = yes"; then + AC_DEFINE(HAVE_STPCPY, 1, [Define if you have stpcpy]) + fi + + AM_LC_MESSAGES + + if test "x$CATOBJEXT" != "x"; then + if test "x$ALL_LINGUAS" = "x"; then + LINGUAS= + else + AC_MSG_CHECKING(for catalogs to be installed) + NEW_LINGUAS= + for lang in ${LINGUAS=$ALL_LINGUAS}; do + case "$ALL_LINGUAS" in + *$lang*) NEW_LINGUAS="$NEW_LINGUAS $lang" ;; + esac + done + LINGUAS=$NEW_LINGUAS + AC_MSG_RESULT($LINGUAS) + fi + + dnl Construct list of names of catalog files to be constructed. + if test -n "$LINGUAS"; then + for lang in $LINGUAS; do CATALOGS="$CATALOGS $lang$CATOBJEXT"; done + fi + fi + + ]) + +AC_DEFUN(AC_HAVE_XPM, + [AC_REQUIRE_CPP()dnl + AC_REQUIRE([KDE_CHECK_EXTRA_LIBS]) + + test -z "$XPM_LDFLAGS" && XPM_LDFLAGS= + test -z "$XPM_INCLUDE" && XPM_INCLUDE= + + AC_ARG_WITH(xpm, [ --without-xpm disable color pixmap XPM tests], + xpm_test=$withval, xpm_test="yes") + if test "x$xpm_test" = xno; then + ac_cv_have_xpm=no + else + AC_MSG_CHECKING(for XPM) + AC_CACHE_VAL(ac_cv_have_xpm, + [ + AC_LANG_C + ac_save_ldflags="$LDFLAGS" + ac_save_cflags="$CFLAGS" + LDFLAGS="$LDFLAGS $X_LDFLAGS $USER_LDFLAGS $LDFLAGS $XPM_LDFLAGS $all_libraries -lXpm -lX11 -lXext $LIBZ $LIBSOCKET" + CFLAGS="$CFLAGS $X_INCLUDES $USER_INCLUDES" + test -n "$XPM_INCLUDE" && CFLAGS="-I$XPM_INCLUDE $CFLAGS" + AC_TRY_LINK([#include ],[], + ac_cv_have_xpm="yes",ac_cv_have_xpm="no") + LDFLAGS="$ac_save_ldflags" + CFLAGS="$ac_save_cflags" + ])dnl + + if test "$ac_cv_have_xpm" = no; then + AC_MSG_RESULT(no) + XPM_LDFLAGS="" + XPMINC="" + $2 + else + AC_DEFINE(HAVE_XPM, 1, [Define if you have XPM support]) + if test "$XPM_LDFLAGS" = ""; then + XPMLIB='-lXpm $(LIB_X11)' + else + XPMLIB="-L$XPM_LDFLAGS -lXpm "'$(LIB_X11)' + fi + if test "$XPM_INCLUDE" = ""; then + XPMINC="" + else + XPMINC="-I$XPM_INCLUDE" + fi + AC_MSG_RESULT(yes) + $1 + fi + fi + AC_SUBST(XPMINC) + AC_SUBST(XPMLIB) +]) + +AC_DEFUN(AC_HAVE_DPMS, + [AC_REQUIRE_CPP()dnl + AC_REQUIRE([KDE_CHECK_EXTRA_LIBS]) + + test -z "$DPMS_LDFLAGS" && DPMS_LDFLAGS= + test -z "$DPMS_INCLUDE" && DPMS_INCLUDE= + DPMS_LIB= + + AC_ARG_WITH(dpms, [ --without-dpms disable DPMS power saving], + dpms_test=$withval, dpms_test="yes") + if test "x$dpms_test" = xno; then + ac_cv_have_dpms=no + else + AC_MSG_CHECKING(for DPMS) + dnl Note: ac_cv_have_dpms can be no, yes, or -lXdpms. + dnl 'yes' means DPMS_LIB="", '-lXdpms' means DPMS_LIB="-lXdpms". + AC_CACHE_VAL(ac_cv_have_dpms, + [ + AC_LANG_C + ac_save_ldflags="$LDFLAGS" + ac_save_cflags="$CFLAGS" + ac_save_libs="$LIBS" + LDFLAGS="$LDFLAGS $DPMS_LDFLAGS $all_libraries -lX11 -lXext $LIBSOCKET" + CFLAGS="$CFLAGS $X_INCLUDES" + test -n "$DPMS_INCLUDE" && CFLAGS="-I$DPMS_INCLUDE $CFLAGS" + AC_TRY_LINK([ + #include + #include + #include + #include + int foo_test_dpms() + { return DPMSSetTimeouts( 0, 0, 0, 0 ); }],[], + ac_cv_have_dpms="yes", [ + LDFLAGS="$ac_save_ldflags" + CFLAGS="$ac_save_cflags" + LDFLAGS="$LDFLAGS $DPMS_LDFLAGS $all_libraries -lX11 -lXext $LIBSOCKET" + LIBS="$LIBS -lXdpms" + CFLAGS="$CFLAGS $X_INCLUDES" + test -n "$DPMS_INCLUDE" && CFLAGS="-I$DPMS_INCLUDE $CFLAGS" + AC_TRY_LINK([ + #include + #include + #include + #include + int foo_test_dpms() + { return DPMSSetTimeouts( 0, 0, 0, 0 ); }],[], + [ + ac_cv_have_dpms="-lXdpms" + ],ac_cv_have_dpms="no") + ]) + LDFLAGS="$ac_save_ldflags" + CFLAGS="$ac_save_cflags" + LIBS="$ac_save_libs" + ])dnl + + if test "$ac_cv_have_dpms" = no; then + AC_MSG_RESULT(no) + DPMS_LDFLAGS="" + DPMSINC="" + $2 + else + AC_DEFINE(HAVE_DPMS, 1, [Define if you have DPMS support]) + if test "$ac_cv_have_dpms" = "-lXdpms"; then + DPMS_LIB="-lXdpms" + fi + if test "$DPMS_LDFLAGS" = ""; then + DPMSLIB="$DPMS_LIB "'$(LIB_X11)' + else + DPMSLIB="$DPMS_LDFLAGS $DPMS_LIB "'$(LIB_X11)' + fi + if test "$DPMS_INCLUDE" = ""; then + DPMSINC="" + else + DPMSINC="-I$DPMS_INCLUDE" + fi + AC_MSG_RESULT(yes) + $1 + fi + fi + AC_SUBST(DPMSINC) + AC_SUBST(DPMSLIB) +]) + +AC_DEFUN(AC_HAVE_GL, + [AC_REQUIRE_CPP()dnl + AC_REQUIRE([KDE_CHECK_EXTRA_LIBS]) + + test -z "$GL_LDFLAGS" && GL_LDFLAGS= + test -z "$GL_INCLUDE" && GL_INCLUDE= + + AC_ARG_WITH(gl, [ --without-gl disable 3D GL modes], + gl_test=$withval, gl_test="yes") + if test "x$gl_test" = xno; then + ac_cv_have_gl=no + else + AC_MSG_CHECKING(for GL) + AC_CACHE_VAL(ac_cv_have_gl, + [ + AC_LANG_C + ac_save_ldflags="$LDFLAGS" + ac_save_cflags="$CFLAGS" + LDFLAGS="$LDFLAGS $GL_LDFLAGS $X_LDFLAGS $all_libraries -lMesaGL -lMesaGLU -lX11 -lXext -lm $LIBSOCKET" + CFLAGS="$CFLAGS $X_INCLUDES" + test -n "$GL_INCLUDE" && CFLAGS="-I$GL_INCLUDE $CFLAGS" + AC_TRY_LINK([#include +#include +], [], + ac_cv_have_gl="mesa", ac_cv_have_gl="no") + if test "x$ac_cv_have_gl" = "xno"; then + LDFLAGS="$ac_save_ldflags $X_LDFLAGS $GL_LDFLAGS $all_libraries -lGL -lGLU -lX11 -lXext -lm $LIBSOCKET" + CFLAGS="$ac_save_cflags $X_INCLUDES" + test -n "$GL_INCLUDE" && CFLAGS="-I$GL_INCLUDE $CFLAGS" + AC_TRY_LINK([#include +#include +], [], + ac_cv_have_gl="yes", ac_cv_have_gl="no") + fi + LDFLAGS="$ac_save_ldflags" + CFLAGS="$ac_save_cflags" + ])dnl + + if test "$ac_cv_have_gl" = "no"; then + AC_MSG_RESULT(no) + GL_LDFLAGS="" + GLINC="" + $2 + else + AC_DEFINE(HAVE_GL, 1, [Defines if you have GL (Mesa, OpenGL, ...)]) + if test "$GL_LDFLAGS" = ""; then + if test "$ac_cv_have_gl" = "mesa"; then + GLLIB='-lMesaGL -lMesaGLU $(LIB_X11)' + else + GLLIB='-lGL -lGLU $(LIB_X11)' + fi + else + if test "$ac_cv_have_gl" = "mesa"; then + GLLIB="$GL_LDFLAGS -lMesaGL -lMesaGLU "'$(LIB_X11)' + else + GLLIB="$GL_LDFLAGS -lGL -lGLU "'$(LIB_X11)' + fi + fi + if test "$GL_INCLUDE" = ""; then + GLINC="" + else + GLINC="-I$GL_INCLUDE" + fi + AC_MSG_RESULT($ac_cv_have_gl) + $1 + fi + fi + AC_SUBST(GLINC) + AC_SUBST(GLLIB) +]) + + + dnl shadow password and PAM magic - maintained by ossi@kde.org + +AC_DEFUN(KDE_PAM, [ + AC_REQUIRE([KDE_CHECK_LIBDL]) + + AC_ARG_WITH(pam, + [ --with-pam[=ARG] enable support for PAM: ARG=[yes|no|service name]], + [ if test "x$withval" = "xyes"; then + use_pam=yes + pam_service=kde + elif test "x$withval" = "xno"; then + use_pam=no + else + use_pam=yes + pam_service=$withval + fi + ac_cv_path_pam="use_pam=$use_pam pam_service=$pam_service" + ], [ + AC_CACHE_VAL(ac_cv_path_pam, + [ use_pam=no + AC_CHECK_LIB(pam, pam_start, + [ AC_CHECK_HEADER(security/pam_appl.h, + [ use_pam=yes + pam_service=kde ]) + ], , $LIBDL) + ac_cv_path_pam="use_pam=$use_pam pam_service=$pam_service" + ]) + ]) + eval "$ac_cv_path_pam" + + AC_MSG_CHECKING(for PAM) + if test "x$use_pam" = xno; then + AC_MSG_RESULT(no) + PAMLIBS="" + else + AC_MSG_RESULT(yes) + AC_DEFINE(HAVE_PAM, 1, [Defines if you have PAM (Pluggable Authentication Modules)]) + PAMLIBS="$PAM_MISC_LIB -lpam $LIBDL" + + dnl test whether struct pam_message is const (Linux) or not (Sun) + AC_MSG_CHECKING(for const pam_message) + AC_EGREP_HEADER([struct pam_message], security/pam_appl.h, + [ AC_EGREP_HEADER([const struct pam_message], security/pam_appl.h, + [AC_MSG_RESULT([const: Linux-type PAM])], + [AC_MSG_RESULT([nonconst: Sun-type PAM]) + AC_DEFINE(PAM_MESSAGE_NONCONST, 1, [Define if your PAM support takes non-const arguments (Solaris)])] + )], + [AC_MSG_RESULT([not found - assume const, Linux-type PAM])]) + fi + + AC_SUBST(PAMLIBS) +]) + +dnl DEF_PAM_SERVICE(arg name, full name, define name) +AC_DEFUN(DEF_PAM_SERVICE, [ + AC_ARG_WITH($1-pam, + [ --with-$1-pam=[val] override PAM service from --with-pam for $2], + [ if test "x$use_pam" = xyes; then + $3_PAM_SERVICE="$withval" + else + AC_MSG_ERROR([Cannot use use --with-$1-pam, as no PAM was detected. +You may want to enforce it by using --with-pam.]) + fi + ], + [ if test "x$use_pam" = xyes; then + $3_PAM_SERVICE="$pam_service" + fi + ]) + if test -n "$$3_PAM_SERVICE"; then + AC_MSG_RESULT([The PAM service used by $2 will be $$3_PAM_SERVICE]) + AC_DEFINE_UNQUOTED($3_PAM_SERVICE, "$$3_PAM_SERVICE", [The PAM service to be used by $2]) + fi + AC_SUBST($3_PAM_SERVICE) +]) + +AC_DEFUN(KDE_SHADOWPASSWD, [ + AC_REQUIRE([KDE_PAM]) + + AC_CHECK_LIB(shadow, getspent, + [ LIBSHADOW="-lshadow" + ac_use_shadow=yes + ], + [ dnl for UnixWare + AC_CHECK_LIB(gen, getspent, + [ LIBGEN="-lgen" + ac_use_shadow=yes + ], + [ AC_CHECK_FUNC(getspent, + [ ac_use_shadow=yes ], + [ ac_use_shadow=no ]) + ]) + ]) + AC_SUBST(LIBSHADOW) + AC_SUBST(LIBGEN) + + AC_MSG_CHECKING([for shadow passwords]) + + AC_ARG_WITH(shadow, + [ --with-shadow If you want shadow password support ], + [ if test "x$withval" != "xno"; then + use_shadow=yes + else + use_shadow=no + fi + ], [ + use_shadow="$ac_use_shadow" + ]) + + if test "x$use_shadow" = xyes; then + AC_MSG_RESULT(yes) + AC_DEFINE(HAVE_SHADOW, 1, [Define if you use shadow passwords]) + else + AC_MSG_RESULT(no) + LIBSHADOW= + LIBGEN= + fi + + dnl finally make the relevant binaries setuid root, if we have shadow passwds. + dnl this still applies, if we could use it indirectly through pam. + if test "x$use_shadow" = xyes || + ( test "x$use_pam" = xyes && test "x$ac_use_shadow" = xyes ); then + case $host in + *-*-freebsd* | *-*-netbsd* | *-*-openbsd*) + SETUIDFLAGS="-m 4755 -o root";; + *) + SETUIDFLAGS="-m 4755";; + esac + fi + AC_SUBST(SETUIDFLAGS) + +]) + +AC_DEFUN(KDE_PASSWDLIBS, [ + AC_REQUIRE([KDE_MISC_TESTS]) dnl for LIBCRYPT + AC_REQUIRE([KDE_PAM]) + AC_REQUIRE([KDE_SHADOWPASSWD]) + + if test "x$use_pam" = "xyes"; then + PASSWDLIBS="$PAMLIBS" + else + PASSWDLIBS="$LIBCRYPT $LIBSHADOW $LIBGEN" + fi + + AC_SUBST(PASSWDLIBS) +]) + +AC_DEFUN(KDE_CHECK_LIBDL, +[ +AC_CHECK_LIB(dl, dlopen, [ +LIBDL="-ldl" +ac_cv_have_dlfcn=yes +]) + +AC_CHECK_LIB(dld, shl_unload, [ +LIBDL="-ldld" +ac_cv_have_shload=yes +]) + +AC_SUBST(LIBDL) +]) + +AC_DEFUN(KDE_CHECK_DLOPEN, +[ +KDE_CHECK_LIBDL +AC_CHECK_HEADERS(dlfcn.h dl.h) +if test "$ac_cv_header_dlfcn_h" = "no"; then + ac_cv_have_dlfcn=no +fi + +if test "$ac_cv_header_dl_h" = "no"; then + ac_cv_have_shload=no +fi + +dnl XXX why change enable_dlopen? its already set by autoconf's AC_ARG_ENABLE +dnl (MM) +AC_ARG_ENABLE(dlopen, +[ --disable-dlopen link statically [default=no]] , +enable_dlopen=$enableval, +enable_dlopen=yes) + +# override the user's opinion, if we know it better ;) +if test "$ac_cv_have_dlfcn" = "no" && test "$ac_cv_have_shload" = "no"; then + enable_dlopen=no +fi + +if test "$ac_cv_have_dlfcn" = "yes"; then + AC_DEFINE_UNQUOTED(HAVE_DLFCN, 1, [Define if you have dlfcn]) +fi + +if test "$ac_cv_have_shload" = "yes"; then + AC_DEFINE_UNQUOTED(HAVE_SHLOAD, 1, [Define if you have shload]) +fi + +if test "$enable_dlopen" = no ; then + test -n "$1" && eval $1 +else + test -n "$2" && eval $2 +fi + +]) + +AC_DEFUN(KDE_CHECK_DYNAMIC_LOADING, +[ +KDE_CHECK_DLOPEN(libtool_enable_shared=yes, libtool_enable_static=no) +KDE_PROG_LIBTOOL +AC_MSG_CHECKING([dynamic loading]) +eval "`egrep '^build_libtool_libs=' libtool`" +if test "$build_libtool_libs" = "yes" && test "$enable_dlopen" = "yes"; then + dynamic_loading=yes + AC_DEFINE_UNQUOTED(HAVE_DYNAMIC_LOADING) +else + dynamic_loading=no +fi +AC_MSG_RESULT($dynamic_loading) +if test "$dynamic_loading" = "yes"; then + $1 +else + $2 +fi +]) + +AC_DEFUN(KDE_ADD_INCLUDES, +[ +if test -z "$1"; then + test_include="Pix.h" +else + test_include="$1" +fi + +AC_MSG_CHECKING([for libg++ ($test_include)]) + +AC_CACHE_VAL(kde_cv_libgpp_includes, +[ +kde_cv_libgpp_includes=no + + for ac_dir in \ + \ + /usr/include/g++ \ + /usr/include \ + /usr/unsupported/include \ + /opt/include \ + $extra_include \ + ; \ + do + if test -r "$ac_dir/$test_include"; then + kde_cv_libgpp_includes=$ac_dir + break + fi + done +]) + +AC_MSG_RESULT($kde_cv_libgpp_includes) +if test "$kde_cv_libgpp_includes" != "no"; then + all_includes="-I$kde_cv_libgpp_includes $all_includes $USER_INCLUDES" +fi +]) +]) + + +AC_DEFUN(KDE_CHECK_MICO, +[ +AC_REQUIRE([KDE_CHECK_LIBDL]) +AC_REQUIRE([KDE_MISC_TESTS]) +AC_MSG_CHECKING(for MICO) + +if test -z "$MICODIR"; then + kde_micodir=/usr/local + else + kde_micodir="$MICODIR" +fi + +AC_ARG_WITH(micodir, + [ --with-micodir=micodir where mico is installed ], + kde_micodir=$withval, + kde_micodir=$kde_micodir +) + +AC_CACHE_VAL(kde_cv_mico_incdir, +[ + mico_incdirs="$kde_micodir/include /usr/include /usr/local/include /usr/local/include /opt/local/include $kde_extra_includes" +AC_FIND_FILE(CORBA.h, $mico_incdirs, kde_cv_mico_incdir) + +]) +kde_micodir=`echo $kde_cv_mico_incdir | sed -e 's#/include##'` + +if test ! -r $kde_micodir/include/CORBA.h; then + AC_MSG_ERROR([No CORBA.h found, specify another micodir]) +fi + +AC_MSG_RESULT($kde_micodir) + +MICO_INCLUDES=-I$kde_micodir/include +AC_SUBST(MICO_INCLUDES) +MICO_LDFLAGS=-L$kde_micodir/lib +AC_SUBST(MICO_LDFLAGS) +micodir=$kde_micodir +AC_SUBST(micodir) + +AC_MSG_CHECKING([for MICO version]) +AC_CACHE_VAL(kde_cv_mico_version, +[ +AC_LANG_C +cat >conftest.$ac_ext < +#include +int main() { + + printf("MICO_VERSION=%s\n",MICO_VERSION); + return (0); +} +EOF +ac_compile='${CC-gcc} $CFLAGS $MICO_INCLUDES conftest.$ac_ext -o conftest' +if AC_TRY_EVAL(ac_compile); then + if eval `./conftest 2>&5`; then + kde_cv_mico_version=$MICO_VERSION + else + AC_MSG_ERROR([your system is not able to execute a small application to + find MICO version! Check $kde_micodir/include/mico/version.h]) + fi +else + AC_MSG_ERROR([your system is not able to compile a small application to + find MICO version! Check $kde_micodir/include/mico/version.h]) +fi +]) + +dnl installed MICO version +mico_v_maj=`echo $kde_cv_mico_version | sed -e 's/^\(.*\)\..*\..*$/\1/'` +mico_v_mid=`echo $kde_cv_mico_version | sed -e 's/^.*\.\(.*\)\..*$/\1/'` +mico_v_min=`echo $kde_cv_mico_version | sed -e 's/^.*\..*\.\(.*\)$/\1/'` + +if test "x$1" = "x"; then + req_version="2.3.0" +else + req_version=$1 +fi + +dnl required MICO version +req_v_maj=`echo $req_version | sed -e 's/^\(.*\)\..*\..*$/\1/'` +req_v_mid=`echo $req_version | sed -e 's/^.*\.\(.*\)\..*$/\1/'` +req_v_min=`echo $req_version | sed -e 's/^.*\..*\.\(.*\)$/\1/'` + +if test "$mico_v_maj" -lt "$req_v_maj" || \ + ( test "$mico_v_maj" -eq "$req_v_maj" && \ + test "$mico_v_mid" -lt "$req_v_mid" ) || \ + ( test "$mico_v_mid" -eq "$req_v_mid" && \ + test "$mico_v_min" -lt "$req_v_min" ) + +then + AC_MSG_ERROR([found MICO version $kde_cv_mico_version but version $req_version \ +at least is required. You should upgrade MICO.]) +else + AC_MSG_RESULT([$kde_cv_mico_version (minimum version $req_version, ok)]) +fi + +LIBMICO="-lmico$kde_cv_mico_version $LIBCRYPT $LIBSOCKET $LIBDL" +AC_SUBST(LIBMICO) +if test -z "$IDL"; then + IDL='$(kde_bindir)/cuteidl' +fi +AC_SUBST(IDL) +IDL_DEPENDENCIES='$(kde_includes)/CUTE.h' +AC_SUBST(IDL_DEPENDENCIES) + +idldir="\$(includedir)/idl" +AC_SUBST(idldir) + +]) + +AC_DEFUN(KDE_CHECK_MINI_STL, +[ +AC_REQUIRE([KDE_CHECK_MICO]) + +AC_MSG_CHECKING(if we use mico's mini-STL) +AC_CACHE_VAL(kde_cv_have_mini_stl, +[ +AC_LANG_SAVE +AC_LANG_CPLUSPLUS +kde_save_cxxflags="$CXXFLAGS" +CXXFLAGS="$CXXFLAGS $MICO_INCLUDES" +AC_TRY_COMPILE( +[ +#include +], +[ +#ifdef HAVE_MINI_STL +#error "nothing" +#endif +], +kde_cv_have_mini_stl=no, +kde_cv_have_mini_stl=yes) +CXXFLAGS="$kde_save_cxxflags" +AC_LANG_RESTORE +]) + +if test "x$kde_cv_have_mini_stl" = "xyes"; then + AC_MSG_RESULT(yes) + $1 +else + AC_MSG_RESULT(no) + $2 +fi +]) + +]) + + +AC_DEFUN(KDE_CHECK_LIBPTHREAD, +[ +AC_CHECK_LIB(pthread, pthread_create, [LIBPTHREAD="-lpthread"] ) +AC_SUBST(LIBPTHREAD) +]) + +AC_DEFUN(KDE_CHECK_PTHREAD_OPTION, +[ + AC_ARG_ENABLE(kernel-threads, [ --enable-kernel-threads Enable the use of the LinuxThreads port on FreeBSD/i386 only.], + kde_use_kernthreads=$enableval, kde_use_kernthreads=no) + + if test "$kde_use_kernthreads" = "yes"; then + ac_save_CXXFLAGS="$CXXFLAGS" + ac_save_CFLAGS="$CXXFLAGS" + CXXFLAGS="-I/usr/local/include/pthread/linuxthreads $CXXFLAGS" + CFLAGS="-I/usr/local/include/pthread/linuxthreads $CFLAGS" + AC_CHECK_HEADERS(pthread/linuxthreads/pthread.h) + CXXFLAGS="$ac_save_CXXFLAGS" + CFLAGS="$ac_save_CFLAGS" + if test "$ac_cv_header_pthread_linuxthreads_pthread_h" = "no"; then + kde_use_kernthreads=no + else + dnl Add proper -I and -l statements + AC_CHECK_LIB(lthread, pthread_join, [LIBPTHREAD="-llthread -llgcc_r"]) dnl for FreeBSD + if test "x$LIBPTHREAD" = "x"; then + kde_use_kernthreads=no + else + USE_THREADS="-D_THREAD_SAFE -I/usr/local/include/pthread/linuxthreads" + fi + fi + else + USE_THREADS="" + if test -z "$LIBPTHREAD"; then + KDE_CHECK_COMPILER_FLAG(pthread, [USE_THREADS="-pthread"] ) + fi + fi + + case $host_os in + solaris*) + KDE_CHECK_COMPILER_FLAG(mt, [USE_THREADS="-mt"]) + CPPFLAGS="$CPPFLAGS -D_REENTRANT -D_POSIX_PTHREAD_SEMANTICS -DUSE_SOLARIS -DSVR4" + echo "Setting Solaris pthread compilation options" + ;; + freebsd*) + CPPFLAGS="$CPPFLAGS -D_THREAD_SAFE" + echo "Setting FreeBSD pthread compilation options" + ;; + aix*) + CPPFLAGS="$CPPFLAGS -D_THREAD_SAFE" + LIBPTHREAD="$LIBPTHREAD -lc_r" + echo "Setting AIX pthread compilation options" + ;; + linux*) CPPFLAGS="$CPPFLAGS -D_REENTRANT" + USE_THREADS="$USE_THREADS -DPIC -fPIC" + echo "Setting Linux pthread compilation options" + ;; + *) + ;; + esac + AC_SUBST(USE_THREADS) + AC_SUBST(LIBPTHREAD) +]) + +AC_DEFUN(KDE_CHECK_THREADING, +[ + AC_REQUIRE([KDE_CHECK_LIBPTHREAD]) + AC_REQUIRE([KDE_CHECK_PTHREAD_OPTION]) + dnl default is yes if libpthread is found and no if no libpthread is available + if test -z "$LIBPTHREAD"; then + kde_check_threading_default=no + else + kde_check_threading_default=yes + fi + AC_ARG_ENABLE(threading, [ --disable-threading disables threading even if libpthread found ], + kde_use_threading=$enableval, kde_use_threading=$kde_check_threading_default) + + if test "x$kde_use_threading" = "xyes"; then + AC_DEFINE(HAVE_LIBPTHREAD, 1, [Define if you have a working libpthread (will enable threaded code)]) + fi +]) + +AC_DEFUN(KDE_TRY_LINK_PYTHON, +[ +if test "$kde_python_link_found" = no; then + +if test "$1" = normal; then + AC_MSG_CHECKING(if a Python application links) +else + AC_MSG_CHECKING(if Python depends on $2) +fi + +AC_CACHE_VAL(kde_cv_try_link_python_$1, +[ +AC_LANG_SAVE +AC_LANG_C +kde_save_cflags="$CFLAGS" +CFLAGS="$CFLAGS $PYTHONINC" +kde_save_libs="$LIBS" +LIBS="$LIBS $LIBPYTHON $2 $LIBDL $LIBSOCKET" +kde_save_ldflags="$LDFLAGS" +LDFLAGS="$LDFLAGS $PYTHONLIB" + +AC_TRY_LINK( +[ +#include +],[ + PySys_SetArgv(1, 0); +], + [kde_cv_try_link_python_$1=yes], + [kde_cv_try_link_python_$1=no] +) +CFLAGS="$kde_save_cflags" +LIBS="$kde_save_libs" +LDFLAGS="$kde_save_ldflags" +]) + +if test "$kde_cv_try_link_python_$1" = "yes"; then + AC_MSG_RESULT(yes) + kde_python_link_found=yes + if test ! "$1" = normal; then + LIBPYTHON="$LIBPYTHON $2" + fi + $3 +else + AC_MSG_RESULT(no) + $4 +fi +AC_LANG_RESTORE + +fi + +]) + +AC_DEFUN(KDE_CHECK_PYTHON_DIR, +[ +AC_MSG_CHECKING([for Python directory]) + +AC_CACHE_VAL(kde_cv_pythondir, +[ + if test -z "$PYTHONDIR"; then + kde_cv_pythondir=/usr/local + else + kde_cv_pythondir="$PYTHONDIR" + fi +]) + +AC_ARG_WITH(pythondir, +[ --with-pythondir=pythondir use python installed in pythondir ], +[ + ac_python_dir=$withval +], ac_python_dir=$kde_cv_pythondir +) + +AC_MSG_RESULT($ac_python_dir) +]) + +AC_DEFUN(KDE_CHECK_PYTHON_INTERN, +[ +AC_REQUIRE([KDE_CHECK_LIBDL]) +AC_REQUIRE([KDE_CHECK_LIBPTHREAD]) +AC_REQUIRE([KDE_CHECK_PYTHON_DIR]) + +if test -z "$1"; then + version="1.5" +else + version="$1" +fi + +AC_MSG_CHECKING([for Python$version]) + +python_incdirs="$ac_python_dir/include /usr/include /usr/local/include/ $kde_extra_includes" +AC_FIND_FILE(Python.h, $python_incdirs, python_incdir) +if test ! -r $python_incdir/Python.h; then + AC_FIND_FILE(python$version/Python.h, $python_incdirs, python_incdir) + python_incdir=$python_incdir/python$version + if test ! -r $python_incdir/Python.h; then + python_incdir=no + fi +fi + +PYTHONINC=-I$python_incdir + +python_libdirs="$ac_python_dir/lib /usr/lib /usr/local /usr/lib $kde_extra_libs" +AC_FIND_FILE(libpython$version.a, $python_libdirs, python_libdir) +if test ! -r $python_libdir/libpython$version.a; then + AC_FIND_FILE(python$version/config/libpython$version.a, $python_libdirs, python_libdir) + python_libdir=$python_libdir/python$version/config + if test ! -r $python_libdir/libpython$version.a; then + python_libdir=no + fi +fi + +PYTHONLIB=-L$python_libdir +kde_orig_LIBPYTHON=$LIBPYTHON +if test -z "$LIBPYTHON"; then + LIBPYTHON=-lpython$version +fi + +python_libdirs="$ac_python_dir/lib /usr/lib /usr/local /usr/lib $kde_extra_libs" +AC_FIND_FILE(python$version/copy.py, $python_libdirs, python_moddir) +python_moddir=$python_moddir/python$version +if test ! -r $python_moddir/copy.py; then + python_moddir=no +fi + +PYTHONMODDIR=$python_moddir + +AC_MSG_RESULT(header $python_incdir library $python_libdir modules $python_moddir) + +if test x$python_incdir = xno || test x$python_libdir = xno || test x$python_moddir = xno; then + LIBPYTHON=$kde_orig_LIBPYTHON + test "x$PYTHONLIB" = "x-Lno" && PYTHONLIB="" + test "x$PYTHONINC" = "x-Ino" && PYTHONINC="" + $2 +else + dnl Note: this test is very weak + kde_python_link_found=no + KDE_TRY_LINK_PYTHON(normal) + KDE_TRY_LINK_PYTHON(m, -lm) + KDE_TRY_LINK_PYTHON(pthread, $LIBPTHREAD) + KDE_TRY_LINK_PYTHON(tcl, -ltcl) + KDE_TRY_LINK_PYTHON(m_and_thread, [$LIBPTHREAD -lm]) + KDE_TRY_LINK_PYTHON(m_and_thread_and_util, [$LIBPTHREAD -lm -lutil]) + KDE_TRY_LINK_PYTHON(m_and_thread_and_db3, [$LIBPTHREAD -lm -ldb-3 -lutil]) + KDE_TRY_LINK_PYTHON(pthread_and_db3, [$LIBPTHREAD -ldb-3]) + KDE_TRY_LINK_PYTHON(m_and_thread_and_db, [$LIBPTHREAD -lm -ldb -ltermcap -lutil]) + KDE_TRY_LINK_PYTHON(m_and_thread_and_db_special, [$LIBPTHREAD -lm -ldb -lutil], [], + [AC_MSG_WARN([it seems, Python depends on another library. + Pleae use \"make LIBPYTHON='-lpython$version -lotherlib'\" to fix this + and contact the authors to let them know about this problem]) + + ]) + + LIBPYTHON="$LIBPYTHON $LIBDL $LIBSOCKET" + AC_SUBST(PYTHONINC) + AC_SUBST(PYTHONLIB) + AC_SUBST(LIBPYTHON) + AC_SUBST(PYTHONMODDIR) + AC_DEFINE(HAVE_PYTHON, 1, [Define if you have the development files for python]) +fi + +]) + + +AC_DEFUN(KDE_CHECK_PYTHON, +[ + KDE_CHECK_PYTHON_INTERN("2.1", [KDE_CHECK_PYTHON_INTERN("2.0", + [ KDE_CHECK_PYTHON_INTERN($1, $2) ]) + ]) +]) + +AC_DEFUN(KDE_CHECK_STL_SGI, +[ + AC_MSG_CHECKING([if STL implementation is SGI like]) + AC_CACHE_VAL(kde_cv_stl_type_sgi, + [ + AC_TRY_COMPILE([ +#include +using namespace std; +],[ + string astring="Hallo Welt."; + astring.erase(0, 6); // now astring is "Welt" + return 0; +], kde_cv_stl_type_sgi=yes, + kde_cv_stl_type_sgi=no) +]) + + AC_MSG_RESULT($kde_cv_stl_type_sgi) + + if test "$kde_cv_stl_type_sgi" = "yes"; then + AC_DEFINE_UNQUOTED(HAVE_SGI_STL, 1, [Define if you have a STL implementation by SGI]) + fi +]) + +AC_DEFUN(KDE_CHECK_STL_HP, +[ + AC_MSG_CHECKING([if STL implementation is HP like]) + AC_CACHE_VAL(kde_cv_stl_type_hp, + [ + AC_TRY_COMPILE([ +#include +using namespace std; +],[ + string astring="Hello World"; + astring.remove(0, 6); // now astring is "World" + return 0; +], kde_cv_stl_type_hp=yes, + kde_cv_stl_type_hp=no) +]) + AC_MSG_RESULT($kde_cv_stl_type_hp) + + if test "$kde_cv_stl_type_hp" = "yes"; then + AC_DEFINE_UNQUOTED(HAVE_HP_STL, 1, [Define if you have a STL implementation by HP]) + fi +]) + +AC_DEFUN(KDE_CHECK_STL, +[ + AC_LANG_SAVE + AC_LANG_CPLUSPLUS + ac_save_CXXFLAGS="$CXXFLAGS" + CXXFLAGS="`echo $CXXFLAGS | sed s/-fno-exceptions//`" + KDE_CHECK_STL_SGI + + if test "$kde_cv_stl_type_sgi" = "no"; then + KDE_CHECK_STL_HP + + if test "$kde_cv_stl_type_hp" = "no"; then + AC_MSG_ERROR("no known STL type found") + fi + fi + + CXXFLAGS="$ac_save_CXXFLAGS" + AC_LANG_RESTORE +]) + +AC_DEFUN(AC_FIND_QIMGIO, + [AC_REQUIRE([AC_FIND_JPEG]) +AC_REQUIRE([KDE_CHECK_EXTRA_LIBS]) +AC_MSG_CHECKING([for qimgio]) +AC_CACHE_VAL(ac_cv_lib_qimgio, +[ +AC_LANG_SAVE +AC_LANG_CPLUSPLUS +ac_save_LIBS="$LIBS" +ac_save_CXXFLAGS="$CXXFLAGS" +LIBS="$all_libraries -lqimgio -lpng -lz $LIBJPEG $LIBQT" +CXXFLAGS="$CXXFLAGS -I$qt_incdir $all_includes" +AC_TRY_RUN(dnl +[ +#include +#include +int main() { + QString t = "hallo"; + t.fill('t'); + qInitImageIO(); +} +], + ac_cv_lib_qimgio=yes, + ac_cv_lib_qimgio=no, + ac_cv_lib_qimgio=no) +LIBS="$ac_save_LIBS" +CXXFLAGS="$ac_save_CXXFLAGS" +AC_LANG_RESTORE +])dnl +if eval "test \"`echo $ac_cv_lib_qimgio`\" = yes"; then + LIBQIMGIO="-lqimgio -lpng -lz $LIBJPEG" + AC_MSG_RESULT(yes) + AC_DEFINE_UNQUOTED(HAVE_QIMGIO, 1, [Define if you have the Qt extension qimgio available]) + AC_SUBST(LIBQIMGIO) +else + AC_MSG_RESULT(not found) +fi +]) + +AC_DEFUN(KDE_CHECK_ANSI, +[ +]) + +AC_DEFUN(KDE_CHECK_INSURE, +[ + AC_ARG_ENABLE(insure, [ --enable-insure use insure++ for debugging [default=no]], + [ + if test $enableval = "no"; dnl + then ac_use_insure="no" + else ac_use_insure="yes" + fi + ], [ac_use_insure="no"]) + + AC_MSG_CHECKING(if we will use Insure++ to debug) + AC_MSG_RESULT($ac_use_insure) + if test "$ac_use_insure" = "yes"; dnl + then CC="insure"; CXX="insure"; dnl CFLAGS="$CLAGS -fno-rtti -fno-exceptions "???? + fi +]) + +AC_DEFUN(AM_DISABLE_LIBRARIES, +[ + AC_PROVIDE([AM_ENABLE_STATIC]) + AC_PROVIDE([AM_ENABLE_SHARED]) + enable_static=no + enable_shared=yes +]) + + +AC_DEFUN(AC_CHECK_UTMP_FILE, +[ + AC_MSG_CHECKING([for utmp file]) + + AC_CACHE_VAL(kde_cv_utmp_file, + [ + kde_cv_utmp_file=no + + for ac_file in \ + \ + /var/run/utmp \ + /var/adm/utmp \ + /etc/utmp \ + ; \ + do + if test -r "$ac_file"; then + kde_cv_utmp_file=$ac_file + break + fi + done + ]) + + if test "$kde_cv_utmp_file" != "no"; then + AC_DEFINE_UNQUOTED(UTMP, "$kde_cv_utmp_file", [Define the file for utmp entries]) + $1 + AC_MSG_RESULT($kde_cv_utmp_file) + else + $2 + AC_MSG_RESULT([non found]) + fi +]) + + +AC_DEFUN(KDE_CREATE_SUBDIRSLIST, +[ + +DO_NOT_COMPILE="$DO_NOT_COMPILE CVS debian bsd-port admin" + +if test ! -s $srcdir/subdirs; then + dnl Note: Makefile.common creates subdirs, so this is just a fallback + TOPSUBDIRS="" + files=`cd $srcdir && ls -1` + dirs=`for i in $files; do if test -d $i; then echo $i; fi; done` + for i in $dirs; do + echo $i >> $srcdir/subdirs + done +fi + +if test -s $srcdir/inst-apps; then + ac_topsubdirs="`cat $srcdir/inst-apps`" +else + ac_topsubdirs="`cat $srcdir/subdirs`" +fi + +for i in $ac_topsubdirs; do + AC_MSG_CHECKING([if $i should be compiled]) + if test -d $srcdir/$i; then + install_it="yes" + for j in $DO_NOT_COMPILE; do + if test $i = $j; then + install_it="no" + fi + done + else + install_it="no" + fi + AC_MSG_RESULT($install_it) + if test $install_it = "yes"; then + TOPSUBDIRS="$TOPSUBDIRS $i" + fi +done + +AC_SUBST(TOPSUBDIRS) +]) + +AC_DEFUN(KDE_CHECK_NAMESPACES, +[ +AC_MSG_CHECKING(whether C++ compiler supports namespaces) +AC_LANG_SAVE +AC_LANG_CPLUSPLUS +AC_TRY_COMPILE([ +], +[ +namespace Foo { + extern int i; + namespace Bar { + extern int i; + } +} + +int Foo::i = 0; +int Foo::Bar::i = 1; +],[ + AC_MSG_RESULT(yes) + AC_DEFINE(HAVE_NAMESPACES) +], [ +AC_MSG_RESULT(no) +]) +AC_LANG_RESTORE +]) + +AC_DEFUN(KDE_CHECK_NEWLIBS, +[ + +]) + +dnl ------------------------------------------------------------------------ +dnl Check for S_ISSOCK macro. Doesn't exist on Unix SCO. faure@kde.org +dnl ------------------------------------------------------------------------ +dnl +AC_DEFUN(AC_CHECK_S_ISSOCK, +[ +AC_MSG_CHECKING(for S_ISSOCK) +AC_CACHE_VAL(ac_cv_have_s_issock, +[ +AC_LANG_SAVE +AC_LANG_C +AC_TRY_LINK( +[ +#include +], +[ +struct stat buff; +int b = S_ISSOCK( buff.st_mode ); +], +ac_cv_have_s_issock=yes, +ac_cv_have_s_issock=no) +AC_LANG_RESTORE +]) +AC_MSG_RESULT($ac_cv_have_s_issock) +if test "$ac_cv_have_s_issock" = "yes"; then + AC_DEFINE_UNQUOTED(HAVE_S_ISSOCK, 1, [Define if sys/stat.h declares S_ISSOCK.]) +fi +]) + +dnl ------------------------------------------------------------------------ +dnl Check for MAXPATHLEN macro, defines KDEMAXPATHLEN. faure@kde.org +dnl ------------------------------------------------------------------------ +dnl +AC_DEFUN(AC_CHECK_KDEMAXPATHLEN, +[ +AC_MSG_CHECKING(for MAXPATHLEN) +AC_CACHE_VAL(ac_cv_maxpathlen, +[ +AC_LANG_C +cat > conftest.$ac_ext < +#endif +#include +#include +#ifndef MAXPATHLEN +#define MAXPATHLEN 1024 +#endif + +KDE_HELLO MAXPATHLEN + +EOF + +ac_try="$ac_cpp conftest.$ac_ext 2>/dev/null | grep '^KDE_HELLO' >conftest.out" + +if AC_TRY_EVAL(ac_try) && test -s conftest.out; then + ac_cv_maxpathlen=`sed 's#KDE_HELLO ##' conftest.out` +else + ac_cv_maxpathlen=1024 +fi + +rm conftest.* + +]) +AC_MSG_RESULT($ac_cv_maxpathlen) +AC_DEFINE_UNQUOTED(KDEMAXPATHLEN,$ac_cv_maxpathlen, [Define a safe value for MAXPATHLEN] ) +]) + +dnl ------------------------------------------------------------------------- +dnl See if the compiler supports a template repository bero@redhat.de +dnl ------------------------------------------------------------------------- +AC_DEFUN(KDE_COMPILER_REPO, +[ + REPO="" + NOREPO="" + + KDE_CHECK_COMPILER_FLAG(frepo, + [ + REPO="-frepo" + NOREPO="-fno-repo" + ]) + + if test -z "$REPO"; then + KDE_CHECK_COMPILER_FLAG(instances=explicit, + [ + REPO="-instances=explicit" + NOREPO="-instances=extern" + ]) + fi + + if test -n "$REPO"; then + AC_DEFINE_UNQUOTED(HAVE_TEMPLATE_REPOSITORY, 1, + [C++ compiler supports template repository]) + $1 + fi + + AC_SUBST(REPO) + AC_SUBST(NOREPO) +]) + +AC_DEFUN(KDE_CHECK_HEADER, +[ + AC_LANG_SAVE + kde_safe_cppflags=$CPPFLAGS + CPPFLAGS="$CPPFLAGS $all_includes" + AC_LANG_CPLUSPLUS + AC_CHECK_HEADER($1, $2, $3) + CPPFLAGS=$kde_safe_cppflags + AC_LANG_RESTORE +]) + +AC_DEFUN(KDE_CHECK_QWSPRITEFIELD, +[ + KDE_CHECK_HEADER(QwSpriteField.h, , + [ + AC_MSG_WARN([you don't have QwSpriteField.h somewhere. Please install + QwSpriteField out of kdesupport.]) + $1 + ]) +]) + +AC_DEFUN(KDE_FAST_CONFIGURE, +[ + dnl makes configure fast (needs perl) + AC_ARG_ENABLE(fast-perl, [ --disable-fast-perl disable fast Makefile generation (needs perl)], + with_fast_perl=$enableval, with_fast_perl=yes) +]) + +AC_DEFUN(KDE_CONF_FILES, +[ + val= + if test -f $srcdir/configure.files ; then + val=`sed -e 's%^%\$(top_srcdir)/%' $srcdir/configure.files` + fi + CONF_FILES= + if test -n "$val" ; then + for i in $val ; do + CONF_FILES="$CONF_FILES $i" + done + fi + AC_SUBST(CONF_FILES) +])dnl + +AC_DEFUN(KDE_SET_PREFIX, +[ + unset CDPATH + dnl make $KDEDIR the default for the installation + AC_PREFIX_DEFAULT(${KDEDIR:-/usr/local/kde}) + + if test "x$prefix" = "xNONE"; then + prefix=$ac_default_prefix + ac_configure_args="$ac_configure_args --prefix $prefix" + fi + KDE_FAST_CONFIGURE + KDE_CONF_FILES +]) + +pushdef([AC_PROG_INSTALL], +[ + dnl our own version, testing for a -p flag + popdef([AC_PROG_INSTALL]) + dnl as AC_PROG_INSTALL works as it works we first have + dnl to save if the user didn't specify INSTALL, as the + dnl autoconf one overwrites INSTALL and we have no chance to find + dnl out afterwards + test -n "$INSTALL" && kde_save_INSTALL_given=$INSTALL + test -n "$INSTALL_PROGRAM" && kde_save_INSTALL_PROGRAM_given=$INSTALL_PROGRAM + test -n "$INSTALL_SCRIPT" && kde_save_INSTALL_SCRIPT_given=$INSTALL_SCRIPT + AC_PROG_INSTALL + + if test -z "$kde_save_INSTALL_given" ; then + # OK, user hasn't given any INSTALL, autoconf found one for us + # now we test, if it supports the -p flag + AC_MSG_CHECKING(for -p flag to install) + rm -f confinst.$$.* > /dev/null 2>&1 + echo "Testtest" > confinst.$$.orig + ac_res=no + if ${INSTALL} -p confinst.$$.orig confinst.$$.new > /dev/null 2>&1 ; then + if test -f confinst.$$.new ; then + # OK, -p seems to do no harm to install + INSTALL="${INSTALL} -p" + ac_res=yes + fi + fi + rm -f confinst.$$.* + AC_MSG_RESULT($ac_res) + fi + dnl the following tries to resolve some signs and wonders coming up + dnl with different autoconf/automake versions + dnl e.g.: + dnl *automake 1.4 install-strip sets A_M_INSTALL_PROGRAM_FLAGS to -s + dnl and has INSTALL_PROGRAM = @INSTALL_PROGRAM@ $(A_M_INSTALL_PROGRAM_FLAGS) + dnl it header-vars.am, so there the actual INSTALL_PROGRAM gets the -s + dnl *automake 1.4a (and above) use INSTALL_STRIP_FLAG and only has + dnl INSTALL_PROGRAM = @INSTALL_PROGRAM@ there, but changes the + dnl install-@DIR@PROGRAMS targets to explicitly use that flag + dnl *autoconf 2.13 is dumb, and thinks it can use INSTALL_PROGRAM as + dnl INSTALL_SCRIPT, which breaks with automake <= 1.4 + dnl *autoconf >2.13 (since 10.Apr 1999) has not that failure + dnl *sometimes KDE does not use the install-@DIR@PROGRAM targets from + dnl automake (due to broken Makefile.am or whatever) to install programs, + dnl and so does not see the -s flag in automake > 1.4 + dnl to clean up that mess we: + dnl +set INSTALL_PROGRAM to use INSTALL_STRIP_FLAG + dnl which cleans KDE's program with automake > 1.4; + dnl +set INSTALL_SCRIPT to only use INSTALL, to clean up autoconf's problems + dnl with automake<=1.4 + dnl note that dues to this sometimes two '-s' flags are used (if KDE + dnl properly uses install-@DIR@PROGRAMS, but I don't care + dnl + dnl And to all this comes, that I even can't write in comments variable + dnl names used by automake, because it is so stupid to think I wanted to + dnl _use_ them, therefor I have written A_M_... instead of AM_ + dnl hmm, I wanted to say something ... ahh yes: Arghhh. + + if test -z "$kde_save_INSTALL_PROGRAM_given" ; then + INSTALL_PROGRAM='${INSTALL} $(INSTALL_STRIP_FLAG)' + fi + if test -z "$kde_save_INSTALL_SCRIPT_given" ; then + INSTALL_SCRIPT='${INSTALL}' + fi +])dnl + +AC_DEFUN(KDE_LANG_CPLUSPLUS, +[AC_LANG_CPLUSPLUS +ac_link='rm -rf SunWS_cache; ${CXX-g++} -o conftest${ac_exeext} $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&AC_FD_CC' +pushdef([AC_LANG_CPLUSPLUS], [popdef([AC_LANG_CPLUSPLUS]) KDE_LANG_CPLUSPLUS]) +]) + +pushdef([AC_LANG_CPLUSPLUS], +[popdef([AC_LANG_CPLUSPLUS]) +KDE_LANG_CPLUSPLUS +]) + +AC_DEFUN(KDE_CHECK_LONG_LONG, +[ +AC_MSG_CHECKING(for long long) +AC_CACHE_VAL(kde_cv_c_long_long, +[ + AC_LANG_SAVE + AC_LANG_CPLUSPLUS + AC_TRY_LINK([], [ + long long foo = 0; + foo = foo+1; + ], + kde_cv_c_long_long=yes, kde_cv_c_long_long=no) +]) +AC_MSG_RESULT($kde_cv_c_long_long) +if test "$kde_cv_c_long_long" = yes; then + AC_DEFINE(HAVE_LONG_LONG, 1, [Define if you have long long as datatype]) +fi +]) + +AC_DEFUN(KDE_CHECK_LIB, +[ + kde_save_LIBS="$LIBS" + LIBS="$LIBS $all_libraries" + case $host_os in + aix*) LIBS="-brtl $LIBS" + test "$GCC" = yes && LIBS="-Wl,$LIBS" + ;; + esac + AC_CHECK_LIB($1, $2, $3, $4, $5) + LIBS="$kde_save_LIBS" +]) + + + + +AC_DEFUN(KDE_CHECK_INITGROUPS, +[ + AC_REQUIRE([AC_CANONICAL_HOST]) + AC_CHECK_FUNCS(initgroups) + if test "x$ac_cv_func_initgroups" = "xyes"; then + case $host_os in + aix*) AC_LANG_SAVE + AC_LANG_CPLUSPLUS + AC_MSG_CHECKING([for initgroups prototype]) + AC_CACHE_VAL(kde_cv_check_initgroups_proto, + [ AC_TRY_COMPILE( + [ #include + ], + [ char buffer[10]; + gid_t id; + int x = initgroups(buffer,id); + ], + kde_cv_check_initgroups_proto=yes, + kde_cv_check_initgroups_proto=no) + ]) + AC_MSG_RESULT($kde_cv_check_initgroups_proto) + AC_LANG_RESTORE + ;; + *) + kde_cv_check_initgroups_proto=yes + ;; + esac + else + kde_cv_check_initgroups_proto=no + fi + if test "x$kde_cv_check_initgroups_proto" = "xyes"; then + kde_check_initgroups_proto=1 + else + kde_check_initgroups_proto=0 + fi + AC_DEFINE_UNQUOTED(HAVE_INITGROUPS_PROTO,$kde_check_initgroups_proto, + [initgroups may exist but not its prototype (e.g. AIX<4.3.3:8)]) +]) + + +AC_DEFUN(KDE_CHECK_JAVA_DIR, +[ +AC_MSG_CHECKING([for Java directory]) + +AC_ARG_WITH(java, +[ --with-java=javadir use java installed in javadir, --without-java disables ], +[ ac_java_dir=$withval +], ac_java_dir="" +) + +dnl at this point ac_java_dir is either a dir, 'no' to disable, or '' to say look in $PATH +if test "x$ac_java_dir" = xno; then + kde_cv_java_bindir=no + kde_cv_java_includedir=no + kde_cv_java_libjvmdir=no + kde_cv_java_libhpidir=no +else + if test "x$ac_java_dir" = x; then + dnl No option set -> look in $PATH + AC_CACHE_VAL(kde_cv_java_bindir, + [ + dnl First look for javac in $PATH. If not found we'll look at the option. + KDE_FIND_PATH(javac, JAVAC, [], []) + if test -n "$JAVAC"; then + kde_cv_java_bindir=`echo $JAVAC | sed -e 's,/javac$,/,'` + dnl this substitution might not work - well, we test for jni.h below + kde_cv_java_includedir=`echo $kde_cv_java_bindir | sed -e 's,bin/$,include/,'` + else + kde_cv_java_bindir=no + fi + ]) + else + dnl config option set + kde_cv_java_bindir=$ac_java_dir/bin + kde_cv_java_includedir=$ac_java_dir/include + fi +fi + +dnl Look for libjvm.so +kde_cv_java_libjvmdir=`find $kde_cv_java_bindir/.. -name libjvm.so | sed 's,libjvm.so,,'|head -n 1` +dnl Look for libhpi.so and avoid green threads +kde_cv_java_libhpidir=`find $kde_cv_java_bindir/.. -name libhpi.so | grep -v green | sed 's,libhpi.so,,'` + +dnl At this point kde_cv_java_bindir and kde_cv_java_includedir are either set or "no" +if test ! "x$kde_cv_java_bindir" = xno; then + + dnl Now check everything's fine under there + + if test ! -x "$kde_cv_java_bindir/javac"; then + AC_MSG_ERROR([javac not found under $kde_cv_java_bindir - it seems you passed a wrong --with-java.]) + fi + if test ! -x "$kde_cv_java_bindir/javah"; then + AC_MSG_ERROR([javah not found under $kde_cv_java_bindir. javac was found though! Use --with-java or --without-java.]) + fi + if test ! -x "$kde_cv_java_bindir/jar"; then + AC_MSG_ERROR([jar not found under $kde_cv_java_bindir. javac was found though! Use --with-java or --without-java.]) + fi + if test ! -r "$kde_cv_java_includedir/jni.h"; then + AC_MSG_ERROR([jni.h not found under $kde_cv_java_includedir. Use --with-java or --without-java.]) + fi + if test ! -r "$kde_cv_java_libjvmdir/libjvm.so"; then + AC_MSG_ERROR([libjvm.so not found under $kde_cv_java_libjvmdir. Use --without-java.]) + fi + if test ! -r "$kde_cv_java_libhpidir/libhpi.so"; then + AC_MSG_ERROR([libhpi.so not found under $kde_cv_java_libhpidir. Use --without-java.]) + fi + + jni_includes="-I$kde_cv_java_includedir" + dnl Strange thing, jni.h requires jni_md.h which is under genunix here.. + dnl and under linux here.. + test -d "$kde_cv_java_includedir/linux" && jni_includes="$jni_includes -I$kde_cv_java_includedir/linux" + test -d "$kde_cv_java_includedir/genunix" && jni_includes="$jni_includes -I$kde_cv_java_includedir/genunix" + + dnl Check for JNI version + AC_LANG_SAVE + AC_LANG_CPLUSPLUS + ac_cxxflags_safe="$CXXFLAGS" + CXXFLAGS="$CXXFLAGS $all_includes $jni_includes" + + AC_TRY_COMPILE([ +#include + ], + [ +#ifndef JNI_VERSION_1_2 +Syntax Error +#endif + ],[ + ],[ AC_MSG_ERROR([Incorrect version of $kde_cv_java_includedir/jni.h. + You need to have Java Development Kit (JDK) version 1.2. + + Use --with-java to specify another location. + Use --without-java to configure without java support. + Or download a newer JDK and try again. + See e.g. http://java.sun.com/products/jdk/1.2 ]) + ]) + + CXXFLAGS="$ac_cxxflags_safe" + AC_LANG_RESTORE + + dnl All tests ok, inform and subst the variables + AC_MSG_RESULT([javac/javah/jar in $kde_cv_java_bindir, jni.h in $kde_cv_java_includedir]) + + JAVAC=$kde_cv_java_bindir/javac + AC_SUBST(JAVAC) + JAVAH=$kde_cv_java_bindir/javah + AC_SUBST(JAVAH) + JAR=$kde_cv_java_bindir/jar + AC_SUBST(JAR) + AC_SUBST(jni_includes) + JVMLIBS="-L$kde_cv_java_libjvmdir -ljvm -L$kde_cv_java_libhpidir -lhpi" + AC_SUBST(JVMLIBS) +fi +]) + +# serial 46 AC_PROG_LIBTOOL +AC_DEFUN([AC_PROG_LIBTOOL], +[AC_REQUIRE([_AC_PROG_LIBTOOL])dnl +dnl If AC_PROG_CXX has already been expanded, run AC_LIBTOOL_CXX +dnl immediately, otherwise, hook it in at the end of AC_PROG_CXX. + AC_PROVIDE_IFELSE([AC_PROG_CXX], + [AC_LIBTOOL_CXX], + [define([AC_PROG_CXX], defn([AC_PROG_CXX])[AC_LIBTOOL_CXX +])]) + +dnl Quote A][M_PROG_GCJ so that aclocal doesn't bring it in needlessly. +dnl If either AC_PROG_GCJ or A][M_PROG_GCJ have already been expanded, run +dnl AC_LIBTOOL_GCJ immediately, otherwise, hook it in at the end of both. + AC_PROVIDE_IFELSE([AC_PROG_GCJ], + [AC_LIBTOOL_GCJ], + [AC_PROVIDE_IFELSE([A][M_PROG_GCJ], + [AC_LIBTOOL_GCJ], + [AC_PROVIDE_IFELSE([LT_AC_PROG_GCJ], + [AC_LIBTOOL_GCJ], + [ifdef([AC_PROG_GCJ], + [define([AC_PROG_GCJ], defn([AC_PROG_GCJ])[AC_LIBTOOL_GCJ +])]) + ifdef([A][M_PROG_GCJ], + [define([A][M_PROG_GCJ], defn([A][M_PROG_GCJ])[AC_LIBTOOL_GCJ +])]) + ifdef([LT_AC_PROG_GCJ], + [define([LT_AC_PROG_GCJ], defn([LT_AC_PROG_GCJ])[AC_LIBTOOL_GCJ +])])])])])]) + +AC_DEFUN([_AC_PROG_LIBTOOL], +[AC_REQUIRE([AC_LIBTOOL_SETUP])dnl +AC_BEFORE([$0],[AC_LIBTOOL_CXX])dnl +AC_BEFORE([$0],[AC_LIBTOOL_GCJ])dnl + +# Save cache, so that ltconfig can load it +AC_CACHE_SAVE + +# Actually configure libtool. ac_aux_dir is where install-sh is found. +AR="$AR" LTCC="$CC" CC="$CC" CFLAGS="$CFLAGS" CPPFLAGS="$CPPFLAGS" \ +MAGIC_CMD="$MAGIC_CMD" LD="$LD" LDFLAGS="$LDFLAGS" LIBS="$LIBS" \ +LN_S="$LN_S" NM="$NM" RANLIB="$RANLIB" STRIP="$STRIP" \ +AS="$AS" DLLTOOL="$DLLTOOL" OBJDUMP="$OBJDUMP" \ +objext="$OBJEXT" exeext="$EXEEXT" reload_flag="$reload_flag" \ +deplibs_check_method="$deplibs_check_method" file_magic_cmd="$file_magic_cmd" \ +${CONFIG_SHELL-/bin/sh} $ac_aux_dir/ltconfig --no-reexec \ +$libtool_flags --no-verify --build="$build" $ac_aux_dir/ltmain.sh $host \ +|| AC_MSG_ERROR([libtool configure failed]) + +# Reload cache, that may have been modified by ltconfig +AC_CACHE_LOAD + +# This can be used to rebuild libtool when needed +LIBTOOL_DEPS="$ac_aux_dir/ltconfig $ac_aux_dir/ltmain.sh $ac_aux_dir/ltcf-c.sh" + +# Always use our own libtool. +LIBTOOL='$(SHELL) $(top_builddir)/libtool' +AC_SUBST(LIBTOOL)dnl + +# Redirect the config.log output again, so that the ltconfig log is not +# clobbered by the next message. +exec 5>>./config.log +]) + +AC_DEFUN([AC_LIBTOOL_SETUP], +[AC_PREREQ(2.13)dnl +AC_REQUIRE([AC_ENABLE_SHARED])dnl +AC_REQUIRE([AC_ENABLE_STATIC])dnl +AC_REQUIRE([AC_ENABLE_FAST_INSTALL])dnl +AC_REQUIRE([AC_CANONICAL_HOST])dnl +AC_REQUIRE([AC_CANONICAL_BUILD])dnl +AC_REQUIRE([AC_PROG_CC])dnl +AC_REQUIRE([AC_PROG_LD])dnl +AC_REQUIRE([AC_PROG_LD_RELOAD_FLAG])dnl +AC_REQUIRE([AC_PROG_NM])dnl +AC_REQUIRE([AC_PROG_LN_S])dnl +AC_REQUIRE([AC_DEPLIBS_CHECK_METHOD])dnl +# Autoconf 2.13's AC_OBJEXT and AC_EXEEXT macros only works for C compilers! +AC_REQUIRE([AC_OBJEXT])dnl +AC_REQUIRE([AC_EXEEXT])dnl +dnl + +# Only perform the check for file, if the check method requires it +case $deplibs_check_method in +file_magic*) + if test "$file_magic_cmd" = '$MAGIC_CMD'; then + AC_PATH_MAGIC + fi + ;; +esac + +AC_CHECK_TOOL(RANLIB, ranlib, :) +AC_CHECK_TOOL(STRIP, strip, :) + +# Check for any special flags to pass to ltconfig. +libtool_flags="--cache-file=$cache_file" +test "$enable_shared" = no && libtool_flags="$libtool_flags --disable-shared" +test "$enable_static" = no && libtool_flags="$libtool_flags --disable-static" +test "$enable_fast_install" = no && libtool_flags="$libtool_flags --disable-fast-install" +test "$GCC" = yes && libtool_flags="$libtool_flags --with-gcc" +test "$lt_cv_prog_gnu_ld" = yes && libtool_flags="$libtool_flags --with-gnu-ld" +ifdef([AC_PROVIDE_AC_LIBTOOL_DLOPEN], +[libtool_flags="$libtool_flags --enable-dlopen"]) +ifdef([AC_PROVIDE_AC_LIBTOOL_WIN32_DLL], +[libtool_flags="$libtool_flags --enable-win32-dll"]) +AC_ARG_ENABLE(libtool-lock, + [ --disable-libtool-lock avoid locking (might break parallel builds)]) +test "x$enable_libtool_lock" = xno && libtool_flags="$libtool_flags --disable-lock" +test x"$silent" = xyes && libtool_flags="$libtool_flags --silent" + +AC_ARG_WITH(pic, + [ --with-pic try to use only PIC/non-PIC objects [default=use both]], + pic_mode="$withval", pic_mode=default) +test x"$pic_mode" = xyes && libtool_flags="$libtool_flags --prefer-pic" +test x"$pic_mode" = xno && libtool_flags="$libtool_flags --prefer-non-pic" + +# Some flags need to be propagated to the compiler or linker for good +# libtool support. +case $host in +*-*-irix6*) + # Find out which ABI we are using. + echo '[#]line __oline__ "configure"' > conftest.$ac_ext + if AC_TRY_EVAL(ac_compile); then + case `/usr/bin/file conftest.$ac_objext` in + *32-bit*) + LD="${LD-ld} -32" + ;; + *N32*) + LD="${LD-ld} -n32" + ;; + *64-bit*) + LD="${LD-ld} -64" + ;; + esac + fi + rm -rf conftest* + ;; + +*-*-sco3.2v5*) + # On SCO OpenServer 5, we need -belf to get full-featured binaries. + SAVE_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS -belf" + AC_CACHE_CHECK([whether the C compiler needs -belf], lt_cv_cc_needs_belf, + [AC_LANG_SAVE + AC_LANG_C + AC_TRY_LINK([],[],[lt_cv_cc_needs_belf=yes],[lt_cv_cc_needs_belf=no]) + AC_LANG_RESTORE]) + if test x"$lt_cv_cc_needs_belf" != x"yes"; then + # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf + CFLAGS="$SAVE_CFLAGS" + fi + ;; + +ifdef([AC_PROVIDE_AC_LIBTOOL_WIN32_DLL], +[*-*-cygwin* | *-*-mingw* | *-*-pw32*) + AC_CHECK_TOOL(DLLTOOL, dlltool, false) + AC_CHECK_TOOL(AS, as, false) + AC_CHECK_TOOL(OBJDUMP, objdump, false) + + # recent cygwin and mingw systems supply a stub DllMain which the user + # can override, but on older systems we have to supply one + AC_CACHE_CHECK([if libtool should supply DllMain function], lt_cv_need_dllmain, + [AC_TRY_LINK([], + [extern int __attribute__((__stdcall__)) DllMain(void*, int, void*); + DllMain (0, 0, 0);], + [lt_cv_need_dllmain=no],[lt_cv_need_dllmain=yes])]) + + case $host/$CC in + *-*-cygwin*/gcc*-mno-cygwin*|*-*-mingw*) + # old mingw systems require "-dll" to link a DLL, while more recent ones + # require "-mdll" + SAVE_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS -mdll" + AC_CACHE_CHECK([how to link DLLs], lt_cv_cc_dll_switch, + [AC_TRY_LINK([], [], [lt_cv_cc_dll_switch=-mdll],[lt_cv_cc_dll_switch=-dll])]) + CFLAGS="$SAVE_CFLAGS" ;; + *-*-cygwin* | *-*-pw32*) + # cygwin systems need to pass --dll to the linker, and not link + # crt.o which will require a WinMain@16 definition. + lt_cv_cc_dll_switch="-Wl,--dll -nostartfiles" ;; + esac + ;; + ]) +esac +]) + +# AC_LIBTOOL_DLOPEN - enable checks for dlopen support +AC_DEFUN([AC_LIBTOOL_DLOPEN], [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])]) + +# AC_LIBTOOL_WIN32_DLL - declare package support for building win32 dll's +AC_DEFUN([AC_LIBTOOL_WIN32_DLL], [AC_BEFORE([$0], [AC_LIBTOOL_SETUP])]) + +# AC_ENABLE_SHARED - implement the --enable-shared flag +# Usage: AC_ENABLE_SHARED[(DEFAULT)] +# Where DEFAULT is either `yes' or `no'. If omitted, it defaults to +# `yes'. +AC_DEFUN([AC_ENABLE_SHARED], +[define([AC_ENABLE_SHARED_DEFAULT], ifelse($1, no, no, yes))dnl +AC_ARG_ENABLE(shared, +changequote(<<, >>)dnl +<< --enable-shared[=PKGS] build shared libraries [default=>>AC_ENABLE_SHARED_DEFAULT], +changequote([, ])dnl +[p=${PACKAGE-default} +case $enableval in +yes) enable_shared=yes ;; +no) enable_shared=no ;; +*) + enable_shared=no + # Look at the argument we got. We use all the common list separators. + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:," + for pkg in $enableval; do + if test "X$pkg" = "X$p"; then + enable_shared=yes + fi + done + IFS="$ac_save_ifs" + ;; +esac], +enable_shared=AC_ENABLE_SHARED_DEFAULT)dnl +]) + +# AC_DISABLE_SHARED - set the default shared flag to --disable-shared +AC_DEFUN([AC_DISABLE_SHARED], [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl +AC_ENABLE_SHARED(no)]) + +# AC_ENABLE_STATIC - implement the --enable-static flag +# Usage: AC_ENABLE_STATIC[(DEFAULT)] +# Where DEFAULT is either `yes' or `no'. If omitted, it defaults to +# `yes'. +AC_DEFUN([AC_ENABLE_STATIC], +[define([AC_ENABLE_STATIC_DEFAULT], ifelse($1, no, no, yes))dnl +AC_ARG_ENABLE(static, +changequote(<<, >>)dnl +<< --enable-static[=PKGS] build static libraries [default=>>AC_ENABLE_STATIC_DEFAULT], +changequote([, ])dnl +[p=${PACKAGE-default} +case $enableval in +yes) enable_static=yes ;; +no) enable_static=no ;; +*) + enable_static=no + # Look at the argument we got. We use all the common list separators. + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:," + for pkg in $enableval; do + if test "X$pkg" = "X$p"; then + enable_static=yes + fi + done + IFS="$ac_save_ifs" + ;; +esac], +enable_static=AC_ENABLE_STATIC_DEFAULT)dnl +]) + +# AC_DISABLE_STATIC - set the default static flag to --disable-static +AC_DEFUN([AC_DISABLE_STATIC], +[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl +AC_ENABLE_STATIC(no)]) + + +# AC_ENABLE_FAST_INSTALL - implement the --enable-fast-install flag +# Usage: AC_ENABLE_FAST_INSTALL[(DEFAULT)] +# Where DEFAULT is either `yes' or `no'. If omitted, it defaults to +# `yes'. +AC_DEFUN([AC_ENABLE_FAST_INSTALL], +[define([AC_ENABLE_FAST_INSTALL_DEFAULT], ifelse($1, no, no, yes))dnl +AC_ARG_ENABLE(fast-install, +changequote(<<, >>)dnl +<< --enable-fast-install[=PKGS] optimize for fast installation [default=>>AC_ENABLE_FAST_INSTALL_DEFAULT], +changequote([, ])dnl +[p=${PACKAGE-default} +case $enableval in +yes) enable_fast_install=yes ;; +no) enable_fast_install=no ;; +*) + enable_fast_install=no + # Look at the argument we got. We use all the common list separators. + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:," + for pkg in $enableval; do + if test "X$pkg" = "X$p"; then + enable_fast_install=yes + fi + done + IFS="$ac_save_ifs" + ;; +esac], +enable_fast_install=AC_ENABLE_FAST_INSTALL_DEFAULT)dnl +]) + +# AC_DISABLE_FAST_INSTALL - set the default to --disable-fast-install +AC_DEFUN([AC_DISABLE_FAST_INSTALL], +[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl +AC_ENABLE_FAST_INSTALL(no)]) + +# AC_LIBTOOL_PICMODE - implement the --with-pic flag +# Usage: AC_LIBTOOL_PICMODE[(MODE)] +# Where MODE is either `yes' or `no'. If omitted, it defaults to +# `both'. +AC_DEFUN([AC_LIBTOOL_PICMODE], +[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl +pic_mode=ifelse($#,1,$1,default)]) + + +# AC_PATH_TOOL_PREFIX - find a file program which can recognise shared library +AC_DEFUN([AC_PATH_TOOL_PREFIX], +[AC_MSG_CHECKING([for $1]) +AC_CACHE_VAL(lt_cv_path_MAGIC_CMD, +[case $MAGIC_CMD in + /*) + lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path. + ;; + ?:/*) + lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a dos path. + ;; + *) + ac_save_MAGIC_CMD="$MAGIC_CMD" + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" +dnl $ac_dummy forces splitting on constant user-supplied paths. +dnl POSIX.2 word splitting is done only on the output of word expansions, +dnl not every word. This closes a longstanding sh security hole. + ac_dummy="ifelse([$2], , $PATH, [$2])" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$1; then + lt_cv_path_MAGIC_CMD="$ac_dir/$1" + if test -n "$file_magic_test_file"; then + case $deplibs_check_method in + "file_magic "*) + file_magic_regex="`expr \"$deplibs_check_method\" : \"file_magic \(.*\)\"`" + MAGIC_CMD="$lt_cv_path_MAGIC_CMD" + if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null | + egrep "$file_magic_regex" > /dev/null; then + : + else + cat <&2 + +*** Warning: the command libtool uses to detect shared libraries, +*** $file_magic_cmd, produces output that libtool cannot recognize. +*** The result is that libtool may fail to recognize shared libraries +*** as such. This will affect the creation of libtool libraries that +*** depend on shared libraries, but programs linked with such libtool +*** libraries will work regardless of this problem. Nevertheless, you +*** may want to report the problem to your system manager and/or to +*** bug-libtool@gnu.org + +EOF + fi ;; + esac + fi + break + fi + done + IFS="$ac_save_ifs" + MAGIC_CMD="$ac_save_MAGIC_CMD" + ;; +esac]) +MAGIC_CMD="$lt_cv_path_MAGIC_CMD" +if test -n "$MAGIC_CMD"; then + AC_MSG_RESULT($MAGIC_CMD) +else + AC_MSG_RESULT(no) +fi +]) + + +# AC_PATH_MAGIC - find a file program which can recognise a shared library +AC_DEFUN([AC_PATH_MAGIC], +[AC_REQUIRE([AC_CHECK_TOOL_PREFIX])dnl +AC_PATH_TOOL_PREFIX(${ac_tool_prefix}file, /usr/bin:$PATH) +if test -z "$lt_cv_path_MAGIC_CMD"; then + if test -n "$ac_tool_prefix"; then + AC_PATH_TOOL_PREFIX(file, /usr/bin:$PATH) + else + MAGIC_CMD=: + fi +fi +]) + + +# AC_PROG_LD - find the path to the GNU or non-GNU linker +AC_DEFUN([AC_PROG_LD], +[AC_ARG_WITH(gnu-ld, +[ --with-gnu-ld assume the C compiler uses GNU ld [default=no]], +test "$withval" = no || with_gnu_ld=yes, with_gnu_ld=no) +AC_REQUIRE([AC_PROG_CC])dnl +AC_REQUIRE([AC_CANONICAL_HOST])dnl +AC_REQUIRE([AC_CANONICAL_BUILD])dnl +ac_prog=ld +if test "$GCC" = yes; then + # Check if gcc -print-prog-name=ld gives a path. + AC_MSG_CHECKING([for ld used by GCC]) + case $host in + *-*-mingw*) + # gcc leaves a trailing carriage return which upsets mingw + ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;; + *) + ac_prog=`($CC -print-prog-name=ld) 2>&5` ;; + esac + case $ac_prog in + # Accept absolute paths. + [[\\/]* | [A-Za-z]:[\\/]*)] + re_direlt=['/[^/][^/]*/\.\./'] + # Canonicalize the path of ld + ac_prog=`echo $ac_prog| sed 's%\\\\%/%g'` + while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do + ac_prog=`echo $ac_prog| sed "s%$re_direlt%/%"` + done + test -z "$LD" && LD="$ac_prog" + ;; + "") + # If it fails, then pretend we aren't using GCC. + ac_prog=ld + ;; + *) + # If it is relative, then search for the first ld in PATH. + with_gnu_ld=unknown + ;; + esac +elif test "$with_gnu_ld" = yes; then + AC_MSG_CHECKING([for GNU ld]) +else + AC_MSG_CHECKING([for non-GNU ld]) +fi +AC_CACHE_VAL(lt_cv_path_LD, +[if test -z "$LD"; then + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}" + for ac_dir in $PATH; do + test -z "$ac_dir" && ac_dir=. + if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then + lt_cv_path_LD="$ac_dir/$ac_prog" + # Check to see if the program is GNU ld. I'd rather use --version, + # but apparently some GNU ld's only accept -v. + # Break only if it was the GNU/non-GNU ld that we prefer. + if "$lt_cv_path_LD" -v 2>&1 < /dev/null | egrep '(GNU|with BFD)' > /dev/null; then + test "$with_gnu_ld" != no && break + else + test "$with_gnu_ld" != yes && break + fi + fi + done + IFS="$ac_save_ifs" +else + lt_cv_path_LD="$LD" # Let the user override the test with a path. +fi]) +LD="$lt_cv_path_LD" +if test -n "$LD"; then + AC_MSG_RESULT($LD) +else + AC_MSG_RESULT(no) +fi +test -z "$LD" && AC_MSG_ERROR([no acceptable ld found in \$PATH]) +AC_PROG_LD_GNU +]) + +AC_DEFUN([AC_PROG_LD_GNU], +[AC_CACHE_CHECK([if the linker ($LD) is GNU ld], lt_cv_prog_gnu_ld, +[# I'd rather use --version here, but apparently some GNU ld's only accept -v. +if $LD -v 2>&1 &5; then + lt_cv_prog_gnu_ld=yes +else + lt_cv_prog_gnu_ld=no +fi]) +with_gnu_ld=$lt_cv_prog_gnu_ld +]) + +# AC_PROG_LD_RELOAD_FLAG - find reload flag for linker +# -- PORTME Some linkers may need a different reload flag. +AC_DEFUN([AC_PROG_LD_RELOAD_FLAG], +[AC_CACHE_CHECK([for $LD option to reload object files], lt_cv_ld_reload_flag, +[lt_cv_ld_reload_flag='-r']) +reload_flag=$lt_cv_ld_reload_flag +test -n "$reload_flag" && reload_flag=" $reload_flag" +]) + +# AC_DEPLIBS_CHECK_METHOD - how to check for library dependencies +# -- PORTME fill in with the dynamic library characteristics +AC_DEFUN([AC_DEPLIBS_CHECK_METHOD], +[AC_CACHE_CHECK([how to recognise dependant libraries], +lt_cv_deplibs_check_method, +[lt_cv_file_magic_cmd='$MAGIC_CMD' +lt_cv_file_magic_test_file= +lt_cv_deplibs_check_method='unknown' +# Need to set the preceding variable on all platforms that support +# interlibrary dependencies. +# 'none' -- dependencies not supported. +# `unknown' -- same as none, but documents that we really don't know. +# 'pass_all' -- all dependencies passed with no checks. +# 'test_compile' -- check by making test program. +# 'file_magic [regex]' -- check by looking for files in library path +# which responds to the $file_magic_cmd with a given egrep regex. +# If you have `file' or equivalent on your system and you're not sure +# whether `pass_all' will *always* work, you probably want this one. + +case $host_os in +aix*) + lt_cv_deplibs_check_method=pass_all + ;; + +beos*) + lt_cv_deplibs_check_method=pass_all + ;; + +bsdi4*) + lt_cv_deplibs_check_method=['file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib)'] + lt_cv_file_magic_cmd='/usr/bin/file -L' + lt_cv_file_magic_test_file=/shlib/libc.so + ;; + +cygwin* | mingw* |pw32*) + lt_cv_deplibs_check_method='file_magic file format pei*-i386(.*architecture: i386)?' + lt_cv_file_magic_cmd='$OBJDUMP -f' + ;; + +darwin* | rhapsody*) + lt_cv_deplibs_check_method='file_magic Mach-O dynamically linked shared library' + lt_cv_file_magic_cmd='/usr/bin/file -L' + case "$host_os" in + rhapsody* | darwin1.[012]) + lt_cv_file_magic_test_file='/System/Library/Frameworks/System.framework/System' + ;; + *) # Darwin 1.3 on + lt_cv_file_magic_test_file='/usr/lib/libSystem.dylib' + ;; + esac + ;; + +freebsd* ) + if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then + case $host_cpu in + i*86 ) + # Not sure whether the presence of OpenBSD here was a mistake. + # Let's accept both of them until this is cleared up. + lt_cv_deplibs_check_method=['file_magic (FreeBSD|OpenBSD)/i[3-9]86 (compact )?demand paged shared library'] + lt_cv_file_magic_cmd=/usr/bin/file + lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*` + ;; + esac + else + lt_cv_deplibs_check_method=pass_all + fi + ;; + +gnu*) + lt_cv_deplibs_check_method=pass_all + ;; + +hpux10.20*|hpux11*) + lt_cv_deplibs_check_method=['file_magic (s[0-9][0-9][0-9]|PA-RISC[0-9].[0-9]) shared library'] + lt_cv_file_magic_cmd=/usr/bin/file + lt_cv_file_magic_test_file=/usr/lib/libc.sl + ;; + +irix5* | irix6*) + case $host_os in + irix5*) + # this will be overridden with pass_all, but let us keep it just in case + lt_cv_deplibs_check_method="file_magic ELF 32-bit MSB dynamic lib MIPS - version 1" + ;; + *) + case $LD in + *-32|*"-32 ") libmagic=32-bit;; + *-n32|*"-n32 ") libmagic=N32;; + *-64|*"-64 ") libmagic=64-bit;; + *) libmagic=never-match;; + esac + # this will be overridden with pass_all, but let us keep it just in case + lt_cv_deplibs_check_method=["file_magic ELF ${libmagic} MSB mips-[1234] dynamic lib MIPS - version 1"] + ;; + esac + lt_cv_file_magic_test_file=`echo /lib${libsuff}/libc.so*` + lt_cv_deplibs_check_method=pass_all + ;; + +# This must be Linux ELF. +linux-gnu*) + case $host_cpu in + alpha* | i*86 | powerpc* | sparc* | ia64* | s390* | m68k* | arm* | mips* | hppa* | sh* ) + lt_cv_deplibs_check_method=pass_all ;; + *) + # glibc up to 2.1.1 does not perform some relocations on ARM + lt_cv_deplibs_check_method=['file_magic ELF [0-9][0-9]*-bit [LM]SB (shared object|dynamic lib )'] ;; + esac + lt_cv_file_magic_test_file=`echo /lib/libc.so* /lib/libc-*.so` + ;; + +netbsd*) + if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then + [lt_cv_deplibs_check_method='file_magic NetBSD/[a-z0-9]* demand paged shared library'] + else + [lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [LM]SB shared object'] + fi + lt_cv_file_magic_cmd='/usr/bin/file -L' + lt_cv_file_magic_test_file=`echo /usr/lib/libc.so*` + ;; + +openbsd* ) + if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then + case "$host_cpu" in + i*86 ) + changequote(,)dnl + lt_cv_deplibs_check_method='file_magic OpenBSD/i[3-9]86 demand paged shared library' + changequote([, ])dnl + lt_cv_file_magic_cmd=/usr/bin/file + lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*` + ;; + esac + else + lt_cv_deplibs_check_method=pass_all + fi + ;; + +newsos6) + [lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (executable|dynamic lib)'] + lt_cv_file_magic_cmd=/usr/bin/file + lt_cv_file_magic_test_file=/usr/lib/libnls.so + ;; + +osf3* | osf4* | osf5*) + # this will be overridden with pass_all, but let us keep it just in case + lt_cv_deplibs_check_method='file_magic COFF format alpha shared library' + lt_cv_file_magic_test_file=/shlib/libc.so + lt_cv_deplibs_check_method=pass_all + ;; + +sco3.2v5*) + lt_cv_deplibs_check_method=pass_all + ;; + +solaris*) + lt_cv_deplibs_check_method=pass_all + lt_cv_file_magic_test_file=/lib/libc.so + ;; + +sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) + case $host_vendor in + ncr) + lt_cv_deplibs_check_method=pass_all + ;; + motorola) + lt_cv_deplibs_check_method=['file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib) M[0-9][0-9]* Version [0-9]'] + lt_cv_file_magic_test_file=`echo /usr/lib/libc.so*` + ;; + esac + ;; +esac +]) +file_magic_cmd=$lt_cv_file_magic_cmd +deplibs_check_method=$lt_cv_deplibs_check_method +]) + + +# AC_PROG_NM - find the path to a BSD-compatible name lister +AC_DEFUN([AC_PROG_NM], +[AC_MSG_CHECKING([for BSD-compatible nm]) +AC_CACHE_VAL(lt_cv_path_NM, +[if test -n "$NM"; then + # Let the user override the test. + lt_cv_path_NM="$NM" +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}" + for ac_dir in $PATH /usr/ccs/bin /usr/ucb /bin; do + test -z "$ac_dir" && ac_dir=. + tmp_nm=$ac_dir/${ac_tool_prefix}nm + if test -f $tmp_nm || test -f $tmp_nm$ac_exeext ; then + # Check to see if the nm accepts a BSD-compat flag. + # Adding the `sed 1q' prevents false positives on HP-UX, which says: + # nm: unknown option "B" ignored + # Tru64's nm complains that /dev/null is an invalid object file + if ($tmp_nm -B /dev/null 2>&1 | sed '1q'; exit 0) | egrep '(/dev/null|Invalid file or object type)' >/dev/null; then + lt_cv_path_NM="$tmp_nm -B" + break + elif ($tmp_nm -p /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then + lt_cv_path_NM="$tmp_nm -p" + break + else + lt_cv_path_NM=${lt_cv_path_NM="$tmp_nm"} # keep the first match, but + continue # so that we can try to find one that supports BSD flags + fi + fi + done + IFS="$ac_save_ifs" + test -z "$lt_cv_path_NM" && lt_cv_path_NM=nm +fi]) +NM="$lt_cv_path_NM" +AC_MSG_RESULT([$NM]) +]) + +# AC_CHECK_LIBM - check for math library +AC_DEFUN([AC_CHECK_LIBM], +[AC_REQUIRE([AC_CANONICAL_HOST])dnl +LIBM= +case $host in +*-*-beos* | *-*-cygwin* | *-*-pw32*) + # These system don't have libm + ;; +*-ncr-sysv4.3*) + AC_CHECK_LIB(mw, _mwvalidcheckl, LIBM="-lmw") + AC_CHECK_LIB(m, main, LIBM="$LIBM -lm") + ;; +*) + AC_CHECK_LIB(m, main, LIBM="-lm") + ;; +esac +]) + +# AC_LIBLTDL_CONVENIENCE[(dir)] - sets LIBLTDL to the link flags for +# the libltdl convenience library and INCLTDL to the include flags for +# the libltdl header and adds --enable-ltdl-convenience to the +# configure arguments. Note that LIBLTDL and INCLTDL are not +# AC_SUBSTed, nor is AC_CONFIG_SUBDIRS called. If DIR is not +# provided, it is assumed to be `libltdl'. LIBLTDL will be prefixed +# with '${top_builddir}/' and INCLTDL will be prefixed with +# '${top_srcdir}/' (note the single quotes!). If your package is not +# flat and you're not using automake, define top_builddir and +# top_srcdir appropriately in the Makefiles. +AC_DEFUN([AC_LIBLTDL_CONVENIENCE], +[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl + case $enable_ltdl_convenience in + no) AC_MSG_ERROR([this package needs a convenience libltdl]) ;; + "") enable_ltdl_convenience=yes + ac_configure_args="$ac_configure_args --enable-ltdl-convenience" ;; + esac + LIBLTDL='${top_builddir}/'ifelse($#,1,[$1],['libltdl'])/libltdlc.la + INCLTDL='-I${top_srcdir}/'ifelse($#,1,[$1],['libltdl']) +]) + +# AC_LIBLTDL_INSTALLABLE[(dir)] - sets LIBLTDL to the link flags for +# the libltdl installable library and INCLTDL to the include flags for +# the libltdl header and adds --enable-ltdl-install to the configure +# arguments. Note that LIBLTDL and INCLTDL are not AC_SUBSTed, nor is +# AC_CONFIG_SUBDIRS called. If DIR is not provided and an installed +# libltdl is not found, it is assumed to be `libltdl'. LIBLTDL will +# be prefixed with '${top_builddir}/' and INCLTDL will be prefixed +# with '${top_srcdir}/' (note the single quotes!). If your package is +# not flat and you're not using automake, define top_builddir and +# top_srcdir appropriately in the Makefiles. +# In the future, this macro may have to be called after AC_PROG_LIBTOOL. +AC_DEFUN([AC_LIBLTDL_INSTALLABLE], +[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl + AC_CHECK_LIB(ltdl, main, + [test x"$enable_ltdl_install" != xyes && enable_ltdl_install=no], + [if test x"$enable_ltdl_install" = xno; then + AC_MSG_WARN([libltdl not installed, but installation disabled]) + else + enable_ltdl_install=yes + fi + ]) + if test x"$enable_ltdl_install" = x"yes"; then + ac_configure_args="$ac_configure_args --enable-ltdl-install" + LIBLTDL='${top_builddir}/'ifelse($#,1,[$1],['libltdl'])/libltdl.la + INCLTDL='-I${top_srcdir}/'ifelse($#,1,[$1],['libltdl']) + else + ac_configure_args="$ac_configure_args --enable-ltdl-install=no" + LIBLTDL="-lltdl" + INCLTDL= + fi +]) + +# If this macro is not defined by Autoconf, define it here. +ifdef([AC_PROVIDE_IFELSE], + [], + [define([AC_PROVIDE_IFELSE], + [ifdef([AC_PROVIDE_$1], + [$2], [$3])])]) + +# AC_LIBTOOL_CXX - enable support for C++ libraries +AC_DEFUN([AC_LIBTOOL_CXX], [AC_REQUIRE([_AC_LIBTOOL_CXX])]) + +AC_DEFUN([_AC_LIBTOOL_CXX], +[AC_REQUIRE([AC_PROG_CXX]) +AC_REQUIRE([AC_PROG_CXXCPP]) +LIBTOOL_DEPS=$LIBTOOL_DEPS" $ac_aux_dir/ltcf-cxx.sh" +lt_save_CC="$CC" +lt_save_CFLAGS="$CFLAGS" +dnl Make sure LTCC is set to the C compiler, i.e. set LTCC before CC +dnl is set to the C++ compiler. +AR="$AR" LTCC="$CC" CC="$CXX" CXX="$CXX" CFLAGS="$CXXFLAGS" CPPFLAGS="$CPPFLAGS" \ +MAGIC_CMD="$MAGIC_CMD" LD="$LD" LDFLAGS="$LDFLAGS" LIBS="$LIBS" \ +LN_S="$LN_S" NM="$NM" RANLIB="$RANLIB" STRIP="$STRIP" \ +AS="$AS" DLLTOOL="$DLLTOOL" OBJDUMP="$OBJDUMP" \ +objext="$OBJEXT" exeext="$EXEEXT" reload_flag="$reload_flag" \ +deplibs_check_method="$deplibs_check_method" \ +file_magic_cmd="$file_magic_cmd" \ +${CONFIG_SHELL-/bin/sh} $ac_aux_dir/ltconfig -o libtool $libtool_flags \ +--build="$build" --add-tag=CXX $ac_aux_dir/ltcf-cxx.sh $host \ +|| AC_MSG_ERROR([libtool tag configuration failed]) +CC="$lt_save_CC" +CFLAGS="$lt_save_CFLAGS" + +# Redirect the config.log output again, so that the ltconfig log is not +# clobbered by the next message. +exec 5>>./config.log +]) + +# AC_LIBTOOL_GCJ - enable support for GCJ libraries +AC_DEFUN([AC_LIBTOOL_GCJ],[AC_REQUIRE([_AC_LIBTOOL_GCJ])]) + +AC_DEFUN([_AC_LIBTOOL_GCJ], +[AC_REQUIRE([AC_PROG_LIBTOOL]) +AC_PROVIDE_IFELSE([AC_PROG_GCJ],[], + [AC_PROVIDE_IFELSE([A][M_PROG_GCJ],[], + [AC_PROVIDE_IFELSE([LT_AC_PROG_GCJ],[], + [ifdef([AC_PROG_GCJ],[AC_REQUIRE([AC_PROG_GCJ])], + [ifdef([A][M_PROG_GCJ],[AC_REQUIRE([A][M_PROG_GCJ])], + [AC_REQUIRE([A][C_PROG_GCJ_OR_A][M_PROG_GCJ])])])])])]) +LIBTOOL_DEPS=$LIBTOOL_DEPS" $ac_aux_dir/ltcf-gcj.sh" +lt_save_CC="$CC" +lt_save_CFLAGS="$CFLAGS" +dnl Make sure LTCC is set to the C compiler, i.e. set LTCC before CC +dnl is set to the C++ compiler. +AR="$AR" LTCC="$CC" CC="$GCJ" CFLAGS="$GCJFLAGS" CPPFLAGS="$CPPFLAGS" \ +MAGIC_CMD="$MAGIC_CMD" LD="$LD" LDFLAGS="$LDFLAGS" LIBS="$LIBS" \ +LN_S="$LN_S" NM="$NM" RANLIB="$RANLIB" STRIP="$STRIP" \ +AS="$AS" DLLTOOL="$DLLTOOL" OBJDUMP="$OBJDUMP" \ +objext="$OBJEXT" exeext="$EXEEXT" reload_flag="$reload_flag" \ +deplibs_check_method="$deplibs_check_method" \ +file_magic_cmd="$file_magic_cmd" \ +${CONFIG_SHELL-/bin/sh} $ac_aux_dir/ltconfig -o libtool $libtool_flags \ +--build="$build" --add-tag=GCJ $ac_aux_dir/ltcf-gcj.sh $host \ +|| AC_MSG_ERROR([libtool tag configuration failed]) +CC="$lt_save_CC" +CFLAGS="$lt_save_CFLAGS" + +# Redirect the config.log output again, so that the ltconfig log is not +# clobbered by the next message. +exec 5>>./config.log +]) + +dnl old names +AC_DEFUN([AM_PROG_LIBTOOL], [AC_PROG_LIBTOOL]) +AC_DEFUN([AM_ENABLE_SHARED], [AC_ENABLE_SHARED($@)]) +AC_DEFUN([AM_ENABLE_STATIC], [AC_ENABLE_STATIC($@)]) +AC_DEFUN([AM_DISABLE_SHARED], [AC_DISABLE_SHARED($@)]) +AC_DEFUN([AM_DISABLE_STATIC], [AC_DISABLE_STATIC($@)]) +AC_DEFUN([AM_PROG_LD], [AC_PROG_LD]) +AC_DEFUN([AM_PROG_NM], [AC_PROG_NM]) + +dnl This is just to silence aclocal about the macro not being used +ifelse([AC_DISABLE_FAST_INSTALL])dnl + +AC_DEFUN([LT_AC_PROG_GCJ], +[AC_CHECK_TOOL(GCJ, gcj, no) + test "x${GCJFLAGS+set}" = xset || GCJFLAGS="-g -O2" + AC_SUBST(GCJFLAGS) +]) + +# Do all the work for Automake. This macro actually does too much -- +# some checks are only needed if your package does certain things. +# But this isn't really a big deal. + +# serial 1 + +dnl Usage: +dnl AM_INIT_AUTOMAKE(package,version, [no-define]) + +AC_DEFUN([AM_INIT_AUTOMAKE], +[AC_REQUIRE([AC_PROG_INSTALL]) +PACKAGE=[$1] +AC_SUBST(PACKAGE) +VERSION=[$2] +AC_SUBST(VERSION) +dnl test to see if srcdir already configured +if test "`cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then + AC_MSG_ERROR([source directory already configured; run "make distclean" there first]) +fi +ifelse([$3],, +AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package]) +AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package])) +AC_REQUIRE([AM_SANITY_CHECK]) +AC_REQUIRE([AC_ARG_PROGRAM]) +dnl FIXME This is truly gross. +missing_dir=`cd $ac_aux_dir && pwd` +AM_MISSING_PROG(ACLOCAL, aclocal, $missing_dir) +AM_MISSING_PROG(AUTOCONF, autoconf, $missing_dir) +AM_MISSING_PROG(AUTOMAKE, automake, $missing_dir) +AM_MISSING_PROG(AUTOHEADER, autoheader, $missing_dir) +AM_MISSING_PROG(MAKEINFO, makeinfo, $missing_dir) +AC_REQUIRE([AC_PROG_MAKE_SET])]) + +# +# Check to make sure that the build environment is sane. +# + +AC_DEFUN([AM_SANITY_CHECK], +[AC_MSG_CHECKING([whether build environment is sane]) +# Just in case +sleep 1 +echo timestamp > conftestfile +# Do `set' in a subshell so we don't clobber the current shell's +# arguments. Must try -L first in case configure is actually a +# symlink; some systems play weird games with the mod time of symlinks +# (eg FreeBSD returns the mod time of the symlink's containing +# directory). +if ( + set X `ls -Lt $srcdir/configure conftestfile 2> /dev/null` + if test "[$]*" = "X"; then + # -L didn't work. + set X `ls -t $srcdir/configure conftestfile` + fi + if test "[$]*" != "X $srcdir/configure conftestfile" \ + && test "[$]*" != "X conftestfile $srcdir/configure"; then + + # If neither matched, then we have a broken ls. This can happen + # if, for instance, CONFIG_SHELL is bash and it inherits a + # broken ls alias from the environment. This has actually + # happened. Such a system could not be considered "sane". + AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken +alias in your environment]) + fi + + test "[$]2" = conftestfile + ) +then + # Ok. + : +else + AC_MSG_ERROR([newly created file is older than distributed files! +Check your system clock]) +fi +rm -f conftest* +AC_MSG_RESULT(yes)]) + +dnl AM_MISSING_PROG(NAME, PROGRAM, DIRECTORY) +dnl The program must properly implement --version. +AC_DEFUN([AM_MISSING_PROG], +[AC_MSG_CHECKING(for working $2) +# Run test in a subshell; some versions of sh will print an error if +# an executable is not found, even if stderr is redirected. +# Redirect stdin to placate older versions of autoconf. Sigh. +if ($2 --version) < /dev/null > /dev/null 2>&1; then + $1=$2 + AC_MSG_RESULT(found) +else + $1="$3/missing $2" + AC_MSG_RESULT(missing) +fi +AC_SUBST($1)]) + +# Like AC_CONFIG_HEADER, but automatically create stamp file. + +AC_DEFUN([AM_CONFIG_HEADER], +[AC_PREREQ([2.12]) +AC_CONFIG_HEADER([$1]) +dnl When config.status generates a header, we must update the stamp-h file. +dnl This file resides in the same directory as the config header +dnl that is generated. We must strip everything past the first ":", +dnl and everything past the last "/". +AC_OUTPUT_COMMANDS(changequote(<<,>>)dnl +ifelse(patsubst(<<$1>>, <<[^ ]>>, <<>>), <<>>, +<>CONFIG_HEADERS" || echo timestamp > patsubst(<<$1>>, <<^\([^:]*/\)?.*>>, <<\1>>)stamp-h<<>>dnl>>, +<>; do + case " <<$>>CONFIG_HEADERS " in + *" <<$>>am_file "*<<)>> + echo timestamp > `echo <<$>>am_file | sed -e 's%:.*%%' -e 's%[^/]*$%%'`stamp-h$am_indx + ;; + esac + am_indx=`expr "<<$>>am_indx" + 1` +done<<>>dnl>>) +changequote([,]))]) + +# Define a conditional. + +AC_DEFUN([AM_CONDITIONAL], +[AC_SUBST($1_TRUE) +AC_SUBST($1_FALSE) +if $2; then + $1_TRUE= + $1_FALSE='#' +else + $1_TRUE='#' + $1_FALSE= +fi]) + diff --git a/config.guess b/config.guess new file mode 100644 index 0000000..1127162 --- /dev/null +++ b/config.guess @@ -0,0 +1,1415 @@ +#! /bin/sh +# Attempt to guess a canonical system name. +# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, +# 2000, 2001, 2002, 2003 Free Software Foundation, Inc. + +timestamp='2003-10-07' + +# This file is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + +# Originally written by Per Bothner . +# Please send patches to . Submit a context +# diff and a properly formatted ChangeLog entry. +# +# This script attempts to guess a canonical system name similar to +# config.sub. If it succeeds, it prints the system name on stdout, and +# exits with 0. Otherwise, it exits with 1. +# +# The plan is that this can be called by configure scripts if you +# don't specify an explicit build system type. + +me=`echo "$0" | sed -e 's,.*/,,'` + +usage="\ +Usage: $0 [OPTION] + +Output the configuration name of the system \`$me' is run on. + +Operation modes: + -h, --help print this help, then exit + -t, --time-stamp print date of last modification, then exit + -v, --version print version number, then exit + +Report bugs and patches to ." + +version="\ +GNU config.guess ($timestamp) + +Originally written by Per Bothner. +Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 +Free Software Foundation, Inc. + +This is free software; see the source for copying conditions. There is NO +warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." + +help=" +Try \`$me --help' for more information." + +# Parse command line +while test $# -gt 0 ; do + case $1 in + --time-stamp | --time* | -t ) + echo "$timestamp" ; exit 0 ;; + --version | -v ) + echo "$version" ; exit 0 ;; + --help | --h* | -h ) + echo "$usage"; exit 0 ;; + -- ) # Stop option processing + shift; break ;; + - ) # Use stdin as input. + break ;; + -* ) + echo "$me: invalid option $1$help" >&2 + exit 1 ;; + * ) + break ;; + esac +done + +if test $# != 0; then + echo "$me: too many arguments$help" >&2 + exit 1 +fi + +trap 'exit 1' 1 2 15 + +# CC_FOR_BUILD -- compiler used by this script. Note that the use of a +# compiler to aid in system detection is discouraged as it requires +# temporary files to be created and, as you can see below, it is a +# headache to deal with in a portable fashion. + +# Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still +# use `HOST_CC' if defined, but it is deprecated. + +# Portable tmp directory creation inspired by the Autoconf team. + +set_cc_for_build=' +trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ; +trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ; +: ${TMPDIR=/tmp} ; + { tmp=`(umask 077 && mktemp -d -q "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } || + { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } || + { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } || + { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ; +dummy=$tmp/dummy ; +tmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ; +case $CC_FOR_BUILD,$HOST_CC,$CC in + ,,) echo "int x;" > $dummy.c ; + for c in cc gcc c89 c99 ; do + if ($c -c -o $dummy.o $dummy.c) >/dev/null 2>&1 ; then + CC_FOR_BUILD="$c"; break ; + fi ; + done ; + if test x"$CC_FOR_BUILD" = x ; then + CC_FOR_BUILD=no_compiler_found ; + fi + ;; + ,,*) CC_FOR_BUILD=$CC ;; + ,*,*) CC_FOR_BUILD=$HOST_CC ;; +esac ;' + +# This is needed to find uname on a Pyramid OSx when run in the BSD universe. +# (ghazi@noc.rutgers.edu 1994-08-24) +if (test -f /.attbin/uname) >/dev/null 2>&1 ; then + PATH=$PATH:/.attbin ; export PATH +fi + +UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown +UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown +UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown +UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown + +# Note: order is significant - the case branches are not exclusive. + +case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in + *:NetBSD:*:*) + # NetBSD (nbsd) targets should (where applicable) match one or + # more of the tupples: *-*-netbsdelf*, *-*-netbsdaout*, + # *-*-netbsdecoff* and *-*-netbsd*. For targets that recently + # switched to ELF, *-*-netbsd* would select the old + # object file format. This provides both forward + # compatibility and a consistent mechanism for selecting the + # object file format. + # + # Note: NetBSD doesn't particularly care about the vendor + # portion of the name. We always set it to "unknown". + sysctl="sysctl -n hw.machine_arch" + UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \ + /usr/sbin/$sysctl 2>/dev/null || echo unknown)` + case "${UNAME_MACHINE_ARCH}" in + armeb) machine=armeb-unknown ;; + arm*) machine=arm-unknown ;; + sh3el) machine=shl-unknown ;; + sh3eb) machine=sh-unknown ;; + *) machine=${UNAME_MACHINE_ARCH}-unknown ;; + esac + # The Operating System including object format, if it has switched + # to ELF recently, or will in the future. + case "${UNAME_MACHINE_ARCH}" in + arm*|i386|m68k|ns32k|sh3*|sparc|vax) + eval $set_cc_for_build + if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \ + | grep __ELF__ >/dev/null + then + # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout). + # Return netbsd for either. FIX? + os=netbsd + else + os=netbsdelf + fi + ;; + *) + os=netbsd + ;; + esac + # The OS release + # Debian GNU/NetBSD machines have a different userland, and + # thus, need a distinct triplet. However, they do not need + # kernel version information, so it can be replaced with a + # suitable tag, in the style of linux-gnu. + case "${UNAME_VERSION}" in + Debian*) + release='-gnu' + ;; + *) + release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` + ;; + esac + # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM: + # contains redundant information, the shorter form: + # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used. + echo "${machine}-${os}${release}" + exit 0 ;; + amiga:OpenBSD:*:*) + echo m68k-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + arc:OpenBSD:*:*) + echo mipsel-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + hp300:OpenBSD:*:*) + echo m68k-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + mac68k:OpenBSD:*:*) + echo m68k-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + macppc:OpenBSD:*:*) + echo powerpc-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + mvme68k:OpenBSD:*:*) + echo m68k-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + mvme88k:OpenBSD:*:*) + echo m88k-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + mvmeppc:OpenBSD:*:*) + echo powerpc-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + pmax:OpenBSD:*:*) + echo mipsel-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + sgi:OpenBSD:*:*) + echo mipseb-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + sun3:OpenBSD:*:*) + echo m68k-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + wgrisc:OpenBSD:*:*) + echo mipsel-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + *:OpenBSD:*:*) + echo ${UNAME_MACHINE}-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + alpha:OSF1:*:*) + if test $UNAME_RELEASE = "V4.0"; then + UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'` + fi + # According to Compaq, /usr/sbin/psrinfo has been available on + # OSF/1 and Tru64 systems produced since 1995. I hope that + # covers most systems running today. This code pipes the CPU + # types through head -n 1, so we only detect the type of CPU 0. + ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^ The alpha \(.*\) processor.*$/\1/p' | head -n 1` + case "$ALPHA_CPU_TYPE" in + "EV4 (21064)") + UNAME_MACHINE="alpha" ;; + "EV4.5 (21064)") + UNAME_MACHINE="alpha" ;; + "LCA4 (21066/21068)") + UNAME_MACHINE="alpha" ;; + "EV5 (21164)") + UNAME_MACHINE="alphaev5" ;; + "EV5.6 (21164A)") + UNAME_MACHINE="alphaev56" ;; + "EV5.6 (21164PC)") + UNAME_MACHINE="alphapca56" ;; + "EV5.7 (21164PC)") + UNAME_MACHINE="alphapca57" ;; + "EV6 (21264)") + UNAME_MACHINE="alphaev6" ;; + "EV6.7 (21264A)") + UNAME_MACHINE="alphaev67" ;; + "EV6.8CB (21264C)") + UNAME_MACHINE="alphaev68" ;; + "EV6.8AL (21264B)") + UNAME_MACHINE="alphaev68" ;; + "EV6.8CX (21264D)") + UNAME_MACHINE="alphaev68" ;; + "EV6.9A (21264/EV69A)") + UNAME_MACHINE="alphaev69" ;; + "EV7 (21364)") + UNAME_MACHINE="alphaev7" ;; + "EV7.9 (21364A)") + UNAME_MACHINE="alphaev79" ;; + esac + # A Vn.n version is a released version. + # A Tn.n version is a released field test version. + # A Xn.n version is an unreleased experimental baselevel. + # 1.2 uses "1.2" for uname -r. + echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[VTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` + exit 0 ;; + Alpha*:OpenVMS:*:*) + echo alpha-hp-vms + exit 0 ;; + Alpha\ *:Windows_NT*:*) + # How do we know it's Interix rather than the generic POSIX subsystem? + # Should we change UNAME_MACHINE based on the output of uname instead + # of the specific Alpha model? + echo alpha-pc-interix + exit 0 ;; + 21064:Windows_NT:50:3) + echo alpha-dec-winnt3.5 + exit 0 ;; + Amiga*:UNIX_System_V:4.0:*) + echo m68k-unknown-sysv4 + exit 0;; + *:[Aa]miga[Oo][Ss]:*:*) + echo ${UNAME_MACHINE}-unknown-amigaos + exit 0 ;; + *:[Mm]orph[Oo][Ss]:*:*) + echo ${UNAME_MACHINE}-unknown-morphos + exit 0 ;; + *:OS/390:*:*) + echo i370-ibm-openedition + exit 0 ;; + arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) + echo arm-acorn-riscix${UNAME_RELEASE} + exit 0;; + SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*) + echo hppa1.1-hitachi-hiuxmpp + exit 0;; + Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*) + # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE. + if test "`(/bin/universe) 2>/dev/null`" = att ; then + echo pyramid-pyramid-sysv3 + else + echo pyramid-pyramid-bsd + fi + exit 0 ;; + NILE*:*:*:dcosx) + echo pyramid-pyramid-svr4 + exit 0 ;; + DRS?6000:unix:4.0:6*) + echo sparc-icl-nx6 + exit 0 ;; + DRS?6000:UNIX_SV:4.2*:7*) + case `/usr/bin/uname -p` in + sparc) echo sparc-icl-nx7 && exit 0 ;; + esac ;; + sun4H:SunOS:5.*:*) + echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit 0 ;; + sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*) + echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit 0 ;; + i86pc:SunOS:5.*:*) + echo i386-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit 0 ;; + sun4*:SunOS:6*:*) + # According to config.sub, this is the proper way to canonicalize + # SunOS6. Hard to guess exactly what SunOS6 will be like, but + # it's likely to be more like Solaris than SunOS4. + echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit 0 ;; + sun4*:SunOS:*:*) + case "`/usr/bin/arch -k`" in + Series*|S4*) + UNAME_RELEASE=`uname -v` + ;; + esac + # Japanese Language versions have a version number like `4.1.3-JL'. + echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'` + exit 0 ;; + sun3*:SunOS:*:*) + echo m68k-sun-sunos${UNAME_RELEASE} + exit 0 ;; + sun*:*:4.2BSD:*) + UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null` + test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3 + case "`/bin/arch`" in + sun3) + echo m68k-sun-sunos${UNAME_RELEASE} + ;; + sun4) + echo sparc-sun-sunos${UNAME_RELEASE} + ;; + esac + exit 0 ;; + aushp:SunOS:*:*) + echo sparc-auspex-sunos${UNAME_RELEASE} + exit 0 ;; + # The situation for MiNT is a little confusing. The machine name + # can be virtually everything (everything which is not + # "atarist" or "atariste" at least should have a processor + # > m68000). The system name ranges from "MiNT" over "FreeMiNT" + # to the lowercase version "mint" (or "freemint"). Finally + # the system name "TOS" denotes a system which is actually not + # MiNT. But MiNT is downward compatible to TOS, so this should + # be no problem. + atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*) + echo m68k-atari-mint${UNAME_RELEASE} + exit 0 ;; + atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*) + echo m68k-atari-mint${UNAME_RELEASE} + exit 0 ;; + *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*) + echo m68k-atari-mint${UNAME_RELEASE} + exit 0 ;; + milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*) + echo m68k-milan-mint${UNAME_RELEASE} + exit 0 ;; + hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*) + echo m68k-hades-mint${UNAME_RELEASE} + exit 0 ;; + *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*) + echo m68k-unknown-mint${UNAME_RELEASE} + exit 0 ;; + powerpc:machten:*:*) + echo powerpc-apple-machten${UNAME_RELEASE} + exit 0 ;; + RISC*:Mach:*:*) + echo mips-dec-mach_bsd4.3 + exit 0 ;; + RISC*:ULTRIX:*:*) + echo mips-dec-ultrix${UNAME_RELEASE} + exit 0 ;; + VAX*:ULTRIX*:*:*) + echo vax-dec-ultrix${UNAME_RELEASE} + exit 0 ;; + 2020:CLIX:*:* | 2430:CLIX:*:*) + echo clipper-intergraph-clix${UNAME_RELEASE} + exit 0 ;; + mips:*:*:UMIPS | mips:*:*:RISCos) + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c +#ifdef __cplusplus +#include /* for printf() prototype */ + int main (int argc, char *argv[]) { +#else + int main (argc, argv) int argc; char *argv[]; { +#endif + #if defined (host_mips) && defined (MIPSEB) + #if defined (SYSTYPE_SYSV) + printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0); + #endif + #if defined (SYSTYPE_SVR4) + printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0); + #endif + #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD) + printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0); + #endif + #endif + exit (-1); + } +EOF + $CC_FOR_BUILD -o $dummy $dummy.c \ + && $dummy `echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` \ + && exit 0 + echo mips-mips-riscos${UNAME_RELEASE} + exit 0 ;; + Motorola:PowerMAX_OS:*:*) + echo powerpc-motorola-powermax + exit 0 ;; + Motorola:*:4.3:PL8-*) + echo powerpc-harris-powermax + exit 0 ;; + Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*) + echo powerpc-harris-powermax + exit 0 ;; + Night_Hawk:Power_UNIX:*:*) + echo powerpc-harris-powerunix + exit 0 ;; + m88k:CX/UX:7*:*) + echo m88k-harris-cxux7 + exit 0 ;; + m88k:*:4*:R4*) + echo m88k-motorola-sysv4 + exit 0 ;; + m88k:*:3*:R3*) + echo m88k-motorola-sysv3 + exit 0 ;; + AViiON:dgux:*:*) + # DG/UX returns AViiON for all architectures + UNAME_PROCESSOR=`/usr/bin/uname -p` + if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ] + then + if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \ + [ ${TARGET_BINARY_INTERFACE}x = x ] + then + echo m88k-dg-dgux${UNAME_RELEASE} + else + echo m88k-dg-dguxbcs${UNAME_RELEASE} + fi + else + echo i586-dg-dgux${UNAME_RELEASE} + fi + exit 0 ;; + M88*:DolphinOS:*:*) # DolphinOS (SVR3) + echo m88k-dolphin-sysv3 + exit 0 ;; + M88*:*:R3*:*) + # Delta 88k system running SVR3 + echo m88k-motorola-sysv3 + exit 0 ;; + XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3) + echo m88k-tektronix-sysv3 + exit 0 ;; + Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD) + echo m68k-tektronix-bsd + exit 0 ;; + *:IRIX*:*:*) + echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'` + exit 0 ;; + ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX. + echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id + exit 0 ;; # Note that: echo "'`uname -s`'" gives 'AIX ' + i*86:AIX:*:*) + echo i386-ibm-aix + exit 0 ;; + ia64:AIX:*:*) + if [ -x /usr/bin/oslevel ] ; then + IBM_REV=`/usr/bin/oslevel` + else + IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} + fi + echo ${UNAME_MACHINE}-ibm-aix${IBM_REV} + exit 0 ;; + *:AIX:2:3) + if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + #include + + main() + { + if (!__power_pc()) + exit(1); + puts("powerpc-ibm-aix3.2.5"); + exit(0); + } +EOF + $CC_FOR_BUILD -o $dummy $dummy.c && $dummy && exit 0 + echo rs6000-ibm-aix3.2.5 + elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then + echo rs6000-ibm-aix3.2.4 + else + echo rs6000-ibm-aix3.2 + fi + exit 0 ;; + *:AIX:*:[45]) + IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'` + if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then + IBM_ARCH=rs6000 + else + IBM_ARCH=powerpc + fi + if [ -x /usr/bin/oslevel ] ; then + IBM_REV=`/usr/bin/oslevel` + else + IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} + fi + echo ${IBM_ARCH}-ibm-aix${IBM_REV} + exit 0 ;; + *:AIX:*:*) + echo rs6000-ibm-aix + exit 0 ;; + ibmrt:4.4BSD:*|romp-ibm:BSD:*) + echo romp-ibm-bsd4.4 + exit 0 ;; + ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and + echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to + exit 0 ;; # report: romp-ibm BSD 4.3 + *:BOSX:*:*) + echo rs6000-bull-bosx + exit 0 ;; + DPX/2?00:B.O.S.:*:*) + echo m68k-bull-sysv3 + exit 0 ;; + 9000/[34]??:4.3bsd:1.*:*) + echo m68k-hp-bsd + exit 0 ;; + hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*) + echo m68k-hp-bsd4.4 + exit 0 ;; + 9000/[34678]??:HP-UX:*:*) + HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` + case "${UNAME_MACHINE}" in + 9000/31? ) HP_ARCH=m68000 ;; + 9000/[34]?? ) HP_ARCH=m68k ;; + 9000/[678][0-9][0-9]) + if [ -x /usr/bin/getconf ]; then + sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null` + sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null` + case "${sc_cpu_version}" in + 523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0 + 528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1 + 532) # CPU_PA_RISC2_0 + case "${sc_kernel_bits}" in + 32) HP_ARCH="hppa2.0n" ;; + 64) HP_ARCH="hppa2.0w" ;; + '') HP_ARCH="hppa2.0" ;; # HP-UX 10.20 + esac ;; + esac + fi + if [ "${HP_ARCH}" = "" ]; then + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + + #define _HPUX_SOURCE + #include + #include + + int main () + { + #if defined(_SC_KERNEL_BITS) + long bits = sysconf(_SC_KERNEL_BITS); + #endif + long cpu = sysconf (_SC_CPU_VERSION); + + switch (cpu) + { + case CPU_PA_RISC1_0: puts ("hppa1.0"); break; + case CPU_PA_RISC1_1: puts ("hppa1.1"); break; + case CPU_PA_RISC2_0: + #if defined(_SC_KERNEL_BITS) + switch (bits) + { + case 64: puts ("hppa2.0w"); break; + case 32: puts ("hppa2.0n"); break; + default: puts ("hppa2.0"); break; + } break; + #else /* !defined(_SC_KERNEL_BITS) */ + puts ("hppa2.0"); break; + #endif + default: puts ("hppa1.0"); break; + } + exit (0); + } +EOF + (CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy` + test -z "$HP_ARCH" && HP_ARCH=hppa + fi ;; + esac + if [ ${HP_ARCH} = "hppa2.0w" ] + then + # avoid double evaluation of $set_cc_for_build + test -n "$CC_FOR_BUILD" || eval $set_cc_for_build + if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E -) | grep __LP64__ >/dev/null + then + HP_ARCH="hppa2.0w" + else + HP_ARCH="hppa64" + fi + fi + echo ${HP_ARCH}-hp-hpux${HPUX_REV} + exit 0 ;; + ia64:HP-UX:*:*) + HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` + echo ia64-hp-hpux${HPUX_REV} + exit 0 ;; + 3050*:HI-UX:*:*) + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + #include + int + main () + { + long cpu = sysconf (_SC_CPU_VERSION); + /* The order matters, because CPU_IS_HP_MC68K erroneously returns + true for CPU_PA_RISC1_0. CPU_IS_PA_RISC returns correct + results, however. */ + if (CPU_IS_PA_RISC (cpu)) + { + switch (cpu) + { + case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break; + case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break; + case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break; + default: puts ("hppa-hitachi-hiuxwe2"); break; + } + } + else if (CPU_IS_HP_MC68K (cpu)) + puts ("m68k-hitachi-hiuxwe2"); + else puts ("unknown-hitachi-hiuxwe2"); + exit (0); + } +EOF + $CC_FOR_BUILD -o $dummy $dummy.c && $dummy && exit 0 + echo unknown-hitachi-hiuxwe2 + exit 0 ;; + 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* ) + echo hppa1.1-hp-bsd + exit 0 ;; + 9000/8??:4.3bsd:*:*) + echo hppa1.0-hp-bsd + exit 0 ;; + *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*) + echo hppa1.0-hp-mpeix + exit 0 ;; + hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* ) + echo hppa1.1-hp-osf + exit 0 ;; + hp8??:OSF1:*:*) + echo hppa1.0-hp-osf + exit 0 ;; + i*86:OSF1:*:*) + if [ -x /usr/sbin/sysversion ] ; then + echo ${UNAME_MACHINE}-unknown-osf1mk + else + echo ${UNAME_MACHINE}-unknown-osf1 + fi + exit 0 ;; + parisc*:Lites*:*:*) + echo hppa1.1-hp-lites + exit 0 ;; + C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*) + echo c1-convex-bsd + exit 0 ;; + C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*) + if getsysinfo -f scalar_acc + then echo c32-convex-bsd + else echo c2-convex-bsd + fi + exit 0 ;; + C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*) + echo c34-convex-bsd + exit 0 ;; + C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*) + echo c38-convex-bsd + exit 0 ;; + C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*) + echo c4-convex-bsd + exit 0 ;; + CRAY*Y-MP:*:*:*) + echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit 0 ;; + CRAY*[A-Z]90:*:*:*) + echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \ + | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \ + -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \ + -e 's/\.[^.]*$/.X/' + exit 0 ;; + CRAY*TS:*:*:*) + echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit 0 ;; + CRAY*T3E:*:*:*) + echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit 0 ;; + CRAY*SV1:*:*:*) + echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit 0 ;; + *:UNICOS/mp:*:*) + echo nv1-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit 0 ;; + F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*) + FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` + FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` + FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'` + echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" + exit 0 ;; + i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*) + echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE} + exit 0 ;; + sparc*:BSD/OS:*:*) + echo sparc-unknown-bsdi${UNAME_RELEASE} + exit 0 ;; + *:BSD/OS:*:*) + echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE} + exit 0 ;; + *:FreeBSD:*:*) + # Determine whether the default compiler uses glibc. + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + #include + #if __GLIBC__ >= 2 + LIBC=gnu + #else + LIBC= + #endif +EOF + eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^LIBC=` + # GNU/KFreeBSD systems have a "k" prefix to indicate we are using + # FreeBSD's kernel, but not the complete OS. + case ${LIBC} in gnu) kernel_only='k' ;; esac + echo ${UNAME_MACHINE}-unknown-${kernel_only}freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`${LIBC:+-$LIBC} + exit 0 ;; + i*:CYGWIN*:*) + echo ${UNAME_MACHINE}-pc-cygwin + exit 0 ;; + i*:MINGW*:*) + echo ${UNAME_MACHINE}-pc-mingw32 + exit 0 ;; + i*:PW*:*) + echo ${UNAME_MACHINE}-pc-pw32 + exit 0 ;; + x86:Interix*:[34]*) + echo i586-pc-interix${UNAME_RELEASE}|sed -e 's/\..*//' + exit 0 ;; + [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*) + echo i${UNAME_MACHINE}-pc-mks + exit 0 ;; + i*:Windows_NT*:* | Pentium*:Windows_NT*:*) + # How do we know it's Interix rather than the generic POSIX subsystem? + # It also conflicts with pre-2.0 versions of AT&T UWIN. Should we + # UNAME_MACHINE based on the output of uname instead of i386? + echo i586-pc-interix + exit 0 ;; + i*:UWIN*:*) + echo ${UNAME_MACHINE}-pc-uwin + exit 0 ;; + p*:CYGWIN*:*) + echo powerpcle-unknown-cygwin + exit 0 ;; + prep*:SunOS:5.*:*) + echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit 0 ;; + *:GNU:*:*) + # the GNU system + echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'` + exit 0 ;; + *:GNU/*:*:*) + # other systems with GNU libc and userland + echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-gnu + exit 0 ;; + i*86:Minix:*:*) + echo ${UNAME_MACHINE}-pc-minix + exit 0 ;; + arm*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit 0 ;; + cris:Linux:*:*) + echo cris-axis-linux-gnu + exit 0 ;; + ia64:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit 0 ;; + m68*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit 0 ;; + mips:Linux:*:*) + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + #undef CPU + #undef mips + #undef mipsel + #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) + CPU=mipsel + #else + #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) + CPU=mips + #else + CPU= + #endif + #endif +EOF + eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^CPU=` + test x"${CPU}" != x && echo "${CPU}-unknown-linux-gnu" && exit 0 + ;; + mips64:Linux:*:*) + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + #undef CPU + #undef mips64 + #undef mips64el + #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) + CPU=mips64el + #else + #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) + CPU=mips64 + #else + CPU= + #endif + #endif +EOF + eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^CPU=` + test x"${CPU}" != x && echo "${CPU}-unknown-linux-gnu" && exit 0 + ;; + ppc:Linux:*:*) + echo powerpc-unknown-linux-gnu + exit 0 ;; + ppc64:Linux:*:*) + echo powerpc64-unknown-linux-gnu + exit 0 ;; + alpha:Linux:*:*) + case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in + EV5) UNAME_MACHINE=alphaev5 ;; + EV56) UNAME_MACHINE=alphaev56 ;; + PCA56) UNAME_MACHINE=alphapca56 ;; + PCA57) UNAME_MACHINE=alphapca56 ;; + EV6) UNAME_MACHINE=alphaev6 ;; + EV67) UNAME_MACHINE=alphaev67 ;; + EV68*) UNAME_MACHINE=alphaev68 ;; + esac + objdump --private-headers /bin/sh | grep ld.so.1 >/dev/null + if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi + echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC} + exit 0 ;; + parisc:Linux:*:* | hppa:Linux:*:*) + # Look for CPU level + case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in + PA7*) echo hppa1.1-unknown-linux-gnu ;; + PA8*) echo hppa2.0-unknown-linux-gnu ;; + *) echo hppa-unknown-linux-gnu ;; + esac + exit 0 ;; + parisc64:Linux:*:* | hppa64:Linux:*:*) + echo hppa64-unknown-linux-gnu + exit 0 ;; + s390:Linux:*:* | s390x:Linux:*:*) + echo ${UNAME_MACHINE}-ibm-linux + exit 0 ;; + sh64*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit 0 ;; + sh*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit 0 ;; + sparc:Linux:*:* | sparc64:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit 0 ;; + x86_64:Linux:*:*) + echo x86_64-unknown-linux-gnu + exit 0 ;; + i*86:Linux:*:*) + # The BFD linker knows what the default object file format is, so + # first see if it will tell us. cd to the root directory to prevent + # problems with other programs or directories called `ld' in the path. + # Set LC_ALL=C to ensure ld outputs messages in English. + ld_supported_targets=`cd /; LC_ALL=C ld --help 2>&1 \ + | sed -ne '/supported targets:/!d + s/[ ][ ]*/ /g + s/.*supported targets: *// + s/ .*// + p'` + case "$ld_supported_targets" in + elf32-i386) + TENTATIVE="${UNAME_MACHINE}-pc-linux-gnu" + ;; + a.out-i386-linux) + echo "${UNAME_MACHINE}-pc-linux-gnuaout" + exit 0 ;; + coff-i386) + echo "${UNAME_MACHINE}-pc-linux-gnucoff" + exit 0 ;; + "") + # Either a pre-BFD a.out linker (linux-gnuoldld) or + # one that does not give us useful --help. + echo "${UNAME_MACHINE}-pc-linux-gnuoldld" + exit 0 ;; + esac + # Determine whether the default compiler is a.out or elf + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + #include + #ifdef __ELF__ + # ifdef __GLIBC__ + # if __GLIBC__ >= 2 + LIBC=gnu + # else + LIBC=gnulibc1 + # endif + # else + LIBC=gnulibc1 + # endif + #else + #ifdef __INTEL_COMPILER + LIBC=gnu + #else + LIBC=gnuaout + #endif + #endif + #ifdef __dietlibc__ + LIBC=dietlibc + #endif +EOF + eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^LIBC=` + test x"${LIBC}" != x && echo "${UNAME_MACHINE}-pc-linux-${LIBC}" && exit 0 + test x"${TENTATIVE}" != x && echo "${TENTATIVE}" && exit 0 + ;; + i*86:DYNIX/ptx:4*:*) + # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. + # earlier versions are messed up and put the nodename in both + # sysname and nodename. + echo i386-sequent-sysv4 + exit 0 ;; + i*86:UNIX_SV:4.2MP:2.*) + # Unixware is an offshoot of SVR4, but it has its own version + # number series starting with 2... + # I am not positive that other SVR4 systems won't match this, + # I just have to hope. -- rms. + # Use sysv4.2uw... so that sysv4* matches it. + echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION} + exit 0 ;; + i*86:OS/2:*:*) + # If we were able to find `uname', then EMX Unix compatibility + # is probably installed. + echo ${UNAME_MACHINE}-pc-os2-emx + exit 0 ;; + i*86:XTS-300:*:STOP) + echo ${UNAME_MACHINE}-unknown-stop + exit 0 ;; + i*86:atheos:*:*) + echo ${UNAME_MACHINE}-unknown-atheos + exit 0 ;; + i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.0*:*) + echo i386-unknown-lynxos${UNAME_RELEASE} + exit 0 ;; + i*86:*DOS:*:*) + echo ${UNAME_MACHINE}-pc-msdosdjgpp + exit 0 ;; + i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*) + UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'` + if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then + echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL} + else + echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL} + fi + exit 0 ;; + i*86:*:5:[78]*) + case `/bin/uname -X | grep "^Machine"` in + *486*) UNAME_MACHINE=i486 ;; + *Pentium) UNAME_MACHINE=i586 ;; + *Pent*|*Celeron) UNAME_MACHINE=i686 ;; + esac + echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION} + exit 0 ;; + i*86:*:3.2:*) + if test -f /usr/options/cb.name; then + UNAME_REL=`sed -n 's/.*Version //p' /dev/null >/dev/null ; then + UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')` + (/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486 + (/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \ + && UNAME_MACHINE=i586 + (/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \ + && UNAME_MACHINE=i686 + (/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \ + && UNAME_MACHINE=i686 + echo ${UNAME_MACHINE}-pc-sco$UNAME_REL + else + echo ${UNAME_MACHINE}-pc-sysv32 + fi + exit 0 ;; + pc:*:*:*) + # Left here for compatibility: + # uname -m prints for DJGPP always 'pc', but it prints nothing about + # the processor, so we play safe by assuming i386. + echo i386-pc-msdosdjgpp + exit 0 ;; + Intel:Mach:3*:*) + echo i386-pc-mach3 + exit 0 ;; + paragon:*:*:*) + echo i860-intel-osf1 + exit 0 ;; + i860:*:4.*:*) # i860-SVR4 + if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then + echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4 + else # Add other i860-SVR4 vendors below as they are discovered. + echo i860-unknown-sysv${UNAME_RELEASE} # Unknown i860-SVR4 + fi + exit 0 ;; + mini*:CTIX:SYS*5:*) + # "miniframe" + echo m68010-convergent-sysv + exit 0 ;; + mc68k:UNIX:SYSTEM5:3.51m) + echo m68k-convergent-sysv + exit 0 ;; + M680?0:D-NIX:5.3:*) + echo m68k-diab-dnix + exit 0 ;; + M68*:*:R3V[567]*:*) + test -r /sysV68 && echo 'm68k-motorola-sysv' && exit 0 ;; + 3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0) + OS_REL='' + test -r /etc/.relid \ + && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` + /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ + && echo i486-ncr-sysv4.3${OS_REL} && exit 0 + /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ + && echo i586-ncr-sysv4.3${OS_REL} && exit 0 ;; + 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*) + /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ + && echo i486-ncr-sysv4 && exit 0 ;; + m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*) + echo m68k-unknown-lynxos${UNAME_RELEASE} + exit 0 ;; + mc68030:UNIX_System_V:4.*:*) + echo m68k-atari-sysv4 + exit 0 ;; + TSUNAMI:LynxOS:2.*:*) + echo sparc-unknown-lynxos${UNAME_RELEASE} + exit 0 ;; + rs6000:LynxOS:2.*:*) + echo rs6000-unknown-lynxos${UNAME_RELEASE} + exit 0 ;; + PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.0*:*) + echo powerpc-unknown-lynxos${UNAME_RELEASE} + exit 0 ;; + SM[BE]S:UNIX_SV:*:*) + echo mips-dde-sysv${UNAME_RELEASE} + exit 0 ;; + RM*:ReliantUNIX-*:*:*) + echo mips-sni-sysv4 + exit 0 ;; + RM*:SINIX-*:*:*) + echo mips-sni-sysv4 + exit 0 ;; + *:SINIX-*:*:*) + if uname -p 2>/dev/null >/dev/null ; then + UNAME_MACHINE=`(uname -p) 2>/dev/null` + echo ${UNAME_MACHINE}-sni-sysv4 + else + echo ns32k-sni-sysv + fi + exit 0 ;; + PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort + # says + echo i586-unisys-sysv4 + exit 0 ;; + *:UNIX_System_V:4*:FTX*) + # From Gerald Hewes . + # How about differentiating between stratus architectures? -djm + echo hppa1.1-stratus-sysv4 + exit 0 ;; + *:*:*:FTX*) + # From seanf@swdc.stratus.com. + echo i860-stratus-sysv4 + exit 0 ;; + *:VOS:*:*) + # From Paul.Green@stratus.com. + echo hppa1.1-stratus-vos + exit 0 ;; + mc68*:A/UX:*:*) + echo m68k-apple-aux${UNAME_RELEASE} + exit 0 ;; + news*:NEWS-OS:6*:*) + echo mips-sony-newsos6 + exit 0 ;; + R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*) + if [ -d /usr/nec ]; then + echo mips-nec-sysv${UNAME_RELEASE} + else + echo mips-unknown-sysv${UNAME_RELEASE} + fi + exit 0 ;; + BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only. + echo powerpc-be-beos + exit 0 ;; + BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only. + echo powerpc-apple-beos + exit 0 ;; + BePC:BeOS:*:*) # BeOS running on Intel PC compatible. + echo i586-pc-beos + exit 0 ;; + SX-4:SUPER-UX:*:*) + echo sx4-nec-superux${UNAME_RELEASE} + exit 0 ;; + SX-5:SUPER-UX:*:*) + echo sx5-nec-superux${UNAME_RELEASE} + exit 0 ;; + SX-6:SUPER-UX:*:*) + echo sx6-nec-superux${UNAME_RELEASE} + exit 0 ;; + Power*:Rhapsody:*:*) + echo powerpc-apple-rhapsody${UNAME_RELEASE} + exit 0 ;; + *:Rhapsody:*:*) + echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE} + exit 0 ;; + *:Darwin:*:*) + case `uname -p` in + *86) UNAME_PROCESSOR=i686 ;; + powerpc) UNAME_PROCESSOR=powerpc ;; + esac + echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE} + exit 0 ;; + *:procnto*:*:* | *:QNX:[0123456789]*:*) + UNAME_PROCESSOR=`uname -p` + if test "$UNAME_PROCESSOR" = "x86"; then + UNAME_PROCESSOR=i386 + UNAME_MACHINE=pc + fi + echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE} + exit 0 ;; + *:QNX:*:4*) + echo i386-pc-qnx + exit 0 ;; + NSR-[DGKLNPTVWY]:NONSTOP_KERNEL:*:*) + echo nsr-tandem-nsk${UNAME_RELEASE} + exit 0 ;; + *:NonStop-UX:*:*) + echo mips-compaq-nonstopux + exit 0 ;; + BS2000:POSIX*:*:*) + echo bs2000-siemens-sysv + exit 0 ;; + DS/*:UNIX_System_V:*:*) + echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE} + exit 0 ;; + *:Plan9:*:*) + # "uname -m" is not consistent, so use $cputype instead. 386 + # is converted to i386 for consistency with other x86 + # operating systems. + if test "$cputype" = "386"; then + UNAME_MACHINE=i386 + else + UNAME_MACHINE="$cputype" + fi + echo ${UNAME_MACHINE}-unknown-plan9 + exit 0 ;; + *:TOPS-10:*:*) + echo pdp10-unknown-tops10 + exit 0 ;; + *:TENEX:*:*) + echo pdp10-unknown-tenex + exit 0 ;; + KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*) + echo pdp10-dec-tops20 + exit 0 ;; + XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*) + echo pdp10-xkl-tops20 + exit 0 ;; + *:TOPS-20:*:*) + echo pdp10-unknown-tops20 + exit 0 ;; + *:ITS:*:*) + echo pdp10-unknown-its + exit 0 ;; + SEI:*:*:SEIUX) + echo mips-sei-seiux${UNAME_RELEASE} + exit 0 ;; +esac + +#echo '(No uname command or uname output not recognized.)' 1>&2 +#echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2 + +eval $set_cc_for_build +cat >$dummy.c < +# include +#endif +main () +{ +#if defined (sony) +#if defined (MIPSEB) + /* BFD wants "bsd" instead of "newsos". Perhaps BFD should be changed, + I don't know.... */ + printf ("mips-sony-bsd\n"); exit (0); +#else +#include + printf ("m68k-sony-newsos%s\n", +#ifdef NEWSOS4 + "4" +#else + "" +#endif + ); exit (0); +#endif +#endif + +#if defined (__arm) && defined (__acorn) && defined (__unix) + printf ("arm-acorn-riscix"); exit (0); +#endif + +#if defined (hp300) && !defined (hpux) + printf ("m68k-hp-bsd\n"); exit (0); +#endif + +#if defined (NeXT) +#if !defined (__ARCHITECTURE__) +#define __ARCHITECTURE__ "m68k" +#endif + int version; + version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`; + if (version < 4) + printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version); + else + printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version); + exit (0); +#endif + +#if defined (MULTIMAX) || defined (n16) +#if defined (UMAXV) + printf ("ns32k-encore-sysv\n"); exit (0); +#else +#if defined (CMU) + printf ("ns32k-encore-mach\n"); exit (0); +#else + printf ("ns32k-encore-bsd\n"); exit (0); +#endif +#endif +#endif + +#if defined (__386BSD__) + printf ("i386-pc-bsd\n"); exit (0); +#endif + +#if defined (sequent) +#if defined (i386) + printf ("i386-sequent-dynix\n"); exit (0); +#endif +#if defined (ns32000) + printf ("ns32k-sequent-dynix\n"); exit (0); +#endif +#endif + +#if defined (_SEQUENT_) + struct utsname un; + + uname(&un); + + if (strncmp(un.version, "V2", 2) == 0) { + printf ("i386-sequent-ptx2\n"); exit (0); + } + if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */ + printf ("i386-sequent-ptx1\n"); exit (0); + } + printf ("i386-sequent-ptx\n"); exit (0); + +#endif + +#if defined (vax) +# if !defined (ultrix) +# include +# if defined (BSD) +# if BSD == 43 + printf ("vax-dec-bsd4.3\n"); exit (0); +# else +# if BSD == 199006 + printf ("vax-dec-bsd4.3reno\n"); exit (0); +# else + printf ("vax-dec-bsd\n"); exit (0); +# endif +# endif +# else + printf ("vax-dec-bsd\n"); exit (0); +# endif +# else + printf ("vax-dec-ultrix\n"); exit (0); +# endif +#endif + +#if defined (alliant) && defined (i860) + printf ("i860-alliant-bsd\n"); exit (0); +#endif + + exit (1); +} +EOF + +$CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && $dummy && exit 0 + +# Apollos put the system type in the environment. + +test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit 0; } + +# Convex versions that predate uname can use getsysinfo(1) + +if [ -x /usr/convex/getsysinfo ] +then + case `getsysinfo -f cpu_type` in + c1*) + echo c1-convex-bsd + exit 0 ;; + c2*) + if getsysinfo -f scalar_acc + then echo c32-convex-bsd + else echo c2-convex-bsd + fi + exit 0 ;; + c34*) + echo c34-convex-bsd + exit 0 ;; + c38*) + echo c38-convex-bsd + exit 0 ;; + c4*) + echo c4-convex-bsd + exit 0 ;; + esac +fi + +cat >&2 < in order to provide the needed +information to handle your system. + +config.guess timestamp = $timestamp + +uname -m = `(uname -m) 2>/dev/null || echo unknown` +uname -r = `(uname -r) 2>/dev/null || echo unknown` +uname -s = `(uname -s) 2>/dev/null || echo unknown` +uname -v = `(uname -v) 2>/dev/null || echo unknown` + +/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null` +/bin/uname -X = `(/bin/uname -X) 2>/dev/null` + +hostinfo = `(hostinfo) 2>/dev/null` +/bin/universe = `(/bin/universe) 2>/dev/null` +/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null` +/bin/arch = `(/bin/arch) 2>/dev/null` +/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null` +/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null` + +UNAME_MACHINE = ${UNAME_MACHINE} +UNAME_RELEASE = ${UNAME_RELEASE} +UNAME_SYSTEM = ${UNAME_SYSTEM} +UNAME_VERSION = ${UNAME_VERSION} +EOF + +exit 1 + +# Local variables: +# eval: (add-hook 'write-file-hooks 'time-stamp) +# time-stamp-start: "timestamp='" +# time-stamp-format: "%:y-%02m-%02d" +# time-stamp-end: "'" +# End: diff --git a/config.h.in b/config.h.in new file mode 100644 index 0000000..45de65a --- /dev/null +++ b/config.h.in @@ -0,0 +1,63 @@ +/* config.h.in. Generated automatically from configure.in by autoheader. */ + +/* Define if your processor stores words with the most significant + byte first (like Motorola and SPARC, unlike Intel and VAX). */ +#undef WORDS_BIGENDIAN + +/* The number of bytes in a char. */ +#undef SIZEOF_CHAR + +/* The number of bytes in a char *. */ +#undef SIZEOF_CHAR_P + +/* The number of bytes in a int. */ +#undef SIZEOF_INT + +/* The number of bytes in a long. */ +#undef SIZEOF_LONG + +/* Define if you have the res_init function. */ +#undef HAVE_RES_INIT + +/* Name of package */ +#undef PACKAGE + +/* Version number of package */ +#undef VERSION + +/* C++ compiler supports template repository */ +#undef HAVE_TEMPLATE_REPOSITORY + +/* Defines if your system has the crypt function */ +#undef HAVE_CRYPT + +/* Define the real type of socklen_t */ +#undef socklen_t + +/* Compatibility define */ +#undef ksize_t + +/* Define if you have libz */ +#undef HAVE_LIBZ + +/* Define if you want Xinerama support */ +#undef HAVE_XINERAMA + +/* Define if you have libpng */ +#undef HAVE_LIBPNG + +/* Define if you have libjpeg */ +#undef HAVE_LIBJPEG + +/* Defines if you have GL (Mesa, OpenGL, ...) */ +#undef HAVE_GL + +/* Define if you have the development files for python */ +#undef HAVE_PYTHON + +/* Define if you have the development files for python */ +#undef HAVE_PYTHON + +/* Define if you have the development files for python */ +#undef HAVE_PYTHON + diff --git a/config.sub b/config.sub new file mode 100644 index 0000000..6eea727 --- /dev/null +++ b/config.sub @@ -0,0 +1,1505 @@ +#! /bin/sh +# Configuration validation subroutine script. +# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, +# 2000, 2001, 2002, 2003 Free Software Foundation, Inc. + +timestamp='2003-07-17' + +# This file is (in principle) common to ALL GNU software. +# The presence of a machine in this file suggests that SOME GNU software +# can handle that machine. It does not imply ALL GNU software can. +# +# This file is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, +# Boston, MA 02111-1307, USA. + +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + +# Please send patches to . Submit a context +# diff and a properly formatted ChangeLog entry. +# +# Configuration subroutine to validate and canonicalize a configuration type. +# Supply the specified configuration type as an argument. +# If it is invalid, we print an error message on stderr and exit with code 1. +# Otherwise, we print the canonical config type on stdout and succeed. + +# This file is supposed to be the same for all GNU packages +# and recognize all the CPU types, system types and aliases +# that are meaningful with *any* GNU software. +# Each package is responsible for reporting which valid configurations +# it does not support. The user should be able to distinguish +# a failure to support a valid configuration from a meaningless +# configuration. + +# The goal of this file is to map all the various variations of a given +# machine specification into a single specification in the form: +# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM +# or in some cases, the newer four-part form: +# CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM +# It is wrong to echo any other type of specification. + +me=`echo "$0" | sed -e 's,.*/,,'` + +usage="\ +Usage: $0 [OPTION] CPU-MFR-OPSYS + $0 [OPTION] ALIAS + +Canonicalize a configuration name. + +Operation modes: + -h, --help print this help, then exit + -t, --time-stamp print date of last modification, then exit + -v, --version print version number, then exit + +Report bugs and patches to ." + +version="\ +GNU config.sub ($timestamp) + +Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 +Free Software Foundation, Inc. + +This is free software; see the source for copying conditions. There is NO +warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." + +help=" +Try \`$me --help' for more information." + +# Parse command line +while test $# -gt 0 ; do + case $1 in + --time-stamp | --time* | -t ) + echo "$timestamp" ; exit 0 ;; + --version | -v ) + echo "$version" ; exit 0 ;; + --help | --h* | -h ) + echo "$usage"; exit 0 ;; + -- ) # Stop option processing + shift; break ;; + - ) # Use stdin as input. + break ;; + -* ) + echo "$me: invalid option $1$help" + exit 1 ;; + + *local*) + # First pass through any local machine types. + echo $1 + exit 0;; + + * ) + break ;; + esac +done + +case $# in + 0) echo "$me: missing argument$help" >&2 + exit 1;; + 1) ;; + *) echo "$me: too many arguments$help" >&2 + exit 1;; +esac + +# Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any). +# Here we must recognize all the valid KERNEL-OS combinations. +maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'` +case $maybe_os in + nto-qnx* | linux-gnu* | kfreebsd*-gnu* | netbsd*-gnu* | storm-chaos* | os2-emx* | rtmk-nova*) + os=-$maybe_os + basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'` + ;; + *) + basic_machine=`echo $1 | sed 's/-[^-]*$//'` + if [ $basic_machine != $1 ] + then os=`echo $1 | sed 's/.*-/-/'` + else os=; fi + ;; +esac + +### Let's recognize common machines as not being operating systems so +### that things like config.sub decstation-3100 work. We also +### recognize some manufacturers as not being operating systems, so we +### can provide default operating systems below. +case $os in + -sun*os*) + # Prevent following clause from handling this invalid input. + ;; + -dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \ + -att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \ + -unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \ + -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\ + -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \ + -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \ + -apple | -axis) + os= + basic_machine=$1 + ;; + -sim | -cisco | -oki | -wec | -winbond) + os= + basic_machine=$1 + ;; + -scout) + ;; + -wrs) + os=-vxworks + basic_machine=$1 + ;; + -chorusos*) + os=-chorusos + basic_machine=$1 + ;; + -chorusrdb) + os=-chorusrdb + basic_machine=$1 + ;; + -hiux*) + os=-hiuxwe2 + ;; + -sco5) + os=-sco3.2v5 + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco4) + os=-sco3.2v4 + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco3.2.[4-9]*) + os=`echo $os | sed -e 's/sco3.2./sco3.2v/'` + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco3.2v[4-9]*) + # Don't forget version if it is 3.2v4 or newer. + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco*) + os=-sco3.2v2 + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -udk*) + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -isc) + os=-isc2.2 + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -clix*) + basic_machine=clipper-intergraph + ;; + -isc*) + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -lynx*) + os=-lynxos + ;; + -ptx*) + basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'` + ;; + -windowsnt*) + os=`echo $os | sed -e 's/windowsnt/winnt/'` + ;; + -psos*) + os=-psos + ;; + -mint | -mint[0-9]*) + basic_machine=m68k-atari + os=-mint + ;; +esac + +# Decode aliases for certain CPU-COMPANY combinations. +case $basic_machine in + # Recognize the basic CPU types without company name. + # Some are omitted here because they have special meanings below. + 1750a | 580 \ + | a29k \ + | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \ + | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \ + | am33_2.0 \ + | arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr \ + | c4x | clipper \ + | d10v | d30v | dlx | dsp16xx \ + | fr30 | frv \ + | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ + | i370 | i860 | i960 | ia64 \ + | ip2k | iq2000 \ + | m32r | m68000 | m68k | m88k | mcore \ + | mips | mipsbe | mipseb | mipsel | mipsle \ + | mips16 \ + | mips64 | mips64el \ + | mips64vr | mips64vrel \ + | mips64orion | mips64orionel \ + | mips64vr4100 | mips64vr4100el \ + | mips64vr4300 | mips64vr4300el \ + | mips64vr5000 | mips64vr5000el \ + | mipsisa32 | mipsisa32el \ + | mipsisa32r2 | mipsisa32r2el \ + | mipsisa64 | mipsisa64el \ + | mipsisa64sb1 | mipsisa64sb1el \ + | mipsisa64sr71k | mipsisa64sr71kel \ + | mipstx39 | mipstx39el \ + | mn10200 | mn10300 \ + | msp430 \ + | ns16k | ns32k \ + | openrisc | or32 \ + | pdp10 | pdp11 | pj | pjl \ + | powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \ + | pyramid \ + | sh | sh[1234] | sh[23]e | sh[34]eb | shbe | shle | sh[1234]le | sh3ele \ + | sh64 | sh64le \ + | sparc | sparc64 | sparc86x | sparclet | sparclite | sparcv9 | sparcv9b \ + | strongarm \ + | tahoe | thumb | tic4x | tic80 | tron \ + | v850 | v850e \ + | we32k \ + | x86 | xscale | xstormy16 | xtensa \ + | z8k) + basic_machine=$basic_machine-unknown + ;; + m6811 | m68hc11 | m6812 | m68hc12) + # Motorola 68HC11/12. + basic_machine=$basic_machine-unknown + os=-none + ;; + m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k) + ;; + + # We use `pc' rather than `unknown' + # because (1) that's what they normally are, and + # (2) the word "unknown" tends to confuse beginning users. + i*86 | x86_64) + basic_machine=$basic_machine-pc + ;; + # Object if more than one company name word. + *-*-*) + echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 + exit 1 + ;; + # Recognize the basic CPU types with company name. + 580-* \ + | a29k-* \ + | alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \ + | alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \ + | alphapca5[67]-* | alpha64pca5[67]-* | arc-* \ + | arm-* | armbe-* | armle-* | armeb-* | armv*-* \ + | avr-* \ + | bs2000-* \ + | c[123]* | c30-* | [cjt]90-* | c4x-* | c54x-* | c55x-* | c6x-* \ + | clipper-* | cydra-* \ + | d10v-* | d30v-* | dlx-* \ + | elxsi-* \ + | f30[01]-* | f700-* | fr30-* | frv-* | fx80-* \ + | h8300-* | h8500-* \ + | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \ + | i*86-* | i860-* | i960-* | ia64-* \ + | ip2k-* | iq2000-* \ + | m32r-* \ + | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \ + | m88110-* | m88k-* | mcore-* \ + | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \ + | mips16-* \ + | mips64-* | mips64el-* \ + | mips64vr-* | mips64vrel-* \ + | mips64orion-* | mips64orionel-* \ + | mips64vr4100-* | mips64vr4100el-* \ + | mips64vr4300-* | mips64vr4300el-* \ + | mips64vr5000-* | mips64vr5000el-* \ + | mipsisa32-* | mipsisa32el-* \ + | mipsisa32r2-* | mipsisa32r2el-* \ + | mipsisa64-* | mipsisa64el-* \ + | mipsisa64sb1-* | mipsisa64sb1el-* \ + | mipsisa64sr71k-* | mipsisa64sr71kel-* \ + | mipstx39-* | mipstx39el-* \ + | msp430-* \ + | none-* | np1-* | nv1-* | ns16k-* | ns32k-* \ + | orion-* \ + | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \ + | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \ + | pyramid-* \ + | romp-* | rs6000-* \ + | sh-* | sh[1234]-* | sh[23]e-* | sh[34]eb-* | shbe-* \ + | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \ + | sparc-* | sparc64-* | sparc86x-* | sparclet-* | sparclite-* \ + | sparcv9-* | sparcv9b-* | strongarm-* | sv1-* | sx?-* \ + | tahoe-* | thumb-* \ + | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \ + | tron-* \ + | v850-* | v850e-* | vax-* \ + | we32k-* \ + | x86-* | x86_64-* | xps100-* | xscale-* | xstormy16-* \ + | xtensa-* \ + | ymp-* \ + | z8k-*) + ;; + # Recognize the various machine names and aliases which stand + # for a CPU type and a company and sometimes even an OS. + 386bsd) + basic_machine=i386-unknown + os=-bsd + ;; + 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc) + basic_machine=m68000-att + ;; + 3b*) + basic_machine=we32k-att + ;; + a29khif) + basic_machine=a29k-amd + os=-udi + ;; + adobe68k) + basic_machine=m68010-adobe + os=-scout + ;; + alliant | fx80) + basic_machine=fx80-alliant + ;; + altos | altos3068) + basic_machine=m68k-altos + ;; + am29k) + basic_machine=a29k-none + os=-bsd + ;; + amd64) + basic_machine=x86_64-pc + ;; + amdahl) + basic_machine=580-amdahl + os=-sysv + ;; + amiga | amiga-*) + basic_machine=m68k-unknown + ;; + amigaos | amigados) + basic_machine=m68k-unknown + os=-amigaos + ;; + amigaunix | amix) + basic_machine=m68k-unknown + os=-sysv4 + ;; + apollo68) + basic_machine=m68k-apollo + os=-sysv + ;; + apollo68bsd) + basic_machine=m68k-apollo + os=-bsd + ;; + aux) + basic_machine=m68k-apple + os=-aux + ;; + balance) + basic_machine=ns32k-sequent + os=-dynix + ;; + c90) + basic_machine=c90-cray + os=-unicos + ;; + convex-c1) + basic_machine=c1-convex + os=-bsd + ;; + convex-c2) + basic_machine=c2-convex + os=-bsd + ;; + convex-c32) + basic_machine=c32-convex + os=-bsd + ;; + convex-c34) + basic_machine=c34-convex + os=-bsd + ;; + convex-c38) + basic_machine=c38-convex + os=-bsd + ;; + cray | j90) + basic_machine=j90-cray + os=-unicos + ;; + crds | unos) + basic_machine=m68k-crds + ;; + cris | cris-* | etrax*) + basic_machine=cris-axis + ;; + da30 | da30-*) + basic_machine=m68k-da30 + ;; + decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn) + basic_machine=mips-dec + ;; + decsystem10* | dec10*) + basic_machine=pdp10-dec + os=-tops10 + ;; + decsystem20* | dec20*) + basic_machine=pdp10-dec + os=-tops20 + ;; + delta | 3300 | motorola-3300 | motorola-delta \ + | 3300-motorola | delta-motorola) + basic_machine=m68k-motorola + ;; + delta88) + basic_machine=m88k-motorola + os=-sysv3 + ;; + dpx20 | dpx20-*) + basic_machine=rs6000-bull + os=-bosx + ;; + dpx2* | dpx2*-bull) + basic_machine=m68k-bull + os=-sysv3 + ;; + ebmon29k) + basic_machine=a29k-amd + os=-ebmon + ;; + elxsi) + basic_machine=elxsi-elxsi + os=-bsd + ;; + encore | umax | mmax) + basic_machine=ns32k-encore + ;; + es1800 | OSE68k | ose68k | ose | OSE) + basic_machine=m68k-ericsson + os=-ose + ;; + fx2800) + basic_machine=i860-alliant + ;; + genix) + basic_machine=ns32k-ns + ;; + gmicro) + basic_machine=tron-gmicro + os=-sysv + ;; + go32) + basic_machine=i386-pc + os=-go32 + ;; + h3050r* | hiux*) + basic_machine=hppa1.1-hitachi + os=-hiuxwe2 + ;; + h8300hms) + basic_machine=h8300-hitachi + os=-hms + ;; + h8300xray) + basic_machine=h8300-hitachi + os=-xray + ;; + h8500hms) + basic_machine=h8500-hitachi + os=-hms + ;; + harris) + basic_machine=m88k-harris + os=-sysv3 + ;; + hp300-*) + basic_machine=m68k-hp + ;; + hp300bsd) + basic_machine=m68k-hp + os=-bsd + ;; + hp300hpux) + basic_machine=m68k-hp + os=-hpux + ;; + hp3k9[0-9][0-9] | hp9[0-9][0-9]) + basic_machine=hppa1.0-hp + ;; + hp9k2[0-9][0-9] | hp9k31[0-9]) + basic_machine=m68000-hp + ;; + hp9k3[2-9][0-9]) + basic_machine=m68k-hp + ;; + hp9k6[0-9][0-9] | hp6[0-9][0-9]) + basic_machine=hppa1.0-hp + ;; + hp9k7[0-79][0-9] | hp7[0-79][0-9]) + basic_machine=hppa1.1-hp + ;; + hp9k78[0-9] | hp78[0-9]) + # FIXME: really hppa2.0-hp + basic_machine=hppa1.1-hp + ;; + hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893) + # FIXME: really hppa2.0-hp + basic_machine=hppa1.1-hp + ;; + hp9k8[0-9][13679] | hp8[0-9][13679]) + basic_machine=hppa1.1-hp + ;; + hp9k8[0-9][0-9] | hp8[0-9][0-9]) + basic_machine=hppa1.0-hp + ;; + hppa-next) + os=-nextstep3 + ;; + hppaosf) + basic_machine=hppa1.1-hp + os=-osf + ;; + hppro) + basic_machine=hppa1.1-hp + os=-proelf + ;; + i370-ibm* | ibm*) + basic_machine=i370-ibm + ;; +# I'm not sure what "Sysv32" means. Should this be sysv3.2? + i*86v32) + basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` + os=-sysv32 + ;; + i*86v4*) + basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` + os=-sysv4 + ;; + i*86v) + basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` + os=-sysv + ;; + i*86sol2) + basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` + os=-solaris2 + ;; + i386mach) + basic_machine=i386-mach + os=-mach + ;; + i386-vsta | vsta) + basic_machine=i386-unknown + os=-vsta + ;; + iris | iris4d) + basic_machine=mips-sgi + case $os in + -irix*) + ;; + *) + os=-irix4 + ;; + esac + ;; + isi68 | isi) + basic_machine=m68k-isi + os=-sysv + ;; + m88k-omron*) + basic_machine=m88k-omron + ;; + magnum | m3230) + basic_machine=mips-mips + os=-sysv + ;; + merlin) + basic_machine=ns32k-utek + os=-sysv + ;; + mingw32) + basic_machine=i386-pc + os=-mingw32 + ;; + miniframe) + basic_machine=m68000-convergent + ;; + *mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*) + basic_machine=m68k-atari + os=-mint + ;; + mips3*-*) + basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'` + ;; + mips3*) + basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown + ;; + mmix*) + basic_machine=mmix-knuth + os=-mmixware + ;; + monitor) + basic_machine=m68k-rom68k + os=-coff + ;; + morphos) + basic_machine=powerpc-unknown + os=-morphos + ;; + msdos) + basic_machine=i386-pc + os=-msdos + ;; + mvs) + basic_machine=i370-ibm + os=-mvs + ;; + ncr3000) + basic_machine=i486-ncr + os=-sysv4 + ;; + netbsd386) + basic_machine=i386-unknown + os=-netbsd + ;; + netwinder) + basic_machine=armv4l-rebel + os=-linux + ;; + news | news700 | news800 | news900) + basic_machine=m68k-sony + os=-newsos + ;; + news1000) + basic_machine=m68030-sony + os=-newsos + ;; + news-3600 | risc-news) + basic_machine=mips-sony + os=-newsos + ;; + necv70) + basic_machine=v70-nec + os=-sysv + ;; + next | m*-next ) + basic_machine=m68k-next + case $os in + -nextstep* ) + ;; + -ns2*) + os=-nextstep2 + ;; + *) + os=-nextstep3 + ;; + esac + ;; + nh3000) + basic_machine=m68k-harris + os=-cxux + ;; + nh[45]000) + basic_machine=m88k-harris + os=-cxux + ;; + nindy960) + basic_machine=i960-intel + os=-nindy + ;; + mon960) + basic_machine=i960-intel + os=-mon960 + ;; + nonstopux) + basic_machine=mips-compaq + os=-nonstopux + ;; + np1) + basic_machine=np1-gould + ;; + nv1) + basic_machine=nv1-cray + os=-unicosmp + ;; + nsr-tandem) + basic_machine=nsr-tandem + ;; + op50n-* | op60c-*) + basic_machine=hppa1.1-oki + os=-proelf + ;; + or32 | or32-*) + basic_machine=or32-unknown + os=-coff + ;; + OSE68000 | ose68000) + basic_machine=m68000-ericsson + os=-ose + ;; + os68k) + basic_machine=m68k-none + os=-os68k + ;; + pa-hitachi) + basic_machine=hppa1.1-hitachi + os=-hiuxwe2 + ;; + paragon) + basic_machine=i860-intel + os=-osf + ;; + pbd) + basic_machine=sparc-tti + ;; + pbb) + basic_machine=m68k-tti + ;; + pc532 | pc532-*) + basic_machine=ns32k-pc532 + ;; + pentium | p5 | k5 | k6 | nexgen | viac3) + basic_machine=i586-pc + ;; + pentiumpro | p6 | 6x86 | athlon | athlon_*) + basic_machine=i686-pc + ;; + pentiumii | pentium2 | pentiumiii | pentium3) + basic_machine=i686-pc + ;; + pentium4) + basic_machine=i786-pc + ;; + pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*) + basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + pentiumpro-* | p6-* | 6x86-* | athlon-*) + basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*) + basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + pentium4-*) + basic_machine=i786-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + pn) + basic_machine=pn-gould + ;; + power) basic_machine=power-ibm + ;; + ppc) basic_machine=powerpc-unknown + ;; + ppc-*) basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + ppcle | powerpclittle | ppc-le | powerpc-little) + basic_machine=powerpcle-unknown + ;; + ppcle-* | powerpclittle-*) + basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + ppc64) basic_machine=powerpc64-unknown + ;; + ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + ppc64le | powerpc64little | ppc64-le | powerpc64-little) + basic_machine=powerpc64le-unknown + ;; + ppc64le-* | powerpc64little-*) + basic_machine=powerpc64le-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + ps2) + basic_machine=i386-ibm + ;; + pw32) + basic_machine=i586-unknown + os=-pw32 + ;; + rom68k) + basic_machine=m68k-rom68k + os=-coff + ;; + rm[46]00) + basic_machine=mips-siemens + ;; + rtpc | rtpc-*) + basic_machine=romp-ibm + ;; + s390 | s390-*) + basic_machine=s390-ibm + ;; + s390x | s390x-*) + basic_machine=s390x-ibm + ;; + sa29200) + basic_machine=a29k-amd + os=-udi + ;; + sb1) + basic_machine=mipsisa64sb1-unknown + ;; + sb1el) + basic_machine=mipsisa64sb1el-unknown + ;; + sei) + basic_machine=mips-sei + os=-seiux + ;; + sequent) + basic_machine=i386-sequent + ;; + sh) + basic_machine=sh-hitachi + os=-hms + ;; + sh64) + basic_machine=sh64-unknown + ;; + sparclite-wrs | simso-wrs) + basic_machine=sparclite-wrs + os=-vxworks + ;; + sps7) + basic_machine=m68k-bull + os=-sysv2 + ;; + spur) + basic_machine=spur-unknown + ;; + st2000) + basic_machine=m68k-tandem + ;; + stratus) + basic_machine=i860-stratus + os=-sysv4 + ;; + sun2) + basic_machine=m68000-sun + ;; + sun2os3) + basic_machine=m68000-sun + os=-sunos3 + ;; + sun2os4) + basic_machine=m68000-sun + os=-sunos4 + ;; + sun3os3) + basic_machine=m68k-sun + os=-sunos3 + ;; + sun3os4) + basic_machine=m68k-sun + os=-sunos4 + ;; + sun4os3) + basic_machine=sparc-sun + os=-sunos3 + ;; + sun4os4) + basic_machine=sparc-sun + os=-sunos4 + ;; + sun4sol2) + basic_machine=sparc-sun + os=-solaris2 + ;; + sun3 | sun3-*) + basic_machine=m68k-sun + ;; + sun4) + basic_machine=sparc-sun + ;; + sun386 | sun386i | roadrunner) + basic_machine=i386-sun + ;; + sv1) + basic_machine=sv1-cray + os=-unicos + ;; + symmetry) + basic_machine=i386-sequent + os=-dynix + ;; + t3e) + basic_machine=alphaev5-cray + os=-unicos + ;; + t90) + basic_machine=t90-cray + os=-unicos + ;; + tic54x | c54x*) + basic_machine=tic54x-unknown + os=-coff + ;; + tic55x | c55x*) + basic_machine=tic55x-unknown + os=-coff + ;; + tic6x | c6x*) + basic_machine=tic6x-unknown + os=-coff + ;; + tx39) + basic_machine=mipstx39-unknown + ;; + tx39el) + basic_machine=mipstx39el-unknown + ;; + toad1) + basic_machine=pdp10-xkl + os=-tops20 + ;; + tower | tower-32) + basic_machine=m68k-ncr + ;; + udi29k) + basic_machine=a29k-amd + os=-udi + ;; + ultra3) + basic_machine=a29k-nyu + os=-sym1 + ;; + v810 | necv810) + basic_machine=v810-nec + os=-none + ;; + vaxv) + basic_machine=vax-dec + os=-sysv + ;; + vms) + basic_machine=vax-dec + os=-vms + ;; + vpp*|vx|vx-*) + basic_machine=f301-fujitsu + ;; + vxworks960) + basic_machine=i960-wrs + os=-vxworks + ;; + vxworks68) + basic_machine=m68k-wrs + os=-vxworks + ;; + vxworks29k) + basic_machine=a29k-wrs + os=-vxworks + ;; + w65*) + basic_machine=w65-wdc + os=-none + ;; + w89k-*) + basic_machine=hppa1.1-winbond + os=-proelf + ;; + xps | xps100) + basic_machine=xps100-honeywell + ;; + ymp) + basic_machine=ymp-cray + os=-unicos + ;; + z8k-*-coff) + basic_machine=z8k-unknown + os=-sim + ;; + none) + basic_machine=none-none + os=-none + ;; + +# Here we handle the default manufacturer of certain CPU types. It is in +# some cases the only manufacturer, in others, it is the most popular. + w89k) + basic_machine=hppa1.1-winbond + ;; + op50n) + basic_machine=hppa1.1-oki + ;; + op60c) + basic_machine=hppa1.1-oki + ;; + romp) + basic_machine=romp-ibm + ;; + rs6000) + basic_machine=rs6000-ibm + ;; + vax) + basic_machine=vax-dec + ;; + pdp10) + # there are many clones, so DEC is not a safe bet + basic_machine=pdp10-unknown + ;; + pdp11) + basic_machine=pdp11-dec + ;; + we32k) + basic_machine=we32k-att + ;; + sh3 | sh4 | sh[34]eb | sh[1234]le | sh[23]ele) + basic_machine=sh-unknown + ;; + sh64) + basic_machine=sh64-unknown + ;; + sparc | sparcv9 | sparcv9b) + basic_machine=sparc-sun + ;; + cydra) + basic_machine=cydra-cydrome + ;; + orion) + basic_machine=orion-highlevel + ;; + orion105) + basic_machine=clipper-highlevel + ;; + mac | mpw | mac-mpw) + basic_machine=m68k-apple + ;; + pmac | pmac-mpw) + basic_machine=powerpc-apple + ;; + *-unknown) + # Make sure to match an already-canonicalized machine name. + ;; + *) + echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 + exit 1 + ;; +esac + +# Here we canonicalize certain aliases for manufacturers. +case $basic_machine in + *-digital*) + basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'` + ;; + *-commodore*) + basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'` + ;; + *) + ;; +esac + +# Decode manufacturer-specific aliases for certain operating systems. + +if [ x"$os" != x"" ] +then +case $os in + # First match some system type aliases + # that might get confused with valid system types. + # -solaris* is a basic system type, with this one exception. + -solaris1 | -solaris1.*) + os=`echo $os | sed -e 's|solaris1|sunos4|'` + ;; + -solaris) + os=-solaris2 + ;; + -svr4*) + os=-sysv4 + ;; + -unixware*) + os=-sysv4.2uw + ;; + -gnu/linux*) + os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'` + ;; + # First accept the basic system types. + # The portable systems comes first. + # Each alternative MUST END IN A *, to match a version number. + # -sysv* is not here because it comes later, after sysvr4. + -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \ + | -*vms* | -sco* | -esix* | -isc* | -aix* | -sunos | -sunos[34]*\ + | -hpux* | -unos* | -osf* | -luna* | -dgux* | -solaris* | -sym* \ + | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \ + | -aos* \ + | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \ + | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \ + | -hiux* | -386bsd* | -netbsd* | -openbsd* | -kfreebsd* | -freebsd* | -riscix* \ + | -lynxos* | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \ + | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \ + | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ + | -chorusos* | -chorusrdb* \ + | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ + | -mingw32* | -linux-gnu* | -uxpv* | -beos* | -mpeix* | -udk* \ + | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \ + | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \ + | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \ + | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \ + | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \ + | -powermax* | -dnix* | -nx6 | -nx7 | -sei*) + # Remember, each alternative MUST END IN *, to match a version number. + ;; + -qnx*) + case $basic_machine in + x86-* | i*86-*) + ;; + *) + os=-nto$os + ;; + esac + ;; + -nto-qnx*) + ;; + -nto*) + os=`echo $os | sed -e 's|nto|nto-qnx|'` + ;; + -sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \ + | -windows* | -osx | -abug | -netware* | -os9* | -beos* \ + | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*) + ;; + -mac*) + os=`echo $os | sed -e 's|mac|macos|'` + ;; + -linux*) + os=`echo $os | sed -e 's|linux|linux-gnu|'` + ;; + -sunos5*) + os=`echo $os | sed -e 's|sunos5|solaris2|'` + ;; + -sunos6*) + os=`echo $os | sed -e 's|sunos6|solaris3|'` + ;; + -opened*) + os=-openedition + ;; + -wince*) + os=-wince + ;; + -osfrose*) + os=-osfrose + ;; + -osf*) + os=-osf + ;; + -utek*) + os=-bsd + ;; + -dynix*) + os=-bsd + ;; + -acis*) + os=-aos + ;; + -atheos*) + os=-atheos + ;; + -386bsd) + os=-bsd + ;; + -ctix* | -uts*) + os=-sysv + ;; + -nova*) + os=-rtmk-nova + ;; + -ns2 ) + os=-nextstep2 + ;; + -nsk*) + os=-nsk + ;; + # Preserve the version number of sinix5. + -sinix5.*) + os=`echo $os | sed -e 's|sinix|sysv|'` + ;; + -sinix*) + os=-sysv4 + ;; + -triton*) + os=-sysv3 + ;; + -oss*) + os=-sysv3 + ;; + -svr4) + os=-sysv4 + ;; + -svr3) + os=-sysv3 + ;; + -sysvr4) + os=-sysv4 + ;; + # This must come after -sysvr4. + -sysv*) + ;; + -ose*) + os=-ose + ;; + -es1800*) + os=-ose + ;; + -xenix) + os=-xenix + ;; + -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) + os=-mint + ;; + -aros*) + os=-aros + ;; + -kaos*) + os=-kaos + ;; + -none) + ;; + *) + # Get rid of the `-' at the beginning of $os. + os=`echo $os | sed 's/[^-]*-//'` + echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2 + exit 1 + ;; +esac +else + +# Here we handle the default operating systems that come with various machines. +# The value should be what the vendor currently ships out the door with their +# machine or put another way, the most popular os provided with the machine. + +# Note that if you're going to try to match "-MANUFACTURER" here (say, +# "-sun"), then you have to tell the case statement up towards the top +# that MANUFACTURER isn't an operating system. Otherwise, code above +# will signal an error saying that MANUFACTURER isn't an operating +# system, and we'll never get to this point. + +case $basic_machine in + *-acorn) + os=-riscix1.2 + ;; + arm*-rebel) + os=-linux + ;; + arm*-semi) + os=-aout + ;; + c4x-* | tic4x-*) + os=-coff + ;; + # This must come before the *-dec entry. + pdp10-*) + os=-tops20 + ;; + pdp11-*) + os=-none + ;; + *-dec | vax-*) + os=-ultrix4.2 + ;; + m68*-apollo) + os=-domain + ;; + i386-sun) + os=-sunos4.0.2 + ;; + m68000-sun) + os=-sunos3 + # This also exists in the configure program, but was not the + # default. + # os=-sunos4 + ;; + m68*-cisco) + os=-aout + ;; + mips*-cisco) + os=-elf + ;; + mips*-*) + os=-elf + ;; + or32-*) + os=-coff + ;; + *-tti) # must be before sparc entry or we get the wrong os. + os=-sysv3 + ;; + sparc-* | *-sun) + os=-sunos4.1.1 + ;; + *-be) + os=-beos + ;; + *-ibm) + os=-aix + ;; + *-wec) + os=-proelf + ;; + *-winbond) + os=-proelf + ;; + *-oki) + os=-proelf + ;; + *-hp) + os=-hpux + ;; + *-hitachi) + os=-hiux + ;; + i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent) + os=-sysv + ;; + *-cbm) + os=-amigaos + ;; + *-dg) + os=-dgux + ;; + *-dolphin) + os=-sysv3 + ;; + m68k-ccur) + os=-rtu + ;; + m88k-omron*) + os=-luna + ;; + *-next ) + os=-nextstep + ;; + *-sequent) + os=-ptx + ;; + *-crds) + os=-unos + ;; + *-ns) + os=-genix + ;; + i370-*) + os=-mvs + ;; + *-next) + os=-nextstep3 + ;; + *-gould) + os=-sysv + ;; + *-highlevel) + os=-bsd + ;; + *-encore) + os=-bsd + ;; + *-sgi) + os=-irix + ;; + *-siemens) + os=-sysv4 + ;; + *-masscomp) + os=-rtu + ;; + f30[01]-fujitsu | f700-fujitsu) + os=-uxpv + ;; + *-rom68k) + os=-coff + ;; + *-*bug) + os=-coff + ;; + *-apple) + os=-macos + ;; + *-atari*) + os=-mint + ;; + *) + os=-none + ;; +esac +fi + +# Here we handle the case where we know the os, and the CPU type, but not the +# manufacturer. We pick the logical manufacturer. +vendor=unknown +case $basic_machine in + *-unknown) + case $os in + -riscix*) + vendor=acorn + ;; + -sunos*) + vendor=sun + ;; + -aix*) + vendor=ibm + ;; + -beos*) + vendor=be + ;; + -hpux*) + vendor=hp + ;; + -mpeix*) + vendor=hp + ;; + -hiux*) + vendor=hitachi + ;; + -unos*) + vendor=crds + ;; + -dgux*) + vendor=dg + ;; + -luna*) + vendor=omron + ;; + -genix*) + vendor=ns + ;; + -mvs* | -opened*) + vendor=ibm + ;; + -ptx*) + vendor=sequent + ;; + -vxsim* | -vxworks* | -windiss*) + vendor=wrs + ;; + -aux*) + vendor=apple + ;; + -hms*) + vendor=hitachi + ;; + -mpw* | -macos*) + vendor=apple + ;; + -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) + vendor=atari + ;; + -vos*) + vendor=stratus + ;; + esac + basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"` + ;; +esac + +echo $basic_machine$os +exit 0 + +# Local variables: +# eval: (add-hook 'write-file-hooks 'time-stamp) +# time-stamp-start: "timestamp='" +# time-stamp-format: "%:y-%02m-%02d" +# time-stamp-end: "'" +# End: diff --git a/configure.in b/configure.in new file mode 100644 index 0000000..2c9d1d9 --- /dev/null +++ b/configure.in @@ -0,0 +1,306 @@ +# Original Author was Kalle@kde.org +# I lifted it in some mater. (Stephan Kulow) +# I used much code from Janos Farkas +# Additional m4 tests in this file are written by kamildobk@poczta.onet.pl + +dnl Process this file with autoconf to produce a configure script. + +AC_INIT(acinclude.m4) dnl a source file from your sub dir + +dnl This is so we can use kde-common +AC_CONFIG_AUX_DIR(admin) + +AC_CANONICAL_SYSTEM +AC_ARG_PROGRAM + +dnl Automake doc recommends to do this only here. (Janos) +AM_INIT_AUTOMAKE(kmatplot,0.4) + +dnl KDE_SET_PREFIX + +AC_PREFIX_DEFAULT(/usr/local) +if test "x$prefix" = "xNONE"; then + prefix=$ac_default_prefix + ac_configure_args="$ac_configure_args --prefix $prefix" +fi + +dnl generate the config header +AM_CONFIG_HEADER(config.h) dnl at the distribution this done + +dnl Checks for programs. +AC_CHECK_COMPILERS +AC_ENABLE_SHARED(yes) +AC_ENABLE_STATIC(no) +KDE_PROG_LIBTOOL + +AC_REQUIRE([KDE_CHECK_EXTRA_LIBS]) +all_libraries="$all_libraries $USER_LDFLAGS" +all_includes="$all_includes $USER_INCLUDES" +AC_SUBST(all_includes) +AC_SUBST(all_libraries) + +dnl for NLS support. Call them in this order! +dnl WITH_NLS is for the po files +AM_KDE_WITH_NLS + +AC_PATH_QT + +dnl Perform program name transformation +AC_ARG_PROGRAM + + +dnl PACKAGE set before +dnl --------------------------------------------------------------------------------------------------------- +dnl --------------------------------------------------------------------------------------------------------- +dnl --------------------------------------------------------------------------------------------------------- +dnl --------------------------------------------------------------------------------------------------------- +dnl --------------------------------------------------------------------------------------------------------- +dnl --------------------------------------------------------------------------------------------------------- +dnl --------------------------------------------------------------------------------------------------------- +dnl --------------------------------------------------------------------------------------------------------- +dnl --------------------------------------------------------------------------------------------------------- +dnl --------------------------------------------------------------------------------------------------------- +dnl --------------------------------------------------------------------------------------------------------- +dnl --------------------------------------------------------------------------------------------------------- +dnl --------------------------------------------------------------------------------------------------------- +dnl --------------------------------------------------------------------------------------------------------- +dnl --------------------------------------------------------------------------------------------------------- + +dnl ------------------------------------------------------------------------------------------------------- + +dnl Find Octave scripts dir + +AC_DEFUN(AC_OCT_INSTALL_DIR, + [ + AC_REQUIRE_CPP() + AC_REQUIRE([AC_HAVE_MKOCTFILE]) + AC_ARG_WITH( oct-dir, [ --with-oct-dir=DIR install '.oct' files in DIR ], oct_path=$withval, oct_path="" ) + AC_MSG_CHECKING("install path for Octave scripts") + + if test "x$oct_path" = x; then + AC_CACHE_VAL( ac_cv_path_oct, [ + save_IFS=$IFS + IFS=":" + octave_home= + for try_path in $PATH; do + if test -f "$try_path/octave"; then + octave_home=$try_path + break + fi + done + IFS=$save_IFS + if test "x$octave_home" = x; then + ac_cv_path_oct= + else + ac_cv_path_oct=$octave_home/../share/octave/site/m + fi + ]) + installoctdir=$ac_cv_path_oct + else + installoctdir=$oct_path + fi + + if test "x$installoctdir" = x; then + AC_MSG_RESULT("do not install") + else + AC_MSG_RESULT("$installoctdir") + fi + + AC_SUBST(installoctdir) + ]) + + +dnl ------------------------------------------------------------------------------------------------------- + +dnl Check if octave 'makeoctfile' is present + +AC_DEFUN(AC_HAVE_MKOCTFILE, + [ + AC_REQUIRE_CPP() + AC_ARG_WITH( mkoctfile-path, [ --with-mkoctfile-path=DIR a path to 'mkoctfile' script], make_oct_path=$withval, make_oct_path="" ) + + AC_PATH_PROG( makeoct, mkoctfile, "", "$make_oct_path:$PATH" ) + + AC_SUBST(makeoct) + ]) + +dnl ------------------------------------------------------------------------------------------------------- + +dnl Find Scilab library dir + +AC_DEFUN(AC_SCILAB_LIB_DIR, + [ + AC_REQUIRE_CPP() + AC_ARG_WITH( scilab-lib-dir, [ --with-scilab-lib-dir=DIR path to Scilab libraries and includes ], libscidir=$withval, libscidir="" ) + AC_MSG_CHECKING("Scilab libraries and includes path") + + if test "x$libscidir" = x; then + AC_CACHE_VAL( ac_cv_path_scilab, [ + ac_cv_path_scilab=$(eval 'echo "printf(\" \");printf(SCI);quit;" | scilab -nw | tail --lines 1' 2>/dev/null) + ]) + libscidir=$ac_cv_path_scilab + fi + + if test ! -d "$libscidir" -a "x$libscidir" != x; then + libscidir= + fi + + if test "x$libscidir" = x; then + AC_MSG_RESULT("not found") + else + AC_MSG_RESULT("$libscidir") + fi + + AC_SUBST(libscidir) + ]) + +dnl ------------------------------------------------------------------------------------------------------- + +dnl Is Qt GL extension built-in Qt or it must be linked additionaly. + +AC_DEFUN(AC_HAVE_QGL, + [ + AC_REQUIRE_CPP() + AC_REQUIRE([AC_HAVE_GL]) + AC_MSG_CHECKING("Qt GL Extension") + AC_ARG_WITH( qgl-extension, [ --with-qgl-extension=LIBRARY link to Qt GL extension in a separate library ], arg_qgl_extension=$withval, arg_qgl_extension="" ) + + dnl make link tests with C++ + AC_LANG_CPLUSPLUS + if test "x$arg_qgl_extension" = x; then + dnl Variable names mus start with ac_cv_'function' + AC_CACHE_VAL( ac_cv_lib_qgl_extension, [ + ac_save_ldflags="$LDFLAGS" + ac_save_cxxflags="$CXXFLAGS" + LDFLAGS="$LDFLAGS $all_libraries -lqgl" + CXXFLAGS="$CXXFLAGS $all_includes" + test -n "$GL_INCLUDE" && CFLAGS="-I$GL_INCLUDE $CFLAGS" + AC_TRY_LINK( [ #include ], [], ac_cv_lib_qgl_extension="-lqgl", ac_cv_lib_qgl_extension="built-in" ) + LDFLAGS="$ac_save_ldflags" + CXXFLAGS="$ac_save_cxxflags" + ]) + if test "$ac_cv_lib_qgl_extension" = "built-in"; then + QGLLIB="" + else + QGLLIB=$ac_cv_lib_qgl_extension + fi + arg_qgl_extension=$ac_cv_lib_qgl_extension + else + QGLLIB=$arg_qgl_extension + fi + AC_MSG_RESULT("$arg_qgl_extension") + AC_SUBST(QGLLIB) + ]) + +dnl --------------------------------------------------------------------------------------------------------- + +dnl Find Qt install prefix - place for the config file + +AC_DEFUN(AC_QSETTINGS_DIR, + [ + AC_REQUIRE_CPP() + AC_ARG_WITH( qsettings-dir, [ --with-qsettings-dir=DIR path to Qt settings ( usually QT_INSTALL_PREFIX/etc/settings ) ], qsettingsdir=$withval, qsettingsdir="" ) + AC_MSG_CHECKING("QSettings path") + + if test "x$qsettingsdir" = x; then + AC_CACHE_VAL( ac_cv_path_qsettingsdir, [ + ac_cv_path_qsettingsdir="$QTDIR/etc/settings" + ]) + qsettingsdir=$ac_cv_path_qsettingsdir + fi + + if test "x$qsettingsdir" = "x/etc/settings"; then + AC_MSG_ERROR("QTDIR is needed to find QSettings path. Please set QTDIR and run configure again !") + else + AC_MSG_RESULT("$qsettingsdir") + fi + + dnl QSETTINGSDIR=$qsettingsdir + AC_SUBST(QSETTINGSDIR) + ]) + +dnl --------------------------------------------------------------------------------------------------------- + +dnl Check for Numpy + +AC_DEFUN(AC_HAVE_NUMPY, + [ + AC_REQUIRE([KDE_CHECK_PYTHON]) + AC_MSG_CHECKING("Numerical Python") + AC_ARG_WITH( numpy, [ --with-numpy=DIR Numerical Python installed in DIR ], arg_numpy=$withval, arg_numpy="" ) + + if test "x$arg_numpy" = x; then + AC_CACHE_VAL( ac_cv_numpy, [ + numpy_possible_locations="$PYTHONMODDIR/site-packages/Numeric $PYTHONMODDIR/Numeric" + ac_cv_numpy="" + AC_FIND_FILE(Numeric.py, $numpy_possible_locations, ac_cv_numpy) + ]) + dir_found=$ac_cv_numpy + else + dir_found=$arg_numpy + fi + + AC_MSG_RESULT($dir_found) + if test "$dir_found" = NO; then + NUMPYDIR="" + else + NUMPYDIR=$dir_found + fi + + AC_SUBST(NUMPYDIR) + ]) + + +dnl --------------------------------------------------------------------------------------------------------- +dnl --------------------------------------------------------------------------------------------------------- +dnl --------------------------------------------------------------------------------------------------------- +dnl --------------------------------------------------------------------------------------------------------- +dnl --------------------------------------------------------------------------------------------------------- + + + + + +dnl in this space add everything you want to check for; +dnl examples are specific headers, libraries, etc. +dnl all_includes="$QT_INCLUDES $X_INCLUDES $USER_INCLUDES" +dnl AC_SUBST(all_includes) + +AC_C_BIGENDIAN +AC_QSETTINGS_DIR +AC_HAVE_GL(GL_DRIVER="YES",GL_DRIVER="") +AC_HAVE_QGL + +AC_HAVE_NUMPY +AM_CONDITIONAL(MAKE_PYTHON, test "x$NUMPYDIR" != x ) +AC_HAVE_MKOCTFILE +AC_OCT_INSTALL_DIR +AM_CONDITIONAL(MAKE_OCT, test "x$makeoct" != x -a "x$installoctdir" != x ) +AC_SCILAB_LIB_DIR +AM_CONDITIONAL(MAKE_SCILAB, test "x$libscidir" != x ) + + + + +KDE_CREATE_SUBDIRSLIST +dnl add here all your Makefiles. This are created by configure +AC_OUTPUT( \ +./Makefile \ +kmatplot/Makefile \ +kmatplot/config/Makefile \ +kmatplot/demos/Makefile \ +kmatplot/dialogs/Makefile \ +kmatplot/dialogs/templates/Makefile \ +kmatplot/docs/Makefile \ +kmatplot/docs/en/Makefile \ +kmatplot/dtd/Makefile \ +kmatplot/examples/Makefile \ +kmatplot/formula/Makefile \ +kmatplot/interface/Makefile \ +kmatplot/octave/Makefile \ +kmatplot/pics/Makefile \ +kmatplot/pixmaps/Makefile \ +kmatplot/python/Makefile \ +kmatplot/scilab/Makefile \ +kmatplot/widgets/Makefile \ +) diff --git a/dist.sh b/dist.sh new file mode 100755 index 0000000..c075aa2 --- /dev/null +++ b/dist.sh @@ -0,0 +1,6 @@ +#!/bin/sh + +make clean +make -f Makefile.dist +./configure +make dist \ No newline at end of file diff --git a/kmatplot.doxygen b/kmatplot.doxygen new file mode 100644 index 0000000..e233702 --- /dev/null +++ b/kmatplot.doxygen @@ -0,0 +1,183 @@ +# Doxyfile 1.2.13-20020210 + +#--------------------------------------------------------------------------- +# General configuration options +#--------------------------------------------------------------------------- +PROJECT_NAME = "KMatplot library" +PROJECT_NUMBER = 0.4 +OUTPUT_DIRECTORY = /home/kamil/kmatplot/kmatplot-api/ +OUTPUT_LANGUAGE = English +EXTRACT_ALL = NO +EXTRACT_PRIVATE = NO +EXTRACT_STATIC = NO +EXTRACT_LOCAL_CLASSES = YES +HIDE_UNDOC_MEMBERS = NO +HIDE_UNDOC_CLASSES = NO +BRIEF_MEMBER_DESC = YES +REPEAT_BRIEF = YES +ALWAYS_DETAILED_SEC = NO +INLINE_INHERITED_MEMB = NO +FULL_PATH_NAMES = NO +STRIP_FROM_PATH = +INTERNAL_DOCS = NO +STRIP_CODE_COMMENTS = YES +CASE_SENSE_NAMES = YES +SHORT_NAMES = NO +HIDE_SCOPE_NAMES = NO +VERBATIM_HEADERS = YES +SHOW_INCLUDE_FILES = YES +JAVADOC_AUTOBRIEF = NO +INHERIT_DOCS = YES +INLINE_INFO = YES +SORT_MEMBER_DOCS = YES +DISTRIBUTE_GROUP_DOC = NO +TAB_SIZE = 4 +GENERATE_TODOLIST = YES +GENERATE_TESTLIST = YES +GENERATE_BUGLIST = YES +ALIASES = +ENABLED_SECTIONS = +MAX_INITIALIZER_LINES = 30 +OPTIMIZE_OUTPUT_FOR_C = NO +SHOW_USED_FILES = YES +#--------------------------------------------------------------------------- +# configuration options related to warning and progress messages +#--------------------------------------------------------------------------- +QUIET = NO +WARNINGS = YES +WARN_IF_UNDOCUMENTED = NO +WARN_FORMAT = "$file:$line: $text" +WARN_LOGFILE = +#--------------------------------------------------------------------------- +# configuration options related to the input files +#--------------------------------------------------------------------------- +INPUT = /home/kamil/kmatplot/kmatplot/widgets +FILE_PATTERNS = *.h \ + *.hh \ + *.H +RECURSIVE = YES +EXCLUDE = +EXCLUDE_SYMLINKS = NO +EXCLUDE_PATTERNS = +EXAMPLE_PATH = /home/kamil/kmatplot/kmatplot/demos +EXAMPLE_PATTERNS = +EXAMPLE_RECURSIVE = NO +IMAGE_PATH = +INPUT_FILTER = +FILTER_SOURCE_FILES = NO +#--------------------------------------------------------------------------- +# configuration options related to source browsing +#--------------------------------------------------------------------------- +SOURCE_BROWSER = NO +INLINE_SOURCES = NO +REFERENCED_BY_RELATION = YES +REFERENCES_RELATION = YES +#--------------------------------------------------------------------------- +# configuration options related to the alphabetical class index +#--------------------------------------------------------------------------- +ALPHABETICAL_INDEX = YES +COLS_IN_ALPHA_INDEX = 5 +IGNORE_PREFIX = +#--------------------------------------------------------------------------- +# configuration options related to the HTML output +#--------------------------------------------------------------------------- +GENERATE_HTML = YES +HTML_OUTPUT = html +HTML_FILE_EXTENSION = .html +HTML_HEADER = +HTML_FOOTER = +HTML_STYLESHEET = +HTML_ALIGN_MEMBERS = YES +GENERATE_HTMLHELP = YES +GENERATE_CHI = NO +BINARY_TOC = NO +TOC_EXPAND = YES +DISABLE_INDEX = NO +ENUM_VALUES_PER_LINE = 4 +GENERATE_TREEVIEW = YES +TREEVIEW_WIDTH = 250 +#--------------------------------------------------------------------------- +# configuration options related to the LaTeX output +#--------------------------------------------------------------------------- +GENERATE_LATEX = NO +LATEX_OUTPUT = latex +COMPACT_LATEX = NO +PAPER_TYPE = a4wide +EXTRA_PACKAGES = +LATEX_HEADER = +PDF_HYPERLINKS = NO +USE_PDFLATEX = NO +LATEX_BATCHMODE = NO +#--------------------------------------------------------------------------- +# configuration options related to the RTF output +#--------------------------------------------------------------------------- +GENERATE_RTF = NO +RTF_OUTPUT = rtf +COMPACT_RTF = NO +RTF_HYPERLINKS = NO +RTF_STYLESHEET_FILE = +RTF_EXTENSIONS_FILE = +#--------------------------------------------------------------------------- +# configuration options related to the man page output +#--------------------------------------------------------------------------- +GENERATE_MAN = NO +MAN_OUTPUT = man +MAN_EXTENSION = .3 +MAN_LINKS = NO +#--------------------------------------------------------------------------- +# configuration options related to the XML output +#--------------------------------------------------------------------------- +GENERATE_XML = NO +#--------------------------------------------------------------------------- +# configuration options for the AutoGen Definitions output +#--------------------------------------------------------------------------- +GENERATE_AUTOGEN_DEF = NO +#--------------------------------------------------------------------------- +# Configuration options related to the preprocessor +#--------------------------------------------------------------------------- +ENABLE_PREPROCESSING = YES +MACRO_EXPANSION = NO +EXPAND_ONLY_PREDEF = NO +SEARCH_INCLUDES = YES +INCLUDE_PATH = +INCLUDE_FILE_PATTERNS = +PREDEFINED = HAVE_GL +EXPAND_AS_DEFINED = +SKIP_FUNCTION_MACROS = YES +#--------------------------------------------------------------------------- +# Configuration::addtions related to external references +#--------------------------------------------------------------------------- +TAGFILES = +GENERATE_TAGFILE = +ALLEXTERNALS = NO +EXTERNAL_GROUPS = YES +PERL_PATH = /usr/bin/perl +#--------------------------------------------------------------------------- +# Configuration options related to the dot tool +#--------------------------------------------------------------------------- +CLASS_DIAGRAMS = YES +HAVE_DOT = YES +CLASS_GRAPH = YES +COLLABORATION_GRAPH = NO +TEMPLATE_RELATIONS = YES +HIDE_UNDOC_RELATIONS = YES +INCLUDE_GRAPH = YES +INCLUDED_BY_GRAPH = YES +GRAPHICAL_HIERARCHY = YES +DOT_IMAGE_FORMAT = gif +DOT_PATH = +DOTFILE_DIRS = +MAX_DOT_GRAPH_WIDTH = 1024 +MAX_DOT_GRAPH_HEIGHT = 1024 +GENERATE_LEGEND = YES +DOT_CLEANUP = YES +#--------------------------------------------------------------------------- +# Configuration::addtions related to the search engine +#--------------------------------------------------------------------------- +SEARCHENGINE = NO +CGI_NAME = search.cgi +CGI_URL = +DOC_URL = +DOC_ABSPATH = +BIN_ABSPATH = /usr/local/bin/ +EXT_DOC_PATHS = diff --git a/kmatplot.kdevprj b/kmatplot.kdevprj new file mode 100644 index 0000000..84c0de0 --- /dev/null +++ b/kmatplot.kdevprj @@ -0,0 +1,8732 @@ +[./AUTHORS] +dist=true +install=false +install_location= +type=DATA + +[./COPYING] +dist=true +install=false +install_location= +type=DATA + +[./ChangeLog] +dist=true +install=false +install_location= +type=DATA + +[./INSTALL] +dist=true +install=false +install_location= +type=DATA + +[./Makefile.am] +files=./ChangeLog,./AUTHORS,./COPYING,./acinclude.m4,./INSTALL,./configure.files,./NEWS,./README,./TODO,./acconfig.h,./subdirs,./aclocal.m4,./configure,./libtool,./config.h.in,./config.h,./kmatplot.spec,./config.sub,./cvs.sh,./install-sh,./kmatplot.kdevprj,./kmatplot.lsm,./ltconfig,./ltmain.sh,./missing,./mkinstalldirs,./stamp-h,./stamp-h.in,./configure.in.in,./config.log,./kmatplot.kdevses,./dist.sh,./configure.in,./kmatplot.doxygen,./config.status,./config.cache, +sub_dirs=kmatplot,Inne programy,admin,kmatplot-api,other,xpm, +type=normal + +[./NEWS] +dist=true +install=false +install_location= +type=DATA + +[./README] +dist=true +install=false +install_location= +type=DATA + +[./TODO] +dist=true +install=false +install_location= +type=DATA + +[./acconfig.h] +dist=true +install=false +install_location= +type=HEADER + +[./acinclude.m4] +dist=true +install=false +install_location= +type=DATA + +[./aclocal.m4] +dist=true +install=false +install_location= +type=DATA + +[./config.cache] +dist=true +install=false +install_location= +type=DATA + +[./config.h] +dist=true +install=false +install_location= +type=HEADER + +[./config.h.in] +dist=true +install=false +install_location= +type=DATA + +[./config.log] +dist=true +install=false +install_location= +type=DATA + +[./config.status] +dist=true +install=false +install_location= +type=DATA + +[./config.sub] +dist=true +install=false +install_location= +type=DATA + +[./configure] +dist=true +install=false +install_location= +type=DATA + +[./configure.files] +dist=true +install=false +install_location= +type=DATA + +[./configure.in] +dist=true +install=false +install_location= +type=DATA + +[./configure.in.in] +dist=true +install=false +install_location= +type=DATA + +[./cvs.sh] +dist=true +install=false +install_location= +type=DATA + +[./dist.sh] +dist=true +install=false +install_location= +type=DATA + +[./install-sh] +dist=true +install=false +install_location= +type=DATA + +[./kmatplot.doxygen] +dist=true +install=false +install_location= +type=DATA + +[./kmatplot.kdevprj] +dist=true +install=false +install_location= +type=DATA + +[./kmatplot.kdevses] +dist=true +install=false +install_location= +type=DATA + +[./kmatplot.lsm] +dist=true +install=false +install_location= +type=DATA + +[./kmatplot.spec] +dist=true +install=false +install_location= +type=DATA + +[./libtool] +dist=true +install=false +install_location= +type=DATA + +[./ltconfig] +dist=true +install=false +install_location= +type=DATA + +[./ltmain.sh] +dist=true +install=false +install_location= +type=DATA + +[./missing] +dist=true +install=false +install_location= +type=DATA + +[./mkinstalldirs] +dist=true +install=false +install_location= +type=DATA + +[./stamp-h] +dist=true +install=false +install_location= +type=DATA + +[./stamp-h.in] +dist=true +install=false +install_location= +type=DATA + +[./subdirs] +dist=true +install=false +install_location= +type=DATA + +[.xvpics/Makefile.am] +files=.xvpics/datasets.png,.xvpics/datasets.xpm,.xvpics/datasets.xcf,.xvpics/axes.xcf,.xvpics/general.xcf,.xvpics/object.xcf,.xvpics/object.xpm,.xvpics/more.xpm, +sub_dirs= +type=normal + +[.xvpics/axes.xcf] +dist=true +install=false +install_location= +type=DATA + +[.xvpics/datasets.png] +dist=true +install=false +install_location= +type=DATA + +[.xvpics/datasets.xcf] +dist=true +install=false +install_location= +type=DATA + +[.xvpics/datasets.xpm] +dist=true +install=false +install_location= +type=DATA + +[.xvpics/general.xcf] +dist=true +install=false +install_location= +type=DATA + +[.xvpics/more.xpm] +dist=true +install=false +install_location= +type=DATA + +[.xvpics/object.xcf] +dist=true +install=false +install_location= +type=DATA + +[.xvpics/object.xpm] +dist=true +install=false +install_location= +type=DATA + +[Config for BinMakefileAm] +addcxxflags= +bin_program=kmatplot +cxxflags= +ldadd= +ldflags= + +[General] +AMChanged=false +author=kamil +email=kamil@localhost.localdomain +kdevprj_version=1.3 +lfv_open_groups= +makefiles=./Makefile.am,xpm/Makefile.am,xpm/.pics/Makefile.am,xpm/.pics/med/Makefile.am,xpm/.xvpics/Makefile.am,xpm/old/Makefile.am,other/Makefile.am,other/old/Makefile.am,other/obsolete/Makefile.am,other/ui/Makefile.am,other/dialogs/Makefile.am,other/dialogs/icons/Makefile.am,other/.xvpics/Makefile.am,.xvpics/Makefile.am,kmatplot-api/Makefile.am,kmatplot-api/html/Makefile.am,admin/Makefile.am,Inne programy/Makefile.am,kmatplot/Makefile.am,kmatplot/examples/Makefile.am,kmatplot/python/Makefile.am,kmatplot/formula/Makefile.am,kmatplot/pixmaps/Makefile.am,kmatplot/pixmaps/.xvpics/Makefile.am,kmatplot/pixmaps/old/Makefile.am,kmatplot/pixmaps/.pics/Makefile.am,kmatplot/pixmaps/.pics/med/Makefile.am,kmatplot/widgets/Makefile.am,kmatplot/toolbar/Makefile.am,kmatplot/scilab/Makefile.am,kmatplot/pics/Makefile.am,kmatplot/part/Makefile.am,kmatplot/octave/Makefile.am,kmatplot/interface/Makefile.am,kmatplot/dtd/Makefile.am,kmatplot/docs/Makefile.am,kmatplot/docs/en/Makefile.am,kmatplot/dialogs/Makefile.am,kmatplot/dialogs/templates/Makefile.am,kmatplot/dialogs/old/Makefile.am,kmatplot/dialogs/old/obsolete/Makefile.am,kmatplot/demos/Makefile.am,kmatplot/config/Makefile.am, +project_name=kmatplot +project_type=normal_empty +sub_dir=kmatplot/ +version= +version_control=CVS +workspace=1 + +[Inne programy/Makefile.am] +files=Inne programy/TerryMessing.gif,Inne programy/TomCarter.gif,Inne programy/population.GIF, +sub_dirs= +type=normal + +[Inne programy/TerryMessing.gif] +dist=true +install=false +install_location= +type=DATA + +[Inne programy/TomCarter.gif] +dist=true +install=false +install_location= +type=DATA + +[Inne programy/population.GIF] +dist=true +install=false +install_location= +type=DATA + +[LFV Groups] +Desktop=*.desktop, +GNU=AUTHORS,COPYING,ChangeLog,INSTALL,README,TODO,NEWS, +Headers=*.h,*.hxx,*.hpp,*.H, +Others=*, +Sources=*.cpp,*.c,*.cc,*.C,*.cxx,*.ec,*.ecpp,*.lxx,*.l++,*.ll,*.l, +Translations=*.ts,*.po, +User Interface=*.ui,*.kdevdlg,*.rc, +groups=Headers,Sources,GNU,Translations,User Interface,Desktop,Others + +[Makefile.am] +sub_dirs=kmatplot + +[admin/Makefile.am] +files=admin/acinclude.m4.in,admin/am_edit,admin/am_edit.py,admin/conf.change.pl,admin/config.guess,admin/config.pl,admin/config.sub,admin/configure.in.min,admin/debianrules,admin/depcomp,admin/install-sh,admin/libtool.m4.in,admin/ltcf-c.sh,admin/ltcf-cxx.sh,admin/ltcf-gcj.sh,admin/ltconfig,admin/ltmain.sh,admin/missing,admin/mkinstalldirs,admin/ylwrap, +sub_dirs= +type=normal + +[admin/acinclude.m4.in] +dist=true +install=false +install_location= +type=DATA + +[admin/am_edit] +dist=true +install=false +install_location= +type=DATA + +[admin/am_edit.py] +dist=true +install=false +install_location= +type=DATA + +[admin/conf.change.pl] +dist=true +install=false +install_location= +type=DATA + +[admin/config.guess] +dist=true +install=false +install_location= +type=DATA + +[admin/config.pl] +dist=true +install=false +install_location= +type=DATA + +[admin/config.sub] +dist=true +install=false +install_location= +type=DATA + +[admin/configure.in.min] +dist=true +install=false +install_location= +type=DATA + +[admin/debianrules] +dist=true +install=false +install_location= +type=DATA + +[admin/depcomp] +dist=true +install=false +install_location= +type=DATA + +[admin/install-sh] +dist=true +install=false +install_location= +type=DATA + +[admin/libtool.m4.in] +dist=true +install=false +install_location= +type=DATA + +[admin/ltcf-c.sh] +dist=true +install=false +install_location= +type=DATA + +[admin/ltcf-cxx.sh] +dist=true +install=false +install_location= +type=DATA + +[admin/ltcf-gcj.sh] +dist=true +install=false +install_location= +type=DATA + +[admin/ltconfig] +dist=true +install=false +install_location= +type=DATA + +[admin/ltmain.sh] +dist=true +install=false +install_location= +type=DATA + +[admin/missing] +dist=true +install=false +install_location= +type=DATA + +[admin/mkinstalldirs] +dist=true +install=false +install_location= +type=DATA + +[admin/ylwrap] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/Makefile.am] +sub_dirs=html, +type=normal + +[kmatplot-api/html/Makefile.am] +files=kmatplot-api/html/doxygen.gif,kmatplot-api/html/index.html,kmatplot-api/html/files.html,kmatplot-api/html/acconfig_8h-source.html,kmatplot-api/html/common_8h-source.html,kmatplot-api/html/config_8h-source.html,kmatplot-api/html/etype_8h-source.html,kmatplot-api/html/kmatplotfactory_8h-source.html,kmatplot-api/html/kmatplotpart_8h-source.html,kmatplot-api/html/kmatplotshell_8h-source.html,kmatplot-api/html/ksarrowpanel_8h-source.html,kmatplot-api/html/ksattrbtn_8h-source.html,kmatplot-api/html/ksattrpanel_8h-source.html,kmatplot-api/html/ksaxispanel_8h-source.html,kmatplot-api/html/kscarrowpanel_8h-source.html,kmatplot-api/html/ksclabelpanel_8h-source.html,kmatplot-api/html/ksclegendcpanel_8h-source.html,kmatplot-api/html/kscolorpanel_8h-source.html,kmatplot-api/html/kscolumndatadlginterf_8h-source.html,kmatplot-api/html/kscommands_8h-source.html,kmatplot-api/html/kscontourpanel_8h-source.html,kmatplot-api/html/kscpospanel_8h-source.html,kmatplot-api/html/kscrectpanel_8h-source.html,kmatplot-api/html/kscubepanel_8h-source.html,kmatplot-api/html/ksdeletedlg_8h-source.html,kmatplot-api/html/ksdelunay_8h-source.html,kmatplot-api/html/ksexception_8h-source.html,kmatplot-api/html/ksexportdlg_8h-source.html,kmatplot-api/html/ksexportpicturedlg_8h-source.html,kmatplot-api/html/ksexportpictureinterf_8h-source.html,kmatplot-api/html/ksfigurepanel_8h-source.html,kmatplot-api/html/ksfillpanel_8h-source.html,kmatplot-api/html/ksfontpanel_8h-source.html,kmatplot-api/html/ksframepanel_8h-source.html,kmatplot-api/html/ksgeneralpanel_8h-source.html,kmatplot-api/html/ksglobalmatrixlist_8h-source.html,kmatplot-api/html/ksglpanel_8h-source.html,kmatplot-api/html/ksgradientpanel_8h-source.html,kmatplot-api/html/ksgraphwizarddlg_8h-source.html,kmatplot-api/html/ksgriddlg_8h-source.html,kmatplot-api/html/ksimagepanel_8h-source.html,kmatplot-api/html/ksimportdlg_8h-source.html,kmatplot-api/html/kslightpanel_8h-source.html,kmatplot-api/html/kslinepanel_8h-source.html,kmatplot-api/html/ksmatrix_8h-source.html,kmatplot-api/html/ksmatrixascii_8h-source.html,kmatplot-api/html/ksmatrixcolrefpanelinterf_8h-source.html,kmatplot-api/html/ksmatrixeditor_8h-source.html,kmatplot-api/html/ksmatrixio_8h-source.html,kmatplot-api/html/ksmatrixiohandler_8h-source.html,kmatplot-api/html/ksmatrixmat_8h-source.html,kmatplot-api/html/ksmatrixpanel_8h-source.html,kmatplot-api/html/ksmatrixpanelinterf_8h-source.html,kmatplot-api/html/ksmatrixrefpanelinterf_8h-source.html,kmatplot-api/html/ksmatrixstringpanelinterf_8h-source.html,kmatplot-api/html/ksmeshpanel_8h-source.html,kmatplot-api/html/ksobjectsdlg_8h-source.html,kmatplot-api/html/kspanel_8h-source.html,kmatplot-api/html/kspanelmanager_8h-source.html,kmatplot-api/html/ksplotchannels_8h-source.html,kmatplot-api/html/kspointpanel_8h-source.html,kmatplot-api/html/ksprojectxml_8h-source.html,kmatplot-api/html/ksrangepanel_8h-source.html,kmatplot-api/html/ksseriespanel_8h-source.html,kmatplot-api/html/kssocketio_8h-source.html,kmatplot-api/html/kssurfacepanel_8h-source.html,kmatplot-api/html/kssurfacewizarddlginterf_8h-source.html,kmatplot-api/html/ksticspanel_8h-source.html,kmatplot-api/html/ksviewpanel_8h-source.html,kmatplot-api/html/ksworkbook_8h-source.html,kmatplot-api/html/ksworksheetdlg_8h-source.html,kmatplot-api/html/msg_8h-source.html,kmatplot-api/html/octave-common_8h-source.html,kmatplot-api/html/qgl_8h-source.html,kmatplot-api/html/qsaxes_8h-source.html,kmatplot-api/html/qsaxes2d_8h-source.html,kmatplot-api/html/qsaxes3d_8h-source.html,kmatplot-api/html/qsaxis_8h-source.html,kmatplot-api/html/qschildlist_8h-source.html,kmatplot-api/html/qsclegend_8h-source.html,kmatplot-api/html/qscobject_8h-source.html,kmatplot-api/html/qscobjects_8h-source.html,kmatplot-api/html/qscontour_8h-source.html,kmatplot-api/html/qscoord_8h-source.html,kmatplot-api/html/qsctool_8h-source.html,kmatplot-api/html/qsctools_8h-source.html,kmatplot-api/html/qscurve_8h-source.html,kmatplot-api/html/qsdata_8h-source.html,kmatplot-api/html/qsdrv_8h-source.html,kmatplot-api/html/qsdrvhittest_8h-source.html,kmatplot-api/html/qsdrvopengl_8h-source.html,kmatplot-api/html/qsdrvqt_8h-source.html,kmatplot-api/html/qsfigure_8h-source.html,kmatplot-api/html/qsgattr_8h-source.html,kmatplot-api/html/qsgraphicaldata_8h-source.html,kmatplot-api/html/qsgsimplegradient_8h-source.html,kmatplot-api/html/qsimage_8h-source.html,kmatplot-api/html/qsmatrix_8h-source.html,kmatplot-api/html/qsplot_8h-source.html,kmatplot-api/html/qsplotview_8h-source.html,kmatplot-api/html/qsprojection_8h-source.html,kmatplot-api/html/qsprojection2d_8h-source.html,kmatplot-api/html/qsprojection3d_8h-source.html,kmatplot-api/html/qsruler_8h-source.html,kmatplot-api/html/qssegment_8h-source.html,kmatplot-api/html/qssurface_8h-source.html,kmatplot-api/html/qsworkbook_8h-source.html,kmatplot-api/html/annotated.html,kmatplot-api/html/classes.html,kmatplot-api/html/hierarchy.html,kmatplot-api/html/functions.html,kmatplot-api/html/structaxis__remembered__view__t.html,kmatplot-api/html/structaxis__remembered__view__t-members.html,kmatplot-api/html/classKMatplotFactory.html,kmatplot-api/html/classKSPanel.gif,kmatplot-api/html/classKMatplotFactory.gif,kmatplot-api/html/classKMatplotFactory-members.html,kmatplot-api/html/classKMatplotPart.html,kmatplot-api/html/classKMatplotPart.gif,kmatplot-api/html/classKMatplotPart-members.html,kmatplot-api/html/classKMatplotShell.html,kmatplot-api/html/classKMatplotShell.gif,kmatplot-api/html/classKMatplotShell-members.html,kmatplot-api/html/classKSAttrBtn.html,kmatplot-api/html/classKSAttrBtn.gif,kmatplot-api/html/classKSAttrBtn-members.html,kmatplot-api/html/classKSAttrPanel.html,kmatplot-api/html/classKSAttrPanel.gif,kmatplot-api/html/classKSAttrPanel-members.html,kmatplot-api/html/classKSAxisSelect.html,kmatplot-api/html/classKSAxisSelect.gif,kmatplot-api/html/classKSAxisSelect-members.html,kmatplot-api/html/classKSCfgPanelInterf.html,kmatplot-api/html/classKSCfgPanelInterf.gif,kmatplot-api/html/classKSCfgPanelInterf-members.html,kmatplot-api/html/classKSChannelList.html,kmatplot-api/html/classKSChannelList.gif,kmatplot-api/html/classKSChannelList-members.html,kmatplot-api/html/classKSColorPanel.html,kmatplot-api/html/classKSColorPanel.gif,kmatplot-api/html/classKSColorPanel-members.html,kmatplot-api/html/classKSCommand.html,kmatplot-api/html/classKSCommand.gif,kmatplot-api/html/classKSCommand-members.html,kmatplot-api/html/classKSCommandHistory.html,kmatplot-api/html/classKSCommandHistory.gif,kmatplot-api/html/classKSCommandHistory-members.html,kmatplot-api/html/classKSDeleteDlg.html,kmatplot-api/html/classKSDeleteDlg.gif,kmatplot-api/html/classKSDeleteDlg-members.html,kmatplot-api/html/classKSDelunay.html,kmatplot-api/html/classKSDelunay.gif,kmatplot-api/html/classKSDelunay-members.html,kmatplot-api/html/classKSException.html,kmatplot-api/html/classKSException-members.html,kmatplot-api/html/classKSExportDlg.html,kmatplot-api/html/classKSExportDlg.gif,kmatplot-api/html/classKSExportDlg-members.html,kmatplot-api/html/classKSExportPictureDlg.html,kmatplot-api/html/classKSExportPictureDlg.gif,kmatplot-api/html/classKSExportPictureDlg-members.html,kmatplot-api/html/classKSGridDlg.html,kmatplot-api/html/classKSGridDlg.gif,kmatplot-api/html/classKSGridDlg-members.html,kmatplot-api/html/classKSImportDlg.html,kmatplot-api/html/classKSImportDlg.gif,kmatplot-api/html/classKSImportDlg-members.html,kmatplot-api/html/classKSMatrix.html,kmatplot-api/html/classKSMatrix.gif,kmatplot-api/html/classKSMatrix-members.html,kmatplot-api/html/classKSMatrixASCII.html,kmatplot-api/html/classKSMatrixASCII.gif,kmatplot-api/html/classKSMatrixASCII-members.html,kmatplot-api/html/classKSMatrixBase.html,kmatplot-api/html/classKSMatrixBase.gif,kmatplot-api/html/classKSMatrixBase-members.html,kmatplot-api/html/classKSMatrixColRef.html,kmatplot-api/html/classKSMatrixColRef.gif,kmatplot-api/html/classKSMatrixColRef-members.html,kmatplot-api/html/classKSMatrixEditor.html,kmatplot-api/html/classKSMatrixEditor.gif,kmatplot-api/html/classKSMatrixEditor-members.html,kmatplot-api/html/classKSMatrixEditorInterf.html,kmatplot-api/html/classKSMatrixEditorInterf.gif,kmatplot-api/html/classKSMatrixEditorInterf-members.html,kmatplot-api/html/classKSMatrixImpl.html,kmatplot-api/html/classKSMatrixImpl.gif,kmatplot-api/html/classKSMatrixImpl-members.html,kmatplot-api/html/classKSMatrixIO.html,kmatplot-api/html/classKSMatrixIO.gif,kmatplot-api/html/classKSMatrixIO-members.html,kmatplot-api/html/classKSMatrixIOHandler.html,kmatplot-api/html/classKSMatrixIOHandler.gif,kmatplot-api/html/classKSMatrixIOHandler-members.html,kmatplot-api/html/classKSMatrixMAT.html,kmatplot-api/html/classKSMatrixMAT.gif,kmatplot-api/html/classKSMatrixMAT-members.html,kmatplot-api/html/classKSMatrixPanel.html,kmatplot-api/html/classKSMatrixPanel.gif,kmatplot-api/html/classKSMatrixPanel-members.html,kmatplot-api/html/classKSMatrixRef.html,kmatplot-api/html/classKSMatrixRef.gif,kmatplot-api/html/classKSMatrixRef-members.html,kmatplot-api/html/classKSMatrixSheetEditor.html,kmatplot-api/html/classKSMatrixSheetEditor.gif,kmatplot-api/html/classKSMatrixSheetEditor-members.html,kmatplot-api/html/classKSMatrixString.html,kmatplot-api/html/classKSMatrixString.gif,kmatplot-api/html/classKSMatrixString-members.html,kmatplot-api/html/classKSObjectsDlg.html,kmatplot-api/html/classKSObjectsDlg.gif,kmatplot-api/html/classKSObjectsDlg-members.html,kmatplot-api/html/classKSPanel.html,kmatplot-api/html/classKSPanel-members.html,kmatplot-api/html/classKSPanelButton.html,kmatplot-api/html/classKSPanelButton.gif,kmatplot-api/html/classKSPanelButton-members.html,kmatplot-api/html/classKSPanelManager.html,kmatplot-api/html/classKSPanelManager.gif,kmatplot-api/html/classKSPanelManager-members.html,kmatplot-api/html/classKSProjectXML.html,kmatplot-api/html/classKSProjectXML-members.html,kmatplot-api/html/classKSSheet.html,kmatplot-api/html/classKSSheet.gif,kmatplot-api/html/classKSSheet-members.html,kmatplot-api/html/classKSSheetList.html,kmatplot-api/html/classKSSheetList.gif,kmatplot-api/html/classKSSheetList-members.html,kmatplot-api/html/classKSSocketIO.html,kmatplot-api/html/classKSSocketIO.gif,kmatplot-api/html/classKSSocketIO-members.html,kmatplot-api/html/classKSWorkbook.html,kmatplot-api/html/classKSWorkbook.gif,kmatplot-api/html/classKSWorkbook-members.html,kmatplot-api/html/classKSWorksheetDlg.html,kmatplot-api/html/classKSWorksheetDlg.gif,kmatplot-api/html/classKSWorksheetDlg-members.html,kmatplot-api/html/classQSAxes.html,kmatplot-api/html/classQSAxes.gif,kmatplot-api/html/classQSAxes-members.html,kmatplot-api/html/classQSAxes2D.html,kmatplot-api/html/classQSAxes2D.gif,kmatplot-api/html/classQSAxes2D-members.html,kmatplot-api/html/classQSAxes3D.html,kmatplot-api/html/classQSAxes3D.gif,kmatplot-api/html/classQSAxes3D-members.html,kmatplot-api/html/classQSAxesChild.html,kmatplot-api/html/classQSAxesChild.gif,kmatplot-api/html/classQSAxesChild-members.html,kmatplot-api/html/classQSAxis.html,kmatplot-api/html/classQSAxis.gif,kmatplot-api/html/classQSAxis-members.html,kmatplot-api/html/classQSBars.html,kmatplot-api/html/classQSBars.gif,kmatplot-api/html/classQSBars-members.html,kmatplot-api/html/classQSCanvasDrv.html,kmatplot-api/html/classQSCanvasDrv.gif,kmatplot-api/html/structQSCanvasDrv_1_1PixmapBuffer.html,kmatplot-api/html/structQSCanvasDrv_1_1PixmapBuffer-members.html,kmatplot-api/html/classQSCanvasDrv-members.html,kmatplot-api/html/classQSCArrow.html,kmatplot-api/html/classQSCArrow.gif,kmatplot-api/html/classQSCArrow-members.html,kmatplot-api/html/classQSChildList.html,kmatplot-api/html/classQSChildList-members.html,kmatplot-api/html/classQSCLabel.html,kmatplot-api/html/classQSCLabel.gif,kmatplot-api/html/classQSCLabel-members.html,kmatplot-api/html/classQSCLegend.html,kmatplot-api/html/classQSCLegend.gif,kmatplot-api/html/classQSCLegend-members.html,kmatplot-api/html/classQSCObject.html,kmatplot-api/html/classQSCObject.gif,kmatplot-api/html/classQSCObject-members.html,kmatplot-api/html/classQSContour.html,kmatplot-api/html/classQSContour.gif,kmatplot-api/html/classQSContour-members.html,kmatplot-api/html/classQSCoord.html,kmatplot-api/html/classQSCoord.gif,kmatplot-api/html/classQSCoord-members.html,kmatplot-api/html/classQSCRect.html,kmatplot-api/html/classQSCRect.gif,kmatplot-api/html/classQSCRect-members.html,kmatplot-api/html/classQSCurve.html,kmatplot-api/html/classQSCurve.gif,kmatplot-api/html/classQSCurve-members.html,kmatplot-api/html/classQSData.html,kmatplot-api/html/classQSData.gif,kmatplot-api/html/classQSData-members.html,kmatplot-api/html/classQSDrv.html,kmatplot-api/html/classQSDrv.gif,kmatplot-api/html/classQSDrv-members.html,kmatplot-api/html/classQSDrvHitTest.html,kmatplot-api/html/classQSDrvHitTest.gif,kmatplot-api/html/classQSDrvHitTest-members.html,kmatplot-api/html/classQSDrvQt.html,kmatplot-api/html/classQSDrvQt.gif,kmatplot-api/html/classQSDrvQt-members.html,kmatplot-api/html/classQSFigure.html,kmatplot-api/html/classQSFigure.gif,kmatplot-api/html/classQSFigure-members.html,kmatplot-api/html/classQSFigures.html,kmatplot-api/html/classQSFigures.gif,kmatplot-api/html/classQSFigures-members.html,kmatplot-api/html/classQSGArrow.html,kmatplot-api/html/classQSGArrow.gif,kmatplot-api/html/classQSGArrow-members.html,kmatplot-api/html/classQSGAttr.html,kmatplot-api/html/classQSGAttr.gif,kmatplot-api/html/classQSGColor.html,kmatplot-api/html/classQSGColor.gif,kmatplot-api/html/classQSGColor-members.html,kmatplot-api/html/classQSGFill.html,kmatplot-api/html/classQSGFill.gif,kmatplot-api/html/classQSGFill-members.html,kmatplot-api/html/classQSGFont.html,kmatplot-api/html/classQSGFont.gif,kmatplot-api/html/classQSGFont-members.html,kmatplot-api/html/classQSGGradient.html,kmatplot-api/html/classQSGGradient.gif,kmatplot-api/html/classQSGGradient-members.html,kmatplot-api/html/classQSGLine.html,kmatplot-api/html/classQSGLine.gif,kmatplot-api/html/classQSGLine-members.html,kmatplot-api/html/classQSGPoint.html,kmatplot-api/html/classQSGPoint.gif,kmatplot-api/html/classQSGPoint-members.html,kmatplot-api/html/classQSGraphicalData.html,kmatplot-api/html/classQSGraphicalData.gif,kmatplot-api/html/structQSGraphicalData_1_1settings__t.html,kmatplot-api/html/structQSGraphicalData_1_1settings__t-members.html,kmatplot-api/html/classQSGraphicalData-members.html,kmatplot-api/html/classQSGriddedContour.html,kmatplot-api/html/classQSGriddedContour.gif,kmatplot-api/html/classQSGriddedContour-members.html,kmatplot-api/html/classQSGSimpleGradient.html,kmatplot-api/html/classQSGSimpleGradient.gif,kmatplot-api/html/classQSGSimpleGradient-members.html,kmatplot-api/html/classQSImage.html,kmatplot-api/html/classQSImage.gif,kmatplot-api/html/classQSImage-members.html,kmatplot-api/html/classQSLines.html,kmatplot-api/html/classQSLines.gif,kmatplot-api/html/classQSLines-members.html,kmatplot-api/html/classQSMatrix.html,kmatplot-api/html/classQSMatrix.gif,kmatplot-api/html/classQSMatrix-members.html,kmatplot-api/html/classQSNonGriddedContour.html,kmatplot-api/html/classQSNonGriddedContour.gif,kmatplot-api/html/classQSNonGriddedContour-members.html,kmatplot-api/html/classQSPage.html,kmatplot-api/html/classQSPage.gif,kmatplot-api/html/classQSPage-members.html,kmatplot-api/html/classQSPlot.html,kmatplot-api/html/classQSPlot.gif,kmatplot-api/html/classQSPlot-members.html,kmatplot-api/html/classQSPlot2D.html,kmatplot-api/html/classQSPlot2D.gif,kmatplot-api/html/classQSPlot2D-members.html,kmatplot-api/html/classQSPlot3D.html,kmatplot-api/html/classQSPlot3D.gif,kmatplot-api/html/classQSPlot3D-members.html,kmatplot-api/html/classQSPlotView.html,kmatplot-api/html/doxygen.css,kmatplot-api/html/classQSPlotView.gif,kmatplot-api/html/classQSPlotView-members.html,kmatplot-api/html/classQSPolys.html,kmatplot-api/html/classQSPolys.gif,kmatplot-api/html/classQSPolys-members.html,kmatplot-api/html/classQSProjection.html,kmatplot-api/html/classQSProjection.gif,kmatplot-api/html/classQSProjection-members.html,kmatplot-api/html/classQSProjection2D.html,kmatplot-api/html/classQSProjection2D.gif,kmatplot-api/html/classQSProjection2D-members.html,kmatplot-api/html/classQSProjection3D.html,kmatplot-api/html/classQSProjection3D.gif,kmatplot-api/html/classQSProjection3D-members.html,kmatplot-api/html/classQSPt2.html,kmatplot-api/html/classQSPt2.gif,kmatplot-api/html/classQSPt2-members.html,kmatplot-api/html/classQSPt2f.html,kmatplot-api/html/classQSPt2f.gif,kmatplot-api/html/classQSPt2f-members.html,kmatplot-api/html/classQSPt3.html,kmatplot-api/html/classQSPt3.gif,kmatplot-api/html/classQSPt3-members.html,kmatplot-api/html/classQSPt3f.html,kmatplot-api/html/classQSPt3f.gif,kmatplot-api/html/classQSPt3f-members.html,kmatplot-api/html/classQSRectf.html,kmatplot-api/html/classQSRectf.gif,kmatplot-api/html/classQSRectf-members.html,kmatplot-api/html/classQSSegment.html,kmatplot-api/html/classQSSegment.gif,kmatplot-api/html/classQSSegment-members.html,kmatplot-api/html/classQSStairs.html,kmatplot-api/html/classQSStairs.gif,kmatplot-api/html/classQSStairs-members.html,kmatplot-api/html/classQSSurface.html,kmatplot-api/html/classQSSurface.gif,kmatplot-api/html/classQSSurface-members.html,kmatplot-api/html/classQSTool.html,kmatplot-api/html/classQSTool.gif,kmatplot-api/html/classQSTool-members.html,kmatplot-api/html/classQSWorkbook.html,kmatplot-api/html/classQSWorkbook.gif,kmatplot-api/html/classQSWorkbook-members.html,kmatplot-api/html/kscellrangedlginterf_8h-source.html,kmatplot-api/html/kssequencedlginterf_8h-source.html,kmatplot-api/html/ksvaluerangedlginterf_8h-source.html,kmatplot-api/html/structKSSheet_1_1ColumnData.html,kmatplot-api/html/structKSSheet_1_1ColumnData-members.html,kmatplot-api/html/qsserializable_8h-source.html,kmatplot-api/html/classQSObjectFactory.html,kmatplot-api/html/classQSObjectFactory-members.html,kmatplot-api/html/classQSSerializable.html,kmatplot-api/html/classQSSerializable.gif,kmatplot-api/html/classQSSerializable-members.html,kmatplot-api/html/ksobjectfactory_8h-source.html,kmatplot-api/html/classKSMatrixWorksheetCellRange.html,kmatplot-api/html/classKSMatrixWorksheetCellRange.gif,kmatplot-api/html/classKSMatrixWorksheetCellRange-members.html,kmatplot-api/html/classKSMatrixWorksheetColumn.html,kmatplot-api/html/classKSMatrixWorksheetColumn.gif,kmatplot-api/html/classKSMatrixWorksheetColumn-members.html,kmatplot-api/html/classKSObjectFactory.html,kmatplot-api/html/classKSObjectFactory.gif,kmatplot-api/html/classKSObjectFactory-members.html,kmatplot-api/html/classQSObjectFactory.gif,kmatplot-api/html/classKSSheet_1_1ColumnData.html,kmatplot-api/html/classKSSheet_1_1ColumnData-members.html,kmatplot-api/html/classQSSelection.html,kmatplot-api/html/classQSSelection.gif,kmatplot-api/html/classQSSelection-members.html,kmatplot-api/html/classQSCObjectCollection.html,kmatplot-api/html/classQSCObjectCollection.gif,kmatplot-api/html/classQSCObjectCollection-members.html,kmatplot-api/html/classQSCGroup.html,kmatplot-api/html/classQSCGroup.gif,kmatplot-api/html/classQSCGroup-members.html,kmatplot-api/html/ksgeneraldialogs_8h-source.html,kmatplot-api/html/ksobjecttreedlginterf_8h-source.html,kmatplot-api/html/classQSCAxesShadow.html,kmatplot-api/html/classQSCAxesShadow.gif,kmatplot-api/html/classQSCAxesShadow-members.html,kmatplot-api/html/mpformula_8h-source.html,kmatplot-api/html/mpparsersymbol_8h-source.html,kmatplot-api/html/mpsymbol_8h-source.html,kmatplot-api/html/mpsymbols_8h-source.html,kmatplot-api/html/classMPCommonSymFactory.html,kmatplot-api/html/classMPCommonSymFactory.gif,kmatplot-api/html/classMPCommonSymFactory-members.html,kmatplot-api/html/classMPError.html,kmatplot-api/html/classMPError.gif,kmatplot-api/html/classMPError-members.html,kmatplot-api/html/classMPFormula.html,kmatplot-api/html/classMPFormula-members.html,kmatplot-api/html/classMPParserSymbol.html,kmatplot-api/html/classMPParserSymbol-members.html,kmatplot-api/html/classMPSymbol.html,kmatplot-api/html/classMPSymbol.gif,kmatplot-api/html/classMPSymbol-members.html,kmatplot-api/html/classMPSymbolFactory.html,kmatplot-api/html/classMPSymbolFactory.gif,kmatplot-api/html/classMPSymbolFactory-members.html,kmatplot-api/html/classMPSymbolList.html,kmatplot-api/html/classMPSymbolList-members.html,kmatplot-api/html/ksdataobjectfactory_8h-source.html,kmatplot-api/html/ksdatasymbolfactory_8h-source.html,kmatplot-api/html/ksmatrixformulapanelinterf_8h-source.html,kmatplot-api/html/mpparser_8cpp_8h-source.html,kmatplot-api/html/classKSDataObjectFactory.html,kmatplot-api/html/classKSDataObjectFactory-members.html,kmatplot-api/html/classKSDataSymbolFactory.html,kmatplot-api/html/classKSDataSymbolFactory.gif,kmatplot-api/html/classKSDataSymbolFactory-members.html,kmatplot-api/html/classMPFactoryList.html,kmatplot-api/html/classMPFactoryList.gif,kmatplot-api/html/classMPFactoryList-members.html,kmatplot-api/html/classMPSymQSMatrix.html,kmatplot-api/html/classMPSymQSMatrix.gif,kmatplot-api/html/classMPSymQSMatrix-members.html, +sub_dirs= +type=normal + +[kmatplot-api/html/acconfig_8h-source.html] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/annotated.html] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/classKMatplotFactory-members.html] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/classKMatplotFactory.gif] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/classKMatplotFactory.html] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/classKMatplotPart-members.html] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/classKMatplotPart.gif] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/classKMatplotPart.html] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/classKMatplotShell-members.html] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/classKMatplotShell.gif] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/classKMatplotShell.html] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/classKSAttrBtn-members.html] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/classKSAttrBtn.gif] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/classKSAttrBtn.html] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/classKSAttrPanel-members.html] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/classKSAttrPanel.gif] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/classKSAttrPanel.html] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/classKSAxisSelect-members.html] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/classKSAxisSelect.gif] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/classKSAxisSelect.html] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/classKSCfgPanelInterf-members.html] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/classKSCfgPanelInterf.gif] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/classKSCfgPanelInterf.html] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/classKSChannelList-members.html] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/classKSChannelList.gif] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/classKSChannelList.html] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/classKSColorPanel-members.html] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/classKSColorPanel.gif] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/classKSColorPanel.html] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/classKSCommand-members.html] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/classKSCommand.gif] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/classKSCommand.html] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/classKSCommandHistory-members.html] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/classKSCommandHistory.gif] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/classKSCommandHistory.html] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/classKSDataObjectFactory-members.html] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/classKSDataObjectFactory.html] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/classKSDataSymbolFactory-members.html] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/classKSDataSymbolFactory.gif] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/classKSDataSymbolFactory.html] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/classKSDeleteDlg-members.html] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/classKSDeleteDlg.gif] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/classKSDeleteDlg.html] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/classKSDelunay-members.html] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/classKSDelunay.gif] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/classKSDelunay.html] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/classKSException-members.html] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/classKSException.html] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/classKSExportDlg-members.html] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/classKSExportDlg.gif] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/classKSExportDlg.html] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/classKSExportPictureDlg-members.html] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/classKSExportPictureDlg.gif] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/classKSExportPictureDlg.html] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/classKSGridDlg-members.html] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/classKSGridDlg.gif] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/classKSGridDlg.html] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/classKSImportDlg-members.html] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/classKSImportDlg.gif] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/classKSImportDlg.html] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/classKSMatrix-members.html] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/classKSMatrix.gif] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/classKSMatrix.html] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/classKSMatrixASCII-members.html] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/classKSMatrixASCII.gif] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/classKSMatrixASCII.html] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/classKSMatrixBase-members.html] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/classKSMatrixBase.gif] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/classKSMatrixBase.html] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/classKSMatrixColRef-members.html] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/classKSMatrixColRef.gif] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/classKSMatrixColRef.html] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/classKSMatrixEditor-members.html] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/classKSMatrixEditor.gif] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/classKSMatrixEditor.html] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/classKSMatrixEditorInterf-members.html] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/classKSMatrixEditorInterf.gif] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/classKSMatrixEditorInterf.html] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/classKSMatrixIO-members.html] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/classKSMatrixIO.gif] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/classKSMatrixIO.html] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/classKSMatrixIOHandler-members.html] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/classKSMatrixIOHandler.gif] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/classKSMatrixIOHandler.html] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/classKSMatrixImpl-members.html] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/classKSMatrixImpl.gif] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/classKSMatrixImpl.html] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/classKSMatrixMAT-members.html] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/classKSMatrixMAT.gif] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/classKSMatrixMAT.html] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/classKSMatrixPanel-members.html] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/classKSMatrixPanel.gif] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/classKSMatrixPanel.html] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/classKSMatrixRef-members.html] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/classKSMatrixRef.gif] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/classKSMatrixRef.html] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/classKSMatrixSheetEditor-members.html] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/classKSMatrixSheetEditor.gif] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/classKSMatrixSheetEditor.html] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/classKSMatrixString-members.html] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/classKSMatrixString.gif] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/classKSMatrixString.html] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/classKSMatrixWorksheetCellRange-members.html] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/classKSMatrixWorksheetCellRange.gif] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/classKSMatrixWorksheetCellRange.html] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/classKSMatrixWorksheetColumn-members.html] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/classKSMatrixWorksheetColumn.gif] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/classKSMatrixWorksheetColumn.html] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/classKSObjectFactory-members.html] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/classKSObjectFactory.gif] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/classKSObjectFactory.html] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/classKSObjectsDlg-members.html] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/classKSObjectsDlg.gif] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/classKSObjectsDlg.html] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/classKSPanel-members.html] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/classKSPanel.gif] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/classKSPanel.html] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/classKSPanelButton-members.html] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/classKSPanelButton.gif] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/classKSPanelButton.html] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/classKSPanelManager-members.html] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/classKSPanelManager.gif] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/classKSPanelManager.html] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/classKSProjectXML-members.html] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/classKSProjectXML.html] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/classKSSheet-members.html] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/classKSSheet.gif] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/classKSSheet.html] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/classKSSheetList-members.html] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/classKSSheetList.gif] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/classKSSheetList.html] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/classKSSheet_1_1ColumnData-members.html] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/classKSSheet_1_1ColumnData.html] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/classKSSocketIO-members.html] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/classKSSocketIO.gif] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/classKSSocketIO.html] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/classKSWorkbook-members.html] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/classKSWorkbook.gif] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/classKSWorkbook.html] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/classKSWorksheetDlg-members.html] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/classKSWorksheetDlg.gif] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/classKSWorksheetDlg.html] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/classMPCommonSymFactory-members.html] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/classMPCommonSymFactory.gif] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/classMPCommonSymFactory.html] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/classMPError-members.html] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/classMPError.gif] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/classMPError.html] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/classMPFactoryList-members.html] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/classMPFactoryList.gif] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/classMPFactoryList.html] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/classMPFormula-members.html] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/classMPFormula.html] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/classMPParserSymbol-members.html] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/classMPParserSymbol.html] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/classMPSymQSMatrix-members.html] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/classMPSymQSMatrix.gif] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/classMPSymQSMatrix.html] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/classMPSymbol-members.html] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/classMPSymbol.gif] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/classMPSymbol.html] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/classMPSymbolFactory-members.html] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/classMPSymbolFactory.gif] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/classMPSymbolFactory.html] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/classMPSymbolList-members.html] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/classMPSymbolList.html] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/classQSAxes-members.html] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/classQSAxes.gif] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/classQSAxes.html] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/classQSAxes2D-members.html] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/classQSAxes2D.gif] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/classQSAxes2D.html] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/classQSAxes3D-members.html] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/classQSAxes3D.gif] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/classQSAxes3D.html] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/classQSAxesChild-members.html] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/classQSAxesChild.gif] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/classQSAxesChild.html] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/classQSAxis-members.html] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/classQSAxis.gif] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/classQSAxis.html] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/classQSBars-members.html] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/classQSBars.gif] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/classQSBars.html] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/classQSCArrow-members.html] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/classQSCArrow.gif] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/classQSCArrow.html] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/classQSCAxesShadow-members.html] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/classQSCAxesShadow.gif] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/classQSCAxesShadow.html] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/classQSCGroup-members.html] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/classQSCGroup.gif] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/classQSCGroup.html] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/classQSCLabel-members.html] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/classQSCLabel.gif] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/classQSCLabel.html] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/classQSCLegend-members.html] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/classQSCLegend.gif] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/classQSCLegend.html] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/classQSCObject-members.html] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/classQSCObject.gif] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/classQSCObject.html] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/classQSCObjectCollection-members.html] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/classQSCObjectCollection.gif] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/classQSCObjectCollection.html] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/classQSCRect-members.html] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/classQSCRect.gif] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/classQSCRect.html] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/classQSCanvasDrv-members.html] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/classQSCanvasDrv.gif] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/classQSCanvasDrv.html] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/classQSChildList-members.html] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/classQSChildList.html] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/classQSContour-members.html] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/classQSContour.gif] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/classQSContour.html] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/classQSCoord-members.html] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/classQSCoord.gif] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/classQSCoord.html] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/classQSCurve-members.html] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/classQSCurve.gif] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/classQSCurve.html] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/classQSData-members.html] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/classQSData.gif] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/classQSData.html] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/classQSDrv-members.html] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/classQSDrv.gif] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/classQSDrv.html] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/classQSDrvHitTest-members.html] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/classQSDrvHitTest.gif] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/classQSDrvHitTest.html] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/classQSDrvQt-members.html] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/classQSDrvQt.gif] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/classQSDrvQt.html] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/classQSFigure-members.html] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/classQSFigure.gif] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/classQSFigure.html] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/classQSFigures-members.html] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/classQSFigures.gif] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/classQSFigures.html] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/classQSGArrow-members.html] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/classQSGArrow.gif] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/classQSGArrow.html] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/classQSGAttr.gif] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/classQSGAttr.html] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/classQSGColor-members.html] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/classQSGColor.gif] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/classQSGColor.html] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/classQSGFill-members.html] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/classQSGFill.gif] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/classQSGFill.html] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/classQSGFont-members.html] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/classQSGFont.gif] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/classQSGFont.html] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/classQSGGradient-members.html] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/classQSGGradient.gif] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/classQSGGradient.html] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/classQSGLine-members.html] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/classQSGLine.gif] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/classQSGLine.html] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/classQSGPoint-members.html] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/classQSGPoint.gif] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/classQSGPoint.html] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/classQSGSimpleGradient-members.html] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/classQSGSimpleGradient.gif] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/classQSGSimpleGradient.html] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/classQSGraphicalData-members.html] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/classQSGraphicalData.gif] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/classQSGraphicalData.html] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/classQSGriddedContour-members.html] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/classQSGriddedContour.gif] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/classQSGriddedContour.html] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/classQSImage-members.html] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/classQSImage.gif] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/classQSImage.html] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/classQSLines-members.html] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/classQSLines.gif] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/classQSLines.html] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/classQSMatrix-members.html] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/classQSMatrix.gif] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/classQSMatrix.html] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/classQSNonGriddedContour-members.html] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/classQSNonGriddedContour.gif] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/classQSNonGriddedContour.html] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/classQSObjectFactory-members.html] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/classQSObjectFactory.gif] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/classQSObjectFactory.html] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/classQSPage-members.html] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/classQSPage.gif] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/classQSPage.html] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/classQSPlot-members.html] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/classQSPlot.gif] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/classQSPlot.html] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/classQSPlot2D-members.html] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/classQSPlot2D.gif] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/classQSPlot2D.html] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/classQSPlot3D-members.html] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/classQSPlot3D.gif] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/classQSPlot3D.html] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/classQSPlotView-members.html] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/classQSPlotView.gif] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/classQSPlotView.html] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/classQSPolys-members.html] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/classQSPolys.gif] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/classQSPolys.html] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/classQSProjection-members.html] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/classQSProjection.gif] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/classQSProjection.html] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/classQSProjection2D-members.html] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/classQSProjection2D.gif] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/classQSProjection2D.html] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/classQSProjection3D-members.html] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/classQSProjection3D.gif] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/classQSProjection3D.html] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/classQSPt2-members.html] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/classQSPt2.gif] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/classQSPt2.html] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/classQSPt2f-members.html] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/classQSPt2f.gif] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/classQSPt2f.html] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/classQSPt3-members.html] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/classQSPt3.gif] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/classQSPt3.html] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/classQSPt3f-members.html] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/classQSPt3f.gif] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/classQSPt3f.html] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/classQSRectf-members.html] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/classQSRectf.gif] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/classQSRectf.html] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/classQSSegment-members.html] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/classQSSegment.gif] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/classQSSegment.html] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/classQSSelection-members.html] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/classQSSelection.gif] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/classQSSelection.html] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/classQSSerializable-members.html] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/classQSSerializable.gif] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/classQSSerializable.html] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/classQSStairs-members.html] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/classQSStairs.gif] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/classQSStairs.html] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/classQSSurface-members.html] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/classQSSurface.gif] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/classQSSurface.html] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/classQSTool-members.html] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/classQSTool.gif] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/classQSTool.html] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/classQSWorkbook-members.html] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/classQSWorkbook.gif] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/classQSWorkbook.html] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/classes.html] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/common_8h-source.html] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/config_8h-source.html] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/doxygen.css] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/doxygen.gif] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/etype_8h-source.html] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/files.html] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/functions.html] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/hierarchy.html] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/index.html] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/kmatplotfactory_8h-source.html] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/kmatplotpart_8h-source.html] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/kmatplotshell_8h-source.html] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/ksarrowpanel_8h-source.html] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/ksattrbtn_8h-source.html] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/ksattrpanel_8h-source.html] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/ksaxispanel_8h-source.html] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/kscarrowpanel_8h-source.html] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/kscellrangedlginterf_8h-source.html] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/ksclabelpanel_8h-source.html] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/ksclegendcpanel_8h-source.html] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/kscolorpanel_8h-source.html] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/kscolumndatadlginterf_8h-source.html] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/kscommands_8h-source.html] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/kscontourpanel_8h-source.html] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/kscpospanel_8h-source.html] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/kscrectpanel_8h-source.html] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/kscubepanel_8h-source.html] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/ksdataobjectfactory_8h-source.html] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/ksdatasymbolfactory_8h-source.html] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/ksdeletedlg_8h-source.html] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/ksdelunay_8h-source.html] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/ksexception_8h-source.html] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/ksexportdlg_8h-source.html] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/ksexportpicturedlg_8h-source.html] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/ksexportpictureinterf_8h-source.html] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/ksfigurepanel_8h-source.html] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/ksfillpanel_8h-source.html] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/ksfontpanel_8h-source.html] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/ksframepanel_8h-source.html] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/ksgeneraldialogs_8h-source.html] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/ksgeneralpanel_8h-source.html] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/ksglobalmatrixlist_8h-source.html] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/ksglpanel_8h-source.html] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/ksgradientpanel_8h-source.html] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/ksgraphwizarddlg_8h-source.html] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/ksgriddlg_8h-source.html] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/ksimagepanel_8h-source.html] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/ksimportdlg_8h-source.html] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/kslightpanel_8h-source.html] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/kslinepanel_8h-source.html] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/ksmatrix_8h-source.html] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/ksmatrixascii_8h-source.html] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/ksmatrixcolrefpanelinterf_8h-source.html] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/ksmatrixeditor_8h-source.html] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/ksmatrixformulapanelinterf_8h-source.html] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/ksmatrixio_8h-source.html] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/ksmatrixiohandler_8h-source.html] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/ksmatrixmat_8h-source.html] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/ksmatrixpanel_8h-source.html] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/ksmatrixpanelinterf_8h-source.html] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/ksmatrixrefpanelinterf_8h-source.html] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/ksmatrixstringpanelinterf_8h-source.html] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/ksmeshpanel_8h-source.html] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/ksobjectfactory_8h-source.html] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/ksobjectsdlg_8h-source.html] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/ksobjecttreedlginterf_8h-source.html] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/kspanel_8h-source.html] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/kspanelmanager_8h-source.html] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/ksplotchannels_8h-source.html] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/kspointpanel_8h-source.html] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/ksprojectxml_8h-source.html] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/ksrangepanel_8h-source.html] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/kssequencedlginterf_8h-source.html] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/ksseriespanel_8h-source.html] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/kssocketio_8h-source.html] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/kssurfacepanel_8h-source.html] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/kssurfacewizarddlginterf_8h-source.html] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/ksticspanel_8h-source.html] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/ksvaluerangedlginterf_8h-source.html] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/ksviewpanel_8h-source.html] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/ksworkbook_8h-source.html] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/ksworksheetdlg_8h-source.html] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/mpformula_8h-source.html] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/mpparser_8cpp_8h-source.html] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/mpparsersymbol_8h-source.html] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/mpsymbol_8h-source.html] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/mpsymbols_8h-source.html] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/msg_8h-source.html] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/octave-common_8h-source.html] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/qgl_8h-source.html] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/qsaxes2d_8h-source.html] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/qsaxes3d_8h-source.html] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/qsaxes_8h-source.html] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/qsaxis_8h-source.html] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/qschildlist_8h-source.html] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/qsclegend_8h-source.html] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/qscobject_8h-source.html] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/qscobjects_8h-source.html] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/qscontour_8h-source.html] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/qscoord_8h-source.html] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/qsctool_8h-source.html] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/qsctools_8h-source.html] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/qscurve_8h-source.html] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/qsdata_8h-source.html] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/qsdrv_8h-source.html] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/qsdrvhittest_8h-source.html] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/qsdrvopengl_8h-source.html] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/qsdrvqt_8h-source.html] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/qsfigure_8h-source.html] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/qsgattr_8h-source.html] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/qsgraphicaldata_8h-source.html] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/qsgsimplegradient_8h-source.html] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/qsimage_8h-source.html] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/qsmatrix_8h-source.html] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/qsplot_8h-source.html] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/qsplotview_8h-source.html] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/qsprojection2d_8h-source.html] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/qsprojection3d_8h-source.html] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/qsprojection_8h-source.html] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/qsruler_8h-source.html] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/qssegment_8h-source.html] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/qsserializable_8h-source.html] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/qssurface_8h-source.html] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/qsworkbook_8h-source.html] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/structKSSheet_1_1ColumnData-members.html] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/structKSSheet_1_1ColumnData.html] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/structQSCanvasDrv_1_1PixmapBuffer-members.html] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/structQSCanvasDrv_1_1PixmapBuffer.html] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/structQSGraphicalData_1_1settings__t-members.html] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/structQSGraphicalData_1_1settings__t.html] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/structaxis__remembered__view__t-members.html] +dist=true +install=false +install_location= +type=DATA + +[kmatplot-api/html/structaxis__remembered__view__t.html] +dist=true +install=false +install_location= +type=DATA + +[kmatplot/Makefile.am] +files=kmatplot/kmatplotshell.cpp,kmatplot/kmatplotshell.h,kmatplot/ksmatrixascii.cpp,kmatplot/ksmatrixascii.h,kmatplot/ksmatrixio.cpp,kmatplot/ksmatrixio.h,kmatplot/ksmatrixiohandler.h,kmatplot/ksmatrixmat.cpp,kmatplot/ksmatrixmat.h,kmatplot/kssocketio.cpp,kmatplot/kssocketio.h,kmatplot/ksworksheetdlg.cpp,kmatplot/ksworksheetdlg.h,kmatplot/main.cpp,kmatplot/toolbar.directory,kmatplot/ksmatrixiohandler.cpp,kmatplot/ksmatrixeditor.h,kmatplot/ksmatrixeditor.cpp,kmatplot/kscommands.cpp,kmatplot/kscommands.h,kmatplot/ksdataobjectfactory.cpp,kmatplot/ksdataobjectfactory.h,kmatplot/ksdatasymbolfactory.cpp,kmatplot/ksdatasymbolfactory.h,kmatplot/ksglobalmatrixlist.cpp,kmatplot/ksglobalmatrixlist.h,kmatplot/ksmatrix.cpp,kmatplot/ksmatrix.h,kmatplot/ksobjectfactory.cpp,kmatplot/ksobjectfactory.h,kmatplot/kspanelmanager.cpp,kmatplot/kspanelmanager.h,kmatplot/ksprojectxml.cpp,kmatplot/ksprojectxml.h,kmatplot/ksworkbook.cpp,kmatplot/ksworkbook.h,kmatplot/qscobjects.cpp,kmatplot/qscobjects.h,kmatplot/qsctools.cpp,kmatplot/qsctools.h,kmatplot/ksglobalsettings.cpp,kmatplot/ksglobalsettings.h,kmatplot/ksworkspace.cpp,kmatplot/ksworkspace.h,kmatplot/kswinpageview.cpp,kmatplot/kswinpageview.h,kmatplot/kswinworksheet.cpp,kmatplot/kswinworksheet.h,kmatplot/ksmatrixsheet.cpp,kmatplot/ksmatrixsheet.h +sub_dirs=config,demos,dialogs,docs,dtd,interface,octave,part,pics,scilab,toolbar,widgets,pixmaps,formula,python,examples, +type=prog_main + +[kmatplot/config/Makefile.am] +files=kmatplot/config/kmatplot.desktop,kmatplot/config/kmatplot.rc,kmatplot/config/x-kmatplot.desktop,kmatplot/config/kmatplotworksheet.rc, +sub_dirs= +type=normal + +[kmatplot/config/kmatplot.desktop] +dist=true +install=false +install_location= +type=DATA + +[kmatplot/config/kmatplot.rc] +dist=true +install=false +install_location= +type=DATA + +[kmatplot/config/kmatplotworksheet.rc] +dist=true +install=false +install_location= +type=DATA + +[kmatplot/config/x-kmatplot.desktop] +dist=true +install=false +install_location= +type=DATA + +[kmatplot/demos/Makefile.am] +files=kmatplot/demos/demo2d.cpp,kmatplot/demos/demo3d.cpp,kmatplot/demos/demo2d,kmatplot/demos/demo3d, +sub_dirs= +type=normal + +[kmatplot/demos/demo2d] +dist=true +install=false +install_location= +type=DATA + +[kmatplot/demos/demo2d.cpp] +dist=true +install=false +install_location= +type=SOURCE + +[kmatplot/demos/demo3d] +dist=true +install=false +install_location= +type=DATA + +[kmatplot/demos/demo3d.cpp] +dist=true +install=false +install_location= +type=SOURCE + +[kmatplot/dialogs/Makefile.am] +files=kmatplot/dialogs/ksattrbtn.cpp,kmatplot/dialogs/ksattrbtn.h,kmatplot/dialogs/ksattrpanel.cpp,kmatplot/dialogs/ksattrpanel.h,kmatplot/dialogs/kspanelcurveinterf.ui,kmatplot/dialogs/kspanelaxisinterf.h,kmatplot/dialogs/kspanelcarrowinterf.h,kmatplot/dialogs/kspanelclabelinterf.h,kmatplot/dialogs/kspanelclegendcinterf.h,kmatplot/dialogs/kspanelcontourinterf.h,kmatplot/dialogs/kspanelcposinterf.h,kmatplot/dialogs/kspanelcrectinterf.h,kmatplot/dialogs/kspanelcubeinterf.h,kmatplot/dialogs/kspanelcurveinterf.h,kmatplot/dialogs/kspanelfigureinterf.h,kmatplot/dialogs/kspanelframeinterf.h,kmatplot/dialogs/kspanelgeneralinterf.h,kmatplot/dialogs/kspanelglinterf.h,kmatplot/dialogs/kspanelgridinterf.h,kmatplot/dialogs/kspanelimageinterf.h,kmatplot/dialogs/kspanellightinterf.h,kmatplot/dialogs/kspanelmeshinterf.h,kmatplot/dialogs/kspanelrangeinterf.h,kmatplot/dialogs/kspanelviewinterf.h,kmatplot/dialogs/kspanelclegendcinterf.ui,kmatplot/dialogs/kspanelsurfaceinterf.h,kmatplot/dialogs/ksattrpanelinterf.ui,kmatplot/dialogs/ksattrpanelinterf.cpp,kmatplot/dialogs/kspanelgradientinterf.cpp,kmatplot/dialogs/ksexportdlginterf.ui,kmatplot/dialogs/ksmpanelformulainterf.cpp,kmatplot/dialogs/ksmpanel.cpp,kmatplot/dialogs/ksgriddlg.cpp,kmatplot/dialogs/ksgriddlg.h,kmatplot/dialogs/ksexportdlg.cpp,kmatplot/dialogs/ksgriddlginterf.h,kmatplot/dialogs/ksmpanelmatrixinterf.cpp,kmatplot/dialogs/ksmpanel.h,kmatplot/dialogs/ksmpanelrefinterf.cpp,kmatplot/dialogs/ksmpanelstringinterf.cpp,kmatplot/dialogs/kspanel.cpp,kmatplot/dialogs/kspanel.h,kmatplot/dialogs/kspanelrangeinterf.cpp,kmatplot/dialogs/kschannellist.cpp,kmatplot/dialogs/kspanelaxisinterf.cpp,kmatplot/dialogs/kspanelcarrowinterf.cpp,kmatplot/dialogs/kspanelclabelinterf.cpp,kmatplot/dialogs/ksmpanels.h,kmatplot/dialogs/kspanelclegendcinterf.cpp,kmatplot/dialogs/kspanelcontourinterf.cpp,kmatplot/dialogs/kspanelcposinterf.cpp,kmatplot/dialogs/kspanelaxisinterf.ui,kmatplot/dialogs/kspanelcrectinterf.cpp,kmatplot/dialogs/kspanelcubeinterf.cpp,kmatplot/dialogs/kspanelcurveinterf.cpp,kmatplot/dialogs/kspanelfigureinterf.cpp,kmatplot/dialogs/kspanelframeinterf.cpp,kmatplot/dialogs/kspanelgeneralinterf.cpp,kmatplot/dialogs/kspanelglinterf.cpp,kmatplot/dialogs/kspanelgridinterf.cpp,kmatplot/dialogs/kspanelimageinterf.cpp,kmatplot/dialogs/kspanellightinterf.cpp,kmatplot/dialogs/kspanelmeshinterf.cpp,kmatplot/dialogs/kspanelsurfaceinterf.cpp,kmatplot/dialogs/kspanelviewinterf.cpp,kmatplot/dialogs/ksattrpanelinterf.h,kmatplot/dialogs/kspanelcposinterf.ui,kmatplot/dialogs/kschannellist.h,kmatplot/dialogs/kspanelcubeinterf.ui,kmatplot/dialogs/ksgriddlginterf.ui,kmatplot/dialogs/ksimportdlginterf.ui,kmatplot/dialogs/ksdatasetdlginterf.ui,kmatplot/dialogs/ksexportdlg.h,kmatplot/dialogs/ksimportdlg.cpp,kmatplot/dialogs/ksimportdlg.h,kmatplot/dialogs/kspanelglinterf.ui,kmatplot/dialogs/ksexportpicturedlg.cpp,kmatplot/dialogs/ksexportpicturedlg.h,kmatplot/dialogs/ksdatasetdlg.cpp,kmatplot/dialogs/ksdatasetdlg.h,kmatplot/dialogs/ksimportdlginterf.h,kmatplot/dialogs/ksexportdlginterf.h,kmatplot/dialogs/ksdatasetdlginterf.h,kmatplot/dialogs/kspanelgridinterf.ui,kmatplot/dialogs/kspanels.h,kmatplot/dialogs/ksexportpicturedlginterf.ui,kmatplot/dialogs/ksexportpicturedlginterf.h,kmatplot/dialogs/kspanelclabelinterf.ui,kmatplot/dialogs/kspanels.cpp,kmatplot/dialogs/kspanelcontourinterf.ui,kmatplot/dialogs/kspanelmeshinterf.ui,kmatplot/dialogs/kspanelrangeinterf.ui,kmatplot/dialogs/kspanelcrectinterf.ui,kmatplot/dialogs/kspanelfigureinterf.ui,kmatplot/dialogs/kspanelframeinterf.ui,kmatplot/dialogs/kspanelcarrowinterf.ui,kmatplot/dialogs/kspanelgeneralinterf.ui,kmatplot/dialogs/kspanelimageinterf.ui,kmatplot/dialogs/kspanellightinterf.ui,kmatplot/dialogs/kspanelsurfaceinterf.ui,kmatplot/dialogs/kspanelviewinterf.ui,kmatplot/dialogs/ksgriddlginterf.cpp,kmatplot/dialogs/ksimportdlginterf.cpp,kmatplot/dialogs/ksexportdlginterf.cpp,kmatplot/dialogs/ksdatasetdlginterf.cpp,kmatplot/dialogs/ksobjecttreedlginterf.ui,kmatplot/dialogs/ksexportpicturedlginterf.cpp,kmatplot/dialogs/ksobjecttreedlg.cpp,kmatplot/dialogs/ksobjecttreedlg.h,kmatplot/dialogs/ksmpanelformulainterf.ui,kmatplot/dialogs/ksmpanelmatrixinterf.ui,kmatplot/dialogs/ksmpanels.cpp,kmatplot/dialogs/ksmpanelstringinterf.ui,kmatplot/dialogs/kssheetdlgcellrangeinterf.ui,kmatplot/dialogs/kssheetdlgcoldatainterf.ui,kmatplot/dialogs/kssheetdlgsequenceinterf.ui,kmatplot/dialogs/kssheetdlgvaluerangeinterf.ui,kmatplot/dialogs/kswizarddlgs.cpp,kmatplot/dialogs/kswizarddlgs.h,kmatplot/dialogs/kssheetdlgs.cpp,kmatplot/dialogs/kssheetdlgs.h,kmatplot/dialogs/ksmpanelrefinterf.ui,kmatplot/dialogs/ksmpanelformulainterf.h,kmatplot/dialogs/ksmpanelmatrixinterf.h,kmatplot/dialogs/ksmpanelrefinterf.h,kmatplot/dialogs/ksmpanelstringinterf.h,kmatplot/dialogs/ksobjecttreedlginterf.h,kmatplot/dialogs/kswizarddlgsurfaceinterf.ui,kmatplot/dialogs/kswizarddlgsurfaceinterf.h,kmatplot/dialogs/kssheetdlgcellrangeinterf.h,kmatplot/dialogs/kssheetdlgcoldatainterf.h,kmatplot/dialogs/kssheetdlgsequenceinterf.h,kmatplot/dialogs/kssheetdlgvaluerangeinterf.h,kmatplot/dialogs/ksobjecttreedlginterf.cpp,kmatplot/dialogs/kswizarddlgsurfaceinterf.cpp,kmatplot/dialogs/kssheetdlgcellrangeinterf.cpp,kmatplot/dialogs/kssheetdlgcoldatainterf.cpp,kmatplot/dialogs/kssheetdlgsequenceinterf.cpp,kmatplot/dialogs/kspanelgradientinterf.ui,kmatplot/dialogs/kssheetdlgvaluerangeinterf.cpp,kmatplot/dialogs/kspanelgradientinterf.h,kmatplot/dialogs/ksconfiguredlginterf.ui,kmatplot/dialogs/ksconfiguredlg.cpp,kmatplot/dialogs/ksconfiguredlg.h,kmatplot/dialogs/kstextedit.cpp,kmatplot/dialogs/kstextedit.h,kmatplot/dialogs/ksgraphwizardinterf.ui,kmatplot/dialogs/ksgraphwizard.cpp,kmatplot/dialogs/ksgraphwizard.h +sub_dirs=old,templates, +type=static_library + +[kmatplot/dialogs/ksattrbtn.cpp] +dist=true +install=false +install_location= +type=SOURCE + +[kmatplot/dialogs/ksattrbtn.h] +dist=true +install=false +install_location= +type=HEADER + +[kmatplot/dialogs/ksattrpanel.cpp] +dist=true +install=false +install_location= +type=SOURCE + +[kmatplot/dialogs/ksattrpanel.h] +dist=true +install=false +install_location= +type=HEADER + +[kmatplot/dialogs/ksattrpanelinterf.cpp] +dist=true +install=false +install_location= +type=SOURCE + +[kmatplot/dialogs/ksattrpanelinterf.h] +dist=true +install=false +install_location= +type=HEADER + +[kmatplot/dialogs/ksattrpanelinterf.ui] +dist=true +install=false +install_location= +type=SOURCE + +[kmatplot/dialogs/kschannellist.cpp] +dist=true +install=false +install_location= +type=SOURCE + +[kmatplot/dialogs/kschannellist.h] +dist=true +install=false +install_location= +type=HEADER + +[kmatplot/dialogs/ksconfiguredlg.cpp] +dist=true +install=false +install_location= +type=SOURCE + +[kmatplot/dialogs/ksconfiguredlg.h] +dist=true +install=false +install_location= +type=HEADER + +[kmatplot/dialogs/ksconfiguredlginterf.ui] +dist=true +install=false +install_location= +type=SOURCE + +[kmatplot/dialogs/ksdatasetdlg.cpp] +dist=true +install=false +install_location= +type=SOURCE + +[kmatplot/dialogs/ksdatasetdlg.h] +dist=true +install=false +install_location= +type=HEADER + +[kmatplot/dialogs/ksdatasetdlginterf.cpp] +dist=true +install=false +install_location= +type=SOURCE + +[kmatplot/dialogs/ksdatasetdlginterf.h] +dist=true +install=false +install_location= +type=HEADER + +[kmatplot/dialogs/ksdatasetdlginterf.ui] +dist=true +install=false +install_location= +type=SOURCE + +[kmatplot/dialogs/ksexportdlg.cpp] +dist=true +install=false +install_location= +type=SOURCE + +[kmatplot/dialogs/ksexportdlg.h] +dist=true +install=false +install_location= +type=HEADER + +[kmatplot/dialogs/ksexportdlginterf.cpp] +dist=true +install=false +install_location= +type=SOURCE + +[kmatplot/dialogs/ksexportdlginterf.h] +dist=true +install=false +install_location= +type=HEADER + +[kmatplot/dialogs/ksexportdlginterf.ui] +dist=true +install=false +install_location= +type=SOURCE + +[kmatplot/dialogs/ksexportpicturedlg.cpp] +dist=true +install=false +install_location= +type=SOURCE + +[kmatplot/dialogs/ksexportpicturedlg.h] +dist=true +install=false +install_location= +type=HEADER + +[kmatplot/dialogs/ksexportpicturedlginterf.cpp] +dist=true +install=false +install_location= +type=SOURCE + +[kmatplot/dialogs/ksexportpicturedlginterf.h] +dist=true +install=false +install_location= +type=HEADER + +[kmatplot/dialogs/ksexportpicturedlginterf.ui] +dist=true +install=false +install_location= +type=SOURCE + +[kmatplot/dialogs/ksgraphwizard.cpp] +dist=true +install=false +install_location= +type=SOURCE + +[kmatplot/dialogs/ksgraphwizard.h] +dist=true +install=false +install_location= +type=HEADER + +[kmatplot/dialogs/ksgraphwizardinterf.ui] +dist=true +install=false +install_location= +type=SOURCE + +[kmatplot/dialogs/ksgriddlg.cpp] +dist=true +install=false +install_location= +type=SOURCE + +[kmatplot/dialogs/ksgriddlg.h] +dist=true +install=false +install_location= +type=HEADER + +[kmatplot/dialogs/ksgriddlginterf.cpp] +dist=true +install=false +install_location= +type=SOURCE + +[kmatplot/dialogs/ksgriddlginterf.h] +dist=true +install=false +install_location= +type=HEADER + +[kmatplot/dialogs/ksgriddlginterf.ui] +dist=true +install=false +install_location= +type=SOURCE + +[kmatplot/dialogs/ksimportdlg.cpp] +dist=true +install=false +install_location= +type=SOURCE + +[kmatplot/dialogs/ksimportdlg.h] +dist=true +install=false +install_location= +type=HEADER + +[kmatplot/dialogs/ksimportdlginterf.cpp] +dist=true +install=false +install_location= +type=SOURCE + +[kmatplot/dialogs/ksimportdlginterf.h] +dist=true +install=false +install_location= +type=HEADER + +[kmatplot/dialogs/ksimportdlginterf.ui] +dist=true +install=false +install_location= +type=SOURCE + +[kmatplot/dialogs/ksmpanel.cpp] +dist=true +install=false +install_location= +type=SOURCE + +[kmatplot/dialogs/ksmpanel.h] +dist=true +install=false +install_location= +type=HEADER + +[kmatplot/dialogs/ksmpanelformulainterf.cpp] +dist=true +install=false +install_location= +type=SOURCE + +[kmatplot/dialogs/ksmpanelformulainterf.h] +dist=true +install=false +install_location= +type=HEADER + +[kmatplot/dialogs/ksmpanelformulainterf.ui] +dist=true +install=false +install_location= +type=SOURCE + +[kmatplot/dialogs/ksmpanelmatrixinterf.cpp] +dist=true +install=false +install_location= +type=SOURCE + +[kmatplot/dialogs/ksmpanelmatrixinterf.h] +dist=true +install=false +install_location= +type=HEADER + +[kmatplot/dialogs/ksmpanelmatrixinterf.ui] +dist=true +install=false +install_location= +type=SOURCE + +[kmatplot/dialogs/ksmpanelrefinterf.cpp] +dist=true +install=false +install_location= +type=SOURCE + +[kmatplot/dialogs/ksmpanelrefinterf.h] +dist=true +install=false +install_location= +type=HEADER + +[kmatplot/dialogs/ksmpanelrefinterf.ui] +dist=true +install=false +install_location= +type=SOURCE + +[kmatplot/dialogs/ksmpanels.cpp] +dist=true +install=false +install_location= +type=SOURCE + +[kmatplot/dialogs/ksmpanels.h] +dist=true +install=false +install_location= +type=HEADER + +[kmatplot/dialogs/ksmpanelstringinterf.cpp] +dist=true +install=false +install_location= +type=SOURCE + +[kmatplot/dialogs/ksmpanelstringinterf.h] +dist=true +install=false +install_location= +type=HEADER + +[kmatplot/dialogs/ksmpanelstringinterf.ui] +dist=true +install=false +install_location= +type=SOURCE + +[kmatplot/dialogs/ksobjecttreedlg.cpp] +dist=true +install=false +install_location= +type=SOURCE + +[kmatplot/dialogs/ksobjecttreedlg.h] +dist=true +install=false +install_location= +type=HEADER + +[kmatplot/dialogs/ksobjecttreedlginterf.cpp] +dist=true +install=false +install_location= +type=SOURCE + +[kmatplot/dialogs/ksobjecttreedlginterf.h] +dist=true +install=false +install_location= +type=HEADER + +[kmatplot/dialogs/ksobjecttreedlginterf.ui] +dist=true +install=false +install_location= +type=SOURCE + +[kmatplot/dialogs/kspanel.cpp] +dist=true +install=false +install_location= +type=SOURCE + +[kmatplot/dialogs/kspanel.h] +dist=true +install=false +install_location= +type=HEADER + +[kmatplot/dialogs/kspanelaxisinterf.cpp] +dist=true +install=false +install_location= +type=SOURCE + +[kmatplot/dialogs/kspanelaxisinterf.h] +dist=true +install=false +install_location= +type=HEADER + +[kmatplot/dialogs/kspanelaxisinterf.ui] +dist=true +install=false +install_location= +type=SOURCE + +[kmatplot/dialogs/kspanelcarrowinterf.cpp] +dist=true +install=false +install_location= +type=SOURCE + +[kmatplot/dialogs/kspanelcarrowinterf.h] +dist=true +install=false +install_location= +type=HEADER + +[kmatplot/dialogs/kspanelcarrowinterf.ui] +dist=true +install=false +install_location= +type=SOURCE + +[kmatplot/dialogs/kspanelclabelinterf.cpp] +dist=true +install=false +install_location= +type=SOURCE + +[kmatplot/dialogs/kspanelclabelinterf.h] +dist=true +install=false +install_location= +type=HEADER + +[kmatplot/dialogs/kspanelclabelinterf.ui] +dist=true +install=false +install_location= +type=SOURCE + +[kmatplot/dialogs/kspanelclegendcinterf.cpp] +dist=true +install=false +install_location= +type=SOURCE + +[kmatplot/dialogs/kspanelclegendcinterf.h] +dist=true +install=false +install_location= +type=HEADER + +[kmatplot/dialogs/kspanelclegendcinterf.ui] +dist=true +install=false +install_location= +type=SOURCE + +[kmatplot/dialogs/kspanelcontourinterf.cpp] +dist=true +install=false +install_location= +type=SOURCE + +[kmatplot/dialogs/kspanelcontourinterf.h] +dist=true +install=false +install_location= +type=HEADER + +[kmatplot/dialogs/kspanelcontourinterf.ui] +dist=true +install=false +install_location= +type=SOURCE + +[kmatplot/dialogs/kspanelcposinterf.cpp] +dist=true +install=false +install_location= +type=SOURCE + +[kmatplot/dialogs/kspanelcposinterf.h] +dist=true +install=false +install_location= +type=HEADER + +[kmatplot/dialogs/kspanelcposinterf.ui] +dist=true +install=false +install_location= +type=SOURCE + +[kmatplot/dialogs/kspanelcrectinterf.cpp] +dist=true +install=false +install_location= +type=SOURCE + +[kmatplot/dialogs/kspanelcrectinterf.h] +dist=true +install=false +install_location= +type=HEADER + +[kmatplot/dialogs/kspanelcrectinterf.ui] +dist=true +install=false +install_location= +type=SOURCE + +[kmatplot/dialogs/kspanelcubeinterf.cpp] +dist=true +install=false +install_location= +type=SOURCE + +[kmatplot/dialogs/kspanelcubeinterf.h] +dist=true +install=false +install_location= +type=HEADER + +[kmatplot/dialogs/kspanelcubeinterf.ui] +dist=true +install=false +install_location= +type=SOURCE + +[kmatplot/dialogs/kspanelcurveinterf.cpp] +dist=true +install=false +install_location= +type=SOURCE + +[kmatplot/dialogs/kspanelcurveinterf.h] +dist=true +install=false +install_location= +type=HEADER + +[kmatplot/dialogs/kspanelcurveinterf.ui] +dist=true +install=false +install_location= +type=SOURCE + +[kmatplot/dialogs/kspanelfigureinterf.cpp] +dist=true +install=false +install_location= +type=SOURCE + +[kmatplot/dialogs/kspanelfigureinterf.h] +dist=true +install=false +install_location= +type=HEADER + +[kmatplot/dialogs/kspanelfigureinterf.ui] +dist=true +install=false +install_location= +type=SOURCE + +[kmatplot/dialogs/kspanelframeinterf.cpp] +dist=true +install=false +install_location= +type=SOURCE + +[kmatplot/dialogs/kspanelframeinterf.h] +dist=true +install=false +install_location= +type=HEADER + +[kmatplot/dialogs/kspanelframeinterf.ui] +dist=true +install=false +install_location= +type=SOURCE + +[kmatplot/dialogs/kspanelgeneralinterf.cpp] +dist=true +install=false +install_location= +type=SOURCE + +[kmatplot/dialogs/kspanelgeneralinterf.h] +dist=true +install=false +install_location= +type=HEADER + +[kmatplot/dialogs/kspanelgeneralinterf.ui] +dist=true +install=false +install_location= +type=SOURCE + +[kmatplot/dialogs/kspanelglinterf.cpp] +dist=true +install=false +install_location= +type=SOURCE + +[kmatplot/dialogs/kspanelglinterf.h] +dist=true +install=false +install_location= +type=HEADER + +[kmatplot/dialogs/kspanelglinterf.ui] +dist=true +install=false +install_location= +type=SOURCE + +[kmatplot/dialogs/kspanelgradientinterf.cpp] +dist=true +install=false +install_location= +type=SOURCE + +[kmatplot/dialogs/kspanelgradientinterf.h] +dist=true +install=false +install_location= +type=HEADER + +[kmatplot/dialogs/kspanelgradientinterf.ui] +dist=true +install=false +install_location= +type=SOURCE + +[kmatplot/dialogs/kspanelgridinterf.cpp] +dist=true +install=false +install_location= +type=SOURCE + +[kmatplot/dialogs/kspanelgridinterf.h] +dist=true +install=false +install_location= +type=HEADER + +[kmatplot/dialogs/kspanelgridinterf.ui] +dist=true +install=false +install_location= +type=SOURCE + +[kmatplot/dialogs/kspanelimageinterf.cpp] +dist=true +install=false +install_location= +type=SOURCE + +[kmatplot/dialogs/kspanelimageinterf.h] +dist=true +install=false +install_location= +type=HEADER + +[kmatplot/dialogs/kspanelimageinterf.ui] +dist=true +install=false +install_location= +type=SOURCE + +[kmatplot/dialogs/kspanellightinterf.cpp] +dist=true +install=false +install_location= +type=SOURCE + +[kmatplot/dialogs/kspanellightinterf.h] +dist=true +install=false +install_location= +type=HEADER + +[kmatplot/dialogs/kspanellightinterf.ui] +dist=true +install=false +install_location= +type=SOURCE + +[kmatplot/dialogs/kspanelmeshinterf.cpp] +dist=true +install=false +install_location= +type=SOURCE + +[kmatplot/dialogs/kspanelmeshinterf.h] +dist=true +install=false +install_location= +type=HEADER + +[kmatplot/dialogs/kspanelmeshinterf.ui] +dist=true +install=false +install_location= +type=SOURCE + +[kmatplot/dialogs/kspanelrangeinterf.cpp] +dist=true +install=false +install_location= +type=SOURCE + +[kmatplot/dialogs/kspanelrangeinterf.h] +dist=true +install=false +install_location= +type=HEADER + +[kmatplot/dialogs/kspanelrangeinterf.ui] +dist=true +install=false +install_location= +type=SOURCE + +[kmatplot/dialogs/kspanels.cpp] +dist=true +install=false +install_location= +type=SOURCE + +[kmatplot/dialogs/kspanels.h] +dist=true +install=false +install_location= +type=HEADER + +[kmatplot/dialogs/kspanelsurfaceinterf.cpp] +dist=true +install=false +install_location= +type=SOURCE + +[kmatplot/dialogs/kspanelsurfaceinterf.h] +dist=true +install=false +install_location= +type=HEADER + +[kmatplot/dialogs/kspanelsurfaceinterf.ui] +dist=true +install=false +install_location= +type=SOURCE + +[kmatplot/dialogs/kspanelviewinterf.cpp] +dist=true +install=false +install_location= +type=SOURCE + +[kmatplot/dialogs/kspanelviewinterf.h] +dist=true +install=false +install_location= +type=HEADER + +[kmatplot/dialogs/kspanelviewinterf.ui] +dist=true +install=false +install_location= +type=SOURCE + +[kmatplot/dialogs/kssheetdlgcellrangeinterf.cpp] +dist=true +install=false +install_location= +type=SOURCE + +[kmatplot/dialogs/kssheetdlgcellrangeinterf.h] +dist=true +install=false +install_location= +type=HEADER + +[kmatplot/dialogs/kssheetdlgcellrangeinterf.ui] +dist=true +install=false +install_location= +type=SOURCE + +[kmatplot/dialogs/kssheetdlgcoldatainterf.cpp] +dist=true +install=false +install_location= +type=SOURCE + +[kmatplot/dialogs/kssheetdlgcoldatainterf.h] +dist=true +install=false +install_location= +type=HEADER + +[kmatplot/dialogs/kssheetdlgcoldatainterf.ui] +dist=true +install=false +install_location= +type=SOURCE + +[kmatplot/dialogs/kssheetdlgs.cpp] +dist=true +install=false +install_location= +type=SOURCE + +[kmatplot/dialogs/kssheetdlgs.h] +dist=true +install=false +install_location= +type=HEADER + +[kmatplot/dialogs/kssheetdlgsequenceinterf.cpp] +dist=true +install=false +install_location= +type=SOURCE + +[kmatplot/dialogs/kssheetdlgsequenceinterf.h] +dist=true +install=false +install_location= +type=HEADER + +[kmatplot/dialogs/kssheetdlgsequenceinterf.ui] +dist=true +install=false +install_location= +type=SOURCE + +[kmatplot/dialogs/kssheetdlgvaluerangeinterf.cpp] +dist=true +install=false +install_location= +type=SOURCE + +[kmatplot/dialogs/kssheetdlgvaluerangeinterf.h] +dist=true +install=false +install_location= +type=HEADER + +[kmatplot/dialogs/kssheetdlgvaluerangeinterf.ui] +dist=true +install=false +install_location= +type=SOURCE + +[kmatplot/dialogs/kstextedit.cpp] +dist=true +install=false +install_location= +type=SOURCE + +[kmatplot/dialogs/kstextedit.h] +dist=true +install=false +install_location= +type=HEADER + +[kmatplot/dialogs/kswizarddlgs.cpp] +dist=true +install=false +install_location= +type=SOURCE + +[kmatplot/dialogs/kswizarddlgs.h] +dist=true +install=false +install_location= +type=HEADER + +[kmatplot/dialogs/kswizarddlgsurfaceinterf.cpp] +dist=true +install=false +install_location= +type=SOURCE + +[kmatplot/dialogs/kswizarddlgsurfaceinterf.h] +dist=true +install=false +install_location= +type=HEADER + +[kmatplot/dialogs/kswizarddlgsurfaceinterf.ui] +dist=true +install=false +install_location= +type=SOURCE + +[kmatplot/dialogs/old/Makefile.am] +files=kmatplot/dialogs/old/ksmpanelref.ui,kmatplot/dialogs/old/kswizarddlgsurface.ui,kmatplot/dialogs/old/ksgradientpanel.cpp,kmatplot/dialogs/old/ksgradientpanel.h,kmatplot/dialogs/old/kscolorpanel.cpp,kmatplot/dialogs/old/kscolorpaneldata.cpp,kmatplot/dialogs/old/kscolorpanel.h,kmatplot/dialogs/old/kscolorpanel.kdevdlg,kmatplot/dialogs/old/ksfillpanel.cpp,kmatplot/dialogs/old/ksfillpaneldata.cpp,kmatplot/dialogs/old/ksfillpanel.h,kmatplot/dialogs/old/ksfillpanel.kdevdlg,kmatplot/dialogs/old/ksfontpanel.cpp,kmatplot/dialogs/old/ksfontpaneldata.cpp,kmatplot/dialogs/old/ksfontpanel.h,kmatplot/dialogs/old/ksfontpanel.kdevdlg,kmatplot/dialogs/old/kslinepanel.cpp,kmatplot/dialogs/old/kslinepaneldata.cpp,kmatplot/dialogs/old/kslinepanel.h,kmatplot/dialogs/old/kslinepanel.kdevdlg,kmatplot/dialogs/old/ksarrowpanel.cpp,kmatplot/dialogs/old/ksarrowpaneldata.cpp,kmatplot/dialogs/old/ksarrowpanel.h,kmatplot/dialogs/old/ksarrowpanel.kdevdlg,kmatplot/dialogs/old/kspointpanel.cpp,kmatplot/dialogs/old/kspointpaneldata.cpp,kmatplot/dialogs/old/kspointpanel.h,kmatplot/dialogs/old/kspointpanel.kdevdlg, +sub_dirs=obsolete, +type=normal + +[kmatplot/dialogs/old/ksarrowpanel.cpp] +dist=true +install=false +install_location= +type=SOURCE + +[kmatplot/dialogs/old/ksarrowpanel.h] +dist=true +install=false +install_location= +type=HEADER + +[kmatplot/dialogs/old/ksarrowpanel.kdevdlg] +dist=true +install=false +install_location= +type=DATA + +[kmatplot/dialogs/old/ksarrowpaneldata.cpp] +dist=true +install=false +install_location= +type=SOURCE + +[kmatplot/dialogs/old/kscolorpanel.cpp] +dist=true +install=false +install_location= +type=SOURCE + +[kmatplot/dialogs/old/kscolorpanel.h] +dist=true +install=false +install_location= +type=HEADER + +[kmatplot/dialogs/old/kscolorpanel.kdevdlg] +dist=true +install=false +install_location= +type=DATA + +[kmatplot/dialogs/old/kscolorpaneldata.cpp] +dist=true +install=false +install_location= +type=SOURCE + +[kmatplot/dialogs/old/ksfillpanel.cpp] +dist=true +install=false +install_location= +type=SOURCE + +[kmatplot/dialogs/old/ksfillpanel.h] +dist=true +install=false +install_location= +type=HEADER + +[kmatplot/dialogs/old/ksfillpanel.kdevdlg] +dist=true +install=false +install_location= +type=DATA + +[kmatplot/dialogs/old/ksfillpaneldata.cpp] +dist=true +install=false +install_location= +type=SOURCE + +[kmatplot/dialogs/old/ksfontpanel.cpp] +dist=true +install=false +install_location= +type=SOURCE + +[kmatplot/dialogs/old/ksfontpanel.h] +dist=true +install=false +install_location= +type=HEADER + +[kmatplot/dialogs/old/ksfontpanel.kdevdlg] +dist=true +install=false +install_location= +type=DATA + +[kmatplot/dialogs/old/ksfontpaneldata.cpp] +dist=true +install=false +install_location= +type=SOURCE + +[kmatplot/dialogs/old/ksgradientpanel.cpp] +dist=true +install=false +install_location= +type=SOURCE + +[kmatplot/dialogs/old/ksgradientpanel.h] +dist=true +install=false +install_location= +type=HEADER + +[kmatplot/dialogs/old/kslinepanel.cpp] +dist=true +install=false +install_location= +type=SOURCE + +[kmatplot/dialogs/old/kslinepanel.h] +dist=true +install=false +install_location= +type=HEADER + +[kmatplot/dialogs/old/kslinepanel.kdevdlg] +dist=true +install=false +install_location= +type=DATA + +[kmatplot/dialogs/old/kslinepaneldata.cpp] +dist=true +install=false +install_location= +type=SOURCE + +[kmatplot/dialogs/old/ksmpanelref.ui] +dist=true +install=false +install_location= +type=SOURCE + +[kmatplot/dialogs/old/kspointpanel.cpp] +dist=true +install=false +install_location= +type=SOURCE + +[kmatplot/dialogs/old/kspointpanel.h] +dist=true +install=false +install_location= +type=HEADER + +[kmatplot/dialogs/old/kspointpanel.kdevdlg] +dist=true +install=false +install_location= +type=DATA + +[kmatplot/dialogs/old/kspointpaneldata.cpp] +dist=true +install=false +install_location= +type=SOURCE + +[kmatplot/dialogs/old/kswizarddlgsurface.ui] +dist=true +install=false +install_location= +type=SOURCE + +[kmatplot/dialogs/old/obsolete/Makefile.am] +files=kmatplot/dialogs/old/obsolete/kmatplot.doxygen,kmatplot/dialogs/old/obsolete/kmatplot.kdevprj,kmatplot/dialogs/old/obsolete/kmatplot.spec,kmatplot/dialogs/old/obsolete/ksdatasetsdlg.kdevdlg,kmatplot/dialogs/old/obsolete/ksdeletedlgdata.cpp,kmatplot/dialogs/old/obsolete/ksdeletedlg.kdevdlg,kmatplot/dialogs/old/obsolete/ksexportdlgdata.cpp,kmatplot/dialogs/old/obsolete/ksexportdlg.kdevdlg,kmatplot/dialogs/old/obsolete/ksgriddlg.kdevdlg,kmatplot/dialogs/old/obsolete/ksimportdlgdata.cpp,kmatplot/dialogs/old/obsolete/ksimportdlg.kdevdlg,kmatplot/dialogs/old/obsolete/ksexportpictureinterf.ui,kmatplot/dialogs/old/obsolete/ksgriddlgdata.cpp,kmatplot/dialogs/old/obsolete/ksmatrixpanel.cpp,kmatplot/dialogs/old/obsolete/ksmatrixpanel.h,kmatplot/dialogs/old/obsolete/ksmatrixpanelinterf.ui,kmatplot/dialogs/old/obsolete/ksmatrixrefpanelinterf.ui,kmatplot/dialogs/old/obsolete/ksmatrixstringpanelinterf.ui, +sub_dirs= +type=normal + +[kmatplot/dialogs/old/obsolete/kmatplot.doxygen] +dist=true +install=false +install_location= +type=DATA + +[kmatplot/dialogs/old/obsolete/kmatplot.kdevprj] +dist=true +install=false +install_location= +type=DATA + +[kmatplot/dialogs/old/obsolete/kmatplot.spec] +dist=true +install=false +install_location= +type=DATA + +[kmatplot/dialogs/old/obsolete/ksdatasetsdlg.kdevdlg] +dist=true +install=false +install_location= +type=DATA + +[kmatplot/dialogs/old/obsolete/ksdeletedlg.kdevdlg] +dist=true +install=false +install_location= +type=DATA + +[kmatplot/dialogs/old/obsolete/ksdeletedlgdata.cpp] +dist=true +install=false +install_location= +type=SOURCE + +[kmatplot/dialogs/old/obsolete/ksexportdlg.kdevdlg] +dist=true +install=false +install_location= +type=DATA + +[kmatplot/dialogs/old/obsolete/ksexportdlgdata.cpp] +dist=true +install=false +install_location= +type=SOURCE + +[kmatplot/dialogs/old/obsolete/ksexportpictureinterf.ui] +dist=true +install=false +install_location= +type=SOURCE + +[kmatplot/dialogs/old/obsolete/ksgriddlg.kdevdlg] +dist=true +install=false +install_location= +type=DATA + +[kmatplot/dialogs/old/obsolete/ksgriddlgdata.cpp] +dist=true +install=false +install_location= +type=SOURCE + +[kmatplot/dialogs/old/obsolete/ksimportdlg.kdevdlg] +dist=true +install=false +install_location= +type=DATA + +[kmatplot/dialogs/old/obsolete/ksimportdlgdata.cpp] +dist=true +install=false +install_location= +type=SOURCE + +[kmatplot/dialogs/old/obsolete/ksmatrixpanel.cpp] +dist=true +install=false +install_location= +type=SOURCE + +[kmatplot/dialogs/old/obsolete/ksmatrixpanel.h] +dist=true +install=false +install_location= +type=HEADER + +[kmatplot/dialogs/old/obsolete/ksmatrixpanelinterf.ui] +dist=true +install=false +install_location= +type=SOURCE + +[kmatplot/dialogs/old/obsolete/ksmatrixrefpanelinterf.ui] +dist=true +install=false +install_location= +type=SOURCE + +[kmatplot/dialogs/old/obsolete/ksmatrixstringpanelinterf.ui] +dist=true +install=false +install_location= +type=SOURCE + +[kmatplot/dialogs/templates/KSMPanel.ui] +dist=true +install=false +install_location= +type=SOURCE + +[kmatplot/dialogs/templates/KSPanel.ui] +dist=true +install=false +install_location= +type=SOURCE + +[kmatplot/dialogs/templates/Makefile.am] +files=kmatplot/dialogs/templates/kspanel.cw,kmatplot/dialogs/templates/kspanel.png,kmatplot/dialogs/templates/KSPanel.ui,kmatplot/dialogs/templates/KSMPanel.ui, +sub_dirs= +type=normal + +[kmatplot/dialogs/templates/kspanel.cw] +dist=true +install=false +install_location= +type=DATA + +[kmatplot/dialogs/templates/kspanel.png] +dist=true +install=false +install_location= +type=DATA + +[kmatplot/docs/Makefile.am] +sub_dirs=en, +type=normal + +[kmatplot/docs/en/Makefile.am] +files=kmatplot/docs/en/index-1.html,kmatplot/docs/en/index-2.html,kmatplot/docs/en/index-3.html,kmatplot/docs/en/index-4.html,kmatplot/docs/en/index-5.html,kmatplot/docs/en/index-6.html,kmatplot/docs/en/index-7.html,kmatplot/docs/en/index.html, +sub_dirs= +type=normal + +[kmatplot/docs/en/index-1.html] +dist=true +install=false +install_location= +type=DATA + +[kmatplot/docs/en/index-2.html] +dist=true +install=false +install_location= +type=DATA + +[kmatplot/docs/en/index-3.html] +dist=true +install=false +install_location= +type=DATA + +[kmatplot/docs/en/index-4.html] +dist=true +install=false +install_location= +type=DATA + +[kmatplot/docs/en/index-5.html] +dist=true +install=false +install_location= +type=DATA + +[kmatplot/docs/en/index-6.html] +dist=true +install=false +install_location= +type=DATA + +[kmatplot/docs/en/index-7.html] +dist=true +install=false +install_location= +type=DATA + +[kmatplot/docs/en/index.html] +dist=true +install=false +install_location= +type=DATA + +[kmatplot/dtd/Makefile.am] +files=kmatplot/dtd/kmatplot.dtd, +sub_dirs= +type=normal + +[kmatplot/dtd/kmatplot.dtd] +dist=true +install=false +install_location= +type=DATA + +[kmatplot/examples/Makefile.am] +files=kmatplot/examples/contour.kmp,kmatplot/examples/path3d.kmp,kmatplot/examples/simple.kmp,kmatplot/examples/surface.kmp,kmatplot/examples/shell.kmp, +sub_dirs= +type=normal + +[kmatplot/examples/contour.kmp] +dist=true +install=false +install_location= +type=DATA + +[kmatplot/examples/path3d.kmp] +dist=true +install=false +install_location= +type=DATA + +[kmatplot/examples/shell.kmp] +dist=true +install=false +install_location= +type=DATA + +[kmatplot/examples/simple.kmp] +dist=true +install=false +install_location= +type=DATA + +[kmatplot/examples/surface.kmp] +dist=true +install=false +install_location= +type=DATA + +[kmatplot/formula/Makefile.am] +files=kmatplot/formula/mpparser.y,kmatplot/formula/mpsymbol.h,kmatplot/formula/mpsymbol.cpp,kmatplot/formula/mpsymbols.h,kmatplot/formula/mpsymbols.cpp,kmatplot/formula/mpformula.h,kmatplot/formula/mpformula.cpp,kmatplot/formula/mpparser.cpp.output,kmatplot/formula/mpparser.cpp,kmatplot/formula/mpparser.cpp.h,kmatplot/formula/mpparser.cpp.report,kmatplot/formula/make_parser.sh,kmatplot/formula/mpparsersymbol.h,kmatplot/formula/mpparsersymbol.cpp,kmatplot/formula/gramdiag,kmatplot/formula/mpdelunay.cpp,kmatplot/formula/mpdelunay.h +sub_dirs= +type=static_library + +[kmatplot/formula/gramdiag] +dist=true +install=false +install_location= +type=DATA + +[kmatplot/formula/make_parser.sh] +dist=true +install=false +install_location= +type=DATA + +[kmatplot/formula/mpdelunay.cpp] +dist=true +install=false +install_location= +type=SOURCE + +[kmatplot/formula/mpdelunay.h] +dist=true +install=false +install_location= +type=HEADER + +[kmatplot/formula/mpformula.cpp] +dist=true +install=false +install_location= +type=SOURCE + +[kmatplot/formula/mpformula.h] +dist=true +install=false +install_location= +type=HEADER + +[kmatplot/formula/mpparser.cpp] +dist=true +install=false +install_location= +type=SOURCE + +[kmatplot/formula/mpparser.cpp.h] +dist=true +install=false +install_location= +type=HEADER + +[kmatplot/formula/mpparser.cpp.output] +dist=true +install=false +install_location= +type=DATA + +[kmatplot/formula/mpparser.cpp.report] +dist=true +install=false +install_location= +type=DATA + +[kmatplot/formula/mpparser.y] +dist=true +install=false +install_location= +type=DATA + +[kmatplot/formula/mpparsersymbol.cpp] +dist=true +install=false +install_location= +type=SOURCE + +[kmatplot/formula/mpparsersymbol.h] +dist=true +install=false +install_location= +type=HEADER + +[kmatplot/formula/mpsymbol.cpp] +dist=true +install=false +install_location= +type=SOURCE + +[kmatplot/formula/mpsymbol.h] +dist=true +install=false +install_location= +type=HEADER + +[kmatplot/formula/mpsymbols.cpp] +dist=true +install=false +install_location= +type=SOURCE + +[kmatplot/formula/mpsymbols.h] +dist=true +install=false +install_location= +type=HEADER + +[kmatplot/interface/Makefile.am] +files=kmatplot/interface/common.c,kmatplot/interface/common.h,kmatplot/interface/etype.h,kmatplot/interface/msg.h, +sub_dirs= +type=normal + +[kmatplot/interface/common.c] +dist=true +install=false +install_location= +type=SOURCE + +[kmatplot/interface/common.h] +dist=true +install=false +install_location= +type=HEADER + +[kmatplot/interface/etype.h] +dist=true +install=false +install_location= +type=HEADER + +[kmatplot/interface/msg.h] +dist=true +install=false +install_location= +type=HEADER + +[kmatplot/kmatplotshell.cpp] +dist=true +install=false +install_location= +type=SOURCE + +[kmatplot/kmatplotshell.h] +dist=true +install=false +install_location= +type=HEADER + +[kmatplot/kscommands.cpp] +dist=true +install=false +install_location= +type=SOURCE + +[kmatplot/kscommands.h] +dist=true +install=false +install_location= +type=HEADER + +[kmatplot/ksdataobjectfactory.cpp] +dist=true +install=false +install_location= +type=SOURCE + +[kmatplot/ksdataobjectfactory.h] +dist=true +install=false +install_location= +type=HEADER + +[kmatplot/ksdatasymbolfactory.cpp] +dist=true +install=false +install_location= +type=SOURCE + +[kmatplot/ksdatasymbolfactory.h] +dist=true +install=false +install_location= +type=HEADER + +[kmatplot/ksglobalmatrixlist.cpp] +dist=true +install=false +install_location= +type=SOURCE + +[kmatplot/ksglobalmatrixlist.h] +dist=true +install=false +install_location= +type=HEADER + +[kmatplot/ksglobalsettings.cpp] +dist=true +install=false +install_location= +type=SOURCE + +[kmatplot/ksglobalsettings.h] +dist=true +install=false +install_location= +type=HEADER + +[kmatplot/ksmatrix.cpp] +dist=true +install=false +install_location= +type=SOURCE + +[kmatplot/ksmatrix.h] +dist=true +install=false +install_location= +type=HEADER + +[kmatplot/ksmatrixascii.cpp] +dist=true +install=false +install_location= +type=SOURCE + +[kmatplot/ksmatrixascii.h] +dist=true +install=false +install_location= +type=HEADER + +[kmatplot/ksmatrixeditor.cpp] +dist=true +install=false +install_location= +type=SOURCE + +[kmatplot/ksmatrixeditor.h] +dist=true +install=false +install_location= +type=HEADER + +[kmatplot/ksmatrixio.cpp] +dist=true +install=false +install_location= +type=SOURCE + +[kmatplot/ksmatrixio.h] +dist=true +install=false +install_location= +type=HEADER + +[kmatplot/ksmatrixiohandler.cpp] +dist=true +install=false +install_location= +type=SOURCE + +[kmatplot/ksmatrixiohandler.h] +dist=true +install=false +install_location= +type=HEADER + +[kmatplot/ksmatrixmat.cpp] +dist=true +install=false +install_location= +type=SOURCE + +[kmatplot/ksmatrixmat.h] +dist=true +install=false +install_location= +type=HEADER + +[kmatplot/ksmatrixsheet.cpp] +dist=true +install=false +install_location= +type=SOURCE + +[kmatplot/ksmatrixsheet.h] +dist=true +install=false +install_location= +type=HEADER + +[kmatplot/ksobjectfactory.cpp] +dist=true +install=false +install_location= +type=SOURCE + +[kmatplot/ksobjectfactory.h] +dist=true +install=false +install_location= +type=HEADER + +[kmatplot/kspanelmanager.cpp] +dist=true +install=false +install_location= +type=SOURCE + +[kmatplot/kspanelmanager.h] +dist=true +install=false +install_location= +type=HEADER + +[kmatplot/ksprojectxml.cpp] +dist=true +install=false +install_location= +type=SOURCE + +[kmatplot/ksprojectxml.h] +dist=true +install=false +install_location= +type=HEADER + +[kmatplot/kssocketio.cpp] +dist=true +install=false +install_location= +type=SOURCE + +[kmatplot/kssocketio.h] +dist=true +install=false +install_location= +type=HEADER + +[kmatplot/kswinpageview.cpp] +dist=true +install=false +install_location= +type=SOURCE + +[kmatplot/kswinpageview.h] +dist=true +install=false +install_location= +type=HEADER + +[kmatplot/kswinworksheet.cpp] +dist=true +install=false +install_location= +type=SOURCE + +[kmatplot/kswinworksheet.h] +dist=true +install=false +install_location= +type=HEADER + +[kmatplot/ksworkbook.cpp] +dist=true +install=false +install_location= +type=SOURCE + +[kmatplot/ksworkbook.h] +dist=true +install=false +install_location= +type=HEADER + +[kmatplot/ksworksheetdlg.cpp] +dist=true +install=false +install_location= +type=SOURCE + +[kmatplot/ksworksheetdlg.h] +dist=true +install=false +install_location= +type=HEADER + +[kmatplot/ksworkspace.cpp] +dist=true +install=false +install_location= +type=SOURCE + +[kmatplot/ksworkspace.h] +dist=true +install=false +install_location= +type=HEADER + +[kmatplot/main.cpp] +dist=true +install=false +install_location= +type=SOURCE + +[kmatplot/octave/Makefile.am] +files=kmatplot/octave/README.octave,kmatplot/octave/kadd.cpp,kmatplot/octave/kaddaxes.cpp,kmatplot/octave/kcontour.cpp,kmatplot/octave/kimage.cpp,kmatplot/octave/kmesh.cpp,kmatplot/octave/kplot.cpp,kmatplot/octave/kremove.cpp,kmatplot/octave/kremoveall.cpp,kmatplot/octave/kremoveaxes.cpp,kmatplot/octave/ksetapp.cpp,kmatplot/octave/ksetaxes.cpp,kmatplot/octave/ksetmatrix.cpp,kmatplot/octave/octave-common.h,kmatplot/octave/kplot.oct,kmatplot/octave/kimage.oct,kmatplot/octave/kcontour.oct,kmatplot/octave/kmesh.oct,kmatplot/octave/ksetapp.oct,kmatplot/octave/ksetaxes.oct,kmatplot/octave/ksetmatrix.oct,kmatplot/octave/kadd.oct,kmatplot/octave/kremove.oct,kmatplot/octave/kaddaxes.oct,kmatplot/octave/kremoveaxes.oct,kmatplot/octave/kremoveall.oct,kmatplot/octave/octave-core, +sub_dirs= +type=normal + +[kmatplot/octave/README.octave] +dist=true +install=false +install_location= +type=DATA + +[kmatplot/octave/kadd.cpp] +dist=true +install=false +install_location= +type=SOURCE + +[kmatplot/octave/kadd.oct] +dist=true +install=false +install_location= +type=DATA + +[kmatplot/octave/kaddaxes.cpp] +dist=true +install=false +install_location= +type=SOURCE + +[kmatplot/octave/kaddaxes.oct] +dist=true +install=false +install_location= +type=DATA + +[kmatplot/octave/kcontour.cpp] +dist=true +install=false +install_location= +type=SOURCE + +[kmatplot/octave/kcontour.oct] +dist=true +install=false +install_location= +type=DATA + +[kmatplot/octave/kimage.cpp] +dist=true +install=false +install_location= +type=SOURCE + +[kmatplot/octave/kimage.oct] +dist=true +install=false +install_location= +type=DATA + +[kmatplot/octave/kmesh.cpp] +dist=true +install=false +install_location= +type=SOURCE + +[kmatplot/octave/kmesh.oct] +dist=true +install=false +install_location= +type=DATA + +[kmatplot/octave/kplot.cpp] +dist=true +install=false +install_location= +type=SOURCE + +[kmatplot/octave/kplot.oct] +dist=true +install=false +install_location= +type=DATA + +[kmatplot/octave/kremove.cpp] +dist=true +install=false +install_location= +type=SOURCE + +[kmatplot/octave/kremove.oct] +dist=true +install=false +install_location= +type=DATA + +[kmatplot/octave/kremoveall.cpp] +dist=true +install=false +install_location= +type=SOURCE + +[kmatplot/octave/kremoveall.oct] +dist=true +install=false +install_location= +type=DATA + +[kmatplot/octave/kremoveaxes.cpp] +dist=true +install=false +install_location= +type=SOURCE + +[kmatplot/octave/kremoveaxes.oct] +dist=true +install=false +install_location= +type=DATA + +[kmatplot/octave/ksetapp.cpp] +dist=true +install=false +install_location= +type=SOURCE + +[kmatplot/octave/ksetapp.oct] +dist=true +install=false +install_location= +type=DATA + +[kmatplot/octave/ksetaxes.cpp] +dist=true +install=false +install_location= +type=SOURCE + +[kmatplot/octave/ksetaxes.oct] +dist=true +install=false +install_location= +type=DATA + +[kmatplot/octave/ksetmatrix.cpp] +dist=true +install=false +install_location= +type=SOURCE + +[kmatplot/octave/ksetmatrix.oct] +dist=true +install=false +install_location= +type=DATA + +[kmatplot/octave/octave-common.h] +dist=true +install=false +install_location= +type=HEADER + +[kmatplot/octave/octave-core] +dist=true +install=false +install_location= +type=DATA + +[kmatplot/part/Makefile.am] +sub_dirs= +type=normal + +[kmatplot/pics/Makefile.am] +files=kmatplot/pics/hi32-app-kmatplot.png,kmatplot/pics/hi48-app-kmatplot.png,kmatplot/pics/lo16-app-kmatplot.png,kmatplot/pics/lo32-app-kmatplot.png, +sub_dirs= +type=normal + +[kmatplot/pics/hi32-app-kmatplot.png] +dist=true +install=false +install_location= +type=DATA + +[kmatplot/pics/hi48-app-kmatplot.png] +dist=true +install=false +install_location= +type=DATA + +[kmatplot/pics/lo16-app-kmatplot.png] +dist=true +install=false +install_location= +type=DATA + +[kmatplot/pics/lo32-app-kmatplot.png] +dist=true +install=false +install_location= +type=DATA + +[kmatplot/pixmaps/.pics/Makefile.am] +sub_dirs=med, +type=normal + +[kmatplot/pixmaps/.pics/med/Makefile.am] +files=kmatplot/pixmaps/.pics/med/lo22-action-arrow.png,kmatplot/pixmaps/.pics/med/lo22-action-contour.png,kmatplot/pixmaps/.pics/med/lo22-action-curve.png,kmatplot/pixmaps/.pics/med/lo22-action-figure.png,kmatplot/pixmaps/.pics/med/lo22-action-fullpage.png,kmatplot/pixmaps/.pics/med/lo22-action-label.png,kmatplot/pixmaps/.pics/med/lo22-action-locate.png,kmatplot/pixmaps/.pics/med/lo22-action-panel_arrow.png,kmatplot/pixmaps/.pics/med/lo22-action-panel_axes.png,kmatplot/pixmaps/.pics/med/lo22-action-panel_box.png,kmatplot/pixmaps/.pics/med/lo22-action-panel_datasets.png,kmatplot/pixmaps/.pics/med/lo22-action-panel_frame.png,kmatplot/pixmaps/.pics/med/lo22-action-panel_general.png,kmatplot/pixmaps/.pics/med/lo22-action-panel_gl.png,kmatplot/pixmaps/.pics/med/lo22-action-panel_gv1.png,kmatplot/pixmaps/.pics/med/lo22-action-panel_gv2.png,kmatplot/pixmaps/.pics/med/lo22-action-panel_gx1.png,kmatplot/pixmaps/.pics/med/lo22-action-panel_gx2.png,kmatplot/pixmaps/.pics/med/lo22-action-panel_gy1.png,kmatplot/pixmaps/.pics/med/lo22-action-panel_gy2.png,kmatplot/pixmaps/.pics/med/lo22-action-panel_gz1.png,kmatplot/pixmaps/.pics/med/lo22-action-panel_gz2.png,kmatplot/pixmaps/.pics/med/lo22-action-panel_label.png,kmatplot/pixmaps/.pics/med/lo22-action-panel_legend.png,kmatplot/pixmaps/.pics/med/lo22-action-panel_light.png,kmatplot/pixmaps/.pics/med/lo22-action-panel_mesh.png,kmatplot/pixmaps/.pics/med/lo22-action-panel_more.png,kmatplot/pixmaps/.pics/med/lo22-action-panel_object.png,kmatplot/pixmaps/.pics/med/lo22-action-panel_pos1.png,kmatplot/pixmaps/.pics/med/lo22-action-panel_pos2.png,kmatplot/pixmaps/.pics/med/lo22-action-panel_position.png,kmatplot/pixmaps/.pics/med/lo22-action-panel_projection.png,kmatplot/pixmaps/.pics/med/lo22-action-panel_rect.png,kmatplot/pixmaps/.pics/med/lo22-action-panel_v1.png,kmatplot/pixmaps/.pics/med/lo22-action-panel_v2.png,kmatplot/pixmaps/.pics/med/lo22-action-panel_x1.png,kmatplot/pixmaps/.pics/med/lo22-action-panel_x2.png,kmatplot/pixmaps/.pics/med/lo22-action-panel_y1.png,kmatplot/pixmaps/.pics/med/lo22-action-panel_y2.png,kmatplot/pixmaps/.pics/med/lo22-action-panel_z1.png,kmatplot/pixmaps/.pics/med/lo22-action-panel_z2.png,kmatplot/pixmaps/.pics/med/lo22-action-pixmap.png,kmatplot/pixmaps/.pics/med/lo22-action-properties.png,kmatplot/pixmaps/.pics/med/lo22-action-rectangle.png,kmatplot/pixmaps/.pics/med/lo22-action-select.png,kmatplot/pixmaps/.pics/med/lo22-action-surface.png,kmatplot/pixmaps/.pics/med/lo22-action-zoom.png,kmatplot/pixmaps/.pics/med/blend.png,kmatplot/pixmaps/.pics/med/lo22-action-panel_contour_gradient.png,kmatplot/pixmaps/.pics/med/lo22-action-panel_figure_gradient.png,kmatplot/pixmaps/.pics/med/lo22-action-panel_pixmap_gradient.png,kmatplot/pixmaps/.pics/med/lo22-action-panel_surface_gradient.png, +sub_dirs= +type=normal + +[kmatplot/pixmaps/.pics/med/blend.png] +dist=true +install=false +install_location= +type=DATA + +[kmatplot/pixmaps/.pics/med/lo22-action-arrow.png] +dist=true +install=false +install_location= +type=DATA + +[kmatplot/pixmaps/.pics/med/lo22-action-contour.png] +dist=true +install=false +install_location= +type=DATA + +[kmatplot/pixmaps/.pics/med/lo22-action-curve.png] +dist=true +install=false +install_location= +type=DATA + +[kmatplot/pixmaps/.pics/med/lo22-action-figure.png] +dist=true +install=false +install_location= +type=DATA + +[kmatplot/pixmaps/.pics/med/lo22-action-fullpage.png] +dist=true +install=false +install_location= +type=DATA + +[kmatplot/pixmaps/.pics/med/lo22-action-label.png] +dist=true +install=false +install_location= +type=DATA + +[kmatplot/pixmaps/.pics/med/lo22-action-locate.png] +dist=true +install=false +install_location= +type=DATA + +[kmatplot/pixmaps/.pics/med/lo22-action-panel_arrow.png] +dist=true +install=false +install_location= +type=DATA + +[kmatplot/pixmaps/.pics/med/lo22-action-panel_axes.png] +dist=true +install=false +install_location= +type=DATA + +[kmatplot/pixmaps/.pics/med/lo22-action-panel_box.png] +dist=true +install=false +install_location= +type=DATA + +[kmatplot/pixmaps/.pics/med/lo22-action-panel_contour_gradient.png] +dist=true +install=false +install_location= +type=DATA + +[kmatplot/pixmaps/.pics/med/lo22-action-panel_datasets.png] +dist=true +install=false +install_location= +type=DATA + +[kmatplot/pixmaps/.pics/med/lo22-action-panel_figure_gradient.png] +dist=true +install=false +install_location= +type=DATA + +[kmatplot/pixmaps/.pics/med/lo22-action-panel_frame.png] +dist=true +install=false +install_location= +type=DATA + +[kmatplot/pixmaps/.pics/med/lo22-action-panel_general.png] +dist=true +install=false +install_location= +type=DATA + +[kmatplot/pixmaps/.pics/med/lo22-action-panel_gl.png] +dist=true +install=false +install_location= +type=DATA + +[kmatplot/pixmaps/.pics/med/lo22-action-panel_gv1.png] +dist=true +install=false +install_location= +type=DATA + +[kmatplot/pixmaps/.pics/med/lo22-action-panel_gv2.png] +dist=true +install=false +install_location= +type=DATA + +[kmatplot/pixmaps/.pics/med/lo22-action-panel_gx1.png] +dist=true +install=false +install_location= +type=DATA + +[kmatplot/pixmaps/.pics/med/lo22-action-panel_gx2.png] +dist=true +install=false +install_location= +type=DATA + +[kmatplot/pixmaps/.pics/med/lo22-action-panel_gy1.png] +dist=true +install=false +install_location= +type=DATA + +[kmatplot/pixmaps/.pics/med/lo22-action-panel_gy2.png] +dist=true +install=false +install_location= +type=DATA + +[kmatplot/pixmaps/.pics/med/lo22-action-panel_gz1.png] +dist=true +install=false +install_location= +type=DATA + +[kmatplot/pixmaps/.pics/med/lo22-action-panel_gz2.png] +dist=true +install=false +install_location= +type=DATA + +[kmatplot/pixmaps/.pics/med/lo22-action-panel_label.png] +dist=true +install=false +install_location= +type=DATA + +[kmatplot/pixmaps/.pics/med/lo22-action-panel_legend.png] +dist=true +install=false +install_location= +type=DATA + +[kmatplot/pixmaps/.pics/med/lo22-action-panel_light.png] +dist=true +install=false +install_location= +type=DATA + +[kmatplot/pixmaps/.pics/med/lo22-action-panel_mesh.png] +dist=true +install=false +install_location= +type=DATA + +[kmatplot/pixmaps/.pics/med/lo22-action-panel_more.png] +dist=true +install=false +install_location= +type=DATA + +[kmatplot/pixmaps/.pics/med/lo22-action-panel_object.png] +dist=true +install=false +install_location= +type=DATA + +[kmatplot/pixmaps/.pics/med/lo22-action-panel_pixmap_gradient.png] +dist=true +install=false +install_location= +type=DATA + +[kmatplot/pixmaps/.pics/med/lo22-action-panel_pos1.png] +dist=true +install=false +install_location= +type=DATA + +[kmatplot/pixmaps/.pics/med/lo22-action-panel_pos2.png] +dist=true +install=false +install_location= +type=DATA + +[kmatplot/pixmaps/.pics/med/lo22-action-panel_position.png] +dist=true +install=false +install_location= +type=DATA + +[kmatplot/pixmaps/.pics/med/lo22-action-panel_projection.png] +dist=true +install=false +install_location= +type=DATA + +[kmatplot/pixmaps/.pics/med/lo22-action-panel_rect.png] +dist=true +install=false +install_location= +type=DATA + +[kmatplot/pixmaps/.pics/med/lo22-action-panel_surface_gradient.png] +dist=true +install=false +install_location= +type=DATA + +[kmatplot/pixmaps/.pics/med/lo22-action-panel_v1.png] +dist=true +install=false +install_location= +type=DATA + +[kmatplot/pixmaps/.pics/med/lo22-action-panel_v2.png] +dist=true +install=false +install_location= +type=DATA + +[kmatplot/pixmaps/.pics/med/lo22-action-panel_x1.png] +dist=true +install=false +install_location= +type=DATA + +[kmatplot/pixmaps/.pics/med/lo22-action-panel_x2.png] +dist=true +install=false +install_location= +type=DATA + +[kmatplot/pixmaps/.pics/med/lo22-action-panel_y1.png] +dist=true +install=false +install_location= +type=DATA + +[kmatplot/pixmaps/.pics/med/lo22-action-panel_y2.png] +dist=true +install=false +install_location= +type=DATA + +[kmatplot/pixmaps/.pics/med/lo22-action-panel_z1.png] +dist=true +install=false +install_location= +type=DATA + +[kmatplot/pixmaps/.pics/med/lo22-action-panel_z2.png] +dist=true +install=false +install_location= +type=DATA + +[kmatplot/pixmaps/.pics/med/lo22-action-pixmap.png] +dist=true +install=false +install_location= +type=DATA + +[kmatplot/pixmaps/.pics/med/lo22-action-properties.png] +dist=true +install=false +install_location= +type=DATA + +[kmatplot/pixmaps/.pics/med/lo22-action-rectangle.png] +dist=true +install=false +install_location= +type=DATA + +[kmatplot/pixmaps/.pics/med/lo22-action-select.png] +dist=true +install=false +install_location= +type=DATA + +[kmatplot/pixmaps/.pics/med/lo22-action-surface.png] +dist=true +install=false +install_location= +type=DATA + +[kmatplot/pixmaps/.pics/med/lo22-action-zoom.png] +dist=true +install=false +install_location= +type=DATA + +[kmatplot/pixmaps/.xvpics/Makefile.am] +files=kmatplot/pixmaps/.xvpics/lo22-action-panel_contour_gradient.png,kmatplot/pixmaps/.xvpics/lo22-action-panel_figure_gradient.png,kmatplot/pixmaps/.xvpics/lo22-action-panel_pixmap_gradient.png,kmatplot/pixmaps/.xvpics/lo22-action-panel_surface_gradient.png,kmatplot/pixmaps/.xvpics/lo22-action-panel_gradient.png,kmatplot/pixmaps/.xvpics/lo22-action-panel_gv.png, +sub_dirs= +type=normal + +[kmatplot/pixmaps/.xvpics/lo22-action-panel_contour_gradient.png] +dist=true +install=false +install_location= +type=DATA + +[kmatplot/pixmaps/.xvpics/lo22-action-panel_figure_gradient.png] +dist=true +install=false +install_location= +type=DATA + +[kmatplot/pixmaps/.xvpics/lo22-action-panel_gradient.png] +dist=true +install=false +install_location= +type=DATA + +[kmatplot/pixmaps/.xvpics/lo22-action-panel_gv.png] +dist=true +install=false +install_location= +type=DATA + +[kmatplot/pixmaps/.xvpics/lo22-action-panel_pixmap_gradient.png] +dist=true +install=false +install_location= +type=DATA + +[kmatplot/pixmaps/.xvpics/lo22-action-panel_surface_gradient.png] +dist=true +install=false +install_location= +type=DATA + +[kmatplot/pixmaps/Makefile.am] +files=kmatplot/pixmaps/action_curve.png,kmatplot/pixmaps/action_figure.png,kmatplot/pixmaps/action_fullpage.png,kmatplot/pixmaps/action_label.png,kmatplot/pixmaps/action_locate.png,kmatplot/pixmaps/panel_arrow.png,kmatplot/pixmaps/panel_axes.png,kmatplot/pixmaps/action_zoom.png,kmatplot/pixmaps/panel_box.png,kmatplot/pixmaps/panel_general.png,kmatplot/pixmaps/panel_frame.png,kmatplot/pixmaps/panel_datasets.png,kmatplot/pixmaps/cvs.sh,kmatplot/pixmaps/action_new.png,kmatplot/pixmaps/panel_object.png,kmatplot/pixmaps/convert.pl,kmatplot/pixmaps/action_toback.png,kmatplot/pixmaps/panel_z.png,kmatplot/pixmaps/panel_label.png,kmatplot/pixmaps/panel_gz.png,kmatplot/pixmaps/action_surface.png,kmatplot/pixmaps/action_pixmap.png,kmatplot/pixmaps/panel_x.png,kmatplot/pixmaps/panel_view.png,kmatplot/pixmaps/action_rectangle.png,kmatplot/pixmaps/panel_gl.png,kmatplot/pixmaps/panel_mesh.png,kmatplot/pixmaps/panel_more.png,kmatplot/pixmaps/panel_position.png,kmatplot/pixmaps/panel_gx.png,kmatplot/pixmaps/panel_gv.png,kmatplot/pixmaps/action_select.png,kmatplot/pixmaps/action_properties.png,kmatplot/pixmaps/panel_gradient.png,kmatplot/pixmaps/panel_y.png,kmatplot/pixmaps/action_lower.png,kmatplot/pixmaps/panel_gy.png,kmatplot/pixmaps/action_copy.png,kmatplot/pixmaps/action_cut.png,kmatplot/pixmaps/panel_legend.png,kmatplot/pixmaps/panel_pos1.png,kmatplot/pixmaps/panel_pos2.png,kmatplot/pixmaps/panel_rect.png,kmatplot/pixmaps/panel_v.png,kmatplot/pixmaps/panel_light.png,kmatplot/pixmaps/panel_z.xpm,kmatplot/pixmaps/action_contour.png,kmatplot/pixmaps/action_delete.png,kmatplot/pixmaps/action_paste.png,kmatplot/pixmaps/action_exit.png,kmatplot/pixmaps/action_open.png,kmatplot/pixmaps/action_print.png,kmatplot/pixmaps/action_save.png,kmatplot/pixmaps/action_redo.png,kmatplot/pixmaps/action_tofront.png,kmatplot/pixmaps/action_undo.png,kmatplot/pixmaps/action_wizard.png,kmatplot/pixmaps/action_raise.png,kmatplot/pixmaps/action_curve.xpm,kmatplot/pixmaps/action_figure.xpm,kmatplot/pixmaps/action_fullpage.xpm,kmatplot/pixmaps/action_label.xpm,kmatplot/pixmaps/action_locate.xpm,kmatplot/pixmaps/panel_arrow.xpm,kmatplot/pixmaps/panel_axes.xpm,kmatplot/pixmaps/action_zoom.xpm,kmatplot/pixmaps/panel_box.xpm,kmatplot/pixmaps/panel_general.xpm,kmatplot/pixmaps/panel_frame.xpm,kmatplot/pixmaps/action_arrow.png,kmatplot/pixmaps/panel_datasets.xpm,kmatplot/pixmaps/action_new.xpm,kmatplot/pixmaps/panel_object.xpm,kmatplot/pixmaps/action_toback.xpm,kmatplot/pixmaps/panel_label.xpm,kmatplot/pixmaps/panel_gz.xpm,kmatplot/pixmaps/action_surface.xpm,kmatplot/pixmaps/action_pixmap.xpm,kmatplot/pixmaps/panel_x.xpm,kmatplot/pixmaps/panel_view.xpm,kmatplot/pixmaps/action_rectangle.xpm,kmatplot/pixmaps/panel_gl.xpm,kmatplot/pixmaps/panel_mesh.xpm,kmatplot/pixmaps/panel_more.xpm,kmatplot/pixmaps/panel_position.xpm,kmatplot/pixmaps/panel_gx.xpm,kmatplot/pixmaps/panel_gv.xpm,kmatplot/pixmaps/action_select.xpm,kmatplot/pixmaps/action_properties.xpm,kmatplot/pixmaps/panel_gradient.xpm,kmatplot/pixmaps/panel_y.xpm,kmatplot/pixmaps/action_lower.xpm,kmatplot/pixmaps/panel_gy.xpm,kmatplot/pixmaps/action_copy.xpm,kmatplot/pixmaps/action_cut.xpm,kmatplot/pixmaps/panel_legend.xpm,kmatplot/pixmaps/panel_pos1.xpm,kmatplot/pixmaps/panel_pos2.xpm,kmatplot/pixmaps/panel_rect.xpm,kmatplot/pixmaps/panel_v.xpm,kmatplot/pixmaps/panel_light.xpm,kmatplot/pixmaps/action_contour.xpm,kmatplot/pixmaps/action_delete.xpm,kmatplot/pixmaps/action_paste.xpm,kmatplot/pixmaps/action_exit.xpm,kmatplot/pixmaps/action_open.xpm,kmatplot/pixmaps/action_print.xpm,kmatplot/pixmaps/action_save.xpm,kmatplot/pixmaps/action_redo.xpm,kmatplot/pixmaps/action_tofront.xpm,kmatplot/pixmaps/action_undo.xpm,kmatplot/pixmaps/action_wizard.xpm,kmatplot/pixmaps/action_raise.xpm,kmatplot/pixmaps/action_arrow.xpm,kmatplot/pixmaps/alpha_mask.ppm, +sub_dirs=old, +type=normal + +[kmatplot/pixmaps/action_arrow.png] +dist=true +install=false +install_location= +type=DATA + +[kmatplot/pixmaps/action_arrow.xpm] +dist=true +install=false +install_location= +type=DATA + +[kmatplot/pixmaps/action_contour.png] +dist=true +install=false +install_location= +type=DATA + +[kmatplot/pixmaps/action_contour.xpm] +dist=true +install=false +install_location= +type=DATA + +[kmatplot/pixmaps/action_copy.png] +dist=true +install=false +install_location= +type=DATA + +[kmatplot/pixmaps/action_copy.xpm] +dist=true +install=false +install_location= +type=DATA + +[kmatplot/pixmaps/action_curve.png] +dist=true +install=false +install_location= +type=DATA + +[kmatplot/pixmaps/action_curve.xpm] +dist=true +install=false +install_location= +type=DATA + +[kmatplot/pixmaps/action_cut.png] +dist=true +install=false +install_location= +type=DATA + +[kmatplot/pixmaps/action_cut.xpm] +dist=true +install=false +install_location= +type=DATA + +[kmatplot/pixmaps/action_delete.png] +dist=true +install=false +install_location= +type=DATA + +[kmatplot/pixmaps/action_delete.xpm] +dist=true +install=false +install_location= +type=DATA + +[kmatplot/pixmaps/action_exit.png] +dist=true +install=false +install_location= +type=DATA + +[kmatplot/pixmaps/action_exit.xpm] +dist=true +install=false +install_location= +type=DATA + +[kmatplot/pixmaps/action_figure.png] +dist=true +install=false +install_location= +type=DATA + +[kmatplot/pixmaps/action_figure.xpm] +dist=true +install=false +install_location= +type=DATA + +[kmatplot/pixmaps/action_fullpage.png] +dist=true +install=false +install_location= +type=DATA + +[kmatplot/pixmaps/action_fullpage.xpm] +dist=true +install=false +install_location= +type=DATA + +[kmatplot/pixmaps/action_label.png] +dist=true +install=false +install_location= +type=DATA + +[kmatplot/pixmaps/action_label.xpm] +dist=true +install=false +install_location= +type=DATA + +[kmatplot/pixmaps/action_locate.png] +dist=true +install=false +install_location= +type=DATA + +[kmatplot/pixmaps/action_locate.xpm] +dist=true +install=false +install_location= +type=DATA + +[kmatplot/pixmaps/action_lower.png] +dist=true +install=false +install_location= +type=DATA + +[kmatplot/pixmaps/action_lower.xpm] +dist=true +install=false +install_location= +type=DATA + +[kmatplot/pixmaps/action_new.png] +dist=true +install=false +install_location= +type=DATA + +[kmatplot/pixmaps/action_new.xpm] +dist=true +install=false +install_location= +type=DATA + +[kmatplot/pixmaps/action_open.png] +dist=true +install=false +install_location= +type=DATA + +[kmatplot/pixmaps/action_open.xpm] +dist=true +install=false +install_location= +type=DATA + +[kmatplot/pixmaps/action_paste.png] +dist=true +install=false +install_location= +type=DATA + +[kmatplot/pixmaps/action_paste.xpm] +dist=true +install=false +install_location= +type=DATA + +[kmatplot/pixmaps/action_pixmap.png] +dist=true +install=false +install_location= +type=DATA + +[kmatplot/pixmaps/action_pixmap.xpm] +dist=true +install=false +install_location= +type=DATA + +[kmatplot/pixmaps/action_print.png] +dist=true +install=false +install_location= +type=DATA + +[kmatplot/pixmaps/action_print.xpm] +dist=true +install=false +install_location= +type=DATA + +[kmatplot/pixmaps/action_properties.png] +dist=true +install=false +install_location= +type=DATA + +[kmatplot/pixmaps/action_properties.xpm] +dist=true +install=false +install_location= +type=DATA + +[kmatplot/pixmaps/action_raise.png] +dist=true +install=false +install_location= +type=DATA + +[kmatplot/pixmaps/action_raise.xpm] +dist=true +install=false +install_location= +type=DATA + +[kmatplot/pixmaps/action_rectangle.png] +dist=true +install=false +install_location= +type=DATA + +[kmatplot/pixmaps/action_rectangle.xpm] +dist=true +install=false +install_location= +type=DATA + +[kmatplot/pixmaps/action_redo.png] +dist=true +install=false +install_location= +type=DATA + +[kmatplot/pixmaps/action_redo.xpm] +dist=true +install=false +install_location= +type=DATA + +[kmatplot/pixmaps/action_save.png] +dist=true +install=false +install_location= +type=DATA + +[kmatplot/pixmaps/action_save.xpm] +dist=true +install=false +install_location= +type=DATA + +[kmatplot/pixmaps/action_select.png] +dist=true +install=false +install_location= +type=DATA + +[kmatplot/pixmaps/action_select.xpm] +dist=true +install=false +install_location= +type=DATA + +[kmatplot/pixmaps/action_surface.png] +dist=true +install=false +install_location= +type=DATA + +[kmatplot/pixmaps/action_surface.xpm] +dist=true +install=false +install_location= +type=DATA + +[kmatplot/pixmaps/action_toback.png] +dist=true +install=false +install_location= +type=DATA + +[kmatplot/pixmaps/action_toback.xpm] +dist=true +install=false +install_location= +type=DATA + +[kmatplot/pixmaps/action_tofront.png] +dist=true +install=false +install_location= +type=DATA + +[kmatplot/pixmaps/action_tofront.xpm] +dist=true +install=false +install_location= +type=DATA + +[kmatplot/pixmaps/action_undo.png] +dist=true +install=false +install_location= +type=DATA + +[kmatplot/pixmaps/action_undo.xpm] +dist=true +install=false +install_location= +type=DATA + +[kmatplot/pixmaps/action_wizard.png] +dist=true +install=false +install_location= +type=DATA + +[kmatplot/pixmaps/action_wizard.xpm] +dist=true +install=false +install_location= +type=DATA + +[kmatplot/pixmaps/action_zoom.png] +dist=true +install=false +install_location= +type=DATA + +[kmatplot/pixmaps/action_zoom.xpm] +dist=true +install=false +install_location= +type=DATA + +[kmatplot/pixmaps/alpha_mask.ppm] +dist=true +install=false +install_location= +type=DATA + +[kmatplot/pixmaps/convert.pl] +dist=true +install=false +install_location= +type=DATA + +[kmatplot/pixmaps/cvs.sh] +dist=true +install=false +install_location= +type=DATA + +[kmatplot/pixmaps/old/Makefile.am] +files=kmatplot/pixmaps/old/action_locate.png,kmatplot/pixmaps/old/action_zoom.png,kmatplot/pixmaps/old/action_fullpage.png,kmatplot/pixmaps/old/action_properties.png,kmatplot/pixmaps/old/colorize.png,kmatplot/pixmaps/old/klpq.png,kmatplot/pixmaps/old/old , +sub_dirs= +type=normal + +[kmatplot/pixmaps/old/action_fullpage.png] +dist=true +install=false +install_location= +type=DATA + +[kmatplot/pixmaps/old/action_locate.png] +dist=true +install=false +install_location= +type=DATA + +[kmatplot/pixmaps/old/action_properties.png] +dist=true +install=false +install_location= +type=DATA + +[kmatplot/pixmaps/old/action_zoom.png] +dist=true +install=false +install_location= +type=DATA + +[kmatplot/pixmaps/old/colorize.png] +dist=true +install=false +install_location= +type=DATA + +[kmatplot/pixmaps/old/klpq.png] +dist=true +install=false +install_location= +type=DATA + +[kmatplot/pixmaps/old/old ] +dist=true +install=false +install_location= +type=DATA + +[kmatplot/pixmaps/panel_arrow.png] +dist=true +install=false +install_location= +type=DATA + +[kmatplot/pixmaps/panel_arrow.xpm] +dist=true +install=false +install_location= +type=DATA + +[kmatplot/pixmaps/panel_axes.png] +dist=true +install=false +install_location= +type=DATA + +[kmatplot/pixmaps/panel_axes.xpm] +dist=true +install=false +install_location= +type=DATA + +[kmatplot/pixmaps/panel_box.png] +dist=true +install=false +install_location= +type=DATA + +[kmatplot/pixmaps/panel_box.xpm] +dist=true +install=false +install_location= +type=DATA + +[kmatplot/pixmaps/panel_datasets.png] +dist=true +install=false +install_location= +type=DATA + +[kmatplot/pixmaps/panel_datasets.xpm] +dist=true +install=false +install_location= +type=DATA + +[kmatplot/pixmaps/panel_frame.png] +dist=true +install=false +install_location= +type=DATA + +[kmatplot/pixmaps/panel_frame.xpm] +dist=true +install=false +install_location= +type=DATA + +[kmatplot/pixmaps/panel_general.png] +dist=true +install=false +install_location= +type=DATA + +[kmatplot/pixmaps/panel_general.xpm] +dist=true +install=false +install_location= +type=DATA + +[kmatplot/pixmaps/panel_gl.png] +dist=true +install=false +install_location= +type=DATA + +[kmatplot/pixmaps/panel_gl.xpm] +dist=true +install=false +install_location= +type=DATA + +[kmatplot/pixmaps/panel_gradient.png] +dist=true +install=false +install_location= +type=DATA + +[kmatplot/pixmaps/panel_gradient.xpm] +dist=true +install=false +install_location= +type=DATA + +[kmatplot/pixmaps/panel_gv.png] +dist=true +install=false +install_location= +type=DATA + +[kmatplot/pixmaps/panel_gv.xpm] +dist=true +install=false +install_location= +type=DATA + +[kmatplot/pixmaps/panel_gx.png] +dist=true +install=false +install_location= +type=DATA + +[kmatplot/pixmaps/panel_gx.xpm] +dist=true +install=false +install_location= +type=DATA + +[kmatplot/pixmaps/panel_gy.png] +dist=true +install=false +install_location= +type=DATA + +[kmatplot/pixmaps/panel_gy.xpm] +dist=true +install=false +install_location= +type=DATA + +[kmatplot/pixmaps/panel_gz.png] +dist=true +install=false +install_location= +type=DATA + +[kmatplot/pixmaps/panel_gz.xpm] +dist=true +install=false +install_location= +type=DATA + +[kmatplot/pixmaps/panel_label.png] +dist=true +install=false +install_location= +type=DATA + +[kmatplot/pixmaps/panel_label.xpm] +dist=true +install=false +install_location= +type=DATA + +[kmatplot/pixmaps/panel_legend.png] +dist=true +install=false +install_location= +type=DATA + +[kmatplot/pixmaps/panel_legend.xpm] +dist=true +install=false +install_location= +type=DATA + +[kmatplot/pixmaps/panel_light.png] +dist=true +install=false +install_location= +type=DATA + +[kmatplot/pixmaps/panel_light.xpm] +dist=true +install=false +install_location= +type=DATA + +[kmatplot/pixmaps/panel_mesh.png] +dist=true +install=false +install_location= +type=DATA + +[kmatplot/pixmaps/panel_mesh.xpm] +dist=true +install=false +install_location= +type=DATA + +[kmatplot/pixmaps/panel_more.png] +dist=true +install=false +install_location= +type=DATA + +[kmatplot/pixmaps/panel_more.xpm] +dist=true +install=false +install_location= +type=DATA + +[kmatplot/pixmaps/panel_object.png] +dist=true +install=false +install_location= +type=DATA + +[kmatplot/pixmaps/panel_object.xpm] +dist=true +install=false +install_location= +type=DATA + +[kmatplot/pixmaps/panel_pos1.png] +dist=true +install=false +install_location= +type=DATA + +[kmatplot/pixmaps/panel_pos1.xpm] +dist=true +install=false +install_location= +type=DATA + +[kmatplot/pixmaps/panel_pos2.png] +dist=true +install=false +install_location= +type=DATA + +[kmatplot/pixmaps/panel_pos2.xpm] +dist=true +install=false +install_location= +type=DATA + +[kmatplot/pixmaps/panel_position.png] +dist=true +install=false +install_location= +type=DATA + +[kmatplot/pixmaps/panel_position.xpm] +dist=true +install=false +install_location= +type=DATA + +[kmatplot/pixmaps/panel_rect.png] +dist=true +install=false +install_location= +type=DATA + +[kmatplot/pixmaps/panel_rect.xpm] +dist=true +install=false +install_location= +type=DATA + +[kmatplot/pixmaps/panel_v.png] +dist=true +install=false +install_location= +type=DATA + +[kmatplot/pixmaps/panel_v.xpm] +dist=true +install=false +install_location= +type=DATA + +[kmatplot/pixmaps/panel_view.png] +dist=true +install=false +install_location= +type=DATA + +[kmatplot/pixmaps/panel_view.xpm] +dist=true +install=false +install_location= +type=DATA + +[kmatplot/pixmaps/panel_x.png] +dist=true +install=false +install_location= +type=DATA + +[kmatplot/pixmaps/panel_x.xpm] +dist=true +install=false +install_location= +type=DATA + +[kmatplot/pixmaps/panel_y.png] +dist=true +install=false +install_location= +type=DATA + +[kmatplot/pixmaps/panel_y.xpm] +dist=true +install=false +install_location= +type=DATA + +[kmatplot/pixmaps/panel_z.png] +dist=true +install=false +install_location= +type=DATA + +[kmatplot/pixmaps/panel_z.xpm] +dist=true +install=false +install_location= +type=DATA + +[kmatplot/python/KMatplot.py] +dist=true +install=false +install_location= +type=DATA + +[kmatplot/python/Makefile.am] +files=kmatplot/python/kplot.py,kmatplot/python/_kplot.py,kmatplot/python/KMatplot.py,kmatplot/python/kplot.pth,kmatplot/python/README.python,kmatplot/python/paths.py, +sub_dirs= +type=normal + +[kmatplot/python/README.python] +dist=true +install=false +install_location= +type=DATA + +[kmatplot/python/_kplot.py] +dist=true +install=false +install_location= +type=DATA + +[kmatplot/python/kplot.pth] +dist=true +install=false +install_location= +type=DATA + +[kmatplot/python/kplot.py] +dist=true +install=false +install_location= +type=DATA + +[kmatplot/python/paths.py] +dist=true +install=false +install_location= +type=DATA + +[kmatplot/qscobjects.cpp] +dist=true +install=false +install_location= +type=SOURCE + +[kmatplot/qscobjects.h] +dist=true +install=false +install_location= +type=HEADER + +[kmatplot/qsctools.cpp] +dist=true +install=false +install_location= +type=SOURCE + +[kmatplot/qsctools.h] +dist=true +install=false +install_location= +type=HEADER + +[kmatplot/scilab/Makefile.am] +files=kmatplot/scilab/README.Scilab,kmatplot/scilab/kcontour.sci,kmatplot/scilab/kimage.sci,kmatplot/scilab/kmesh.sci,kmatplot/scilab/kplot.sci,kmatplot/scilab/plots.c,kmatplot/scilab/plots.sci, +sub_dirs= +type=normal + +[kmatplot/scilab/README.Scilab] +dist=true +install=false +install_location= +type=DATA + +[kmatplot/scilab/kcontour.sci] +dist=true +install=false +install_location= +type=DATA + +[kmatplot/scilab/kimage.sci] +dist=true +install=false +install_location= +type=DATA + +[kmatplot/scilab/kmesh.sci] +dist=true +install=false +install_location= +type=DATA + +[kmatplot/scilab/kplot.sci] +dist=true +install=false +install_location= +type=DATA + +[kmatplot/scilab/plots.c] +dist=true +install=false +install_location= +type=SOURCE + +[kmatplot/scilab/plots.sci] +dist=true +install=false +install_location= +type=DATA + +[kmatplot/toolbar.directory] +dist=true +install=false +install_location= +type=DATA + +[kmatplot/toolbar/Makefile.am] +sub_dirs= +type=normal + +[kmatplot/widgets/Makefile.am] +files=kmatplot/widgets/qsprojection3d.h,kmatplot/widgets/qsprojection3d.cpp,kmatplot/widgets/qsaxes.cpp,kmatplot/widgets/qsaxes.h,kmatplot/widgets/qsaxes2d.cpp,kmatplot/widgets/qsaxes2d.h,kmatplot/widgets/qsaxes3d.cpp,kmatplot/widgets/qsaxes3d.h,kmatplot/widgets/qsclegend.cpp,kmatplot/widgets/qsclegend.h,kmatplot/widgets/qscobject.cpp,kmatplot/widgets/qscobject.h,kmatplot/widgets/qscontour.cpp,kmatplot/widgets/qscontour.h,kmatplot/widgets/qscoord.cpp,kmatplot/widgets/qscoord.h,kmatplot/widgets/qsctool.cpp,kmatplot/widgets/qsctool.h,kmatplot/widgets/qscurve.cpp,kmatplot/widgets/qscurve.h,kmatplot/widgets/qsdrv.cpp,kmatplot/widgets/qsdrv.h,kmatplot/widgets/qsdrvopengl.cpp,kmatplot/widgets/qsdrvopengl.h,kmatplot/widgets/qsdrvqt.cpp,kmatplot/widgets/qsdrvqt.h,kmatplot/widgets/qsfigure.cpp,kmatplot/widgets/qsfigure.h,kmatplot/widgets/qsgattr.cpp,kmatplot/widgets/qsgattr.h,kmatplot/widgets/qsimage.cpp,kmatplot/widgets/qsimage.h,kmatplot/widgets/qsmatrix.h,kmatplot/widgets/qsplot.cpp,kmatplot/widgets/qsplot.h,kmatplot/widgets/qsplotview.cpp,kmatplot/widgets/qsplotview.h,kmatplot/widgets/qssegment.cpp,kmatplot/widgets/qssegment.h,kmatplot/widgets/qssurface.cpp,kmatplot/widgets/qssurface.h,kmatplot/widgets/qsdata.h,kmatplot/widgets/qschildlist.h,kmatplot/widgets/qsaxis.h,kmatplot/widgets/qsmatrix.cpp,kmatplot/widgets/qsworkbook.h,kmatplot/widgets/qsdata.cpp,kmatplot/widgets/qsaxis.cpp,kmatplot/widgets/qsruler.h,kmatplot/widgets/qsgraphicaldata.h,kmatplot/widgets/qsprojection.h,kmatplot/widgets/qsprojection.cpp,kmatplot/widgets/qsruler.cpp,kmatplot/widgets/qsdrvhittest.h,kmatplot/widgets/qsgraphicaldata.cpp,kmatplot/widgets/qsprojection2d.h,kmatplot/widgets/qsprojection2d.cpp,kmatplot/widgets/qsdrvhittest.cpp,kmatplot/widgets/qsworkbook.cpp,kmatplot/widgets/qsserializable.h,kmatplot/widgets/qsserializable.cpp,kmatplot/widgets/qsconsole.cpp,kmatplot/widgets/qsconsole.h +sub_dirs= +type=static_library + +[kmatplot/widgets/qsaxes.cpp] +dist=true +install=false +install_location= +type=SOURCE + +[kmatplot/widgets/qsaxes.h] +dist=true +install=false +install_location= +type=HEADER + +[kmatplot/widgets/qsaxes2d.cpp] +dist=true +install=false +install_location= +type=SOURCE + +[kmatplot/widgets/qsaxes2d.h] +dist=true +install=false +install_location= +type=HEADER + +[kmatplot/widgets/qsaxes3d.cpp] +dist=true +install=false +install_location= +type=SOURCE + +[kmatplot/widgets/qsaxes3d.h] +dist=true +install=false +install_location= +type=HEADER + +[kmatplot/widgets/qsaxis.cpp] +dist=true +install=false +install_location= +type=SOURCE + +[kmatplot/widgets/qsaxis.h] +dist=true +install=false +install_location= +type=HEADER + +[kmatplot/widgets/qschildlist.h] +dist=true +install=false +install_location= +type=HEADER + +[kmatplot/widgets/qsclegend.cpp] +dist=true +install=false +install_location= +type=SOURCE + +[kmatplot/widgets/qsclegend.h] +dist=true +install=false +install_location= +type=HEADER + +[kmatplot/widgets/qscobject.cpp] +dist=true +install=false +install_location= +type=SOURCE + +[kmatplot/widgets/qscobject.h] +dist=true +install=false +install_location= +type=HEADER + +[kmatplot/widgets/qsconsole.cpp] +dist=true +install=false +install_location= +type=SOURCE + +[kmatplot/widgets/qsconsole.h] +dist=true +install=false +install_location= +type=HEADER + +[kmatplot/widgets/qscontour.cpp] +dist=true +install=false +install_location= +type=SOURCE + +[kmatplot/widgets/qscontour.h] +dist=true +install=false +install_location= +type=HEADER + +[kmatplot/widgets/qscoord.cpp] +dist=true +install=false +install_location= +type=SOURCE + +[kmatplot/widgets/qscoord.h] +dist=true +install=false +install_location= +type=HEADER + +[kmatplot/widgets/qsctool.cpp] +dist=true +install=false +install_location= +type=SOURCE + +[kmatplot/widgets/qsctool.h] +dist=true +install=false +install_location= +type=HEADER + +[kmatplot/widgets/qscurve.cpp] +dist=true +install=false +install_location= +type=SOURCE + +[kmatplot/widgets/qscurve.h] +dist=true +install=false +install_location= +type=HEADER + +[kmatplot/widgets/qsdata.cpp] +dist=true +install=false +install_location= +type=SOURCE + +[kmatplot/widgets/qsdata.h] +dist=true +install=false +install_location= +type=HEADER + +[kmatplot/widgets/qsdrv.cpp] +dist=true +install=false +install_location= +type=SOURCE + +[kmatplot/widgets/qsdrv.h] +dist=true +install=false +install_location= +type=HEADER + +[kmatplot/widgets/qsdrvhittest.cpp] +dist=true +install=false +install_location= +type=SOURCE + +[kmatplot/widgets/qsdrvhittest.h] +dist=true +install=false +install_location= +type=HEADER + +[kmatplot/widgets/qsdrvopengl.cpp] +dist=true +install=false +install_location= +type=SOURCE + +[kmatplot/widgets/qsdrvopengl.h] +dist=true +install=false +install_location= +type=HEADER + +[kmatplot/widgets/qsdrvqt.cpp] +dist=true +install=false +install_location= +type=SOURCE + +[kmatplot/widgets/qsdrvqt.h] +dist=true +install=false +install_location= +type=HEADER + +[kmatplot/widgets/qsfigure.cpp] +dist=true +install=false +install_location= +type=SOURCE + +[kmatplot/widgets/qsfigure.h] +dist=true +install=false +install_location= +type=HEADER + +[kmatplot/widgets/qsgattr.cpp] +dist=true +install=false +install_location= +type=SOURCE + +[kmatplot/widgets/qsgattr.h] +dist=true +install=false +install_location= +type=HEADER + +[kmatplot/widgets/qsgraphicaldata.cpp] +dist=true +install=false +install_location= +type=SOURCE + +[kmatplot/widgets/qsgraphicaldata.h] +dist=true +install=false +install_location= +type=HEADER + +[kmatplot/widgets/qsimage.cpp] +dist=true +install=false +install_location= +type=SOURCE + +[kmatplot/widgets/qsimage.h] +dist=true +install=false +install_location= +type=HEADER + +[kmatplot/widgets/qsmatrix.cpp] +dist=true +install=false +install_location= +type=SOURCE + +[kmatplot/widgets/qsmatrix.h] +dist=true +install=false +install_location= +type=HEADER + +[kmatplot/widgets/qsplot.cpp] +dist=true +install=false +install_location= +type=SOURCE + +[kmatplot/widgets/qsplot.h] +dist=true +install=false +install_location= +type=HEADER + +[kmatplot/widgets/qsplotview.cpp] +dist=true +install=false +install_location= +type=SOURCE + +[kmatplot/widgets/qsplotview.h] +dist=true +install=false +install_location= +type=HEADER + +[kmatplot/widgets/qsprojection.cpp] +dist=true +install=false +install_location= +type=SOURCE + +[kmatplot/widgets/qsprojection.h] +dist=true +install=false +install_location= +type=HEADER + +[kmatplot/widgets/qsprojection2d.cpp] +dist=true +install=false +install_location= +type=SOURCE + +[kmatplot/widgets/qsprojection2d.h] +dist=true +install=false +install_location= +type=HEADER + +[kmatplot/widgets/qsprojection3d.cpp] +dist=true +install=false +install_location= +type=SOURCE + +[kmatplot/widgets/qsprojection3d.h] +dist=true +install=false +install_location= +type=HEADER + +[kmatplot/widgets/qsruler.cpp] +dist=true +install=false +install_location= +type=SOURCE + +[kmatplot/widgets/qsruler.h] +dist=true +install=false +install_location= +type=HEADER + +[kmatplot/widgets/qssegment.cpp] +dist=true +install=false +install_location= +type=SOURCE + +[kmatplot/widgets/qssegment.h] +dist=true +install=false +install_location= +type=HEADER + +[kmatplot/widgets/qsserializable.cpp] +dist=true +install=false +install_location= +type=SOURCE + +[kmatplot/widgets/qsserializable.h] +dist=true +install=false +install_location= +type=HEADER + +[kmatplot/widgets/qssurface.cpp] +dist=true +install=false +install_location= +type=SOURCE + +[kmatplot/widgets/qssurface.h] +dist=true +install=false +install_location= +type=HEADER + +[kmatplot/widgets/qsworkbook.cpp] +dist=true +install=false +install_location= +type=SOURCE + +[kmatplot/widgets/qsworkbook.h] +dist=true +install=false +install_location= +type=HEADER + +[other/.xvpics/Makefile.am] +files=other/.xvpics/kspanel.png, +sub_dirs= +type=normal + +[other/.xvpics/kspanel.png] +dist=true +install=false +install_location= +type=DATA + +[other/Makefile.am] +files=other/TODO.detail,other/TODO.detail2,other/path3d.kmp,other/surface.kmp,other/shell.kmp,other/simple.kmp,other/contour.kmp,other/test0.ps,other/test.kmp,other/test2.kmp,other/test3.kmp,other/test4.kmp,other/kspanel.png,other/kmatplot.kdevprj.old,other/kmatplot.kdevprj, +sub_dirs=dialogs,ui,obsolete,old, +type=normal + +[other/TODO.detail] +dist=true +install=false +install_location= +type=DATA + +[other/TODO.detail2] +dist=true +install=false +install_location= +type=DATA + +[other/contour.kmp] +dist=true +install=false +install_location= +type=DATA + +[other/dialogs/Makefile.am] +files=other/dialogs/kspanelrange.ui, +sub_dirs=icons, +type=normal + +[other/dialogs/icons/1downarrow.png] +dist=true +install=false +install_location= +type=DATA + +[other/dialogs/icons/1leftarrow.png] +dist=true +install=false +install_location= +type=DATA + +[other/dialogs/icons/1rightarrow.png] +dist=true +install=false +install_location= +type=DATA + +[other/dialogs/icons/1uparrow.png] +dist=true +install=false +install_location= +type=DATA + +[other/dialogs/icons/Makefile.am] +files=other/dialogs/icons/1downarrow.png,other/dialogs/icons/1leftarrow.png,other/dialogs/icons/1rightarrow.png,other/dialogs/icons/1uparrow.png,other/dialogs/icons/fileclose.png,other/dialogs/icons/filefind.png,other/dialogs/icons/filenew.png,other/dialogs/icons/fileopen.png,other/dialogs/icons/fileprint.png,other/dialogs/icons/filesaveas.png,other/dialogs/icons/filesave.png,other/dialogs/icons/redo.png,other/dialogs/icons/undo.png,other/dialogs/icons/up.png,other/dialogs/icons/viewmag.png,other/dialogs/icons/back.png,other/dialogs/icons/forward.png,other/dialogs/icons/down.png, +sub_dirs= +type=normal + +[other/dialogs/icons/back.png] +dist=true +install=false +install_location= +type=DATA + +[other/dialogs/icons/down.png] +dist=true +install=false +install_location= +type=DATA + +[other/dialogs/icons/fileclose.png] +dist=true +install=false +install_location= +type=DATA + +[other/dialogs/icons/filefind.png] +dist=true +install=false +install_location= +type=DATA + +[other/dialogs/icons/filenew.png] +dist=true +install=false +install_location= +type=DATA + +[other/dialogs/icons/fileopen.png] +dist=true +install=false +install_location= +type=DATA + +[other/dialogs/icons/fileprint.png] +dist=true +install=false +install_location= +type=DATA + +[other/dialogs/icons/filesave.png] +dist=true +install=false +install_location= +type=DATA + +[other/dialogs/icons/filesaveas.png] +dist=true +install=false +install_location= +type=DATA + +[other/dialogs/icons/forward.png] +dist=true +install=false +install_location= +type=DATA + +[other/dialogs/icons/redo.png] +dist=true +install=false +install_location= +type=DATA + +[other/dialogs/icons/undo.png] +dist=true +install=false +install_location= +type=DATA + +[other/dialogs/icons/up.png] +dist=true +install=false +install_location= +type=DATA + +[other/dialogs/icons/viewmag.png] +dist=true +install=false +install_location= +type=DATA + +[other/dialogs/kspanelrange.ui] +dist=true +install=false +install_location= +type=SOURCE + +[other/kmatplot.kdevprj] +dist=true +install=false +install_location= +type=DATA + +[other/kmatplot.kdevprj.old] +dist=true +install=false +install_location= +type=DATA + +[other/kspanel.png] +dist=true +install=false +install_location= +type=DATA + +[other/obsolete/Makefile.am] +files=other/obsolete/ksaxispanel.cpp,other/obsolete/ksaxispaneldata.cpp,other/obsolete/ksaxispanel.h,other/obsolete/ksaxispanel.kdevdlg,other/obsolete/kscarrowpanel.cpp,other/obsolete/kscarrowpaneldata.cpp,other/obsolete/kscarrowpanel.h,other/obsolete/kscarrowpanel.kdevdlg,other/obsolete/ksclabelpanel.cpp,other/obsolete/ksclabelpaneldata.cpp,other/obsolete/ksclabelpanel.h,other/obsolete/ksclabelpanel.kdevdlg,other/obsolete/ksclegendcpanel.cpp,other/obsolete/ksclegendcpaneldata.cpp,other/obsolete/ksclegendcpanel.h,other/obsolete/ksclegendcpanel.kdevdlg,other/obsolete/kscontourpanel.cpp,other/obsolete/kscontourpaneldata.cpp,other/obsolete/kscontourpanel.h,other/obsolete/kscontourpanel.kdevdlg,other/obsolete/kscpospanel.cpp,other/obsolete/kscpospaneldata.cpp,other/obsolete/kscpospanel.h,other/obsolete/kscpospanel.kdevdlg,other/obsolete/kscrectpanel.cpp,other/obsolete/kscrectpaneldata.cpp,other/obsolete/kscrectpanel.h,other/obsolete/kscrectpanel.kdevdlg,other/obsolete/kscubepanel.cpp,other/obsolete/kscubepaneldata.cpp,other/obsolete/kscubepanel.h,other/obsolete/kscubepanel.kdevdlg,other/obsolete/ksfigurepanel.cpp,other/obsolete/ksfigurepaneldata.cpp,other/obsolete/ksfigurepanel.h,other/obsolete/ksfigurepanel.kdevdlg,other/obsolete/ksframepanel.cpp,other/obsolete/ksframepaneldata.cpp,other/obsolete/ksframepanel.h,other/obsolete/ksframepanel.kdevdlg,other/obsolete/ksgeneralpanel.cpp,other/obsolete/ksgeneralpaneldata.cpp,other/obsolete/ksgeneralpanel.h,other/obsolete/ksgeneralpanel.kdevdlg,other/obsolete/ksglpanel.cpp,other/obsolete/ksglpaneldata.cpp,other/obsolete/ksglpanel.h,other/obsolete/ksglpanel.kdevdlg,other/obsolete/ksimagepanel.cpp,other/obsolete/ksimagepaneldata.cpp,other/obsolete/ksimagepanel.h,other/obsolete/ksimagepanel.kdevdlg,other/obsolete/kslightpanel.cpp,other/obsolete/kslightpaneldata.cpp,other/obsolete/kslightpanel.h,other/obsolete/kslightpanel.kdevdlg,other/obsolete/ksmeshpanel.cpp,other/obsolete/ksmeshpaneldata.cpp,other/obsolete/ksmeshpanel.h,other/obsolete/ksmeshpanel.kdevdlg,other/obsolete/ksseriespanel.cpp,other/obsolete/ksseriespaneldata.cpp,other/obsolete/ksseriespanel.h,other/obsolete/ksseriespanel.kdevdlg,other/obsolete/kssurfacepanel.cpp,other/obsolete/kssurfacepaneldata.cpp,other/obsolete/kssurfacepanel.h,other/obsolete/kssurfacepanel.kdevdlg,other/obsolete/ksticspanel.cpp,other/obsolete/ksticspaneldata.cpp,other/obsolete/ksticspanel.h,other/obsolete/ksticspanel.kdevdlg,other/obsolete/ksviewpanel.cpp,other/obsolete/ksviewpaneldata.cpp,other/obsolete/ksviewpanel.h,other/obsolete/ksviewpanel.kdevdlg,other/obsolete/kspanelcarrow.ui, +sub_dirs= +type=normal + +[other/obsolete/ksaxispanel.cpp] +dist=true +install=false +install_location= +type=SOURCE + +[other/obsolete/ksaxispanel.h] +dist=true +install=false +install_location= +type=HEADER + +[other/obsolete/ksaxispanel.kdevdlg] +dist=true +install=false +install_location= +type=DATA + +[other/obsolete/ksaxispaneldata.cpp] +dist=true +install=false +install_location= +type=SOURCE + +[other/obsolete/kscarrowpanel.cpp] +dist=true +install=false +install_location= +type=SOURCE + +[other/obsolete/kscarrowpanel.h] +dist=true +install=false +install_location= +type=HEADER + +[other/obsolete/kscarrowpanel.kdevdlg] +dist=true +install=false +install_location= +type=DATA + +[other/obsolete/kscarrowpaneldata.cpp] +dist=true +install=false +install_location= +type=SOURCE + +[other/obsolete/ksclabelpanel.cpp] +dist=true +install=false +install_location= +type=SOURCE + +[other/obsolete/ksclabelpanel.h] +dist=true +install=false +install_location= +type=HEADER + +[other/obsolete/ksclabelpanel.kdevdlg] +dist=true +install=false +install_location= +type=DATA + +[other/obsolete/ksclabelpaneldata.cpp] +dist=true +install=false +install_location= +type=SOURCE + +[other/obsolete/ksclegendcpanel.cpp] +dist=true +install=false +install_location= +type=SOURCE + +[other/obsolete/ksclegendcpanel.h] +dist=true +install=false +install_location= +type=HEADER + +[other/obsolete/ksclegendcpanel.kdevdlg] +dist=true +install=false +install_location= +type=DATA + +[other/obsolete/ksclegendcpaneldata.cpp] +dist=true +install=false +install_location= +type=SOURCE + +[other/obsolete/kscontourpanel.cpp] +dist=true +install=false +install_location= +type=SOURCE + +[other/obsolete/kscontourpanel.h] +dist=true +install=false +install_location= +type=HEADER + +[other/obsolete/kscontourpanel.kdevdlg] +dist=true +install=false +install_location= +type=DATA + +[other/obsolete/kscontourpaneldata.cpp] +dist=true +install=false +install_location= +type=SOURCE + +[other/obsolete/kscpospanel.cpp] +dist=true +install=false +install_location= +type=SOURCE + +[other/obsolete/kscpospanel.h] +dist=true +install=false +install_location= +type=HEADER + +[other/obsolete/kscpospanel.kdevdlg] +dist=true +install=false +install_location= +type=DATA + +[other/obsolete/kscpospaneldata.cpp] +dist=true +install=false +install_location= +type=SOURCE + +[other/obsolete/kscrectpanel.cpp] +dist=true +install=false +install_location= +type=SOURCE + +[other/obsolete/kscrectpanel.h] +dist=true +install=false +install_location= +type=HEADER + +[other/obsolete/kscrectpanel.kdevdlg] +dist=true +install=false +install_location= +type=DATA + +[other/obsolete/kscrectpaneldata.cpp] +dist=true +install=false +install_location= +type=SOURCE + +[other/obsolete/kscubepanel.cpp] +dist=true +install=false +install_location= +type=SOURCE + +[other/obsolete/kscubepanel.h] +dist=true +install=false +install_location= +type=HEADER + +[other/obsolete/kscubepanel.kdevdlg] +dist=true +install=false +install_location= +type=DATA + +[other/obsolete/kscubepaneldata.cpp] +dist=true +install=false +install_location= +type=SOURCE + +[other/obsolete/ksfigurepanel.cpp] +dist=true +install=false +install_location= +type=SOURCE + +[other/obsolete/ksfigurepanel.h] +dist=true +install=false +install_location= +type=HEADER + +[other/obsolete/ksfigurepanel.kdevdlg] +dist=true +install=false +install_location= +type=DATA + +[other/obsolete/ksfigurepaneldata.cpp] +dist=true +install=false +install_location= +type=SOURCE + +[other/obsolete/ksframepanel.cpp] +dist=true +install=false +install_location= +type=SOURCE + +[other/obsolete/ksframepanel.h] +dist=true +install=false +install_location= +type=HEADER + +[other/obsolete/ksframepanel.kdevdlg] +dist=true +install=false +install_location= +type=DATA + +[other/obsolete/ksframepaneldata.cpp] +dist=true +install=false +install_location= +type=SOURCE + +[other/obsolete/ksgeneralpanel.cpp] +dist=true +install=false +install_location= +type=SOURCE + +[other/obsolete/ksgeneralpanel.h] +dist=true +install=false +install_location= +type=HEADER + +[other/obsolete/ksgeneralpanel.kdevdlg] +dist=true +install=false +install_location= +type=DATA + +[other/obsolete/ksgeneralpaneldata.cpp] +dist=true +install=false +install_location= +type=SOURCE + +[other/obsolete/ksglpanel.cpp] +dist=true +install=false +install_location= +type=SOURCE + +[other/obsolete/ksglpanel.h] +dist=true +install=false +install_location= +type=HEADER + +[other/obsolete/ksglpanel.kdevdlg] +dist=true +install=false +install_location= +type=DATA + +[other/obsolete/ksglpaneldata.cpp] +dist=true +install=false +install_location= +type=SOURCE + +[other/obsolete/ksimagepanel.cpp] +dist=true +install=false +install_location= +type=SOURCE + +[other/obsolete/ksimagepanel.h] +dist=true +install=false +install_location= +type=HEADER + +[other/obsolete/ksimagepanel.kdevdlg] +dist=true +install=false +install_location= +type=DATA + +[other/obsolete/ksimagepaneldata.cpp] +dist=true +install=false +install_location= +type=SOURCE + +[other/obsolete/kslightpanel.cpp] +dist=true +install=false +install_location= +type=SOURCE + +[other/obsolete/kslightpanel.h] +dist=true +install=false +install_location= +type=HEADER + +[other/obsolete/kslightpanel.kdevdlg] +dist=true +install=false +install_location= +type=DATA + +[other/obsolete/kslightpaneldata.cpp] +dist=true +install=false +install_location= +type=SOURCE + +[other/obsolete/ksmeshpanel.cpp] +dist=true +install=false +install_location= +type=SOURCE + +[other/obsolete/ksmeshpanel.h] +dist=true +install=false +install_location= +type=HEADER + +[other/obsolete/ksmeshpanel.kdevdlg] +dist=true +install=false +install_location= +type=DATA + +[other/obsolete/ksmeshpaneldata.cpp] +dist=true +install=false +install_location= +type=SOURCE + +[other/obsolete/kspanelcarrow.ui] +dist=true +install=false +install_location= +type=SOURCE + +[other/obsolete/ksseriespanel.cpp] +dist=true +install=false +install_location= +type=SOURCE + +[other/obsolete/ksseriespanel.h] +dist=true +install=false +install_location= +type=HEADER + +[other/obsolete/ksseriespanel.kdevdlg] +dist=true +install=false +install_location= +type=DATA + +[other/obsolete/ksseriespaneldata.cpp] +dist=true +install=false +install_location= +type=SOURCE + +[other/obsolete/kssurfacepanel.cpp] +dist=true +install=false +install_location= +type=SOURCE + +[other/obsolete/kssurfacepanel.h] +dist=true +install=false +install_location= +type=HEADER + +[other/obsolete/kssurfacepanel.kdevdlg] +dist=true +install=false +install_location= +type=DATA + +[other/obsolete/kssurfacepaneldata.cpp] +dist=true +install=false +install_location= +type=SOURCE + +[other/obsolete/ksticspanel.cpp] +dist=true +install=false +install_location= +type=SOURCE + +[other/obsolete/ksticspanel.h] +dist=true +install=false +install_location= +type=HEADER + +[other/obsolete/ksticspanel.kdevdlg] +dist=true +install=false +install_location= +type=DATA + +[other/obsolete/ksticspaneldata.cpp] +dist=true +install=false +install_location= +type=SOURCE + +[other/obsolete/ksviewpanel.cpp] +dist=true +install=false +install_location= +type=SOURCE + +[other/obsolete/ksviewpanel.h] +dist=true +install=false +install_location= +type=HEADER + +[other/obsolete/ksviewpanel.kdevdlg] +dist=true +install=false +install_location= +type=DATA + +[other/obsolete/ksviewpaneldata.cpp] +dist=true +install=false +install_location= +type=SOURCE + +[other/old/Makefile.am] +files=other/old/kmatplot.kdevprj,other/old/kspanel.cw, +sub_dirs= +type=normal + +[other/old/kmatplot.kdevprj] +dist=true +install=false +install_location= +type=DATA + +[other/old/kspanel.cw] +dist=true +install=false +install_location= +type=DATA + +[other/path3d.kmp] +dist=true +install=false +install_location= +type=DATA + +[other/shell.kmp] +dist=true +install=false +install_location= +type=DATA + +[other/simple.kmp] +dist=true +install=false +install_location= +type=DATA + +[other/surface.kmp] +dist=true +install=false +install_location= +type=DATA + +[other/test.kmp] +dist=true +install=false +install_location= +type=DATA + +[other/test0.ps] +dist=true +install=false +install_location= +type=DATA + +[other/test2.kmp] +dist=true +install=false +install_location= +type=DATA + +[other/test3.kmp] +dist=true +install=false +install_location= +type=DATA + +[other/test4.kmp] +dist=true +install=false +install_location= +type=DATA + +[other/ui/Makefile.am] +files=other/ui/kspanelaxisinterf.ui,other/ui/kspanelcarrowinterf.ui,other/ui/kspanelcarrow.ui,other/ui/kspanelclabelinterf.ui,other/ui/kspanelcontourinterf.ui,other/ui/kspanelcposinterf.ui,other/ui/kspanelcrectinterf.ui,other/ui/kspanelcubeinterf.ui,other/ui/kspanelfigureinterf.ui,other/ui/kspanelframeinterf.ui,other/ui/kspanelgeneralinterf.ui,other/ui/kspanelglinterf.ui,other/ui/kspanelgridinterf.ui,other/ui/kspanelimageinterf.ui,other/ui/kspanellightinterf.ui,other/ui/kspanelmeshinterf.ui,other/ui/kspanelrangeinterf.ui,other/ui/kspanelseriesinterf.ui,other/ui/kspanelsurfaceinterf.ui,other/ui/kspanelviewinterf.ui, +sub_dirs= +type=normal + +[other/ui/kspanelaxisinterf.ui] +dist=true +install=false +install_location= +type=SOURCE + +[other/ui/kspanelcarrow.ui] +dist=true +install=false +install_location= +type=SOURCE + +[other/ui/kspanelcarrowinterf.ui] +dist=true +install=false +install_location= +type=SOURCE + +[other/ui/kspanelclabelinterf.ui] +dist=true +install=false +install_location= +type=SOURCE + +[other/ui/kspanelcontourinterf.ui] +dist=true +install=false +install_location= +type=SOURCE + +[other/ui/kspanelcposinterf.ui] +dist=true +install=false +install_location= +type=SOURCE + +[other/ui/kspanelcrectinterf.ui] +dist=true +install=false +install_location= +type=SOURCE + +[other/ui/kspanelcubeinterf.ui] +dist=true +install=false +install_location= +type=SOURCE + +[other/ui/kspanelfigureinterf.ui] +dist=true +install=false +install_location= +type=SOURCE + +[other/ui/kspanelframeinterf.ui] +dist=true +install=false +install_location= +type=SOURCE + +[other/ui/kspanelgeneralinterf.ui] +dist=true +install=false +install_location= +type=SOURCE + +[other/ui/kspanelglinterf.ui] +dist=true +install=false +install_location= +type=SOURCE + +[other/ui/kspanelgridinterf.ui] +dist=true +install=false +install_location= +type=SOURCE + +[other/ui/kspanelimageinterf.ui] +dist=true +install=false +install_location= +type=SOURCE + +[other/ui/kspanellightinterf.ui] +dist=true +install=false +install_location= +type=SOURCE + +[other/ui/kspanelmeshinterf.ui] +dist=true +install=false +install_location= +type=SOURCE + +[other/ui/kspanelrangeinterf.ui] +dist=true +install=false +install_location= +type=SOURCE + +[other/ui/kspanelseriesinterf.ui] +dist=true +install=false +install_location= +type=SOURCE + +[other/ui/kspanelsurfaceinterf.ui] +dist=true +install=false +install_location= +type=SOURCE + +[other/ui/kspanelviewinterf.ui] +dist=true +install=false +install_location= +type=SOURCE + +[xpm/.pics/Makefile.am] +sub_dirs=med, +type=normal + +[xpm/.pics/med/Makefile.am] +files=xpm/.pics/med/axes.png,xpm/.pics/med/axes.xpm,xpm/.pics/med/charset.png,xpm/.pics/med/datasets.png,xpm/.pics/med/datasets.xpm,xpm/.pics/med/general.png,xpm/.pics/med/general.xpm,xpm/.pics/med/idea.png,xpm/.pics/med/kcmpartitions.png,xpm/.pics/med/kmatplot.png,xpm/.pics/med/lo22-action-figure.png,xpm/.pics/med/more.xpm,xpm/.pics/med/move.png,xpm/.pics/med/object.png,xpm/.pics/med/object.xpm,xpm/.pics/med/rotate_ccw.png,xpm/.pics/med/lo22-action-gl.png,xpm/.pics/med/lo22-action-arrowpanel.png,xpm/.pics/med/lo22-action-glpanel.png,xpm/.pics/med/lo22-action-datasets.png,xpm/.pics/med/lo22-action-light.png,xpm/.pics/med/lo22-action-mesh.png,xpm/.pics/med/lo22-action-position.png,xpm/.pics/med/lo22-action-text.png,xpm/.pics/med/lo22-action-panel_mesh.png,xpm/.pics/med/lo22-action-panel_more.png,xpm/.pics/med/lo22-action-panel_label.png,xpm/.pics/med/lo22-action-panel_gl.png,xpm/.pics/med/lo22-action-panel_light.png,xpm/.pics/med/lo22-action-panel_position.png,xpm/.pics/med/lo22-action-panel_projection.png,xpm/.pics/med/lo22-action-contour.png,xpm/.pics/med/lo22-action-curve.png,xpm/.pics/med/lo22-action-surface.png,xpm/.pics/med/lo22-action-pixmap.png,xpm/.pics/med/lo22-action-panel_rect.png,xpm/.pics/med/lo22-action-panel_arrow.png,xpm/.pics/med/lo22-action-panel_pos1.png,xpm/.pics/med/lo22-action-panel_pos2.png,xpm/.pics/med/editcopy.png,xpm/.pics/med/lo22-action-panel_legend.png,xpm/.pics/med/lo22-action-panel_box.png,xpm/.pics/med/package.png,xpm/.pics/med/lo22-action-panel_frame.png,xpm/.pics/med/lo22-action-panel-gridx1.png,xpm/.pics/med/lo22-action-panel-gridy1.png,xpm/.pics/med/lo22-action-panel-gridv1.png,xpm/.pics/med/lo22-action-panel_v1.png,xpm/.pics/med/lo22-action-panel_gx1.png,xpm/.pics/med/lo22-action-panel_gv1.png,xpm/.pics/med/lo22-action-panel_x1.png,xpm/.pics/med/lo22-action-panel_y1.png,xpm/.pics/med/lo22-action-panel_z1.png,xpm/.pics/med/lo22-action-panel_gy1.png,xpm/.pics/med/lo22-action-panel_z2.png,xpm/.pics/med/lo22-action-panel_x2.png,xpm/.pics/med/lo22-action-panel_v2.png,xpm/.pics/med/lo22-action-panel_y2.png,xpm/.pics/med/lo22-action-panel_gv2.png,xpm/.pics/med/lo22-action-panel_gx2.png,xpm/.pics/med/lo22-action-panel_gy2.png,xpm/.pics/med/lo22-action-panel_gz2.png,xpm/.pics/med/lo22-action-panel_gz1.png, +sub_dirs= +type=normal + +[xpm/.pics/med/axes.png] +dist=true +install=false +install_location= +type=DATA + +[xpm/.pics/med/axes.xpm] +dist=true +install=false +install_location= +type=DATA + +[xpm/.pics/med/charset.png] +dist=true +install=false +install_location= +type=DATA + +[xpm/.pics/med/datasets.png] +dist=true +install=false +install_location= +type=DATA + +[xpm/.pics/med/datasets.xpm] +dist=true +install=false +install_location= +type=DATA + +[xpm/.pics/med/editcopy.png] +dist=true +install=false +install_location= +type=DATA + +[xpm/.pics/med/general.png] +dist=true +install=false +install_location= +type=DATA + +[xpm/.pics/med/general.xpm] +dist=true +install=false +install_location= +type=DATA + +[xpm/.pics/med/idea.png] +dist=true +install=false +install_location= +type=DATA + +[xpm/.pics/med/kcmpartitions.png] +dist=true +install=false +install_location= +type=DATA + +[xpm/.pics/med/kmatplot.png] +dist=true +install=false +install_location= +type=DATA + +[xpm/.pics/med/lo22-action-arrowpanel.png] +dist=true +install=false +install_location= +type=DATA + +[xpm/.pics/med/lo22-action-contour.png] +dist=true +install=false +install_location= +type=DATA + +[xpm/.pics/med/lo22-action-curve.png] +dist=true +install=false +install_location= +type=DATA + +[xpm/.pics/med/lo22-action-datasets.png] +dist=true +install=false +install_location= +type=DATA + +[xpm/.pics/med/lo22-action-figure.png] +dist=true +install=false +install_location= +type=DATA + +[xpm/.pics/med/lo22-action-gl.png] +dist=true +install=false +install_location= +type=DATA + +[xpm/.pics/med/lo22-action-glpanel.png] +dist=true +install=false +install_location= +type=DATA + +[xpm/.pics/med/lo22-action-light.png] +dist=true +install=false +install_location= +type=DATA + +[xpm/.pics/med/lo22-action-mesh.png] +dist=true +install=false +install_location= +type=DATA + +[xpm/.pics/med/lo22-action-panel-gridv1.png] +dist=true +install=false +install_location= +type=DATA + +[xpm/.pics/med/lo22-action-panel-gridx1.png] +dist=true +install=false +install_location= +type=DATA + +[xpm/.pics/med/lo22-action-panel-gridy1.png] +dist=true +install=false +install_location= +type=DATA + +[xpm/.pics/med/lo22-action-panel_arrow.png] +dist=true +install=false +install_location= +type=DATA + +[xpm/.pics/med/lo22-action-panel_box.png] +dist=true +install=false +install_location= +type=DATA + +[xpm/.pics/med/lo22-action-panel_frame.png] +dist=true +install=false +install_location= +type=DATA + +[xpm/.pics/med/lo22-action-panel_gl.png] +dist=true +install=false +install_location= +type=DATA + +[xpm/.pics/med/lo22-action-panel_gv1.png] +dist=true +install=false +install_location= +type=DATA + +[xpm/.pics/med/lo22-action-panel_gv2.png] +dist=true +install=false +install_location= +type=DATA + +[xpm/.pics/med/lo22-action-panel_gx1.png] +dist=true +install=false +install_location= +type=DATA + +[xpm/.pics/med/lo22-action-panel_gx2.png] +dist=true +install=false +install_location= +type=DATA + +[xpm/.pics/med/lo22-action-panel_gy1.png] +dist=true +install=false +install_location= +type=DATA + +[xpm/.pics/med/lo22-action-panel_gy2.png] +dist=true +install=false +install_location= +type=DATA + +[xpm/.pics/med/lo22-action-panel_gz1.png] +dist=true +install=false +install_location= +type=DATA + +[xpm/.pics/med/lo22-action-panel_gz2.png] +dist=true +install=false +install_location= +type=DATA + +[xpm/.pics/med/lo22-action-panel_label.png] +dist=true +install=false +install_location= +type=DATA + +[xpm/.pics/med/lo22-action-panel_legend.png] +dist=true +install=false +install_location= +type=DATA + +[xpm/.pics/med/lo22-action-panel_light.png] +dist=true +install=false +install_location= +type=DATA + +[xpm/.pics/med/lo22-action-panel_mesh.png] +dist=true +install=false +install_location= +type=DATA + +[xpm/.pics/med/lo22-action-panel_more.png] +dist=true +install=false +install_location= +type=DATA + +[xpm/.pics/med/lo22-action-panel_pos1.png] +dist=true +install=false +install_location= +type=DATA + +[xpm/.pics/med/lo22-action-panel_pos2.png] +dist=true +install=false +install_location= +type=DATA + +[xpm/.pics/med/lo22-action-panel_position.png] +dist=true +install=false +install_location= +type=DATA + +[xpm/.pics/med/lo22-action-panel_projection.png] +dist=true +install=false +install_location= +type=DATA + +[xpm/.pics/med/lo22-action-panel_rect.png] +dist=true +install=false +install_location= +type=DATA + +[xpm/.pics/med/lo22-action-panel_v1.png] +dist=true +install=false +install_location= +type=DATA + +[xpm/.pics/med/lo22-action-panel_v2.png] +dist=true +install=false +install_location= +type=DATA + +[xpm/.pics/med/lo22-action-panel_x1.png] +dist=true +install=false +install_location= +type=DATA + +[xpm/.pics/med/lo22-action-panel_x2.png] +dist=true +install=false +install_location= +type=DATA + +[xpm/.pics/med/lo22-action-panel_y1.png] +dist=true +install=false +install_location= +type=DATA + +[xpm/.pics/med/lo22-action-panel_y2.png] +dist=true +install=false +install_location= +type=DATA + +[xpm/.pics/med/lo22-action-panel_z1.png] +dist=true +install=false +install_location= +type=DATA + +[xpm/.pics/med/lo22-action-panel_z2.png] +dist=true +install=false +install_location= +type=DATA + +[xpm/.pics/med/lo22-action-pixmap.png] +dist=true +install=false +install_location= +type=DATA + +[xpm/.pics/med/lo22-action-position.png] +dist=true +install=false +install_location= +type=DATA + +[xpm/.pics/med/lo22-action-surface.png] +dist=true +install=false +install_location= +type=DATA + +[xpm/.pics/med/lo22-action-text.png] +dist=true +install=false +install_location= +type=DATA + +[xpm/.pics/med/more.xpm] +dist=true +install=false +install_location= +type=DATA + +[xpm/.pics/med/move.png] +dist=true +install=false +install_location= +type=DATA + +[xpm/.pics/med/object.png] +dist=true +install=false +install_location= +type=DATA + +[xpm/.pics/med/object.xpm] +dist=true +install=false +install_location= +type=DATA + +[xpm/.pics/med/package.png] +dist=true +install=false +install_location= +type=DATA + +[xpm/.pics/med/rotate_ccw.png] +dist=true +install=false +install_location= +type=DATA + +[xpm/.xvpics/Makefile.am] +files=xpm/.xvpics/axes.xpm,xpm/.xvpics/general.xpm,xpm/.xvpics/axes.png,xpm/.xvpics/object.png,xpm/.xvpics/lo22-action-gl.png,xpm/.xvpics/lo22-action-arrowpanel.png,xpm/.xvpics/lo22-action-glpanel.png,xpm/.xvpics/lo22-action-panel_more.png,xpm/.xvpics/lo22-action-panel_projection.png,xpm/.xvpics/lo22-action-panel_rect.png,xpm/.xvpics/lo22-action-panel_arrow.png,xpm/.xvpics/lo22-action-panel_pos1.png,xpm/.xvpics/lo22-action-panel_pos2.png,xpm/.xvpics/lo22-action-panel_legend.png,xpm/.xvpics/lo22-action-panel_box.png,xpm/.xvpics/package.png,xpm/.xvpics/lo22-action-panel_frame.png,xpm/.xvpics/lo22-action-panel-gridx1.png,xpm/.xvpics/lo22-action-panel-gridy1.png,xpm/.xvpics/lo22-action-panel-gridv1.png,xpm/.xvpics/lo22-action-panel_v1.png,xpm/.xvpics/lo22-action-panel_x1.png,xpm/.xvpics/lo22-action-panel_y1.png,xpm/.xvpics/lo22-action-panel_z1.png,xpm/.xvpics/lo22-action-panel_z2.png,xpm/.xvpics/lo22-action-panel_x2.png,xpm/.xvpics/lo22-action-panel_v2.png,xpm/.xvpics/lo22-action-panel_y2.png,xpm/.xvpics/lo22-action-panel_gv2.png,xpm/.xvpics/lo22-action-panel_gx2.png,xpm/.xvpics/lo22-action-panel_gy2.png,xpm/.xvpics/lo22-action-panel_gz2.png,xpm/.xvpics/lo22-action-panel_gz1.png,xpm/.xvpics/lo22-action-panel_gv1.png,xpm/.xvpics/lo22-action-panel_gx1.png,xpm/.xvpics/lo22-action-panel_gy1.png, +sub_dirs= +type=normal + +[xpm/.xvpics/axes.png] +dist=true +install=false +install_location= +type=DATA + +[xpm/.xvpics/axes.xpm] +dist=true +install=false +install_location= +type=DATA + +[xpm/.xvpics/general.xpm] +dist=true +install=false +install_location= +type=DATA + +[xpm/.xvpics/lo22-action-arrowpanel.png] +dist=true +install=false +install_location= +type=DATA + +[xpm/.xvpics/lo22-action-gl.png] +dist=true +install=false +install_location= +type=DATA + +[xpm/.xvpics/lo22-action-glpanel.png] +dist=true +install=false +install_location= +type=DATA + +[xpm/.xvpics/lo22-action-panel-gridv1.png] +dist=true +install=false +install_location= +type=DATA + +[xpm/.xvpics/lo22-action-panel-gridx1.png] +dist=true +install=false +install_location= +type=DATA + +[xpm/.xvpics/lo22-action-panel-gridy1.png] +dist=true +install=false +install_location= +type=DATA + +[xpm/.xvpics/lo22-action-panel_arrow.png] +dist=true +install=false +install_location= +type=DATA + +[xpm/.xvpics/lo22-action-panel_box.png] +dist=true +install=false +install_location= +type=DATA + +[xpm/.xvpics/lo22-action-panel_frame.png] +dist=true +install=false +install_location= +type=DATA + +[xpm/.xvpics/lo22-action-panel_gv1.png] +dist=true +install=false +install_location= +type=DATA + +[xpm/.xvpics/lo22-action-panel_gv2.png] +dist=true +install=false +install_location= +type=DATA + +[xpm/.xvpics/lo22-action-panel_gx1.png] +dist=true +install=false +install_location= +type=DATA + +[xpm/.xvpics/lo22-action-panel_gx2.png] +dist=true +install=false +install_location= +type=DATA + +[xpm/.xvpics/lo22-action-panel_gy1.png] +dist=true +install=false +install_location= +type=DATA + +[xpm/.xvpics/lo22-action-panel_gy2.png] +dist=true +install=false +install_location= +type=DATA + +[xpm/.xvpics/lo22-action-panel_gz1.png] +dist=true +install=false +install_location= +type=DATA + +[xpm/.xvpics/lo22-action-panel_gz2.png] +dist=true +install=false +install_location= +type=DATA + +[xpm/.xvpics/lo22-action-panel_legend.png] +dist=true +install=false +install_location= +type=DATA + +[xpm/.xvpics/lo22-action-panel_more.png] +dist=true +install=false +install_location= +type=DATA + +[xpm/.xvpics/lo22-action-panel_pos1.png] +dist=true +install=false +install_location= +type=DATA + +[xpm/.xvpics/lo22-action-panel_pos2.png] +dist=true +install=false +install_location= +type=DATA + +[xpm/.xvpics/lo22-action-panel_projection.png] +dist=true +install=false +install_location= +type=DATA + +[xpm/.xvpics/lo22-action-panel_rect.png] +dist=true +install=false +install_location= +type=DATA + +[xpm/.xvpics/lo22-action-panel_v1.png] +dist=true +install=false +install_location= +type=DATA + +[xpm/.xvpics/lo22-action-panel_v2.png] +dist=true +install=false +install_location= +type=DATA + +[xpm/.xvpics/lo22-action-panel_x1.png] +dist=true +install=false +install_location= +type=DATA + +[xpm/.xvpics/lo22-action-panel_x2.png] +dist=true +install=false +install_location= +type=DATA + +[xpm/.xvpics/lo22-action-panel_y1.png] +dist=true +install=false +install_location= +type=DATA + +[xpm/.xvpics/lo22-action-panel_y2.png] +dist=true +install=false +install_location= +type=DATA + +[xpm/.xvpics/lo22-action-panel_z1.png] +dist=true +install=false +install_location= +type=DATA + +[xpm/.xvpics/lo22-action-panel_z2.png] +dist=true +install=false +install_location= +type=DATA + +[xpm/.xvpics/object.png] +dist=true +install=false +install_location= +type=DATA + +[xpm/.xvpics/package.png] +dist=true +install=false +install_location= +type=DATA + +[xpm/Makefile.am] +files=xpm/axes.xpm,xpm/package.png,xpm/axes.png,xpm/lo22-action-panel_label.png,xpm/kcmpartitions.png,xpm/general.png,xpm/rotate_ccw.png,xpm/axes.xcf,xpm/datasets.xcf,xpm/general.xcf,xpm/object.xcf,xpm/datasets.xpm,xpm/more.xpm,xpm/object.xpm,xpm/general.xpm,xpm/lo22-action-figure.png,xpm/object.png,xpm/lo22-action-datasets.png,xpm/lo22-action-panel_gl.png,xpm/lo22-action-arrowpanel.png,xpm/lo22-action-contour.png,xpm/lo22-action-panel_mesh.png,xpm/lo22-action-panel_light.png,xpm/lo22-action-panel_position.png,xpm/lo22-action-panel_more.png,xpm/lo22-action-panel_projection.png,xpm/lo22-action-curve.png,xpm/lo22-action-surface.png,xpm/lo22-action-pixmap.png,xpm/lo22-action-panel_rect.png,xpm/lo22-action-panel_arrow.png,xpm/lo22-action-panel_pos1.png,xpm/lo22-action-panel_pos2.png,xpm/lo22-action-panel_legend.png,xpm/lo22-action-panel_box.png,xpm/lo22-action-panel_frame.png,xpm/lo22-action-panel_gy1.png,xpm/lo22-action-panel_x1.png,xpm/lo22-action-panel_gx1.png,xpm/lo22-action-panel_v1.png,xpm/lo22-action-panel_gv1.png,xpm/lo22-action-panel_y1.png,xpm/lo22-action-panel_z1.png,xpm/lo22-action-panel_z2.png,xpm/lo22-action-panel_x2.png,xpm/lo22-action-panel_v2.png,xpm/lo22-action-panel_y2.png,xpm/lo22-action-panel_gv2.png,xpm/lo22-action-panel_gx2.png,xpm/lo22-action-panel_gy2.png,xpm/lo22-action-panel_gz2.png,xpm/lo22-action-panel_gz1.png, +sub_dirs=old, +type=normal + +[xpm/axes.png] +dist=true +install=false +install_location= +type=DATA + +[xpm/axes.xcf] +dist=true +install=false +install_location= +type=DATA + +[xpm/axes.xpm] +dist=true +install=false +install_location= +type=DATA + +[xpm/datasets.xcf] +dist=true +install=false +install_location= +type=DATA + +[xpm/datasets.xpm] +dist=true +install=false +install_location= +type=DATA + +[xpm/general.png] +dist=true +install=false +install_location= +type=DATA + +[xpm/general.xcf] +dist=true +install=false +install_location= +type=DATA + +[xpm/general.xpm] +dist=true +install=false +install_location= +type=DATA + +[xpm/kcmpartitions.png] +dist=true +install=false +install_location= +type=DATA + +[xpm/lo22-action-arrowpanel.png] +dist=true +install=false +install_location= +type=DATA + +[xpm/lo22-action-contour.png] +dist=true +install=false +install_location= +type=DATA + +[xpm/lo22-action-curve.png] +dist=true +install=false +install_location= +type=DATA + +[xpm/lo22-action-datasets.png] +dist=true +install=false +install_location= +type=DATA + +[xpm/lo22-action-figure.png] +dist=true +install=false +install_location= +type=DATA + +[xpm/lo22-action-panel_arrow.png] +dist=true +install=false +install_location= +type=DATA + +[xpm/lo22-action-panel_box.png] +dist=true +install=false +install_location= +type=DATA + +[xpm/lo22-action-panel_frame.png] +dist=true +install=false +install_location= +type=DATA + +[xpm/lo22-action-panel_gl.png] +dist=true +install=false +install_location= +type=DATA + +[xpm/lo22-action-panel_gv1.png] +dist=true +install=false +install_location= +type=DATA + +[xpm/lo22-action-panel_gv2.png] +dist=true +install=false +install_location= +type=DATA + +[xpm/lo22-action-panel_gx1.png] +dist=true +install=false +install_location= +type=DATA + +[xpm/lo22-action-panel_gx2.png] +dist=true +install=false +install_location= +type=DATA + +[xpm/lo22-action-panel_gy1.png] +dist=true +install=false +install_location= +type=DATA + +[xpm/lo22-action-panel_gy2.png] +dist=true +install=false +install_location= +type=DATA + +[xpm/lo22-action-panel_gz1.png] +dist=true +install=false +install_location= +type=DATA + +[xpm/lo22-action-panel_gz2.png] +dist=true +install=false +install_location= +type=DATA + +[xpm/lo22-action-panel_label.png] +dist=true +install=false +install_location= +type=DATA + +[xpm/lo22-action-panel_legend.png] +dist=true +install=false +install_location= +type=DATA + +[xpm/lo22-action-panel_light.png] +dist=true +install=false +install_location= +type=DATA + +[xpm/lo22-action-panel_mesh.png] +dist=true +install=false +install_location= +type=DATA + +[xpm/lo22-action-panel_more.png] +dist=true +install=false +install_location= +type=DATA + +[xpm/lo22-action-panel_pos1.png] +dist=true +install=false +install_location= +type=DATA + +[xpm/lo22-action-panel_pos2.png] +dist=true +install=false +install_location= +type=DATA + +[xpm/lo22-action-panel_position.png] +dist=true +install=false +install_location= +type=DATA + +[xpm/lo22-action-panel_projection.png] +dist=true +install=false +install_location= +type=DATA + +[xpm/lo22-action-panel_rect.png] +dist=true +install=false +install_location= +type=DATA + +[xpm/lo22-action-panel_v1.png] +dist=true +install=false +install_location= +type=DATA + +[xpm/lo22-action-panel_v2.png] +dist=true +install=false +install_location= +type=DATA + +[xpm/lo22-action-panel_x1.png] +dist=true +install=false +install_location= +type=DATA + +[xpm/lo22-action-panel_x2.png] +dist=true +install=false +install_location= +type=DATA + +[xpm/lo22-action-panel_y1.png] +dist=true +install=false +install_location= +type=DATA + +[xpm/lo22-action-panel_y2.png] +dist=true +install=false +install_location= +type=DATA + +[xpm/lo22-action-panel_z1.png] +dist=true +install=false +install_location= +type=DATA + +[xpm/lo22-action-panel_z2.png] +dist=true +install=false +install_location= +type=DATA + +[xpm/lo22-action-pixmap.png] +dist=true +install=false +install_location= +type=DATA + +[xpm/lo22-action-surface.png] +dist=true +install=false +install_location= +type=DATA + +[xpm/more.xpm] +dist=true +install=false +install_location= +type=DATA + +[xpm/object.png] +dist=true +install=false +install_location= +type=DATA + +[xpm/object.xcf] +dist=true +install=false +install_location= +type=DATA + +[xpm/object.xpm] +dist=true +install=false +install_location= +type=DATA + +[xpm/old/1rightarrow.png] +dist=true +install=false +install_location= +type=DATA + +[xpm/old/Makefile.am] +files=xpm/old/1rightarrow.png, +sub_dirs= +type=normal + +[xpm/package.png] +dist=true +install=false +install_location= +type=DATA + +[xpm/rotate_ccw.png] +dist=true +install=false +install_location= +type=DATA diff --git a/kmatplot.kdevses b/kmatplot.kdevses new file mode 100644 index 0000000..4acb0b8 --- /dev/null +++ b/kmatplot.kdevses @@ -0,0 +1,53 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/kmatplot.lsm b/kmatplot.lsm new file mode 100644 index 0000000..e96e8e1 --- /dev/null +++ b/kmatplot.lsm @@ -0,0 +1,14 @@ +Begin3 +Title: KMatplot +Version: 0.4 +Entered-date: +Description: KMatplot is a gnuplot-like tools to generate plots either in two or three dimensions. +Keywords: plot graph science Qt Octave +Author: Kamil Dobkowski +Maintained-by: Kamil Dobkowski +Primary-site: +Home-page: http://kmatplot.sourceforge.net +Original-site: +Platforms: Linux and other Unices +Copying-policy: GNU Public License +End diff --git a/kmatplot.spec b/kmatplot.spec new file mode 100644 index 0000000..204f5a8 --- /dev/null +++ b/kmatplot.spec @@ -0,0 +1,87 @@ +# You might want to change the next line, the rest should be ok +%define qtdir /usr/local/qt + +Name: kmatplot +URL: http://kmatplot.sourceforge.net +Summary: Science plotting tool +Version: 0.4 +Release: 1 +Copyright: GPL +Vendor: kamil +Packager: kamil +Group: Applications/Engineering +Source: kmatplot-0.4.tar.gz +BuildRoot: /var/tmp/%{name}-root + + +%description +KMatplot is an Origin-like tool to generate scientific plots either in two or three dimensions. +Source package contains also Scilab support. + + +%prep +rm -rf $RPM_BUILD_ROOT +%setup -q + +%build +export QTDIR=%{qtdir} +CFLAGS="$RPM_OPT_FLAGS" CXXFLAGS="$RPM_OPT_FLAGS -DNO_DEBUG -DNDEBUG" ./configure --prefix=/usr/local +make + +%install +make DESTDIR=$RPM_BUILD_ROOT install-strip + +cd $RPM_BUILD_ROOT + +find . -type d | sed '1,2d;s,^\.,\%attr(-\,root\,root) \%dir ,' > \ + $RPM_BUILD_DIR/file.list.%{name} + +find . -type f | sed -e 's,^\.,\%attr(-\,root\,root) ,' \ + -e '/\/config\//s|^|%config|' >> \ + $RPM_BUILD_DIR/file.list.%{name} + +find . -type l | sed 's,^\.,\%attr(-\,root\,root) ,' >> \ + $RPM_BUILD_DIR/file.list.%{name} + +grep "\.oct$" $RPM_BUILD_DIR/file.list.%{name} > \ + $RPM_BUILD_DIR/file.list.%{name}-octave + +grep "\.py$" $RPM_BUILD_DIR/file.list.%{name} > \ + $RPM_BUILD_DIR/file.list.%{name}-python + +grep "\.pth$" $RPM_BUILD_DIR/file.list.%{name} >> \ + $RPM_BUILD_DIR/file.list.%{name}-python + +egrep -v "\.oct$|\.py$|\.pth$" $RPM_BUILD_DIR/file.list.%{name} > \ + $RPM_BUILD_DIR/file.list.%{name}-main + +%clean +rm -rf $RPM_BUILD_ROOT $RPM_BUILD_DIR/files.list.%{name} $RPM_BUILD_ROOT $RPM_BUILD_DIR/files.list.%{name}-main $RPM_BUILD_ROOT $RPM_BUILD_DIR/files.list.%{name}-octave $RPM_BUILD_ROOT $RPM_BUILD_DIR/files.list.%{name}-python + +%files -f ../file.list.%{name}-main + +%package octave +Summary: Functions to transfer data from Octave to KMatplot +Vendor: kamil +Group: Applications/Engineering + +%description octave +This package contains Octave support, so it is possible to make plots directly from +Octave using 'kplot', 'kimage', 'kmesh' and other functions. Those functions transfer data from +Octave to KMatplot through an Unix socket. + +%files octave -f ../file.list.%{name}-octave + +%package python +Requires: Numeric +Summary: Functions to transfer data from Python applications to KMatplot +Vendor: Martin Wiechert +Group: Applications/Engineering + +%description python +This package contains Python support, so it is possible to make plots directly from +Python using 'kplot', 'kimage', 'kmesh' and other functions. Those functions transfer data from +Numeric Python application to KMatplot through an Unix socket. + +%files python -f ../file.list.%{name}-python + diff --git a/kmatplot/Makefile.am b/kmatplot/Makefile.am new file mode 100644 index 0000000..629e7e3 --- /dev/null +++ b/kmatplot/Makefile.am @@ -0,0 +1,60 @@ +INCLUDES = $(all_includes) + +KDE_OPTIONS = qtonly +SUBDIRS = docs examples formula widgets dialogs demos interface octave scilab python dtd config pics pixmaps +METASOURCES = AUTO +bin_PROGRAMS = kmatplot +kmatplot_LDADD = widgets/libplot.a formula/libformula.a dialogs/libdialogs.a $(QGLLIB) $(LIB_QT) $(GLLIB) -lXmu $(LIBSOCKET) +kmatplot_LDFLAGS = $(QT_LDFLAGS) $(X_LDFLAGS) $(USER_LDFLAGS) + +kmatplot_SOURCES = ksmatrixsheet.cpp \ + ksglobalsettings.cpp \ + ksmatrix.cpp \ + ksglobalmatrixlist.cpp \ + qscobjects.cpp \ + ksworkbook.cpp \ + kscommands.cpp \ + qsctools.cpp \ + ksprojectxml.cpp \ + kspanelmanager.cpp \ + ksobjectfactory.cpp \ + ksdataobjectfactory.cpp \ + ksdatasymbolfactory.cpp \ + ksmatrixeditor.cpp \ + ksmatrixmat.cpp \ + ksmatrixio.cpp \ + ksmatrixiohandler.cpp \ + ksmatrixascii.cpp \ + kssocketio.cpp \ + ksworksheetdlg.cpp \ + kmatplotshell.cpp \ + ksworkspace.cpp \ + kswinpageview.cpp \ + kswinworksheet.cpp \ + main.cpp + + +EXTRA_DIST = ksmatrixsheet.h \ + ksglobalsettings.h \ + ksmatrixeditor.h \ + kssocketio.h \ + kmatplotshell.h \ + ksmatrixascii.h \ + ksmatrixio.h \ + ksmatrixiohandler.h \ + ksworksheetdlg.h \ + ksmatrixmat.h \ + ksglobalmatrixlist.h \ + ksprojectxml.h \ + ksmatrix.h \ + kspanelmanager.h \ + qsctools.h \ + qscobjects.h \ + ksworkbook.h \ + kscommands.h \ + ksobjectfactory.h \ + ksdataobjectfactory.h \ + ksdatasymbolfactory.h \ + ksworkspace.h \ + kswinpageview.h \ + kswinworksheet.h diff --git a/kmatplot/config/Makefile.am b/kmatplot/config/Makefile.am new file mode 100644 index 0000000..fe4f6b6 --- /dev/null +++ b/kmatplot/config/Makefile.am @@ -0,0 +1,8 @@ +rcfiles_DATA = kmatplotrc +rcfilesdir = $(QSETTINGSDIR) + +CLEANFILES = kmatplotrc + +kmatplotrc: Makefile + echo "[General]" > kmatplotrc + echo "installPath=$(prefix)" >> kmatplotrc diff --git a/kmatplot/demos/Makefile.am b/kmatplot/demos/Makefile.am new file mode 100644 index 0000000..7750001 --- /dev/null +++ b/kmatplot/demos/Makefile.am @@ -0,0 +1,14 @@ +INCLUDES = $(all_includes) -I../widgets + +KDE_OPTIONS = qtonly +noinst_PROGRAMS = demo2d demo3d + +demo2d_LDADD = ../widgets/libplot.a $(LIB_QT) -lXmu $(QGLLIB) $(GLLIB) +demo2d_LDFLAGS = $(QT_LDFLAGS) $(X_LDFLAGS) $(USER_LDFLAGS) +demo2d_SOURCES = demo2d.cpp +demo2d_METASOURCES = AUTO + +demo3d_LDADD = ../widgets/libplot.a $(LIB_QT) -lXmu $(QGLLIB) $(GLLIB) +demo3d_LDFLAGS = $(QT_LDFLAGS) $(X_LDFLAGS) $(USER_LDFLAGS) +demo3d_SOURCES = demo3d.cpp +demo3d_METASOURCES = AUTO diff --git a/kmatplot/demos/demo2d.cpp b/kmatplot/demos/demo2d.cpp new file mode 100644 index 0000000..eb70c96 --- /dev/null +++ b/kmatplot/demos/demo2d.cpp @@ -0,0 +1,69 @@ + +#include +#include +#include +#include + +/** see ../widgets dir */ +#include "qsplotview.h" +//#include "qsworkbook.h" +#include "qsaxes2d.h" +#include "qscurve.h" +#include "qsclegend.h" + +// implementation of QSMatrix +class Curve1 : public QSMatrix { + public: + Curve1() {} + ~Curve1() {} + int cols() const { return 1; } + int rows() const { return 100; } + double value( int row, int col ) { return sin( row/10.0 )*100.0; } + }; + + +int main( int argc, char ** argv ) { + QApplication a( argc, argv ); +// QApplication::setStyle( new QMotifPlusStyle() ); + + QMainWindow *mw = new QMainWindow(); + mw->setCaption( "plot2d demo" ); + + // create a workbook with a one empty page. + QSWorkbook *doc = new QSWorkbook( mw ); + doc->clear(); + doc->pageAdd( new QSPage() ); + + // create the view and set it as main widget in app window + QSPlotView *view = new QSPlotView( mw ); + view->setFullPage( true ); + mw->setCentralWidget( view ); + + // set workbook to be displayed + view->setWorkbook( doc ); + + // create axes object + QSAxes2D *axes = new QSAxes2D(); + // axes doesn't inherit QSCObject ( problems with multiple inheritance ) + // so we must use axes->shadowObject() instead + doc->page(0)->objects()->add( axes->shadowObject() ); + + // create dataset + QSCurve *c = new QSCurve( axes ); + // set data to be displayed + c->setMatrix( QSCurve::YVector, new Curve1() ); + c->setTitle( "Sample" ); + axes->plotAdd( c ); + + // setting attributes + QSGLine l( QSGLine::Dash ); + l.color.set( 255, 0, 0 ); + c->setLine( QSCurve::BaseLine, l ); + + // adding legend + doc->page(0)->objects()->add( new QSCLegend(axes) ); + + mw->show(); + a.connect( &a, SIGNAL(lastWindowClosed()), &a, SLOT(quit()) ); + return a.exec(); +} diff --git a/kmatplot/demos/demo3d.cpp b/kmatplot/demos/demo3d.cpp new file mode 100644 index 0000000..5ff1f60 --- /dev/null +++ b/kmatplot/demos/demo3d.cpp @@ -0,0 +1,74 @@ + +#include +#include +#include +#include +#include +#include + +/** see ../widgets dir */ +#include "qsmatrix.h" +#include "qsplotview.h" +#include "qsaxes3d.h" +#include "qssurface.h" +#include "qsfigure.h" + +// implementation of QSMatrix interface +class Surface1 : public QSMatrix { + + public: + Surface1() {} + ~Surface1() {} + + int cols() const { return 100; } + int rows() const { return 100; } + + double value( int row, int col ) { return sin( sqrt((row/8-50)*(row/8-50)+(col/8-20)*(col/8-20)) ); } + }; + + + +int main( int argc, char ** argv ) { + QApplication a( argc, argv ); +// QApplication::setStyle( new QMotifPlusStyle() ); + + QMainWindow *mw = new QMainWindow(); + + // create workbook with a one empty page + QSWorkbook *doc = new QSWorkbook( mw ); + doc->clear(); + doc->pageAdd( new QSPage() ); + + // printer is used for paper size and displaying printing margins + doc->setPrinter( new QPrinter() ); + + // create the view + QSPlotView *view = new QSPlotView( mw ); + view->setWorkbook( doc ); + mw->setCentralWidget( view ); + + // create axes object and add it to the workbook + QSAxes3D *axes = new QSAxes3D(); + doc->page(0)->objects()->add( axes->shadowObject() ); + + // only selected axes displayed when full page is off + view->selection()->set( axes->shadowObject() ); + view->setFullPage( false ); + + // funny sliders should change the viewpoint + view->bindSlider( QSPlotView::HorizontalSlider, "azimuth", 0, 359 ); + view->bindSlider( QSPlotView::VerticalSlider, "elevation", -90, 90 ); + + // create dataset + QSSurface *s1 = new QSSurface( axes ); axes->plotAdd( s1 ); + s1->setMatrix( QSSurface::ZData, new Surface1() ); + + // this is how we can see to which axis this dataset is bound to + // ( there can be many X Axes in QSAxes3D ). + s1->defaultAxis(QSAxis::XAxisType)->setRange(10.0,100.0); + + mw->setCaption( "surface demo" ); + mw->show(); + a.connect( &a, SIGNAL(lastWindowClosed()), &a, SLOT(quit()) ); + return a.exec(); +} diff --git a/kmatplot/dialogs/Makefile.am b/kmatplot/dialogs/Makefile.am new file mode 100644 index 0000000..cd8bbc5 --- /dev/null +++ b/kmatplot/dialogs/Makefile.am @@ -0,0 +1,87 @@ +INCLUDES = $(all_includes) + +KDE_OPTIONS = qtonly +SUBDIRS = templates +noinst_LIBRARIES = libdialogs.a +libdialogs_a_METASOURCES = AUTO + +libdialogs_a_SOURCES = kstextedit.cpp \ + kspanel.cpp \ + ksmpanel.cpp \ + ksattrpanelinterf.ui \ + ksattrpanel.cpp \ + ksattrbtn.cpp \ + kschannellist.cpp \ + ksmpanelformulainterf.ui \ + ksmpanelmatrixinterf.ui \ + ksmpanelrefinterf.ui \ + ksmpanelstringinterf.ui \ + ksmpanels.cpp \ + kspanelaxisinterf.ui \ + kspanelcarrowinterf.ui \ + kspanelclabelinterf.ui \ + kspanelclegendcinterf.ui \ + kspanelcontourinterf.ui \ + kspanelcposinterf.ui \ + kspanelcrectinterf.ui \ + kspanelcubeinterf.ui \ + kspanelcurveinterf.ui \ + kspanelfigureinterf.ui \ + kspanelframeinterf.ui \ + kspanelgeneralinterf.ui \ + kspanelglinterf.ui \ + kspanelgradientinterf.ui \ + kspanelgridinterf.ui \ + kspanelimageinterf.ui \ + kspanellightinterf.ui \ + kspanelmeshinterf.ui \ + kspanelrangeinterf.ui \ + kspanelsurfaceinterf.ui \ + kspanelviewinterf.ui \ + kspanels.cpp \ + ksgriddlginterf.ui \ + ksimportdlginterf.ui \ + ksexportdlginterf.ui \ + ksdatasetdlginterf.ui \ + ksexportpicturedlginterf.ui \ + ksobjecttreedlginterf.ui \ + ksconfiguredlginterf.ui \ + ksgriddlg.cpp \ + ksexportdlg.cpp \ + ksimportdlg.cpp \ + ksdatasetdlg.cpp \ + ksexportpicturedlg.cpp \ + ksobjecttreedlg.cpp \ + ksconfiguredlg.cpp \ + kswizarddlgsurfaceinterf.ui \ + kswizarddlgs.cpp \ + kssheetdlgcellrangeinterf.ui \ + kssheetdlgcoldatainterf.ui \ + kssheetdlgsequenceinterf.ui \ + kssheetdlgvaluerangeinterf.ui \ + kssheetdlgs.cpp \ + ksgraphwizardinterf.ui \ + ksgraphwizard.cpp + + +EXTRA_DIST = kstextedit.h \ + kspanel.h \ + ksattrpanel.h \ + ksmpanel.h \ + kspanels.h \ + ksmpanels.h \ + kschannellist.h \ + ksattrbtn.h \ + ksgriddlg.h \ + ksimportdlg.h \ + ksexportdlg.h \ + ksdatasetdlg.h \ + ksexportpicturedlg.h \ + ksobjecttreedlg.h \ + ksconfiguredlg.h \ + kswizarddlgs.h \ + kssheetdlgs.h \ + ksgraphwizard.h + + + diff --git a/kmatplot/dialogs/ksattrbtn.cpp b/kmatplot/dialogs/ksattrbtn.cpp new file mode 100644 index 0000000..b750490 --- /dev/null +++ b/kmatplot/dialogs/ksattrbtn.cpp @@ -0,0 +1,457 @@ +/*************************************************************************** + ksattrbtn.cpp + ------------------- + begin : Fri Jan 7 2000 + copyright : (C) 2000 by Kamil Dobkowski + email : kamildbk@friko.onet.pl + ***************************************************************************/ + +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + +#include "ksattrbtn.h" +#include "ksattrpanel.h" +#include "../widgets/qsdrvqt.h" +#include + +#define BTN_HSPACE 5 +#define BTN_VSPACE 3 + +KSAttrBtn::KSAttrBtn(QWidget *parent, const char *name ) +: QPushButton(parent,name) + { + m_attr_panel = NULL; + setDefault( false ); + setAutoDefault( false ); + setSizePolicy( QSizePolicy( QSizePolicy::Preferred, QSizePolicy::Preferred ) ); + connect( this, SIGNAL(clicked()), this, SLOT(slot_show_panel()) ); + } + +//-----------------------------------------------------------// + +KSAttrBtn::~KSAttrBtn() + { + delete m_attr_panel; + } + +//-----------------------------------------------------------// + +void KSAttrBtn::slot_show_panel() + { + delete m_attr_panel; + m_attr_panel = new KSAttrPanel( this ); + //m_attr_panel->move( 0, 0 ); + //m_attr_panel->resize( parentWidget()->size() ); + //connect( m_attr_panel, SIGNAL(acceptValue()), this, SLOT(slot_accept_value()) ); + prepare( m_attr_panel ); + //m_attr_panel->show(); + if ( m_attr_panel->exec() ) accept( m_attr_panel ); + delete m_attr_panel; + m_attr_panel = NULL; + } + +//-----------------------------------------------------------// +/* +void KSAttrBtn::slot_accept_value() + { + if ( m_attr_panel ) { + if ( m_attr_panel->result() ) accept( m_attr_panel ); + delete m_attr_panel; + m_attr_panel = NULL; + } + } +*/ +//-----------------------------------------------------------// +//-----------------------------------------------------------// +//-----------------------------------------------------------// + +KSFillBtn::KSFillBtn( QWidget *parent, const char *name) +:KSAttrBtn(parent,name) + { + } + +//-----------------------------------------------------------// + +KSFillBtn::~KSFillBtn() + { + } + +//-----------------------------------------------------------// + +void KSFillBtn::setDialogFill( const QSGFill &new_f ) + { + f = new_f; + emit attrChanged(); + update(); + } + +//-----------------------------------------------------------// + +void KSFillBtn::drawButtonLabel( QPainter *p ) + { + QRect r = rect(); + r.setCoords( r.left()+BTN_HSPACE, + r.top()+BTN_VSPACE, + r.right()-BTN_HSPACE, + r.bottom()-BTN_VSPACE ); + + if ( f.style == QSGFill::Transparent ) { + QFont fnt = font(); fnt.setPointSize( 10 ); + p->setFont( fnt ); + p->setPen( white ); + p->fillRect( r, black ); + p->drawText( 0, + 0, + size().width(), + size().height(), + AlignHCenter | + AlignVCenter, + tr("Transparent") ); + } else { + p->setPen( black ); + QSDrvQt drv; // we use only a canvas driver so NULL is allowed + drv.setDC( p, 72, false ); + drv.startDrawing(); + drv.setFill( f ); + drv.drawRect( QSPt2f(r.x(),r.y()), QSPt2f(r.right(),r.bottom()) ); + drv.stopDrawing(); + } + } + +//-----------------------------------------------------------// + +void KSFillBtn::prepare( KSAttrPanel *panel ) + { + KSSelectFill *fpanel = new KSSelectFill( panel->subPanelPlace1() ); + KSSelectColor *cpanel = new KSSelectColor( panel->subPanelPlace2() ); + panel->setSubPanel1( fpanel ); + panel->setSubPanel2( cpanel ); + fpanel->setPanelFill( f ); + cpanel->setPanelColor( f.color ); + } + +//-----------------------------------------------------------// + +void KSFillBtn::accept( KSAttrPanel *panel ) + { + QSGFill fill = ((KSSelectFill *)panel->subPanel1())->panelFill(); + fill.color = ((KSSelectColor *)panel->subPanel2())->panelColor(); + setDialogFill( fill ); + } + +//-----------------------------------------------------------// +//-----------------------------------------------------------// +//-----------------------------------------------------------// + +KSFontBtn::KSFontBtn( QWidget *parent, const char *name) +:KSAttrBtn(parent,name) + { + } + +//-----------------------------------------------------------// + +KSFontBtn::~KSFontBtn() + { + } + +//-----------------------------------------------------------// + +void KSFontBtn::setDialogFont( const QSGFont &new_f ) + { + f = new_f; + emit attrChanged(); + update(); + } + +//-----------------------------------------------------------// + +void KSFontBtn::drawButtonLabel( QPainter * p ) + { + QFont c = QSDrvQt::toQFont( f ); c.setPointSize( 10 ); + + p->setPen( black ); + p->setFont( c ); + p->drawText( 0, 0, + size().width(), + size().height(), + AlignHCenter | + AlignVCenter, + c.family() ); + } + +//-----------------------------------------------------------// + +void KSFontBtn::prepare( KSAttrPanel *panel ) + { + KSSelectFont *fpanel = new KSSelectFont( panel->subPanelPlace1() ); + KSSelectColor *cpanel = new KSSelectColor( panel->subPanelPlace2() ); + panel->setSubPanel1( fpanel ); + panel->setSubPanel2( cpanel ); + fpanel->setPanelFont( f ); + cpanel->setPanelColor( f.color ); + } + +//-----------------------------------------------------------// + +void KSFontBtn::accept( KSAttrPanel *panel ) + { + QSGFont font = ((KSSelectFont *)panel->subPanel1())->panelFont(); + font.color = ((KSSelectColor *)panel->subPanel2())->panelColor(); + setDialogFont( font ); + } + +//-----------------------------------------------------------// +//-----------------------------------------------------------// +//-----------------------------------------------------------// + +KSLineBtn::KSLineBtn( QWidget *parent, const char *name) +:KSAttrBtn(parent,name) + { + } + +//-----------------------------------------------------------// + +KSLineBtn::~KSLineBtn() + { + } + +//-----------------------------------------------------------// + +void KSLineBtn::setDialogLine( const QSGLine &new_l ) + { + l = new_l; + emit attrChanged(); + update(); + } + +//-----------------------------------------------------------// + +void KSLineBtn::drawButtonLabel( QPainter * p ) + { + QRect r = rect(); + r.setCoords( r.left()+BTN_HSPACE, + r.top()+BTN_VSPACE, + r.right()-BTN_HSPACE, + r.bottom()-BTN_VSPACE ); + + p->setPen( black ); + p->setBrush( white ); + p->drawRect( r ); + + p->setClipRect( r ); + if ( l.style != QSGLine::Invisible ) { + + p->setPen( QSDrvQt::toQPen(l) ); + p->drawLine( r.left() + 4, r.center().y(), + r.right() - 4, r.center().y() ); + } else { + + QFont f = font();f.setPointSize( 10 ); + p->setFont( f ); + p->setPen( black ); + p->drawText( 0, 0, + size().width(), + size().height(), + AlignHCenter | + AlignVCenter, + tr("Invisible") ); + } + + p->setClipping( false ); + } + +//-----------------------------------------------------------// + +void KSLineBtn::prepare( KSAttrPanel *panel ) + { + KSSelectLine *lpanel = new KSSelectLine( panel->subPanelPlace1() ); + KSSelectColor *cpanel = new KSSelectColor( panel->subPanelPlace2() ); + panel->setSubPanel1( lpanel ); + panel->setSubPanel2( cpanel ); + lpanel->setPanelLine( l ); + cpanel->setPanelColor( l.color ); + } + +//-----------------------------------------------------------// + +void KSLineBtn::accept( KSAttrPanel *panel ) + { + QSGLine line = ((KSSelectLine *)panel->subPanel1())->panelLine(); + line.color = ((KSSelectColor *)panel->subPanel2())->panelColor(); + setDialogLine( line ); + } + +//-----------------------------------------------------------// +//-----------------------------------------------------------// +//-----------------------------------------------------------// + +KSPointBtn::KSPointBtn(QWidget *parent, const char *name) +:KSAttrBtn(parent,name) + { + } + +//-----------------------------------------------------------// + +KSPointBtn::~KSPointBtn() + { + } + +//-----------------------------------------------------------// + +void KSPointBtn::setDialogPoint( const QSGPoint &new_p ) + { + p = new_p; + attrChanged(); + update(); + } + +//-----------------------------------------------------------// + +void KSPointBtn::drawButtonLabel( QPainter *paint ) + { + QRect r = rect(); + + r.setCoords( r.left()+BTN_HSPACE, + r.top()+BTN_VSPACE, + r.right()-BTN_HSPACE, + r.bottom()-BTN_VSPACE ); + + paint->setPen( black ); + paint->setBrush( white ); + paint->drawRect( r ); + + paint->setClipRect( r ); + if ( p.style != QSGPoint::Invisible ) { + QSPt2f mid( r.center().x(), r.center().y() ); + QSDrvQt drv; // we use only canvas driver, so NULL is allowed + drv.setDC( paint, 72, false ); + drv.startDrawing(); + drv.drawPoint( mid, p ); + drv.stopDrawing(); + } else { + QFont f = font();f.setPointSize( 10 ); + paint->setFont( f ); + paint->setPen( black ); + paint->drawText( 0, 0, + size().width(), + size().height(), + AlignHCenter | + AlignVCenter, + tr("Invisible") ); + } + } + +//-----------------------------------------------------------// + +void KSPointBtn::prepare( KSAttrPanel *panel ) + { + KSSelectPoint *ppanel = new KSSelectPoint( panel->subPanelPlace1() ); + KSSelectColor *cpanel = new KSSelectColor( panel->subPanelPlace2() ); + panel->setSubPanel1( ppanel ); + panel->setSubPanel2( cpanel ); + ppanel->setPanelPoint( p ); + cpanel->setPanelColor( p.color ); + } + +//-----------------------------------------------------------// + +void KSPointBtn::accept( KSAttrPanel *panel ) + { + QSGPoint point = ((KSSelectPoint *)panel->subPanel1())->panelPoint(); + point.color = ((KSSelectColor *)panel->subPanel2())->panelColor(); + setDialogPoint( point ); + } + +//-----------------------------------------------------------// +//-----------------------------------------------------------// +//-----------------------------------------------------------// + +KSArrowBtn::KSArrowBtn(QWidget *parent, bool origin, const char *name) +:KSAttrBtn(parent,name) + { + m_origin = origin; + } + +//-----------------------------------------------------------// + +KSArrowBtn::~KSArrowBtn() + { + } + +//-----------------------------------------------------------// + +void KSArrowBtn::setDialogArrow( const QSGArrow &new_a ) + { + a = new_a; + attrChanged(); + update(); + } + +//-----------------------------------------------------------// + +void KSArrowBtn::setOrigin( bool origin ) + { + m_origin = origin; + update(); + } + +//-----------------------------------------------------------// + +void KSArrowBtn::drawButtonLabel( QPainter *paint ) + { + QRect r = rect(); + + r.setCoords( r.left()+BTN_HSPACE, + r.top()+BTN_VSPACE, + r.right()-BTN_HSPACE, + r.bottom()-BTN_VSPACE ); + + paint->setPen( black ); + paint->setBrush( white ); + paint->drawRect( r ); + + paint->setClipRect( r ); + if ( a.style != QSGArrow::None ) { + QSPt2f mid( r.center().x(), r.center().y() ); + QSDrvQt drv; // we use only a canvas driver so NULL is allowed + QSGLine l; + drv.setDC( paint, 72, false ); + drv.startDrawing(); + drv.setLine( l ); + drv.drawDart( mid, m_origin?180.0:0.0, a ); + drv.stopDrawing(); + } else { + QFont f = font();f.setPointSize( 10 ); + paint->setFont( f ); + paint->setPen( black ); + paint->drawText( r, + AlignHCenter | + AlignVCenter, + tr("None") ); + } + } + + +//-----------------------------------------------------------// + +void KSArrowBtn::prepare( KSAttrPanel *panel ) + { + KSSelectArrow *apanel = new KSSelectArrow( panel->subPanelPlace1() ); + panel->setSubPanel1( apanel ); + apanel->setPanelArrow( a ); + } + +//-----------------------------------------------------------// + +void KSArrowBtn::accept( KSAttrPanel *panel ) + { + QSGArrow arrow = ((KSSelectArrow *)panel->subPanel1())->panelArrow(); + setDialogArrow( arrow ); + } + diff --git a/kmatplot/dialogs/ksattrbtn.h b/kmatplot/dialogs/ksattrbtn.h new file mode 100644 index 0000000..2846f86 --- /dev/null +++ b/kmatplot/dialogs/ksattrbtn.h @@ -0,0 +1,146 @@ +/*************************************************************************** + ksattrbtn.h + ------------------- + begin : Fri Jan 7 2000 + copyright : (C) 2000 by Kamil Dobkowski + email : kamildbk@friko.onet.pl + ***************************************************************************/ + +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + +#ifndef KSATTRIBBUTTON_H +#define KSATTRIBBUTTON_H + +#include +#include "../widgets/qsgattr.h" + +class QWidget; +class KSAttrPanel; + +/** + *@author Kamil Dobkowski + */ +class KSAttrBtn : public QPushButton + { + Q_OBJECT + public: + KSAttrBtn(QWidget *parent=0, const char *name=0); + virtual ~KSAttrBtn(); + + signals: + void attrChanged(); + + protected: + virtual void prepare( KSAttrPanel *panel ) = 0; + virtual void accept( KSAttrPanel *panel ) = 0; + + private slots: + void slot_show_panel(); + //void slot_accept_value(); + + private: + KSAttrPanel *m_attr_panel; + }; + +//-----------------------------------------------------------// + +class KSFillBtn : public KSAttrBtn + { + Q_OBJECT + public: + KSFillBtn( QWidget *parent=0, const char *name=0); + virtual ~KSFillBtn(); + void setDialogFill( const QSGFill &f ); + QSGFill dialogFill() const { return f; } + + protected: + void drawButtonLabel ( QPainter * p ); + QSGFill f; + virtual void prepare( KSAttrPanel *panel ); + virtual void accept( KSAttrPanel *panel ); + + }; + +//-----------------------------------------------------------// + +class KSFontBtn : public KSAttrBtn + { + Q_OBJECT + public: + KSFontBtn( QWidget *parent=0, const char *name=0); + virtual ~KSFontBtn(); + void setDialogFont( const QSGFont &f ); + QSGFont dialogFont() const { return f; } + + protected: + void drawButtonLabel ( QPainter * p ); + QSGFont f; + virtual void prepare( KSAttrPanel *panel ); + virtual void accept( KSAttrPanel *panel ); + }; + +//-----------------------------------------------------------// + +class KSLineBtn : public KSAttrBtn + { + Q_OBJECT + public: + KSLineBtn( QWidget *parent=0, const char *name=0); + virtual ~KSLineBtn(); + void setDialogLine( const QSGLine &l ); + QSGLine dialogLine() const { return l; } + + protected: + void drawButtonLabel ( QPainter * p ); + QSGLine l; + virtual void prepare( KSAttrPanel *panel ); + virtual void accept( KSAttrPanel *panel ); + }; + +//-----------------------------------------------------------// + +class KSPointBtn : public KSAttrBtn + { + Q_OBJECT + public: + KSPointBtn(QWidget *parent=0, const char *name=0); + virtual ~KSPointBtn(); + void setDialogPoint( const QSGPoint &p ); + QSGPoint dialogPoint() const { return p; } + + protected: + void drawButtonLabel( QPainter *p ); + QSGPoint p; + virtual void prepare( KSAttrPanel *panel ); + virtual void accept( KSAttrPanel *panel ); + }; + +//-----------------------------------------------------------// + +class KSArrowBtn : public KSAttrBtn + { + Q_OBJECT + public: + KSArrowBtn(QWidget *parent=0, bool origin=false, const char *name=0); + virtual ~KSArrowBtn(); + void setDialogArrow( const QSGArrow &a ); + QSGArrow dialogArrow() const { return a; } + void setOrigin( bool origin ); + bool isOrigin() const { return m_origin; } + + protected: + void drawButtonLabel( QPainter *p ); + QSGArrow a; + bool m_origin; + virtual void prepare( KSAttrPanel *panel ); + virtual void accept( KSAttrPanel *panel ); + }; + +#endif diff --git a/kmatplot/dialogs/ksattrpanel.cpp b/kmatplot/dialogs/ksattrpanel.cpp new file mode 100644 index 0000000..c467474 --- /dev/null +++ b/kmatplot/dialogs/ksattrpanel.cpp @@ -0,0 +1,1157 @@ +/*************************************************************************** + ksattrpanel.cpp + ------------------- + begin : Tue Oct 10 2000 + copyright : (C) 2000 by Kamil Dobkowski + email : kamildobk@friko.onet.pl + ***************************************************************************/ + +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + +#include "ksattrpanel.h" +#include "../widgets/qsdrvqt.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +//--------------------------------------------------------------// + +KSAttrPanel::KSAttrPanel(QWidget *parent, const char *name ) +: KSAttrPanelInterf(parent,name,TRUE) + { + //m_result = false; + m_subpanel_1 = NULL; + m_subpanel_2 = NULL; + //connect( buttonApply, SIGNAL(clicked()), this, SLOT(apply_clicked()) ); + //connect( buttonCancel, SIGNAL(clicked()), this, SLOT(cancel_clicked()) ); + } + +//--------------------------------------------------------------// + +KSAttrPanel::~KSAttrPanel() + { + delete m_subpanel_1; + delete m_subpanel_2; + } + +//--------------------------------------------------------------// + +void KSAttrPanel::setSubPanel1( QWidget *panel ) + { + delete m_subpanel_1; + m_subpanel_1 = panel; + m_subpanel_1->resize( placePanel1->size() ); + placePanel1->setColumnLayout( 1, Horizontal ); + m_subpanel_1->show(); + } + +//--------------------------------------------------------------// + +void KSAttrPanel::setSubPanel2( QWidget *panel ) + { + delete m_subpanel_2; + m_subpanel_2 = panel; + m_subpanel_2->resize( placePanel2->size() ); + placePanel2->setColumnLayout( 1, Horizontal ); + m_subpanel_2->show(); + } + +//--------------------------------------------------------------// + +QWidget *KSAttrPanel::subPanel1() const + { + return m_subpanel_1; + } + +//--------------------------------------------------------------// + +QWidget *KSAttrPanel::subPanel2() const + { + return m_subpanel_2; + } + +//-------------------------------------------------------------- + +QWidget *KSAttrPanel::subPanelPlace1() const + { + return placePanel1; + } + +//-------------------------------------------------------------- + +QWidget *KSAttrPanel::subPanelPlace2() const + { + return placePanel2; + } + +//--------------------------------------------------------------// + +/* +void KSAttrPanel::apply_clicked() + { + m_result = true; + //emit acceptValue(); + } + +//--------------------------------------------------------------// + +void KSAttrPanel::cancel_clicked() + { + m_result = false; + //emit acceptValue(); + } +*/ +//-------------------------------------------------------------// +//-------------------------------------------------------------// +//-------------------------------------------------------------// +//-------------------------------------------------------------// +//-------------------------------------------------------------// +//-------------------------------------------------------------// + + + +class KSListBoxArrow : public QListBoxItem + { + public: + KSListBoxArrow( QListBox *parent, const QSGArrow &p, const QString& name ); + virtual ~KSListBoxArrow(); + virtual int height ( const QListBox * ) const; + virtual int width ( const QListBox * ) const; + QSGArrow arrow; + protected: + virtual void paint ( QPainter * ); + }; + +//-------------------------------------------------------------// + +// +// List item which consist of a dart shape and a label. +// + +#define ARROWBOX_SIZE_W 20 +#define ARROWBOX_SIZE_H 15 +#define ARROWBOX_KSPACING_W 5 +#define ARROWBOX_KSPACING_H 5 + +KSListBoxArrow::KSListBoxArrow( QListBox *parent, const QSGArrow &init_a, const QString& name ) +:QListBoxItem(parent), arrow(init_a) + { + setText( name ); + } + +//-------------------------------------------------------------// + +KSListBoxArrow::~KSListBoxArrow() + { + } + +//-------------------------------------------------------------// + +int KSListBoxArrow::height( const QListBox *lb ) const + { + return QMAX( ARROWBOX_SIZE_H+2*ARROWBOX_KSPACING_H, lb->fontMetrics().lineSpacing()+1 ); + } + +//-------------------------------------------------------------// + +int KSListBoxArrow::width( const QListBox *lb ) const + { + return lb->fontMetrics().width(text()) + ARROWBOX_SIZE_W + ARROWBOX_KSPACING_W*3; + } + +//-------------------------------------------------------------// + +void KSListBoxArrow::paint( QPainter *p ) + { + int w = p->fontMetrics().width(text()) + ARROWBOX_SIZE_W + 3*ARROWBOX_KSPACING_W; + int h = QMAX( ARROWBOX_SIZE_H+2*ARROWBOX_KSPACING_H, p->fontMetrics().lineSpacing()+1 ); + + QRect r( ARROWBOX_KSPACING_W, + (h-ARROWBOX_SIZE_H)/2, + ARROWBOX_SIZE_W, + ARROWBOX_SIZE_H ); + + QSDrvQt drv; + QSGLine l; + l.color = QSDrvQt::toQSGColor(p->pen().color()); + QSGArrow temp_a = arrow; + temp_a.size = 5; + drv.setDC(p,72,false); + drv.startDrawing(); + drv.setLine(l); + drv.drawDart(QSPt2f(r.center().x(),r.center().y()),0,temp_a); + drv.stopDrawing(); + p->drawText( ARROWBOX_SIZE_W+2*ARROWBOX_KSPACING_W, + 0, w, h, Qt::AlignLeft | Qt::AlignVCenter, text() ); + } + +//--------------------------------------------------------------// +//--------------------------------------------------------------// +//--------------------------------------------------------------// +//--------------------------------------------------------------// +//--------------------------------------------------------------// + + +KSSelectArrow::KSSelectArrow( QWidget *parent ) +: QWidget( parent ) + { + m_layout = new QGridLayout( this, 2, 2, 2 ); + m_list = new QListBox( this ); + m_label = new QLabel( tr("Size (points):"), this ); + m_size = new QSpinBox( 0, 999, 1, this ); + m_layout->addMultiCellWidget( m_list, 0, 0, 0, 1 ); + m_layout->addWidget( m_label, 1, 0 ); + m_layout->addWidget( m_size, 1, 1 ); + + QSGArrow a; a.style = QSGArrow::None; m_arrow = a; + a.style = QSGArrow::None; new KSListBoxArrow( m_list, a, tr("None") ); + a.style = QSGArrow::Arrow; new KSListBoxArrow( m_list, a, tr("Arrow") ); + a.style = QSGArrow::FArrow; new KSListBoxArrow( m_list, a, tr("Filled Arrow") ); + a.style = QSGArrow::NArrow; new KSListBoxArrow( m_list, a, tr("Narrow Arrow") ); + a.style = QSGArrow::RArrow; new KSListBoxArrow( m_list, a, tr("Arrow") ); + a.style = QSGArrow::RFArrow; new KSListBoxArrow( m_list, a, tr("Filled Arrow") ); + a.style = QSGArrow::RNArrow; new KSListBoxArrow( m_list, a, tr("Narrow Arrow") ); + + a.style = QSGArrow::Rect; new KSListBoxArrow( m_list, a, tr("Rectangle") ); + a.style = QSGArrow::Diamond; new KSListBoxArrow( m_list, a, tr("Diamond") ); + a.style = QSGArrow::Circle; new KSListBoxArrow( m_list, a, tr("Circle") ); + a.style = QSGArrow::Line; new KSListBoxArrow( m_list, a, tr("Line") ); + a.style = QSGArrow::FDiagLine; new KSListBoxArrow( m_list, a, tr("FDiag Line") ); + a.style = QSGArrow::BDiagLine; new KSListBoxArrow( m_list, a, tr("BDiag Line") ); + + m_list->setCurrentItem(0); + connect( m_list, SIGNAL(highlighted(int)), this, SLOT(changePanelArrow(int)) ); + connect( m_size, SIGNAL(valueChanged(int)), this, SLOT(changePanelArrow(int)) ); + } + +//-------------------------------------------------------------// + +KSSelectArrow::~KSSelectArrow() + { + } + +//-------------------------------------------------------------// + +void KSSelectArrow::setPanelArrow( const QSGArrow& new_arrow ) + { + if ( m_arrow != new_arrow ) { + m_arrow = new_arrow; + disconnect( m_list, SIGNAL(highlighted(int)), this, SLOT(changePanelArrow(int)) ); + disconnect( m_size, SIGNAL(valueChanged(int)), this, SLOT(changePanelArrow(int)) ); + m_size->setValue( m_arrow.size ); + for ( int i=0; i<(int )m_list->count(); i++ ) { + KSListBoxArrow *item = dynamic_cast( m_list->item(i) ); + if ( item && item->arrow.style == m_arrow.style ) { m_list->setCurrentItem(i); break; } + } + connect( m_list, SIGNAL(highlighted(int)), this, SLOT(changePanelArrow(int)) ); + connect( m_size, SIGNAL(valueChanged(int)), this, SLOT(changePanelArrow(int)) ); + } + } + +//-------------------------------------------------------------// + +void KSSelectArrow::changePanelArrow(int) + { + KSListBoxArrow *item = dynamic_cast( m_list->item( m_list->currentItem() ) ); + if ( item ) { + QSGArrow new_arrow = m_arrow; + new_arrow.style = item->arrow.style; + new_arrow.size = m_size->value(); + setPanelArrow( new_arrow ); + } + } + + + +//-----------------------------------------------------------------// +//-----------------------------------------------------------------// +//-----------------------------------------------------------------// +//-----------------------------------------------------------------// +//-----------------------------------------------------------------// +//-----------------------------------------------------------------// +//-----------------------------------------------------------------// + + +class KSListBoxColor : public QListBoxItem + { + public: + KSListBoxColor( QListBox *parent, const QColor &c, const QString& name ); + virtual ~KSListBoxColor(); + virtual int height ( const QListBox * ) const; + virtual int width ( const QListBox * ) const; + QColor color; + protected: + virtual void paint ( QPainter * ); + }; + +#define COLORBOX_SIZE_W 15 +#define COLORBOX_SIZE_H 10 +#define COLORBOX_SPACING_W 5 +#define COLORBOX_SPACING_H 5 + +KSListBoxColor::KSListBoxColor( QListBox *parent, const QColor &init_color, const QString& name ) +:QListBoxItem(parent), color(init_color) + { + setText( name ); + } + +//-------------------------------------------------------------// + +KSListBoxColor::~KSListBoxColor() + { + } + +//-------------------------------------------------------------// + +int KSListBoxColor::height( const QListBox *lb ) const + { + QFontMetrics fm = lb->fontMetrics(); + return QMAX( COLORBOX_SIZE_H+2*COLORBOX_SPACING_H, fm.lineSpacing()+1 ); + } + +//-------------------------------------------------------------// + +int KSListBoxColor::width( const QListBox *lb ) const + { + QFontMetrics fm = lb->fontMetrics(); + return fm.width(text()) + COLORBOX_SIZE_W + COLORBOX_SPACING_W*3; + } + +//-------------------------------------------------------------// + +void KSListBoxColor::paint( QPainter *p ) + { + QFontMetrics fm = p->fontMetrics(); + int w = fm.width(text()) + COLORBOX_SIZE_W + 3*COLORBOX_SPACING_W; + int h = QMAX( COLORBOX_SIZE_H+2*COLORBOX_SPACING_H, fm.lineSpacing()+1 ); + + QRect r( COLORBOX_SPACING_W, + (h-COLORBOX_SIZE_H)/2, + COLORBOX_SIZE_W, + COLORBOX_SIZE_H ); + + p->fillRect( r, color ); + p->drawText( COLORBOX_SIZE_W+2*COLORBOX_SPACING_W, + 0, + w, + h, + Qt::AlignLeft | Qt::AlignVCenter, + text() ); + } + + +//-------------------------------------------------------------// +//-------------------------------------------------------------// +//-------------------------------------------------------------// +//-------------------------------------------------------------// +//--------------------------------------------------------------// + + +KSSelectColor::KSSelectColor( QWidget *parent ) +: QWidget( parent ) + { + m_layout = new QGridLayout( this, 3, 2, 2 ); + m_list = new QListBox( this ); + m_label = new QLabel( tr("Alpha:"), this ); + m_alpha = new QSpinBox( 0, 255, 1, this ); + m_custom = new QPushButton( tr("Custom ..."), this ); + m_layout->addMultiCellWidget( m_list, 0, 0, 0, 1 ); + m_layout->addWidget( m_label, 1, 0 ); + m_layout->addWidget( m_alpha, 1, 1 ); + m_layout->addMultiCellWidget( m_custom, 2, 2, 0, 1 ); + + new KSListBoxColor( m_list, white, tr("Custom") ); + new KSListBoxColor( m_list, black, tr("Black") ); + new KSListBoxColor( m_list, white, tr("White") ); + new KSListBoxColor( m_list, darkGray, tr("Dark Gray") ); + new KSListBoxColor( m_list, gray, tr("Gray") ); + new KSListBoxColor( m_list, lightGray, tr("Light Gray") ); + new KSListBoxColor( m_list, red, tr("Red") ); + new KSListBoxColor( m_list, green, tr("Green") ); + new KSListBoxColor( m_list, blue, tr("Blue") ); + new KSListBoxColor( m_list, cyan, tr("Cyan") ); + new KSListBoxColor( m_list, magenta, tr("Magenta") ); + new KSListBoxColor( m_list, yellow, tr("Yellow") ); + new KSListBoxColor( m_list, darkRed, tr("Dark Red") ); + new KSListBoxColor( m_list, darkGreen, tr("DarkGren") ); + new KSListBoxColor( m_list, darkBlue, tr("Dark Blue") ); + new KSListBoxColor( m_list, darkCyan, tr("Dark Cyan") ); + new KSListBoxColor( m_list, darkMagenta, tr("Dark Magenta") ); + new KSListBoxColor( m_list, darkYellow, tr("Dark Yellow") ); + + m_color = black; + m_list->setCurrentItem(1); + m_list->setHScrollBarMode( QScrollView::AlwaysOff ); + m_color_alpha = 255; + m_alpha->setValue( m_color_alpha ); + connect( m_custom, SIGNAL(clicked()), this, SLOT(showColorDialog()) ); + connect( m_list, SIGNAL(highlighted(int)), this, SLOT(changePanelColor(int)) ); + connect( m_alpha, SIGNAL(valueChanged(int)), this, SLOT(changePanelAlpha(int)) ); + } + +//--------------------------------------------------------------// + +KSSelectColor::~KSSelectColor() + { + } + + +//-------------------------------------------------------------// + +void KSSelectColor::setPanelColor( const QSGColor& new_color ) + { + QColor color( new_color.r, new_color.g, new_color.b ); + if ( m_color != color ) { + int i; + for ( i=1; i<(int )m_list->count(); i++ ) { + KSListBoxColor *item = dynamic_cast(m_list->item(i)); + if ( item && item->color == color ) { m_color = color; m_list->setCurrentItem(i); break; } + } + // not ont the list + if ( i == (int )m_list->count() ) { + dynamic_cast(m_list->item(0))->color = m_color = color; + m_list->setCurrentItem( 0 ); + m_list->triggerUpdate(TRUE); + } + } + + unsigned char alpha = new_color.a; + if ( alpha != m_color_alpha ) { + m_color_alpha = alpha; + m_alpha->setValue( m_color_alpha ); + } + } + +//-------------------------------------------------------------// + +QSGColor KSSelectColor::panelColor() const + { + return QSGColor( m_color.red(), m_color.green(), m_color.blue(), m_color_alpha ); + } + +//-------------------------------------------------------------// + +void KSSelectColor::showColorDialog() + { + QColor color = QColorDialog::getColor( m_color, this ); + if ( color.isValid() ) setPanelColor( QSGColor(color.red(),color.green(),color.blue(),m_color_alpha) ); + } + +//-------------------------------------------------------------// + +void KSSelectColor::changePanelColor( int ) + { + KSListBoxColor *item = dynamic_cast(m_list->item(m_list->currentItem())); + if ( item ) m_color = item->color; + } + +//-------------------------------------------------------------// + +void KSSelectColor::changePanelAlpha( int value ) + { + if ( m_alpha->text().length() > 0 ) m_color_alpha = (unsigned char )value; + } + +//-------------------------------------------------------------// +//-------------------------------------------------------------// +//-------------------------------------------------------------// +//-------------------------------------------------------------// +//-------------------------------------------------------------// +//-------------------------------------------------------------// + +class KSListBoxFill : public QListBoxItem + { + public: + KSListBoxFill( QListBox *parent, const QBrush &b, const QString& name ); + virtual ~KSListBoxFill(); + virtual int height( const QListBox * ) const; + virtual int width ( const QListBox * ) const; + QBrush brush; + + protected: + virtual void paint ( QPainter * ); + }; + +//-----------------------------------------------------------// +//-----------------------------------------------------------// +//-----------------------------------------------------------// +//-----------------------------------------------------------// +//-----------------------------------------------------------// +//-----------------------------------------------------------// + +#define FILLBOX_SIZE_W 20 +#define FILLBOX_SIZE_H 15 +#define FILLBOX_KSACING_W 5 +#define FILLBOX_KSACING_H 5 + +KSListBoxFill::KSListBoxFill( QListBox *parent, const QBrush &init_brush, const QString& name ) +:QListBoxItem(parent), brush(init_brush) + { + setText( name ); + } + +//-------------------------------------------------------------// + +KSListBoxFill::~KSListBoxFill() + { + } + +//-------------------------------------------------------------// + +int KSListBoxFill::height( const QListBox *lb ) const + { + return QMAX( FILLBOX_SIZE_H+2*FILLBOX_KSACING_H, lb->fontMetrics().lineSpacing()+1 ); + } + +//-------------------------------------------------------------// + +int KSListBoxFill::width( const QListBox *lb ) const + { + return lb->fontMetrics().width(text()) + FILLBOX_SIZE_W + FILLBOX_KSACING_W*3; + } + +//-------------------------------------------------------------// + +void KSListBoxFill::paint( QPainter *p ) + { + int w = p->fontMetrics().width(text()) + FILLBOX_SIZE_W + 3*FILLBOX_KSACING_W; + int h = QMAX( FILLBOX_SIZE_H+2*FILLBOX_KSACING_H, p->fontMetrics().lineSpacing()+1 ); + + p->setBrushOrigin( 0, listBox()->itemRect(this).y() ); + + QRect r( FILLBOX_KSACING_W, + (h-FILLBOX_SIZE_H)/2, + FILLBOX_SIZE_W, + FILLBOX_SIZE_H ); + + QBrush br = QBrush( p->pen().color(), brush.style() ); + p->fillRect( r, brush ); + p->drawRect( r ); + p->drawText( FILLBOX_SIZE_W+2*FILLBOX_KSACING_W, + 0, + w, + h, + Qt::AlignLeft | Qt::AlignVCenter, + text() ); + } + +//-----------------------------------------------------------// +//-----------------------------------------------------------// + +KSSelectFill::KSSelectFill( QWidget *parent ) +: QWidget( parent ) + { + m_layout = new QGridLayout( this, 1, 2, 2 ); + m_list = new QListBox( this ); + m_layout->addMultiCellWidget( m_list, 0, 0, 0, 1 ); + new KSListBoxFill( m_list, QBrush( black, Qt::SolidPattern ), tr("Solid") ); + new KSListBoxFill( m_list, QBrush( white, Qt::NoBrush ), tr("Transparent") ) ; + new KSListBoxFill( m_list, QBrush( black, Qt::HorPattern ), tr("Horizontal Lines") ); + new KSListBoxFill( m_list, QBrush( black, Qt::VerPattern ), tr("Vertical Lines") ); + new KSListBoxFill( m_list, QBrush( black, Qt::CrossPattern ), tr("Cross Lines") ); + new KSListBoxFill( m_list, QBrush( black, Qt::BDiagPattern ), tr("BDiag Lines") ); + new KSListBoxFill( m_list, QBrush( black, Qt::FDiagPattern ), tr("FDiag Lines") ); + new KSListBoxFill( m_list, QBrush( black, Qt::DiagCrossPattern ), tr("Diag Cross Lines") ); + new KSListBoxFill( m_list, QBrush( black, Qt::Dense4Pattern ), tr("Half Pattern") ); + + m_brush = QBrush( black, Qt::SolidPattern ); + m_list->setCurrentItem( 0 ); + m_list->setHScrollBarMode( QScrollView::AlwaysOff ); + connect( m_list, SIGNAL(highlighted(int)), this, SLOT(changePanelBrush(int)) ); + } + +//-----------------------------------------------------------// + +KSSelectFill::~KSSelectFill() + { + } + +//-----------------------------------------------------------// + +void KSSelectFill::setPanelBrush( const QBrush& new_brush ) + { + QBrush brush = new_brush; brush.setColor( black ); + if ( m_brush.style() != brush.style() ) { + int i; + for ( i=0; i<(int )m_list->count(); i++ ) { + KSListBoxFill *item = dynamic_cast(m_list->item(i)); + if ( item && item->brush.style() == brush.style() ) { m_brush = brush; m_list->setCurrentItem(i); break; } + } + // not on the list + if ( i == (int )m_list->count() ) { + KSListBoxFill *item = dynamic_cast(m_list->item(0)); + if ( item ) m_brush = item->brush; + m_list->setCurrentItem(0); + m_list->triggerUpdate(TRUE); + } + } + } + +//-----------------------------------------------------------// + +void KSSelectFill::changePanelBrush(int) + { + KSListBoxFill *item = dynamic_cast(m_list->item(m_list->currentItem())); + if ( item ) setPanelBrush( item->brush ); + } + +//-----------------------------------------------------------// + +void KSSelectFill::setPanelFill( const QSGFill& fill ) + { + setPanelBrush( QSDrvQt::toQBrush( fill ) ); + } + +//-----------------------------------------------------------// + +QSGFill KSSelectFill::panelFill() const + { + QSGFill result = QSDrvQt::toQSGFill( m_brush ); + return result; + } + +//-----------------------------------------------------------// +//-----------------------------------------------------------// +//-----------------------------------------------------------// +//-----------------------------------------------------------// +//-----------------------------------------------------------// +//-----------------------------------------------------------// + +class KSListBoxFont : public QListBoxItem + { + public: + KSListBoxFont( QListBox *parent, const QFont &f, const QString& name ); + virtual ~KSListBoxFont(); + virtual int height ( const QListBox * ) const; + virtual int width ( const QListBox * ) const; + QFont font; + protected: + virtual void paint ( QPainter * ); + }; + +#define FONTBOX_KSACING_W 5 + +KSListBoxFont::KSListBoxFont( QListBox *parent, const QFont &init_font, const QString& name ) +:QListBoxItem(parent), font(init_font) + { + setText( name ); + } + +//-------------------------------------------------------------// + +KSListBoxFont::~KSListBoxFont() + { + } + +//-------------------------------------------------------------// + +int KSListBoxFont::height( const QListBox * ) const + { + return QFontMetrics(font).lineSpacing()+1; + } + +//-------------------------------------------------------------// + +int KSListBoxFont::width( const QListBox * ) const + { + return QFontMetrics(font).width(text()) + FONTBOX_KSACING_W*2; + } + +//-------------------------------------------------------------// + +void KSListBoxFont::paint( QPainter *paint ) + { + int w = QFontMetrics(font).width(text()) + FONTBOX_KSACING_W*2; + int h = QFontMetrics(font).lineSpacing()+1; + paint->setFont( font ); + paint->drawText( FONTBOX_KSACING_W, + 0, + w, + h, + Qt::AlignLeft | Qt::AlignVCenter, + text() ); + + } + +//-----------------------------------------------------------// +//-----------------------------------------------------------// +//-----------------------------------------------------------// +//-----------------------------------------------------------// +//-----------------------------------------------------------// +//-----------------------------------------------------------// +//-----------------------------------------------------------// + +KSSelectFont::KSSelectFont( QWidget *parent ) +: QWidget( parent ) + { + m_layout = new QGridLayout( this, 2, 2, 2 ); + m_list = new QListBox( this ); + m_custom = new QPushButton( tr("Custom ..."), this ); + m_layout->addMultiCellWidget( m_list, 0, 0, 0, 1 ); + m_layout->addMultiCellWidget( m_custom, 1, 1, 0, 1 ); + + QFont font( "helvetica", 10 ); + new KSListBoxFont( m_list, font, tr("Custom Style ...") ); + new KSListBoxFont( m_list, font, "Helvetica" ); + m_font = font; m_list->setCurrentItem(1); + font.setItalic( TRUE ); + new KSListBoxFont( m_list, font, "Helvetica Italic" ); + font.setItalic( FALSE ); + font.setPointSize( 8 ); + new KSListBoxFont( m_list, font, "Helvetica Small" ); + font.setBold( TRUE ); + font.setPointSize(12); + new KSListBoxFont( m_list, font, "Helvetica Large" ); + font.setFamily("Times"); + font.setPointSize(10); + font.setBold( FALSE ); + new KSListBoxFont( m_list, font, "Times" ); + font.setItalic( TRUE ); + new KSListBoxFont( m_list, font, "Times Italic" ); + font.setItalic( FALSE ); + font.setPointSize( 8 ); + new KSListBoxFont( m_list, font, "Times Small" ); + font.setFamily("Courier"); + font.setPointSize(10); + font.setBold( FALSE ); + new KSListBoxFont( m_list, font, "Courier" ); + + m_list->setHScrollBarMode( QScrollView::AlwaysOff ); + connect( m_custom, SIGNAL(clicked()), this, SLOT(showFontDialog()) ); + connect( m_list, SIGNAL(highlighted(int)), this, SLOT(changePanelQFont(int)) ); + } + +//-------------------------------------------------------------// + +KSSelectFont::~KSSelectFont() + { + } + +//-------------------------------------------------------------// + +void KSSelectFont::setPanelQFont( const QFont& font ) + { + if ( m_font != font ) { + int i; + for ( i=1; i<(int )m_list->count(); i++ ) { + KSListBoxFont *item = dynamic_cast(m_list->item(i)); + if ( item && item->font == font ) { m_font = font; m_list->setCurrentItem(i); break; } + } + // not on the list + if ( i == (int )m_list->count() ) { + dynamic_cast(m_list->item(0))->font = m_font = font; + m_list->setCurrentItem(0); + m_list->triggerUpdate(TRUE); + } + + m_font = font; + } + } + +//-------------------------------------------------------------// + +void KSSelectFont::showFontDialog() + { + bool ok; + QFont font = QFontDialog::getFont( &ok, m_font ); + if ( ok ) setPanelQFont( font ); + } + +//-------------------------------------------------------------// + +void KSSelectFont::changePanelQFont(int) + { + KSListBoxFont *item = dynamic_cast(m_list->item(m_list->currentItem())); + if ( item ) setPanelQFont( item->font ); + } + +//-----------------------------------------------------------// + +void KSSelectFont::setPanelFont( const QSGFont &f ) + { + setPanelQFont( QSDrvQt::toQFont(f) ); + } + +//-----------------------------------------------------------// + +QSGFont KSSelectFont::panelFont() const + { + QSGFont result; + result = QSDrvQt::toQSGFont( panelQFont(), black ); + return result; + } + +//-----------------------------------------------------------// +//-----------------------------------------------------------// +//-----------------------------------------------------------// +//-----------------------------------------------------------// + + +//-------------------------------------------------------------// + +class KSListBoxLine : public QListBoxItem + { + public: + KSListBoxLine( QListBox *parent, const QPen &c, const QString& name ); + virtual ~KSListBoxLine(); + virtual int height ( const QListBox * ) const; + virtual int width ( const QListBox * ) const; + QPen pen; + + protected: + virtual void paint ( QPainter * ); + }; + +//-------------------------------------------------------------// +//-------------------------------------------------------------// +//-------------------------------------------------------------// + +#define LINEBOX_SIZE_W 40 +#define LINEBOX_SIZE_H 15 +#define LINEBOX_KSACING_W 5 +#define LINEBOX_KSACING_H 5 + +KSListBoxLine::KSListBoxLine( QListBox *parent, const QPen &init_pen, const QString& name ) +:QListBoxItem(parent), pen(init_pen) + { + setText( name ); + } + +//-------------------------------------------------------------// + +KSListBoxLine::~KSListBoxLine() + { + } + +//-------------------------------------------------------------// + +int KSListBoxLine::height( const QListBox *lb ) const + { + return QMAX( LINEBOX_SIZE_H+2*LINEBOX_KSACING_H, lb->fontMetrics().lineSpacing()+1 ); + } + +//-------------------------------------------------------------// + +int KSListBoxLine::width( const QListBox *lb ) const + { + return lb->fontMetrics().width(text()) + LINEBOX_SIZE_W + LINEBOX_KSACING_W*3; + } + +//-------------------------------------------------------------// + +void KSListBoxLine::paint( QPainter *paint ) + { + int w = paint->fontMetrics().width(text()) + LINEBOX_SIZE_W + 3*LINEBOX_KSACING_W; + int h = QMAX( LINEBOX_SIZE_H+2*LINEBOX_KSACING_H, paint->fontMetrics().lineSpacing()+1 ); + + QRect r( LINEBOX_KSACING_W, + (h-LINEBOX_SIZE_H)/2, + LINEBOX_SIZE_W, + LINEBOX_SIZE_H ); + + QPen curr_pen = pen; + if ( listBox() && selected() ) curr_pen.setColor( listBox()->colorGroup().highlightedText() ); + paint->drawText( LINEBOX_SIZE_W+2*LINEBOX_KSACING_W, + 0, + w, + h, + Qt::AlignLeft | Qt::AlignVCenter, + text() ); + paint->setPen( curr_pen ); + paint->drawLine( r.left(), r.top()+(r.bottom()-r.top())/2, r.right(), r.top()+(r.bottom()-r.top())/2 ); + } + + +//-------------------------------------------------------------// +//-------------------------------------------------------------// +//-------------------------------------------------------------// +//-------------------------------------------------------------// + +KSSelectLine::KSSelectLine( QWidget *parent ) +: QWidget( parent ) + { + m_layout = new QGridLayout( this, 2, 2, 2 ); + m_list = new QListBox( this ); + m_label = new QLabel( tr("Width:"), this ); + m_width = new QSpinBox( 0, 999, 1, this ); + m_layout->addMultiCellWidget( m_list, 0, 0, 0, 1 ); + m_layout->addWidget( m_label, 1, 0 ); + m_layout->addWidget( m_width, 1, 1 ); + + m_pen_width = 0; + QSGLine l; l.style = QSGLine::Invisible; m_pen = QSDrvQt::toQPen(l); + l.style = QSGLine::Invisible; new KSListBoxLine( m_list, QSDrvQt::toQPen(l), tr("Invisible") ); + l.style = QSGLine::Solid; new KSListBoxLine( m_list, QSDrvQt::toQPen(l), tr("Solid") ); + l.style = QSGLine::Dash; new KSListBoxLine( m_list, QSDrvQt::toQPen(l), tr("Dashed") ); + l.style = QSGLine::DashDot; new KSListBoxLine( m_list, QSDrvQt::toQPen(l), tr("Dashed-Dotted") ); + l.style = QSGLine::Dot; new KSListBoxLine( m_list, QSDrvQt::toQPen(l), tr("Dotted") ); + l.style = QSGLine::DashDotDot; new KSListBoxLine( m_list, QSDrvQt::toQPen(l), tr("Dashed-2Dotted") ); + m_list->setHScrollBarMode( QScrollView::AlwaysOff ); + m_list->setCurrentItem(0); + connect( m_list, SIGNAL(highlighted(int)), this, SLOT(changePanelQPen(int)) ); + connect( m_width, SIGNAL(valueChanged(int)), this, SLOT(changePanelLineWidth(int)) ); + } + +//-------------------------------------------------------------// + +KSSelectLine::~KSSelectLine() + { + } + +//-------------------------------------------------------------// + +void KSSelectLine::setPanelQPen( const QPen& new_pen ) + { + QPen pen = new_pen; pen.setColor( black ); pen.setWidth( 0 ); + if ( m_pen != pen ) { + int i; + for ( i=0; i<(int )m_list->count(); i++ ) { + std::cout << " checking " << i << std::endl; + KSListBoxLine *item = dynamic_cast(m_list->item(i)); + if ( item && item->pen == pen ) { m_pen = pen; m_list->setCurrentItem(i); break; } + } + if ( i == (int )m_list->count() ) { + KSListBoxLine *item = dynamic_cast(m_list->item(0)); + if ( item ) m_pen = item->pen; + m_list->setCurrentItem(0); + m_list->triggerUpdate(TRUE); + } + } + } + +//-------------------------------------------------------------// + +void KSSelectLine::setPanelLineWidth( int width ) + { + if ( m_pen_width != width ) { m_pen_width = width; m_width->setValue(width); } + } + +//-------------------------------------------------------------// + +void KSSelectLine::changePanelQPen(int) + { + KSListBoxLine *item = dynamic_cast(m_list->item(m_list->currentItem())); + if ( item ) setPanelQPen( item->pen ); + } + +//-------------------------------------------------------------// + +void KSSelectLine::changePanelLineWidth( int value ) + { + setPanelLineWidth( value ); + } + +//-----------------------------------------------------------// + +void KSSelectLine::setPanelLine( const QSGLine &l ) + { + QPen pen = QSDrvQt::toQPen( l ); + setPanelQPen( pen ); + setPanelLineWidth( l.width ); + } + +//-----------------------------------------------------------// + +QSGLine KSSelectLine::panelLine() const + { + QSGLine result; + result = QSDrvQt::toQSGLine( panelQPen() ); + result.width = panelLineWidth(); + return result; + } + +//-------------------------------------------------------------// +//-------------------------------------------------------------// +//-------------------------------------------------------------// +//-------------------------------------------------------------// + +class KSListBoxPoint : public QListBoxItem + { + public: + KSListBoxPoint( QListBox *parent, const QSGPoint &p, const QString& name ); + virtual ~KSListBoxPoint(); + virtual int height ( const QListBox * ) const; + virtual int width ( const QListBox * ) const; + QSGPoint point; + + protected: + virtual void paint ( QPainter * ); + + }; + +#define POINTBOX_SIZE_W 20 +#define POINTBOX_SIZE_H 15 +#define POINTBOX_KSACING_W 5 +#define POINTBOX_KSACING_H 5 + +KSListBoxPoint::KSListBoxPoint( QListBox *parent, const QSGPoint &init_point, const QString& name ) +:QListBoxItem(parent), point(init_point) + { + setText( name ); + } + +//-------------------------------------------------------------// + +KSListBoxPoint::~KSListBoxPoint() + { + } + +//-------------------------------------------------------------// + +int KSListBoxPoint::height( const QListBox *lb ) const + { + return QMAX( POINTBOX_SIZE_H+2*POINTBOX_KSACING_H, lb->fontMetrics().lineSpacing()+1 ); + } + +//-------------------------------------------------------------// + +int KSListBoxPoint::width( const QListBox *lb ) const + { + return lb->fontMetrics().width(text()) + POINTBOX_SIZE_W + POINTBOX_KSACING_W*3; + } + +//-------------------------------------------------------------// + +void KSListBoxPoint::paint( QPainter *p ) + { + int w = p->fontMetrics().width(text()) + POINTBOX_SIZE_W + 3*POINTBOX_KSACING_W; + int h = QMAX( POINTBOX_SIZE_H+2*POINTBOX_KSACING_H, p->fontMetrics().lineSpacing()+1 ); + + QRect r( POINTBOX_KSACING_W, + (h-POINTBOX_SIZE_H)/2, + POINTBOX_SIZE_W, + POINTBOX_SIZE_H ); + + QSGPoint pts = point; pts.size = 9; pts.color = QSDrvQt::toQSGColor( p->pen().color() ); + + QSDrvQt drv; + drv.setDC(p,72,false); + drv.startDrawing(); + drv.drawPoint( QSPt2f(r.center().x(), r.center().y()), pts ); + drv.stopDrawing(); + p->drawText( POINTBOX_SIZE_W+2*POINTBOX_KSACING_W, + 0, + w, + h, + Qt::AlignLeft | Qt::AlignVCenter, + text() ); + } + + +//-------------------------------------------------------------// +//-------------------------------------------------------------// +//-------------------------------------------------------------// +//-------------------------------------------------------------// + +KSSelectPoint::KSSelectPoint( QWidget *parent ) +: QWidget( parent ) + { + m_layout = new QGridLayout( this, 2, 2, 2 ); + m_list = new QListBox( this ); + m_label = new QLabel( tr("Size (points):"), this ); + m_size = new QSpinBox( 0, 999, 1, this ); + m_layout->addMultiCellWidget( m_list, 0, 0, 0, 1 ); + m_layout->addWidget( m_label, 1, 0 ); + m_layout->addWidget( m_size, 1, 1 ); + + QSGPoint p; p.fill = QSGPoint::Transparent; + p.style = QSGPoint::Invisible; new KSListBoxPoint( m_list, p, tr("Invisible") ); + p.style = QSGPoint::Circle; new KSListBoxPoint( m_list, p, tr("Circle") ); + p.style = QSGPoint::Rect; new KSListBoxPoint( m_list, p, tr("Rectangle") ); + p.style = QSGPoint::Triangle; new KSListBoxPoint( m_list, p, tr("Triangle") ); + p.style = QSGPoint::Diamond; new KSListBoxPoint( m_list, p, tr("Diamond") ); + p.style = QSGPoint::Cross; new KSListBoxPoint( m_list, p, tr("Cross") ); + p.style = QSGPoint::Plus; new KSListBoxPoint( m_list, p, tr("Plus") ); + p.style = QSGPoint::HLine; new KSListBoxPoint( m_list, p, tr("HLine") ); + p.style = QSGPoint::VLine; new KSListBoxPoint( m_list, p, tr("VLine") ); + p.fill = QSGPoint::Filled; + p.style = QSGPoint::Circle; new KSListBoxPoint( m_list, p, tr("Filled Circle") ); + p.style = QSGPoint::Rect; new KSListBoxPoint( m_list, p, tr("Filled Rectangle") ); + p.style = QSGPoint::Triangle; new KSListBoxPoint( m_list, p, tr("Filled Triangle") ); + p.style = QSGPoint::Diamond; new KSListBoxPoint( m_list, p, tr("Filled Diamond") ); + p.fill = QSGPoint::Opaque; + p.style = QSGPoint::Circle; new KSListBoxPoint( m_list, p, tr("Opaque Circle") ); + p.style = QSGPoint::Rect; new KSListBoxPoint( m_list, p, tr("Opaque Rectangle") ); + p.style = QSGPoint::Triangle; new KSListBoxPoint( m_list, p, tr("Opaque Triangle") ); + p.style = QSGPoint::Diamond; new KSListBoxPoint( m_list, p, tr("Opaque Diamond") ); + + m_list->setHScrollBarMode( QScrollView::AlwaysOff ); + m_list->setCurrentItem(0); + m_size->setValue(9); + connect( m_list, SIGNAL(highlighted(int)), this, SLOT(changePanelPointShape(int)) ); + connect( m_size, SIGNAL(valueChanged(int)), this, SLOT(changePanelPointShape(int)) ); + } + +//-------------------------------------------------------------// + +KSSelectPoint::~KSSelectPoint() + { + } + +//-------------------------------------------------------------// + +void KSSelectPoint::setPanelPointShape( const QSGPoint& new_point ) + { + if ( m_point != new_point ) { + m_point = new_point; + disconnect( m_list, SIGNAL(highlighted(int)), this, SLOT(changePanelPointShape(int)) ); + disconnect( m_size, SIGNAL(valueChanged(int)), this, SLOT(changePanelPointShape(int)) ); + m_size->setValue( m_point.size ); + for ( int i=0; i<(int )m_list->count(); i++ ) { + KSListBoxPoint *item = dynamic_cast(m_list->item(i)); + if ( item && item->point.style == m_point.style && item->point.fill == m_point.fill ) { + m_list->setCurrentItem(i); + break; + } + } + connect( m_list, SIGNAL(highlighted(int)), this, SLOT(changePanelPointShape(int)) ); + connect( m_size, SIGNAL(valueChanged(int)), this, SLOT(changePanelPointShape(int)) ); + } + } +//-------------------------------------------------------------// + +void KSSelectPoint::changePanelPointShape(int) + { + KSListBoxPoint *item = dynamic_cast(m_list->item(m_list->currentItem())); + if ( item ) { + QSGPoint new_p = m_point; + new_p.style = item->point.style; + new_p.fill = item->point.fill; + new_p.size = m_size->value(); + setPanelPointShape( new_p ); + } + } + +//-----------------------------------------------------------// + +void KSSelectPoint::setPanelPoint( const QSGPoint &p ) + { + setPanelPointShape( p ); + } + +//-----------------------------------------------------------// + +QSGPoint KSSelectPoint::panelPoint() const + { + QSGPoint result; + result = panelPointShape(); + return result; + } + +//-------------------------------------------------------------// +//-------------------------------------------------------------// +//-------------------------------------------------------------// diff --git a/kmatplot/dialogs/ksattrpanel.h b/kmatplot/dialogs/ksattrpanel.h new file mode 100644 index 0000000..b66e2a5 --- /dev/null +++ b/kmatplot/dialogs/ksattrpanel.h @@ -0,0 +1,244 @@ +/*************************************************************************** + ksattrpanel.h + ------------------- + begin : Tue Oct 10 2000 + copyright : (C) 2000 by Kamil Dobkowski + email : kamildobk@friko.onet.pl + ***************************************************************************/ + +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + +#ifndef KSATTRPANEL_H +#define KSATTRPANEL_H + +#include "ksattrpanelinterf.h" +#include "../widgets/qsgattr.h" +#include +#include +#include + +/** Base class for attr panels. + * You have to set two subpanels ( arrow shape and color for example ) to use it. + * @author Kamil Dobkowski + */ +class KSAttrPanel : public KSAttrPanelInterf { + Q_OBJECT + public: + /** + * Constructor + */ + KSAttrPanel( QWidget *parent=0, const char *name=0 ); + /** + * Destructor + */ + ~KSAttrPanel(); + /** + * Set the first ( left ) subpanel + */ + void setSubPanel1( QWidget *panel ); + /** + * Sets the second( right ) subpanel + */ + void setSubPanel2( QWidget *panel ); + /** + * Returns the first subpanel ( if set ). You will have + * to cast it to the desired type if you want to retrieve + * some information from it. + */ + QWidget *subPanel1() const; + /** + * Returns the second subpanel. + */ + QWidget *subPanel2() const; + /** + * Use it as a parent widget when creating subpanels. + */ + QWidget *subPanelPlace1() const; + /** + * Use it as a parent widget when creating subpanels. + */ + QWidget *subPanelPlace2() const; + /** + * True if Apply clicked, False otherwise. + */ + //bool result() const { return m_result; } + /* + signals: + + * Apply or Cancel clicked. See result() + + void acceptValue(); + */ + protected: + QWidget *m_subpanel_1; + QWidget *m_subpanel_2; + //bool m_result; + /* + private slots: + void apply_clicked(); + void cancel_clicked(); + */ +}; + +//-------------------------------------------------------------// + +class QLabel; +class QSpinBox; +class QListBox; +class QGridLayout; +class KSSelectArrow : public QWidget + { + Q_OBJECT + public: + KSSelectArrow( QWidget *parent ); + virtual ~KSSelectArrow(); + void setPanelArrow( const QSGArrow& p ); + QSGArrow panelArrow() const { return m_arrow; } + + protected slots: + void changePanelArrow(int); + + protected: + QGridLayout *m_layout; + QListBox *m_list; + QLabel *m_label; + QSpinBox *m_size; + QSGArrow m_arrow; + }; + +//-------------------------------------------------------------// + +class KSSelectColor : public QWidget + { + Q_OBJECT + public: + KSSelectColor( QWidget *parent ); + virtual ~KSSelectColor(); + void setPanelColor( const QSGColor& p ); + QSGColor panelColor() const; + + private slots: + void showColorDialog(); + void changePanelColor(int); + void changePanelAlpha(int); + + protected: + QGridLayout *m_layout; + QListBox *m_list; + QLabel *m_label; + QSpinBox *m_alpha; + QPushButton *m_custom; + unsigned char m_color_alpha; + QColor m_color; + }; + +//-------------------------------------------------------------// + +class KSSelectFill : public QWidget + { + Q_OBJECT + public: + KSSelectFill( QWidget *parent ); + virtual ~KSSelectFill(); + void setPanelFill( const QSGFill& p ); + QSGFill panelFill() const; + + protected slots: + void changePanelBrush(int); + + protected: + void setPanelBrush( const QBrush& b ); + QBrush panelBrush() const; + + QGridLayout *m_layout; + QListBox *m_list; + QBrush m_brush; + }; + +//-------------------------------------------------------------// + +class KSSelectFont : public QWidget + { + Q_OBJECT + public: + KSSelectFont( QWidget *parent ); + virtual ~KSSelectFont(); + void setPanelFont( const QSGFont& p ); + QSGFont panelFont() const; + + protected slots: + void showFontDialog(); + void changePanelQFont(int); + + protected: + void setPanelQFont( const QFont& f ); + QFont panelQFont() const { return m_font; } + QFont itemFont(int); + QFont m_font; + + QGridLayout *m_layout; + QListBox *m_list; + QPushButton *m_custom; + QBrush m_brush; + }; + +//-------------------------------------------------------------// + +class KSSelectLine : public QWidget + { + Q_OBJECT + public: + KSSelectLine( QWidget *parent ); + virtual ~KSSelectLine(); + void setPanelLine( const QSGLine& l ); + QSGLine panelLine() const; + void setPanelLineWidth( int width ); + int panelLineWidth() const { return m_pen_width; } + + protected slots: + void changePanelQPen(int); + void changePanelLineWidth(int); + + protected: + void setPanelQPen( const QPen& p ); + QPen panelQPen() const { return m_pen; } + QPen m_pen; + int m_pen_width; + QGridLayout *m_layout; + QListBox *m_list; + QLabel *m_label; + QSpinBox *m_width; + }; + +//-------------------------------------------------------------// + +class KSSelectPoint : public QWidget + { + Q_OBJECT + public: + KSSelectPoint( QWidget *parent ); + virtual ~KSSelectPoint(); + void setPanelPoint( const QSGPoint& p ); + QSGPoint panelPoint() const; + + protected slots: + void changePanelPointShape(int); + void setPanelPointShape( const QSGPoint& p ); + QSGPoint panelPointShape() const { return m_point; } + + protected: + QGridLayout *m_layout; + QListBox *m_list; + QLabel *m_label; + QSpinBox *m_size; + QSGPoint m_point; + }; + +#endif diff --git a/kmatplot/dialogs/ksattrpanelinterf.cpp b/kmatplot/dialogs/ksattrpanelinterf.cpp new file mode 100644 index 0000000..32091ed --- /dev/null +++ b/kmatplot/dialogs/ksattrpanelinterf.cpp @@ -0,0 +1,88 @@ +/**************************************************************************** +** Form implementation generated from reading ui file './ksattrpanelinterf.ui' +** +** Created: śro mar 20 18:52:42 2002 +** by: The User Interface Compiler (uic) +** +** WARNING! All changes made in this file will be lost! +****************************************************************************/ +#include "ksattrpanelinterf.h" + +#include +#include +#include +#include +#include +#include +#include + +/* + * Constructs a KSAttrPanelInterf which is a child of 'parent', with the + * name 'name' and widget flags set to 'f'. + * + * The dialog will by default be modeless, unless you set 'modal' to + * TRUE to construct a modal dialog. + */ +KSAttrPanelInterf::KSAttrPanelInterf( QWidget* parent, const char* name, bool modal, WFlags fl ) + : QDialog( parent, name, modal, fl ) +{ + if ( !name ) + setName( "KSAttrPanelInterf" ); + resize( 372, 266 ); + setCaption( trUtf8( "Change attributes" ) ); + KSAttrPanelInterfLayout = new QGridLayout( this, 1, 1, 11, 6, "KSAttrPanelInterfLayout"); + + Layout2 = new QHBoxLayout( 0, 0, 6, "Layout2"); + + placePanel1 = new QGroupBox( this, "placePanel1" ); + placePanel1->setFrameShape( QGroupBox::NoFrame ); + placePanel1->setFrameShadow( QGroupBox::Plain ); + placePanel1->setLineWidth( 0 ); + placePanel1->setTitle( trUtf8( "" ) ); + Layout2->addWidget( placePanel1 ); + + placePanel2 = new QGroupBox( this, "placePanel2" ); + placePanel2->setFrameShape( QGroupBox::NoFrame ); + placePanel2->setFrameShadow( QGroupBox::Plain ); + placePanel2->setLineWidth( 0 ); + placePanel2->setTitle( trUtf8( "" ) ); + Layout2->addWidget( placePanel2 ); + + KSAttrPanelInterfLayout->addMultiCellLayout( Layout2, 0, 0, 0, 2 ); + + Line1 = new QFrame( this, "Line1" ); + Line1->setProperty( "frameShape", (int)QFrame::HLine ); + Line1->setFrameShadow( QFrame::Sunken ); + Line1->setFrameShape( QFrame::HLine ); + + KSAttrPanelInterfLayout->addMultiCellWidget( Line1, 1, 1, 0, 2 ); + + buttonCancel = new QPushButton( this, "buttonCancel" ); + buttonCancel->setMaximumSize( QSize( 120, 32767 ) ); + buttonCancel->setText( trUtf8( "Cancel" ) ); + + KSAttrPanelInterfLayout->addWidget( buttonCancel, 2, 2 ); + + buttonApply = new QPushButton( this, "buttonApply" ); + buttonApply->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)1, (QSizePolicy::SizeType)0, 0, 0, buttonApply->sizePolicy().hasHeightForWidth() ) ); + buttonApply->setMaximumSize( QSize( 120, 32767 ) ); + buttonApply->setText( trUtf8( "Apply" ) ); + + KSAttrPanelInterfLayout->addWidget( buttonApply, 2, 1 ); + QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Preferred, QSizePolicy::Minimum ); + KSAttrPanelInterfLayout->addItem( spacer, 2, 0 ); + + // signals and slots connections + connect( buttonApply, SIGNAL( clicked() ), this, SLOT( accept() ) ); + connect( buttonCancel, SIGNAL( clicked() ), this, SLOT( reject() ) ); +} + +/* + * Destroys the object and frees any allocated resources + */ +KSAttrPanelInterf::~KSAttrPanelInterf() +{ + // no need to delete child widgets, Qt does it all for us +} + +#include "ksattrpanelinterf.moc" diff --git a/kmatplot/dialogs/ksattrpanelinterf.ui b/kmatplot/dialogs/ksattrpanelinterf.ui new file mode 100644 index 0000000..0a3e50b --- /dev/null +++ b/kmatplot/dialogs/ksattrpanelinterf.ui @@ -0,0 +1,162 @@ + +KSAttrPanelInterf + + + KSAttrPanelInterf + + + + 0 + 0 + 372 + 266 + + + + Change attributes + + + + unnamed + + + 11 + + + 6 + + + + Layout2 + + + + unnamed + + + 0 + + + 6 + + + + placePanel1 + + + NoFrame + + + Plain + + + 0 + + + + + + + + placePanel2 + + + NoFrame + + + Plain + + + 0 + + + + + + + + + + Line1 + + + HLine + + + Sunken + + + Horizontal + + + + + buttonCancel + + + + 120 + 32767 + + + + Cancel + + + + + buttonApply + + + + 1 + 0 + 0 + 0 + + + + + 120 + 32767 + + + + Apply + + + + + Spacer3 + + + Horizontal + + + Preferred + + + + 20 + 20 + + + + + + + + buttonApply + clicked() + KSAttrPanelInterf + accept() + + + buttonCancel + clicked() + KSAttrPanelInterf + reject() + + + + diff --git a/kmatplot/dialogs/ksattrpanelinterf2.ui b/kmatplot/dialogs/ksattrpanelinterf2.ui new file mode 100644 index 0000000..4bc3531 --- /dev/null +++ b/kmatplot/dialogs/ksattrpanelinterf2.ui @@ -0,0 +1,148 @@ + +KSAttrPanelInterf + + + KSAttrPanelInterf + + + + 0 + 0 + 372 + 266 + + + + Change attributes + + + + unnamed + + + 11 + + + 6 + + + + Layout2 + + + + unnamed + + + 0 + + + 6 + + + + placePanel1 + + + NoFrame + + + Plain + + + 0 + + + + + + + + placePanel2 + + + NoFrame + + + Plain + + + 0 + + + + + + + + + + Line1 + + + HLine + + + Sunken + + + Horizontal + + + + + buttonCancel + + + + 120 + 32767 + + + + Cancel + + + + + buttonApply + + + + 1 + 0 + 0 + 0 + + + + + 120 + 32767 + + + + Apply + + + + + Spacer3 + + + Horizontal + + + Preferred + + + + 20 + 20 + + + + + + + diff --git a/kmatplot/dialogs/kschannellist.cpp b/kmatplot/dialogs/kschannellist.cpp new file mode 100644 index 0000000..42e8a0d --- /dev/null +++ b/kmatplot/dialogs/kschannellist.cpp @@ -0,0 +1,205 @@ +/*************************************************************************** + ksplotchannels.cpp + ------------------- + begin : 01-January-2000 + copyright : (C) 2000 by Kamil Dobkowski + email : kamildobk@poczta.onet.pl + ***************************************************************************/ + +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + + +#include"kschannellist.h" +#include"../ksdataobjectfactory.h" +#include"../ksmatrix.h" + +//-------------------------------------------------------------// + +KSChannelList::KSChannelList( QWidget *parent, const char *name ) +: QListView( parent, name ) + { + m_show_all_channels = true; + m_default_channel = -1; + prev_selected_data = NULL; + prev_selected_channel = -1; + m_data = NULL; + setSorting(-1); + setAllColumnsShowFocus( true ); + setRootIsDecorated( true ); + setTreeStepSize( 10 ); + setMultiSelection(false); + setVScrollBarMode( AlwaysOn ); + setHScrollBarMode( AlwaysOff ); + connect( this, SIGNAL(selectionChanged()), this, SLOT(slot_show_description()) ); + } + +//-------------------------------------------------------------// + +KSChannelList::~KSChannelList() + { + emit sigShowText( QString::null ); + } + +//-------------------------------------------------------------// + +void KSChannelList::setDataObject( QSData *data, bool showAllChannels, int defaultChannel, bool showRoot ) + { + m_show_all_channels = showAllChannels; + m_default_channel = defaultChannel; + m_show_root = showRoot; + if ( (QSData *)m_data != data ) { + if ( !m_data.isNull() ) { + disconnect( m_data, SIGNAL(sigDataChanged(QSData*,int)), this, SLOT(slot_refresh_list(QSData*,int)) ); + disconnect( m_data, SIGNAL(sigChildListChanged()), this, SLOT(slot_refresh_contents()) ); + disconnect( m_data, SIGNAL(sigNameChanged(QSData*,const char*)), this, SLOT(slot_refresh_list(QSData*,const char*)) ); + } + m_data = data; + if ( data ) { + connect( m_data, SIGNAL(sigDataChanged(QSData*,int)), this, SLOT(slot_refresh_list(QSData*,int)) ); + connect( m_data, SIGNAL(sigChildListChanged()), this, SLOT(slot_refresh_contents()) ); + connect( m_data, SIGNAL(sigNameChanged(QSData*,const char*)), this, SLOT(slot_refresh_list(QSData*,const char*)) ); + } + + slot_refresh_contents(); + } + } + +//-------------------------------------------------------------// + +void KSChannelList::select( QSData *dataObject, int channel ) + { + KSChannelListItem *citem = first(); + while( citem ) { + if ( citem->dataObject() == dataObject && citem->channel() == channel ) setSelected( citem, true ); + citem = citem->next(); + } + } + +//-------------------------------------------------------------// + +void KSChannelList::slot_refresh_contents() + { + // try to select the same item after refreshing the contents + prev_selected_data = selected() ? selected()->dataObject() : NULL; + prev_selected_channel = selected() ? selected()->channel() : -1; + + clear(); + if ( !m_data.isNull() ) { + if ( m_show_root ) add_qsdata_object_to_list( m_data ); + for( int child_nr=0; child_nrchildCount(); child_nr++ ) + add_qsdata_object_to_list( m_data->child(child_nr) ); + } + + slot_refresh_list(NULL,0); + } + +//-------------------------------------------------------------// + +void KSChannelList::add_qsdata_object_to_list( QSData *data ) + { + KSChannelListItem *parentItem = new KSChannelListItem( this, data, m_default_channel, KSDataObjectFactory::channelNameFactory(data,-1),KSDataObjectFactory::channelDescFactory(data,-1) ); + if ( m_show_all_channels ) + for( int channel=data->channelCount()-1; channel>=0; channel-- ) { + if ( parentItem ) { + (void )new KSChannelListItem( parentItem, data, channel, + KSDataObjectFactory::channelNameFactory(data,channel), + QString::null, + KSDataObjectFactory::channelDescFactory(data,channel) ); + } + } + + if ( parentItem ) setOpen( parentItem, true ); + } + + + +//-------------------------------------------------------------// + +void KSChannelList::slot_refresh_list(QSData*object, int channel) + { + KSChannelListItem *current = first(); + while( current ) { + if ( current->m_data && + current->m_channel == m_default_channel ) current->setText( 1, current->m_data->objectName() ); + QString size; + if ( current->m_data && + current->m_channel >= 0 && + current->m_data->matrix(current->m_channel) ) + size.sprintf("%dx%d",current->m_data->matrix(current->m_channel)->rows(), + current->m_data->matrix(current->m_channel)->cols() ); + + current->setText( 2, size ); + if ( current->dataObject() && + current->dataObject() == prev_selected_data && + current->channel() == prev_selected_channel ) { + current->setSelected( TRUE ); + setCurrentItem( current ); + triggerUpdate(); + } + current = current->next(); + } + + prev_selected_data = NULL; + prev_selected_channel = -1; + emit sigDataChanged( object, channel ); + } + +//-------------------------------------------------------------// + +void KSChannelList::slot_refresh_list( QSData*object, const char *newName ) + { + KSChannelListItem *current = first(); + while( current ) { + if ( current->m_data == object && + current->m_channel == m_default_channel ) current->setText( 1, newName ); + current = current->next(); + } + } + +//-------------------------------------------------------------// + +void KSChannelList::slot_show_description() + { + KSChannelListItem *citem = selected(); + if ( citem && citem->dataObject() ) { + emit sigShowText( KSDataObjectFactory::channelDescFactory(citem->dataObject(), citem->channel()) ); + } else { + emit sigShowText( QString::null ); + } + } + + + + + /* +if ( m_show_root ) { + parentItem = new KSChannelListItem( this, data, m_default_channel, KSDataObjectFactory::channelNameFactory(data,-1),KSDataObjectFactory::channelDescFactory(data,-1) ); + } + if ( m_show_all_channels ) + for( int channel=data->channelCount()-1; channel>=0; channel-- ) { + if ( parentItem ) { + (void )new KSChannelListItem( parentItem, data, channel, + KSDataObjectFactory::channelNameFactory(data,channel), + QString::null, + KSDataObjectFactory::channelDescFactory(data,channel) ); + } else { + (void )new KSChannelListItem( this, data, channel, + KSDataObjectFactory::channelNameFactory(data,channel), + QString::null, + KSDataObjectFactory::channelDescFactory(data,channel) ); + } + + } +*/ + + + + + diff --git a/kmatplot/dialogs/kschannellist.h b/kmatplot/dialogs/kschannellist.h new file mode 100644 index 0000000..cf7df27 --- /dev/null +++ b/kmatplot/dialogs/kschannellist.h @@ -0,0 +1,125 @@ +/*************************************************************************** + kschannellist.h + ------------------- + begin : 01-January-2000 + copyright : (C) 2000 by Kamil Dobkowski + email : kamildobk@poczta.onet.pl + ***************************************************************************/ + +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + + +#ifndef KSCHANNELLIST_H +#define KSCHANNELLIST_H + + +#include"../widgets/qsdata.h" +#include +#include +#include +#include + +class KSChannelListItem : public QListViewItem { + public: + + KSChannelListItem( QListView* parent, QSData* object, int channel, QString c1, QString description ) + : QListViewItem( parent, c1 ), m_data(object), m_channel(channel), m_description(description) {} + + KSChannelListItem( QListView* parent, QSData* object, int channel, QString c1, QString c2, QString description ) + : QListViewItem( parent, c1, c2 ), m_data(object), m_channel(channel), m_description(description) {} + + KSChannelListItem( QListViewItem* parent, QSData* object, int channel, QString c1, QString c2, QString description ) + : QListViewItem( parent, c1, c2 ), m_data(object), m_channel(channel), m_description(description) {} + + virtual ~KSChannelListItem() {} + QSData *dataObject() const { return m_data; } + int channel() const { return m_channel; } + bool isValid() const { return m_channel>=0 && m_data; } + KSChannelListItem *next() { return dynamic_cast(itemBelow()); } + + QSData *m_data; + int m_channel; + QString m_description; + }; + + +//--------------------------------------------------------------------------------------------------------// + +class QSPlot; + +/** + * Smart list view, wchich display matrix list. + * It tracks QSData object state so can be used in non-modal dialogs. + * Displays all tree hierarchy of QSAxes. + * @author Kamil Dobkowski + */ +class KSChannelList : public QListView + { + Q_OBJECT + + public: + /** + * Constructor. + */ + KSChannelList( QWidget *parent, const char *name = 0 ); + /** + * Destructor. + */ + ~KSChannelList(); + /** + * Data object and all its childeren will be showed in list window. + */ + void setDataObject( QSData *data, bool showAllChannels = true, int defaultChannel = -1, bool showRoot = true ); + /** + * + */ + QSData *dataObject() const { return m_data; } + /** + * + */ + KSChannelListItem *first() const { return dynamic_cast(firstChild()); } + /** + * + */ + KSChannelListItem *selected() const { return dynamic_cast(selectedItem()); } + /** + * + */ + void select( QSData *dataObject, int channel ); + + signals: + void sigShowText( const QString& ); + void sigDataChanged( QSData *object, int channel ); + + private slots: + void slot_refresh_contents(); + void slot_refresh_list(QSData*,int); + void slot_show_description(); + void slot_refresh_list( QSData *object, const char *newName ); + + private: + void add_qsdata_object_to_list( QSData *data ); + QGuardedPtr m_data; + QSData *prev_selected_data; + int prev_selected_channel; + bool m_show_all_channels; + bool m_show_root; + int m_default_channel; + + }; + +#endif + + + + + + + diff --git a/kmatplot/dialogs/ksconfiguredlg.cpp b/kmatplot/dialogs/ksconfiguredlg.cpp new file mode 100644 index 0000000..ec0eb5b --- /dev/null +++ b/kmatplot/dialogs/ksconfiguredlg.cpp @@ -0,0 +1,103 @@ +/*************************************************************************** + ksconfiguredlg.cpp + ------------------- + begin : Mon Jan 14 2002 + copyright : (C) 2002 by kamil + email : kamil@localhost.localdomain + ***************************************************************************/ + +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + +#include "ksconfiguredlg.h" +#include "../ksglobalsettings.h" +#include +#include +#include +#include +#include +#include +#include + +//----------------------------------------------------------------------------// + +KSConfigureDlg::KSConfigureDlg(QWidget *parent, const char *name ) +: KSConfigureDlgInterf(parent,name, TRUE) + { + textInstallPath->setText( KSGlobalSettings::installPath() ); + useCustomPrintDpi->setChecked( KSGlobalSettings::useCustomPrintDpi() ); + customPrintDpi->setValue( KSGlobalSettings::customPrintDpi() ); + openSocket->setChecked( KSGlobalSettings::openSocket() ); + undoLevels->setValue( KSGlobalSettings::undoLevels() ); + connect( tabWidget, SIGNAL(currentChanged(QWidget*)), this, SLOT(currentTabChanged(QWidget*)) ); + } + +//----------------------------------------------------------------------------// + +KSConfigureDlg::~KSConfigureDlg() + { + } + +//----------------------------------------------------------------------------// + +void KSConfigureDlg::applySettings() + { + KSGlobalSettings::setInstallPath( textInstallPath->text() ); + KSGlobalSettings::setUseCustomPrintDpi( useCustomPrintDpi->isChecked() ); + KSGlobalSettings::setCustomPrintDpi( customPrintDpi->value() ); + KSGlobalSettings::setUndoLevels( undoLevels->value() ); + KSGlobalSettings::setOpenSocket( openSocket->isChecked() ); + KSGlobalSettings::save(); + KSGlobalSettings::apply(); + } + +//----------------------------------------------------------------------------// + +void KSConfigureDlg::addModulePath() + { + QString new_module_dir = QFileDialog::getExistingDirectory(); + if ( !new_module_dir.isEmpty() ) textModulePaths->setText( textModulePaths->text() +":"+ new_module_dir ); + } + +//----------------------------------------------------------------------------// + +void KSConfigureDlg::setInstallPath() + { + QString new_install_dir = QFileDialog::getExistingDirectory(); + if ( !new_install_dir.isEmpty() ) textInstallPath->setText( new_install_dir ); + } + +//----------------------------------------------------------------------------// + +void KSConfigureDlg::currentTabChanged( QWidget *w ) + { + if ( w == tabGeneral ) tabDescription->setText(tr( + "General" + "
" + "

" + "Install path - base directory where the program is installed. Kmatplot searches for its resources" + " such as examples, help files, modules in subdirectories of this directory." + "

" + "

" + "Custom printing resolution - generate Poscript file at a given resolution. It affects line widths " + "and printing quality - coordinates can be calculated with increased accuracy. Default resolution is 600 dpi." + "

" + "

" + "Open socket - You can feed the program with data through an unix socket. This option tells whether " + "KMatplot should open a socket when running. Notice that it will be always opened when the program is " + "executed from within Octave or Scilab or with a command line argument --fd file_descriptor. " + "See also:View/IO info" + "

" ) ); + else tabDescription->setText(tr( + "Sorry !" + "
" + "No help for this page.") ); + } + + diff --git a/kmatplot/dialogs/ksconfiguredlg.h b/kmatplot/dialogs/ksconfiguredlg.h new file mode 100644 index 0000000..3b2f44c --- /dev/null +++ b/kmatplot/dialogs/ksconfiguredlg.h @@ -0,0 +1,40 @@ +/*************************************************************************** + ksconfiguredlg.h + ------------------- + begin : Mon Jan 14 2002 + copyright : (C) 2002 by kamil + email : kamil@localhost.localdomain + ***************************************************************************/ + +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + +#ifndef KSCONFIGUREDLG_H +#define KSCONFIGUREDLG_H + +#include +#include "ksconfiguredlginterf.h" + +/** + *@author kamil + */ +class KSConfigureDlg : public KSConfigureDlgInterf { + Q_OBJECT + public: + KSConfigureDlg(QWidget *parent=0, const char *name=0); + virtual ~KSConfigureDlg(); + void applySettings(); + protected slots: + virtual void addModulePath(); + virtual void setInstallPath(); + virtual void currentTabChanged( QWidget *w ); + +}; + +#endif diff --git a/kmatplot/dialogs/ksconfiguredlginterf.cpp b/kmatplot/dialogs/ksconfiguredlginterf.cpp new file mode 100644 index 0000000..e185a2c --- /dev/null +++ b/kmatplot/dialogs/ksconfiguredlginterf.cpp @@ -0,0 +1,153 @@ +/**************************************************************************** +** Form implementation generated from reading ui file './ksconfiguredlginterf.ui' +** +** Created: śro mar 20 18:53:22 2002 +** by: The User Interface Compiler (uic) +** +** WARNING! All changes made in this file will be lost! +****************************************************************************/ +#include "ksconfiguredlginterf.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "ksconfiguredlginterf.ui.h" + +/* + * Constructs a KSConfigureDlgInterf which is a child of 'parent', with the + * name 'name' and widget flags set to 'f'. + * + * The dialog will by default be modeless, unless you set 'modal' to + * TRUE to construct a modal dialog. + */ +KSConfigureDlgInterf::KSConfigureDlgInterf( QWidget* parent, const char* name, bool modal, WFlags fl ) + : QDialog( parent, name, modal, fl ) +{ + if ( !name ) + setName( "KSConfigureDlgInterf" ); + resize( 638, 400 ); + setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, sizePolicy().hasHeightForWidth() ) ); + setMinimumSize( QSize( 638, 400 ) ); + setMaximumSize( QSize( 638, 400 ) ); + setCaption( trUtf8( "Configure KMatplot" ) ); + + tabDescription = new QTextBrowser( this, "tabDescription" ); + tabDescription->setGeometry( QRect( 6, 11, 190, 344 ) ); + tabDescription->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)7, 0, 0, tabDescription->sizePolicy().hasHeightForWidth() ) ); + tabDescription->setMinimumSize( QSize( 150, 0 ) ); + QFont tabDescription_font( tabDescription->font() ); + tabDescription->setFont( tabDescription_font ); + tabDescription->setFrameShape( QTextBrowser::WinPanel ); + tabDescription->setHScrollBarMode( QTextBrowser::AlwaysOff ); + tabDescription->setTextFormat( QTextBrowser::RichText ); + tabDescription->setText( trUtf8( "General options


Install path - path where program is installed." ) ); + tabDescription->setUndoRedoEnabled( FALSE ); + + buttonCancel = new QPushButton( this, "buttonCancel" ); + buttonCancel->setGeometry( QRect( 535, 365, 95, 28 ) ); + buttonCancel->setText( trUtf8( "Cancel" ) ); + + buttonOK = new QPushButton( this, "buttonOK" ); + buttonOK->setGeometry( QRect( 430, 365, 90, 28 ) ); + buttonOK->setText( trUtf8( "OK" ) ); + buttonOK->setDefault( TRUE ); + + tabWidget = new QTabWidget( this, "tabWidget" ); + tabWidget->setEnabled( TRUE ); + tabWidget->setGeometry( QRect( 200, 10, 433, 344 ) ); + tabWidget->setTabShape( QTabWidget::Rounded ); + + tabGeneral = new QWidget( tabWidget, "tabGeneral" ); + + GroupBox1 = new QGroupBox( tabGeneral, "GroupBox1" ); + GroupBox1->setGeometry( QRect( 5, 5, 420, 141 ) ); + GroupBox1->setTitle( trUtf8( "Paths" ) ); + + TextLabel1 = new QLabel( GroupBox1, "TextLabel1" ); + TextLabel1->setGeometry( QRect( 20, 25, 90, 25 ) ); + TextLabel1->setText( trUtf8( "Install path:" ) ); + + textInstallPath = new QLineEdit( GroupBox1, "textInstallPath" ); + textInstallPath->setGeometry( QRect( 20, 50, 340, 22 ) ); + + buttonInstallPath = new QPushButton( GroupBox1, "buttonInstallPath" ); + buttonInstallPath->setGeometry( QRect( 370, 50, 30, 25 ) ); + buttonInstallPath->setText( trUtf8( "..." ) ); + buttonInstallPath->setAutoDefault( FALSE ); + + textModulePaths = new QLineEdit( GroupBox1, "textModulePaths" ); + textModulePaths->setGeometry( QRect( 20, 105, 340, 22 ) ); + + TextLabel3 = new QLabel( GroupBox1, "TextLabel3" ); + TextLabel3->setGeometry( QRect( 20, 80, 95, 25 ) ); + TextLabel3->setText( trUtf8( "Module paths:" ) ); + + buttonModulePaths = new QPushButton( GroupBox1, "buttonModulePaths" ); + buttonModulePaths->setGeometry( QRect( 370, 105, 30, 25 ) ); + buttonModulePaths->setText( trUtf8( "..." ) ); + buttonModulePaths->setAutoDefault( FALSE ); + buttonModulePaths->setDefault( FALSE ); + + GroupBox3 = new QGroupBox( tabGeneral, "GroupBox3" ); + GroupBox3->setGeometry( QRect( 5, 155, 230, 150 ) ); + GroupBox3->setTitle( trUtf8( "Printing" ) ); + + useCustomPrintDpi = new QCheckBox( GroupBox3, "useCustomPrintDpi" ); + useCustomPrintDpi->setGeometry( QRect( 20, 40, 190, 20 ) ); + useCustomPrintDpi->setText( trUtf8( "Print at a custom resolution" ) ); + + customPrintDpi = new QSpinBox( GroupBox3, "customPrintDpi" ); + customPrintDpi->setGeometry( QRect( 125, 75, 65, 20 ) ); + customPrintDpi->setButtonSymbols( QSpinBox::UpDownArrows ); + customPrintDpi->setMaxValue( 2400 ); + + TextLabel10 = new QLabel( GroupBox3, "TextLabel10" ); + TextLabel10->setGeometry( QRect( 20, 75, 105, 20 ) ); + TextLabel10->setText( trUtf8( "Custom resolution" ) ); + + TextLabel9 = new QLabel( GroupBox3, "TextLabel9" ); + TextLabel9->setGeometry( QRect( 200, 75, 20, 20 ) ); + TextLabel9->setText( trUtf8( "dpi" ) ); + + GroupBox2 = new QGroupBox( tabGeneral, "GroupBox2" ); + GroupBox2->setGeometry( QRect( 245, 155, 180, 150 ) ); + GroupBox2->setTitle( trUtf8( "Other" ) ); + + openSocket = new QCheckBox( GroupBox2, "openSocket" ); + openSocket->setGeometry( QRect( 20, 40, 145, 20 ) ); + openSocket->setText( trUtf8( "Open socket at start" ) ); + + TextLabel4 = new QLabel( GroupBox2, "TextLabel4" ); + TextLabel4->setGeometry( QRect( 20, 75, 80, 20 ) ); + TextLabel4->setText( trUtf8( "Undo levels" ) ); + + undoLevels = new QSpinBox( GroupBox2, "undoLevels" ); + undoLevels->setGeometry( QRect( 95, 75, 65, 20 ) ); + tabWidget->insertTab( tabGeneral, trUtf8( "General" ) ); + + // signals and slots connections + connect( buttonOK, SIGNAL( clicked() ), this, SLOT( accept() ) ); + connect( buttonCancel, SIGNAL( clicked() ), this, SLOT( reject() ) ); + connect( buttonInstallPath, SIGNAL( clicked() ), this, SLOT( setInstallPath() ) ); + connect( buttonModulePaths, SIGNAL( clicked() ), this, SLOT( addModulePath() ) ); +} + +/* + * Destroys the object and frees any allocated resources + */ +KSConfigureDlgInterf::~KSConfigureDlgInterf() +{ + // no need to delete child widgets, Qt does it all for us +} + +#include "ksconfiguredlginterf.moc" diff --git a/kmatplot/dialogs/ksconfiguredlginterf.ui b/kmatplot/dialogs/ksconfiguredlginterf.ui new file mode 100644 index 0000000..81c0081 --- /dev/null +++ b/kmatplot/dialogs/ksconfiguredlginterf.ui @@ -0,0 +1,440 @@ + +KSConfigureDlgInterf + + + KSConfigureDlgInterf + + + + 0 + 0 + 638 + 400 + + + + + 0 + 0 + 0 + 0 + + + + + 638 + 400 + + + + + 638 + 400 + + + + Configure KMatplot + + + + tabDescription + + + + 6 + 11 + 190 + 344 + + + + + 0 + 7 + 0 + 0 + + + + + 150 + 0 + + + + + + + + WinPanel + + + AlwaysOff + + + RichText + + + <B>General options</b><br><hr><br> <i>Install path</i> - path where program is installed. + + + false + + + + + buttonCancel + + + + 535 + 365 + 95 + 28 + + + + Cancel + + + + + buttonOK + + + + 430 + 365 + 90 + 28 + + + + OK + + + true + + + + + tabWidget + + + true + + + + 200 + 10 + 433 + 344 + + + + Rounded + + + + tabGeneral + + + General + + + + GroupBox1 + + + + 5 + 5 + 420 + 141 + + + + Paths + + + + TextLabel1 + + + + 20 + 25 + 90 + 25 + + + + Install path: + + + + + textInstallPath + + + + 20 + 50 + 340 + 22 + + + + + + buttonInstallPath + + + + 370 + 50 + 30 + 25 + + + + ... + + + false + + + + + textModulePaths + + + + 20 + 105 + 340 + 22 + + + + + + TextLabel3 + + + + 20 + 80 + 95 + 25 + + + + Module paths: + + + + + buttonModulePaths + + + + 370 + 105 + 30 + 25 + + + + ... + + + false + + + false + + + + + + GroupBox3 + + + + 5 + 155 + 230 + 150 + + + + Printing + + + + useCustomPrintDpi + + + + 20 + 40 + 190 + 20 + + + + Print at a custom resolution + + + + + customPrintDpi + + + + 125 + 75 + 65 + 20 + + + + UpDownArrows + + + 2400 + + + + + TextLabel10 + + + + 20 + 75 + 105 + 20 + + + + Custom resolution + + + + + TextLabel9 + + + + 200 + 75 + 20 + 20 + + + + dpi + + + + + + GroupBox2 + + + + 245 + 155 + 180 + 150 + + + + Other + + + + openSocket + + + + 20 + 40 + 145 + 20 + + + + Open socket at start + + + + + TextLabel4 + + + + 20 + 75 + 80 + 20 + + + + Undo levels + + + + + undoLevels + + + + 95 + 75 + 65 + 20 + + + + + + + + + + buttonOK + clicked() + KSConfigureDlgInterf + accept() + + + buttonCancel + clicked() + KSConfigureDlgInterf + reject() + + + buttonInstallPath + clicked() + KSConfigureDlgInterf + setInstallPath() + + + buttonModulePaths + clicked() + KSConfigureDlgInterf + addModulePath() + + + + ksconfiguredlginterf.ui.h + + + addModulePath() + setInstallPath() + + + diff --git a/kmatplot/dialogs/ksconfiguredlginterf.ui.h b/kmatplot/dialogs/ksconfiguredlginterf.ui.h new file mode 100644 index 0000000..2a0eefd --- /dev/null +++ b/kmatplot/dialogs/ksconfiguredlginterf.ui.h @@ -0,0 +1,18 @@ +/**************************************************************************** +** ui.h extension file, included from the uic-generated form implementation. +** +** If you wish to add, delete or rename slots use Qt Designer which will +** update this file, preserving your code. Create an init() slot in place of +** a constructor, and a destroy() slot in place of a destructor. +*****************************************************************************/ + + +void KSConfigureDlgInterf::addModulePath() +{ + +} + +void KSConfigureDlgInterf::setInstallPath() +{ + +} \ No newline at end of file diff --git a/kmatplot/dialogs/ksdatasetdlg.cpp b/kmatplot/dialogs/ksdatasetdlg.cpp new file mode 100644 index 0000000..e44733f --- /dev/null +++ b/kmatplot/dialogs/ksdatasetdlg.cpp @@ -0,0 +1,169 @@ +/*************************************************************************** + spdeletedialog.cpp + ------------------- + begin : 01-January-2000 + copyright : (C) 2000 by Kamil Dobkowski + email : kamildobk@poczta.onet.pl + ***************************************************************************/ + +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + +#include "ksdatasetdlg.h" +#include "kschannellist.h" +//#include "../kmatplotshell.h" +#include "../ksworkbook.h" +#include "../kscommands.h" +#include "../ksobjectfactory.h" +#include "../widgets/qsplot.h" +#include "../widgets/qsaxes.h" +#include +#include +#include + +//-----------------------------------------------------------// + +KSDatasetDlg::KSDatasetDlg( KSWorkbook *workbook, QSAxes *axes, QWidget *parent, const char *name ) +: KSDatasetDlgInterf(parent,name,true) + { + setCaption(tr("Current axes - Datasets")); + + m_workbook = workbook; + m_axes = axes; + + chanList->setGeometry(20,30,410,220); + chanList->setDataObject( axes, false, -1 ); + chanList->addColumn( tr(" Channel name"), 380 ); + + connect( bok, SIGNAL(clicked()), this, SLOT(accept()) ); + connect( bfront, SIGNAL(clicked()), this, SLOT(slot_to_front()) ); + connect( bback, SIGNAL(clicked()), this, SLOT(slot_to_back()) ); + connect( buttonRaise, SIGNAL(clicked()), this, SLOT(slot_raise()) ); + connect( buttonLower, SIGNAL(clicked()), this, SLOT(slot_lower()) ); + connect( chanList, SIGNAL(rightButtonPressed(QListViewItem*,const QPoint&,int)),this,SLOT(slot_show_menu(QListViewItem*,const QPoint&,int)) ); + } + +//-----------------------------------------------------------// + +KSDatasetDlg::~KSDatasetDlg() + { + } + +//-----------------------------------------------------------// + +void KSDatasetDlg::slot_to_front() + { + if ( chanList->selected() && chanList->selected()->dataObject() ) { + QSPlot *plot = dynamic_cast(chanList->selected()->dataObject()); + QSAxis *axis = dynamic_cast(chanList->selected()->dataObject()); + if ( plot ) m_workbook->execute( new KSCmdDatasetOrder( KSCmdDatasetOrder::ToFront,plot) ); + if ( axis ) m_workbook->execute( new KSCmdAxisOrder( KSCmdAxisOrder::ToFront,axis) ); + } + } + +//-----------------------------------------------------------// + +void KSDatasetDlg::slot_to_back() + { + if ( chanList->selected() && chanList->selected()->dataObject() ) { + QSPlot *plot = dynamic_cast(chanList->selected()->dataObject()); + QSAxis *axis = dynamic_cast(chanList->selected()->dataObject()); + if ( plot ) m_workbook->execute( new KSCmdDatasetOrder( KSCmdDatasetOrder::ToBack,plot) ); + if ( axis ) m_workbook->execute( new KSCmdAxisOrder( KSCmdAxisOrder::ToBack,axis) ); + } + } + +//-----------------------------------------------------------// + +void KSDatasetDlg::slot_raise() + { + if ( chanList->selected() && chanList->selected()->dataObject() ) { + QSPlot *plot = dynamic_cast(chanList->selected()->dataObject()); + QSAxis *axis = dynamic_cast(chanList->selected()->dataObject()); + if ( plot ) m_workbook->execute( new KSCmdDatasetOrder( KSCmdDatasetOrder::Raise,plot) ); + if ( axis ) m_workbook->execute( new KSCmdAxisOrder( KSCmdAxisOrder::Raise,axis) ); + } + } + + //-----------------------------------------------------------// + +void KSDatasetDlg::slot_lower() + { + if ( chanList->selected() && chanList->selected()->dataObject() ) { + QSPlot *plot = dynamic_cast(chanList->selected()->dataObject()); + QSAxis *axis = dynamic_cast(chanList->selected()->dataObject()); + if ( plot ) m_workbook->execute( new KSCmdDatasetOrder( KSCmdDatasetOrder::Lower,plot) ); + if ( axis ) m_workbook->execute( new KSCmdAxisOrder( KSCmdAxisOrder::Lower,axis) ); + } + } + +//-----------------------------------------------------------// + +void KSDatasetDlg::slot_show_menu(QListViewItem*,const QPoint&,int) + { + // Part -> show menu + // + QPopupMenu *menu = new QPopupMenu( this ); + int menu_cut = menu->insertItem( tr("Cut") ); + int menu_copy = menu->insertItem( tr("Copy") ); + int menu_copy_all = menu->insertItem( tr("Copy all") ); + int menu_paste = menu->insertItem( tr("Paste") ); + int menu_delete = menu->insertItem( tr("Delete") ); + if ( !chanList->selected() || !chanList->selected()->dataObject() ) { + menu->setItemEnabled( menu_cut, FALSE ); + menu->setItemEnabled( menu_copy, FALSE ); + menu->setItemEnabled( menu_copy_all, FALSE ); + menu->setItemEnabled( menu_delete, FALSE ); + } + int item_id = menu->exec(QCursor::pos()); + KSObjectFactory factory( m_workbook ); + + QSData *selected = chanList->selected() ? chanList->selected()->dataObject() : NULL; + QSPlot *plot = dynamic_cast(selected); + if ( plot && item_id == menu_cut ) { + factory.copyQSPlotToClipboard( plot ); + m_workbook->execute( new KSCmdRemoveDataset(plot) ); + } + else if ( plot && item_id == menu_copy ) { + factory.copyQSPlotToClipboard( plot ); + } + else if ( plot && item_id == menu_copy_all ) { + factory.setFlags( KSObjectFactory::CopyAllData ); + factory.copyQSPlotToClipboard( plot ); + } + if ( plot && item_id == menu_delete ) { + m_workbook->execute( new KSCmdRemoveDataset(plot) ); + } + + QSAxis *axis = dynamic_cast(selected); + if ( axis && item_id == menu_cut ) { + factory.copyQSAxisToClipboard( axis ); + m_workbook->execute( new KSCmdRemoveAxis(axis) ); + } + else if ( axis && item_id == menu_copy ) { + factory.copyQSAxisToClipboard( axis ); + } + else if ( axis && item_id == menu_copy_all ) { + factory.setFlags( KSObjectFactory::CopyAllData ); + factory.copyQSAxisToClipboard( axis ); + } + if ( axis && item_id == menu_delete ) { + m_workbook->execute( new KSCmdRemoveAxis(axis) ); + } + + if ( item_id == menu_paste ) { + QSPlot *new_plot = factory.pasteQSPlotFromClipboard( m_axes ); + if ( new_plot ) m_workbook->execute( new KSCmdAddDataset( new_plot ) ); + + QSAxis *new_axis = factory.pasteQSAxisFromClipboard( m_axes ); + if ( new_axis ) m_workbook->execute( new KSCmdAddAxis( new_axis ) ); + } + } + + diff --git a/kmatplot/dialogs/ksdatasetdlg.h b/kmatplot/dialogs/ksdatasetdlg.h new file mode 100644 index 0000000..36c2524 --- /dev/null +++ b/kmatplot/dialogs/ksdatasetdlg.h @@ -0,0 +1,71 @@ +/*************************************************************************** + spdeletedialog.h + ------------------- + begin : 01-January-2000 + copyright : (C) 2000 by Kamil Dobkowski + email : kamildobk@poczta.onet.pl + ***************************************************************************/ + +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + + +#ifndef KSDELETEDIALOG_H +#define KSDELETEDIALOG_H + + +#include"ksdatasetdlginterf.h" + +class QListViewItem; +class KSChannelList; +class QSAxes; +class KSWorkbook; + +/** + * Delete dialog. + * @author Kamil Dobkowski + */ +class KSDatasetDlg : public KSDatasetDlgInterf +{ + Q_OBJECT + public: + /** + * Constructor. + */ + KSDatasetDlg( KSWorkbook *workbook, QSAxes *axes, QWidget *parent=0, const char *name=0); + /** + * Destructor. + */ + ~KSDatasetDlg(); + + private slots: + void slot_to_front(); + void slot_to_back(); + void slot_raise(); + void slot_lower(); + void slot_show_menu(QListViewItem*,const QPoint&,int); + + private: + KSWorkbook *m_workbook; + QSAxes *m_axes; + +}; + +#endif + + + + + + + + + + + diff --git a/kmatplot/dialogs/ksdatasetdlginterf.cpp b/kmatplot/dialogs/ksdatasetdlginterf.cpp new file mode 100644 index 0000000..caed77d --- /dev/null +++ b/kmatplot/dialogs/ksdatasetdlginterf.cpp @@ -0,0 +1,97 @@ +/**************************************************************************** +** Form implementation generated from reading ui file './ksdatasetdlginterf.ui' +** +** Created: śro mar 20 18:53:15 2002 +** by: The User Interface Compiler (uic) +** +** WARNING! All changes made in this file will be lost! +****************************************************************************/ +#include "ksdatasetdlginterf.h" + +#include +#include +#include +#include +#include +#include +#include +#include "kschannellist.h" + +/* + * Constructs a KSDatasetDlgInterf which is a child of 'parent', with the + * name 'name' and widget flags set to 'f'. + * + * The dialog will by default be modeless, unless you set 'modal' to + * TRUE to construct a modal dialog. + */ +KSDatasetDlgInterf::KSDatasetDlgInterf( QWidget* parent, const char* name, bool modal, WFlags fl ) + : QDialog( parent, name, modal, fl ) +{ + if ( !name ) + setName( "KSDatasetDlgInterf" ); + resize( 445, 364 ); + setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5, (QSizePolicy::SizeType)5, 0, 0, sizePolicy().hasHeightForWidth() ) ); + setCaption( trUtf8( "NoName" ) ); + KSDatasetDlgInterfLayout = new QGridLayout( this, 1, 1, 11, 6, "KSDatasetDlgInterfLayout"); + + gchannels = new QGroupBox( this, "gchannels" ); + gchannels->setTitle( trUtf8( "Datasets && Axes" ) ); + gchannels->setColumnLayout(0, Qt::Vertical ); + gchannels->layout()->setSpacing( 5 ); + gchannels->layout()->setMargin( 11 ); + gchannelsLayout = new QGridLayout( gchannels->layout() ); + gchannelsLayout->setAlignment( Qt::AlignTop ); + + bback = new QPushButton( gchannels, "bback" ); + bback->setText( trUtf8( " << To Back" ) ); + + gchannelsLayout->addWidget( bback, 1, 0 ); + + buttonLower = new QPushButton( gchannels, "buttonLower" ); + buttonLower->setText( trUtf8( " < Lower" ) ); + + gchannelsLayout->addWidget( buttonLower, 1, 1 ); + + bfront = new QPushButton( gchannels, "bfront" ); + bfront->setText( trUtf8( "To Front >>" ) ); + + gchannelsLayout->addWidget( bfront, 1, 4 ); + + buttonRaise = new QPushButton( gchannels, "buttonRaise" ); + buttonRaise->setText( trUtf8( "Raise >" ) ); + + gchannelsLayout->addWidget( buttonRaise, 1, 3 ); + QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ); + gchannelsLayout->addItem( spacer, 1, 2 ); + + chanList = new KSChannelList( gchannels, "chanList" ); + chanList->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)7, 0, 0, chanList->sizePolicy().hasHeightForWidth() ) ); + + gchannelsLayout->addMultiCellWidget( chanList, 0, 0, 0, 4 ); + + KSDatasetDlgInterfLayout->addMultiCellWidget( gchannels, 0, 0, 0, 1 ); + + Line1 = new QFrame( this, "Line1" ); + Line1->setProperty( "frameShape", (int)QFrame::HLine ); + Line1->setFrameShadow( QFrame::Sunken ); + Line1->setFrameShape( QFrame::HLine ); + + KSDatasetDlgInterfLayout->addMultiCellWidget( Line1, 1, 1, 0, 1 ); + + bok = new QPushButton( this, "bok" ); + bok->setText( trUtf8( "Close" ) ); + + KSDatasetDlgInterfLayout->addWidget( bok, 2, 1 ); + QSpacerItem* spacer_2 = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ); + KSDatasetDlgInterfLayout->addItem( spacer_2, 2, 0 ); +} + +/* + * Destroys the object and frees any allocated resources + */ +KSDatasetDlgInterf::~KSDatasetDlgInterf() +{ + // no need to delete child widgets, Qt does it all for us +} + +#include "ksdatasetdlginterf.moc" diff --git a/kmatplot/dialogs/ksdatasetdlginterf.ui b/kmatplot/dialogs/ksdatasetdlginterf.ui new file mode 100644 index 0000000..fa8dd6a --- /dev/null +++ b/kmatplot/dialogs/ksdatasetdlginterf.ui @@ -0,0 +1,182 @@ + +KSDatasetDlgInterf + + + KSDatasetDlgInterf + + + + 0 + 0 + 445 + 364 + + + + + 5 + 5 + 0 + 0 + + + + NoName + + + + unnamed + + + 11 + + + 6 + + + + gchannels + + + Datasets && Axes + + + + unnamed + + + 11 + + + 5 + + + + bback + + + << To Back + + + + + buttonLower + + + < Lower + + + + + bfront + + + To Front >> + + + + + buttonRaise + + + Raise > + + + + + Spacer1 + + + Horizontal + + + Expanding + + + + 20 + 20 + + + + + + chanList + + + + 7 + 7 + 0 + 0 + + + + + + + + Line1 + + + HLine + + + Sunken + + + Horizontal + + + + + bok + + + Close + + + + + Spacer2 + + + Horizontal + + + Expanding + + + + 20 + 20 + + + + + + + + KSChannelList +
kschannellist.h
+ + -1 + -1 + + 0 + + 5 + 5 + 0 + 0 + + image0 +
+
+ + + 789c6dd2c10ac2300c00d07bbf2234b7229d1be245fc04c5a3201e4615f430059d0711ff5ddb2e6bb236ec90eed134cb5a19d8ef36602af5ecdbfeeac05dda0798d3abebde87e3faa374d3807fa0d633a52d38d8de6f679fe33fc776e196f53cd010188256a3600a292882096246517815ca99884606e18044a3a40d91824820924265a7923a2e8bcd05f33db1173e002913175f2a6be6d3294871a2d95fa00e8a94ee017b69d339d90df1e77c57ea072ede6758 + + + +
diff --git a/kmatplot/dialogs/ksexportdlg.cpp b/kmatplot/dialogs/ksexportdlg.cpp new file mode 100644 index 0000000..e0719d6 --- /dev/null +++ b/kmatplot/dialogs/ksexportdlg.cpp @@ -0,0 +1,109 @@ +/*************************************************************************** + ksexportdlg.cpp + ------------------- + begin : Thu Feb 10 2000 + copyright : (C) 2000 by Kamil Dobkowski + email : kamildbk@friko.onet.pl + ***************************************************************************/ + +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + +#include "ksexportdlg.h" +#include "../ksmatrixio.h" +#include "../ksglobalmatrixlist.h" +#include "../ksdataobjectfactory.h" +#include "kschannellist.h" +#include +#include +#include +#include + +QString KSExportDlg::m_file_name; + +//-----------------------------------------------------------// + +KSExportDlg::KSExportDlg(QSData *data, QWidget *parent, const char *name) +: KSExportDlgInterf(parent,name,true) + { + chanList->addColumn( tr(" Channel name"), 150 ); + chanList->addColumn( tr(" Channel name"), 85 ); + chanList->addColumn( tr(" RowsxCols"), 60 ); + chanList->addColumn( tr(" Action "), 60 ); + + if ( dynamic_cast(data) ) chanList->setDataObject( data, false, 0, false ); + else chanList->setDataObject( data, true, -1, true ); + filename->setText( m_file_name ); + + connect( bbrowse, SIGNAL(clicked()), this, SLOT(chooseFile()) ); + connect( bexport, SIGNAL(clicked()), this, SLOT(markChannel()) ); + connect( bok, SIGNAL(clicked()), this, SLOT(accept()) ); + connect( bcancel, SIGNAL(clicked()), this, SLOT(reject()) ); + } + +//-----------------------------------------------------------// + +KSExportDlg::~KSExportDlg() + { + } + +//-----------------------------------------------------------// + +void KSExportDlg::markChannel() + { + KSChannelListItem *citem = chanList->selected(); + if ( citem && citem->isValid() ) { + if ( citem->text(3).isEmpty() ) citem->setText( 3, tr("Export") ); + else citem->setText( 3, QString::null ); + } + } + +//-----------------------------------------------------------// + +void KSExportDlg::chooseFile() + { + QString result = QFileDialog::getSaveFileName( m_file_name.isEmpty() ? QDir::homeDirPath() : m_file_name, + tr("*| All files (*)"), + this, "export_dialog", + tr("Export to...")); + if ( !result.isEmpty() ) { + m_file_name = result; + filename->setText( m_file_name ); + } + } + +//-----------------------------------------------------------// + +void KSExportDlg::saveAll() + { + m_file_name = filename->text().stripWhiteSpace(); + if ( m_file_name.isEmpty() ) return; + + KSMatrixIO io( m_file_name, IO_WriteOnly ); + KSChannelListItem *citem = chanList->first(); + while ( citem ) { + if ( citem->isValid() && !citem->text(3).isEmpty() ) { + QString mname = QString("c") + + KSDataObjectFactory::channelNameFactory(citem->dataObject(),citem->channel()).lower().stripWhiteSpace()+ + QString::number(citem->channel()); + + mname.replace( QRegExp("\\s+" ), "_" ); + mname.replace( QRegExp("\\-+" ), "_" ); + mname.replace( QRegExp("\\.+" ), "_" ); + QSMatrix *m = citem->dataObject()->matrix( citem->channel() ); + if ( m ) io.saveMatrix( m, mname, "ASCII" ); + } + + // process the next item + citem = citem->next(); + } + } + +//-----------------------------------------------------------// + diff --git a/kmatplot/dialogs/ksexportdlg.h b/kmatplot/dialogs/ksexportdlg.h new file mode 100644 index 0000000..b3beea2 --- /dev/null +++ b/kmatplot/dialogs/ksexportdlg.h @@ -0,0 +1,49 @@ +/*************************************************************************** + ksexportdlg.h + ------------------- + begin : Thu Feb 10 2000 + copyright : (C) 2000 by Kamil Dobkowski + email : kamildbk@friko.onet.pl + ***************************************************************************/ + +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + +#ifndef KSEXPORTDLG_H +#define KSEXPORTDLG_H + +#include +#include "../widgets/qsdata.h" +#include "ksexportdlginterf.h" + + +class KSChannelList; + +/** + *@author Kamil Dobkowski + */ + +class KSExportDlg : public KSExportDlgInterf + { + Q_OBJECT +public: + KSExportDlg(QSData *view, QWidget *parent=0, const char *name=0); + ~KSExportDlg(); + void saveAll(); + +protected: + static QString m_file_name; + KSChannelList *m_chan_list; + +protected slots: + void markChannel(); + void chooseFile(); +}; + +#endif diff --git a/kmatplot/dialogs/ksexportdlginterf.cpp b/kmatplot/dialogs/ksexportdlginterf.cpp new file mode 100644 index 0000000..641d49c --- /dev/null +++ b/kmatplot/dialogs/ksexportdlginterf.cpp @@ -0,0 +1,111 @@ +/**************************************************************************** +** Form implementation generated from reading ui file './ksexportdlginterf.ui' +** +** Created: śro mar 20 18:53:14 2002 +** by: The User Interface Compiler (uic) +** +** WARNING! All changes made in this file will be lost! +****************************************************************************/ +#include "ksexportdlginterf.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include "kschannellist.h" + +/* + * Constructs a KSExportDlgInterf which is a child of 'parent', with the + * name 'name' and widget flags set to 'f'. + * + * The dialog will by default be modeless, unless you set 'modal' to + * TRUE to construct a modal dialog. + */ +KSExportDlgInterf::KSExportDlgInterf( QWidget* parent, const char* name, bool modal, WFlags fl ) + : QDialog( parent, name, modal, fl ) +{ + if ( !name ) + setName( "KSExportDlgInterf" ); + resize( 430, 415 ); + setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, sizePolicy().hasHeightForWidth() ) ); + setMinimumSize( QSize( 430, 415 ) ); + setCaption( trUtf8( "Export ASCII Octave" ) ); + KSExportDlgInterfLayout = new QGridLayout( this, 1, 1, 11, 6, "KSExportDlgInterfLayout"); + + bcancel = new QPushButton( this, "bcancel" ); + bcancel->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5, (QSizePolicy::SizeType)0, 0, 0, bcancel->sizePolicy().hasHeightForWidth() ) ); + bcancel->setText( trUtf8( "Close" ) ); + + KSExportDlgInterfLayout->addWidget( bcancel, 2, 2 ); + + bok = new QPushButton( this, "bok" ); + bok->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5, (QSizePolicy::SizeType)0, 0, 0, bok->sizePolicy().hasHeightForWidth() ) ); + bok->setText( trUtf8( "Create File" ) ); + bok->setDefault( TRUE ); + + KSExportDlgInterfLayout->addWidget( bok, 2, 1 ); + + QGroupBox_1 = new QGroupBox( this, "QGroupBox_1" ); + QGroupBox_1->setTitle( trUtf8( "Choose a file name and matrices to export" ) ); + QGroupBox_1->setColumnLayout(0, Qt::Vertical ); + QGroupBox_1->layout()->setSpacing( 6 ); + QGroupBox_1->layout()->setMargin( 25 ); + QGroupBox_1Layout = new QGridLayout( QGroupBox_1->layout() ); + QGroupBox_1Layout->setAlignment( Qt::AlignTop ); + + chanList = new KSChannelList( QGroupBox_1, "chanList" ); + chanList->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5, (QSizePolicy::SizeType)7, 0, 0, chanList->sizePolicy().hasHeightForWidth() ) ); + + QGroupBox_1Layout->addMultiCellWidget( chanList, 1, 1, 0, 1 ); + + Frame3 = new QFrame( QGroupBox_1, "Frame3" ); + Frame3->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)0, 0, 0, Frame3->sizePolicy().hasHeightForWidth() ) ); + Frame3->setFrameShape( QFrame::WinPanel ); + Frame3->setFrameShadow( QFrame::Sunken ); + Frame3->setMidLineWidth( 1 ); + Frame3Layout = new QHBoxLayout( Frame3, 2, 0, "Frame3Layout"); + + filename = new QLineEdit( Frame3, "filename" ); + filename->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)7, 0, 0, filename->sizePolicy().hasHeightForWidth() ) ); + filename->setFrame( FALSE ); + Frame3Layout->addWidget( filename ); + + bbrowse = new QPushButton( Frame3, "bbrowse" ); + bbrowse->setText( trUtf8( "Browse ..." ) ); + bbrowse->setAutoDefault( FALSE ); + Frame3Layout->addWidget( bbrowse ); + + QGroupBox_1Layout->addMultiCellWidget( Frame3, 0, 0, 0, 1 ); + + bexport = new QPushButton( QGroupBox_1, "bexport" ); + bexport->setText( trUtf8( "Mark/Unmark" ) ); + + QGroupBox_1Layout->addWidget( bexport, 2, 1 ); + QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ); + QGroupBox_1Layout->addItem( spacer, 2, 0 ); + + KSExportDlgInterfLayout->addMultiCellWidget( QGroupBox_1, 0, 0, 0, 2 ); + + Line2 = new QFrame( this, "Line2" ); + Line2->setProperty( "frameShape", (int)QFrame::HLine ); + Line2->setFrameShadow( QFrame::Sunken ); + Line2->setFrameShape( QFrame::HLine ); + + KSExportDlgInterfLayout->addMultiCellWidget( Line2, 1, 1, 0, 2 ); + QSpacerItem* spacer_2 = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ); + KSExportDlgInterfLayout->addItem( spacer_2, 2, 0 ); +} + +/* + * Destroys the object and frees any allocated resources + */ +KSExportDlgInterf::~KSExportDlgInterf() +{ + // no need to delete child widgets, Qt does it all for us +} + +#include "ksexportdlginterf.moc" diff --git a/kmatplot/dialogs/ksexportdlginterf.ui b/kmatplot/dialogs/ksexportdlginterf.ui new file mode 100644 index 0000000..908a8dc --- /dev/null +++ b/kmatplot/dialogs/ksexportdlginterf.ui @@ -0,0 +1,255 @@ + +KSExportDlgInterf + + + KSExportDlgInterf + + + + 0 + 0 + 430 + 415 + + + + + 0 + 0 + 0 + 0 + + + + + 430 + 415 + + + + Export ASCII Octave + + + + unnamed + + + 11 + + + 6 + + + + bcancel + + + + 5 + 0 + 0 + 0 + + + + Close + + + + + bok + + + + 5 + 0 + 0 + 0 + + + + Create File + + + true + + + + + QGroupBox_1 + + + Choose a file name and matrices to export + + + + unnamed + + + 25 + + + 6 + + + + chanList + + + + 5 + 7 + 0 + 0 + + + + + + Frame3 + + + + 7 + 0 + 0 + 0 + + + + WinPanel + + + Sunken + + + 1 + + + + + + + + unnamed + + + 2 + + + 0 + + + + filename + + + + 7 + 7 + 0 + 0 + + + + false + + + + + bbrowse + + + Browse ... + + + false + + + + + + + bexport + + + Mark/Unmark + + + + + Spacer2 + + + Horizontal + + + Expanding + + + + 20 + 20 + + + + + + + + Line2 + + + HLine + + + Sunken + + + Horizontal + + + + + Spacer1 + + + Horizontal + + + Expanding + + + + 20 + 20 + + + + + + + + KSChannelList +
kschannellist.h
+ + -1 + -1 + + 0 + + 5 + 5 + 0 + 0 + + image0 +
+
+ + + 789c6dd2c10ac2300c00d07bbf2234b7229d1be245fc04c5a3201e4615f430059d0711ff5ddb2e6bb236ec90eed134cb5a19d8ef36602af5ecdbfeeac05dda0798d3abebde87e3faa374d3807fa0d633a52d38d8de6f679fe33fc776e196f53cd010188256a3600a292882096246517815ca99884606e18044a3a40d91824820924265a7923a2e8bcd05f33db1173e002913175f2a6be6d3294871a2d95fa00e8a94ee017b69d339d90df1e77c57ea072ede6758 + + + +
diff --git a/kmatplot/dialogs/ksexportpicturedlg.cpp b/kmatplot/dialogs/ksexportpicturedlg.cpp new file mode 100644 index 0000000..80a5be1 --- /dev/null +++ b/kmatplot/dialogs/ksexportpicturedlg.cpp @@ -0,0 +1,370 @@ +/*************************************************************************** + ksexportpicturedlg.cpp - description + ------------------- + begin : Tue May 29 2001 + copyright : (C) 2001 by kamil + email : kamil@localhost.localdomain + ***************************************************************************/ + +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + +#include "ksexportpicturedlg.h" +#include "../widgets/qsplotview.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include // tmpfile + +QString KSExportPictureDlg::m_file_name; +int KSExportPictureDlg::m_file_format = 0; +double KSExportPictureDlg::m_file_dpi = 72.0; + +int KSExportPictureDlg::m_pixmap_format = 0; +int KSExportPictureDlg::m_pixmap_quality = 75; +bool KSExportPictureDlg::m_pixmap_smooth = false; + +int KSExportPictureDlg::m_metafile_format = 0; + +bool KSExportPictureDlg::m_input_full_page = false; +double KSExportPictureDlg::m_input_x = 0.0; +double KSExportPictureDlg::m_input_y = 0.0; +double KSExportPictureDlg::m_input_width = 0.0; +double KSExportPictureDlg::m_input_height = 0.0; + +int KSExportPictureDlg::m_user_gs_device = 0; +int KSExportPictureDlg::m_user_imagick_device = 0; +int KSExportPictureDlg::m_user_command = -1; +QStringList KSExportPictureDlg::m_user_commands; +QString KSExportPictureDlg::m_user_curr_command; + +//---------------------------------------------------------------------------// + +KSExportPictureDlg::KSExportPictureDlg(QSPlotView *view, const char *name ) +: KSExportPictureDlgInterf(view,name,TRUE) + { + m_view = view; + m_curr_process = NULL; + m_curr_temp_file = NULL; + + fileName->setText(m_file_name); + + fileFormat->clear(); + fileFormat->insertItem( tr("Pixmap") ); + fileFormat->insertItem( tr("Qt metafile") ); + fileFormat->insertItem( tr("User's program") ); + fileFormat->setCurrentItem( m_file_format ); + fileDpi->setText( QString::number(m_file_dpi) ); + + pixmapDepth->clear(); + pixmapDepth->insertItem( tr("Screen") ); + pixmapDepth->setEnabled( FALSE ); // not implemented + pixmapFormat->clear(); + pixmapFormat->insertStringList( QImage::outputFormatList() ); + pixmapFormat->setCurrentItem( m_pixmap_format ); + pixmapSmooth->setChecked( m_pixmap_smooth ); + pixmapQuality->setValue( m_pixmap_quality ); + + metafileFormat->setCurrentItem( m_metafile_format ); + + inputX->setText( QString::number(m_input_x) ); + inputY->setText( QString::number(m_input_y) ); + inputWidth->setText( QString::number(m_input_width) ); + inputHeight->setText( QString::number(m_input_height) ); + inputFullPage->setChecked( m_input_full_page ); + + if ( m_input_width == 0.0 || m_input_height == 0.0 ) { + setFullPage( TRUE ); + setFullPage( FALSE ); + } + + if ( m_user_command == -1 ) { + // default comand in the edit field + m_user_curr_command = "gs -q -dBATCH -dSAFER -dQUIET -dNOPAUSE -g%3x%4 -sDEVICE=%6 -sOutputFile=%2 %1 "; + // commands in the drop-down menu + m_user_commands.append( m_user_curr_command ); + m_user_commands.append("pstoedit -f xfig %1 %2"); + m_user_commands.append("convert -antialias -page %3x%4 ps:%1 %7:%2"); + m_user_commands.append("convert -colors 256 -dither -page %3x%4 ps:%1 %7:%2"); + m_user_commands.append("cp %1 %2"); + m_user_command = 0; + } + + userCommand->clear(); + userCommand->insertStringList( m_user_commands ); + userCommand->setCurrentItem( m_user_command ); + userCommand->setEditText( m_user_curr_command ); + + userGSDevice->setCurrentItem( m_user_gs_device ); + userIMagickDevice->setCurrentItem( m_user_imagick_device ); + changeImageSize( QString::null ); + } + +//---------------------------------------------------------------------------// + +KSExportPictureDlg::~KSExportPictureDlg() + { + clean_up(); + } + +//---------------------------------------------------------------------------// + +void KSExportPictureDlg::browseFilename() + { + QString result = QFileDialog::getSaveFileName(QDir::currentDirPath(), + tr("*| All files (*)"), + this, "export_picture", + tr("Export to...")); + if ( !result.isEmpty() ) fileName->setText( result ); + } + +//---------------------------------------------------------------------------// + +void KSExportPictureDlg::changeImageSize( const QString& ) + { + double dpi = fileDpi->text().toDouble(); + double w = inputWidth->text().toDouble(); + double h = inputHeight->text().toDouble(); + imageSize->setText( QString::number( QMAX((int )QSCoord::mmToPixels(w,dpi),1) ) + + " x " + + QString::number( QMAX((int )QSCoord::mmToPixels(h,dpi),1) ) + + tr(" pixels") ); + } + +//---------------------------------------------------------------------------// + +void KSExportPictureDlg::setFullPage( bool enabled ) + { + if ( enabled ) { + if ( m_view->workbook()->printer() ) { + QPaintDeviceMetrics pdm(m_view->workbook()->printer()); + inputX->setText(QString::number(0)); + inputY->setText(QString::number(0)); + inputWidth->setText(QString::number(pdm.widthMM())); + inputHeight->setText(QString::number(pdm.heightMM())); + } + inputX->setEnabled( FALSE ); + inputY->setEnabled( FALSE ); + inputWidth->setEnabled( FALSE ); + inputHeight->setEnabled( FALSE ); + } else { + inputX->setEnabled( TRUE ); + inputY->setEnabled( TRUE ); + inputWidth->setEnabled( TRUE ); + inputHeight->setEnabled( TRUE ); + } + } + +//---------------------------------------------------------------------------// + +void KSExportPictureDlg::exportPicture() + { + clean_up(); + + if ( fileName->text().isEmpty() ) { + QMessageBox::warning ( this, tr("Error"), tr("File name is empty !"), QMessageBox::Ok, 0, 0 ); + return; + } + + // calculate the size of output + enum OutputType { OutputPixmap=0, OutputMetafile=1, OutputProgram=2 } output_type; + output_type = (OutputType )fileFormat->currentItem(); + + double dpi = fileDpi->text().toDouble(); + double x_mm = inputX->text().toDouble(); + double y_mm = inputY->text().toDouble(); + double w_mm = inputWidth->text().toDouble(); + double h_mm = inputHeight->text().toDouble(); + int w = QMAX( (int )QSCoord::mmToPixels(w_mm,dpi), 1 ); + int h = QMAX( (int )QSCoord::mmToPixels(h_mm,dpi), 1 ); + + // prepare an output device + QString format; + QPaintDevice *output_device = NULL; + + userOutput->clear(); + userOutput->append(tr("Exporting ...")); + qApp->processEvents(); + if ( output_type == OutputPixmap ) { + if ( pixmapSmooth->isChecked() ) { w *= 2; h *= 2; dpi *= 2.0; } + QPixmap *pixmap = new QPixmap( w, h ); + pixmap->fill( white ); + output_device = pixmap; + format = QImage::outputFormatList()[pixmapFormat->currentItem()]; + } + else + if ( output_type == OutputMetafile ) { + output_device = new QPicture(); + format = QString::null; + } + else + if ( output_type == OutputProgram ) { + m_curr_temp_file = new QFile( tmpnam(NULL) ); + + // create a temporary file + if ( !m_curr_temp_file->open(IO_WriteOnly) ) userOutput->append( tr("Can't open a temporary file ")+m_curr_temp_file->name() ); else m_curr_temp_file->close(); + + QPrinter *printer = new QPrinter(); + printer->setOutputToFile( TRUE ); + printer->setOutputFileName( m_curr_temp_file->name() );// overwrite temp_file + printer->setPageSize( m_view->workbook()->printer()->pageSize() ); + printer->setFullPage( TRUE ); + printer->setColorMode( QPrinter::Color ); + printer->setNumCopies( 1 ); + output_device = printer; + format = QString::null; + } + + // draw on a pixmap + QSPage *curr_page = m_view->currentPage(); + if ( curr_page ) { + QPainter painter( output_device ); + // Try setting resolution in Qt3 instead of this + // - check crop 0 + if ( output_type == OutputProgram ) { + painter.translate( 0, -int(h/dpi*(dpi-72.0)) ); + } + + painter.translate( -(int )QSCoord::mmToPixels(x_mm,dpi), + -(int )QSCoord::mmToPixels(y_mm,dpi) ); + + curr_page->paint( &painter, dpi, true ); + } + + // generate output + bool result = false; + if ( output_type == OutputPixmap ) { + QPixmap *output = (QPixmap *)output_device; + QImage image = output->convertToImage(); + if ( pixmapSmooth->isChecked() ) image = image.smoothScale( w/2, h/2 ); + result = image.save( fileName->text(), format, pixmapQuality->value() ); + if ( !result ) userOutput->append(tr("Can't write image !")); + } + else + if ( output_type == OutputMetafile ) { + QPicture *output = (QPicture *)output_device; + result = output->save(fileName->text(), ( metafileFormat->currentItem() ? "svg" : NULL ) ); + if ( !result ) userOutput->append(tr("Can't write image !")); + } + else + if ( output_type == OutputProgram ) { + QPrinter *output = (QPrinter *)output_device; + if ( output->aborted() ) { + userOutput->append(tr("Printing to PS aborted !.")); + } else { + // substitute values + QString command_line = userCommand->currentText(); + command_line = command_line.replace( QRegExp("%1"), m_curr_temp_file->name() ); + command_line = command_line.replace( QRegExp("%2"), fileName->text() ); + command_line = command_line.replace( QRegExp("%3"), QString::number(w) ); + command_line = command_line.replace( QRegExp("%4"), QString::number(h) ); + command_line = command_line.replace( QRegExp("%5"), QString::number(dpi) ); + command_line = command_line.replace( QRegExp("%6"), userGSDevice->currentText() ); + command_line = command_line.replace( QRegExp("%7"), userIMagickDevice->currentText() ); + command_line = command_line.stripWhiteSpace(); + userOutput->append( tr("Executing:\n")+command_line ); + qApp->processEvents(); + + // prepare argument list + m_curr_process = new QProcess( QStringList::split( QRegExp("\\s+"), command_line ), this ); + connect( m_curr_process, SIGNAL(readyReadStdout()), this, SLOT(slotReceivedOutput()) ); + connect( m_curr_process, SIGNAL(readyReadStderr()), this, SLOT(slotReceivedOutput()) ); + connect( m_curr_process, SIGNAL(processExited()), this, SLOT(slotProcessExited()) ); + result = m_curr_process->start(); + + if ( !result ) { userOutput->append( tr("\nCould not run the program !") ); clean_up(); } + } + } + + m_file_name = fileName->text(); + m_file_format = fileFormat->currentItem(); + m_file_dpi = fileDpi->text().toDouble(); + + m_input_x = inputX->text().toDouble(); + m_input_y = inputY->text().toDouble(); + m_input_width = inputWidth->text().toDouble(); + m_input_height = inputHeight->text().toDouble(); + m_input_full_page = inputFullPage->isChecked(); + + m_pixmap_format = pixmapFormat->currentItem(); + m_pixmap_quality = pixmapQuality->value(); + m_pixmap_smooth = pixmapSmooth->isChecked(); + + m_metafile_format = metafileFormat->currentItem(); + + m_user_gs_device = userGSDevice->currentItem(); + m_user_imagick_device = userIMagickDevice->currentItem(); + m_user_command = userCommand->currentItem(); + m_user_commands.clear(); + for ( int i=0; icount(); i++ ) m_user_commands.append( userCommand->text( i ) ); + m_user_curr_command = userCommand->currentText(); + + delete output_device; + if ( !result ) QMessageBox::warning ( this, tr("Error"), tr("Unknown error !"), QMessageBox::Ok, 0, 0 ); + + userOutput->append(tr("Finished.")); + m_view->updateCanvas(); + } + +//---------------------------------------------------------------------------// + +void KSExportPictureDlg::slotReceivedOutput() + { + if ( m_curr_process ) { + if ( m_curr_process->readStdout().size() ) userOutput->append(m_curr_process->readStdout()); + if ( m_curr_process->readStderr().size() ) userOutput->append(m_curr_process->readStderr()); + } + qApp->processEvents(); + } + +//---------------------------------------------------------------------------// + +void KSExportPictureDlg::slotProcessExited() + { + if ( m_curr_process && m_curr_process->normalExit() ) { + userOutput->append( tr("\nExit code : ")+QString::number(m_curr_process->exitStatus()) ); + } else { + userOutput->append( tr("\nProgram died unexpectedly !") ); + } + clean_up(); + } + +//---------------------------------------------------------------------------// + +void KSExportPictureDlg::clean_up() + { + if ( m_curr_process && m_curr_process->isRunning() ) m_curr_process->kill(); + delete m_curr_process; m_curr_process = NULL; + if ( m_curr_temp_file ) m_curr_temp_file->remove(); + delete m_curr_temp_file; m_curr_temp_file = NULL; + } + +/* +&& m_curr_process->normalExit() +else { + userOutput->append( tr("\nProgram died unexpectedly !") ); + } +*/ +//for( int i=0; i<(int )args.count(); i++ ) user_prog << args[i].stripWhiteSpace(); +// QStringList args = QStringList::split( QRegExp("\\s+"), command_line ); diff --git a/kmatplot/dialogs/ksexportpicturedlg.h b/kmatplot/dialogs/ksexportpicturedlg.h new file mode 100644 index 0000000..5c2318b --- /dev/null +++ b/kmatplot/dialogs/ksexportpicturedlg.h @@ -0,0 +1,71 @@ +/*************************************************************************** + ksexportpicturedlg.h - description + ------------------- + begin : Tue May 29 2001 + copyright : (C) 2001 by kamil + email : kamil@localhost.localdomain + ***************************************************************************/ + +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + +#ifndef KSEXPORTPICTUREDLG_H +#define KSEXPORTPICTUREDLG_H + +#include +#include +#include +#include "ksexportpicturedlginterf.h" +class QFile; +class QProcess; +class QSPlotView; + +/** + *@author kamil + */ +class KSExportPictureDlg : public KSExportPictureDlgInterf { + Q_OBJECT + public: + KSExportPictureDlg( QSPlotView *view, const char *name=0); + virtual ~KSExportPictureDlg(); + + public slots: + virtual void exportPicture(); + virtual void browseFilename(); + virtual void changeImageSize( const QString& ); + virtual void setFullPage( bool ); + void slotReceivedOutput (); + void slotProcessExited(); + + protected: + QSPlotView *m_view; + QProcess *m_curr_process; + QFile *m_curr_temp_file; + static QString m_file_name; + static int m_file_format; + static double m_file_dpi; + static int m_pixmap_format; + static int m_pixmap_quality; + static bool m_pixmap_smooth; + static int m_metafile_format; + static double m_input_x; + static double m_input_y; + static double m_input_width; + static double m_input_height; + static bool m_input_full_page; + static int m_user_gs_device; + static int m_user_imagick_device; + static int m_user_command; + static QStringList m_user_commands; + static QString m_user_curr_command; + + void clean_up(); +}; + +#endif diff --git a/kmatplot/dialogs/ksexportpicturedlginterf.cpp b/kmatplot/dialogs/ksexportpicturedlginterf.cpp new file mode 100644 index 0000000..bf7498d --- /dev/null +++ b/kmatplot/dialogs/ksexportpicturedlginterf.cpp @@ -0,0 +1,451 @@ +/**************************************************************************** +** Form implementation generated from reading ui file './ksexportpicturedlginterf.ui' +** +** Created: śro mar 20 18:53:19 2002 +** by: The User Interface Compiler (uic) +** +** WARNING! All changes made in this file will be lost! +****************************************************************************/ +#include "ksexportpicturedlginterf.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +/* + * Constructs a KSExportPictureDlgInterf which is a child of 'parent', with the + * name 'name' and widget flags set to 'f'. + * + * The dialog will by default be modeless, unless you set 'modal' to + * TRUE to construct a modal dialog. + */ +KSExportPictureDlgInterf::KSExportPictureDlgInterf( QWidget* parent, const char* name, bool modal, WFlags fl ) + : QDialog( parent, name, modal, fl ) +{ + if ( !name ) + setName( "KSExportPictureDlgInterf" ); + resize( 550, 510 ); + setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, sizePolicy().hasHeightForWidth() ) ); + setMinimumSize( QSize( 550, 510 ) ); + setMaximumSize( QSize( 550, 371 ) ); + setBaseSize( QSize( 200, 200 ) ); + setCaption( trUtf8( "Export picture" ) ); + + Line1 = new QFrame( this, "Line1" ); + Line1->setGeometry( QRect( 5, 450, 535, 16 ) ); + Line1->setFrameShape( QFrame::HLine ); + + userOutput = new QMultiLineEdit( this, "userOutput" ); + userOutput->setEnabled( TRUE ); + userOutput->setGeometry( QRect( 5, 350, 540, 100 ) ); + userOutput->setFocusPolicy( QMultiLineEdit::NoFocus ); + userOutput->setAcceptDrops( FALSE ); + userOutput->setFrameShape( QMultiLineEdit::Box ); + userOutput->setReadOnly( TRUE ); + userOutput->setText( trUtf8( "" ) ); + QToolTip::add( userOutput, trUtf8( "Program output" ) ); + + Frame3 = new QFrame( this, "Frame3" ); + Frame3->setGeometry( QRect( 215, 125, 325, 220 ) ); + Frame3->setFrameShape( QFrame::WinPanel ); + Frame3->setFrameShadow( QFrame::Sunken ); + Frame3->setLineWidth( 1 ); + Frame3Layout = new QHBoxLayout( Frame3, 2, 0, "Frame3Layout"); + + TabWidget2 = new QTabWidget( Frame3, "TabWidget2" ); + + tab = new QWidget( TabWidget2, "tab" ); + + GroupBox4_2 = new QGroupBox( tab, "GroupBox4_2" ); + GroupBox4_2->setGeometry( QRect( 5, 5, 310, 180 ) ); + GroupBox4_2->setFrameShape( QGroupBox::NoFrame ); + GroupBox4_2->setTitle( trUtf8( "" ) ); + + TextLabel1_2_2 = new QLabel( GroupBox4_2, "TextLabel1_2_2" ); + TextLabel1_2_2->setGeometry( QRect( 25, 36, 70, 20 ) ); + TextLabel1_2_2->setText( trUtf8( "Format" ) ); + + TextLabel1_3_2 = new QLabel( GroupBox4_2, "TextLabel1_3_2" ); + TextLabel1_3_2->setGeometry( QRect( 25, 70, 65, 20 ) ); + TextLabel1_3_2->setText( trUtf8( "Quality" ) ); + + TextLabel3_2 = new QLabel( GroupBox4_2, "TextLabel3_2" ); + TextLabel3_2->setGeometry( QRect( 25, 100, 70, 25 ) ); + TextLabel3_2->setText( trUtf8( "Depth" ) ); + + pixmapSmooth = new QCheckBox( GroupBox4_2, "pixmapSmooth" ); + pixmapSmooth->setGeometry( QRect( 95, 135, 145, 20 ) ); + pixmapSmooth->setText( trUtf8( "Smooth" ) ); + + pixmapDepth = new QComboBox( FALSE, GroupBox4_2, "pixmapDepth" ); + pixmapDepth->insertItem( trUtf8( "16M colors" ) ); + pixmapDepth->insertItem( trUtf8( "256 colors" ) ); + pixmapDepth->insertItem( trUtf8( "256 grays" ) ); + pixmapDepth->setGeometry( QRect( 95, 100, 90, 22 ) ); + + pixmapQuality = new QSlider( GroupBox4_2, "pixmapQuality" ); + pixmapQuality->setGeometry( QRect( 95, 70, 140, 16 ) ); + pixmapQuality->setMaxValue( 100 ); + pixmapQuality->setValue( 90 ); + pixmapQuality->setOrientation( QSlider::Horizontal ); + + pixmapFormat = new QComboBox( FALSE, GroupBox4_2, "pixmapFormat" ); + pixmapFormat->insertItem( trUtf8( "PNG" ) ); + pixmapFormat->insertItem( trUtf8( "JPEG" ) ); + pixmapFormat->setGeometry( QRect( 95, 35, 140, 20 ) ); + TabWidget2->insertTab( tab, trUtf8( "Pixmap" ) ); + + tab_2 = new QWidget( TabWidget2, "tab_2" ); + + TextLabel1_5 = new QLabel( tab_2, "TextLabel1_5" ); + TextLabel1_5->setGeometry( QRect( 55, 70, 85, 20 ) ); + TextLabel1_5->setText( trUtf8( "Format" ) ); + + metafileFormat = new QComboBox( FALSE, tab_2, "metafileFormat" ); + metafileFormat->insertItem( trUtf8( "Native" ) ); + metafileFormat->insertItem( trUtf8( "SVG" ) ); + metafileFormat->setGeometry( QRect( 143, 70, 120, 20 ) ); + TabWidget2->insertTab( tab_2, trUtf8( "QMetafile" ) ); + + tab_3 = new QWidget( TabWidget2, "tab_3" ); + + GroupBox5 = new QGroupBox( tab_3, "GroupBox5" ); + GroupBox5->setGeometry( QRect( 10, 5, 310, 180 ) ); + GroupBox5->setFrameShape( QGroupBox::NoFrame ); + GroupBox5->setTitle( trUtf8( "" ) ); + + userCommand = new QComboBox( FALSE, GroupBox5, "userCommand" ); + userCommand->insertItem( trUtf8( "gs -q -g%1x%2 -sDEVICE=%3 -sOutputFile=%4 - " ) ); + userCommand->insertItem( trUtf8( "pstoedit -f xfig > %4" ) ); + userCommand->setGeometry( QRect( 10, 25, 290, 21 ) ); + userCommand->setEditable( TRUE ); + userCommand->setCurrentItem( -1 ); + userCommand->setDuplicatesEnabled( FALSE ); + QToolTip::add( userCommand, trUtf8( "Command line" ) ); + + TextLabel1_3 = new QLabel( GroupBox5, "TextLabel1_3" ); + TextLabel1_3->setGeometry( QRect( 10, 0, 290, 25 ) ); + TextLabel1_3->setText( trUtf8( "Command line :" ) ); + + userGSDevice = new QComboBox( FALSE, GroupBox5, "userGSDevice" ); + userGSDevice->insertItem( trUtf8( "pngmono" ) ); + userGSDevice->insertItem( trUtf8( "pnggray" ) ); + userGSDevice->insertItem( trUtf8( "png16" ) ); + userGSDevice->insertItem( trUtf8( "png256" ) ); + userGSDevice->insertItem( trUtf8( "png16m" ) ); + userGSDevice->insertItem( trUtf8( "jpeg" ) ); + userGSDevice->insertItem( trUtf8( "jpeggray" ) ); + userGSDevice->insertItem( trUtf8( "bmp16m" ) ); + userGSDevice->insertItem( trUtf8( "pdfwrite" ) ); + userGSDevice->insertItem( trUtf8( "epswrite" ) ); + userGSDevice->insertItem( trUtf8( "pbm" ) ); + userGSDevice->insertItem( trUtf8( "pbmraw" ) ); + userGSDevice->insertItem( trUtf8( "pgm" ) ); + userGSDevice->insertItem( trUtf8( "pgmraw" ) ); + userGSDevice->insertItem( trUtf8( "pgnm" ) ); + userGSDevice->insertItem( trUtf8( "pgnmraw" ) ); + userGSDevice->insertItem( trUtf8( "pnm" ) ); + userGSDevice->insertItem( trUtf8( "pnmraw" ) ); + userGSDevice->insertItem( trUtf8( "ppm" ) ); + userGSDevice->insertItem( trUtf8( "ppmraw" ) ); + userGSDevice->insertItem( trUtf8( "tiffcrle" ) ); + userGSDevice->insertItem( trUtf8( "tiffg3" ) ); + userGSDevice->insertItem( trUtf8( "tiffg32d" ) ); + userGSDevice->insertItem( trUtf8( "tiffg4" ) ); + userGSDevice->insertItem( trUtf8( "tifflzw" ) ); + userGSDevice->insertItem( trUtf8( "tiffpack" ) ); + userGSDevice->insertItem( trUtf8( "tiff12nc" ) ); + userGSDevice->insertItem( trUtf8( "tiff24nc" ) ); + userGSDevice->insertItem( trUtf8( "bit" ) ); + userGSDevice->insertItem( trUtf8( "bitrgb" ) ); + userGSDevice->insertItem( trUtf8( "bitcmyk" ) ); + userGSDevice->setGeometry( QRect( 190, 80, 110, 22 ) ); + QToolTip::add( userGSDevice, trUtf8( "GS device (%5)" ) ); + + TextLabel2 = new QLabel( GroupBox5, "TextLabel2" ); + TextLabel2->setGeometry( QRect( 140, 55, 160, 20 ) ); + TextLabel2->setText( trUtf8( "Ghostscript ( gs ) device:" ) ); + TextLabel2->setAlignment( int( QLabel::AlignVCenter | QLabel::AlignRight ) ); + + userIMagickDevice = new QComboBox( FALSE, GroupBox5, "userIMagickDevice" ); + userIMagickDevice->insertItem( trUtf8( "bmp" ) ); + userIMagickDevice->insertItem( trUtf8( "bmp24" ) ); + userIMagickDevice->insertItem( trUtf8( "dib" ) ); + userIMagickDevice->insertItem( trUtf8( "ept" ) ); + userIMagickDevice->insertItem( trUtf8( "fax" ) ); + userIMagickDevice->insertItem( trUtf8( "g3" ) ); + userIMagickDevice->insertItem( trUtf8( "fits" ) ); + userIMagickDevice->insertItem( trUtf8( "fpx" ) ); + userIMagickDevice->insertItem( trUtf8( "gif" ) ); + userIMagickDevice->insertItem( trUtf8( "gif87" ) ); + userIMagickDevice->insertItem( trUtf8( "gray" ) ); + userIMagickDevice->insertItem( trUtf8( "hdf" ) ); + userIMagickDevice->insertItem( trUtf8( "html" ) ); + userIMagickDevice->insertItem( trUtf8( "icm" ) ); + userIMagickDevice->insertItem( trUtf8( "ipic" ) ); + userIMagickDevice->insertItem( trUtf8( "bie" ) ); + userIMagickDevice->insertItem( trUtf8( "jbg" ) ); + userIMagickDevice->insertItem( trUtf8( "jbig" ) ); + userIMagickDevice->insertItem( trUtf8( "jpeg24" ) ); + userIMagickDevice->insertItem( trUtf8( "jpeg" ) ); + userIMagickDevice->insertItem( trUtf8( "matte" ) ); + userIMagickDevice->insertItem( trUtf8( "miff" ) ); + userIMagickDevice->insertItem( trUtf8( "mono" ) ); + userIMagickDevice->insertItem( trUtf8( "mtv" ) ); + userIMagickDevice->insertItem( trUtf8( "mvg" ) ); + userIMagickDevice->insertItem( trUtf8( "pcd" ) ); + userIMagickDevice->insertItem( trUtf8( "pcl" ) ); + userIMagickDevice->insertItem( trUtf8( "pcx" ) ); + userIMagickDevice->insertItem( trUtf8( "epdf" ) ); + userIMagickDevice->insertItem( trUtf8( "pdf" ) ); + userIMagickDevice->insertItem( trUtf8( "pict" ) ); + userIMagickDevice->insertItem( trUtf8( "pict24" ) ); + userIMagickDevice->insertItem( trUtf8( "mng" ) ); + userIMagickDevice->insertItem( trUtf8( "png" ) ); + userIMagickDevice->insertItem( trUtf8( "p7" ) ); + userIMagickDevice->insertItem( trUtf8( "pbm" ) ); + userIMagickDevice->insertItem( trUtf8( "pgm" ) ); + userIMagickDevice->insertItem( trUtf8( "pnm" ) ); + userIMagickDevice->insertItem( trUtf8( "ppm" ) ); + userIMagickDevice->insertItem( trUtf8( "epi" ) ); + userIMagickDevice->insertItem( trUtf8( "eps" ) ); + userIMagickDevice->insertItem( trUtf8( "ps" ) ); + userIMagickDevice->insertItem( trUtf8( "ps2" ) ); + userIMagickDevice->insertItem( trUtf8( "ps3" ) ); + userIMagickDevice->insertItem( trUtf8( "psd" ) ); + userIMagickDevice->insertItem( trUtf8( "sgi" ) ); + userIMagickDevice->insertItem( trUtf8( "ras" ) ); + userIMagickDevice->insertItem( trUtf8( "svg" ) ); + userIMagickDevice->insertItem( trUtf8( "tga" ) ); + userIMagickDevice->insertItem( trUtf8( "tiff" ) ); + userIMagickDevice->insertItem( trUtf8( "tiff24" ) ); + userIMagickDevice->insertItem( trUtf8( "pal" ) ); + userIMagickDevice->insertItem( trUtf8( "uyvy" ) ); + userIMagickDevice->insertItem( trUtf8( "vicar" ) ); + userIMagickDevice->insertItem( trUtf8( "vid" ) ); + userIMagickDevice->insertItem( trUtf8( "viff" ) ); + userIMagickDevice->insertItem( trUtf8( "xv" ) ); + userIMagickDevice->insertItem( trUtf8( "wbmp" ) ); + userIMagickDevice->insertItem( trUtf8( "xpg" ) ); + userIMagickDevice->insertItem( trUtf8( "x" ) ); + userIMagickDevice->insertItem( trUtf8( "xpm" ) ); + userIMagickDevice->insertItem( trUtf8( "yuv" ) ); + userIMagickDevice->setGeometry( QRect( 190, 140, 110, 22 ) ); + QToolTip::add( userIMagickDevice, trUtf8( "Convert device (%6)" ) ); + + TextLabel1_2 = new QLabel( GroupBox5, "TextLabel1_2" ); + TextLabel1_2->setGeometry( QRect( 130, 115, 170, 25 ) ); + TextLabel1_2->setText( trUtf8( "ImageMagick ( convert ) device:" ) ); + TextLabel1_2->setAlignment( int( QLabel::AlignVCenter | QLabel::AlignRight ) ); + + TextLabel1_4 = new QLabel( GroupBox5, "TextLabel1_4" ); + TextLabel1_4->setGeometry( QRect( 10, 70, 130, 95 ) ); + TextLabel1_4->setFrameShape( QLabel::Box ); + TextLabel1_4->setFrameShadow( QLabel::Plain ); + TextLabel1_4->setLineWidth( 1 ); + TextLabel1_4->setMargin( 7 ); + TextLabel1_4->setMidLineWidth( 0 ); + TextLabel1_4->setText( trUtf8( "%1 - input PS filename \n" +"%2 - output filename\n" +"%3 - width in pixels\n" +"%4 - height in pixels\n" +"%5 - dpi" ) ); + TextLabel1_4->setScaledContents( FALSE ); + TextLabel1_4->setAlignment( int( QLabel::AlignVCenter | QLabel::AlignLeft ) ); + TabWidget2->insertTab( tab_3, trUtf8( "User program" ) ); + Frame3Layout->addWidget( TabWidget2 ); + + GroupBox1 = new QGroupBox( this, "GroupBox1" ); + GroupBox1->setGeometry( QRect( 5, 125, 205, 220 ) ); + GroupBox1->setTitle( trUtf8( "Input area" ) ); + + TextLabel8 = new QLabel( GroupBox1, "TextLabel8" ); + TextLabel8->setGeometry( QRect( 20, 50, 65, 25 ) ); + TextLabel8->setText( trUtf8( "X" ) ); + + TextLabel10 = new QLabel( GroupBox1, "TextLabel10" ); + TextLabel10->setGeometry( QRect( 20, 100, 65, 25 ) ); + TextLabel10->setText( trUtf8( "Width" ) ); + + TextLabel11 = new QLabel( GroupBox1, "TextLabel11" ); + TextLabel11->setGeometry( QRect( 20, 125, 65, 25 ) ); + TextLabel11->setText( trUtf8( "Height" ) ); + + inputWidth = new QLineEdit( GroupBox1, "inputWidth" ); + inputWidth->setGeometry( QRect( 85, 100, 70, 22 ) ); + inputWidth->setText( trUtf8( "0" ) ); + + inputHeight = new QLineEdit( GroupBox1, "inputHeight" ); + inputHeight->setGeometry( QRect( 85, 125, 71, 22 ) ); + inputHeight->setText( trUtf8( "0" ) ); + + TextLabel9 = new QLabel( GroupBox1, "TextLabel9" ); + TextLabel9->setGeometry( QRect( 20, 75, 65, 25 ) ); + TextLabel9->setText( trUtf8( "Y" ) ); + + inputY = new QLineEdit( GroupBox1, "inputY" ); + inputY->setGeometry( QRect( 85, 75, 71, 22 ) ); + inputY->setText( trUtf8( "0" ) ); + + TextLabel15 = new QLabel( GroupBox1, "TextLabel15" ); + TextLabel15->setGeometry( QRect( 165, 125, 30, 25 ) ); + TextLabel15->setText( trUtf8( "mm" ) ); + + TextLabel14 = new QLabel( GroupBox1, "TextLabel14" ); + TextLabel14->setGeometry( QRect( 165, 100, 30, 25 ) ); + TextLabel14->setText( trUtf8( "mm" ) ); + + TextLabel13 = new QLabel( GroupBox1, "TextLabel13" ); + TextLabel13->setGeometry( QRect( 165, 75, 30, 25 ) ); + TextLabel13->setText( trUtf8( "mm" ) ); + + TextLabel12 = new QLabel( GroupBox1, "TextLabel12" ); + TextLabel12->setGeometry( QRect( 165, 50, 30, 25 ) ); + TextLabel12->setText( trUtf8( "mm" ) ); + + inputX = new QLineEdit( GroupBox1, "inputX" ); + inputX->setGeometry( QRect( 85, 50, 70, 22 ) ); + inputX->setText( trUtf8( "0" ) ); + + inputFullPage = new QCheckBox( GroupBox1, "inputFullPage" ); + inputFullPage->setGeometry( QRect( 80, 160, 100, 18 ) ); + inputFullPage->setText( trUtf8( "Full page" ) ); + + GroupBox3 = new QGroupBox( this, "GroupBox3" ); + GroupBox3->setGeometry( QRect( 5, 5, 535, 115 ) ); + GroupBox3->setTitle( trUtf8( "File format" ) ); + + GroupBox4 = new QGroupBox( GroupBox3, "GroupBox4" ); + GroupBox4->setGeometry( QRect( 45, 475, 250, 60 ) ); + GroupBox4->setFrameShape( QGroupBox::Panel ); + GroupBox4->setFrameShadow( QGroupBox::Raised ); + GroupBox4->setTitle( trUtf8( "" ) ); + + TextLabel7 = new QLabel( GroupBox3, "TextLabel7" ); + TextLabel7->setGeometry( QRect( 10, 80, 80, 20 ) ); + TextLabel7->setText( trUtf8( "DPI" ) ); + + TextLabel1 = new QLabel( GroupBox3, "TextLabel1" ); + TextLabel1->setGeometry( QRect( 10, 20, 80, 20 ) ); + TextLabel1->setText( trUtf8( "Filename" ) ); + + TextLabel4 = new QLabel( GroupBox3, "TextLabel4" ); + TextLabel4->setGeometry( QRect( 10, 51, 80, 20 ) ); + TextLabel4->setText( trUtf8( "Format" ) ); + + fileBrowse = new QPushButton( GroupBox3, "fileBrowse" ); + fileBrowse->setGeometry( QRect( 431, 15, 90, 27 ) ); + fileBrowse->setText( trUtf8( "Browse ..." ) ); + fileBrowse->setAutoDefault( FALSE ); + + fileFormat = new QComboBox( FALSE, GroupBox3, "fileFormat" ); + fileFormat->insertItem( trUtf8( "Pixmap" ) ); + fileFormat->insertItem( trUtf8( "Qt metafile" ) ); + fileFormat->insertItem( trUtf8( "User program" ) ); + fileFormat->setGeometry( QRect( 90, 50, 135, 22 ) ); + + fileDpi = new QLineEdit( GroupBox3, "fileDpi" ); + fileDpi->setGeometry( QRect( 90, 80, 135, 22 ) ); + fileDpi->setText( trUtf8( "72.0" ) ); + + fileName = new QLineEdit( GroupBox3, "fileName" ); + fileName->setGeometry( QRect( 90, 20, 335, 22 ) ); + QToolTip::add( fileName, trUtf8( "Output filename (%2)" ) ); + + imageSize = new QLabel( GroupBox3, "imageSize" ); + imageSize->setGeometry( QRect( 275, 50, 245, 50 ) ); + imageSize->setFrameShape( QLabel::Box ); + imageSize->setFrameShadow( QLabel::Plain ); + imageSize->setLineWidth( 1 ); + imageSize->setText( trUtf8( "Image size: 234 x 100 pixels" ) ); + imageSize->setAlignment( int( QLabel::AlignCenter ) ); + + Frame21 = new QFrame( this, "Frame21" ); + Frame21->setGeometry( QRect( 365, 465, 175, 40 ) ); + Frame21->setFrameShape( QFrame::NoFrame ); + Frame21->setFrameShadow( QFrame::Raised ); + Frame21Layout = new QHBoxLayout( Frame21, 0, 6, "Frame21Layout"); + + buttonExport = new QPushButton( Frame21, "buttonExport" ); + buttonExport->setText( trUtf8( "Export" ) ); + buttonExport->setDefault( FALSE ); + Frame21Layout->addWidget( buttonExport ); + + buttonCancel = new QPushButton( Frame21, "buttonCancel" ); + buttonCancel->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, buttonCancel->sizePolicy().hasHeightForWidth() ) ); + buttonCancel->setText( trUtf8( "Cancel" ) ); + Frame21Layout->addWidget( buttonCancel ); + + // signals and slots connections + connect( buttonCancel, SIGNAL( clicked() ), this, SLOT( reject() ) ); + connect( fileBrowse, SIGNAL( clicked() ), this, SLOT( browseFilename() ) ); + connect( inputFullPage, SIGNAL( toggled(bool) ), this, SLOT( setFullPage(bool) ) ); + connect( fileDpi, SIGNAL( textChanged(const QString&) ), this, SLOT( changeImageSize( const QString& ) ) ); + connect( inputY, SIGNAL( textChanged(const QString&) ), this, SLOT( changeImageSize( const QString& ) ) ); + connect( inputWidth, SIGNAL( textChanged(const QString&) ), this, SLOT( changeImageSize( const QString& ) ) ); + connect( inputHeight, SIGNAL( textChanged(const QString&) ), this, SLOT( changeImageSize( const QString& ) ) ); + connect( inputX, SIGNAL( textChanged(const QString&) ), this, SLOT( changeImageSize( const QString& ) ) ); + connect( buttonExport, SIGNAL( clicked() ), this, SLOT( exportPicture() ) ); + + // tab order + setTabOrder( fileName, fileBrowse ); + setTabOrder( fileBrowse, fileFormat ); + setTabOrder( fileFormat, fileDpi ); + setTabOrder( fileDpi, inputX ); + setTabOrder( inputX, inputY ); + setTabOrder( inputY, inputWidth ); + setTabOrder( inputWidth, inputHeight ); + setTabOrder( inputHeight, inputFullPage ); + setTabOrder( inputFullPage, TabWidget2 ); + setTabOrder( TabWidget2, userCommand ); + setTabOrder( userCommand, userGSDevice ); + setTabOrder( userGSDevice, userIMagickDevice ); + setTabOrder( userIMagickDevice, pixmapFormat ); + setTabOrder( pixmapFormat, pixmapQuality ); + setTabOrder( pixmapQuality, pixmapDepth ); + setTabOrder( pixmapDepth, pixmapSmooth ); + setTabOrder( pixmapSmooth, buttonExport ); + setTabOrder( buttonExport, buttonCancel ); +} + +/* + * Destroys the object and frees any allocated resources + */ +KSExportPictureDlgInterf::~KSExportPictureDlgInterf() +{ + // no need to delete child widgets, Qt does it all for us +} + +void KSExportPictureDlgInterf::browseFilename() +{ + qWarning( "KSExportPictureDlgInterf::browseFilename(): Not implemented yet!" ); +} + +void KSExportPictureDlgInterf::changeImageSize( const QString& ) +{ + qWarning( "KSExportPictureDlgInterf::changeImageSize( const QString& ): Not implemented yet!" ); +} + +void KSExportPictureDlgInterf::exportPicture() +{ + qWarning( "KSExportPictureDlgInterf::exportPicture(): Not implemented yet!" ); +} + +void KSExportPictureDlgInterf::setFullPage(bool) +{ + qWarning( "KSExportPictureDlgInterf::setFullPage(bool): Not implemented yet!" ); +} + +#include "ksexportpicturedlginterf.moc" diff --git a/kmatplot/dialogs/ksexportpicturedlginterf.ui b/kmatplot/dialogs/ksexportpicturedlginterf.ui new file mode 100644 index 0000000..4f481f7 --- /dev/null +++ b/kmatplot/dialogs/ksexportpicturedlginterf.ui @@ -0,0 +1,1912 @@ + +KSExportPictureDlgInterf + + QDialog + + name + KSExportPictureDlgInterf + + + geometry + + 0 + 0 + 550 + 510 + + + + sizePolicy + + 0 + 0 + + + + minimumSize + + 550 + 510 + + + + maximumSize + + 550 + 371 + + + + baseSize + + 200 + 200 + + + + caption + Export picture + + + Line + + name + Line1 + + + geometry + + 5 + 450 + 535 + 16 + + + + orientation + Horizontal + + + + QMultiLineEdit + + name + userOutput + + + enabled + true + + + geometry + + 5 + 350 + 540 + 100 + + + + focusPolicy + NoFocus + + + acceptDrops + false + + + frameShape + Box + + + readOnly + true + + + text + + + + toolTip + Program output + + + + QFrame + + name + Frame3 + + + geometry + + 215 + 125 + 325 + 220 + + + + frameShape + WinPanel + + + frameShadow + Sunken + + + lineWidth + 1 + + + layoutMargin + + + layoutSpacing + + + + margin + 2 + + + spacing + 0 + + + QTabWidget + + name + TabWidget2 + + + QWidget + + name + tab + + + title + Pixmap + + + QGroupBox + + name + GroupBox4_2 + + + geometry + + 5 + 5 + 310 + 180 + + + + frameShape + NoFrame + + + title + + + + QLabel + + name + TextLabel1_2_2 + + + geometry + + 25 + 36 + 70 + 20 + + + + text + Format + + + + QLabel + + name + TextLabel1_3_2 + + + geometry + + 25 + 70 + 65 + 20 + + + + text + Quality + + + + QLabel + + name + TextLabel3_2 + + + geometry + + 25 + 100 + 70 + 25 + + + + text + Depth + + + + QCheckBox + + name + pixmapSmooth + + + geometry + + 95 + 135 + 145 + 20 + + + + text + Smooth + + + + QComboBox + + + text + 16M colors + + + + + text + 256 colors + + + + + text + 256 grays + + + + name + pixmapDepth + + + geometry + + 95 + 100 + 90 + 22 + + + + + QSlider + + name + pixmapQuality + + + geometry + + 95 + 70 + 140 + 16 + + + + maxValue + 100 + + + value + 90 + + + orientation + Horizontal + + + + QComboBox + + + text + PNG + + + + + text + JPEG + + + + name + pixmapFormat + + + geometry + + 95 + 35 + 140 + 20 + + + + + + + QWidget + + name + tab + + + title + QMetafile + + + QLabel + + name + TextLabel1_5 + + + geometry + + 55 + 70 + 85 + 20 + + + + text + Format + + + + QComboBox + + + text + Native + + + + + text + SVG + + + + name + metafileFormat + + + geometry + + 143 + 70 + 120 + 20 + + + + + + QWidget + + name + tab + + + title + User program + + + QGroupBox + + name + GroupBox5 + + + geometry + + 10 + 5 + 310 + 180 + + + + frameShape + NoFrame + + + title + + + + QComboBox + + + text + gs -q -g%1x%2 -sDEVICE=%3 -sOutputFile=%4 - + + + + + text + pstoedit -f xfig > %4 + + + + name + userCommand + + + geometry + + 10 + 25 + 290 + 21 + + + + editable + true + + + currentItem + -1 + + + duplicatesEnabled + false + + + toolTip + Command line + + + + QLabel + + name + TextLabel1_3 + + + geometry + + 10 + 0 + 290 + 25 + + + + text + Command line : + + + + QComboBox + + + text + pngmono + + + + + text + pnggray + + + + + text + png16 + + + + + text + png256 + + + + + text + png16m + + + + + text + jpeg + + + + + text + jpeggray + + + + + text + bmp16m + + + + + text + pdfwrite + + + + + text + epswrite + + + + + text + pbm + + + + + text + pbmraw + + + + + text + pgm + + + + + text + pgmraw + + + + + text + pgnm + + + + + text + pgnmraw + + + + + text + pnm + + + + + text + pnmraw + + + + + text + ppm + + + + + text + ppmraw + + + + + text + tiffcrle + + + + + text + tiffg3 + + + + + text + tiffg32d + + + + + text + tiffg4 + + + + + text + tifflzw + + + + + text + tiffpack + + + + + text + tiff12nc + + + + + text + tiff24nc + + + + + text + bit + + + + + text + bitrgb + + + + + text + bitcmyk + + + + name + userGSDevice + + + geometry + + 190 + 80 + 110 + 22 + + + + toolTip + GS device (%5) + + + + QLabel + + name + TextLabel2 + + + geometry + + 140 + 55 + 160 + 20 + + + + text + Ghostscript ( gs ) device: + + + alignment + AlignVCenter|AlignRight + + + hAlign + + + + QComboBox + + + text + bmp + + + + + text + bmp24 + + + + + text + dib + + + + + text + ept + + + + + text + fax + + + + + text + g3 + + + + + text + fits + + + + + text + fpx + + + + + text + gif + + + + + text + gif87 + + + + + text + gray + + + + + text + hdf + + + + + text + html + + + + + text + icm + + + + + text + ipic + + + + + text + bie + + + + + text + jbg + + + + + text + jbig + + + + + text + jpeg24 + + + + + text + jpeg + + + + + text + matte + + + + + text + miff + + + + + text + mono + + + + + text + mtv + + + + + text + mvg + + + + + text + pcd + + + + + text + pcl + + + + + text + pcx + + + + + text + epdf + + + + + text + pdf + + + + + text + pict + + + + + text + pict24 + + + + + text + mng + + + + + text + png + + + + + text + p7 + + + + + text + pbm + + + + + text + pgm + + + + + text + pnm + + + + + text + ppm + + + + + text + epi + + + + + text + eps + + + + + text + ps + + + + + text + ps2 + + + + + text + ps3 + + + + + text + psd + + + + + text + sgi + + + + + text + ras + + + + + text + svg + + + + + text + tga + + + + + text + tiff + + + + + text + tiff24 + + + + + text + pal + + + + + text + uyvy + + + + + text + vicar + + + + + text + vid + + + + + text + viff + + + + + text + xv + + + + + text + wbmp + + + + + text + xpg + + + + + text + x + + + + + text + xpm + + + + + text + yuv + + + + name + userIMagickDevice + + + geometry + + 190 + 140 + 110 + 22 + + + + toolTip + Convert device (%6) + + + + QLabel + + name + TextLabel1_2 + + + geometry + + 130 + 115 + 170 + 25 + + + + text + ImageMagick ( convert ) device: + + + alignment + AlignVCenter|AlignRight + + + hAlign + + + + QLabel + + name + TextLabel1_4 + + + geometry + + 10 + 70 + 130 + 95 + + + + frameShape + Box + + + frameShadow + Plain + + + lineWidth + 1 + + + margin + 7 + + + midLineWidth + 0 + + + text + %1 - input PS filename +%2 - output filename +%3 - width in pixels +%4 - height in pixels +%5 - dpi + + + scaledContents + false + + + alignment + AlignVCenter|AlignLeft + + + hAlign + + + + + + + + + QGroupBox + + name + GroupBox1 + + + geometry + + 5 + 125 + 205 + 220 + + + + title + Input area + + + QLabel + + name + TextLabel8 + + + geometry + + 20 + 50 + 65 + 25 + + + + text + X + + + + QLabel + + name + TextLabel10 + + + geometry + + 20 + 100 + 65 + 25 + + + + text + Width + + + + QLabel + + name + TextLabel11 + + + geometry + + 20 + 125 + 65 + 25 + + + + text + Height + + + + QLineEdit + + name + inputWidth + + + geometry + + 85 + 100 + 70 + 22 + + + + text + 0 + + + + QLineEdit + + name + inputHeight + + + geometry + + 85 + 125 + 71 + 22 + + + + text + 0 + + + + QLabel + + name + TextLabel9 + + + geometry + + 20 + 75 + 65 + 25 + + + + text + Y + + + + QLineEdit + + name + inputY + + + geometry + + 85 + 75 + 71 + 22 + + + + text + 0 + + + + QLabel + + name + TextLabel15 + + + geometry + + 165 + 125 + 30 + 25 + + + + text + mm + + + + QLabel + + name + TextLabel14 + + + geometry + + 165 + 100 + 30 + 25 + + + + text + mm + + + + QLabel + + name + TextLabel13 + + + geometry + + 165 + 75 + 30 + 25 + + + + text + mm + + + + QLabel + + name + TextLabel12 + + + geometry + + 165 + 50 + 30 + 25 + + + + text + mm + + + + QLineEdit + + name + inputX + + + geometry + + 85 + 50 + 70 + 22 + + + + text + 0 + + + + QCheckBox + + name + inputFullPage + + + geometry + + 80 + 160 + 100 + 18 + + + + text + Full page + + + + + QGroupBox + + name + GroupBox3 + + + geometry + + 5 + 5 + 535 + 115 + + + + title + File format + + + QGroupBox + + name + GroupBox4 + + + geometry + + 45 + 475 + 250 + 60 + + + + frameShape + Panel + + + frameShadow + Raised + + + title + + + + + QLabel + + name + TextLabel7 + + + geometry + + 10 + 80 + 80 + 20 + + + + text + DPI + + + + QLabel + + name + TextLabel1 + + + geometry + + 10 + 20 + 80 + 20 + + + + text + Filename + + + + QLabel + + name + TextLabel4 + + + geometry + + 10 + 51 + 80 + 20 + + + + text + Format + + + + QPushButton + + name + fileBrowse + + + geometry + + 431 + 15 + 90 + 27 + + + + text + Browse ... + + + autoDefault + false + + + + QComboBox + + + text + Pixmap + + + + + text + Qt metafile + + + + + text + User program + + + + name + fileFormat + + + geometry + + 90 + 50 + 135 + 22 + + + + + QLineEdit + + name + fileDpi + + + geometry + + 90 + 80 + 135 + 22 + + + + text + 72.0 + + + + QLineEdit + + name + fileName + + + geometry + + 90 + 20 + 335 + 22 + + + + toolTip + Output filename (%2) + + + + QLabel + + name + imageSize + + + geometry + + 275 + 50 + 245 + 50 + + + + frameShape + Box + + + frameShadow + Plain + + + lineWidth + 1 + + + text + Image size: 234 x 100 pixels + + + alignment + AlignCenter + + + hAlign + + + + + QFrame + + name + Frame21 + + + geometry + + 365 + 465 + 175 + 40 + + + + frameShape + NoFrame + + + frameShadow + Raised + + + layoutMargin + + + + margin + 0 + + + spacing + 6 + + + QPushButton + + name + buttonExport + + + text + Export + + + default + false + + + + QPushButton + + name + buttonCancel + + + sizePolicy + + 0 + 0 + + + + text + Cancel + + + + + + + + buttonCancel + clicked() + KSExportPictureDlgInterf + reject() + + + fileBrowse + clicked() + KSExportPictureDlgInterf + browseFilename() + + + inputFullPage + toggled(bool) + KSExportPictureDlgInterf + setFullPage(bool) + + + fileDpi + textChanged(const QString&) + KSExportPictureDlgInterf + changeImageSize( const QString& ) + + + inputY + textChanged(const QString&) + KSExportPictureDlgInterf + changeImageSize( const QString& ) + + + inputWidth + textChanged(const QString&) + KSExportPictureDlgInterf + changeImageSize( const QString& ) + + + inputHeight + textChanged(const QString&) + KSExportPictureDlgInterf + changeImageSize( const QString& ) + + + inputX + textChanged(const QString&) + KSExportPictureDlgInterf + changeImageSize( const QString& ) + + + buttonExport + clicked() + KSExportPictureDlgInterf + exportPicture() + + browseFilename() + changeImageSize( const QString& ) + exportPicture() + setFullPage(bool) + + + fileName + fileBrowse + fileFormat + fileDpi + inputX + inputY + inputWidth + inputHeight + inputFullPage + TabWidget2 + userCommand + userGSDevice + userIMagickDevice + pixmapFormat + pixmapQuality + pixmapDepth + pixmapSmooth + buttonExport + buttonCancel + + diff --git a/kmatplot/dialogs/ksgraphwizard.cpp b/kmatplot/dialogs/ksgraphwizard.cpp new file mode 100644 index 0000000..fd74e4c --- /dev/null +++ b/kmatplot/dialogs/ksgraphwizard.cpp @@ -0,0 +1,507 @@ +/*************************************************************************** + ksgraphwizard.cpp - description + ------------------- + begin : Thu Mar 14 2002 + copyright : (C) 2002 by kamil + email : kamil@localhost.localdomain + ***************************************************************************/ + +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + +#include "ksgraphwizard.h" +#include "../ksmatrix.h" +#include "../ksworkbook.h" +#include "../ksglobalmatrixlist.h" +#include "../ksglobalsettings.h" +#include "../ksmatrixeditor.h" +#include "../ksdatasymbolfactory.h" +#include "../kscommands.h" + +#include "../widgets/qsplotview.h" +#include "../widgets/qscurve.h" +#include "../widgets/qsimage.h" +#include "../widgets/qscontour.h" +#include "../widgets/qssurface.h" +#include "../widgets/qsfigure.h" +#include "../widgets/qsconsole.h" +#include "../widgets/qsaxes2d.h" +#include "../widgets/qsaxes3d.h" + +#include "../formula/mpformula.h" + +#include "kschannellist.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include + +//-------------------------------------------------------------------------// + +KSGraphSubtypeItem::KSGraphSubtypeItem( QIconView *parent, KSDataObjectFactory::DataObject objectType, const QString& title, const QString& icon ) +: QIconViewItem( parent, title, QPixmap( KSGlobalSettings::picturePath()+"/"+icon ) ) + { + m_object_type = objectType; + } + +//-------------------------------------------------------------------------// + +KSGraphSubtypeItem::~KSGraphSubtypeItem() + { + } + +//-------------------------------------------------------------------------// + +QWidget *KSGraphSubtypeItem::additionalPage( QWidget *parent ) +// not implemented + { + return NULL; + } + +//-------------------------------------------------------------------------// + +void KSGraphSubtypeItem::initChannels( KSGraphInfo *info ) + { + int channels = KSDataObjectFactory::channelNumber( m_object_type ); + info->resize( channels ); + for( int i=0; iat(i).m_name = KSDataObjectFactory::channelNameFactory( m_object_type, i ); + info->at(i).m_description = KSDataObjectFactory::channelDescFactory( m_object_type, i ); + } + } + +//-------------------------------------------------------------------------// + +QSAxesChild *KSGraphSubtypeItem::createObject( QSAxes *parent ) +// it must be reimplemented + { + return NULL; + } + +//-------------------------------------------------------------------------// +//-------------------------------------------------------------------------// +//-------------------------------------------------------------------------// +//-------------------------------------------------------------------------// +//-------------------------------------------------------------------------// + +class KSGraphCurveItem : public KSGraphSubtypeItem + { + public: + KSGraphCurveItem( QIconView *parent ) : KSGraphSubtypeItem( parent, KSDataObjectFactory::ObjectCurve, QObject::tr("Curve"), "graph_xyplot.png" ) {} + ~KSGraphCurveItem() {} + virtual QSAxesChild *createObject( QSAxes *parent ) { QSCurve *result = new QSCurve(parent); return result; } + }; + +//-------------------------------------------------------------------------// + +class KSGraphImageItem : public KSGraphSubtypeItem + { + public: + KSGraphImageItem( QIconView *parent ) : KSGraphSubtypeItem( parent, KSDataObjectFactory::ObjectImage, QObject::tr("Pixmap"), "graph_image.png" ) {} + ~KSGraphImageItem() {} + virtual QSAxesChild *createObject( QSAxes *parent ) { QSImage *result = new QSImage(parent); return result; } + }; + +//-------------------------------------------------------------------------// + +class KSGraphGriddedContourItem : public KSGraphSubtypeItem + { + public: + KSGraphGriddedContourItem( QIconView *parent ) : KSGraphSubtypeItem( parent, KSDataObjectFactory::ObjectGriddedContour, QObject::tr("Gridded contour"), "graph_contour.png" ) {} + ~KSGraphGriddedContourItem() {} + virtual QSAxesChild *createObject( QSAxes *parent ) { QSGriddedContour *result = new QSGriddedContour(parent); return result; } + }; + +//-------------------------------------------------------------------------// + +class KSGraphNonGriddedContourItem : public KSGraphSubtypeItem + { + public: + KSGraphNonGriddedContourItem( QIconView *parent ) : KSGraphSubtypeItem( parent, KSDataObjectFactory::ObjectNonGriddedContour, QObject::tr("Non-gridded contour"), "graph_ngcontour.png" ) {} + ~KSGraphNonGriddedContourItem() {} + virtual QSAxesChild *createObject( QSAxes *parent ) { QSNonGriddedContour *result = new QSNonGriddedContour(parent); return result; } + virtual void initChannels( KSGraphInfo *info ) { + KSGraphSubtypeItem::initChannels( info ); + info->at(QSNonGriddedContour::Triangles).m_use_formula=true; + info->at(QSNonGriddedContour::Triangles).m_formula="delunay(x,y)"; + } + }; + +//-------------------------------------------------------------------------// + +class KSGraphSurfaceItem : public KSGraphSubtypeItem + { + public: + KSGraphSurfaceItem( QIconView *parent ) : KSGraphSubtypeItem( parent, KSDataObjectFactory::ObjectSurface, QObject::tr("Surface"), "graph_surface.png" ) {} + ~KSGraphSurfaceItem() {} + virtual QSAxesChild *createObject( QSAxes *parent ) { QSSurface *result = new QSSurface(parent); return result; } + }; + +//-------------------------------------------------------------------------// + +class KSGraphNonGriddedSurfaceItem : public KSGraphSubtypeItem + { + public: + KSGraphNonGriddedSurfaceItem( QIconView *parent ) : KSGraphSubtypeItem( parent, KSDataObjectFactory::ObjectFigure, QObject::tr("Non-gridded surface"), "graph_ngsurface.png" ) {} + ~KSGraphNonGriddedSurfaceItem() {} + virtual QSAxesChild *createObject( QSAxes *parent ) { QSFigure *result = new QSFigure(parent); return result; } + virtual void initChannels( KSGraphInfo *info ) { + KSGraphSubtypeItem::initChannels( info ); + info->at(QSFigure::VTableI).m_use_formula=true; + info->at(QSFigure::VTableI).m_formula="delunay(x,y)"; + } + }; + +//-------------------------------------------------------------------------// + +class KSGraphFigureItem : public KSGraphSubtypeItem + { + public: + KSGraphFigureItem( QIconView *parent ) : KSGraphSubtypeItem( parent, KSDataObjectFactory::ObjectFigure, QObject::tr("Figure"), "graph_figure.png" ) {} + ~KSGraphFigureItem() {} + virtual QSAxesChild *createObject( QSAxes *parent ) { QSFigure *result = new QSFigure(parent); return result; } + }; + + +//-------------------------------------------------------------------------// +//-------------------------------------------------------------------------// +//-------------------------------------------------------------------------// +//-------------------------------------------------------------------------// +//-------------------------------------------------------------------------// + +KSGraphWizard::KSGraphWizard( QSPlotView *view, KSWorkbook *workbook, QWidget *parent, const char *name ) +: KSGraphWizardInterf(parent,name,true) + { + m_view = view; + m_workbook = workbook; + m_sheet_editor = NULL; // select data range on it + m_preview_axes = NULL; + m_new_axes = NULL; + m_new_dataset = NULL; + m_watch_data_page = true; + + for ( int i=0; iactiveAxes() ) selectedAxes->setChecked( TRUE ); else { newAxes2D->setChecked( TRUE ); selectedAxes->setEnabled( false ); } + worksheetList->addColumn( tr("Sheets"), 95 ); + worksheetList->addColumn( tr(""), 95 ); + worksheetList->addColumn( tr(""), 50 ); + worksheetList->setDataObject( m_workbook->sheets(), false, 0, false ); + + connect( graphType, SIGNAL(highlighted(int)), this, SLOT(slot_graph_type_changed(int)) ); + connect( graphType, SIGNAL(selectionChanged()), this, SLOT(slot_page_type_changed()) ); + connect( graphSubtype, SIGNAL(selectionChanged()), this, SLOT(slot_page_type_changed()) ); + connect( worksheetList, SIGNAL(selectionChanged()), this, SLOT(slot_page_type_changed()) ); + + connect( channelList, SIGNAL(highlighted(int)), this, SLOT(slot_channel_selected(int)) ); + connect( clearChannel, SIGNAL(clicked()), this, SLOT(slot_clear_channel()) ); + connect( useFormula, SIGNAL(stateChanged(int)), this, SLOT(slot_channel_data_changed()) ); + connect( formulaString, SIGNAL(textChanged()), this, SLOT(slot_channel_data_changed()) ); + + graphSubtype->clear(); + setNextEnabled( QWizard::page(1), false ); + setFinishEnabled( QWizard::page(3), true ); + sheetEditorPlace->installEventFilter( this ); + previewPlace->installEventFilter( this ); + } + +//-------------------------------------------------------------------------// + +KSGraphWizard::~KSGraphWizard() + { + delete m_sheet_editor; + clear_preview(); + } + +//-------------------------------------------------------------------------// + +bool KSGraphWizard::eventFilter( QObject *object, QEvent *e ) + { + if ( object == sheetEditorPlace && e->type() == QEvent::Resize ) { + if ( m_sheet_editor && m_sheet_editor->widget() ) + m_sheet_editor->widget()->resize( sheetEditorPlace->size() ); + } + else if ( object == previewPlace && e->type() == QEvent::Paint ) { + if ( m_preview_axes ) { + QPainter painter( previewPlace ); + m_preview_axes->stop(); + m_preview_axes->setCanvasRect( QSRectf(60,40,previewPlace->width()-120,previewPlace->height()-80) ); + m_preview_axes->paintPlot( &painter, 72.0, false ); + return true; + } + } + + return false; + } + +//-------------------------------------------------------------------------// + +void KSGraphWizard::showPage( QWidget *page ) + { + switch( indexOf(page) ) { + // case 0: show_page_into(); break; + // case 1: show_page_type(); break; + case 2: show_page_data(); break; + case 3: show_page_finish(); break; + } + QWizard::showPage( page ); + } + +//-------------------------------------------------------------------------// + +void KSGraphWizard::slot_page_type_changed() +// state of the widgets on the type page has changed +// check if we can enable the next button + { + if ( graphType->currentItem() >= 0 && graphSubtype->currentItem() && worksheetList->selectedItem() ) + setNextEnabled( QWizard::page(1), true ); else setNextEnabled( QWizard::page(1), false ); + } + +//-------------------------------------------------------------------------// + +void KSGraphWizard::slot_graph_type_changed( int index ) +// type of the graph has changed - show all available subtypes for this type + { + graphSubtype->clear(); + switch( index ) { + // XY plot + case 0: + (void )new KSGraphCurveItem( graphSubtype ); + break; + // Pixmap + case 1: + (void )new KSGraphImageItem( graphSubtype ); + break; + // Contour + case 2: + (void )new KSGraphGriddedContourItem( graphSubtype ); + (void )new KSGraphNonGriddedContourItem( graphSubtype ); + break; + // Surface + case 3: + (void )new KSGraphSurfaceItem( graphSubtype ); + (void )new KSGraphNonGriddedSurfaceItem( graphSubtype ); + break; + // Figure + case 4: + (void )new KSGraphFigureItem( graphSubtype ); + break; + } + slot_page_type_changed(); + } + +//-------------------------------------------------------------------------// + +void KSGraphWizard::show_page_data() + { + // delete preview object ( if back was clicked and we moved from the finish page ) + clear_preview(); + + // create channel list + KSGraphSubtypeItem *m_graph_subtype = dynamic_cast(graphSubtype->currentItem()); + m_graph_subtype->initChannels( &m_graph_info ); + channelList->clear(); + for( int i=0; iinsertItem( m_graph_info.at(i).m_name ); + slot_channel_selected( -1 ); + } + +//-------------------------------------------------------------------------// + +void KSGraphWizard::slot_channel_selected( int index ) + { + set_watch_data_page( false ); + // channel was selected - show the editor with the worksheet and allow user to select a data range + if ( index >= 0 ) { + KSGraphChannelInfo channel = m_graph_info.at(index); + + // fill all fields + channelDescription->setText( channel.m_description ); + formulaString->setText( channel.m_formula ); + useFormula->setChecked( channel.m_use_formula ); + + // create editor + QSData *data_object = channel.m_sheet ? channel.m_sheet : worksheetList->selected()->dataObject(); + + if ( m_sheet_editor == NULL || m_sheet_editor->editedMatrix() != data_object->matrix(0) ) { + delete m_sheet_editor; m_sheet_editor = NULL; + m_sheet_editor = KSDataObjectFactory::createEditor( m_workbook, data_object, 0, sheetEditorPlace ); + // + // this is a little trick ! + // + connect( m_sheet_editor->widget(), SIGNAL(selectionChanged()), this, SLOT(slot_channel_data_changed()) ); + } + + // initialize editor + m_sheet_editor->setSelectionRange( channel.m_selection ); + m_sheet_editor->setEditorContentsPos( channel.m_editor_pos ); + m_sheet_editor->widget()->resize( sheetEditorPlace->size() ); + m_sheet_editor->widget()->show(); + } else { + channelDescription->setText( QString::null ); + formulaString->setText( QString::null ); + useFormula->setChecked( false ); + delete m_sheet_editor; m_sheet_editor = NULL; + } + + set_watch_data_page( true ); + } + +//-------------------------------------------------------------------------// + +void KSGraphWizard::slot_clear_channel() +// clear channel data button was clicked + { + int curr_channel = channelList->currentItem(); + if ( curr_channel >= 0 ) { + m_graph_info.at(curr_channel).m_use_formula = false; + m_graph_info.at(curr_channel).m_sheet = NULL; + m_graph_info.at(curr_channel).m_selection = QRect(); + m_graph_info.at(curr_channel).m_editor_pos = QPoint(); + slot_channel_selected( curr_channel ); + } + } + +//-------------------------------------------------------------------------// + +void KSGraphWizard::slot_channel_data_changed() +// state of the data panel was changed ( button clicked, text entered, selection changed etc... ) +// remembercurrent settings for the selected channel + { + if ( !m_watch_data_page ) return; + int curr_channel = channelList->currentItem(); + if ( curr_channel >= 0 ) { + if ( m_sheet_editor && !m_sheet_editor->selectionRange().isEmpty() ) { + if ( !m_graph_info.at(curr_channel).m_sheet ) + m_graph_info.at(curr_channel).m_sheet = dynamic_cast(worksheetList->selected()->dataObject()); + m_graph_info.at(curr_channel).m_selection = m_sheet_editor->selectionRange(); + } + if ( m_sheet_editor ) m_graph_info.at(curr_channel).m_editor_pos = m_sheet_editor->editorContentsPos(); + m_graph_info.at(curr_channel).m_formula = formulaString->text(); + m_graph_info.at(curr_channel).m_use_formula = useFormula->isChecked(); + } + } + +//-------------------------------------------------------------------------// + +void KSGraphWizard::show_page_finish() +// user clicked next and we enter the finish page - show the preview + { + clear_preview(); + + // create preview + KSGraphSubtypeItem *m_graph_subtype = dynamic_cast(graphSubtype->currentItem()); + + if ( selectedAxes->isChecked() ) { + m_preview_axes = m_view->activeAxes(); + } + else if ( newAxes2D->isChecked() ) { + m_new_axes = new QSAxes2D(); + m_preview_axes = m_new_axes; + } + else if ( newAxes3D->isChecked() ) { + m_new_axes = new QSAxes3D(); + m_preview_axes = m_new_axes; + } + + m_new_dataset = m_graph_subtype->createObject( m_preview_axes ); + create_data( m_new_dataset ); + + m_preview_axes->plotAdd( dynamic_cast(m_new_dataset) ); + } + +//-------------------------------------------------------------------------// + +void KSGraphWizard::create_data( QSData *new_object ) +// create dataset from channel data + { + for( int i=0; ichannelCount(); i++ ) { + KSGraphChannelInfo channel = m_graph_info.at(i); + + if ( channel.m_use_formula ) { + KSMatrixFormula *new_matrix = new KSMatrixFormula(); + new_matrix->setFormula( channel.m_formula ); + new_object->setMatrix( i, new_matrix ); + } + else if ( !channel.m_selection.isEmpty() ) { + KSSheet *sheet = channel.m_sheet ? channel.m_sheet : dynamic_cast(worksheetList->selected()->dataObject()); + KSMatrixWorksheetCellRange *new_matrix = new KSMatrixWorksheetCellRange( m_workbook ); + new_matrix->setWorksheet( m_workbook->sheets()->sheetFind( sheet ) ); + + new_matrix->setRowFrom( channel.m_selection.top() ); + new_matrix->setColFrom( channel.m_selection.left() ); + if ( channel.m_selection.bottom() == sheet->matrix(0)->rows()-1 ) new_matrix->setRowTo( -1 ); + else new_matrix->setRowTo( channel.m_selection.bottom() ); + if ( channel.m_selection.right() == sheet->matrix(0)->cols()-1 ) new_matrix->setColTo( -1 ); + else new_matrix->setColTo( channel.m_selection.right() ); + new_object->setMatrix( i, new_matrix ); + } + } + + // recalculate all formulas + for( int i=0; ichannelCount(); i++ ) { + KSMatrixFormula *formula_matrix = dynamic_cast(new_object->matrix(i)); + if ( formula_matrix ) { + MPFactoryList factory( new KSDataSymbolFactory( m_workbook, formula_matrix->dataObject() ) ); + MPFormulaError error; + formula_matrix->init( error, &factory ); + if ( error.hasError() ) QSConsole::write( QObject::tr("Error parsing formula :")+formula_matrix->formula()+"
"+error.message() ); + } + } + } + +//-------------------------------------------------------------------------// + +void KSGraphWizard::accept() +// user clicked ok - add objects to the workbook. + { + apply_dataset(); + QWizard::accept(); + } + +//-------------------------------------------------------------------------// + +void KSGraphWizard::clear_preview() +// delete object ( which was created for a preview ) + { + if ( m_new_dataset ) m_new_dataset->parentAxes()->plotRemove( dynamic_cast(m_new_dataset) ); + m_preview_axes = NULL; + delete m_new_dataset; m_new_dataset = NULL; + delete m_new_axes; m_new_axes = NULL; + } + +//-------------------------------------------------------------------------// + +void KSGraphWizard::apply_dataset() +// add object to the workbook + { + m_preview_axes = NULL; + if ( m_new_axes ) { + m_workbook->execute( new KSCmdAddCObject( m_new_axes->shadowObject(), m_view->currentPage()->objects() ) ); + m_new_axes = NULL; + m_new_dataset = NULL; + } + else if ( m_new_dataset ) { + m_new_dataset->parentAxes()->plotRemove( dynamic_cast(m_new_dataset) ); + m_workbook->execute( new KSCmdAddDataset(dynamic_cast(m_new_dataset)) ); + m_new_dataset = NULL; + } + } + +//-------------------------------------------------------------------------// + +void KSGraphWizard::set_watch_data_page( bool enabled ) + { + m_watch_data_page = enabled; + } + + diff --git a/kmatplot/dialogs/ksgraphwizard.h b/kmatplot/dialogs/ksgraphwizard.h new file mode 100644 index 0000000..79b8af2 --- /dev/null +++ b/kmatplot/dialogs/ksgraphwizard.h @@ -0,0 +1,121 @@ +/*************************************************************************** + ksgraphwizard.h - description + ------------------- + begin : Thu Mar 14 2002 + copyright : (C) 2002 by kamil + email : kamil@localhost.localdomain + ***************************************************************************/ + +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + +#ifndef KSGRAPHWIZARD_H +#define KSGRAPHWIZARD_H + +#include +#include +#include +#include "ksgraphwizardinterf.h" +#include "../ksdataobjectfactory.h" + + +class QSAxes; +class QSPlotView; +class KSWorkbook; +class KSSheet; +class QSAxesChild; +class KSMatrixEditorInterf; + +//---------------------------------------------------------------------------// + +struct KSGraphChannelInfo { + KSSheet *m_sheet; + QPoint m_editor_pos; + QRect m_selection; + bool m_use_formula; + QString m_formula; + QString m_name; + QString m_description; + KSGraphChannelInfo() { m_sheet = NULL; m_use_formula=false; } + ~KSGraphChannelInfo() {} + }; + +//---------------------------------------------------------------------------// + +typedef QValueVector KSGraphInfo; + +//---------------------------------------------------------------------------// + +class KSGraphSubtypeItem : public QIconViewItem + { + public: + KSGraphSubtypeItem( QIconView *parent, KSDataObjectFactory::DataObject objectType, const QString& title, const QString& icon ); + virtual ~KSGraphSubtypeItem(); + virtual void initChannels( KSGraphInfo *info ); + virtual QWidget *additionalPage( QWidget *parent ); + virtual QSAxesChild *createObject( QSAxes *parent ); + private: + KSGraphInfo m_graph_info; + KSDataObjectFactory::DataObject m_object_type; + void show_page_1(); + }; + +/** +class KSGraphPreview : public QWidget + { + Q_OBJECT + public: + void setAxes( bool axes3d ); + QSAxes *axes(); + + + }; + + */ + +//---------------------------------------------------------------------------// + +/** + *@author kamil + */ +class KSGraphWizard : public KSGraphWizardInterf { + Q_OBJECT +public: + KSGraphWizard( QSPlotView *view, KSWorkbook *workbook, QWidget *parent=0, const char *name=0); + virtual ~KSGraphWizard(); + virtual void showPage( QWidget *page ); + virtual bool eventFilter( QObject *watched, QEvent *e ); +private: + QSAxes *m_preview_axes; + QSAxes *m_new_axes; + QSAxesChild *m_new_dataset; + QSPlotView *m_view; + KSWorkbook *m_workbook; + KSGraphInfo m_graph_info; + KSMatrixEditorInterf *m_sheet_editor; + bool m_watch_data_page; + + QSAxesChild *create_graph(); + void set_watch_data_page( bool enabled ); + void show_page_data(); + void show_page_finish(); + void create_data( QSData *object ); + void clear_preview(); + void apply_dataset(); + +private slots: + void slot_page_type_changed(); + void slot_graph_type_changed( int index ); + void slot_channel_selected( int index ); + void slot_clear_channel(); + void slot_channel_data_changed(); + void accept(); +}; + +#endif diff --git a/kmatplot/dialogs/ksgraphwizardinterf.cpp b/kmatplot/dialogs/ksgraphwizardinterf.cpp new file mode 100644 index 0000000..88745da --- /dev/null +++ b/kmatplot/dialogs/ksgraphwizardinterf.cpp @@ -0,0 +1,314 @@ +/**************************************************************************** +** Form implementation generated from reading ui file './ksgraphwizardinterf.ui' +** +** Created: śro mar 20 18:53:28 2002 +** by: The User Interface Compiler (uic) +** +** WARNING! All changes made in this file will be lost! +****************************************************************************/ +#include "ksgraphwizardinterf.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "kschannellist.h" +static const char* const image0_data[] = { +"32 32 10 1", +". c None", +"# c #000000", +"b c #00c200", +"e c #313031", +"h c #410000", +"d c #5a595a", +"g c #a4a1a4", +"f c #c5c2c5", +"a c #c5ffc5", +"c c #ffffff", +"...###..........................", +"...#aa##........................", +".###baaa##......................", +".#cd##baaa##....................", +".#cccd##baaa##..##e.............", +".#cccccd##baaa##aaa##...........", +".#cccccccd##baaaaaaaa##.........", +".#cccccccccd##baaaaaaa#.........", +".#cccccfcffgg#bbbbaaaaa#........", +".#ccccccfcfffd#bbbbbbaa#........", +".#cccfcfcfcffgd##bh#bbba#.......", +".#ccccfcfffffffgd#dd##ba#.......", +".#cfcfcfcfffffffffgfgd#bb#......", +".#ccfcfffffffffgfgfgfgd#b#......", +".#cfcfcfffffffffgfgfggd#b#......", +".#fcfffffffffgfgfgggggd#b#......", +".#cfcfffffffffgfgfggggd#b#......", +".#fffffffffgfgfgggggggdhb#......", +".#ffffffffffgfgfggggggd#b#......", +".#ggfffffgfgfgggggggggd#b#......", +".#ddggffffgfgfggggggggd#b#......", +"..##ddggfgfgggggggggggd#b#......", +"....##ddgggfggggggggggd#b#......", +"......##ddggggggggggggd#b#......", +"........##ddggggggggggd#b#......", +"..........##ddggggggggd#b#......", +"............##ddggggggd#b###....", +"..............##ddggggd#b#####..", +"................##ddggd#b######.", +"..................##ddd#b#####..", +"....................##d#b###....", +"......................####......"}; + + +/* + * Constructs a KSGraphWizardInterf which is a child of 'parent', with the + * name 'name' and widget flags set to 'f'. + * + * The wizard will by default be modeless, unless you set 'modal' to + * TRUE to construct a modal wizard. + */ +KSGraphWizardInterf::KSGraphWizardInterf( QWidget* parent, const char* name, bool modal, WFlags fl ) + : QWizard( parent, name, modal, fl ) +{ + QPixmap image0( ( const char** ) image0_data ); + if ( !name ) + setName( "KSGraphWizardInterf" ); + resize( 533, 491 ); + setCaption( trUtf8( "Graph wizard" ) ); + + page = new QWidget( this, "page" ); + pageLayout = new QGridLayout( page, 1, 1, 25, 6, "pageLayout"); + + TextLabel1 = new QLabel( page, "TextLabel1" ); + TextLabel1->setText( trUtf8( "

Welcome in the graph wizard !

\n" +"
\n" +"

This wizard allows you to create graphs easily and quickly. Notice that it doesn't cover all aspects of graph appearance, but concentrates on organising your data. You will have to tune other graph properties after finishing work with this wizard. Graphs are created in two simple steps:

\n" +"
\n" +"\n" +"
    \n" +"
  • First step.\n" +"In the first step you choose a graph type and a worksheet with your data. The graph is added to the currently selected axes, but if you didn't create axes yet you will have an occasion to create a new axes object together with your graph.\n" +"
\n" +"
\n" +"
    \n" +"
  • Second step.\n" +"In the second step you assign data to the graph. Each graph accepts a few matrices, some are required and some are optional. For example, an ordinary XY plot accepts four matrices: X,Y, DX, DY - optional matrices are grayed out. You assign the data to them by selecting areas in the worksheet, but you can also write a formula. The size of all matrices must be correct, in this example all ones must be column vectors with the same number of rows. \n" +"\n" +"
" ) ); + TextLabel1->setTextFormat( QLabel::RichText ); + TextLabel1->setAlignment( int( QLabel::WordBreak | QLabel::AlignJustify | QLabel::AlignTop ) ); + + pageLayout->addWidget( TextLabel1, 0, 0 ); + addPage( page, trUtf8( "" ) ); + + page_2 = new QWidget( this, "page_2" ); + pageLayout_2 = new QGridLayout( page_2, 1, 1, 2, 5, "pageLayout_2"); + + GroupBox2 = new QGroupBox( page_2, "GroupBox2" ); + GroupBox2->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5, (QSizePolicy::SizeType)7, 0, 4, GroupBox2->sizePolicy().hasHeightForWidth() ) ); + GroupBox2->setMinimumSize( QSize( 0, 220 ) ); + GroupBox2->setTitle( trUtf8( "Select graph type" ) ); + GroupBox2->setColumnLayout(0, Qt::Vertical ); + GroupBox2->layout()->setSpacing( 6 ); + GroupBox2->layout()->setMargin( 11 ); + GroupBox2Layout = new QGridLayout( GroupBox2->layout() ); + GroupBox2Layout->setAlignment( Qt::AlignTop ); + + graphSubtype = new QIconView( GroupBox2, "graphSubtype" ); + (void) new QIconViewItem( graphSubtype, trUtf8( "New Item" ), image0 ); + (void) new QIconViewItem( graphSubtype, trUtf8( "New Item" ), image0 ); + graphSubtype->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)7, 0, 0, graphSubtype->sizePolicy().hasHeightForWidth() ) ); + graphSubtype->setMouseTracking( FALSE ); + graphSubtype->setAcceptDrops( FALSE ); + graphSubtype->setVScrollBarMode( QIconView::Auto ); + graphSubtype->setHScrollBarMode( QIconView::AlwaysOff ); + graphSubtype->setDragAutoScroll( FALSE ); + graphSubtype->setItemsMovable( FALSE ); + + GroupBox2Layout->addWidget( graphSubtype, 1, 1 ); + + TextLabel6 = new QLabel( GroupBox2, "TextLabel6" ); + TextLabel6->setText( trUtf8( " Subtype" ) ); + + GroupBox2Layout->addWidget( TextLabel6, 0, 1 ); + + graphType = new QListBox( GroupBox2, "graphType" ); + graphType->insertItem( trUtf8( "XY plot" ) ); + graphType->insertItem( trUtf8( "Pixmap" ) ); + graphType->insertItem( trUtf8( "Contour" ) ); + graphType->insertItem( trUtf8( "Surface" ) ); + graphType->insertItem( trUtf8( "Figure" ) ); + graphType->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5, (QSizePolicy::SizeType)7, 0, 0, graphType->sizePolicy().hasHeightForWidth() ) ); + graphType->setMinimumSize( QSize( 160, 0 ) ); + graphType->setMaximumSize( QSize( 160, 32767 ) ); + QFont graphType_font( graphType->font() ); + graphType_font.setPointSize( 14 ); + graphType_font.setBold( TRUE ); + graphType->setFont( graphType_font ); + graphType->setMargin( 3 ); + graphType->setHScrollBarMode( QListBox::AlwaysOff ); + + GroupBox2Layout->addWidget( graphType, 1, 0 ); + + TextLabel5 = new QLabel( GroupBox2, "TextLabel5" ); + TextLabel5->setText( trUtf8( " Type :" ) ); + + GroupBox2Layout->addWidget( TextLabel5, 0, 0 ); + + pageLayout_2->addMultiCellWidget( GroupBox2, 1, 1, 0, 1 ); + + GroupBox5 = new QGroupBox( page_2, "GroupBox5" ); + GroupBox5->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5, (QSizePolicy::SizeType)5, 1, 2, GroupBox5->sizePolicy().hasHeightForWidth() ) ); + GroupBox5->setTitle( trUtf8( "Worksheet" ) ); + GroupBox5->setAlignment( int( QGroupBox::AlignTop ) ); + GroupBox5->setColumnLayout(0, Qt::Vertical ); + GroupBox5->layout()->setSpacing( 6 ); + GroupBox5->layout()->setMargin( 15 ); + GroupBox5Layout = new QGridLayout( GroupBox5->layout() ); + GroupBox5Layout->setAlignment( Qt::AlignTop ); + + worksheetList = new KSChannelList( GroupBox5, "worksheetList" ); + worksheetList->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)7, 0, 0, worksheetList->sizePolicy().hasHeightForWidth() ) ); + worksheetList->setMaximumSize( QSize( 32767, 150 ) ); + + GroupBox5Layout->addWidget( worksheetList, 0, 0 ); + + pageLayout_2->addWidget( GroupBox5, 0, 0 ); + + useAxes = new QButtonGroup( page_2, "useAxes" ); + useAxes->setFrameShadow( QButtonGroup::Sunken ); + useAxes->setTitle( trUtf8( "Axes" ) ); + useAxes->setExclusive( TRUE ); + useAxes->setColumnLayout(0, Qt::Vertical ); + useAxes->layout()->setSpacing( 6 ); + useAxes->layout()->setMargin( 40 ); + useAxesLayout = new QGridLayout( useAxes->layout() ); + useAxesLayout->setAlignment( Qt::AlignTop ); + + newAxes3D = new QRadioButton( useAxes, "newAxes3D" ); + newAxes3D->setText( trUtf8( "Create new XYZ axes" ) ); + + useAxesLayout->addWidget( newAxes3D, 2, 0 ); + + newAxes2D = new QRadioButton( useAxes, "newAxes2D" ); + newAxes2D->setText( trUtf8( "Create new XY axes" ) ); + + useAxesLayout->addWidget( newAxes2D, 1, 0 ); + + selectedAxes = new QRadioButton( useAxes, "selectedAxes" ); + selectedAxes->setText( trUtf8( "Use the selected axes" ) ); + + useAxesLayout->addWidget( selectedAxes, 0, 0 ); + + pageLayout_2->addWidget( useAxes, 0, 1 ); + addPage( page_2, trUtf8( "1. Choose a source worksheet and a graph type" ) ); + + page_3 = new QWidget( this, "page_3" ); + pageLayout_3 = new QGridLayout( page_3, 1, 1, 2, 5, "pageLayout_3"); + + GroupBox3_2 = new QGroupBox( page_3, "GroupBox3_2" ); + GroupBox3_2->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5, (QSizePolicy::SizeType)5, 0, 0, GroupBox3_2->sizePolicy().hasHeightForWidth() ) ); + GroupBox3_2->setTitle( trUtf8( "Graph data" ) ); + GroupBox3_2->setColumnLayout(0, Qt::Vertical ); + GroupBox3_2->layout()->setSpacing( 6 ); + GroupBox3_2->layout()->setMargin( 11 ); + GroupBox3_2Layout = new QGridLayout( GroupBox3_2->layout() ); + GroupBox3_2Layout->setAlignment( Qt::AlignTop ); + + TabWidget2 = new QTabWidget( GroupBox3_2, "TabWidget2" ); + TabWidget2->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)7, 0, 1, TabWidget2->sizePolicy().hasHeightForWidth() ) ); + TabWidget2->setTabShape( QTabWidget::Rounded ); + + tab = new QWidget( TabWidget2, "tab" ); + tabLayout = new QGridLayout( tab, 1, 1, 2, 6, "tabLayout"); + + sheetEditorPlace = new QFrame( tab, "sheetEditorPlace" ); + sheetEditorPlace->setFrameShape( QFrame::StyledPanel ); + sheetEditorPlace->setFrameShadow( QFrame::Sunken ); + + tabLayout->addWidget( sheetEditorPlace, 0, 0 ); + TabWidget2->insertTab( tab, trUtf8( "Data range" ) ); + + tab_2 = new QWidget( TabWidget2, "tab_2" ); + tabLayout_2 = new QGridLayout( tab_2, 1, 1, 11, 6, "tabLayout_2"); + + useFormula = new QCheckBox( tab_2, "useFormula" ); + useFormula->setText( trUtf8( "Formula" ) ); + + tabLayout_2->addWidget( useFormula, 0, 0 ); + QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Minimum, QSizePolicy::Expanding ); + tabLayout_2->addItem( spacer, 2, 0 ); + + formulaString = new QTextEdit( tab_2, "formulaString" ); + formulaString->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)7, 0, 0, formulaString->sizePolicy().hasHeightForWidth() ) ); + formulaString->setMaximumSize( QSize( 32767, 32767 ) ); + + tabLayout_2->addWidget( formulaString, 1, 0 ); + TabWidget2->insertTab( tab_2, trUtf8( "Options" ) ); + + GroupBox3_2Layout->addMultiCellWidget( TabWidget2, 0, 2, 1, 1 ); + + channelList = new QListBox( GroupBox3_2, "channelList" ); + channelList->insertItem( trUtf8( "New Item" ) ); + channelList->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)7, 0, 3, channelList->sizePolicy().hasHeightForWidth() ) ); + channelList->setMaximumSize( QSize( 150, 32767 ) ); + + GroupBox3_2Layout->addWidget( channelList, 0, 0 ); + + channelDescription = new QLabel( GroupBox3_2, "channelDescription" ); + channelDescription->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5, (QSizePolicy::SizeType)5, 0, 0, channelDescription->sizePolicy().hasHeightForWidth() ) ); + channelDescription->setMinimumSize( QSize( 150, 0 ) ); + channelDescription->setMaximumSize( QSize( 150, 32767 ) ); + QFont channelDescription_font( channelDescription->font() ); + channelDescription_font.setPointSize( 9 ); + channelDescription->setFont( channelDescription_font ); + channelDescription->setText( trUtf8( "Select a data channel on the list above and assign data to it by selecting cells of the worksheet." ) ); + channelDescription->setAlignment( int( QLabel::WordBreak | QLabel::AlignJustify | QLabel::AlignTop ) ); + channelDescription->setIndent( 5 ); + + GroupBox3_2Layout->addWidget( channelDescription, 2, 0 ); + + clearChannel = new QPushButton( GroupBox3_2, "clearChannel" ); + clearChannel->setText( trUtf8( "Clear" ) ); + + GroupBox3_2Layout->addWidget( clearChannel, 1, 0 ); + + pageLayout_3->addWidget( GroupBox3_2, 0, 0 ); + addPage( page_3, trUtf8( "2. Assign data to the graph" ) ); + + page_4 = new QWidget( this, "page_4" ); + pageLayout_4 = new QGridLayout( page_4, 1, 1, 11, 6, "pageLayout_4"); + + previewPlace = new QFrame( page_4, "previewPlace" ); + previewPlace->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)7, 0, 0, previewPlace->sizePolicy().hasHeightForWidth() ) ); + previewPlace->setPaletteBackgroundColor( QColor( 255, 255, 255 ) ); + previewPlace->setFrameShape( QFrame::Panel ); + previewPlace->setFrameShadow( QFrame::Sunken ); + + pageLayout_4->addWidget( previewPlace, 0, 0 ); + addPage( page_4, trUtf8( "Click Finish to create the graph" ) ); +} + +/* + * Destroys the object and frees any allocated resources + */ +KSGraphWizardInterf::~KSGraphWizardInterf() +{ + // no need to delete child widgets, Qt does it all for us +} + +#include "ksgraphwizardinterf.moc" diff --git a/kmatplot/dialogs/ksgraphwizardinterf.ui b/kmatplot/dialogs/ksgraphwizardinterf.ui new file mode 100644 index 0000000..1ca4ec5 --- /dev/null +++ b/kmatplot/dialogs/ksgraphwizardinterf.ui @@ -0,0 +1,639 @@ + +KSGraphWizardInterf + + + KSGraphWizardInterf + + + + 0 + 0 + 533 + 491 + + + + Graph wizard + + + + page + + + + + + + unnamed + + + 25 + + + 6 + + + + TextLabel1 + + + <center><h2>Welcome in the graph wizard !</h2></center> +<br> +<p>This wizard allows you to create graphs easily and quickly. Notice that it doesn't cover all aspects of graph appearance, but concentrates on organising your data. You will have to tune other graph properties after finishing work with this wizard. Graphs are created in two simple steps:</p> +<br> + +<UL> +<LI><b>First step.</b> +In the first step you choose a graph type and a worksheet with your data. The graph is added to the currently selected axes, but if you didn't create axes yet you will have an occasion to create a new axes object together with your graph. +</UL> +<br> +<UL> +<LI><b>Second step.</b> +In the second step you assign data to the graph. Each graph accepts a few matrices, some are required and some are optional. For example, an ordinary XY plot accepts four matrices: X,<b>Y</b>, DX, DY - optional matrices are grayed out. You assign the data to them by selecting areas in the worksheet, but you can also write a formula. The size of all matrices must be correct, in this example all ones must be column vectors with the same number of rows. + +</UL> + + + RichText + + + WordBreak|AlignJustify|AlignTop + + + + + + + page + + + 1. Choose a source worksheet and a graph type + + + + unnamed + + + 2 + + + 5 + + + + GroupBox2 + + + + 5 + 7 + 0 + 4 + + + + + 0 + 220 + + + + Select graph type + + + + unnamed + + + 11 + + + 6 + + + + + New Item + + + image0 + + + + + New Item + + + image0 + + + + graphSubtype + + + + 7 + 7 + 0 + 0 + + + + false + + + false + + + Auto + + + AlwaysOff + + + false + + + false + + + + + TextLabel6 + + + Subtype + + + + + + XY plot + + + + + Pixmap + + + + + Contour + + + + + Surface + + + + + Figure + + + + graphType + + + + 5 + 7 + 0 + 0 + + + + + 160 + 0 + + + + + 160 + 32767 + + + + + 14 + 1 + + + + 3 + + + AlwaysOff + + + + + TextLabel5 + + + Type : + + + + + + + GroupBox5 + + + + 5 + 5 + 1 + 2 + + + + Worksheet + + + AlignTop + + + + unnamed + + + 15 + + + 6 + + + + worksheetList + + + + 7 + 7 + 0 + 0 + + + + + 32767 + 150 + + + + + + + + useAxes + + + Sunken + + + Axes + + + true + + + + unnamed + + + 40 + + + 6 + + + + newAxes3D + + + Create new XYZ axes + + + + + newAxes2D + + + Create new XY axes + + + + + selectedAxes + + + Use the selected axes + + + + + + + + + page + + + 2. Assign data to the graph + + + + unnamed + + + 2 + + + 5 + + + + GroupBox3_2 + + + + 5 + 5 + 0 + 0 + + + + Graph data + + + + unnamed + + + 11 + + + 6 + + + + TabWidget2 + + + + 7 + 7 + 0 + 1 + + + + Rounded + + + + tab + + + Data range + + + + unnamed + + + 2 + + + 6 + + + + sheetEditorPlace + + + StyledPanel + + + Sunken + + + + + + + tab + + + Options + + + + unnamed + + + 11 + + + 6 + + + + useFormula + + + Formula + + + + + Spacer2 + + + Vertical + + + Expanding + + + + 20 + 20 + + + + + + formulaString + + + + 7 + 7 + 0 + 0 + + + + + 32767 + 32767 + + + + + + + + + + New Item + + + + channelList + + + + 7 + 7 + 0 + 3 + + + + + 150 + 32767 + + + + + + channelDescription + + + + 5 + 5 + 0 + 0 + + + + + 150 + 0 + + + + + 150 + 32767 + + + + + 9 + + + + Select a data channel on the list above and assign data to it by selecting cells of the worksheet. + + + WordBreak|AlignJustify|AlignTop + + + 5 + + + + + clearChannel + + + Clear + + + + + + + + + page + + + Click <b>Finish</b> to create the graph + + + + unnamed + + + 11 + + + 6 + + + + previewPlace + + + + 7 + 7 + 0 + 0 + + + + + 255 + 255 + 255 + + + + Panel + + + Sunken + + + + + + + + KSChannelList +
kschannellist.h
+ + -1 + -1 + + 0 + + 5 + 5 + 0 + 0 + + image1 +
+
+ + + 789c7dd3cd4e84301405e03d4fd17077c430fc2e8c9947d0b834312e4a4b8b8bd1641c17c6f8eef6b614da5ee0c2a227f938eda29c0af6f2fcc88a53f675e3b777c1c4c4afac90df97cbcfebdbf937cbdb8699b7ae589ddf6579c9047bfafc18710d660d951d8c838ba27171c4d8d66dd5da0f278c5dedb1c4d8f3febee7183546def19a77181546d18b46f418b98b4ab928302a3bf648650900e5ee78c3f9beb2c6b40c7c5f3923e4919a8d0815c0b86d02951606665176021599486d1a2594d21a0633310a7b10296911326a947b94c6ed26840b5a7b6c0b8e51d29e2b31bec53384c300714f0c6604b42742c410a0a9a12d1b3da4c59869c70428edd13a6da1464aa742941873abac0a5aa8f12a44d42cead0a46adbc46acf840a8dbbd4a9599533a8a8f1ca1bd8344e1df7cceae03cabf2bf61fef790fd03a2a94f81 + + + 789c6dd2c10ac2300c00d07bbf2234b7229d1be245fc04c5a3201e4615f430059d0711ff5ddb2e6bb236ec90eed134cb5a19d8ef36602af5ecdbfeeac05dda0798d3abebde87e3faa374d3807fa0d633a52d38d8de6f679fe33fc776e196f53cd010188256a3600a292882096246517815ca99884606e18044a3a40d91824820924265a7923a2e8bcd05f33db1173e002913175f2a6be6d3294871a2d95fa00e8a94ee017b69d339d90df1e77c57ea072ede6758 + + + +
diff --git a/kmatplot/dialogs/ksgriddlg.cpp b/kmatplot/dialogs/ksgriddlg.cpp new file mode 100644 index 0000000..e375127 --- /dev/null +++ b/kmatplot/dialogs/ksgriddlg.cpp @@ -0,0 +1,53 @@ +/*************************************************************************** + ksgriddlg.cpp + ------------------- + begin : Sat Apr 7 2001 + copyright : (C) 2001 by Kamil Dobkowski + email : kamildobk@poczta.onet.pl + ***************************************************************************/ + +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + +#include "ksgriddlg.h" +#include "../widgets/qsplotview.h" +#include +#include +#include + +KSGridDlg::KSGridDlg( QSPlotView *view, QWidget *parent, const char *name) + : KSGridDlgInterf(parent,name,true) + { + m_view = view; + gridx->setValue( m_view->gridSpacingX() ); + gridy->setValue( m_view->gridSpacingY() ); + visible->setChecked( m_view->gridVisible() ); + page_margins->setChecked( m_view->pageMarginsVisible() ); + setCaption( tr("Grid") ); + connect( bok, SIGNAL(clicked()), this, SLOT(accept()) ); + connect( bcancel, SIGNAL(clicked()), this, SLOT(reject()) ); + } + +//-----------------------------------------------------------// + +KSGridDlg::~KSGridDlg() + { + } + +//-----------------------------------------------------------// + +void KSGridDlg::accept() + { + m_view->setGridSpacing( gridx->value(), gridy->value() ); + m_view->setGridVisible( visible->isChecked() ); + m_view->setPageMarginsVisible( page_margins->isChecked() ); + QDialog::accept(); + } + +//-----------------------------------------------------------// diff --git a/kmatplot/dialogs/ksgriddlg.h b/kmatplot/dialogs/ksgriddlg.h new file mode 100644 index 0000000..e4e676e --- /dev/null +++ b/kmatplot/dialogs/ksgriddlg.h @@ -0,0 +1,41 @@ +/*************************************************************************** + ksgriddlg.h + ------------------- + begin : Sat Apr 7 2001 + copyright : (C) 2001 by Kamil Dobkowski + email : kamildobk@poczta.onet.pl + ***************************************************************************/ + +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + +#ifndef KSGRIDDLG_H +#define KSGRIDDLG_H + +#include"ksgriddlginterf.h" + +class QSPlotView; +/** + *@author Kamil Dobkowski + */ + +class KSGridDlg : public KSGridDlgInterf { + Q_OBJECT + public: + KSGridDlg( QSPlotView *view, QWidget *parent=0, const char *name=0); + ~KSGridDlg(); + + protected slots: + virtual void accept(); + + private: + QSPlotView *m_view; +}; + +#endif diff --git a/kmatplot/dialogs/ksgriddlginterf.cpp b/kmatplot/dialogs/ksgriddlginterf.cpp new file mode 100644 index 0000000..fdaa46f --- /dev/null +++ b/kmatplot/dialogs/ksgriddlginterf.cpp @@ -0,0 +1,93 @@ +/**************************************************************************** +** Form implementation generated from reading ui file './ksgriddlginterf.ui' +** +** Created: śro mar 20 18:53:12 2002 +** by: The User Interface Compiler (uic) +** +** WARNING! All changes made in this file will be lost! +****************************************************************************/ +#include "ksgriddlginterf.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +/* + * Constructs a KSGridDlgInterf which is a child of 'parent', with the + * name 'name' and widget flags set to 'f'. + * + * The dialog will by default be modeless, unless you set 'modal' to + * TRUE to construct a modal dialog. + */ +KSGridDlgInterf::KSGridDlgInterf( QWidget* parent, const char* name, bool modal, WFlags fl ) + : QDialog( parent, name, modal, fl ) +{ + if ( !name ) + setName( "KSGridDlgInterf" ); + resize( 250, 210 ); + setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, sizePolicy().hasHeightForWidth() ) ); + setMinimumSize( QSize( 250, 210 ) ); + setMaximumSize( QSize( 250, 210 ) ); + setBaseSize( QSize( 100, 100 ) ); + setCaption( trUtf8( "NoName" ) ); + + bok = new QPushButton( this, "bok" ); + bok->setGeometry( QRect( 70, 170, 85, 30 ) ); + bok->setText( trUtf8( "OK" ) ); + + QGroupBox_1 = new QGroupBox( this, "QGroupBox_1" ); + QGroupBox_1->setGeometry( QRect( 10, 10, 235, 155 ) ); + QGroupBox_1->setTitle( trUtf8( "Grid" ) ); + + gridy = new QSpinBox( QGroupBox_1, "gridy" ); + gridy->setGeometry( QRect( 110, 60, 55, 20 ) ); + gridy->setMaxValue( 99 ); + + visible = new QCheckBox( QGroupBox_1, "visible" ); + visible->setGeometry( QRect( 35, 95, 175, 25 ) ); + visible->setText( trUtf8( "Show grid" ) ); + + QLabel_1 = new QLabel( QGroupBox_1, "QLabel_1" ); + QLabel_1->setGeometry( QRect( 35, 30, 75, 20 ) ); + QLabel_1->setText( trUtf8( "Grid-DX" ) ); + + QLabel_2 = new QLabel( QGroupBox_1, "QLabel_2" ); + QLabel_2->setGeometry( QRect( 35, 60, 75, 20 ) ); + QLabel_2->setText( trUtf8( "Grid-DY" ) ); + + QLabel_3 = new QLabel( QGroupBox_1, "QLabel_3" ); + QLabel_3->setGeometry( QRect( 175, 30, 50, 20 ) ); + QLabel_3->setText( trUtf8( "mm" ) ); + + QLabel_4 = new QLabel( QGroupBox_1, "QLabel_4" ); + QLabel_4->setGeometry( QRect( 175, 60, 50, 20 ) ); + QLabel_4->setText( trUtf8( "mm" ) ); + + page_margins = new QCheckBox( QGroupBox_1, "page_margins" ); + page_margins->setGeometry( QRect( 35, 120, 175, 25 ) ); + page_margins->setText( trUtf8( "Show page margins" ) ); + + gridx = new QSpinBox( QGroupBox_1, "gridx" ); + gridx->setGeometry( QRect( 110, 30, 55, 20 ) ); + gridx->setMaxValue( 99 ); + + bcancel = new QPushButton( this, "bcancel" ); + bcancel->setGeometry( QRect( 160, 170, 85, 30 ) ); + bcancel->setText( trUtf8( "Cancel" ) ); +} + +/* + * Destroys the object and frees any allocated resources + */ +KSGridDlgInterf::~KSGridDlgInterf() +{ + // no need to delete child widgets, Qt does it all for us +} + +#include "ksgriddlginterf.moc" diff --git a/kmatplot/dialogs/ksgriddlginterf.ui b/kmatplot/dialogs/ksgriddlginterf.ui new file mode 100644 index 0000000..6671eb7 --- /dev/null +++ b/kmatplot/dialogs/ksgriddlginterf.ui @@ -0,0 +1,271 @@ + +KSGridDlgInterf + + QDialog + + name + KSGridDlgInterf + + + geometry + + 0 + 0 + 250 + 210 + + + + sizePolicy + + 0 + 0 + + + + minimumSize + + 250 + 210 + + + + maximumSize + + 250 + 210 + + + + baseSize + + 100 + 100 + + + + caption + NoName + + + QPushButton + + name + bok + + + geometry + + 70 + 170 + 85 + 30 + + + + text + OK + + + + QGroupBox + + name + QGroupBox_1 + + + geometry + + 10 + 10 + 235 + 155 + + + + title + Grid + + + QSpinBox + + name + gridy + + + geometry + + 110 + 60 + 55 + 20 + + + + maxValue + 99 + + + + QCheckBox + + name + visible + + + geometry + + 35 + 95 + 175 + 25 + + + + text + Show grid + + + + QLabel + + name + QLabel_1 + + + geometry + + 35 + 30 + 75 + 20 + + + + text + Grid-DX + + + + QLabel + + name + QLabel_2 + + + geometry + + 35 + 60 + 75 + 20 + + + + text + Grid-DY + + + + QLabel + + name + QLabel_3 + + + geometry + + 175 + 30 + 50 + 20 + + + + text + mm + + + + QLabel + + name + QLabel_4 + + + geometry + + 175 + 60 + 50 + 20 + + + + text + mm + + + + QCheckBox + + name + page_margins + + + geometry + + 35 + 120 + 175 + 25 + + + + text + Show page margins + + + + QSpinBox + + name + gridx + + + geometry + + 110 + 30 + 55 + 20 + + + + maxValue + 99 + + + + + QPushButton + + name + bcancel + + + geometry + + 160 + 170 + 85 + 30 + + + + text + Cancel + + + + diff --git a/kmatplot/dialogs/ksimportdlg.cpp b/kmatplot/dialogs/ksimportdlg.cpp new file mode 100644 index 0000000..0a5771c --- /dev/null +++ b/kmatplot/dialogs/ksimportdlg.cpp @@ -0,0 +1,160 @@ +/*************************************************************************** + ksimportdlg.cpp + ------------------- + begin : 01-January-2000 + copyright : (C) 2000 by Kamil Dobkowski + email : kamildobk@poczta.onet.pl + ***************************************************************************/ + +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + + +#include "ksimportdlg.h" +#include "../widgets/qsdata.h" +#include "../ksworkbook.h" +#include "../ksmatrix.h" +#include "../kscommands.h" +#include "../ksmatrixio.h" +#include +#include +#include +#include +#include +#include +#include +//#include + +QString KSImportDlg::m_file_name; + +//-----------------------------------------------------------// + +KSImportDlg::KSImportDlg( KSWorkbook *workbook, QSData *data, int channel, QWidget *parent, const char *name) + : KSImportDlgInterf(parent,name,true) + { + m_workbook = workbook; + m_data = data; + m_channel = channel; + + // init the matrix list + mlist->addColumn( tr("Name"), 270 ); + mlist->addColumn( tr("RowsCols"), 85 ); + mlist->setSorting(-1); + mlist->setAllColumnsShowFocus( true ); + + // handle some signals + connect( bload, SIGNAL(clicked()), this, SLOT(accept()) ); + connect( bcancel, SIGNAL(clicked()), this, SLOT(reject()) ); + connect( filename, SIGNAL(returnPressed()), this, SLOT(changedFile()) ); + connect( bbrowse, SIGNAL(clicked()), this, SLOT(chooseFile()) ); + + filename->setText( m_file_name ); + refreshFileContents(); + } + +//-----------------------------------------------------------// + +KSImportDlg::~KSImportDlg() + { + } + +//-----------------------------------------------------------// + +void KSImportDlg::chooseFile() + { + QString new_file = QFileDialog::getOpenFileName( m_file_name.isEmpty() ? QDir::homeDirPath() : m_file_name, + tr("*|All files (*)\n*.txt|ASCII files (*.txt)\n*.mat|MATLAB 1.0 files (*.mat)"), + this, "import_dialog", tr("Import File...") ); + if ( !new_file.isEmpty() ) { + m_file_name = new_file; + filename->setText( m_file_name ); + refreshFileContents(); + } + } + +//-----------------------------------------------------------// + +void KSImportDlg::changedFile() + { + m_file_name = filename->text(); + refreshFileContents(); + } + +//-----------------------------------------------------------// + +void KSImportDlg::refreshFileContents() + { + if ( m_file_name.isEmpty() ) return; + + + mlist->clear(); + KSHeadersList *headers; + KSMatrixIO io(m_file_name); + headers = io.loadHeaders(); + if ( !headers ) { + QMessageBox::warning ( this, tr("Error"), tr("Unknown error !"), QMessageBox::Ok, 0, 0 ); + return; + } + + KSHeadersList::iterator curr = headers->end(); + KSHeadersList::iterator last = headers->begin(); + while( curr != last ) { + curr--; + QString size = QString::null; + int col = (*curr)->cols(); + int row = (*curr)->rows(); + if ( row && col ) size.sprintf("%dx%d ", row, col ); + (void) new QListViewItem( mlist, (*curr)->name(), size ); + } + + delete headers; + mlist->triggerUpdate(); + } + +//-----------------------------------------------------------// + +void KSImportDlg::loadAll() + { + KSMatrixIO io(m_file_name); + QListViewItem *mitem = mlist->selectedItem(); + if ( mitem && !mitem->text(0).isEmpty() ) { + KSMatrix *new_matrix = io.loadMatrix( mitem->text(0) ); + if ( new_matrix ) m_workbook->execute( new KSCmdSetData(m_data,m_channel,new_matrix) ); + } + } + +//-----------------------------------------------------------// + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/kmatplot/dialogs/ksimportdlg.h b/kmatplot/dialogs/ksimportdlg.h new file mode 100644 index 0000000..d56ca04 --- /dev/null +++ b/kmatplot/dialogs/ksimportdlg.h @@ -0,0 +1,88 @@ +/*************************************************************************** + ksimportdlg.h + ------------------- + begin : 01-January-2000 + copyright : (C) 2000 by Kamil Dobkowski + email : kamildobk@poczta.onet.pl + ***************************************************************************/ + +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + + +#ifndef KSIMPORTDLG_H +#define KSIMPORTDLG_H + +#include"ksimportdlginterf.h" +#include + +class KSChannelList; +class QListViewItem; +class KSWorkbook; +class QSData; +class QWidget; + +/** + * Import dialog. + * @author Kamil Dobkowski + */ +class KSImportDlg : public KSImportDlgInterf + { + Q_OBJECT + public: + /** + * Constructor. + */ + KSImportDlg( KSWorkbook *workbook, QSData *data, int channel, QWidget *parent=0, const char *name=0); + /** + * Destructor. + */ + ~KSImportDlg(); + /** + * + */ + void loadAll(); + + protected slots: + void chooseFile(); + void changedFile(); + + protected: + void refreshFileContents(); + KSWorkbook *m_workbook; + static QString m_file_name; + QSData *m_data; + int m_channel; +}; + +#endif + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/kmatplot/dialogs/ksimportdlginterf.cpp b/kmatplot/dialogs/ksimportdlginterf.cpp new file mode 100644 index 0000000..2e261ad --- /dev/null +++ b/kmatplot/dialogs/ksimportdlginterf.cpp @@ -0,0 +1,110 @@ +/**************************************************************************** +** Form implementation generated from reading ui file './ksimportdlginterf.ui' +** +** Created: śro mar 20 18:53:13 2002 +** by: The User Interface Compiler (uic) +** +** WARNING! All changes made in this file will be lost! +****************************************************************************/ +#include "ksimportdlginterf.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +/* + * Constructs a KSImportDlgInterf which is a child of 'parent', with the + * name 'name' and widget flags set to 'f'. + * + * The dialog will by default be modeless, unless you set 'modal' to + * TRUE to construct a modal dialog. + */ +KSImportDlgInterf::KSImportDlgInterf( QWidget* parent, const char* name, bool modal, WFlags fl ) + : QDialog( parent, name, modal, fl ) +{ + if ( !name ) + setName( "KSImportDlgInterf" ); + resize( 430, 415 ); + setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, sizePolicy().hasHeightForWidth() ) ); + setMinimumSize( QSize( 430, 415 ) ); + setBaseSize( QSize( 500, 500 ) ); + setCaption( trUtf8( "Import Octave/MAT1.0" ) ); + KSImportDlgInterfLayout = new QGridLayout( this, 1, 1, 11, 6, "KSImportDlgInterfLayout"); + + bcancel = new QPushButton( this, "bcancel" ); + bcancel->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5, (QSizePolicy::SizeType)0, 0, 0, bcancel->sizePolicy().hasHeightForWidth() ) ); + bcancel->setText( trUtf8( "Close" ) ); + + KSImportDlgInterfLayout->addWidget( bcancel, 2, 2 ); + + bload = new QPushButton( this, "bload" ); + bload->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5, (QSizePolicy::SizeType)0, 0, 0, bload->sizePolicy().hasHeightForWidth() ) ); + bload->setText( trUtf8( "Import" ) ); + bload->setDefault( FALSE ); + + KSImportDlgInterfLayout->addWidget( bload, 2, 1 ); + + Line4 = new QFrame( this, "Line4" ); + Line4->setProperty( "frameShape", (int)QFrame::HLine ); + Line4->setFrameShadow( QFrame::Sunken ); + Line4->setFrameShape( QFrame::HLine ); + + KSImportDlgInterfLayout->addMultiCellWidget( Line4, 1, 1, 0, 2 ); + + QGroupBox_3 = new QGroupBox( this, "QGroupBox_3" ); + QGroupBox_3->setFrameShape( QGroupBox::Box ); + QGroupBox_3->setFrameShadow( QGroupBox::Sunken ); + QGroupBox_3->setTitle( trUtf8( "Choose a file and a matrix to import" ) ); + QGroupBox_3->setColumnLayout(0, Qt::Vertical ); + QGroupBox_3->layout()->setSpacing( 6 ); + QGroupBox_3->layout()->setMargin( 25 ); + QGroupBox_3Layout = new QGridLayout( QGroupBox_3->layout() ); + QGroupBox_3Layout->setAlignment( Qt::AlignTop ); + + Frame3 = new QFrame( QGroupBox_3, "Frame3" ); + Frame3->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)0, 0, 0, Frame3->sizePolicy().hasHeightForWidth() ) ); + Frame3->setFrameShape( QFrame::WinPanel ); + Frame3->setFrameShadow( QFrame::Sunken ); + Frame3->setLineWidth( 1 ); + Frame3->setMidLineWidth( 1 ); + Frame3Layout = new QHBoxLayout( Frame3, 2, 0, "Frame3Layout"); + + filename = new QLineEdit( Frame3, "filename" ); + filename->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)7, 0, 0, filename->sizePolicy().hasHeightForWidth() ) ); + filename->setFrame( FALSE ); + Frame3Layout->addWidget( filename ); + + bbrowse = new QPushButton( Frame3, "bbrowse" ); + bbrowse->setText( trUtf8( "Browse ..." ) ); + bbrowse->setAutoDefault( FALSE ); + Frame3Layout->addWidget( bbrowse ); + + QGroupBox_3Layout->addWidget( Frame3, 0, 0 ); + + mlist = new QListView( QGroupBox_3, "mlist" ); + mlist->setVScrollBarMode( QListView::Auto ); + mlist->setHScrollBarMode( QListView::Auto ); + + QGroupBox_3Layout->addWidget( mlist, 1, 0 ); + + KSImportDlgInterfLayout->addMultiCellWidget( QGroupBox_3, 0, 0, 0, 2 ); + QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ); + KSImportDlgInterfLayout->addItem( spacer, 2, 0 ); +} + +/* + * Destroys the object and frees any allocated resources + */ +KSImportDlgInterf::~KSImportDlgInterf() +{ + // no need to delete child widgets, Qt does it all for us +} + +#include "ksimportdlginterf.moc" diff --git a/kmatplot/dialogs/ksimportdlginterf.ui b/kmatplot/dialogs/ksimportdlginterf.ui new file mode 100644 index 0000000..90f73df --- /dev/null +++ b/kmatplot/dialogs/ksimportdlginterf.ui @@ -0,0 +1,220 @@ + +KSImportDlgInterf + + + KSImportDlgInterf + + + + 0 + 0 + 430 + 415 + + + + + 0 + 0 + 0 + 0 + + + + + 430 + 415 + + + + + 500 + 500 + + + + Import Octave/MAT1.0 + + + + unnamed + + + 11 + + + 6 + + + + bcancel + + + + 5 + 0 + 0 + 0 + + + + Close + + + + + bload + + + + 5 + 0 + 0 + 0 + + + + Import + + + false + + + + + Line4 + + + HLine + + + Sunken + + + Horizontal + + + + + QGroupBox_3 + + + Box + + + Sunken + + + Choose a file and a matrix to import + + + + unnamed + + + 25 + + + 6 + + + + Frame3 + + + + 7 + 0 + 0 + 0 + + + + WinPanel + + + Sunken + + + 1 + + + 1 + + + + + + + + unnamed + + + 2 + + + 0 + + + + filename + + + + 7 + 7 + 0 + 0 + + + + false + + + + + bbrowse + + + Browse ... + + + false + + + + + + + mlist + + + Auto + + + Auto + + + + + + + Spacer1 + + + Horizontal + + + Expanding + + + + 20 + 20 + + + + + + + diff --git a/kmatplot/dialogs/ksmpanel.cpp b/kmatplot/dialogs/ksmpanel.cpp new file mode 100644 index 0000000..e22cd0e --- /dev/null +++ b/kmatplot/dialogs/ksmpanel.cpp @@ -0,0 +1,62 @@ +/*************************************************************************** + ksmmatrixpanel.cpp + ------------------- + begin + copyright : (C) 2001 by Kamil Dobkowski + email : kamildbk@friko.onet.pl + ***************************************************************************/ + +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + +#include "ksmpanel.h" +#include +#include + +//----------------------------------------------------------------------------------------// + +KSMPanel::KSMPanel( QWidget *parent, const char *name ) +: QWidget( parent, name ) + { + //setFixedHeight( 130 ); + } + +//----------------------------------------------------------------------------------------// + +KSMPanel::~KSMPanel() + { + } + +//----------------------------------------------------------------------------------------// + +void KSMPanel::updateContents() + { + } + +//----------------------------------------------------------------------------------------// + +QSMatrix *KSMPanel::editedMatrix() + { + return NULL; + } + +//----------------------------------------------------------------------------------------// + +void KSMPanel::setOrientation( Qt::Orientation o ) + { + const QObjectList *objects = queryList( "QBoxLayout", 0, FALSE, FALSE ); + if ( objects ) { + QObjectListIt object( *objects ); + while ( (QObject*)object ) { + QBoxLayout *layout = dynamic_cast((QObject*)object); + if ( layout ) layout->setDirection( o==Horizontal ? QBoxLayout::LeftToRight : QBoxLayout::TopToBottom ); + ++object; + } + } + } diff --git a/kmatplot/dialogs/ksmpanel.h b/kmatplot/dialogs/ksmpanel.h new file mode 100644 index 0000000..44ca3de --- /dev/null +++ b/kmatplot/dialogs/ksmpanel.h @@ -0,0 +1,40 @@ +/*************************************************************************** + ksmpanel.h + ------------------- + copyright : (C) 2001 by Kamil Dobkowski + email : kamildobk@friko.onet.pl + ***************************************************************************/ + +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + +#ifndef KSMPANEL_H +#define KSMPANEL_H + +#include + +class QSMatrix; + +/** + * Base interface for matrix config panels. It is an interface and not a base class + * because QtDesigner cant generate dialogs which inherits custom classes. + */ +class KSMPanel : public QWidget { + Q_OBJECT + public: + KSMPanel( QWidget *parent, const char *name=0 ); + virtual ~KSMPanel(); + virtual void updateContents(); + virtual QSMatrix *editedMatrix(); + public slots: + void setOrientation( Orientation o ); + + }; + +#endif diff --git a/kmatplot/dialogs/ksmpanelformulainterf.cpp b/kmatplot/dialogs/ksmpanelformulainterf.cpp new file mode 100644 index 0000000..c7bcc1a --- /dev/null +++ b/kmatplot/dialogs/ksmpanelformulainterf.cpp @@ -0,0 +1,67 @@ +/**************************************************************************** +** Form implementation generated from reading ui file './ksmpanelformulainterf.ui' +** +** Created: śro mar 20 18:52:44 2002 +** by: The User Interface Compiler (uic) +** +** WARNING! All changes made in this file will be lost! +****************************************************************************/ +#include "ksmpanelformulainterf.h" + +#include +#include +#include +#include +#include +#include +#include +#include "ksmpanel.h" + +/* + * Constructs a KSMPanelFormulaInterf which is a child of 'parent', with the + * name 'name'.' + */ +KSMPanelFormulaInterf::KSMPanelFormulaInterf( QWidget* parent, const char* name ) + : KSMPanel( parent, name ) +{ + if ( !name ) + setName( "KSMPanelFormulaInterf" ); + resize( 500, 140 ); + setCaption( trUtf8( "KSMPanelForm" ) ); + KSMPanelFormulaInterfLayout = new QHBoxLayout( this, 2, 2, "KSMPanelFormulaInterfLayout"); + + Frame3 = new QFrame( this, "Frame3" ); + Frame3->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)5, 0, 0, Frame3->sizePolicy().hasHeightForWidth() ) ); + Frame3->setMinimumSize( QSize( 0, 0 ) ); + Frame3->setMaximumSize( QSize( 32767, 140 ) ); + Frame3->setFrameShape( QFrame::StyledPanel ); + Frame3->setFrameShadow( QFrame::Raised ); + Frame3Layout = new QHBoxLayout( Frame3, 11, 6, "Frame3Layout"); + + matrixFormula = new QMultiLineEdit( Frame3, "matrixFormula" ); + matrixFormula->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5, (QSizePolicy::SizeType)5, 0, 0, matrixFormula->sizePolicy().hasHeightForWidth() ) ); + matrixFormula->setWordWrap( QMultiLineEdit::WidgetWidth ); + matrixFormula->setWrapPolicy( QMultiLineEdit::Anywhere ); + Frame3Layout->addWidget( matrixFormula ); + KSMPanelFormulaInterfLayout->addWidget( Frame3 ); + + Frame4 = new QFrame( this, "Frame4" ); + Frame4->setFrameShape( QFrame::StyledPanel ); + Frame4->setFrameShadow( QFrame::Raised ); + + buttonApply = new QPushButton( Frame4, "buttonApply" ); + buttonApply->setGeometry( QRect( 10, 5, 80, 28 ) ); + buttonApply->setText( trUtf8( "Apply" ) ); + buttonApply->setDefault( TRUE ); + KSMPanelFormulaInterfLayout->addWidget( Frame4 ); +} + +/* + * Destroys the object and frees any allocated resources + */ +KSMPanelFormulaInterf::~KSMPanelFormulaInterf() +{ + // no need to delete child widgets, Qt does it all for us +} + +#include "ksmpanelformulainterf.moc" diff --git a/kmatplot/dialogs/ksmpanelformulainterf.ui b/kmatplot/dialogs/ksmpanelformulainterf.ui new file mode 100644 index 0000000..7b6dcfe --- /dev/null +++ b/kmatplot/dialogs/ksmpanelformulainterf.ui @@ -0,0 +1,145 @@ + +KSMPanelFormulaInterf + + + KSMPanelFormulaInterf + + + + 0 + 0 + 500 + 140 + + + + KSMPanelForm + + + + unnamed + + + 2 + + + 2 + + + + Frame3 + + + + 7 + 5 + 0 + 0 + + + + + 0 + 0 + + + + + 32767 + 140 + + + + StyledPanel + + + Raised + + + + unnamed + + + 11 + + + 6 + + + + matrixFormula + + + + 5 + 5 + 0 + 0 + + + + WidgetWidth + + + Anywhere + + + + + + + Frame4 + + + StyledPanel + + + Raised + + + + buttonApply + + + + 10 + 5 + 80 + 28 + + + + Apply + + + true + + + + + + + + KSMPanel +
ksmpanel.h
+ + 500 + 140 + + 1 + + 0 + 0 + 0 + 0 + + image0 +
+
+ + + 789cd3d7528808f055d0d2e72a2e492cc94c5648ce482c52d04a29cdcdad8c8eb5ade65232540043251d2e253d856405e554300073956aadb900494e10c6 + + + +
diff --git a/kmatplot/dialogs/ksmpanelmatrixinterf.cpp b/kmatplot/dialogs/ksmpanelmatrixinterf.cpp new file mode 100644 index 0000000..bdb109b --- /dev/null +++ b/kmatplot/dialogs/ksmpanelmatrixinterf.cpp @@ -0,0 +1,88 @@ +/**************************************************************************** +** Form implementation generated from reading ui file './ksmpanelmatrixinterf.ui' +** +** Created: śro mar 20 18:52:44 2002 +** by: The User Interface Compiler (uic) +** +** WARNING! All changes made in this file will be lost! +****************************************************************************/ +#include "ksmpanelmatrixinterf.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "ksmpanel.h" + +/* + * Constructs a KSMPanelMatrixInterf which is a child of 'parent', with the + * name 'name'.' + */ +KSMPanelMatrixInterf::KSMPanelMatrixInterf( QWidget* parent, const char* name ) + : KSMPanel( parent, name ) +{ + if ( !name ) + setName( "KSMPanelMatrixInterf" ); + resize( 500, 140 ); + setCaption( trUtf8( "KSMPanelForm" ) ); + KSMPanelMatrixInterfLayout = new QHBoxLayout( this, 2, 2, "KSMPanelMatrixInterfLayout"); + + Frame3 = new QFrame( this, "Frame3" ); + Frame3->setFrameShape( QFrame::StyledPanel ); + Frame3->setFrameShadow( QFrame::Raised ); + + TextLabel1_2 = new QLabel( Frame3, "TextLabel1_2" ); + TextLabel1_2->setGeometry( QRect( 10, 11, 65, 20 ) ); + TextLabel1_2->setText( trUtf8( "Type" ) ); + + TextLabel1 = new QLabel( Frame3, "TextLabel1" ); + TextLabel1->setGeometry( QRect( 10, 35, 65, 25 ) ); + TextLabel1->setText( trUtf8( "Rows" ) ); + + matrixType = new QComboBox( FALSE, Frame3, "matrixType" ); + matrixType->insertItem( trUtf8( "unsigned char" ) ); + matrixType->insertItem( trUtf8( "unsigned short" ) ); + matrixType->insertItem( trUtf8( "short" ) ); + matrixType->insertItem( trUtf8( "long" ) ); + matrixType->insertItem( trUtf8( "float" ) ); + matrixType->insertItem( trUtf8( "double" ) ); + matrixType->setGeometry( QRect( 75, 10, 125, 22 ) ); + + matrixRows = new QSpinBox( Frame3, "matrixRows" ); + matrixRows->setGeometry( QRect( 75, 35, 70, 22 ) ); + matrixRows->setMaxValue( 999999999 ); + + TextLabel2 = new QLabel( Frame3, "TextLabel2" ); + TextLabel2->setGeometry( QRect( 10, 60, 65, 25 ) ); + TextLabel2->setText( trUtf8( "Cols" ) ); + + matrixCols = new QSpinBox( Frame3, "matrixCols" ); + matrixCols->setGeometry( QRect( 75, 60, 70, 22 ) ); + matrixCols->setMaxValue( 999999999 ); + KSMPanelMatrixInterfLayout->addWidget( Frame3 ); + + Frame4 = new QFrame( this, "Frame4" ); + Frame4->setFrameShape( QFrame::StyledPanel ); + Frame4->setFrameShadow( QFrame::Raised ); + + buttonApply = new QPushButton( Frame4, "buttonApply" ); + buttonApply->setGeometry( QRect( 10, 10, 94, 27 ) ); + buttonApply->setText( trUtf8( "Apply" ) ); + buttonApply->setDefault( TRUE ); + KSMPanelMatrixInterfLayout->addWidget( Frame4 ); +} + +/* + * Destroys the object and frees any allocated resources + */ +KSMPanelMatrixInterf::~KSMPanelMatrixInterf() +{ + // no need to delete child widgets, Qt does it all for us +} + +#include "ksmpanelmatrixinterf.moc" diff --git a/kmatplot/dialogs/ksmpanelmatrixinterf.ui b/kmatplot/dialogs/ksmpanelmatrixinterf.ui new file mode 100644 index 0000000..97f67b9 --- /dev/null +++ b/kmatplot/dialogs/ksmpanelmatrixinterf.ui @@ -0,0 +1,218 @@ + +KSMPanelMatrixInterf + + + KSMPanelMatrixInterf + + + + 0 + 0 + 500 + 140 + + + + KSMPanelForm + + + + unnamed + + + 2 + + + 2 + + + + Frame3 + + + StyledPanel + + + Raised + + + + TextLabel1_2 + + + + 10 + 11 + 65 + 20 + + + + Type + + + + + TextLabel1 + + + + 10 + 35 + 65 + 25 + + + + Rows + + + + + + unsigned char + + + + + unsigned short + + + + + short + + + + + long + + + + + float + + + + + double + + + + matrixType + + + + 75 + 10 + 125 + 22 + + + + + + matrixRows + + + + 75 + 35 + 70 + 22 + + + + 999999999 + + + + + TextLabel2 + + + + 10 + 60 + 65 + 25 + + + + Cols + + + + + matrixCols + + + + 75 + 60 + 70 + 22 + + + + 999999999 + + + + + + Frame4 + + + StyledPanel + + + Raised + + + + buttonApply + + + + 10 + 10 + 94 + 27 + + + + Apply + + + true + + + + + + + + KSMPanel +
ksmpanel.h
+ + 500 + 140 + + 1 + + 0 + 0 + 0 + 0 + + image0 +
+
+ + + 789cd3d7528808f055d0d2e72a2e492cc94c5648ce482c52d04a29cdcdad8c8eb5ade65232540043251d2e253d856405e554300073956aadb900494e10c6 + + + +
diff --git a/kmatplot/dialogs/ksmpanelrefinterf.cpp b/kmatplot/dialogs/ksmpanelrefinterf.cpp new file mode 100644 index 0000000..57d4e27 --- /dev/null +++ b/kmatplot/dialogs/ksmpanelrefinterf.cpp @@ -0,0 +1,102 @@ +/**************************************************************************** +** Form implementation generated from reading ui file './ksmpanelrefinterf.ui' +** +** Created: śro mar 20 18:52:45 2002 +** by: The User Interface Compiler (uic) +** +** WARNING! All changes made in this file will be lost! +****************************************************************************/ +#include "ksmpanelrefinterf.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "ksmpanel.h" + +/* + * Constructs a KSMPanelRefInterf which is a child of 'parent', with the + * name 'name'.' + */ +KSMPanelRefInterf::KSMPanelRefInterf( QWidget* parent, const char* name ) + : KSMPanel( parent, name ) +{ + if ( !name ) + setName( "KSMPanelRefInterf" ); + resize( 500, 140 ); + setCaption( trUtf8( "KSMPanelForm" ) ); + KSMPanelRefInterfLayout = new QHBoxLayout( this, 2, 2, "KSMPanelRefInterfLayout"); + + Frame4 = new QFrame( this, "Frame4" ); + Frame4->setMinimumSize( QSize( 175, 0 ) ); + Frame4->setFrameShape( QFrame::StyledPanel ); + Frame4->setFrameShadow( QFrame::Raised ); + + matrixColTo = new QLineEdit( Frame4, "matrixColTo" ); + matrixColTo->setGeometry( QRect( 120, 35, 45, 22 ) ); + QToolTip::add( matrixColTo, trUtf8( "To column ( -1 max available ) " ) ); + + matrixRowTo = new QLineEdit( Frame4, "matrixRowTo" ); + matrixRowTo->setGeometry( QRect( 120, 10, 45, 22 ) ); + QToolTip::add( matrixRowTo, trUtf8( "To row ( -1 max available ) " ) ); + + matrixRowStep = new QLineEdit( Frame4, "matrixRowStep" ); + matrixRowStep->setGeometry( QRect( 95, 10, 25, 22 ) ); + QToolTip::add( matrixRowStep, trUtf8( "Step" ) ); + + matrixColStep = new QLineEdit( Frame4, "matrixColStep" ); + matrixColStep->setGeometry( QRect( 95, 35, 25, 22 ) ); + QToolTip::add( matrixColStep, trUtf8( "Step" ) ); + + matrixColFrom = new QLineEdit( Frame4, "matrixColFrom" ); + matrixColFrom->setGeometry( QRect( 50, 35, 45, 22 ) ); + QToolTip::add( matrixColFrom, trUtf8( "From column" ) ); + + matrixRowFrom = new QLineEdit( Frame4, "matrixRowFrom" ); + matrixRowFrom->setGeometry( QRect( 50, 10, 45, 22 ) ); + matrixRowFrom->setText( trUtf8( "" ) ); + QToolTip::add( matrixRowFrom, trUtf8( "From row" ) ); + + TextLabel3 = new QLabel( Frame4, "TextLabel3" ); + TextLabel3->setGeometry( QRect( 10, 30, 40, 30 ) ); + TextLabel3->setText( trUtf8( "Cols" ) ); + + TextLabel2 = new QLabel( Frame4, "TextLabel2" ); + TextLabel2->setGeometry( QRect( 10, 10, 40, 25 ) ); + TextLabel2->setText( trUtf8( "Rows" ) ); + + matrixTransposition = new QCheckBox( Frame4, "matrixTransposition" ); + matrixTransposition->setGeometry( QRect( 50, 65, 90, 18 ) ); + matrixTransposition->setText( trUtf8( "Transposition" ) ); + KSMPanelRefInterfLayout->addWidget( Frame4 ); + + channelListPlace = new QFrame( this, "channelListPlace" ); + channelListPlace->setFrameShape( QFrame::NoFrame ); + channelListPlace->setFrameShadow( QFrame::Raised ); + KSMPanelRefInterfLayout->addWidget( channelListPlace ); + + Frame5 = new QFrame( this, "Frame5" ); + Frame5->setFrameShape( QFrame::StyledPanel ); + Frame5->setFrameShadow( QFrame::Raised ); + + buttonApply = new QPushButton( Frame5, "buttonApply" ); + buttonApply->setGeometry( QRect( 10, 10, 94, 27 ) ); + buttonApply->setText( trUtf8( "Apply" ) ); + buttonApply->setDefault( TRUE ); + KSMPanelRefInterfLayout->addWidget( Frame5 ); +} + +/* + * Destroys the object and frees any allocated resources + */ +KSMPanelRefInterf::~KSMPanelRefInterf() +{ + // no need to delete child widgets, Qt does it all for us +} + +#include "ksmpanelrefinterf.moc" diff --git a/kmatplot/dialogs/ksmpanelrefinterf.ui b/kmatplot/dialogs/ksmpanelrefinterf.ui new file mode 100644 index 0000000..0a0aa1e --- /dev/null +++ b/kmatplot/dialogs/ksmpanelrefinterf.ui @@ -0,0 +1,259 @@ + +KSMPanelRefInterf + + + KSMPanelRefInterf + + + + 0 + 0 + 500 + 140 + + + + KSMPanelForm + + + + unnamed + + + 2 + + + 2 + + + + Frame4 + + + + 175 + 0 + + + + StyledPanel + + + Raised + + + + matrixColTo + + + + 120 + 35 + 45 + 22 + + + + To column ( -1 max available ) + + + + + matrixRowTo + + + + 120 + 10 + 45 + 22 + + + + To row ( -1 max available ) + + + + + matrixRowStep + + + + 95 + 10 + 25 + 22 + + + + Step + + + + + matrixColStep + + + + 95 + 35 + 25 + 22 + + + + Step + + + + + matrixColFrom + + + + 50 + 35 + 45 + 22 + + + + From column + + + + + matrixRowFrom + + + + 50 + 10 + 45 + 22 + + + + + + + From row + + + + + TextLabel3 + + + + 10 + 30 + 40 + 30 + + + + Cols + + + + + TextLabel2 + + + + 10 + 10 + 40 + 25 + + + + Rows + + + + + matrixTransposition + + + + 50 + 65 + 90 + 18 + + + + Transposition + + + + + + channelListPlace + + + NoFrame + + + Raised + + + + + Frame5 + + + StyledPanel + + + Raised + + + + buttonApply + + + + 10 + 10 + 94 + 27 + + + + Apply + + + true + + + + + + + + KSMPanel +
ksmpanel.h
+ + 500 + 140 + + 1 + + 0 + 0 + 0 + 0 + + image0 +
+
+ + + 789cd3d7528808f055d0d2e72a2e492cc94c5648ce482c52d04a29cdcdad8c8eb5ade65232540043251d2e253d856405e554300073956aadb900494e10c6 + + + +
diff --git a/kmatplot/dialogs/ksmpanels.cpp b/kmatplot/dialogs/ksmpanels.cpp new file mode 100644 index 0000000..2555256 --- /dev/null +++ b/kmatplot/dialogs/ksmpanels.cpp @@ -0,0 +1,438 @@ +/*************************************************************************** + ksmmatrixpanel.cpp + ------------------- + begin + copyright : (C) 2001 by Kamil Dobkowski + email : kamildbk@friko.onet.pl + ***************************************************************************/ + +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + +#include "ksmpanels.h" + +#include "kschannellist.h" +#include "../ksworkbook.h" +#include "../ksglobalmatrixlist.h" +#include "../kscommands.h" +#include "../ksmatrix.h" +#include "../ksdatasymbolfactory.h" +#include "../widgets/qsdata.h" +#include "../widgets/qsconsole.h" +#include "../formula/mpformula.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +// All constructors should take QSData and channel instead just KSMatrix* +KSMPanelMatrix::KSMPanelMatrix( KSWorkbook *workbook, KSMatrix *matrix, QWidget *parent ) +:KSMPanelMatrixInterf( parent ) + { + m_workbook = workbook; + m_matrix = matrix; + m_data_object = matrix->dataObject(); + m_channel = matrix->channel(); + connect( buttonApply, SIGNAL(clicked()), this, SLOT(apply()) ); + updateContents(); + } + +//----------------------------------------------------------------------------------------// + +KSMPanelMatrix::~KSMPanelMatrix() + { + } + +//----------------------------------------------------------------------------------------// + +void KSMPanelMatrix::apply() + { + EType new_type = EDouble; + switch( matrixType->currentItem() ) { + case 0: new_type = EUChar; break; + case 1: new_type = EShort; break; + case 2: new_type = EUShort; break; + case 3: new_type = ELong; break; + case 4: new_type = EFloat; break; + case 5: new_type = EDouble; break; + } + + int new_rows = matrixRows->value(); + int new_cols = matrixCols->value(); + + if ( isModified() ) { + KSMatrix *new_matrix = KSMatrix::create(new_type); + new_matrix->resize(new_rows,new_cols); + for( int row=0; rowrows(); row++ ) + for( int col=0; colcols(); col++ ) { + if ( row < m_matrix->rows() && + col < m_matrix->cols() ) { + new_matrix->setValue( row, col, m_matrix->value(row,col) ); + } + } + m_matrix = new_matrix; + m_workbook->execute( new KSCmdSetData(m_data_object,m_channel,new_matrix) ); + } + } + + + +//----------------------------------------------------------------------------------------// + +bool KSMPanelMatrix::isModified() + { + EType new_type = EDouble; + switch( matrixType->currentItem() ) { + case 0: new_type = EUChar; break; + case 1: new_type = EShort; break; + case 2: new_type = EUShort; break; + case 3: new_type = ELong; break; + case 4: new_type = EFloat; break; + case 5: new_type = EDouble; break; + } + int new_rows = matrixRows->value(); + int new_cols = matrixCols->value(); + + if ( m_matrix && + new_rows != m_matrix->rows() || + new_cols != m_matrix->cols() || + new_type != m_matrix->type() ) return true; + + return false; + } + +//----------------------------------------------------------------------------------------// + +void KSMPanelMatrix::updateContents() + { + matrixRows->setValue( m_matrix->rows() ); + matrixCols->setValue( m_matrix->cols() ); + switch( m_matrix->type() ) { + case EUChar: matrixType->setCurrentItem( 0 ); break; + case EShort: matrixType->setCurrentItem( 1 ); break; + case EUShort:matrixType->setCurrentItem( 2 ); break; + case ELong: matrixType->setCurrentItem( 3 ); break; + case EFloat: matrixType->setCurrentItem( 4 ); break; + case EDouble:matrixType->setCurrentItem( 5 ); break; + } + } + +//----------------------------------------------------------------------------------------// + +QSMatrix *KSMPanelMatrix::editedMatrix() + { + return m_matrix; + } + + +//----------------------------------------------------------------------------------------// +//----------------------------------------------------------------------------------------// +//----------------------------------------------------------------------------------------// +//----------------------------------------------------------------------------------------// +//----------------------------------------------------------------------------------------// + + + + +KSMPanelRef::KSMPanelRef( KSWorkbook *workbook, KSMatrixWorksheetCellRange *matrix, QWidget *parent ) +:KSMPanelRefInterf( parent ) + { + m_workbook = workbook; + m_matrix = matrix; + m_data_object = matrix->dataObject(); + m_channel = matrix->channel(); + m_chan_list = NULL; + connect( buttonApply, SIGNAL(clicked()), this, SLOT(apply()) ); + QApplication::postEvent( this, new QCustomEvent(QEvent::User) ); + } + +//----------------------------------------------------------------------------------------// + +KSMPanelRef::~KSMPanelRef() + { + } + +//----------------------------------------------------------------------------------------// + +void KSMPanelRef::customEvent( QCustomEvent *e ) +// I couldn't create m_chan_list in the constructor because the constructor is +// called in signal KSSheetList::sigDataChanged and m_chan_list connects +// to the same signal from the same object during its initialization - it seems as a little bit +// confusing to the QT. + { + KSMPanelRefInterf::customEvent(e); + m_chan_list = new KSChannelList( channelListPlace ); + m_chan_list->setGeometry( channelListPlace->rect() ); + m_chan_list->addColumn( tr("Name"), 90 ); + m_chan_list->addColumn( tr(""), 80 ); + m_chan_list->addColumn( tr(""), 50 ); + m_chan_list->setDataObject( m_workbook->sheets(), false, 0, false ); + m_chan_list->setRootIsDecorated( false ); + m_chan_list->show(); + updateContents(); + } + +//----------------------------------------------------------------------------------------// + +void KSMPanelRef::apply() + { + if ( !m_chan_list ) return; + + KSChannelListItem *citem = m_chan_list->selected(); + QSData *new_object = citem ? citem->dataObject() : NULL; + int new_channel = citem ? citem->channel() : NULL; + int new_col_from = matrixColFrom->text().toInt(); + int new_col_to = matrixColTo->text().toInt(); + int new_row_from = matrixRowFrom->text().toInt(); + int new_row_to = matrixRowTo->text().toInt(); + int new_col_step = matrixColStep->text().toInt(); + int new_row_step = matrixRowStep->text().toInt(); + bool new_transposition = matrixTransposition->isChecked(); + //QString new_name = matrixName->text(); + + if ( new_channel < 0 ) new_object = NULL; + + if ( isModified() ) { + KSMatrixWorksheetCellRange *new_matrix = new KSMatrixWorksheetCellRange(m_workbook); + new_matrix->setWorksheet( m_workbook->sheets()->childIndex(new_object) ); + new_matrix->setRowFrom( new_row_from ); + new_matrix->setRowStep( new_row_step ); + new_matrix->setRowTo( new_row_to ); + new_matrix->setColFrom( new_col_from ); + new_matrix->setColStep( new_col_step ); + new_matrix->setColTo( new_col_to ); + new_matrix->setTransposition( new_transposition ); + m_matrix = new_matrix; + m_workbook->execute( new KSCmdSetData(m_data_object,m_channel,new_matrix) ); + } + } + +//----------------------------------------------------------------------------------------// + +bool KSMPanelRef::isModified() + { + if ( !m_chan_list ) return false; + + KSChannelListItem *citem = m_chan_list->selected(); + QSData *new_object = citem ? citem->dataObject() : NULL; + int new_channel = citem ? citem->channel() : NULL; + int new_col_from = matrixColFrom->text().toInt(); + int new_col_to = matrixColTo->text().toInt(); + int new_row_from = matrixRowFrom->text().toInt(); + int new_row_to = matrixRowTo->text().toInt(); + int new_col_step = matrixColStep->text().toInt(); + int new_row_step = matrixRowStep->text().toInt(); + bool new_transposition = matrixTransposition->isChecked(); + + if ( new_channel < 0 ) new_object = NULL; + + if ( m_matrix->refObject() != new_object || + m_matrix->refChannel() != new_channel || + m_matrix->transposition() != new_transposition || + new_row_from != m_matrix->refRowFrom() || + new_row_to != m_matrix->refRowTo() || + new_col_from != m_matrix->refColFrom() || + new_col_to != m_matrix->refColTo() || + new_row_step != m_matrix->refRowStep() || + new_col_step != m_matrix->refColStep() ) return true; + + return false; + } + +//----------------------------------------------------------------------------------------// + +void KSMPanelRef::updateContents() + { + matrixColFrom->setText( QString::number(m_matrix->refColFrom()) ); + matrixColTo->setText( QString::number(m_matrix->refColTo()) ); + matrixRowFrom->setText( QString::number(m_matrix->refRowFrom()) ); + matrixRowTo->setText( QString::number(m_matrix->refRowTo()) ); + matrixColStep->setText( QString::number(m_matrix->refColStep()) ); + matrixRowStep->setText( QString::number(m_matrix->refRowStep()) ); + matrixTransposition->setChecked( m_matrix->transposition() ); + m_chan_list->select( m_matrix->refObject(), m_matrix->refChannel() ); + } + +//----------------------------------------------------------------------------------------// + +QSMatrix *KSMPanelRef::editedMatrix() + { + return m_matrix; + } + + + +//----------------------------------------------------------------------------------------// +//----------------------------------------------------------------------------------------// +//----------------------------------------------------------------------------------------// +//----------------------------------------------------------------------------------------// +//----------------------------------------------------------------------------------------// +//----------------------------------------------------------------------------------------// + + + + + + + + + + +KSMPanelString::KSMPanelString( KSWorkbook *workbook, KSMatrixString *matrix, QWidget *parent ) +:KSMPanelStringInterf( parent ) + { + m_workbook = workbook; + m_matrix = matrix; + m_data_object = matrix->dataObject(); + m_channel = matrix->channel(); + connect( buttonApply, SIGNAL(clicked()), this, SLOT(apply()) ); + updateContents(); + } + +//----------------------------------------------------------------------------------------// + +KSMPanelString::~KSMPanelString() + { + } + +//----------------------------------------------------------------------------------------// + +void KSMPanelString::apply() + { + int new_rows = matrixRows->value(); + int new_cols = matrixCols->value(); + + if ( isModified() ) { + KSMatrixString *new_matrix = new KSMatrixString(); + new_matrix->resize(new_rows,new_cols); + for( int row=0; rowrows(); row++ ) + for( int col=0; colcols(); col++ ) { + if ( row < m_matrix->rows() && + col < m_matrix->cols() ) { + new_matrix->setString( row, col, m_matrix->string(row,col) ); + } + } + m_matrix = new_matrix; + m_workbook->execute( new KSCmdSetData(m_data_object,m_channel,new_matrix) ); + } + + } + +//----------------------------------------------------------------------------------------// + +QSMatrix *KSMPanelString::editedMatrix() + { + return m_matrix; + } + +//----------------------------------------------------------------------------------------// + +bool KSMPanelString::isModified() + { + int new_rows = matrixRows->value(); + int new_cols = matrixCols->value(); + + if ( new_rows != m_matrix->rows() || + new_cols != m_matrix->cols() ) return true; + + return false; + } + +//----------------------------------------------------------------------------------------// + +void KSMPanelString::updateContents() + { + matrixRows->setValue( m_matrix->rows() ); + matrixCols->setValue( m_matrix->cols() ); + } + + + + + + +//----------------------------------------------------------------------------------------// +//----------------------------------------------------------------------------------------// +//----------------------------------------------------------------------------------------// +//----------------------------------------------------------------------------------------// +//----------------------------------------------------------------------------------------// +//----------------------------------------------------------------------------------------// + + + + + + + + + + +KSMPanelFormula::KSMPanelFormula( KSWorkbook *workbook, KSMatrixFormula *matrix, QWidget *parent ) +:KSMPanelFormulaInterf( parent ) + { + m_workbook = workbook; + m_matrix = matrix; + m_data_object = matrix->dataObject(); + m_channel = matrix->channel(); + connect( buttonApply, SIGNAL(clicked()), this, SLOT(apply()) ); + updateContents(); + } + +//----------------------------------------------------------------------------------------// + +KSMPanelFormula::~KSMPanelFormula() + { + } + +//----------------------------------------------------------------------------------------// + +void KSMPanelFormula::apply() + { + KSMatrixFormula *new_matrix = new KSMatrixFormula(); + new_matrix->setFormula( matrixFormula->text() ); + new_matrix->setTransposition( m_matrix->transposition() ); + MPFactoryList factory( new KSDataSymbolFactory( m_workbook, m_matrix->dataObject() ) ); + MPFormulaError error; + if ( !new_matrix->init( error, &factory ) ) { + QMessageBox::critical( NULL, tr("Error"), error.message(), QMessageBox::Ok, 0 ); + QSConsole::write( tr("Error parsing formula:" )+error.message() ); + } + m_matrix = new_matrix; + m_workbook->execute( new KSCmdSetData(m_data_object,m_channel,new_matrix) ); + } + +//----------------------------------------------------------------------------------------// + +QSMatrix *KSMPanelFormula::editedMatrix() + { + return m_matrix; + } + +//----------------------------------------------------------------------------------------// + +bool KSMPanelFormula::isModified() + { + if ( m_matrix->formula() != matrixFormula->text() ) return true; + return false; + } + +//----------------------------------------------------------------------------------------// + +void KSMPanelFormula::updateContents() + { + matrixFormula->setText( m_matrix->formula() ); + } + diff --git a/kmatplot/dialogs/ksmpanels.h b/kmatplot/dialogs/ksmpanels.h new file mode 100644 index 0000000..900ed45 --- /dev/null +++ b/kmatplot/dialogs/ksmpanels.h @@ -0,0 +1,121 @@ +/*************************************************************************** + ksmpanels.h + ------------------- + copyright : (C) 2001 by Kamil Dobkowski + email : kamildobk@friko.onet.pl + ***************************************************************************/ + +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + +#ifndef KSMPANELS_H +#define KSMPANELS_H + +#include "ksmpanelmatrixinterf.h" +#include "ksmpanelrefinterf.h" +#include "ksmpanelstringinterf.h" +#include "ksmpanelformulainterf.h" + +#include"../ksmatrix.h" + +class KSMatrixRef; +class KSMatrixColRef; +class KSMatrixString; +class KSMatrixFormula; +class KSChannelList; +class KSWorkbook; +class QSData; +class KSMatrixWorksheetCellRange; + +//------------------------------------------------------------------------// + +/** + *@author Kamil Dobkowski + */ +class KSMPanelMatrix : public KSMPanelMatrixInterf { + Q_OBJECT + public: + KSMPanelMatrix( KSWorkbook *workbook, KSMatrix *matrix, QWidget *parent ); + virtual ~KSMPanelMatrix(); + virtual bool isModified(); + virtual void updateContents(); + virtual QSMatrix *editedMatrix(); + public slots: + virtual void apply(); + private: + KSWorkbook *m_workbook; + KSMatrix *m_matrix; + QSData *m_data_object; + int m_channel; +}; + +//------------------------------------------------------------------------// + + +class KSMPanelRef : public KSMPanelRefInterf { + Q_OBJECT + public: + KSMPanelRef( KSWorkbook *workbook, KSMatrixWorksheetCellRange *matrix, QWidget *parent ); + virtual ~KSMPanelRef(); + virtual bool isModified(); + virtual void updateContents(); + virtual QSMatrix *editedMatrix(); + public slots: + virtual void apply(); + protected: + virtual void customEvent( QCustomEvent *e ); + private: + KSWorkbook *m_workbook; + KSMatrixWorksheetCellRange *m_matrix; + QSData *m_data_object; + int m_channel; + KSChannelList *m_chan_list; +}; + +//------------------------------------------------------------------------// + + +class KSMPanelString : public KSMPanelStringInterf { + Q_OBJECT + public: + KSMPanelString( KSWorkbook *workbook, KSMatrixString *matrix, QWidget *parent ); + virtual ~KSMPanelString(); + virtual bool isModified(); + virtual void updateContents(); + virtual QSMatrix *editedMatrix(); + public slots: + virtual void apply(); + private: + KSWorkbook *m_workbook; + KSMatrixString *m_matrix; + QSData *m_data_object; + int m_channel; +}; + +//------------------------------------------------------------------------// + + +class KSMPanelFormula : public KSMPanelFormulaInterf { + Q_OBJECT + public: + KSMPanelFormula( KSWorkbook *workbook, KSMatrixFormula *matrix, QWidget *parent ); + virtual ~KSMPanelFormula(); + virtual bool isModified(); + virtual void updateContents(); + virtual QSMatrix *editedMatrix(); + public slots: + virtual void apply(); + private: + KSWorkbook *m_workbook; + KSMatrixFormula *m_matrix; + QSData *m_data_object; + int m_channel; +}; + +#endif diff --git a/kmatplot/dialogs/ksmpanelstringinterf.cpp b/kmatplot/dialogs/ksmpanelstringinterf.cpp new file mode 100644 index 0000000..2302602 --- /dev/null +++ b/kmatplot/dialogs/ksmpanelstringinterf.cpp @@ -0,0 +1,75 @@ +/**************************************************************************** +** Form implementation generated from reading ui file './ksmpanelstringinterf.ui' +** +** Created: śro mar 20 18:52:46 2002 +** by: The User Interface Compiler (uic) +** +** WARNING! All changes made in this file will be lost! +****************************************************************************/ +#include "ksmpanelstringinterf.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include "ksmpanel.h" + +/* + * Constructs a KSMPanelStringInterf which is a child of 'parent', with the + * name 'name'.' + */ +KSMPanelStringInterf::KSMPanelStringInterf( QWidget* parent, const char* name ) + : KSMPanel( parent, name ) +{ + if ( !name ) + setName( "KSMPanelStringInterf" ); + resize( 500, 140 ); + setCaption( trUtf8( "KSMPanelForm" ) ); + KSMPanelStringInterfLayout = new QHBoxLayout( this, 2, 2, "KSMPanelStringInterfLayout"); + + Frame3 = new QFrame( this, "Frame3" ); + Frame3->setFrameShape( QFrame::StyledPanel ); + Frame3->setFrameShadow( QFrame::Raised ); + + TextLabel3 = new QLabel( Frame3, "TextLabel3" ); + TextLabel3->setGeometry( QRect( 10, 35, 90, 25 ) ); + TextLabel3->setText( trUtf8( "Cols" ) ); + + TextLabel2 = new QLabel( Frame3, "TextLabel2" ); + TextLabel2->setGeometry( QRect( 10, 10, 90, 25 ) ); + TextLabel2->setText( trUtf8( "Rows" ) ); + + matrixRows = new QSpinBox( Frame3, "matrixRows" ); + matrixRows->setGeometry( QRect( 55, 10, 85, 22 ) ); + matrixRows->setMaxValue( 999999999 ); + + matrixCols = new QSpinBox( Frame3, "matrixCols" ); + matrixCols->setGeometry( QRect( 55, 35, 85, 22 ) ); + matrixCols->setMaxValue( 999999999 ); + KSMPanelStringInterfLayout->addWidget( Frame3 ); + + Frame4 = new QFrame( this, "Frame4" ); + Frame4->setFrameShape( QFrame::StyledPanel ); + Frame4->setFrameShadow( QFrame::Raised ); + + buttonApply = new QPushButton( Frame4, "buttonApply" ); + buttonApply->setGeometry( QRect( 15, 10, 94, 30 ) ); + buttonApply->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)1, (QSizePolicy::SizeType)0, 0, 0, buttonApply->sizePolicy().hasHeightForWidth() ) ); + buttonApply->setText( trUtf8( "Apply" ) ); + buttonApply->setDefault( TRUE ); + KSMPanelStringInterfLayout->addWidget( Frame4 ); +} + +/* + * Destroys the object and frees any allocated resources + */ +KSMPanelStringInterf::~KSMPanelStringInterf() +{ + // no need to delete child widgets, Qt does it all for us +} + +#include "ksmpanelstringinterf.moc" diff --git a/kmatplot/dialogs/ksmpanelstringinterf.ui b/kmatplot/dialogs/ksmpanelstringinterf.ui new file mode 100644 index 0000000..e7a326f --- /dev/null +++ b/kmatplot/dialogs/ksmpanelstringinterf.ui @@ -0,0 +1,167 @@ + +KSMPanelStringInterf + + + KSMPanelStringInterf + + + + 0 + 0 + 500 + 140 + + + + KSMPanelForm + + + + unnamed + + + 2 + + + 2 + + + + Frame3 + + + StyledPanel + + + Raised + + + + TextLabel3 + + + + 10 + 35 + 90 + 25 + + + + Cols + + + + + TextLabel2 + + + + 10 + 10 + 90 + 25 + + + + Rows + + + + + matrixRows + + + + 55 + 10 + 85 + 22 + + + + 999999999 + + + + + matrixCols + + + + 55 + 35 + 85 + 22 + + + + 999999999 + + + + + + Frame4 + + + StyledPanel + + + Raised + + + + buttonApply + + + + 15 + 10 + 94 + 30 + + + + + 1 + 0 + 0 + 0 + + + + Apply + + + true + + + + + + + + KSMPanel +
ksmpanel.h
+ + 500 + 140 + + 1 + + 0 + 0 + 0 + 0 + + image0 +
+
+ + + 789cd3d7528808f055d0d2e72a2e492cc94c5648ce482c52d04a29cdcdad8c8eb5ade65232540043251d2e253d856405e554300073956aadb900494e10c6 + + + +
diff --git a/kmatplot/dialogs/ksobjecttreedlg.cpp b/kmatplot/dialogs/ksobjecttreedlg.cpp new file mode 100644 index 0000000..e02e812 --- /dev/null +++ b/kmatplot/dialogs/ksobjecttreedlg.cpp @@ -0,0 +1,213 @@ +/*************************************************************************** + ksgeneraldialogs.cpp - description + ------------------- + begin : Fri Nov 9 2001 + copyright : (C) 2001 by kamil + email : kamil@localhost.localdomain + ***************************************************************************/ + +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + +#include "ksobjecttreedlg.h" +#include "../widgets/qsplotview.h" +#include "../kmatplotshell.h" +#include + +class KSObjectTreeListItem : public QListViewItem + { + public: + KSObjectTreeListItem( QListView *parent, QSCObject *object ) + : QListViewItem(parent), m_object(object) { + setText( 0, m_object->name() ); + } + KSObjectTreeListItem( QListViewItem *parent, QSCObject *object ) + : QListViewItem(parent), m_object(object) { + setText( 0, m_object->name() ); + } + ~KSObjectTreeListItem() { + } + QSCObject *object() const { + return m_object; + } + private: + QSCObject *m_object; + }; + +//--------------------------------------------------------------------------// + +KSObjectTreePanel::KSObjectTreePanel( KMatplotShell *shell, QSPlotView *view, QWidget *parent ) +: KSObjectTreePanelInterf(parent,NULL) + { + m_page = NULL; + m_shell = shell; + m_view = view; + objectView->setSorting(-1); + connect( m_view, SIGNAL(sigCurrentPageChanged()), this, SLOT(slot_current_page_changed()) ); + connect( m_view->selection(), SIGNAL(sigChanged()), this, SLOT(slot_selection_changed()) ); + setPage( m_view->currentPage() ); + } + +//--------------------------------------------------------------------------// + +KSObjectTreePanel::~KSObjectTreePanel() + { + } + +//--------------------------------------------------------------------------// + +void KSObjectTreePanel::slotRaise() + { + m_shell->doAction( m_shell->m_raise ); + } + +//--------------------------------------------------------------------------// + +void KSObjectTreePanel::slotLower() + { + m_shell->doAction( m_shell->m_lower ); + } + +//--------------------------------------------------------------------------// + +void KSObjectTreePanel::slotToBack() + { + m_shell->doAction( m_shell->m_send_to_back ); + } + +//--------------------------------------------------------------------------// + +void KSObjectTreePanel::slotToFront() + { + m_shell->doAction( m_shell->m_bring_to_front ); + } + +//--------------------------------------------------------------------------// + +void KSObjectTreePanel::slotShowMenu( QListViewItem *, const QPoint&, int ) + { + m_shell->doAction( m_shell->m_object_menu ); + } + +//--------------------------------------------------------------------------// + +void KSObjectTreePanel::setPage( QSPage *page ) + { + if ( m_page ) { + disconnect( m_page->objects(), SIGNAL(sigListChanged(QSCObjectCollection*)), this, SLOT(slot_object_list_changed(QSCObjectCollection*)) ); + } + m_page = page; + if ( m_page ) { + connect( m_page->objects(), SIGNAL(sigListChanged(QSCObjectCollection*)), this, SLOT(slot_object_list_changed(QSCObjectCollection*)) ); + } + create_object_list(); + } + +//--------------------------------------------------------------------------/ + +void KSObjectTreePanel::slotObjectViewSelectionChanged() + { + m_view->selection()->setAutoUpdates( false ); + m_view->selection()->clear(); + KSObjectTreeListItem *citem = dynamic_cast(objectView->firstChild()); + while ( citem ) { + if ( citem->isSelected() ) m_view->selection()->add( citem->object() ); + citem = dynamic_cast(citem->itemBelow()); + } + m_view->selection()->setAutoUpdates( true ); + } + +//--------------------------------------------------------------------------// + +void KSObjectTreePanel::slot_current_page_changed() + { + setPage( m_view->currentPage() ); + } + +//--------------------------------------------------------------------------// + +void KSObjectTreePanel::slot_object_list_changed( QSCObjectCollection * ) + { + create_object_list(); + } + +//--------------------------------------------------------------------------// + +void KSObjectTreePanel::slot_selection_changed() + { + update_selection(); + } + +//--------------------------------------------------------------------------// + +void KSObjectTreePanel::create_object_list() + { + int pos_x = objectView->contentsX(); + int pos_y = objectView->contentsY(); + QSCObject *current_object = objectView->currentItem() ? dynamic_cast(objectView->currentItem())->object() : NULL; + objectView->clear(); + if ( m_page ) + for( int i=0; iobjects()->count(); i++ ) { + add_object_to_the_list( m_page->objects()->object(i) ); + } + update_selection(); + update_current_item( current_object ); + objectView->setContentsPos(pos_x,pos_y); + } + +//--------------------------------------------------------------------------// + +void KSObjectTreePanel::add_object_to_the_list( QSCObject *object, QListViewItem *parent ) + { + KSObjectTreeListItem *curr_item = NULL; + if ( parent ) curr_item = new KSObjectTreeListItem( parent, object ); + else curr_item = new KSObjectTreeListItem( objectView, object ); + + if ( dynamic_cast(object) ) { + QSCGroup *curr_group = dynamic_cast(object); + for( int i=0; iobjects()->count(); i++ ) { + add_object_to_the_list( curr_group->objects()->object(i), curr_item ); + } + } + + objectView->setOpen( curr_item, true ); + } + +//--------------------------------------------------------------------------// + +void KSObjectTreePanel::update_selection() + { + KSObjectTreeListItem *citem = dynamic_cast(objectView->firstChild()); + while ( citem ) { + if ( m_view->selection()->contains(citem->object()) ) citem->setSelected( true ); + else citem->setSelected( false ); + citem = dynamic_cast(citem->itemBelow()); + } + objectView->triggerUpdate(); + } + +//--------------------------------------------------------------------------// + +void KSObjectTreePanel::update_current_item( QSCObject *object ) + { + KSObjectTreeListItem *citem = dynamic_cast(objectView->firstChild()); + while ( citem ) { + if ( citem->object() == object ) { + objectView->setCurrentItem( citem ); + break; + } + citem = dynamic_cast(citem->itemBelow()); + } + } + +//--------------------------------------------------------------------------// + + + + diff --git a/kmatplot/dialogs/ksobjecttreedlg.h b/kmatplot/dialogs/ksobjecttreedlg.h new file mode 100644 index 0000000..9bcb4da --- /dev/null +++ b/kmatplot/dialogs/ksobjecttreedlg.h @@ -0,0 +1,65 @@ +/*************************************************************************** + ksgeneraldialogs.h - description + ------------------- + begin : Fri Nov 9 2001 + copyright : (C) 2001 by kamil + email : kamil@localhost.localdomain + ***************************************************************************/ + +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + +#ifndef KSOBJECTTREEDLG_H +#define KSOBJECTTREEDLG_H + +#ifdef HAVE_CONFIG_H +#include +#endif + +#include "ksobjecttreedlginterf.h" + +class QSPage; +class QPoint; +class QSCObject; +class QSPlotView; +class QListViewItem; +class KMatplotShell; +class QSCObjectCollection; + +class KSObjectTreePanel : public KSObjectTreePanelInterf + { + Q_OBJECT + public: + KSObjectTreePanel( KMatplotShell *shell, QSPlotView *view, QWidget *parent ); + virtual ~KSObjectTreePanel(); + void setPage( QSPage *page ); + public slots: + virtual void slotRaise(); + virtual void slotLower(); + virtual void slotToBack(); + virtual void slotToFront(); + virtual void slotObjectViewSelectionChanged(); + virtual void slotShowMenu( QListViewItem *, const QPoint&, int ); + private slots: + void slot_current_page_changed(); + void slot_object_list_changed( QSCObjectCollection *collection ); + void slot_selection_changed(); + private: + KMatplotShell *m_shell; + QSPlotView *m_view; + QSPage *m_page; + + void create_object_list(); + void add_object_to_the_list( QSCObject *object, QListViewItem *parent=NULL ); + void update_selection(); + void update_current_item( QSCObject *object ); + }; + +#endif + diff --git a/kmatplot/dialogs/ksobjecttreedlginterf.cpp b/kmatplot/dialogs/ksobjecttreedlginterf.cpp new file mode 100644 index 0000000..5753f37 --- /dev/null +++ b/kmatplot/dialogs/ksobjecttreedlginterf.cpp @@ -0,0 +1,96 @@ +/**************************************************************************** +** Form implementation generated from reading ui file './ksobjecttreedlginterf.ui' +** +** Created: śro mar 20 18:53:21 2002 +** by: The User Interface Compiler (uic) +** +** WARNING! All changes made in this file will be lost! +****************************************************************************/ +#include "ksobjecttreedlginterf.h" + +#include +#include +#include +#include +#include +#include +#include + +/* + * Constructs a KSObjectTreePanelInterf which is a child of 'parent', with the + * name 'name' and widget flags set to 'f'. + */ +KSObjectTreePanelInterf::KSObjectTreePanelInterf( QWidget* parent, const char* name, WFlags fl ) + : QWidget( parent, name, fl ) +{ + if ( !name ) + setName( "KSObjectTreePanelInterf" ); + resize( 201, 367 ); + setCaption( trUtf8( "Object tree" ) ); + KSObjectTreePanelInterfLayout = new QVBoxLayout( this, 1, 2, "KSObjectTreePanelInterfLayout"); + + objectView = new QListView( this, "objectView" ); + objectView->addColumn( trUtf8( "Objects " ) ); + objectView->setResizePolicy( QListView::AutoOneFit ); + objectView->setVScrollBarMode( QListView::Auto ); + objectView->setHScrollBarMode( QListView::AlwaysOff ); + objectView->setSelectionMode( QListView::Extended ); + objectView->setAllColumnsShowFocus( TRUE ); + objectView->setRootIsDecorated( TRUE ); + KSObjectTreePanelInterfLayout->addWidget( objectView ); + + Layout2 = new QHBoxLayout( 0, 0, 21, "Layout2"); + + buttonLower = new QPushButton( this, "buttonLower" ); + QFont buttonLower_font( buttonLower->font() ); + buttonLower_font.setPointSize( 9 ); + buttonLower->setFont( buttonLower_font ); + buttonLower->setText( trUtf8( "< Lower" ) ); + buttonLower->setFlat( TRUE ); + Layout2->addWidget( buttonLower ); + + buttonRaise = new QPushButton( this, "buttonRaise" ); + QFont buttonRaise_font( buttonRaise->font() ); + buttonRaise_font.setPointSize( 9 ); + buttonRaise->setFont( buttonRaise_font ); + buttonRaise->setText( trUtf8( "Raise >" ) ); + buttonRaise->setFlat( TRUE ); + Layout2->addWidget( buttonRaise ); + KSObjectTreePanelInterfLayout->addLayout( Layout2 ); + + // signals and slots connections + connect( buttonLower, SIGNAL( clicked() ), this, SLOT( slotLower() ) ); + connect( buttonRaise, SIGNAL( clicked() ), this, SLOT( slotRaise() ) ); + connect( objectView, SIGNAL( rightButtonPressed(QListViewItem*,const QPoint&,int) ), this, SLOT( slotShowMenu(QListViewItem*,const QPoint&,int) ) ); + connect( objectView, SIGNAL( selectionChanged() ), this, SLOT( slotObjectViewSelectionChanged() ) ); +} + +/* + * Destroys the object and frees any allocated resources + */ +KSObjectTreePanelInterf::~KSObjectTreePanelInterf() +{ + // no need to delete child widgets, Qt does it all for us +} + +void KSObjectTreePanelInterf::slotShowMenu( QListViewItem *, const QPoint&, int ) +{ + qWarning( "KSObjectTreePanelInterf::slotShowMenu( QListViewItem *, const QPoint&, int ): Not implemented yet!" ); +} + +void KSObjectTreePanelInterf::slotLower() +{ + qWarning( "KSObjectTreePanelInterf::slotLower(): Not implemented yet!" ); +} + +void KSObjectTreePanelInterf::slotObjectViewSelectionChanged() +{ + qWarning( "KSObjectTreePanelInterf::slotObjectViewSelectionChanged(): Not implemented yet!" ); +} + +void KSObjectTreePanelInterf::slotRaise() +{ + qWarning( "KSObjectTreePanelInterf::slotRaise(): Not implemented yet!" ); +} + +#include "ksobjecttreedlginterf.moc" diff --git a/kmatplot/dialogs/ksobjecttreedlginterf.ui b/kmatplot/dialogs/ksobjecttreedlginterf.ui new file mode 100644 index 0000000..9c2b003 --- /dev/null +++ b/kmatplot/dialogs/ksobjecttreedlginterf.ui @@ -0,0 +1,149 @@ + +KSObjectTreePanelInterf + + + KSObjectTreePanelInterf + + + + 0 + 0 + 201 + 367 + + + + Object tree + + + + + + + + unnamed + + + 1 + + + 2 + + + + + Objects + + + true + + + true + + + + objectView + + + AutoOneFit + + + Auto + + + AlwaysOff + + + Extended + + + true + + + true + + + + + Layout2 + + + + unnamed + + + 0 + + + 21 + + + + buttonLower + + + + 9 + + + + < Lower + + + true + + + + + buttonRaise + + + + 9 + + + + Raise > + + + true + + + + + + + + + buttonLower + clicked() + KSObjectTreePanelInterf + slotLower() + + + buttonRaise + clicked() + KSObjectTreePanelInterf + slotRaise() + + + objectView + rightButtonPressed(QListViewItem*,const QPoint&,int) + KSObjectTreePanelInterf + slotShowMenu(QListViewItem*,const QPoint&,int) + + + objectView + selectionChanged() + KSObjectTreePanelInterf + slotObjectViewSelectionChanged() + + + + slotShowMenu( QListViewItem *, const QPoint&, int ) + slotLower() + slotObjectViewSelectionChanged() + slotRaise() + + + diff --git a/kmatplot/dialogs/kspanel.cpp b/kmatplot/dialogs/kspanel.cpp new file mode 100644 index 0000000..00dc059 --- /dev/null +++ b/kmatplot/dialogs/kspanel.cpp @@ -0,0 +1,228 @@ +/*************************************************************************** + kspanel.cpp + ------------------- + begin : Sat Oct 7 2000 + copyright : (C) 2000 by Kamil Dobkowski + email : kamildobk@friko.onet.pl + ***************************************************************************/ + +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + +#include "kspanel.h" +#include +#include +#include +#include +#include "../widgets/qsaxes.h" +#include "../widgets/qsaxis.h" +#include "../pixmaps/panel_general.xpm" +#include "../pixmaps/panel_axes.xpm" +#include "../pixmaps/panel_datasets.xpm" +#include "../pixmaps/panel_object.xpm" + +KSPanelButton *KSPanelButton::categoryButton( ButtonCategory category, QWidget *parent ) + { + switch( category ) { + case BGeneral: return new KSPanelButton( parent, NULL, BGeneral, QPixmap(panel_general), tr("General properties") ); break; + case BAxes: return new KSPanelButton( parent, NULL, BAxes, QPixmap(panel_axes), tr("Axis properties") ); break; + case BDatasets: return new KSPanelButton( parent, NULL, BDatasets, QPixmap(panel_datasets), tr("Dataset properties") ); break; + case BObject: return new KSPanelButton( parent, NULL, BObject, QPixmap(panel_object), tr("Object properties") ); break; + } + return NULL; + } + +//-----------------------------------------------------// + +KSPanelButton::KSPanelButton( QWidget *parent, KSWorkbook *workbook, ButtonCategory category, const QPixmap& icon, const QString& toolTip, QSData *dataObject ) +:QPushButton( parent ) + { + m_category = category; + m_workbook = workbook; + m_data_object = dataObject; + //setFixedHeight( 25 ); + setToggleButton( true ); + setPixmap(icon); + QToolTip::add( this, toolTip ); + QWhatsThis::add( this, toolTip ); + installEventFilter( this ); + } + +//-----------------------------------------------------// + +KSPanelButton::~KSPanelButton() + { + } + +//-----------------------------------------------------// + +KSPanel *KSPanelButton::createPanel( QWidget * ) + { + return NULL; + } + +//-----------------------------------------------------// +//-----------------------------------------------------// +//-----------------------------------------------------// +//-----------------------------------------------------// + +KSPanel::KSPanel(QWidget *parent, const char *name ) +: QWidget(parent,name) + { + } + +//-----------------------------------------------------// + +KSPanel::~KSPanel() + { + } + +//-----------------------------------------------------// + +void KSPanel::watchProperties() + { + watch_properties_of( this ); + } + +//-----------------------------------------------------// + +void KSPanel::watch_properties_of( QObject *o ) +// handles: +// QLineEdit +// QCheckBox +// QSpinBox +// QButton +// QMultiLineEdit +// KSAttrBtn + { + const QObjectList *fields = o->children(); + if ( fields ) { + QObjectListIt field( *fields ); + while ( (QObject *)field ) { + QObject *object = field; + // KSAttrBtn must be before QButton ! + if ( qstrcmp(object->className(),"QFrame") == 0 ) watch_properties_of( object ); + else if ( object->inherits("KSTextEdit") ) { object->installEventFilter( this ); connect( object, SIGNAL(changed()), this, SLOT(property_change()) ); } + else if ( object->inherits("QLineEdit") ) { object->installEventFilter( this ); connect( object, SIGNAL(returnPressed()), this, SLOT(property_change()) );} + else if ( object->inherits("KSAttrBtn") ) { object->installEventFilter( this ); connect( object, SIGNAL(attrChanged()), this, SLOT(property_change()) ); } + else if ( object->inherits("QButton") ) { object->installEventFilter( this ); connect( object, SIGNAL(clicked()), this, SLOT(property_change()) ); } + else if ( object->inherits("QMultiLineEdit") ) { object->installEventFilter( this ); connect( object, SIGNAL(textChanged()), this, SLOT(property_change()) ); } + else if ( object->inherits("QComboBox") ) { object->installEventFilter( this ); connect( object, SIGNAL(activated(const QString&)), this, SLOT(property_change_string(const QString&)) ); } + else if ( object->inherits("QSpinBox") ) { + QObjectList *l = object->queryList( "QLineEdit" ); + QObjectListIt it( *l ); + QObject *line_edit = it.current(); + if ( line_edit ) { + line_edit->installEventFilter( this ); + QWhatsThis::add( (QWidget *)line_edit, QWhatsThis::textFor((QWidget *)object) ); + } + delete l; + connect( object, SIGNAL(valueChanged(const QString&)), this, SLOT(property_change_string(const QString&)) ); + } + + + ++field; + } + } + } + +//-----------------------------------------------------// + +void KSPanel::property_change() + { + emit propertiesChanged(); + } +//-----------------------------------------------------// + +void KSPanel::property_change_string(const QString&) + { + emit propertiesChanged(); + } + +//-----------------------------------------------------// + +bool KSPanel::eventFilter ( QObject *o, QEvent *e ) + { + if ( o->isWidgetType() ) switch( e->type() ) { + case QEvent::Enter: emit message( QWhatsThis::textFor((QWidget *)o) ); break; + case QEvent::Leave: emit message( "" ); break; + default: break; + } + return FALSE; + } + +//-----------------------------------------------------// +//-----------------------------------------------------// +//-----------------------------------------------------// +//-----------------------------------------------------// + +KSAxisSelect::KSAxisSelect( QComboBox *parent, QSAxes *parentAxes, int axisType ) +:QObject( parent ) + { + m_parent = parent; + m_parent_axes = parentAxes; + m_axis_type = axisType; + + QWhatsThis::add( parent, axisName() + tr("\n\nAxis, which the current dataset is bound to" ) ); + } + +//-----------------------------------------------------// + +KSAxisSelect::~KSAxisSelect() + { + } + +//-----------------------------------------------------// + +QString KSAxisSelect::axisName() + { + QString type_name = "Unknown"; + switch( m_axis_type ) { + case QSAxis::XAxisType: type_name = "X axis "; break; + case QSAxis::YAxisType: type_name = "Y axis "; break; + case QSAxis::ZAxisType: type_name = "Z axis "; break; + case QSAxis::VAxisType: type_name = "V axis "; break; + } + return type_name; + } + +//-----------------------------------------------------// + +QSAxis *KSAxisSelect::selectedAxis() + { + if ( m_parent_axes == NULL ) return NULL; + + int index = m_parent->currentItem(); + int axis_of_type = 0; + int axis_nr; + for( axis_nr=0; axis_nraxisCount(); axis_nr++ ) { + if ( m_parent_axes->axis(axis_nr)->type() == m_axis_type ) { + if ( axis_of_type == index ) break; + axis_of_type += 1; + } + } + return m_parent_axes->axis(axis_nr); + } + +//-----------------------------------------------------// + +void KSAxisSelect::readProperties( QSAxis *selectedAxis ) + { + m_parent->clear(); + if( m_parent_axes == NULL ) return; + + int index = 0; + for( int axis_nr=0; axis_nraxisCount(); axis_nr++ ) + if ( m_parent_axes->axis(axis_nr)->type() == m_axis_type ) { + m_parent->insertItem( axisName() + m_parent_axes->axis(axis_nr)->title() ); + if ( m_parent_axes->axis(axis_nr) == selectedAxis ) m_parent->setCurrentItem( index ); + index++; + } + + } diff --git a/kmatplot/dialogs/kspanel.h b/kmatplot/dialogs/kspanel.h new file mode 100644 index 0000000..0265228 --- /dev/null +++ b/kmatplot/dialogs/kspanel.h @@ -0,0 +1,104 @@ +/*************************************************************************** + kspanel.h + ------------------- + begin : Sat Oct 7 2000 + copyright : (C) 2000 by Kamil Dobkowski + email : kamildobk@friko.onet.pl + ***************************************************************************/ + +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + +#ifndef KSPANEL_H +#define KSPANEL_H +#include +#include +#include +#include"../ksworkbook.h" + +//------------------------------------------------------------------------------------------------------// + +class KSPanel; +class QSCObject; +class QButtonGroup; +class QSData; + +/** + * Click it and the apriopriate panel is shown. + */ +class KSPanelButton : public QPushButton { + Q_OBJECT + public: + enum ButtonCategory { BGeneral, BAxes, BDatasets, BObject }; + static KSPanelButton *categoryButton( ButtonCategory category, QWidget *parent ); + KSPanelButton( QWidget *parent, KSWorkbook *workbook, ButtonCategory category, const QPixmap& icon, const QString& toolTip = QString::null, QSData *dataObject = NULL ); + virtual ~KSPanelButton(); + virtual KSPanel *createPanel( QWidget *panelParent ); + virtual bool isButtonFor( QSCObject *object, int category, int element ) { return false; } + ButtonCategory category() const { return m_category; } + QSData *dataObject() const { return m_data_object; } + + protected: + KSWorkbook *m_workbook; + ButtonCategory m_category; + QSData *m_data_object; + }; + +//------------------------------------------------------------------------------------------------------// + +/** + *Base class for config panels + *@author Kamil Dobkowski + */ +class KSPanel : public QWidget { + Q_OBJECT + public: + KSPanel(QWidget *parent=0, const char *name=0); + ~KSPanel(); + virtual void readProperties() = 0; + virtual void applyProperties() = 0; + virtual bool eventFilter( QObject*, QEvent* ); + + signals: + void propertiesChanged(); + void message( const QString& text ); + + protected: + virtual void watchProperties(); + virtual void watch_properties_of( QObject *o ); + private slots: + void property_change(); + void property_change_string(const QString&); +}; + +//------------------------------------------------------------------------------------------------------// + +class QComboBox; +class QSAxis; +class QSAxes; + +/** + * A little tool class which provides a list of available axes to select + */ +class KSAxisSelect : public QObject + { + Q_OBJECT + public: + KSAxisSelect( QComboBox *parent, QSAxes *parentAxes, int axisType ); + virtual ~KSAxisSelect(); + void readProperties( QSAxis *selected ); + QSAxis *selectedAxis(); + QString axisName(); + private: + QComboBox *m_parent; + QSAxes *m_parent_axes; + int m_axis_type; + }; + +#endif diff --git a/kmatplot/dialogs/kspanelaxisinterf.cpp b/kmatplot/dialogs/kspanelaxisinterf.cpp new file mode 100644 index 0000000..f5c214d --- /dev/null +++ b/kmatplot/dialogs/kspanelaxisinterf.cpp @@ -0,0 +1,227 @@ +/**************************************************************************** +** Form implementation generated from reading ui file './kspanelaxisinterf.ui' +** +** Created: śro mar 20 18:52:47 2002 +** by: The User Interface Compiler (uic) +** +** WARNING! All changes made in this file will be lost! +****************************************************************************/ +#include "kspanelaxisinterf.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "ksattrbtn.h" +#include "kspanel.h" +#include "kstextedit.h" + +/* + * Constructs a KSPanelAxisInterf which is a child of 'parent', with the + * name 'name'.' + */ +KSPanelAxisInterf::KSPanelAxisInterf( QWidget* parent, const char* name ) + : KSPanel( parent, name ) +{ + if ( !name ) + setName( "KSPanelAxisInterf" ); + resize( 537, 193 ); + setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)7, 0, 0, sizePolicy().hasHeightForWidth() ) ); + setCaption( trUtf8( "KSPanelForm" ) ); + KSPanelAxisInterfLayout = new QHBoxLayout( this, 1, 1, "KSPanelAxisInterfLayout"); + + Frame5 = new QFrame( this, "Frame5" ); + Frame5->setFrameShape( QFrame::StyledPanel ); + Frame5->setFrameShadow( QFrame::Raised ); + Frame5Layout = new QGridLayout( Frame5, 1, 1, 10, 1, "Frame5Layout"); + QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Minimum, QSizePolicy::Expanding ); + Frame5Layout->addItem( spacer, 5, 1 ); + + QLabel_6 = new QLabel( Frame5, "QLabel_6" ); + QFont QLabel_6_font( QLabel_6->font() ); + QLabel_6_font.setBold( TRUE ); + QLabel_6_font.setUnderline( TRUE ); + QLabel_6->setFont( QLabel_6_font ); + QLabel_6->setText( trUtf8( "Title" ) ); + + Frame5Layout->addMultiCellWidget( QLabel_6, 0, 0, 0, 1 ); + + titlePosPerp = new QLineEdit( Frame5, "titlePosPerp" ); + titlePosPerp->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)2, (QSizePolicy::SizeType)0, 0, 0, titlePosPerp->sizePolicy().hasHeightForWidth() ) ); + titlePosPerp->setMaximumSize( QSize( 100, 32767 ) ); + + Frame5Layout->addWidget( titlePosPerp, 3, 1 ); + + TextLabel1 = new QLabel( Frame5, "TextLabel1" ); + TextLabel1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)5, 0, 0, TextLabel1->sizePolicy().hasHeightForWidth() ) ); + TextLabel1->setText( trUtf8( "Title pos." ) ); + + Frame5Layout->addWidget( TextLabel1, 4, 0 ); + + TextLabel2 = new QLabel( Frame5, "TextLabel2" ); + TextLabel2->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)5, 0, 0, TextLabel2->sizePolicy().hasHeightForWidth() ) ); + TextLabel2->setText( trUtf8( "Title dist." ) ); + + Frame5Layout->addWidget( TextLabel2, 3, 0 ); + + titlePosPara = new QLineEdit( Frame5, "titlePosPara" ); + titlePosPara->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)2, (QSizePolicy::SizeType)0, 0, 0, titlePosPara->sizePolicy().hasHeightForWidth() ) ); + titlePosPara->setMaximumSize( QSize( 100, 32767 ) ); + + Frame5Layout->addWidget( titlePosPara, 4, 1 ); + + titleFont = new KSFontBtn( Frame5, "titleFont" ); + titleFont->setMinimumSize( QSize( 0, 22 ) ); + + Frame5Layout->addMultiCellWidget( titleFont, 2, 2, 0, 1 ); + + labele = new KSTextEdit( Frame5, "labele" ); + labele->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5, (QSizePolicy::SizeType)0, 0, 0, labele->sizePolicy().hasHeightForWidth() ) ); + labele->setMinimumSize( QSize( 0, 22 ) ); + + Frame5Layout->addMultiCellWidget( labele, 1, 1, 0, 1 ); + KSPanelAxisInterfLayout->addWidget( Frame5 ); + + Frame6 = new QFrame( this, "Frame6" ); + Frame6->setFrameShape( QFrame::StyledPanel ); + Frame6->setFrameShadow( QFrame::Raised ); + Frame6Layout = new QGridLayout( Frame6, 1, 1, 10, 1, "Frame6Layout"); + + TextLabel2_2 = new QLabel( Frame6, "TextLabel2_2" ); + QFont TextLabel2_2_font( TextLabel2_2->font() ); + TextLabel2_2_font.setBold( TRUE ); + TextLabel2_2_font.setUnderline( TRUE ); + TextLabel2_2->setFont( TextLabel2_2_font ); + TextLabel2_2->setText( trUtf8( "Range" ) ); + + Frame6Layout->addMultiCellWidget( TextLabel2_2, 0, 0, 0, 2 ); + QSpacerItem* spacer_2 = new QSpacerItem( 20, 20, QSizePolicy::Minimum, QSizePolicy::Expanding ); + Frame6Layout->addMultiCell( spacer_2, 5, 5, 1, 2 ); + + QLabel_2 = new QLabel( Frame6, "QLabel_2" ); + QLabel_2->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)5, 0, 0, QLabel_2->sizePolicy().hasHeightForWidth() ) ); + QLabel_2->setMinimumSize( QSize( 40, 0 ) ); + QLabel_2->setText( trUtf8( "Max" ) ); + + Frame6Layout->addWidget( QLabel_2, 1, 0 ); + + QLabel_1 = new QLabel( Frame6, "QLabel_1" ); + QLabel_1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)5, 0, 0, QLabel_1->sizePolicy().hasHeightForWidth() ) ); + QLabel_1->setMinimumSize( QSize( 40, 0 ) ); + QLabel_1->setText( trUtf8( "Min" ) ); + + Frame6Layout->addWidget( QLabel_1, 2, 0 ); + + QLabel_3 = new QLabel( Frame6, "QLabel_3" ); + QLabel_3->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)5, 0, 0, QLabel_3->sizePolicy().hasHeightForWidth() ) ); + QLabel_3->setMinimumSize( QSize( 55, 0 ) ); + QLabel_3->setText( trUtf8( "Kind/Base" ) ); + + Frame6Layout->addWidget( QLabel_3, 3, 0 ); + + scrollable = new QCheckBox( Frame6, "scrollable" ); + scrollable->setText( trUtf8( "Scrollable range" ) ); + + Frame6Layout->addMultiCellWidget( scrollable, 4, 4, 0, 2 ); + + abasee = new QLineEdit( Frame6, "abasee" ); + abasee->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)2, (QSizePolicy::SizeType)0, 0, 0, abasee->sizePolicy().hasHeightForWidth() ) ); + abasee->setMaximumSize( QSize( 55, 32767 ) ); + + Frame6Layout->addWidget( abasee, 3, 2 ); + + amine = new QLineEdit( Frame6, "amine" ); + amine->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)0, 1, 0, amine->sizePolicy().hasHeightForWidth() ) ); + amine->setMaximumSize( QSize( 130, 32767 ) ); + + Frame6Layout->addMultiCellWidget( amine, 2, 2, 1, 2 ); + + amaxe = new QLineEdit( Frame6, "amaxe" ); + amaxe->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)0, 1, 0, amaxe->sizePolicy().hasHeightForWidth() ) ); + amaxe->setMaximumSize( QSize( 130, 32767 ) ); + + Frame6Layout->addMultiCellWidget( amaxe, 1, 1, 1, 2 ); + + ascalel = new QComboBox( FALSE, Frame6, "ascalel" ); + ascalel->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)2, (QSizePolicy::SizeType)0, 0, 0, ascalel->sizePolicy().hasHeightForWidth() ) ); + ascalel->setMaximumSize( QSize( 70, 32767 ) ); + ascalel->setInsertionPolicy( QComboBox::AtTop ); + + Frame6Layout->addWidget( ascalel, 3, 1 ); + KSPanelAxisInterfLayout->addWidget( Frame6 ); + + Frame7 = new QFrame( this, "Frame7" ); + Frame7->setFrameShape( QFrame::StyledPanel ); + Frame7->setFrameShadow( QFrame::Raised ); + Frame7Layout = new QGridLayout( Frame7, 1, 1, 10, 1, "Frame7Layout"); + + visible = new QCheckBox( Frame7, "visible" ); + QFont visible_font( visible->font() ); + visible_font.setBold( TRUE ); + visible_font.setUnderline( TRUE ); + visible->setFont( visible_font ); + visible->setText( trUtf8( "Appearance" ) ); + + Frame7Layout->addMultiCellWidget( visible, 0, 0, 0, 1 ); + + opposite = new QCheckBox( Frame7, "opposite" ); + opposite->setText( trUtf8( "Opposite side" ) ); + + Frame7Layout->addMultiCellWidget( opposite, 3, 3, 0, 1 ); + QSpacerItem* spacer_3 = new QSpacerItem( 20, 20, QSizePolicy::Minimum, QSizePolicy::Expanding ); + Frame7Layout->addItem( spacer_3, 5, 0 ); + + areversed = new QCheckBox( Frame7, "areversed" ); + areversed->setText( trUtf8( "Reversed direction" ) ); + + Frame7Layout->addMultiCellWidget( areversed, 4, 4, 0, 1 ); + + lengthl_2 = new QLabel( Frame7, "lengthl_2" ); + lengthl_2->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)5, 0, 0, lengthl_2->sizePolicy().hasHeightForWidth() ) ); + lengthl_2->setText( trUtf8( "Position" ) ); + + Frame7Layout->addWidget( lengthl_2, 2, 0 ); + + alene = new QLineEdit( Frame7, "alene" ); + alene->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)2, (QSizePolicy::SizeType)0, 0, 0, alene->sizePolicy().hasHeightForWidth() ) ); + alene->setMaximumSize( QSize( 100, 32767 ) ); + + Frame7Layout->addWidget( alene, 2, 1 ); + + Layout3 = new QHBoxLayout( 0, 0, 1, "Layout3"); + + axisArrow1 = new KSArrowBtn( Frame7, "axisArrow1" ); + axisArrow1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)5, 0, 0, axisArrow1->sizePolicy().hasHeightForWidth() ) ); + axisArrow1->setMinimumSize( QSize( 35, 22 ) ); + Layout3->addWidget( axisArrow1 ); + + axisLine = new KSLineBtn( Frame7, "axisLine" ); + axisLine->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)5, 0, 0, axisLine->sizePolicy().hasHeightForWidth() ) ); + axisLine->setMinimumSize( QSize( 0, 22 ) ); + axisLine->setMaximumSize( QSize( 65, 32767 ) ); + Layout3->addWidget( axisLine ); + + axisArrow2 = new KSArrowBtn( Frame7, "axisArrow2" ); + axisArrow2->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)5, 0, 0, axisArrow2->sizePolicy().hasHeightForWidth() ) ); + axisArrow2->setMinimumSize( QSize( 35, 22 ) ); + Layout3->addWidget( axisArrow2 ); + + Frame7Layout->addMultiCellLayout( Layout3, 1, 1, 0, 1 ); + KSPanelAxisInterfLayout->addWidget( Frame7 ); +} + +/* + * Destroys the object and frees any allocated resources + */ +KSPanelAxisInterf::~KSPanelAxisInterf() +{ + // no need to delete child widgets, Qt does it all for us +} + +#include "kspanelaxisinterf.moc" diff --git a/kmatplot/dialogs/kspanelaxisinterf.ui b/kmatplot/dialogs/kspanelaxisinterf.ui new file mode 100644 index 0000000..4d81dca --- /dev/null +++ b/kmatplot/dialogs/kspanelaxisinterf.ui @@ -0,0 +1,680 @@ + +KSPanelAxisInterf + + + KSPanelAxisInterf + + + + 0 + 0 + 537 + 193 + + + + + 7 + 7 + 0 + 0 + + + + KSPanelForm + + + + unnamed + + + 1 + + + 1 + + + + Frame5 + + + StyledPanel + + + Raised + + + + unnamed + + + 10 + + + 1 + + + + Spacer1 + + + Vertical + + + Expanding + + + + 20 + 20 + + + + + + QLabel_6 + + + + 1 + 1 + + + + Title + + + + + titlePosPerp + + + + 2 + 0 + 0 + 0 + + + + + 100 + 32767 + + + + + + TextLabel1 + + + + 3 + 5 + 0 + 0 + + + + Title pos. + + + + + TextLabel2 + + + + 3 + 5 + 0 + 0 + + + + Title dist. + + + + + titlePosPara + + + + 2 + 0 + 0 + 0 + + + + + 100 + 32767 + + + + + + titleFont + + + + 0 + 22 + + + + + + labele + + + + 5 + 0 + 0 + 0 + + + + + 0 + 22 + + + + + + + + Frame6 + + + StyledPanel + + + Raised + + + + unnamed + + + 10 + + + 1 + + + + TextLabel2_2 + + + + 1 + 1 + + + + Range + + + + + Spacer3 + + + Vertical + + + Expanding + + + + 20 + 20 + + + + + + QLabel_2 + + + + 3 + 5 + 0 + 0 + + + + + 40 + 0 + + + + Max + + + + + QLabel_1 + + + + 3 + 5 + 0 + 0 + + + + + 40 + 0 + + + + Min + + + + + QLabel_3 + + + + 3 + 5 + 0 + 0 + + + + + 55 + 0 + + + + Kind/Base + + + + + scrollable + + + Scrollable range + + + + + abasee + + + + 2 + 0 + 0 + 0 + + + + + 55 + 32767 + + + + + + amine + + + + 7 + 0 + 1 + 0 + + + + + 130 + 32767 + + + + + + amaxe + + + + 7 + 0 + 1 + 0 + + + + + 130 + 32767 + + + + + + ascalel + + + + 2 + 0 + 0 + 0 + + + + + 70 + 32767 + + + + AtTop + + + + + + + Frame7 + + + StyledPanel + + + Raised + + + + unnamed + + + 10 + + + 1 + + + + visible + + + + 1 + 1 + + + + Appearance + + + + + opposite + + + Opposite side + + + + + Spacer2 + + + Vertical + + + Expanding + + + + 20 + 20 + + + + + + areversed + + + Reversed direction + + + + + lengthl_2 + + + + 3 + 5 + 0 + 0 + + + + Position + + + + + alene + + + + 2 + 0 + 0 + 0 + + + + + 100 + 32767 + + + + + + Layout3 + + + + unnamed + + + 0 + + + 1 + + + + axisArrow1 + + + + 0 + 5 + 0 + 0 + + + + + 35 + 22 + + + + + + axisLine + + + + 7 + 5 + 0 + 0 + + + + + 0 + 22 + + + + + 65 + 32767 + + + + + + axisArrow2 + + + + 0 + 5 + 0 + 0 + + + + + 35 + 22 + + + + + + + + + + + + KSPanel +
kspanel.h
+ + 500 + 140 + + 1 + + 0 + 0 + 0 + 0 + + image0 +
+ + KSFontBtn +
ksattrbtn.h
+ + -1 + 22 + + 0 + + 5 + 5 + 0 + 0 + + image1 +
+ + KSLineBtn +
ksattrbtn.h
+ + -1 + 22 + + 0 + + 5 + 5 + 0 + 0 + + image2 +
+ + KSArrowBtn +
ksattrbtn.h
+ + -1 + 22 + + 0 + + 5 + 5 + 0 + 0 + + image3 +
+ + KSTextEdit +
kstextedit.h
+ + -1 + -1 + + 0 + + 5 + 5 + 0 + 0 + + image4 +
+
+ + + 789cd3d7528808f055d0d2e72a2e492cc94c5648ce482c52d04a29cdcdad8c8eb5ade65232540043251d2e253d856405e554300073956aadb900494e10c6 + + + 789cd3d7528808f055d0d2e72a2e492cc94c5648ce482c52d04a29cdcdad8c8eb5ade6523232520022630543251d2e253d856405bffcbc54105b19c856360003103711c44d0303b04aac80721965651c32ca8989ca24ca002590a4506594b1cb002590cd234646192c8690429101014c19b0c32040195d46591945134c46196e334c8aa00cc2fb70164c060cf49059b48c5314995a6b2e00c5aa7ebc + + + 789cd3d7528808f055d0d2e72a2e492cc94c5648ce482c52d04a29cdcdad8c8eb5ade6523234530022630543251d2e253d856405bffcbc54103b11c8564e3449344c3401719541dcb434032000ab440338c59481004d4c5919551022a6a7872c08370f9b1892207e31842001b14488a0b232b23fb089e9411d8a2606f6106a1840fc88355c6aadb9009dd649aa + + + 789c75d0c10a82401006e0bb4f313837094d3124a247283a06d161662bea6041d921a2776f67db44d7f1670ffbefc7ae835902dbcd0a922c7a34d45c0c9833dd21393cebfab5db2fdf515c1460d70cf27812c5291858dfae47d9a3dde3d445aa915a7135af582a4ba592722aa592d4938b7b474d28e8a30849581147ac8a251e131e112444552c708a66280e64f6503ca42907d242f80f7ad0953e7424809fa0024ee47000fe0e0dc17f4781ff04a377346aa7c691d794c49f45f4052a748685 + + + 789cd3d7528808f055d0d2e72a2e492cc94c5648ce482c52d04a29cdcdad8c8eb5ade6523234530022630543251d2e253d856405bffcbc54105b19c856360003103711c44d490541b04a34805b4c593911ca0731d0c49413812cfc7a95c18a9561ea4022890802530caa5719a40fac17490c9b3a9ce6a1da4bb47f8910abb5e602003a1250e8 + + + +
diff --git a/kmatplot/dialogs/kspanelcarrowinterf.cpp b/kmatplot/dialogs/kspanelcarrowinterf.cpp new file mode 100644 index 0000000..caeebed --- /dev/null +++ b/kmatplot/dialogs/kspanelcarrowinterf.cpp @@ -0,0 +1,139 @@ +/**************************************************************************** +** Form implementation generated from reading ui file './kspanelcarrowinterf.ui' +** +** Created: śro mar 20 18:52:48 2002 +** by: The User Interface Compiler (uic) +** +** WARNING! All changes made in this file will be lost! +****************************************************************************/ +#include "kspanelcarrowinterf.h" + +#include +#include +#include +#include +#include +#include +#include +#include "ksattrbtn.h" +#include "kspanel.h" + +/* + * Constructs a KSPanelCArrowInterf which is a child of 'parent', with the + * name 'name'.' + */ +KSPanelCArrowInterf::KSPanelCArrowInterf( QWidget* parent, const char* name ) + : KSPanel( parent, name ) +{ + if ( !name ) + setName( "KSPanelCArrowInterf" ); + resize( 500, 140 ); + setCaption( trUtf8( "KSPanelForm" ) ); + KSPanelCArrowInterfLayout = new QHBoxLayout( this, 1, 1, "KSPanelCArrowInterfLayout"); + + Frame5 = new QFrame( this, "Frame5" ); + Frame5->setFrameShape( QFrame::StyledPanel ); + Frame5->setFrameShadow( QFrame::Raised ); + Frame5Layout = new QGridLayout( Frame5, 1, 1, 10, 1, "Frame5Layout"); + + TextLabel1_2 = new QLabel( Frame5, "TextLabel1_2" ); + TextLabel1_2->setText( trUtf8( "Dart" ) ); + + Frame5Layout->addWidget( TextLabel1_2, 1, 0 ); + + TextLabel2_2 = new QLabel( Frame5, "TextLabel2_2" ); + TextLabel2_2->setText( trUtf8( "Point" ) ); + + Frame5Layout->addWidget( TextLabel2_2, 2, 0 ); + + QLabel_1 = new QLabel( Frame5, "QLabel_1" ); + QLabel_1->setMinimumSize( QSize( 0, 25 ) ); + QFont QLabel_1_font( QLabel_1->font() ); + QLabel_1_font.setBold( TRUE ); + QLabel_1_font.setUnderline( TRUE ); + QLabel_1->setFont( QLabel_1_font ); + QLabel_1->setText( trUtf8( "Arrow origin" ) ); + + Frame5Layout->addMultiCellWidget( QLabel_1, 0, 0, 0, 1 ); + QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Minimum, QSizePolicy::Expanding ); + Frame5Layout->addMultiCell( spacer, 3, 3, 0, 1 ); + + originArrow = new KSArrowBtn( Frame5, "originArrow" ); + originArrow->setMinimumSize( QSize( 0, 22 ) ); + + Frame5Layout->addWidget( originArrow, 1, 1 ); + + originPoint = new KSPointBtn( Frame5, "originPoint" ); + originPoint->setMinimumSize( QSize( 0, 22 ) ); + + Frame5Layout->addWidget( originPoint, 2, 1 ); + KSPanelCArrowInterfLayout->addWidget( Frame5 ); + + Frame4 = new QFrame( this, "Frame4" ); + Frame4->setFrameShape( QFrame::StyledPanel ); + Frame4->setFrameShadow( QFrame::Raised ); + Frame4Layout = new QGridLayout( Frame4, 1, 1, 10, 1, "Frame4Layout"); + + QLabel_2 = new QLabel( Frame4, "QLabel_2" ); + QLabel_2->setText( trUtf8( "Line" ) ); + + Frame4Layout->addWidget( QLabel_2, 1, 0 ); + QSpacerItem* spacer_2 = new QSpacerItem( 20, 20, QSizePolicy::Minimum, QSizePolicy::Expanding ); + Frame4Layout->addItem( spacer_2, 2, 2 ); + + arrowLine = new KSLineBtn( Frame4, "arrowLine" ); + arrowLine->setMinimumSize( QSize( 0, 22 ) ); + + Frame4Layout->addMultiCellWidget( arrowLine, 1, 1, 1, 2 ); + QSpacerItem* spacer_3 = new QSpacerItem( 20, 20, QSizePolicy::Minimum, QSizePolicy::Expanding ); + Frame4Layout->addItem( spacer_3, 0, 1 ); + KSPanelCArrowInterfLayout->addWidget( Frame4 ); + + Frame3 = new QFrame( this, "Frame3" ); + Frame3->setFrameShape( QFrame::StyledPanel ); + Frame3->setFrameShadow( QFrame::Raised ); + Frame3Layout = new QGridLayout( Frame3, 1, 1, 10, 1, "Frame3Layout"); + + QLabel_3 = new QLabel( Frame3, "QLabel_3" ); + QLabel_3->setMinimumSize( QSize( 0, 25 ) ); + QFont QLabel_3_font( QLabel_3->font() ); + QLabel_3_font.setBold( TRUE ); + QLabel_3_font.setUnderline( TRUE ); + QLabel_3->setFont( QLabel_3_font ); + QLabel_3->setText( trUtf8( "Arrow end" ) ); + + Frame3Layout->addMultiCellWidget( QLabel_3, 0, 0, 0, 1 ); + + TextLabel1 = new QLabel( Frame3, "TextLabel1" ); + TextLabel1->setText( trUtf8( "Dart" ) ); + + Frame3Layout->addWidget( TextLabel1, 1, 0 ); + + TextLabel2 = new QLabel( Frame3, "TextLabel2" ); + TextLabel2->setText( trUtf8( "Point" ) ); + + Frame3Layout->addWidget( TextLabel2, 2, 0 ); + QSpacerItem* spacer_4 = new QSpacerItem( 20, 20, QSizePolicy::Minimum, QSizePolicy::Expanding ); + Frame3Layout->addItem( spacer_4, 3, 1 ); + + endArrow = new KSArrowBtn( Frame3, "endArrow" ); + endArrow->setMinimumSize( QSize( 0, 22 ) ); + + Frame3Layout->addWidget( endArrow, 1, 1 ); + + endPoint = new KSPointBtn( Frame3, "endPoint" ); + endPoint->setMinimumSize( QSize( 0, 22 ) ); + + Frame3Layout->addWidget( endPoint, 2, 1 ); + KSPanelCArrowInterfLayout->addWidget( Frame3 ); +} + +/* + * Destroys the object and frees any allocated resources + */ +KSPanelCArrowInterf::~KSPanelCArrowInterf() +{ + // no need to delete child widgets, Qt does it all for us +} + +#include "kspanelcarrowinterf.moc" diff --git a/kmatplot/dialogs/kspanelcarrowinterf.ui b/kmatplot/dialogs/kspanelcarrowinterf.ui new file mode 100644 index 0000000..4f4462f --- /dev/null +++ b/kmatplot/dialogs/kspanelcarrowinterf.ui @@ -0,0 +1,380 @@ + +KSPanelCArrowInterf + + + KSPanelCArrowInterf + + + + 0 + 0 + 500 + 140 + + + + KSPanelForm + + + + unnamed + + + 1 + + + 1 + + + + Frame5 + + + StyledPanel + + + Raised + + + + unnamed + + + 10 + + + 1 + + + + TextLabel1_2 + + + Dart + + + + + TextLabel2_2 + + + Point + + + + + QLabel_1 + + + + 0 + 25 + + + + + 1 + 1 + + + + Arrow origin + + + + + Spacer1 + + + Vertical + + + Expanding + + + + 20 + 20 + + + + + + originArrow + + + + 0 + 22 + + + + + + originPoint + + + + 0 + 22 + + + + + + + + Frame4 + + + StyledPanel + + + Raised + + + + unnamed + + + 10 + + + 1 + + + + QLabel_2 + + + Line + + + + + Spacer2 + + + Vertical + + + Expanding + + + + 20 + 20 + + + + + + arrowLine + + + + 0 + 22 + + + + + + Spacer3 + + + Vertical + + + Expanding + + + + 20 + 20 + + + + + + + + Frame3 + + + StyledPanel + + + Raised + + + + unnamed + + + 10 + + + 1 + + + + QLabel_3 + + + + 0 + 25 + + + + + 1 + 1 + + + + Arrow end + + + + + TextLabel1 + + + Dart + + + + + TextLabel2 + + + Point + + + + + Spacer4 + + + Vertical + + + Expanding + + + + 20 + 20 + + + + + + endArrow + + + + 0 + 22 + + + + + + endPoint + + + + 0 + 22 + + + + + + + + + + KSPanel +
kspanel.h
+ + 500 + 140 + + 1 + + 0 + 0 + 0 + 0 + + image0 +
+ + KSLineBtn +
ksattrbtn.h
+ + -1 + 22 + + 0 + + 5 + 5 + 0 + 0 + + image1 +
+ + KSArrowBtn +
ksattrbtn.h
+ + -1 + 22 + + 0 + + 5 + 5 + 0 + 0 + + image2 +
+ + KSPointBtn +
ksattrbtn.h
+ + -1 + 22 + + 0 + + 5 + 5 + 0 + 0 + + image3 +
+
+ + + 789cd3d7528808f055d0d2e72a2e492cc94c5648ce482c52d04a29cdcdad8c8eb5ade65232540043251d2e253d856405e554300073956aadb900494e10c6 + + + 789cd3d7528808f055d0d2e72a2e492cc94c5648ce482c52d04a29cdcdad8c8eb5ade6523234530022630543251d2e253d856405bffcbc54103b11c8564e3449344c3401719541dcb434032000ab440338c59481004d4c5919551022a6a7872c08370f9b1892207e31842001b14488a0b232b23fb089e9411d8a2606f6106a1840fc88355c6aadb9009dd649aa + + + 789c75d0c10a82401006e0bb4f313837094d3124a247283a06d161662bea6041d921a2776f67db44d7f1670ffbefc7ae835902dbcd0a922c7a34d45c0c9833dd21393cebfab5db2fdf515c1460d70cf27812c5291858dfae47d9a3dde3d445aa915a7135af582a4ba592722aa592d4938b7b474d28e8a30849581147ac8a251e131e112444552c708a66280e64f6503ca42907d242f80f7ad0953e7424809fa0024ee47000fe0e0dc17f4781ff04a377346aa7c691d794c49f45f4052a748685 + + + 789cd3d7528808f055d0d2e72a2e492cc94c5648ce482c52d04a29cdcdad8c8eb5ade6523234530022630543251d2e253d856405bffcbc54105b19c856360003103711c44d0303b04a34408c98b2b232ba98726262a2324962ca20538002c8e641059491ed8588296311435387300f451d6562ca308bb1864bad3517007a684bc0 + + + +
diff --git a/kmatplot/dialogs/kspanelclabelinterf.cpp b/kmatplot/dialogs/kspanelclabelinterf.cpp new file mode 100644 index 0000000..0fd536c --- /dev/null +++ b/kmatplot/dialogs/kspanelclabelinterf.cpp @@ -0,0 +1,223 @@ +/**************************************************************************** +** Form implementation generated from reading ui file './kspanelclabelinterf.ui' +** +** Created: śro mar 20 18:52:50 2002 +** by: The User Interface Compiler (uic) +** +** WARNING! All changes made in this file will be lost! +****************************************************************************/ +#include "kspanelclabelinterf.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "ksattrbtn.h" +#include "kspanel.h" + +/* + * Constructs a KSPanelCLabelInterf which is a child of 'parent', with the + * name 'name'.' + */ +KSPanelCLabelInterf::KSPanelCLabelInterf( QWidget* parent, const char* name ) + : KSPanel( parent, name ) +{ + if ( !name ) + setName( "KSPanelCLabelInterf" ); + resize( 500, 140 ); + setCaption( trUtf8( "KSPanelForm" ) ); + KSPanelCLabelInterfLayout = new QHBoxLayout( this, 1, 1, "KSPanelCLabelInterfLayout"); + + Frame5 = new QFrame( this, "Frame5" ); + Frame5->setFrameShape( QFrame::StyledPanel ); + Frame5->setFrameShadow( QFrame::Raised ); + Frame5Layout = new QGridLayout( Frame5, 1, 1, 10, 1, "Frame5Layout"); + + TextLabel1 = new QLabel( Frame5, "TextLabel1" ); + TextLabel1->setMinimumSize( QSize( 0, 25 ) ); + QFont TextLabel1_font( TextLabel1->font() ); + TextLabel1_font.setBold( TRUE ); + TextLabel1_font.setUnderline( TRUE ); + TextLabel1->setFont( TextLabel1_font ); + TextLabel1->setText( trUtf8( "Labels" ) ); + + Frame5Layout->addWidget( TextLabel1, 0, 0 ); + QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Minimum, QSizePolicy::Expanding ); + Frame5Layout->addItem( spacer, 4, 1 ); + + QLabel_10 = new QLabel( Frame5, "QLabel_10" ); + QLabel_10->setText( trUtf8( "Background" ) ); + + Frame5Layout->addMultiCellWidget( QLabel_10, 3, 3, 0, 1 ); + + QLabel_9 = new QLabel( Frame5, "QLabel_9" ); + QLabel_9->setText( trUtf8( "Frame" ) ); + + Frame5Layout->addMultiCellWidget( QLabel_9, 2, 2, 0, 1 ); + + QLabel_8 = new QLabel( Frame5, "QLabel_8" ); + QLabel_8->setText( trUtf8( "Font" ) ); + + Frame5Layout->addMultiCellWidget( QLabel_8, 1, 1, 0, 1 ); + + labelFill = new KSFillBtn( Frame5, "labelFill" ); + labelFill->setMinimumSize( QSize( 0, 22 ) ); + + Frame5Layout->addWidget( labelFill, 3, 2 ); + + labelFrame = new KSLineBtn( Frame5, "labelFrame" ); + labelFrame->setMinimumSize( QSize( 0, 22 ) ); + + Frame5Layout->addWidget( labelFrame, 2, 2 ); + + labelFont = new KSFontBtn( Frame5, "labelFont" ); + labelFont->setMinimumSize( QSize( 0, 22 ) ); + + Frame5Layout->addWidget( labelFont, 1, 2 ); + KSPanelCLabelInterfLayout->addWidget( Frame5 ); + + Frame4 = new QFrame( this, "Frame4" ); + Frame4->setFrameShape( QFrame::StyledPanel ); + Frame4->setFrameShadow( QFrame::Raised ); + Frame4Layout = new QGridLayout( Frame4, 1, 1, 10, 1, "Frame4Layout"); + + shadowfillp = new QWidget( Frame4, "shadowfillp" ); + + Frame4Layout->addWidget( shadowfillp, 0, 0 ); + + shadowdx = new QSpinBox( Frame4, "shadowdx" ); + shadowdx->setMaxValue( 99 ); + shadowdx->setMinValue( -99 ); + + Frame4Layout->addWidget( shadowdx, 1, 1 ); + + shadowdy = new QSpinBox( Frame4, "shadowdy" ); + shadowdy->setMaxValue( 99 ); + shadowdy->setMinValue( -99 ); + + Frame4Layout->addWidget( shadowdy, 2, 1 ); + + QLabel_13 = new QLabel( Frame4, "QLabel_13" ); + QLabel_13->setText( trUtf8( "DX" ) ); + + Frame4Layout->addWidget( QLabel_13, 1, 0 ); + + QLabel_14 = new QLabel( Frame4, "QLabel_14" ); + QLabel_14->setMinimumSize( QSize( 0, 25 ) ); + QFont QLabel_14_font( QLabel_14->font() ); + QLabel_14_font.setBold( TRUE ); + QLabel_14_font.setUnderline( TRUE ); + QLabel_14->setFont( QLabel_14_font ); + QLabel_14->setText( trUtf8( "Shadow" ) ); + + Frame4Layout->addMultiCellWidget( QLabel_14, 0, 0, 0, 1 ); + QSpacerItem* spacer_2 = new QSpacerItem( 20, 20, QSizePolicy::Minimum, QSizePolicy::Expanding ); + Frame4Layout->addItem( spacer_2, 4, 1 ); + + shadowFill = new KSFillBtn( Frame4, "shadowFill" ); + shadowFill->setMinimumSize( QSize( 0, 22 ) ); + + Frame4Layout->addWidget( shadowFill, 3, 1 ); + + QLabel_15 = new QLabel( Frame4, "QLabel_15" ); + QLabel_15->setText( trUtf8( "DY" ) ); + + Frame4Layout->addWidget( QLabel_15, 2, 0 ); + + TextLabel1_2 = new QLabel( Frame4, "TextLabel1_2" ); + TextLabel1_2->setText( trUtf8( "Fill" ) ); + + Frame4Layout->addWidget( TextLabel1_2, 3, 0 ); + KSPanelCLabelInterfLayout->addWidget( Frame4 ); + + Frame3 = new QFrame( this, "Frame3" ); + Frame3->setFrameShape( QFrame::StyledPanel ); + Frame3->setFrameShadow( QFrame::Raised ); + Frame3Layout = new QGridLayout( Frame3, 1, 1, 11, 6, "Frame3Layout"); + + ButtonGroup1 = new QButtonGroup( Frame3, "ButtonGroup1" ); + QFont ButtonGroup1_font( ButtonGroup1->font() ); + ButtonGroup1_font.setBold( TRUE ); + ButtonGroup1_font.setUnderline( TRUE ); + ButtonGroup1->setFont( ButtonGroup1_font ); + ButtonGroup1->setFrameShape( QButtonGroup::NoFrame ); + ButtonGroup1->setTitle( trUtf8( "Align" ) ); + ButtonGroup1->setColumnLayout(0, Qt::Vertical ); + ButtonGroup1->layout()->setSpacing( 6 ); + ButtonGroup1->layout()->setMargin( 19 ); + ButtonGroup1Layout = new QGridLayout( ButtonGroup1->layout() ); + ButtonGroup1Layout->setAlignment( Qt::AlignTop ); + + _cc = new QRadioButton( ButtonGroup1, "_cc" ); + _cc->setText( trUtf8( "" ) ); + + ButtonGroup1Layout->addWidget( _cc, 1, 1 ); + + _bc = new QRadioButton( ButtonGroup1, "_bc" ); + _bc->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)1, (QSizePolicy::SizeType)1, 0, 0, _bc->sizePolicy().hasHeightForWidth() ) ); + _bc->setText( trUtf8( "" ) ); + + ButtonGroup1Layout->addWidget( _bc, 2, 1 ); + + _bl = new QRadioButton( ButtonGroup1, "_bl" ); + _bl->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)1, (QSizePolicy::SizeType)1, 0, 0, _bl->sizePolicy().hasHeightForWidth() ) ); + _bl->setText( trUtf8( "" ) ); + + ButtonGroup1Layout->addWidget( _bl, 2, 0 ); + + _cl = new QRadioButton( ButtonGroup1, "_cl" ); + _cl->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)1, (QSizePolicy::SizeType)1, 0, 0, _cl->sizePolicy().hasHeightForWidth() ) ); + _cl->setText( trUtf8( "" ) ); + + ButtonGroup1Layout->addWidget( _cl, 1, 0 ); + + _tl = new QRadioButton( ButtonGroup1, "_tl" ); + _tl->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)1, (QSizePolicy::SizeType)1, 0, 0, _tl->sizePolicy().hasHeightForWidth() ) ); + _tl->setText( trUtf8( "" ) ); + + ButtonGroup1Layout->addWidget( _tl, 0, 0 ); + + _tc = new QRadioButton( ButtonGroup1, "_tc" ); + _tc->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)1, (QSizePolicy::SizeType)1, 0, 0, _tc->sizePolicy().hasHeightForWidth() ) ); + _tc->setText( trUtf8( "" ) ); + + ButtonGroup1Layout->addWidget( _tc, 0, 1 ); + + _tr = new QRadioButton( ButtonGroup1, "_tr" ); + _tr->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)1, (QSizePolicy::SizeType)1, 0, 0, _tr->sizePolicy().hasHeightForWidth() ) ); + _tr->setText( trUtf8( "" ) ); + + ButtonGroup1Layout->addWidget( _tr, 0, 2 ); + + _br = new QRadioButton( ButtonGroup1, "_br" ); + _br->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)1, (QSizePolicy::SizeType)1, 0, 0, _br->sizePolicy().hasHeightForWidth() ) ); + _br->setText( trUtf8( "" ) ); + + ButtonGroup1Layout->addWidget( _br, 2, 2 ); + + _cr = new QRadioButton( ButtonGroup1, "_cr" ); + _cr->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)1, (QSizePolicy::SizeType)1, 0, 0, _cr->sizePolicy().hasHeightForWidth() ) ); + _cr->setText( trUtf8( "" ) ); + + ButtonGroup1Layout->addWidget( _cr, 1, 2 ); + + Frame3Layout->addWidget( ButtonGroup1, 0, 0 ); + KSPanelCLabelInterfLayout->addWidget( Frame3 ); +} + +/* + * Destroys the object and frees any allocated resources + */ +KSPanelCLabelInterf::~KSPanelCLabelInterf() +{ + // no need to delete child widgets, Qt does it all for us +} + +#include "kspanelclabelinterf.moc" diff --git a/kmatplot/dialogs/kspanelclabelinterf.ui b/kmatplot/dialogs/kspanelclabelinterf.ui new file mode 100644 index 0000000..4bd33ea --- /dev/null +++ b/kmatplot/dialogs/kspanelclabelinterf.ui @@ -0,0 +1,534 @@ + +KSPanelCLabelInterf + + + KSPanelCLabelInterf + + + + 0 + 0 + 500 + 140 + + + + KSPanelForm + + + + unnamed + + + 1 + + + 1 + + + + Frame5 + + + StyledPanel + + + Raised + + + + unnamed + + + 10 + + + 1 + + + + TextLabel1 + + + + 0 + 25 + + + + + 1 + 1 + + + + Labels + + + + + Spacer2 + + + Vertical + + + Expanding + + + + 20 + 20 + + + + + + QLabel_10 + + + Background + + + + + QLabel_9 + + + Frame + + + + + QLabel_8 + + + Font + + + + + labelFill + + + + 0 + 22 + + + + + + labelFrame + + + + 0 + 22 + + + + + + labelFont + + + + 0 + 22 + + + + + + + + Frame4 + + + StyledPanel + + + Raised + + + + unnamed + + + 10 + + + 1 + + + + shadowfillp + + + + + shadowdx + + + 99 + + + -99 + + + + + shadowdy + + + 99 + + + -99 + + + + + QLabel_13 + + + DX + + + + + QLabel_14 + + + + 0 + 25 + + + + + 1 + 1 + + + + Shadow + + + + + Spacer1 + + + Vertical + + + Expanding + + + + 20 + 20 + + + + + + shadowFill + + + + 0 + 22 + + + + + + QLabel_15 + + + DY + + + + + TextLabel1_2 + + + Fill + + + + + + + Frame3 + + + StyledPanel + + + Raised + + + + unnamed + + + 11 + + + 6 + + + + ButtonGroup1 + + + + 1 + 1 + + + + NoFrame + + + Align + + + + unnamed + + + 19 + + + 6 + + + + _cc + + + + + + + + _bc + + + + 1 + 1 + 0 + 0 + + + + + + + + + _bl + + + + 1 + 1 + 0 + 0 + + + + + + + + + _cl + + + + 1 + 1 + 0 + 0 + + + + + + + + + _tl + + + + 1 + 1 + 0 + 0 + + + + + + + + + _tc + + + + 1 + 1 + 0 + 0 + + + + + + + + + _tr + + + + 1 + 1 + 0 + 0 + + + + + + + + + _br + + + + 1 + 1 + 0 + 0 + + + + + + + + + _cr + + + + 1 + 1 + 0 + 0 + + + + + + + + + + + + + + + KSFillBtn +
ksattrbtn.h
+ + -1 + 22 + + 0 + + 5 + 5 + 0 + 0 + + image0 +
+ + KSPanel +
kspanel.h
+ + 500 + 140 + + 1 + + 0 + 0 + 0 + 0 + + image1 +
+ + KSFontBtn +
ksattrbtn.h
+ + -1 + 22 + + 0 + + 5 + 5 + 0 + 0 + + image2 +
+ + KSLineBtn +
ksattrbtn.h
+ + -1 + 22 + + 0 + + 5 + 5 + 0 + 0 + + image3 +
+
+ + + 789ca5ceb10ac23010c6f13d4f71245b90f48a6805f1111447411c9254d1a10a5a0711dfddbba669822e827f0acdf72b84161a36eb25e842dc5adb9e3cf8a3bd82aeef4df3d8ee164f21cb29d03381528e8434e0617539eff9ace8ac10ab1a91a7e75939c4302dcfd9387e753c0f5498a64f71f4ce4ca91e93a9d80f66bfcd3a3b98ef22728cb931119acc02310e168930592abb8febfee06ffb48bee6e20df819667e + + + 789cd3d7528808f055d0d2e72a2e492cc94c5648ce482c52d04a29cdcdad8c8eb5ade65232540043251d2e253d856405e554300073956aadb900494e10c6 + + + 789cd3d7528808f055d0d2e72a2e492cc94c5648ce482c52d04a29cdcdad8c8eb5ade6523232520022630543251d2e253d856405bffcbc54105b19c856360003103711c44d0303b04aac80721965651c32ca8989ca24ca002590a4506594b1cb002590cd234646192c8690429101014c19b0c32040195d46591945134c46196e334c8aa00cc2fb70164c060cf49059b48c5314995a6b2e00c5aa7ebc + + + 789cd3d7528808f055d0d2e72a2e492cc94c5648ce482c52d04a29cdcdad8c8eb5ade6523234530022630543251d2e253d856405bffcbc54103b11c8564e3449344c3401719541dcb434032000ab440338c59481004d4c5919551022a6a7872c08370f9b1892207e31842001b14488a0b232b23fb089e9411d8a2606f6106a1840fc88355c6aadb9009dd649aa + + + +
diff --git a/kmatplot/dialogs/kspanelclegendcinterf.cpp b/kmatplot/dialogs/kspanelclegendcinterf.cpp new file mode 100644 index 0000000..a5aec96 --- /dev/null +++ b/kmatplot/dialogs/kspanelclegendcinterf.cpp @@ -0,0 +1,81 @@ +/**************************************************************************** +** Form implementation generated from reading ui file './kspanelclegendcinterf.ui' +** +** Created: śro mar 20 18:52:51 2002 +** by: The User Interface Compiler (uic) +** +** WARNING! All changes made in this file will be lost! +****************************************************************************/ +#include "kspanelclegendcinterf.h" + +#include +#include +#include +#include +#include +#include +#include +#include "kspanel.h" + +/* + * Constructs a KSPanelCLegendCInterf which is a child of 'parent', with the + * name 'name'.' + */ +KSPanelCLegendCInterf::KSPanelCLegendCInterf( QWidget* parent, const char* name ) + : KSPanel( parent, name ) +{ + if ( !name ) + setName( "KSPanelCLegendCInterf" ); + resize( 500, 140 ); + setCaption( trUtf8( "KSPanelForm" ) ); + KSPanelCLegendCInterfLayout = new QHBoxLayout( this, 1, 1, "KSPanelCLegendCInterfLayout"); + + Frame3 = new QFrame( this, "Frame3" ); + Frame3->setFrameShape( QFrame::StyledPanel ); + Frame3->setFrameShadow( QFrame::Raised ); + Frame3Layout = new QGridLayout( Frame3, 1, 1, 10, 1, "Frame3Layout"); + QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Minimum, QSizePolicy::Expanding ); + Frame3Layout->addItem( spacer, 2, 0 ); + + columns = new QSpinBox( Frame3, "columns" ); + columns->setMaxValue( 99 ); + columns->setMinValue( 1 ); + + Frame3Layout->addWidget( columns, 1, 1 ); + + QLabel_10 = new QLabel( Frame3, "QLabel_10" ); + QLabel_10->setText( trUtf8( "Legend columns" ) ); + + Frame3Layout->addWidget( QLabel_10, 1, 0 ); + + TextLabel1 = new QLabel( Frame3, "TextLabel1" ); + TextLabel1->setMinimumSize( QSize( 0, 25 ) ); + QFont TextLabel1_font( TextLabel1->font() ); + TextLabel1_font.setBold( TRUE ); + TextLabel1_font.setUnderline( TRUE ); + TextLabel1->setFont( TextLabel1_font ); + TextLabel1->setText( trUtf8( "Legend" ) ); + + Frame3Layout->addWidget( TextLabel1, 0, 0 ); + KSPanelCLegendCInterfLayout->addWidget( Frame3 ); + + Frame4 = new QFrame( this, "Frame4" ); + Frame4->setFrameShape( QFrame::StyledPanel ); + Frame4->setFrameShadow( QFrame::Raised ); + KSPanelCLegendCInterfLayout->addWidget( Frame4 ); + + Frame5 = new QFrame( this, "Frame5" ); + Frame5->setFrameShape( QFrame::StyledPanel ); + Frame5->setFrameShadow( QFrame::Raised ); + KSPanelCLegendCInterfLayout->addWidget( Frame5 ); +} + +/* + * Destroys the object and frees any allocated resources + */ +KSPanelCLegendCInterf::~KSPanelCLegendCInterf() +{ + // no need to delete child widgets, Qt does it all for us +} + +#include "kspanelclegendcinterf.moc" diff --git a/kmatplot/dialogs/kspanelclegendcinterf.ui b/kmatplot/dialogs/kspanelclegendcinterf.ui new file mode 100644 index 0000000..e580299 --- /dev/null +++ b/kmatplot/dialogs/kspanelclegendcinterf.ui @@ -0,0 +1,154 @@ + +KSPanelCLegendCInterf + + + KSPanelCLegendCInterf + + + + 0 + 0 + 500 + 140 + + + + KSPanelForm + + + + unnamed + + + 1 + + + 1 + + + + Frame3 + + + StyledPanel + + + Raised + + + + unnamed + + + 10 + + + 1 + + + + Spacer1 + + + Vertical + + + Expanding + + + + 20 + 20 + + + + + + columns + + + 99 + + + 1 + + + + + QLabel_10 + + + Legend columns + + + + + TextLabel1 + + + + 0 + 25 + + + + + 1 + 1 + + + + Legend + + + + + + + Frame4 + + + StyledPanel + + + Raised + + + + + Frame5 + + + StyledPanel + + + Raised + + + + + + + KSPanel +
kspanel.h
+ + 500 + 140 + + 1 + + 0 + 0 + 0 + 0 + + image0 +
+
+ + + 789cd3d7528808f055d0d2e72a2e492cc94c5648ce482c52d04a29cdcdad8c8eb5ade65232540043251d2e253d856405e554300073956aadb900494e10c6 + + + +
diff --git a/kmatplot/dialogs/kspanelcontourinterf.cpp b/kmatplot/dialogs/kspanelcontourinterf.cpp new file mode 100644 index 0000000..b9e4e14 --- /dev/null +++ b/kmatplot/dialogs/kspanelcontourinterf.cpp @@ -0,0 +1,199 @@ +/**************************************************************************** +** Form implementation generated from reading ui file './kspanelcontourinterf.ui' +** +** Created: śro mar 20 18:52:52 2002 +** by: The User Interface Compiler (uic) +** +** WARNING! All changes made in this file will be lost! +****************************************************************************/ +#include "kspanelcontourinterf.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "ksattrbtn.h" +#include "kspanel.h" +#include "kstextedit.h" + +/* + * Constructs a KSPanelContourInterf which is a child of 'parent', with the + * name 'name'.' + */ +KSPanelContourInterf::KSPanelContourInterf( QWidget* parent, const char* name ) + : KSPanel( parent, name ) +{ + if ( !name ) + setName( "KSPanelContourInterf" ); + resize( 500, 140 ); + setCaption( trUtf8( "KSPanelForm" ) ); + KSPanelContourInterfLayout = new QHBoxLayout( this, 1, 1, "KSPanelContourInterfLayout"); + + Frame3 = new QFrame( this, "Frame3" ); + Frame3->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)5, 0, 0, Frame3->sizePolicy().hasHeightForWidth() ) ); + Frame3->setFrameShape( QFrame::StyledPanel ); + Frame3->setFrameShadow( QFrame::Raised ); + Frame3Layout = new QGridLayout( Frame3, 1, 1, 10, 1, "Frame3Layout"); + + QLabel_3 = new QLabel( Frame3, "QLabel_3" ); + QLabel_3->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)5, 0, 0, QLabel_3->sizePolicy().hasHeightForWidth() ) ); + QLabel_3->setText( trUtf8( "V-Axis" ) ); + + Frame3Layout->addWidget( QLabel_3, 4, 0 ); + + QLabel_2 = new QLabel( Frame3, "QLabel_2" ); + QLabel_2->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)5, 0, 0, QLabel_2->sizePolicy().hasHeightForWidth() ) ); + QLabel_2->setText( trUtf8( "Y-Axis" ) ); + + Frame3Layout->addWidget( QLabel_2, 3, 0 ); + + QLabel_1 = new QLabel( Frame3, "QLabel_1" ); + QLabel_1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)5, 0, 0, QLabel_1->sizePolicy().hasHeightForWidth() ) ); + QLabel_1->setText( trUtf8( "X-Axis" ) ); + + Frame3Layout->addWidget( QLabel_1, 2, 0 ); + + TextLabel1 = new QLabel( Frame3, "TextLabel1" ); + TextLabel1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)5, 0, 0, TextLabel1->sizePolicy().hasHeightForWidth() ) ); + QFont TextLabel1_font( TextLabel1->font() ); + TextLabel1_font.setBold( TRUE ); + TextLabel1_font.setUnderline( TRUE ); + TextLabel1->setFont( TextLabel1_font ); + TextLabel1->setText( trUtf8( "Title" ) ); + + Frame3Layout->addMultiCellWidget( TextLabel1, 0, 0, 0, 1 ); + + yaxisc = new QComboBox( FALSE, Frame3, "yaxisc" ); + yaxisc->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)0, 0, 0, yaxisc->sizePolicy().hasHeightForWidth() ) ); + yaxisc->setInsertionPolicy( QComboBox::AtTop ); + + Frame3Layout->addMultiCellWidget( yaxisc, 3, 3, 1, 2 ); + + vaxisc = new QComboBox( FALSE, Frame3, "vaxisc" ); + vaxisc->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)0, 0, 0, vaxisc->sizePolicy().hasHeightForWidth() ) ); + vaxisc->setInsertionPolicy( QComboBox::AtTop ); + + Frame3Layout->addMultiCellWidget( vaxisc, 4, 4, 1, 2 ); + + xaxisc = new QComboBox( FALSE, Frame3, "xaxisc" ); + xaxisc->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)0, 0, 0, xaxisc->sizePolicy().hasHeightForWidth() ) ); + xaxisc->setInsertionPolicy( QComboBox::AtTop ); + + Frame3Layout->addMultiCellWidget( xaxisc, 2, 2, 1, 2 ); + QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Minimum, QSizePolicy::Expanding ); + Frame3Layout->addItem( spacer, 5, 2 ); + + titlee = new KSTextEdit( Frame3, "titlee" ); + titlee->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)0, 0, 0, titlee->sizePolicy().hasHeightForWidth() ) ); + titlee->setMinimumSize( QSize( 0, 22 ) ); + + Frame3Layout->addMultiCellWidget( titlee, 1, 1, 0, 2 ); + KSPanelContourInterfLayout->addWidget( Frame3 ); + + Frame4 = new QFrame( this, "Frame4" ); + Frame4->setFrameShape( QFrame::StyledPanel ); + Frame4->setFrameShadow( QFrame::Raised ); + Frame4Layout = new QGridLayout( Frame4, 1, 1, 10, 1, "Frame4Layout"); + QSpacerItem* spacer_2 = new QSpacerItem( 20, 20, QSizePolicy::Minimum, QSizePolicy::Expanding ); + Frame4Layout->addItem( spacer_2, 4, 0 ); + + QLabel_4 = new QLabel( Frame4, "QLabel_4" ); + QLabel_4->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)5, 0, 0, QLabel_4->sizePolicy().hasHeightForWidth() ) ); + QLabel_4->setText( trUtf8( "Point" ) ); + + Frame4Layout->addWidget( QLabel_4, 2, 0 ); + + TextLabel1_2 = new QLabel( Frame4, "TextLabel1_2" ); + QFont TextLabel1_2_font( TextLabel1_2->font() ); + TextLabel1_2_font.setBold( TRUE ); + TextLabel1_2_font.setUnderline( TRUE ); + TextLabel1_2->setFont( TextLabel1_2_font ); + TextLabel1_2->setText( trUtf8( "Grid" ) ); + + Frame4Layout->addMultiCellWidget( TextLabel1_2, 0, 0, 0, 1 ); + + gridLine = new KSLineBtn( Frame4, "gridLine" ); + gridLine->setMinimumSize( QSize( 0, 22 ) ); + gridLine->setMaximumSize( QSize( 80, 32767 ) ); + + Frame4Layout->addWidget( gridLine, 1, 1 ); + + QLabel_5 = new QLabel( Frame4, "QLabel_5" ); + QLabel_5->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)5, 0, 0, QLabel_5->sizePolicy().hasHeightForWidth() ) ); + QLabel_5->setText( trUtf8( "Line" ) ); + + Frame4Layout->addWidget( QLabel_5, 1, 0 ); + + gridPoint = new KSPointBtn( Frame4, "gridPoint" ); + gridPoint->setMinimumSize( QSize( 0, 22 ) ); + gridPoint->setMaximumSize( QSize( 80, 32767 ) ); + + Frame4Layout->addWidget( gridPoint, 2, 1 ); + + labelSpacing = new QLineEdit( Frame4, "labelSpacing" ); + labelSpacing->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5, (QSizePolicy::SizeType)0, 1, 0, labelSpacing->sizePolicy().hasHeightForWidth() ) ); + labelSpacing->setMaximumSize( QSize( 80, 32767 ) ); + + Frame4Layout->addWidget( labelSpacing, 3, 1 ); + + QLabel_6 = new QLabel( Frame4, "QLabel_6" ); + QLabel_6->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)5, 0, 0, QLabel_6->sizePolicy().hasHeightForWidth() ) ); + QLabel_6->setText( trUtf8( "Label spacing" ) ); + + Frame4Layout->addWidget( QLabel_6, 3, 0 ); + KSPanelContourInterfLayout->addWidget( Frame4 ); + + Frame5 = new QFrame( this, "Frame5" ); + Frame5->setFrameShape( QFrame::StyledPanel ); + Frame5->setFrameShadow( QFrame::Raised ); + Frame5Layout = new QGridLayout( Frame5, 1, 1, 10, 1, "Frame5Layout"); + + legendc = new QCheckBox( Frame5, "legendc" ); + legendc->setText( trUtf8( "Show legend item" ) ); + + Frame5Layout->addMultiCellWidget( legendc, 4, 4, 0, 1 ); + + labelsc = new QCheckBox( Frame5, "labelsc" ); + labelsc->setText( trUtf8( "Show level labels" ) ); + + Frame5Layout->addMultiCellWidget( labelsc, 3, 3, 0, 1 ); + + linesc = new QCheckBox( Frame5, "linesc" ); + linesc->setText( trUtf8( "Show level lines" ) ); + + Frame5Layout->addMultiCellWidget( linesc, 2, 2, 0, 1 ); + + fillsc = new QCheckBox( Frame5, "fillsc" ); + fillsc->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)1, (QSizePolicy::SizeType)0, 1, 0, fillsc->sizePolicy().hasHeightForWidth() ) ); + fillsc->setText( trUtf8( "Fill contours" ) ); + + Frame5Layout->addMultiCellWidget( fillsc, 1, 1, 0, 1 ); + QSpacerItem* spacer_3 = new QSpacerItem( 20, 20, QSizePolicy::Minimum, QSizePolicy::Expanding ); + Frame5Layout->addItem( spacer_3, 5, 0 ); + + TextLabel1_3 = new QLabel( Frame5, "TextLabel1_3" ); + QFont TextLabel1_3_font( TextLabel1_3->font() ); + TextLabel1_3_font.setBold( TRUE ); + TextLabel1_3_font.setUnderline( TRUE ); + TextLabel1_3->setFont( TextLabel1_3_font ); + TextLabel1_3->setText( trUtf8( "Options" ) ); + + Frame5Layout->addWidget( TextLabel1_3, 0, 0 ); + KSPanelContourInterfLayout->addWidget( Frame5 ); +} + +/* + * Destroys the object and frees any allocated resources + */ +KSPanelContourInterf::~KSPanelContourInterf() +{ + // no need to delete child widgets, Qt does it all for us +} + +#include "kspanelcontourinterf.moc" diff --git a/kmatplot/dialogs/kspanelcontourinterf.ui b/kmatplot/dialogs/kspanelcontourinterf.ui new file mode 100644 index 0000000..5db4392 --- /dev/null +++ b/kmatplot/dialogs/kspanelcontourinterf.ui @@ -0,0 +1,542 @@ + +KSPanelContourInterf + + + KSPanelContourInterf + + + + 0 + 0 + 500 + 140 + + + + KSPanelForm + + + + unnamed + + + 1 + + + 1 + + + + Frame3 + + + + 7 + 5 + 0 + 0 + + + + StyledPanel + + + Raised + + + + unnamed + + + 10 + + + 1 + + + + QLabel_3 + + + + 7 + 5 + 0 + 0 + + + + V-Axis + + + + + QLabel_2 + + + + 7 + 5 + 0 + 0 + + + + Y-Axis + + + + + QLabel_1 + + + + 7 + 5 + 0 + 0 + + + + X-Axis + + + + + TextLabel1 + + + + 7 + 5 + 0 + 0 + + + + + 1 + 1 + + + + Title + + + + + yaxisc + + + + 7 + 0 + 0 + 0 + + + + AtTop + + + + + vaxisc + + + + 7 + 0 + 0 + 0 + + + + AtTop + + + + + xaxisc + + + + 7 + 0 + 0 + 0 + + + + AtTop + + + + + Spacer3 + + + Vertical + + + Expanding + + + + 20 + 20 + + + + + + titlee + + + + 7 + 0 + 0 + 0 + + + + + 0 + 22 + + + + + + + + Frame4 + + + StyledPanel + + + Raised + + + + unnamed + + + 10 + + + 1 + + + + Spacer2 + + + Vertical + + + Expanding + + + + 20 + 20 + + + + + + QLabel_4 + + + + 3 + 5 + 0 + 0 + + + + Point + + + + + TextLabel1_2 + + + + 1 + 1 + + + + Grid + + + + + gridLine + + + + 0 + 22 + + + + + 80 + 32767 + + + + + + QLabel_5 + + + + 3 + 5 + 0 + 0 + + + + Line + + + + + gridPoint + + + + 0 + 22 + + + + + 80 + 32767 + + + + + + labelSpacing + + + + 5 + 0 + 1 + 0 + + + + + 80 + 32767 + + + + + + QLabel_6 + + + + 3 + 5 + 0 + 0 + + + + Label spacing + + + + + + + Frame5 + + + StyledPanel + + + Raised + + + + unnamed + + + 10 + + + 1 + + + + legendc + + + Show legend item + + + + + labelsc + + + Show level labels + + + + + linesc + + + Show level lines + + + + + fillsc + + + + 1 + 0 + 1 + 0 + + + + Fill contours + + + + + Spacer1 + + + Vertical + + + Expanding + + + + 20 + 20 + + + + + + TextLabel1_3 + + + + 1 + 1 + + + + Options + + + + + + + + + KSPanel +
kspanel.h
+ + 500 + 140 + + 1 + + 0 + 0 + 0 + 0 + + image0 +
+ + KSLineBtn +
ksattrbtn.h
+ + -1 + 22 + + 0 + + 5 + 5 + 0 + 0 + + image1 +
+ + KSPointBtn +
ksattrbtn.h
+ + -1 + 22 + + 0 + + 5 + 5 + 0 + 0 + + image2 +
+ + KSTextEdit +
kstextedit.h
+ + -1 + -1 + + 0 + + 5 + 5 + 0 + 0 + + image3 +
+
+ + + 789cd3d7528808f055d0d2e72a2e492cc94c5648ce482c52d04a29cdcdad8c8eb5ade65232540043251d2e253d856405e554300073956aadb900494e10c6 + + + 789cd3d7528808f055d0d2e72a2e492cc94c5648ce482c52d04a29cdcdad8c8eb5ade6523234530022630543251d2e253d856405bffcbc54103b11c8564e3449344c3401719541dcb434032000ab440338c59481004d4c5919551022a6a7872c08370f9b1892207e31842001b14488a0b232b23fb089e9411d8a2606f6106a1840fc88355c6aadb9009dd649aa + + + 789cd3d7528808f055d0d2e72a2e492cc94c5648ce482c52d04a29cdcdad8c8eb5ade6523234530022630543251d2e253d856405bffcbc54105b19c856360003103711c44d0303b04a34408c98b2b232ba98726262a2324962ca20538002c8e641059491ed8588296311435387300f451d6562ca308bb1864bad3517007a684bc0 + + + 789cd3d7528808f055d0d2e72a2e492cc94c5648ce482c52d04a29cdcdad8c8eb5ade6523234530022630543251d2e253d856405bffcbc54105b19c856360003103711c44d490541b04a34805b4c593911ca0731d0c49413812cfc7a95c18a9561ea4022890802530caa5719a40fac17490c9b3a9ce6a1da4bb47f8910abb5e602003a1250e8 + + + +
diff --git a/kmatplot/dialogs/kspanelcposinterf.cpp b/kmatplot/dialogs/kspanelcposinterf.cpp new file mode 100644 index 0000000..4c3a429 --- /dev/null +++ b/kmatplot/dialogs/kspanelcposinterf.cpp @@ -0,0 +1,156 @@ +/**************************************************************************** +** Form implementation generated from reading ui file './kspanelcposinterf.ui' +** +** Created: śro mar 20 18:52:53 2002 +** by: The User Interface Compiler (uic) +** +** WARNING! All changes made in this file will be lost! +****************************************************************************/ +#include "kspanelcposinterf.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "kspanel.h" + +/* + * Constructs a KSPanelCPosInterf which is a child of 'parent', with the + * name 'name'.' + */ +KSPanelCPosInterf::KSPanelCPosInterf( QWidget* parent, const char* name ) + : KSPanel( parent, name ) +{ + if ( !name ) + setName( "KSPanelCPosInterf" ); + resize( 472, 140 ); + setCaption( trUtf8( "KSPanelForm" ) ); + KSPanelCPosInterfLayout = new QHBoxLayout( this, 1, 1, "KSPanelCPosInterfLayout"); + + Frame4 = new QFrame( this, "Frame4" ); + Frame4->setFrameShape( QFrame::StyledPanel ); + Frame4->setFrameShadow( QFrame::Raised ); + Frame4Layout = new QGridLayout( Frame4, 1, 1, 10, 1, "Frame4Layout"); + + QLabel_3 = new QLabel( Frame4, "QLabel_3" ); + QLabel_3->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)1, (QSizePolicy::SizeType)5, 0, 0, QLabel_3->sizePolicy().hasHeightForWidth() ) ); + QLabel_3->setText( trUtf8( "Z-Axis " ) ); + + Frame4Layout->addWidget( QLabel_3, 3, 0 ); + + xAxis = new QComboBox( FALSE, Frame4, "xAxis" ); + xAxis->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)0, 2, 0, xAxis->sizePolicy().hasHeightForWidth() ) ); + xAxis->setInsertionPolicy( QComboBox::AtTop ); + + Frame4Layout->addWidget( xAxis, 1, 1 ); + + yAxis = new QComboBox( FALSE, Frame4, "yAxis" ); + yAxis->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)0, 0, 0, yAxis->sizePolicy().hasHeightForWidth() ) ); + yAxis->setInsertionPolicy( QComboBox::AtTop ); + + Frame4Layout->addWidget( yAxis, 2, 1 ); + + zAxis = new QComboBox( FALSE, Frame4, "zAxis" ); + zAxis->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)0, 0, 0, zAxis->sizePolicy().hasHeightForWidth() ) ); + zAxis->setInsertionPolicy( QComboBox::AtTop ); + + Frame4Layout->addWidget( zAxis, 3, 1 ); + QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Minimum, QSizePolicy::Expanding ); + Frame4Layout->addItem( spacer, 4, 1 ); + + QLabel_2 = new QLabel( Frame4, "QLabel_2" ); + QLabel_2->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)1, (QSizePolicy::SizeType)5, 0, 0, QLabel_2->sizePolicy().hasHeightForWidth() ) ); + QLabel_2->setText( trUtf8( "Y-Axis " ) ); + + Frame4Layout->addWidget( QLabel_2, 2, 0 ); + + QLabel_1 = new QLabel( Frame4, "QLabel_1" ); + QLabel_1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)1, (QSizePolicy::SizeType)5, 0, 0, QLabel_1->sizePolicy().hasHeightForWidth() ) ); + QLabel_1->setText( trUtf8( "X-Axis " ) ); + + Frame4Layout->addWidget( QLabel_1, 1, 0 ); + + QLabel_5 = new QLabel( Frame4, "QLabel_5" ); + QLabel_5->setMinimumSize( QSize( 0, 25 ) ); + QFont QLabel_5_font( QLabel_5->font() ); + QLabel_5_font.setBold( TRUE ); + QLabel_5_font.setUnderline( TRUE ); + QLabel_5->setFont( QLabel_5_font ); + QLabel_5->setText( trUtf8( "Bind to :" ) ); + + Frame4Layout->addMultiCellWidget( QLabel_5, 0, 0, 0, 1 ); + KSPanelCPosInterfLayout->addWidget( Frame4 ); + + Frame3 = new QFrame( this, "Frame3" ); + Frame3->setFrameShape( QFrame::StyledPanel ); + Frame3->setFrameShadow( QFrame::Raised ); + Frame3Layout = new QGridLayout( Frame3, 1, 1, 10, 1, "Frame3Layout"); + + QLabel_4 = new QLabel( Frame3, "QLabel_4" ); + QLabel_4->setMinimumSize( QSize( 0, 25 ) ); + QFont QLabel_4_font( QLabel_4->font() ); + QLabel_4_font.setBold( TRUE ); + QLabel_4_font.setUnderline( TRUE ); + QLabel_4->setFont( QLabel_4_font ); + QLabel_4->setText( trUtf8( "Coordinate system / Position :" ) ); + + Frame3Layout->addMultiCellWidget( QLabel_4, 0, 0, 0, 1 ); + + xaxisc = new QComboBox( FALSE, Frame3, "xaxisc" ); + xaxisc->insertItem( trUtf8( "x mm " ) ); + xaxisc->insertItem( trUtf8( "x normalized " ) ); + xaxisc->insertItem( trUtf8( "x world " ) ); + xaxisc->insertItem( trUtf8( "x data " ) ); + xaxisc->setInsertionPolicy( QComboBox::AtTop ); + + Frame3Layout->addWidget( xaxisc, 1, 0 ); + + yaxisc = new QComboBox( FALSE, Frame3, "yaxisc" ); + yaxisc->insertItem( trUtf8( "y mm" ) ); + yaxisc->insertItem( trUtf8( "y normalized" ) ); + yaxisc->insertItem( trUtf8( "y world" ) ); + yaxisc->insertItem( trUtf8( "y data" ) ); + yaxisc->setInsertionPolicy( QComboBox::AtTop ); + + Frame3Layout->addWidget( yaxisc, 2, 0 ); + + zaxisc = new QComboBox( FALSE, Frame3, "zaxisc" ); + zaxisc->insertItem( trUtf8( "z mm" ) ); + zaxisc->insertItem( trUtf8( "z normalized" ) ); + zaxisc->insertItem( trUtf8( "z world" ) ); + zaxisc->insertItem( trUtf8( "z data" ) ); + zaxisc->setInsertionPolicy( QComboBox::AtTop ); + + Frame3Layout->addWidget( zaxisc, 3, 0 ); + + zpos = new QLineEdit( Frame3, "zpos" ); + + Frame3Layout->addWidget( zpos, 3, 1 ); + + ypos = new QLineEdit( Frame3, "ypos" ); + + Frame3Layout->addWidget( ypos, 2, 1 ); + QSpacerItem* spacer_2 = new QSpacerItem( 20, 20, QSizePolicy::Minimum, QSizePolicy::Expanding ); + Frame3Layout->addItem( spacer_2, 4, 1 ); + + xpos = new QLineEdit( Frame3, "xpos" ); + xpos->setText( trUtf8( "" ) ); + + Frame3Layout->addWidget( xpos, 1, 1 ); + KSPanelCPosInterfLayout->addWidget( Frame3 ); +} + +/* + * Destroys the object and frees any allocated resources + */ +KSPanelCPosInterf::~KSPanelCPosInterf() +{ + // no need to delete child widgets, Qt does it all for us +} + +#include "kspanelcposinterf.moc" diff --git a/kmatplot/dialogs/kspanelcposinterf.ui b/kmatplot/dialogs/kspanelcposinterf.ui new file mode 100644 index 0000000..53405dc --- /dev/null +++ b/kmatplot/dialogs/kspanelcposinterf.ui @@ -0,0 +1,370 @@ + +KSPanelCPosInterf + + + KSPanelCPosInterf + + + + 0 + 0 + 472 + 140 + + + + KSPanelForm + + + + unnamed + + + 1 + + + 1 + + + + Frame4 + + + StyledPanel + + + Raised + + + + unnamed + + + 10 + + + 1 + + + + QLabel_3 + + + + 1 + 5 + 0 + 0 + + + + Z-Axis + + + + + xAxis + + + + 7 + 0 + 2 + 0 + + + + AtTop + + + + + yAxis + + + + 7 + 0 + 0 + 0 + + + + AtTop + + + + + zAxis + + + + 7 + 0 + 0 + 0 + + + + AtTop + + + + + Spacer1 + + + Vertical + + + Expanding + + + + 20 + 20 + + + + + + QLabel_2 + + + + 1 + 5 + 0 + 0 + + + + Y-Axis + + + + + QLabel_1 + + + + 1 + 5 + 0 + 0 + + + + X-Axis + + + + + QLabel_5 + + + + 0 + 25 + + + + + 1 + 1 + + + + Bind to : + + + + + + + Frame3 + + + StyledPanel + + + Raised + + + + unnamed + + + 10 + + + 1 + + + + QLabel_4 + + + + 0 + 25 + + + + + 1 + 1 + + + + Coordinate system / Position : + + + + + + x mm + + + + + x normalized + + + + + x world + + + + + x data + + + + xaxisc + + + AtTop + + + + + + y mm + + + + + y normalized + + + + + y world + + + + + y data + + + + yaxisc + + + AtTop + + + + + + z mm + + + + + z normalized + + + + + z world + + + + + z data + + + + zaxisc + + + AtTop + + + + + zpos + + + + + ypos + + + + + Spacer2 + + + Vertical + + + Expanding + + + + 20 + 20 + + + + + + xpos + + + + + + + + + + + + KSPanel +
kspanel.h
+ + 500 + 140 + + 1 + + 0 + 0 + 0 + 0 + + image0 +
+
+ + + 789cd3d7528808f055d0d2e72a2e492cc94c5648ce482c52d04a29cdcdad8c8eb5ade65232540043251d2e253d856405e554300073956aadb900494e10c6 + + + +
diff --git a/kmatplot/dialogs/kspanelcrectinterf.cpp b/kmatplot/dialogs/kspanelcrectinterf.cpp new file mode 100644 index 0000000..74da596 --- /dev/null +++ b/kmatplot/dialogs/kspanelcrectinterf.cpp @@ -0,0 +1,158 @@ +/**************************************************************************** +** Form implementation generated from reading ui file './kspanelcrectinterf.ui' +** +** Created: śro mar 20 18:52:54 2002 +** by: The User Interface Compiler (uic) +** +** WARNING! All changes made in this file will be lost! +****************************************************************************/ +#include "kspanelcrectinterf.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "ksattrbtn.h" +#include "kspanel.h" + +/* + * Constructs a KSPanelCRectInterf which is a child of 'parent', with the + * name 'name'.' + */ +KSPanelCRectInterf::KSPanelCRectInterf( QWidget* parent, const char* name ) + : KSPanel( parent, name ) +{ + if ( !name ) + setName( "KSPanelCRectInterf" ); + resize( 465, 140 ); + setCaption( trUtf8( "KSPanelForm" ) ); + KSPanelCRectInterfLayout = new QHBoxLayout( this, 1, 1, "KSPanelCRectInterfLayout"); + + Frame5 = new QFrame( this, "Frame5" ); + Frame5->setFrameShape( QFrame::StyledPanel ); + Frame5->setFrameShadow( QFrame::Raised ); + Frame5Layout = new QGridLayout( Frame5, 1, 1, 11, 1, "Frame5Layout"); + + TextLabel1_2 = new QLabel( Frame5, "TextLabel1_2" ); + TextLabel1_2->setMinimumSize( QSize( 0, 25 ) ); + QFont TextLabel1_2_font( TextLabel1_2->font() ); + TextLabel1_2_font.setBold( TRUE ); + TextLabel1_2_font.setUnderline( TRUE ); + TextLabel1_2->setFont( TextLabel1_2_font ); + TextLabel1_2->setText( trUtf8( "Type" ) ); + + Frame5Layout->addWidget( TextLabel1_2, 0, 0 ); + + ellipse = new QCheckBox( Frame5, "ellipse" ); + QFont ellipse_font( ellipse->font() ); + ellipse->setFont( ellipse_font ); + ellipse->setText( trUtf8( "Ellipse" ) ); + + Frame5Layout->addWidget( ellipse, 1, 0 ); + QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Minimum, QSizePolicy::Expanding ); + Frame5Layout->addItem( spacer, 2, 0 ); + KSPanelCRectInterfLayout->addWidget( Frame5 ); + + Frame4 = new QFrame( this, "Frame4" ); + Frame4->setFrameShape( QFrame::StyledPanel ); + Frame4->setFrameShadow( QFrame::Raised ); + Frame4Layout = new QGridLayout( Frame4, 1, 1, 10, 1, "Frame4Layout"); + QSpacerItem* spacer_2 = new QSpacerItem( 20, 20, QSizePolicy::Minimum, QSizePolicy::Expanding ); + Frame4Layout->addMultiCell( spacer_2, 3, 3, 0, 1 ); + + QLabel_2 = new QLabel( Frame4, "QLabel_2" ); + QLabel_2->setText( trUtf8( "Fill" ) ); + + Frame4Layout->addWidget( QLabel_2, 2, 0 ); + + QLabel_1 = new QLabel( Frame4, "QLabel_1" ); + QLabel_1->setText( trUtf8( "Frame" ) ); + + Frame4Layout->addWidget( QLabel_1, 1, 0 ); + + rectFill = new KSFillBtn( Frame4, "rectFill" ); + rectFill->setMinimumSize( QSize( 0, 22 ) ); + + Frame4Layout->addWidget( rectFill, 2, 1 ); + + TextLabel2 = new QLabel( Frame4, "TextLabel2" ); + TextLabel2->setMinimumSize( QSize( 0, 25 ) ); + QFont TextLabel2_font( TextLabel2->font() ); + TextLabel2_font.setBold( TRUE ); + TextLabel2_font.setUnderline( TRUE ); + TextLabel2->setFont( TextLabel2_font ); + TextLabel2->setText( trUtf8( "Attributes" ) ); + + Frame4Layout->addMultiCellWidget( TextLabel2, 0, 0, 0, 1 ); + + rectFrame = new KSLineBtn( Frame4, "rectFrame" ); + rectFrame->setMinimumSize( QSize( 0, 22 ) ); + + Frame4Layout->addWidget( rectFrame, 1, 1 ); + KSPanelCRectInterfLayout->addWidget( Frame4 ); + + Frame3 = new QFrame( this, "Frame3" ); + Frame3->setFrameShape( QFrame::StyledPanel ); + Frame3->setFrameShadow( QFrame::Raised ); + Frame3Layout = new QGridLayout( Frame3, 1, 1, 10, 1, "Frame3Layout"); + + shadowdx = new QSpinBox( Frame3, "shadowdx" ); + shadowdx->setMaxValue( 99 ); + shadowdx->setMinValue( -99 ); + + Frame3Layout->addWidget( shadowdx, 1, 1 ); + + shadowdy = new QSpinBox( Frame3, "shadowdy" ); + shadowdy->setMaxValue( 99 ); + shadowdy->setMinValue( -99 ); + + Frame3Layout->addWidget( shadowdy, 2, 1 ); + + QLabel_15 = new QLabel( Frame3, "QLabel_15" ); + QLabel_15->setText( trUtf8( "DY" ) ); + + Frame3Layout->addWidget( QLabel_15, 2, 0 ); + + QLabel_13 = new QLabel( Frame3, "QLabel_13" ); + QLabel_13->setText( trUtf8( "DX" ) ); + + Frame3Layout->addWidget( QLabel_13, 1, 0 ); + + TextLabel1 = new QLabel( Frame3, "TextLabel1" ); + TextLabel1->setMinimumSize( QSize( 0, 25 ) ); + QFont TextLabel1_font( TextLabel1->font() ); + TextLabel1_font.setBold( TRUE ); + TextLabel1_font.setUnderline( TRUE ); + TextLabel1->setFont( TextLabel1_font ); + TextLabel1->setText( trUtf8( "Shadow" ) ); + + Frame3Layout->addMultiCellWidget( TextLabel1, 0, 0, 0, 1 ); + QSpacerItem* spacer_3 = new QSpacerItem( 20, 20, QSizePolicy::Minimum, QSizePolicy::Expanding ); + Frame3Layout->addItem( spacer_3, 4, 1 ); + + TextLabel1_3 = new QLabel( Frame3, "TextLabel1_3" ); + TextLabel1_3->setText( trUtf8( "Fill" ) ); + + Frame3Layout->addWidget( TextLabel1_3, 3, 0 ); + + shadowFill = new KSFillBtn( Frame3, "shadowFill" ); + shadowFill->setMinimumSize( QSize( 0, 22 ) ); + + Frame3Layout->addWidget( shadowFill, 3, 1 ); + KSPanelCRectInterfLayout->addWidget( Frame3 ); +} + +/* + * Destroys the object and frees any allocated resources + */ +KSPanelCRectInterf::~KSPanelCRectInterf() +{ + // no need to delete child widgets, Qt does it all for us +} + +#include "kspanelcrectinterf.moc" diff --git a/kmatplot/dialogs/kspanelcrectinterf.ui b/kmatplot/dialogs/kspanelcrectinterf.ui new file mode 100644 index 0000000..970a12c --- /dev/null +++ b/kmatplot/dialogs/kspanelcrectinterf.ui @@ -0,0 +1,376 @@ + +KSPanelCRectInterf + + + KSPanelCRectInterf + + + + 0 + 0 + 465 + 140 + + + + KSPanelForm + + + + unnamed + + + 1 + + + 1 + + + + Frame5 + + + StyledPanel + + + Raised + + + + unnamed + + + 11 + + + 1 + + + + TextLabel1_2 + + + + 0 + 25 + + + + + 1 + 1 + + + + Type + + + + + ellipse + + + + + + + Ellipse + + + + + Spacer2 + + + Vertical + + + Expanding + + + + 20 + 20 + + + + + + + + Frame4 + + + StyledPanel + + + Raised + + + + unnamed + + + 10 + + + 1 + + + + Spacer3 + + + Vertical + + + Expanding + + + + 20 + 20 + + + + + + QLabel_2 + + + Fill + + + + + QLabel_1 + + + Frame + + + + + rectFill + + + + 0 + 22 + + + + + + TextLabel2 + + + + 0 + 25 + + + + + 1 + 1 + + + + Attributes + + + + + rectFrame + + + + 0 + 22 + + + + + + + + Frame3 + + + StyledPanel + + + Raised + + + + unnamed + + + 10 + + + 1 + + + + shadowdx + + + 99 + + + -99 + + + + + shadowdy + + + 99 + + + -99 + + + + + QLabel_15 + + + DY + + + + + QLabel_13 + + + DX + + + + + TextLabel1 + + + + 0 + 25 + + + + + 1 + 1 + + + + Shadow + + + + + Spacer1 + + + Vertical + + + Expanding + + + + 20 + 20 + + + + + + TextLabel1_3 + + + Fill + + + + + shadowFill + + + + 0 + 22 + + + + + + + + + + KSFillBtn +
ksattrbtn.h
+ + -1 + 22 + + 0 + + 5 + 5 + 0 + 0 + + image0 +
+ + KSPanel +
kspanel.h
+ + 500 + 140 + + 1 + + 0 + 0 + 0 + 0 + + image1 +
+ + KSLineBtn +
ksattrbtn.h
+ + -1 + 22 + + 0 + + 5 + 5 + 0 + 0 + + image2 +
+
+ + + 789ca5ceb10ac23010c6f13d4f71245b90f48a6805f1111447411c9254d1a10a5a0711dfddbba669822e827f0acdf72b84161a36eb25e842dc5adb9e3cf8a3bd82aeef4df3d8ee164f21cb29d03381528e8434e0617539eff9ace8ac10ab1a91a7e75939c4302dcfd9387e753c0f5498a64f71f4ce4ca91e93a9d80f66bfcd3a3b98ef22728cb931119acc02310e168930592abb8febfee06ffb48bee6e20df819667e + + + 789cd3d7528808f055d0d2e72a2e492cc94c5648ce482c52d04a29cdcdad8c8eb5ade65232540043251d2e253d856405e554300073956aadb900494e10c6 + + + 789cd3d7528808f055d0d2e72a2e492cc94c5648ce482c52d04a29cdcdad8c8eb5ade6523234530022630543251d2e253d856405bffcbc54103b11c8564e3449344c3401719541dcb434032000ab440338c59481004d4c5919551022a6a7872c08370f9b1892207e31842001b14488a0b232b23fb089e9411d8a2606f6106a1840fc88355c6aadb9009dd649aa + + + +
diff --git a/kmatplot/dialogs/kspanelcubeinterf.cpp b/kmatplot/dialogs/kspanelcubeinterf.cpp new file mode 100644 index 0000000..86270b8 --- /dev/null +++ b/kmatplot/dialogs/kspanelcubeinterf.cpp @@ -0,0 +1,244 @@ +/**************************************************************************** +** Form implementation generated from reading ui file './kspanelcubeinterf.ui' +** +** Created: śro mar 20 18:52:55 2002 +** by: The User Interface Compiler (uic) +** +** WARNING! All changes made in this file will be lost! +****************************************************************************/ +#include "kspanelcubeinterf.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include "ksattrbtn.h" +#include "kspanel.h" + +/* + * Constructs a KSPanelCubeInterf which is a child of 'parent', with the + * name 'name'.' + */ +KSPanelCubeInterf::KSPanelCubeInterf( QWidget* parent, const char* name ) + : KSPanel( parent, name ) +{ + if ( !name ) + setName( "KSPanelCubeInterf" ); + resize( 612, 161 ); + setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5, (QSizePolicy::SizeType)5, 0, 0, sizePolicy().hasHeightForWidth() ) ); + setCaption( trUtf8( "KSPanelForm" ) ); + KSPanelCubeInterfLayout = new QHBoxLayout( this, 1, 1, "KSPanelCubeInterfLayout"); + + Frame7 = new QFrame( this, "Frame7" ); + Frame7->setFrameShape( QFrame::StyledPanel ); + Frame7->setFrameShadow( QFrame::Raised ); + Frame7Layout = new QGridLayout( Frame7, 1, 1, 10, 1, "Frame7Layout"); + + xyThick = new QLineEdit( Frame7, "xyThick" ); + xyThick->setMaximumSize( QSize( 60, 32767 ) ); + + Frame7Layout->addWidget( xyThick, 1, 1 ); + + thickl = new QLabel( Frame7, "thickl" ); + thickl->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)5, 0, 0, thickl->sizePolicy().hasHeightForWidth() ) ); + thickl->setText( trUtf8( "Thick." ) ); + + Frame7Layout->addWidget( thickl, 1, 0 ); + + linel = new QLabel( Frame7, "linel" ); + linel->setText( trUtf8( "Line" ) ); + + Frame7Layout->addWidget( linel, 3, 0 ); + + TextLabel1 = new QLabel( Frame7, "TextLabel1" ); + TextLabel1->setMinimumSize( QSize( 0, 25 ) ); + QFont TextLabel1_font( TextLabel1->font() ); + TextLabel1_font.setBold( TRUE ); + TextLabel1_font.setUnderline( TRUE ); + TextLabel1->setFont( TextLabel1_font ); + TextLabel1->setText( trUtf8( "XY wall" ) ); + + Frame7Layout->addMultiCellWidget( TextLabel1, 0, 0, 0, 1 ); + QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Minimum, QSizePolicy::Expanding ); + Frame7Layout->addItem( spacer, 4, 1 ); + + xyLine = new KSLineBtn( Frame7, "xyLine" ); + xyLine->setMinimumSize( QSize( 0, 22 ) ); + xyLine->setMaximumSize( QSize( 100, 32767 ) ); + + Frame7Layout->addWidget( xyLine, 3, 1 ); + + filll = new QLabel( Frame7, "filll" ); + filll->setText( trUtf8( "Fill" ) ); + + Frame7Layout->addWidget( filll, 2, 0 ); + + xyFill = new KSFillBtn( Frame7, "xyFill" ); + xyFill->setMinimumSize( QSize( 0, 22 ) ); + xyFill->setMaximumSize( QSize( 100, 32767 ) ); + + Frame7Layout->addWidget( xyFill, 2, 1 ); + KSPanelCubeInterfLayout->addWidget( Frame7 ); + + Frame6 = new QFrame( this, "Frame6" ); + Frame6->setFrameShape( QFrame::StyledPanel ); + Frame6->setFrameShadow( QFrame::Raised ); + Frame6Layout = new QGridLayout( Frame6, 1, 1, 10, 1, "Frame6Layout"); + + xzThick = new QLineEdit( Frame6, "xzThick" ); + xzThick->setMaximumSize( QSize( 60, 32767 ) ); + xzThick->setText( trUtf8( "" ) ); + + Frame6Layout->addWidget( xzThick, 1, 1 ); + + thickl2 = new QLabel( Frame6, "thickl2" ); + thickl2->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)5, 0, 0, thickl2->sizePolicy().hasHeightForWidth() ) ); + thickl2->setText( trUtf8( "Thick." ) ); + + Frame6Layout->addWidget( thickl2, 1, 0 ); + + filll2 = new QLabel( Frame6, "filll2" ); + filll2->setText( trUtf8( "Fill" ) ); + + Frame6Layout->addWidget( filll2, 2, 0 ); + + TextLabel2 = new QLabel( Frame6, "TextLabel2" ); + TextLabel2->setMinimumSize( QSize( 0, 25 ) ); + QFont TextLabel2_font( TextLabel2->font() ); + TextLabel2_font.setBold( TRUE ); + TextLabel2_font.setUnderline( TRUE ); + TextLabel2->setFont( TextLabel2_font ); + TextLabel2->setText( trUtf8( "XZ Wall" ) ); + + Frame6Layout->addMultiCellWidget( TextLabel2, 0, 0, 0, 1 ); + QSpacerItem* spacer_2 = new QSpacerItem( 20, 20, QSizePolicy::Minimum, QSizePolicy::Expanding ); + Frame6Layout->addItem( spacer_2, 4, 0 ); + + linel2 = new QLabel( Frame6, "linel2" ); + linel2->setText( trUtf8( "Line" ) ); + + Frame6Layout->addWidget( linel2, 3, 0 ); + + xzLine = new KSLineBtn( Frame6, "xzLine" ); + xzLine->setMinimumSize( QSize( 0, 22 ) ); + + Frame6Layout->addWidget( xzLine, 3, 1 ); + + xzFill = new KSFillBtn( Frame6, "xzFill" ); + xzFill->setMinimumSize( QSize( 0, 22 ) ); + + Frame6Layout->addWidget( xzFill, 2, 1 ); + KSPanelCubeInterfLayout->addWidget( Frame6 ); + + Frame5 = new QFrame( this, "Frame5" ); + Frame5->setFrameShape( QFrame::StyledPanel ); + Frame5->setFrameShadow( QFrame::Raised ); + Frame5Layout = new QGridLayout( Frame5, 1, 1, 10, 1, "Frame5Layout"); + + yzThick = new QLineEdit( Frame5, "yzThick" ); + yzThick->setMaximumSize( QSize( 60, 32767 ) ); + + Frame5Layout->addWidget( yzThick, 1, 1 ); + + thickl3 = new QLabel( Frame5, "thickl3" ); + thickl3->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)5, 0, 0, thickl3->sizePolicy().hasHeightForWidth() ) ); + thickl3->setText( trUtf8( "Thick." ) ); + + Frame5Layout->addWidget( thickl3, 1, 0 ); + + filll3 = new QLabel( Frame5, "filll3" ); + filll3->setText( trUtf8( "Fill" ) ); + + Frame5Layout->addWidget( filll3, 2, 0 ); + + linel3 = new QLabel( Frame5, "linel3" ); + linel3->setText( trUtf8( "Line" ) ); + + Frame5Layout->addWidget( linel3, 3, 0 ); + + TextLabel3 = new QLabel( Frame5, "TextLabel3" ); + TextLabel3->setMinimumSize( QSize( 0, 25 ) ); + QFont TextLabel3_font( TextLabel3->font() ); + TextLabel3_font.setBold( TRUE ); + TextLabel3_font.setUnderline( TRUE ); + TextLabel3->setFont( TextLabel3_font ); + TextLabel3->setText( trUtf8( "YZ wall" ) ); + + Frame5Layout->addMultiCellWidget( TextLabel3, 0, 0, 0, 1 ); + + yzFill = new KSFillBtn( Frame5, "yzFill" ); + yzFill->setMinimumSize( QSize( 0, 22 ) ); + + Frame5Layout->addWidget( yzFill, 2, 1 ); + + yzLine = new KSLineBtn( Frame5, "yzLine" ); + yzLine->setMinimumSize( QSize( 0, 22 ) ); + + Frame5Layout->addWidget( yzLine, 3, 1 ); + QSpacerItem* spacer_3 = new QSpacerItem( 20, 20, QSizePolicy::Minimum, QSizePolicy::Expanding ); + Frame5Layout->addItem( spacer_3, 4, 1 ); + KSPanelCubeInterfLayout->addWidget( Frame5 ); + + Frame4 = new QFrame( this, "Frame4" ); + Frame4->setFrameShape( QFrame::StyledPanel ); + Frame4->setFrameShadow( QFrame::Raised ); + Frame4Layout = new QGridLayout( Frame4, 1, 1, 10, 1, "Frame4Layout"); + + QLabel_12 = new QLabel( Frame4, "QLabel_12" ); + QLabel_12->setMinimumSize( QSize( 0, 25 ) ); + QFont QLabel_12_font( QLabel_12->font() ); + QLabel_12_font.setBold( TRUE ); + QLabel_12_font.setUnderline( TRUE ); + QLabel_12->setFont( QLabel_12_font ); + QLabel_12->setText( trUtf8( "Length of edges" ) ); + + Frame4Layout->addMultiCellWidget( QLabel_12, 0, 0, 0, 1 ); + + xEdge = new QLineEdit( Frame4, "xEdge" ); + xEdge->setMaximumSize( QSize( 60, 32767 ) ); + + Frame4Layout->addWidget( xEdge, 1, 1 ); + + yEdge = new QLineEdit( Frame4, "yEdge" ); + yEdge->setMaximumSize( QSize( 60, 32767 ) ); + + Frame4Layout->addWidget( yEdge, 2, 1 ); + + xaxisl = new QLabel( Frame4, "xaxisl" ); + xaxisl->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)5, 0, 0, xaxisl->sizePolicy().hasHeightForWidth() ) ); + xaxisl->setText( trUtf8( "X edge" ) ); + + Frame4Layout->addWidget( xaxisl, 1, 0 ); + + yaxisl = new QLabel( Frame4, "yaxisl" ); + yaxisl->setText( trUtf8( "Y edge" ) ); + + Frame4Layout->addWidget( yaxisl, 2, 0 ); + + zaxisl = new QLabel( Frame4, "zaxisl" ); + zaxisl->setText( trUtf8( "Z edge" ) ); + + Frame4Layout->addWidget( zaxisl, 3, 0 ); + + zEdge = new QLineEdit( Frame4, "zEdge" ); + zEdge->setMaximumSize( QSize( 60, 32767 ) ); + + Frame4Layout->addWidget( zEdge, 3, 1 ); + QSpacerItem* spacer_4 = new QSpacerItem( 20, 20, QSizePolicy::Minimum, QSizePolicy::Expanding ); + Frame4Layout->addItem( spacer_4, 4, 1 ); + KSPanelCubeInterfLayout->addWidget( Frame4 ); +} + +/* + * Destroys the object and frees any allocated resources + */ +KSPanelCubeInterf::~KSPanelCubeInterf() +{ + // no need to delete child widgets, Qt does it all for us +} + +#include "kspanelcubeinterf.moc" diff --git a/kmatplot/dialogs/kspanelcubeinterf.ui b/kmatplot/dialogs/kspanelcubeinterf.ui new file mode 100644 index 0000000..5dda7dc --- /dev/null +++ b/kmatplot/dialogs/kspanelcubeinterf.ui @@ -0,0 +1,611 @@ + +KSPanelCubeInterf + + + KSPanelCubeInterf + + + + 0 + 0 + 612 + 161 + + + + + 5 + 5 + 0 + 0 + + + + KSPanelForm + + + + unnamed + + + 1 + + + 1 + + + + Frame7 + + + StyledPanel + + + Raised + + + + unnamed + + + 10 + + + 1 + + + + xyThick + + + + 60 + 32767 + + + + + + thickl + + + + 3 + 5 + 0 + 0 + + + + Thick. + + + + + linel + + + Line + + + + + TextLabel1 + + + + 0 + 25 + + + + + 1 + 1 + + + + XY wall + + + + + Spacer2 + + + Vertical + + + Expanding + + + + 20 + 20 + + + + + + xyLine + + + + 0 + 22 + + + + + 100 + 32767 + + + + + + filll + + + Fill + + + + + xyFill + + + + 0 + 22 + + + + + 100 + 32767 + + + + + + + + Frame6 + + + StyledPanel + + + Raised + + + + unnamed + + + 10 + + + 1 + + + + xzThick + + + + 60 + 32767 + + + + + + + + + thickl2 + + + + 3 + 5 + 0 + 0 + + + + Thick. + + + + + filll2 + + + Fill + + + + + TextLabel2 + + + + 0 + 25 + + + + + 1 + 1 + + + + XZ Wall + + + + + Spacer1 + + + Vertical + + + Expanding + + + + 20 + 20 + + + + + + linel2 + + + Line + + + + + xzLine + + + + 0 + 22 + + + + + + xzFill + + + + 0 + 22 + + + + + + + + Frame5 + + + StyledPanel + + + Raised + + + + unnamed + + + 10 + + + 1 + + + + yzThick + + + + 60 + 32767 + + + + + + thickl3 + + + + 3 + 5 + 0 + 0 + + + + Thick. + + + + + filll3 + + + Fill + + + + + linel3 + + + Line + + + + + TextLabel3 + + + + 0 + 25 + + + + + 1 + 1 + + + + YZ wall + + + + + yzFill + + + + 0 + 22 + + + + + + yzLine + + + + 0 + 22 + + + + + + Spacer3 + + + Vertical + + + Expanding + + + + 20 + 20 + + + + + + + + Frame4 + + + StyledPanel + + + Raised + + + + unnamed + + + 10 + + + 1 + + + + QLabel_12 + + + + 0 + 25 + + + + + 1 + 1 + + + + Length of edges + + + + + xEdge + + + + 60 + 32767 + + + + + + yEdge + + + + 60 + 32767 + + + + + + xaxisl + + + + 3 + 5 + 0 + 0 + + + + X edge + + + + + yaxisl + + + Y edge + + + + + zaxisl + + + Z edge + + + + + zEdge + + + + 60 + 32767 + + + + + + Spacer4 + + + Vertical + + + Expanding + + + + 20 + 20 + + + + + + + + + + KSFillBtn +
ksattrbtn.h
+ + -1 + 22 + + 0 + + 5 + 5 + 0 + 0 + + image0 +
+ + KSPanel +
kspanel.h
+ + 500 + 140 + + 1 + + 0 + 0 + 0 + 0 + + image1 +
+ + KSLineBtn +
ksattrbtn.h
+ + -1 + 22 + + 0 + + 5 + 5 + 0 + 0 + + image2 +
+
+ + + 789ca5ceb10ac23010c6f13d4f71245b90f48a6805f1111447411c9254d1a10a5a0711dfddbba669822e827f0acdf72b84161a36eb25e842dc5adb9e3cf8a3bd82aeef4df3d8ee164f21cb29d03381528e8434e0617539eff9ace8ac10ab1a91a7e75939c4302dcfd9387e753c0f5498a64f71f4ce4ca91e93a9d80f66bfcd3a3b98ef22728cb931119acc02310e168930592abb8febfee06ffb48bee6e20df819667e + + + 789cd3d7528808f055d0d2e72a2e492cc94c5648ce482c52d04a29cdcdad8c8eb5ade65232540043251d2e253d856405e554300073956aadb900494e10c6 + + + 789cd3d7528808f055d0d2e72a2e492cc94c5648ce482c52d04a29cdcdad8c8eb5ade6523234530022630543251d2e253d856405bffcbc54103b11c8564e3449344c3401719541dcb434032000ab440338c59481004d4c5919551022a6a7872c08370f9b1892207e31842001b14488a0b232b23fb089e9411d8a2606f6106a1840fc88355c6aadb9009dd649aa + + + +
diff --git a/kmatplot/dialogs/kspanelcurveinterf.cpp b/kmatplot/dialogs/kspanelcurveinterf.cpp new file mode 100644 index 0000000..0009bb8 --- /dev/null +++ b/kmatplot/dialogs/kspanelcurveinterf.cpp @@ -0,0 +1,254 @@ +/**************************************************************************** +** Form implementation generated from reading ui file './kspanelcurveinterf.ui' +** +** Created: śro mar 20 18:52:56 2002 +** by: The User Interface Compiler (uic) +** +** WARNING! All changes made in this file will be lost! +****************************************************************************/ +#include "kspanelcurveinterf.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "ksattrbtn.h" +#include "kspanel.h" +#include "kstextedit.h" + +/* + * Constructs a KSPanelCurveInterf which is a child of 'parent', with the + * name 'name'.' + */ +KSPanelCurveInterf::KSPanelCurveInterf( QWidget* parent, const char* name ) + : KSPanel( parent, name ) +{ + if ( !name ) + setName( "KSPanelCurveInterf" ); + resize( 496, 140 ); + setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5, (QSizePolicy::SizeType)5, 0, 0, sizePolicy().hasHeightForWidth() ) ); + setCaption( trUtf8( "KSPanelForm" ) ); + KSPanelCurveInterfLayout = new QHBoxLayout( this, 1, 1, "KSPanelCurveInterfLayout"); + + Frame5 = new QFrame( this, "Frame5" ); + Frame5->setFrameShape( QFrame::StyledPanel ); + Frame5->setFrameShadow( QFrame::Raised ); + Frame5Layout = new QGridLayout( Frame5, 1, 1, 10, 1, "Frame5Layout"); + + titlee = new KSTextEdit( Frame5, "titlee" ); + titlee->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)0, 0, 0, titlee->sizePolicy().hasHeightForWidth() ) ); + titlee->setMinimumSize( QSize( 0, 22 ) ); + + Frame5Layout->addMultiCellWidget( titlee, 0, 0, 0, 1 ); + + typec = new QComboBox( FALSE, Frame5, "typec" ); + typec->insertItem( trUtf8( "Lines" ) ); + typec->insertItem( trUtf8( "Polys" ) ); + typec->insertItem( trUtf8( "Bars" ) ); + typec->insertItem( trUtf8( "Vectors" ) ); + typec->insertItem( trUtf8( "Rectangles" ) ); + typec->insertItem( trUtf8( "Ellipses" ) ); + typec->setInsertionPolicy( QComboBox::AtTop ); + + Frame5Layout->addMultiCellWidget( typec, 1, 1, 0, 1 ); + + xaxisc = new QComboBox( FALSE, Frame5, "xaxisc" ); + xaxisc->setInsertionPolicy( QComboBox::AtTop ); + + Frame5Layout->addWidget( xaxisc, 2, 1 ); + + QLabel_13 = new QLabel( Frame5, "QLabel_13" ); + QLabel_13->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)5, 0, 0, QLabel_13->sizePolicy().hasHeightForWidth() ) ); + QLabel_13->setText( trUtf8( "X-Axis" ) ); + + Frame5Layout->addWidget( QLabel_13, 2, 0 ); + + yaxisc = new QComboBox( FALSE, Frame5, "yaxisc" ); + yaxisc->setInsertionPolicy( QComboBox::AtTop ); + + Frame5Layout->addWidget( yaxisc, 3, 1 ); + + QLabel_14 = new QLabel( Frame5, "QLabel_14" ); + QLabel_14->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)5, 0, 0, QLabel_14->sizePolicy().hasHeightForWidth() ) ); + QLabel_14->setText( trUtf8( "Y-Axis" ) ); + + Frame5Layout->addWidget( QLabel_14, 3, 0 ); + + legendc = new QCheckBox( Frame5, "legendc" ); + legendc->setText( trUtf8( "Show legend item" ) ); + + Frame5Layout->addMultiCellWidget( legendc, 4, 4, 0, 1 ); + QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Minimum, QSizePolicy::Preferred ); + Frame5Layout->addItem( spacer, 5, 1 ); + KSPanelCurveInterfLayout->addWidget( Frame5 ); + + Frame3 = new QFrame( this, "Frame3" ); + Frame3->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5, (QSizePolicy::SizeType)5, 0, 0, Frame3->sizePolicy().hasHeightForWidth() ) ); + Frame3->setFrameShape( QFrame::StyledPanel ); + Frame3->setFrameShadow( QFrame::Raised ); + Frame3Layout = new QGridLayout( Frame3, 1, 1, 10, 1, "Frame3Layout"); + + deltadxe = new QLineEdit( Frame3, "deltadxe" ); + deltadxe->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)2, (QSizePolicy::SizeType)0, 0, 0, deltadxe->sizePolicy().hasHeightForWidth() ) ); + + Frame3Layout->addWidget( deltadxe, 1, 2 ); + + zeroye = new QLineEdit( Frame3, "zeroye" ); + zeroye->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)2, (QSizePolicy::SizeType)0, 0, 0, zeroye->sizePolicy().hasHeightForWidth() ) ); + + Frame3Layout->addWidget( zeroye, 4, 2 ); + + QLabel_11 = new QLabel( Frame3, "QLabel_11" ); + QLabel_11->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)5, 0, 0, QLabel_11->sizePolicy().hasHeightForWidth() ) ); + QLabel_11->setText( trUtf8( "DX" ) ); + + Frame3Layout->addWidget( QLabel_11, 1, 0 ); + + deltapdxe = new QLineEdit( Frame3, "deltapdxe" ); + deltapdxe->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)2, (QSizePolicy::SizeType)0, 0, 0, deltapdxe->sizePolicy().hasHeightForWidth() ) ); + + Frame3Layout->addWidget( deltapdxe, 1, 1 ); + + deltadye = new QLineEdit( Frame3, "deltadye" ); + deltadye->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)2, (QSizePolicy::SizeType)0, 0, 0, deltadye->sizePolicy().hasHeightForWidth() ) ); + + Frame3Layout->addWidget( deltadye, 2, 2 ); + + zeroxe = new QLineEdit( Frame3, "zeroxe" ); + zeroxe->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)2, (QSizePolicy::SizeType)0, 0, 0, zeroxe->sizePolicy().hasHeightForWidth() ) ); + + Frame3Layout->addWidget( zeroxe, 4, 1 ); + + deltapdye = new QLineEdit( Frame3, "deltapdye" ); + deltapdye->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)2, (QSizePolicy::SizeType)0, 0, 0, deltapdye->sizePolicy().hasHeightForWidth() ) ); + + Frame3Layout->addWidget( deltapdye, 2, 1 ); + + QLabel_12 = new QLabel( Frame3, "QLabel_12" ); + QLabel_12->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)5, 0, 0, QLabel_12->sizePolicy().hasHeightForWidth() ) ); + QLabel_12->setText( trUtf8( "DY" ) ); + + Frame3Layout->addWidget( QLabel_12, 2, 0 ); + + TextLabel1 = new QLabel( Frame3, "TextLabel1" ); + TextLabel1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)2, (QSizePolicy::SizeType)5, 0, 0, TextLabel1->sizePolicy().hasHeightForWidth() ) ); + TextLabel1->setText( trUtf8( "%" ) ); + TextLabel1->setAlignment( int( QLabel::AlignBottom | QLabel::AlignHCenter ) ); + + Frame3Layout->addWidget( TextLabel1, 0, 1 ); + + TextLabel3 = new QLabel( Frame3, "TextLabel3" ); + TextLabel3->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)2, (QSizePolicy::SizeType)5, 0, 0, TextLabel3->sizePolicy().hasHeightForWidth() ) ); + TextLabel3->setText( trUtf8( "x" ) ); + TextLabel3->setAlignment( int( QLabel::AlignBottom | QLabel::AlignHCenter ) ); + + Frame3Layout->addWidget( TextLabel3, 3, 1 ); + + TextLabel2 = new QLabel( Frame3, "TextLabel2" ); + TextLabel2->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)2, (QSizePolicy::SizeType)5, 0, 0, TextLabel2->sizePolicy().hasHeightForWidth() ) ); + TextLabel2->setText( trUtf8( "abs." ) ); + TextLabel2->setAlignment( int( QLabel::AlignBottom | QLabel::AlignHCenter ) ); + + Frame3Layout->addWidget( TextLabel2, 0, 2 ); + + TextLabel4 = new QLabel( Frame3, "TextLabel4" ); + TextLabel4->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)2, (QSizePolicy::SizeType)5, 0, 0, TextLabel4->sizePolicy().hasHeightForWidth() ) ); + TextLabel4->setText( trUtf8( "y" ) ); + TextLabel4->setAlignment( int( QLabel::AlignBottom | QLabel::AlignHCenter ) ); + + Frame3Layout->addWidget( TextLabel4, 3, 2 ); + + QLabel_4 = new QLabel( Frame3, "QLabel_4" ); + QLabel_4->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)5, 0, 0, QLabel_4->sizePolicy().hasHeightForWidth() ) ); + QLabel_4->setText( trUtf8( "Zero" ) ); + + Frame3Layout->addWidget( QLabel_4, 4, 0 ); + KSPanelCurveInterfLayout->addWidget( Frame3 ); + + Frame4 = new QFrame( this, "Frame4" ); + Frame4->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5, (QSizePolicy::SizeType)5, 0, 0, Frame4->sizePolicy().hasHeightForWidth() ) ); + Frame4->setFrameShape( QFrame::StyledPanel ); + Frame4->setFrameShadow( QFrame::Raised ); + Frame4Layout = new QGridLayout( Frame4, 1, 1, 10, 1, "Frame4Layout"); + + QLabel_6 = new QLabel( Frame4, "QLabel_6" ); + QLabel_6->setText( trUtf8( "Fill style" ) ); + + Frame4Layout->addWidget( QLabel_6, 1, 0 ); + + QLabel_5 = new QLabel( Frame4, "QLabel_5" ); + QLabel_5->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)5, 0, 0, QLabel_5->sizePolicy().hasHeightForWidth() ) ); + QLabel_5->setText( trUtf8( "Line style" ) ); + + Frame4Layout->addWidget( QLabel_5, 0, 0 ); + + QLabel_20 = new QLabel( Frame4, "QLabel_20" ); + QLabel_20->setText( trUtf8( "Error bars" ) ); + + Frame4Layout->addWidget( QLabel_20, 3, 0 ); + + QLabel_21 = new QLabel( Frame4, "QLabel_21" ); + QLabel_21->setText( trUtf8( "Point mark" ) ); + + Frame4Layout->addWidget( QLabel_21, 2, 0 ); + + QLabel_8 = new QLabel( Frame4, "QLabel_8" ); + QLabel_8->setText( trUtf8( "X - Y" ) ); + + Frame4Layout->addWidget( QLabel_8, 4, 0 ); + + endArrow = new KSArrowBtn( Frame4, "endArrow" ); + + Frame4Layout->addWidget( endArrow, 5, 2 ); + + originArrow = new KSArrowBtn( Frame4, "originArrow" ); + + Frame4Layout->addWidget( originArrow, 5, 1 ); + + xLine = new KSLineBtn( Frame4, "xLine" ); + + Frame4Layout->addWidget( xLine, 4, 1 ); + + yLine = new KSLineBtn( Frame4, "yLine" ); + + Frame4Layout->addWidget( yLine, 4, 2 ); + + curveLine = new KSLineBtn( Frame4, "curveLine" ); + curveLine->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)5, 1, 0, curveLine->sizePolicy().hasHeightForWidth() ) ); + + Frame4Layout->addMultiCellWidget( curveLine, 0, 0, 1, 2 ); + + curveFill = new KSFillBtn( Frame4, "curveFill" ); + + Frame4Layout->addMultiCellWidget( curveFill, 1, 1, 1, 2 ); + + curvePoint = new KSPointBtn( Frame4, "curvePoint" ); + + Frame4Layout->addMultiCellWidget( curvePoint, 2, 2, 1, 2 ); + + errorLine = new KSLineBtn( Frame4, "errorLine" ); + + Frame4Layout->addMultiCellWidget( errorLine, 3, 3, 1, 2 ); + + QLabel_9 = new QLabel( Frame4, "QLabel_9" ); + QLabel_9->setText( trUtf8( "Arrows" ) ); + + Frame4Layout->addWidget( QLabel_9, 5, 0 ); + KSPanelCurveInterfLayout->addWidget( Frame4 ); +} + +/* + * Destroys the object and frees any allocated resources + */ +KSPanelCurveInterf::~KSPanelCurveInterf() +{ + // no need to delete child widgets, Qt does it all for us +} + +#include "kspanelcurveinterf.moc" diff --git a/kmatplot/dialogs/kspanelcurveinterf.ui b/kmatplot/dialogs/kspanelcurveinterf.ui new file mode 100644 index 0000000..182eebf --- /dev/null +++ b/kmatplot/dialogs/kspanelcurveinterf.ui @@ -0,0 +1,675 @@ + +KSPanelCurveInterf + + + KSPanelCurveInterf + + + + 0 + 0 + 496 + 140 + + + + + 5 + 5 + 0 + 0 + + + + KSPanelForm + + + + unnamed + + + 1 + + + 1 + + + + Frame5 + + + StyledPanel + + + Raised + + + + unnamed + + + 10 + + + 1 + + + + titlee + + + + 7 + 0 + 0 + 0 + + + + + 0 + 22 + + + + + + + Lines + + + + + Polys + + + + + Bars + + + + + Vectors + + + + + Rectangles + + + + + Ellipses + + + + typec + + + AtTop + + + + + xaxisc + + + AtTop + + + + + QLabel_13 + + + + 3 + 5 + 0 + 0 + + + + X-Axis + + + + + yaxisc + + + AtTop + + + + + QLabel_14 + + + + 3 + 5 + 0 + 0 + + + + Y-Axis + + + + + legendc + + + Show legend item + + + + + Spacer1 + + + Vertical + + + Preferred + + + + 20 + 20 + + + + + + + + Frame3 + + + + 5 + 5 + 0 + 0 + + + + StyledPanel + + + Raised + + + + unnamed + + + 10 + + + 1 + + + + deltadxe + + + + 2 + 0 + 0 + 0 + + + + + + zeroye + + + + 2 + 0 + 0 + 0 + + + + + + QLabel_11 + + + + 3 + 5 + 0 + 0 + + + + DX + + + + + deltapdxe + + + + 2 + 0 + 0 + 0 + + + + + + deltadye + + + + 2 + 0 + 0 + 0 + + + + + + zeroxe + + + + 2 + 0 + 0 + 0 + + + + + + deltapdye + + + + 2 + 0 + 0 + 0 + + + + + + QLabel_12 + + + + 3 + 5 + 0 + 0 + + + + DY + + + + + TextLabel1 + + + + 2 + 5 + 0 + 0 + + + + % + + + AlignBottom|AlignHCenter + + + + + TextLabel3 + + + + 2 + 5 + 0 + 0 + + + + x + + + AlignBottom|AlignHCenter + + + + + TextLabel2 + + + + 2 + 5 + 0 + 0 + + + + abs. + + + AlignBottom|AlignHCenter + + + + + TextLabel4 + + + + 2 + 5 + 0 + 0 + + + + y + + + AlignBottom|AlignHCenter + + + + + QLabel_4 + + + + 3 + 5 + 0 + 0 + + + + Zero + + + + + + + Frame4 + + + + 5 + 5 + 0 + 0 + + + + StyledPanel + + + Raised + + + + unnamed + + + 10 + + + 1 + + + + QLabel_6 + + + Fill style + + + + + QLabel_5 + + + + 3 + 5 + 0 + 0 + + + + Line style + + + + + QLabel_20 + + + Error bars + + + + + QLabel_21 + + + Point mark + + + + + QLabel_8 + + + X - Y + + + + + endArrow + + + + + originArrow + + + + + xLine + + + + + yLine + + + + + curveLine + + + + 3 + 5 + 1 + 0 + + + + + + curveFill + + + + + curvePoint + + + + + errorLine + + + + + QLabel_9 + + + Arrows + + + + + + + + + KSFillBtn +
ksattrbtn.h
+ + -1 + 22 + + 0 + + 5 + 5 + 0 + 0 + + image0 +
+ + KSPanel +
kspanel.h
+ + 500 + 140 + + 1 + + 0 + 0 + 0 + 0 + + image1 +
+ + KSLineBtn +
ksattrbtn.h
+ + -1 + 22 + + 0 + + 5 + 5 + 0 + 0 + + image2 +
+ + KSArrowBtn +
ksattrbtn.h
+ + -1 + 22 + + 0 + + 5 + 5 + 0 + 0 + + image3 +
+ + KSPointBtn +
ksattrbtn.h
+ + -1 + 22 + + 0 + + 5 + 5 + 0 + 0 + + image4 +
+ + KSTextEdit +
kstextedit.h
+ + -1 + -1 + + 0 + + 5 + 5 + 0 + 0 + + image5 +
+
+ + + 789ca5ceb10ac23010c6f13d4f71245b90f48a6805f1111447411c9254d1a10a5a0711dfddbba669822e827f0acdf72b84161a36eb25e842dc5adb9e3cf8a3bd82aeef4df3d8ee164f21cb29d03381528e8434e0617539eff9ace8ac10ab1a91a7e75939c4302dcfd9387e753c0f5498a64f71f4ce4ca91e93a9d80f66bfcd3a3b98ef22728cb931119acc02310e168930592abb8febfee06ffb48bee6e20df819667e + + + 789cd3d7528808f055d0d2e72a2e492cc94c5648ce482c52d04a29cdcdad8c8eb5ade65232540043251d2e253d856405e554300073956aadb900494e10c6 + + + 789cd3d7528808f055d0d2e72a2e492cc94c5648ce482c52d04a29cdcdad8c8eb5ade6523234530022630543251d2e253d856405bffcbc54103b11c8564e3449344c3401719541dcb434032000ab440338c59481004d4c5919551022a6a7872c08370f9b1892207e31842001b14488a0b232b23fb089e9411d8a2606f6106a1840fc88355c6aadb9009dd649aa + + + 789c75d0c10a82401006e0bb4f313837094d3124a247283a06d161662bea6041d921a2776f67db44d7f1670ffbefc7ae835902dbcd0a922c7a34d45c0c9833dd21393cebfab5db2fdf515c1460d70cf27812c5291858dfae47d9a3dde3d445aa915a7135af582a4ba592722aa592d4938b7b474d28e8a30849581147ac8a251e131e112444552c708a66280e64f6503ca42907d242f80f7ad0953e7424809fa0024ee47000fe0e0dc17f4781ff04a377346aa7c691d794c49f45f4052a748685 + + + 789cd3d7528808f055d0d2e72a2e492cc94c5648ce482c52d04a29cdcdad8c8eb5ade6523234530022630543251d2e253d856405bffcbc54105b19c856360003103711c44d0303b04a34408c98b2b232ba98726262a2324962ca20538002c8e641059491ed8588296311435387300f451d6562ca308bb1864bad3517007a684bc0 + + + 789cd3d7528808f055d0d2e72a2e492cc94c5648ce482c52d04a29cdcdad8c8eb5ade6523234530022630543251d2e253d856405bffcbc54105b19c856360003103711c44d490541b04a34805b4c593911ca0731d0c49413812cfc7a95c18a9561ea4022890802530caa5719a40fac17490c9b3a9ce6a1da4bb47f8910abb5e602003a1250e8 + + + +
diff --git a/kmatplot/dialogs/kspanelfigureinterf.cpp b/kmatplot/dialogs/kspanelfigureinterf.cpp new file mode 100644 index 0000000..96664cc --- /dev/null +++ b/kmatplot/dialogs/kspanelfigureinterf.cpp @@ -0,0 +1,165 @@ +/**************************************************************************** +** Form implementation generated from reading ui file './kspanelfigureinterf.ui' +** +** Created: śro mar 20 18:52:58 2002 +** by: The User Interface Compiler (uic) +** +** WARNING! All changes made in this file will be lost! +****************************************************************************/ +#include "kspanelfigureinterf.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "kspanel.h" +#include "kstextedit.h" + +/* + * Constructs a KSPanelFigureInterf which is a child of 'parent', with the + * name 'name'.' + */ +KSPanelFigureInterf::KSPanelFigureInterf( QWidget* parent, const char* name ) + : KSPanel( parent, name ) +{ + if ( !name ) + setName( "KSPanelFigureInterf" ); + resize( 500, 140 ); + setCaption( trUtf8( "KSPanelForm" ) ); + KSPanelFigureInterfLayout = new QHBoxLayout( this, 1, 1, "KSPanelFigureInterfLayout"); + + Frame5 = new QFrame( this, "Frame5" ); + Frame5->setFrameShape( QFrame::StyledPanel ); + Frame5->setFrameShadow( QFrame::Raised ); + Frame5Layout = new QGridLayout( Frame5, 1, 1, 10, 1, "Frame5Layout"); + + TextLabel2 = new QLabel( Frame5, "TextLabel2" ); + TextLabel2->setMinimumSize( QSize( 0, 25 ) ); + QFont TextLabel2_font( TextLabel2->font() ); + TextLabel2_font.setBold( TRUE ); + TextLabel2_font.setUnderline( TRUE ); + TextLabel2->setFont( TextLabel2_font ); + TextLabel2->setText( trUtf8( "Title" ) ); + + Frame5Layout->addWidget( TextLabel2, 0, 0 ); + QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Minimum, QSizePolicy::Expanding ); + Frame5Layout->addItem( spacer, 2, 0 ); + + titlee = new KSTextEdit( Frame5, "titlee" ); + titlee->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)0, 0, 0, titlee->sizePolicy().hasHeightForWidth() ) ); + titlee->setMinimumSize( QSize( 0, 22 ) ); + + Frame5Layout->addWidget( titlee, 1, 0 ); + KSPanelFigureInterfLayout->addWidget( Frame5 ); + + Frame4 = new QFrame( this, "Frame4" ); + Frame4->setFrameShape( QFrame::StyledPanel ); + Frame4->setFrameShadow( QFrame::Raised ); + Frame4Layout = new QGridLayout( Frame4, 1, 1, 10, 1, "Frame4Layout"); + + xaxisc = new QComboBox( FALSE, Frame4, "xaxisc" ); + xaxisc->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)0, 2, 0, xaxisc->sizePolicy().hasHeightForWidth() ) ); + xaxisc->setInsertionPolicy( QComboBox::AtTop ); + + Frame4Layout->addWidget( xaxisc, 1, 1 ); + + zaxisc = new QComboBox( FALSE, Frame4, "zaxisc" ); + zaxisc->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)0, 0, 0, zaxisc->sizePolicy().hasHeightForWidth() ) ); + zaxisc->setInsertionPolicy( QComboBox::AtTop ); + + Frame4Layout->addWidget( zaxisc, 4, 1 ); + + QLabel_6 = new QLabel( Frame4, "QLabel_6" ); + QLabel_6->setText( trUtf8( "Z-Axis " ) ); + + Frame4Layout->addWidget( QLabel_6, 4, 0 ); + + yaxisc = new QComboBox( FALSE, Frame4, "yaxisc" ); + yaxisc->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)0, 0, 0, yaxisc->sizePolicy().hasHeightForWidth() ) ); + yaxisc->setInsertionPolicy( QComboBox::AtTop ); + + Frame4Layout->addWidget( yaxisc, 2, 1 ); + + QLabel_7 = new QLabel( Frame4, "QLabel_7" ); + QLabel_7->setText( trUtf8( "V-Axis " ) ); + + Frame4Layout->addWidget( QLabel_7, 3, 0 ); + + QLabel_2 = new QLabel( Frame4, "QLabel_2" ); + QLabel_2->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5, (QSizePolicy::SizeType)5, 0, 0, QLabel_2->sizePolicy().hasHeightForWidth() ) ); + QLabel_2->setText( trUtf8( "X-Axis " ) ); + + Frame4Layout->addWidget( QLabel_2, 1, 0 ); + + vaxisc = new QComboBox( FALSE, Frame4, "vaxisc" ); + vaxisc->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)0, 0, 0, vaxisc->sizePolicy().hasHeightForWidth() ) ); + vaxisc->setInsertionPolicy( QComboBox::AtTop ); + + Frame4Layout->addWidget( vaxisc, 3, 1 ); + + QLabel_5 = new QLabel( Frame4, "QLabel_5" ); + QLabel_5->setText( trUtf8( "Y-Axis " ) ); + + Frame4Layout->addWidget( QLabel_5, 2, 0 ); + + TextLabel1 = new QLabel( Frame4, "TextLabel1" ); + TextLabel1->setMinimumSize( QSize( 0, 25 ) ); + QFont TextLabel1_font( TextLabel1->font() ); + TextLabel1_font.setBold( TRUE ); + TextLabel1_font.setUnderline( TRUE ); + TextLabel1->setFont( TextLabel1_font ); + TextLabel1->setText( trUtf8( "Bind to" ) ); + + Frame4Layout->addMultiCellWidget( TextLabel1, 0, 0, 0, 1 ); + QSpacerItem* spacer_2 = new QSpacerItem( 20, 20, QSizePolicy::Minimum, QSizePolicy::Expanding ); + Frame4Layout->addItem( spacer_2, 5, 1 ); + KSPanelFigureInterfLayout->addWidget( Frame4 ); + + Frame3 = new QFrame( this, "Frame3" ); + Frame3->setFrameShape( QFrame::StyledPanel ); + Frame3->setFrameShadow( QFrame::Raised ); + Frame3Layout = new QGridLayout( Frame3, 1, 1, 10, 1, "Frame3Layout"); + + accuracys = new QSpinBox( Frame3, "accuracys" ); + accuracys->setMaxValue( 99 ); + + Frame3Layout->addWidget( accuracys, 1, 1 ); + + vertexl = new QLabel( Frame3, "vertexl" ); + vertexl->setText( trUtf8( "VCR" ) ); + + Frame3Layout->addWidget( vertexl, 1, 0 ); + + legendc = new QCheckBox( Frame3, "legendc" ); + legendc->setText( trUtf8( "Show legend item" ) ); + + Frame3Layout->addMultiCellWidget( legendc, 2, 2, 0, 1 ); + QSpacerItem* spacer_3 = new QSpacerItem( 20, 20, QSizePolicy::Minimum, QSizePolicy::Expanding ); + Frame3Layout->addMultiCell( spacer_3, 3, 3, 0, 1 ); + + TextLabel1_2 = new QLabel( Frame3, "TextLabel1_2" ); + QFont TextLabel1_2_font( TextLabel1_2->font() ); + TextLabel1_2_font.setBold( TRUE ); + TextLabel1_2_font.setUnderline( TRUE ); + TextLabel1_2->setFont( TextLabel1_2_font ); + TextLabel1_2->setText( trUtf8( "Options" ) ); + + Frame3Layout->addMultiCellWidget( TextLabel1_2, 0, 0, 0, 1 ); + KSPanelFigureInterfLayout->addWidget( Frame3 ); +} + +/* + * Destroys the object and frees any allocated resources + */ +KSPanelFigureInterf::~KSPanelFigureInterf() +{ + // no need to delete child widgets, Qt does it all for us +} + +#include "kspanelfigureinterf.moc" diff --git a/kmatplot/dialogs/kspanelfigureinterf.ui b/kmatplot/dialogs/kspanelfigureinterf.ui new file mode 100644 index 0000000..9d84bde --- /dev/null +++ b/kmatplot/dialogs/kspanelfigureinterf.ui @@ -0,0 +1,391 @@ + +KSPanelFigureInterf + + + KSPanelFigureInterf + + + + 0 + 2 + 500 + 140 + + + + KSPanelForm + + + + unnamed + + + 1 + + + 1 + + + + Frame5 + + + StyledPanel + + + Raised + + + + unnamed + + + 10 + + + 1 + + + + TextLabel2 + + + + 0 + 25 + + + + + 1 + 1 + + + + Title + + + + + Spacer2 + + + Vertical + + + Expanding + + + + 20 + 20 + + + + + + titlee + + + + 7 + 0 + 0 + 0 + + + + + 0 + 22 + + + + + + + + Frame4 + + + StyledPanel + + + Raised + + + + unnamed + + + 10 + + + 1 + + + + xaxisc + + + + 7 + 0 + 2 + 0 + + + + AtTop + + + + + zaxisc + + + + 7 + 0 + 0 + 0 + + + + AtTop + + + + + QLabel_6 + + + Z-Axis + + + + + yaxisc + + + + 7 + 0 + 0 + 0 + + + + AtTop + + + + + QLabel_7 + + + V-Axis + + + + + QLabel_2 + + + + 5 + 5 + 0 + 0 + + + + X-Axis + + + + + vaxisc + + + + 7 + 0 + 0 + 0 + + + + AtTop + + + + + QLabel_5 + + + Y-Axis + + + + + TextLabel1 + + + + 0 + 25 + + + + + 1 + 1 + + + + Bind to + + + + + Spacer3 + + + Vertical + + + Expanding + + + + 20 + 20 + + + + + + + + Frame3 + + + StyledPanel + + + Raised + + + + unnamed + + + 10 + + + 1 + + + + accuracys + + + 99 + + + + + vertexl + + + VCR + + + + + legendc + + + Show legend item + + + + + Spacer1 + + + Vertical + + + Expanding + + + + 20 + 20 + + + + + + TextLabel1_2 + + + + 1 + 1 + + + + Options + + + + + + + + + KSPanel +
kspanel.h
+ + 500 + 140 + + 1 + + 0 + 0 + 0 + 0 + + image0 +
+ + KSTextEdit +
kstextedit.h
+ + -1 + -1 + + 0 + + 5 + 5 + 0 + 0 + + image1 +
+
+ + + 789cd3d7528808f055d0d2e72a2e492cc94c5648ce482c52d04a29cdcdad8c8eb5ade65232540043251d2e253d856405e554300073956aadb900494e10c6 + + + 789cd3d7528808f055d0d2e72a2e492cc94c5648ce482c52d04a29cdcdad8c8eb5ade6523234530022630543251d2e253d856405bffcbc54105b19c856360003103711c44d490541b04a34805b4c593911ca0731d0c49413812cfc7a95c18a9561ea4022890802530caa5719a40fac17490c9b3a9ce6a1da4bb47f8910abb5e602003a1250e8 + + + +
diff --git a/kmatplot/dialogs/kspanelframeinterf.cpp b/kmatplot/dialogs/kspanelframeinterf.cpp new file mode 100644 index 0000000..73ef62f --- /dev/null +++ b/kmatplot/dialogs/kspanelframeinterf.cpp @@ -0,0 +1,107 @@ +/**************************************************************************** +** Form implementation generated from reading ui file './kspanelframeinterf.ui' +** +** Created: śro mar 20 18:52:59 2002 +** by: The User Interface Compiler (uic) +** +** WARNING! All changes made in this file will be lost! +****************************************************************************/ +#include "kspanelframeinterf.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include "ksattrbtn.h" +#include "kspanel.h" + +/* + * Constructs a KSPanelFrameInterf which is a child of 'parent', with the + * name 'name'.' + */ +KSPanelFrameInterf::KSPanelFrameInterf( QWidget* parent, const char* name ) + : KSPanel( parent, name ) +{ + if ( !name ) + setName( "KSPanelFrameInterf" ); + resize( 500, 140 ); + setCaption( trUtf8( "KSPanelForm" ) ); + KSPanelFrameInterfLayout = new QHBoxLayout( this, 1, 1, "KSPanelFrameInterfLayout"); + + Frame4 = new QFrame( this, "Frame4" ); + Frame4->setFrameShape( QFrame::StyledPanel ); + Frame4->setFrameShadow( QFrame::Raised ); + Frame4Layout = new QGridLayout( Frame4, 1, 1, 10, 1, "Frame4Layout"); + + thicks = new QSpinBox( Frame4, "thicks" ); + thicks->setMaxValue( 99 ); + + Frame4Layout->addWidget( thicks, 1, 1 ); + + QLabel_5 = new QLabel( Frame4, "QLabel_5" ); + QLabel_5->setText( trUtf8( "Fill style" ) ); + + Frame4Layout->addWidget( QLabel_5, 3, 0 ); + + QLabel_3 = new QLabel( Frame4, "QLabel_3" ); + QLabel_3->setText( trUtf8( "Style" ) ); + + Frame4Layout->addWidget( QLabel_3, 2, 0 ); + + QLabel_2 = new QLabel( Frame4, "QLabel_2" ); + QLabel_2->setText( trUtf8( "Thickness" ) ); + + Frame4Layout->addWidget( QLabel_2, 1, 0 ); + QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Minimum, QSizePolicy::Expanding ); + Frame4Layout->addItem( spacer, 4, 1 ); + + frameStyle = new KSFillBtn( Frame4, "frameStyle" ); + frameStyle->setMinimumSize( QSize( 0, 22 ) ); + + Frame4Layout->addWidget( frameStyle, 2, 1 ); + + fillStyle = new KSFillBtn( Frame4, "fillStyle" ); + fillStyle->setMinimumSize( QSize( 0, 22 ) ); + + Frame4Layout->addWidget( fillStyle, 3, 1 ); + + TextLabel1 = new QLabel( Frame4, "TextLabel1" ); + QFont TextLabel1_font( TextLabel1->font() ); + TextLabel1_font.setBold( TRUE ); + TextLabel1_font.setUnderline( TRUE ); + TextLabel1->setFont( TextLabel1_font ); + TextLabel1->setText( trUtf8( "Frame" ) ); + + Frame4Layout->addMultiCellWidget( TextLabel1, 0, 0, 0, 1 ); + KSPanelFrameInterfLayout->addWidget( Frame4 ); + + Frame5 = new QFrame( this, "Frame5" ); + Frame5->setFrameShape( QFrame::StyledPanel ); + Frame5->setFrameShadow( QFrame::Raised ); + Frame5Layout = new QGridLayout( Frame5, 1, 1, 11, 6, "Frame5Layout"); + QSpacerItem* spacer_2 = new QSpacerItem( 20, 20, QSizePolicy::Minimum, QSizePolicy::Expanding ); + Frame5Layout->addItem( spacer_2, 0, 0 ); + KSPanelFrameInterfLayout->addWidget( Frame5 ); + + Frame6 = new QFrame( this, "Frame6" ); + Frame6->setFrameShape( QFrame::StyledPanel ); + Frame6->setFrameShadow( QFrame::Raised ); + Frame6Layout = new QGridLayout( Frame6, 1, 1, 11, 6, "Frame6Layout"); + QSpacerItem* spacer_3 = new QSpacerItem( 20, 20, QSizePolicy::Minimum, QSizePolicy::Expanding ); + Frame6Layout->addItem( spacer_3, 0, 0 ); + KSPanelFrameInterfLayout->addWidget( Frame6 ); +} + +/* + * Destroys the object and frees any allocated resources + */ +KSPanelFrameInterf::~KSPanelFrameInterf() +{ + // no need to delete child widgets, Qt does it all for us +} + +#include "kspanelframeinterf.moc" diff --git a/kmatplot/dialogs/kspanelframeinterf.ui b/kmatplot/dialogs/kspanelframeinterf.ui new file mode 100644 index 0000000..a46d5c2 --- /dev/null +++ b/kmatplot/dialogs/kspanelframeinterf.ui @@ -0,0 +1,258 @@ + +KSPanelFrameInterf + + + KSPanelFrameInterf + + + + 0 + 0 + 500 + 140 + + + + KSPanelForm + + + + unnamed + + + 1 + + + 1 + + + + Frame4 + + + StyledPanel + + + Raised + + + + unnamed + + + 10 + + + 1 + + + + thicks + + + 99 + + + + + QLabel_5 + + + Fill style + + + + + QLabel_3 + + + Style + + + + + QLabel_2 + + + Thickness + + + + + Spacer1 + + + Vertical + + + Expanding + + + + 20 + 20 + + + + + + frameStyle + + + + 0 + 22 + + + + + + fillStyle + + + + 0 + 22 + + + + + + TextLabel1 + + + + 1 + 1 + + + + Frame + + + + + + + Frame5 + + + StyledPanel + + + Raised + + + + unnamed + + + 11 + + + 6 + + + + Spacer2 + + + Vertical + + + Expanding + + + + 20 + 20 + + + + + + + + Frame6 + + + StyledPanel + + + Raised + + + + unnamed + + + 11 + + + 6 + + + + Spacer3 + + + Vertical + + + Expanding + + + + 20 + 20 + + + + + + + + + + KSFillBtn +
ksattrbtn.h
+ + -1 + 22 + + 0 + + 5 + 5 + 0 + 0 + + image0 +
+ + KSPanel +
kspanel.h
+ + 500 + 140 + + 1 + + 0 + 0 + 0 + 0 + + image1 +
+
+ + + 789ca5ceb10ac23010c6f13d4f71245b90f48a6805f1111447411c9254d1a10a5a0711dfddbba669822e827f0acdf72b84161a36eb25e842dc5adb9e3cf8a3bd82aeef4df3d8ee164f21cb29d03381528e8434e0617539eff9ace8ac10ab1a91a7e75939c4302dcfd9387e753c0f5498a64f71f4ce4ca91e93a9d80f66bfcd3a3b98ef22728cb931119acc02310e168930592abb8febfee06ffb48bee6e20df819667e + + + 789cd3d7528808f055d0d2e72a2e492cc94c5648ce482c52d04a29cdcdad8c8eb5ade65232540043251d2e253d856405e554300073956aadb900494e10c6 + + + +
diff --git a/kmatplot/dialogs/kspanelgeneralinterf.cpp b/kmatplot/dialogs/kspanelgeneralinterf.cpp new file mode 100644 index 0000000..ba866dd --- /dev/null +++ b/kmatplot/dialogs/kspanelgeneralinterf.cpp @@ -0,0 +1,188 @@ +/**************************************************************************** +** Form implementation generated from reading ui file './kspanelgeneralinterf.ui' +** +** Created: śro mar 20 18:53:00 2002 +** by: The User Interface Compiler (uic) +** +** WARNING! All changes made in this file will be lost! +****************************************************************************/ +#include "kspanelgeneralinterf.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "ksattrbtn.h" +#include "kspanel.h" + +/* + * Constructs a KSPanelGeneralInterf which is a child of 'parent', with the + * name 'name'.' + */ +KSPanelGeneralInterf::KSPanelGeneralInterf( QWidget* parent, const char* name ) + : KSPanel( parent, name ) +{ + if ( !name ) + setName( "KSPanelGeneralInterf" ); + resize( 537, 164 ); + setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5, (QSizePolicy::SizeType)5, 0, 0, sizePolicy().hasHeightForWidth() ) ); + setCaption( trUtf8( "KSPanelForm" ) ); + KSPanelGeneralInterfLayout = new QHBoxLayout( this, 1, 1, "KSPanelGeneralInterfLayout"); + + Frame5 = new QFrame( this, "Frame5" ); + Frame5->setFrameShape( QFrame::StyledPanel ); + Frame5->setFrameShadow( QFrame::Raised ); + Frame5Layout = new QGridLayout( Frame5, 1, 1, 10, 1, "Frame5Layout"); + + titlee = new QLineEdit( Frame5, "titlee" ); + + Frame5Layout->addWidget( titlee, 1, 0 ); + + TextLabel1 = new QLabel( Frame5, "TextLabel1" ); + QFont TextLabel1_font( TextLabel1->font() ); + TextLabel1_font.setBold( TRUE ); + TextLabel1_font.setUnderline( TRUE ); + TextLabel1->setFont( TextLabel1_font ); + TextLabel1->setText( trUtf8( "Title" ) ); + + Frame5Layout->addWidget( TextLabel1, 0, 0 ); + QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Minimum, QSizePolicy::Expanding ); + Frame5Layout->addItem( spacer, 2, 0 ); + KSPanelGeneralInterfLayout->addWidget( Frame5 ); + + Frame3 = new QFrame( this, "Frame3" ); + Frame3->setFrameShape( QFrame::StyledPanel ); + Frame3->setFrameShadow( QFrame::Raised ); + Frame3Layout = new QGridLayout( Frame3, 1, 1, 10, 1, "Frame3Layout"); + + QLabel_8 = new QLabel( Frame3, "QLabel_8" ); + QLabel_8->setText( trUtf8( " mm" ) ); + + Frame3Layout->addWidget( QLabel_8, 3, 2 ); + + ypose = new QLineEdit( Frame3, "ypose" ); + ypose->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5, (QSizePolicy::SizeType)0, 0, 0, ypose->sizePolicy().hasHeightForWidth() ) ); + ypose->setMaximumSize( QSize( 70, 32767 ) ); + + Frame3Layout->addWidget( ypose, 2, 1 ); + + QLabel_11 = new QLabel( Frame3, "QLabel_11" ); + QLabel_11->setText( trUtf8( " mm" ) ); + + Frame3Layout->addWidget( QLabel_11, 2, 2 ); + + widthe = new QLineEdit( Frame3, "widthe" ); + widthe->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5, (QSizePolicy::SizeType)0, 0, 0, widthe->sizePolicy().hasHeightForWidth() ) ); + widthe->setMaximumSize( QSize( 70, 32767 ) ); + widthe->setText( trUtf8( "" ) ); + + Frame3Layout->addWidget( widthe, 3, 1 ); + + QLabel_7 = new QLabel( Frame3, "QLabel_7" ); + QLabel_7->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)5, 0, 0, QLabel_7->sizePolicy().hasHeightForWidth() ) ); + QLabel_7->setText( trUtf8( " Height " ) ); + + Frame3Layout->addWidget( QLabel_7, 4, 0 ); + + QLabel_5 = new QLabel( Frame3, "QLabel_5" ); + QLabel_5->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)5, 0, 0, QLabel_5->sizePolicy().hasHeightForWidth() ) ); + QLabel_5->setText( trUtf8( " Y " ) ); + + Frame3Layout->addWidget( QLabel_5, 2, 0 ); + + QLabel_6 = new QLabel( Frame3, "QLabel_6" ); + QLabel_6->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)5, 0, 0, QLabel_6->sizePolicy().hasHeightForWidth() ) ); + QLabel_6->setText( trUtf8( " Width " ) ); + + Frame3Layout->addWidget( QLabel_6, 3, 0 ); + + heighte = new QLineEdit( Frame3, "heighte" ); + heighte->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5, (QSizePolicy::SizeType)0, 0, 0, heighte->sizePolicy().hasHeightForWidth() ) ); + heighte->setMaximumSize( QSize( 70, 32767 ) ); + + Frame3Layout->addWidget( heighte, 4, 1 ); + QSpacerItem* spacer_2 = new QSpacerItem( 20, 20, QSizePolicy::Minimum, QSizePolicy::Expanding ); + Frame3Layout->addItem( spacer_2, 5, 1 ); + + TextLabel1_2 = new QLabel( Frame3, "TextLabel1_2" ); + QFont TextLabel1_2_font( TextLabel1_2->font() ); + TextLabel1_2_font.setBold( TRUE ); + TextLabel1_2_font.setUnderline( TRUE ); + TextLabel1_2->setFont( TextLabel1_2_font ); + TextLabel1_2->setText( trUtf8( "Position & Size" ) ); + + Frame3Layout->addMultiCellWidget( TextLabel1_2, 0, 0, 0, 2 ); + + xpose = new QLineEdit( Frame3, "xpose" ); + xpose->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5, (QSizePolicy::SizeType)0, 0, 0, xpose->sizePolicy().hasHeightForWidth() ) ); + xpose->setMaximumSize( QSize( 70, 32767 ) ); + + Frame3Layout->addWidget( xpose, 1, 1 ); + + QLabel_10 = new QLabel( Frame3, "QLabel_10" ); + QLabel_10->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5, (QSizePolicy::SizeType)5, 0, 0, QLabel_10->sizePolicy().hasHeightForWidth() ) ); + QLabel_10->setText( trUtf8( " mm" ) ); + + Frame3Layout->addWidget( QLabel_10, 1, 2 ); + + QLabel_4 = new QLabel( Frame3, "QLabel_4" ); + QLabel_4->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)5, 0, 0, QLabel_4->sizePolicy().hasHeightForWidth() ) ); + QLabel_4->setText( trUtf8( " X " ) ); + + Frame3Layout->addWidget( QLabel_4, 1, 0 ); + + QLabel_9 = new QLabel( Frame3, "QLabel_9" ); + QLabel_9->setText( trUtf8( " mm" ) ); + + Frame3Layout->addWidget( QLabel_9, 4, 2 ); + KSPanelGeneralInterfLayout->addWidget( Frame3 ); + + Frame4 = new QFrame( this, "Frame4" ); + Frame4->setFrameShape( QFrame::StyledPanel ); + Frame4->setFrameShadow( QFrame::Raised ); + Frame4Layout = new QGridLayout( Frame4, 1, 1, 10, 1, "Frame4Layout"); + + QLabel_2 = new QLabel( Frame4, "QLabel_2" ); + QLabel_2->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)5, 0, 0, QLabel_2->sizePolicy().hasHeightForWidth() ) ); + QLabel_2->setText( trUtf8( "Background" ) ); + + Frame4Layout->addWidget( QLabel_2, 2, 0 ); + + draw_in_background = new QCheckBox( Frame4, "draw_in_background" ); + draw_in_background->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)0, 0, 0, draw_in_background->sizePolicy().hasHeightForWidth() ) ); + draw_in_background->setText( trUtf8( "Draw in background" ) ); + + Frame4Layout->addMultiCellWidget( draw_in_background, 1, 1, 0, 1 ); + QSpacerItem* spacer_3 = new QSpacerItem( 20, 20, QSizePolicy::Minimum, QSizePolicy::Expanding ); + Frame4Layout->addItem( spacer_3, 3, 0 ); + + backgroundFill = new KSFillBtn( Frame4, "backgroundFill" ); + backgroundFill->setMinimumSize( QSize( 0, 22 ) ); + + Frame4Layout->addWidget( backgroundFill, 2, 1 ); + + TextLabel1_3 = new QLabel( Frame4, "TextLabel1_3" ); + QFont TextLabel1_3_font( TextLabel1_3->font() ); + TextLabel1_3_font.setBold( TRUE ); + TextLabel1_3_font.setUnderline( TRUE ); + TextLabel1_3->setFont( TextLabel1_3_font ); + TextLabel1_3->setText( trUtf8( "Options" ) ); + + Frame4Layout->addMultiCellWidget( TextLabel1_3, 0, 0, 0, 1 ); + KSPanelGeneralInterfLayout->addWidget( Frame4 ); +} + +/* + * Destroys the object and frees any allocated resources + */ +KSPanelGeneralInterf::~KSPanelGeneralInterf() +{ + // no need to delete child widgets, Qt does it all for us +} + +#include "kspanelgeneralinterf.moc" diff --git a/kmatplot/dialogs/kspanelgeneralinterf.ui b/kmatplot/dialogs/kspanelgeneralinterf.ui new file mode 100644 index 0000000..1915ce7 --- /dev/null +++ b/kmatplot/dialogs/kspanelgeneralinterf.ui @@ -0,0 +1,471 @@ + +KSPanelGeneralInterf + + + KSPanelGeneralInterf + + + + 0 + 0 + 537 + 164 + + + + + 5 + 5 + 0 + 0 + + + + KSPanelForm + + + + unnamed + + + 1 + + + 1 + + + + Frame5 + + + StyledPanel + + + Raised + + + + unnamed + + + 10 + + + 1 + + + + titlee + + + + + TextLabel1 + + + + 1 + 1 + + + + Title + + + + + Spacer3 + + + Vertical + + + Expanding + + + + 20 + 20 + + + + + + + + Frame3 + + + StyledPanel + + + Raised + + + + unnamed + + + 10 + + + 1 + + + + QLabel_8 + + + mm + + + + + ypose + + + + 5 + 0 + 0 + 0 + + + + + 70 + 32767 + + + + + + QLabel_11 + + + mm + + + + + widthe + + + + 5 + 0 + 0 + 0 + + + + + 70 + 32767 + + + + + + + + + QLabel_7 + + + + 7 + 5 + 0 + 0 + + + + Height + + + + + QLabel_5 + + + + 7 + 5 + 0 + 0 + + + + Y + + + + + QLabel_6 + + + + 7 + 5 + 0 + 0 + + + + Width + + + + + heighte + + + + 5 + 0 + 0 + 0 + + + + + 70 + 32767 + + + + + + Spacer1 + + + Vertical + + + Expanding + + + + 20 + 20 + + + + + + TextLabel1_2 + + + + 1 + 1 + + + + Position & Size + + + + + xpose + + + + 5 + 0 + 0 + 0 + + + + + 70 + 32767 + + + + + + QLabel_10 + + + + 5 + 5 + 0 + 0 + + + + mm + + + + + QLabel_4 + + + + 7 + 5 + 0 + 0 + + + + X + + + + + QLabel_9 + + + mm + + + + + + + Frame4 + + + StyledPanel + + + Raised + + + + unnamed + + + 10 + + + 1 + + + + QLabel_2 + + + + 7 + 5 + 0 + 0 + + + + Background + + + + + draw_in_background + + + + 7 + 0 + 0 + 0 + + + + Draw in background + + + + + Spacer2 + + + Vertical + + + Expanding + + + + 20 + 20 + + + + + + backgroundFill + + + + 0 + 22 + + + + + + TextLabel1_3 + + + + 1 + 1 + + + + Options + + + + + + + + + KSFillBtn +
ksattrbtn.h
+ + -1 + 22 + + 0 + + 5 + 5 + 0 + 0 + + image0 +
+ + KSPanel +
kspanel.h
+ + 500 + 140 + + 1 + + 0 + 0 + 0 + 0 + + image1 +
+
+ + + 789ca5ceb10ac23010c6f13d4f71245b90f48a6805f1111447411c9254d1a10a5a0711dfddbba669822e827f0acdf72b84161a36eb25e842dc5adb9e3cf8a3bd82aeef4df3d8ee164f21cb29d03381528e8434e0617539eff9ace8ac10ab1a91a7e75939c4302dcfd9387e753c0f5498a64f71f4ce4ca91e93a9d80f66bfcd3a3b98ef22728cb931119acc02310e168930592abb8febfee06ffb48bee6e20df819667e + + + 789cd3d7528808f055d0d2e72a2e492cc94c5648ce482c52d04a29cdcdad8c8eb5ade65232540043251d2e253d856405e554300073956aadb900494e10c6 + + + +
diff --git a/kmatplot/dialogs/kspanelglinterf.cpp b/kmatplot/dialogs/kspanelglinterf.cpp new file mode 100644 index 0000000..9173e7c --- /dev/null +++ b/kmatplot/dialogs/kspanelglinterf.cpp @@ -0,0 +1,131 @@ +/**************************************************************************** +** Form implementation generated from reading ui file './kspanelglinterf.ui' +** +** Created: śro mar 20 18:53:01 2002 +** by: The User Interface Compiler (uic) +** +** WARNING! All changes made in this file will be lost! +****************************************************************************/ +#include "kspanelglinterf.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "kspanel.h" + +/* + * Constructs a KSPanelGLInterf which is a child of 'parent', with the + * name 'name'.' + */ +KSPanelGLInterf::KSPanelGLInterf( QWidget* parent, const char* name ) + : KSPanel( parent, name ) +{ + if ( !name ) + setName( "KSPanelGLInterf" ); + resize( 500, 140 ); + setCaption( trUtf8( "KSPanelForm" ) ); + KSPanelGLInterfLayout = new QHBoxLayout( this, 1, 1, "KSPanelGLInterfLayout"); + + Frame5 = new QFrame( this, "Frame5" ); + Frame5->setFrameShape( QFrame::StyledPanel ); + Frame5->setFrameShadow( QFrame::Raised ); + Frame5Layout = new QGridLayout( Frame5, 1, 1, 10, 1, "Frame5Layout"); + + openglc = new QCheckBox( Frame5, "openglc" ); + QFont openglc_font( openglc->font() ); + openglc_font.setBold( TRUE ); + openglc_font.setUnderline( TRUE ); + openglc->setFont( openglc_font ); + openglc->setText( trUtf8( "Enable OpenGL" ) ); + + Frame5Layout->addWidget( openglc, 0, 0 ); + QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Minimum, QSizePolicy::Expanding ); + Frame5Layout->addItem( spacer, 1, 0 ); + KSPanelGLInterfLayout->addWidget( Frame5 ); + + Frame4 = new QFrame( this, "Frame4" ); + Frame4->setFrameShape( QFrame::StyledPanel ); + Frame4->setFrameShadow( QFrame::Raised ); + Frame4Layout = new QGridLayout( Frame4, 1, 1, 10, 1, "Frame4Layout"); + + alphac = new QCheckBox( Frame4, "alphac" ); + alphac->setText( trUtf8( "Enable transparency" ) ); + + Frame4Layout->addMultiCellWidget( alphac, 1, 1, 0, 1 ); + + autostrokec = new QCheckBox( Frame4, "autostrokec" ); + autostrokec->setText( trUtf8( "Stroke auto color " ) ); + + Frame4Layout->addMultiCellWidget( autostrokec, 2, 2, 0, 1 ); + + shadewallsc = new QCheckBox( Frame4, "shadewallsc" ); + shadewallsc->setText( trUtf8( "Shade walls" ) ); + + Frame4Layout->addMultiCellWidget( shadewallsc, 3, 3, 0, 1 ); + QSpacerItem* spacer_2 = new QSpacerItem( 20, 20, QSizePolicy::Minimum, QSizePolicy::Expanding ); + Frame4Layout->addItem( spacer_2, 4, 0 ); + + TextLabel1 = new QLabel( Frame4, "TextLabel1" ); + QFont TextLabel1_font( TextLabel1->font() ); + TextLabel1_font.setBold( TRUE ); + TextLabel1_font.setUnderline( TRUE ); + TextLabel1->setFont( TextLabel1_font ); + TextLabel1->setText( trUtf8( "Options" ) ); + + Frame4Layout->addWidget( TextLabel1, 0, 0 ); + KSPanelGLInterfLayout->addWidget( Frame4 ); + + Frame3 = new QFrame( this, "Frame3" ); + Frame3->setFrameShape( QFrame::StyledPanel ); + Frame3->setFrameShadow( QFrame::Raised ); + Frame3Layout = new QGridLayout( Frame3, 1, 1, 10, 1, "Frame3Layout"); + + QLabel_1 = new QLabel( Frame3, "QLabel_1" ); + QLabel_1->setText( trUtf8( "Global transparency" ) ); + + Frame3Layout->addWidget( QLabel_1, 1, 0 ); + + globaltr = new QSpinBox( Frame3, "globaltr" ); + globaltr->setMaxValue( 255 ); + + Frame3Layout->addMultiCellWidget( globaltr, 1, 1, 1, 2 ); + + strokel = new QSpinBox( Frame3, "strokel" ); + strokel->setMaxValue( 999 ); + strokel->setMinValue( -999 ); + + Frame3Layout->addMultiCellWidget( strokel, 2, 2, 1, 2 ); + + QLabel_3 = new QLabel( Frame3, "QLabel_3" ); + QLabel_3->setText( trUtf8( "Stroke lightness" ) ); + + Frame3Layout->addWidget( QLabel_3, 2, 0 ); + QSpacerItem* spacer_3 = new QSpacerItem( 20, 20, QSizePolicy::Minimum, QSizePolicy::Expanding ); + Frame3Layout->addItem( spacer_3, 3, 0 ); + + TextLabel2 = new QLabel( Frame3, "TextLabel2" ); + QFont TextLabel2_font( TextLabel2->font() ); + TextLabel2_font.setBold( TRUE ); + TextLabel2_font.setUnderline( TRUE ); + TextLabel2->setFont( TextLabel2_font ); + TextLabel2->setText( trUtf8( "More options" ) ); + + Frame3Layout->addMultiCellWidget( TextLabel2, 0, 0, 0, 1 ); + KSPanelGLInterfLayout->addWidget( Frame3 ); +} + +/* + * Destroys the object and frees any allocated resources + */ +KSPanelGLInterf::~KSPanelGLInterf() +{ + // no need to delete child widgets, Qt does it all for us +} + +#include "kspanelglinterf.moc" diff --git a/kmatplot/dialogs/kspanelglinterf.ui b/kmatplot/dialogs/kspanelglinterf.ui new file mode 100644 index 0000000..d419924 --- /dev/null +++ b/kmatplot/dialogs/kspanelglinterf.ui @@ -0,0 +1,272 @@ + +KSPanelGLInterf + + + KSPanelGLInterf + + + + 0 + 0 + 500 + 140 + + + + KSPanelForm + + + + unnamed + + + 1 + + + 1 + + + + Frame5 + + + StyledPanel + + + Raised + + + + unnamed + + + 10 + + + 1 + + + + openglc + + + + 1 + 1 + + + + Enable OpenGL + + + + + Spacer1 + + + Vertical + + + Expanding + + + + 20 + 20 + + + + + + + + Frame4 + + + StyledPanel + + + Raised + + + + unnamed + + + 10 + + + 1 + + + + alphac + + + Enable transparency + + + + + autostrokec + + + Stroke auto color + + + + + shadewallsc + + + Shade walls + + + + + Spacer2 + + + Vertical + + + Expanding + + + + 20 + 20 + + + + + + TextLabel1 + + + + 1 + 1 + + + + Options + + + + + + + Frame3 + + + StyledPanel + + + Raised + + + + unnamed + + + 10 + + + 1 + + + + QLabel_1 + + + Global transparency + + + + + globaltr + + + 255 + + + + + strokel + + + 999 + + + -999 + + + + + QLabel_3 + + + Stroke lightness + + + + + Spacer3 + + + Vertical + + + Expanding + + + + 20 + 20 + + + + + + TextLabel2 + + + + 1 + 1 + + + + More options + + + + + + + + + KSPanel +
kspanel.h
+ + 500 + 140 + + 1 + + 0 + 0 + 0 + 0 + + image0 +
+
+ + + 789cd3d7528808f055d0d2e72a2e492cc94c5648ce482c52d04a29cdcdad8c8eb5ade65232540043251d2e253d856405e554300073956aadb900494e10c6 + + + +
diff --git a/kmatplot/dialogs/kspanelgradientinterf.cpp b/kmatplot/dialogs/kspanelgradientinterf.cpp new file mode 100644 index 0000000..5b52767 --- /dev/null +++ b/kmatplot/dialogs/kspanelgradientinterf.cpp @@ -0,0 +1,104 @@ +/**************************************************************************** +** Form implementation generated from reading ui file './kspanelgradientinterf.ui' +** +** Created: śro mar 20 18:53:02 2002 +** by: The User Interface Compiler (uic) +** +** WARNING! All changes made in this file will be lost! +****************************************************************************/ +#include "kspanelgradientinterf.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include "ksattrbtn.h" +#include "kspanel.h" + +/* + * Constructs a KSPanelGradientInterf which is a child of 'parent', with the + * name 'name'.' + */ +KSPanelGradientInterf::KSPanelGradientInterf( QWidget* parent, const char* name ) + : KSPanel( parent, name ) +{ + if ( !name ) + setName( "KSPanelGradientInterf" ); + resize( 500, 140 ); + setCaption( trUtf8( "KSPanelForm" ) ); + KSPanelGradientInterfLayout = new QHBoxLayout( this, 1, 1, "KSPanelGradientInterfLayout"); + + Frame3 = new QFrame( this, "Frame3" ); + Frame3->setFrameShape( QFrame::StyledPanel ); + Frame3->setFrameShadow( QFrame::Raised ); + Frame3Layout = new QGridLayout( Frame3, 1, 1, 9, 0, "Frame3Layout"); + + type = new QComboBox( FALSE, Frame3, "type" ); + type->insertItem( trUtf8( "Default" ) ); + type->insertItem( trUtf8( "Gray" ) ); + type->insertItem( trUtf8( "Strange" ) ); + type->insertItem( trUtf8( "Two colors" ) ); + type->insertItem( trUtf8( "Five colors" ) ); + type->setInsertionPolicy( QComboBox::AtTop ); + + Frame3Layout->addMultiCellWidget( type, 1, 1, 0, 1 ); + + gradientw = new QWidget( Frame3, "gradientw" ); + gradientw->setPaletteBackgroundColor( QColor( 153, 153, 153 ) ); + + Frame3Layout->addMultiCellWidget( gradientw, 2, 6, 1, 1 ); + + gradientFill5 = new KSFillBtn( Frame3, "gradientFill5" ); + + Frame3Layout->addWidget( gradientFill5, 2, 0 ); + + gradientFill4 = new KSFillBtn( Frame3, "gradientFill4" ); + + Frame3Layout->addWidget( gradientFill4, 3, 0 ); + + gradientFill3 = new KSFillBtn( Frame3, "gradientFill3" ); + + Frame3Layout->addWidget( gradientFill3, 4, 0 ); + + gradientFill2 = new KSFillBtn( Frame3, "gradientFill2" ); + + Frame3Layout->addWidget( gradientFill2, 5, 0 ); + + gradientFill1 = new KSFillBtn( Frame3, "gradientFill1" ); + + Frame3Layout->addWidget( gradientFill1, 6, 0 ); + + TextLabel1 = new QLabel( Frame3, "TextLabel1" ); + QFont TextLabel1_font( TextLabel1->font() ); + TextLabel1_font.setBold( TRUE ); + TextLabel1_font.setUnderline( TRUE ); + TextLabel1->setFont( TextLabel1_font ); + TextLabel1->setText( trUtf8( "Gradient" ) ); + + Frame3Layout->addMultiCellWidget( TextLabel1, 0, 0, 0, 1 ); + KSPanelGradientInterfLayout->addWidget( Frame3 ); + + Frame4 = new QFrame( this, "Frame4" ); + Frame4->setFrameShape( QFrame::StyledPanel ); + Frame4->setFrameShadow( QFrame::Raised ); + KSPanelGradientInterfLayout->addWidget( Frame4 ); + + Frame5 = new QFrame( this, "Frame5" ); + Frame5->setFrameShape( QFrame::StyledPanel ); + Frame5->setFrameShadow( QFrame::Raised ); + KSPanelGradientInterfLayout->addWidget( Frame5 ); +} + +/* + * Destroys the object and frees any allocated resources + */ +KSPanelGradientInterf::~KSPanelGradientInterf() +{ + // no need to delete child widgets, Qt does it all for us +} + +#include "kspanelgradientinterf.moc" diff --git a/kmatplot/dialogs/kspanelgradientinterf.ui b/kmatplot/dialogs/kspanelgradientinterf.ui new file mode 100644 index 0000000..be29d99 --- /dev/null +++ b/kmatplot/dialogs/kspanelgradientinterf.ui @@ -0,0 +1,201 @@ + +KSPanelGradientInterf + + + KSPanelGradientInterf + + + + 0 + 0 + 500 + 140 + + + + KSPanelForm + + + + unnamed + + + 1 + + + 1 + + + + Frame3 + + + StyledPanel + + + Raised + + + + unnamed + + + 9 + + + 0 + + + + + Default + + + + + Gray + + + + + Strange + + + + + Two colors + + + + + Five colors + + + + type + + + AtTop + + + + + gradientw + + + + 153 + 153 + 153 + + + + + + gradientFill5 + + + + + gradientFill4 + + + + + gradientFill3 + + + + + gradientFill2 + + + + + gradientFill1 + + + + + TextLabel1 + + + + 1 + 1 + + + + Gradient + + + + + + + Frame4 + + + StyledPanel + + + Raised + + + + + Frame5 + + + StyledPanel + + + Raised + + + + + + + KSFillBtn +
ksattrbtn.h
+ + -1 + 22 + + 0 + + 5 + 5 + 0 + 0 + + image0 +
+ + KSPanel +
kspanel.h
+ + 500 + 140 + + 1 + + 0 + 0 + 0 + 0 + + image1 +
+
+ + + 789ca5ceb10ac23010c6f13d4f71245b90f48a6805f1111447411c9254d1a10a5a0711dfddbba669822e827f0acdf72b84161a36eb25e842dc5adb9e3cf8a3bd82aeef4df3d8ee164f21cb29d03381528e8434e0617539eff9ace8ac10ab1a91a7e75939c4302dcfd9387e753c0f5498a64f71f4ce4ca91e93a9d80f66bfcd3a3b98ef22728cb931119acc02310e168930592abb8febfee06ffb48bee6e20df819667e + + + 789cd3d7528808f055d0d2e72a2e492cc94c5648ce482c52d04a29cdcdad8c8eb5ade65232540043251d2e253d856405e554300073956aadb900494e10c6 + + + +
diff --git a/kmatplot/dialogs/kspanelgridinterf.cpp b/kmatplot/dialogs/kspanelgridinterf.cpp new file mode 100644 index 0000000..ab9941a --- /dev/null +++ b/kmatplot/dialogs/kspanelgridinterf.cpp @@ -0,0 +1,209 @@ +/**************************************************************************** +** Form implementation generated from reading ui file './kspanelgridinterf.ui' +** +** Created: śro mar 20 18:53:03 2002 +** by: The User Interface Compiler (uic) +** +** WARNING! All changes made in this file will be lost! +****************************************************************************/ +#include "kspanelgridinterf.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "ksattrbtn.h" +#include "kspanel.h" +#include "kstextedit.h" + +/* + * Constructs a KSPanelGridInterf which is a child of 'parent', with the + * name 'name'.' + */ +KSPanelGridInterf::KSPanelGridInterf( QWidget* parent, const char* name ) + : KSPanel( parent, name ) +{ + if ( !name ) + setName( "KSPanelGridInterf" ); + resize( 537, 210 ); + setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5, (QSizePolicy::SizeType)5, 0, 0, sizePolicy().hasHeightForWidth() ) ); + setCaption( trUtf8( "KSPanelForm" ) ); + KSPanelGridInterfLayout = new QHBoxLayout( this, 1, 1, "KSPanelGridInterfLayout"); + + Frame5 = new QFrame( this, "Frame5" ); + Frame5->setFrameShape( QFrame::StyledPanel ); + Frame5->setFrameShadow( QFrame::Raised ); + Frame5Layout = new QGridLayout( Frame5, 1, 1, 10, 1, "Frame5Layout"); + QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Minimum, QSizePolicy::Expanding ); + Frame5Layout->addItem( spacer, 5, 1 ); + + labelFont = new KSFontBtn( Frame5, "labelFont" ); + labelFont->setMinimumSize( QSize( 0, 22 ) ); + + Frame5Layout->addMultiCellWidget( labelFont, 2, 2, 0, 2 ); + + TextLabel2 = new QLabel( Frame5, "TextLabel2" ); + QFont TextLabel2_font( TextLabel2->font() ); + TextLabel2_font.setBold( TRUE ); + TextLabel2_font.setUnderline( TRUE ); + TextLabel2->setFont( TextLabel2_font ); + TextLabel2->setText( trUtf8( "Labels" ) ); + + Frame5Layout->addMultiCellWidget( TextLabel2, 0, 0, 0, 2 ); + + QLabel_9 = new QLabel( Frame5, "QLabel_9" ); + QLabel_9->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)5, 0, 0, QLabel_9->sizePolicy().hasHeightForWidth() ) ); + QLabel_9->setText( trUtf8( "Even/Odd pos." ) ); + + Frame5Layout->addWidget( QLabel_9, 3, 0 ); + + angle = new QSpinBox( Frame5, "angle" ); + angle->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5, (QSizePolicy::SizeType)0, 1, 0, angle->sizePolicy().hasHeightForWidth() ) ); + angle->setMaximumSize( QSize( 80, 32767 ) ); + angle->setMaxValue( 360 ); + angle->setMinValue( -360 ); + + Frame5Layout->addMultiCellWidget( angle, 4, 4, 1, 2 ); + + QLabel_8 = new QLabel( Frame5, "QLabel_8" ); + QLabel_8->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)5, 0, 0, QLabel_8->sizePolicy().hasHeightForWidth() ) ); + QLabel_8->setText( trUtf8( "Angle" ) ); + + Frame5Layout->addWidget( QLabel_8, 4, 0 ); + + oddPos = new QLineEdit( Frame5, "oddPos" ); + oddPos->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)2, (QSizePolicy::SizeType)0, 0, 0, oddPos->sizePolicy().hasHeightForWidth() ) ); + oddPos->setMaximumSize( QSize( 80, 32767 ) ); + oddPos->setText( trUtf8( "" ) ); + + Frame5Layout->addWidget( oddPos, 3, 2 ); + + evenPos = new QLineEdit( Frame5, "evenPos" ); + evenPos->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)2, (QSizePolicy::SizeType)0, 0, 0, evenPos->sizePolicy().hasHeightForWidth() ) ); + evenPos->setMaximumSize( QSize( 80, 32767 ) ); + + Frame5Layout->addWidget( evenPos, 3, 1 ); + + formate = new KSTextEdit( Frame5, "formate" ); + formate->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5, (QSizePolicy::SizeType)0, 0, 0, formate->sizePolicy().hasHeightForWidth() ) ); + formate->setMinimumSize( QSize( 0, 22 ) ); + + Frame5Layout->addMultiCellWidget( formate, 1, 1, 0, 2 ); + KSPanelGridInterfLayout->addWidget( Frame5 ); + + Frame3 = new QFrame( this, "Frame3" ); + Frame3->setFrameShape( QFrame::StyledPanel ); + Frame3->setFrameShadow( QFrame::Raised ); + Frame3Layout = new QGridLayout( Frame3, 1, 1, 10, 1, "Frame3Layout"); + + QLabel_1_2 = new QLabel( Frame3, "QLabel_1_2" ); + QLabel_1_2->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)5, 0, 0, QLabel_1_2->sizePolicy().hasHeightForWidth() ) ); + QLabel_1_2->setText( trUtf8( "Major step" ) ); + + Frame3Layout->addWidget( QLabel_1_2, 1, 0 ); + + QLabel_3_2 = new QLabel( Frame3, "QLabel_3_2" ); + QLabel_3_2->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)5, 0, 0, QLabel_3_2->sizePolicy().hasHeightForWidth() ) ); + QLabel_3_2->setText( trUtf8( "Major style " ) ); + + Frame3Layout->addWidget( QLabel_3_2, 2, 0 ); + + majdensitye = new QLineEdit( Frame3, "majdensitye" ); + majdensitye->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)2, (QSizePolicy::SizeType)0, 1, 0, majdensitye->sizePolicy().hasHeightForWidth() ) ); + majdensitye->setMaximumSize( QSize( 60, 32767 ) ); + + Frame3Layout->addWidget( majdensitye, 1, 1 ); + + QLabel_2 = new QLabel( Frame3, "QLabel_2" ); + QLabel_2->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)5, 0, 0, QLabel_2->sizePolicy().hasHeightForWidth() ) ); + QLabel_2->setText( trUtf8( "Minor step " ) ); + + Frame3Layout->addWidget( QLabel_2, 3, 0 ); + + mindensitye = new QLineEdit( Frame3, "mindensitye" ); + mindensitye->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)2, (QSizePolicy::SizeType)0, 1, 0, mindensitye->sizePolicy().hasHeightForWidth() ) ); + mindensitye->setMaximumSize( QSize( 60, 32767 ) ); + + Frame3Layout->addWidget( mindensitye, 3, 1 ); + + QLabel_4 = new QLabel( Frame3, "QLabel_4" ); + QLabel_4->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)5, 0, 0, QLabel_4->sizePolicy().hasHeightForWidth() ) ); + QLabel_4->setText( trUtf8( "Minor style " ) ); + + Frame3Layout->addWidget( QLabel_4, 4, 0 ); + + minorLine = new KSLineBtn( Frame3, "minorLine" ); + minorLine->setMinimumSize( QSize( 0, 20 ) ); + minorLine->setMaximumSize( QSize( 60, 32767 ) ); + + Frame3Layout->addWidget( minorLine, 4, 1 ); + + majorLine = new KSLineBtn( Frame3, "majorLine" ); + majorLine->setMinimumSize( QSize( 0, 20 ) ); + majorLine->setMaximumSize( QSize( 60, 32767 ) ); + + Frame3Layout->addWidget( majorLine, 2, 1 ); + QSpacerItem* spacer_2 = new QSpacerItem( 20, 20, QSizePolicy::Minimum, QSizePolicy::Expanding ); + Frame3Layout->addItem( spacer_2, 5, 1 ); + + TextLabel1_2 = new QLabel( Frame3, "TextLabel1_2" ); + QFont TextLabel1_2_font( TextLabel1_2->font() ); + TextLabel1_2_font.setBold( TRUE ); + TextLabel1_2_font.setUnderline( TRUE ); + TextLabel1_2->setFont( TextLabel1_2_font ); + TextLabel1_2->setText( trUtf8( "Grid" ) ); + + Frame3Layout->addMultiCellWidget( TextLabel1_2, 0, 0, 0, 1 ); + KSPanelGridInterfLayout->addWidget( Frame3 ); + + Frame4 = new QFrame( this, "Frame4" ); + Frame4->setFrameShape( QFrame::StyledPanel ); + Frame4->setFrameShadow( QFrame::Raised ); + Frame4Layout = new QGridLayout( Frame4, 1, 1, 10, 0, "Frame4Layout"); + + outerc = new QCheckBox( Frame4, "outerc" ); + outerc->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, 0, 0, outerc->sizePolicy().hasHeightForWidth() ) ); + outerc->setText( trUtf8( "Outer tics" ) ); + + Frame4Layout->addWidget( outerc, 1, 0 ); + + showticc = new QCheckBox( Frame4, "showticc" ); + showticc->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, 0, 0, showticc->sizePolicy().hasHeightForWidth() ) ); + showticc->setText( trUtf8( "Show tics" ) ); + + Frame4Layout->addWidget( showticc, 2, 0 ); + + adjustc = new QCheckBox( Frame4, "adjustc" ); + adjustc->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, 0, 0, adjustc->sizePolicy().hasHeightForWidth() ) ); + adjustc->setText( trUtf8( "Round range" ) ); + + Frame4Layout->addWidget( adjustc, 3, 0 ); + QSpacerItem* spacer_3 = new QSpacerItem( 20, 20, QSizePolicy::Minimum, QSizePolicy::Expanding ); + Frame4Layout->addItem( spacer_3, 4, 0 ); + + TextLabel1_3 = new QLabel( Frame4, "TextLabel1_3" ); + QFont TextLabel1_3_font( TextLabel1_3->font() ); + TextLabel1_3_font.setBold( TRUE ); + TextLabel1_3_font.setUnderline( TRUE ); + TextLabel1_3->setFont( TextLabel1_3_font ); + TextLabel1_3->setText( trUtf8( "Options" ) ); + + Frame4Layout->addWidget( TextLabel1_3, 0, 0 ); + KSPanelGridInterfLayout->addWidget( Frame4 ); +} + +/* + * Destroys the object and frees any allocated resources + */ +KSPanelGridInterf::~KSPanelGridInterf() +{ + // no need to delete child widgets, Qt does it all for us +} + +#include "kspanelgridinterf.moc" diff --git a/kmatplot/dialogs/kspanelgridinterf.ui b/kmatplot/dialogs/kspanelgridinterf.ui new file mode 100644 index 0000000..7247a12 --- /dev/null +++ b/kmatplot/dialogs/kspanelgridinterf.ui @@ -0,0 +1,590 @@ + +KSPanelGridInterf + + + KSPanelGridInterf + + + + 0 + 0 + 537 + 210 + + + + + 5 + 5 + 0 + 0 + + + + KSPanelForm + + + + unnamed + + + 1 + + + 1 + + + + Frame5 + + + StyledPanel + + + Raised + + + + unnamed + + + 10 + + + 1 + + + + Spacer2 + + + Vertical + + + Expanding + + + + 20 + 20 + + + + + + labelFont + + + + 0 + 22 + + + + + + TextLabel2 + + + + 1 + 1 + + + + Labels + + + + + QLabel_9 + + + + 3 + 5 + 0 + 0 + + + + Even/Odd pos. + + + + + angle + + + + 5 + 0 + 1 + 0 + + + + + 80 + 32767 + + + + 360 + + + -360 + + + + + QLabel_8 + + + + 3 + 5 + 0 + 0 + + + + Angle + + + + + oddPos + + + + 2 + 0 + 0 + 0 + + + + + 80 + 32767 + + + + + + + + + evenPos + + + + 2 + 0 + 0 + 0 + + + + + 80 + 32767 + + + + + + formate + + + + 5 + 0 + 0 + 0 + + + + + 0 + 22 + + + + + + + + Frame3 + + + StyledPanel + + + Raised + + + + unnamed + + + 10 + + + 1 + + + + QLabel_1_2 + + + + 3 + 5 + 0 + 0 + + + + Major step + + + + + QLabel_3_2 + + + + 3 + 5 + 0 + 0 + + + + Major style + + + + + majdensitye + + + + 2 + 0 + 1 + 0 + + + + + 60 + 32767 + + + + + + QLabel_2 + + + + 3 + 5 + 0 + 0 + + + + Minor step + + + + + mindensitye + + + + 2 + 0 + 1 + 0 + + + + + 60 + 32767 + + + + + + QLabel_4 + + + + 3 + 5 + 0 + 0 + + + + Minor style + + + + + minorLine + + + + 0 + 20 + + + + + 60 + 32767 + + + + + + majorLine + + + + 0 + 20 + + + + + 60 + 32767 + + + + + + Spacer3 + + + Vertical + + + Expanding + + + + 20 + 20 + + + + + + TextLabel1_2 + + + + 1 + 1 + + + + Grid + + + + + + + Frame4 + + + StyledPanel + + + Raised + + + + unnamed + + + 10 + + + 0 + + + + outerc + + + + 3 + 0 + 0 + 0 + + + + Outer tics + + + + + showticc + + + + 3 + 0 + 0 + 0 + + + + Show tics + + + + + adjustc + + + + 3 + 0 + 0 + 0 + + + + Round range + + + + + Spacer1 + + + Vertical + + + Expanding + + + + 20 + 20 + + + + + + TextLabel1_3 + + + + 1 + 1 + + + + Options + + + + + + + + + KSPanel +
kspanel.h
+ + 500 + 140 + + 1 + + 0 + 0 + 0 + 0 + + image0 +
+ + KSFontBtn +
ksattrbtn.h
+ + -1 + 22 + + 0 + + 5 + 5 + 0 + 0 + + image1 +
+ + KSLineBtn +
ksattrbtn.h
+ + -1 + 22 + + 0 + + 5 + 5 + 0 + 0 + + image2 +
+ + KSTextEdit +
kstextedit.h
+ + -1 + -1 + + 0 + + 5 + 5 + 0 + 0 + + image3 +
+
+ + + 789cd3d7528808f055d0d2e72a2e492cc94c5648ce482c52d04a29cdcdad8c8eb5ade65232540043251d2e253d856405e554300073956aadb900494e10c6 + + + 789cd3d7528808f055d0d2e72a2e492cc94c5648ce482c52d04a29cdcdad8c8eb5ade6523232520022630543251d2e253d856405bffcbc54105b19c856360003103711c44d0303b04aac80721965651c32ca8989ca24ca002590a4506594b1cb002590cd234646192c8690429101014c19b0c32040195d46591945134c46196e334c8aa00cc2fb70164c060cf49059b48c5314995a6b2e00c5aa7ebc + + + 789cd3d7528808f055d0d2e72a2e492cc94c5648ce482c52d04a29cdcdad8c8eb5ade6523234530022630543251d2e253d856405bffcbc54103b11c8564e3449344c3401719541dcb434032000ab440338c59481004d4c5919551022a6a7872c08370f9b1892207e31842001b14488a0b232b23fb089e9411d8a2606f6106a1840fc88355c6aadb9009dd649aa + + + 789cd3d7528808f055d0d2e72a2e492cc94c5648ce482c52d04a29cdcdad8c8eb5ade6523234530022630543251d2e253d856405bffcbc54105b19c856360003103711c44d490541b04a34805b4c593911ca0731d0c49413812cfc7a95c18a9561ea4022890802530caa5719a40fac17490c9b3a9ce6a1da4bb47f8910abb5e602003a1250e8 + + + +
diff --git a/kmatplot/dialogs/kspanelimageinterf.cpp b/kmatplot/dialogs/kspanelimageinterf.cpp new file mode 100644 index 0000000..3d4cd82 --- /dev/null +++ b/kmatplot/dialogs/kspanelimageinterf.cpp @@ -0,0 +1,149 @@ +/**************************************************************************** +** Form implementation generated from reading ui file './kspanelimageinterf.ui' +** +** Created: śro mar 20 18:53:04 2002 +** by: The User Interface Compiler (uic) +** +** WARNING! All changes made in this file will be lost! +****************************************************************************/ +#include "kspanelimageinterf.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "kspanel.h" +#include "kstextedit.h" + +/* + * Constructs a KSPanelImageInterf which is a child of 'parent', with the + * name 'name'.' + */ +KSPanelImageInterf::KSPanelImageInterf( QWidget* parent, const char* name ) + : KSPanel( parent, name ) +{ + if ( !name ) + setName( "KSPanelImageInterf" ); + resize( 500, 140 ); + setCaption( trUtf8( "KSPanelForm" ) ); + KSPanelImageInterfLayout = new QHBoxLayout( this, 1, 1, "KSPanelImageInterfLayout"); + + Frame5 = new QFrame( this, "Frame5" ); + Frame5->setFrameShape( QFrame::StyledPanel ); + Frame5->setFrameShadow( QFrame::Raised ); + Frame5Layout = new QGridLayout( Frame5, 1, 1, 10, 1, "Frame5Layout"); + + TextLabel2 = new QLabel( Frame5, "TextLabel2" ); + QFont TextLabel2_font( TextLabel2->font() ); + TextLabel2_font.setBold( TRUE ); + TextLabel2_font.setUnderline( TRUE ); + TextLabel2->setFont( TextLabel2_font ); + TextLabel2->setText( trUtf8( "Title" ) ); + + Frame5Layout->addWidget( TextLabel2, 0, 0 ); + QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Minimum, QSizePolicy::Expanding ); + Frame5Layout->addItem( spacer, 2, 1 ); + + titlee = new KSTextEdit( Frame5, "titlee" ); + titlee->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)0, 0, 0, titlee->sizePolicy().hasHeightForWidth() ) ); + titlee->setMinimumSize( QSize( 0, 22 ) ); + + Frame5Layout->addMultiCellWidget( titlee, 1, 1, 0, 1 ); + KSPanelImageInterfLayout->addWidget( Frame5 ); + + Frame4 = new QFrame( this, "Frame4" ); + Frame4->setMinimumSize( QSize( 175, 0 ) ); + Frame4->setFrameShape( QFrame::StyledPanel ); + Frame4->setFrameShadow( QFrame::Raised ); + Frame4Layout = new QGridLayout( Frame4, 1, 1, 10, 1, "Frame4Layout"); + + QLabel_2 = new QLabel( Frame4, "QLabel_2" ); + QLabel_2->setText( trUtf8( "Y-Axis" ) ); + + Frame4Layout->addWidget( QLabel_2, 2, 0 ); + + QLabel_1 = new QLabel( Frame4, "QLabel_1" ); + QLabel_1->setText( trUtf8( "X-Axis" ) ); + + Frame4Layout->addWidget( QLabel_1, 1, 0 ); + + TextLabel1 = new QLabel( Frame4, "TextLabel1" ); + TextLabel1->setMinimumSize( QSize( 0, 25 ) ); + QFont TextLabel1_font( TextLabel1->font() ); + TextLabel1_font.setBold( TRUE ); + TextLabel1_font.setUnderline( TRUE ); + TextLabel1->setFont( TextLabel1_font ); + TextLabel1->setText( trUtf8( "Bind to" ) ); + + Frame4Layout->addMultiCellWidget( TextLabel1, 0, 0, 0, 1 ); + + yaxisc = new QComboBox( FALSE, Frame4, "yaxisc" ); + yaxisc->setInsertionPolicy( QComboBox::AtTop ); + + Frame4Layout->addWidget( yaxisc, 2, 1 ); + + xaxisc = new QComboBox( FALSE, Frame4, "xaxisc" ); + xaxisc->setInsertionPolicy( QComboBox::AtTop ); + + Frame4Layout->addWidget( xaxisc, 1, 1 ); + + QLabel_3 = new QLabel( Frame4, "QLabel_3" ); + QLabel_3->setText( trUtf8( "V-Axis" ) ); + + Frame4Layout->addWidget( QLabel_3, 3, 0 ); + + vaxisc = new QComboBox( FALSE, Frame4, "vaxisc" ); + vaxisc->setInsertionPolicy( QComboBox::AtTop ); + + Frame4Layout->addWidget( vaxisc, 3, 1 ); + QSpacerItem* spacer_2 = new QSpacerItem( 20, 20, QSizePolicy::Minimum, QSizePolicy::Expanding ); + Frame4Layout->addItem( spacer_2, 4, 1 ); + KSPanelImageInterfLayout->addWidget( Frame4 ); + + Frame3 = new QFrame( this, "Frame3" ); + Frame3->setFrameShape( QFrame::StyledPanel ); + Frame3->setFrameShadow( QFrame::Raised ); + Frame3Layout = new QGridLayout( Frame3, 1, 1, 10, 1, "Frame3Layout"); + + legendc = new QCheckBox( Frame3, "legendc" ); + legendc->setText( trUtf8( "Show legend item" ) ); + + Frame3Layout->addMultiCellWidget( legendc, 3, 3, 0, 1 ); + + gradientc = new QCheckBox( Frame3, "gradientc" ); + gradientc->setText( trUtf8( "Use gradient" ) ); + + Frame3Layout->addMultiCellWidget( gradientc, 2, 2, 0, 1 ); + + rawc = new QCheckBox( Frame3, "rawc" ); + rawc->setText( trUtf8( "Raw mode" ) ); + + Frame3Layout->addMultiCellWidget( rawc, 1, 1, 0, 1 ); + QSpacerItem* spacer_3 = new QSpacerItem( 20, 20, QSizePolicy::Minimum, QSizePolicy::Expanding ); + Frame3Layout->addItem( spacer_3, 4, 0 ); + + TextLabel1_2 = new QLabel( Frame3, "TextLabel1_2" ); + QFont TextLabel1_2_font( TextLabel1_2->font() ); + TextLabel1_2_font.setBold( TRUE ); + TextLabel1_2_font.setUnderline( TRUE ); + TextLabel1_2->setFont( TextLabel1_2_font ); + TextLabel1_2->setText( trUtf8( "Options" ) ); + + Frame3Layout->addWidget( TextLabel1_2, 0, 0 ); + KSPanelImageInterfLayout->addWidget( Frame3 ); +} + +/* + * Destroys the object and frees any allocated resources + */ +KSPanelImageInterf::~KSPanelImageInterf() +{ + // no need to delete child widgets, Qt does it all for us +} + +#include "kspanelimageinterf.moc" diff --git a/kmatplot/dialogs/kspanelimageinterf.ui b/kmatplot/dialogs/kspanelimageinterf.ui new file mode 100644 index 0000000..d00f32f --- /dev/null +++ b/kmatplot/dialogs/kspanelimageinterf.ui @@ -0,0 +1,335 @@ + +KSPanelImageInterf + + + KSPanelImageInterf + + + + 0 + 0 + 500 + 140 + + + + KSPanelForm + + + + unnamed + + + 1 + + + 1 + + + + Frame5 + + + StyledPanel + + + Raised + + + + unnamed + + + 10 + + + 1 + + + + TextLabel2 + + + + 1 + 1 + + + + Title + + + + + Spacer1 + + + Vertical + + + Expanding + + + + 20 + 20 + + + + + + titlee + + + + 7 + 0 + 0 + 0 + + + + + 0 + 22 + + + + + + + + Frame4 + + + + 175 + 0 + + + + StyledPanel + + + Raised + + + + unnamed + + + 10 + + + 1 + + + + QLabel_2 + + + Y-Axis + + + + + QLabel_1 + + + X-Axis + + + + + TextLabel1 + + + + 0 + 25 + + + + + 1 + 1 + + + + Bind to + + + + + yaxisc + + + AtTop + + + + + xaxisc + + + AtTop + + + + + QLabel_3 + + + V-Axis + + + + + vaxisc + + + AtTop + + + + + Spacer3 + + + Vertical + + + Expanding + + + + 20 + 20 + + + + + + + + Frame3 + + + StyledPanel + + + Raised + + + + unnamed + + + 10 + + + 1 + + + + legendc + + + Show legend item + + + + + gradientc + + + Use gradient + + + + + rawc + + + Raw mode + + + + + Spacer2 + + + Vertical + + + Expanding + + + + 20 + 20 + + + + + + TextLabel1_2 + + + + 1 + 1 + + + + Options + + + + + + + + + KSPanel +
kspanel.h
+ + 500 + 140 + + 1 + + 0 + 0 + 0 + 0 + + image0 +
+ + KSTextEdit +
kstextedit.h
+ + -1 + -1 + + 0 + + 5 + 5 + 0 + 0 + + image1 +
+
+ + + 789cd3d7528808f055d0d2e72a2e492cc94c5648ce482c52d04a29cdcdad8c8eb5ade65232540043251d2e253d856405e554300073956aadb900494e10c6 + + + 789cd3d7528808f055d0d2e72a2e492cc94c5648ce482c52d04a29cdcdad8c8eb5ade6523234530022630543251d2e253d856405bffcbc54105b19c856360003103711c44d490541b04a34805b4c593911ca0731d0c49413812cfc7a95c18a9561ea4022890802530caa5719a40fac17490c9b3a9ce6a1da4bb47f8910abb5e602003a1250e8 + + + +
diff --git a/kmatplot/dialogs/kspanellightinterf.cpp b/kmatplot/dialogs/kspanellightinterf.cpp new file mode 100644 index 0000000..e4a8efc --- /dev/null +++ b/kmatplot/dialogs/kspanellightinterf.cpp @@ -0,0 +1,141 @@ +/**************************************************************************** +** Form implementation generated from reading ui file './kspanellightinterf.ui' +** +** Created: śro mar 20 18:53:05 2002 +** by: The User Interface Compiler (uic) +** +** WARNING! All changes made in this file will be lost! +****************************************************************************/ +#include "kspanellightinterf.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "kspanel.h" + +/* + * Constructs a KSPanelLightInterf which is a child of 'parent', with the + * name 'name'.' + */ +KSPanelLightInterf::KSPanelLightInterf( QWidget* parent, const char* name ) + : KSPanel( parent, name ) +{ + if ( !name ) + setName( "KSPanelLightInterf" ); + resize( 500, 140 ); + setCaption( trUtf8( "KSPanelForm" ) ); + KSPanelLightInterfLayout = new QHBoxLayout( this, 1, 1, "KSPanelLightInterfLayout"); + + Frame5 = new QFrame( this, "Frame5" ); + Frame5->setFrameShape( QFrame::StyledPanel ); + Frame5->setFrameShadow( QFrame::Raised ); + Frame5Layout = new QGridLayout( Frame5, 1, 1, 10, 1, "Frame5Layout"); + + lightc = new QCheckBox( Frame5, "lightc" ); + lightc->setMinimumSize( QSize( 0, 25 ) ); + QFont lightc_font( lightc->font() ); + lightc_font.setBold( TRUE ); + lightc_font.setUnderline( TRUE ); + lightc->setFont( lightc_font ); + lightc->setText( trUtf8( "Enable light" ) ); + + Frame5Layout->addWidget( lightc, 0, 0 ); + QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Minimum, QSizePolicy::Expanding ); + Frame5Layout->addItem( spacer, 1, 0 ); + KSPanelLightInterfLayout->addWidget( Frame5 ); + + Frame4 = new QFrame( this, "Frame4" ); + Frame4->setFrameShape( QFrame::StyledPanel ); + Frame4->setFrameShadow( QFrame::Raised ); + Frame4Layout = new QGridLayout( Frame4, 1, 1, 10, 1, "Frame4Layout"); + + QLabel_21 = new QLabel( Frame4, "QLabel_21" ); + QLabel_21->setText( trUtf8( "Elevation" ) ); + + Frame4Layout->addWidget( QLabel_21, 2, 0 ); + + lightas = new QSpinBox( Frame4, "lightas" ); + lightas->setMaxValue( 359 ); + + Frame4Layout->addWidget( lightas, 1, 1 ); + + QLabel_20 = new QLabel( Frame4, "QLabel_20" ); + QLabel_20->setText( trUtf8( "Azimuth" ) ); + + Frame4Layout->addWidget( QLabel_20, 1, 0 ); + + QLabel_22 = new QLabel( Frame4, "QLabel_22" ); + QLabel_22->setText( trUtf8( "Intensity" ) ); + + Frame4Layout->addWidget( QLabel_22, 3, 0 ); + + lightis = new QSpinBox( Frame4, "lightis" ); + lightis->setMaxValue( 50 ); + lightis->setMinValue( -50 ); + + Frame4Layout->addWidget( lightis, 3, 1 ); + + lightes = new QSpinBox( Frame4, "lightes" ); + lightes->setMaxValue( 90 ); + lightes->setMinValue( -90 ); + + Frame4Layout->addWidget( lightes, 2, 1 ); + + QLabel_5 = new QLabel( Frame4, "QLabel_5" ); + QLabel_5->setMinimumSize( QSize( 0, 25 ) ); + QFont QLabel_5_font( QLabel_5->font() ); + QLabel_5_font.setBold( TRUE ); + QLabel_5_font.setUnderline( TRUE ); + QLabel_5->setFont( QLabel_5_font ); + QLabel_5->setText( trUtf8( "Directed light" ) ); + + Frame4Layout->addMultiCellWidget( QLabel_5, 0, 0, 0, 1 ); + QSpacerItem* spacer_2 = new QSpacerItem( 20, 20, QSizePolicy::Minimum, QSizePolicy::Expanding ); + Frame4Layout->addItem( spacer_2, 4, 0 ); + KSPanelLightInterfLayout->addWidget( Frame4 ); + + Frame3 = new QFrame( this, "Frame3" ); + Frame3->setFrameShape( QFrame::StyledPanel ); + Frame3->setFrameShadow( QFrame::Raised ); + Frame3Layout = new QGridLayout( Frame3, 1, 1, 10, 1, "Frame3Layout"); + + lightams = new QSpinBox( Frame3, "lightams" ); + lightams->setMaxValue( 50 ); + lightams->setMinValue( -50 ); + + Frame3Layout->addWidget( lightams, 1, 1 ); + + QLabel_23 = new QLabel( Frame3, "QLabel_23" ); + QLabel_23->setText( trUtf8( "Intensity" ) ); + + Frame3Layout->addWidget( QLabel_23, 1, 0 ); + + QLabel_6 = new QLabel( Frame3, "QLabel_6" ); + QLabel_6->setMinimumSize( QSize( 0, 25 ) ); + QFont QLabel_6_font( QLabel_6->font() ); + QLabel_6_font.setBold( TRUE ); + QLabel_6_font.setUnderline( TRUE ); + QLabel_6->setFont( QLabel_6_font ); + QLabel_6->setText( trUtf8( "Ambient light" ) ); + + Frame3Layout->addMultiCellWidget( QLabel_6, 0, 0, 0, 1 ); + QSpacerItem* spacer_3 = new QSpacerItem( 20, 20, QSizePolicy::Minimum, QSizePolicy::Expanding ); + Frame3Layout->addItem( spacer_3, 2, 0 ); + KSPanelLightInterfLayout->addWidget( Frame3 ); +} + +/* + * Destroys the object and frees any allocated resources + */ +KSPanelLightInterf::~KSPanelLightInterf() +{ + // no need to delete child widgets, Qt does it all for us +} + +#include "kspanellightinterf.moc" diff --git a/kmatplot/dialogs/kspanellightinterf.ui b/kmatplot/dialogs/kspanellightinterf.ui new file mode 100644 index 0000000..22da41a --- /dev/null +++ b/kmatplot/dialogs/kspanellightinterf.ui @@ -0,0 +1,304 @@ + +KSPanelLightInterf + + + KSPanelLightInterf + + + + 0 + 0 + 500 + 140 + + + + KSPanelForm + + + + unnamed + + + 1 + + + 1 + + + + Frame5 + + + StyledPanel + + + Raised + + + + unnamed + + + 10 + + + 1 + + + + lightc + + + + 0 + 25 + + + + + 1 + 1 + + + + Enable light + + + + + Spacer1 + + + Vertical + + + Expanding + + + + 20 + 20 + + + + + + + + Frame4 + + + StyledPanel + + + Raised + + + + unnamed + + + 10 + + + 1 + + + + QLabel_21 + + + Elevation + + + + + lightas + + + 359 + + + + + QLabel_20 + + + Azimuth + + + + + QLabel_22 + + + Intensity + + + + + lightis + + + 50 + + + -50 + + + + + lightes + + + 90 + + + -90 + + + + + QLabel_5 + + + + 0 + 25 + + + + + 1 + 1 + + + + Directed light + + + + + Spacer2 + + + Vertical + + + Expanding + + + + 20 + 20 + + + + + + + + Frame3 + + + StyledPanel + + + Raised + + + + unnamed + + + 10 + + + 1 + + + + lightams + + + 50 + + + -50 + + + + + QLabel_23 + + + Intensity + + + + + QLabel_6 + + + + 0 + 25 + + + + + 1 + 1 + + + + Ambient light + + + + + Spacer3 + + + Vertical + + + Expanding + + + + 20 + 20 + + + + + + + + + + KSPanel +
kspanel.h
+ + 500 + 140 + + 1 + + 0 + 0 + 0 + 0 + + image0 +
+
+ + + 789cd3d7528808f055d0d2e72a2e492cc94c5648ce482c52d04a29cdcdad8c8eb5ade65232540043251d2e253d856405e554300073956aadb900494e10c6 + + + +
diff --git a/kmatplot/dialogs/kspanelmeshinterf.cpp b/kmatplot/dialogs/kspanelmeshinterf.cpp new file mode 100644 index 0000000..1f994d0 --- /dev/null +++ b/kmatplot/dialogs/kspanelmeshinterf.cpp @@ -0,0 +1,186 @@ +/**************************************************************************** +** Form implementation generated from reading ui file './kspanelmeshinterf.ui' +** +** Created: śro mar 20 18:53:06 2002 +** by: The User Interface Compiler (uic) +** +** WARNING! All changes made in this file will be lost! +****************************************************************************/ +#include "kspanelmeshinterf.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "ksattrbtn.h" +#include "kspanel.h" + +/* + * Constructs a KSPanelMeshInterf which is a child of 'parent', with the + * name 'name'.' + */ +KSPanelMeshInterf::KSPanelMeshInterf( QWidget* parent, const char* name ) + : KSPanel( parent, name ) +{ + if ( !name ) + setName( "KSPanelMeshInterf" ); + resize( 496, 140 ); + setCaption( trUtf8( "KSPanelForm" ) ); + KSPanelMeshInterfLayout = new QHBoxLayout( this, 1, 1, "KSPanelMeshInterfLayout"); + + Frame5 = new QFrame( this, "Frame5" ); + Frame5->setFrameShape( QFrame::StyledPanel ); + Frame5->setFrameShadow( QFrame::Raised ); + Frame5Layout = new QGridLayout( Frame5, 1, 1, 10, 1, "Frame5Layout"); + + meshBottomFill = new KSFillBtn( Frame5, "meshBottomFill" ); + + Frame5Layout->addWidget( meshBottomFill, 3, 1 ); + + meshLine = new KSLineBtn( Frame5, "meshLine" ); + + Frame5Layout->addWidget( meshLine, 1, 1 ); + + QLabel_4 = new QLabel( Frame5, "QLabel_4" ); + QLabel_4->setText( trUtf8( "Bottom" ) ); + + Frame5Layout->addWidget( QLabel_4, 3, 0 ); + + QLabel_5 = new QLabel( Frame5, "QLabel_5" ); + QLabel_5->setText( trUtf8( "Line" ) ); + + Frame5Layout->addWidget( QLabel_5, 1, 0 ); + + QLabel_3 = new QLabel( Frame5, "QLabel_3" ); + QLabel_3->setText( trUtf8( "Top" ) ); + + Frame5Layout->addWidget( QLabel_3, 2, 0 ); + + QLabel_7 = new QLabel( Frame5, "QLabel_7" ); + QLabel_7->setText( trUtf8( "Point mark" ) ); + + Frame5Layout->addWidget( QLabel_7, 4, 0 ); + + meshPoint = new KSPointBtn( Frame5, "meshPoint" ); + + Frame5Layout->addWidget( meshPoint, 4, 1 ); + + meshTopFill = new KSFillBtn( Frame5, "meshTopFill" ); + + Frame5Layout->addWidget( meshTopFill, 2, 1 ); + + TextLabel1 = new QLabel( Frame5, "TextLabel1" ); + QFont TextLabel1_font( TextLabel1->font() ); + TextLabel1_font.setBold( TRUE ); + TextLabel1_font.setUnderline( TRUE ); + TextLabel1->setFont( TextLabel1_font ); + TextLabel1->setText( trUtf8( "Mesh" ) ); + + Frame5Layout->addMultiCellWidget( TextLabel1, 0, 0, 0, 1 ); + KSPanelMeshInterfLayout->addWidget( Frame5 ); + + Frame3 = new QFrame( this, "Frame3" ); + Frame3->setFrameShape( QFrame::StyledPanel ); + Frame3->setFrameShadow( QFrame::Raised ); + Frame3Layout = new QGridLayout( Frame3, 1, 1, 10, 1, "Frame3Layout"); + + type = new QComboBox( FALSE, Frame3, "type" ); + type->setInsertionPolicy( QComboBox::AtTop ); + + Frame3Layout->addMultiCellWidget( type, 1, 1, 0, 1 ); + + meshFill1 = new KSFillBtn( Frame3, "meshFill1" ); + + Frame3Layout->addWidget( meshFill1, 6, 0 ); + + meshFill2 = new KSFillBtn( Frame3, "meshFill2" ); + + Frame3Layout->addWidget( meshFill2, 5, 0 ); + + meshFill3 = new KSFillBtn( Frame3, "meshFill3" ); + + Frame3Layout->addWidget( meshFill3, 4, 0 ); + + meshFill4 = new KSFillBtn( Frame3, "meshFill4" ); + + Frame3Layout->addWidget( meshFill4, 3, 0 ); + + meshFill5 = new KSFillBtn( Frame3, "meshFill5" ); + + Frame3Layout->addWidget( meshFill5, 2, 0 ); + + gradientw = new QWidget( Frame3, "gradientw" ); + gradientw->setPaletteBackgroundColor( QColor( 171, 171, 171 ) ); + + Frame3Layout->addMultiCellWidget( gradientw, 2, 6, 1, 1 ); + + colorc = new QCheckBox( Frame3, "colorc" ); + QFont colorc_font( colorc->font() ); + colorc_font.setBold( TRUE ); + colorc_font.setUnderline( TRUE ); + colorc->setFont( colorc_font ); + colorc->setText( trUtf8( "Gradient" ) ); + + Frame3Layout->addMultiCellWidget( colorc, 0, 0, 0, 1 ); + KSPanelMeshInterfLayout->addWidget( Frame3 ); + + Frame4 = new QFrame( this, "Frame4" ); + Frame4->setFrameShape( QFrame::StyledPanel ); + Frame4->setFrameShadow( QFrame::Raised ); + Frame4Layout = new QGridLayout( Frame4, 1, 1, 10, 1, "Frame4Layout"); + + topbottom = new QCheckBox( Frame4, "topbottom" ); + topbottom->setText( trUtf8( "Show top/bottom " ) ); + + Frame4Layout->addMultiCellWidget( topbottom, 1, 1, 0, 1 ); + + TextLabel3 = new QLabel( Frame4, "TextLabel3" ); + QFont TextLabel3_font( TextLabel3->font() ); + TextLabel3_font.setBold( TRUE ); + TextLabel3_font.setUnderline( TRUE ); + TextLabel3->setFont( TextLabel3_font ); + TextLabel3->setText( trUtf8( "Options" ) ); + + Frame4Layout->addMultiCellWidget( TextLabel3, 0, 0, 0, 1 ); + QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Minimum, QSizePolicy::Expanding ); + Frame4Layout->addMultiCell( spacer, 5, 5, 0, 1 ); + + divide = new QCheckBox( Frame4, "divide" ); + divide->setText( trUtf8( "Discrete gradient" ) ); + + Frame4Layout->addMultiCellWidget( divide, 2, 2, 0, 1 ); + + zAxisGradient = new QCheckBox( Frame4, "zAxisGradient" ); + zAxisGradient->setText( trUtf8( "Use Z axis for gradient" ) ); + + Frame4Layout->addMultiCellWidget( zAxisGradient, 3, 3, 0, 1 ); + + edgeAutoColor = new QSpinBox( Frame4, "edgeAutoColor" ); + edgeAutoColor->setMaxValue( 256 ); + edgeAutoColor->setMinValue( -256 ); + + Frame4Layout->addWidget( edgeAutoColor, 4, 1 ); + + TextLabel1_2 = new QLabel( Frame4, "TextLabel1_2" ); + TextLabel1_2->setText( trUtf8( "Edge color" ) ); + + Frame4Layout->addWidget( TextLabel1_2, 4, 0 ); + KSPanelMeshInterfLayout->addWidget( Frame4 ); +} + +/* + * Destroys the object and frees any allocated resources + */ +KSPanelMeshInterf::~KSPanelMeshInterf() +{ + // no need to delete child widgets, Qt does it all for us +} + +#include "kspanelmeshinterf.moc" diff --git a/kmatplot/dialogs/kspanelmeshinterf.ui b/kmatplot/dialogs/kspanelmeshinterf.ui new file mode 100644 index 0000000..9fc16db --- /dev/null +++ b/kmatplot/dialogs/kspanelmeshinterf.ui @@ -0,0 +1,376 @@ + +KSPanelMeshInterf + + + KSPanelMeshInterf + + + + 0 + 2 + 496 + 140 + + + + KSPanelForm + + + + unnamed + + + 1 + + + 1 + + + + Frame5 + + + StyledPanel + + + Raised + + + + unnamed + + + 10 + + + 1 + + + + meshBottomFill + + + + + meshLine + + + + + QLabel_4 + + + Bottom + + + + + QLabel_5 + + + Line + + + + + QLabel_3 + + + Top + + + + + QLabel_7 + + + Point mark + + + + + meshPoint + + + + + meshTopFill + + + + + TextLabel1 + + + + 1 + 1 + + + + Mesh + + + + + + + Frame3 + + + StyledPanel + + + Raised + + + + unnamed + + + 10 + + + 1 + + + + type + + + AtTop + + + + + meshFill1 + + + + + meshFill2 + + + + + meshFill3 + + + + + meshFill4 + + + + + meshFill5 + + + + + gradientw + + + + 171 + 171 + 171 + + + + + + colorc + + + + 1 + 1 + + + + Gradient + + + + + + + Frame4 + + + StyledPanel + + + Raised + + + + unnamed + + + 10 + + + 1 + + + + topbottom + + + Show top/bottom + + + + + TextLabel3 + + + + 1 + 1 + + + + Options + + + + + Spacer1 + + + Vertical + + + Expanding + + + + 20 + 20 + + + + + + divide + + + Discrete gradient + + + + + zAxisGradient + + + Use Z axis for gradient + + + + + edgeAutoColor + + + 256 + + + -256 + + + + + TextLabel1_2 + + + Edge color + + + + + + + + + KSFillBtn +
ksattrbtn.h
+ + -1 + 22 + + 0 + + 5 + 5 + 0 + 0 + + image0 +
+ + KSPanel +
kspanel.h
+ + 500 + 140 + + 1 + + 0 + 0 + 0 + 0 + + image1 +
+ + KSLineBtn +
ksattrbtn.h
+ + -1 + 22 + + 0 + + 5 + 5 + 0 + 0 + + image2 +
+ + KSPointBtn +
ksattrbtn.h
+ + -1 + 22 + + 0 + + 5 + 5 + 0 + 0 + + image3 +
+
+ + + 789ca5ceb10ac23010c6f13d4f71245b90f48a6805f1111447411c9254d1a10a5a0711dfddbba669822e827f0acdf72b84161a36eb25e842dc5adb9e3cf8a3bd82aeef4df3d8ee164f21cb29d03381528e8434e0617539eff9ace8ac10ab1a91a7e75939c4302dcfd9387e753c0f5498a64f71f4ce4ca91e93a9d80f66bfcd3a3b98ef22728cb931119acc02310e168930592abb8febfee06ffb48bee6e20df819667e + + + 789cd3d7528808f055d0d2e72a2e492cc94c5648ce482c52d04a29cdcdad8c8eb5ade65232540043251d2e253d856405e554300073956aadb900494e10c6 + + + 789cd3d7528808f055d0d2e72a2e492cc94c5648ce482c52d04a29cdcdad8c8eb5ade6523234530022630543251d2e253d856405bffcbc54103b11c8564e3449344c3401719541dcb434032000ab440338c59481004d4c5919551022a6a7872c08370f9b1892207e31842001b14488a0b232b23fb089e9411d8a2606f6106a1840fc88355c6aadb9009dd649aa + + + 789cd3d7528808f055d0d2e72a2e492cc94c5648ce482c52d04a29cdcdad8c8eb5ade6523234530022630543251d2e253d856405bffcbc54105b19c856360003103711c44d0303b04a34408c98b2b232ba98726262a2324962ca20538002c8e641059491ed8588296311435387300f451d6562ca308bb1864bad3517007a684bc0 + + + +
diff --git a/kmatplot/dialogs/kspanelrangeinterf.cpp b/kmatplot/dialogs/kspanelrangeinterf.cpp new file mode 100644 index 0000000..894d818 --- /dev/null +++ b/kmatplot/dialogs/kspanelrangeinterf.cpp @@ -0,0 +1,1090 @@ +/**************************************************************************** +** Form implementation generated from reading ui file './kspanelrangeinterf.ui' +** +** Created: śro mar 20 18:53:07 2002 +** by: The User Interface Compiler (uic) +** +** WARNING! All changes made in this file will be lost! +****************************************************************************/ +#include "kspanelrangeinterf.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "kspanel.h" +static const char* const image0_data[] = { +"22 22 48 1", +". c None", +"a c #000000", +"g c #000400", +"d c #080408", +"y c #080808", +"T c #080c08", +"E c #101010", +"N c #181818", +"b c #313431", +"# c #393439", +"I c #393839", +"O c #393c39", +"L c #413c41", +"F c #4a444a", +"c c #4a484a", +"S c #524c52", +"Q c #525052", +"z c #5a555a", +"R c #5a595a", +"K c #5a5d5a", +"D c #625d62", +"n c #626162", +"P c #626562", +"s c #6a656a", +"j c #6a696a", +"G c #6a6d6a", +"A c #737173", +"f c #837d83", +"C c #838183", +"x c #838583", +"w c #8b858b", +"u c #8b898b", +"M c #8b8d8b", +"H c #948d94", +"h c #949194", +"r c #949594", +"v c #9c959c", +"e c #9c999c", +"k c #9c9d9c", +"p c #a49da4", +"B c #a4a1a4", +"t c #a4a5a4", +"q c #aca5ac", +"m c #b4b2b4", +"J c #b4b6b4", +"o c #c5c2c5", +"i c #f6f2f6", +"l c #ffffff", +"......................", +"......................", +"..............#a......", +".............bcd......", +"............#efg......", +"...........bhijg......", +"..........#klmnd......", +".........bklopna......", +"........#eloqrsa......", +".......btloqhuna......", +"......#vioqhwxna......", +"......yzAwBeCxDa......", +".......EFGuBeHna......", +"........EIjHJeKa......", +".........ELGMmnN......", +"..........EOPGQd......", +"...........EIRSg......", +"............TIOg......", +".............T#a......", +"..............ya......", +"......................", +"......................"}; + +static const char* const image1_data[] = { +"22 22 54 1", +". c None", +"c c #000000", +"a c #000400", +"# c #080408", +"b c #080808", +"o c #080c08", +"B c #100c10", +"S c #101010", +"V c #101410", +"d c #201c20", +"e c #313031", +"L c #313431", +"A c #393839", +"n c #414041", +"f c #4a4c4a", +"Z c #525552", +"m c #5a555a", +"i c #5a5d5a", +"l c #625d62", +"k c #626162", +"j c #626562", +"K c #6a656a", +"h c #6a696a", +"z c #6a6d6a", +"Y c #737573", +"R c #7b717b", +"g c #7b797b", +"w c #838583", +"u c #8b858b", +"J c #8b898b", +"Q c #8b8d8b", +"v c #948994", +"H c #949594", +"G c #9c919c", +"x c #9c959c", +"s c #9c9d9c", +"C c #a495a4", +"t c #a499a4", +"p c #a49da4", +"F c #a4a1a4", +"O c #a4a5a4", +"T c #ac9dac", +"M c #aca1ac", +"U c #aca5ac", +"W c #b4a5b4", +"P c #b4aab4", +"y c #bdb6bd", +"r c #bdbabd", +"I c #c5bac5", +"E c #cdc6cd", +"N c #cdcacd", +"X c #eeeeee", +"q c #ffeeff", +"D c #ffffff", +"......................", +"......................", +"......................", +"......................", +"......................", +"......................", +"..#a#abcccccccd##a#c..", +"..efghijkkkkiklmfneo..", +"...epqrstuvwxxyzlAB...", +"....eCDEFGwwHIJKLB....", +".....eMDNOtxPQRAS.....", +"......eTDEFUwhAS......", +".......epDNwRAV.......", +"........eWXYnS........", +".........epZS.........", +"..........eB..........", +"......................", +"......................", +"......................", +"......................", +"......................", +"......................"}; + +static const char* const image2_data[] = { +"22 22 41 1", +". c None", +"c c #000000", +"K c #000400", +"F c #080c08", +"H c #100c10", +"z c #101410", +"E c #181418", +"r c #181c18", +"u c #201c20", +"n c #292429", +"k c #292829", +"a c #313031", +"# c #393439", +"D c #393839", +"M c #414041", +"b c #625d62", +"e c #626162", +"L c #737173", +"C c #7b757b", +"I c #7b797b", +"G c #7b7d7b", +"A c #838183", +"v c #838583", +"w c #8b858b", +"t c #8b898b", +"q c #949194", +"x c #9c959c", +"p c #9c999c", +"J c #a49da4", +"s c #aca5ac", +"B c #acaeac", +"l c #b4b2b4", +"h c #bdbabd", +"y c #c5c2c5", +"d c #c5c6c5", +"f c #cdc6cd", +"o c #cdcacd", +"j c #dedede", +"m c #e6e2e6", +"g c #e6e6e6", +"i c #f6f2f6", +"......................", +"......................", +"......#a..............", +"......abc.............", +"......#dec............", +"......afgbc...........", +"......ahijec..........", +"......klmhjbc.........", +"......nlopqjec........", +"......rsfptqjbc.......", +"......uplvwwxyec......", +"......zqpvAqBCDc......", +"......EvpvqBCDc.......", +"......FGtqBCDc........", +"......HIJBCDc.........", +"......KCpCDc..........", +"......cLCDc...........", +"......cLDc............", +"......cMc.............", +"......cc..............", +"......................", +"......................"}; + +static const char* const image3_data[] = { +"22 22 46 1", +". c None", +"# c #000000", +"R c #080408", +"Q c #080808", +"P c #100c10", +"O c #101010", +"N c #181818", +"M c #202020", +"L c #202420", +"K c #292829", +"J c #292c29", +"H c #313031", +"I c #313431", +"A c #393439", +"b c #393c39", +"f c #413c41", +"G c #414041", +"a c #5a5d5a", +"c c #625d62", +"F c #736d73", +"E c #737173", +"e c #737573", +"C c #7b797b", +"D c #837d83", +"n c #838183", +"s c #838583", +"o c #8b858b", +"k c #8b898b", +"m c #8b8d8b", +"j c #948d94", +"h c #949194", +"r c #9c999c", +"z c #9c9d9c", +"q c #a49da4", +"B c #a4a5a4", +"y c #acaeac", +"i c #b4aeb4", +"l c #b4b2b4", +"p c #bdbabd", +"d c #c5c6c5", +"w c #cdc6cd", +"x c #cdcacd", +"g c #e6dee6", +"v c #e6e2e6", +"t c #eee6ee", +"u c #eeeeee", +"......................", +"......................", +"......................", +"......................", +"......................", +"......................", +"..........##..........", +".........#ab#.........", +"........#cdef#........", +".......#aghieb#.......", +"......#cgjkjlef#......", +".....#agmknomieb#.....", +"....#cgpqrksojlef#....", +"...#atuvwxyzrmrzeb#...", +"..AcwdpllBqhkCDeEFG#..", +"..HIHHJKLMNNOPQR####..", +"......................", +"......................", +"......................", +"......................", +"......................", +"......................"}; + +static const char* const image4_data[] = { +"22 22 49 1", +". c None", +"c c #000000", +"a c #000400", +"# c #080408", +"b c #080808", +"o c #080c08", +"B c #100c10", +"Q c #101010", +"R c #101410", +"d c #201c20", +"e c #313031", +"J c #313431", +"A c #393839", +"n c #414041", +"f c #4a4c4a", +"U c #525552", +"m c #5a555a", +"z c #5a595a", +"i c #5a5d5a", +"l c #625d62", +"k c #626162", +"j c #626562", +"I c #6a656a", +"h c #6a696a", +"y c #6a6d6a", +"P c #736d73", +"T c #737573", +"g c #7b797b", +"v c #838583", +"u c #8b858b", +"H c #8b898b", +"O c #8b8d8b", +"w c #949194", +"F c #949594", +"t c #9c959c", +"p c #9c999c", +"s c #9c9d9c", +"K c #a49da4", +"E c #a4a1a4", +"M c #a4a5a4", +"N c #aca5ac", +"x c #b4b2b4", +"r c #b4b6b4", +"G c #bdb6bd", +"D c #c5c2c5", +"L c #c5c6c5", +"S c #eeeeee", +"q c #f6eef6", +"C c #ffffff", +"......................", +"......................", +"......................", +"......................", +"......................", +"......................", +"..#a#abcccccccd##a#c..", +"..efghijkkkkiklmfneo..", +"...epqrstuuvwtxyzAB...", +"....etCDEwvvFGHIJB....", +".....eKCLMttNOPAQ.....", +"......eKCDEMvhAQ......", +".......epCLvPAR.......", +"........eNSTnQ........", +".........epUQ.........", +"..........eB..........", +"......................", +"......................", +"......................", +"......................", +"......................", +"......................"}; + +static const char* const image5_data[] = { +"22 22 76 2", +"Qt c None", +".k c #000000", +".y c #080008", +"#j c #080408", +".a c #083452", +".Q c #083c5a", +".1 c #0891bd", +"#i c #089dc5", +".K c #08aecd", +".5 c #08b2cd", +".r c #103452", +".# c #103852", +".N c #10385a", +".O c #103c5a", +".P c #104062", +".7 c #10658b", +".x c #10698b", +"#f c #106994", +".I c #106d94", +".C c #1089ac", +".G c #108db4", +".W c #1091b4", +".2 c #1091bd", +".v c #1095bd", +".4 c #1099c5", +".U c #109dc5", +"#a c #10a1c5", +".0 c #10aecd", +".3 c #10c2de", +".J c #18405a", +".q c #186994", +".M c #18719c", +"#e c #18a1c5", +"#b c #18aed5", +"#c c #18c2de", +".V c #18c6e6", +".d c #204062", +".j c #20799c", +".6 c #20a5cd", +".L c #20c2d5", +".w c #20c6de", +".b c #294c62", +".T c #29aed5", +".c c #31506a", +".X c #317d9c", +".8 c #3181a4", +".u c #41bede", +".D c #41d2de", +".F c #4ac2de", +".H c #4adeee", +"#d c #4ae2ee", +"#h c #5ac6de", +".B c #62c2d5", +"## c #62c6e6", +".S c #6abede", +".n c #7bbed5", +".Y c #83bad5", +".o c #83cae6", +".m c #94cede", +".p c #94cee6", +".e c #9cc6de", +".Z c #a4d6e6", +"#. c #accee6", +".E c #bddeee", +".t c #bde2ee", +".R c #c5e2f6", +".f c #d5e2ee", +".A c #d5eaf6", +".i c #deeaf6", +"#g c #deeef6", +".l c #deeeff", +".h c #e6eef6", +".g c #e6eeff", +".9 c #e6f2ff", +".z c #fffaff", +".s c #ffffff", +"QtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQt", +"QtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQt", +"QtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQt", +"QtQtQtQtQtQtQt.#.a.b.c.d.a.#.aQtQtQtQtQtQtQt", +"QtQtQtQtQtQtQt.a.e.f.g.h.i.j.kQtQtQtQtQtQtQt", +"QtQtQtQtQtQtQt.#.l.m.n.o.p.q.kQtQtQtQtQtQtQt", +"QtQtQtQtQtQtQt.r.s.t.u.v.w.x.yQtQtQtQtQtQtQt", +"QtQtQtQtQtQtQt.#.z.A.B.C.D.q.kQtQtQtQtQtQtQt", +"QtQtQtQtQtQtQt.a.s.E.F.G.H.I.kQtQtQtQtQtQtQt", +"QtQtQtQtQtQtQt.J.z.o.K.v.L.M.kQtQtQtQtQtQtQt", +"QtQt.N.O.P.Q.P.O.R.S.T.U.V.W.P.O.P.Q.P.OQtQt", +"QtQtQt.k.X.Y.e.e.Z.0.1.2.3.4.5.6.X.7.kQtQtQt", +"QtQtQtQt.y.8.9#.###a.v.4#b#c#d#e#f.kQtQtQtQt", +"QtQtQtQtQt.k.X.s#g#h#i.4.3#d#e.7.kQtQtQtQtQt", +"QtQtQtQtQtQt#j.8.s#g###h#d#e#f.kQtQtQtQtQtQt", +"QtQtQtQtQtQtQt.k.X.s.E#d#e.7.kQtQtQtQtQtQtQt", +"QtQtQtQtQtQtQtQt.y.8.9#e#f.kQtQtQtQtQtQtQtQt", +"QtQtQtQtQtQtQtQtQt.k.X.7.kQtQtQtQtQtQtQtQtQt", +"QtQtQtQtQtQtQtQtQtQt.y.kQtQtQtQtQtQtQtQtQtQt", +"QtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQt", +"QtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQt", +"QtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQt"}; + +static const char* const image6_data[] = { +"22 22 97 2", +"Qt c None", +".r c #000008", +".n c #000400", +"#u c #000c10", +".P c #001020", +"#z c #080408", +"#E c #080810", +".4 c #080818", +"#D c #080c18", +".C c #081020", +"#m c #081420", +".3 c #081429", +"#y c #081829", +"#x c #081831", +".# c #083452", +".c c #083c5a", +"#. c #0895c5", +".H c #089dc5", +".9 c #08a1c5", +".q c #103852", +".i c #103c5a", +".a c #103c62", +"#t c #10446a", +"#C c #10557b", +"#B c #105d83", +".2 c #106183", +"#c c #10618b", +".5 c #10658b", +"#s c #106594", +"#r c #106994", +".m c #107194", +"#w c #10719c", +"#A c #1081a4", +"#a c #1091b4", +"#b c #1091bd", +"#p c #1095b4", +"## c #1095bd", +".W c #1099c5", +".V c #109dc5", +"#d c #10a5cd", +"#q c #186994", +".6 c #18a5c5", +".G c #18aacd", +"#f c #18aed5", +".U c #18b6d5", +"#g c #18bade", +"#l c #18c2de", +".8 c #18c6e6", +".p c #204462", +"#v c #20a5cd", +"#n c #20b6d5", +"#k c #20c2d5", +".7 c #20cede", +".b c #294c73", +".B c #295573", +".O c #29698b", +".v c #29b2d5", +"#h c #29c6d5", +".h c #31658b", +".o c #395973", +".X c #39b2d5", +".I c #39b6d5", +"#e c #39dae6", +".w c #419dc5", +".1 c #41a5cd", +"#j c #41d6e6", +".e c #4a658b", +"#i c #4adae6", +"#o c #4adeee", +".u c #5ac6de", +".N c #62b6d5", +".d c #739dbd", +".F c #73d2e6", +".Q c #7b99bd", +".0 c #7bc6e6", +".T c #7bd2e6", +".s c #839dbd", +".j c #83a1bd", +".f c #83a1c5", +".Y c #83cade", +".D c #8baac5", +".J c #94daee", +".x c #9cd2ee", +".Z c #a4d6ee", +".l c #accee6", +".M c #ace2f6", +".S c #c5e2f6", +".L c #cdeef6", +".K c #cdeeff", +".A c #d5eeff", +".R c #def2ff", +".E c #e6eef6", +".g c #e6f2ff", +".y c #e6f6ff", +".t c #eef2ff", +".z c #fffaff", +".k c #ffffff", +"QtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQt", +"QtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQt", +"QtQtQtQtQtQtQtQtQtQtQt.#QtQtQtQtQtQtQtQtQtQt", +"QtQtQtQtQtQtQtQtQtQt.#.aQtQtQtQtQtQtQtQtQtQt", +"QtQtQtQtQtQtQtQtQt.#.b.cQtQtQtQtQtQtQtQtQtQt", +"QtQtQtQtQtQtQtQt.#.d.e.aQtQtQtQtQtQtQtQtQtQt", +"QtQtQtQtQtQtQt.#.f.g.h.iQtQtQtQtQtQtQtQtQtQt", +"QtQtQtQtQtQt.#.j.k.l.m.a.n.o.p.q.#.q.rQtQtQt", +"QtQtQtQtQt.#.s.k.t.u.v.w.x.y.k.z.A.B.CQtQtQt", +"QtQtQtQt.#.D.z.E.F.G.H.I.J.K.L.M.N.O.PQtQtQt", +"QtQtQt.#.Q.R.S.T.U.V.W.V.X.Y.Z.0.1.2.3QtQtQt", +"QtQtQt.4.5.6.7.8.9.W#..W###a#a#b###c.PQtQtQt", +"QtQtQtQt.C.5#d#e.8#f#g#h#i#j#i#k#l#c#mQtQtQt", +"QtQtQtQtQt.C.5#n#o#l#a#p.5#q#r#s.2#t#uQtQtQt", +"QtQtQtQtQtQt.C.5#v#e#w.i#x#m#y.3#y.P#zQtQtQt", +"QtQtQtQtQtQtQt.C.5#A#B.aQtQtQtQtQtQtQtQtQtQt", +"QtQtQtQtQtQtQtQt.C.5#C.cQtQtQtQtQtQtQtQtQtQt", +"QtQtQtQtQtQtQtQtQt#D.c.aQtQtQtQtQtQtQtQtQtQt", +"QtQtQtQtQtQtQtQtQtQt#D.iQtQtQtQtQtQtQtQtQtQt", +"QtQtQtQtQtQtQtQtQtQtQt#EQtQtQtQtQtQtQtQtQtQt", +"QtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQt", +"QtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQt"}; + +static const char* const image7_data[] = { +"22 22 73 2", +"Qt c None", +".b c #000000", +".e c #080008", +".j c #080408", +".l c #083452", +".a c #083c5a", +".V c #0889ac", +"#d c #0891b4", +".T c #0895bd", +".E c #089dc5", +"#e c #103452", +".k c #103852", +".# c #10385a", +".c c #104062", +".0 c #10658b", +"#. c #106994", +"#b c #106d94", +".U c #1089ac", +".N c #1091bd", +".O c #1095bd", +".W c #1099c5", +".P c #109dc5", +".D c #10aecd", +"#f c #10b2d5", +".7 c #10c2de", +".m c #18405a", +"#a c #186994", +"#c c #18719c", +".Z c #18a1c5", +".8 c #18aed5", +".9 c #18c2de", +".6 c #18c6e6", +".R c #204062", +"## c #20759c", +"#g c #20a5cd", +".2 c #20c6de", +".v c #294c62", +".M c #29aed5", +".5 c #29c6de", +".G c #31556a", +".g c #317d9c", +".d c #3181a4", +".J c #41bede", +".3 c #41d2de", +".L c #4ac2de", +".4 c #4adeee", +".Y c #4ae2ee", +".X c #5ac2de", +".F c #5ac6de", +".K c #62c2de", +".t c #62c6e6", +".C c #6abede", +".f c #83bad5", +".I c #83bed5", +".B c #83cae6", +".x c #94cede", +".1 c #94cee6", +".n c #9cc6de", +".h c #9ccade", +".o c #accede", +".s c #acdaee", +".A c #b4deee", +".Q c #bddeee", +".y c #bde2ee", +".r c #c5e2f6", +".w c #cde2ee", +".z c #d5eaf6", +".S c #deeaf6", +".u c #deeef6", +".q c #deeeff", +".H c #e6eeff", +".i c #e6f2ff", +".p c #ffffff", +"QtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQt", +"QtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQt", +"QtQtQtQtQtQtQtQtQtQt.#QtQtQtQtQtQtQtQtQtQtQt", +"QtQtQtQtQtQtQtQtQtQt.a.bQtQtQtQtQtQtQtQtQtQt", +"QtQtQtQtQtQtQtQtQtQt.c.d.eQtQtQtQtQtQtQtQtQt", +"QtQtQtQtQtQtQtQtQtQt.a.f.g.bQtQtQtQtQtQtQtQt", +"QtQtQtQtQtQtQtQtQtQt.c.h.i.d.jQtQtQtQtQtQtQt", +"QtQtQt.k.l.k.l.k.l.m.a.n.o.p.g.bQtQtQtQtQtQt", +"QtQtQt.k.n.q.p.p.p.p.r.s.t.u.p.d.eQtQtQtQtQt", +"QtQtQt.v.w.x.y.z.A.B.C.D.E.F.u.p.g.bQtQtQtQt", +"QtQtQt.G.H.I.J.K.L.D.M.N.O.P.t.Q.i.d.eQtQtQt", +"QtQtQt.R.S.B.T.U.V.O.E.N.T.W.X.Y.Z.0.bQtQtQt", +"QtQtQt.l.S.1.2.3.4.5.6.7.8.9.Y.Z#..bQtQtQtQt", +"QtQtQt.k###a.0#a#b#c#d.W.7.Y.Z.0.bQtQtQtQtQt", +"QtQtQt#e.b.b.e.b.b.b.c#f.Y.Z#..bQtQtQtQtQtQt", +"QtQtQtQtQtQtQtQtQtQt.a#g.Z.0.bQtQtQtQtQtQtQt", +"QtQtQtQtQtQtQtQtQtQt.c.d#..bQtQtQtQtQtQtQtQt", +"QtQtQtQtQtQtQtQtQtQt.a.0.bQtQtQtQtQtQtQtQtQt", +"QtQtQtQtQtQtQtQtQtQt.c.bQtQtQtQtQtQtQtQtQtQt", +"QtQtQtQtQtQtQtQtQtQt.aQtQtQtQtQtQtQtQtQtQtQt", +"QtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQt", +"QtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQt"}; + +static const char* const image8_data[] = { +"22 22 94 2", +"Qt c None", +".1 c #000400", +"#x c #000408", +"#A c #000c18", +"#w c #001018", +"#d c #001420", +"#B c #080408", +".0 c #080810", +".a c #080818", +".J c #080c18", +".d c #081020", +"#z c #081420", +"#y c #081429", +"#h c #081829", +".8 c #081831", +".# c #083452", +".U c #083c5a", +"#t c #085d83", +".E c #089dc5", +"#i c #103852", +".V c #103c62", +"#v c #10446a", +".T c #10557b", +".S c #105d83", +"#q c #106183", +"#u c #10618b", +".c c #10658b", +"#m c #106594", +".7 c #106994", +".N c #10719c", +".I c #1081a4", +".R c #1091b4", +"#l c #1091bd", +".Z c #1095b4", +".5 c #1099bd", +".F c #1099c5", +".P c #109dc5", +".x c #10a1c5", +".l c #10a5cd", +"#c c #186994", +".g c #18a5c5", +".D c #18aacd", +".G c #18aad5", +".w c #18b6d5", +".Q c #18bade", +".H c #18c2de", +".q c #18c6e6", +"#e c #204862", +".z c #20a5cd", +".s c #20b6d5", +".Y c #20c2d5", +".k c #20cede", +".K c #294c73", +"#r c #295073", +"#s c #29698b", +".O c #29b2d5", +".M c #31658b", +".9 c #395973", +".W c #399dc5", +".4 c #39b2d5", +".X c #39b6d5", +".r c #39d6e6", +"#p c #41a5cd", +"#b c #41d6de", +".L c #4a698b", +".6 c #4adae6", +".y c #4ae2ee", +".C c #5ac2de", +"#o c #62b6d5", +".A c #739dbd", +".v c #73d2e6", +".b c #7b99bd", +"#k c #7bc6de", +".p c #7bcee6", +".h c #839dbd", +".m c #83a1bd", +".t c #83a1c5", +"#a c #83cade", +".e c #8baac5", +".2 c #9cd2ee", +".3 c #9cdaee", +"#g c #a4d6ee", +".B c #accee6", +"#j c #ace2f6", +".j c #c5e2f6", +"#f c #cdeef6", +"## c #cdeeff", +"#n c #d5eeff", +".f c #deeeff", +".o c #e6eef6", +"#. c #e6f6ff", +".u c #eef2ff", +".i c #fffaff", +".n c #ffffff", +"QtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQt", +"QtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQt", +"QtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQt", +"QtQtQtQtQtQtQtQtQtQt.#.aQtQtQtQtQtQtQtQtQtQt", +"QtQtQtQtQtQtQtQtQt.#.b.c.dQtQtQtQtQtQtQtQtQt", +"QtQtQtQtQtQtQtQt.#.e.f.g.c.dQtQtQtQtQtQtQtQt", +"QtQtQtQtQtQtQt.#.h.i.j.k.l.c.dQtQtQtQtQtQtQt", +"QtQtQtQtQtQt.#.m.n.o.p.q.r.s.c.dQtQtQtQtQtQt", +"QtQtQtQtQt.#.t.n.u.v.w.x.q.y.z.c.dQtQtQtQtQt", +"QtQtQtQt.#.A.f.B.C.D.E.F.G.H.r.I.c.JQtQtQtQt", +"QtQtQt.#.K.L.M.N.O.P.F.F.Q.R.N.S.T.U.JQtQtQt", +"QtQt.#.V.U.V.U.V.W.X.P.F.Y.Z.U.V.U.V.U.0QtQt", +"QtQtQtQtQtQtQt.1.2.3.4.5.6.7.8QtQtQtQtQtQtQt", +"QtQtQtQtQtQtQt.9#.###a.R#b#c#dQtQtQtQtQtQtQt", +"QtQtQtQtQtQtQt#e.n#f#g.R.6.7#hQtQtQtQtQtQtQt", +"QtQtQtQtQtQtQt#i.i#j#k#l.Y#m#dQtQtQtQtQtQtQt", +"QtQtQtQtQtQtQt.##n#o#p.5.H#q#hQtQtQtQtQtQtQt", +"QtQtQtQtQtQtQt#i#r#s#t#u#u#v#wQtQtQtQtQtQtQt", +"QtQtQtQtQtQtQt#x.d#d#y#z#z#A#BQtQtQtQtQtQtQt", +"QtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQt", +"QtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQt", +"QtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQt"}; + + +/* + * Constructs a KSPanelRangeInterf which is a child of 'parent', with the + * name 'name'.' + */ +KSPanelRangeInterf::KSPanelRangeInterf( QWidget* parent, const char* name ) + : KSPanel( parent, name ) +{ + QPixmap image0( ( const char** ) image0_data ); + QPixmap image1( ( const char** ) image1_data ); + QPixmap image2( ( const char** ) image2_data ); + QPixmap image3( ( const char** ) image3_data ); + QPixmap image4( ( const char** ) image4_data ); + QPixmap image5( ( const char** ) image5_data ); + QPixmap image6( ( const char** ) image6_data ); + QPixmap image7( ( const char** ) image7_data ); + QPixmap image8( ( const char** ) image8_data ); + if ( !name ) + setName( "KSPanelRangeInterf" ); + resize( 554, 145 ); + setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5, (QSizePolicy::SizeType)5, 0, 0, sizePolicy().hasHeightForWidth() ) ); + setCaption( trUtf8( "KSPanelForm" ) ); + KSPanelRangeInterfLayout = new QHBoxLayout( this, 1, 1, "KSPanelRangeInterfLayout"); + + Frame11 = new QFrame( this, "Frame11" ); + Frame11->setFrameShape( QFrame::StyledPanel ); + Frame11->setFrameShadow( QFrame::Raised ); + Frame11Layout = new QGridLayout( Frame11, 1, 1, 10, 1, "Frame11Layout"); + + QLabel_4 = new QLabel( Frame11, "QLabel_4" ); + QFont QLabel_4_font( QLabel_4->font() ); + QLabel_4_font.setItalic( TRUE ); + QLabel_4->setFont( QLabel_4_font ); + QLabel_4->setFrameShape( QLabel::MShape ); + QLabel_4->setFrameShadow( QLabel::MShadow ); + QLabel_4->setText( trUtf8( "X / Y" ) ); + QLabel_4->setAlignment( int( QLabel::AlignCenter ) ); + + Frame11Layout->addWidget( QLabel_4, 2, 1 ); + + TextLabel2 = new QLabel( Frame11, "TextLabel2" ); + TextLabel2->setMinimumSize( QSize( 0, 22 ) ); + QFont TextLabel2_font( TextLabel2->font() ); + TextLabel2_font.setBold( TRUE ); + TextLabel2_font.setUnderline( TRUE ); + TextLabel2->setFont( TextLabel2_font ); + TextLabel2->setText( trUtf8( "Axes" ) ); + + Frame11Layout->addMultiCellWidget( TextLabel2, 0, 0, 0, 2 ); + + xMinus = new QPushButton( Frame11, "xMinus" ); + xMinus->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5, (QSizePolicy::SizeType)5, 0, 0, xMinus->sizePolicy().hasHeightForWidth() ) ); + xMinus->setMaximumSize( QSize( 35, 35 ) ); + xMinus->setText( trUtf8( "" ) ); + xMinus->setPixmap( image0 ); + xMinus->setFlat( FALSE ); + + Frame11Layout->addWidget( xMinus, 2, 0 ); + + yMinus = new QPushButton( Frame11, "yMinus" ); + yMinus->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5, (QSizePolicy::SizeType)5, 0, 0, yMinus->sizePolicy().hasHeightForWidth() ) ); + yMinus->setMaximumSize( QSize( 35, 35 ) ); + yMinus->setText( trUtf8( "" ) ); + yMinus->setPixmap( image1 ); + yMinus->setFlat( FALSE ); + + Frame11Layout->addWidget( yMinus, 3, 1 ); + + xPlus = new QPushButton( Frame11, "xPlus" ); + xPlus->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5, (QSizePolicy::SizeType)5, 0, 0, xPlus->sizePolicy().hasHeightForWidth() ) ); + xPlus->setMaximumSize( QSize( 35, 35 ) ); + xPlus->setText( trUtf8( "" ) ); + xPlus->setPixmap( image2 ); + xPlus->setFlat( FALSE ); + + Frame11Layout->addWidget( xPlus, 2, 2 ); + + yPlus = new QPushButton( Frame11, "yPlus" ); + yPlus->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5, (QSizePolicy::SizeType)5, 0, 0, yPlus->sizePolicy().hasHeightForWidth() ) ); + yPlus->setMaximumSize( QSize( 35, 35 ) ); + yPlus->setText( trUtf8( "" ) ); + yPlus->setPixmap( image3 ); + yPlus->setFlat( FALSE ); + + Frame11Layout->addWidget( yPlus, 1, 1 ); + KSPanelRangeInterfLayout->addWidget( Frame11 ); + + Frame13 = new QFrame( this, "Frame13" ); + Frame13->setFrameShape( QFrame::StyledPanel ); + Frame13->setFrameShadow( QFrame::Raised ); + Frame13Layout = new QGridLayout( Frame13, 1, 1, 10, 1, "Frame13Layout"); + + zMinus = new QPushButton( Frame13, "zMinus" ); + zMinus->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5, (QSizePolicy::SizeType)5, 0, 0, zMinus->sizePolicy().hasHeightForWidth() ) ); + zMinus->setMaximumSize( QSize( 35, 35 ) ); + zMinus->setText( trUtf8( "" ) ); + zMinus->setPixmap( image4 ); + zMinus->setFlat( FALSE ); + + Frame13Layout->addWidget( zMinus, 3, 0 ); + + vMinus = new QPushButton( Frame13, "vMinus" ); + vMinus->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5, (QSizePolicy::SizeType)5, 0, 0, vMinus->sizePolicy().hasHeightForWidth() ) ); + vMinus->setMaximumSize( QSize( 35, 35 ) ); + vMinus->setText( trUtf8( "" ) ); + vMinus->setPixmap( image4 ); + vMinus->setFlat( FALSE ); + + Frame13Layout->addWidget( vMinus, 3, 1 ); + + TextLabel1_2 = new QLabel( Frame13, "TextLabel1_2" ); + QFont TextLabel1_2_font( TextLabel1_2->font() ); + TextLabel1_2_font.setBold( TRUE ); + TextLabel1_2_font.setUnderline( TRUE ); + TextLabel1_2->setFont( TextLabel1_2_font ); + TextLabel1_2->setText( trUtf8( "More axes" ) ); + + Frame13Layout->addMultiCellWidget( TextLabel1_2, 0, 0, 0, 1 ); + + zPlus = new QPushButton( Frame13, "zPlus" ); + zPlus->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5, (QSizePolicy::SizeType)5, 0, 0, zPlus->sizePolicy().hasHeightForWidth() ) ); + zPlus->setMaximumSize( QSize( 35, 35 ) ); + zPlus->setText( trUtf8( "" ) ); + zPlus->setPixmap( image3 ); + zPlus->setFlat( FALSE ); + + Frame13Layout->addWidget( zPlus, 2, 0 ); + + QLabel_2 = new QLabel( Frame13, "QLabel_2" ); + QLabel_2->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5, (QSizePolicy::SizeType)1, 0, 0, QLabel_2->sizePolicy().hasHeightForWidth() ) ); + QLabel_2->setMaximumSize( QSize( 32767, 35 ) ); + QFont QLabel_2_font( QLabel_2->font() ); + QLabel_2_font.setItalic( TRUE ); + QLabel_2->setFont( QLabel_2_font ); + QLabel_2->setText( trUtf8( " Z" ) ); + QLabel_2->setAlignment( int( QLabel::AlignCenter ) ); + + Frame13Layout->addWidget( QLabel_2, 1, 0 ); + + vPlus = new QPushButton( Frame13, "vPlus" ); + vPlus->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5, (QSizePolicy::SizeType)5, 0, 0, vPlus->sizePolicy().hasHeightForWidth() ) ); + vPlus->setMaximumSize( QSize( 35, 35 ) ); + vPlus->setText( trUtf8( "" ) ); + vPlus->setPixmap( image3 ); + vPlus->setFlat( FALSE ); + + Frame13Layout->addWidget( vPlus, 2, 1 ); + + QLabel_3 = new QLabel( Frame13, "QLabel_3" ); + QLabel_3->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5, (QSizePolicy::SizeType)1, 0, 0, QLabel_3->sizePolicy().hasHeightForWidth() ) ); + QLabel_3->setMaximumSize( QSize( 32767, 35 ) ); + QFont QLabel_3_font( QLabel_3->font() ); + QLabel_3_font.setItalic( TRUE ); + QLabel_3->setFont( QLabel_3_font ); + QLabel_3->setText( trUtf8( " V" ) ); + QLabel_3->setAlignment( int( QLabel::AlignCenter ) ); + + Frame13Layout->addWidget( QLabel_3, 1, 1 ); + KSPanelRangeInterfLayout->addWidget( Frame13 ); + + Frame9 = new QFrame( this, "Frame9" ); + Frame9->setFrameShape( QFrame::StyledPanel ); + Frame9->setFrameShadow( QFrame::Raised ); + Frame9Layout = new QGridLayout( Frame9, 1, 1, 10, 1, "Frame9Layout"); + + viewDown = new QPushButton( Frame9, "viewDown" ); + viewDown->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5, (QSizePolicy::SizeType)5, 0, 0, viewDown->sizePolicy().hasHeightForWidth() ) ); + viewDown->setMaximumSize( QSize( 35, 35 ) ); + viewDown->setText( trUtf8( "" ) ); + viewDown->setPixmap( image5 ); + viewDown->setFlat( FALSE ); + + Frame9Layout->addWidget( viewDown, 3, 1 ); + + viewLeft = new QPushButton( Frame9, "viewLeft" ); + viewLeft->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5, (QSizePolicy::SizeType)5, 0, 0, viewLeft->sizePolicy().hasHeightForWidth() ) ); + viewLeft->setMaximumSize( QSize( 35, 35 ) ); + viewLeft->setText( trUtf8( "" ) ); + viewLeft->setPixmap( image6 ); + viewLeft->setFlat( FALSE ); + + Frame9Layout->addWidget( viewLeft, 2, 0 ); + + viewRight = new QPushButton( Frame9, "viewRight" ); + viewRight->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5, (QSizePolicy::SizeType)5, 0, 0, viewRight->sizePolicy().hasHeightForWidth() ) ); + viewRight->setMaximumSize( QSize( 35, 35 ) ); + viewRight->setText( trUtf8( "" ) ); + viewRight->setPixmap( image7 ); + viewRight->setFlat( FALSE ); + + Frame9Layout->addWidget( viewRight, 2, 2 ); + + TextLabel1 = new QLabel( Frame9, "TextLabel1" ); + QFont TextLabel1_font( TextLabel1->font() ); + TextLabel1_font.setItalic( TRUE ); + TextLabel1->setFont( TextLabel1_font ); + TextLabel1->setText( trUtf8( "3D" ) ); + TextLabel1->setAlignment( int( QLabel::AlignCenter ) ); + + Frame9Layout->addWidget( TextLabel1, 2, 1 ); + + viewUp = new QPushButton( Frame9, "viewUp" ); + viewUp->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5, (QSizePolicy::SizeType)5, 0, 0, viewUp->sizePolicy().hasHeightForWidth() ) ); + viewUp->setMaximumSize( QSize( 35, 35 ) ); + viewUp->setText( trUtf8( "" ) ); + viewUp->setPixmap( image8 ); + viewUp->setFlat( FALSE ); + + Frame9Layout->addWidget( viewUp, 1, 1 ); + + TextLabel3 = new QLabel( Frame9, "TextLabel3" ); + QFont TextLabel3_font( TextLabel3->font() ); + TextLabel3_font.setBold( TRUE ); + TextLabel3_font.setUnderline( TRUE ); + TextLabel3->setFont( TextLabel3_font ); + TextLabel3->setText( trUtf8( "Viewpoint" ) ); + + Frame9Layout->addMultiCellWidget( TextLabel3, 0, 0, 0, 2 ); + KSPanelRangeInterfLayout->addWidget( Frame9 ); + + Frame7 = new QFrame( this, "Frame7" ); + Frame7->setFrameShape( QFrame::StyledPanel ); + Frame7->setFrameShadow( QFrame::Raised ); + Frame7Layout = new QGridLayout( Frame7, 1, 1, 5, 1, "Frame7Layout"); + + rememberView = new QPushButton( Frame7, "rememberView" ); + rememberView->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5, (QSizePolicy::SizeType)0, 0, 0, rememberView->sizePolicy().hasHeightForWidth() ) ); + rememberView->setText( trUtf8( "Remember" ) ); + rememberView->setAutoDefault( FALSE ); + + Frame7Layout->addMultiCellWidget( rememberView, 2, 2, 0, 2 ); + + view3 = new QPushButton( Frame7, "view3" ); + view3->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5, (QSizePolicy::SizeType)0, 0, 0, view3->sizePolicy().hasHeightForWidth() ) ); + view3->setText( trUtf8( " 3" ) ); + view3->setAutoDefault( FALSE ); + + Frame7Layout->addWidget( view3, 1, 2 ); + + view2 = new QPushButton( Frame7, "view2" ); + view2->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5, (QSizePolicy::SizeType)0, 0, 0, view2->sizePolicy().hasHeightForWidth() ) ); + view2->setText( trUtf8( "2" ) ); + view2->setAutoDefault( FALSE ); + + Frame7Layout->addWidget( view2, 1, 1 ); + + view1 = new QPushButton( Frame7, "view1" ); + view1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5, (QSizePolicy::SizeType)0, 0, 0, view1->sizePolicy().hasHeightForWidth() ) ); + view1->setText( trUtf8( " 1" ) ); + view1->setAutoDefault( FALSE ); + + Frame7Layout->addWidget( view1, 1, 0 ); + QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Minimum, QSizePolicy::Preferred ); + Frame7Layout->addItem( spacer, 0, 1 ); + KSPanelRangeInterfLayout->addWidget( Frame7 ); +} + +/* + * Destroys the object and frees any allocated resources + */ +KSPanelRangeInterf::~KSPanelRangeInterf() +{ + // no need to delete child widgets, Qt does it all for us +} + +#include "kspanelrangeinterf.moc" diff --git a/kmatplot/dialogs/kspanelrangeinterf.ui b/kmatplot/dialogs/kspanelrangeinterf.ui new file mode 100644 index 0000000..2a1dd59 --- /dev/null +++ b/kmatplot/dialogs/kspanelrangeinterf.ui @@ -0,0 +1,760 @@ + +KSPanelRangeInterf + + + KSPanelRangeInterf + + + + 0 + 0 + 554 + 145 + + + + + 5 + 5 + 0 + 0 + + + + KSPanelForm + + + + unnamed + + + 1 + + + 1 + + + + Frame11 + + + StyledPanel + + + Raised + + + + unnamed + + + 10 + + + 1 + + + + QLabel_4 + + + + 1 + + + + MShape + + + MShadow + + + X / Y + + + AlignCenter + + + + + + + TextLabel2 + + + + 0 + 22 + + + + + 1 + 1 + + + + Axes + + + + + xMinus + + + + 5 + 5 + 0 + 0 + + + + + 35 + 35 + + + + + + + image0 + + + false + + + + + yMinus + + + + 5 + 5 + 0 + 0 + + + + + 35 + 35 + + + + + + + image1 + + + false + + + + + xPlus + + + + 5 + 5 + 0 + 0 + + + + + 35 + 35 + + + + + + + image2 + + + false + + + + + yPlus + + + + 5 + 5 + 0 + 0 + + + + + 35 + 35 + + + + + + + image3 + + + false + + + + + + + Frame13 + + + StyledPanel + + + Raised + + + + unnamed + + + 10 + + + 1 + + + + zMinus + + + + 5 + 5 + 0 + 0 + + + + + 35 + 35 + + + + + + + image4 + + + false + + + + + vMinus + + + + 5 + 5 + 0 + 0 + + + + + 35 + 35 + + + + + + + image4 + + + false + + + + + TextLabel1_2 + + + + 1 + 1 + + + + More axes + + + + + zPlus + + + + 5 + 5 + 0 + 0 + + + + + 35 + 35 + + + + + + + image3 + + + false + + + + + QLabel_2 + + + + 5 + 1 + 0 + 0 + + + + + 32767 + 35 + + + + + 1 + + + + Z + + + AlignCenter + + + + + + + vPlus + + + + 5 + 5 + 0 + 0 + + + + + 35 + 35 + + + + + + + image3 + + + false + + + + + QLabel_3 + + + + 5 + 1 + 0 + 0 + + + + + 32767 + 35 + + + + + 1 + + + + V + + + AlignCenter + + + + + + + + + Frame9 + + + StyledPanel + + + Raised + + + + unnamed + + + 10 + + + 1 + + + + viewDown + + + + 5 + 5 + 0 + 0 + + + + + 35 + 35 + + + + + + + image5 + + + false + + + + + viewLeft + + + + 5 + 5 + 0 + 0 + + + + + 35 + 35 + + + + + + + image6 + + + false + + + + + viewRight + + + + 5 + 5 + 0 + 0 + + + + + 35 + 35 + + + + + + + image7 + + + false + + + + + TextLabel1 + + + + 1 + + + + 3D + + + AlignCenter + + + + + + + viewUp + + + + 5 + 5 + 0 + 0 + + + + + 35 + 35 + + + + + + + image8 + + + false + + + + + TextLabel3 + + + + 1 + 1 + + + + Viewpoint + + + + + + + Frame7 + + + StyledPanel + + + Raised + + + + unnamed + + + 5 + + + 1 + + + + rememberView + + + + 5 + 0 + 0 + 0 + + + + Remember + + + false + + + + + view3 + + + + 5 + 0 + 0 + 0 + + + + 3 + + + false + + + + + view2 + + + + 5 + 0 + 0 + 0 + + + + 2 + + + false + + + + + view1 + + + + 5 + 0 + 0 + 0 + + + + 1 + + + false + + + + + Spacer1 + + + Vertical + + + Preferred + + + + 20 + 20 + + + + + + + + + + KSPanel +
kspanel.h
+ + 500 + 140 + + 1 + + 0 + 0 + 0 + 0 + + image9 +
+
+ + + 789c95d24b6fe2301007f03b9f222237b4a224b183add51e4a9b026d79b4e5b0d26a0f8e9d9457a0e551a0abfdeeeb99f19e302bed2407fff4cf58ce24578de0fb781034ae6adb9ddacd74a0a76a1334ccbeaa4e3f7e7efb55abc771606f2682a8fea5566f063a18ae5705ac955d872d2ce0ab23231aa4b014c093a3204e1c353103462db88043a4800b9803932861099e21444a4b09ec3b0ae2c851131f812c4a34c3de3ba4628c29a07614c417208f99e631f089c85bc44fa4e29ce3c3cf8e92f8e06888b7c034e626c5de15318d8863474edc229525f6ce1d25b1eb6888d7c076d28eda09b0048aa46d04f2866827873c3a72e201995be6c0bda3240e1c0db107944c18c98053a28c881b474efc406a4b0d2c1c2571e168886f40c5a451d8db21aa88b873e4c477a4b6c4de0a98b33cce31bd774c896ba0e63ad61c380396691997297089c4c29fd95bff9384ea42926be34fc2a27cf526f97436f726e16259ad7cbbe58be5fa6de53941582cd7ef9bed7992ef6c30dd9ff7841f331b1c8ee7c9e9f3fad0296e8eb7e7bb6577dd7da7e8f94e90f5e7bdfbe2c1379decb13ba85643df9b66a371f7c93fb7acfffce29f5b73d21f5d489a938bdfa779ba98fcad7f24bfbfd6fe00fe9d17ba + + + 789ccdd3496fda401407f03b9fc2821baa1a2f33e051d50384ec8110c84252f5309e1907c212c21243aa7ef7ce5b1aa511c7aaeab30ffee93f6ffcc692f7aac1a0db0eaa7ba5e54aaf46263043bd08aa763d9d6ebf7dfffaa3548ee3c0df520451f953a9fc393041e769e6e0d92f0e2a2116503305b1824c3d5360c64c894f4c436c02a3303411f6f68970016f9882688171189918e980499484094e78ce14c406522569a28033a088442830cd915a18a181f740194b2963e014a93d311d312d7102acc5d2d670f198588b888f4c493c436a4fec1d3215f195698977c07a5297f504d84366f5a89e011f988a5800d32495292e5e23334f4c4f998a78c9b4c417a012a95202784c54927884342a5206b8614ae2926989fb40ed7b35f6ae988a38675ae2215147c40b26f75e21fdce1a776e13fd62e43553126f8199efcdb0b7cbd4c42dd266b5cc02174c4d3c011a9969238107486b6a06d30e5313074087057c06e6b973790e6c11a1f037d959ff4b52d1159d192a5bf132bf13973f0c478f635fa3f1649acfdcd3db6e6efebc58aed62fc566b37d9d349aefdee3f65b07874745717c727a76defc6302d76e752e569bee65afd1ff309bbbf25dd7c59083f753bb79ab53f41a373bcee36e0777b3fece93baf9fd5bf0e11bb8e6dff86eff20f9f9a5f40b25a6301a + + + 789c8dd1cb4ee3301480e17d9fc26a771582d8712e1662012d773a9a25d26816be24b4a597a44d530a9a779f9c63a3b882482459e4d37f8e14c56743f2fc7b428667bd6d25ab99267a2a37646876cbe5e1cfdf8b8f5e9f31d23c9c12da3fe9f54f8926bfd6ab0cde9b613208f0023e3a72cb1b641ae82005de016910688af5dd9272cb6b64da1087378eda72076401d50c875748c13813c057c7d45202431a06217ef00029421e621d3ba6961320a73ce038ac80318b4ccc8099654c2d9f804998d024048e902a891205bc771496b78ec6f2129886294d71b7768c2cf748d510872b4761590205175470e01b528b486860e1282c1f80920b2371788bd4329258af1c33cb055071c5140e4f914649658007a08e34d311d038c69639d234c4e1b5a3b49c034d06377009cce28c6531f0c531b69c01f3386739f2f4dbeb276520bb8a54ba6bc764ba63277f39daf2ca7436f7b7daf2ba584ee7de565b568b75517a5b6dd96cf3a22adbadb6ec8a45bddfbf1d3eb7daf25e16f56579351a7f29d775517bc12b37b7951fbc7277ffe007af3c8e0a3f78453f1d85a332eef8a37ad2750afa38fce8b4bf947fe7bdffa052058b + + + 789ccdd2494fe3301407f07b3f4554df2a04599cc51a71602f4b4be184349a8337baa4e992b6947634df1dbff74c1052e78e9d837ffabfbf143939e9042f835ed03969add6723dd6811ec93ae8984d55ed7eff39fddb6ac771e01e9e0551fba8d53e0e74d09fcf2c9c993bb31017f01959843c2c804f9e0571008cc2504738fc48840dec230bd8c01e300e61031f3c39f11e29e22216c03b4f4dec02932809137ce15b4f4e3c430a471c569e9af80ae451a2390edf10794894c054a62695400dcce2d46431f01a982799c913e015318f88d633255e20552e7205bc0416496e0a4c67447719c895674a9c239523764b4f41ac3c0d710214bc308203474411116ba4164268e0ded3109740c98591387c4e94297187d4d24a1c1e03159756613a25aa98b8401a2595011aa04e75a653e016691c317df794c421d066c6da0cf846b431718d7499c57f72e36989c707d74f4b18fb4fc2a4620713773df6951d48981c8ec6b6697d254c0f27e564dab49ac435aa7236af9ad667e21a8b655daee64dcb274cae376fdbf7ddbeaeea3db52839d35bb3984ecf97a3f2e2d25e5ddfb0cfa47bdbeddedd3ff4fafdc7c1d333638cfdbcaff02df9f7abf501939a1135 + + + 789ccdd24b4fe3301007f07b3f45d4dc2a0479d8492cb487be78b6a5e521adb4da83633bb4943e68d39482f6bbaf67c62016f5b8424c72c84fff8c33b672d4f07e0efb5ee3a8b62e6539519e1acb95d7d09bd96cf7ebf78fd75a3d8a3c7b33e185f5835afdd053de603137f06c5ff6fc000b281d19d1476696193077cc880b47456c01c3205021f68e887001af1d195103a3205411d200e3300e629cf0c291119b481167b100ce812c6401c3b4404aa69804de0179c4398f8033a4b4c4f4c55110278e9af8084c22ae13ec9d129390f8e0c889e7486989bd634741dc396ae21098c6894e63e02d31e5c47b649e8a340756c02cce7886e906995b627ae62888578e9ab8050a2642c180278e9c582295a5022e1d0571eda8899740c98496d8db25ca90d877e4c401525962ef333067799463ba724c88a7486da9811da0e22a521cd8734c88374083057c0216893145026c23b1f0dfde5bdf25f1a52f7345a57d2bf59698e27e3c7998da9a4c1f67c5dc2cde5733cba7d5badc6caa6df9bc7b69b63e7cc794ed4e775b5527a767e717ad7f263097ed5ebf2c0757c3e6e8d36c36ea74fbd5d8051fa736cb76af1a36aff7ecc70c6e6ee7a3bd3b35cbbbf7e0d31998d6ff38b72f48fe1cd7fe0244361c70 + + + 789cc5d3c94e1b411006e0bb9f6244df50f4e319cfaa2807f67d313b4439f474cf780163c0663151de3ddd5d35430858f894b0083e57cd5f5d6d7961de3b3fd8f5e6171aa3b11cf794a7baf2de9bd70f83c1e4fb8f6f3f1b7341e0999f24f682b92f8db9f6d853dedef0a6b0c0958168ba2fe789736a985a8b3e3b2443925b61e4c2d066ab483afbe4cccfb57bbec7d62a72f56db22c94ab2322e701fbdeda6fd6f9829db2f76ad3bc7d7635ff801c3663ea4fc87194e6cecfec8c2ccaca59e8ea9b6ccd5e26a79954ceeb6c9d53fd8c6cf62507b5699f4776c40ed919dfc7099bef4748b2f4b9de6457f7d522ab40d3fbb7e59c864ddeff8e5cefb34b4efccc9d5f14e42a5fe4ec429315b9ce3f65c745ecacad83d7fbed93938cf2119365c4e7dd219b3cdae7891d73be9b1f64a1e2bc6372751eb8f3b4fca819d37ee7e444f3bc949cfa92f67db00efdbce0fc15b2aef6597396f57e1b645d14ce42938b80ddb58e647dde25eb38a8f611825dddcf91b3ace7df5827795eed73619db672c91e9295e4e707d6e63aaae76f2b73ddbd7f99aacf73692d43cdf3059c55ddbf6a9deb6a3f8cc9d57e38b456511194d4ef3e0f3aaaeb8b6cc975f77936696cd161175cbfae5d3abbfb2be2badea94df58c5c06ec17ebb22c257bc42ec9edf1ecdfffbe1f02123914b4f96bfeffb45fa240890ebae8a18fab19f2af31c00d86b8c5dd0cfdf718618c073ce209cf98cc90ff82452c61192b33e54b93bf8a35ac63039b33f46f99fc21b6cd7976b03bad1f7bd8c701dae6771f8738c2314e708a33677efd6d3eae708e0b7397052ed1848f002d8488109bd7936ace9fe7c104293201218434a709452e94d0a210e5eba9de9edfcd18898ee88a9ec96ed9eed7ec8ff6157d33c33e21cc337f654fb91f3703abefb33feeaff778973dad9f67bccb9edeef667cd0fd3f3e5f9ff4fffadaf80d65de6ed9 + + + 789cadd4db4edb401006e07b9e2262ee50f537766cc7abaa1710a027a0a4e554aa5e6cd636044802211c42d577ef7a66bc54854a412ac1828f9959ef61d8d72bada3ddedd6caeba5eb999d0d5dcb9dda696ba5b8198de6df7fbcfdb9b41cc72dff6dbaad78f9d5d2727fd672ad9dc9b8ac81a907b5ebaf9c3d5627ed766dba51bb888d5d71d48e25fec0ce7d3ed7d3863ad7fc2458e2eb6a27464f1cc61ba913313ac186e37375aebe6fdc89389fc49d24e5c5c2a95d6a391f6293ba94e3efd585da886da4beaa1db53bb98e3754eb78b08d338ed34c9c2499bcaf274ed3ee80bda62ef20ed7c7e22c12930be67ca4ea544cd78d4dc29eaa8d18237137d2f85db063af8af3c84a5ce76fa28178105cb02fd5a9c62998e338541bddaf03b5ee2715629b3a194ff6330ff3cdc4b6398f776aabf995ba2c24be2f1e64623a51db82fb992ec42e1623576765c6e6f5c4f5f9c879dd8ac3fcc6e230feb9d88f27efefaa4b1d9ff72b3689ebca79ae89fd798b3f8b33a3e729ef33031d8f4ec54edf0776276ace1b13b6498d8e77246eeaf141ddccb7141756d7cbe79f44a1bf237158ef99b868f687eb131bfa6d286ec6a389ba2c65fd7c3fa4d6cf5fbc533b8b9bf980cfbfeb27a4fdb2292e627d5f9f3d3046e36d7138af3d71c8e7fecf1fc73b135bed57548d75bddfc44efb037cfff876b11aff58db247e7d12e7fbc438ff3ef1716d9bf8fd11737f59e74a9dcfb6b88c2bf1d7da2e0dde62fbed527f0aaed8fcff58a4c15fd86515abf93e2db3507f220ef1b93a53f3fd533ed6f3fd5c5595559fab2b717fb6f8e7ffe5835e920f825d3cdf670fe016cdf7d905ca45c7f7d9154e708ae122f93efb0ce7b8c00816634c70892bffb72b4c9fcbf7916b9f3dc30d6e71877bccbd1eb08a35f49ee6fbec751fddc026dee13d3ee0233e610bdbd8c167ecfe9defb3fbf882afd8c33e0e70e89f237cc331da8810a3f3243f418a0c5de4303824f887c8facfc0ff744fc7f7153da45450899c2a3aa1531ad2997fcee9821c8d9e5d6f5d31a689cfb074e97fbfa2295d23a619ddfc633feb8a5b2ae90e43baa711cdd1f1cf2e3dfcf3bcea8a555a5bbc7fb8a2b778fff467b40ef792fee48a85fae78f8a8d97e53fff7971feaf374bbf01ffcdacb6 + + + 789cadd4d76edb301406e07b3f8510de05c51f4bd644d18becd1ec9d14bda048da597696338bbe7b299e23c676560dc44a8c7ce6e11994e2a9c9e070732d989c6adcf665ff5405ea44de0493faaedb7dfaf5fbc79fc6441405f6276b05d1c4b7c6c4563f50c1fa65cf544069219aeee56c9c73cbdcf98c1db32fc8ad3871c920d92a91cefbe4bc90aab2d0e4222c63b7becb4e4aed3ccfd62a71f1ae7ed8f4f9cfd9395b78533d458e9b29ad37c96992972e1fd845e1ea8b92adc9d823d7fd629d6cfba5fe36d875bf07ec82fac5269bfbc71c591ae5e2459b5c469ad633b28a349d7fd7398f9b348f9064df2fcd97676141fd1d9365c8f572b6e1fc05d9e74fd9a9499db72b47febc84206709e5171db24ca87f44649572be7be722567cde6b645f3f21fbf8c5caad304952ba5f1d72a6791e4dce4349f763a5721c9686f7b7c8ba9e67d559faf962b236867c443611fbb072f212bfc0aefbfb59398dfc7a9f5d9fd7acb3f4fdb8fb99b74ac9f32eb3ebf967c84af2fec7caf6b8eafd616d5eef392bdfcf095bb22f2b4be5f7df92b5e4f9a62b97b19f7fcb597b3f91fd79dc54568989da54ffc1f965fdb9b24e8ce4f51d67e37dc736ec6befb6f35265937a9f92db11fbaa72dbbde8cbe8ffafaf8a8718335ea21c2b5e41c38c95bf8dceeb1a1fe43fc1a9ad71f65e3cce71e17fbb367f0f97b81aad3114dfc3b58da0eb06b7e8e3cefe3534c740fc3d1ef088273c631a3398c51ce6b1e0760cd418885fc41296b1829f58b5b16b58c706366d8d2d37877915bf8d1d9b77177bd8b791f3367e170738c4118ed1ac2b0cc45fd8f810115a88912045861c45152df0663fe7420889a690a2144a689b3b1bce3d1c2f0c4a7bd17b0925daa3b93fbebfa2339afbb3e76734f727cfcfabdc9fe41fef79966f7dfa75ff8fefc6fffddef807271766bc + + + 789cc5d45d53d3401406e07b7e458773c738af499aa4c9385e808af8015214051d2fb6bb09146881123e8ae37f7773ced9f8815a6e1ca770f1f4bce764b3d9e6e14a6f6f7bb3b7f270e9a231cdd8f6eca199f556dce56432fff4f9f197a5e524e9f9bf32ed25cb0f9696874dcff6b64ea7550bc41e1445511a45ade9a673c15e55db587c2d8e23b553a789f4afb18bd08f485dc45c87e92cf5976a9d0f99e7d33aef561de6cf3b97ec4375214611dc8fd924eea719df3c76d53633dcdf883357f4b9fe4c5c3a9b717ddc3a8efa85f6bf57db9c4d57e234cd791ede89b36c3062bf55eb7c3a17e7b1fab2b3e4ad3a13d324b84cb93e5097ea2df1202e2dfb85b8888dd477c4653c62d34967c7f58fea4ceac8d4a5d6d783653fb0add6fdc18dd8c46a9d6f32cbfd24f75374eb3d10fbbae49faa8de4f13cd849fd5a3ccad543b571727e37c436519fabf32ae7eb57ad93282de479e1561cd6870b71377f5fece7898fd595ce7fc52e533b90e7371367915ae69579a9cff38d7814e66db6eec7e1f9a264975929fdf820eef6371577fd7beab0de99d885fb3d6b9dc6ddfe8fc42ed7f5bf669b6e7db9d819e9c75c5c2595e49fb4ce4cd85f3a6d9d27ddf5f9fd30f00bd0f372257689cee3eb0f46e13cd1b1d886f59ca92bcdf3efb9f83e6f2236e1bc36c1fafb34621bce033f6f7f3c8cee5fd2bab42edc4f5f6dc4c4e7d1a47effa4ceef2f63c37ae8485c25b5ac8f6db360aad9aeaad4d4b9664f5bbb2c189cf7e560decf2aeffa21ae73adf3fbc1571335bf8feaba36eaa9ba160f9bfb7ffe571e0473ffbc4f8f60e1ee97f7e90a350e7ed77137efd38718e308c738b9dbf16bdea72798e2146738c70c17bf76fc9cf7e9c6a72f71856bdcf88e396e7feef831efd3ab7edd6b7882a77886753cc786bfc60bdff1f26edea75fe13536b18537d8f6e9750cb1e3f516efb01b3a42dea7dffb6fe5ff03f6b8631f1fbbef7611fd617f6224e82345861c03140bf7b3241091c10e8dc8d282fd1c3654614a351df8b5fbf974b8303fc6988ee8984eb04f93c5f3fd62a6744a677efd1b747e9ff934a30b6ae8d27faee87a61fe068e1ccde9d67f56696d51feef9f7f9efffa68e91b2f37a4ed + + + 789cd3d7528808f055d0d2e72a2e492cc94c5648ce482c52d04a29cdcdad8c8eb5ade65232540043251d2e253d856405e554300073956aadb900494e10c6 + + + +
diff --git a/kmatplot/dialogs/kspanels.cpp b/kmatplot/dialogs/kspanels.cpp new file mode 100644 index 0000000..10ca452 --- /dev/null +++ b/kmatplot/dialogs/kspanels.cpp @@ -0,0 +1,2547 @@ +/*************************************************************************** + kspanels.cpp + ------------------- + begin : Fri Jan 4 2002 + copyright : (C) 2002 by kamil + email : kamil@localhost.localdomain + ***************************************************************************/ + +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + + +#include"kspanels.h" +#include"ksattrbtn.h" +#include "../widgets/qsaxes3d.h" +#include "../widgets/qsaxes2d.h" +#include "../widgets/qsaxis.h" +#include "../widgets/qsplot.h" +#include "../widgets/qsfigure.h" +#include "../widgets/qssurface.h" +#include "../widgets/qscontour.h" +#include "../widgets/qscurve.h" +#include "../widgets/qsimage.h" +#include "../kscommands.h" +#include "kstextedit.h" + +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +#include"../pixmaps/panel_position.xpm" +#include"../pixmaps/panel_arrow.xpm" +#include"../pixmaps/panel_x.xpm" +#include"../pixmaps/panel_y.xpm" +#include"../pixmaps/panel_z.xpm" +#include"../pixmaps/panel_v.xpm" +#include"../pixmaps/panel_label.xpm" +#include"../pixmaps/panel_legend.xpm" +#include"../pixmaps/action_contour.xpm" +#include"../pixmaps/panel_pos1.xpm" +#include"../pixmaps/panel_rect.xpm" +#include"../pixmaps/panel_box.xpm" +#include"../pixmaps/action_figure.xpm" +#include"../pixmaps/panel_frame.xpm" +#include"../pixmaps/panel_general.xpm" +#include"../pixmaps/panel_gl.xpm" +#include"../pixmaps/action_pixmap.xpm" +#include"../pixmaps/panel_light.xpm" +#include"../pixmaps/panel_mesh.xpm" +#include"../pixmaps/action_curve.xpm" +#include"../pixmaps/action_surface.xpm" +#include"../pixmaps/panel_gx.xpm" +#include"../pixmaps/panel_gy.xpm" +#include"../pixmaps/panel_gz.xpm" +#include"../pixmaps/panel_gv.xpm" +#include"../pixmaps/panel_view.xpm" +#include"../pixmaps/panel_gradient.xpm" + + +//-----------------------------------------------------------// + +KSPanelButtonRange::KSPanelButtonRange( QWidget *parent, KSWorkbook *workbook, QSAxes *axes ) +:KSPanelButton( parent, workbook, BGeneral, QPixmap(panel_position), tr("Fast range and viewpoint setting") ) + { + m_axes = axes; + } + +//-----------------------------------------------------------// + +KSPanelButtonRange::~KSPanelButtonRange() + { + } + +//-----------------------------------------------------------// + +KSPanel *KSPanelButtonRange::createPanel( QWidget *panelParent ) + { + return new KSPanelRange( panelParent, m_workbook, m_axes ); + } + +//-----------------------------------------------------------// + +bool KSPanelButtonRange::isButtonFor( QSCObject *, int, int ) + { + /* + if ( category == QSAxes::GeneralCategory && + object->isAxesShadow() && + element == 0 ) return true; + */ + return false; + } + +//-----------------------------------------------------------// +//-----------------------------------------------------------// +//-----------------------------------------------------------// +//-----------------------------------------------------------// +//-----------------------------------------------------------// + +KSPanelRange::KSPanelRange(QWidget *parent, KSWorkbook *workbook, QSAxes *axes, const char *name) +: KSPanelRangeInterf(parent,name) + { + m_axes = axes; + m_workbook = workbook; + + connect( rememberView, SIGNAL(clicked()), this, SLOT(remember_view()) ); + + connect( view1, SIGNAL(clicked()), this, SLOT(set_view_1()) ); + connect( view2, SIGNAL(clicked()), this, SLOT(set_view_2()) ); + connect( view3, SIGNAL(clicked()), this, SLOT(set_view_3()) ); + + connect( viewUp, SIGNAL(clicked()), this, SLOT(view_up()) ); + connect( viewDown, SIGNAL(clicked()), this, SLOT(view_down()) ); + connect( viewLeft, SIGNAL(clicked()), this, SLOT(view_left()) ); + connect( viewRight, SIGNAL(clicked()), this, SLOT(view_right()) ); + + connect( xPlus, SIGNAL(clicked()), this, SLOT(x_plus()) ); + connect( yPlus, SIGNAL(clicked()), this, SLOT(y_plus()) ); + connect( zPlus, SIGNAL(clicked()), this, SLOT(z_plus()) ); + connect( vPlus, SIGNAL(clicked()), this, SLOT(v_plus()) ); + + connect( xMinus, SIGNAL(clicked()), this, SLOT(x_minus()) ); + connect( yMinus, SIGNAL(clicked()), this, SLOT(y_minus()) ); + connect( zMinus, SIGNAL(clicked()), this, SLOT(z_minus()) ); + connect( vMinus, SIGNAL(clicked()), this, SLOT(v_minus()) ); + + m_axes3 = dynamic_cast(axes); + + if ( !m_axes3 ) { + viewLeft->setEnabled( false ); + viewRight->setEnabled( false ); + viewUp->setEnabled( false ); + viewDown->setEnabled( false ); + } + } + +//-----------------------------------------------------------// + +KSPanelRange::~KSPanelRange() + { + } + +//-----------------------------------------------------------// + +void KSPanelRange::readProperties() + { + } + +//-----------------------------------------------------------// + +void KSPanelRange::applyProperties() + { + } + +//-----------------------------------------------------------// + +void KSPanelRange::x_plus() + { + shift_range( QSAxis::XAxisType, 0.1 ); + } + +//-----------------------------------------------------------// + +void KSPanelRange::y_plus() + { + shift_range( QSAxis::YAxisType, 0.1 ); + } + +//-----------------------------------------------------------// + +void KSPanelRange::z_plus() + { + shift_range( QSAxis::ZAxisType, 0.1 ); + } + +//-----------------------------------------------------------// + +void KSPanelRange::v_plus() + { + shift_range( QSAxis::VAxisType, 0.1 ); + } + +//-----------------------------------------------------------// + +void KSPanelRange::x_minus() + { + shift_range( QSAxis::XAxisType, -0.1 ); + } + +//-----------------------------------------------------------// + +void KSPanelRange::y_minus() + { + shift_range( QSAxis::YAxisType, -0.1 ); + } + +//-----------------------------------------------------------// + +void KSPanelRange::z_minus() + { + shift_range( QSAxis::ZAxisType, -0.1 ); + } + +//-----------------------------------------------------------// + +void KSPanelRange::v_minus() + { + shift_range( QSAxis::VAxisType, -0.1 ); + } + +//-----------------------------------------------------------// + +void KSPanelRange::view_up() + { + if ( m_axes3 ) { + m_axes3->setElevation( m_axes3->elevation()+5 ); + } + } + +//-----------------------------------------------------------// + +void KSPanelRange::view_down() + { + if ( m_axes3 ) m_axes3->setElevation( m_axes3->elevation()-5 ); + } + + //-----------------------------------------------------------// + +void KSPanelRange::view_left() + { + if ( m_axes3 ) m_axes3->setAzimuth( m_axes3->azimuth()-15 ); + } + +//-----------------------------------------------------------// + +void KSPanelRange::view_right() + { + if ( m_axes3 ) m_axes3->setAzimuth( m_axes3->azimuth()+15 ); + } + +//-----------------------------------------------------------// + +void KSPanelRange::shift_range( int axis_type, double shift ) + { + KSCmdSetRanges *cmd = new KSCmdSetRanges( m_axes ); + for( int axis_nr=0; axis_nraxisCount(); axis_nr++ ) { + QSAxis *axis = m_axes->axis(axis_nr); + if ( axis->type() == axis_type && axis->scrollable() ) { + double min = axis->worldToData(0.0+shift); + double max = axis->worldToData(1.0+shift); + axis->setRange( min, max ); + } + } + cmd->commit(); + m_workbook->execute( cmd ); + } + +// axis->setRange( min, max ); +//-----------------------------------------------------------// + +void KSPanelRange::set_view_1() + { + KSCmdSetRanges *cmd = new KSCmdSetRanges( m_axes ); + m_axes->setRememberedView( 0 ); + cmd->commit(); + m_workbook->execute( cmd ); + } + +//-----------------------------------------------------------// + +void KSPanelRange::set_view_2() + { + KSCmdSetRanges *cmd = new KSCmdSetRanges( m_axes ); + m_axes->setRememberedView( 1 ); + cmd->commit(); + m_workbook->execute( cmd ); + } + +//-----------------------------------------------------------// + +void KSPanelRange::set_view_3() + { + KSCmdSetRanges *cmd = new KSCmdSetRanges( m_axes ); + m_axes->setRememberedView( 2 ); + cmd->commit(); + m_workbook->execute( cmd ); + } + +//-----------------------------------------------------------// + +void KSPanelRange::remember_view() + { + bool ok = FALSE; + int view_number = QInputDialog::getInteger( tr( "Please enter a number " ), "", 1, 1, 3, 1, &ok, this ); + if ( ok ) m_axes->rememberCurrentView( view_number-1 ); + } + + +//----------------------------------------------------------------------------------------------------------// +//----------------------------------------------------------------------------------------------------------// +//----------------------------------------------------------------------------------------------------------// +//----------------------------------------------------------------------------------------------------------// +//----------------------------------------------------------------------------------------------------------// +//-----------------------------------------------------------// + + + +KSPanelButtonCArrow::KSPanelButtonCArrow( QWidget *parent, KSWorkbook *workbook, QSCObject *o ) +:KSPanelButton( parent, workbook, BObject, QPixmap(panel_arrow), tr("Arrow properties") ) + { + m_object = o; + } + +//-----------------------------------------------------------// + +KSPanelButtonCArrow::~KSPanelButtonCArrow() + { + } + +//-----------------------------------------------------------// + +KSPanel *KSPanelButtonCArrow::createPanel( QWidget *panelParent ) + { + return new KSPanelCArrow( panelParent, m_workbook, m_object ); + } + +//-----------------------------------------------------------// +//-----------------------------------------------------------// +//-----------------------------------------------------------// +//-----------------------------------------------------------// +//-----------------------------------------------------------// + +KSPanelCArrow::KSPanelCArrow(QWidget *parent, KSWorkbook *workbook, QSCObject *init_o, const char *name) +: KSPanelCArrowInterf(parent,name) + { + originArrow->setOrigin( true ); + endArrow->setOrigin( false ); + m_workbook = workbook; + o = init_o; + watchProperties(); + } + +//-------------------------------------------------------------// + +KSPanelCArrow::~KSPanelCArrow() + { + } + +//-------------------------------------------------------------// + +void KSPanelCArrow::readProperties() + { + originPoint->setDialogPoint( toQSGPoint(o->property("originPoint").toString()) ); + endPoint->setDialogPoint( toQSGPoint(o->property("endPoint").toString()) ); + originArrow->setDialogArrow( toQSGArrow(o->property("originArrow").toString()) ); + endArrow->setDialogArrow( toQSGArrow(o->property("endArrow").toString()) ); + arrowLine->setDialogLine( toQSGLine(o->property("line").toString()) ); + } + +//-------------------------------------------------------------// + +void KSPanelCArrow::applyProperties() + { + KSCmdSetProperties *cmd = new KSCmdSetProperties(o); + cmd->setProperty( "originPoint", toQString(originPoint->dialogPoint()) ); + cmd->setProperty( "endPoint", toQString(endPoint->dialogPoint()) ); + cmd->setProperty( "originArrow", toQString(originArrow->dialogArrow()) ); + cmd->setProperty( "endArrow", toQString(endArrow->dialogArrow()) ); + cmd->setProperty( "line", toQString(arrowLine->dialogLine()) ); + m_workbook->execute( cmd ); + } + + +//-----------------------------------------------------------// +//-----------------------------------------------------------// +//-----------------------------------------------------------// +//-----------------------------------------------------------// +//-----------------------------------------------------------// + +KSPanelButtonAxis::KSPanelButtonAxis( QWidget *parent, KSWorkbook *workbook, QSAxis *axis ) +:KSPanelButton( parent, workbook, BAxes, QPixmap(), QString::null, axis ) + { + m_axis = axis; + + QPixmap icon; + QString tool_tip; + switch( m_axis->type() ) { + case QSAxis::XAxisType: icon = QPixmap(panel_x); tool_tip = tr("X axis "); break; + case QSAxis::YAxisType: icon = QPixmap(panel_y); tool_tip = tr("Y axis "); break; + case QSAxis::ZAxisType: icon = QPixmap(panel_z); tool_tip = tr("Z axis "); break; + case QSAxis::VAxisType: icon = QPixmap(panel_v); tool_tip = tr("V axis "); break; + } + setPixmap(icon); + QToolTip::add( this, tool_tip ); + QWhatsThis::add( this, tool_tip ); + } + +//-----------------------------------------------------------// + +KSPanelButtonAxis::~KSPanelButtonAxis() + { + } + +//-----------------------------------------------------------// + +KSPanel *KSPanelButtonAxis::createPanel( QWidget *panelParent ) + { + return new KSPanelAxis( panelParent, m_workbook, m_axis ); + } + +//-----------------------------------------------------------// + +bool KSPanelButtonAxis::isButtonFor( QSCObject *object, int category, int element ) + { + if ( category == QSAxes::AxisCategory && + object->isAxesShadow() && + m_axis == object->parentAxes()->axis(element) ) return true; + return false; + } + +//-----------------------------------------------------------// +//-----------------------------------------------------------// +//-----------------------------------------------------------// +//-----------------------------------------------------------// +//-----------------------------------------------------------// + +#define KS_MAX_DOUBLE 1e300 + +KSPanelAxis::KSPanelAxis(QWidget *parent, KSWorkbook *workbook, QSAxis *axis, const char *name) +: KSPanelAxisInterf(parent,name) + { + m_workbook = workbook; + m_axis = axis; + + ascalel->insertItem(tr("Linear"), 0 ); + ascalel->insertItem(tr("Log"), 1 ); + + alene->setValidator( new QDoubleValidator( -1000.0, 1000.0, 3, alene ) ); + amine->setValidator( new QDoubleValidator( -KS_MAX_DOUBLE, KS_MAX_DOUBLE, 16, amine ) ); + amaxe->setValidator( new QDoubleValidator( -KS_MAX_DOUBLE, KS_MAX_DOUBLE, 16, amaxe ) ); + abasee->setValidator( new QDoubleValidator( 0.0, KS_MAX_DOUBLE, 16, abasee ) ); + axisArrow1->setOrigin( true ); + axisArrow2->setOrigin( false ); + QWhatsThis::add( amine, tr("Minimum value on the axis\n\n" + "If both Maximum and Minimum values are set to zero " + "the axis range automatically fits to data. ") ); + QWhatsThis::add( amaxe, tr("Maximum value on the axis\n\n" + "If both Maximum and Minimum values are set to zero " + "the axis range automatically fits to data. ") ); + QWhatsThis::add( alene, tr("Position of the axis\n\n") ); + QWhatsThis::add( ascalel, tr("Axis scale\n\nTwo modes are available LINEAR and LOG. ") ); + QWhatsThis::add( abasee, tr("Base value\n\nWhen a scale kind is LINEAR " + "this value acts as a base step for auto-generated labels. " + "If a scale kind is LOG, the value is used as a base of " + "logarithm, but always must be > 1.0. ") ); + //QWhatsThis::add( lfont, tr("Title font\n\nFont used to print the axis title.") ); + QWhatsThis::add( labele, tr("Axis title\n\nWrite a title string here. ") ); + + watchProperties(); + } + +//-----------------------------------------------------------// + +KSPanelAxis::~KSPanelAxis() + { + } + +//-----------------------------------------------------------// + +void KSPanelAxis::readProperties() + { + QString s; + + amine->setText( s.setNum( m_axis->min(), 'g', 8 ) ); + amaxe->setText( s.setNum( m_axis->max(), 'g', 8 ) ); + alene->setText( s.setNum( m_axis->position(), 'g', 8 ) ); + abasee->setText( s.setNum( m_axis->scaleBase(), 'g', 8 ) ); + ascalel->setCurrentItem( m_axis->scaleType() == QSAxis::LinearScale ? 0 : 1 ); + labele->setText( m_axis->title() ); + labele->setBaseFont( m_axis->font(QSAxis::TitleFont) ); + titleFont->setDialogFont( m_axis->font(QSAxis::TitleFont) ); + axisArrow1->setDialogArrow( m_axis->arrow1() ); + axisArrow2->setDialogArrow( m_axis->arrow2() ); + axisLine->setDialogLine( m_axis->line(QSAxis::AxisLine) ); + areversed->setChecked( m_axis->reversed() ); + visible->setChecked( m_axis->visible() ); + scrollable->setChecked( m_axis->scrollable() ); + opposite->setChecked( m_axis->oppositePosition() ); + //defaultPosition->setChecked( m_axis->defaultPosition() ); + titlePosPara->setText( QString::number( m_axis->titlePosition(), 'g', 3 ) ); + titlePosPerp->setText( QString::number( m_axis->titleDistance(), 'g', 3 ) ); + } + +//-----------------------------------------------------------// + +void KSPanelAxis::applyProperties() + { + KSCmdSetGraphicalProperties *cmd = new KSCmdSetGraphicalProperties( m_axis ); + cmd->setProperty( "min", amine->text().toDouble() ); + cmd->setProperty( "max", amaxe->text().toDouble() ); + cmd->setProperty( "position", alene->text().toDouble() ); + cmd->setProperty( "scaleType", ascalel->currentItem()==1 ? QSAxis::LogScale : QSAxis::LinearScale ); + cmd->setProperty( "scaleBase", abasee->text().toDouble() ); + cmd->setProperty( "title", labele->text() ); + cmd->setFont( QSAxis::TitleFont, titleFont->dialogFont() ); + cmd->setProperty( "reversed", areversed->isChecked() ); + cmd->setProperty( "arrow1", toQString(axisArrow1->dialogArrow()) ); + cmd->setProperty( "arrow2", toQString(axisArrow2->dialogArrow()) ); + cmd->setLine( QSAxis::AxisLine, axisLine->dialogLine() ); + cmd->setProperty( "visible", visible->isChecked() ); + cmd->setProperty( "scrollable", scrollable->isChecked() ); + cmd->setProperty( "oppositePosition", opposite->isChecked() ); + //cmd->setProperty( "defaultPosition", defaultPosition->isChecked() ); + cmd->setProperty( "titlePosition", titlePosPara->text().toDouble() ); + cmd->setProperty( "titleDistance", titlePosPerp->text().toDouble() ); + m_workbook->execute( cmd ); + labele->setBaseFont( titleFont->dialogFont() ); + } + + +//-----------------------------------------------------------// +//-----------------------------------------------------------// +//-----------------------------------------------------------// +//-----------------------------------------------------------// +//-----------------------------------------------------------// + + +//-----------------------------------------------------------// + +KSPanelButtonCLabel::KSPanelButtonCLabel( QWidget *parent, KSWorkbook *workbook, QSCObject *o ) +:KSPanelButton( parent, workbook, BObject, QPixmap(panel_label), tr("Label") ) + { + m_object = o; + } + +//-----------------------------------------------------------// + +KSPanelButtonCLabel::~KSPanelButtonCLabel() + { + } + +//-----------------------------------------------------------// + +KSPanel *KSPanelButtonCLabel::createPanel( QWidget *panelParent ) + { + return new KSPanelCLabel( panelParent, m_workbook, m_object ); + } + + +//-----------------------------------------------------------// +//-----------------------------------------------------------// +//-----------------------------------------------------------// +//-----------------------------------------------------------// +//-----------------------------------------------------------// + + +KSPanelCLabel::KSPanelCLabel(QWidget *parent, KSWorkbook *workbook, QSCObject *init_o, const char *name) +: KSPanelCLabelInterf(parent,name) + { + m_workbook = workbook; + o = init_o; + watchProperties(); + } + +//-------------------------------------------------------------// + +KSPanelCLabel::~KSPanelCLabel() + { + } + +//-------------------------------------------------------------// + +void KSPanelCLabel::readProperties() + { + labelFrame->setDialogLine( toQSGLine(o->property("frame").toString()) ); + labelFont->setDialogFont( toQSGFont(o->property("font").toString()) ); + labelFill->setDialogFill( toQSGFill(o->property("fill").toString()) ); + shadowFill->setDialogFill( toQSGFill(o->property("shadowFill").toString()) ); + shadowdx->setValue( o->property("shadowPosX").toInt() ); + shadowdy->setValue( o->property("shadowPosY").toInt() ); + setPosAlign( o->property("textAlign").toInt() ); + } + +//-------------------------------------------------------------// + +void KSPanelCLabel::applyProperties() + { + KSCmdSetProperties *cmd = new KSCmdSetProperties(o); + cmd->setProperty( "frame", toQString(labelFrame->dialogLine()) ); + cmd->setProperty( "font", toQString(labelFont->dialogFont()) ); + cmd->setProperty( "fill", toQString(labelFill->dialogFill()) ); + cmd->setProperty( "shadowFill", toQString(shadowFill->dialogFill()) ); + cmd->setProperty( "textAlign", posAlign() ); + cmd->setProperty( "shadowPosX", shadowdx->value() ); + cmd->setProperty( "shadowPosY", shadowdy->value() ); + m_workbook->execute( cmd ); + } + +//-------------------------------------------------------------// + +void KSPanelCLabel::setPosAlign( int a ) + { + if ( a & AlignTop ) { + if ( a & AlignLeft ) _tl->setChecked( true ); + if ( a & AlignHCenter ) _tc->setChecked( true ); + if ( a & AlignRight ) _tr->setChecked( true ); + } + else + if ( a & AlignVCenter ) { + if ( a & AlignLeft ) _cl->setChecked( true ); + if ( a & AlignHCenter ) _cc->setChecked( true ); + if ( a & AlignRight ) _cr->setChecked( true ); + } + else + if ( a & AlignBottom ) { + if ( a & AlignLeft ) _bl->setChecked( true ); + if ( a & AlignHCenter ) _bc->setChecked( true ); + if ( a & AlignRight ) _br->setChecked( true ); + } + } + +//-------------------------------------------------------------// + +int KSPanelCLabel::posAlign() + { + int result = 0; + + if ( _tl->isChecked() ) result = AlignTop | AlignLeft ; + if ( _tc->isChecked() ) result = AlignTop | AlignHCenter ; + if ( _tr->isChecked() ) result = AlignTop | AlignRight ; + + if ( _cl->isChecked() ) result = AlignVCenter | AlignLeft ; + if ( _cc->isChecked() ) result = AlignVCenter | AlignHCenter ; + if ( _cr->isChecked() ) result = AlignVCenter | AlignRight ; + + if ( _bl->isChecked() ) result = AlignBottom | AlignLeft ; + if ( _bc->isChecked() ) result = AlignBottom | AlignHCenter ; + if ( _br->isChecked() ) result = AlignBottom | AlignRight ; + + return result; + } + +//-----------------------------------------------------------// +//-----------------------------------------------------------// +//-----------------------------------------------------------// +//-----------------------------------------------------------// +//-----------------------------------------------------------// + +KSPanelButtonCLegend::KSPanelButtonCLegend( QWidget *parent, KSWorkbook *workbook, QSCObject *o ) +:KSPanelButton( parent, workbook, BObject, QPixmap(panel_legend), tr("Legend") ) + { + m_object = o; + } + +//-----------------------------------------------------------// + +KSPanelButtonCLegend::~KSPanelButtonCLegend() + { + } + +//-----------------------------------------------------------// + +KSPanel *KSPanelButtonCLegend::createPanel( QWidget *panelParent ) + { + return new KSPanelCLegendC( panelParent, m_workbook, m_object ); + } + +//------------------------------------------------------------------// + +KSPanelCLegendC::KSPanelCLegendC(QWidget *parent, KSWorkbook *workbook, QSCObject* init_o, const char *name) +: KSPanelCLegendCInterf(parent,name) + { + o = init_o; + m_workbook = workbook; + watchProperties(); + } + +//------------------------------------------------------------------// + +KSPanelCLegendC::~KSPanelCLegendC() + { + } + +//------------------------------------------------------------------// + +void KSPanelCLegendC::readProperties() + { + columns->setValue( o->property("columns").toInt() ); + } + +//------------------------------------------------------------------// + +void KSPanelCLegendC::applyProperties() + { + KSCmdSetProperties *cmd = new KSCmdSetProperties(o); + cmd->setProperty("columns",columns->value()); + m_workbook->execute( cmd ); + } + +//------------------------------------------------------------------// +//------------------------------------------------------------------// +//------------------------------------------------------------------// +//------------------------------------------------------------------// +//------------------------------------------------------------------// +//------------------------------------------------------------------// + + + +//-----------------------------------------------------------// + +KSPanelButtonContour::KSPanelButtonContour( QWidget *parent, KSWorkbook *workbook, QSContour *contour ) +:KSPanelButton( parent, workbook, BDatasets, QPixmap(action_contour), tr("Contour: "), contour ) + { + m_contour = contour; + } + +//-----------------------------------------------------------// + +KSPanelButtonContour::~KSPanelButtonContour() + { + } + +//-----------------------------------------------------------// + +KSPanel *KSPanelButtonContour::createPanel( QWidget *panelParent ) + { + return new KSPanelContour( panelParent, m_workbook, m_contour ); + } + +//-----------------------------------------------------------// + +bool KSPanelButtonContour::isButtonFor( QSCObject *object, int category, int element ) + { + if ( category == QSAxes::DatasetCategory && + object->isAxesShadow() && + object->parentAxes()->plot(element) == m_contour ) return true; + return false; + } + +//-------------------------------------------------------------// +//-------------------------------------------------------------// +//-------------------------------------------------------------// +//-------------------------------------------------------------// + +KSPanelContour::KSPanelContour(QWidget *parent, KSWorkbook *workbook, QSContour *init_contour, const char *name) +: KSPanelContourInterf(parent,name) + { + contour = init_contour; + m_workbook = workbook; + m_x_select = new KSAxisSelect( xaxisc, contour->parentAxes(), QSAxis::XAxisType ); + m_y_select = new KSAxisSelect( yaxisc, contour->parentAxes(), QSAxis::YAxisType ); + m_v_select = new KSAxisSelect( vaxisc, contour->parentAxes(), QSAxis::VAxisType ); + QWhatsThis::add( titlee, tr("Series title\n\nIt is displayed on the legend.") ); + watchProperties(); + } + +//-------------------------------------------------------------// + +KSPanelContour::~KSPanelContour() +{ +} + +//-------------------------------------------------------------// + +void KSPanelContour::readProperties() +{ + m_x_select->readProperties( contour->defaultAxis(QSAxis::XAxisType) ); + m_y_select->readProperties( contour->defaultAxis(QSAxis::YAxisType) ); + m_v_select->readProperties( contour->defaultAxis(QSAxis::VAxisType) ); + fillsc->setChecked( contour->contourFills() ); + linesc->setChecked( contour->contourLines() ); + labelsc->setChecked( contour->contourLabels() ); + legendc->setChecked( contour->legendItemVisible() ); + labelSpacing->setText( QString::number(contour->labelSpacing()) ); + gridPoint->setDialogPoint( contour->point(QSContour::PointMark) ); + gridLine->setDialogLine( contour->line(QSContour::Grid) ); + titlee->setText( contour->title() ); +} + +//-------------------------------------------------------------// + +void KSPanelContour::applyProperties() +{ + KSCmdSetGraphicalProperties *cmd = new KSCmdSetGraphicalProperties(contour); + + cmd->setProperty( "title", titlee->text() ); + cmd->setProperty( "contourFills", fillsc->isChecked() ); + cmd->setProperty( "contourLines", linesc->isChecked() ); + cmd->setProperty( "contourLabels", labelsc->isChecked() ); + cmd->setProperty( "legendItemVisible", legendc->isChecked() ); + cmd->setProperty( "labelSpacing", labelSpacing->text().toDouble() ); + cmd->setLine( QSContour::Grid, gridLine->dialogLine() ); + cmd->setPoint( QSContour::PointMark, gridPoint->dialogPoint() ); + + cmd->setProperty( "defaultXAxis", contour->parentAxes()->axisIndex(m_x_select->selectedAxis()) ); + cmd->setProperty( "defaultYAxis", contour->parentAxes()->axisIndex(m_y_select->selectedAxis()) ); + cmd->setProperty( "defaultVAxis", contour->parentAxes()->axisIndex(m_v_select->selectedAxis()) ); + + m_workbook->execute( cmd ); +} + +//-------------------------------------------------------------// +//-------------------------------------------------------------// +//-------------------------------------------------------------// +//-------------------------------------------------------------// +//-----------------------------------------------------------// + +KSPanelButtonCPos::KSPanelButtonCPos( QWidget *parent, + KSWorkbook *workbook, QSCObject *o, + const QCString& posX, const QCString& posY, const QCString& posZ, + const QCString& coordX, const QCString& coordY, const QCString& coordZ ) +:KSPanelButton( parent, workbook, BObject, QPixmap(panel_pos1), tr("Position") ) + { + m_object = o; + m_pos_x = posX; + m_pos_y = posY; + m_pos_z = posZ; + m_coord_x = coordX; + m_coord_y = coordY; + m_coord_z = coordZ; + } + +//-----------------------------------------------------------// + +KSPanelButtonCPos::~KSPanelButtonCPos() + { + } + +//-----------------------------------------------------------// + +KSPanel *KSPanelButtonCPos::createPanel( QWidget *panelParent ) + { + return new KSPanelCPos( panelParent, m_workbook, m_object, m_pos_x, m_pos_y, m_pos_z, m_coord_x, m_coord_y, m_coord_z ); + } + +//-----------------------------------------------------------// +//-----------------------------------------------------------// +//-----------------------------------------------------------// +//-----------------------------------------------------------// +//-----------------------------------------------------------// + +KSPanelCPos::KSPanelCPos(QWidget *parent, KSWorkbook *workbook, QSCObject *init_o, + const QCString& posX, const QCString& posY, const QCString& posZ, + const QCString& coordX, const QCString& coordY, const QCString& coordZ, + const char *name ) +: KSPanelCPosInterf(parent,name) + {; + o = init_o; + m_workbook = workbook; + m_pos_x = posX; + m_pos_y = posY; + m_pos_z = posZ; + m_coord_x = coordX; + m_coord_y = coordY; + m_coord_z = coordZ; + + m_x_select = new KSAxisSelect( xAxis, o->parentAxes(), QSAxis::XAxisType ); + m_y_select = new KSAxisSelect( yAxis, o->parentAxes(), QSAxis::YAxisType ); + m_z_select = new KSAxisSelect( zAxis, o->parentAxes(), QSAxis::ZAxisType ); + + watchProperties(); + } + +//-------------------------------------------------------------// + +KSPanelCPos::~KSPanelCPos() + { + } + + +//-------------------------------------------------------------// + +void KSPanelCPos::readProperties() + { + m_x_select->readProperties( o->defaultAxis(QSAxis::XAxisType) ); + m_y_select->readProperties( o->defaultAxis(QSAxis::YAxisType) ); + m_z_select->readProperties( o->defaultAxis(QSAxis::ZAxisType) ); + + xaxisc->setCurrentItem( o->property(m_coord_x).toInt() ); + yaxisc->setCurrentItem( o->property(m_coord_y).toInt() ); + zaxisc->setCurrentItem( o->property(m_coord_z).toInt() ); + + xpos->setText( QString::number(o->property(m_pos_x).toDouble(),'g',9) ); + ypos->setText( QString::number(o->property(m_pos_y).toDouble(),'g',9) ); + zpos->setText( QString::number(o->property(m_pos_z).toDouble(),'g',9) ); + } + +//-------------------------------------------------------------// + +void KSPanelCPos::applyProperties() + { + KSCmdSetProperties *cmd = new KSCmdSetProperties(o); + + if ( o->parentAxes() ) { + cmd->setProperty( "defaultXAxis", o->parentAxes()->axisIndex(m_x_select->selectedAxis()) ); + cmd->setProperty( "defaultYAxis", o->parentAxes()->axisIndex(m_y_select->selectedAxis()) ); + cmd->setProperty( "defaultZAxis", o->parentAxes()->axisIndex(m_z_select->selectedAxis()) ); + } + + int old_xCoord = o->property(m_coord_x).toInt(); + int old_yCoord = o->property(m_coord_y).toInt(); + int old_zCoord = o->property(m_coord_z).toInt(); + + int new_xCoord = xaxisc->currentItem(); + int new_yCoord = yaxisc->currentItem(); + int new_zCoord = zaxisc->currentItem(); + + if ( old_xCoord != new_xCoord || + old_yCoord != new_yCoord || + old_zCoord != new_zCoord ) { + double dpi = o->parentAxes() ? o->parentAxes()->run_dpi() : 72.0; + QSPt3f p(xpos->text().toDouble(), + ypos->text().toDouble(), + zpos->text().toDouble()); + QSPt3f cp = o->mixedToCanvas( p, old_xCoord, old_yCoord, old_zCoord, dpi ); + cmd->setProperty( m_coord_x, new_xCoord ); + cmd->setProperty( m_coord_y, new_yCoord ); + cmd->setProperty( m_coord_z, new_zCoord ); + p = o->canvasToMixed( cp, new_xCoord, new_yCoord, new_zCoord, dpi ); + xpos->setText( QString::number(p.x,'g',9) ); + ypos->setText( QString::number(p.y,'g',9) ); + zpos->setText( QString::number(p.z,'g',9) ); + } + + cmd->setProperty( m_pos_x, xpos->text().toDouble() ); + cmd->setProperty( m_pos_y, ypos->text().toDouble() ); + cmd->setProperty( m_pos_z, zpos->text().toDouble() ); + + m_workbook->execute( cmd ); + } + +//-------------------------------------------------------------// +//-------------------------------------------------------------// +//-------------------------------------------------------------// +//-------------------------------------------------------------// + + +//-----------------------------------------------------------// + +KSPanelButtonCRect::KSPanelButtonCRect( QWidget *parent, KSWorkbook *workbook, QSCObject *o ) +:KSPanelButton( parent, workbook, BObject, QPixmap(panel_rect), tr("Rectangle/Ellipse") ) + { + m_object = o; + } + +//-----------------------------------------------------------// + +KSPanelButtonCRect::~KSPanelButtonCRect() + { + } + +//-----------------------------------------------------------// + +KSPanel *KSPanelButtonCRect::createPanel( QWidget *panelParent ) + { + return new KSPanelCRect( panelParent, m_workbook, m_object ); + } + +//-------------------------------------------------------------// +//-------------------------------------------------------------// +//-------------------------------------------------------------// +//-------------------------------------------------------------// + +KSPanelCRect::KSPanelCRect( QWidget *parent, KSWorkbook *workbook, QSCObject *init_o, const char *name ) +: KSPanelCRectInterf(parent,name) + {; + o = init_o; + m_workbook = workbook; + watchProperties(); +} + +//-------------------------------------------------------------// + +KSPanelCRect::~KSPanelCRect() + { + } + +//-------------------------------------------------------------// + +void KSPanelCRect::readProperties() + { + ellipse->setChecked( o->property("ellipse").toBool() ); + rectFrame->setDialogLine( toQSGLine(o->property("frame").toString()) ); + rectFill->setDialogFill( toQSGFill(o->property("fill").toString()) ); + shadowFill->setDialogFill( toQSGFill(o->property("shadowFill").toString()) ); + shadowdx->setValue( o->property("shadowPosX").toInt() ); + shadowdy->setValue( o->property("shadowPosY").toInt() ); + } + +//-------------------------------------------------------------// + +void KSPanelCRect::applyProperties() + { + KSCmdSetProperties *cmd = new KSCmdSetProperties(o); + cmd->setProperty( "ellipse", ellipse->isChecked() ); + cmd->setProperty( "frame", toQString(rectFrame->dialogLine()) ); + cmd->setProperty( "fill", toQString(rectFill->dialogFill()) ); + cmd->setProperty( "shadowFill", toQString(shadowFill->dialogFill()) ); + cmd->setProperty( "shadowPosX", shadowdx->value() ); + cmd->setProperty( "shadowPosY", shadowdy->value() ); + m_workbook->execute( cmd ); + } + +//-------------------------------------------------------------// +//-------------------------------------------------------------// +//-------------------------------------------------------------// +//-------------------------------------------------------------// +//-------------------------------------------------------------// + + + //-----------------------------------------------------------// + +KSPanelButtonCube::KSPanelButtonCube( QWidget *parent, KSWorkbook *workbook, QSAxes3D *axes ) +:KSPanelButton( parent, workbook, BGeneral, QPixmap(panel_box), tr("Cube") ) + { + m_axes = axes; + } + +//-----------------------------------------------------------// + +KSPanelButtonCube::~KSPanelButtonCube() + { + } + +//-----------------------------------------------------------// + +KSPanel *KSPanelButtonCube::createPanel( QWidget *panelParent ) + { + return new KSPanelCube( panelParent, m_workbook, m_axes ); + } + +//-----------------------------------------------------------// + +bool KSPanelButtonCube::isButtonFor( QSCObject *object, int category, int element ) + { + if ( category == QSAxes::GeneralCategory && + object->isAxesShadow() && + element == 0 ) return true; + return false; + } +//-------------------------------------------------------------// +//-------------------------------------------------------------// +//-------------------------------------------------------------// +//-------------------------------------------------------------// + +KSPanelCube::KSPanelCube(QWidget *parent, KSWorkbook *workbook, QSAxes3D *plot, const char *name) + : KSPanelCubeInterf(parent,name) + { + assert( plot ); p3 = plot; + m_workbook = workbook; + + xyThick->setValidator( new QDoubleValidator( 0.0, 1.0, 16, xyThick ) ); + xzThick->setValidator( new QDoubleValidator( 0.0, 1.0, 16, xzThick ) ); + yzThick->setValidator( new QDoubleValidator( 0.0, 1.0, 16, yzThick ) ); + + watchProperties(); + } + +//-------------------------------------------------------------// + +KSPanelCube::~KSPanelCube() + { + } + +//-------------------------------------------------------------// + +void KSPanelCube::readProperties() + { + QString s; + + xyThick->setText( s.setNum( p3->xyWallThickness(), 'g', 16 ) ); + xzThick->setText( s.setNum( p3->xzWallThickness(), 'g', 16 ) ); + yzThick->setText( s.setNum( p3->yzWallThickness(), 'g', 16 ) ); + + xEdge->setText( s.setNum( p3->xEdgeLength(), 'g', 16 ) ); + yEdge->setText( s.setNum( p3->yEdgeLength(), 'g', 16 ) ); + zEdge->setText( s.setNum( p3->zEdgeLength(), 'g', 16 ) ); + + xyFill->setDialogFill( p3->fill( QSAxes3D::XYWallFill ) ); + xzFill->setDialogFill( p3->fill( QSAxes3D::XZWallFill ) ); + yzFill->setDialogFill( p3->fill( QSAxes3D::YZWallFill ) ); + + xyLine->setDialogLine( p3->line( QSAxes3D::XYWallLine ) ); + xzLine->setDialogLine( p3->line( QSAxes3D::XZWallLine ) ); + yzLine->setDialogLine( p3->line( QSAxes3D::YZWallLine ) ); + + } + +//-------------------------------------------------------------// + +void KSPanelCube::applyProperties() + { + KSCmdSetGraphicalProperties *cmd = new KSCmdSetGraphicalProperties(p3); + cmd->setProperty( "xyWallThickness", xyThick->text().toDouble() ); + cmd->setProperty( "xzWallThickness", xzThick->text().toDouble() ); + cmd->setProperty( "yzWallThickness", yzThick->text().toDouble() ); + + cmd->setProperty( "xEdgeLength", xEdge->text().toDouble() ); + cmd->setProperty( "yEdgeLength", yEdge->text().toDouble() ); + cmd->setProperty( "zEdgeLength", zEdge->text().toDouble() ); + + cmd->setFill( QSAxes3D::XYWallFill, xyFill->dialogFill() ); + cmd->setFill( QSAxes3D::XZWallFill, xzFill->dialogFill() ); + cmd->setFill( QSAxes3D::YZWallFill, yzFill->dialogFill() ); + + cmd->setLine( QSAxes3D::XYWallLine, xyLine->dialogLine() ); + cmd->setLine( QSAxes3D::XZWallLine, xzLine->dialogLine() ); + cmd->setLine( QSAxes3D::YZWallLine, yzLine->dialogLine() ); + + m_workbook->execute( cmd ); + } + +//-------------------------------------------------------------// +//-------------------------------------------------------------// +//-------------------------------------------------------------// +//-------------------------------------------------------------// +//-------------------------------------------------------------// + + + ///-----------------------------------------------------------// + +KSPanelButtonFigure::KSPanelButtonFigure( QWidget *parent, KSWorkbook *workbook, QSFigure *figure ) +:KSPanelButton( parent, workbook, BDatasets, QPixmap(action_figure), tr("Figure"), figure ) + { + m_figure = figure; + } + +//-----------------------------------------------------------// + +KSPanelButtonFigure::~KSPanelButtonFigure() + { + } + +//-----------------------------------------------------------// + +KSPanel *KSPanelButtonFigure::createPanel( QWidget *panelParent ) + { + return new KSPanelFigure( panelParent, m_workbook, m_figure ); + } + +//-----------------------------------------------------------// + +bool KSPanelButtonFigure::isButtonFor( QSCObject *object, int category, int element ) + { + if ( category == QSAxes::DatasetCategory && + object->isAxesShadow() && + object->parentAxes()->plot(element) == m_figure ) return true; + return false; + } + +//-------------------------------------------------------------// +//-------------------------------------------------------------// +//-------------------------------------------------------------// +//-------------------------------------------------------------// + +KSPanelFigure::KSPanelFigure(QWidget *parent, KSWorkbook *workbook, QSFigure *init_figure, const char *name) +: KSPanelFigureInterf(parent,name) + { + figure = init_figure; + m_workbook = workbook; + m_x_select = new KSAxisSelect( xaxisc, figure->parentAxes(), QSAxis::XAxisType ); + m_y_select = new KSAxisSelect( yaxisc, figure->parentAxes(), QSAxis::YAxisType ); + m_z_select = new KSAxisSelect( zaxisc, figure->parentAxes(), QSAxis::ZAxisType ); + m_v_select = new KSAxisSelect( vaxisc, figure->parentAxes(), QSAxis::VAxisType ); + QWhatsThis::add( accuracys, tr("VCR - Vertex comparing accuracy\n\nThis value is used" + " in shading calculations by drivers which use" + " normals to vertices, such as OpenGL. A normal" + " to a vertex is calculated as an average of all normals" + " to polygons, which share this vertex. To find if two" + " polygons share a vertex all vertices in those polygons" + " are compared. To eliminate round-off errors, before comparing," + " all vertices in the plot are mapped to <0,1> box and next all" + " coordinates are rounded to VCR places after the point.") ); + + + watchProperties(); +} + +//-------------------------------------------------------------// + +KSPanelFigure::~KSPanelFigure() + { + } + +//-------------------------------------------------------------// + +void KSPanelFigure::readProperties() + { + m_x_select->readProperties( figure->defaultAxis(QSAxis::XAxisType) ); + m_y_select->readProperties( figure->defaultAxis(QSAxis::YAxisType) ); + m_z_select->readProperties( figure->defaultAxis(QSAxis::ZAxisType) ); + m_v_select->readProperties( figure->defaultAxis(QSAxis::VAxisType) ); + legendc->setChecked( figure->legendItemVisible() ); + accuracys->setValue( figure->vertexCompareAccuracy() ); + titlee->setText( figure->title() ); + } + +//-------------------------------------------------------------// + +void KSPanelFigure::applyProperties() + { + KSCmdSetGraphicalProperties *cmd = new KSCmdSetGraphicalProperties(figure); + + cmd->setProperty( "legendItemVisible", legendc->isChecked() ); + cmd->setProperty( "vertexCompareAccuracy", accuracys->value() ); + cmd->setProperty( "title", titlee->text() ); + cmd->setProperty( "defaultXAxis", figure->parentAxes()->axisIndex(m_x_select->selectedAxis()) ); + cmd->setProperty( "defaultYAxis", figure->parentAxes()->axisIndex(m_y_select->selectedAxis()) ); + cmd->setProperty( "defaultZAxis", figure->parentAxes()->axisIndex(m_z_select->selectedAxis()) ); + cmd->setProperty( "defaultVAxis", figure->parentAxes()->axisIndex(m_v_select->selectedAxis()) ); + + m_workbook->execute( cmd ); + } + +//-------------------------------------------------------------// +//-------------------------------------------------------------// +//-------------------------------------------------------------// +//-------------------------------------------------------------// +//-------------------------------------------------------------// +//-------------------------------------------------------------// + + +//-----------------------------------------------------------// + +KSPanelButtonFrame::KSPanelButtonFrame( QWidget *parent, KSWorkbook *workbook, QSAxes2D *axes ) +:KSPanelButton( parent, workbook, BGeneral, QPixmap(panel_frame), tr("Frame") ) + { + m_axes = axes; + } + +//-----------------------------------------------------------// + +KSPanelButtonFrame::~KSPanelButtonFrame() + { + } + +//-----------------------------------------------------------// + +KSPanel *KSPanelButtonFrame::createPanel( QWidget *panelParent ) + { + return new KSPanelFrame( panelParent, m_workbook, m_axes ); + } + +//-----------------------------------------------------------// + +bool KSPanelButtonFrame::isButtonFor( QSCObject *object, int category, int element ) + { + if ( category == QSAxes::GeneralCategory && + object->isAxesShadow() && + element == 0 ) return true; + return false; + } + +//-------------------------------------------------------------// +//-------------------------------------------------------------// +//-------------------------------------------------------------// +//-------------------------------------------------------------// + +KSPanelFrame::KSPanelFrame(QWidget *parent, KSWorkbook *workbook, QSAxes2D *plot, const char *name) +: KSPanelFrameInterf(parent,name) + { + assert( plot ); p2 = plot; + m_workbook = workbook; + + + QWhatsThis::add( fillStyle, tr("Plot area fill\n\nFill style of the inside-frame area") ); + QWhatsThis::add( frameStyle, tr("Frame fill\n\nFill style of the plot frame") ); + QWhatsThis::add( thicks, tr("Frame thickness\n\nThickness of the plot frame.") ); + + watchProperties(); + } + +//-------------------------------------------------------------// + +KSPanelFrame::~KSPanelFrame() + { + } + +//-------------------------------------------------------------// + +void KSPanelFrame::readProperties() + { + thicks->setValue( p2->frameWidth() ); + fillStyle->setDialogFill( p2->fill( QSAxes2D::RectFill) ); + frameStyle->setDialogFill( p2->fill( QSAxes2D::FrameFill) ); + } + +//-------------------------------------------------------------// + +void KSPanelFrame::applyProperties() + { + KSCmdSetGraphicalProperties *cmd = new KSCmdSetGraphicalProperties(p2); + cmd->setProperty( "frameWidth", thicks->value() ); + cmd->setFill( QSAxes2D::RectFill, fillStyle->dialogFill() ); + cmd->setFill( QSAxes2D::FrameFill, frameStyle->dialogFill() ); + m_workbook->execute( cmd ); + } + +//-------------------------------------------------------------// +//-------------------------------------------------------------// +//-------------------------------------------------------------// +//-------------------------------------------------------------// +//-------------------------------------------------------------// +//-----------------------------------------------------------// + +KSPanelButtonGeneral::KSPanelButtonGeneral( QWidget *parent, KSWorkbook *workbook, QSAxes *axes ) +:KSPanelButton( parent, workbook, BGeneral, QPixmap(panel_general), tr("Position/Title") ) + { + m_axes = axes; + } + +//-----------------------------------------------------------// + +KSPanelButtonGeneral::~KSPanelButtonGeneral() + { + } + +//-----------------------------------------------------------// + +KSPanel *KSPanelButtonGeneral::createPanel( QWidget *panelParent ) + { + return new KSPanelGeneral( panelParent, m_workbook, m_axes ); + } + +//-----------------------------------------------------------// + +bool KSPanelButtonGeneral::isButtonFor( QSCObject *, int, int ) + { +// if ( category == QSAxes::GeneralCategory && +// object->isAxesShadow() && +// element == 0 ) return true; + return false; + } + +//-------------------------------------------------------------// +//-------------------------------------------------------------// +//-------------------------------------------------------------// +//-------------------------------------------------------------// + +KSPanelGeneral::KSPanelGeneral(QWidget *parent, KSWorkbook *workbook, QSAxes *plot, const char *name) +: KSPanelGeneralInterf(parent,name) + { + assert( plot ); p = plot; + m_workbook = workbook; + //font = new KSFontBtn( fontw->parentWidget() ); font->setGeometry( fontw->geometry() ); + QWhatsThis::add( titlee, tr("Plot title\n\nYou can write a title text here.") ); + //QWhatsThis::add( font, tr("Title font\n\nFont used to draw a title.")); + //QWhatsThis::add( tposc, tr("Title position\n\nPostion of the plot title on the canvas.") ); + QWhatsThis::add( backgroundFill, tr("Background fill\n\n Background fill style.") ); + watchProperties(); + } + +//-------------------------------------------------------------// + +KSPanelGeneral::~KSPanelGeneral() + { + } + +//-------------------------------------------------------------// + +void KSPanelGeneral::readProperties() + { + backgroundFill->setDialogFill( p->background() ); + titlee->setText( p->title() ); + xpose->setText( QString::number(p->posMM().x) ); + ypose->setText( QString::number(p->posMM().y) ); + widthe->setText( QString::number(p->sizeMM().x) ); + heighte->setText( QString::number(p->sizeMM().y) ); + draw_in_background->setChecked( p->drawInBackground() ); + } + +//-------------------------------------------------------------// + +void KSPanelGeneral::applyProperties() + { + KSCmdSetGraphicalProperties *cmd = new KSCmdSetGraphicalProperties(p); + cmd->setProperty( "background", toQString(backgroundFill->dialogFill()) ); + cmd->setProperty( "title", titlee->text() ); + cmd->setProperty( "xPosMM", xpose->text().toDouble() ); + cmd->setProperty( "yPosMM", ypose->text().toDouble() ); + cmd->setProperty( "widthMM", widthe->text().toDouble() ); + cmd->setProperty( "heightMM", heighte->text().toDouble() ); + cmd->setProperty( "drawInBackground", draw_in_background->isChecked() ); + m_workbook->execute( cmd ); + + } + +//-------------------------------------------------------------// +//-------------------------------------------------------------// +//-------------------------------------------------------------// +//-------------------------------------------------------------// +//-----------------------------------------------------------// + +KSPanelButtonGL::KSPanelButtonGL( QWidget *parent, KSWorkbook *workbook, QSAxes3D *axes ) +:KSPanelButton( parent, workbook, BGeneral, QPixmap(panel_gl), tr("OpenGL") ) + { + m_axes = axes; + } + +//-----------------------------------------------------------// + +KSPanelButtonGL::~KSPanelButtonGL() + { + } + +//-----------------------------------------------------------// + +KSPanel *KSPanelButtonGL::createPanel( QWidget *panelParent ) + { + return new KSPanelGL( panelParent, m_workbook, m_axes ); + } + +//-------------------------------------------------------------// +//-------------------------------------------------------------// +//-------------------------------------------------------------// +//-------------------------------------------------------------// + +KSPanelGL::KSPanelGL(QWidget *parent, KSWorkbook *workbook, QSAxes3D *plot, const char *name) +: KSPanelGLInterf(parent,name) + { + p3 = plot; + m_workbook = workbook; + + QWhatsThis::add( openglc, tr("OpenGL\n\nIf checked, an OpenGL will be used to draw the plot" + " instead of a standard Qt driver. OpenGL supports " + " smooth shading, transparency and color interpolation") ); + QWhatsThis::add( alphac, tr("Alpha\n\nTurns on a transparency support in OpenGL") ); + QWhatsThis::add( globaltr, tr("Global transparency\n\nThis transparency value will be added to each color.") ); + QWhatsThis::add( shadewallsc, tr("Shading\n\nTurns on/off shading of the axis box. ") ); + QWhatsThis::add( shadewallsc, tr("Auto color\n\n") ); + QWhatsThis::add( shadewallsc, tr("Lightness\n\n") ); + +#ifndef HAVE_GL + openglc->setEnabled( false ); + shadewallsc->setEnabled( false ); + alphac->setEnabled( false ); + autostrokec->setEnabled( false ); + globaltr->setEnabled( false ); + strokel->setEnabled( false ); + setEnabled( false ); +#endif + + watchProperties(); + } + +//-------------------------------------------------------------// + +KSPanelGL::~KSPanelGL() + { + } + +//-------------------------------------------------------------// + +void KSPanelGL::readProperties() + { +#ifdef HAVE_GL + openglc->setChecked(p3->openGL()); + alphac->setChecked(p3->glTransparency()); + shadewallsc->setChecked(p3->glShadeWalls()); + autostrokec->setChecked(p3->glMeshAutoStroke()); + globaltr->setValue(p3->glGlobalTransparency()); + strokel->setValue(p3->glAutoStrokeLightness()); +#endif + } + +//-------------------------------------------------------------// + +void KSPanelGL::applyProperties() + { +#ifdef HAVE_GL + KSCmdSetProperties *cmd = new KSCmdSetProperties(p3); + cmd->setProperty( "openGL", openglc->isChecked() ); + cmd->setProperty( "glTransparency", alphac->isChecked() ); + cmd->setProperty( "glShadeWalls", shadewallsc->isChecked() ); + cmd->setProperty( "glMeshAutoStroke", autostrokec->isChecked() ); + cmd->setProperty( "glGlobalTransparency", globaltr->value() ); + cmd->setProperty( "glAutoStrokeLightness", strokel->value() ); + m_workbook->execute( cmd ); +#endif + } + +//------------------------------------------------------------------------------------------------------// +//------------------------------------------------------------------------------------------------------// +//------------------------------------------------------------------------------------------------------// +//------------------------------------------------------------------------------------------------------// +//------------------------------------------------------------------------------------------------------// + + +KSPanelButtonImage::KSPanelButtonImage( QWidget *parent, KSWorkbook *workbook, QSImage *image ) +:KSPanelButton( parent, workbook, BDatasets, QPixmap(action_pixmap), tr("Pixmap: "), image ) + { + m_image = image; + } + +//-----------------------------------------------------------// + +KSPanelButtonImage::~KSPanelButtonImage() + { + } + +//-----------------------------------------------------------// + +KSPanel *KSPanelButtonImage::createPanel( QWidget *panelParent ) + { + return new KSPanelImage( panelParent, m_workbook, m_image ); + } + +//-----------------------------------------------------------// + +bool KSPanelButtonImage::isButtonFor( QSCObject *object, int category, int element ) + { + if ( category == QSAxes::DatasetCategory && + object->isAxesShadow() && + object->parentAxes()->plot(element) == m_image ) return true; + return false; + } + +//-------------------------------------------------------------// +//-------------------------------------------------------------// +//-------------------------------------------------------------// +//-------------------------------------------------------------// + +KSPanelImage::KSPanelImage(QWidget *parent, KSWorkbook *workbook, QSImage *init_image, const char *name) +: KSPanelImageInterf(parent,name) + { + m_workbook = workbook; + image = init_image; + m_x_select = new KSAxisSelect( xaxisc, image->parentAxes(), QSAxis::XAxisType ); + m_y_select = new KSAxisSelect( yaxisc, image->parentAxes(), QSAxis::YAxisType ); + m_v_select = new KSAxisSelect( vaxisc, image->parentAxes(), QSAxis::VAxisType ); + + QWhatsThis::add( titlee, tr("Series title\n\nIt is displayed on the legend.") ); + QWhatsThis::add( rawc, tr("Raw mode\n\nWhen raw mode is on, the V axis has set fixed range <0,255> and" + " linear scale. It requires much less calculations, so repaints" + " are much faster.") ); + watchProperties(); +} + +//-------------------------------------------------------------// + +KSPanelImage::~KSPanelImage() +{ +} + +//-------------------------------------------------------------// + +void KSPanelImage::readProperties() +{ + m_x_select->readProperties( image->defaultAxis(QSAxis::XAxisType) ); + m_y_select->readProperties( image->defaultAxis(QSAxis::YAxisType) ); + m_v_select->readProperties( image->defaultAxis(QSAxis::VAxisType) ); + legendc->setChecked( image->legendItemVisible() ); + gradientc->setChecked( image->useGradient() ); + rawc->setChecked( image->rawMode() ); + titlee->setText( image->title() ); +} + +//-------------------------------------------------------------// + +void KSPanelImage::applyProperties() +{ + KSCmdSetGraphicalProperties *cmd = new KSCmdSetGraphicalProperties(image); + cmd->setProperty( "defaultXAxis", image->parentAxes()->axisIndex(m_x_select->selectedAxis()) ); + cmd->setProperty( "defaultYAxis", image->parentAxes()->axisIndex(m_y_select->selectedAxis()) ); + cmd->setProperty( "defaultVAxis", image->parentAxes()->axisIndex(m_v_select->selectedAxis()) ); + cmd->setProperty( "legendItemVisible", legendc->isChecked() ); + cmd->setProperty( "rawMode", rawc->isChecked() ); + cmd->setProperty( "useGradient", gradientc->isChecked() ); + cmd->setProperty( "title", titlee->text() ); + m_workbook->execute( cmd ); +} + +//-------------------------------------------------------------// +//-------------------------------------------------------------// +//-------------------------------------------------------------// +//-------------------------------------------------------------// +//-------------------------------------------------------------// + +//-----------------------------------------------------------// + +KSPanelButtonLight::KSPanelButtonLight( QWidget *parent, KSWorkbook *workbook, QSAxes3D *axes ) +:KSPanelButton( parent, workbook, BGeneral, QPixmap(panel_light), tr("Light") ) + { + m_axes = axes; + } + +//-----------------------------------------------------------// + +KSPanelButtonLight::~KSPanelButtonLight() + { + } + +//-----------------------------------------------------------// + +KSPanel *KSPanelButtonLight::createPanel( QWidget *panelParent ) + { + return new KSPanelLight( panelParent, m_workbook, m_axes ); + } + +//-------------------------------------------------------------// +//-------------------------------------------------------------// +//-------------------------------------------------------------// +//-------------------------------------------------------------// + +KSPanelLight::KSPanelLight(QWidget *parent, KSWorkbook *workbook, QSAxes3D *plot, const char *name) +: KSPanelLightInterf(parent,name) + { + assert( plot ); p3 = plot; + m_workbook = workbook; + QWhatsThis::add( lightc, tr("Light\n\nTurns on lighting.") ); + QWhatsThis::add( lightas, tr("Light azimuth\n\nPosition of the light source in spherical coordinates. Range is <0,359> degree. ") ); + QWhatsThis::add( lightes, tr("Light elevation\n\nPosition of the light source in spherical coordinates. Range is <-90,90> degree.") ); + QWhatsThis::add( lightis, tr("Light intensity\n\nIntensity of the directed light source. This parameter changes from " + "-50 (0%) to 50 (100%).") ); + QWhatsThis::add( lightams, tr("Abmient light intensity\n\nIntensity of the ambient light source or simple - lightness " + "This parameter changes from -50 (0%) to 50 (100%).") ); + + watchProperties(); + } + +//-----------------------------------------------------------// + +KSPanelLight::~KSPanelLight() + { + } + +//-----------------------------------------------------------// + +void KSPanelLight::readProperties() + { + lightas->setValue( p3->lightAzimuth() ); + lightes->setValue( p3->lightElevation() ); + lightis->setValue( p3->directLight() ); + lightams->setValue( p3->ambientLight() ); + lightc->setChecked( p3->light() ); + } + +//-----------------------------------------------------------// + +void KSPanelLight::applyProperties() + { + KSCmdSetProperties *cmd = new KSCmdSetProperties(p3); + cmd->setProperty( "lightAzimuth", lightas->value() ); + cmd->setProperty( "lightElevation", lightes->value() ); + cmd->setProperty( "directLight", lightis->value() ); + cmd->setProperty( "ambientLight", lightams->value() ); + cmd->setProperty( "light", lightc->isChecked() ); + m_workbook->execute( cmd ); + } + +//-----------------------------------------------------------// +//-----------------------------------------------------------// +//-----------------------------------------------------------// +//-----------------------------------------------------------// +//-----------------------------------------------------------// +//-----------------------------------------------------------// + + + //-----------------------------------------------------------// + +KSPanelButtonMesh::KSPanelButtonMesh( QWidget *parent, KSWorkbook *workbook, QSPlot3D *plot ) +:KSPanelButton( parent, workbook, BDatasets, QPixmap(panel_mesh), tr("Mesh: ")+plot->title() ) + { + m_plot = plot; + } + +//-----------------------------------------------------------// + +KSPanelButtonMesh::~KSPanelButtonMesh() + { + } + +//-----------------------------------------------------------// + +KSPanel *KSPanelButtonMesh::createPanel( QWidget *panelParent ) + { + return new KSPanelMesh( panelParent, m_workbook, m_plot ); + } + +//-------------------------------------------------------------// +//-------------------------------------------------------------// +//-------------------------------------------------------------// +//-------------------------------------------------------------// + +KSPanelMesh::KSPanelMesh(QWidget *parent, KSWorkbook *workbook, QSPlot3D *plot, const char *name) +: KSPanelMeshInterf(parent,name) + { + assert( plot ); p3 = plot; + m_workbook = workbook; + type->insertItem(tr("Default")); + type->insertItem(tr("Gray")); + type->insertItem(tr("Strange")); + type->insertItem(tr("Two colors")); + type->insertItem(tr("Five colors")); + connect( type, SIGNAL(activated(int)), this, SLOT(gradient_type_changed(int)) ); + + gradientw->setBackgroundMode( NoBackground ); + gradientw->installEventFilter( this ); + + QWhatsThis::add( colorc, tr("Auto colors\n\nIf checked auto-colors are used as a fill color for a top side of the mesh." + " Default colors/Top is used otherwise.") ); + QWhatsThis::add( meshTopFill, tr("Top color\n\nDefault color for a top side of the mesh. Used only if Auto color" + " is off.") ); + QWhatsThis::add( meshBottomFill, tr("Bottom color\n\nDefault color for the bottom side of the mesh.") ); + /* + QWhatsThis::add( col1, tr("Default color for points with lowest Z values.") ); + QWhatsThis::add( col2, tr("Default color for points with low Z values.") ); + QWhatsThis::add( col3, tr("Default color for points with middle Z values.") ); + QWhatsThis::add( col4, tr("Default color for points with great Z values.") ); + QWhatsThis::add( col5, tr("Default color for points with greates Z values.") ); + QWhatsThis::add( line, tr("Line style\n\nLine style for the mesh stroke.") ); + QWhatsThis::add( gradientw, tr("Gradient preview\n\nNothing really usable :)") ); + */ + watchProperties(); + } + +//-------------------------------------------------------------// + +KSPanelMesh::~KSPanelMesh() + { + } + +//-------------------------------------------------------------// + +void KSPanelMesh::readProperties() + { + colorc->setChecked( p3->colored() ); + divide->setChecked( p3->autoDivide() ); + topbottom->setChecked( p3->topBottom() ); + edgeAutoColor->setValue( p3->edgeAutoColor() ); + + meshTopFill->setDialogFill( p3->fill(QSPlot3D::TMeshFill) ); + meshBottomFill->setDialogFill( p3->fill(QSPlot3D::BMeshFill) ); + meshLine->setDialogLine( p3->line(QSPlot3D::MeshLine) ); + meshPoint->setDialogPoint( p3->point(QSPlot3D::PointMark) ); + + QSGGradient g = p3->gradient(); + + type->setCurrentItem( g.type() ); + gradient_type_changed(g.type()); + + meshFill1->setDialogFill( g.fill(0) ); + meshFill2->setDialogFill( g.fill(1) ); + meshFill3->setDialogFill( g.fill(2) ); + meshFill4->setDialogFill( g.fill(3) ); + meshFill5->setDialogFill( g.fill(4) ); + + preview(); + } + +//-------------------------------------------------------------// + +void KSPanelMesh::applyProperties() + { + KSCmdSetGraphicalProperties *cmd = new KSCmdSetGraphicalProperties( p3 ); + cmd->setProperty( "gradient", toQString( QSGGradient( meshFill1->dialogFill(), + meshFill2->dialogFill(), + meshFill3->dialogFill(), + meshFill4->dialogFill(), + meshFill5->dialogFill(), + (QSGGradient::Type )type->currentItem())) ); + cmd->setProperty( "colored", colorc->isChecked() ); + cmd->setProperty( "autoDivide", divide->isChecked() ); + cmd->setProperty( "topBottom", topbottom->isChecked() ); + cmd->setProperty( "edgeAutoColor", edgeAutoColor->value() ); + cmd->setFill( QSPlot3D::TMeshFill, meshTopFill->dialogFill() ); + cmd->setFill( QSPlot3D::BMeshFill, meshBottomFill->dialogFill() ); + cmd->setLine( QSPlot3D::MeshLine, meshLine->dialogLine() ); + cmd->setPoint( QSPlot3D::PointMark, meshPoint->dialogPoint() ); + m_workbook->execute( cmd ); + preview(); + } + + +//-------------------------------------------------------------// + +bool KSPanelMesh::eventFilter( QObject *o, QEvent *e ) + { + QSGFill fill; + + if ( o == gradientw ) { + if ( e->type() == QEvent::Paint ) { + QPainter p( gradientw ); + QSGGradient g = p3->gradient(); + int w = gradientw->size().width(); + int h = gradientw->size().height(); + for ( int i=0; iupdate(); + } + +//-------------------------------------------------------------// + +void KSPanelMesh::gradient_type_changed(int ) + { + QSGGradient g = QSGGradient( (QSGGradient::Type )type->currentItem() ); + meshFill1->show(); + meshFill2->show(); + meshFill3->show(); + meshFill4->show(); + meshFill5->show(); + + meshFill1->setDialogFill( g.fill(0) ); + meshFill2->setDialogFill( g.fill(1) ); + meshFill3->setDialogFill( g.fill(2) ); + meshFill4->setDialogFill( g.fill(3) ); + meshFill5->setDialogFill( g.fill(4) ); + + + if ( type->currentItem() == QSGGradient::GTwoColors ) { + meshFill2->hide(); + meshFill3->hide(); + meshFill4->hide(); + } + else + if ( type->currentItem() == QSGGradient::GFiveColors ) { + } + else { + meshFill1->hide(); + meshFill2->hide(); + meshFill3->hide(); + meshFill4->hide(); + meshFill5->hide(); + } + + preview(); + } + +//-------------------------------------------------------------// +//-------------------------------------------------------------// +//-------------------------------------------------------------// +//-------------------------------------------------------------// +//-------------------------------------------------------------// + + +//-----------------------------------------------------------// + +KSPanelButtonCurve::KSPanelButtonCurve( QWidget *parent, KSWorkbook *workbook, QSCurve *curve ) +:KSPanelButton( parent, workbook, BDatasets, QPixmap(action_curve), tr("XY plot: "), curve ) + { + m_curve = curve; + } + +//-----------------------------------------------------------// + +KSPanelButtonCurve::~KSPanelButtonCurve() + { + } + +//-----------------------------------------------------------// + +KSPanel *KSPanelButtonCurve::createPanel( QWidget *panelParent ) + { + return new KSPanelCurve( panelParent, m_workbook, m_curve ); + } + +//-----------------------------------------------------------// + +bool KSPanelButtonCurve::isButtonFor( QSCObject *object, int category, int element ) + { + if ( category == QSAxes::DatasetCategory && + object->isAxesShadow() && + object->parentAxes()->plot(element) == m_curve ) return true; + return false; + } +//-------------------------------------------------------------// +//-------------------------------------------------------------// +//-------------------------------------------------------------// +//-------------------------------------------------------------// + +//-------------------------------------------------------------// + +KSPanelCurve::KSPanelCurve(QWidget *parent, KSWorkbook *workbook, QSCurve *plot, const char *name) +: KSPanelCurveInterf(parent,name) + { + assert( plot ); curve = plot; + m_workbook = workbook; + typec->clear(); + typec->insertItem(tr("Lines")); + typec->insertItem(tr("Area")); + typec->insertItem(tr("Ribbon")); + typec->insertItem(tr("Bars")); + typec->insertItem(tr("Vectors")); + typec->insertItem(tr("Flux")); + typec->insertItem(tr("Rectangles")); + typec->insertItem(tr("Ellipses")); + typec->insertItem(tr("Left Stairs")); + typec->insertItem(tr("Middle Stairs")); + typec->insertItem(tr("Right Stairs")); + + originArrow->setOrigin( true ); + endArrow->setOrigin( false ); + m_x_select = new KSAxisSelect( xaxisc, curve->parentAxes(), QSAxis::XAxisType ); + m_y_select = new KSAxisSelect( yaxisc, curve->parentAxes(), QSAxis::YAxisType ); + + QWhatsThis::add( titlee, tr("Series title\n\nIt is displayed on the legend.") ); + + QWhatsThis::add( typec, tr("Style\n\nPlot style for the current series.") ); + + QWhatsThis::add( curveLine, tr("Line style\n\nLine style used to draw the current series") ); + QWhatsThis::add( curveFill, tr("Fill style\n\n Used to draw interiors of Polys, Rectangles, Ellipses and Bars") ); + QWhatsThis::add( curvePoint, tr("Point style\n\nStyle of point marks used to draw data points") ); + QWhatsThis::add( errorLine, tr("Errorbars line style\n\nLine style used to draw errorbars. See also 'Arrows' below.") ); + + QWhatsThis::add( deltapdxe, tr("Delta % X value\n\nThis value is used when drawing Errorbars, Vectors, Rectangles, Ellipses or Polys. " + "Total delta value is calculated as follows: DX[i] = DXVector[i] + FixedDeltaX + PercentDeltaX*XVector[i]/100.0;") ); + QWhatsThis::add( deltapdye, tr("Delta % Y value\n\nThis value is used when drawing Errorbars, Vectors, Rectangles, Ellipses or Polys." + "Total delta value is calculated as follows: DY[i] = DYVector[i] + FixedDeltaY + PercentDeltaY*YVector[i]/100.0;") ); + QWhatsThis::add( deltadxe, tr("Fixed Delta X value\n\nThis value is used when drawing Errorbars, Vectors, Rectangles, Ellipses or Polys." + "Total delta value is calculated as follows: DX[i] = DXVector[i] + FixedDeltaX + PercentDeltaX*XVector[i]/100.0;") ); + QWhatsThis::add( deltadye, tr("Fixed Delta Y value\n\nThis value is used when drawing Errorbars, Vectors, Rectangles, Ellipses or Polys." + "Total delta value is calculated as follows: DY[i] = DYVector[i] + FixedDeltaY + PercentDeltaY*YVector[i]/100.0;") ); + + QWhatsThis::add( zeroxe, tr("Zero Level X\n\nThis an X coordinate where XLines begin") ); + QWhatsThis::add( zeroye, tr("Zero Level Y\n\nThis an Y coordinate where YLines and Bars begin") ); + + QWhatsThis::add( xLine, tr("Y Lines\n\n Horizontal lines, which crosses data points on the plot") ); + QWhatsThis::add( yLine, tr("X Lines\n\n Vertical lines, which crosses data points on the plot") ); + + QWhatsThis::add( originArrow, tr("Arrow style\n\n Arrow style used to draw horizontal bars or a vector begin") ); + QWhatsThis::add( endArrow, tr("Arrow style\n\n Arrow style used to draw vertical bars or a vector end") ); + + + watchProperties(); + } + +//-------------------------------------------------------------// + +KSPanelCurve::~KSPanelCurve() + { + } + + + +//-------------------------------------------------------------// + +void KSPanelCurve::readProperties() + { + typec->setCurrentItem( curve->type() ); + m_x_select->readProperties( curve->defaultAxis(QSAxis::XAxisType) ); + m_y_select->readProperties( curve->defaultAxis(QSAxis::YAxisType) ); + + legendc->setChecked( curve->legendItemVisible() ); + + deltapdxe->setText( QString::number(curve->percentDelta().x) ); + deltapdye->setText( QString::number(curve->percentDelta().y) ); + + deltadxe->setText( QString::number(curve->fixedDelta().x) ); + deltadye->setText( QString::number(curve->fixedDelta().y) ); + + zeroxe->setText( QString::number(curve->zeroPoint().x) ); + zeroye->setText( QString::number(curve->zeroPoint().y) ); + errorLine->setDialogLine( curve->line(QSCurve::ErrorLine) ); + xLine->setDialogLine( curve->line(QSCurve::XLine) ); + yLine->setDialogLine( curve->line(QSCurve::YLine) ); + curveLine->setDialogLine( curve->line(QSCurve::BaseLine) ); + curveFill->setDialogFill( curve->fill(QSCurve::BaseFill) ); + curvePoint->setDialogPoint( curve->point(QSCurve::PointMark) ); + originArrow->setDialogArrow( curve->arrow1() ); + endArrow->setDialogArrow( curve->arrow2() ); + titlee->setText( curve->title() ); + } + +//-------------------------------------------------------------// + +void KSPanelCurve::applyProperties() +{ + KSCmdSetGraphicalProperties *cmd = new KSCmdSetGraphicalProperties(curve); + cmd->setProperty( "defaultXAxis", curve->parentAxes()->axisIndex(m_x_select->selectedAxis()) ); + cmd->setProperty( "defaultYAxis", curve->parentAxes()->axisIndex(m_y_select->selectedAxis()) ); + cmd->setProperty( "legendItemVisible", legendc->isChecked() ); + cmd->setProperty( "title", titlee->text() ); + + cmd->setProperty( "type", typec->currentItem() ); + cmd->setProperty( "zeroLevelX", zeroxe->text().toDouble() ); + cmd->setProperty( "zeroLevelY", zeroye->text().toDouble() ); + cmd->setProperty( "fixedDX", deltadxe->text().toDouble() ); + cmd->setProperty( "fixedDY", deltadye->text().toDouble() ); + cmd->setProperty( "percentDX", deltapdxe->text().toDouble() ); + cmd->setProperty( "percentDY", deltapdye->text().toDouble() ); + + cmd->setLine( QSCurve::BaseLine, curveLine->dialogLine() ); + cmd->setLine( QSCurve::ErrorLine, errorLine->dialogLine() ); + cmd->setLine( QSCurve::XLine, xLine->dialogLine() ); + cmd->setLine( QSCurve::YLine, yLine->dialogLine() ); + cmd->setFill( QSCurve::BaseFill, curveFill->dialogFill() ); + cmd->setPoint( QSCurve::PointMark, curvePoint->dialogPoint() ); + + cmd->setProperty( "arrow1", toQString(originArrow->dialogArrow()) ); + cmd->setProperty( "arrow2", toQString(endArrow->dialogArrow()) ); + + m_workbook->execute( cmd ); +} + + +//-------------------------------------------------------------// +//-------------------------------------------------------------// +//-------------------------------------------------------------// +//-------------------------------------------------------------// +//-------------------------------------------------------------// + + +//-----------------------------------------------------------// + +KSPanelButtonSurface::KSPanelButtonSurface( QWidget *parent, KSWorkbook *workbook, QSSurface *surface ) +:KSPanelButton( parent, workbook, BDatasets, QPixmap(action_surface), tr("Surface: "), surface ) + { + m_surface = surface; + } + +//-----------------------------------------------------------// + +KSPanelButtonSurface::~KSPanelButtonSurface() + { + } + +//-----------------------------------------------------------// + +KSPanel *KSPanelButtonSurface::createPanel( QWidget *panelParent ) + { + return new KSPanelSurface( panelParent, m_workbook, m_surface ); + } + +//-----------------------------------------------------------// + +bool KSPanelButtonSurface::isButtonFor( QSCObject *object, int category, int element ) + { + if ( category == QSAxes::DatasetCategory && + object->isAxesShadow() && + object->parentAxes()->plot(element) == m_surface ) return true; + return false; + } + +//-------------------------------------------------------------// +//-------------------------------------------------------------// +//-------------------------------------------------------------// +//-------------------------------------------------------------// + +KSPanelSurface::KSPanelSurface(QWidget *parent, KSWorkbook *workbook, QSSurface *init_surface, const char *name) +: KSPanelSurfaceInterf(parent,name) + { + surface = init_surface; + m_workbook = workbook; + m_x_select = new KSAxisSelect( xaxisc, surface->parentAxes(), QSAxis::XAxisType ); + m_y_select = new KSAxisSelect( yaxisc, surface->parentAxes(), QSAxis::YAxisType ); + m_z_select = new KSAxisSelect( zaxisc, surface->parentAxes(), QSAxis::ZAxisType ); + m_v_select = new KSAxisSelect( vaxisc, surface->parentAxes(), QSAxis::VAxisType ); + watchProperties(); + } + +//------------------------------------------------------------// + +KSPanelSurface::~KSPanelSurface() + { + } + +//------------------------------------------------------------// + +void KSPanelSurface::readProperties() + { + m_x_select->readProperties( surface->defaultAxis(QSAxis::XAxisType) ); + m_y_select->readProperties( surface->defaultAxis(QSAxis::YAxisType) ); + m_z_select->readProperties( surface->defaultAxis(QSAxis::ZAxisType) ); + m_v_select->readProperties( surface->defaultAxis(QSAxis::VAxisType) ); + xGridStep->setValue( surface->xGridStep() ); + yGridStep->setValue( surface->yGridStep() ); + legendc->setChecked( surface->legendItemVisible() ); + titlee->setText( surface->title() ); + } + +//------------------------------------------------------------// + +void KSPanelSurface::applyProperties() + { + KSCmdSetGraphicalProperties *cmd = new KSCmdSetGraphicalProperties(surface); + + cmd->setProperty( "xGridStep", xGridStep->value() ); + cmd->setProperty( "yGridStep", yGridStep->value() ); + cmd->setProperty( "legendItemVisible", legendc->isChecked() ); + cmd->setProperty( "title", titlee->text() ); + cmd->setProperty( "defaultXAxis", surface->parentAxes()->axisIndex(m_x_select->selectedAxis()) ); + cmd->setProperty( "defaultYAxis", surface->parentAxes()->axisIndex(m_y_select->selectedAxis()) ); + cmd->setProperty( "defaultZAxis", surface->parentAxes()->axisIndex(m_z_select->selectedAxis()) ); + cmd->setProperty( "defaultVAxis", surface->parentAxes()->axisIndex(m_v_select->selectedAxis()) ); + + m_workbook->execute( cmd ); + } + +//------------------------------------------------------------// +//------------------------------------------------------------// +//------------------------------------------------------------// +//------------------------------------------------------------// +//------------------------------------------------------------// + +//-----------------------------------------------------------// + +KSPanelButtonGrid::KSPanelButtonGrid( QWidget *parent, KSWorkbook *workbook, QSAxis *axis ) +:KSPanelButton( parent, workbook, BAxes, QPixmap() ) + { + m_axis = axis; + + QPixmap icon; + QString tool_tip; + switch( m_axis->type() ) { + case QSAxis::XAxisType: icon = QPixmap(panel_gx); tool_tip = tr("X grid : ")+axis->title(); break; + case QSAxis::YAxisType: icon = QPixmap(panel_gy); tool_tip = tr("Y grid : ")+axis->title(); break; + case QSAxis::ZAxisType: icon = QPixmap(panel_gz); tool_tip = tr("Z grid : ")+axis->title(); break; + case QSAxis::VAxisType: icon = QPixmap(panel_gv); tool_tip = tr("V grid : ")+axis->title(); break; + } + setPixmap(icon); + QToolTip::add( this, tool_tip ); + QWhatsThis::add( this, tool_tip ); + } + +//-----------------------------------------------------------// + +KSPanelButtonGrid::~KSPanelButtonGrid() + { + } + +//-----------------------------------------------------------// + +KSPanel *KSPanelButtonGrid::createPanel( QWidget *panelParent ) + { + return new KSPanelGrid( panelParent, m_workbook, m_axis ); + } + +//-----------------------------------------------------------// + +bool KSPanelButtonGrid::isButtonFor( QSCObject *object, int category, int element ) + { + if ( category == QSAxes::GridCategory && + object->isAxesShadow() && + object->parentAxes()->axis(element) == m_axis ) return true; + return false; + } + +//-----------------------------------------------------------// +//-----------------------------------------------------------// +//-----------------------------------------------------------// +//-----------------------------------------------------------// +//-----------------------------------------------------------// +//-----------------------------------------------------------// + + +KSPanelGrid::KSPanelGrid(QWidget *parent, KSWorkbook *workbook, QSAxis *axis, const char *name) + : KSPanelGridInterf(parent,name) + { + m_axis = axis; + m_workbook = workbook; + + codes = new QPopupMenu( formate ); + codes->setFont(QFont("helvetica", 10, 50)); + codes->insertItem( tr("value"), Value ); + codes->insertItem( tr("factor"), Factor ); + codes->insertItem( tr("base"), Base ); + codes->insertItem( tr("exponent"), Exponent ); + + formate->installEventFilter( this ); + + + QWhatsThis::add( adjustc, tr("Adjust an axis range \n\nIf turned on the axis range " + "is rounded to a tic step border.") ); + QWhatsThis::add( majdensitye, tr("Major tic step(value>0) \nMajor tic density (value<0)\n\nDensity is " + "only an approximative value. Number of visible tics " + "may be slightly different. ") ); + QWhatsThis::add( mindensitye, tr("Minor tic step \nMinor tic density \n\nDensity is " + "only an approximative value. Number of visible tics " + "may be slightly different. ") ); + QWhatsThis::add( formate, tr("Format of axis labels \n\nThis is a text, which will be displayed " + "as a label text.\nTo insert a tic value into it type (TIC). Two " + "additional paramaters may be added after TIC word:\n" + "TYPE=\"?\", where ? can be one of the following letters: \n" + "V - tic value. This is a default value. \n" + "X - exponent part of the label value. \n" + "F - factor part of the label value. \n" + "B - base part of the label value.\n" + "\n" + "FORMAT=\"?\", where ? is an ordinary C-styled \"printf\" format, " + "but with only eEfgG types allowed. Default value is %g. " + "\n\n" + "Example:\n" + "(TIC TYPE=\"x\" FORMAT=\"%.2f\") \n" + "\n" + "Press a right mouse button over the edit field to insert a standard format.") ); + QWhatsThis::add( majorLine, tr("Line style\n\nLine style for major grid lines.") ); + QWhatsThis::add( minorLine, tr("Line style\n\nLine style for minor grid lines.") ); + QWhatsThis::add( labelFont, tr("Labels font\n\nFont used to draw labels.") ); + watchProperties(); + } + + +//-----------------------------------------------------------// + +KSPanelGrid::~KSPanelGrid() + { + } + +//-----------------------------------------------------------// + +void KSPanelGrid::applyProperties() + { + KSCmdSetGraphicalProperties *cmd = new KSCmdSetGraphicalProperties(m_axis); + cmd->setProperty( "ticsFormat", formate->text() ); + cmd->setProperty( "roundRangeToTicStep", adjustc->isChecked() ); + cmd->setProperty( "majorGridStep", majdensitye->text().toDouble() ); + cmd->setProperty( "minorGridStep", mindensitye->text().toDouble() ); + cmd->setFont( QSAxis::TicsFont, labelFont->dialogFont() ); + cmd->setLine( QSAxis::MajorGridLine, majorLine->dialogLine() ); + cmd->setLine( QSAxis::MinorGridLine, minorLine->dialogLine() ); + cmd->setProperty( "ticsOuter", outerc->isChecked() ); + cmd->setProperty( "ticsVisible", showticc->isChecked() ); + cmd->setProperty( "ticsAngle", angle->value() ); + cmd->setProperty( "ticLabelPos1", evenPos->text().toDouble() ); + cmd->setProperty( "ticLabelPos2", oddPos->text().toDouble() ); + m_workbook->execute( cmd ); + } + + +//-----------------------------------------------------------// + +void KSPanelGrid::readProperties() + { + formate->setText( m_axis->ticsFormat() ); + adjustc->setChecked( m_axis->roundRangeToTicStep() ); + majdensitye->setText( QString::number( m_axis->majorGridStep(), 'g', 3 ) ); + mindensitye->setText( QString::number( m_axis->minorGridStep(), 'g', 3 ) ); + labelFont->setDialogFont( m_axis->font(QSAxis::TicsFont) ); + majorLine->setDialogLine( m_axis->line(QSAxis::MajorGridLine) ); + minorLine->setDialogLine( m_axis->line(QSAxis::MinorGridLine) ); + outerc->setChecked( m_axis->ticsOuter() ); + showticc->setChecked( m_axis->ticsVisible() ); + angle->setValue( m_axis->ticsAngle() ); + evenPos->setText( QString::number( m_axis->ticLabelPos1(), 'g', 3 ) ); + oddPos->setText( QString::number( m_axis->ticLabelPos2(), 'g', 3 ) ); + } + + +//-----------------------------------------------------------// + +bool KSPanelGrid::eventFilter( QObject *o, QEvent *e ) + { + /* + if ( e->type() == QEvent::MouseButtonPress && o == formate ) { + // popup menu + QMouseEvent *p = static_cast(e); + + if ( p->button() == RightButton ) { + + FormatCode code = FormatCode( codes->exec( QCursor::pos())); + + switch( code ) { + case Value: formate->insert(""); break; + case Factor: formate->insert(""); break; + case Exponent: formate->insert(""); break; + case Base: formate->insert(""); break; + } + return TRUE; + } + } + */ + return KSPanelGridInterf::eventFilter(o,e); + } + + +//------------------------------------------------------------------------------------------------------// +//------------------------------------------------------------------------------------------------------// +//------------------------------------------------------------------------------------------------------// +//------------------------------------------------------------------------------------------------------// +//------------------------------------------------------------------------------------------------------// +//------------------------------------------------------------------------------------------------------// + + //-----------------------------------------------------------// + +KSPanelButtonView::KSPanelButtonView( QWidget *parent, KSWorkbook *workbook, QSAxes3D *axes ) +:KSPanelButton( parent, workbook, BGeneral, QPixmap(panel_view), tr("Viewpoint") ) + { + m_axes = axes; + } + +//-----------------------------------------------------------// + +KSPanelButtonView::~KSPanelButtonView() + { + } + +//-----------------------------------------------------------// + +KSPanel *KSPanelButtonView::createPanel( QWidget *panelParent ) + { + return new KSPanelView( panelParent, m_workbook, m_axes ); + } + +//-------------------------------------------------------------// +//-------------------------------------------------------------// +//-------------------------------------------------------------// +//-------------------------------------------------------------// + +KSPanelView::KSPanelView(QWidget *parent, KSWorkbook *workbook, QSAxes3D *plot, const char *name) +: KSPanelViewInterf(parent,name) + { + assert( plot ); p3 = plot; + m_workbook = workbook; + + QWhatsThis::add( perspectivec, tr("Perspective\n\nTurns on perspective.")); + QWhatsThis::add( autoscalec, tr("Autoscale\n\nFits an axis box to the display area.")); + QWhatsThis::add( azimuths, tr("Azimuth\n\nPosition of the viewpoint in spherical coordinates. Range is <0,359> degree.") ); + QWhatsThis::add( elevations, tr("Elevation\n\nPosition of the viewpoint in spherical coordinates. Range is <-90,90> degree.")); + QWhatsThis::add( distances, tr("Distance\n\nSize of the plot. Changes from -50 (0%) to 50 (200%).") ); + QWhatsThis::add( fdistances, tr("Focuspoint distance\n\nDistance from the focus point to the " + "screen. Changes from -50 (almost zero) to 50 (almost inf).") ); + + watchProperties(); + } + +//-----------------------------------------------------------// + +KSPanelView::~KSPanelView() + { + } + +//-----------------------------------------------------------// + +void KSPanelView::readProperties() + { + azimuths->setValue( p3->azimuth() ); + elevations->setValue( p3->elevation() ); + distances->setValue( p3->distance() ); + fdistances->setValue( p3->focusDistance() ); + + perspectivec->setChecked( p3->perspective() ); + autoscalec->setChecked( p3->autoscale() ); + } + +//-----------------------------------------------------------// + +void KSPanelView::applyProperties() + { + KSCmdSetProperties *cmd = new KSCmdSetProperties(p3); + + cmd->setProperty( "azimuth", azimuths->value() ); + cmd->setProperty( "elevation", elevations->value() ); + cmd->setProperty( "distance", distances->value() ); + cmd->setProperty( "focusDistance", fdistances->value() ); + cmd->setProperty( "perspective", perspectivec->isChecked() ); + cmd->setProperty( "autoscale", autoscalec->isChecked() ); + + m_workbook->execute( cmd ); + } + +//-----------------------------------------------------------// +//-----------------------------------------------------------// +//-----------------------------------------------------------// +//-----------------------------------------------------------// +//-----------------------------------------------------------// + +KSPanelButtonGradient::KSPanelButtonGradient( QWidget *parent, KSWorkbook *workbook, QSPlot *plot ) +:KSPanelButton( parent, workbook, BDatasets, QPixmap(panel_gradient), tr("Gradient "), plot ) + { + m_plot = plot; + } + +//-----------------------------------------------------------// + +KSPanelButtonGradient::~KSPanelButtonGradient() + { + } + +//-----------------------------------------------------------// + +KSPanel *KSPanelButtonGradient::createPanel( QWidget *panelParent ) + { + return new KSPanelGradient( panelParent, m_workbook, m_plot ); + } + +//-------------------------------------------------------------// +//-------------------------------------------------------------// +//-------------------------------------------------------------// +//-------------------------------------------------------------// +//-------------------------------------------------------------// + +KSPanelGradient::KSPanelGradient(QWidget *parent, KSWorkbook *workbook, QSPlot *init_plot, const char *name) +: KSPanelGradientInterf(parent,name) + { + m_plot = init_plot; + m_workbook = workbook; + connect( type, SIGNAL(activated(int)), this, SLOT(gradient_type_changed(int)) ); + //connect( col1, SIGNAL(dialogFillChanged()), this, SLOT(preview()) ); + //connect( col2, SIGNAL(dialogFillChanged()), this, SLOT(preview()) ); + //connect( col3, SIGNAL(dialogFillChanged()), this, SLOT(preview()) ); + //connect( col4, SIGNAL(dialogFillChanged()), this, SLOT(preview()) ); + //connect( col5, SIGNAL(dialogFillChanged()), this, SLOT(preview()) ); + + gradientw->setBackgroundMode( NoBackground ); + gradientw->installEventFilter( this ); + /* + QWhatsThis::add( col1, tr("Default color for points with lowest Z values.") ); + QWhatsThis::add( col2, tr("Default color for points with low Z values.") ); + QWhatsThis::add( col3, tr("Default color for points with middle Z values.") ); + QWhatsThis::add( col4, tr("Default color for points with great Z values.") ); + QWhatsThis::add( col5, tr("Default color for points with greates Z values.") ); + QWhatsThis::add( gradientw, tr("Gradient preview") ); + */ + watchProperties(); + } + + +//-------------------------------------------------------------// + +KSPanelGradient::~KSPanelGradient() + { + } + +//-------------------------------------------------------------// + +void KSPanelGradient::readProperties() + { + QSGGradient g = m_plot->gradient(); + + type->setCurrentItem( g.type() ); + gradient_type_changed(g.type()); + + gradientFill1->setDialogFill( g.fill(0) ); + gradientFill2->setDialogFill( g.fill(1) ); + gradientFill3->setDialogFill( g.fill(2) ); + gradientFill4->setDialogFill( g.fill(3) ); + gradientFill5->setDialogFill( g.fill(4) ); + + preview(); + } + +//-------------------------------------------------------------// + +void KSPanelGradient::applyProperties() + { + KSCmdSetGraphicalProperties *cmd = new KSCmdSetGraphicalProperties( m_plot ); + cmd->setProperty( "gradient", toQString( QSGGradient( gradientFill1->dialogFill(), + gradientFill2->dialogFill(), + gradientFill3->dialogFill(), + gradientFill4->dialogFill(), + gradientFill5->dialogFill(), + (QSGGradient::Type )type->currentItem() )) ); + m_workbook->execute( cmd ); + preview(); + } + + +//-------------------------------------------------------------// + +bool KSPanelGradient::eventFilter( QObject *o, QEvent *e ) + { + QSGFill fill; + + if ( o == gradientw ) { + if ( e->type() == QEvent::Paint ) { + QPainter p( gradientw ); + QSGGradient g = m_plot->gradient(); + int w = gradientw->size().width(); + int h = gradientw->size().height(); + for ( int i=0; iupdate(); + } + +//-------------------------------------------------------------// + +void KSPanelGradient::gradient_type_changed(int ) + { + QSGGradient g = QSGGradient( (QSGGradient::Type )type->currentItem() ); + gradientFill1->show(); + gradientFill2->show(); + gradientFill3->show(); + gradientFill4->show(); + gradientFill5->show(); + + gradientFill1->setDialogFill( g.fill(0) ); + gradientFill2->setDialogFill( g.fill(1) ); + gradientFill3->setDialogFill( g.fill(2) ); + gradientFill4->setDialogFill( g.fill(3) ); + gradientFill5->setDialogFill( g.fill(4) ); + + if ( type->currentItem() == QSGGradient::GTwoColors ) { + gradientFill2->hide(); + gradientFill3->hide(); + gradientFill4->hide(); + } + else + if ( type->currentItem() == QSGGradient::GFiveColors ) { + } + else { + gradientFill1->hide(); + gradientFill2->hide(); + gradientFill3->hide(); + gradientFill4->hide(); + gradientFill5->hide(); + } + + preview(); + } + diff --git a/kmatplot/dialogs/kspanels.h b/kmatplot/dialogs/kspanels.h new file mode 100644 index 0000000..2c3e575 --- /dev/null +++ b/kmatplot/dialogs/kspanels.h @@ -0,0 +1,876 @@ +/*************************************************************************** + kspanels.h + ------------------- + begin : Fri Jan 4 2002 + copyright : (C) 2002 by kamil + email : kamil@localhost.localdomain + ***************************************************************************/ + +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + +#ifndef KSPANELS_H +#define KSPANELS_H + +#include "kspanel.h" +#include "../widgets/qscobject.h" +#include "../widgets/qsgattr.h" +#include "../widgets/qsaxes.h" +#include "../widgets/qsaxes3d.h" +#include "../widgets/qsaxes2d.h" +#include +#include + +class KSFillBtn; +class KSFontBtn; +class KSLineBtn; +class KSArrowBtn; +class KSPointBtn; + +//-----------------------------------------------------------------------------------------------// +//-----------------------------------------------------------------------------------------------// +//-----------------------------------------------------------------------------------------------// +//-----------------------------------------------------------------------------------------------// + +#include "kspanelrangeinterf.h" + +class KSPanelButtonRange : public KSPanelButton { + Q_OBJECT + public: + KSPanelButtonRange( QWidget *parent, KSWorkbook *workbook, QSAxes *axes ); + virtual ~KSPanelButtonRange(); + virtual KSPanel *createPanel( QWidget *panelParent ); + virtual bool isButtonFor( QSCObject *object, int category, int element ); + private: + QSAxes *m_axes; + }; + +//------------------------------------------------------------------------------------------------------// + +class QSAxes3D; + +class KSPanelRange : public KSPanelRangeInterf { + Q_OBJECT +public: + KSPanelRange(QWidget *parent, KSWorkbook *workbook, QSAxes *axes, const char *name=0); + ~KSPanelRange(); + virtual void readProperties(); + virtual void applyProperties(); +private: + QSAxes *m_axes; + QSAxes3D *m_axes3; + KSWorkbook *m_workbook; + void shift_range( int axis_type, double shift ); + +private slots: + void x_plus(); + void y_plus(); + void z_plus(); + void v_plus(); + + void x_minus(); + void y_minus(); + void z_minus(); + void v_minus(); + + void view_up(); + void view_down(); + void view_left(); + void view_right(); + + void set_view_1(); + void set_view_2(); + void set_view_3(); + void remember_view(); +}; + +//------------------------------------------------------------------------------------------------------// +//------------------------------------------------------------------------------------------------------// +//------------------------------------------------------------------------------------------------------// +//------------------------------------------------------------------------------------------------------// + +#include"kspanelcarrowinterf.h" + +class KSPanelButtonCArrow : public KSPanelButton { + Q_OBJECT + public: + KSPanelButtonCArrow( QWidget *parent, KSWorkbook *workbook, QSCObject *o ); + virtual ~KSPanelButtonCArrow(); + virtual KSPanel *createPanel( QWidget *panelParent ); + private: + QSCObject *m_object; + }; + +//------------------------------------------------------------------------------------------------------// + +class KSPanelCArrow : public KSPanelCArrowInterf { + Q_OBJECT +public: + KSPanelCArrow(QWidget *parent, KSWorkbook *workbook, QSCObject *o, const char *name=0); + ~KSPanelCArrow(); + + void readProperties(); + void applyProperties(); +private: + KSWorkbook *m_workbook; + QSCObject *o; +}; + +//------------------------------------------------------------------------------------------------------// +//------------------------------------------------------------------------------------------------------// +//------------------------------------------------------------------------------------------------------// +//------------------------------------------------------------------------------------------------------// + +#include"kspanelaxisinterf.h" + +class KSPanelButtonAxis : public KSPanelButton { + Q_OBJECT + public: + KSPanelButtonAxis( QWidget *parent, KSWorkbook *workbook, QSAxis *axis ); + virtual ~KSPanelButtonAxis(); + virtual KSPanel *createPanel( QWidget *panelParent ); + virtual bool isButtonFor( QSCObject *object, int category, int element ); + private: + QSAxis *m_axis; + }; + +//------------------------------------------------------------------------------------------------------// + +class KSPanelAxis : public KSPanelAxisInterf { + Q_OBJECT +public: + KSPanelAxis(QWidget *parent, KSWorkbook *workbook, QSAxis *axis, const char *name=0); + ~KSPanelAxis(); + void readProperties(); + void applyProperties(); + +private: + KSWorkbook *m_workbook; + QSAxis *m_axis; + +}; + +//------------------------------------------------------------------------------------------------------// +//------------------------------------------------------------------------------------------------------// +//------------------------------------------------------------------------------------------------------// +//------------------------------------------------------------------------------------------------------// + +#include"kspanelclabelinterf.h" + +class KSPanelButtonCLabel : public KSPanelButton { + Q_OBJECT + public: + KSPanelButtonCLabel( QWidget *parent, KSWorkbook *workbook, QSCObject *o ); + virtual ~KSPanelButtonCLabel(); + virtual KSPanel *createPanel( QWidget *panelParent ); + private: + QSCObject *m_object; + }; + +//------------------------------------------------------------------------------------------------------// + +class KSPanelCLabel : public KSPanelCLabelInterf { + Q_OBJECT +public: + KSPanelCLabel(QWidget *parent, KSWorkbook *workbook, QSCObject *o, const char *name=0); + ~KSPanelCLabel(); + void readProperties(); + void applyProperties(); + void setPosAlign( int align ); + int posAlign(); + +private: + KSWorkbook *m_workbook; + QSCObject *o; +}; + +//------------------------------------------------------------------------------------------------------// +//------------------------------------------------------------------------------------------------------// +//------------------------------------------------------------------------------------------------------// +//------------------------------------------------------------------------------------------------------// +//------------------------------------------------------------------------------------------------------// + +#include"kspanelclegendcinterf.h" + +class KSPanelButtonCLegend : public KSPanelButton { + Q_OBJECT + public: + KSPanelButtonCLegend( QWidget *parent, KSWorkbook *workbook, QSCObject *o ); + virtual ~KSPanelButtonCLegend(); + virtual KSPanel *createPanel( QWidget *panelParent ); + private: + QSCObject *m_object; + int *m_columns; + }; + +//------------------------------------------------------------------------------------------------------// + +class KSPanelCLegendC : public KSPanelCLegendCInterf { + Q_OBJECT +public: + KSPanelCLegendC(QWidget *parent, KSWorkbook *workbook, QSCObject *o, const char *name=0 ); + ~KSPanelCLegendC(); + void readProperties(); + void applyProperties(); + + private: + KSWorkbook *m_workbook; + QSCObject *o; +}; + +//------------------------------------------------------------------------------------------------------// +//------------------------------------------------------------------------------------------------------// +//------------------------------------------------------------------------------------------------------// +//------------------------------------------------------------------------------------------------------// + +#include"kspanelcontourinterf.h" +class QSContour; + +//------------------------------------------------------------------------------------------------------// + +class KSPanelButtonContour : public KSPanelButton { + Q_OBJECT + public: + KSPanelButtonContour( QWidget *parent, KSWorkbook *workbook, QSContour *contour ); + virtual ~KSPanelButtonContour(); + virtual KSPanel *createPanel( QWidget *panelParent ); + virtual bool isButtonFor( QSCObject *object, int category, int element ); + private: + QSContour *m_contour; + }; + +//------------------------------------------------------------------------------------------------------// + + +class KSPanelContour : public KSPanelContourInterf { + Q_OBJECT + public: + KSPanelContour(QWidget *parent, KSWorkbook *workbook, QSContour *contour, const char *name=0); + ~KSPanelContour(); + void readProperties(); + void applyProperties(); + +private: + KSWorkbook *m_workbook; + QSContour *contour; + KSAxisSelect *m_x_select; + KSAxisSelect *m_y_select; + KSAxisSelect *m_v_select; +}; + +//------------------------------------------------------------------------------------------------------// +//------------------------------------------------------------------------------------------------------// +//------------------------------------------------------------------------------------------------------// +//------------------------------------------------------------------------------------------------------// + +#include"kspanelcposinterf.h" + +//------------------------------------------------------------------------------------------------------// + +class KSPanelButtonCPos : public KSPanelButton { + Q_OBJECT + public: + KSPanelButtonCPos( QWidget *parent, + KSWorkbook *workbook, QSCObject *o, + const QCString& posX, const QCString& posY, const QCString& posZ, + const QCString& coordX, const QCString& coordY, const QCString& coordZ ); + virtual ~KSPanelButtonCPos(); + virtual KSPanel *createPanel( QWidget *panelParent ); + private: + QSCObject *m_object; + QCString m_pos_x; + QCString m_pos_y; + QCString m_pos_z; + QCString m_coord_x; + QCString m_coord_y; + QCString m_coord_z; + }; + +//------------------------------------------------------------------------------------------------------// + +class KSPanelCPos : public KSPanelCPosInterf { + Q_OBJECT +public: + KSPanelCPos(QWidget *parent, KSWorkbook *workbook, QSCObject *o, + const QCString& posX, const QCString& posY, const QCString& posZ, + const QCString& coordX, const QCString& coordY, const QCString& coordZ, + const char *name=0 ); + ~KSPanelCPos(); + void readProperties(); + void applyProperties(); + +protected: + QSCObject *o; + KSWorkbook *m_workbook; + KSAxisSelect *m_x_select; + KSAxisSelect *m_y_select; + KSAxisSelect *m_z_select; + QCString m_pos_x; + QCString m_pos_y; + QCString m_pos_z; + QCString m_coord_x; + QCString m_coord_y; + QCString m_coord_z; +}; + +//------------------------------------------------------------------------------------------------------// +//------------------------------------------------------------------------------------------------------// +//------------------------------------------------------------------------------------------------------// +//------------------------------------------------------------------------------------------------------// + //------------------------------------------------------------------------------------------------------// + +#include"kspanelcrectinterf.h" + +//------------------------------------------------------------------------------------------------------// + +class KSPanelButtonCRect : public KSPanelButton { + Q_OBJECT + public: + KSPanelButtonCRect( QWidget *parent, KSWorkbook *workbook, QSCObject *o ); + virtual ~KSPanelButtonCRect(); + virtual KSPanel *createPanel( QWidget *panelParent ); + private: + QSCObject *m_object; + }; + +//------------------------------------------------------------------------------------------------------// + + +class KSPanelCRect : public KSPanelCRectInterf { + Q_OBJECT +public: + KSPanelCRect(QWidget *parent, KSWorkbook *workbook, QSCObject *o, const char *name=0); + ~KSPanelCRect(); + void readProperties(); + void applyProperties(); + +protected: + KSWorkbook *m_workbook; + QSCObject *o; +}; + +//------------------------------------------------------------------------------------------------------// +//------------------------------------------------------------------------------------------------------// +//------------------------------------------------------------------------------------------------------// +//------------------------------------------------------------------------------------------------------// + +#include"kspanelcubeinterf.h" + +class KSPanelButtonCube : public KSPanelButton { + Q_OBJECT + public: + KSPanelButtonCube( QWidget *parent, KSWorkbook *workbook, QSAxes3D *axes ); + virtual ~KSPanelButtonCube(); + virtual KSPanel *createPanel( QWidget *panelParent ); + virtual bool isButtonFor( QSCObject *object, int category, int element ); + private: + QSAxes3D *m_axes; + }; + +//------------------------------------------------------------------------------------------------------// + +class KSPanelCube : public KSPanelCubeInterf + { + Q_OBJECT + public: + KSPanelCube(QWidget *parent, KSWorkbook *workbook, QSAxes3D *plot, const char *name=0); + ~KSPanelCube(); + void readProperties(); + void applyProperties(); + + protected: + QSAxes3D *p3; + KSWorkbook *m_workbook; +}; + +//------------------------------------------------------------------------------------------------------// +//------------------------------------------------------------------------------------------------------// +//------------------------------------------------------------------------------------------------------// +//------------------------------------------------------------------------------------------------------// +//------------------------------------------------------------------------------------------------------// +//------------------------------------------------------------------------------------------------------// +//------------------------------------------------------------------------------------------------------// +//------------------------------------------------------------------------------------------------------// + +#include"kspanelfigureinterf.h" +class QSFigure; + +//------------------------------------------------------------------------------------------------------// + +class KSPanelButtonFigure : public KSPanelButton { + Q_OBJECT + public: + KSPanelButtonFigure( QWidget *parent, KSWorkbook *workbook, QSFigure *figure ); + virtual ~KSPanelButtonFigure(); + virtual KSPanel *createPanel( QWidget *panelParent ); + virtual bool isButtonFor( QSCObject *object, int category, int element ); + private: + QSFigure *m_figure; + }; + +//------------------------------------------------------------------------------------------------------// + + +class KSPanelFigure : public KSPanelFigureInterf { + Q_OBJECT + public: + KSPanelFigure(QWidget *parent, KSWorkbook *workbook, QSFigure *figure, const char *name=0); + ~KSPanelFigure(); + void readProperties(); + void applyProperties(); + + protected: + KSWorkbook *m_workbook; + QSFigure *figure; + KSAxisSelect *m_x_select; + KSAxisSelect *m_y_select; + KSAxisSelect *m_z_select; + KSAxisSelect *m_v_select; +}; + +//------------------------------------------------------------------------------------------------------// +//------------------------------------------------------------------------------------------------------// +//------------------------------------------------------------------------------------------------------// +//------------------------------------------------------------------------------------------------------// +//------------------------------------------------------------------------------------------------------// +//------------------------------------------------------------------------------------------------------// +//------------------------------------------------------------------------------------------------------// + +#include"kspanelframeinterf.h" + +class KSPanelButtonFrame : public KSPanelButton { + Q_OBJECT + public: + KSPanelButtonFrame( QWidget *parent, KSWorkbook *workbook, QSAxes2D *axes ); + virtual ~KSPanelButtonFrame(); + virtual KSPanel *createPanel( QWidget *panelParent ); + virtual bool isButtonFor( QSCObject *object, int category, int element ); + private: + QSAxes2D *m_axes; + }; + +//------------------------------------------------------------------------------------------------------// + +class KSPanelFrame : public KSPanelFrameInterf { + Q_OBJECT + public: + KSPanelFrame(QWidget *parent, KSWorkbook *workbook, QSAxes2D *plot, const char *name=0); + ~KSPanelFrame(); + void readProperties(); + void applyProperties(); + + protected: + KSFillBtn *pcol; + KSFillBtn *fcol; + QSAxes2D *p2; + KSWorkbook *m_workbook; + }; + + //------------------------------------------------------------------------------------------------------// +//------------------------------------------------------------------------------------------------------// +//------------------------------------------------------------------------------------------------------// +//------------------------------------------------------------------------------------------------------// +//------------------------------------------------------------------------------------------------------// + +#include"kspanelgeneralinterf.h" + +//------------------------------------------------------------------------------------------------------// + +class KSPanelButtonGeneral : public KSPanelButton { + Q_OBJECT + public: + KSPanelButtonGeneral( QWidget *parent, KSWorkbook *workbook, QSAxes *axes ); + virtual ~KSPanelButtonGeneral(); + virtual KSPanel *createPanel( QWidget *panelParent ); + virtual bool isButtonFor( QSCObject *object, int category, int element ); + private: + QSAxes *m_axes; + }; + +//------------------------------------------------------------------------------------------------------// + +class KSPanelGeneral : public KSPanelGeneralInterf + { + Q_OBJECT +public: + KSPanelGeneral(QWidget *parent, KSWorkbook *workbook, QSAxes *plot, const char *name=0); + ~KSPanelGeneral(); + void readProperties(); + void applyProperties(); + +protected: + QSAxes *p; + KSFontBtn *font; + KSFillBtn *bcol; + KSWorkbook *m_workbook; + +}; + +//------------------------------------------------------------------------------------------------------// +//------------------------------------------------------------------------------------------------------// +//------------------------------------------------------------------------------------------------------// +//------------------------------------------------------------------------------------------------------// +//------------------------------------------------------------------------------------------------------// + +#include"kspanelglinterf.h" + +//------------------------------------------------------------------------------------------------------// + +class KSPanelButtonGL : public KSPanelButton { + Q_OBJECT + public: + KSPanelButtonGL( QWidget *parent, KSWorkbook *workbook, QSAxes3D *axes ); + virtual ~KSPanelButtonGL(); + virtual KSPanel *createPanel( QWidget *panelParent ); + private: + QSAxes3D *m_axes; + }; + +//------------------------------------------------------------------------------------------------------// + +class KSPanelGL : public KSPanelGLInterf { + Q_OBJECT + public: + KSPanelGL(QWidget *parent, KSWorkbook *workbook, QSAxes3D *plot, const char *name=0); + ~KSPanelGL(); + void readProperties(); + void applyProperties(); + protected: + KSWorkbook *m_workbook; + QSAxes3D *p3; +}; + +//------------------------------------------------------------------------------------------------------// +//------------------------------------------------------------------------------------------------------// +//------------------------------------------------------------------------------------------------------// +//------------------------------------------------------------------------------------------------------// +//------------------------------------------------------------------------------------------------------// + +#include"kspanelimageinterf.h" +class QSImage; + +//------------------------------------------------------------------------------------------------------// + +class KSPanelButtonImage : public KSPanelButton { + Q_OBJECT + public: + KSPanelButtonImage( QWidget *parent, KSWorkbook *workbook, QSImage *image ); + virtual ~KSPanelButtonImage(); + virtual KSPanel *createPanel( QWidget *panelParent ); + virtual bool isButtonFor( QSCObject *object, int category, int element ); + private: + QSImage *m_image; + }; + +//------------------------------------------------------------------------------------------------------// + +class KSPanelImage : public KSPanelImageInterf + { + Q_OBJECT + public: + KSPanelImage(QWidget *parent, KSWorkbook *workbook, QSImage *image, const char *name=0); + ~KSPanelImage(); + void readProperties(); + void applyProperties(); + + protected: + QSImage *image; + KSAxisSelect *m_x_select; + KSAxisSelect *m_y_select; + KSAxisSelect *m_v_select; + KSWorkbook *m_workbook; +}; + +//------------------------------------------------------------------------------------------------------// +//------------------------------------------------------------------------------------------------------// +//------------------------------------------------------------------------------------------------------// +//------------------------------------------------------------------------------------------------------// +//------------------------------------------------------------------------------------------------------// + +#include"kspanellightinterf.h" + +//------------------------------------------------------------------------------------------------------// + +class KSPanelButtonLight : public KSPanelButton { + Q_OBJECT + public: + KSPanelButtonLight( QWidget *parent, KSWorkbook *workbook, QSAxes3D *axes ); + virtual ~KSPanelButtonLight(); + virtual KSPanel *createPanel( QWidget *panelParent ); + private: + QSAxes3D *m_axes; + }; + +//------------------------------------------------------------------------------------------------------// + +class KSPanelLight : public KSPanelLightInterf +{ + Q_OBJECT + public: + KSPanelLight(QWidget *parent, KSWorkbook *workbook, QSAxes3D *plot, const char *name=0); + ~KSPanelLight(); + void readProperties(); + void applyProperties(); + + protected: + QSAxes3D *p3; + KSWorkbook *m_workbook; +}; + +//------------------------------------------------------------------------------------------------------// +//------------------------------------------------------------------------------------------------------// +//------------------------------------------------------------------------------------------------------// +//------------------------------------------------------------------------------------------------------// +//------------------------------------------------------------------------------------------------------// + +#include"kspanelmeshinterf.h" +class QSPlot3D; + +//------------------------------------------------------------------------------------------------------// + +class KSPanelButtonMesh : public KSPanelButton { + Q_OBJECT + public: + KSPanelButtonMesh( QWidget *parent, KSWorkbook *workbook, QSPlot3D *plot ); + virtual ~KSPanelButtonMesh(); + virtual KSPanel *createPanel( QWidget *panelParent ); + private: + QSPlot3D *m_plot; + }; + +//------------------------------------------------------------------------------------------------------// + +class KSPanelMesh : public KSPanelMeshInterf { + Q_OBJECT +public: + KSPanelMesh(QWidget *parent, KSWorkbook *workbook, QSPlot3D *plot, const char *name=0); + ~KSPanelMesh(); + void readProperties(); + void applyProperties(); + bool eventFilter( QObject *o, QEvent *e ); + +protected: + QSPlot3D *p3; + KSWorkbook *m_workbook; + + protected slots: + + void preview(); + void gradient_type_changed(int); +}; + +//------------------------------------------------------------------------------------------------------// +//------------------------------------------------------------------------------------------------------// +//------------------------------------------------------------------------------------------------------// +//------------------------------------------------------------------------------------------------------// +//------------------------------------------------------------------------------------------------------// +//------------------------------------------------------------------------------------------------------// + +#include"kspanelcurveinterf.h" +class QSCurve; + +//------------------------------------------------------------------------------------------------------// + +class KSPanelButtonCurve : public KSPanelButton { + Q_OBJECT + public: + KSPanelButtonCurve( QWidget *parent, KSWorkbook *workbook, QSCurve *curve ); + virtual ~KSPanelButtonCurve(); + virtual KSPanel *createPanel( QWidget *panelParent ); + virtual bool isButtonFor( QSCObject *object, int category, int element ); + private: + QSCurve *m_curve; + }; + +//------------------------------------------------------------------------------------------------------// + +class KSPanelCurve : public KSPanelCurveInterf { + Q_OBJECT + public: + + KSPanelCurve(QWidget *parent, KSWorkbook *workbook, QSCurve *plot, const char *name=0); + ~KSPanelCurve(); + + void selectSeries( int num ); + void readProperties(); + void applyProperties(); + + protected: + QSCurve *curve; + + KSAxisSelect *m_x_select; + KSAxisSelect *m_y_select; + KSWorkbook *m_workbook; + }; + +//------------------------------------------------------------------------------------------------------// +//------------------------------------------------------------------------------------------------------// +//------------------------------------------------------------------------------------------------------// +//------------------------------------------------------------------------------------------------------// +//------------------------------------------------------------------------------------------------------// +//------------------------------------------------------------------------------------------------------// + +#include"kspanelsurfaceinterf.h" +class QSSurface; + +//------------------------------------------------------------------------------------------------------// + +class KSPanelButtonSurface : public KSPanelButton { + Q_OBJECT + public: + KSPanelButtonSurface( QWidget *parent, KSWorkbook *workbook, QSSurface *m_surface ); + virtual ~KSPanelButtonSurface(); + virtual KSPanel *createPanel( QWidget *panelParent ); + virtual bool isButtonFor( QSCObject *object, int category, int element ); + private: + QSSurface *m_surface; + }; + +//------------------------------------------------------------------------------------------------------// + +class KSPanelSurface : public KSPanelSurfaceInterf { + Q_OBJECT +public: + KSPanelSurface(QWidget *parent, KSWorkbook *workbook, QSSurface *surface, const char *name=0); + ~KSPanelSurface(); + void readProperties(); + void applyProperties(); + +protected: + KSWorkbook *m_workbook; + QSSurface *surface; + KSAxisSelect *m_x_select; + KSAxisSelect *m_y_select; + KSAxisSelect *m_z_select; + KSAxisSelect *m_v_select; +}; + +//------------------------------------------------------------------------------------------------------// +//------------------------------------------------------------------------------------------------------// +//------------------------------------------------------------------------------------------------------// +//------------------------------------------------------------------------------------------------------// +//------------------------------------------------------------------------------------------------------// + +#include"kspanelgridinterf.h" + +//------------------------------------------------------------------------------------------------------// + +class KSPanelButtonGrid : public KSPanelButton { + Q_OBJECT + public: + KSPanelButtonGrid( QWidget *parent, KSWorkbook *workbook, QSAxis *axis ); + virtual ~KSPanelButtonGrid(); + virtual KSPanel *createPanel( QWidget *panelParent ); + virtual bool isButtonFor( QSCObject *object, int category, int element ); + private: + QSAxis *m_axis; + }; + +//------------------------------------------------------------------------------------------------------// + +class KSPanelGrid : public KSPanelGridInterf { + Q_OBJECT +public: + KSPanelGrid(QWidget *parent, KSWorkbook *workbook, QSAxis *axis, const char *name=0); + ~KSPanelGrid(); + void readProperties(); + void applyProperties(); + bool eventFilter( QObject *o, QEvent *e ); + +private: + enum FormatCode { + Value, + Factor, + Base, + Exponent + }; + QSAxis *m_axis; + QPopupMenu *codes; + KSWorkbook *m_workbook; +}; + +//------------------------------------------------------------------------------------------------------// +//------------------------------------------------------------------------------------------------------// +//------------------------------------------------------------------------------------------------------// +//------------------------------------------------------------------------------------------------------// +//------------------------------------------------------------------------------------------------------// + +#include"kspanelviewinterf.h" + +//------------------------------------------------------------------------------------------------------// + +class KSPanelButtonView : public KSPanelButton { + Q_OBJECT + public: + KSPanelButtonView( QWidget *parent, KSWorkbook *workbook, QSAxes3D *axes ); + virtual ~KSPanelButtonView(); + virtual KSPanel *createPanel( QWidget *panelParent ); + private: + QSAxes3D *m_axes; + }; + +//------------------------------------------------------------------------------------------------------// + +class KSPanelView : public KSPanelViewInterf + { + Q_OBJECT + public: + KSPanelView(QWidget *parent, KSWorkbook *workbook, QSAxes3D *plot, const char *name=0); + ~KSPanelView(); + void readProperties(); + void applyProperties(); + + protected: + QSAxes3D *p3; + KSWorkbook *m_workbook; +}; + +//------------------------------------------------------------------------------------------------------// +//------------------------------------------------------------------------------------------------------// +//------------------------------------------------------------------------------------------------------// +//------------------------------------------------------------------------------------------------------// +//------------------------------------------------------------------------------------------------------// +//------------------------------------------------------------------------------------------------------// + +#include"kspanelgradientinterf.h" + +class QSPlot; + +class KSPanelButtonGradient : public KSPanelButton { + Q_OBJECT + public: + KSPanelButtonGradient( QWidget *parent, KSWorkbook *workbook, QSPlot *plot ); + virtual ~KSPanelButtonGradient(); + virtual KSPanel *createPanel( QWidget *panelParent ); + private: + QSPlot *m_plot; + }; + +//------------------------------------------------------------------------------------------------------// + +class KSPanelGradient : public KSPanelGradientInterf { + Q_OBJECT +public: + KSPanelGradient(QWidget *parent, KSWorkbook *workbook, QSPlot *plot, const char *name=0); + ~KSPanelGradient(); + void readProperties(); + void applyProperties(); + bool eventFilter( QObject *o, QEvent *e ); + +protected: + QSPlot *m_plot; + KSWorkbook *m_workbook; + + protected slots: + + void preview(); + void gradient_type_changed(int); +}; + +#endif diff --git a/kmatplot/dialogs/kspanelsurfaceinterf.cpp b/kmatplot/dialogs/kspanelsurfaceinterf.cpp new file mode 100644 index 0000000..50bf118 --- /dev/null +++ b/kmatplot/dialogs/kspanelsurfaceinterf.cpp @@ -0,0 +1,175 @@ +/**************************************************************************** +** Form implementation generated from reading ui file './kspanelsurfaceinterf.ui' +** +** Created: śro mar 20 18:53:09 2002 +** by: The User Interface Compiler (uic) +** +** WARNING! All changes made in this file will be lost! +****************************************************************************/ +#include "kspanelsurfaceinterf.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "kspanel.h" +#include "kstextedit.h" + +/* + * Constructs a KSPanelSurfaceInterf which is a child of 'parent', with the + * name 'name'.' + */ +KSPanelSurfaceInterf::KSPanelSurfaceInterf( QWidget* parent, const char* name ) + : KSPanel( parent, name ) +{ + if ( !name ) + setName( "KSPanelSurfaceInterf" ); + resize( 617, 157 ); + setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5, (QSizePolicy::SizeType)5, 0, 0, sizePolicy().hasHeightForWidth() ) ); + setCaption( trUtf8( "KSPanelForm" ) ); + KSPanelSurfaceInterfLayout = new QHBoxLayout( this, 1, 1, "KSPanelSurfaceInterfLayout"); + + Frame5 = new QFrame( this, "Frame5" ); + Frame5->setFrameShape( QFrame::StyledPanel ); + Frame5->setFrameShadow( QFrame::Raised ); + Frame5Layout = new QGridLayout( Frame5, 1, 1, 10, 1, "Frame5Layout"); + + TextLabel1 = new QLabel( Frame5, "TextLabel1" ); + QFont TextLabel1_font( TextLabel1->font() ); + TextLabel1_font.setBold( TRUE ); + TextLabel1_font.setUnderline( TRUE ); + TextLabel1->setFont( TextLabel1_font ); + TextLabel1->setText( trUtf8( "Title" ) ); + + Frame5Layout->addWidget( TextLabel1, 0, 0 ); + QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Minimum, QSizePolicy::Expanding ); + Frame5Layout->addItem( spacer, 2, 0 ); + + titlee = new KSTextEdit( Frame5, "titlee" ); + titlee->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)0, 0, 0, titlee->sizePolicy().hasHeightForWidth() ) ); + titlee->setMinimumSize( QSize( 0, 22 ) ); + titlee->setMaximumSize( QSize( 32767, 22 ) ); + + Frame5Layout->addWidget( titlee, 1, 0 ); + KSPanelSurfaceInterfLayout->addWidget( Frame5 ); + + Frame3 = new QFrame( this, "Frame3" ); + Frame3->setFrameShape( QFrame::StyledPanel ); + Frame3->setFrameShadow( QFrame::Raised ); + Frame3Layout = new QGridLayout( Frame3, 1, 1, 10, 1, "Frame3Layout"); + + zaxisc = new QComboBox( FALSE, Frame3, "zaxisc" ); + zaxisc->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)0, 0, 0, zaxisc->sizePolicy().hasHeightForWidth() ) ); + zaxisc->setInsertionPolicy( QComboBox::AtTop ); + + Frame3Layout->addWidget( zaxisc, 3, 1 ); + + xaxisc = new QComboBox( FALSE, Frame3, "xaxisc" ); + xaxisc->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)0, 1, 0, xaxisc->sizePolicy().hasHeightForWidth() ) ); + xaxisc->setInsertionPolicy( QComboBox::AtTop ); + + Frame3Layout->addWidget( xaxisc, 1, 1 ); + + vaxisc = new QComboBox( FALSE, Frame3, "vaxisc" ); + vaxisc->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)0, 0, 0, vaxisc->sizePolicy().hasHeightForWidth() ) ); + vaxisc->setInsertionPolicy( QComboBox::AtTop ); + + Frame3Layout->addWidget( vaxisc, 4, 1 ); + + QLabel_5 = new QLabel( Frame3, "QLabel_5" ); + QLabel_5->setText( trUtf8( "Y-Axis " ) ); + + Frame3Layout->addWidget( QLabel_5, 2, 0 ); + + QLabel_6 = new QLabel( Frame3, "QLabel_6" ); + QLabel_6->setText( trUtf8( "Z-Axis " ) ); + + Frame3Layout->addWidget( QLabel_6, 3, 0 ); + + QLabel_4 = new QLabel( Frame3, "QLabel_4" ); + QLabel_4->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5, (QSizePolicy::SizeType)5, 0, 0, QLabel_4->sizePolicy().hasHeightForWidth() ) ); + QLabel_4->setText( trUtf8( "X-Axis " ) ); + + Frame3Layout->addWidget( QLabel_4, 1, 0 ); + + yaxisc = new QComboBox( FALSE, Frame3, "yaxisc" ); + yaxisc->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)0, 0, 0, yaxisc->sizePolicy().hasHeightForWidth() ) ); + yaxisc->setInsertionPolicy( QComboBox::AtTop ); + + Frame3Layout->addWidget( yaxisc, 2, 1 ); + + QLabel_7 = new QLabel( Frame3, "QLabel_7" ); + QLabel_7->setText( trUtf8( "V-Axis " ) ); + + Frame3Layout->addWidget( QLabel_7, 4, 0 ); + QSpacerItem* spacer_2 = new QSpacerItem( 20, 20, QSizePolicy::Minimum, QSizePolicy::Expanding ); + Frame3Layout->addItem( spacer_2, 5, 1 ); + + TextLabel1_2 = new QLabel( Frame3, "TextLabel1_2" ); + QFont TextLabel1_2_font( TextLabel1_2->font() ); + TextLabel1_2_font.setBold( TRUE ); + TextLabel1_2_font.setUnderline( TRUE ); + TextLabel1_2->setFont( TextLabel1_2_font ); + TextLabel1_2->setText( trUtf8( "Bind to" ) ); + + Frame3Layout->addMultiCellWidget( TextLabel1_2, 0, 0, 0, 1 ); + KSPanelSurfaceInterfLayout->addWidget( Frame3 ); + + Frame4 = new QFrame( this, "Frame4" ); + Frame4->setFrameShape( QFrame::StyledPanel ); + Frame4->setFrameShadow( QFrame::Raised ); + Frame4Layout = new QGridLayout( Frame4, 1, 1, 10, 1, "Frame4Layout"); + QSpacerItem* spacer_3 = new QSpacerItem( 20, 20, QSizePolicy::Minimum, QSizePolicy::Expanding ); + Frame4Layout->addMultiCell( spacer_3, 4, 4, 0, 1 ); + + legendc = new QCheckBox( Frame4, "legendc" ); + legendc->setText( trUtf8( "Show legend item" ) ); + + Frame4Layout->addMultiCellWidget( legendc, 1, 1, 0, 1 ); + + TextLabel1_3 = new QLabel( Frame4, "TextLabel1_3" ); + QFont TextLabel1_3_font( TextLabel1_3->font() ); + TextLabel1_3_font.setBold( TRUE ); + TextLabel1_3_font.setUnderline( TRUE ); + TextLabel1_3->setFont( TextLabel1_3_font ); + TextLabel1_3->setText( trUtf8( "Options" ) ); + + Frame4Layout->addMultiCellWidget( TextLabel1_3, 0, 0, 0, 1 ); + + xGridStep = new QSpinBox( Frame4, "xGridStep" ); + + Frame4Layout->addWidget( xGridStep, 2, 1 ); + + yGridStep = new QSpinBox( Frame4, "yGridStep" ); + + Frame4Layout->addWidget( yGridStep, 3, 1 ); + + TextLabel1_4 = new QLabel( Frame4, "TextLabel1_4" ); + TextLabel1_4->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)5, 0, 0, TextLabel1_4->sizePolicy().hasHeightForWidth() ) ); + TextLabel1_4->setText( trUtf8( "X grid step" ) ); + + Frame4Layout->addWidget( TextLabel1_4, 2, 0 ); + + TextLabel2 = new QLabel( Frame4, "TextLabel2" ); + TextLabel2->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)5, 0, 0, TextLabel2->sizePolicy().hasHeightForWidth() ) ); + TextLabel2->setText( trUtf8( "Y grid step" ) ); + + Frame4Layout->addWidget( TextLabel2, 3, 0 ); + KSPanelSurfaceInterfLayout->addWidget( Frame4 ); +} + +/* + * Destroys the object and frees any allocated resources + */ +KSPanelSurfaceInterf::~KSPanelSurfaceInterf() +{ + // no need to delete child widgets, Qt does it all for us +} + +#include "kspanelsurfaceinterf.moc" diff --git a/kmatplot/dialogs/kspanelsurfaceinterf.ui b/kmatplot/dialogs/kspanelsurfaceinterf.ui new file mode 100644 index 0000000..dc7a825 --- /dev/null +++ b/kmatplot/dialogs/kspanelsurfaceinterf.ui @@ -0,0 +1,419 @@ + +KSPanelSurfaceInterf + + + KSPanelSurfaceInterf + + + + 0 + 0 + 617 + 157 + + + + + 5 + 5 + 0 + 0 + + + + KSPanelForm + + + + unnamed + + + 1 + + + 1 + + + + Frame5 + + + StyledPanel + + + Raised + + + + unnamed + + + 10 + + + 1 + + + + TextLabel1 + + + + 1 + 1 + + + + Title + + + + + Spacer1 + + + Vertical + + + Expanding + + + + 20 + 20 + + + + + + titlee + + + + 7 + 0 + 0 + 0 + + + + + 0 + 22 + + + + + 32767 + 22 + + + + + + + + Frame3 + + + StyledPanel + + + Raised + + + + unnamed + + + 10 + + + 1 + + + + zaxisc + + + + 7 + 0 + 0 + 0 + + + + AtTop + + + + + xaxisc + + + + 7 + 0 + 1 + 0 + + + + AtTop + + + + + vaxisc + + + + 7 + 0 + 0 + 0 + + + + AtTop + + + + + QLabel_5 + + + Y-Axis + + + + + QLabel_6 + + + Z-Axis + + + + + QLabel_4 + + + + 5 + 5 + 0 + 0 + + + + X-Axis + + + + + yaxisc + + + + 7 + 0 + 0 + 0 + + + + AtTop + + + + + QLabel_7 + + + V-Axis + + + + + Spacer2 + + + Vertical + + + Expanding + + + + 20 + 20 + + + + + + TextLabel1_2 + + + + 1 + 1 + + + + Bind to + + + + + + + Frame4 + + + StyledPanel + + + Raised + + + + unnamed + + + 10 + + + 1 + + + + Spacer3 + + + Vertical + + + Expanding + + + + 20 + 20 + + + + + + legendc + + + Show legend item + + + + + TextLabel1_3 + + + + 1 + 1 + + + + Options + + + + + xGridStep + + + + + yGridStep + + + + + TextLabel1_4 + + + + 7 + 5 + 0 + 0 + + + + X grid step + + + + + TextLabel2 + + + + 7 + 5 + 0 + 0 + + + + Y grid step + + + + + + + + + KSPanel +
kspanel.h
+ + 500 + 140 + + 1 + + 0 + 0 + 0 + 0 + + image0 +
+ + KSTextEdit +
kstextedit.h
+ + -1 + -1 + + 0 + + 5 + 5 + 0 + 0 + + image1 +
+
+ + + 789cd3d7528808f055d0d2e72a2e492cc94c5648ce482c52d04a29cdcdad8c8eb5ade65232540043251d2e253d856405e554300073956aadb900494e10c6 + + + 789cd3d7528808f055d0d2e72a2e492cc94c5648ce482c52d04a29cdcdad8c8eb5ade6523234530022630543251d2e253d856405bffcbc54105b19c856360003103711c44d490541b04a34805b4c593911ca0731d0c49413812cfc7a95c18a9561ea4022890802530caa5719a40fac17490c9b3a9ce6a1da4bb47f8910abb5e602003a1250e8 + + + +
diff --git a/kmatplot/dialogs/kspanelviewinterf.cpp b/kmatplot/dialogs/kspanelviewinterf.cpp new file mode 100644 index 0000000..6e42942 --- /dev/null +++ b/kmatplot/dialogs/kspanelviewinterf.cpp @@ -0,0 +1,146 @@ +/**************************************************************************** +** Form implementation generated from reading ui file './kspanelviewinterf.ui' +** +** Created: śro mar 20 18:53:11 2002 +** by: The User Interface Compiler (uic) +** +** WARNING! All changes made in this file will be lost! +****************************************************************************/ +#include "kspanelviewinterf.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "kspanel.h" + +/* + * Constructs a KSPanelViewInterf which is a child of 'parent', with the + * name 'name'.' + */ +KSPanelViewInterf::KSPanelViewInterf( QWidget* parent, const char* name ) + : KSPanel( parent, name ) +{ + if ( !name ) + setName( "KSPanelViewInterf" ); + resize( 500, 140 ); + setCaption( trUtf8( "KSPanelForm" ) ); + KSPanelViewInterfLayout = new QHBoxLayout( this, 1, 1, "KSPanelViewInterfLayout"); + + Frame3 = new QFrame( this, "Frame3" ); + Frame3->setFrameShape( QFrame::StyledPanel ); + Frame3->setFrameShadow( QFrame::Raised ); + Frame3Layout = new QGridLayout( Frame3, 1, 1, 10, 1, "Frame3Layout"); + + QLabel_6 = new QLabel( Frame3, "QLabel_6" ); + QLabel_6->setMinimumSize( QSize( 0, 20 ) ); + QFont QLabel_6_font( QLabel_6->font() ); + QLabel_6_font.setBold( TRUE ); + QLabel_6_font.setUnderline( TRUE ); + QLabel_6->setFont( QLabel_6_font ); + QLabel_6->setText( trUtf8( "Viewpoint" ) ); + + Frame3Layout->addMultiCellWidget( QLabel_6, 0, 0, 0, 1 ); + + azimuths = new QSpinBox( Frame3, "azimuths" ); + azimuths->setMaxValue( 359 ); + + Frame3Layout->addWidget( azimuths, 1, 1 ); + + elevations = new QSpinBox( Frame3, "elevations" ); + elevations->setMaxValue( 90 ); + elevations->setMinValue( -90 ); + + Frame3Layout->addWidget( elevations, 2, 1 ); + + QLabel_3 = new QLabel( Frame3, "QLabel_3" ); + QLabel_3->setText( trUtf8( "Distance" ) ); + + Frame3Layout->addWidget( QLabel_3, 3, 0 ); + + QLabel_1 = new QLabel( Frame3, "QLabel_1" ); + QLabel_1->setText( trUtf8( "Azimuth" ) ); + + Frame3Layout->addWidget( QLabel_1, 1, 0 ); + + distances = new QSpinBox( Frame3, "distances" ); + distances->setMaxValue( 50 ); + distances->setMinValue( -50 ); + + Frame3Layout->addWidget( distances, 3, 1 ); + + QLabel_2 = new QLabel( Frame3, "QLabel_2" ); + QLabel_2->setText( trUtf8( "Elevation" ) ); + + Frame3Layout->addWidget( QLabel_2, 2, 0 ); + QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Minimum, QSizePolicy::Expanding ); + Frame3Layout->addItem( spacer, 4, 0 ); + KSPanelViewInterfLayout->addWidget( Frame3 ); + + Frame4 = new QFrame( this, "Frame4" ); + Frame4->setFrameShape( QFrame::StyledPanel ); + Frame4->setFrameShadow( QFrame::Raised ); + Frame4Layout = new QGridLayout( Frame4, 1, 1, 10, 1, "Frame4Layout"); + QSpacerItem* spacer_2 = new QSpacerItem( 20, 20, QSizePolicy::Minimum, QSizePolicy::Expanding ); + Frame4Layout->addItem( spacer_2, 2, 0 ); + + perspectivec = new QCheckBox( Frame4, "perspectivec" ); + perspectivec->setMinimumSize( QSize( 0, 20 ) ); + QFont perspectivec_font( perspectivec->font() ); + perspectivec_font.setBold( TRUE ); + perspectivec_font.setUnderline( TRUE ); + perspectivec->setFont( perspectivec_font ); + perspectivec->setText( trUtf8( "Perspective" ) ); + + Frame4Layout->addMultiCellWidget( perspectivec, 0, 0, 0, 1 ); + + fdistances = new QSpinBox( Frame4, "fdistances" ); + fdistances->setMaxValue( 50 ); + fdistances->setMinValue( -50 ); + + Frame4Layout->addWidget( fdistances, 1, 1 ); + + QLabel_7 = new QLabel( Frame4, "QLabel_7" ); + QLabel_7->setText( trUtf8( "Focuspoint dist." ) ); + + Frame4Layout->addWidget( QLabel_7, 1, 0 ); + KSPanelViewInterfLayout->addWidget( Frame4 ); + + Frame5 = new QFrame( this, "Frame5" ); + Frame5->setFrameShape( QFrame::StyledPanel ); + Frame5->setFrameShadow( QFrame::Raised ); + Frame5Layout = new QGridLayout( Frame5, 1, 1, 10, 1, "Frame5Layout"); + QSpacerItem* spacer_3 = new QSpacerItem( 20, 20, QSizePolicy::Minimum, QSizePolicy::Expanding ); + Frame5Layout->addItem( spacer_3, 2, 1 ); + + autoscalec = new QCheckBox( Frame5, "autoscalec" ); + autoscalec->setText( trUtf8( "Autoscale" ) ); + + Frame5Layout->addMultiCellWidget( autoscalec, 1, 1, 0, 1 ); + + TextLabel1 = new QLabel( Frame5, "TextLabel1" ); + TextLabel1->setMinimumSize( QSize( 0, 20 ) ); + QFont TextLabel1_font( TextLabel1->font() ); + TextLabel1_font.setBold( TRUE ); + TextLabel1_font.setUnderline( TRUE ); + TextLabel1->setFont( TextLabel1_font ); + TextLabel1->setText( trUtf8( "Options" ) ); + + Frame5Layout->addWidget( TextLabel1, 0, 0 ); + KSPanelViewInterfLayout->addWidget( Frame5 ); +} + +/* + * Destroys the object and frees any allocated resources + */ +KSPanelViewInterf::~KSPanelViewInterf() +{ + // no need to delete child widgets, Qt does it all for us +} + +#include "kspanelviewinterf.moc" diff --git a/kmatplot/dialogs/kspanelviewinterf.ui b/kmatplot/dialogs/kspanelviewinterf.ui new file mode 100644 index 0000000..e341a41 --- /dev/null +++ b/kmatplot/dialogs/kspanelviewinterf.ui @@ -0,0 +1,312 @@ + +KSPanelViewInterf + + + KSPanelViewInterf + + + + 0 + 0 + 500 + 140 + + + + KSPanelForm + + + + unnamed + + + 1 + + + 1 + + + + Frame3 + + + StyledPanel + + + Raised + + + + unnamed + + + 10 + + + 1 + + + + QLabel_6 + + + + 0 + 20 + + + + + 1 + 1 + + + + Viewpoint + + + + + azimuths + + + 359 + + + + + elevations + + + 90 + + + -90 + + + + + QLabel_3 + + + Distance + + + + + QLabel_1 + + + Azimuth + + + + + distances + + + 50 + + + -50 + + + + + QLabel_2 + + + Elevation + + + + + Spacer2 + + + Vertical + + + Expanding + + + + 20 + 20 + + + + + + + + Frame4 + + + StyledPanel + + + Raised + + + + unnamed + + + 10 + + + 1 + + + + Spacer3 + + + Vertical + + + Expanding + + + + 20 + 20 + + + + + + perspectivec + + + + 0 + 20 + + + + + 1 + 1 + + + + Perspective + + + + + fdistances + + + 50 + + + -50 + + + + + QLabel_7 + + + Focuspoint dist. + + + + + + + Frame5 + + + StyledPanel + + + Raised + + + + unnamed + + + 10 + + + 1 + + + + Spacer1 + + + Vertical + + + Expanding + + + + 20 + 20 + + + + + + autoscalec + + + Autoscale + + + + + TextLabel1 + + + + 0 + 20 + + + + + 1 + 1 + + + + Options + + + + + + + + + KSPanel +
kspanel.h
+ + 500 + 140 + + 1 + + 0 + 0 + 0 + 0 + + image0 +
+
+ + + 789cd3d7528808f055d0d2e72a2e492cc94c5648ce482c52d04a29cdcdad8c8eb5ade65232540043251d2e253d856405e554300073956aadb900494e10c6 + + + +
diff --git a/kmatplot/dialogs/kssheetdlgcellrangeinterf.cpp b/kmatplot/dialogs/kssheetdlgcellrangeinterf.cpp new file mode 100644 index 0000000..1924e31 --- /dev/null +++ b/kmatplot/dialogs/kssheetdlgcellrangeinterf.cpp @@ -0,0 +1,94 @@ +/**************************************************************************** +** Form implementation generated from reading ui file './kssheetdlgcellrangeinterf.ui' +** +** Created: śro mar 20 18:53:24 2002 +** by: The User Interface Compiler (uic) +** +** WARNING! All changes made in this file will be lost! +****************************************************************************/ +#include "kssheetdlgcellrangeinterf.h" + +#include +#include +#include +#include +#include +#include +#include +#include + +/* + * Constructs a KSSheetDlgCellRangeInterf which is a child of 'parent', with the + * name 'name' and widget flags set to 'f'. + * + * The dialog will by default be modeless, unless you set 'modal' to + * TRUE to construct a modal dialog. + */ +KSSheetDlgCellRangeInterf::KSSheetDlgCellRangeInterf( QWidget* parent, const char* name, bool modal, WFlags fl ) + : QDialog( parent, name, modal, fl ) +{ + if ( !name ) + setName( "KSSheetDlgCellRangeInterf" ); + resize( 266, 159 ); + setCaption( trUtf8( "Select cell range" ) ); + + TextLabel4 = new QLabel( this, "TextLabel4" ); + TextLabel4->setGeometry( QRect( 20, 65, 75, 25 ) ); + TextLabel4->setText( trUtf8( "Columns" ) ); + + TextLabel1 = new QLabel( this, "TextLabel1" ); + TextLabel1->setGeometry( QRect( 20, 30, 75, 25 ) ); + TextLabel1->setText( trUtf8( "Rows" ) ); + + TextLabel2 = new QLabel( this, "TextLabel2" ); + TextLabel2->setGeometry( QRect( 100, 5, 70, 20 ) ); + TextLabel2->setText( trUtf8( "From :" ) ); + TextLabel2->setAlignment( int( QLabel::AlignCenter ) ); + + TextLabel3 = new QLabel( this, "TextLabel3" ); + TextLabel3->setGeometry( QRect( 190, 5, 70, 20 ) ); + TextLabel3->setText( trUtf8( "To :" ) ); + TextLabel3->setAlignment( int( QLabel::AlignCenter ) ); + + rowFrom = new QSpinBox( this, "rowFrom" ); + rowFrom->setGeometry( QRect( 100, 30, 70, 25 ) ); + rowFrom->setMaxValue( 999999999 ); + + rowTo = new QSpinBox( this, "rowTo" ); + rowTo->setGeometry( QRect( 190, 30, 70, 25 ) ); + rowTo->setMaxValue( 999999999 ); + + colFrom = new QSpinBox( this, "colFrom" ); + colFrom->setGeometry( QRect( 100, 65, 70, 25 ) ); + colFrom->setMaxValue( 999999999 ); + + colTo = new QSpinBox( this, "colTo" ); + colTo->setGeometry( QRect( 190, 65, 71, 25 ) ); + colTo->setMaxValue( 999999999 ); + + buttonCancel = new QPushButton( this, "buttonCancel" ); + buttonCancel->setGeometry( QRect( 170, 120, 90, 30 ) ); + buttonCancel->setText( trUtf8( "Cancel" ) ); + + buttonOK = new QPushButton( this, "buttonOK" ); + buttonOK->setGeometry( QRect( 70, 120, 90, 30 ) ); + buttonOK->setText( trUtf8( "OK" ) ); + + Line1 = new QFrame( this, "Line1" ); + Line1->setGeometry( QRect( 15, 101, 250, 16 ) ); + Line1->setFrameShape( QFrame::HLine ); + + // signals and slots connections + connect( buttonOK, SIGNAL( clicked() ), this, SLOT( accept() ) ); + connect( buttonCancel, SIGNAL( clicked() ), this, SLOT( reject() ) ); +} + +/* + * Destroys the object and frees any allocated resources + */ +KSSheetDlgCellRangeInterf::~KSSheetDlgCellRangeInterf() +{ + // no need to delete child widgets, Qt does it all for us +} + +#include "kssheetdlgcellrangeinterf.moc" diff --git a/kmatplot/dialogs/kssheetdlgcellrangeinterf.ui b/kmatplot/dialogs/kssheetdlgcellrangeinterf.ui new file mode 100644 index 0000000..77500fe --- /dev/null +++ b/kmatplot/dialogs/kssheetdlgcellrangeinterf.ui @@ -0,0 +1,271 @@ + +KSSheetDlgCellRangeInterf + + QDialog + + name + KSSheetDlgCellRangeInterf + + + geometry + + 0 + 0 + 266 + 159 + + + + caption + Select cell range + + + QLabel + + name + TextLabel4 + + + geometry + + 20 + 65 + 75 + 25 + + + + text + Columns + + + + QLabel + + name + TextLabel1 + + + geometry + + 20 + 30 + 75 + 25 + + + + text + Rows + + + + QLabel + + name + TextLabel2 + + + geometry + + 100 + 5 + 70 + 20 + + + + text + From : + + + alignment + AlignCenter + + + hAlign + + + + QLabel + + name + TextLabel3 + + + geometry + + 190 + 5 + 70 + 20 + + + + text + To : + + + alignment + AlignCenter + + + hAlign + + + + QSpinBox + + name + rowFrom + + + geometry + + 100 + 30 + 70 + 25 + + + + maxValue + 999999999 + + + + QSpinBox + + name + rowTo + + + geometry + + 190 + 30 + 70 + 25 + + + + maxValue + 999999999 + + + + QSpinBox + + name + colFrom + + + geometry + + 100 + 65 + 70 + 25 + + + + maxValue + 999999999 + + + + QSpinBox + + name + colTo + + + geometry + + 190 + 65 + 71 + 25 + + + + maxValue + 999999999 + + + + QPushButton + + name + buttonCancel + + + geometry + + 170 + 120 + 90 + 30 + + + + text + Cancel + + + + QPushButton + + name + buttonOK + + + geometry + + 70 + 120 + 90 + 30 + + + + text + OK + + + + Line + + name + Line1 + + + geometry + + 15 + 101 + 250 + 16 + + + + orientation + Horizontal + + + + + + buttonOK + clicked() + KSSheetDlgCellRangeInterf + accept() + + + buttonCancel + clicked() + KSSheetDlgCellRangeInterf + reject() + + + diff --git a/kmatplot/dialogs/kssheetdlgcoldatainterf.cpp b/kmatplot/dialogs/kssheetdlgcoldatainterf.cpp new file mode 100644 index 0000000..5b38ace --- /dev/null +++ b/kmatplot/dialogs/kssheetdlgcoldatainterf.cpp @@ -0,0 +1,105 @@ +/**************************************************************************** +** Form implementation generated from reading ui file './kssheetdlgcoldatainterf.ui' +** +** Created: śro mar 20 18:53:25 2002 +** by: The User Interface Compiler (uic) +** +** WARNING! All changes made in this file will be lost! +****************************************************************************/ +#include "kssheetdlgcoldatainterf.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +/* + * Constructs a KSSheetDlgColDataInterf which is a child of 'parent', with the + * name 'name' and widget flags set to 'f'. + * + * The dialog will by default be modeless, unless you set 'modal' to + * TRUE to construct a modal dialog. + */ +KSSheetDlgColDataInterf::KSSheetDlgColDataInterf( QWidget* parent, const char* name, bool modal, WFlags fl ) + : QDialog( parent, name, modal, fl ) +{ + if ( !name ) + setName( "KSSheetDlgColDataInterf" ); + resize( 300, 290 ); + setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)1, (QSizePolicy::SizeType)5, 0, 0, sizePolicy().hasHeightForWidth() ) ); + setCaption( trUtf8( "Form1" ) ); + + buttonCancel = new QPushButton( this, "buttonCancel" ); + buttonCancel->setGeometry( QRect( 200, 260, 94, 25 ) ); + buttonCancel->setText( trUtf8( "Cancel" ) ); + buttonCancel->setAutoDefault( FALSE ); + + buttonOK = new QPushButton( this, "buttonOK" ); + buttonOK->setGeometry( QRect( 95, 260, 94, 25 ) ); + buttonOK->setText( trUtf8( "OK" ) ); + buttonOK->setAutoDefault( FALSE ); + + Frame3 = new QFrame( this, "Frame3" ); + Frame3->setGeometry( QRect( 5, 235, 291, 21 ) ); + Frame3->setFrameShape( QFrame::HLine ); + Frame3->setFrameShadow( QFrame::Sunken ); + + colType = new QComboBox( FALSE, this, "colType" ); + colType->setGeometry( QRect( 160, 205, 135, 22 ) ); + + TextLabel2 = new QLabel( this, "TextLabel2" ); + TextLabel2->setGeometry( QRect( 10, 205, 150, 25 ) ); + TextLabel2->setText( trUtf8( "Data type in this column" ) ); + + TextLabel1 = new QLabel( this, "TextLabel1" ); + TextLabel1->setGeometry( QRect( 5, 70, 290, 16 ) ); + TextLabel1->setText( trUtf8( "Column title" ) ); + TextLabel1->setAlignment( int( QLabel::AlignCenter ) ); + + colTitle = new QMultiLineEdit( this, "colTitle" ); + colTitle->setGeometry( QRect( 5, 90, 290, 110 ) ); + + GroupBox1 = new QGroupBox( this, "GroupBox1" ); + GroupBox1->setGeometry( QRect( 5, 5, 290, 60 ) ); + GroupBox1->setTitle( trUtf8( "Apply to column range" ) ); + + columnFrom = new QSpinBox( GroupBox1, "columnFrom" ); + columnFrom->setGeometry( QRect( 95, 25, 70, 22 ) ); + columnFrom->setMaxValue( 999999999 ); + + TextLabel1_2 = new QLabel( GroupBox1, "TextLabel1_2" ); + TextLabel1_2->setGeometry( QRect( 10, 25, 85, 25 ) ); + TextLabel1_2->setText( trUtf8( "From/Step/To:" ) ); + + columnTo = new QSpinBox( GroupBox1, "columnTo" ); + columnTo->setGeometry( QRect( 205, 25, 70, 22 ) ); + columnTo->setButtonSymbols( QSpinBox::UpDownArrows ); + columnTo->setMaxValue( 999999999 ); + + columnStep = new QSpinBox( GroupBox1, "columnStep" ); + columnStep->setGeometry( QRect( 165, 25, 40, 22 ) ); + columnStep->setMaxValue( 999999999 ); + columnStep->setMinValue( 1 ); + columnStep->setValue( 1 ); + + // signals and slots connections + connect( buttonOK, SIGNAL( clicked() ), this, SLOT( accept() ) ); + connect( buttonCancel, SIGNAL( clicked() ), this, SLOT( reject() ) ); +} + +/* + * Destroys the object and frees any allocated resources + */ +KSSheetDlgColDataInterf::~KSSheetDlgColDataInterf() +{ + // no need to delete child widgets, Qt does it all for us +} + +#include "kssheetdlgcoldatainterf.moc" diff --git a/kmatplot/dialogs/kssheetdlgcoldatainterf.ui b/kmatplot/dialogs/kssheetdlgcoldatainterf.ui new file mode 100644 index 0000000..da7e7d2 --- /dev/null +++ b/kmatplot/dialogs/kssheetdlgcoldatainterf.ui @@ -0,0 +1,307 @@ + +KSSheetDlgColDataInterf + + QDialog + + name + KSSheetDlgColDataInterf + + + geometry + + 0 + 0 + 300 + 290 + + + + sizePolicy + + 1 + 5 + + + + caption + Form1 + + + QPushButton + + name + buttonCancel + + + geometry + + 200 + 260 + 94 + 25 + + + + text + Cancel + + + autoDefault + false + + + + QPushButton + + name + buttonOK + + + geometry + + 95 + 260 + 94 + 25 + + + + text + OK + + + autoDefault + false + + + + QFrame + + name + Frame3 + + + geometry + + 5 + 235 + 291 + 21 + + + + frameShape + HLine + + + frameShadow + Sunken + + + + QComboBox + + name + colType + + + geometry + + 160 + 205 + 135 + 22 + + + + + QLabel + + name + TextLabel2 + + + geometry + + 10 + 205 + 150 + 25 + + + + text + Data type in this column + + + + QLabel + + name + TextLabel1 + + + geometry + + 5 + 70 + 290 + 16 + + + + text + Column title + + + alignment + AlignCenter + + + hAlign + + + + QMultiLineEdit + + name + colTitle + + + geometry + + 5 + 90 + 290 + 110 + + + + + QGroupBox + + name + GroupBox1 + + + geometry + + 5 + 5 + 290 + 60 + + + + title + Apply to column range + + + QSpinBox + + name + columnFrom + + + geometry + + 95 + 25 + 70 + 22 + + + + maxValue + 999999999 + + + + QLabel + + name + TextLabel1_2 + + + geometry + + 10 + 25 + 85 + 25 + + + + text + From/Step/To: + + + + QSpinBox + + name + columnTo + + + geometry + + 205 + 25 + 70 + 22 + + + + buttonSymbols + UpDownArrows + + + maxValue + 999999999 + + + + QSpinBox + + name + columnStep + + + geometry + + 165 + 25 + 40 + 22 + + + + maxValue + 999999999 + + + minValue + 1 + + + value + 1 + + + + + + + buttonOK + clicked() + KSSheetDlgColDataInterf + accept() + + + buttonCancel + clicked() + KSSheetDlgColDataInterf + reject() + + + diff --git a/kmatplot/dialogs/kssheetdlgs.cpp b/kmatplot/dialogs/kssheetdlgs.cpp new file mode 100644 index 0000000..1b9a90e --- /dev/null +++ b/kmatplot/dialogs/kssheetdlgs.cpp @@ -0,0 +1,203 @@ +/*************************************************************************** + kssheetdlgs.cpp + ------------------- + begin : + copyright : (C) 2001 by Kamil Dobkowski + email : kamildbk@friko.onet.pl + ***************************************************************************/ + +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + + +#include "kssheetdlgs.h" +#include "../ksglobalmatrixlist.h" +#include "../formula/mpformula.h" +#include "../kscommands.h" +#include "../ksworkbook.h" +#include "../ksobjectfactory.h" +#include "../ksdatasymbolfactory.h" + +#include +#include +#include +#include +#include +#include + +//--------------------------------------------------------------------// +//--------------------------------------------------------------------// +//--------------------------------------------------------------------// +//--------------------------------------------------------------------// + +KSSheetDlgCellRange::KSSheetDlgCellRange( QWidget *parent ) +: KSSheetDlgCellRangeInterf( parent, NULL, TRUE ) + { + } + +//--------------------------------------------------------------------// + +KSSheetDlgCellRange::~KSSheetDlgCellRange() + { + } + +//--------------------------------------------------------------------// +//--------------------------------------------------------------------// +//--------------------------------------------------------------------// +//--------------------------------------------------------------------// + +KSSheetDlgValueRange::KSSheetDlgValueRange( QWidget *parent ) +: KSSheetDlgValueRangeInterf( parent, NULL, TRUE ) + { + } + +//--------------------------------------------------------------------// + +KSSheetDlgValueRange::~KSSheetDlgValueRange() + { + } + +//--------------------------------------------------------------------// + +void KSSheetDlgValueRange::setMinValue( double value ) + { + rangeMin->setText( QString::number(value) ); + } + +//--------------------------------------------------------------------// + +void KSSheetDlgValueRange::setMaxValue( double value ) + { + rangeMax->setText( QString::number(value) ); + } + +//--------------------------------------------------------------------// + +double KSSheetDlgValueRange::minValue() const + { + return rangeMin->text().toDouble(); + } + +//--------------------------------------------------------------------// + +double KSSheetDlgValueRange::maxValue() const + { + return rangeMax->text().toDouble(); + } + +//--------------------------------------------------------------------// +//--------------------------------------------------------------------// +//--------------------------------------------------------------------// +//--------------------------------------------------------------------// + +KSSheetDlgSequence::KSSheetDlgSequence( QWidget *parent ) +: KSSheetDlgSequenceInterf( parent, NULL, TRUE ) + { + } + +//--------------------------------------------------------------------// + +KSSheetDlgSequence::~KSSheetDlgSequence() + { + } + +//--------------------------------------------------------------------// + +double KSSheetDlgSequence::from() const + { + return sequenceFrom->text().toDouble(); + } + +//--------------------------------------------------------------------// + +double KSSheetDlgSequence::to() const + { + return sequenceTo->text().toDouble(); + } + +//--------------------------------------------------------------------// + +bool KSSheetDlgSequence::useStep() const + { + return sequenceUseStepValue->isChecked(); + } + +//--------------------------------------------------------------------// + +bool KSSheetDlgSequence::reversedDirection() const + { + return sequenceReversedDirection->isChecked(); + } + +//--------------------------------------------------------------------// +//--------------------------------------------------------------------// +//--------------------------------------------------------------------// +//--------------------------------------------------------------------// +//--------------------------------------------------------------------// +//--------------------------------------------------------------------// + +KSSheetDlgColData::KSSheetDlgColData( QWidget *parent, KSSheet *matrix, int column_from, int column_step, int column_to ) +: KSSheetDlgColDataInterf( parent, NULL, TRUE ) + { + m_global_matrix = matrix; + m_column_from = column_from; + m_column_step = column_step; + m_column_to = column_to; + + columnFrom->setValue( m_column_from ); + columnStep->setValue( m_column_step ); + columnTo->setValue( m_column_to ); + + setCaption( tr("Column editor") ); + colType->clear(); + colType->insertItem( tr("Unknown") ); + colType->insertItem( tr("X") ); + colType->insertItem( tr("Y") ); + colType->insertItem( tr("Z") ); + colType->insertItem( tr("V") ); + colType->insertItem( tr("Delta X") ); + colType->insertItem( tr("Delta Y") ); + if ( matrix->isColumnDataPresent(m_column_from) ) { + colTitle->setText( matrix->columnData(m_column_from).title ); + colType->setCurrentItem( matrix->columnData(m_column_from).type ); + } + } + +//--------------------------------------------------------------------// + +KSSheetDlgColData::~KSSheetDlgColData() + { + } + +//--------------------------------------------------------------------// + +KSSheet::ColumnType KSSheetDlgColData::columnType() const + { + return static_cast(colType->currentItem()); + } + +//--------------------------------------------------------------------// + +QString KSSheetDlgColData::columnTitle() const + { + return colTitle->text(); + } + +//--------------------------------------------------------------------// + +void KSSheetDlgColData::apply() + { + for( int curr_col=columnFrom->value(); curr_col<=columnTo->value(); curr_col+=columnStep->value() ) { + m_global_matrix->setColumnData( curr_col, columnType(), columnTitle() ); + } + } + + + + diff --git a/kmatplot/dialogs/kssheetdlgs.h b/kmatplot/dialogs/kssheetdlgs.h new file mode 100644 index 0000000..2cec559 --- /dev/null +++ b/kmatplot/dialogs/kssheetdlgs.h @@ -0,0 +1,91 @@ +/*************************************************************************** + kssheetdlgs.h + ------------------- + begin : + copyright : (C) 2001 by Kamil Dobkowski + email : kamildbk@friko.onet.pl + ***************************************************************************/ + +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + +#ifndef KSSHEETDLGS_H +#define KSSHEETDLGS_H + +#ifdef HAVE_CONFIG_H +#include +#endif + +#include +#include "kssheetdlgcoldatainterf.h" +#include "kssheetdlgcellrangeinterf.h" +#include "kssheetdlgvaluerangeinterf.h" +#include "kssheetdlgsequenceinterf.h" +#include "../ksglobalmatrixlist.h" + +class QWidget; +class KSWorkbook; + +//--------------------------------------------------------------------------------------------------// + +class KSSheetDlgCellRange : public KSSheetDlgCellRangeInterf + { + Q_OBJECT + public: + KSSheetDlgCellRange( QWidget *parent ); + virtual ~KSSheetDlgCellRange(); + }; + +//--------------------------------------------------------------------------------------------------// + +class KSSheetDlgValueRange : public KSSheetDlgValueRangeInterf + { + Q_OBJECT + public: + KSSheetDlgValueRange( QWidget *parent ); + virtual ~KSSheetDlgValueRange(); + void setText( const QString& text ); + void setMinValue( double value ); + void setMaxValue( double value ); + double minValue() const; + double maxValue() const; + }; + +//--------------------------------------------------------------------------------------------------// + +class KSSheetDlgSequence : public KSSheetDlgSequenceInterf + { + Q_OBJECT + public: + KSSheetDlgSequence( QWidget *parent ); + virtual ~KSSheetDlgSequence(); + double from() const; + double to() const; + bool useStep() const; + bool reversedDirection() const; + }; + +//--------------------------------------------------------------------------------------------------// + +class KSSheetDlgColData : public KSSheetDlgColDataInterf { + Q_OBJECT + public: + KSSheetDlgColData( QWidget *parent, KSSheet *matrix, int columnFrom, int columnStep, int columnTo ); + virtual ~KSSheetDlgColData(); + KSSheet::ColumnType columnType() const; + QString columnTitle() const; + void apply(); + protected: + KSSheet *m_global_matrix; + int m_column_from; + int m_column_step; + int m_column_to; + }; + +#endif diff --git a/kmatplot/dialogs/kssheetdlgsequenceinterf.cpp b/kmatplot/dialogs/kssheetdlgsequenceinterf.cpp new file mode 100644 index 0000000..821c4d6 --- /dev/null +++ b/kmatplot/dialogs/kssheetdlgsequenceinterf.cpp @@ -0,0 +1,85 @@ +/**************************************************************************** +** Form implementation generated from reading ui file './kssheetdlgsequenceinterf.ui' +** +** Created: śro mar 20 18:53:26 2002 +** by: The User Interface Compiler (uic) +** +** WARNING! All changes made in this file will be lost! +****************************************************************************/ +#include "kssheetdlgsequenceinterf.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +/* + * Constructs a KSSheetDlgSequenceInterf which is a child of 'parent', with the + * name 'name' and widget flags set to 'f'. + * + * The dialog will by default be modeless, unless you set 'modal' to + * TRUE to construct a modal dialog. + */ +KSSheetDlgSequenceInterf::KSSheetDlgSequenceInterf( QWidget* parent, const char* name, bool modal, WFlags fl ) + : QDialog( parent, name, modal, fl ) +{ + if ( !name ) + setName( "KSSheetDlgSequenceInterf" ); + resize( 241, 192 ); + setCaption( trUtf8( "Sequence" ) ); + + buttonCancel = new QPushButton( this, "buttonCancel" ); + buttonCancel->setGeometry( QRect( 145, 155, 90, 30 ) ); + buttonCancel->setText( trUtf8( "Cancel" ) ); + + TextLabel1 = new QLabel( this, "TextLabel1" ); + TextLabel1->setGeometry( QRect( 30, 10, 95, 25 ) ); + TextLabel1->setText( trUtf8( "From :" ) ); + + sequenceFrom = new QLineEdit( this, "sequenceFrom" ); + sequenceFrom->setGeometry( QRect( 125, 10, 100, 25 ) ); + sequenceFrom->setText( trUtf8( "0.0" ) ); + + TextLabel2 = new QLabel( this, "TextLabel2" ); + TextLabel2->setGeometry( QRect( 30, 40, 95, 25 ) ); + TextLabel2->setText( trUtf8( "To / Step :" ) ); + + Line1 = new QFrame( this, "Line1" ); + Line1->setGeometry( QRect( 10, 135, 225, 16 ) ); + Line1->setFrameShape( QFrame::HLine ); + + sequenceTo = new QLineEdit( this, "sequenceTo" ); + sequenceTo->setGeometry( QRect( 125, 40, 100, 26 ) ); + sequenceTo->setText( trUtf8( "1.0" ) ); + + sequenceUseStepValue = new QCheckBox( this, "sequenceUseStepValue" ); + sequenceUseStepValue->setGeometry( QRect( 30, 80, 185, 21 ) ); + sequenceUseStepValue->setText( trUtf8( "Second parameter is a step value" ) ); + + sequenceReversedDirection = new QCheckBox( this, "sequenceReversedDirection" ); + sequenceReversedDirection->setGeometry( QRect( 30, 110, 185, 18 ) ); + sequenceReversedDirection->setText( trUtf8( "Fill in reversed direction" ) ); + + buttonOK = new QPushButton( this, "buttonOK" ); + buttonOK->setGeometry( QRect( 50, 155, 90, 30 ) ); + buttonOK->setText( trUtf8( "OK" ) ); + + // signals and slots connections + connect( buttonOK, SIGNAL( clicked() ), this, SLOT( accept() ) ); + connect( buttonCancel, SIGNAL( clicked() ), this, SLOT( reject() ) ); +} + +/* + * Destroys the object and frees any allocated resources + */ +KSSheetDlgSequenceInterf::~KSSheetDlgSequenceInterf() +{ + // no need to delete child widgets, Qt does it all for us +} + +#include "kssheetdlgsequenceinterf.moc" diff --git a/kmatplot/dialogs/kssheetdlgsequenceinterf.ui b/kmatplot/dialogs/kssheetdlgsequenceinterf.ui new file mode 100644 index 0000000..4b0ba27 --- /dev/null +++ b/kmatplot/dialogs/kssheetdlgsequenceinterf.ui @@ -0,0 +1,217 @@ + +KSSheetDlgSequenceInterf + + QDialog + + name + KSSheetDlgSequenceInterf + + + geometry + + 0 + 0 + 241 + 192 + + + + caption + Sequence + + + QPushButton + + name + buttonCancel + + + geometry + + 145 + 155 + 90 + 30 + + + + text + Cancel + + + + QLabel + + name + TextLabel1 + + + geometry + + 30 + 10 + 95 + 25 + + + + text + From : + + + + QLineEdit + + name + sequenceFrom + + + geometry + + 125 + 10 + 100 + 25 + + + + text + 0.0 + + + + QLabel + + name + TextLabel2 + + + geometry + + 30 + 40 + 95 + 25 + + + + text + To / Step : + + + + Line + + name + Line1 + + + geometry + + 10 + 135 + 225 + 16 + + + + orientation + Horizontal + + + + QLineEdit + + name + sequenceTo + + + geometry + + 125 + 40 + 100 + 26 + + + + text + 1.0 + + + + QCheckBox + + name + sequenceUseStepValue + + + geometry + + 30 + 80 + 185 + 21 + + + + text + Second parameter is a step value + + + + QCheckBox + + name + sequenceReversedDirection + + + geometry + + 30 + 110 + 185 + 18 + + + + text + Fill in reversed direction + + + + QPushButton + + name + buttonOK + + + geometry + + 50 + 155 + 90 + 30 + + + + text + OK + + + + + + buttonOK + clicked() + KSSheetDlgSequenceInterf + accept() + + + buttonCancel + clicked() + KSSheetDlgSequenceInterf + reject() + + + diff --git a/kmatplot/dialogs/kssheetdlgvaluerangeinterf.cpp b/kmatplot/dialogs/kssheetdlgvaluerangeinterf.cpp new file mode 100644 index 0000000..9cd2cd8 --- /dev/null +++ b/kmatplot/dialogs/kssheetdlgvaluerangeinterf.cpp @@ -0,0 +1,79 @@ +/**************************************************************************** +** Form implementation generated from reading ui file './kssheetdlgvaluerangeinterf.ui' +** +** Created: śro mar 20 18:53:27 2002 +** by: The User Interface Compiler (uic) +** +** WARNING! All changes made in this file will be lost! +****************************************************************************/ +#include "kssheetdlgvaluerangeinterf.h" + +#include +#include +#include +#include +#include +#include +#include +#include + +/* + * Constructs a KSSheetDlgValueRangeInterf which is a child of 'parent', with the + * name 'name' and widget flags set to 'f'. + * + * The dialog will by default be modeless, unless you set 'modal' to + * TRUE to construct a modal dialog. + */ +KSSheetDlgValueRangeInterf::KSSheetDlgValueRangeInterf( QWidget* parent, const char* name, bool modal, WFlags fl ) + : QDialog( parent, name, modal, fl ) +{ + if ( !name ) + setName( "KSSheetDlgValueRangeInterf" ); + resize( 224, 159 ); + setCaption( trUtf8( "Enter value range" ) ); + + TextLabel2 = new QLabel( this, "TextLabel2" ); + TextLabel2->setGeometry( QRect( 15, 40, 90, 25 ) ); + TextLabel2->setText( trUtf8( "Minimum" ) ); + + TextLabel3 = new QLabel( this, "TextLabel3" ); + TextLabel3->setGeometry( QRect( 15, 70, 90, 25 ) ); + TextLabel3->setText( trUtf8( "Maximum" ) ); + + Line1 = new QFrame( this, "Line1" ); + Line1->setGeometry( QRect( 10, 100, 210, 16 ) ); + Line1->setFrameShape( QFrame::HLine ); + + rangeMin = new QLineEdit( this, "rangeMin" ); + rangeMin->setGeometry( QRect( 105, 40, 110, 22 ) ); + + rangeMax = new QLineEdit( this, "rangeMax" ); + rangeMax->setGeometry( QRect( 105, 70, 110, 22 ) ); + + buttonCancel = new QPushButton( this, "buttonCancel" ); + buttonCancel->setGeometry( QRect( 130, 125, 90, 30 ) ); + buttonCancel->setText( trUtf8( "Cancel" ) ); + + buttonOK = new QPushButton( this, "buttonOK" ); + buttonOK->setGeometry( QRect( 35, 125, 91, 31 ) ); + buttonOK->setText( trUtf8( "OK" ) ); + + infoText = new QLabel( this, "infoText" ); + infoText->setGeometry( QRect( 15, 5, 201, 26 ) ); + infoText->setText( trUtf8( "Fill with random numbers in setAlignment( int( QLabel::AlignCenter ) ); + + // signals and slots connections + connect( buttonOK, SIGNAL( clicked() ), this, SLOT( accept() ) ); + connect( buttonCancel, SIGNAL( clicked() ), this, SLOT( reject() ) ); +} + +/* + * Destroys the object and frees any allocated resources + */ +KSSheetDlgValueRangeInterf::~KSSheetDlgValueRangeInterf() +{ + // no need to delete child widgets, Qt does it all for us +} + +#include "kssheetdlgvaluerangeinterf.moc" diff --git a/kmatplot/dialogs/kssheetdlgvaluerangeinterf.ui b/kmatplot/dialogs/kssheetdlgvaluerangeinterf.ui new file mode 100644 index 0000000..0b14e66 --- /dev/null +++ b/kmatplot/dialogs/kssheetdlgvaluerangeinterf.ui @@ -0,0 +1,196 @@ + +KSSheetDlgValueRangeInterf + + QDialog + + name + KSSheetDlgValueRangeInterf + + + geometry + + 0 + 0 + 224 + 159 + + + + caption + Enter value range + + + QLabel + + name + TextLabel2 + + + geometry + + 15 + 40 + 90 + 25 + + + + text + Minimum + + + + QLabel + + name + TextLabel3 + + + geometry + + 15 + 70 + 90 + 25 + + + + text + Maximum + + + + Line + + name + Line1 + + + geometry + + 10 + 100 + 210 + 16 + + + + orientation + Horizontal + + + + QLineEdit + + name + rangeMin + + + geometry + + 105 + 40 + 110 + 22 + + + + + QLineEdit + + name + rangeMax + + + geometry + + 105 + 70 + 110 + 22 + + + + + QPushButton + + name + buttonCancel + + + geometry + + 130 + 125 + 90 + 30 + + + + text + Cancel + + + + QPushButton + + name + buttonOK + + + geometry + + 35 + 125 + 91 + 31 + + + + text + OK + + + + QLabel + + name + infoText + + + geometry + + 15 + 5 + 201 + 26 + + + + text + Fill with random numbers in <min,max) + + + alignment + AlignCenter + + + hAlign + + + + + + buttonOK + clicked() + KSSheetDlgValueRangeInterf + accept() + + + buttonCancel + clicked() + KSSheetDlgValueRangeInterf + reject() + + + diff --git a/kmatplot/dialogs/kstextedit.cpp b/kmatplot/dialogs/kstextedit.cpp new file mode 100644 index 0000000..6b33b26 --- /dev/null +++ b/kmatplot/dialogs/kstextedit.cpp @@ -0,0 +1,539 @@ +/*************************************************************************** + kstextedit.cpp - description + ------------------- + begin : Fri Feb 15 2002 + copyright : (C) 2002 by kamil + email : kamil@localhost.localdomain + ***************************************************************************/ + +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + +#include"kstextedit.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include"../pixmaps/action_open.xpm" +#include"../pixmaps/action_save.xpm" +#include"../pixmaps/action_undo.xpm" +#include"../pixmaps/action_redo.xpm" +#include"../pixmaps/action_cut.xpm" +#include"../pixmaps/action_copy.xpm" +#include"../pixmaps/action_paste.xpm" +#include"../pixmaps/action_textbold.xpm" +#include"../pixmaps/action_textitalic.xpm" +#include"../pixmaps/action_textunderline.xpm" +#include"../pixmaps/action_textleft.xpm" +#include"../pixmaps/action_textcenter.xpm" +#include"../pixmaps/action_textright.xpm" +#include"../pixmaps/action_textjustify.xpm" +#include"../pixmaps/action_textcolor.xpm" +#include"../pixmaps/action_textsubscript.xpm" +#include"../pixmaps/action_textsuperscript.xpm" + +#include"../widgets/qsdrvqt.h" + +//---------------------------------------------------------------------------// + +KSTextEdit::KSTextEdit(QWidget *parent, const char *name ) + : QFrame(parent,name) + { + setFrameStyle( StyledPanel | Sunken ); + setLineWidth( 2 ); + setFixedHeight( 22 ); + QHBoxLayout *layout = new QHBoxLayout( this, 2, 1 ); + layout->setAutoAdd( TRUE ); + m_line = new QLineEdit( this ); m_line->setFrameStyle( NoFrame | Plain ); + m_button = new QPushButton( tr("..."), this ); + connect( m_button, SIGNAL(clicked()), this, SLOT(show_dialog()) ); + connect( m_line, SIGNAL(returnPressed()), this, SLOT(change_first_line()) ); + } + +//---------------------------------------------------------------------------// + +KSTextEdit::~KSTextEdit() + { + } + +//---------------------------------------------------------------------------// + +void KSTextEdit::setText( const QString& text ) + { + m_text = text; + m_line->setText( text ); + } + +//---------------------------------------------------------------------------// + +void KSTextEdit::setBaseFont( const QSGFont& baseFont ) + { + m_base_font = baseFont; + } + +//---------------------------------------------------------------------------// + +void KSTextEdit::show_dialog() + { + KSTextEditDlg dlg( this, m_text, m_base_font ); + if ( dlg.exec() ) { setText( dlg.text() ); emit changed(); } + } + +//---------------------------------------------------------------------------// + +void KSTextEdit::change_first_line() + { + setText( m_line->text() ); + emit changed(); + } + + +//---------------------------------------------------------------------------// +//---------------------------------------------------------------------------// +//---------------------------------------------------------------------------// +//---------------------------------------------------------------------------// +//---------------------------------------------------------------------------// +//---------------------------------------------------------------------------// + + +KSTextEditDlg::KSTextEditDlg( QWidget *parent, const QString& text, const QSGFont& baseFont ) +: QDialog( parent, NULL, TRUE ) + { + setCaption( tr("Enter text") ); + resize( 470, 350 ); + m_menu = new QMenuBar( this ); + m_toolbars_area = new QDockArea( Horizontal, QDockArea::Normal, this ); + QGridLayout *layout = new QGridLayout( this, 3, 4, 1, 1 ); + + //QStyleSheet *sheet = new QStyleSheet( this ); + //sheet->item("p")->setLineSpacing( 0 ); + //sheet->item("p")->setFontFamily(baseFont.family); + //sheet->item("p")->setColor( QSDrvQt::toQColor(baseFont.color) ); + + //QStyleSheet::defaultSheet()->item("p")->setFontFamily("Symbol"); + + m_text_edit = new QTextEdit( text, QString::null, this ); + m_button_ok = new QPushButton( tr("OK"),this ); + m_button_cancel = new QPushButton( tr("Cancel"), this ); + layout->setMenuBar( m_menu ); + layout->addMultiCellWidget( m_toolbars_area, 0, 0, 0, 3 ); + layout->addMultiCellWidget( m_text_edit, 1, 1, 0, 3 ); + layout->addWidget( m_button_ok, 2, 1 ); + layout->addWidget( m_button_cancel, 2, 3 ); + layout->setColStretch( 0, 100 ); + layout->addRowSpacing( 2, 35 ); + layout->addColSpacing( 2, 10 ); + m_text_edit->setTextFormat( RichText ); + m_text_edit->setWordWrap( QTextEdit::NoWrap ); + //m_text_edit->setStyleSheet( sheet ); + + m_button_ok->setDefault ( FALSE ); + m_button_cancel->setDefault ( FALSE ); + connect( m_button_ok, SIGNAL(clicked()), this, SLOT(accept()) ); + connect( m_button_cancel, SIGNAL(clicked()), this, SLOT(reject()) ); + setup_actions(); + //m_text_edit->setCurrentFont( QSDrvQt::toQFont(baseFont,72.0) ); + //m_text_edit->setColor( QSDrvQt::toQColor(baseFont.color) ); + //m_text_edit->setFont( QSDrvQt::toQFont(baseFont) ); + //cout << " set font " << QSDrvQt::toQFont(baseFont).family() << endl; + } + +//---------------------------------------------------------------------------// + +void KSTextEditDlg::setup_actions() + { + QToolBar *file_toolbar = new QToolBar( "Text file toolbar", (QMainWindow *)qApp->mainWidget(), m_toolbars_area ); + file_toolbar->dock(); + file_toolbar->setMovingEnabled( FALSE ); + + QPopupMenu *file_menu = new QPopupMenu( this ); + m_menu->insertItem( tr("&File"), file_menu ); + + QAction *action_import = new QAction( tr("Import"), QPixmap(action_open), tr("&Import..."),CTRL+Key_I, this, "text_file_import" ); + connect( action_import, SIGNAL(activated()), this, SLOT(slotImport()) ); + action_import->addTo( file_toolbar ); + action_import->addTo( file_menu ); + + QAction *action_export = new QAction( tr("Export"), QPixmap(action_save), tr("&Export..."), CTRL + Key_E, this, "text_file_export" ); + connect( action_export, SIGNAL(activated()), this, SLOT(slotExport()) ); + action_export->addTo( file_toolbar ); + action_export->addTo( file_menu ); + + //-----------------------------------------------------------------------------------------------------------// + + QToolBar *edit_toolbar = new QToolBar( "Text edit toolbar", (QMainWindow *)qApp->mainWidget(), m_toolbars_area ); + edit_toolbar->dock(); + edit_toolbar->setMovingEnabled( FALSE ); + QPopupMenu *edit_menu = new QPopupMenu( this ); + m_menu->insertItem( tr("&Edit"), edit_menu ); + + QAction *action_edit_undo = new QAction( tr("Undo"), QPixmap(action_undo), tr("&Undo"), CTRL+Key_Z, this, "text_undo" ); + connect( action_edit_undo, SIGNAL(activated()), this, SLOT(slotUndo()) ); + action_edit_undo->addTo( edit_toolbar ); + action_edit_undo->addTo( edit_menu ); + + QAction *action_edit_redo = new QAction( tr("Redo"), QPixmap(action_redo), tr("&Redo"), CTRL+Key_Y, this, "text_redo" ); + connect( action_edit_redo, SIGNAL(activated()), this, SLOT(slotRedo()) ); + action_edit_redo->addTo( edit_toolbar ); + action_edit_redo->addTo( edit_menu ); + edit_menu->insertSeparator(); + + QAction *action_edit_copy = new QAction( tr("Copy"), QPixmap(action_copy), tr("&Copy"), CTRL+Key_C, this, "text_copy" ); + connect( action_edit_copy, SIGNAL( activated() ), this, SLOT(slotCopy()) ); + action_edit_copy->addTo( edit_toolbar ); + action_edit_copy->addTo( edit_menu ); + + QAction *action_edit_cut = new QAction( tr("Cut"), QPixmap(action_cut), tr("Cu&t"), CTRL+Key_X, this, "text_cut" ); + connect( action_edit_cut, SIGNAL(activated()), this, SLOT(slotCut()) ); + action_edit_cut->addTo( edit_toolbar ); + action_edit_cut->addTo( edit_menu ); + + QAction *action_edit_paste = new QAction( tr( "Paste" ), QPixmap(action_paste), tr("&Paste"), CTRL+Key_V, this, "text_paste" ); + connect( action_edit_paste, SIGNAL(activated()), this, SLOT(slotPaste()) ); + action_edit_paste->addTo( edit_toolbar ); + action_edit_paste->addTo( edit_menu ); + + //----------------------------------------------------------------------------------------------------------// + + QPopupMenu *format_menu = new QPopupMenu( this ); + m_menu->insertItem( tr("F&ormat"), format_menu ); + + QToolBar *format_toolbar = new QToolBar( "Format toolbar", (QMainWindow *)qApp->mainWidget(), m_toolbars_area ); + format_toolbar->dock(); + format_toolbar->setMovingEnabled( FALSE ); + + m_action_text_bold = new QAction( tr("Bold"), QPixmap(action_textbold), tr("&Bold"), CTRL+Key_B, this, "text_bold" ); + connect( m_action_text_bold, SIGNAL(activated()), this, SLOT(slotTextBold()) ); + m_action_text_bold->addTo( format_toolbar ); + m_action_text_bold->addTo( format_menu ); + m_action_text_bold->setToggleAction( TRUE ); + + m_action_text_italic = new QAction( tr("Italic"), QPixmap(action_textitalic), tr("&Italic"), CTRL+Key_I, this, "text_italic" ); + connect( m_action_text_italic, SIGNAL(activated()), this, SLOT(slotTextItalic()) ); + m_action_text_italic->addTo( format_toolbar ); + m_action_text_italic->addTo( format_menu ); + m_action_text_italic->setToggleAction( TRUE ); + + m_action_text_underline = new QAction( tr("Underline"), QPixmap(action_textunderline), tr("&Underline"), CTRL+Key_U, this, "text_underline" ); + connect( m_action_text_underline, SIGNAL( activated() ), this, SLOT(slotTextUnderline()) ); + m_action_text_underline->addTo( format_toolbar ); + m_action_text_underline->addTo( format_menu ); + m_action_text_underline->setToggleAction( TRUE ); + format_menu->insertSeparator(); + + + m_action_valign_sub = new QAction( tr("Subscript"), QPixmap(action_textsubscript), tr("Su&bscript"), CTRL+Key_B, this, "text_subscript" ); + connect( m_action_valign_sub, SIGNAL( activated() ), this, SLOT(slotTextVAlignSubScript()) ); + m_action_valign_sub->addTo( format_toolbar ); + m_action_valign_sub->addTo( format_menu ); + m_action_valign_sub->setToggleAction( TRUE ); + + m_action_valign_sup = new QAction( tr("Supscript"), QPixmap(action_textsuperscript), tr("Su&pscript"), CTRL+Key_P, this, "text_supscript" ); + connect( m_action_valign_sup, SIGNAL( activated() ), this, SLOT(slotTextVAlignSuperScript()) ); + m_action_valign_sup->addTo( format_toolbar ); + m_action_valign_sup->addTo( format_menu ); + m_action_valign_sup->setToggleAction( TRUE ); + + QActionGroup *align_group = new QActionGroup( this ); + align_group->setExclusive( TRUE ); + connect( align_group, SIGNAL(selected(QAction*)), this, SLOT(slotTextAlign(QAction*)) ); + + m_action_align_left = new QAction( tr("Left"), QPixmap(action_textleft), tr("&Left"), CTRL+Key_L, align_group, "text_left" ); + m_action_align_left->addTo( format_toolbar ); + m_action_align_left->addTo( format_menu ); + m_action_align_left->setToggleAction( TRUE ); + m_action_align_center = new QAction( tr("Center"), QPixmap(action_textcenter), tr("C&enter"), CTRL+Key_E, align_group, "text_center" ); + m_action_align_center->addTo( format_toolbar ); + m_action_align_center->addTo( format_menu ); + m_action_align_center->setToggleAction( TRUE ); + m_action_align_right = new QAction( tr("Right"), QPixmap(action_textright), tr("&Right"), CTRL+Key_R, align_group, "text_right" ); + m_action_align_right->addTo( format_toolbar ); + m_action_align_right->addTo( format_menu ); + m_action_align_right->setToggleAction( TRUE ); + m_action_align_justify = new QAction( tr("Justify"), QPixmap(action_textjustify), tr("&Justify"), CTRL+Key_J, align_group, "text_justify" ); + m_action_align_justify->addTo( format_toolbar ); + m_action_align_justify->addTo( format_menu ); + m_action_align_justify->setToggleAction( TRUE ); + + format_menu->insertSeparator(); + + m_action_text_color = new QAction( tr("Color"), QPixmap(action_textcolor), tr("&Color..."), 0, this, "text_color" ); + connect( m_action_text_color, SIGNAL(activated()), this, SLOT(slotTextColor()) ); + m_action_text_color->addTo( format_toolbar ); + m_action_text_color->addTo( format_menu ); + + //----------------------------------------------------------------------------------------------------------// + + QToolBar *font_toolbar = new QToolBar( "Format toolbar", (QMainWindow *)qApp->mainWidget(), m_toolbars_area ); + font_toolbar->dock(); + font_toolbar->setMovingEnabled( FALSE ); + m_combo_style = new QComboBox( FALSE, font_toolbar ); + m_combo_style->insertItem( "Standard" ); + m_combo_style->insertItem( "Bullet List (Disc)" ); + m_combo_style->insertItem( "Bullet List (Circle)" ); + m_combo_style->insertItem( "Bullet List (Square)" ); + m_combo_style->insertItem( "Ordered List (Decimal)" ); + m_combo_style->insertItem( "Ordered List (Alpha lower)" ); + m_combo_style->insertItem( "Ordered List (Alpha upper)" ); + connect( m_combo_style, SIGNAL(activated(int)), this, SLOT(slotTextStyle(int)) ); + + QFontDatabase font_list; + m_combo_font = new QComboBox( TRUE, font_toolbar ); + m_combo_font->insertStringList( font_list.families() ); + m_combo_font->lineEdit()->setText( QApplication::font().family() ); + connect( m_combo_font, SIGNAL(activated(const QString&)), this, SLOT(slotTextFamily(const QString &)) ); + + m_combo_size = new QComboBox( TRUE, font_toolbar ); + m_combo_size->lineEdit()->setText( QString::number(QApplication::font().pointSize()) ); + QValueList sizes = font_list.standardSizes(); + QValueList::Iterator it = sizes.begin(); + for ( ;it!=sizes.end();++it ) m_combo_size->insertItem( QString::number(*it) ); + connect( m_combo_size, SIGNAL(activated(const QString&)), this, SLOT(slotTextSize(const QString &)) ); + + QComboBox *m_combo_symbol = new QComboBox( TRUE, font_toolbar ); + //m_combo_symbol->setListBox( new QListBox(m_combo_symbol) ); + //m_combo_symbol->setEditable( FALSE ); + for ( int i='a';i<='z';i++) m_combo_symbol->insertItem( QChar((char )i) ); + for ( int i='A';i<='Z';i++) m_combo_symbol->insertItem( QChar((char )i) ); + m_combo_symbol->listBox()->setColumnMode( 10 ); + m_combo_symbol->listBox()->viewport()->setBackgroundMode( PaletteBase ); + m_combo_symbol->listBox()->setVScrollBarMode( QScrollView::AlwaysOff ); + m_combo_symbol->listBox()->setHScrollBarMode( QScrollView::AlwaysOff ); + m_combo_symbol->listBox()->setMinimumWidth( m_combo_symbol->listBox()->sizeHint().width()+10 ); + m_combo_symbol->listBox()->setMinimumHeight( m_combo_symbol->listBox()->sizeHint().height()+10 ); + m_combo_symbol->listBox()->setFont( QFont("Symbol",16) ); + m_combo_symbol->setFont( QFont("Symbol",16) ); + connect( m_combo_symbol, SIGNAL(activated(const QString&)), this, SLOT(slotTextSymbol(const QString &)) ); + +//---------------------------------------------------------------------------// + + connect( m_text_edit, SIGNAL(currentFontChanged(const QFont &)), this, SLOT(slot_font_changed(const QFont &)) ); + connect( m_text_edit, SIGNAL(currentAlignmentChanged(int)), this, SLOT(slot_alignment_changed(int)) ); + connect( m_text_edit, SIGNAL(currentVerticalAlignmentChanged(VerticalAlignment)), this, SLOT(slot_valignment_changed(VerticalAlignment)) ); + } + +//---------------------------------------------------------------------------// + +KSTextEditDlg::~KSTextEditDlg() + { + //delete file_toolbar; + } + +//---------------------------------------------------------------------------// + +QString KSTextEditDlg::text() const + { + return m_text_edit->text(); + } + +//---------------------------------------------------------------------------// + +void KSTextEditDlg::slotImport() +{ + QString file_name = QFileDialog::getOpenFileName( QString::null, tr( "HTML-Files (*.htm *.html);;All Files (*)" ), this ); + if ( !file_name.isEmpty() ) { + if ( !QFile::exists(file_name) ) { QMessageBox::critical( this, tr("Error"), tr("File does not exist !"), 0, 0 ); return; } + QFile file( file_name ); + if ( !file.open(IO_ReadOnly) ) { QMessageBox::critical( this, tr("Error"), tr("Can't open the file !"), 0, 0 ); return; } + QTextStream text_stream( &file ); + m_text_edit->setText( text_stream.read() ); + } +} + +//---------------------------------------------------------------------------// + +void KSTextEditDlg::slotExport() +{ + QString file_name = QFileDialog::getSaveFileName( QString::null, tr( "HTML-Files (*.htm *.html);;All Files (*)" ), this ); + if ( !file_name.isEmpty() ) { + QFile file( file_name ); + if ( !file.open(IO_WriteOnly) ) { QMessageBox::critical( this, tr("Error"), tr("Can't open the file !"), 0, 0 ); return; } + QTextStream text_stream( &file ); + text_stream << m_text_edit->text(); + } +} + + +//---------------------------------------------------------------------------// + +void KSTextEditDlg::slotUndo() +{ + m_text_edit->undo(); +} + +//---------------------------------------------------------------------------// + +void KSTextEditDlg::slotRedo() +{ + m_text_edit->redo(); +} + +//---------------------------------------------------------------------------// + +void KSTextEditDlg::slotCut() +{ + m_text_edit->cut(); +} + +//---------------------------------------------------------------------------// + +void KSTextEditDlg::slotCopy() +{ + m_text_edit->copy(); +} + +//---------------------------------------------------------------------------// + +void KSTextEditDlg::slotPaste() +{ + m_text_edit->paste(); +} + +//---------------------------------------------------------------------------// + +void KSTextEditDlg::slotTextBold() +{ + m_text_edit->setBold( m_action_text_bold->isOn() ); +} + +//---------------------------------------------------------------------------// + +void KSTextEditDlg::slotTextUnderline() +{ + m_text_edit->setUnderline( m_action_text_underline->isOn() ); +} + +//---------------------------------------------------------------------------// + +void KSTextEditDlg::slotTextItalic() +{ + m_text_edit->setItalic( m_action_text_italic->isOn() ); +} + +//---------------------------------------------------------------------------// + +void KSTextEditDlg::slotTextFamily( const QString &font ) +{ + m_text_edit->setFamily( font ); + m_text_edit->setFocus(); +} + +//---------------------------------------------------------------------------// + +void KSTextEditDlg::slotTextSize( const QString &size ) +{ + m_text_edit->setPointSize( size.toInt() ); + m_text_edit->setFocus(); +} + +//---------------------------------------------------------------------------// + +void KSTextEditDlg::slotTextStyle( int style ) +{ + if ( style == 0 ) m_text_edit->setParagType( QStyleSheetItem::DisplayBlock, QStyleSheetItem::ListDisc ); + else if ( style == 1 ) m_text_edit->setParagType( QStyleSheetItem::DisplayListItem, QStyleSheetItem::ListDisc ); + else if ( style == 2 ) m_text_edit->setParagType( QStyleSheetItem::DisplayListItem, QStyleSheetItem::ListCircle ); + else if ( style == 3 ) m_text_edit->setParagType( QStyleSheetItem::DisplayListItem, QStyleSheetItem::ListSquare ); + else if ( style == 4 ) m_text_edit->setParagType( QStyleSheetItem::DisplayListItem, QStyleSheetItem::ListDecimal ); + else if ( style == 5 ) m_text_edit->setParagType( QStyleSheetItem::DisplayListItem, QStyleSheetItem::ListLowerAlpha ); + else if ( style == 6 ) m_text_edit->setParagType( QStyleSheetItem::DisplayListItem, QStyleSheetItem::ListUpperAlpha ); + m_text_edit->setFocus(); +} + +//---------------------------------------------------------------------------// + +void KSTextEditDlg::slotTextColor() +{ + QColor col = QColorDialog::getColor( m_text_edit->color(), this ); + if ( col.isValid() ) { m_text_edit->setColor( col ); } +} + +//---------------------------------------------------------------------------// + +void KSTextEditDlg::slotTextAlign( QAction *action ) +{ + if ( action == m_action_align_left ) m_text_edit->setAlignment( AlignLeft ); + else if ( action == m_action_align_center ) m_text_edit->setAlignment( AlignHCenter ); + else if ( action == m_action_align_right ) m_text_edit->setAlignment( AlignRight ); + else if ( action == m_action_align_justify ) m_text_edit->setAlignment( AlignJustify ); +} + +//---------------------------------------------------------------------------// + +void KSTextEditDlg::slot_font_changed( const QFont &font ) +{ + m_combo_font->lineEdit()->setText( font.family() ); + m_combo_size->lineEdit()->setText( QString::number(font.pointSize()) ); + m_action_text_bold->setOn( font.bold() ); + m_action_text_italic->setOn( font.italic() ); + m_action_text_underline->setOn( font.underline() ); +} + +//---------------------------------------------------------------------------// + +void KSTextEditDlg::slot_alignment_changed( int align ) +{ + if ( ( align == AlignAuto ) || ( align & AlignLeft )) m_action_align_left->setOn( TRUE ); + else if ( ( align & AlignHCenter ) ) m_action_align_center->setOn( TRUE ); + else if ( ( align & AlignRight ) ) m_action_align_right->setOn( TRUE ); + else if ( ( align & AlignJustify ) ) m_action_align_justify->setOn( TRUE ); +} + +//---------------------------------------------------------------------------// + +void KSTextEditDlg::slotTextVAlignSubScript() +{ + if ( m_action_valign_sub->isOn() ) m_text_edit->setVerticalAlignment( QTextEdit::AlignSubScript ); + else m_text_edit->setVerticalAlignment( QTextEdit::AlignNormal ); +} + +//---------------------------------------------------------------------------// + +void KSTextEditDlg::slotTextVAlignSuperScript() +{ + if ( m_action_valign_sup->isOn() ) m_text_edit->setVerticalAlignment( QTextEdit::AlignSuperScript ); + else m_text_edit->setVerticalAlignment( QTextEdit::AlignNormal ); +} + +//---------------------------------------------------------------------------// + +void KSTextEditDlg::slot_valignment_changed( KSTextEditDlg::VerticalAlignment alignment ) +{ + m_action_valign_sub->setOn( alignment == QTextEdit::AlignSubScript ); + m_action_valign_sup->setOn( alignment == QTextEdit::AlignSuperScript ); +} + +//---------------------------------------------------------------------------// + +void KSTextEditDlg::slotTextSymbol(const QString &text ) + { + QString family = m_text_edit->family(); + m_text_edit->setFamily("Symbol"); + m_text_edit->insert(text); + m_text_edit->setFamily(family); + } \ No newline at end of file diff --git a/kmatplot/dialogs/kstextedit.h b/kmatplot/dialogs/kstextedit.h new file mode 100644 index 0000000..82af43f --- /dev/null +++ b/kmatplot/dialogs/kstextedit.h @@ -0,0 +1,123 @@ +/*************************************************************************** + kstextedit.h - description + ------------------- + begin : Fri Feb 15 2002 + copyright : (C) 2002 by kamil + email : kamil@localhost.localdomain + ***************************************************************************/ + +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + +#ifndef KSTEXTEDIT_H +#define KSTEXTEDIT_H + +#include +#include +#include +#include +#include +#include"../widgets/qsgattr.h" + +class QLineEdit; +class QPushButton; +class QTextEdit; +class QMenuBar; +class QDockArea; +class QAction; +class QComboBox; +class QFont; + +//----------------------------------------------------------------------------------------------// + +/** + *@author kamil + */ +class KSTextEdit : public QFrame { + Q_OBJECT +public: + KSTextEdit(QWidget *parent, const char *name=0 ); + virtual ~KSTextEdit(); + void setBaseFont( const QSGFont& baseFont ); + void setText( const QString& text ); + QString text() const { return m_text; } +signals: + void changed(); +protected: + QLineEdit *m_line; + QPushButton *m_button; + QString m_text; + QSGFont m_base_font; + +protected slots: + void show_dialog(); + void change_first_line(); +}; + +//----------------------------------------------------------------------------------------------// + +/** +` * Rich text edit dialog. + */ +class KSTextEditDlg : public QDialog { + Q_OBJECT +public: + KSTextEditDlg( QWidget *parent, const QString& text, const QSGFont& baseFont ); + virtual ~KSTextEditDlg(); + QString text() const; + +protected: + void setup_actions(); + QPushButton *m_button_ok; + QPushButton *m_button_cancel; + QTextEdit *m_text_edit; + QMenuBar *m_menu; + QDockArea *m_toolbars_area; + QAction *m_action_text_bold; + QAction *m_action_text_underline; + QAction *m_action_text_italic; + QAction *m_action_text_color; + QAction *m_action_align_left; + QAction *m_action_align_center; + QAction *m_action_align_right; + QAction *m_action_align_justify; + QAction *m_action_valign_sup; + QAction *m_action_valign_sub; + QComboBox *m_combo_style; + QComboBox *m_combo_font; + QComboBox *m_combo_size; + +private slots: + void slotImport(); + void slotExport(); + void slotUndo(); + void slotRedo(); + void slotCut(); + void slotCopy(); + void slotPaste(); + void slotTextBold(); + void slotTextUnderline(); + void slotTextItalic(); + void slotTextFamily( const QString &family ); + void slotTextSize( const QString &size ); + void slotTextStyle( int style ); + void slotTextColor(); + void slotTextAlign( QAction *action ); + void slotTextVAlignSubScript(); + void slotTextVAlignSuperScript(); + void slotTextSymbol(const QString &text ); + void slot_font_changed( const QFont &font ); + void slot_alignment_changed( int alignment ); + typedef QTextEdit::VerticalAlignment VerticalAlignment; + void slot_valignment_changed( VerticalAlignment ); + }; + +//----------------------------------------------------------------------------------------------// + +#endif diff --git a/kmatplot/dialogs/kswizarddlgs.cpp b/kmatplot/dialogs/kswizarddlgs.cpp new file mode 100644 index 0000000..86ab304 --- /dev/null +++ b/kmatplot/dialogs/kswizarddlgs.cpp @@ -0,0 +1,151 @@ +/*************************************************************************** + kswizarddlgs.cpp + ------------------- + begin : Wed Aug 15 2001 + copyright : (C) 2001 by kamil + email : kamil@localhost.localdomain + ***************************************************************************/ + +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + +#include"kswizarddlgs.h" +#include"../widgets/qssurface.h" +#include"../widgets/qscontour.h" +#include"../ksmatrix.h" +#include"../kscommands.h" + +#include +#include + + +//------------------------------------------------------------------------------------// + +KSWizardDlgSurface::KSWizardDlgSurface( QWidget *parent, KSWorkbook *workbook, KSSheet *sheet, QSAxes *axes, bool surface ) +:KSWizardDlgSurfaceInterf( parent, NULL, TRUE ) + { + m_sheet = sheet; + m_axes = axes; + m_surface = surface; + m_workbook = workbook; + if ( m_surface ) { + setCaption(tr("Surface wizard") ); + } else { + setCaption(tr("Contour wizard") ); + colorAreaUnder->setEnabled( false ); + } + } + +//------------------------------------------------------------------------------------// + +KSWizardDlgSurface::~KSWizardDlgSurface() + { + } + +//------------------------------------------------------------------------------------// + +//data->setDataObject( new_contour, QSGriddedContour::Data ); +// data->setRefObject( m_sheet, 0, +// rowFrom->value(), rowStep->value(), rowTo->value(), +// colFrom->value(), colStep->value(), colTo->value() ); +// data->setDataObject( new_surface, QSSurface::ZData ); +// data->setRefObject( m_sheet, 0, +// rowFrom->value(), rowStep->value(), rowTo->value(), +// colFrom->value(), colStep->value(), colTo->value() ); +// KSMatrixRef *data = new KSMatrixRef(); +void KSWizardDlgSurface::create() + { + // add contour + if ( colorAreaUnder->isChecked() || !m_surface ) { + QSContour *new_contour = new QSGriddedContour( m_axes ); + // data + KSMatrixWorksheetCellRange *data = new KSMatrixWorksheetCellRange( m_workbook ); + data->setWorksheet( m_workbook->sheets()->childIndex(m_sheet) ); + data->setRowFrom( rowFrom->value() ); + data->setRowStep( rowStep->value() ); + data->setRowTo( rowTo->value() ); + data->setColFrom( colFrom->value() ); + data->setColStep( colStep->value() ); + data->setColTo( colTo->value() ); + new_contour->setMatrix( QSGriddedContour::Data, data ); + + // x-vector + if ( isXVector->isChecked() ) { + KSMatrixWorksheetCellRange *x_vector = new KSMatrixWorksheetCellRange( m_workbook ); + x_vector->setWorksheet( m_workbook->sheets()->childIndex(m_sheet) ); + x_vector->setRowFrom( 0 ); + x_vector->setRowStep( 1 ); + x_vector->setRowTo( 0 ); + x_vector->setColFrom( colFrom->value() ); + x_vector->setColStep( colStep->value() ); + x_vector->setColTo( colTo->value() ); + new_contour->setMatrix( QSGriddedContour::XVector, x_vector ); + } + // y-vector + if ( isYVector->isChecked() ) { + KSMatrixWorksheetCellRange *y_vector = new KSMatrixWorksheetCellRange( m_workbook ); + y_vector->setWorksheet( m_workbook->sheets()->childIndex(m_sheet) ); + y_vector->setRowFrom( rowFrom->value() ); + y_vector->setRowStep( rowStep->value() ); + y_vector->setRowTo( rowTo->value() ); + y_vector->setColFrom( 0 ); + y_vector->setColStep( 1 ); + y_vector->setColTo( 0 ); + new_contour->setMatrix( QSGriddedContour::YVector, y_vector ); + } + // register plot + m_workbook->execute( new KSCmdAddDataset(new_contour) ); + if ( m_surface ) { new_contour->setContourLabels( false ); } + + } + + // add surface + if ( m_surface ) { + QSSurface *new_surface = new QSSurface( m_axes ); + // data + KSMatrixWorksheetCellRange *data = new KSMatrixWorksheetCellRange( m_workbook ); + data->setWorksheet( m_workbook->sheets()->childIndex(m_sheet) ); + data->setRowFrom( rowFrom->value() ); + data->setRowStep( rowStep->value() ); + data->setRowTo( rowTo->value() ); + data->setColFrom( colFrom->value() ); + data->setColStep( colStep->value() ); + data->setColTo( colTo->value() ); + new_surface->setMatrix( QSSurface::ZData, data ); + // x-vector + if ( isXVector->isChecked() ) { + KSMatrixWorksheetCellRange *x_vector = new KSMatrixWorksheetCellRange( m_workbook ); + x_vector->setWorksheet( m_workbook->sheets()->childIndex(m_sheet) ); + x_vector->setRowFrom( 0 ); + x_vector->setRowStep( 1 ); + x_vector->setRowTo( 0 ); + x_vector->setColFrom( colFrom->value() ); + x_vector->setColStep( colStep->value() ); + x_vector->setColTo( colTo->value() ); + new_surface->setMatrix( QSSurface::XVector, x_vector ); + } + // y-vector + if ( isYVector->isChecked() ) { + KSMatrixWorksheetCellRange *y_vector = new KSMatrixWorksheetCellRange( m_workbook ); + y_vector->setWorksheet( m_workbook->sheets()->childIndex(m_sheet) ); + y_vector->setRowFrom( rowFrom->value() ); + y_vector->setRowStep( rowStep->value() ); + y_vector->setRowTo( rowTo->value() ); + y_vector->setColFrom( 0 ); + y_vector->setColStep( 1 ); + y_vector->setColTo( 0 ); + new_surface->setMatrix( QSSurface::YVector, y_vector ); + } + // register plot + m_workbook->execute( new KSCmdAddDataset(new_surface) ); + } + accept(); + } + +//------------------------------------------------------------------------------------// diff --git a/kmatplot/dialogs/kswizarddlgs.h b/kmatplot/dialogs/kswizarddlgs.h new file mode 100644 index 0000000..f35deea --- /dev/null +++ b/kmatplot/dialogs/kswizarddlgs.h @@ -0,0 +1,47 @@ +/*************************************************************************** + kswizarddlgs.h + ------------------- + begin : Wed Aug 15 2001 + copyright : (C) 2001 by kamil + email : kamil@localhost.localdomain + ***************************************************************************/ + +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + +#ifndef KSWIZARDDLGS_H +#define KSWIZARDDLGS_H + +#ifdef HAVE_CONFIG_H +#include +#endif + +#include "kswizarddlgsurfaceinterf.h" +#include "../widgets/qsaxes.h" +#include "../ksworkbook.h" +#include "../ksglobalmatrixlist.h" + +class KSWizardDlgSurface : public KSWizardDlgSurfaceInterf + { + Q_OBJECT + public: + KSWizardDlgSurface( QWidget *parent, KSWorkbook *workbook, KSSheet *sheet, QSAxes *parent, bool surface = true ); + ~KSWizardDlgSurface(); + + public slots: + virtual void create(); + + private: + bool m_surface; + QSAxes *m_axes; + KSSheet *m_sheet; + KSWorkbook *m_workbook; + }; + +#endif diff --git a/kmatplot/dialogs/kswizarddlgsurfaceinterf.cpp b/kmatplot/dialogs/kswizarddlgsurfaceinterf.cpp new file mode 100644 index 0000000..9f3660b --- /dev/null +++ b/kmatplot/dialogs/kswizarddlgsurfaceinterf.cpp @@ -0,0 +1,146 @@ +/**************************************************************************** +** Form implementation generated from reading ui file './kswizarddlgsurfaceinterf.ui' +** +** Created: śro mar 20 18:53:23 2002 +** by: The User Interface Compiler (uic) +** +** WARNING! All changes made in this file will be lost! +****************************************************************************/ +#include "kswizarddlgsurfaceinterf.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +/* + * Constructs a KSWizardDlgSurfaceInterf which is a child of 'parent', with the + * name 'name' and widget flags set to 'f'. + * + * The dialog will by default be modeless, unless you set 'modal' to + * TRUE to construct a modal dialog. + */ +KSWizardDlgSurfaceInterf::KSWizardDlgSurfaceInterf( QWidget* parent, const char* name, bool modal, WFlags fl ) + : QDialog( parent, name, modal, fl ) +{ + if ( !name ) + setName( "KSWizardDlgSurfaceInterf" ); + resize( 325, 304 ); + setCaption( trUtf8( "KSSurfaceWizardDlgInterf" ) ); + + GroupBox5 = new QGroupBox( this, "GroupBox5" ); + GroupBox5->setGeometry( QRect( 5, 5, 315, 100 ) ); + GroupBox5->setTitle( trUtf8( "Range" ) ); + + TextLabel1 = new QLabel( GroupBox5, "TextLabel1" ); + TextLabel1->setGeometry( QRect( 125, 20, 60, 16 ) ); + TextLabel1->setText( trUtf8( "From:" ) ); + + TextLabel2 = new QLabel( GroupBox5, "TextLabel2" ); + TextLabel2->setGeometry( QRect( 190, 20, 45, 16 ) ); + TextLabel2->setText( trUtf8( "Step:" ) ); + + TextLabel3 = new QLabel( GroupBox5, "TextLabel3" ); + TextLabel3->setGeometry( QRect( 240, 20, 50, 16 ) ); + TextLabel3->setText( trUtf8( "To:" ) ); + + TextLabel5 = new QLabel( GroupBox5, "TextLabel5" ); + TextLabel5->setGeometry( QRect( 45, 66, 75, 20 ) ); + TextLabel5->setText( trUtf8( "Columns" ) ); + + TextLabel4 = new QLabel( GroupBox5, "TextLabel4" ); + TextLabel4->setGeometry( QRect( 45, 40, 75, 20 ) ); + TextLabel4->setText( trUtf8( "Rows" ) ); + + rowFrom = new QSpinBox( GroupBox5, "rowFrom" ); + rowFrom->setGeometry( QRect( 120, 40, 65, 22 ) ); + rowFrom->setMaxValue( 999999999 ); + rowFrom->setMinValue( -1 ); + rowFrom->setValue( 1 ); + + colFrom = new QSpinBox( GroupBox5, "colFrom" ); + colFrom->setGeometry( QRect( 120, 65, 65, 22 ) ); + colFrom->setMaxValue( 999999999 ); + colFrom->setMinValue( -1 ); + colFrom->setValue( 1 ); + + rowTo = new QSpinBox( GroupBox5, "rowTo" ); + rowTo->setGeometry( QRect( 235, 40, 65, 22 ) ); + rowTo->setMaxValue( 999999999 ); + rowTo->setMinValue( -1 ); + rowTo->setValue( -1 ); + + colTo = new QSpinBox( GroupBox5, "colTo" ); + colTo->setGeometry( QRect( 235, 65, 65, 22 ) ); + colTo->setMaxValue( 999999999 ); + colTo->setMinValue( -1 ); + colTo->setValue( -1 ); + + colStep = new QSpinBox( GroupBox5, "colStep" ); + colStep->setGeometry( QRect( 185, 65, 50, 22 ) ); + colStep->setMaxValue( 999999999 ); + colStep->setMinValue( 1 ); + colStep->setValue( 1 ); + + rowStep = new QSpinBox( GroupBox5, "rowStep" ); + rowStep->setGeometry( QRect( 185, 40, 50, 22 ) ); + rowStep->setMaxValue( 999999999 ); + rowStep->setMinValue( 1 ); + rowStep->setValue( 1 ); + + GroupBox2 = new QGroupBox( this, "GroupBox2" ); + GroupBox2->setGeometry( QRect( 5, 110, 315, 81 ) ); + GroupBox2->setTitle( trUtf8( "X/Y index" ) ); + + isYVector = new QCheckBox( GroupBox2, "isYVector" ); + isYVector->setGeometry( QRect( 25, 50, 200, 18 ) ); + isYVector->setText( trUtf8( "First row contains Y vector" ) ); + isYVector->setChecked( TRUE ); + + isXVector = new QCheckBox( GroupBox2, "isXVector" ); + isXVector->setGeometry( QRect( 25, 25, 200, 18 ) ); + isXVector->setText( trUtf8( "First column contains X vector" ) ); + isXVector->setChecked( TRUE ); + + GroupBox1 = new QGroupBox( this, "GroupBox1" ); + GroupBox1->setGeometry( QRect( 5, 200, 315, 60 ) ); + GroupBox1->setTitle( trUtf8( "Surface options" ) ); + + colorAreaUnder = new QCheckBox( GroupBox1, "colorAreaUnder" ); + colorAreaUnder->setGeometry( QRect( 25, 30, 200, 18 ) ); + colorAreaUnder->setText( trUtf8( "Color area under the surface" ) ); + + buttonCreate = new QPushButton( this, "buttonCreate" ); + buttonCreate->setGeometry( QRect( 125, 270, 94, 30 ) ); + buttonCreate->setText( trUtf8( "Create" ) ); + buttonCreate->setDefault( TRUE ); + + buttonCancel = new QPushButton( this, "buttonCancel" ); + buttonCancel->setGeometry( QRect( 225, 270, 94, 30 ) ); + buttonCancel->setText( trUtf8( "Cancel" ) ); + buttonCancel->setAutoDefault( FALSE ); + + // signals and slots connections + connect( buttonCancel, SIGNAL( clicked() ), this, SLOT( reject() ) ); + connect( buttonCreate, SIGNAL( clicked() ), this, SLOT( create() ) ); +} + +/* + * Destroys the object and frees any allocated resources + */ +KSWizardDlgSurfaceInterf::~KSWizardDlgSurfaceInterf() +{ + // no need to delete child widgets, Qt does it all for us +} + +void KSWizardDlgSurfaceInterf::create() +{ + qWarning( "KSWizardDlgSurfaceInterf::create(): Not implemented yet!" ); +} + +#include "kswizarddlgsurfaceinterf.moc" diff --git a/kmatplot/dialogs/kswizarddlgsurfaceinterf.ui b/kmatplot/dialogs/kswizarddlgsurfaceinterf.ui new file mode 100644 index 0000000..22d5ca8 --- /dev/null +++ b/kmatplot/dialogs/kswizarddlgsurfaceinterf.ui @@ -0,0 +1,482 @@ + +KSWizardDlgSurfaceInterf + + QDialog + + name + KSWizardDlgSurfaceInterf + + + geometry + + 0 + 0 + 325 + 304 + + + + caption + KSSurfaceWizardDlgInterf + + + QGroupBox + + name + GroupBox5 + + + geometry + + 5 + 5 + 315 + 100 + + + + title + Range + + + QLabel + + name + TextLabel1 + + + geometry + + 125 + 20 + 60 + 16 + + + + text + From: + + + + QLabel + + name + TextLabel2 + + + geometry + + 190 + 20 + 45 + 16 + + + + text + Step: + + + + QLabel + + name + TextLabel3 + + + geometry + + 240 + 20 + 50 + 16 + + + + text + To: + + + + QLabel + + name + TextLabel5 + + + geometry + + 45 + 66 + 75 + 20 + + + + text + Columns + + + + QLabel + + name + TextLabel4 + + + geometry + + 45 + 40 + 75 + 20 + + + + text + Rows + + + + QSpinBox + + name + rowFrom + + + geometry + + 120 + 40 + 65 + 22 + + + + maxValue + 999999999 + + + minValue + -1 + + + value + 1 + + + + QSpinBox + + name + colFrom + + + geometry + + 120 + 65 + 65 + 22 + + + + maxValue + 999999999 + + + minValue + -1 + + + value + 1 + + + + QSpinBox + + name + rowTo + + + geometry + + 235 + 40 + 65 + 22 + + + + maxValue + 999999999 + + + minValue + -1 + + + value + -1 + + + + QSpinBox + + name + colTo + + + geometry + + 235 + 65 + 65 + 22 + + + + maxValue + 999999999 + + + minValue + -1 + + + value + -1 + + + + QSpinBox + + name + colStep + + + geometry + + 185 + 65 + 50 + 22 + + + + maxValue + 999999999 + + + minValue + 1 + + + value + 1 + + + + QSpinBox + + name + rowStep + + + geometry + + 185 + 40 + 50 + 22 + + + + maxValue + 999999999 + + + minValue + 1 + + + value + 1 + + + + + QGroupBox + + name + GroupBox2 + + + geometry + + 5 + 110 + 315 + 81 + + + + title + X/Y index + + + QCheckBox + + name + isYVector + + + geometry + + 25 + 50 + 200 + 18 + + + + text + First row contains Y vector + + + checked + true + + + + QCheckBox + + name + isXVector + + + geometry + + 25 + 25 + 200 + 18 + + + + text + First column contains X vector + + + checked + true + + + + + QGroupBox + + name + GroupBox1 + + + geometry + + 5 + 200 + 315 + 60 + + + + title + Surface options + + + QCheckBox + + name + colorAreaUnder + + + geometry + + 25 + 30 + 200 + 18 + + + + text + Color area under the surface + + + + + QPushButton + + name + buttonCreate + + + geometry + + 125 + 270 + 94 + 30 + + + + text + Create + + + default + true + + + + QPushButton + + name + buttonCancel + + + geometry + + 225 + 270 + 94 + 30 + + + + text + Cancel + + + autoDefault + false + + + + + + buttonCancel + clicked() + KSWizardDlgSurfaceInterf + reject() + + + buttonCreate + clicked() + KSWizardDlgSurfaceInterf + create() + + create() + + diff --git a/kmatplot/dialogs/templates/KSMPanel.ui b/kmatplot/dialogs/templates/KSMPanel.ui new file mode 100644 index 0000000..40664b1 --- /dev/null +++ b/kmatplot/dialogs/templates/KSMPanel.ui @@ -0,0 +1,16 @@ + + +KSMPanel + + name + KSMPanelForm + + + geometry + + 300 + 400 + + + + diff --git a/kmatplot/dialogs/templates/KSPanel.ui b/kmatplot/dialogs/templates/KSPanel.ui new file mode 100644 index 0000000..ffb9612 --- /dev/null +++ b/kmatplot/dialogs/templates/KSPanel.ui @@ -0,0 +1,16 @@ + + +KSPanel + + name + KSPanelForm + + + geometry + + 500 + 130 + + + + diff --git a/kmatplot/dialogs/templates/Makefile.am b/kmatplot/dialogs/templates/Makefile.am new file mode 100644 index 0000000..7bfbb1e --- /dev/null +++ b/kmatplot/dialogs/templates/Makefile.am @@ -0,0 +1,2 @@ +EXTRA_DIST = kmatplot_widgets.cw kspanel.png KSPanel.ui KSMPanel.ui + diff --git a/kmatplot/dialogs/templates/kmatplot_widgets.cw b/kmatplot/dialogs/templates/kmatplot_widgets.cw new file mode 100644 index 0000000..1bc2a03 --- /dev/null +++ b/kmatplot/dialogs/templates/kmatplot_widgets.cw @@ -0,0 +1,148 @@ + + + + KSFillBtn +
ksattrbtn.h
+ + -1 + 22 + + 0 + + 5 + 5 + + + 789ca5ceb10ac23010c6f13d4f71245b90f48a6805f1111447411c9254d1a10a5a0711dfddbba669822e827f0acdf72b84161a36eb25e842dc5adb9e3cf8a3bd82aeef4df3d8ee164f21cb29d03381528e8434e0617539eff9ace8ac10ab1a91a7e75939c4302dcfd9387e753c0f5498a64f71f4ce4ca91e93a9d80f66bfcd3a3b98ef22728cb931119acc02310e168930592abb8febfee06ffb48bee6e20df819667e + +
+ + KSPanel +
kspanel.h
+ + 500 + 140 + + 1 + + 0 + 0 + + + 789cd3d7528808f055d0d2e72a2e492cc94c5648ce482c52d04a29cdcdad8c8eb5ade65232540043251d2e253d856405e554300073956aadb900494e10c6 + +
+ + KSChannelList +
kschannellist.h
+ + -1 + -1 + + 0 + + 5 + 5 + + + 789c6dd2c10ac2300c00d07bbf2234b7229d1be245fc04c5a3201e4615f430059d0711ff5ddb2e6bb236ec90eed134cb5a19d8ef36602af5ecdbfeeac05dda0798d3abebde87e3faa374d3807fa0d633a52d38d8de6f679fe33fc776e196f53cd010188256a3600a292882096246517815ca99884606e18044a3a40d91824820924265a7923a2e8bcd05f33db1173e002913175f2a6be6d3294871a2d95fa00e8a94ee017b69d339d90df1e77c57ea072ede6758 + +
+ + KSMPanel +
ksmpanel.h
+ + 500 + 140 + + 1 + + 0 + 0 + + + 789cd3d7528808f055d0d2e72a2e492cc94c5648ce482c52d04a29cdcdad8c8eb5ade65232540043251d2e253d856405e554300073956aadb900494e10c6 + +
+ + KSFontBtn +
ksattrbtn.h
+ + -1 + 22 + + 0 + + 5 + 5 + + + 789cd3d7528808f055d0d2e72a2e492cc94c5648ce482c52d04a29cdcdad8c8eb5ade6523232520022630543251d2e253d856405bffcbc54105b19c856360003103711c44d0303b04aac80721965651c32ca8989ca24ca002590a4506594b1cb002590cd234646192c8690429101014c19b0c32040195d46591945134c46196e334c8aa00cc2fb70164c060cf49059b48c5314995a6b2e00c5aa7ebc + +
+ + KSLineBtn +
ksattrbtn.h
+ + -1 + 22 + + 0 + + 5 + 5 + + + 789cd3d7528808f055d0d2e72a2e492cc94c5648ce482c52d04a29cdcdad8c8eb5ade6523234530022630543251d2e253d856405bffcbc54103b11c8564e3449344c3401719541dcb434032000ab440338c59481004d4c5919551022a6a7872c08370f9b1892207e31842001b14488a0b232b23fb089e9411d8a2606f6106a1840fc88355c6aadb9009dd649aa + +
+ + KSArrowBtn +
ksattrbtn.h
+ + -1 + 22 + + 0 + + 5 + 5 + + + 789c75d0c10a82401006e0bb4f313837094d3124a247283a06d161662bea6041d921a2776f67db44d7f1670ffbefc7ae835902dbcd0a922c7a34d45c0c9833dd21393cebfab5db2fdf515c1460d70cf27812c5291858dfae47d9a3dde3d445aa915a7135af582a4ba592722aa592d4938b7b474d28e8a30849581147ac8a251e131e112444552c708a66280e64f6503ca42907d242f80f7ad0953e7424809fa0024ee47000fe0e0dc17f4781ff04a377346aa7c691d794c49f45f4052a748685 + +
+ + KSPointBtn +
ksattrbtn.h
+ + -1 + 22 + + 0 + + 5 + 5 + + + 789cd3d7528808f055d0d2e72a2e492cc94c5648ce482c52d04a29cdcdad8c8eb5ade6523234530022630543251d2e253d856405bffcbc54105b19c856360003103711c44d0303b04a34408c98b2b232ba98726262a2324962ca20538002c8e641059491ed8588296311435387300f451d6562ca308bb1864bad3517007a684bc0 + +
+ + KSTextEdit +
kstextedit.h
+ + -1 + -1 + + 0 + + 5 + 5 + + + 789cd3d7528808f055d0d2e72a2e492cc94c5648ce482c52d04a29cdcdad8c8eb5ade6523234530022630543251d2e253d856405bffcbc54105b19c856360003103711c44d490541b04a34805b4c593911ca0731d0c49413812cfc7a95c18a9561ea4022890802530caa5719a40fac17490c9b3a9ce6a1da4bb47f8910abb5e602003a1250e8 + +
+
+
diff --git a/kmatplot/dialogs/templates/kspanel.png b/kmatplot/dialogs/templates/kspanel.png new file mode 100644 index 0000000000000000000000000000000000000000..c5a4ef186652cf332f42645b56c29e0dfcec4946 GIT binary patch literal 179 zcmeAS@N?(olHy`uVBq!ia0vp^j3CUy3?$!L-`oYHSkfJR9T^xl_H+M9WCikt0(?ST z|APULw_w2nAoK0px8m{#&jb04B|(0{3=Yq3q=7g|-tI089jvk*Kn`btM`SSr12-QC zGdk>h2sD&|y~NYkmHiSUvpBET>F&u}fI?iJE{-7;bCNlL>>!4~?}|6K16d57u6{1- HoD!M + + + + + + + + + + + + + + + + + + + + + + + + + + + + + <line element-number='0' style='solid' width='0' color='ff000000'/> + <line element-number='1' style='invisible' width='0' color='ff000000'/> + <line element-number='2' style='invisible' width='0' color='ff000000'/> + <font element-number='0' family='helvetica' size='10' bold='0' italic='0' color='ff000000'/> + <font element-number='1' family='helvetica' size='10' bold='0' italic='0' color='ff000000'/> + <matrix-string title='' rows='1' cols='4' data-channel='0'> + <e row='0' col='0' string='6'/> + <e row='0' col='1' string='Custom tic mark on the X axis at (TIC)'/> + <e row='0' col='3' string='-45'/> + </matrix-string> + <matrix-string title='' rows='1' cols='5' data-channel='2'> + <e row='0' col='0' string='times'/> + <e row='0' col='1' string='18'/> + <e row='0' col='4' string='255'/> + </matrix-string> + </axis> + <axis type='Y' visible='1' scrollable='1'> + <dart element-number='1' style='none' size='3' /> + <dart element-number='2' style='none' size='3' /> + <display position='0' default='1' opposite='0' /> + <range min='0' max='0' rounded='0'/> + <scale type='linear' base='10' reversed='0'/> + <grid-step major='-4' minor='-20'/> + <tics format='(TIC)' visible='1' outer='0' angle='0' pos1='0.01' pos2='0.01'/> + <title-position pos='0.5' distance='0.05'/> + <remembered-view number='0' min='0' max='0' scale='linear' base='10' reversed='0' rounded='0'/> + <remembered-view number='1' min='0' max='0' scale='linear' base='10' reversed='0' rounded='0'/> + <remembered-view number='2' min='0' max='0' scale='linear' base='10' reversed='0' rounded='0'/> + <title text='Y'/> + <line element-number='0' style='solid' width='0' color='ff000000'/> + <line element-number='1' style='invisible' width='0' color='ff000000'/> + <line element-number='2' style='invisible' width='0' color='ff000000'/> + <font element-number='0' family='helvetica' size='10' bold='0' italic='0' color='ff000000'/> + <font element-number='1' family='helvetica' size='10' bold='0' italic='0' color='ff000000'/> + </axis> + <axis type='Z' visible='1' scrollable='1'> + <dart element-number='1' style='none' size='3' /> + <dart element-number='2' style='none' size='3' /> + <display position='0' default='1' opposite='0' /> + <range min='0' max='0' rounded='0'/> + <scale type='linear' base='10' reversed='0'/> + <grid-step major='-4' minor='-20'/> + <tics format='(TIC)' visible='1' outer='0' angle='0' pos1='0.01' pos2='0.01'/> + <title-position pos='0.5' distance='0.05'/> + <remembered-view number='0' min='0' max='0' scale='linear' base='10' reversed='0' rounded='0'/> + <remembered-view number='1' min='0' max='0' scale='linear' base='10' reversed='0' rounded='0'/> + <remembered-view number='2' min='0' max='0' scale='linear' base='10' reversed='0' rounded='0'/> + <title text='Z'/> + <line element-number='0' style='solid' width='0' color='ff000000'/> + <line element-number='1' style='invisible' width='0' color='ff000000'/> + <line element-number='2' style='invisible' width='0' color='ff000000'/> + <font element-number='0' family='helvetica' size='10' bold='0' italic='0' color='ff000000'/> + <font element-number='1' family='helvetica' size='10' bold='0' italic='0' color='ff000000'/> + </axis> + <axis type='V' visible='1' scrollable='1'> + <dart element-number='1' style='none' size='3' /> + <dart element-number='2' style='none' size='3' /> + <display position='0' default='1' opposite='0' /> + <range min='10' max='110' rounded='0'/> + <scale type='linear' base='10' reversed='0'/> + <grid-step major='-4' minor='0'/> + <tics format='(TIC)' visible='0' outer='0' angle='0' pos1='0.01' pos2='0.01'/> + <title-position pos='0.5' distance='0.05'/> + <remembered-view number='0' min='0' max='0' scale='linear' base='10' reversed='0' rounded='0'/> + <remembered-view number='1' min='0' max='0' scale='linear' base='10' reversed='0' rounded='0'/> + <remembered-view number='2' min='0' max='0' scale='linear' base='10' reversed='0' rounded='0'/> + <title text='V'/> + <line element-number='0' style='solid' width='0' color='ff000000'/> + <line element-number='1' style='solid' width='0' color='ff000000'/> + <line element-number='2' style='invisible' width='0' color='ff000000'/> + <font element-number='0' family='helvetica' size='10' bold='0' italic='0' color='ff000000'/> + <font element-number='1' family='helvetica' size='12' bold='1' italic='0' color='ff000000'/> + <matrix-string title='' rows='1' cols='4' data-channel='0'> + <e row='0' col='0' string='31'/> + <e row='0' col='1' string='Custom tic mark on the V axis'/> + <e row='0' col='2' string='1'/> + <e row='0' col='3' string='0'/> + </matrix-string> + <matrix-string title='' rows='1' cols='6' data-channel='1'> + <e row='0' col='0' string='1'/> + <e row='0' col='1' string='3'/> + <e row='0' col='2' string='255'/> + </matrix-string> + <matrix-string title='' rows='1' cols='7' data-channel='2'> + <e row='0' col='0' string='times'/> + <e row='0' col='1' string='18'/> + <e row='0' col='2' string='0'/> + <e row='0' col='3' string='1'/> + <e row='0' col='4' string='255'/> + </matrix-string> + <matrix-string title='' rows='1' cols='6' data-channel='3'> + <e row='0' col='0' string='0'/> + <e row='0' col='1' string='255'/> + </matrix-string> + </axis> + <title text=''/> + <fill element-number='0' style='transparent' color='ff000000'/> + <fill element-number='1' style='solid' color='ff000000'/> + <gridded-contour stack-order='0'> + <legend-item visible='1'/> + <default-axis x-axis='0' y-axis='1' z-axis='2' v-axis='3'/> + <gradient type='gray'> + <fill element-number='0' style='solid' color='ff808080'/> + <fill element-number='1' style='solid' color='ffffffff'/> + <fill element-number='2' style='solid' color='ffffffff'/> + <fill element-number='3' style='solid' color='ffffffff'/> + <fill element-number='4' style='solid' color='fff0f0f0'/> + </gradient> + <filled enabled='1'/> + <lines enabled='1'/> + <labels enabled='1' spacing='0.2'/> + <title text='Untitled contour'/> + <line element-number='0' style='invisible' width='0' color='ff000000'/> + <point element-number='0' style='invisible' fill='transparent' size='9' color='ff000000'/> + <matrix-formula title='' formula='0:1:10' transposition='0' data-channel='0'/> + <matrix-formula title='' formula='(0:1:10)'' transposition='0' data-channel='1'/> + <matrix-formula title='' formula='x*y' transposition='0' data-channel='2'/> + </gridded-contour> + </axes2d> + <label> + <text><p><b><u><font size="3" style="font-size:14pt">Custom contour levels</font></u></b></p> <p>Contour levels are tic marks on<wsp> </wsp>the "virtual" V axis.</p> <p>Unfortunately there is no level editor, which would help to edit</p> <p>them, so you will have to do everything by hand.</p> <p>1. Select the graph and next select<wsp> </wsp>the V axis on the property panel, </p> <p><wsp> </wsp>usually placed at the bottom.</p> <p>2. Choose<b><font size="3" style="font-size:12pt"> Windows/New window/Current dataset.</font></b></p> <p>3.<wsp> </wsp>Select channel<i><font size="3" style="font-size:12pt"> "0. Tic marks"</font></i><wsp> </wsp>and choose </p> <p><b><font size="3" style="font-size:12pt"><wsp> </wsp>Workseet/New matrix/String matrix</font></b> from the main menu.<wsp> </wsp></p> <p>4. Change rows to 1, columns to 2 and click Apply button</p> <p>5. In the first column (value) write 25, and in the second ( format ) write </p> <p><wsp> </wsp>"New level"</p> <p>6. Leave the edit field.</p> <p>7. The new level should appear.<wsp> </wsp></p> </text> + <angle deg='0'/> + <align text='9' frame='9'/> + <pos x='15.0994' y='170.076' z='0'/> + <coord-system x='1' y='1' z='1'/> + <shadow-shift x='5' y='5'/> + <font element-number='1' family='helvetica' size='10' bold='0' italic='0' color='ff000000'/> + <fill element-number='1' style='transparent' color='ffffffff'/> + <line element-number='1' style='invisible' width='0' color='ff000000'/> + <fill element-number='2' style='transparent' color='ff000000'/> + <axes-bindings x-axis='-1' y-axis='-1' z-axis='-1'/> + </label> + </page> + </canvas> +</kmatplot> diff --git a/kmatplot/examples/path3d.kmp b/kmatplot/examples/path3d.kmp new file mode 100644 index 0000000..f8304d4 --- /dev/null +++ b/kmatplot/examples/path3d.kmp @@ -0,0 +1,267 @@ +<?xml version='1.0' encoding='UTF-8'?> +<!DOCTYPE kmatplot> +<kmatplot mime='application/x-kmatplot' editor='KMatplot' version='0.3' url='http://kmatplot.sourceforge.net' program-author='K. Dobkowski'> + <canvas page-size='A4' orientation='Portrait' dpi='72'> + <sheets number='1'> + <sheet number='0' name='t_params'> + <matrix title='t_params' rows='100' cols='3' element-type='double' data-channel='0'> + <row>0 0.0950252374 0 </row> + <row>0.2 0.102012825 0.01 </row> + <row>0.4 0.0347660015 0.02 </row> + <row>0.6 0.118106217 0.03 </row> + <row>0.8 0.10410806 0.04 </row> + <row>1 0.0931953418 0.05 </row> + <row>1.2 0.121959648 0.06 </row> + <row>1.4 0.0981059412 0.07 </row> + <row>1.6 0.15860021 0.08 </row> + <row>1.8 0.120745787 0.09 </row> + <row>2 0.144703358 0.1 </row> + <row>2.2 0.132610663 0.11 </row> + <row>2.4 0.138753311 0.12 </row> + <row>2.6 0.157623467 0.13 </row> + <row>2.8 0.195644376 0.14 </row> + <row>3 0.191650128 0.15 </row> + <row>3.2 0.176960709 0.16 </row> + <row>3.4 0.260680393 0.17 </row> + <row>3.6 0.190317119 0.18 </row> + <row>3.8 0.202607534 0.19 </row> + <row>4 0.249544407 0.2 </row> + <row>4.2 0.286047523 0.21 </row> + <row>4.4 0.318475166 0.22 </row> + <row>4.6 0.323500399 0.23 </row> + <row>4.8 0.308444502 0.24 </row> + <row>5 0.288318833 0.25 </row> + <row>5.2 0.334977088 0.26 </row> + <row>5.4 0.306866354 0.27 </row> + <row>5.6 0.309416036 0.28 </row> + <row>5.8 0.313226154 0.29 </row> + <row>6 0.35844885 0.3 </row> + <row>6.2 0.334441274 0.31 </row> + <row>6.4 0.335238979 0.32 </row> + <row>6.6 0.403214852 0.33 </row> + <row>6.8 0.35254749 0.34 </row> + <row>7 0.429347039 0.35 </row> + <row>7.2 0.376410193 0.36 </row> + <row>7.4 0.444507139 0.37 </row> + <row>7.6 0.38745298 0.38 </row> + <row>7.8 0.485010403 0.39 </row> + <row>8 0.405252926 0.4 </row> + <row>8.2 0.462156338 0.41 </row> + <row>8.4 0.437621066 0.42 </row> + <row>8.6 0.454006237 0.43 </row> + <row>8.8 0.519779805 0.44 </row> + <row>9 0.523265441 0.45 </row> + <row>9.2 0.525656365 0.46 </row> + <row>9.4 0.566740514 0.47 </row> + <row>9.6 0.543945835 0.48 </row> + <row>9.8 0.565973484 0.49 </row> + <row>10 0.509348048 0.5 </row> + <row>10.2 0.523490241 0.51 </row> + <row>10.4 0.572021007 0.52 </row> + <row>10.6 0.537823214 0.53 </row> + <row>10.8 0.54699064 0.54 </row> + <row>11 0.570465509 0.55 </row> + <row>11.2 0.606142047 0.56 </row> + <row>11.4 0.651967728 0.57 </row> + <row>11.6 0.637331863 0.58 </row> + <row>11.8 0.665558084 0.59 </row> + <row>12 0.605193882 0.6 </row> + <row>12.2 0.625780713 0.61 </row> + <row>12.4 0.719999357 0.62 </row> + <row>12.6 0.650432861 0.63 </row> + <row>12.8 0.728995564 0.64 </row> + <row>13 0.662546848 0.65 </row> + <row>13.2 0.7597799 0.66 </row> + <row>13.4 0.675405758 0.67 </row> + <row>13.6 0.767053986 0.68 </row> + <row>13.8 0.69723288 0.69 </row> + <row>14 0.700416161 0.7 </row> + <row>14.2 0.802306913 0.71 </row> + <row>14.4 0.779389218 0.72 </row> + <row>14.6 0.748037227 0.73 </row> + <row>14.8 0.75631315 0.74 </row> + <row>15 0.789169023 0.75 </row> + <row>15.2 0.851302668 0.76 </row> + <row>15.4 0.851969515 0.77 </row> + <row>15.6 0.815909537 0.78 </row> + <row>15.8 0.845248502 0.79 </row> + <row>16 0.857942999 0.8 </row> + <row>16.2 0.855257585 0.81 </row> + <row>16.4 0.888738743 0.82 </row> + <row>16.6 0.839964006 0.83 </row> + <row>16.8 0.893080799 0.84 </row> + <row>17 0.925729383 0.85 </row> + <row>17.2 0.890429515 0.86 </row> + <row>17.4 0.969222846 0.87 </row> + <row>17.6 0.937697111 0.88 </row> + <row>17.8 0.977761378 0.89 </row> + <row>18 0.97478093 0.9 </row> + <row>18.2 0.972890993 0.91 </row> + <row>18.4 0.923542091 0.92 </row> + <row>18.6 1.00478029 0.93 </row> + <row>18.8 1.02332385 0.94 </row> + <row>19 1.04253766 0.95 </row> + <row>19.2 1.04732713 0.96 </row> + <row>19.4 1.05310375 0.97 </row> + <row>19.6 1.07794341 0.98 </row> + <row>19.8 1.06438112 0.99 </row> + </matrix> + </sheet> + </sheets> + <page number='0' title='Page 1'> + <axes3d> + <area xmm='110' ymm='20' wmm='85' hmm='80'/> + <draw-in-background enabled='1'/> + <title-attributes> + </title-attributes> + <background-attributes> + <fill element-number='-1' style='transparent' color='ff000000'/> + </background-attributes> + <opengl enabled='0' enable-transparency='0' global-transparency='0' shade-walls='1' auto-stroke='1' auto-stroke-lightness='-45'/> + <wall-thickness xy='0.05' xz='0' yz='0'/> + <edge-length x='1' y='1' z='0.75'/> + <viewpoint azimuth='45' elevation='35' distance='0'/> + <light enabled='0' azimuth='135' elevation='30' ambient-intensity='10' directed-intensity='0'/> + <perspective enabled='1' focus-distance='35'/> + <autoscale enabled='1'/> + <axis type='X' visible='1' scrollable='1'> + <dart element-number='1' style='none' size='3' /> + <dart element-number='2' style='none' size='3' /> + <display position='0' default='1' opposite='0' /> + <range min='0' max='0' rounded='0'/> + <scale type='linear' base='10' reversed='0'/> + <grid-step major='-4' minor='-20'/> + <tics format='(TIC)' visible='1' outer='0' angle='0' pos1='0.01' pos2='0.01'/> + <title-position pos='0.5' distance='0.05'/> + <remembered-view number='0' min='0' max='0' scale='linear' base='10' reversed='0' rounded='0'/> + <remembered-view number='1' min='0' max='0' scale='linear' base='10' reversed='0' rounded='0'/> + <remembered-view number='2' min='0' max='0' scale='linear' base='10' reversed='0' rounded='0'/> + <title text='X'/> + <line element-number='0' style='solid' width='0' color='ff000000'/> + <line element-number='1' style='invisible' width='0' color='ff000000'/> + <line element-number='2' style='invisible' width='0' color='ff000000'/> + <font element-number='0' family='helvetica' size='10' bold='0' italic='0' color='ff000000'/> + <font element-number='1' family='helvetica' size='10' bold='0' italic='0' color='ff000000'/> + </axis> + <axis type='Y' visible='1' scrollable='1'> + <dart element-number='1' style='none' size='3' /> + <dart element-number='2' style='none' size='3' /> + <display position='0' default='1' opposite='0' /> + <range min='0' max='0' rounded='0'/> + <scale type='linear' base='10' reversed='0'/> + <grid-step major='-4' minor='-20'/> + <tics format='(TIC)' visible='1' outer='0' angle='0' pos1='0.01' pos2='0.01'/> + <title-position pos='0.5' distance='0.05'/> + <remembered-view number='0' min='0' max='0' scale='linear' base='10' reversed='0' rounded='0'/> + <remembered-view number='1' min='0' max='0' scale='linear' base='10' reversed='0' rounded='0'/> + <remembered-view number='2' min='0' max='0' scale='linear' base='10' reversed='0' rounded='0'/> + <title text='Y'/> + <line element-number='0' style='solid' width='0' color='ff000000'/> + <line element-number='1' style='invisible' width='0' color='ff000000'/> + <line element-number='2' style='invisible' width='0' color='ff000000'/> + <font element-number='0' family='helvetica' size='10' bold='0' italic='0' color='ff000000'/> + <font element-number='1' family='helvetica' size='10' bold='0' italic='0' color='ff000000'/> + </axis> + <axis type='Z' visible='1' scrollable='1'> + <dart element-number='1' style='none' size='3' /> + <dart element-number='2' style='none' size='3' /> + <display position='0' default='1' opposite='0' /> + <range min='0' max='0' rounded='0'/> + <scale type='linear' base='10' reversed='0'/> + <grid-step major='-4' minor='-20'/> + <tics format='(TIC)' visible='1' outer='0' angle='0' pos1='0.01' pos2='0.01'/> + <title-position pos='1.2' distance='0.05'/> + <remembered-view number='0' min='0' max='0' scale='linear' base='10' reversed='0' rounded='0'/> + <remembered-view number='1' min='0' max='0' scale='linear' base='10' reversed='0' rounded='0'/> + <remembered-view number='2' min='0' max='0' scale='linear' base='10' reversed='0' rounded='0'/> + <title text='Z'/> + <line element-number='0' style='solid' width='0' color='ff000000'/> + <line element-number='1' style='invisible' width='0' color='ff000000'/> + <line element-number='2' style='invisible' width='0' color='ff000000'/> + <font element-number='0' family='helvetica' size='10' bold='0' italic='0' color='ff000000'/> + <font element-number='1' family='helvetica' size='10' bold='0' italic='0' color='ff000000'/> + </axis> + <axis type='V' visible='1' scrollable='1'> + <dart element-number='1' style='none' size='3' /> + <dart element-number='2' style='none' size='3' /> + <display position='0' default='1' opposite='0' /> + <range min='0' max='0' rounded='0'/> + <scale type='linear' base='10' reversed='0'/> + <grid-step major='-4' minor='0'/> + <tics format='(TIC)' visible='1' outer='0' angle='0' pos1='0.01' pos2='0.01'/> + <title-position pos='0.5' distance='0.05'/> + <remembered-view number='0' min='0' max='0' scale='linear' base='10' reversed='0' rounded='0'/> + <remembered-view number='1' min='0' max='0' scale='linear' base='10' reversed='0' rounded='0'/> + <remembered-view number='2' min='0' max='0' scale='linear' base='10' reversed='0' rounded='0'/> + <title text='V'/> + <line element-number='0' style='solid' width='0' color='ff000000'/> + <line element-number='1' style='invisible' width='0' color='ff000000'/> + <line element-number='2' style='invisible' width='0' color='ff000000'/> + <font element-number='0' family='helvetica' size='10' bold='0' italic='0' color='ff000000'/> + <font element-number='1' family='helvetica' size='10' bold='0' italic='0' color='ff000000'/> + </axis> + <title text=''/> + <line element-number='0' style='solid' width='0' color='ff000000'/> + <line element-number='1' style='solid' width='0' color='ff000000'/> + <line element-number='2' style='solid' width='0' color='ff606060'/> + <line element-number='3' style='solid' width='0' color='ff606060'/> + <line element-number='4' style='solid' width='0' color='ff606060'/> + <fill element-number='0' style='solid' color='ffffffff'/> + <fill element-number='1' style='solid' color='ffffffff'/> + <fill element-number='2' style='solid' color='ffe0e0e0'/> + <fill element-number='3' style='solid' color='fff0f0f0'/> + <fill element-number='4' style='solid' color='fff0f0f0'/> + <figure stack-order='0'> + <legend-item visible='1'/> + <default-axis x-axis='0' y-axis='1' z-axis='2' v-axis='3'/> + <gradient type='default'> + <fill element-number='0' style='solid' color='ff000080'/> + <fill element-number='1' style='solid' color='ff008000'/> + <fill element-number='2' style='solid' color='ffff0000'/> + <fill element-number='3' style='solid' color='ffffa000'/> + <fill element-number='4' style='solid' color='ffffffc4'/> + </gradient> + <vertex-compare accuracy='4'/> + <autodivide enabled='0'/> + <colored enabled='1'/> + <topbottom enabled='1'/> + <edges autocolor='-50'/> + <title text='3D path'/> + <line element-number='0' style='solid' width='2' color='ffff0000'/> + <fill element-number='0' style='solid' color='ffffffff'/> + <fill element-number='1' style='solid' color='ffffffff'/> + <point element-number='0' style='circle' fill='opaque' size='5' color='ff000000'/> + <matrix-formula title='unnamed' formula='sin(t_params(:,0))' transposition='0' data-channel='0'/> + <matrix-formula title='unnamed' formula='cos(t_params(:,0))' transposition='0' data-channel='1'/> + <matrix-formula title='unnamed' formula='t_params(:,1)' transposition='0' data-channel='2'/> + </figure> + <label> + <text>3D path</text> + <angle deg='0'/> + <align text='9' frame='9'/> + <pos x='0.349037' y='-0.152185' z='0'/> + <coord-system x='1' y='1' z='1'/> + <shadow-shift x='5' y='5'/> + <font element-number='1' family='helvetica' size='24' bold='1' italic='0' color='ff000000'/> + <fill element-number='1' style='transparent' color='ffffffff'/> + <line element-number='1' style='invisible' width='0' color='ff000000'/> + <fill element-number='2' style='transparent' color='ff000000'/> + <axes-bindings x-axis='0' y-axis='1' z-axis='2'/> + </label> + </axes3d> + <label> + <text><p>1. Select the graph, on the property panel below select the</p> <p><wsp> </wsp>dataset<i><font size="3" style="font-size:12pt"> '3D path'</font></i></p> <p>2. Select<b><font size="3" style="font-size:12pt"> Window/New window/Current dataset </font></b></p> <p><wsp> </wsp>from the main menu.</p> <p>4.<wsp> </wsp>Now select "Z" from Channels list.</p> <p>5. You should see a simple formula like "t_params(:,1)",</p> <p><wsp> </wsp>which means "get all rows and column number 1 from</p> <p><wsp> </wsp>sheet "t_params".</p> <p>6. Change it to "t_params(:,2)" and click OK.</p> <p>7. Graph is updated automatically</p> </text> + <angle deg='0'/> + <align text='0' frame='9'/> + <pos x='15.0911' y='89.9641' z='0'/> + <coord-system x='1' y='1' z='1'/> + <shadow-shift x='5' y='5'/> + <font element-number='1' family='Helvetica [Urw]' size='12' bold='0' italic='0' color='ff000000'/> + <fill element-number='1' style='transparent' color='ffffffff'/> + <line element-number='1' style='invisible' width='0' color='ff000000'/> + <fill element-number='2' style='transparent' color='ff000000'/> + <axes-bindings x-axis='-1' y-axis='-1' z-axis='-1'/> + </label> + </page> + </canvas> +</kmatplot> diff --git a/kmatplot/examples/shell.kmp b/kmatplot/examples/shell.kmp new file mode 100644 index 0000000..f4bff19 --- /dev/null +++ b/kmatplot/examples/shell.kmp @@ -0,0 +1,2390 @@ +<?xml version='1.0' encoding='UTF-8'?> +<!DOCTYPE kmatplot> +<kmatplot mime='application/x-kmatplot' editor='KMatplot' version='0.3' url='http://kmatplot.sourceforge.net' program-author='K. Dobkowski'> + <canvas page-size='A4' orientation='Portrait' dpi='72'> + <sheets number='0'> + </sheets> + <page number='0' title='Page 1'> + <axes3d> + <area xmm='55' ymm='45' wmm='100' hmm='100'/> + <draw-in-background enabled='1'/> + <title-attributes> + </title-attributes> + <background-attributes> + <fill element-number='-1' style='transparent' color='ff000000'/> + </background-attributes> + <opengl enabled='0' enable-transparency='0' global-transparency='0' shade-walls='1' auto-stroke='1' auto-stroke-lightness='-45'/> + <wall-thickness xy='0.2' xz='0.1' yz='0.05'/> + <edge-length x='1' y='0.5' z='0.75'/> + <viewpoint azimuth='46' elevation='34' distance='0'/> + <light enabled='1' azimuth='135' elevation='30' ambient-intensity='0' directed-intensity='0'/> + <perspective enabled='1' focus-distance='35'/> + <autoscale enabled='1'/> + <axis type='X' visible='1' scrollable='1'> + <dart element-number='1' style='none' size='3' /> + <dart element-number='2' style='none' size='3' /> + <display position='0' default='1' opposite='1' /> + <range min='-5.21959' max='0.929604' rounded='0'/> + <scale type='linear' base='10' reversed='0'/> + <grid-step major='-4' minor='-20'/> + <tics format='(TIC)' visible='1' outer='0' angle='0' pos1='0.01' pos2='0.01'/> + <title-position pos='0.5' distance='0.05'/> + <remembered-view number='0' min='0' max='0' scale='linear' base='10' reversed='0' rounded='0'/> + <remembered-view number='1' min='0' max='0' scale='linear' base='10' reversed='0' rounded='0'/> + <remembered-view number='2' min='0' max='0' scale='linear' base='10' reversed='0' rounded='0'/> + <title text='X'/> + <line element-number='0' style='solid' width='0' color='ff000000'/> + <line element-number='1' style='invisible' width='0' color='ff000000'/> + <line element-number='2' style='invisible' width='0' color='ff000000'/> + <font element-number='0' family='helvetica' size='10' bold='0' italic='0' color='ff000000'/> + <font element-number='1' family='helvetica' size='10' bold='0' italic='0' color='ff000000'/> + </axis> + <axis type='Y' visible='1' scrollable='1'> + <dart element-number='1' style='none' size='3' /> + <dart element-number='2' style='none' size='3' /> + <display position='0' default='1' opposite='1' /> + <range min='-2.9662' max='3.00982' rounded='0'/> + <scale type='linear' base='10' reversed='0'/> + <grid-step major='-2' minor='-20'/> + <tics format='(TIC)' visible='1' outer='0' angle='0' pos1='0.01' pos2='0.01'/> + <title-position pos='0.5' distance='0.05'/> + <remembered-view number='0' min='0' max='0' scale='linear' base='10' reversed='0' rounded='0'/> + <remembered-view number='1' min='0' max='0' scale='linear' base='10' reversed='0' rounded='0'/> + <remembered-view number='2' min='0' max='0' scale='linear' base='10' reversed='0' rounded='0'/> + <title text='Y'/> + <line element-number='0' style='solid' width='0' color='ff000000'/> + <line element-number='1' style='invisible' width='0' color='ff000000'/> + <line element-number='2' style='invisible' width='0' color='ff000000'/> + <font element-number='0' family='helvetica' size='10' bold='0' italic='0' color='ff000000'/> + <font element-number='1' family='helvetica' size='10' bold='0' italic='0' color='ff000000'/> + </axis> + <axis type='Z' visible='1' scrollable='1'> + <dart element-number='1' style='none' size='3' /> + <dart element-number='2' style='none' size='3' /> + <display position='0' default='1' opposite='0' /> + <range min='-1.19642' max='3.08707' rounded='0'/> + <scale type='linear' base='10' reversed='0'/> + <grid-step major='-4' minor='-20'/> + <tics format='(TIC)' visible='1' outer='0' angle='0' pos1='0.01' pos2='0.01'/> + <title-position pos='0.5' distance='0.05'/> + <remembered-view number='0' min='0' max='0' scale='linear' base='10' reversed='0' rounded='0'/> + <remembered-view number='1' min='0' max='0' scale='linear' base='10' reversed='0' rounded='0'/> + <remembered-view number='2' min='0' max='0' scale='linear' base='10' reversed='0' rounded='0'/> + <title text='Z'/> + <line element-number='0' style='solid' width='0' color='ff000000'/> + <line element-number='1' style='invisible' width='0' color='ff000000'/> + <line element-number='2' style='invisible' width='0' color='ff000000'/> + <font element-number='0' family='helvetica' size='10' bold='0' italic='0' color='ff000000'/> + <font element-number='1' family='helvetica' size='10' bold='0' italic='0' color='ff000000'/> + </axis> + <axis type='V' visible='1' scrollable='1'> + <dart element-number='1' style='none' size='3' /> + <dart element-number='2' style='none' size='3' /> + <display position='0' default='1' opposite='0' /> + <range min='0' max='0' rounded='0'/> + <scale type='linear' base='10' reversed='0'/> + <grid-step major='-8' minor='0'/> + <tics format='<TIC>' visible='1' outer='0' angle='0' pos1='0.01' pos2='0.01'/> + <title-position pos='0.5' distance='0.05'/> + <remembered-view number='0' min='0' max='0' scale='linear' base='10' reversed='0' rounded='0'/> + <remembered-view number='1' min='0' max='0' scale='linear' base='10' reversed='0' rounded='0'/> + <remembered-view number='2' min='0' max='0' scale='linear' base='10' reversed='0' rounded='0'/> + <title text='V'/> + <line element-number='0' style='solid' width='0' color='ff000000'/> + <line element-number='1' style='invisible' width='0' color='ff000000'/> + <line element-number='2' style='invisible' width='0' color='ff000000'/> + <font element-number='0' family='helvetica' size='10' bold='0' italic='0' color='ff000000'/> + <font element-number='1' family='helvetica' size='10' bold='0' italic='0' color='ff000000'/> + </axis> + <title text=''/> + <line element-number='0' style='solid' width='0' color='ff000000'/> + <line element-number='1' style='solid' width='0' color='ff000000'/> + <line element-number='2' style='solid' width='0' color='ff606060'/> + <line element-number='3' style='solid' width='0' color='ff606060'/> + <line element-number='4' style='solid' width='0' color='ff606060'/> + <fill element-number='0' style='solid' color='ffffffff'/> + <fill element-number='1' style='solid' color='ffffffff'/> + <fill element-number='2' style='solid' color='ffe0e0e0'/> + <fill element-number='3' style='solid' color='fff0f0f0'/> + <fill element-number='4' style='solid' color='fff0f0f0'/> + <figure stack-order='0'> + <legend-item visible='1'/> + <default-axis x-axis='0' y-axis='1' z-axis='2' v-axis='3'/> + <gradient type='default'> + <fill element-number='0' style='solid' color='ff000080'/> + <fill element-number='1' style='solid' color='ff008000'/> + <fill element-number='2' style='solid' color='ffff0000'/> + <fill element-number='3' style='solid' color='ffffa000'/> + <fill element-number='4' style='solid' color='ffffffc4'/> + </gradient> + <vertex-compare accuracy='4'/> + <autodivide enabled='1'/> + <colored enabled='1'/> + <topbottom enabled='1'/> + <edges autocolor='-50'/> + <title text='Untitled figure'/> + <line element-number='0' style='solid' width='0' color='ff000000'/> + <fill element-number='0' style='solid' color='ffffffff'/> + <fill element-number='1' style='solid' color='ffffffff'/> + <point element-number='0' style='invisible' fill='transparent' size='9' color='ff000000'/> + <matrix title='x' rows='741' cols='4' element-type='double' data-channel='0'> + <row>0 0.238531527 0.234223429 0 </row> + <row>0.238531527 0.45844848 0.450168479 0.234223429 </row> + <row>0.45844848 0.641940495 0.630346459 0.450168479 </row> + <row>0.641940495 0.772776465 0.758819412 0.630346459 </row> + <row>0.772776465 0.837022208 0.821904817 0.758819412 </row> + <row>0.837022208 0.823674478 0.808798159 0.821904817 </row> + <row>0.823674478 0.725187832 0.712090273 0.808798159 </row> + <row>0.725187832 0.537874425 0.528159918 0.712090273 </row> + <row>0.537874425 0.262161103 0.257426233 0.528159918 </row> + <row>0.262161103 -0.0973070628 -0.0955496078 0.257426233 </row> + <row>-0.0973070628 -0.531722442 -0.522119046 -0.0955496078 </row> + <row>-0.531722442 -1.02832995 -1.00975736 -0.522119046 </row> + <row>-1.02832995 -1.57079633 -1.5424263 -1.00975736 </row> + <row>-1.57079633 -2.13972311 -2.10107774 -1.5424263 </row> + <row>-2.13972311 -2.71328754 -2.66428307 -2.10107774 </row> + <row>-2.71328754 -3.26799134 -3.20896841 -2.66428307 </row> + <row>-3.26799134 -3.77949317 -3.71123205 -3.20896841 </row> + <row>-3.77949317 -4.2234974 -4.14721716 -3.71123205 </row> + <row>-4.2234974 -4.57666948 -4.49401063 -4.14721716 </row> + <row>-4.57666948 -4.81754683 -4.7305375 -4.49401063 </row> + <row>-4.81754683 -4.92741364 -4.83842002 -4.7305375 </row> + <row>-4.92741364 -4.89110881 -4.80277089 -4.83842002 </row> + <row>-4.89110881 -4.69773755 -4.61289209 -4.80277089 </row> + <row>-4.69773755 -4.34126006 -4.26285291 -4.61289209 </row> + <row>-4.34126006 -3.82093413 -3.75192454 -4.26285291 </row> + <row>-3.82093413 -3.14159265 -3.0848526 -3.75192454 </row> + <row>-3.14159265 -2.31374238 -2.27195406 -3.0848526 </row> + <row>-2.31374238 -1.35347531 -1.3290303 -2.27195406 </row> + <row>-1.35347531 -0.282190482 -0.277093863 -1.3290303 </row> + <row>-0.282190482 0.873870344 0.858087442 -0.277093863 </row> + <row>0.873870344 2.0842634 2.04661968 0.858087442 </row> + <row>2.0842634 3.31514437 3.25526982 2.04661968 </row> + <row>3.31514437 4.53020963 4.44838988 3.25526982 </row> + <row>4.53020963 5.69175101 5.58895276 4.44838988 </row> + <row>5.69175101 6.76179407 6.63966985 5.58895276 </row> + <row>6.76179407 7.70328594 7.56415751 6.63966985 </row> + <row>7.70328594 8.48129687 8.32811685 7.56415751 </row> + <row>8.48129687 9.06419803 8.90049028 8.32811685 </row> + <row>9.06419803 9.42477796 9.25455781 8.90049028 </row> + <row>0 0.234223429 0.221765982 0 </row> + <row>0.234223429 0.450168479 0.426225742 0.221765982 </row> + <row>0.450168479 0.630346459 0.596820746 0.426225742 </row> + <row>0.630346459 0.758819412 0.718460715 0.596820746 </row> + <row>0.758819412 0.821904817 0.778190849 0.718460715 </row> + <row>0.821904817 0.808798159 0.765781284 0.778190849 </row> + <row>0.808798159 0.712090273 0.674216919 0.765781284 </row> + <row>0.712090273 0.528159918 0.500069116 0.674216919 </row> + <row>0.528159918 0.257426233 0.243734718 0.500069116 </row> + <row>0.257426233 -0.0955496078 -0.0904676902 0.243734718 </row> + <row>-0.0955496078 -0.522119046 -0.494349535 -0.0904676902 </row> + <row>-0.522119046 -1.00975736 -0.956052236 -0.494349535 </row> + <row>-1.00975736 -1.5424263 -1.46039056 -0.956052236 </row> + <row>-1.5424263 -2.10107774 -1.98932947 -1.46039056 </row> + <row>-2.10107774 -2.66428307 -2.52258006 -1.98932947 </row> + <row>-2.66428307 -3.20896841 -3.03829568 -2.52258006 </row> + <row>-3.20896841 -3.71123205 -3.51384584 -3.03829568 </row> + <row>-3.71123205 -4.14721716 -3.92664257 -3.51384584 </row> + <row>-4.14721716 -4.49401063 -4.25499142 -3.92664257 </row> + <row>-4.49401063 -4.7305375 -4.47893834 -4.25499142 </row> + <row>-4.7305375 -4.83842002 -4.58108299 -4.47893834 </row> + <row>-4.83842002 -4.80277089 -4.54732991 -4.58108299 </row> + <row>-4.80277089 -4.61289209 -4.36755004 -4.54732991 </row> + <row>-4.61289209 -4.26285291 -4.0361281 -4.36755004 </row> + <row>-4.26285291 -3.75192454 -3.55237405 -4.0361281 </row> + <row>-3.75192454 -3.0848526 -2.92078111 -3.55237405 </row> + <row>-3.0848526 -2.27195406 -2.15111753 -2.92078111 </row> + <row>-2.27195406 -1.3290303 -1.25834427 -2.15111753 </row> + <row>-1.3290303 -0.277093863 -0.262356302 -1.25834427 </row> + <row>-0.277093863 0.858087442 0.812449059 -0.262356302 </row> + <row>0.858087442 2.04661968 1.93776782 0.812449059 </row> + <row>2.04661968 3.25526982 3.08213449 1.93776782 </row> + <row>3.25526982 4.44838988 4.21179706 3.08213449 </row> + <row>4.44838988 5.58895276 5.29169777 4.21179706 </row> + <row>5.58895276 6.63966985 6.28653125 5.29169777 </row> + <row>6.63966985 7.56415751 7.16184896 6.28653125 </row> + <row>7.56415751 8.32811685 7.88517623 7.16184896 </row> + <row>8.32811685 8.90049028 8.42710731 7.88517623 </row> + <row>8.90049028 9.25455781 8.76234333 8.42710731 </row> + <row>0 0.221765982 0.202509145 0 </row> + <row>0.221765982 0.426225742 0.389214837 0.202509145 </row> + <row>0.426225742 0.596820746 0.544996387 0.389214837 </row> + <row>0.596820746 0.718460715 0.656073865 0.544996387 </row> + <row>0.718460715 0.778190849 0.71061739 0.656073865 </row> + <row>0.778190849 0.765781284 0.699285398 0.71061739 </row> + <row>0.765781284 0.674216919 0.615671937 0.699285398 </row> + <row>0.674216919 0.500069116 0.456646092 0.615671937 </row> + <row>0.500069116 0.243734718 0.222570246 0.456646092 </row> + <row>0.243734718 -0.0904676902 -0.0826120148 0.222570246 </row> + <row>-0.0904676902 -0.494349535 -0.451423165 -0.0826120148 </row> + <row>-0.494349535 -0.956052236 -0.873034354 -0.451423165 </row> + <row>-0.956052236 -1.46039056 -1.33357894 -0.873034354 </row> + <row>-1.46039056 -1.98932947 -1.81658795 -1.33357894 </row> + <row>-1.98932947 -2.52258006 -2.30353423 -1.81658795 </row> + <row>-2.52258006 -3.03829568 -2.77446817 -2.30353423 </row> + <row>-3.03829568 -3.51384584 -3.20872439 -2.77446817 </row> + <row>-3.51384584 -3.92664257 -3.58567631 -3.20872439 </row> + <row>-3.92664257 -4.25499142 -3.8855133 -3.58567631 </row> + <row>-4.25499142 -4.47893834 -4.090014 -3.8855133 </row> + <row>-4.47893834 -4.58108299 -4.18328903 -4.090014 </row> + <row>-4.58108299 -4.54732991 -4.15246686 -4.18328903 </row> + <row>-4.54732991 -4.36755004 -3.988298 -4.15246686 </row> + <row>-4.36755004 -4.0361281 -3.68565477 -3.988298 </row> + <row>-4.0361281 -3.55237405 -3.24390705 -3.68565477 </row> + <row>-3.55237405 -2.92078111 -2.66715787 -3.24390705 </row> + <row>-2.92078111 -2.15111753 -1.9643273 -2.66715787 </row> + <row>-2.15111753 -1.25834427 -1.14907715 -1.9643273 </row> + <row>-1.25834427 -0.262356302 -0.239574843 -1.14907715 </row> + <row>-0.262356302 0.812449059 0.741900821 -0.239574843 </row> + <row>0.812449059 1.93776782 1.76950361 0.741900821 </row> + <row>1.93776782 3.08213449 2.81450028 1.76950361 </row> + <row>3.08213449 4.21179706 3.84606969 2.81450028 </row> + <row>4.21179706 5.29169777 4.83219825 3.84606969 </row> + <row>5.29169777 6.28653125 5.74064632 4.83219825 </row> + <row>6.28653125 7.16184896 6.53995665 5.74064632 </row> + <row>7.16184896 7.88517623 7.20047448 6.53995665 </row> + <row>7.88517623 8.42710731 7.6953475 7.20047448 </row> + <row>8.42710731 8.76234333 8.00147362 7.6953475 </row> + <row>0 0.202509145 0.178539694 0 </row> + <row>0.202509145 0.389214837 0.343146469 0.178539694 </row> + <row>0.389214837 0.544996387 0.480489355 0.343146469 </row> + <row>0.544996387 0.656073865 0.578419446 0.480489355 </row> + <row>0.656073865 0.71061739 0.626507073 0.578419446 </row> + <row>0.71061739 0.699285398 0.616516362 0.626507073 </row> + <row>0.699285398 0.615671937 0.542799584 0.616516362 </row> + <row>0.615671937 0.456646092 0.402596405 0.542799584 </row> + <row>0.456646092 0.222570246 0.196226318 0.402596405 </row> + <row>0.222570246 -0.0826120148 -0.0728338658 0.196226318 </row> + <row>-0.0826120148 -0.451423165 -0.397991676 -0.0728338658 </row> + <row>-0.451423165 -0.873034354 -0.76969999 -0.397991676 </row> + <row>-0.873034354 -1.33357894 -1.17573345 -0.76969999 </row> + <row>-1.33357894 -1.81658795 -1.6015724 -1.17573345 </row> + <row>-1.81658795 -2.30353423 -2.0308826 -1.6015724 </row> + <row>-2.30353423 -2.77446817 -2.44607571 -2.0308826 </row> + <row>-2.77446817 -3.20872439 -2.82893236 -2.44607571 </row> + <row>-3.20872439 -3.58567631 -3.16126738 -2.82893236 </row> + <row>-3.58567631 -3.8855133 -3.42561497 -3.16126738 </row> + <row>-3.8855133 -4.090014 -3.60591049 -3.42561497 </row> + <row>-4.090014 -4.18328903 -3.68814527 -3.60591049 </row> + <row>-4.18328903 -4.15246686 -3.66097128 -3.68814527 </row> + <row>-4.15246686 -3.988298 -3.51623383 -3.66097128 </row> + <row>-3.988298 -3.68565477 -3.24941216 -3.51623383 </row> + <row>-3.68565477 -3.24390705 -2.85995071 -3.24941216 </row> + <row>-3.24390705 -2.66715787 -2.3514669 -2.85995071 </row> + <row>-2.66715787 -1.9643273 -1.73182498 -2.3514669 </row> + <row>-1.9643273 -1.14907715 -1.01306972 -1.73182498 </row> + <row>-1.14907715 -0.239574843 -0.211218211 -1.01306972 </row> + <row>-0.239574843 0.741900821 0.654087725 -0.211218211 </row> + <row>0.741900821 1.76950361 1.56006107 0.654087725 </row> + <row>1.76950361 2.81450028 2.48136953 1.56006107 </row> + <row>2.81450028 3.84606969 3.39083999 2.48136953 </row> + <row>3.84606969 4.83219825 4.2602481 3.39083999 </row> + <row>4.83219825 5.74064632 5.06117015 4.2602481 </row> + <row>5.74064632 6.53995665 5.76587226 5.06117015 </row> + <row>6.53995665 7.20047448 6.34820968 5.76587226 </row> + <row>7.20047448 7.6953475 6.78450838 6.34820968 </row> + <row>7.6953475 8.00147362 7.05440071 6.78450838 </row> + <row>0 0.178539694 0.152455092 0 </row> + <row>0.178539694 0.343146469 0.293012861 0.152455092 </row> + <row>0.343146469 0.480489355 0.410289988 0.293012861 </row> + <row>0.480489355 0.578419446 0.493912519 0.410289988 </row> + <row>0.578419446 0.626507073 0.534974556 0.493912519 </row> + <row>0.626507073 0.616516362 0.526443485 0.534974556 </row> + <row>0.616516362 0.542799584 0.463496709 0.526443485 </row> + <row>0.542799584 0.402596405 0.343777177 0.463496709 </row> + <row>0.402596405 0.196226318 0.167557705 0.343777177 </row> + <row>0.196226318 -0.0728338658 -0.0621928573 0.167557705 </row> + <row>-0.0728338658 -0.397991676 -0.339845198 -0.0621928573 </row> + <row>-0.397991676 -0.76969999 -0.657247026 -0.339845198 </row> + <row>-0.76969999 -1.17573345 -1.00395911 -0.657247026 </row> + <row>-1.17573345 -1.6015724 -1.3675831 -1.00395911 </row> + <row>-1.6015724 -2.0308826 -1.73417119 -1.3675831 </row> + <row>-2.0308826 -2.44607571 -2.0887047 -1.73417119 </row> + <row>-2.44607571 -2.82893236 -2.41562609 -2.0887047 </row> + <row>-2.82893236 -3.16126738 -2.69940705 -2.41562609 </row> + <row>-3.16126738 -3.42561497 -2.92513353 -2.69940705 </row> + <row>-3.42561497 -3.60591049 -3.07908793 -2.92513353 </row> + <row>-3.60591049 -3.68814527 -3.14930823 -3.07908793 </row> + <row>-3.68814527 -3.66097128 -3.12610435 -3.14930823 </row> + <row>-3.66097128 -3.51623383 -3.002513 -3.12610435 </row> + <row>-3.51623383 -3.24941216 -2.7746739 -3.002513 </row> + <row>-3.24941216 -2.85995071 -2.44211267 -2.7746739 </row> + <row>-2.85995071 -2.3514669 -2.00791821 -2.44211267 </row> + <row>-2.3514669 -1.73182498 -1.47880581 -2.00791821 </row> + <row>-1.73182498 -1.01306972 -0.865060504 -1.47880581 </row> + <row>-1.01306972 -0.211218211 -0.180359286 -0.865060504 </row> + <row>-0.211218211 0.654087725 0.558525682 -0.180359286 </row> + <row>0.654087725 1.56006107 1.33213656 0.558525682 </row> + <row>1.56006107 2.48136953 2.1188421 1.33213656 </row> + <row>2.48136953 3.39083999 2.89543917 2.1188421 </row> + <row>3.39083999 4.2602481 3.63782698 2.89543917 </row> + <row>4.2602481 5.06117015 4.32173454 3.63782698 </row> + <row>5.06117015 5.76587226 4.92347986 4.32173454 </row> + <row>5.76587226 6.34820968 5.42073793 4.92347986 </row> + <row>6.34820968 6.78450838 5.79329351 5.42073793 </row> + <row>6.78450838 7.05440071 6.02375464 5.79329351 </row> + <row>0 0.152455092 0.12708201 0 </row> + <row>0.152455092 0.293012861 0.244246768 0.12708201 </row> + <row>0.293012861 0.410289988 0.342005477 0.244246768 </row> + <row>0.410289988 0.493912519 0.41171072 0.342005477 </row> + <row>0.493912519 0.534974556 0.445938808 0.41171072 </row> + <row>0.534974556 0.526443485 0.438827562 0.445938808 </row> + <row>0.526443485 0.463496709 0.38635701 0.438827562 </row> + <row>0.463496709 0.343777177 0.286562385 0.38635701 </row> + <row>0.343777177 0.167557705 0.139671097 0.286562385 </row> + <row>0.167557705 -0.0621928573 -0.0518421079 0.139671097 </row> + <row>-0.0621928573 -0.339845198 -0.283284804 -0.0518421079 </row> + <row>-0.339845198 -0.657247026 -0.547861486 -0.283284804 </row> + <row>-0.657247026 -1.00395911 -0.836870319 -0.547861486 </row> + <row>-1.00395911 -1.3675831 -1.13997641 -0.836870319 </row> + <row>-1.3675831 -1.73417119 -1.4455533 -1.13997641 </row> + <row>-1.73417119 -2.0887047 -1.74108184 -1.4455533 </row> + <row>-2.0887047 -2.41562609 -2.01359374 -1.74108184 </row> + <row>-2.41562609 -2.69940705 -2.25014507 -2.01359374 </row> + <row>-2.69940705 -2.92513353 -2.43830393 -2.25014507 </row> + <row>-2.92513353 -3.07908793 -2.56663571 -2.43830393 </row> + <row>-3.07908793 -3.14930823 -2.62516925 -2.56663571 </row> + <row>-3.14930823 -3.12610435 -2.6058272 -2.62516925 </row> + <row>-3.12610435 -3.002513 -2.50280514 -2.6058272 </row> + <row>-3.002513 -2.7746739 -2.31288527 -2.50280514 </row> + <row>-2.7746739 -2.44211267 -2.03567217 -2.31288527 </row> + <row>-2.44211267 -2.00791821 -1.67374064 -2.03567217 </row> + <row>-2.00791821 -1.47880581 -1.23268834 -1.67374064 </row> + <row>-1.47880581 -0.865060504 -0.721088592 -1.23268834 </row> + <row>-0.865060504 -0.180359286 -0.150342113 -0.721088592 </row> + <row>-0.180359286 0.558525682 0.465570323 -0.150342113 </row> + <row>0.558525682 1.33213656 1.11042924 0.465570323 </row> + <row>1.33213656 2.1188421 1.76620347 1.11042924 </row> + <row>2.1188421 2.89543917 2.41355159 1.76620347 </row> + <row>2.89543917 3.63782698 3.03238389 2.41355159 </row> + <row>3.63782698 4.32173454 3.6024688 3.03238389 </row> + <row>4.32173454 4.92347986 4.10406572 3.6024688 </row> + <row>4.92347986 5.42073793 4.5185652 4.10406572 </row> + <row>5.42073793 5.79329351 4.8291164 4.5185652 </row> + <row>5.79329351 6.02375464 5.02122191 4.8291164 </row> + <row>0 0.12708201 0.105170016 0 </row> + <row>0.12708201 0.244246768 0.202132751 0.105170016 </row> + <row>0.244246768 0.342005477 0.283035508 0.202132751 </row> + <row>0.342005477 0.41171072 0.340721891 0.283035508 </row> + <row>0.41171072 0.445938808 0.369048233 0.340721891 </row> + <row>0.445938808 0.438827562 0.363163137 0.369048233 </row> + <row>0.438827562 0.38635701 0.31973977 0.363163137 </row> + <row>0.38635701 0.286562385 0.237152138 0.31973977 </row> + <row>0.286562385 0.139671097 0.115588441 0.237152138 </row> + <row>0.139671097 -0.0518421079 -0.0429032817 0.115588441 </row> + <row>-0.0518421079 -0.283284804 -0.234439691 -0.0429032817 </row> + <row>-0.283284804 -0.547861486 -0.45339699 -0.234439691 </row> + <row>-0.547861486 -0.836870319 -0.69257375 -0.45339699 </row> + <row>-0.836870319 -1.13997641 -0.943417063 -0.69257375 </row> + <row>-1.13997641 -1.4455533 -1.19630514 -0.943417063 </row> + <row>-1.4455533 -1.74108184 -1.44087746 -1.19630514 </row> + <row>-1.74108184 -2.01359374 -1.66640176 -1.44087746 </row> + <row>-2.01359374 -2.25014507 -1.86216595 -1.66640176 </row> + <row>-2.25014507 -2.43830393 -2.01788169 -1.86216595 </row> + <row>-2.43830393 -2.56663571 -2.12408599 -2.01788169 </row> + <row>-2.56663571 -2.62516925 -2.17252694 -2.12408599 </row> + <row>-2.62516925 -2.6058272 -2.15651992 -2.17252694 </row> + <row>-2.6058272 -2.50280514 -2.07126134 -2.15651992 </row> + <row>-2.50280514 -2.31288527 -1.91408823 -2.07126134 </row> + <row>-2.31288527 -2.03567217 -1.68467333 -1.91408823 </row> + <row>-2.03567217 -1.67374064 -1.3851475 -1.68467333 </row> + <row>-1.67374064 -1.23268834 -1.02014323 -1.3851475 </row> + <row>-1.23268834 -0.721088592 -0.596755577 -1.02014323 </row> + <row>-0.721088592 -0.150342113 -0.124419517 -0.596755577 </row> + <row>-0.150342113 0.465570323 0.385294803 -0.124419517 </row> + <row>0.465570323 1.11042924 0.918964535 0.385294803 </row> + <row>1.11042924 1.76620347 1.46166752 0.918964535 </row> + <row>1.76620347 2.41355159 1.99739725 1.46166752 </row> + <row>2.41355159 3.03238389 2.50952798 1.99739725 </row> + <row>3.03238389 3.6024688 2.98131654 2.50952798 </row> + <row>3.6024688 4.10406572 3.39642609 2.98131654 </row> + <row>4.10406572 4.5185652 3.73945589 3.39642609 </row> + <row>4.5185652 4.8291164 3.99646059 3.73945589 </row> + <row>4.8291164 5.02122191 4.1554425 3.99646059 </row> + <row>0 0.105170016 0.0890936125 0 </row> + <row>0.105170016 0.202132751 0.171234518 0.0890936125 </row> + <row>0.202132751 0.283035508 0.239770392 0.171234518 </row> + <row>0.283035508 0.340721891 0.288638771 0.239770392 </row> + <row>0.340721891 0.369048233 0.312635118 0.288638771 </row> + <row>0.369048233 0.363163137 0.307649624 0.312635118 </row> + <row>0.363163137 0.31973977 0.270864 0.307649624 </row> + <row>0.31973977 0.237152138 0.200900804 0.270864 </row> + <row>0.237152138 0.115588441 0.0979194659 0.200900804 </row> + <row>0.115588441 -0.0429032817 -0.0363450394 0.0979194659 </row> + <row>-0.0429032817 -0.234439691 -0.198602985 -0.0363450394 </row> + <row>-0.234439691 -0.45339699 -0.384090232 -0.198602985 </row> + <row>-0.45339699 -0.69257375 -0.586706172 -0.384090232 </row> + <row>-0.69257375 -0.943417063 -0.799205304 -0.586706172 </row> + <row>-0.943417063 -1.19630514 -1.01343664 -0.799205304 </row> + <row>-1.19630514 -1.44087746 -1.22062336 -1.01343664 </row> + <row>-1.44087746 -1.66640176 -1.41167377 -1.22062336 </row> + <row>-1.66640176 -1.86216595 -1.57751323 -1.41167377 </row> + <row>-1.86216595 -2.01788169 -1.7094261 -1.57751323 </row> + <row>-2.01788169 -2.12408599 -1.79939589 -1.7094261 </row> + <row>-2.12408599 -2.17252694 -1.84043211 -1.79939589 </row> + <row>-2.17252694 -2.15651992 -1.82687194 -1.84043211 </row> + <row>-2.15651992 -2.07126134 -1.75464608 -1.82687194 </row> + <row>-2.07126134 -1.91408823 -1.62149862 -1.75464608 </row> + <row>-1.91408823 -1.68467333 -1.42715233 -1.62149862 </row> + <row>-1.68467333 -1.3851475 -1.17341234 -1.42715233 </row> + <row>-1.3851475 -1.02014323 -0.864203023 -1.17341234 </row> + <row>-1.02014323 -0.596755577 -0.50553487 -0.864203023 </row> + <row>-0.596755577 -0.124419517 -0.105400614 -0.50553487 </row> + <row>-0.124419517 0.385294803 0.32639822 -0.105400614 </row> + <row>0.385294803 0.918964535 0.778490615 0.32639822 </row> + <row>0.918964535 1.46166752 1.23823543 0.778490615 </row> + <row>1.46166752 1.99739725 1.69207293 1.23823543 </row> + <row>1.99739725 2.50952798 2.1259188 1.69207293 </row> + <row>2.50952798 2.98131654 2.52558925 2.1259188 </row> + <row>2.98131654 3.39642609 2.8772447 2.52558925 </row> + <row>3.39642609 3.73945589 3.16783859 2.8772447 </row> + <row>3.73945589 3.99646059 3.38555727 3.16783859 </row> + <row>3.99646059 4.1554425 3.52023703 3.38555727 </row> + <row>0 0.0890936125 0.0805949288 0 </row> + <row>0.0890936125 0.171234518 0.154900373 0.0805949288 </row> + <row>0.171234518 0.239770392 0.216898576 0.154900373 </row> + <row>0.239770392 0.288638771 0.261105376 0.216898576 </row> + <row>0.288638771 0.312635118 0.2828127 0.261105376 </row> + <row>0.312635118 0.307649624 0.278302775 0.2828127 </row> + <row>0.307649624 0.270864 0.245026149 0.278302775 </row> + <row>0.270864 0.200900804 0.181736777 0.245026149 </row> + <row>0.200900804 0.0979194659 0.0885788797 0.181736777 </row> + <row>0.0979194659 -0.0363450394 -0.0328780681 0.0885788797 </row> + <row>-0.0363450394 -0.198602985 -0.179658148 -0.0328780681 </row> + <row>-0.198602985 -0.384090232 -0.347451675 -0.179658148 </row> + <row>-0.384090232 -0.586706172 -0.53073998 -0.347451675 </row> + <row>-0.586706172 -0.799205304 -0.722968715 -0.53073998 </row> + <row>-0.799205304 -1.01343664 -0.916764415 -0.722968715 </row> + <row>-1.01343664 -1.22062336 -1.10418749 -0.916764415 </row> + <row>-1.22062336 -1.41167377 -1.27701351 -1.10418749 </row> + <row>-1.41167377 -1.57751323 -1.42703347 -1.27701351 </row> + <row>-1.57751323 -1.7094261 -1.5463631 -1.42703347 </row> + <row>-1.7094261 -1.79939589 -1.62775063 -1.5463631 </row> + <row>-1.79939589 -1.84043211 -1.66487238 -1.62775063 </row> + <row>-1.84043211 -1.82687194 -1.65260572 -1.66487238 </row> + <row>-1.82687194 -1.75464608 -1.58726952 -1.65260572 </row> + <row>-1.75464608 -1.62149862 -1.46682306 -1.58726952 </row> + <row>-1.62149862 -1.42715233 -1.29101556 -1.46682306 </row> + <row>-1.42715233 -1.17341234 -1.06147996 -1.29101556 </row> + <row>-1.17341234 -0.864203023 -0.78176627 -1.06147996 </row> + <row>-0.864203023 -0.50553487 -0.457311649 -0.78176627 </row> + <row>-0.50553487 -0.105400614 -0.0953463975 -0.457311649 </row> + <row>-0.105400614 0.32639822 0.295262932 -0.0953463975 </row> + <row>0.32639822 0.778490615 0.704230011 0.295262932 </row> + <row>0.778490615 1.23823543 1.12011954 0.704230011 </row> + <row>1.23823543 1.69207293 1.53066526 1.12011954 </row> + <row>1.69207293 2.1259188 1.92312636 1.53066526 </row> + <row>2.1259188 2.52558925 2.28467204 1.92312636 </row> + <row>2.52558925 2.8772447 2.60278291 2.28467204 </row> + <row>2.8772447 3.16783859 2.8656569 2.60278291 </row> + <row>3.16783859 3.38555727 3.06260729 2.8656569 </row> + <row>3.38555727 3.52023703 3.18443988 3.06260729 </row> + <row>0 0.0805949288 0.0805949288 0 </row> + <row>0.0805949288 0.154900373 0.154900373 0.0805949288 </row> + <row>0.154900373 0.216898576 0.216898576 0.154900373 </row> + <row>0.216898576 0.261105376 0.261105376 0.216898576 </row> + <row>0.261105376 0.2828127 0.2828127 0.261105376 </row> + <row>0.2828127 0.278302775 0.278302775 0.2828127 </row> + <row>0.278302775 0.245026149 0.245026149 0.278302775 </row> + <row>0.245026149 0.181736777 0.181736777 0.245026149 </row> + <row>0.181736777 0.0885788797 0.0885788797 0.181736777 </row> + <row>0.0885788797 -0.0328780681 -0.0328780681 0.0885788797 </row> + <row>-0.0328780681 -0.179658148 -0.179658148 -0.0328780681 </row> + <row>-0.179658148 -0.347451675 -0.347451675 -0.179658148 </row> + <row>-0.347451675 -0.53073998 -0.53073998 -0.347451675 </row> + <row>-0.53073998 -0.722968715 -0.722968715 -0.53073998 </row> + <row>-0.722968715 -0.916764415 -0.916764415 -0.722968715 </row> + <row>-0.916764415 -1.10418749 -1.10418749 -0.916764415 </row> + <row>-1.10418749 -1.27701351 -1.27701351 -1.10418749 </row> + <row>-1.27701351 -1.42703347 -1.42703347 -1.27701351 </row> + <row>-1.42703347 -1.5463631 -1.5463631 -1.42703347 </row> + <row>-1.5463631 -1.62775063 -1.62775063 -1.5463631 </row> + <row>-1.62775063 -1.66487238 -1.66487238 -1.62775063 </row> + <row>-1.66487238 -1.65260572 -1.65260572 -1.66487238 </row> + <row>-1.65260572 -1.58726952 -1.58726952 -1.65260572 </row> + <row>-1.58726952 -1.46682306 -1.46682306 -1.58726952 </row> + <row>-1.46682306 -1.29101556 -1.29101556 -1.46682306 </row> + <row>-1.29101556 -1.06147996 -1.06147996 -1.29101556 </row> + <row>-1.06147996 -0.78176627 -0.78176627 -1.06147996 </row> + <row>-0.78176627 -0.457311649 -0.457311649 -0.78176627 </row> + <row>-0.457311649 -0.0953463975 -0.0953463975 -0.457311649 </row> + <row>-0.0953463975 0.295262932 0.295262932 -0.0953463975 </row> + <row>0.295262932 0.704230011 0.704230011 0.295262932 </row> + <row>0.704230011 1.12011954 1.12011954 0.704230011 </row> + <row>1.12011954 1.53066526 1.53066526 1.12011954 </row> + <row>1.53066526 1.92312636 1.92312636 1.53066526 </row> + <row>1.92312636 2.28467204 2.28467204 1.92312636 </row> + <row>2.28467204 2.60278291 2.60278291 2.28467204 </row> + <row>2.60278291 2.8656569 2.8656569 2.60278291 </row> + <row>2.8656569 3.06260729 3.06260729 2.8656569 </row> + <row>3.06260729 3.18443988 3.18443988 3.06260729 </row> + <row>0 0.0805949288 0.0890936125 0 </row> + <row>0.0805949288 0.154900373 0.171234518 0.0890936125 </row> + <row>0.154900373 0.216898576 0.239770392 0.171234518 </row> + <row>0.216898576 0.261105376 0.288638771 0.239770392 </row> + <row>0.261105376 0.2828127 0.312635118 0.288638771 </row> + <row>0.2828127 0.278302775 0.307649624 0.312635118 </row> + <row>0.278302775 0.245026149 0.270864 0.307649624 </row> + <row>0.245026149 0.181736777 0.200900804 0.270864 </row> + <row>0.181736777 0.0885788797 0.0979194659 0.200900804 </row> + <row>0.0885788797 -0.0328780681 -0.0363450394 0.0979194659 </row> + <row>-0.0328780681 -0.179658148 -0.198602985 -0.0363450394 </row> + <row>-0.179658148 -0.347451675 -0.384090232 -0.198602985 </row> + <row>-0.347451675 -0.53073998 -0.586706172 -0.384090232 </row> + <row>-0.53073998 -0.722968715 -0.799205304 -0.586706172 </row> + <row>-0.722968715 -0.916764415 -1.01343664 -0.799205304 </row> + <row>-0.916764415 -1.10418749 -1.22062336 -1.01343664 </row> + <row>-1.10418749 -1.27701351 -1.41167377 -1.22062336 </row> + <row>-1.27701351 -1.42703347 -1.57751323 -1.41167377 </row> + <row>-1.42703347 -1.5463631 -1.7094261 -1.57751323 </row> + <row>-1.5463631 -1.62775063 -1.79939589 -1.7094261 </row> + <row>-1.62775063 -1.66487238 -1.84043211 -1.79939589 </row> + <row>-1.66487238 -1.65260572 -1.82687194 -1.84043211 </row> + <row>-1.65260572 -1.58726952 -1.75464608 -1.82687194 </row> + <row>-1.58726952 -1.46682306 -1.62149862 -1.75464608 </row> + <row>-1.46682306 -1.29101556 -1.42715233 -1.62149862 </row> + <row>-1.29101556 -1.06147996 -1.17341234 -1.42715233 </row> + <row>-1.06147996 -0.78176627 -0.864203023 -1.17341234 </row> + <row>-0.78176627 -0.457311649 -0.50553487 -0.864203023 </row> + <row>-0.457311649 -0.0953463975 -0.105400614 -0.50553487 </row> + <row>-0.0953463975 0.295262932 0.32639822 -0.105400614 </row> + <row>0.295262932 0.704230011 0.778490615 0.32639822 </row> + <row>0.704230011 1.12011954 1.23823543 0.778490615 </row> + <row>1.12011954 1.53066526 1.69207293 1.23823543 </row> + <row>1.53066526 1.92312636 2.1259188 1.69207293 </row> + <row>1.92312636 2.28467204 2.52558925 2.1259188 </row> + <row>2.28467204 2.60278291 2.8772447 2.52558925 </row> + <row>2.60278291 2.8656569 3.16783859 2.8772447 </row> + <row>2.8656569 3.06260729 3.38555727 3.16783859 </row> + <row>3.06260729 3.18443988 3.52023703 3.38555727 </row> + <row>0 0.0890936125 0.105170016 0 </row> + <row>0.0890936125 0.171234518 0.202132751 0.105170016 </row> + <row>0.171234518 0.239770392 0.283035508 0.202132751 </row> + <row>0.239770392 0.288638771 0.340721891 0.283035508 </row> + <row>0.288638771 0.312635118 0.369048233 0.340721891 </row> + <row>0.312635118 0.307649624 0.363163137 0.369048233 </row> + <row>0.307649624 0.270864 0.31973977 0.363163137 </row> + <row>0.270864 0.200900804 0.237152138 0.31973977 </row> + <row>0.200900804 0.0979194659 0.115588441 0.237152138 </row> + <row>0.0979194659 -0.0363450394 -0.0429032817 0.115588441 </row> + <row>-0.0363450394 -0.198602985 -0.234439691 -0.0429032817 </row> + <row>-0.198602985 -0.384090232 -0.45339699 -0.234439691 </row> + <row>-0.384090232 -0.586706172 -0.69257375 -0.45339699 </row> + <row>-0.586706172 -0.799205304 -0.943417063 -0.69257375 </row> + <row>-0.799205304 -1.01343664 -1.19630514 -0.943417063 </row> + <row>-1.01343664 -1.22062336 -1.44087746 -1.19630514 </row> + <row>-1.22062336 -1.41167377 -1.66640176 -1.44087746 </row> + <row>-1.41167377 -1.57751323 -1.86216595 -1.66640176 </row> + <row>-1.57751323 -1.7094261 -2.01788169 -1.86216595 </row> + <row>-1.7094261 -1.79939589 -2.12408599 -2.01788169 </row> + <row>-1.79939589 -1.84043211 -2.17252694 -2.12408599 </row> + <row>-1.84043211 -1.82687194 -2.15651992 -2.17252694 </row> + <row>-1.82687194 -1.75464608 -2.07126134 -2.15651992 </row> + <row>-1.75464608 -1.62149862 -1.91408823 -2.07126134 </row> + <row>-1.62149862 -1.42715233 -1.68467333 -1.91408823 </row> + <row>-1.42715233 -1.17341234 -1.3851475 -1.68467333 </row> + <row>-1.17341234 -0.864203023 -1.02014323 -1.3851475 </row> + <row>-0.864203023 -0.50553487 -0.596755577 -1.02014323 </row> + <row>-0.50553487 -0.105400614 -0.124419517 -0.596755577 </row> + <row>-0.105400614 0.32639822 0.385294803 -0.124419517 </row> + <row>0.32639822 0.778490615 0.918964535 0.385294803 </row> + <row>0.778490615 1.23823543 1.46166752 0.918964535 </row> + <row>1.23823543 1.69207293 1.99739725 1.46166752 </row> + <row>1.69207293 2.1259188 2.50952798 1.99739725 </row> + <row>2.1259188 2.52558925 2.98131654 2.50952798 </row> + <row>2.52558925 2.8772447 3.39642609 2.98131654 </row> + <row>2.8772447 3.16783859 3.73945589 3.39642609 </row> + <row>3.16783859 3.38555727 3.99646059 3.73945589 </row> + <row>3.38555727 3.52023703 4.1554425 3.99646059 </row> + <row>0 0.105170016 0.12708201 0 </row> + <row>0.105170016 0.202132751 0.244246768 0.12708201 </row> + <row>0.202132751 0.283035508 0.342005477 0.244246768 </row> + <row>0.283035508 0.340721891 0.41171072 0.342005477 </row> + <row>0.340721891 0.369048233 0.445938808 0.41171072 </row> + <row>0.369048233 0.363163137 0.438827562 0.445938808 </row> + <row>0.363163137 0.31973977 0.38635701 0.438827562 </row> + <row>0.31973977 0.237152138 0.286562385 0.38635701 </row> + <row>0.237152138 0.115588441 0.139671097 0.286562385 </row> + <row>0.115588441 -0.0429032817 -0.0518421079 0.139671097 </row> + <row>-0.0429032817 -0.234439691 -0.283284804 -0.0518421079 </row> + <row>-0.234439691 -0.45339699 -0.547861486 -0.283284804 </row> + <row>-0.45339699 -0.69257375 -0.836870319 -0.547861486 </row> + <row>-0.69257375 -0.943417063 -1.13997641 -0.836870319 </row> + <row>-0.943417063 -1.19630514 -1.4455533 -1.13997641 </row> + <row>-1.19630514 -1.44087746 -1.74108184 -1.4455533 </row> + <row>-1.44087746 -1.66640176 -2.01359374 -1.74108184 </row> + <row>-1.66640176 -1.86216595 -2.25014507 -2.01359374 </row> + <row>-1.86216595 -2.01788169 -2.43830393 -2.25014507 </row> + <row>-2.01788169 -2.12408599 -2.56663571 -2.43830393 </row> + <row>-2.12408599 -2.17252694 -2.62516925 -2.56663571 </row> + <row>-2.17252694 -2.15651992 -2.6058272 -2.62516925 </row> + <row>-2.15651992 -2.07126134 -2.50280514 -2.6058272 </row> + <row>-2.07126134 -1.91408823 -2.31288527 -2.50280514 </row> + <row>-1.91408823 -1.68467333 -2.03567217 -2.31288527 </row> + <row>-1.68467333 -1.3851475 -1.67374064 -2.03567217 </row> + <row>-1.3851475 -1.02014323 -1.23268834 -1.67374064 </row> + <row>-1.02014323 -0.596755577 -0.721088592 -1.23268834 </row> + <row>-0.596755577 -0.124419517 -0.150342113 -0.721088592 </row> + <row>-0.124419517 0.385294803 0.465570323 -0.150342113 </row> + <row>0.385294803 0.918964535 1.11042924 0.465570323 </row> + <row>0.918964535 1.46166752 1.76620347 1.11042924 </row> + <row>1.46166752 1.99739725 2.41355159 1.76620347 </row> + <row>1.99739725 2.50952798 3.03238389 2.41355159 </row> + <row>2.50952798 2.98131654 3.6024688 3.03238389 </row> + <row>2.98131654 3.39642609 4.10406572 3.6024688 </row> + <row>3.39642609 3.73945589 4.5185652 4.10406572 </row> + <row>3.73945589 3.99646059 4.8291164 4.5185652 </row> + <row>3.99646059 4.1554425 5.02122191 4.8291164 </row> + <row>0 0.12708201 0.152455092 0 </row> + <row>0.12708201 0.244246768 0.293012861 0.152455092 </row> + <row>0.244246768 0.342005477 0.410289988 0.293012861 </row> + <row>0.342005477 0.41171072 0.493912519 0.410289988 </row> + <row>0.41171072 0.445938808 0.534974556 0.493912519 </row> + <row>0.445938808 0.438827562 0.526443485 0.534974556 </row> + <row>0.438827562 0.38635701 0.463496709 0.526443485 </row> + <row>0.38635701 0.286562385 0.343777177 0.463496709 </row> + <row>0.286562385 0.139671097 0.167557705 0.343777177 </row> + <row>0.139671097 -0.0518421079 -0.0621928573 0.167557705 </row> + <row>-0.0518421079 -0.283284804 -0.339845198 -0.0621928573 </row> + <row>-0.283284804 -0.547861486 -0.657247026 -0.339845198 </row> + <row>-0.547861486 -0.836870319 -1.00395911 -0.657247026 </row> + <row>-0.836870319 -1.13997641 -1.3675831 -1.00395911 </row> + <row>-1.13997641 -1.4455533 -1.73417119 -1.3675831 </row> + <row>-1.4455533 -1.74108184 -2.0887047 -1.73417119 </row> + <row>-1.74108184 -2.01359374 -2.41562609 -2.0887047 </row> + <row>-2.01359374 -2.25014507 -2.69940705 -2.41562609 </row> + <row>-2.25014507 -2.43830393 -2.92513353 -2.69940705 </row> + <row>-2.43830393 -2.56663571 -3.07908793 -2.92513353 </row> + <row>-2.56663571 -2.62516925 -3.14930823 -3.07908793 </row> + <row>-2.62516925 -2.6058272 -3.12610435 -3.14930823 </row> + <row>-2.6058272 -2.50280514 -3.002513 -3.12610435 </row> + <row>-2.50280514 -2.31288527 -2.7746739 -3.002513 </row> + <row>-2.31288527 -2.03567217 -2.44211267 -2.7746739 </row> + <row>-2.03567217 -1.67374064 -2.00791821 -2.44211267 </row> + <row>-1.67374064 -1.23268834 -1.47880581 -2.00791821 </row> + <row>-1.23268834 -0.721088592 -0.865060504 -1.47880581 </row> + <row>-0.721088592 -0.150342113 -0.180359286 -0.865060504 </row> + <row>-0.150342113 0.465570323 0.558525682 -0.180359286 </row> + <row>0.465570323 1.11042924 1.33213656 0.558525682 </row> + <row>1.11042924 1.76620347 2.1188421 1.33213656 </row> + <row>1.76620347 2.41355159 2.89543917 2.1188421 </row> + <row>2.41355159 3.03238389 3.63782698 2.89543917 </row> + <row>3.03238389 3.6024688 4.32173454 3.63782698 </row> + <row>3.6024688 4.10406572 4.92347986 4.32173454 </row> + <row>4.10406572 4.5185652 5.42073793 4.92347986 </row> + <row>4.5185652 4.8291164 5.79329351 5.42073793 </row> + <row>4.8291164 5.02122191 6.02375464 5.79329351 </row> + <row>0 0.152455092 0.178539694 0 </row> + <row>0.152455092 0.293012861 0.343146469 0.178539694 </row> + <row>0.293012861 0.410289988 0.480489355 0.343146469 </row> + <row>0.410289988 0.493912519 0.578419446 0.480489355 </row> + <row>0.493912519 0.534974556 0.626507073 0.578419446 </row> + <row>0.534974556 0.526443485 0.616516362 0.626507073 </row> + <row>0.526443485 0.463496709 0.542799584 0.616516362 </row> + <row>0.463496709 0.343777177 0.402596405 0.542799584 </row> + <row>0.343777177 0.167557705 0.196226318 0.402596405 </row> + <row>0.167557705 -0.0621928573 -0.0728338658 0.196226318 </row> + <row>-0.0621928573 -0.339845198 -0.397991676 -0.0728338658 </row> + <row>-0.339845198 -0.657247026 -0.76969999 -0.397991676 </row> + <row>-0.657247026 -1.00395911 -1.17573345 -0.76969999 </row> + <row>-1.00395911 -1.3675831 -1.6015724 -1.17573345 </row> + <row>-1.3675831 -1.73417119 -2.0308826 -1.6015724 </row> + <row>-1.73417119 -2.0887047 -2.44607571 -2.0308826 </row> + <row>-2.0887047 -2.41562609 -2.82893236 -2.44607571 </row> + <row>-2.41562609 -2.69940705 -3.16126738 -2.82893236 </row> + <row>-2.69940705 -2.92513353 -3.42561497 -3.16126738 </row> + <row>-2.92513353 -3.07908793 -3.60591049 -3.42561497 </row> + <row>-3.07908793 -3.14930823 -3.68814527 -3.60591049 </row> + <row>-3.14930823 -3.12610435 -3.66097128 -3.68814527 </row> + <row>-3.12610435 -3.002513 -3.51623383 -3.66097128 </row> + <row>-3.002513 -2.7746739 -3.24941216 -3.51623383 </row> + <row>-2.7746739 -2.44211267 -2.85995071 -3.24941216 </row> + <row>-2.44211267 -2.00791821 -2.3514669 -2.85995071 </row> + <row>-2.00791821 -1.47880581 -1.73182498 -2.3514669 </row> + <row>-1.47880581 -0.865060504 -1.01306972 -1.73182498 </row> + <row>-0.865060504 -0.180359286 -0.211218211 -1.01306972 </row> + <row>-0.180359286 0.558525682 0.654087725 -0.211218211 </row> + <row>0.558525682 1.33213656 1.56006107 0.654087725 </row> + <row>1.33213656 2.1188421 2.48136953 1.56006107 </row> + <row>2.1188421 2.89543917 3.39083999 2.48136953 </row> + <row>2.89543917 3.63782698 4.2602481 3.39083999 </row> + <row>3.63782698 4.32173454 5.06117015 4.2602481 </row> + <row>4.32173454 4.92347986 5.76587226 5.06117015 </row> + <row>4.92347986 5.42073793 6.34820968 5.76587226 </row> + <row>5.42073793 5.79329351 6.78450838 6.34820968 </row> + <row>5.79329351 6.02375464 7.05440071 6.78450838 </row> + <row>0 0.178539694 0.202509145 0 </row> + <row>0.178539694 0.343146469 0.389214837 0.202509145 </row> + <row>0.343146469 0.480489355 0.544996387 0.389214837 </row> + <row>0.480489355 0.578419446 0.656073865 0.544996387 </row> + <row>0.578419446 0.626507073 0.71061739 0.656073865 </row> + <row>0.626507073 0.616516362 0.699285398 0.71061739 </row> + <row>0.616516362 0.542799584 0.615671937 0.699285398 </row> + <row>0.542799584 0.402596405 0.456646092 0.615671937 </row> + <row>0.402596405 0.196226318 0.222570246 0.456646092 </row> + <row>0.196226318 -0.0728338658 -0.0826120148 0.222570246 </row> + <row>-0.0728338658 -0.397991676 -0.451423165 -0.0826120148 </row> + <row>-0.397991676 -0.76969999 -0.873034354 -0.451423165 </row> + <row>-0.76969999 -1.17573345 -1.33357894 -0.873034354 </row> + <row>-1.17573345 -1.6015724 -1.81658795 -1.33357894 </row> + <row>-1.6015724 -2.0308826 -2.30353423 -1.81658795 </row> + <row>-2.0308826 -2.44607571 -2.77446817 -2.30353423 </row> + <row>-2.44607571 -2.82893236 -3.20872439 -2.77446817 </row> + <row>-2.82893236 -3.16126738 -3.58567631 -3.20872439 </row> + <row>-3.16126738 -3.42561497 -3.8855133 -3.58567631 </row> + <row>-3.42561497 -3.60591049 -4.090014 -3.8855133 </row> + <row>-3.60591049 -3.68814527 -4.18328903 -4.090014 </row> + <row>-3.68814527 -3.66097128 -4.15246686 -4.18328903 </row> + <row>-3.66097128 -3.51623383 -3.988298 -4.15246686 </row> + <row>-3.51623383 -3.24941216 -3.68565477 -3.988298 </row> + <row>-3.24941216 -2.85995071 -3.24390705 -3.68565477 </row> + <row>-2.85995071 -2.3514669 -2.66715787 -3.24390705 </row> + <row>-2.3514669 -1.73182498 -1.9643273 -2.66715787 </row> + <row>-1.73182498 -1.01306972 -1.14907715 -1.9643273 </row> + <row>-1.01306972 -0.211218211 -0.239574843 -1.14907715 </row> + <row>-0.211218211 0.654087725 0.741900821 -0.239574843 </row> + <row>0.654087725 1.56006107 1.76950361 0.741900821 </row> + <row>1.56006107 2.48136953 2.81450028 1.76950361 </row> + <row>2.48136953 3.39083999 3.84606969 2.81450028 </row> + <row>3.39083999 4.2602481 4.83219825 3.84606969 </row> + <row>4.2602481 5.06117015 5.74064632 4.83219825 </row> + <row>5.06117015 5.76587226 6.53995665 5.74064632 </row> + <row>5.76587226 6.34820968 7.20047448 6.53995665 </row> + <row>6.34820968 6.78450838 7.6953475 7.20047448 </row> + <row>6.78450838 7.05440071 8.00147362 7.6953475 </row> + <row>0 0.202509145 0.221765982 0 </row> + <row>0.202509145 0.389214837 0.426225742 0.221765982 </row> + <row>0.389214837 0.544996387 0.596820746 0.426225742 </row> + <row>0.544996387 0.656073865 0.718460715 0.596820746 </row> + <row>0.656073865 0.71061739 0.778190849 0.718460715 </row> + <row>0.71061739 0.699285398 0.765781284 0.778190849 </row> + <row>0.699285398 0.615671937 0.674216919 0.765781284 </row> + <row>0.615671937 0.456646092 0.500069116 0.674216919 </row> + <row>0.456646092 0.222570246 0.243734718 0.500069116 </row> + <row>0.222570246 -0.0826120148 -0.0904676902 0.243734718 </row> + <row>-0.0826120148 -0.451423165 -0.494349535 -0.0904676902 </row> + <row>-0.451423165 -0.873034354 -0.956052236 -0.494349535 </row> + <row>-0.873034354 -1.33357894 -1.46039056 -0.956052236 </row> + <row>-1.33357894 -1.81658795 -1.98932947 -1.46039056 </row> + <row>-1.81658795 -2.30353423 -2.52258006 -1.98932947 </row> + <row>-2.30353423 -2.77446817 -3.03829568 -2.52258006 </row> + <row>-2.77446817 -3.20872439 -3.51384584 -3.03829568 </row> + <row>-3.20872439 -3.58567631 -3.92664257 -3.51384584 </row> + <row>-3.58567631 -3.8855133 -4.25499142 -3.92664257 </row> + <row>-3.8855133 -4.090014 -4.47893834 -4.25499142 </row> + <row>-4.090014 -4.18328903 -4.58108299 -4.47893834 </row> + <row>-4.18328903 -4.15246686 -4.54732991 -4.58108299 </row> + <row>-4.15246686 -3.988298 -4.36755004 -4.54732991 </row> + <row>-3.988298 -3.68565477 -4.0361281 -4.36755004 </row> + <row>-3.68565477 -3.24390705 -3.55237405 -4.0361281 </row> + <row>-3.24390705 -2.66715787 -2.92078111 -3.55237405 </row> + <row>-2.66715787 -1.9643273 -2.15111753 -2.92078111 </row> + <row>-1.9643273 -1.14907715 -1.25834427 -2.15111753 </row> + <row>-1.14907715 -0.239574843 -0.262356302 -1.25834427 </row> + <row>-0.239574843 0.741900821 0.812449059 -0.262356302 </row> + <row>0.741900821 1.76950361 1.93776782 0.812449059 </row> + <row>1.76950361 2.81450028 3.08213449 1.93776782 </row> + <row>2.81450028 3.84606969 4.21179706 3.08213449 </row> + <row>3.84606969 4.83219825 5.29169777 4.21179706 </row> + <row>4.83219825 5.74064632 6.28653125 5.29169777 </row> + <row>5.74064632 6.53995665 7.16184896 6.28653125 </row> + <row>6.53995665 7.20047448 7.88517623 7.16184896 </row> + <row>7.20047448 7.6953475 8.42710731 7.88517623 </row> + <row>7.6953475 8.00147362 8.76234333 8.42710731 </row> + <row>0 0.221765982 0.234223429 0 </row> + <row>0.221765982 0.426225742 0.450168479 0.234223429 </row> + <row>0.426225742 0.596820746 0.630346459 0.450168479 </row> + <row>0.596820746 0.718460715 0.758819412 0.630346459 </row> + <row>0.718460715 0.778190849 0.821904817 0.758819412 </row> + <row>0.778190849 0.765781284 0.808798159 0.821904817 </row> + <row>0.765781284 0.674216919 0.712090273 0.808798159 </row> + <row>0.674216919 0.500069116 0.528159918 0.712090273 </row> + <row>0.500069116 0.243734718 0.257426233 0.528159918 </row> + <row>0.243734718 -0.0904676902 -0.0955496078 0.257426233 </row> + <row>-0.0904676902 -0.494349535 -0.522119046 -0.0955496078 </row> + <row>-0.494349535 -0.956052236 -1.00975736 -0.522119046 </row> + <row>-0.956052236 -1.46039056 -1.5424263 -1.00975736 </row> + <row>-1.46039056 -1.98932947 -2.10107774 -1.5424263 </row> + <row>-1.98932947 -2.52258006 -2.66428307 -2.10107774 </row> + <row>-2.52258006 -3.03829568 -3.20896841 -2.66428307 </row> + <row>-3.03829568 -3.51384584 -3.71123205 -3.20896841 </row> + <row>-3.51384584 -3.92664257 -4.14721716 -3.71123205 </row> + <row>-3.92664257 -4.25499142 -4.49401063 -4.14721716 </row> + <row>-4.25499142 -4.47893834 -4.7305375 -4.49401063 </row> + <row>-4.47893834 -4.58108299 -4.83842002 -4.7305375 </row> + <row>-4.58108299 -4.54732991 -4.80277089 -4.83842002 </row> + <row>-4.54732991 -4.36755004 -4.61289209 -4.80277089 </row> + <row>-4.36755004 -4.0361281 -4.26285291 -4.61289209 </row> + <row>-4.0361281 -3.55237405 -3.75192454 -4.26285291 </row> + <row>-3.55237405 -2.92078111 -3.0848526 -3.75192454 </row> + <row>-2.92078111 -2.15111753 -2.27195406 -3.0848526 </row> + <row>-2.15111753 -1.25834427 -1.3290303 -2.27195406 </row> + <row>-1.25834427 -0.262356302 -0.277093863 -1.3290303 </row> + <row>-0.262356302 0.812449059 0.858087442 -0.277093863 </row> + <row>0.812449059 1.93776782 2.04661968 0.858087442 </row> + <row>1.93776782 3.08213449 3.25526982 2.04661968 </row> + <row>3.08213449 4.21179706 4.44838988 3.25526982 </row> + <row>4.21179706 5.29169777 5.58895276 4.44838988 </row> + <row>5.29169777 6.28653125 6.63966985 5.58895276 </row> + <row>6.28653125 7.16184896 7.56415751 6.63966985 </row> + <row>7.16184896 7.88517623 8.32811685 7.56415751 </row> + <row>7.88517623 8.42710731 8.90049028 8.32811685 </row> + <row>8.42710731 8.76234333 9.25455781 8.90049028 </row> + <row>0 0.234223429 0.238531527 0 </row> + <row>0.234223429 0.450168479 0.45844848 0.238531527 </row> + <row>0.450168479 0.630346459 0.641940495 0.45844848 </row> + <row>0.630346459 0.758819412 0.772776465 0.641940495 </row> + <row>0.758819412 0.821904817 0.837022208 0.772776465 </row> + <row>0.821904817 0.808798159 0.823674478 0.837022208 </row> + <row>0.808798159 0.712090273 0.725187832 0.823674478 </row> + <row>0.712090273 0.528159918 0.537874425 0.725187832 </row> + <row>0.528159918 0.257426233 0.262161103 0.537874425 </row> + <row>0.257426233 -0.0955496078 -0.0973070628 0.262161103 </row> + <row>-0.0955496078 -0.522119046 -0.531722442 -0.0973070628 </row> + <row>-0.522119046 -1.00975736 -1.02832995 -0.531722442 </row> + <row>-1.00975736 -1.5424263 -1.57079633 -1.02832995 </row> + <row>-1.5424263 -2.10107774 -2.13972311 -1.57079633 </row> + <row>-2.10107774 -2.66428307 -2.71328754 -2.13972311 </row> + <row>-2.66428307 -3.20896841 -3.26799134 -2.71328754 </row> + <row>-3.20896841 -3.71123205 -3.77949317 -3.26799134 </row> + <row>-3.71123205 -4.14721716 -4.2234974 -3.77949317 </row> + <row>-4.14721716 -4.49401063 -4.57666948 -4.2234974 </row> + <row>-4.49401063 -4.7305375 -4.81754683 -4.57666948 </row> + <row>-4.7305375 -4.83842002 -4.92741364 -4.81754683 </row> + <row>-4.83842002 -4.80277089 -4.89110881 -4.92741364 </row> + <row>-4.80277089 -4.61289209 -4.69773755 -4.89110881 </row> + <row>-4.61289209 -4.26285291 -4.34126006 -4.69773755 </row> + <row>-4.26285291 -3.75192454 -3.82093413 -4.34126006 </row> + <row>-3.75192454 -3.0848526 -3.14159265 -3.82093413 </row> + <row>-3.0848526 -2.27195406 -2.31374238 -3.14159265 </row> + <row>-2.27195406 -1.3290303 -1.35347531 -2.31374238 </row> + <row>-1.3290303 -0.277093863 -0.282190482 -1.35347531 </row> + <row>-0.277093863 0.858087442 0.873870344 -0.282190482 </row> + <row>0.858087442 2.04661968 2.0842634 0.873870344 </row> + <row>2.04661968 3.25526982 3.31514437 2.0842634 </row> + <row>3.25526982 4.44838988 4.53020963 3.31514437 </row> + <row>4.44838988 5.58895276 5.69175101 4.53020963 </row> + <row>5.58895276 6.63966985 6.76179407 5.69175101 </row> + <row>6.63966985 7.56415751 7.70328594 6.76179407 </row> + <row>7.56415751 8.32811685 8.48129687 7.70328594 </row> + <row>8.32811685 8.90049028 9.06419803 8.48129687 </row> + <row>8.90049028 9.25455781 9.42477796 9.06419803 </row> + </matrix> + <matrix title='y' rows='741' cols='4' element-type='double' data-channel='1'> + <row>0 0 0.0261557299 0 </row> + <row>0 0 0.0523114599 0.0261557299 </row> + <row>0 0 0.0784671898 0.0523114599 </row> + <row>0 0 0.10462292 0.0784671898 </row> + <row>0 0 0.13077865 0.10462292 </row> + <row>0 0 0.15693438 0.13077865 </row> + <row>0 0 0.183090109 0.15693438 </row> + <row>0 0 0.209245839 0.183090109 </row> + <row>0 0 0.235401569 0.209245839 </row> + <row>0 0 0.261557299 0.235401569 </row> + <row>0 0 0.287713029 0.261557299 </row> + <row>0 0 0.313868759 0.287713029 </row> + <row>0 0 0.340024489 0.313868759 </row> + <row>0 0 0.366180219 0.340024489 </row> + <row>0 0 0.392335949 0.366180219 </row> + <row>0 0 0.418491679 0.392335949 </row> + <row>0 0 0.444647409 0.418491679 </row> + <row>0 0 0.470803139 0.444647409 </row> + <row>0 0 0.496958869 0.470803139 </row> + <row>0 0 0.523114599 0.496958869 </row> + <row>0 0 0.549270328 0.523114599 </row> + <row>0 0 0.575426058 0.549270328 </row> + <row>0 0 0.601581788 0.575426058 </row> + <row>0 0 0.627737518 0.601581788 </row> + <row>0 0 0.653893248 0.627737518 </row> + <row>0 0 0.680048978 0.653893248 </row> + <row>0 0 0.706204708 0.680048978 </row> + <row>0 0 0.732360438 0.706204708 </row> + <row>0 0 0.758516168 0.732360438 </row> + <row>0 0 0.784671898 0.758516168 </row> + <row>0 0 0.810827628 0.784671898 </row> + <row>0 0 0.836983358 0.810827628 </row> + <row>0 0 0.863139088 0.836983358 </row> + <row>0 0 0.889294817 0.863139088 </row> + <row>0 0 0.915450547 0.889294817 </row> + <row>0 0 0.941606277 0.915450547 </row> + <row>0 0 0.967762007 0.941606277 </row> + <row>0 0 0.993917737 0.967762007 </row> + <row>0 0 1.02007347 0.993917737 </row> + <row>0 0.0261557299 0.0494770807 0 </row> + <row>0.0261557299 0.0523114599 0.0989541613 0.0494770807 </row> + <row>0.0523114599 0.0784671898 0.148431242 0.0989541613 </row> + <row>0.0784671898 0.10462292 0.197908323 0.148431242 </row> + <row>0.10462292 0.13077865 0.247385403 0.197908323 </row> + <row>0.13077865 0.15693438 0.296862484 0.247385403 </row> + <row>0.15693438 0.183090109 0.346339565 0.296862484 </row> + <row>0.183090109 0.209245839 0.395816645 0.346339565 </row> + <row>0.209245839 0.235401569 0.445293726 0.395816645 </row> + <row>0.235401569 0.261557299 0.494770807 0.445293726 </row> + <row>0.261557299 0.287713029 0.544247887 0.494770807 </row> + <row>0.287713029 0.313868759 0.593724968 0.544247887 </row> + <row>0.313868759 0.340024489 0.643202049 0.593724968 </row> + <row>0.340024489 0.366180219 0.692679129 0.643202049 </row> + <row>0.366180219 0.392335949 0.74215621 0.692679129 </row> + <row>0.392335949 0.418491679 0.791633291 0.74215621 </row> + <row>0.418491679 0.444647409 0.841110371 0.791633291 </row> + <row>0.444647409 0.470803139 0.890587452 0.841110371 </row> + <row>0.470803139 0.496958869 0.940064533 0.890587452 </row> + <row>0.496958869 0.523114599 0.989541613 0.940064533 </row> + <row>0.523114599 0.549270328 1.03901869 0.989541613 </row> + <row>0.549270328 0.575426058 1.08849577 1.03901869 </row> + <row>0.575426058 0.601581788 1.13797286 1.08849577 </row> + <row>0.601581788 0.627737518 1.18744994 1.13797286 </row> + <row>0.627737518 0.653893248 1.23692702 1.18744994 </row> + <row>0.653893248 0.680048978 1.2864041 1.23692702 </row> + <row>0.680048978 0.706204708 1.33588118 1.2864041 </row> + <row>0.706204708 0.732360438 1.38535826 1.33588118 </row> + <row>0.732360438 0.758516168 1.43483534 1.38535826 </row> + <row>0.758516168 0.784671898 1.48431242 1.43483534 </row> + <row>0.784671898 0.810827628 1.5337895 1.48431242 </row> + <row>0.810827628 0.836983358 1.58326658 1.5337895 </row> + <row>0.836983358 0.863139088 1.63274366 1.58326658 </row> + <row>0.863139088 0.889294817 1.68222074 1.63274366 </row> + <row>0.889294817 0.915450547 1.73169782 1.68222074 </row> + <row>0.915450547 0.941606277 1.7811749 1.73169782 </row> + <row>0.941606277 0.967762007 1.83065198 1.7811749 </row> + <row>0.967762007 0.993917737 1.88012907 1.83065198 </row> + <row>0.993917737 1.02007347 1.92960615 1.88012907 </row> + <row>0 0.0494770807 0.067436822 0 </row> + <row>0.0494770807 0.0989541613 0.134873644 0.067436822 </row> + <row>0.0989541613 0.148431242 0.202310466 0.134873644 </row> + <row>0.148431242 0.197908323 0.269747288 0.202310466 </row> + <row>0.197908323 0.247385403 0.33718411 0.269747288 </row> + <row>0.247385403 0.296862484 0.404620932 0.33718411 </row> + <row>0.296862484 0.346339565 0.472057754 0.404620932 </row> + <row>0.346339565 0.395816645 0.539494576 0.472057754 </row> + <row>0.395816645 0.445293726 0.606931398 0.539494576 </row> + <row>0.445293726 0.494770807 0.67436822 0.606931398 </row> + <row>0.494770807 0.544247887 0.741805042 0.67436822 </row> + <row>0.544247887 0.593724968 0.809241864 0.741805042 </row> + <row>0.593724968 0.643202049 0.876678686 0.809241864 </row> + <row>0.643202049 0.692679129 0.944115508 0.876678686 </row> + <row>0.692679129 0.74215621 1.01155233 0.944115508 </row> + <row>0.74215621 0.791633291 1.07898915 1.01155233 </row> + <row>0.791633291 0.841110371 1.14642597 1.07898915 </row> + <row>0.841110371 0.890587452 1.2138628 1.14642597 </row> + <row>0.890587452 0.940064533 1.28129962 1.2138628 </row> + <row>0.940064533 0.989541613 1.34873644 1.28129962 </row> + <row>0.989541613 1.03901869 1.41617326 1.34873644 </row> + <row>1.03901869 1.08849577 1.48361008 1.41617326 </row> + <row>1.08849577 1.13797286 1.55104691 1.48361008 </row> + <row>1.13797286 1.18744994 1.61848373 1.55104691 </row> + <row>1.18744994 1.23692702 1.68592055 1.61848373 </row> + <row>1.23692702 1.2864041 1.75335737 1.68592055 </row> + <row>1.2864041 1.33588118 1.82079419 1.75335737 </row> + <row>1.33588118 1.38535826 1.88823102 1.82079419 </row> + <row>1.38535826 1.43483534 1.95566784 1.88823102 </row> + <row>1.43483534 1.48431242 2.02310466 1.95566784 </row> + <row>1.48431242 1.5337895 2.09054148 2.02310466 </row> + <row>1.5337895 1.58326658 2.1579783 2.09054148 </row> + <row>1.58326658 1.63274366 2.22541513 2.1579783 </row> + <row>1.63274366 1.68222074 2.29285195 2.22541513 </row> + <row>1.68222074 1.73169782 2.36028877 2.29285195 </row> + <row>1.73169782 1.7811749 2.42772559 2.36028877 </row> + <row>1.7811749 1.83065198 2.49516241 2.42772559 </row> + <row>1.83065198 1.88012907 2.56259924 2.49516241 </row> + <row>1.88012907 1.92960615 2.63003606 2.56259924 </row> + <row>0 0.067436822 0.0780887373 0 </row> + <row>0.067436822 0.134873644 0.156177475 0.0780887373 </row> + <row>0.134873644 0.202310466 0.234266212 0.156177475 </row> + <row>0.202310466 0.269747288 0.312354949 0.234266212 </row> + <row>0.269747288 0.33718411 0.390443686 0.312354949 </row> + <row>0.33718411 0.404620932 0.468532424 0.390443686 </row> + <row>0.404620932 0.472057754 0.546621161 0.468532424 </row> + <row>0.472057754 0.539494576 0.624709898 0.546621161 </row> + <row>0.539494576 0.606931398 0.702798636 0.624709898 </row> + <row>0.606931398 0.67436822 0.780887373 0.702798636 </row> + <row>0.67436822 0.741805042 0.85897611 0.780887373 </row> + <row>0.741805042 0.809241864 0.937064847 0.85897611 </row> + <row>0.809241864 0.876678686 1.01515358 0.937064847 </row> + <row>0.876678686 0.944115508 1.09324232 1.01515358 </row> + <row>0.944115508 1.01155233 1.17133106 1.09324232 </row> + <row>1.01155233 1.07898915 1.2494198 1.17133106 </row> + <row>1.07898915 1.14642597 1.32750853 1.2494198 </row> + <row>1.14642597 1.2138628 1.40559727 1.32750853 </row> + <row>1.2138628 1.28129962 1.48368601 1.40559727 </row> + <row>1.28129962 1.34873644 1.56177475 1.48368601 </row> + <row>1.34873644 1.41617326 1.63986348 1.56177475 </row> + <row>1.41617326 1.48361008 1.71795222 1.63986348 </row> + <row>1.48361008 1.55104691 1.79604096 1.71795222 </row> + <row>1.55104691 1.61848373 1.87412969 1.79604096 </row> + <row>1.61848373 1.68592055 1.95221843 1.87412969 </row> + <row>1.68592055 1.75335737 2.03030717 1.95221843 </row> + <row>1.75335737 1.82079419 2.10839591 2.03030717 </row> + <row>1.82079419 1.88823102 2.18648464 2.10839591 </row> + <row>1.88823102 1.95566784 2.26457338 2.18648464 </row> + <row>1.95566784 2.02310466 2.34266212 2.26457338 </row> + <row>2.02310466 2.09054148 2.42075086 2.34266212 </row> + <row>2.09054148 2.1579783 2.49883959 2.42075086 </row> + <row>2.1579783 2.22541513 2.57692833 2.49883959 </row> + <row>2.22541513 2.29285195 2.65501707 2.57692833 </row> + <row>2.29285195 2.36028877 2.7331058 2.65501707 </row> + <row>2.36028877 2.42772559 2.81119454 2.7331058 </row> + <row>2.42772559 2.49516241 2.88928328 2.81119454 </row> + <row>2.49516241 2.56259924 2.96737202 2.88928328 </row> + <row>2.56259924 2.63003606 3.04546075 2.96737202 </row> + <row>0 0.0780887373 0.0802785262 0 </row> + <row>0.0780887373 0.156177475 0.160557052 0.0802785262 </row> + <row>0.156177475 0.234266212 0.240835579 0.160557052 </row> + <row>0.234266212 0.312354949 0.321114105 0.240835579 </row> + <row>0.312354949 0.390443686 0.401392631 0.321114105 </row> + <row>0.390443686 0.468532424 0.481671157 0.401392631 </row> + <row>0.468532424 0.546621161 0.561949683 0.481671157 </row> + <row>0.546621161 0.624709898 0.64222821 0.561949683 </row> + <row>0.624709898 0.702798636 0.722506736 0.64222821 </row> + <row>0.702798636 0.780887373 0.802785262 0.722506736 </row> + <row>0.780887373 0.85897611 0.883063788 0.802785262 </row> + <row>0.85897611 0.937064847 0.963342314 0.883063788 </row> + <row>0.937064847 1.01515358 1.04362084 0.963342314 </row> + <row>1.01515358 1.09324232 1.12389937 1.04362084 </row> + <row>1.09324232 1.17133106 1.20417789 1.12389937 </row> + <row>1.17133106 1.2494198 1.28445642 1.20417789 </row> + <row>1.2494198 1.32750853 1.36473495 1.28445642 </row> + <row>1.32750853 1.40559727 1.44501347 1.36473495 </row> + <row>1.40559727 1.48368601 1.525292 1.44501347 </row> + <row>1.48368601 1.56177475 1.60557052 1.525292 </row> + <row>1.56177475 1.63986348 1.68584905 1.60557052 </row> + <row>1.63986348 1.71795222 1.76612758 1.68584905 </row> + <row>1.71795222 1.79604096 1.8464061 1.76612758 </row> + <row>1.79604096 1.87412969 1.92668463 1.8464061 </row> + <row>1.87412969 1.95221843 2.00696316 1.92668463 </row> + <row>1.95221843 2.03030717 2.08724168 2.00696316 </row> + <row>2.03030717 2.10839591 2.16752021 2.08724168 </row> + <row>2.10839591 2.18648464 2.24779873 2.16752021 </row> + <row>2.18648464 2.26457338 2.32807726 2.24779873 </row> + <row>2.26457338 2.34266212 2.40835579 2.32807726 </row> + <row>2.34266212 2.42075086 2.48863431 2.40835579 </row> + <row>2.42075086 2.49883959 2.56891284 2.48863431 </row> + <row>2.49883959 2.57692833 2.64919136 2.56891284 </row> + <row>2.57692833 2.65501707 2.72946989 2.64919136 </row> + <row>2.65501707 2.7331058 2.80974842 2.72946989 </row> + <row>2.7331058 2.81119454 2.89002694 2.80974842 </row> + <row>2.81119454 2.88928328 2.97030547 2.89002694 </row> + <row>2.88928328 2.96737202 3.050584 2.97030547 </row> + <row>2.96737202 3.04546075 3.13086252 3.050584 </row> + <row>0 0.0802785262 0.0737688912 0 </row> + <row>0.0802785262 0.160557052 0.147537782 0.0737688912 </row> + <row>0.160557052 0.240835579 0.221306673 0.147537782 </row> + <row>0.240835579 0.321114105 0.295075565 0.221306673 </row> + <row>0.321114105 0.401392631 0.368844456 0.295075565 </row> + <row>0.401392631 0.481671157 0.442613347 0.368844456 </row> + <row>0.481671157 0.561949683 0.516382238 0.442613347 </row> + <row>0.561949683 0.64222821 0.590151129 0.516382238 </row> + <row>0.64222821 0.722506736 0.66392002 0.590151129 </row> + <row>0.722506736 0.802785262 0.737688912 0.66392002 </row> + <row>0.802785262 0.883063788 0.811457803 0.737688912 </row> + <row>0.883063788 0.963342314 0.885226694 0.811457803 </row> + <row>0.963342314 1.04362084 0.958995585 0.885226694 </row> + <row>1.04362084 1.12389937 1.03276448 0.958995585 </row> + <row>1.12389937 1.20417789 1.10653337 1.03276448 </row> + <row>1.20417789 1.28445642 1.18030226 1.10653337 </row> + <row>1.28445642 1.36473495 1.25407115 1.18030226 </row> + <row>1.36473495 1.44501347 1.32784004 1.25407115 </row> + <row>1.44501347 1.525292 1.40160893 1.32784004 </row> + <row>1.525292 1.60557052 1.47537782 1.40160893 </row> + <row>1.60557052 1.68584905 1.54914671 1.47537782 </row> + <row>1.68584905 1.76612758 1.62291561 1.54914671 </row> + <row>1.76612758 1.8464061 1.6966845 1.62291561 </row> + <row>1.8464061 1.92668463 1.77045339 1.6966845 </row> + <row>1.92668463 2.00696316 1.84422228 1.77045339 </row> + <row>2.00696316 2.08724168 1.91799117 1.84422228 </row> + <row>2.08724168 2.16752021 1.99176006 1.91799117 </row> + <row>2.16752021 2.24779873 2.06552895 1.99176006 </row> + <row>2.24779873 2.32807726 2.13929784 2.06552895 </row> + <row>2.32807726 2.40835579 2.21306673 2.13929784 </row> + <row>2.40835579 2.48863431 2.28683563 2.21306673 </row> + <row>2.48863431 2.56891284 2.36060452 2.28683563 </row> + <row>2.56891284 2.64919136 2.43437341 2.36060452 </row> + <row>2.64919136 2.72946989 2.5081423 2.43437341 </row> + <row>2.72946989 2.80974842 2.58191119 2.5081423 </row> + <row>2.80974842 2.89002694 2.65568008 2.58191119 </row> + <row>2.89002694 2.97030547 2.72944897 2.65568008 </row> + <row>2.97030547 3.050584 2.80321786 2.72944897 </row> + <row>3.050584 3.13086252 2.87698676 2.80321786 </row> + <row>0 0.0737688912 0.0592652521 0 </row> + <row>0.0737688912 0.147537782 0.118530504 0.0592652521 </row> + <row>0.147537782 0.221306673 0.177795756 0.118530504 </row> + <row>0.221306673 0.295075565 0.237061008 0.177795756 </row> + <row>0.295075565 0.368844456 0.296326261 0.237061008 </row> + <row>0.368844456 0.442613347 0.355591513 0.296326261 </row> + <row>0.442613347 0.516382238 0.414856765 0.355591513 </row> + <row>0.516382238 0.590151129 0.474122017 0.414856765 </row> + <row>0.590151129 0.66392002 0.533387269 0.474122017 </row> + <row>0.66392002 0.737688912 0.592652521 0.533387269 </row> + <row>0.737688912 0.811457803 0.651917773 0.592652521 </row> + <row>0.811457803 0.885226694 0.711183025 0.651917773 </row> + <row>0.885226694 0.958995585 0.770448278 0.711183025 </row> + <row>0.958995585 1.03276448 0.82971353 0.770448278 </row> + <row>1.03276448 1.10653337 0.888978782 0.82971353 </row> + <row>1.10653337 1.18030226 0.948244034 0.888978782 </row> + <row>1.18030226 1.25407115 1.00750929 0.948244034 </row> + <row>1.25407115 1.32784004 1.06677454 1.00750929 </row> + <row>1.32784004 1.40160893 1.12603979 1.06677454 </row> + <row>1.40160893 1.47537782 1.18530504 1.12603979 </row> + <row>1.47537782 1.54914671 1.24457029 1.18530504 </row> + <row>1.54914671 1.62291561 1.30383555 1.24457029 </row> + <row>1.62291561 1.6966845 1.3631008 1.30383555 </row> + <row>1.6966845 1.77045339 1.42236605 1.3631008 </row> + <row>1.77045339 1.84422228 1.4816313 1.42236605 </row> + <row>1.84422228 1.91799117 1.54089656 1.4816313 </row> + <row>1.91799117 1.99176006 1.60016181 1.54089656 </row> + <row>1.99176006 2.06552895 1.65942706 1.60016181 </row> + <row>2.06552895 2.13929784 1.71869231 1.65942706 </row> + <row>2.13929784 2.21306673 1.77795756 1.71869231 </row> + <row>2.21306673 2.28683563 1.83722282 1.77795756 </row> + <row>2.28683563 2.36060452 1.89648807 1.83722282 </row> + <row>2.36060452 2.43437341 1.95575332 1.89648807 </row> + <row>2.43437341 2.5081423 2.01501857 1.95575332 </row> + <row>2.5081423 2.58191119 2.07428382 2.01501857 </row> + <row>2.58191119 2.65568008 2.13354908 2.07428382 </row> + <row>2.65568008 2.72944897 2.19281433 2.13354908 </row> + <row>2.72944897 2.80321786 2.25207958 2.19281433 </row> + <row>2.80321786 2.87698676 2.31134483 2.25207958 </row> + <row>0 0.0592652521 0.0383393034 0 </row> + <row>0.0592652521 0.118530504 0.0766786068 0.0383393034 </row> + <row>0.118530504 0.177795756 0.11501791 0.0766786068 </row> + <row>0.177795756 0.237061008 0.153357214 0.11501791 </row> + <row>0.237061008 0.296326261 0.191696517 0.153357214 </row> + <row>0.296326261 0.355591513 0.230035821 0.191696517 </row> + <row>0.355591513 0.414856765 0.268375124 0.230035821 </row> + <row>0.414856765 0.474122017 0.306714427 0.268375124 </row> + <row>0.474122017 0.533387269 0.345053731 0.306714427 </row> + <row>0.533387269 0.592652521 0.383393034 0.345053731 </row> + <row>0.592652521 0.651917773 0.421732338 0.383393034 </row> + <row>0.651917773 0.711183025 0.460071641 0.421732338 </row> + <row>0.711183025 0.770448278 0.498410944 0.460071641 </row> + <row>0.770448278 0.82971353 0.536750248 0.498410944 </row> + <row>0.82971353 0.888978782 0.575089551 0.536750248 </row> + <row>0.888978782 0.948244034 0.613428855 0.575089551 </row> + <row>0.948244034 1.00750929 0.651768158 0.613428855 </row> + <row>1.00750929 1.06677454 0.690107462 0.651768158 </row> + <row>1.06677454 1.12603979 0.728446765 0.690107462 </row> + <row>1.12603979 1.18530504 0.766786068 0.728446765 </row> + <row>1.18530504 1.24457029 0.805125372 0.766786068 </row> + <row>1.24457029 1.30383555 0.843464675 0.805125372 </row> + <row>1.30383555 1.3631008 0.881803979 0.843464675 </row> + <row>1.3631008 1.42236605 0.920143282 0.881803979 </row> + <row>1.42236605 1.4816313 0.958482586 0.920143282 </row> + <row>1.4816313 1.54089656 0.996821889 0.958482586 </row> + <row>1.54089656 1.60016181 1.03516119 0.996821889 </row> + <row>1.60016181 1.65942706 1.0735005 1.03516119 </row> + <row>1.65942706 1.71869231 1.1118398 1.0735005 </row> + <row>1.71869231 1.77795756 1.1501791 1.1118398 </row> + <row>1.77795756 1.83722282 1.18851841 1.1501791 </row> + <row>1.83722282 1.89648807 1.22685771 1.18851841 </row> + <row>1.89648807 1.95575332 1.26519701 1.22685771 </row> + <row>1.95575332 2.01501857 1.30353632 1.26519701 </row> + <row>2.01501857 2.07428382 1.34187562 1.30353632 </row> + <row>2.07428382 2.13354908 1.38021492 1.34187562 </row> + <row>2.13354908 2.19281433 1.41855423 1.38021492 </row> + <row>2.19281433 2.25207958 1.45689353 1.41855423 </row> + <row>2.25207958 2.31134483 1.49523283 1.45689353 </row> + <row>0 0.0383393034 0.0132586963 0 </row> + <row>0.0383393034 0.0766786068 0.0265173926 0.0132586963 </row> + <row>0.0766786068 0.11501791 0.0397760889 0.0265173926 </row> + <row>0.11501791 0.153357214 0.0530347852 0.0397760889 </row> + <row>0.153357214 0.191696517 0.0662934815 0.0530347852 </row> + <row>0.191696517 0.230035821 0.0795521778 0.0662934815 </row> + <row>0.230035821 0.268375124 0.0928108741 0.0795521778 </row> + <row>0.268375124 0.306714427 0.10606957 0.0928108741 </row> + <row>0.306714427 0.345053731 0.119328267 0.10606957 </row> + <row>0.345053731 0.383393034 0.132586963 0.119328267 </row> + <row>0.383393034 0.421732338 0.145845659 0.132586963 </row> + <row>0.421732338 0.460071641 0.159104356 0.145845659 </row> + <row>0.460071641 0.498410944 0.172363052 0.159104356 </row> + <row>0.498410944 0.536750248 0.185621748 0.172363052 </row> + <row>0.536750248 0.575089551 0.198880444 0.185621748 </row> + <row>0.575089551 0.613428855 0.212139141 0.198880444 </row> + <row>0.613428855 0.651768158 0.225397837 0.212139141 </row> + <row>0.651768158 0.690107462 0.238656533 0.225397837 </row> + <row>0.690107462 0.728446765 0.25191523 0.238656533 </row> + <row>0.728446765 0.766786068 0.265173926 0.25191523 </row> + <row>0.766786068 0.805125372 0.278432622 0.265173926 </row> + <row>0.805125372 0.843464675 0.291691319 0.278432622 </row> + <row>0.843464675 0.881803979 0.304950015 0.291691319 </row> + <row>0.881803979 0.920143282 0.318208711 0.304950015 </row> + <row>0.920143282 0.958482586 0.331467407 0.318208711 </row> + <row>0.958482586 0.996821889 0.344726104 0.331467407 </row> + <row>0.996821889 1.03516119 0.3579848 0.344726104 </row> + <row>1.03516119 1.0735005 0.371243496 0.3579848 </row> + <row>1.0735005 1.1118398 0.384502193 0.371243496 </row> + <row>1.1118398 1.1501791 0.397760889 0.384502193 </row> + <row>1.1501791 1.18851841 0.411019585 0.397760889 </row> + <row>1.18851841 1.22685771 0.424278282 0.411019585 </row> + <row>1.22685771 1.26519701 0.437536978 0.424278282 </row> + <row>1.26519701 1.30353632 0.450795674 0.437536978 </row> + <row>1.30353632 1.34187562 0.46405437 0.450795674 </row> + <row>1.34187562 1.38021492 0.477313067 0.46405437 </row> + <row>1.38021492 1.41855423 0.490571763 0.477313067 </row> + <row>1.41855423 1.45689353 0.503830459 0.490571763 </row> + <row>1.45689353 1.49523283 0.517089156 0.503830459 </row> + <row>0 0.0132586963 -0.0132586963 0 </row> + <row>0.0132586963 0.0265173926 -0.0265173926 -0.0132586963 </row> + <row>0.0265173926 0.0397760889 -0.0397760889 -0.0265173926 </row> + <row>0.0397760889 0.0530347852 -0.0530347852 -0.0397760889 </row> + <row>0.0530347852 0.0662934815 -0.0662934815 -0.0530347852 </row> + <row>0.0662934815 0.0795521778 -0.0795521778 -0.0662934815 </row> + <row>0.0795521778 0.0928108741 -0.0928108741 -0.0795521778 </row> + <row>0.0928108741 0.10606957 -0.10606957 -0.0928108741 </row> + <row>0.10606957 0.119328267 -0.119328267 -0.10606957 </row> + <row>0.119328267 0.132586963 -0.132586963 -0.119328267 </row> + <row>0.132586963 0.145845659 -0.145845659 -0.132586963 </row> + <row>0.145845659 0.159104356 -0.159104356 -0.145845659 </row> + <row>0.159104356 0.172363052 -0.172363052 -0.159104356 </row> + <row>0.172363052 0.185621748 -0.185621748 -0.172363052 </row> + <row>0.185621748 0.198880444 -0.198880444 -0.185621748 </row> + <row>0.198880444 0.212139141 -0.212139141 -0.198880444 </row> + <row>0.212139141 0.225397837 -0.225397837 -0.212139141 </row> + <row>0.225397837 0.238656533 -0.238656533 -0.225397837 </row> + <row>0.238656533 0.25191523 -0.25191523 -0.238656533 </row> + <row>0.25191523 0.265173926 -0.265173926 -0.25191523 </row> + <row>0.265173926 0.278432622 -0.278432622 -0.265173926 </row> + <row>0.278432622 0.291691319 -0.291691319 -0.278432622 </row> + <row>0.291691319 0.304950015 -0.304950015 -0.291691319 </row> + <row>0.304950015 0.318208711 -0.318208711 -0.304950015 </row> + <row>0.318208711 0.331467407 -0.331467407 -0.318208711 </row> + <row>0.331467407 0.344726104 -0.344726104 -0.331467407 </row> + <row>0.344726104 0.3579848 -0.3579848 -0.344726104 </row> + <row>0.3579848 0.371243496 -0.371243496 -0.3579848 </row> + <row>0.371243496 0.384502193 -0.384502193 -0.371243496 </row> + <row>0.384502193 0.397760889 -0.397760889 -0.384502193 </row> + <row>0.397760889 0.411019585 -0.411019585 -0.397760889 </row> + <row>0.411019585 0.424278282 -0.424278282 -0.411019585 </row> + <row>0.424278282 0.437536978 -0.437536978 -0.424278282 </row> + <row>0.437536978 0.450795674 -0.450795674 -0.437536978 </row> + <row>0.450795674 0.46405437 -0.46405437 -0.450795674 </row> + <row>0.46405437 0.477313067 -0.477313067 -0.46405437 </row> + <row>0.477313067 0.490571763 -0.490571763 -0.477313067 </row> + <row>0.490571763 0.503830459 -0.503830459 -0.490571763 </row> + <row>0.503830459 0.517089156 -0.517089156 -0.503830459 </row> + <row>0 -0.0132586963 -0.0383393034 0 </row> + <row>-0.0132586963 -0.0265173926 -0.0766786068 -0.0383393034 </row> + <row>-0.0265173926 -0.0397760889 -0.11501791 -0.0766786068 </row> + <row>-0.0397760889 -0.0530347852 -0.153357214 -0.11501791 </row> + <row>-0.0530347852 -0.0662934815 -0.191696517 -0.153357214 </row> + <row>-0.0662934815 -0.0795521778 -0.230035821 -0.191696517 </row> + <row>-0.0795521778 -0.0928108741 -0.268375124 -0.230035821 </row> + <row>-0.0928108741 -0.10606957 -0.306714427 -0.268375124 </row> + <row>-0.10606957 -0.119328267 -0.345053731 -0.306714427 </row> + <row>-0.119328267 -0.132586963 -0.383393034 -0.345053731 </row> + <row>-0.132586963 -0.145845659 -0.421732338 -0.383393034 </row> + <row>-0.145845659 -0.159104356 -0.460071641 -0.421732338 </row> + <row>-0.159104356 -0.172363052 -0.498410944 -0.460071641 </row> + <row>-0.172363052 -0.185621748 -0.536750248 -0.498410944 </row> + <row>-0.185621748 -0.198880444 -0.575089551 -0.536750248 </row> + <row>-0.198880444 -0.212139141 -0.613428855 -0.575089551 </row> + <row>-0.212139141 -0.225397837 -0.651768158 -0.613428855 </row> + <row>-0.225397837 -0.238656533 -0.690107462 -0.651768158 </row> + <row>-0.238656533 -0.25191523 -0.728446765 -0.690107462 </row> + <row>-0.25191523 -0.265173926 -0.766786068 -0.728446765 </row> + <row>-0.265173926 -0.278432622 -0.805125372 -0.766786068 </row> + <row>-0.278432622 -0.291691319 -0.843464675 -0.805125372 </row> + <row>-0.291691319 -0.304950015 -0.881803979 -0.843464675 </row> + <row>-0.304950015 -0.318208711 -0.920143282 -0.881803979 </row> + <row>-0.318208711 -0.331467407 -0.958482586 -0.920143282 </row> + <row>-0.331467407 -0.344726104 -0.996821889 -0.958482586 </row> + <row>-0.344726104 -0.3579848 -1.03516119 -0.996821889 </row> + <row>-0.3579848 -0.371243496 -1.0735005 -1.03516119 </row> + <row>-0.371243496 -0.384502193 -1.1118398 -1.0735005 </row> + <row>-0.384502193 -0.397760889 -1.1501791 -1.1118398 </row> + <row>-0.397760889 -0.411019585 -1.18851841 -1.1501791 </row> + <row>-0.411019585 -0.424278282 -1.22685771 -1.18851841 </row> + <row>-0.424278282 -0.437536978 -1.26519701 -1.22685771 </row> + <row>-0.437536978 -0.450795674 -1.30353632 -1.26519701 </row> + <row>-0.450795674 -0.46405437 -1.34187562 -1.30353632 </row> + <row>-0.46405437 -0.477313067 -1.38021492 -1.34187562 </row> + <row>-0.477313067 -0.490571763 -1.41855423 -1.38021492 </row> + <row>-0.490571763 -0.503830459 -1.45689353 -1.41855423 </row> + <row>-0.503830459 -0.517089156 -1.49523283 -1.45689353 </row> + <row>0 -0.0383393034 -0.0592652521 0 </row> + <row>-0.0383393034 -0.0766786068 -0.118530504 -0.0592652521 </row> + <row>-0.0766786068 -0.11501791 -0.177795756 -0.118530504 </row> + <row>-0.11501791 -0.153357214 -0.237061008 -0.177795756 </row> + <row>-0.153357214 -0.191696517 -0.296326261 -0.237061008 </row> + <row>-0.191696517 -0.230035821 -0.355591513 -0.296326261 </row> + <row>-0.230035821 -0.268375124 -0.414856765 -0.355591513 </row> + <row>-0.268375124 -0.306714427 -0.474122017 -0.414856765 </row> + <row>-0.306714427 -0.345053731 -0.533387269 -0.474122017 </row> + <row>-0.345053731 -0.383393034 -0.592652521 -0.533387269 </row> + <row>-0.383393034 -0.421732338 -0.651917773 -0.592652521 </row> + <row>-0.421732338 -0.460071641 -0.711183025 -0.651917773 </row> + <row>-0.460071641 -0.498410944 -0.770448278 -0.711183025 </row> + <row>-0.498410944 -0.536750248 -0.82971353 -0.770448278 </row> + <row>-0.536750248 -0.575089551 -0.888978782 -0.82971353 </row> + <row>-0.575089551 -0.613428855 -0.948244034 -0.888978782 </row> + <row>-0.613428855 -0.651768158 -1.00750929 -0.948244034 </row> + <row>-0.651768158 -0.690107462 -1.06677454 -1.00750929 </row> + <row>-0.690107462 -0.728446765 -1.12603979 -1.06677454 </row> + <row>-0.728446765 -0.766786068 -1.18530504 -1.12603979 </row> + <row>-0.766786068 -0.805125372 -1.24457029 -1.18530504 </row> + <row>-0.805125372 -0.843464675 -1.30383555 -1.24457029 </row> + <row>-0.843464675 -0.881803979 -1.3631008 -1.30383555 </row> + <row>-0.881803979 -0.920143282 -1.42236605 -1.3631008 </row> + <row>-0.920143282 -0.958482586 -1.4816313 -1.42236605 </row> + <row>-0.958482586 -0.996821889 -1.54089656 -1.4816313 </row> + <row>-0.996821889 -1.03516119 -1.60016181 -1.54089656 </row> + <row>-1.03516119 -1.0735005 -1.65942706 -1.60016181 </row> + <row>-1.0735005 -1.1118398 -1.71869231 -1.65942706 </row> + <row>-1.1118398 -1.1501791 -1.77795756 -1.71869231 </row> + <row>-1.1501791 -1.18851841 -1.83722282 -1.77795756 </row> + <row>-1.18851841 -1.22685771 -1.89648807 -1.83722282 </row> + <row>-1.22685771 -1.26519701 -1.95575332 -1.89648807 </row> + <row>-1.26519701 -1.30353632 -2.01501857 -1.95575332 </row> + <row>-1.30353632 -1.34187562 -2.07428382 -2.01501857 </row> + <row>-1.34187562 -1.38021492 -2.13354908 -2.07428382 </row> + <row>-1.38021492 -1.41855423 -2.19281433 -2.13354908 </row> + <row>-1.41855423 -1.45689353 -2.25207958 -2.19281433 </row> + <row>-1.45689353 -1.49523283 -2.31134483 -2.25207958 </row> + <row>0 -0.0592652521 -0.0737688912 0 </row> + <row>-0.0592652521 -0.118530504 -0.147537782 -0.0737688912 </row> + <row>-0.118530504 -0.177795756 -0.221306673 -0.147537782 </row> + <row>-0.177795756 -0.237061008 -0.295075565 -0.221306673 </row> + <row>-0.237061008 -0.296326261 -0.368844456 -0.295075565 </row> + <row>-0.296326261 -0.355591513 -0.442613347 -0.368844456 </row> + <row>-0.355591513 -0.414856765 -0.516382238 -0.442613347 </row> + <row>-0.414856765 -0.474122017 -0.590151129 -0.516382238 </row> + <row>-0.474122017 -0.533387269 -0.66392002 -0.590151129 </row> + <row>-0.533387269 -0.592652521 -0.737688912 -0.66392002 </row> + <row>-0.592652521 -0.651917773 -0.811457803 -0.737688912 </row> + <row>-0.651917773 -0.711183025 -0.885226694 -0.811457803 </row> + <row>-0.711183025 -0.770448278 -0.958995585 -0.885226694 </row> + <row>-0.770448278 -0.82971353 -1.03276448 -0.958995585 </row> + <row>-0.82971353 -0.888978782 -1.10653337 -1.03276448 </row> + <row>-0.888978782 -0.948244034 -1.18030226 -1.10653337 </row> + <row>-0.948244034 -1.00750929 -1.25407115 -1.18030226 </row> + <row>-1.00750929 -1.06677454 -1.32784004 -1.25407115 </row> + <row>-1.06677454 -1.12603979 -1.40160893 -1.32784004 </row> + <row>-1.12603979 -1.18530504 -1.47537782 -1.40160893 </row> + <row>-1.18530504 -1.24457029 -1.54914671 -1.47537782 </row> + <row>-1.24457029 -1.30383555 -1.62291561 -1.54914671 </row> + <row>-1.30383555 -1.3631008 -1.6966845 -1.62291561 </row> + <row>-1.3631008 -1.42236605 -1.77045339 -1.6966845 </row> + <row>-1.42236605 -1.4816313 -1.84422228 -1.77045339 </row> + <row>-1.4816313 -1.54089656 -1.91799117 -1.84422228 </row> + <row>-1.54089656 -1.60016181 -1.99176006 -1.91799117 </row> + <row>-1.60016181 -1.65942706 -2.06552895 -1.99176006 </row> + <row>-1.65942706 -1.71869231 -2.13929784 -2.06552895 </row> + <row>-1.71869231 -1.77795756 -2.21306673 -2.13929784 </row> + <row>-1.77795756 -1.83722282 -2.28683563 -2.21306673 </row> + <row>-1.83722282 -1.89648807 -2.36060452 -2.28683563 </row> + <row>-1.89648807 -1.95575332 -2.43437341 -2.36060452 </row> + <row>-1.95575332 -2.01501857 -2.5081423 -2.43437341 </row> + <row>-2.01501857 -2.07428382 -2.58191119 -2.5081423 </row> + <row>-2.07428382 -2.13354908 -2.65568008 -2.58191119 </row> + <row>-2.13354908 -2.19281433 -2.72944897 -2.65568008 </row> + <row>-2.19281433 -2.25207958 -2.80321786 -2.72944897 </row> + <row>-2.25207958 -2.31134483 -2.87698676 -2.80321786 </row> + <row>0 -0.0737688912 -0.0802785262 0 </row> + <row>-0.0737688912 -0.147537782 -0.160557052 -0.0802785262 </row> + <row>-0.147537782 -0.221306673 -0.240835579 -0.160557052 </row> + <row>-0.221306673 -0.295075565 -0.321114105 -0.240835579 </row> + <row>-0.295075565 -0.368844456 -0.401392631 -0.321114105 </row> + <row>-0.368844456 -0.442613347 -0.481671157 -0.401392631 </row> + <row>-0.442613347 -0.516382238 -0.561949683 -0.481671157 </row> + <row>-0.516382238 -0.590151129 -0.64222821 -0.561949683 </row> + <row>-0.590151129 -0.66392002 -0.722506736 -0.64222821 </row> + <row>-0.66392002 -0.737688912 -0.802785262 -0.722506736 </row> + <row>-0.737688912 -0.811457803 -0.883063788 -0.802785262 </row> + <row>-0.811457803 -0.885226694 -0.963342314 -0.883063788 </row> + <row>-0.885226694 -0.958995585 -1.04362084 -0.963342314 </row> + <row>-0.958995585 -1.03276448 -1.12389937 -1.04362084 </row> + <row>-1.03276448 -1.10653337 -1.20417789 -1.12389937 </row> + <row>-1.10653337 -1.18030226 -1.28445642 -1.20417789 </row> + <row>-1.18030226 -1.25407115 -1.36473495 -1.28445642 </row> + <row>-1.25407115 -1.32784004 -1.44501347 -1.36473495 </row> + <row>-1.32784004 -1.40160893 -1.525292 -1.44501347 </row> + <row>-1.40160893 -1.47537782 -1.60557052 -1.525292 </row> + <row>-1.47537782 -1.54914671 -1.68584905 -1.60557052 </row> + <row>-1.54914671 -1.62291561 -1.76612758 -1.68584905 </row> + <row>-1.62291561 -1.6966845 -1.8464061 -1.76612758 </row> + <row>-1.6966845 -1.77045339 -1.92668463 -1.8464061 </row> + <row>-1.77045339 -1.84422228 -2.00696316 -1.92668463 </row> + <row>-1.84422228 -1.91799117 -2.08724168 -2.00696316 </row> + <row>-1.91799117 -1.99176006 -2.16752021 -2.08724168 </row> + <row>-1.99176006 -2.06552895 -2.24779873 -2.16752021 </row> + <row>-2.06552895 -2.13929784 -2.32807726 -2.24779873 </row> + <row>-2.13929784 -2.21306673 -2.40835579 -2.32807726 </row> + <row>-2.21306673 -2.28683563 -2.48863431 -2.40835579 </row> + <row>-2.28683563 -2.36060452 -2.56891284 -2.48863431 </row> + <row>-2.36060452 -2.43437341 -2.64919136 -2.56891284 </row> + <row>-2.43437341 -2.5081423 -2.72946989 -2.64919136 </row> + <row>-2.5081423 -2.58191119 -2.80974842 -2.72946989 </row> + <row>-2.58191119 -2.65568008 -2.89002694 -2.80974842 </row> + <row>-2.65568008 -2.72944897 -2.97030547 -2.89002694 </row> + <row>-2.72944897 -2.80321786 -3.050584 -2.97030547 </row> + <row>-2.80321786 -2.87698676 -3.13086252 -3.050584 </row> + <row>0 -0.0802785262 -0.0780887373 0 </row> + <row>-0.0802785262 -0.160557052 -0.156177475 -0.0780887373 </row> + <row>-0.160557052 -0.240835579 -0.234266212 -0.156177475 </row> + <row>-0.240835579 -0.321114105 -0.312354949 -0.234266212 </row> + <row>-0.321114105 -0.401392631 -0.390443686 -0.312354949 </row> + <row>-0.401392631 -0.481671157 -0.468532424 -0.390443686 </row> + <row>-0.481671157 -0.561949683 -0.546621161 -0.468532424 </row> + <row>-0.561949683 -0.64222821 -0.624709898 -0.546621161 </row> + <row>-0.64222821 -0.722506736 -0.702798636 -0.624709898 </row> + <row>-0.722506736 -0.802785262 -0.780887373 -0.702798636 </row> + <row>-0.802785262 -0.883063788 -0.85897611 -0.780887373 </row> + <row>-0.883063788 -0.963342314 -0.937064847 -0.85897611 </row> + <row>-0.963342314 -1.04362084 -1.01515358 -0.937064847 </row> + <row>-1.04362084 -1.12389937 -1.09324232 -1.01515358 </row> + <row>-1.12389937 -1.20417789 -1.17133106 -1.09324232 </row> + <row>-1.20417789 -1.28445642 -1.2494198 -1.17133106 </row> + <row>-1.28445642 -1.36473495 -1.32750853 -1.2494198 </row> + <row>-1.36473495 -1.44501347 -1.40559727 -1.32750853 </row> + <row>-1.44501347 -1.525292 -1.48368601 -1.40559727 </row> + <row>-1.525292 -1.60557052 -1.56177475 -1.48368601 </row> + <row>-1.60557052 -1.68584905 -1.63986348 -1.56177475 </row> + <row>-1.68584905 -1.76612758 -1.71795222 -1.63986348 </row> + <row>-1.76612758 -1.8464061 -1.79604096 -1.71795222 </row> + <row>-1.8464061 -1.92668463 -1.87412969 -1.79604096 </row> + <row>-1.92668463 -2.00696316 -1.95221843 -1.87412969 </row> + <row>-2.00696316 -2.08724168 -2.03030717 -1.95221843 </row> + <row>-2.08724168 -2.16752021 -2.10839591 -2.03030717 </row> + <row>-2.16752021 -2.24779873 -2.18648464 -2.10839591 </row> + <row>-2.24779873 -2.32807726 -2.26457338 -2.18648464 </row> + <row>-2.32807726 -2.40835579 -2.34266212 -2.26457338 </row> + <row>-2.40835579 -2.48863431 -2.42075086 -2.34266212 </row> + <row>-2.48863431 -2.56891284 -2.49883959 -2.42075086 </row> + <row>-2.56891284 -2.64919136 -2.57692833 -2.49883959 </row> + <row>-2.64919136 -2.72946989 -2.65501707 -2.57692833 </row> + <row>-2.72946989 -2.80974842 -2.7331058 -2.65501707 </row> + <row>-2.80974842 -2.89002694 -2.81119454 -2.7331058 </row> + <row>-2.89002694 -2.97030547 -2.88928328 -2.81119454 </row> + <row>-2.97030547 -3.050584 -2.96737202 -2.88928328 </row> + <row>-3.050584 -3.13086252 -3.04546075 -2.96737202 </row> + <row>0 -0.0780887373 -0.067436822 0 </row> + <row>-0.0780887373 -0.156177475 -0.134873644 -0.067436822 </row> + <row>-0.156177475 -0.234266212 -0.202310466 -0.134873644 </row> + <row>-0.234266212 -0.312354949 -0.269747288 -0.202310466 </row> + <row>-0.312354949 -0.390443686 -0.33718411 -0.269747288 </row> + <row>-0.390443686 -0.468532424 -0.404620932 -0.33718411 </row> + <row>-0.468532424 -0.546621161 -0.472057754 -0.404620932 </row> + <row>-0.546621161 -0.624709898 -0.539494576 -0.472057754 </row> + <row>-0.624709898 -0.702798636 -0.606931398 -0.539494576 </row> + <row>-0.702798636 -0.780887373 -0.67436822 -0.606931398 </row> + <row>-0.780887373 -0.85897611 -0.741805042 -0.67436822 </row> + <row>-0.85897611 -0.937064847 -0.809241864 -0.741805042 </row> + <row>-0.937064847 -1.01515358 -0.876678686 -0.809241864 </row> + <row>-1.01515358 -1.09324232 -0.944115508 -0.876678686 </row> + <row>-1.09324232 -1.17133106 -1.01155233 -0.944115508 </row> + <row>-1.17133106 -1.2494198 -1.07898915 -1.01155233 </row> + <row>-1.2494198 -1.32750853 -1.14642597 -1.07898915 </row> + <row>-1.32750853 -1.40559727 -1.2138628 -1.14642597 </row> + <row>-1.40559727 -1.48368601 -1.28129962 -1.2138628 </row> + <row>-1.48368601 -1.56177475 -1.34873644 -1.28129962 </row> + <row>-1.56177475 -1.63986348 -1.41617326 -1.34873644 </row> + <row>-1.63986348 -1.71795222 -1.48361008 -1.41617326 </row> + <row>-1.71795222 -1.79604096 -1.55104691 -1.48361008 </row> + <row>-1.79604096 -1.87412969 -1.61848373 -1.55104691 </row> + <row>-1.87412969 -1.95221843 -1.68592055 -1.61848373 </row> + <row>-1.95221843 -2.03030717 -1.75335737 -1.68592055 </row> + <row>-2.03030717 -2.10839591 -1.82079419 -1.75335737 </row> + <row>-2.10839591 -2.18648464 -1.88823102 -1.82079419 </row> + <row>-2.18648464 -2.26457338 -1.95566784 -1.88823102 </row> + <row>-2.26457338 -2.34266212 -2.02310466 -1.95566784 </row> + <row>-2.34266212 -2.42075086 -2.09054148 -2.02310466 </row> + <row>-2.42075086 -2.49883959 -2.1579783 -2.09054148 </row> + <row>-2.49883959 -2.57692833 -2.22541513 -2.1579783 </row> + <row>-2.57692833 -2.65501707 -2.29285195 -2.22541513 </row> + <row>-2.65501707 -2.7331058 -2.36028877 -2.29285195 </row> + <row>-2.7331058 -2.81119454 -2.42772559 -2.36028877 </row> + <row>-2.81119454 -2.88928328 -2.49516241 -2.42772559 </row> + <row>-2.88928328 -2.96737202 -2.56259924 -2.49516241 </row> + <row>-2.96737202 -3.04546075 -2.63003606 -2.56259924 </row> + <row>0 -0.067436822 -0.0494770807 0 </row> + <row>-0.067436822 -0.134873644 -0.0989541613 -0.0494770807 </row> + <row>-0.134873644 -0.202310466 -0.148431242 -0.0989541613 </row> + <row>-0.202310466 -0.269747288 -0.197908323 -0.148431242 </row> + <row>-0.269747288 -0.33718411 -0.247385403 -0.197908323 </row> + <row>-0.33718411 -0.404620932 -0.296862484 -0.247385403 </row> + <row>-0.404620932 -0.472057754 -0.346339565 -0.296862484 </row> + <row>-0.472057754 -0.539494576 -0.395816645 -0.346339565 </row> + <row>-0.539494576 -0.606931398 -0.445293726 -0.395816645 </row> + <row>-0.606931398 -0.67436822 -0.494770807 -0.445293726 </row> + <row>-0.67436822 -0.741805042 -0.544247887 -0.494770807 </row> + <row>-0.741805042 -0.809241864 -0.593724968 -0.544247887 </row> + <row>-0.809241864 -0.876678686 -0.643202049 -0.593724968 </row> + <row>-0.876678686 -0.944115508 -0.692679129 -0.643202049 </row> + <row>-0.944115508 -1.01155233 -0.74215621 -0.692679129 </row> + <row>-1.01155233 -1.07898915 -0.791633291 -0.74215621 </row> + <row>-1.07898915 -1.14642597 -0.841110371 -0.791633291 </row> + <row>-1.14642597 -1.2138628 -0.890587452 -0.841110371 </row> + <row>-1.2138628 -1.28129962 -0.940064533 -0.890587452 </row> + <row>-1.28129962 -1.34873644 -0.989541613 -0.940064533 </row> + <row>-1.34873644 -1.41617326 -1.03901869 -0.989541613 </row> + <row>-1.41617326 -1.48361008 -1.08849577 -1.03901869 </row> + <row>-1.48361008 -1.55104691 -1.13797286 -1.08849577 </row> + <row>-1.55104691 -1.61848373 -1.18744994 -1.13797286 </row> + <row>-1.61848373 -1.68592055 -1.23692702 -1.18744994 </row> + <row>-1.68592055 -1.75335737 -1.2864041 -1.23692702 </row> + <row>-1.75335737 -1.82079419 -1.33588118 -1.2864041 </row> + <row>-1.82079419 -1.88823102 -1.38535826 -1.33588118 </row> + <row>-1.88823102 -1.95566784 -1.43483534 -1.38535826 </row> + <row>-1.95566784 -2.02310466 -1.48431242 -1.43483534 </row> + <row>-2.02310466 -2.09054148 -1.5337895 -1.48431242 </row> + <row>-2.09054148 -2.1579783 -1.58326658 -1.5337895 </row> + <row>-2.1579783 -2.22541513 -1.63274366 -1.58326658 </row> + <row>-2.22541513 -2.29285195 -1.68222074 -1.63274366 </row> + <row>-2.29285195 -2.36028877 -1.73169782 -1.68222074 </row> + <row>-2.36028877 -2.42772559 -1.7811749 -1.73169782 </row> + <row>-2.42772559 -2.49516241 -1.83065198 -1.7811749 </row> + <row>-2.49516241 -2.56259924 -1.88012907 -1.83065198 </row> + <row>-2.56259924 -2.63003606 -1.92960615 -1.88012907 </row> + <row>0 -0.0494770807 -0.0261557299 0 </row> + <row>-0.0494770807 -0.0989541613 -0.0523114599 -0.0261557299 </row> + <row>-0.0989541613 -0.148431242 -0.0784671898 -0.0523114599 </row> + <row>-0.148431242 -0.197908323 -0.10462292 -0.0784671898 </row> + <row>-0.197908323 -0.247385403 -0.13077865 -0.10462292 </row> + <row>-0.247385403 -0.296862484 -0.15693438 -0.13077865 </row> + <row>-0.296862484 -0.346339565 -0.183090109 -0.15693438 </row> + <row>-0.346339565 -0.395816645 -0.209245839 -0.183090109 </row> + <row>-0.395816645 -0.445293726 -0.235401569 -0.209245839 </row> + <row>-0.445293726 -0.494770807 -0.261557299 -0.235401569 </row> + <row>-0.494770807 -0.544247887 -0.287713029 -0.261557299 </row> + <row>-0.544247887 -0.593724968 -0.313868759 -0.287713029 </row> + <row>-0.593724968 -0.643202049 -0.340024489 -0.313868759 </row> + <row>-0.643202049 -0.692679129 -0.366180219 -0.340024489 </row> + <row>-0.692679129 -0.74215621 -0.392335949 -0.366180219 </row> + <row>-0.74215621 -0.791633291 -0.418491679 -0.392335949 </row> + <row>-0.791633291 -0.841110371 -0.444647409 -0.418491679 </row> + <row>-0.841110371 -0.890587452 -0.470803139 -0.444647409 </row> + <row>-0.890587452 -0.940064533 -0.496958869 -0.470803139 </row> + <row>-0.940064533 -0.989541613 -0.523114599 -0.496958869 </row> + <row>-0.989541613 -1.03901869 -0.549270328 -0.523114599 </row> + <row>-1.03901869 -1.08849577 -0.575426058 -0.549270328 </row> + <row>-1.08849577 -1.13797286 -0.601581788 -0.575426058 </row> + <row>-1.13797286 -1.18744994 -0.627737518 -0.601581788 </row> + <row>-1.18744994 -1.23692702 -0.653893248 -0.627737518 </row> + <row>-1.23692702 -1.2864041 -0.680048978 -0.653893248 </row> + <row>-1.2864041 -1.33588118 -0.706204708 -0.680048978 </row> + <row>-1.33588118 -1.38535826 -0.732360438 -0.706204708 </row> + <row>-1.38535826 -1.43483534 -0.758516168 -0.732360438 </row> + <row>-1.43483534 -1.48431242 -0.784671898 -0.758516168 </row> + <row>-1.48431242 -1.5337895 -0.810827628 -0.784671898 </row> + <row>-1.5337895 -1.58326658 -0.836983358 -0.810827628 </row> + <row>-1.58326658 -1.63274366 -0.863139088 -0.836983358 </row> + <row>-1.63274366 -1.68222074 -0.889294817 -0.863139088 </row> + <row>-1.68222074 -1.73169782 -0.915450547 -0.889294817 </row> + <row>-1.73169782 -1.7811749 -0.941606277 -0.915450547 </row> + <row>-1.7811749 -1.83065198 -0.967762007 -0.941606277 </row> + <row>-1.83065198 -1.88012907 -0.993917737 -0.967762007 </row> + <row>-1.88012907 -1.92960615 -1.02007347 -0.993917737 </row> + <row>0 -0.0261557299 -1.97299558e-17 0 </row> + <row>-0.0261557299 -0.0523114599 -3.94599117e-17 -1.97299558e-17 </row> + <row>-0.0523114599 -0.0784671898 -5.91898675e-17 -3.94599117e-17 </row> + <row>-0.0784671898 -0.10462292 -7.89198233e-17 -5.91898675e-17 </row> + <row>-0.10462292 -0.13077865 -9.86497792e-17 -7.89198233e-17 </row> + <row>-0.13077865 -0.15693438 -1.18379735e-16 -9.86497792e-17 </row> + <row>-0.15693438 -0.183090109 -1.38109691e-16 -1.18379735e-16 </row> + <row>-0.183090109 -0.209245839 -1.57839647e-16 -1.38109691e-16 </row> + <row>-0.209245839 -0.235401569 -1.77569602e-16 -1.57839647e-16 </row> + <row>-0.235401569 -0.261557299 -1.97299558e-16 -1.77569602e-16 </row> + <row>-0.261557299 -0.287713029 -2.17029514e-16 -1.97299558e-16 </row> + <row>-0.287713029 -0.313868759 -2.3675947e-16 -2.17029514e-16 </row> + <row>-0.313868759 -0.340024489 -2.56489426e-16 -2.3675947e-16 </row> + <row>-0.340024489 -0.366180219 -2.76219382e-16 -2.56489426e-16 </row> + <row>-0.366180219 -0.392335949 -2.95949337e-16 -2.76219382e-16 </row> + <row>-0.392335949 -0.418491679 -3.15679293e-16 -2.95949337e-16 </row> + <row>-0.418491679 -0.444647409 -3.35409249e-16 -3.15679293e-16 </row> + <row>-0.444647409 -0.470803139 -3.55139205e-16 -3.35409249e-16 </row> + <row>-0.470803139 -0.496958869 -3.74869161e-16 -3.55139205e-16 </row> + <row>-0.496958869 -0.523114599 -3.94599117e-16 -3.74869161e-16 </row> + <row>-0.523114599 -0.549270328 -4.14329072e-16 -3.94599117e-16 </row> + <row>-0.549270328 -0.575426058 -4.34059028e-16 -4.14329072e-16 </row> + <row>-0.575426058 -0.601581788 -4.53788984e-16 -4.34059028e-16 </row> + <row>-0.601581788 -0.627737518 -4.7351894e-16 -4.53788984e-16 </row> + <row>-0.627737518 -0.653893248 -4.93248896e-16 -4.7351894e-16 </row> + <row>-0.653893248 -0.680048978 -5.12978852e-16 -4.93248896e-16 </row> + <row>-0.680048978 -0.706204708 -5.32708807e-16 -5.12978852e-16 </row> + <row>-0.706204708 -0.732360438 -5.52438763e-16 -5.32708807e-16 </row> + <row>-0.732360438 -0.758516168 -5.72168719e-16 -5.52438763e-16 </row> + <row>-0.758516168 -0.784671898 -5.91898675e-16 -5.72168719e-16 </row> + <row>-0.784671898 -0.810827628 -6.11628631e-16 -5.91898675e-16 </row> + <row>-0.810827628 -0.836983358 -6.31358587e-16 -6.11628631e-16 </row> + <row>-0.836983358 -0.863139088 -6.51088542e-16 -6.31358587e-16 </row> + <row>-0.863139088 -0.889294817 -6.70818498e-16 -6.51088542e-16 </row> + <row>-0.889294817 -0.915450547 -6.90548454e-16 -6.70818498e-16 </row> + <row>-0.915450547 -0.941606277 -7.1027841e-16 -6.90548454e-16 </row> + <row>-0.941606277 -0.967762007 -7.30008366e-16 -7.1027841e-16 </row> + <row>-0.967762007 -0.993917737 -7.49738322e-16 -7.30008366e-16 </row> + <row>-0.993917737 -1.02007347 -7.69468277e-16 -7.49738322e-16 </row> + </matrix> + <matrix title='z' rows='741' cols='4' element-type='double' data-channel='2'> + <row>0 0.0387651463 0.0380650121 0 </row> + <row>0.0387651463 0.153052591 0.150288321 0.0380650121 </row> + <row>0.153052591 0.336916362 0.330831343 0.150288321 </row> + <row>0.336916362 0.580703841 0.570215796 0.330831343 </row> + <row>0.580703841 0.871432427 0.855693556 0.570215796 </row> + <row>0.871432427 1.19329849 1.17174642 0.855693556 </row> + <row>1.19329849 1.52830098 1.50069846 1.17174642 </row> + <row>1.52830098 1.85695793 1.82341957 1.50069846 </row> + <row>1.85695793 2.15909093 2.12009577 1.82341957 </row> + <row>2.15909093 2.41464986 2.37103906 2.12009577 </row> + <row>2.41464986 2.60454879 2.55750824 2.37103906 </row> + <row>2.60454879 2.71148322 2.66251134 2.55750824 </row> + <row>2.71148322 2.72069905 2.67156072 2.66251134 </row> + <row>2.72069905 2.62068505 2.57335307 2.67156072 </row> + <row>2.62068505 2.40376301 2.36034884 2.57335307 </row> + <row>2.40376301 2.06655251 2.02922867 2.36034884 </row> + <row>2.06655251 1.61029155 1.58120821 2.02922867 </row> + <row>1.61029155 1.04099861 1.02219722 1.58120821 </row> + <row>1.04099861 0.369466957 0.362794044 1.02219722 </row> + <row>0.369466957 -0.388912586 -0.381888467 0.362794044 </row> + <row>-0.388912586 -1.21449838 -1.19256343 -0.381888467 </row> + <row>-1.21449838 -2.08390671 -2.04626944 -1.19256343 </row> + <row>-2.08390671 -2.97066923 -2.91701621 -2.04626944 </row> + <row>-2.97066923 -3.84602081 -3.77655814 -2.91701621 </row> + <row>-3.84602081 -4.67979473 -4.59527333 -3.77655814 </row> + <row>-4.67979473 -5.44139809 -5.34312144 -4.59527333 </row> + <row>-5.44139809 -6.10083725 -5.99065052 -5.34312144 </row> + <row>-6.10083725 -6.62976055 -6.51002098 -5.99065052 </row> + <row>-6.62976055 -7.00248459 -6.87601328 -6.51002098 </row> + <row>-7.00248459 -7.19696978 -7.06698589 -6.87601328 </row> + <row>-7.19696978 -7.195712 -7.06575082 -7.06698589 </row> + <row>-7.195712 -6.98651876 -6.86033581 -7.06575082 </row> + <row>-6.98651876 -6.56314171 -6.44460534 -6.86033581 </row> + <row>-6.56314171 -5.9257405 -5.81871618 -6.44460534 </row> + <row>-5.9257405 -5.08115861 -4.98938821 -5.81871618 </row> + <row>-5.08115861 -4.04299635 -3.96997612 -4.98938821 </row> + <row>-4.04299635 -2.83147294 -2.78033393 -3.96997612 </row> + <row>-2.83147294 -1.47307556 -1.44647046 -2.78033393 </row> + <row>-1.47307556 -2.30840483e-15 -2.26671292e-15 -1.44647046 </row> + <row>0 0.0380650121 0.0360404799 0 </row> + <row>0.0380650121 0.150288321 0.142295061 0.0360404799 </row> + <row>0.150288321 0.330831343 0.313235691 0.142295061 </row> + <row>0.330831343 0.570215796 0.539888203 0.313235691 </row> + <row>0.570215796 0.855693556 0.810182494 0.539888203 </row> + <row>0.855693556 1.17174642 1.10942572 0.810182494 </row> + <row>1.17174642 1.50069846 1.42088206 1.10942572 </row> + <row>1.50069846 1.82341957 1.72643887 1.42088206 </row> + <row>1.82341957 2.12009577 2.007336 1.72643887 </row> + <row>2.12009577 2.37103906 2.24493258 2.007336 </row> + <row>2.37103906 2.55750824 2.42148418 2.24493258 </row> + <row>2.55750824 2.66251134 2.52090257 2.42148418 </row> + <row>2.66251134 2.67156072 2.52947064 2.52090257 </row> + <row>2.67156072 2.57335307 2.43648628 2.52947064 </row> + <row>2.57335307 2.36034884 2.23481092 2.43648628 </row> + <row>2.36034884 2.02922867 1.92130177 2.23481092 </row> + <row>2.02922867 1.58120821 1.4971098 1.92130177 </row> + <row>1.58120821 1.02219722 0.967830469 1.4971098 </row> + <row>1.02219722 0.362794044 0.343498419 0.967830469 </row> + <row>0.362794044 -0.381888467 -0.361577283 0.343498419 </row> + <row>-0.381888467 -1.19256343 -1.12913555 -0.361577283 </row> + <row>-1.19256343 -2.04626944 -1.93743621 -1.12913555 </row> + <row>-2.04626944 -2.91701621 -2.7618713 -1.93743621 </row> + <row>-2.91701621 -3.77655814 -3.57569748 -2.7618713 </row> + <row>-3.77655814 -4.59527333 -4.35086835 -3.57569748 </row> + <row>-4.59527333 -5.34312144 -5.05894128 -4.35086835 </row> + <row>-5.34312144 -5.99065052 -5.67203077 -5.05894128 </row> + <row>-5.99065052 -6.51002098 -6.16377791 -5.67203077 </row> + <row>-6.51002098 -6.87601328 -6.51030448 -6.16377791 </row> + <row>-6.87601328 -7.06698589 -6.69111999 -6.51030448 </row> + <row>-7.06698589 -7.06575082 -6.68995061 -6.69111999 </row> + <row>-7.06575082 -6.86033581 -6.49546084 -6.68995061 </row> + <row>-6.86033581 -6.44460534 -6.10184147 -6.49546084 </row> + <row>-6.44460534 -5.81871618 -5.50924096 -6.10184147 </row> + <row>-5.81871618 -4.98938821 -4.72402177 -5.50924096 </row> + <row>-4.98938821 -3.96997612 -3.7588283 -4.72402177 </row> + <row>-3.96997612 -2.78033393 -2.63245862 -3.7588283 </row> + <row>-2.78033393 -1.44647046 -1.36953824 -2.63245862 </row> + <row>-1.44647046 -2.26671292e-15 -2.14615514e-15 -1.36953824 </row> + <row>0 0.0360404799 0.0329109393 0 </row> + <row>0.0360404799 0.142295061 0.129939005 0.0329109393 </row> + <row>0.142295061 0.313235691 0.286036169 0.129939005 </row> + <row>0.313235691 0.539888203 0.493007526 0.286036169 </row> + <row>0.539888203 0.810182494 0.739831072 0.493007526 </row> + <row>0.810182494 1.10942572 1.0130898 0.739831072 </row> + <row>1.10942572 1.42088206 1.29750112 1.0130898 </row> + <row>1.42088206 1.72643887 1.5765252 1.29750112 </row> + <row>1.72643887 2.007336 1.83303089 1.5765252 </row> + <row>2.007336 2.24493258 2.049996 1.83303089 </row> + <row>2.24493258 2.42148418 2.21121691 2.049996 </row> + <row>2.42148418 2.52090257 2.3020024 2.21121691 </row> + <row>2.52090257 2.52947064 2.30982647 2.3020024 </row> + <row>2.52947064 2.43648628 2.22491632 2.30982647 </row> + <row>2.43648628 2.23481092 2.04075325 2.22491632 </row> + <row>2.23481092 1.92130177 1.75446737 2.04075325 </row> + <row>1.92130177 1.4971098 1.3671097 1.75446737 </row> + <row>1.4971098 0.967830469 0.883789835 1.3671097 </row> + <row>0.967830469 0.343498419 0.313671062 0.883789835 </row> + <row>0.343498419 -0.361577283 -0.330180065 0.313671062 </row> + <row>-0.361577283 -1.12913555 -1.03108814 -0.330180065 </row> + <row>-1.12913555 -1.93743621 -1.76920079 -1.03108814 </row> + <row>-1.93743621 -2.7618713 -2.52204684 -1.76920079 </row> + <row>-2.7618713 -3.57569748 -3.26520521 -2.52204684 </row> + <row>-3.57569748 -4.35086835 -3.97306485 -3.26520521 </row> + <row>-4.35086835 -5.05894128 -4.61965295 -3.97306485 </row> + <row>-5.05894128 -5.67203077 -5.1795054 -4.61965295 </row> + <row>-5.67203077 -6.16377791 -5.62855214 -5.1795054 </row> + <row>-6.16377791 -6.51030448 -5.94498841 -5.62855214 </row> + <row>-6.51030448 -6.69111999 -6.11010298 -5.94498841 </row> + <row>-6.69111999 -6.68995061 -6.10903514 -6.11010298 </row> + <row>-6.68995061 -6.49546084 -5.9314337 -6.10903514 </row> + <row>-6.49546084 -6.10184147 -5.5719939 -5.9314337 </row> + <row>-6.10184147 -5.50924096 -5.03085129 -5.5719939 </row> + <row>-5.50924096 -4.72402177 -4.31381586 -5.03085129 </row> + <row>-4.72402177 -3.7588283 -3.43243403 -4.31381586 </row> + <row>-3.7588283 -2.63245862 -2.40387159 -3.43243403 </row> + <row>-2.63245862 -1.36953824 -1.25061569 -2.40387159 </row> + <row>-1.36953824 -2.14615514e-15 -1.95979581e-15 -1.25061569 </row> + <row>0 0.0329109393 0.0290155245 0 </row> + <row>0.0329109393 0.129939005 0.114559124 0.0290155245 </row> + <row>0.129939005 0.286036169 0.252180267 0.114559124 </row> + <row>0.286036169 0.493007526 0.434654016 0.252180267 </row> + <row>0.493007526 0.739831072 0.652262956 0.434654016 </row> + <row>0.739831072 1.0130898 0.893178149 0.652262956 </row> + <row>1.0130898 1.29750112 1.14392589 0.893178149 </row> + <row>1.29750112 1.5765252 1.38992403 1.14392589 </row> + <row>1.5765252 1.83303089 1.61606912 1.38992403 </row> + <row>1.83303089 2.049996 1.80735374 1.61606912 </row> + <row>2.049996 2.21121691 1.94949217 1.80735374 </row> + <row>2.21121691 2.3020024 2.02953208 1.94949217 </row> + <row>2.3020024 2.30982647 2.03643007 2.02953208 </row> + <row>2.30982647 2.22491632 1.96157008 2.03643007 </row> + <row>2.22491632 2.04075325 1.79920498 1.96157008 </row> + <row>2.04075325 1.75446737 1.54680456 1.79920498 </row> + <row>1.75446737 1.3671097 1.20529544 1.54680456 </row> + <row>1.3671097 0.883789835 0.779182427 1.20529544 </row> + <row>0.883789835 0.313671062 0.27654423 0.779182427 </row> + <row>0.313671062 -0.330180065 -0.291099189 0.27654423 </row> + <row>-0.330180065 -1.03108814 -0.909046165 -0.291099189 </row> + <row>-1.03108814 -1.76920079 -1.55979409 -0.909046165 </row> + <row>-1.76920079 -2.52204684 -2.22353155 -1.55979409 </row> + <row>-2.52204684 -3.26520521 -2.87872797 -2.22353155 </row> + <row>-3.26520521 -3.97306485 -3.50280371 -2.87872797 </row> + <row>-3.97306485 -4.61965295 -4.07286015 -3.50280371 </row> + <row>-4.61965295 -5.1795054 -4.56644717 -4.07286015 </row> + <row>-5.1795054 -5.62855214 -4.9623437 -4.56644717 </row> + <row>-5.62855214 -5.94498841 -5.24132584 -4.9623437 </row> + <row>-5.94498841 -6.11010298 -5.38689707 -5.24132584 </row> + <row>-6.11010298 -6.10903514 -5.38595562 -5.38689707 </row> + <row>-6.10903514 -5.9314337 -5.2293755 -5.38595562 </row> + <row>-5.9314337 -5.5719939 -4.91247982 -5.2293755 </row> + <row>-5.5719939 -5.03085129 -4.4353881 -4.91247982 </row> + <row>-5.03085129 -4.31381586 -3.80322264 -4.4353881 </row> + <row>-4.31381586 -3.43243403 -3.02616321 -3.80322264 </row> + <row>-3.43243403 -2.40387159 -2.1193438 -3.02616321 </row> + <row>-2.40387159 -1.25061569 -1.10258993 -2.1193438 </row> + <row>-1.25061569 -1.95979581e-15 -1.72782985e-15 -1.10258993 </row> + <row>0 0.0290155245 0.024776364 0 </row> + <row>0.0290155245 0.114559124 0.0978220665 0.024776364 </row> + <row>0.114559124 0.252180267 0.215336797 0.0978220665 </row> + <row>0.252180267 0.434654016 0.37115118 0.215336797 </row> + <row>0.434654016 0.652262956 0.556967512 0.37115118 </row> + <row>0.652262956 0.893178149 0.762685059 0.556967512 </row> + <row>0.893178149 1.14392589 0.976798622 0.762685059 </row> + <row>1.14392589 1.38992403 1.1868565 0.976798622 </row> + <row>1.38992403 1.61606912 1.37996185 1.1868565 </row> + <row>1.61606912 1.80735374 1.54329984 1.37996185 </row> + <row>1.80735374 1.94949217 1.66467188 1.54329984 </row> + <row>1.94949217 2.02953208 1.73301798 1.66467188 </row> + <row>2.02953208 2.03643007 1.73890818 1.73301798 </row> + <row>2.03643007 1.96157008 1.67498521 1.73890818 </row> + <row>1.96157008 1.79920498 1.53634161 1.67498521 </row> + <row>1.79920498 1.54680456 1.32081682 1.53634161 </row> + <row>1.54680456 1.20529544 1.02920209 1.32081682 </row> + <row>1.20529544 0.779182427 0.665344082 1.02920209 </row> + <row>0.779182427 0.27654423 0.236141192 0.665344082 </row> + <row>0.27654423 -0.291099189 -0.248569675 0.236141192 </row> + <row>-0.291099189 -0.909046165 -0.776234762 -0.248569675 </row> + <row>-0.909046165 -1.55979409 -1.33190859 -0.776234762 </row> + <row>-1.55979409 -2.22353155 -1.89867418 -1.33190859 </row> + <row>-2.22353155 -2.87872797 -2.45814658 -1.89867418 </row> + <row>-2.87872797 -3.50280371 -2.99104502 -2.45814658 </row> + <row>-3.50280371 -4.07286015 -3.47781636 -2.99104502 </row> + <row>-4.07286015 -4.56644717 -3.89929045 -3.47781636 </row> + <row>-4.56644717 -4.9623437 -4.23734661 -3.89929045 </row> + <row>-4.9623437 -5.24132584 -4.47556953 -4.23734661 </row> + <row>-5.24132584 -5.38689707 -4.59987284 -4.47556953 </row> + <row>-5.38689707 -5.38595562 -4.59906893 -4.59987284 </row> + <row>-5.38595562 -5.2293755 -4.46536513 -4.59906893 </row> + <row>-5.2293755 -4.91247982 -4.19476782 -4.46536513 </row> + <row>-4.91247982 -4.4353881 -3.78737908 -4.19476782 </row> + <row>-4.4353881 -3.80322264 -3.24757282 -3.78737908 </row> + <row>-3.80322264 -3.02616321 -2.58404157 -3.24757282 </row> + <row>-3.02616321 -2.1193438 -1.80970823 -2.58404157 </row> + <row>-2.1193438 -1.10258993 -0.941501834 -1.80970823 </row> + <row>-1.10258993 -1.72782985e-15 -1.47539437e-15 -0.941501834 </row> + <row>0 0.024776364 0.0206528369 0 </row> + <row>0.024776364 0.0978220665 0.0815415523 0.0206528369 </row> + <row>0.0978220665 0.215336797 0.179498321 0.0815415523 </row> + <row>0.215336797 0.37115118 0.309380535 0.179498321 </row> + <row>0.37115118 0.556967512 0.464271478 0.309380535 </row> + <row>0.556967512 0.762685059 0.63575148 0.464271478 </row> + <row>0.762685059 0.976798622 0.81423015 0.63575148 </row> + <row>0.976798622 1.1868565 0.989328121 0.81423015 </row> + <row>1.1868565 1.37996185 1.15029497 0.989328121 </row> + <row>1.37996185 1.54329984 1.28644864 1.15029497 </row> + <row>1.54329984 1.66467188 1.38762075 1.28644864 </row> + <row>1.66467188 1.73301798 1.44459201 1.38762075 </row> + <row>1.73301798 1.73890818 1.44950191 1.44459201 </row> + <row>1.73890818 1.67498521 1.39621763 1.44950191 </row> + <row>1.67498521 1.53634161 1.28064847 1.39621763 </row> + <row>1.53634161 1.32081682 1.10099344 1.28064847 </row> + <row>1.32081682 1.02920209 0.857912118 1.10099344 </row> + <row>1.02920209 0.665344082 0.55461095 0.857912118 </row> + <row>0.665344082 0.236141192 0.196840243 0.55461095 </row> + <row>0.236141192 -0.248569675 -0.207200255 0.196840243 </row> + <row>-0.248569675 -0.776234762 -0.647046108 -0.207200255 </row> + <row>-0.776234762 -1.33190859 -1.11023921 -0.647046108 </row> + <row>-1.33190859 -1.89867418 -1.58267807 -1.11023921 </row> + <row>-1.89867418 -2.45814658 -2.04903755 -1.58267807 </row> + <row>-2.45814658 -2.99104502 -2.49324577 -2.04903755 </row> + <row>-2.99104502 -3.47781636 -2.89900382 -2.49324577 </row> + <row>-3.47781636 -3.89929045 -3.25033203 -2.89900382 </row> + <row>-3.89929045 -4.23734661 -3.53212554 -3.25033203 </row> + <row>-4.23734661 -4.47556953 -3.73070105 -3.53212554 </row> + <row>-4.47556953 -4.59987284 -3.83431658 -3.73070105 </row> + <row>-4.59987284 -4.59906893 -3.83364647 -3.83431658 </row> + <row>-4.59906893 -4.46536513 -3.72219497 -3.83364647 </row> + <row>-4.46536513 -4.19476782 -3.49663314 -3.72219497 </row> + <row>-4.19476782 -3.78737908 -3.15704605 -3.49663314 </row> + <row>-3.78737908 -3.24757282 -2.70707969 -3.15704605 </row> + <row>-3.24757282 -2.58404157 -2.15397985 -2.70707969 </row> + <row>-2.58404157 -1.80970823 -1.50851872 -2.15397985 </row> + <row>-1.80970823 -0.941501834 -0.784807802 -1.50851872 </row> + <row>-0.941501834 -1.47539437e-15 -1.22984467e-15 -0.784807802 </row> + <row>0 0.0206528369 0.0170917911 0 </row> + <row>0.0206528369 0.0815415523 0.0674818276 0.0170917911 </row> + <row>0.0815415523 0.179498321 0.148548494 0.0674818276 </row> + <row>0.179498321 0.309380535 0.256035891 0.148548494 </row> + <row>0.309380535 0.464271478 0.38421991 0.256035891 </row> + <row>0.464271478 0.63575148 0.526132636 0.38421991 </row> + <row>0.63575148 0.81423015 0.67383729 0.526132636 </row> + <row>0.81423015 0.989328121 0.81874416 0.67383729 </row> + <row>0.989328121 1.15029497 0.951956456 0.81874416 </row> + <row>1.15029497 1.28644864 1.06463396 0.951956456 </row> + <row>1.28644864 1.38762075 1.14836156 1.06463396 </row> + <row>1.38762075 1.44459201 1.19550961 1.14836156 </row> + <row>1.44459201 1.44950191 1.19957292 1.19550961 </row> + <row>1.44950191 1.39621763 1.15547614 1.19957292 </row> + <row>1.39621763 1.28064847 1.05983388 1.15547614 </row> + <row>1.28064847 1.10099344 0.911155695 1.05983388 </row> + <row>1.10099344 0.857912118 0.709987437 0.911155695 </row> + <row>0.857912118 0.55461095 0.458982684 0.709987437 </row> + <row>0.55461095 0.196840243 0.162900251 0.458982684 </row> + <row>0.196840243 -0.207200255 -0.171473948 0.162900251 </row> + <row>-0.207200255 -0.647046108 -0.535479798 -0.171473948 </row> + <row>-0.647046108 -1.11023921 -0.918807271 -0.535479798 </row> + <row>-1.11023921 -1.58267807 -1.30978631 -0.918807271 </row> + <row>-1.58267807 -2.04903755 -1.6957342 -1.30978631 </row> + <row>-2.04903755 -2.49324577 -2.06335024 -1.6957342 </row> + <row>-2.49324577 -2.89900382 -2.39914584 -2.06335024 </row> + <row>-2.89900382 -3.25033203 -2.68989662 -2.39914584 </row> + <row>-3.25033203 -3.53212554 -2.92310215 -2.68989662 </row> + <row>-3.53212554 -3.73070105 -3.08743847 -2.92310215 </row> + <row>-3.73070105 -3.83431658 -3.17318819 -3.08743847 </row> + <row>-3.83431658 -3.83364647 -3.17263362 -3.17318819 </row> + <row>-3.83364647 -3.72219497 -3.08039904 -3.17263362 </row> + <row>-3.72219497 -3.49663314 -2.8937295 -3.08039904 </row> + <row>-3.49663314 -3.15704605 -2.61269539 -2.8937295 </row> + <row>-3.15704605 -2.70707969 -2.24031404 -2.61269539 </row> + <row>-2.70707969 -2.15397985 -1.78258192 -2.24031404 </row> + <row>-2.15397985 -1.50851872 -1.24841381 -1.78258192 </row> + <row>-1.50851872 -0.784807802 -0.649488062 -1.24841381 </row> + <row>-0.784807802 -1.22984467e-15 -1.01778987e-15 -0.649488062 </row> + <row>0 0.0170917911 0.0144791213 0 </row> + <row>0.0170917911 0.0674818276 0.057166482 0.0144791213 </row> + <row>0.0674818276 0.148548494 0.125841209 0.057166482 </row> + <row>0.148548494 0.256035891 0.216897966 0.125841209 </row> + <row>0.256035891 0.38421991 0.325487636 0.216897966 </row> + <row>0.38421991 0.526132636 0.445707428 0.325487636 </row> + <row>0.526132636 0.67383729 0.570833788 0.445707428 </row> + <row>0.67383729 0.81874416 0.693590036 0.570833788 </row> + <row>0.81874416 0.951956456 0.806439355 0.693590036 </row> + <row>0.951956456 1.06463396 0.901892849 0.806439355 </row> + <row>1.06463396 1.14836156 0.972821762 0.901892849 </row> + <row>1.14836156 1.19550961 1.01276271 0.972821762 </row> + <row>1.19550961 1.19957292 1.0162049 1.01276271 </row> + <row>1.19957292 1.15547614 0.978848795 1.0162049 </row> + <row>1.15547614 1.05983388 0.897826515 0.978848795 </row> + <row>1.05983388 0.911155695 0.771875443 0.897826515 </row> + <row>0.911155695 0.709987437 0.601457984 0.771875443 </row> + <row>0.709987437 0.458982684 0.388822091 0.601457984 </row> + <row>0.458982684 0.162900251 0.137999141 0.388822091 </row> + <row>0.162900251 -0.171473948 -0.145262254 0.137999141 </row> + <row>-0.171473948 -0.535479798 -0.453625773 -0.145262254 </row> + <row>-0.535479798 -0.918807271 -0.778357391 -0.453625773 </row> + <row>-0.918807271 -1.30978631 -1.10957095 -0.778357391 </row> + <row>-1.30978631 -1.6957342 -1.43652242 -1.10957095 </row> + <row>-1.6957342 -2.06335024 -1.74794428 -1.43652242 </row> + <row>-2.06335024 -2.39914584 -2.0324098 -1.74794428 </row> + <row>-2.39914584 -2.68989662 -2.27871609 -2.0324098 </row> + <row>-2.68989662 -2.92310215 -2.47627357 -2.27871609 </row> + <row>-2.92310215 -3.08743847 -2.61548926 -2.47627357 </row> + <row>-3.08743847 -3.17318819 -2.68813118 -2.61548926 </row> + <row>-3.17318819 -3.17263362 -2.68766139 -2.68813118 </row> + <row>-3.17263362 -3.08039904 -2.60952589 -2.68766139 </row> + <row>-3.08039904 -2.8937295 -2.45139085 -2.60952589 </row> + <row>-2.8937295 -2.61269539 -2.21331593 -2.45139085 </row> + <row>-2.61269539 -2.24031404 -1.8978572 -2.21331593 </row> + <row>-2.24031404 -1.78258192 -1.51009451 -1.8978572 </row> + <row>-1.78258192 -1.24841381 -1.05757992 -1.51009451 </row> + <row>-1.24841381 -0.649488062 -0.55020661 -1.05757992 </row> + <row>-0.649488062 -1.01778987e-15 -8.62209403e-16 -0.55020661 </row> + <row>0 0.0144791213 0.0130979508 0 </row> + <row>0.0144791213 0.057166482 0.051713343 0.0130979508 </row> + <row>0.057166482 0.125841209 0.113837154 0.051713343 </row> + <row>0.125841209 0.216897966 0.196207962 0.113837154 </row> + <row>0.216897966 0.325487636 0.29443921 0.196207962 </row> + <row>0.325487636 0.445707428 0.403191176 0.29443921 </row> + <row>0.445707428 0.570833788 0.516381671 0.403191176 </row> + <row>0.570833788 0.693590036 0.62742814 0.516381671 </row> + <row>0.693590036 0.806439355 0.729512707 0.62742814 </row> + <row>0.806439355 0.901892849 0.815860845 0.729512707 </row> + <row>0.901892849 0.972821762 0.880023813 0.815860845 </row> + <row>0.972821762 1.01276271 0.916154774 0.880023813 </row> + <row>1.01276271 1.0162049 0.919268612 0.916154774 </row> + <row>1.0162049 0.978848795 0.885475925 0.919268612 </row> + <row>0.978848795 0.897826515 0.8121824 0.885475925 </row> + <row>0.897826515 0.771875443 0.698245864 0.8121824 </row> + <row>0.771875443 0.601457984 0.54408461 0.698245864 </row> + <row>0.601457984 0.388822091 0.35173216 0.54408461 </row> + <row>0.388822091 0.137999141 0.124835335 0.35173216 </row> + <row>0.137999141 -0.145262254 -0.131405616 0.124835335 </row> + <row>-0.145262254 -0.453625773 -0.410354186 -0.131405616 </row> + <row>-0.453625773 -0.778357391 -0.704109495 -0.410354186 </row> + <row>-0.778357391 -1.10957095 -1.00372843 -0.704109495 </row> + <row>-1.10957095 -1.43652242 -1.29949184 -1.00372843 </row> + <row>-1.43652242 -1.74794428 -1.58120701 -1.29949184 </row> + <row>-1.74794428 -2.0324098 -1.83853722 -1.58120701 </row> + <row>-2.0324098 -2.27871609 -2.06134824 -1.83853722 </row> + <row>-2.27871609 -2.47627357 -2.24006062 -2.06134824 </row> + <row>-2.47627357 -2.61548926 -2.36599645 -2.24006062 </row> + <row>-2.61548926 -2.68813118 -2.43170902 -2.36599645 </row> + <row>-2.68813118 -2.68766139 -2.43128404 -2.43170902 </row> + <row>-2.68766139 -2.60952589 -2.36060192 -2.43128404 </row> + <row>-2.60952589 -2.45139085 -2.21755147 -2.36060192 </row> + <row>-2.45139085 -2.21331593 -2.00218663 -2.21755147 </row> + <row>-2.21331593 -1.8978572 -1.71681966 -2.00218663 </row> + <row>-1.8978572 -1.51009451 -1.36604585 -1.71681966 </row> + <row>-1.51009451 -1.05757992 -0.956696846 -1.36604585 </row> + <row>-1.05757992 -0.55020661 -0.49772213 -0.956696846 </row> + <row>-0.55020661 -8.62209403e-16 -7.79962822e-16 -0.49772213 </row> + <row>0 0.0130979508 0.0130979508 0 </row> + <row>0.0130979508 0.051713343 0.051713343 0.0130979508 </row> + <row>0.051713343 0.113837154 0.113837154 0.051713343 </row> + <row>0.113837154 0.196207962 0.196207962 0.113837154 </row> + <row>0.196207962 0.29443921 0.29443921 0.196207962 </row> + <row>0.29443921 0.403191176 0.403191176 0.29443921 </row> + <row>0.403191176 0.516381671 0.516381671 0.403191176 </row> + <row>0.516381671 0.62742814 0.62742814 0.516381671 </row> + <row>0.62742814 0.729512707 0.729512707 0.62742814 </row> + <row>0.729512707 0.815860845 0.815860845 0.729512707 </row> + <row>0.815860845 0.880023813 0.880023813 0.815860845 </row> + <row>0.880023813 0.916154774 0.916154774 0.880023813 </row> + <row>0.916154774 0.919268612 0.919268612 0.916154774 </row> + <row>0.919268612 0.885475925 0.885475925 0.919268612 </row> + <row>0.885475925 0.8121824 0.8121824 0.885475925 </row> + <row>0.8121824 0.698245864 0.698245864 0.8121824 </row> + <row>0.698245864 0.54408461 0.54408461 0.698245864 </row> + <row>0.54408461 0.35173216 0.35173216 0.54408461 </row> + <row>0.35173216 0.124835335 0.124835335 0.35173216 </row> + <row>0.124835335 -0.131405616 -0.131405616 0.124835335 </row> + <row>-0.131405616 -0.410354186 -0.410354186 -0.131405616 </row> + <row>-0.410354186 -0.704109495 -0.704109495 -0.410354186 </row> + <row>-0.704109495 -1.00372843 -1.00372843 -0.704109495 </row> + <row>-1.00372843 -1.29949184 -1.29949184 -1.00372843 </row> + <row>-1.29949184 -1.58120701 -1.58120701 -1.29949184 </row> + <row>-1.58120701 -1.83853722 -1.83853722 -1.58120701 </row> + <row>-1.83853722 -2.06134824 -2.06134824 -1.83853722 </row> + <row>-2.06134824 -2.24006062 -2.24006062 -2.06134824 </row> + <row>-2.24006062 -2.36599645 -2.36599645 -2.24006062 </row> + <row>-2.36599645 -2.43170902 -2.43170902 -2.36599645 </row> + <row>-2.43170902 -2.43128404 -2.43128404 -2.43170902 </row> + <row>-2.43128404 -2.36060192 -2.36060192 -2.43128404 </row> + <row>-2.36060192 -2.21755147 -2.21755147 -2.36060192 </row> + <row>-2.21755147 -2.00218663 -2.00218663 -2.21755147 </row> + <row>-2.00218663 -1.71681966 -1.71681966 -2.00218663 </row> + <row>-1.71681966 -1.36604585 -1.36604585 -1.71681966 </row> + <row>-1.36604585 -0.956696846 -0.956696846 -1.36604585 </row> + <row>-0.956696846 -0.49772213 -0.49772213 -0.956696846 </row> + <row>-0.49772213 -7.79962822e-16 -7.79962822e-16 -0.49772213 </row> + <row>0 0.0130979508 0.0144791213 0 </row> + <row>0.0130979508 0.051713343 0.057166482 0.0144791213 </row> + <row>0.051713343 0.113837154 0.125841209 0.057166482 </row> + <row>0.113837154 0.196207962 0.216897966 0.125841209 </row> + <row>0.196207962 0.29443921 0.325487636 0.216897966 </row> + <row>0.29443921 0.403191176 0.445707428 0.325487636 </row> + <row>0.403191176 0.516381671 0.570833788 0.445707428 </row> + <row>0.516381671 0.62742814 0.693590036 0.570833788 </row> + <row>0.62742814 0.729512707 0.806439355 0.693590036 </row> + <row>0.729512707 0.815860845 0.901892849 0.806439355 </row> + <row>0.815860845 0.880023813 0.972821762 0.901892849 </row> + <row>0.880023813 0.916154774 1.01276271 0.972821762 </row> + <row>0.916154774 0.919268612 1.0162049 1.01276271 </row> + <row>0.919268612 0.885475925 0.978848795 1.0162049 </row> + <row>0.885475925 0.8121824 0.897826515 0.978848795 </row> + <row>0.8121824 0.698245864 0.771875443 0.897826515 </row> + <row>0.698245864 0.54408461 0.601457984 0.771875443 </row> + <row>0.54408461 0.35173216 0.388822091 0.601457984 </row> + <row>0.35173216 0.124835335 0.137999141 0.388822091 </row> + <row>0.124835335 -0.131405616 -0.145262254 0.137999141 </row> + <row>-0.131405616 -0.410354186 -0.453625773 -0.145262254 </row> + <row>-0.410354186 -0.704109495 -0.778357391 -0.453625773 </row> + <row>-0.704109495 -1.00372843 -1.10957095 -0.778357391 </row> + <row>-1.00372843 -1.29949184 -1.43652242 -1.10957095 </row> + <row>-1.29949184 -1.58120701 -1.74794428 -1.43652242 </row> + <row>-1.58120701 -1.83853722 -2.0324098 -1.74794428 </row> + <row>-1.83853722 -2.06134824 -2.27871609 -2.0324098 </row> + <row>-2.06134824 -2.24006062 -2.47627357 -2.27871609 </row> + <row>-2.24006062 -2.36599645 -2.61548926 -2.47627357 </row> + <row>-2.36599645 -2.43170902 -2.68813118 -2.61548926 </row> + <row>-2.43170902 -2.43128404 -2.68766139 -2.68813118 </row> + <row>-2.43128404 -2.36060192 -2.60952589 -2.68766139 </row> + <row>-2.36060192 -2.21755147 -2.45139085 -2.60952589 </row> + <row>-2.21755147 -2.00218663 -2.21331593 -2.45139085 </row> + <row>-2.00218663 -1.71681966 -1.8978572 -2.21331593 </row> + <row>-1.71681966 -1.36604585 -1.51009451 -1.8978572 </row> + <row>-1.36604585 -0.956696846 -1.05757992 -1.51009451 </row> + <row>-0.956696846 -0.49772213 -0.55020661 -1.05757992 </row> + <row>-0.49772213 -7.79962822e-16 -8.62209403e-16 -0.55020661 </row> + <row>0 0.0144791213 0.0170917911 0 </row> + <row>0.0144791213 0.057166482 0.0674818276 0.0170917911 </row> + <row>0.057166482 0.125841209 0.148548494 0.0674818276 </row> + <row>0.125841209 0.216897966 0.256035891 0.148548494 </row> + <row>0.216897966 0.325487636 0.38421991 0.256035891 </row> + <row>0.325487636 0.445707428 0.526132636 0.38421991 </row> + <row>0.445707428 0.570833788 0.67383729 0.526132636 </row> + <row>0.570833788 0.693590036 0.81874416 0.67383729 </row> + <row>0.693590036 0.806439355 0.951956456 0.81874416 </row> + <row>0.806439355 0.901892849 1.06463396 0.951956456 </row> + <row>0.901892849 0.972821762 1.14836156 1.06463396 </row> + <row>0.972821762 1.01276271 1.19550961 1.14836156 </row> + <row>1.01276271 1.0162049 1.19957292 1.19550961 </row> + <row>1.0162049 0.978848795 1.15547614 1.19957292 </row> + <row>0.978848795 0.897826515 1.05983388 1.15547614 </row> + <row>0.897826515 0.771875443 0.911155695 1.05983388 </row> + <row>0.771875443 0.601457984 0.709987437 0.911155695 </row> + <row>0.601457984 0.388822091 0.458982684 0.709987437 </row> + <row>0.388822091 0.137999141 0.162900251 0.458982684 </row> + <row>0.137999141 -0.145262254 -0.171473948 0.162900251 </row> + <row>-0.145262254 -0.453625773 -0.535479798 -0.171473948 </row> + <row>-0.453625773 -0.778357391 -0.918807271 -0.535479798 </row> + <row>-0.778357391 -1.10957095 -1.30978631 -0.918807271 </row> + <row>-1.10957095 -1.43652242 -1.6957342 -1.30978631 </row> + <row>-1.43652242 -1.74794428 -2.06335024 -1.6957342 </row> + <row>-1.74794428 -2.0324098 -2.39914584 -2.06335024 </row> + <row>-2.0324098 -2.27871609 -2.68989662 -2.39914584 </row> + <row>-2.27871609 -2.47627357 -2.92310215 -2.68989662 </row> + <row>-2.47627357 -2.61548926 -3.08743847 -2.92310215 </row> + <row>-2.61548926 -2.68813118 -3.17318819 -3.08743847 </row> + <row>-2.68813118 -2.68766139 -3.17263362 -3.17318819 </row> + <row>-2.68766139 -2.60952589 -3.08039904 -3.17263362 </row> + <row>-2.60952589 -2.45139085 -2.8937295 -3.08039904 </row> + <row>-2.45139085 -2.21331593 -2.61269539 -2.8937295 </row> + <row>-2.21331593 -1.8978572 -2.24031404 -2.61269539 </row> + <row>-1.8978572 -1.51009451 -1.78258192 -2.24031404 </row> + <row>-1.51009451 -1.05757992 -1.24841381 -1.78258192 </row> + <row>-1.05757992 -0.55020661 -0.649488062 -1.24841381 </row> + <row>-0.55020661 -8.62209403e-16 -1.01778987e-15 -0.649488062 </row> + <row>0 0.0170917911 0.0206528369 0 </row> + <row>0.0170917911 0.0674818276 0.0815415523 0.0206528369 </row> + <row>0.0674818276 0.148548494 0.179498321 0.0815415523 </row> + <row>0.148548494 0.256035891 0.309380535 0.179498321 </row> + <row>0.256035891 0.38421991 0.464271478 0.309380535 </row> + <row>0.38421991 0.526132636 0.63575148 0.464271478 </row> + <row>0.526132636 0.67383729 0.81423015 0.63575148 </row> + <row>0.67383729 0.81874416 0.989328121 0.81423015 </row> + <row>0.81874416 0.951956456 1.15029497 0.989328121 </row> + <row>0.951956456 1.06463396 1.28644864 1.15029497 </row> + <row>1.06463396 1.14836156 1.38762075 1.28644864 </row> + <row>1.14836156 1.19550961 1.44459201 1.38762075 </row> + <row>1.19550961 1.19957292 1.44950191 1.44459201 </row> + <row>1.19957292 1.15547614 1.39621763 1.44950191 </row> + <row>1.15547614 1.05983388 1.28064847 1.39621763 </row> + <row>1.05983388 0.911155695 1.10099344 1.28064847 </row> + <row>0.911155695 0.709987437 0.857912118 1.10099344 </row> + <row>0.709987437 0.458982684 0.55461095 0.857912118 </row> + <row>0.458982684 0.162900251 0.196840243 0.55461095 </row> + <row>0.162900251 -0.171473948 -0.207200255 0.196840243 </row> + <row>-0.171473948 -0.535479798 -0.647046108 -0.207200255 </row> + <row>-0.535479798 -0.918807271 -1.11023921 -0.647046108 </row> + <row>-0.918807271 -1.30978631 -1.58267807 -1.11023921 </row> + <row>-1.30978631 -1.6957342 -2.04903755 -1.58267807 </row> + <row>-1.6957342 -2.06335024 -2.49324577 -2.04903755 </row> + <row>-2.06335024 -2.39914584 -2.89900382 -2.49324577 </row> + <row>-2.39914584 -2.68989662 -3.25033203 -2.89900382 </row> + <row>-2.68989662 -2.92310215 -3.53212554 -3.25033203 </row> + <row>-2.92310215 -3.08743847 -3.73070105 -3.53212554 </row> + <row>-3.08743847 -3.17318819 -3.83431658 -3.73070105 </row> + <row>-3.17318819 -3.17263362 -3.83364647 -3.83431658 </row> + <row>-3.17263362 -3.08039904 -3.72219497 -3.83364647 </row> + <row>-3.08039904 -2.8937295 -3.49663314 -3.72219497 </row> + <row>-2.8937295 -2.61269539 -3.15704605 -3.49663314 </row> + <row>-2.61269539 -2.24031404 -2.70707969 -3.15704605 </row> + <row>-2.24031404 -1.78258192 -2.15397985 -2.70707969 </row> + <row>-1.78258192 -1.24841381 -1.50851872 -2.15397985 </row> + <row>-1.24841381 -0.649488062 -0.784807802 -1.50851872 </row> + <row>-0.649488062 -1.01778987e-15 -1.22984467e-15 -0.784807802 </row> + <row>0 0.0206528369 0.024776364 0 </row> + <row>0.0206528369 0.0815415523 0.0978220665 0.024776364 </row> + <row>0.0815415523 0.179498321 0.215336797 0.0978220665 </row> + <row>0.179498321 0.309380535 0.37115118 0.215336797 </row> + <row>0.309380535 0.464271478 0.556967512 0.37115118 </row> + <row>0.464271478 0.63575148 0.762685059 0.556967512 </row> + <row>0.63575148 0.81423015 0.976798622 0.762685059 </row> + <row>0.81423015 0.989328121 1.1868565 0.976798622 </row> + <row>0.989328121 1.15029497 1.37996185 1.1868565 </row> + <row>1.15029497 1.28644864 1.54329984 1.37996185 </row> + <row>1.28644864 1.38762075 1.66467188 1.54329984 </row> + <row>1.38762075 1.44459201 1.73301798 1.66467188 </row> + <row>1.44459201 1.44950191 1.73890818 1.73301798 </row> + <row>1.44950191 1.39621763 1.67498521 1.73890818 </row> + <row>1.39621763 1.28064847 1.53634161 1.67498521 </row> + <row>1.28064847 1.10099344 1.32081682 1.53634161 </row> + <row>1.10099344 0.857912118 1.02920209 1.32081682 </row> + <row>0.857912118 0.55461095 0.665344082 1.02920209 </row> + <row>0.55461095 0.196840243 0.236141192 0.665344082 </row> + <row>0.196840243 -0.207200255 -0.248569675 0.236141192 </row> + <row>-0.207200255 -0.647046108 -0.776234762 -0.248569675 </row> + <row>-0.647046108 -1.11023921 -1.33190859 -0.776234762 </row> + <row>-1.11023921 -1.58267807 -1.89867418 -1.33190859 </row> + <row>-1.58267807 -2.04903755 -2.45814658 -1.89867418 </row> + <row>-2.04903755 -2.49324577 -2.99104502 -2.45814658 </row> + <row>-2.49324577 -2.89900382 -3.47781636 -2.99104502 </row> + <row>-2.89900382 -3.25033203 -3.89929045 -3.47781636 </row> + <row>-3.25033203 -3.53212554 -4.23734661 -3.89929045 </row> + <row>-3.53212554 -3.73070105 -4.47556953 -4.23734661 </row> + <row>-3.73070105 -3.83431658 -4.59987284 -4.47556953 </row> + <row>-3.83431658 -3.83364647 -4.59906893 -4.59987284 </row> + <row>-3.83364647 -3.72219497 -4.46536513 -4.59906893 </row> + <row>-3.72219497 -3.49663314 -4.19476782 -4.46536513 </row> + <row>-3.49663314 -3.15704605 -3.78737908 -4.19476782 </row> + <row>-3.15704605 -2.70707969 -3.24757282 -3.78737908 </row> + <row>-2.70707969 -2.15397985 -2.58404157 -3.24757282 </row> + <row>-2.15397985 -1.50851872 -1.80970823 -2.58404157 </row> + <row>-1.50851872 -0.784807802 -0.941501834 -1.80970823 </row> + <row>-0.784807802 -1.22984467e-15 -1.47539437e-15 -0.941501834 </row> + <row>0 0.024776364 0.0290155245 0 </row> + <row>0.024776364 0.0978220665 0.114559124 0.0290155245 </row> + <row>0.0978220665 0.215336797 0.252180267 0.114559124 </row> + <row>0.215336797 0.37115118 0.434654016 0.252180267 </row> + <row>0.37115118 0.556967512 0.652262956 0.434654016 </row> + <row>0.556967512 0.762685059 0.893178149 0.652262956 </row> + <row>0.762685059 0.976798622 1.14392589 0.893178149 </row> + <row>0.976798622 1.1868565 1.38992403 1.14392589 </row> + <row>1.1868565 1.37996185 1.61606912 1.38992403 </row> + <row>1.37996185 1.54329984 1.80735374 1.61606912 </row> + <row>1.54329984 1.66467188 1.94949217 1.80735374 </row> + <row>1.66467188 1.73301798 2.02953208 1.94949217 </row> + <row>1.73301798 1.73890818 2.03643007 2.02953208 </row> + <row>1.73890818 1.67498521 1.96157008 2.03643007 </row> + <row>1.67498521 1.53634161 1.79920498 1.96157008 </row> + <row>1.53634161 1.32081682 1.54680456 1.79920498 </row> + <row>1.32081682 1.02920209 1.20529544 1.54680456 </row> + <row>1.02920209 0.665344082 0.779182427 1.20529544 </row> + <row>0.665344082 0.236141192 0.27654423 0.779182427 </row> + <row>0.236141192 -0.248569675 -0.291099189 0.27654423 </row> + <row>-0.248569675 -0.776234762 -0.909046165 -0.291099189 </row> + <row>-0.776234762 -1.33190859 -1.55979409 -0.909046165 </row> + <row>-1.33190859 -1.89867418 -2.22353155 -1.55979409 </row> + <row>-1.89867418 -2.45814658 -2.87872797 -2.22353155 </row> + <row>-2.45814658 -2.99104502 -3.50280371 -2.87872797 </row> + <row>-2.99104502 -3.47781636 -4.07286015 -3.50280371 </row> + <row>-3.47781636 -3.89929045 -4.56644717 -4.07286015 </row> + <row>-3.89929045 -4.23734661 -4.9623437 -4.56644717 </row> + <row>-4.23734661 -4.47556953 -5.24132584 -4.9623437 </row> + <row>-4.47556953 -4.59987284 -5.38689707 -5.24132584 </row> + <row>-4.59987284 -4.59906893 -5.38595562 -5.38689707 </row> + <row>-4.59906893 -4.46536513 -5.2293755 -5.38595562 </row> + <row>-4.46536513 -4.19476782 -4.91247982 -5.2293755 </row> + <row>-4.19476782 -3.78737908 -4.4353881 -4.91247982 </row> + <row>-3.78737908 -3.24757282 -3.80322264 -4.4353881 </row> + <row>-3.24757282 -2.58404157 -3.02616321 -3.80322264 </row> + <row>-2.58404157 -1.80970823 -2.1193438 -3.02616321 </row> + <row>-1.80970823 -0.941501834 -1.10258993 -2.1193438 </row> + <row>-0.941501834 -1.47539437e-15 -1.72782985e-15 -1.10258993 </row> + <row>0 0.0290155245 0.0329109393 0 </row> + <row>0.0290155245 0.114559124 0.129939005 0.0329109393 </row> + <row>0.114559124 0.252180267 0.286036169 0.129939005 </row> + <row>0.252180267 0.434654016 0.493007526 0.286036169 </row> + <row>0.434654016 0.652262956 0.739831072 0.493007526 </row> + <row>0.652262956 0.893178149 1.0130898 0.739831072 </row> + <row>0.893178149 1.14392589 1.29750112 1.0130898 </row> + <row>1.14392589 1.38992403 1.5765252 1.29750112 </row> + <row>1.38992403 1.61606912 1.83303089 1.5765252 </row> + <row>1.61606912 1.80735374 2.049996 1.83303089 </row> + <row>1.80735374 1.94949217 2.21121691 2.049996 </row> + <row>1.94949217 2.02953208 2.3020024 2.21121691 </row> + <row>2.02953208 2.03643007 2.30982647 2.3020024 </row> + <row>2.03643007 1.96157008 2.22491632 2.30982647 </row> + <row>1.96157008 1.79920498 2.04075325 2.22491632 </row> + <row>1.79920498 1.54680456 1.75446737 2.04075325 </row> + <row>1.54680456 1.20529544 1.3671097 1.75446737 </row> + <row>1.20529544 0.779182427 0.883789835 1.3671097 </row> + <row>0.779182427 0.27654423 0.313671062 0.883789835 </row> + <row>0.27654423 -0.291099189 -0.330180065 0.313671062 </row> + <row>-0.291099189 -0.909046165 -1.03108814 -0.330180065 </row> + <row>-0.909046165 -1.55979409 -1.76920079 -1.03108814 </row> + <row>-1.55979409 -2.22353155 -2.52204684 -1.76920079 </row> + <row>-2.22353155 -2.87872797 -3.26520521 -2.52204684 </row> + <row>-2.87872797 -3.50280371 -3.97306485 -3.26520521 </row> + <row>-3.50280371 -4.07286015 -4.61965295 -3.97306485 </row> + <row>-4.07286015 -4.56644717 -5.1795054 -4.61965295 </row> + <row>-4.56644717 -4.9623437 -5.62855214 -5.1795054 </row> + <row>-4.9623437 -5.24132584 -5.94498841 -5.62855214 </row> + <row>-5.24132584 -5.38689707 -6.11010298 -5.94498841 </row> + <row>-5.38689707 -5.38595562 -6.10903514 -6.11010298 </row> + <row>-5.38595562 -5.2293755 -5.9314337 -6.10903514 </row> + <row>-5.2293755 -4.91247982 -5.5719939 -5.9314337 </row> + <row>-4.91247982 -4.4353881 -5.03085129 -5.5719939 </row> + <row>-4.4353881 -3.80322264 -4.31381586 -5.03085129 </row> + <row>-3.80322264 -3.02616321 -3.43243403 -4.31381586 </row> + <row>-3.02616321 -2.1193438 -2.40387159 -3.43243403 </row> + <row>-2.1193438 -1.10258993 -1.25061569 -2.40387159 </row> + <row>-1.10258993 -1.72782985e-15 -1.95979581e-15 -1.25061569 </row> + <row>0 0.0329109393 0.0360404799 0 </row> + <row>0.0329109393 0.129939005 0.142295061 0.0360404799 </row> + <row>0.129939005 0.286036169 0.313235691 0.142295061 </row> + <row>0.286036169 0.493007526 0.539888203 0.313235691 </row> + <row>0.493007526 0.739831072 0.810182494 0.539888203 </row> + <row>0.739831072 1.0130898 1.10942572 0.810182494 </row> + <row>1.0130898 1.29750112 1.42088206 1.10942572 </row> + <row>1.29750112 1.5765252 1.72643887 1.42088206 </row> + <row>1.5765252 1.83303089 2.007336 1.72643887 </row> + <row>1.83303089 2.049996 2.24493258 2.007336 </row> + <row>2.049996 2.21121691 2.42148418 2.24493258 </row> + <row>2.21121691 2.3020024 2.52090257 2.42148418 </row> + <row>2.3020024 2.30982647 2.52947064 2.52090257 </row> + <row>2.30982647 2.22491632 2.43648628 2.52947064 </row> + <row>2.22491632 2.04075325 2.23481092 2.43648628 </row> + <row>2.04075325 1.75446737 1.92130177 2.23481092 </row> + <row>1.75446737 1.3671097 1.4971098 1.92130177 </row> + <row>1.3671097 0.883789835 0.967830469 1.4971098 </row> + <row>0.883789835 0.313671062 0.343498419 0.967830469 </row> + <row>0.313671062 -0.330180065 -0.361577283 0.343498419 </row> + <row>-0.330180065 -1.03108814 -1.12913555 -0.361577283 </row> + <row>-1.03108814 -1.76920079 -1.93743621 -1.12913555 </row> + <row>-1.76920079 -2.52204684 -2.7618713 -1.93743621 </row> + <row>-2.52204684 -3.26520521 -3.57569748 -2.7618713 </row> + <row>-3.26520521 -3.97306485 -4.35086835 -3.57569748 </row> + <row>-3.97306485 -4.61965295 -5.05894128 -4.35086835 </row> + <row>-4.61965295 -5.1795054 -5.67203077 -5.05894128 </row> + <row>-5.1795054 -5.62855214 -6.16377791 -5.67203077 </row> + <row>-5.62855214 -5.94498841 -6.51030448 -6.16377791 </row> + <row>-5.94498841 -6.11010298 -6.69111999 -6.51030448 </row> + <row>-6.11010298 -6.10903514 -6.68995061 -6.69111999 </row> + <row>-6.10903514 -5.9314337 -6.49546084 -6.68995061 </row> + <row>-5.9314337 -5.5719939 -6.10184147 -6.49546084 </row> + <row>-5.5719939 -5.03085129 -5.50924096 -6.10184147 </row> + <row>-5.03085129 -4.31381586 -4.72402177 -5.50924096 </row> + <row>-4.31381586 -3.43243403 -3.7588283 -4.72402177 </row> + <row>-3.43243403 -2.40387159 -2.63245862 -3.7588283 </row> + <row>-2.40387159 -1.25061569 -1.36953824 -2.63245862 </row> + <row>-1.25061569 -1.95979581e-15 -2.14615514e-15 -1.36953824 </row> + <row>0 0.0360404799 0.0380650121 0 </row> + <row>0.0360404799 0.142295061 0.150288321 0.0380650121 </row> + <row>0.142295061 0.313235691 0.330831343 0.150288321 </row> + <row>0.313235691 0.539888203 0.570215796 0.330831343 </row> + <row>0.539888203 0.810182494 0.855693556 0.570215796 </row> + <row>0.810182494 1.10942572 1.17174642 0.855693556 </row> + <row>1.10942572 1.42088206 1.50069846 1.17174642 </row> + <row>1.42088206 1.72643887 1.82341957 1.50069846 </row> + <row>1.72643887 2.007336 2.12009577 1.82341957 </row> + <row>2.007336 2.24493258 2.37103906 2.12009577 </row> + <row>2.24493258 2.42148418 2.55750824 2.37103906 </row> + <row>2.42148418 2.52090257 2.66251134 2.55750824 </row> + <row>2.52090257 2.52947064 2.67156072 2.66251134 </row> + <row>2.52947064 2.43648628 2.57335307 2.67156072 </row> + <row>2.43648628 2.23481092 2.36034884 2.57335307 </row> + <row>2.23481092 1.92130177 2.02922867 2.36034884 </row> + <row>1.92130177 1.4971098 1.58120821 2.02922867 </row> + <row>1.4971098 0.967830469 1.02219722 1.58120821 </row> + <row>0.967830469 0.343498419 0.362794044 1.02219722 </row> + <row>0.343498419 -0.361577283 -0.381888467 0.362794044 </row> + <row>-0.361577283 -1.12913555 -1.19256343 -0.381888467 </row> + <row>-1.12913555 -1.93743621 -2.04626944 -1.19256343 </row> + <row>-1.93743621 -2.7618713 -2.91701621 -2.04626944 </row> + <row>-2.7618713 -3.57569748 -3.77655814 -2.91701621 </row> + <row>-3.57569748 -4.35086835 -4.59527333 -3.77655814 </row> + <row>-4.35086835 -5.05894128 -5.34312144 -4.59527333 </row> + <row>-5.05894128 -5.67203077 -5.99065052 -5.34312144 </row> + <row>-5.67203077 -6.16377791 -6.51002098 -5.99065052 </row> + <row>-6.16377791 -6.51030448 -6.87601328 -6.51002098 </row> + <row>-6.51030448 -6.69111999 -7.06698589 -6.87601328 </row> + <row>-6.69111999 -6.68995061 -7.06575082 -7.06698589 </row> + <row>-6.68995061 -6.49546084 -6.86033581 -7.06575082 </row> + <row>-6.49546084 -6.10184147 -6.44460534 -6.86033581 </row> + <row>-6.10184147 -5.50924096 -5.81871618 -6.44460534 </row> + <row>-5.50924096 -4.72402177 -4.98938821 -5.81871618 </row> + <row>-4.72402177 -3.7588283 -3.96997612 -4.98938821 </row> + <row>-3.7588283 -2.63245862 -2.78033393 -3.96997612 </row> + <row>-2.63245862 -1.36953824 -1.44647046 -2.78033393 </row> + <row>-1.36953824 -2.14615514e-15 -2.26671292e-15 -1.44647046 </row> + <row>0 0.0380650121 0.0387651463 0 </row> + <row>0.0380650121 0.150288321 0.153052591 0.0387651463 </row> + <row>0.150288321 0.330831343 0.336916362 0.153052591 </row> + <row>0.330831343 0.570215796 0.580703841 0.336916362 </row> + <row>0.570215796 0.855693556 0.871432427 0.580703841 </row> + <row>0.855693556 1.17174642 1.19329849 0.871432427 </row> + <row>1.17174642 1.50069846 1.52830098 1.19329849 </row> + <row>1.50069846 1.82341957 1.85695793 1.52830098 </row> + <row>1.82341957 2.12009577 2.15909093 1.85695793 </row> + <row>2.12009577 2.37103906 2.41464986 2.15909093 </row> + <row>2.37103906 2.55750824 2.60454879 2.41464986 </row> + <row>2.55750824 2.66251134 2.71148322 2.60454879 </row> + <row>2.66251134 2.67156072 2.72069905 2.71148322 </row> + <row>2.67156072 2.57335307 2.62068505 2.72069905 </row> + <row>2.57335307 2.36034884 2.40376301 2.62068505 </row> + <row>2.36034884 2.02922867 2.06655251 2.40376301 </row> + <row>2.02922867 1.58120821 1.61029155 2.06655251 </row> + <row>1.58120821 1.02219722 1.04099861 1.61029155 </row> + <row>1.02219722 0.362794044 0.369466957 1.04099861 </row> + <row>0.362794044 -0.381888467 -0.388912586 0.369466957 </row> + <row>-0.381888467 -1.19256343 -1.21449838 -0.388912586 </row> + <row>-1.19256343 -2.04626944 -2.08390671 -1.21449838 </row> + <row>-2.04626944 -2.91701621 -2.97066923 -2.08390671 </row> + <row>-2.91701621 -3.77655814 -3.84602081 -2.97066923 </row> + <row>-3.77655814 -4.59527333 -4.67979473 -3.84602081 </row> + <row>-4.59527333 -5.34312144 -5.44139809 -4.67979473 </row> + <row>-5.34312144 -5.99065052 -6.10083725 -5.44139809 </row> + <row>-5.99065052 -6.51002098 -6.62976055 -6.10083725 </row> + <row>-6.51002098 -6.87601328 -7.00248459 -6.62976055 </row> + <row>-6.87601328 -7.06698589 -7.19696978 -7.00248459 </row> + <row>-7.06698589 -7.06575082 -7.195712 -7.19696978 </row> + <row>-7.06575082 -6.86033581 -6.98651876 -7.195712 </row> + <row>-6.86033581 -6.44460534 -6.56314171 -6.98651876 </row> + <row>-6.44460534 -5.81871618 -5.9257405 -6.56314171 </row> + <row>-5.81871618 -4.98938821 -5.08115861 -5.9257405 </row> + <row>-4.98938821 -3.96997612 -4.04299635 -5.08115861 </row> + <row>-3.96997612 -2.78033393 -2.83147294 -4.04299635 </row> + <row>-2.78033393 -1.44647046 -1.47307556 -2.83147294 </row> + <row>-1.44647046 -2.26671292e-15 -2.30840483e-15 -1.47307556 </row> + </matrix> + <matrix-formula title='' formula='x*y*z' transposition='0' data-channel='3'/> + </figure> + <label> + <text>SHELL</text> + <angle deg='0'/> + <align text='9' frame='9'/> + <pos x='0.399593' y='-0.148556' z='0'/> + <coord-system x='1' y='1' z='1'/> + <shadow-shift x='5' y='5'/> + <font element-number='1' family='helvetica' size='24' bold='1' italic='0' color='ff000000'/> + <fill element-number='1' style='transparent' color='ffffffff'/> + <line element-number='1' style='invisible' width='0' color='ff000000'/> + <fill element-number='2' style='transparent' color='ff000000'/> + <axes-bindings x-axis='0' y-axis='1' z-axis='2'/> + </label> + </axes3d> + <label> + <text><p>1. Select the graph using the select tool.</p> <p>2. Use the arrows on the side panel to explore the </p> <p><wsp> </wsp>the invisible part of the shell.</p> <p>3. You can use zoom tool - Select the graph object, </p> <p><wsp> </wsp>choose the zoom tool and double click on it to set</p> <p><wsp> </wsp>the autorange mode.</p> <p>4. You can also set axis ranges manually - setting</p> <p><wsp> </wsp>0 as max and min turns on the autorange mode </p> <p><wsp> </wsp>on this axis.<wsp> </wsp>You will find the axis settings on</p> <p><wsp> </wsp>the side panel.</p> </text> + <angle deg='0'/> + <align text='9' frame='9'/> + <pos x='39.9037' y='160.218' z='0'/> + <coord-system x='1' y='1' z='1'/> + <shadow-shift x='5' y='5'/> + <font element-number='1' family='helvetica' size='16' bold='0' italic='0' color='ff000000'/> + <fill element-number='1' style='transparent' color='ffffffff'/> + <line element-number='1' style='invisible' width='0' color='ff000000'/> + <fill element-number='2' style='transparent' color='ff000000'/> + <axes-bindings x-axis='-1' y-axis='-1' z-axis='-1'/> + </label> + </page> + </canvas> +</kmatplot> diff --git a/kmatplot/examples/simple.kmp b/kmatplot/examples/simple.kmp new file mode 100644 index 0000000..fa50c03 --- /dev/null +++ b/kmatplot/examples/simple.kmp @@ -0,0 +1,720 @@ +<?xml version='1.0' encoding='UTF-8'?> +<!DOCTYPE kmatplot> +<kmatplot mime='application/x-kmatplot' editor='KMatplot' version='0.3' url='http://kmatplot.sourceforge.net' program-author='K. Dobkowski'> + <canvas page-size='A4' orientation='Portrait' dpi='72'> + <sheets number='1'> + <sheet number='0' name='unnamed'> + <column number='0' title='Common X' type='x'/> + <column number='1' title='One' type='y'/> + <column number='2' title='Two' type='y'/> + <matrix-string title='sheet1' rows='100' cols='3' data-channel='0'> + <e row='0' col='0' string='0'/> + <e row='0' col='1' string='0'/> + <e row='0' col='2' string='1'/> + <e row='1' col='0' string='0.1'/> + <e row='1' col='1' string='0.0998334166'/> + <e row='1' col='2' string='0.995004165'/> + <e row='2' col='0' string='0.2'/> + <e row='2' col='1' string='0.198669331'/> + <e row='2' col='2' string='0.980066578'/> + <e row='3' col='0' string='0.3'/> + <e row='3' col='1' string='0.295520207'/> + <e row='3' col='2' string='0.955336489'/> + <e row='4' col='0' string='0.4'/> + <e row='4' col='1' string='0.389418342'/> + <e row='4' col='2' string='0.921060994'/> + <e row='5' col='0' string='0.5'/> + <e row='5' col='1' string='0.479425539'/> + <e row='5' col='2' string='0.877582562'/> + <e row='6' col='0' string='0.6'/> + <e row='6' col='1' string='0.564642473'/> + <e row='6' col='2' string='0.825335615'/> + <e row='7' col='0' string='0.7'/> + <e row='7' col='1' string='0.644217687'/> + <e row='7' col='2' string='0.764842187'/> + <e row='8' col='0' string='0.8'/> + <e row='8' col='1' string='0.717356091'/> + <e row='8' col='2' string='0.696706709'/> + <e row='9' col='0' string='0.9'/> + <e row='9' col='1' string='0.78332691'/> + <e row='9' col='2' string='0.621609968'/> + <e row='10' col='0' string='1'/> + <e row='10' col='1' string='0.841470985'/> + <e row='10' col='2' string='0.540302306'/> + <e row='11' col='0' string='1.1'/> + <e row='11' col='1' string='0.89120736'/> + <e row='11' col='2' string='0.453596121'/> + <e row='12' col='0' string='1.2'/> + <e row='12' col='1' string='0.932039086'/> + <e row='12' col='2' string='0.362357754'/> + <e row='13' col='0' string='1.3'/> + <e row='13' col='1' string='0.963558185'/> + <e row='13' col='2' string='0.267498829'/> + <e row='14' col='0' string='1.4'/> + <e row='14' col='1' string='0.98544973'/> + <e row='14' col='2' string='0.169967143'/> + <e row='15' col='0' string='1.5'/> + <e row='15' col='1' string='0.997494987'/> + <e row='15' col='2' string='0.0707372017'/> + <e row='16' col='0' string='1.6'/> + <e row='16' col='1' string='0.999573603'/> + <e row='16' col='2' string='-0.0291995223'/> + <e row='17' col='0' string='1.7'/> + <e row='17' col='1' string='0.99166481'/> + <e row='17' col='2' string='-0.128844494'/> + <e row='18' col='0' string='1.8'/> + <e row='18' col='1' string='0.973847631'/> + <e row='18' col='2' string='-0.227202095'/> + <e row='19' col='0' string='1.9'/> + <e row='19' col='1' string='0.946300088'/> + <e row='19' col='2' string='-0.323289567'/> + <e row='20' col='0' string='2'/> + <e row='20' col='1' string='0.909297427'/> + <e row='20' col='2' string='-0.416146837'/> + <e row='21' col='0' string='2.1'/> + <e row='21' col='1' string='0.863209367'/> + <e row='21' col='2' string='-0.504846105'/> + <e row='22' col='0' string='2.2'/> + <e row='22' col='1' string='0.808496404'/> + <e row='22' col='2' string='-0.588501117'/> + <e row='23' col='0' string='2.3'/> + <e row='23' col='1' string='0.745705212'/> + <e row='23' col='2' string='-0.666276021'/> + <e row='24' col='0' string='2.4'/> + <e row='24' col='1' string='0.675463181'/> + <e row='24' col='2' string='-0.737393716'/> + <e row='25' col='0' string='2.5'/> + <e row='25' col='1' string='0.598472144'/> + <e row='25' col='2' string='-0.801143616'/> + <e row='26' col='0' string='2.6'/> + <e row='26' col='1' string='0.515501372'/> + <e row='26' col='2' string='-0.856888753'/> + <e row='27' col='0' string='2.7'/> + <e row='27' col='1' string='0.42737988'/> + <e row='27' col='2' string='-0.904072142'/> + <e row='28' col='0' string='2.8'/> + <e row='28' col='1' string='0.33498815'/> + <e row='28' col='2' string='-0.942222341'/> + <e row='29' col='0' string='2.9'/> + <e row='29' col='1' string='0.239249329'/> + <e row='29' col='2' string='-0.970958165'/> + <e row='30' col='0' string='3'/> + <e row='30' col='1' string='0.141120008'/> + <e row='30' col='2' string='-0.989992497'/> + <e row='31' col='0' string='3.1'/> + <e row='31' col='1' string='0.0415806624'/> + <e row='31' col='2' string='-0.99913515'/> + <e row='32' col='0' string='3.2'/> + <e row='32' col='1' string='-0.0583741434'/> + <e row='32' col='2' string='-0.998294776'/> + <e row='33' col='0' string='3.3'/> + <e row='33' col='1' string='-0.157745694'/> + <e row='33' col='2' string='-0.98747977'/> + <e row='34' col='0' string='3.4'/> + <e row='34' col='1' string='-0.255541102'/> + <e row='34' col='2' string='-0.966798193'/> + <e row='35' col='0' string='3.5'/> + <e row='35' col='1' string='-0.350783228'/> + <e row='35' col='2' string='-0.936456687'/> + <e row='36' col='0' string='3.6'/> + <e row='36' col='1' string='-0.442520443'/> + <e row='36' col='2' string='-0.896758416'/> + <e row='37' col='0' string='3.7'/> + <e row='37' col='1' string='-0.529836141'/> + <e row='37' col='2' string='-0.848100032'/> + <e row='38' col='0' string='3.8'/> + <e row='38' col='1' string='-0.611857891'/> + <e row='38' col='2' string='-0.790967712'/> + <e row='39' col='0' string='3.9'/> + <e row='39' col='1' string='-0.687766159'/> + <e row='39' col='2' string='-0.725932304'/> + <e row='40' col='0' string='4'/> + <e row='40' col='1' string='-0.756802495'/> + <e row='40' col='2' string='-0.653643621'/> + <e row='41' col='0' string='4.1'/> + <e row='41' col='1' string='-0.818277111'/> + <e row='41' col='2' string='-0.574823947'/> + <e row='42' col='0' string='4.2'/> + <e row='42' col='1' string='-0.871575772'/> + <e row='42' col='2' string='-0.490260821'/> + <e row='43' col='0' string='4.3'/> + <e row='43' col='1' string='-0.916165937'/> + <e row='43' col='2' string='-0.400799172'/> + <e row='44' col='0' string='4.4'/> + <e row='44' col='1' string='-0.951602074'/> + <e row='44' col='2' string='-0.30733287'/> + <e row='45' col='0' string='4.5'/> + <e row='45' col='1' string='-0.977530118'/> + <e row='45' col='2' string='-0.210795799'/> + <e row='46' col='0' string='4.6'/> + <e row='46' col='1' string='-0.993691004'/> + <e row='46' col='2' string='-0.112152527'/> + <e row='47' col='0' string='4.7'/> + <e row='47' col='1' string='-0.999923258'/> + <e row='47' col='2' string='-0.0123886635'/> + <e row='48' col='0' string='4.8'/> + <e row='48' col='1' string='-0.996164609'/> + <e row='48' col='2' string='0.0874989834'/> + <e row='49' col='0' string='4.9'/> + <e row='49' col='1' string='-0.982452613'/> + <e row='49' col='2' string='0.186512369'/> + <e row='50' col='0' string='5'/> + <e row='50' col='1' string='-0.958924275'/> + <e row='50' col='2' string='0.283662185'/> + <e row='51' col='0' string='5.1'/> + <e row='51' col='1' string='-0.925814682'/> + <e row='51' col='2' string='0.377977743'/> + <e row='52' col='0' string='5.2'/> + <e row='52' col='1' string='-0.883454656'/> + <e row='52' col='2' string='0.468516671'/> + <e row='53' col='0' string='5.3'/> + <e row='53' col='1' string='-0.832267442'/> + <e row='53' col='2' string='0.554374336'/> + <e row='54' col='0' string='5.4'/> + <e row='54' col='1' string='-0.772764488'/> + <e row='54' col='2' string='0.634692876'/> + <e row='55' col='0' string='5.5'/> + <e row='55' col='1' string='-0.705540326'/> + <e row='55' col='2' string='0.708669774'/> + <e row='56' col='0' string='5.6'/> + <e row='56' col='1' string='-0.631266638'/> + <e row='56' col='2' string='0.775565879'/> + <e row='57' col='0' string='5.7'/> + <e row='57' col='1' string='-0.550685543'/> + <e row='57' col='2' string='0.834712785'/> + <e row='58' col='0' string='5.8'/> + <e row='58' col='1' string='-0.464602179'/> + <e row='58' col='2' string='0.885519517'/> + <e row='59' col='0' string='5.9'/> + <e row='59' col='1' string='-0.373876665'/> + <e row='59' col='2' string='0.927478431'/> + <e row='60' col='0' string='6'/> + <e row='60' col='1' string='-0.279415498'/> + <e row='60' col='2' string='0.960170287'/> + <e row='61' col='0' string='6.1'/> + <e row='61' col='1' string='-0.182162504'/> + <e row='61' col='2' string='0.983268438'/> + <e row='62' col='0' string='6.2'/> + <e row='62' col='1' string='-0.0830894028'/> + <e row='62' col='2' string='0.996542097'/> + <e row='63' col='0' string='6.3'/> + <e row='63' col='1' string='0.0168139005'/> + <e row='63' col='2' string='0.999858636'/> + <e row='64' col='0' string='6.4'/> + <e row='64' col='1' string='0.116549205'/> + <e row='64' col='2' string='0.993184919'/> + <e row='65' col='0' string='6.5'/> + <e row='65' col='1' string='0.215119988'/> + <e row='65' col='2' string='0.976587626'/> + <e row='66' col='0' string='6.6'/> + <e row='66' col='1' string='0.311541364'/> + <e row='66' col='2' string='0.950232592'/> + <e row='67' col='0' string='6.7'/> + <e row='67' col='1' string='0.404849921'/> + <e row='67' col='2' string='0.914383148'/> + <e row='68' col='0' string='6.8'/> + <e row='68' col='1' string='0.494113351'/> + <e row='68' col='2' string='0.86939749'/> + <e row='69' col='0' string='6.9'/> + <e row='69' col='1' string='0.578439764'/> + <e row='69' col='2' string='0.8157251'/> + <e row='70' col='0' string='7'/> + <e row='70' col='1' string='0.656986599'/> + <e row='70' col='2' string='0.753902254'/> + <e row='71' col='0' string='7.1'/> + <e row='71' col='1' string='0.72896904'/> + <e row='71' col='2' string='0.684546666'/> + <e row='72' col='0' string='7.2'/> + <e row='72' col='1' string='0.793667864'/> + <e row='72' col='2' string='0.608351315'/> + <e row='73' col='0' string='7.3'/> + <e row='73' col='1' string='0.850436621'/> + <e row='73' col='2' string='0.526077517'/> + <e row='74' col='0' string='7.4'/> + <e row='74' col='1' string='0.898708096'/> + <e row='74' col='2' string='0.438547328'/> + <e row='75' col='0' string='7.5'/> + <e row='75' col='1' string='0.937999977'/> + <e row='75' col='2' string='0.346635318'/> + <e row='76' col='0' string='7.6'/> + <e row='76' col='1' string='0.967919672'/> + <e row='76' col='2' string='0.251259843'/> + <e row='77' col='0' string='7.7'/> + <e row='77' col='1' string='0.988168234'/> + <e row='77' col='2' string='0.153373862'/> + <e row='78' col='0' string='7.8'/> + <e row='78' col='1' string='0.998543345'/> + <e row='78' col='2' string='0.0539554206'/> + <e row='79' col='0' string='7.9'/> + <e row='79' col='1' string='0.998941342'/> + <e row='79' col='2' string='-0.0460021256'/> + <e row='80' col='0' string='8'/> + <e row='80' col='1' string='0.989358247'/> + <e row='80' col='2' string='-0.145500034'/> + <e row='81' col='0' string='8.1'/> + <e row='81' col='1' string='0.969889811'/> + <e row='81' col='2' string='-0.243544154'/> + <e row='82' col='0' string='8.2'/> + <e row='82' col='1' string='0.940730557'/> + <e row='82' col='2' string='-0.339154861'/> + <e row='83' col='0' string='8.3'/> + <e row='83' col='1' string='0.902171834'/> + <e row='83' col='2' string='-0.431376845'/> + <e row='84' col='0' string='8.4'/> + <e row='84' col='1' string='0.854598908'/> + <e row='84' col='2' string='-0.519288654'/> + <e row='85' col='0' string='8.5'/> + <e row='85' col='1' string='0.798487113'/> + <e row='85' col='2' string='-0.602011903'/> + <e row='86' col='0' string='8.6'/> + <e row='86' col='1' string='0.734397098'/> + <e row='86' col='2' string='-0.678720047'/> + <e row='87' col='0' string='8.7'/> + <e row='87' col='1' string='0.66296923'/> + <e row='87' col='2' string='-0.748646646'/> + <e row='88' col='0' string='8.8'/> + <e row='88' col='1' string='0.584917193'/> + <e row='88' col='2' string='-0.811093014'/> + <e row='89' col='0' string='8.9'/> + <e row='89' col='1' string='0.501020856'/> + <e row='89' col='2' string='-0.865435209'/> + <e row='90' col='0' string='9'/> + <e row='90' col='1' string='0.412118485'/> + <e row='90' col='2' string='-0.911130262'/> + <e row='91' col='0' string='9.1'/> + <e row='91' col='1' string='0.319098362'/> + <e row='91' col='2' string='-0.947721602'/> + <e row='92' col='0' string='9.2'/> + <e row='92' col='1' string='0.222889914'/> + <e row='92' col='2' string='-0.974843621'/> + <e row='93' col='0' string='9.3'/> + <e row='93' col='1' string='0.124454424'/> + <e row='93' col='2' string='-0.992225325'/> + <e row='94' col='0' string='9.4'/> + <e row='94' col='1' string='0.0247754255'/> + <e row='94' col='2' string='-0.999693042'/> + <e row='95' col='0' string='9.5'/> + <e row='95' col='1' string='-0.0751511205'/> + <e row='95' col='2' string='-0.997172156'/> + <e row='96' col='0' string='9.6'/> + <e row='96' col='1' string='-0.174326781'/> + <e row='96' col='2' string='-0.984687856'/> + <e row='97' col='0' string='9.7'/> + <e row='97' col='1' string='-0.271760626'/> + <e row='97' col='2' string='-0.96236488'/> + <e row='98' col='0' string='9.8'/> + <e row='98' col='1' string='-0.366479129'/> + <e row='98' col='2' string='-0.930426272'/> + <e row='99' col='0' string='9.9'/> + <e row='99' col='1' string='-0.457535894'/> + <e row='99' col='2' string='-0.889191153'/> + </matrix-string> + </sheet> + </sheets> + <page number='0' title='Page 1'> + <axes2d> + <area xmm='60' ymm='20' wmm='85' hmm='65'/> + <draw-in-background enabled='1'/> + <title-attributes> + </title-attributes> + <background-attributes> + <fill element-number='-1' style='transparent' color='ff000000'/> + </background-attributes> + <frame width='1'/> + <axis type='X' visible='1' scrollable='1'> + <dart element-number='1' style='none' size='3' /> + <dart element-number='2' style='none' size='3' /> + <display position='0' default='1' opposite='0' /> + <range min='1' max='10' rounded='0'/> + <scale type='linear' base='10' reversed='0'/> + <grid-step major='-4' minor='-20'/> + <tics format='(TIC)' visible='1' outer='0' angle='0' pos1='0.01' pos2='0.01'/> + <title-position pos='0.5' distance='0.05'/> + <remembered-view number='0' min='0' max='0' scale='linear' base='10' reversed='0' rounded='0'/> + <remembered-view number='1' min='0' max='0' scale='linear' base='10' reversed='0' rounded='0'/> + <remembered-view number='2' min='0' max='0' scale='linear' base='10' reversed='0' rounded='0'/> + <title text='X'/> + <line element-number='0' style='solid' width='0' color='ff000000'/> + <line element-number='1' style='invisible' width='0' color='ff000000'/> + <line element-number='2' style='invisible' width='0' color='ff000000'/> + <font element-number='0' family='helvetica' size='10' bold='0' italic='0' color='ff000000'/> + <font element-number='1' family='helvetica' size='10' bold='0' italic='0' color='ff000000'/> + <matrix-string title='' rows='1' cols='4' data-channel='0'> + <e row='0' col='0' string='5'/> + <e row='0' col='1' string='Custom tic'/> + <e row='0' col='2' string='1'/> + <e row='0' col='3' string='-45'/> + </matrix-string> + <matrix-string title='' rows='1' cols='6' data-channel='1'> + <e row='0' col='0' string='2'/> + <e row='0' col='1' string='2'/> + <e row='0' col='2' string='128'/> + <e row='0' col='3' string='64'/> + <e row='0' col='4' string='128'/> + </matrix-string> + <matrix-string title='' rows='1' cols='8' data-channel='2'> + <e row='0' col='0' string='helvetica'/> + <e row='0' col='1' string='20'/> + <e row='0' col='2' string='1'/> + <e row='0' col='3' string='0'/> + <e row='0' col='4' string='128'/> + <e row='0' col='5' string='64'/> + <e row='0' col='6' string='128'/> + </matrix-string> + </axis> + <axis type='Y' visible='1' scrollable='1'> + <dart element-number='1' style='fdiag' size='5' /> + <dart element-number='2' style='fdiag' size='3' /> + <display position='-0.1' default='0' opposite='0' /> + <range min='-0.999693' max='1' rounded='0'/> + <scale type='linear' base='10' reversed='0'/> + <grid-step major='-4' minor='-20'/> + <tics format='(TIC)' visible='1' outer='0' angle='0' pos1='0.01' pos2='0.01'/> + <title-position pos='0.5' distance='0.05'/> + <remembered-view number='0' min='0' max='0' scale='linear' base='10' reversed='0' rounded='0'/> + <remembered-view number='1' min='0' max='0' scale='linear' base='10' reversed='0' rounded='0'/> + <remembered-view number='2' min='0' max='0' scale='linear' base='10' reversed='0' rounded='0'/> + <title text='Y'/> + <line element-number='0' style='solid' width='0' color='ff000000'/> + <line element-number='1' style='invisible' width='0' color='ff000000'/> + <line element-number='2' style='invisible' width='0' color='ff000000'/> + <font element-number='0' family='helvetica' size='10' bold='0' italic='0' color='ff000000'/> + <font element-number='1' family='helvetica' size='10' bold='0' italic='0' color='ff000000'/> + </axis> + <axis type='Z' visible='1' scrollable='1'> + <dart element-number='1' style='none' size='3' /> + <dart element-number='2' style='none' size='3' /> + <display position='0' default='1' opposite='0' /> + <range min='0' max='0' rounded='0'/> + <scale type='linear' base='10' reversed='0'/> + <grid-step major='-4' minor='-20'/> + <tics format='(TIC)' visible='1' outer='0' angle='0' pos1='0.01' pos2='0.01'/> + <title-position pos='0.5' distance='0.05'/> + <remembered-view number='0' min='0' max='0' scale='linear' base='10' reversed='0' rounded='0'/> + <remembered-view number='1' min='0' max='0' scale='linear' base='10' reversed='0' rounded='0'/> + <remembered-view number='2' min='0' max='0' scale='linear' base='10' reversed='0' rounded='0'/> + <title text='Z'/> + <line element-number='0' style='solid' width='0' color='ff000000'/> + <line element-number='1' style='invisible' width='0' color='ff000000'/> + <line element-number='2' style='invisible' width='0' color='ff000000'/> + <font element-number='0' family='helvetica' size='10' bold='0' italic='0' color='ff000000'/> + <font element-number='1' family='helvetica' size='10' bold='0' italic='0' color='ff000000'/> + </axis> + <axis type='V' visible='1' scrollable='1'> + <dart element-number='1' style='none' size='3' /> + <dart element-number='2' style='none' size='3' /> + <display position='0' default='1' opposite='0' /> + <range min='0' max='0' rounded='0'/> + <scale type='linear' base='10' reversed='0'/> + <grid-step major='-4' minor='0'/> + <tics format='(TIC)' visible='1' outer='0' angle='0' pos1='0.01' pos2='0.01'/> + <title-position pos='0.5' distance='0.05'/> + <remembered-view number='0' min='0' max='0' scale='linear' base='10' reversed='0' rounded='0'/> + <remembered-view number='1' min='0' max='0' scale='linear' base='10' reversed='0' rounded='0'/> + <remembered-view number='2' min='0' max='0' scale='linear' base='10' reversed='0' rounded='0'/> + <title text='V'/> + <line element-number='0' style='solid' width='0' color='ff000000'/> + <line element-number='1' style='invisible' width='0' color='ff000000'/> + <line element-number='2' style='invisible' width='0' color='ff000000'/> + <font element-number='0' family='helvetica' size='10' bold='0' italic='0' color='ff000000'/> + <font element-number='1' family='helvetica' size='10' bold='0' italic='0' color='ff000000'/> + </axis> + <axis type='Y' visible='1' scrollable='0'> + <dart element-number='1' style='line' size='5' /> + <dart element-number='2' style='filled' size='5' /> + <display position='-0.1' default='0' opposite='1' /> + <range min='0' max='0' rounded='0'/> + <scale type='linear' base='10' reversed='0'/> + <grid-step major='-4' minor='-20'/> + <tics format='(TIC)' visible='1' outer='0' angle='0' pos1='0.01' pos2='0.01'/> + <title-position pos='0.5' distance='0.05'/> + <remembered-view number='0' min='0' max='0' scale='linear' base='10' reversed='0' rounded='0'/> + <remembered-view number='1' min='0' max='0' scale='linear' base='10' reversed='0' rounded='0'/> + <remembered-view number='2' min='0' max='0' scale='linear' base='10' reversed='0' rounded='0'/> + <title text='Y ( not scrollable )'/> + <line element-number='0' style='solid' width='0' color='ffff0000'/> + <line element-number='1' style='invisible' width='0' color='ff000000'/> + <line element-number='2' style='invisible' width='0' color='ff000000'/> + <font element-number='0' family='helvetica' size='16' bold='1' italic='0' color='ffff0000'/> + <font element-number='1' family='helvetica' size='10' bold='0' italic='0' color='ffff0000'/> + </axis> + <axis type='Y' visible='1' scrollable='1'> + <dart element-number='1' style='none' size='3' /> + <dart element-number='2' style='filled' size='5' /> + <display position='-0.3' default='0' opposite='1' /> + <range min='1' max='10' rounded='0'/> + <scale type='linear' base='10' reversed='1'/> + <grid-step major='-4' minor='-20'/> + <tics format='(TIC)' visible='1' outer='0' angle='0' pos1='0.01' pos2='0.01'/> + <title-position pos='0.5' distance='0.05'/> + <remembered-view number='0' min='0' max='0' scale='linear' base='10' reversed='0' rounded='0'/> + <remembered-view number='1' min='0' max='0' scale='linear' base='10' reversed='0' rounded='0'/> + <remembered-view number='2' min='0' max='0' scale='linear' base='10' reversed='0' rounded='0'/> + <title text='You can add as many axes as you wish'/> + <line element-number='0' style='solid' width='0' color='ff808080'/> + <line element-number='1' style='invisible' width='0' color='ff000000'/> + <line element-number='2' style='invisible' width='0' color='ff000000'/> + <font element-number='0' family='helvetica' size='10' bold='0' italic='0' color='ff808080'/> + <font element-number='1' family='helvetica' size='10' bold='0' italic='0' color='ff808080'/> + </axis> + <title text=''/> + <fill element-number='0' style='transparent' color='ff000000'/> + <fill element-number='1' style='solid' color='ff000000'/> + <curve stack-order='0'> + <legend-item visible='1'/> + <default-axis x-axis='0' y-axis='4' z-axis='2' v-axis='3'/> + <gradient type='default'> + <fill element-number='0' style='solid' color='ff000080'/> + <fill element-number='1' style='solid' color='ff008000'/> + <fill element-number='2' style='solid' color='ffff0000'/> + <fill element-number='3' style='solid' color='ffffa000'/> + <fill element-number='4' style='solid' color='ffffffc4'/> + </gradient> + <series type='lines'/> + <delta fixed-x='0' fixed-y='0' percent-x='0' percent-y='0'/> + <zero x='0' y='0'/> + <dart element-number='1' style='none' size='3' /> + <dart element-number='2' style='none' size='3' /> + <title text='One'/> + <line element-number='0' style='solid' width='2' color='ffff0000'/> + <line element-number='1' style='invisible' width='0' color='ff000000'/> + <line element-number='2' style='invisible' width='0' color='ff000000'/> + <line element-number='3' style='invisible' width='0' color='ff000000'/> + <fill element-number='0' style='transparent' color='ff000000'/> + <point element-number='0' style='invisible' fill='transparent' size='9' color='ff000000'/> + <matrixref title='' sheet='0' row-from='0' row-step='1' row-to='-1' col-from='0' col-step='1' col-to='0' transposition='0' data-channel='0'/> + <matrixref title='' sheet='0' row-from='0' row-step='1' row-to='-1' col-from='1' col-step='1' col-to='1' transposition='0' data-channel='1'/> + </curve> + <curve stack-order='1'> + <legend-item visible='1'/> + <default-axis x-axis='0' y-axis='1' z-axis='2' v-axis='3'/> + <gradient type='default'> + <fill element-number='0' style='solid' color='ff000080'/> + <fill element-number='1' style='solid' color='ff008000'/> + <fill element-number='2' style='solid' color='ffff0000'/> + <fill element-number='3' style='solid' color='ffffa000'/> + <fill element-number='4' style='solid' color='ffffffc4'/> + </gradient> + <series type='lines'/> + <delta fixed-x='0' fixed-y='0' percent-x='0' percent-y='0'/> + <zero x='0' y='0'/> + <dart element-number='1' style='none' size='3' /> + <dart element-number='2' style='none' size='3' /> + <title text='Two'/> + <line element-number='0' style='solid' width='0' color='ff000000'/> + <line element-number='1' style='invisible' width='0' color='ff000000'/> + <line element-number='2' style='invisible' width='0' color='ff000000'/> + <line element-number='3' style='invisible' width='0' color='ff000000'/> + <fill element-number='0' style='transparent' color='ff000000'/> + <point element-number='0' style='invisible' fill='transparent' size='9' color='ff000000'/> + <matrixref title='' sheet='0' row-from='0' row-step='1' row-to='-1' col-from='0' col-step='1' col-to='0' transposition='0' data-channel='0'/> + <matrixref title='' sheet='0' row-from='0' row-step='1' row-to='-1' col-from='2' col-step='1' col-to='2' transposition='0' data-channel='1'/> + </curve> + <legend> + <align frame='10'/> + <format columns='1'/> + <pos x='0.279306' y='0.05' z='0'/> + <coord-system x='1' y='1' z='1'/> + <shadow-shift x='3' y='3'/> + <font element-number='1' family='helvetica' size='10' bold='0' italic='0' color='ff000000'/> + <fill element-number='1' style='solid' color='ffffffff'/> + <line element-number='1' style='solid' width='0' color='ff000000'/> + <fill element-number='2' style='transparent' color='ff000000'/> + <axes-bindings x-axis='0' y-axis='1' z-axis='2'/> + </legend> + <arrow> + <begin x='0.9' y='-0.05' z='0'/> + <end x='5' y='0' z='10'/> + <coord-system-begin x='1' y='1' z='1'/> + <coord-system-end x='3' y='3' z='3'/> + <line element-number='1' style='solid' width='0' color='ff000000'/> + <dart element-number='1' style='none' size='3' /> + <dart element-number='2' style='filled' size='3' /> + <point element-number='1' style='invisible' fill='transparent' size='9' color='ff000000'/> + <point element-number='2' style='invisible' fill='transparent' size='9' color='ff000000'/> + <axes-bindings x-axis='0' y-axis='1' z-axis='2'/> + </arrow> + <label> + <text>Example</text> + <angle deg='0'/> + <align text='9' frame='9'/> + <pos x='-0.0846667' y='-0.183444' z='0'/> + <coord-system x='1' y='1' z='1'/> + <shadow-shift x='5' y='5'/> + <font element-number='1' family='helvetica' size='24' bold='1' italic='0' color='ff000000'/> + <fill element-number='1' style='transparent' color='ffffffff'/> + <line element-number='1' style='invisible' width='0' color='ff000000'/> + <fill element-number='2' style='transparent' color='ff000000'/> + <axes-bindings x-axis='0' y-axis='1' z-axis='2'/> + </label> + </axes2d> + <label> + <text>Points at (0,5)</text> + <angle deg='0'/> + <align text='9' frame='9'/> + <pos x='114.8' y='4.85181' z='0'/> + <coord-system x='1' y='1' z='1'/> + <shadow-shift x='5' y='5'/> + <font element-number='1' family='helvetica' size='16' bold='0' italic='0' color='ff000000'/> + <fill element-number='1' style='transparent' color='ffffffff'/> + <line element-number='1' style='invisible' width='0' color='ff000000'/> + <fill element-number='2' style='transparent' color='ff000000'/> + <axes-bindings x-axis='-1' y-axis='-1' z-axis='-1'/> + </label> + <axes2d> + <area xmm='125' ymm='215' wmm='70' hmm='60'/> + <draw-in-background enabled='1'/> + <title-attributes> + </title-attributes> + <background-attributes> + <fill element-number='-1' style='transparent' color='ff000000'/> + </background-attributes> + <frame width='0'/> + <axis type='X' visible='1' scrollable='1'> + <dart element-number='1' style='none' size='3' /> + <dart element-number='2' style='normal' size='5' /> + <display position='0' default='1' opposite='0' /> + <range min='0.693385' max='2.31179' rounded='0'/> + <scale type='linear' base='10' reversed='0'/> + <grid-step major='-4' minor='-20'/> + <tics format='(TIC)' visible='1' outer='0' angle='0' pos1='0.01' pos2='0.01'/> + <title-position pos='0.5' distance='0.05'/> + <remembered-view number='0' min='0' max='0' scale='linear' base='10' reversed='0' rounded='0'/> + <remembered-view number='1' min='0' max='0' scale='linear' base='10' reversed='0' rounded='0'/> + <remembered-view number='2' min='0' max='0' scale='linear' base='10' reversed='0' rounded='0'/> + <title text='X'/> + <line element-number='0' style='solid' width='0' color='ff000000'/> + <line element-number='1' style='invisible' width='0' color='ff000000'/> + <line element-number='2' style='invisible' width='0' color='ff000000'/> + <font element-number='0' family='helvetica' size='10' bold='0' italic='0' color='ff000000'/> + <font element-number='1' family='helvetica' size='10' bold='0' italic='0' color='ff000000'/> + </axis> + <axis type='Y' visible='1' scrollable='1'> + <dart element-number='1' style='none' size='3' /> + <dart element-number='2' style='normal' size='5' /> + <display position='0' default='1' opposite='0' /> + <range min='0.390771' max='1.60096' rounded='0'/> + <scale type='linear' base='10' reversed='0'/> + <grid-step major='-4' minor='-20'/> + <tics format='(TIC)' visible='1' outer='0' angle='0' pos1='0.01' pos2='0.01'/> + <title-position pos='0.5' distance='0.05'/> + <remembered-view number='0' min='0' max='0' scale='linear' base='10' reversed='0' rounded='0'/> + <remembered-view number='1' min='0' max='0' scale='linear' base='10' reversed='0' rounded='0'/> + <remembered-view number='2' min='0' max='0' scale='linear' base='10' reversed='0' rounded='0'/> + <title text='Y'/> + <line element-number='0' style='solid' width='0' color='ff000000'/> + <line element-number='1' style='invisible' width='0' color='ff000000'/> + <line element-number='2' style='invisible' width='0' color='ff000000'/> + <font element-number='0' family='helvetica' size='10' bold='0' italic='0' color='ff000000'/> + <font element-number='1' family='helvetica' size='10' bold='0' italic='0' color='ff000000'/> + </axis> + <axis type='Z' visible='1' scrollable='1'> + <dart element-number='1' style='none' size='3' /> + <dart element-number='2' style='none' size='3' /> + <display position='0' default='1' opposite='0' /> + <range min='0' max='0' rounded='0'/> + <scale type='linear' base='10' reversed='0'/> + <grid-step major='-4' minor='-20'/> + <tics format='(TIC)' visible='1' outer='0' angle='0' pos1='0.01' pos2='0.01'/> + <title-position pos='0.5' distance='0.05'/> + <remembered-view number='0' min='0' max='0' scale='linear' base='10' reversed='0' rounded='0'/> + <remembered-view number='1' min='0' max='0' scale='linear' base='10' reversed='0' rounded='0'/> + <remembered-view number='2' min='0' max='0' scale='linear' base='10' reversed='0' rounded='0'/> + <title text='Z'/> + <line element-number='0' style='solid' width='0' color='ff000000'/> + <line element-number='1' style='invisible' width='0' color='ff000000'/> + <line element-number='2' style='invisible' width='0' color='ff000000'/> + <font element-number='0' family='helvetica' size='10' bold='0' italic='0' color='ff000000'/> + <font element-number='1' family='helvetica' size='10' bold='0' italic='0' color='ff000000'/> + </axis> + <axis type='V' visible='1' scrollable='1'> + <dart element-number='1' style='none' size='3' /> + <dart element-number='2' style='none' size='3' /> + <display position='0' default='1' opposite='0' /> + <range min='0' max='0' rounded='0'/> + <scale type='linear' base='10' reversed='0'/> + <grid-step major='-4' minor='0'/> + <tics format='(TIC)' visible='1' outer='0' angle='0' pos1='0.01' pos2='0.01'/> + <title-position pos='0.5' distance='0.05'/> + <remembered-view number='0' min='0' max='0' scale='linear' base='10' reversed='0' rounded='0'/> + <remembered-view number='1' min='0' max='0' scale='linear' base='10' reversed='0' rounded='0'/> + <remembered-view number='2' min='0' max='0' scale='linear' base='10' reversed='0' rounded='0'/> + <title text='V'/> + <line element-number='0' style='solid' width='0' color='ff000000'/> + <line element-number='1' style='invisible' width='0' color='ff000000'/> + <line element-number='2' style='invisible' width='0' color='ff000000'/> + <font element-number='0' family='helvetica' size='10' bold='0' italic='0' color='ff000000'/> + <font element-number='1' family='helvetica' size='10' bold='0' italic='0' color='ff000000'/> + </axis> + <title text=''/> + <fill element-number='0' style='transparent' color='ff000000'/> + <fill element-number='1' style='solid' color='ff000000'/> + <curve stack-order='0'> + <legend-item visible='1'/> + <default-axis x-axis='0' y-axis='1' z-axis='2' v-axis='3'/> + <gradient type='default'> + <fill element-number='0' style='solid' color='ff000080'/> + <fill element-number='1' style='solid' color='ff008000'/> + <fill element-number='2' style='solid' color='ffff0000'/> + <fill element-number='3' style='solid' color='ffffa000'/> + <fill element-number='4' style='solid' color='ffffffc4'/> + </gradient> + <series type='lines'/> + <delta fixed-x='0' fixed-y='0' percent-x='0' percent-y='0'/> + <zero x='0' y='0'/> + <dart element-number='1' style='line' size='5' /> + <dart element-number='2' style='line' size='5' /> + <title text='One'/> + <line element-number='0' style='solid' width='0' color='ff000000'/> + <line element-number='1' style='solid' width='0' color='ff808080'/> + <line element-number='2' style='invisible' width='0' color='ff000000'/> + <line element-number='3' style='invisible' width='0' color='ff000000'/> + <fill element-number='0' style='transparent' color='ff000000'/> + <point element-number='0' style='circle' fill='opaque' size='7' color='ff808080'/> + <matrixref title='' sheet='0' row-from='0' row-step='1' row-to='-1' col-from='0' col-step='1' col-to='0' transposition='0' data-channel='0'/> + <matrixref title='' sheet='0' row-from='0' row-step='1' row-to='-1' col-from='1' col-step='1' col-to='1' transposition='0' data-channel='1'/> + <matrix-formula title='' formula='y*0.05+0.01' transposition='0' data-channel='3'/> + </curve> + <label> + <text>Error Bars</text> + <angle deg='0'/> + <align text='9' frame='9'/> + <pos x='-0.00197531' y='-0.178388' z='0'/> + <coord-system x='1' y='1' z='1'/> + <shadow-shift x='5' y='5'/> + <font element-number='1' family='helvetica' size='24' bold='1' italic='0' color='ff000000'/> + <fill element-number='1' style='transparent' color='ffffffff'/> + <line element-number='1' style='invisible' width='0' color='ff000000'/> + <fill element-number='2' style='transparent' color='ff000000'/> + <axes-bindings x-axis='0' y-axis='1' z-axis='2'/> + </label> + </axes2d> + <label> + <text><p>1. KMatplot does not implement a concept of "layers", known from other plotting packages, but you can </p> <p><wsp> </wsp>easily add/remove axes to/from a graph. Select the above graph using the select tool, </p> <p><wsp> </wsp>choose<b><font size="3" style="font-size:12pt"> Graph/Insert/X Axis</font></b> axis from the main menu.<wsp> </wsp>On the side panel, in the field "Position" , </p> <p><wsp> </wsp>write 0.5 and press ENTER. You shoud see a new X axis.</p> <p>2. To remove the existing axis choose<b><font size="3" style="font-size:12pt"> Graph/Edit datasets</font></b>, highlight the axis, and from a popup menu</p> <p><wsp> </wsp>( right mouse button ) choose Delete. You can also select the axes on the property panel, click</p> <p><wsp> </wsp>with the right mouse button over the axis button<wsp> </wsp>list and choose<b><font size="3" style="font-size:12pt"> Delete dataset</font></b> from the popup</p> <p><wsp> </wsp>menu.</p> <p>3.<wsp> </wsp>Click with middle mouse button on the thick, red curve, and on the property panel choose a new X axis</p> <p><wsp> </wsp>to bind this dataset to ( well two axes have the same title, you can't tell which is new )<wsp> </wsp></p> </text> + <angle deg='0'/> + <align text='9' frame='9'/> + <pos x='15.0721' y='115.108' z='0'/> + <coord-system x='1' y='1' z='1'/> + <shadow-shift x='5' y='5'/> + <font element-number='1' family='helvetica' size='10' bold='0' italic='0' color='ff000000'/> + <fill element-number='1' style='transparent' color='ffffffff'/> + <line element-number='1' style='invisible' width='0' color='ff000000'/> + <fill element-number='2' style='transparent' color='ff000000'/> + <axes-bindings x-axis='-1' y-axis='-1' z-axis='-1'/> + </label> + <label> + <text><p>1. Notice that you can't select label "Example",</p> <p><wsp> </wsp>"Error Bars" and arrow - they are grouped</p> <p><wsp> </wsp>with the graph object. To group a new object</p> <p><wsp> </wsp>with a graph, select this graph before creating</p> <p><wsp> </wsp>a new object.</p> <p>2. Grouped object can keep its position relative</p> <p><wsp> </wsp>to the parent or to the data ( notice that arrows</p> <p><wsp> </wsp>always points at ( 5, 0 ), even if you change</p> <p><wsp> </wsp>ranges.</p> <p>3. To select grouped object keep CTRL pressed</p> <p><wsp> </wsp>when clicking mouse<wsp> </wsp>button.</p> </text> + <angle deg='0'/> + <align text='9' frame='9'/> + <pos x='14.9685' y='199.961' z='0'/> + <coord-system x='1' y='1' z='1'/> + <shadow-shift x='5' y='5'/> + <font element-number='1' family='helvetica' size='10' bold='0' italic='0' color='ff000000'/> + <fill element-number='1' style='transparent' color='ffffffff'/> + <line element-number='1' style='invisible' width='0' color='ff000000'/> + <fill element-number='2' style='transparent' color='ff000000'/> + <axes-bindings x-axis='-1' y-axis='-1' z-axis='-1'/> + </label> + </page> + </canvas> +</kmatplot> diff --git a/kmatplot/examples/surface.kmp b/kmatplot/examples/surface.kmp new file mode 100644 index 0000000..a64f911 --- /dev/null +++ b/kmatplot/examples/surface.kmp @@ -0,0 +1,385 @@ +<?xml version='1.0' encoding='UTF-8'?> +<!DOCTYPE kmatplot> +<kmatplot mime='application/x-kmatplot' editor='KMatplot' version='0.3' url='http://kmatplot.sourceforge.net' program-author='K. Dobkowski'> + <canvas page-size='A4' orientation='Portrait' dpi='72'> + <sheets number='2'> + <sheet number='0' name='unnamed'> + <matrix title='' rows='64' cols='64' element-type='double' data-channel='0'> + <row>0.912792206 0.918793678 0.936246037 0.963537633 0.9981215 1.0367136 1.07554698 1.11066163 1.13820732 1.1547364 1.15745986 1.14445257 1.11478686 1.06858814 1.00700903 0.932125807 0.846767187 0.754290879 0.658328116 0.562517822 0.47025162 0.384452522 0.307403326 0.240637124 0.184899196 0.140178159 0.10580305 0.0805943012 0.0630531013 0.0515695699 0.0446299352 0.0410028957 0.0398865342 0.0410028957 0.0446299352 0.0515695699 0.0630531013 0.0805943012 0.10580305 0.140178159 0.184899196 0.240637124 0.307403326 0.384452522 0.47025162 0.562517822 0.658328116 0.754290879 0.846767187 0.932125807 1.00700903 1.06858814 1.11478686 1.14445257 1.15745986 1.1547364 1.13820732 1.11066163 1.07554698 1.0367136 0.9981215 0.963537633 0.936246037 0.918793678 </row> + <row>0.918793559 0.924484253 0.941023707 0.96685648 0.999525011 1.03586137 1.0722338 1.10482633 1.12993288 1.14423954 1.14507318 1.1305989 1.09994829 1.05327368 0.991722167 0.917333364 0.832873344 0.741617918 0.647103846 0.552870691 0.462214351 0.37797156 0.302354306 0.236844137 0.18215546 0.138266832 0.104515404 0.0797448978 0.0624892265 0.0511758439 0.0443270057 0.0407413244 0.0396365114 0.0407414287 0.0443270393 0.0511758178 0.0624892302 0.0797448903 0.104515433 0.138266832 0.18215546 0.236844122 0.302354306 0.3779715 0.462214321 0.55287075 0.647103906 0.741617918 0.832873344 0.917333305 0.991722167 1.05327368 1.09994829 1.1305989 1.14507341 1.14423954 1.12993288 1.10482633 1.0722338 1.03586149 0.99952507 0.966856539 0.941023707 0.924484372 </row> + <row>0.936245978 0.941023767 0.954881012 0.976427853 1.00346982 1.03318071 1.06232584 1.08751345 1.10546076 1.11324799 1.10854149 1.08977056 1.05624247 1.00818765 0.946734846 0.873815536 0.792011797 0.704356849 0.614109099 0.524516404 0.438591868 0.358919114 0.287502319 0.225671604 0.174051598 0.132591948 0.100655317 0.077154249 0.0607208386 0.0498929583 0.0432998538 0.0398286656 0.0387553349 0.0398287065 0.0432998426 0.0498929992 0.0607208312 0.0771542639 0.100655317 0.132591948 0.174051598 0.225671604 0.287502319 0.358919054 0.438591838 0.524516463 0.614109159 0.704356909 0.792011797 0.873815596 0.946734846 1.00818777 1.05624247 1.08977056 1.10854149 1.11324799 1.10546076 1.08751345 1.06232584 1.03318083 1.00346982 0.976427794 0.954880953 0.941023767 </row> + <row>0.963537633 0.96685648 0.976427794 0.991127074 1.00918102 1.02831149 1.0459187 1.05929112 1.06582308 1.06322503 1.04970586 1.02411675 0.986043751 0.935840607 0.874603868 0.804089904 0.726582825 0.644725978 0.561329722 0.479173541 0.400817484 0.328439921 0.26371333 0.207727239 0.16096504 0.123333082 0.0942385942 0.0727080703 0.0575340949 0.0474352241 0.0412149094 0.0379040688 0.0368731096 0.03790408 0.0412149169 0.0474352054 0.0575341173 0.0727081001 0.0942385644 0.123333141 0.16096504 0.207727239 0.26371336 0.328439951 0.400817484 0.479173541 0.561329782 0.644725919 0.726582825 0.804089904 0.874603927 0.935840607 0.986043751 1.02411675 1.04970586 1.06322503 1.06582308 1.05929112 1.0459187 1.02831149 1.00918102 0.991127014 0.976427794 0.966856539 </row> + <row>0.99812144 0.99952507 1.00346971 1.00918102 1.0154413 1.02069378 1.02317655 1.02107275 1.01266861 0.996502697 0.971496582 0.937054396 0.893124878 0.840219736 0.779388428 0.712150812 0.640394092 0.566242993 0.491914392 0.419568002 0.351166129 0.288353741 0.23236835 0.18398644 0.143510491 0.110796385 0.08531674 0.0662561804 0.0526259542 0.0433895215 0.0375856236 0.0344394371 0.0334486291 0.0344394594 0.0375856422 0.0433894582 0.0526259467 0.0662561506 0.0853167549 0.110796392 0.143510491 0.18398644 0.232368365 0.288353741 0.351166129 0.419568002 0.491914421 0.566242933 0.640394092 0.712150812 0.779388428 0.840219796 0.893124878 0.937054396 0.971496582 0.996502697 1.01266861 1.02107275 1.02317655 1.02069378 1.0154413 1.00918102 1.00346971 0.99952507 </row> + <row>1.0367136 1.03586149 1.03318083 1.02831161 1.0206939 1.00962603 0.994336963 0.97406882 0.948160946 0.916130483 0.877737641 0.833035648 0.782396078 0.726509869 0.666362464 0.603185058 0.538386881 0.473471493 0.409947395 0.349236816 0.292592734 0.241029769 0.195274293 0.155738324 0.122518972 0.0954225063 0.0740110651 0.0576684475 0.0456772298 0.0373018123 0.0318693221 0.0288419239 0.0278727245 0.0288418997 0.0318693183 0.0373017751 0.0456772298 0.057668481 0.0740110949 0.0954224914 0.122518972 0.155738354 0.195274293 0.241029769 0.292592734 0.349236816 0.409947395 0.473471493 0.538386881 0.603185117 0.666362405 0.726509869 0.782396078 0.833035648 0.877737701 0.916130483 0.948160946 0.97406882 0.994336963 1.00962603 1.0206939 1.02831161 1.03318083 1.03586161 </row> + <row>1.07554698 1.07223392 1.06232584 1.04591882 1.02317667 0.994336903 0.95971781 0.919723213 0.874847889 0.825678945 0.772892594 0.71724689 0.659568429 0.600733519 0.541644931 0.483204633 0.426284134 0.371694148 0.320155889 0.272275537 0.228524312 0.18922542 0.154548958 0.124515459 0.099008657 0.0777955502 0.0605537295 0.046903681 0.0364436619 0.0287852734 0.0235864557 0.0205804203 0.0195977222 0.0205804147 0.0235864297 0.0287852734 0.0364436433 0.046903681 0.0605537482 0.0777955651 0.099008657 0.124515451 0.154548958 0.18922542 0.228524312 0.272275507 0.320155889 0.371694177 0.426284134 0.483204603 0.541644931 0.600733519 0.659568489 0.71724695 0.772892654 0.825678945 0.874847889 0.919723272 0.959717751 0.994336963 1.02317655 1.0459187 1.06232572 1.0722338 </row> + <row>1.11066151 1.10482633 1.08751333 1.05929112 1.02107286 0.974068701 0.919723153 0.859640896 0.795508385 0.729014218 0.661773801 0.595263541 0.530767381 0.46933803 0.411776453 0.358626664 0.310187757 0.266538709 0.227574512 0.193049029 0.162621111 0.13590014 0.11248754 0.0920106769 0.0741489232 0.0586489141 0.0453302339 0.0340821557 0.0248533748 0.0176364463 0.0124502704 0.00932293665 0.00827755313 0.00932292547 0.0124502638 0.0176365003 0.0248533674 0.0340821482 0.045330178 0.0586489215 0.0741489232 0.0920106918 0.11248754 0.13590017 0.162621111 0.193049014 0.227574497 0.266538739 0.310187757 0.358626693 0.411776453 0.469338089 0.530767381 0.59526366 0.661773801 0.729014158 0.795508385 0.859640956 0.919723153 0.974068701 1.02107286 1.05929112 1.08751333 1.10482633 </row> + <row>1.13820732 1.12993288 1.10546076 1.06582308 1.01266861 0.948160946 0.874847829 0.795508385 0.712992072 0.630059302 0.549235225 0.472685993 0.402126342 0.338762492 0.283274114 0.235832855 0.196155861 0.163586363 0.137194455 0.115888372 0.0985262096 0.0840196759 0.0714210421 0.0599873699 0.0492182523 0.0388655923 0.0289165396 0.0195539873 0.0110995481 0.00394662423 0.001508769 0.00493148342 0.00609843805 0.00493148342 0.001508769 0.00394662423 0.0110995481 0.0195539873 0.0289165396 0.0388655923 0.0492182523 0.0599873699 0.0714210421 0.0840196759 0.0985262096 0.115888372 0.137194455 0.163586363 0.196155861 0.235832855 0.283274114 0.338762492 0.402126342 0.472685993 0.549235225 0.630059302 0.712992072 0.795508385 0.874847829 0.948160946 1.01266861 1.06582308 1.10546076 1.12993288 </row> + <row>1.15473616 1.14423966 1.11324799 1.06322503 0.996502817 0.916130424 0.825678945 0.729014218 0.630059302 0.53256011 0.439872295 0.354784966 0.279391438 0.215016186 0.162200049 0.120742247 0.0897940397 0.0679925904 0.0536235422 0.0447970964 0.0396220647 0.0363641754 0.0335757956 0.0301876143 0.0255568847 0.019470565 0.0121054146 0.0039528436 0.00428374531 0.0118058734 0.0178391747 0.0217419583 0.0230919439 0.0217419509 0.017839184 0.0118058883 0.00428375881 0.00395283056 0.0121054249 0.0194705427 0.0255568847 0.0301875994 0.0335757956 0.0363641679 0.0396220647 0.0447971001 0.0536235422 0.0679925829 0.0897940397 0.120742247 0.162200049 0.215016186 0.279391438 0.354784966 0.439872354 0.53256011 0.630059302 0.729014158 0.825678885 0.916130424 0.996502697 1.06322503 1.11324799 1.14423966 </row> + <row>1.15745986 1.14507329 1.10854149 1.04970586 0.971496701 0.877737522 0.772892594 0.661773741 0.549235225 0.439872354 0.337750643 0.246182367 0.167566463 0.103301488 0.0537755787 0.0184302311 0.00410904316 0.0158502385 0.019216286 0.0168106798 0.0111875646 0.00464460813 0.000944189727 0.0042440379 0.00451593846 0.00161215442 0.00408511423 0.011773116 0.0203731768 0.0286942944 0.0355985314 0.0401509888 0.0417394675 0.0401510075 0.0355985165 0.0286943056 0.0203731824 0.011773088 0.00408510864 0.00161215605 0.00451593846 0.00424404116 0.000944184081 0.00464460859 0.0111875618 0.0168106891 0.0192162823 0.0158502478 0.00410904316 0.018430246 0.0537755825 0.10330148 0.167566463 0.246182352 0.337750643 0.439872324 0.549235225 0.66177386 0.772892594 0.877737641 0.971496642 1.04970586 1.10854161 1.14507329 </row> + <row>1.14445257 1.13059902 1.08977056 1.02411675 0.937054515 0.833035648 0.71724695 0.5952636 0.472685993 0.354784966 0.246182367 0.150589779 0.0706236735 0.00770815788 0.0379300751 0.0671781078 0.0818741769 0.0845833644 0.0783313736 0.0663207397 0.0516539142 0.0370856859 0.0248248074 0.0163995847 0.0125957113 0.0134684322 0.0184239633 0.0263592023 0.0358436145 0.0453236848 0.0533286519 0.0586568676 0.0605237484 0.0586568676 0.0533286445 0.0453236662 0.0358435996 0.0263591856 0.0184239671 0.0134684257 0.0125957113 0.0163995866 0.0248248093 0.0370856859 0.0516539253 0.0663207397 0.0783313736 0.0845833868 0.0818741769 0.0671781078 0.0379300639 0.0077081318 0.0706236809 0.150589794 0.246182352 0.354784966 0.472685993 0.5952636 0.71724695 0.833035648 0.937054455 1.02411675 1.08977067 1.1305989 </row> + <row>1.11478686 1.09994829 1.05624247 0.986043751 0.893124938 0.782396138 0.659568429 0.530767381 0.402126282 0.279391408 0.167566434 0.0706236586 0.00869856961 0.068999365 0.110214911 0.133518368 0.141131207 0.136065722 0.121821366 0.102062635 0.0803058371 0.059640605 0.0425085276 0.0305550508 0.024564622 0.024480382 0.0295030288 0.0382557474 0.0489970669 0.0598583892 0.0690828338 0.0752407834 0.077401109 0.0752407908 0.0690828264 0.0598583892 0.0489970669 0.0382557511 0.0295030251 0.024480382 0.024564622 0.030555049 0.0425085276 0.059640605 0.0803058445 0.102062628 0.121821359 0.136065707 0.141131207 0.133518383 0.110214911 0.068999365 0.00869856402 0.070623666 0.167566434 0.279391438 0.402126282 0.530767381 0.659568489 0.782396078 0.893124938 0.986043811 1.05624247 1.09994841 </row> + <row>1.06858814 1.0532738 1.00818777 0.935840607 0.840219796 0.726509869 0.600733519 0.469338059 0.338762492 0.215016171 0.10330148 0.00770815415 0.068999365 0.125487655 0.161848724 0.179487109 0.180912554 0.16945906 0.148955584 0.123377725 0.0965102166 0.0716483817 0.0513620824 0.0373400673 0.0303245466 0.0301382616 0.0357969813 0.0456937067 0.0578342229 0.0700993165 0.0805075318 0.0874517262 0.0898871198 0.0874517262 0.0805075169 0.0700993612 0.0578342229 0.0456936993 0.0357969813 0.0301382616 0.0303245466 0.0373400636 0.0513620973 0.0716483742 0.0965102166 0.123377718 0.148955584 0.169459045 0.180912554 0.179487124 0.161848724 0.125487655 0.0689993724 0.00770814158 0.103301488 0.215016186 0.338762492 0.469338089 0.600733519 0.726509869 0.840219796 0.935840666 1.00818777 1.0532738 </row> + <row>1.00700891 0.991722167 0.946734786 0.874603927 0.779388487 0.666362345 0.541644931 0.411776423 0.283274114 0.162199989 0.053775534 0.0379300788 0.110214934 0.161848769 0.193062454 0.205427319 0.201636195 0.18521066 0.160157502 0.130607873 0.10046792 0.0731111094 0.0511364713 0.036210604 0.0290046036 0.0292268936 0.0357450247 0.046782162 0.0601666234 0.0736083835 0.0849758759 0.0925453156 0.095197618 0.0925453082 0.0849758834 0.0736083537 0.060166616 0.0467821732 0.0357450359 0.0292268973 0.0290046036 0.0362105966 0.0511364639 0.0731111243 0.10046792 0.130607873 0.160157502 0.185210645 0.201636195 0.205427274 0.193062499 0.161848724 0.110214919 0.0379301123 0.0537755229 0.162200004 0.283274114 0.411776483 0.541644931 0.666362405 0.779388487 0.874603927 0.946734846 0.991722167 </row> + <row>0.932125688 0.917333364 0.873815536 0.804089844 0.712150812 0.603184998 0.483204603 0.358626693 0.23583284 0.120742247 0.0184302349 0.0671780929 0.133518353 0.179487094 0.205427274 0.213003874 0.204983279 0.184937552 0.156900957 0.125008479 0.0931475163 0.064651981 0.0420629792 0.0269740205 0.0199716929 0.0206725821 0.0278495625 0.0396325998 0.053762611 0.0678720102 0.0797650069 0.087669529 0.0904368609 0.0876695365 0.0797649696 0.0678720102 0.0537626222 0.0396325886 0.0278495736 0.0206725765 0.0199716929 0.0269740112 0.0420629829 0.0646519959 0.0931475088 0.125008464 0.156900972 0.184937567 0.204983279 0.213003889 0.205427259 0.179487094 0.133518323 0.067178078 0.0184302088 0.120742254 0.23583284 0.358626693 0.483204633 0.603184998 0.712150872 0.804089904 0.873815536 0.917333305 </row> + <row>0.846767128 0.832873404 0.792011797 0.726582825 0.640394151 0.538386822 0.426284134 0.310187757 0.196155861 0.0897940323 0.00410906365 0.0818741694 0.141131207 0.180912524 0.201636165 0.204983279 0.193682849 0.171225265 0.141529664 0.108594939 0.0761642158 0.0474305786 0.0248079188 0.00978387892 0.00286526931 0.00361675094 0.0107860174 0.0225008596 0.0365174785 0.0504942089 0.0622647442 0.0700836107 0.072820276 0.0700836107 0.0622647442 0.0504942089 0.0365174785 0.0225008596 0.0107860174 0.00361675094 0.00286526931 0.00978387892 0.0248079188 0.0474305786 0.0761642158 0.108594939 0.141529664 0.171225265 0.193682849 0.204983279 0.201636165 0.180912524 0.141131207 0.0818741694 0.00410906365 0.0897940323 0.196155861 0.310187757 0.426284134 0.538386822 0.640394151 0.726582825 0.792011797 0.832873404 </row> + <row>0.754290819 0.741618037 0.704356968 0.644726038 0.566243052 0.473471522 0.371694207 0.266538739 0.163586348 0.0679925755 0.0158502813 0.0845833868 0.136065707 0.16945903 0.185210645 0.184937552 0.171225265 0.147359669 0.117016777 0.0839376822 0.0516159721 0.0230242666 0.000401603233 0.0148824016 0.0223770794 0.0225131568 0.0164845176 0.00606304035 0.0066344412 0.0194024071 0.030202629 0.0373938568 0.0399134308 0.037393868 0.0302026328 0.0194023941 0.00663443049 0.00606303103 0.0164845195 0.0225131642 0.0223770794 0.0148823932 0.000401602185 0.0230242573 0.0516159683 0.0839376822 0.11701677 0.147359654 0.171225265 0.184937552 0.1852106 0.16945906 0.136065722 0.0845833644 0.015850259 0.0679925829 0.163586348 0.266538739 0.371694177 0.473471463 0.566243052 0.644725978 0.704356909 0.741618037 </row> + <row>0.658328176 0.647103906 0.614109159 0.561329722 0.491914421 0.409947366 0.320155919 0.227574527 0.13719447 0.0536235571 0.0192162842 0.0783313587 0.121821359 0.148955554 0.160157517 0.156900957 0.141529679 0.11701677 0.0866868272 0.0539239198 0.0218914282 0.00671346067 0.0298508052 0.0462600701 0.0555051342 0.0579410344 0.0546087511 0.0470696948 0.0371975675 0.026948886 0.0181343593 0.0122130997 0.0101303179 0.0122130848 0.0181343481 0.0269488655 0.0371975563 0.0470697433 0.0546087585 0.0579410195 0.0555051342 0.0462600589 0.0298507959 0.00671347464 0.0218914207 0.0539239086 0.0866868123 0.1170168 0.141529679 0.156900972 0.160157502 0.148955598 0.121821351 0.0783313513 0.0192162972 0.0536235534 0.13719447 0.227574527 0.320155919 0.409947395 0.491914451 0.561329782 0.614109159 0.647103906 </row> + <row>0.562517822 0.55287081 0.524516404 0.479173601 0.419568062 0.349236786 0.272275567 0.193049029 0.115888357 0.044797089 0.0168107022 0.0663207248 0.102062613 0.123377688 0.130607843 0.125008449 0.108594917 0.0839376822 0.0539239012 0.0215072874 0.0105332071 0.0398053117 0.0644691586 0.0833447501 0.0959534124 0.102492675 0.103749558 0.100962214 0.0956449807 0.0893949643 0.0836989284 0.0797589943 0.0783555657 0.0797589868 0.0836988986 0.0893950015 0.0956449732 0.100962199 0.103749543 0.102492683 0.0959534124 0.0833447576 0.0644691661 0.0398053043 0.0105332127 0.021507293 0.0539238788 0.0839376673 0.108594917 0.125008464 0.130607858 0.123377681 0.102062605 0.0663207173 0.0168107152 0.0447970964 0.115888357 0.193048999 0.272275567 0.349236786 0.419568032 0.479173541 0.524516404 0.55287081 </row> + <row>0.47025156 0.46221441 0.438591838 0.400817484 0.351166189 0.292592764 0.228524342 0.162621111 0.0985262096 0.0396220461 0.0111875627 0.0516539104 0.0803058445 0.0965101793 0.100467898 0.0931474939 0.0761642009 0.0516159534 0.0218913946 0.0105332229 0.0432912372 0.0743001774 0.101900376 0.124947287 0.142851382 0.15556474 0.163518026 0.167516172 0.168603629 0.167914674 0.166522622 0.165304318 0.164831966 0.165304303 0.166522622 0.167914674 0.168603629 0.167516172 0.163518026 0.155564725 0.142851382 0.124947295 0.101900361 0.0743001774 0.0432912335 0.0105332239 0.0218913946 0.0516159572 0.0761642009 0.0931474939 0.100467891 0.0965101793 0.0803058296 0.051653903 0.0111875683 0.0396220498 0.0985262096 0.162621111 0.228524357 0.292592764 0.351166219 0.400817454 0.438591808 0.46221441 </row> + <row>0.384452492 0.377971619 0.358919054 0.328439921 0.288353771 0.241029814 0.189225435 0.135900155 0.0840196684 0.0363641717 0.00464461884 0.0370856635 0.0596406236 0.0716483667 0.0731111094 0.0646520033 0.0474305823 0.0230242722 0.0067134737 0.0398052856 0.0743001625 0.108408876 0.140614867 0.169752225 0.195046335 0.2161154 0.232936308 0.245779052 0.255118698 0.261535108 0.265610576 0.26783675 0.268540621 0.267836779 0.265610605 0.261535108 0.255118728 0.245779037 0.232936308 0.2161154 0.195046335 0.16975224 0.140614867 0.108408883 0.0743001625 0.0398052931 0.00671346672 0.023024261 0.0474305823 0.064651981 0.0731111169 0.0716483742 0.0596406013 0.037085671 0.00464460766 0.0363641605 0.0840196684 0.135900185 0.189225465 0.241029799 0.28835386 0.328439951 0.358919054 0.377971619 </row> + <row>0.307403237 0.302354276 0.287502229 0.2637133 0.23236838 0.195274293 0.154548928 0.112487495 0.0714210495 0.0335757881 0.000944167376 0.0248247962 0.0425085202 0.0513620786 0.0511364676 0.042062968 0.0248079151 0.000401596451 0.0298508219 0.0644691437 0.101900369 0.140614852 0.179190114 0.216376066 0.251138687 0.282680035 0.310436189 0.334055096 0.353359222 0.368299007 0.378902853 0.385229766 0.387331963 0.385229737 0.378902853 0.368299007 0.353359252 0.334055096 0.310436189 0.282680035 0.251138687 0.216376066 0.179190129 0.140614852 0.101900369 0.0644691512 0.0298508164 0.00040160332 0.0248079151 0.042062968 0.0511364602 0.0513620824 0.0425085053 0.0248248037 0.000944168889 0.0335757807 0.0714210495 0.11248754 0.154548973 0.195274219 0.232368335 0.2637133 0.287502199 0.302354336 </row> + <row>0.240637109 0.236844242 0.225671545 0.207727194 0.18398647 0.155738309 0.124515526 0.0920106843 0.0599873848 0.0301876366 0.00424402347 0.0163995791 0.0305550657 0.0373400673 0.0362106077 0.026974 0.00978387333 0.0148823988 0.0462600738 0.0833447352 0.124947287 0.169752255 0.216376081 0.263421953 0.309528679 0.353411853 0.39389649 0.429941058 0.460653454 0.485300153 0.503311038 0.514279604 0.517962694 0.514279544 0.503311038 0.485300183 0.460653394 0.429941088 0.39389649 0.353411853 0.309528679 0.263421953 0.216376081 0.169752255 0.124947302 0.0833447427 0.0462600812 0.0148824025 0.00978387333 0.0269740112 0.0362106003 0.0373400487 0.0305550415 0.0163995977 0.00424403511 0.0301876403 0.0599873848 0.0920106769 0.124515481 0.155738324 0.1839865 0.207727224 0.225671574 0.236844197 </row> + <row>0.184899196 0.182155579 0.174051613 0.160965011 0.14351058 0.122518979 0.0990087315 0.0741489455 0.0492182672 0.0255569089 0.00451593427 0.0125957178 0.024564622 0.0303245522 0.0290046372 0.0199716836 0.00286527979 0.0223770719 0.0555051155 0.0959533751 0.142851368 0.195046321 0.251138628 0.309528649 0.368472755 0.42614758 0.480718821 0.530412495 0.573584735 0.608788133 0.634829998 0.650821209 0.656213403 0.650821209 0.634829998 0.608788133 0.573584735 0.530412495 0.480718821 0.42614758 0.368472755 0.309528649 0.251138628 0.195046321 0.142851368 0.0959533751 0.0555051155 0.0223770719 0.00286527979 0.0199716836 0.0290046372 0.0303245522 0.024564622 0.0125957178 0.00451593427 0.0255569089 0.0492182672 0.0741489455 0.0990087315 0.122518979 0.14351058 0.160965011 0.174051613 0.182155579 </row> + <row>0.140178084 0.138266802 0.132591948 0.123333059 0.11079637 0.095422484 0.0777956098 0.0586489141 0.0388655774 0.019470524 0.0016121146 0.013468435 0.0244803838 0.0301382747 0.0292269327 0.0206725709 0.00361675792 0.0225131698 0.0579410121 0.102492645 0.15556471 0.216115385 0.282680005 0.353411853 0.42614758 0.498494983 0.567938566 0.631956935 0.688145578 0.73433882 0.768720269 0.789918959 0.79708159 0.7899189 0.768720269 0.73433876 0.688145638 0.631956875 0.567938626 0.498495013 0.42614758 0.353411824 0.282680035 0.21611537 0.15556471 0.10249266 0.0579410307 0.0225131493 0.00361675792 0.0206725691 0.0292269383 0.0301382728 0.0244804025 0.0134684406 0.00161213533 0.0194705129 0.0388655774 0.0586489029 0.0777956098 0.0954224393 0.110796385 0.123333029 0.132591888 0.138266861 </row> + <row>0.10580299 0.104515456 0.100655302 0.0942385122 0.0853167474 0.0740110427 0.0605537891 0.0453301705 0.0289165284 0.0121054174 0.00408514962 0.0184239969 0.0295030419 0.0357970037 0.0357450806 0.0278495364 0.0107860155 0.0164845437 0.0546087436 0.103749536 0.163518012 0.232936293 0.310436189 0.393896461 0.480718821 0.567938566 0.652365923 0.730747283 0.799938917 0.857079506 0.899751663 0.926120281 0.935039639 0.926120281 0.899751663 0.857079506 0.799938917 0.730747223 0.652365863 0.567938626 0.480718821 0.39389649 0.310436159 0.232936293 0.163518026 0.103749536 0.0546087399 0.0164845362 0.0107860155 0.0278495643 0.0357450806 0.035796985 0.0295030531 0.0184239708 0.00408509374 0.0121053904 0.0289165284 0.045330137 0.0605537407 0.0740110353 0.085316807 0.0942385867 0.10065525 0.104515478 </row> + <row>0.0805943534 0.079744935 0.077154249 0.0727081001 0.0662562475 0.0576684475 0.0469037145 0.0340821557 0.0195540097 0.00395284081 0.011773116 0.0263592284 0.0382557809 0.0456937365 0.0467822365 0.039632611 0.0225008894 0.00606298167 0.0470696539 0.100962155 0.167516142 0.245779008 0.334055036 0.429941058 0.530412495 0.631956875 0.730747283 0.822844625 0.904416323 0.971956372 1.02249122 1.05375767 1.06434035 1.05375755 1.0224911 0.971956372 0.904416323 0.822844565 0.730747283 0.631956875 0.530412495 0.429940999 0.334055036 0.245779008 0.167516142 0.100962162 0.0470696837 0.00606299937 0.0225008894 0.0396326222 0.0467822589 0.0456937701 0.0382558331 0.0263592601 0.0117731458 0.00395284733 0.0195540097 0.0340821408 0.0469037406 0.0576684214 0.0662561953 0.0727081001 0.0771542639 0.0797449797 </row> + <row>0.0630530715 0.0624893196 0.06072082 0.0575340614 0.0526260138 0.0456772335 0.0364437141 0.0248533841 0.0110995565 0.00428372808 0.0203731507 0.0358436294 0.0489970818 0.0578342155 0.0601666532 0.0537626036 0.0365174748 0.00663443003 0.037197534 0.0956449285 0.168603644 0.255118668 0.353359193 0.460653394 0.573584735 0.688145638 0.799938917 0.904416323 0.997136116 1.07402384 1.13161683 1.1672765 1.1793505 1.1672765 1.13161695 1.07402384 0.997136176 0.904416323 0.799938977 0.688145638 0.573584735 0.460653394 0.353359222 0.255118698 0.168603644 0.0956449285 0.0371975601 0.00663444307 0.0365174748 0.0537625961 0.0601666495 0.0578342415 0.0489970446 0.0358436257 0.020373119 0.00428371457 0.0110995565 0.0248533972 0.0364437327 0.0456772409 0.052626051 0.0575341173 0.0607208051 0.0624893494 </row> + <row>0.0515695661 0.0511759259 0.0498928763 0.0474351645 0.0433894992 0.0373017639 0.0287853368 0.0176364686 0.00394671271 0.0118058249 0.0286943316 0.0453237109 0.059858378 0.0700993463 0.0736083686 0.067871958 0.0504941754 0.0194023233 0.0269488841 0.0893949866 0.167914674 0.261535108 0.368299037 0.485300153 0.608788133 0.73433882 0.857079506 0.971956253 1.07402384 1.15873873 1.22223616 1.26156819 1.27488828 1.26156819 1.22223628 1.15873885 1.07402384 0.971956313 0.857079566 0.73433876 0.608788133 0.485300124 0.368299037 0.261535078 0.167914659 0.0893949866 0.0269489009 0.0194023866 0.0504941754 0.067871958 0.0736083835 0.0700993538 0.0598583743 0.0453236513 0.0286943242 0.0118058389 0.00394671271 0.0176365003 0.0287853293 0.0373017937 0.043389529 0.0474351682 0.0498928837 0.0511759147 </row> + <row>0.0446299352 0.0443270765 0.0432998538 0.0412148796 0.0375857241 0.0318693221 0.0235865563 0.0124502676 0.00150867843 0.0178391207 0.0355985351 0.0533287078 0.0690828338 0.0805074498 0.0849758908 0.0797649175 0.0622647181 0.0302026216 0.0181343257 0.0836988911 0.166522652 0.265610516 0.378902823 0.503310978 0.634829938 0.768720269 0.899751604 1.0224911 1.13161683 1.22223616 1.29018402 1.3322829 1.34654188 1.3322829 1.29018402 1.22223604 1.13161683 1.0224911 0.899751663 0.768720329 0.634829938 0.503310978 0.378902793 0.265610546 0.166522682 0.0836988986 0.0181343481 0.0302025825 0.0622647181 0.0797648951 0.0849758983 0.0805075169 0.0690827817 0.053328611 0.0355984867 0.0178391449 0.00150867843 0.0124503179 0.0235865358 0.0318692997 0.0375857055 0.0412148312 0.0432998687 0.0443270989 </row> + <row>0.0410028622 0.0407414138 0.0398286693 0.0379040278 0.0344394855 0.0288419183 0.0205804501 0.00932296645 0.0049314308 0.0217419155 0.0401509628 0.0586568229 0.075240761 0.087451674 0.0925453454 0.0876694694 0.0700836107 0.0373938382 0.0122130318 0.0797589496 0.165304318 0.26783669 0.385229737 0.514279485 0.650821209 0.789918959 0.926120341 1.05375767 1.16727638 1.26156807 1.33228302 1.37610137 1.39094377 1.37610149 1.3322829 1.26156819 1.1672765 1.05375755 0.926120281 0.7899189 0.650821209 0.514279544 0.385229737 0.26783672 0.165304333 0.0797589198 0.0122130783 0.0373938456 0.0700836107 0.0876695216 0.0925453156 0.0874517262 0.0752408206 0.0586569346 0.0401509814 0.0217419192 0.0049314308 0.00932292547 0.0205805078 0.0288418997 0.034439519 0.0379040726 0.0398286805 0.0407413878 </row> + <row>0.039886564 0.0396365933 0.0387553014 0.0368731283 0.0334486663 0.0278727263 0.0195978098 0.00827757176 0.00609843805 0.0230919532 0.0417394377 0.0605237819 0.0774011463 0.0898871794 0.0951976553 0.0904368833 0.0728203058 0.0399134345 0.0101302871 0.0783555284 0.164831981 0.268540621 0.387331933 0.517962694 0.656213403 0.79708159 0.935039699 1.06434035 1.17935038 1.2748884 1.34654188 1.39094377 1.40598392 1.39094377 1.34654188 1.2748884 1.17935038 1.06434035 0.935039699 0.79708159 0.656213403 0.517962694 0.387331933 0.268540621 0.164831981 0.0783555284 0.0101302871 0.0399134345 0.0728203058 0.0904368833 0.0951976553 0.0898871794 0.0774011463 0.0605237819 0.0417394377 0.0230919532 0.00609843805 0.00827757176 0.0195978098 0.0278727263 0.0334486663 0.0368731283 0.0387553014 0.0396365933 </row> + <row>0.0410028622 0.0407413878 0.0398286805 0.0379040726 0.034439519 0.0288418997 0.0205805078 0.00932292547 0.0049314308 0.0217419192 0.0401509814 0.0586569346 0.0752408206 0.0874517262 0.0925453156 0.0876695216 0.0700836107 0.0373938456 0.0122130783 0.0797589198 0.165304333 0.26783672 0.385229737 0.514279544 0.650821209 0.7899189 0.926120281 1.05375755 1.1672765 1.26156819 1.3322829 1.37610149 1.39094377 1.37610137 1.33228302 1.26156807 1.16727638 1.05375767 0.926120341 0.789918959 0.650821209 0.514279485 0.385229737 0.26783669 0.165304318 0.0797589496 0.0122130318 0.0373938382 0.0700836107 0.0876694694 0.0925453454 0.087451674 0.075240761 0.0586568229 0.0401509628 0.0217419155 0.0049314308 0.00932296645 0.0205804501 0.0288419183 0.0344394855 0.0379040278 0.0398286693 0.0407414138 </row> + <row>0.0446299352 0.0443270989 0.0432998687 0.0412148312 0.0375857055 0.0318692997 0.0235865358 0.0124503179 0.00150867843 0.0178391449 0.0355984867 0.053328611 0.0690827817 0.0805075169 0.0849758983 0.0797648951 0.0622647181 0.0302025825 0.0181343481 0.0836988986 0.166522682 0.265610546 0.378902793 0.503310978 0.634829938 0.768720329 0.899751663 1.0224911 1.13161683 1.22223604 1.29018402 1.3322829 1.34654188 1.3322829 1.29018402 1.22223616 1.13161683 1.0224911 0.899751604 0.768720269 0.634829938 0.503310978 0.378902823 0.265610516 0.166522652 0.0836988911 0.0181343257 0.0302026216 0.0622647181 0.0797649175 0.0849758908 0.0805074498 0.0690828338 0.0533287078 0.0355985351 0.0178391207 0.00150867843 0.0124502676 0.0235865563 0.0318693221 0.0375857241 0.0412148796 0.0432998538 0.0443270765 </row> + <row>0.0515695661 0.0511759147 0.0498928837 0.0474351682 0.043389529 0.0373017937 0.0287853293 0.0176365003 0.00394671271 0.0118058389 0.0286943242 0.0453236513 0.0598583743 0.0700993538 0.0736083835 0.067871958 0.0504941754 0.0194023866 0.0269489009 0.0893949866 0.167914659 0.261535078 0.368299037 0.485300124 0.608788133 0.73433876 0.857079566 0.971956313 1.07402384 1.15873885 1.22223628 1.26156819 1.27488828 1.26156819 1.22223616 1.15873873 1.07402384 0.971956253 0.857079506 0.73433882 0.608788133 0.485300153 0.368299037 0.261535108 0.167914674 0.0893949866 0.0269488841 0.0194023233 0.0504941754 0.067871958 0.0736083686 0.0700993463 0.059858378 0.0453237109 0.0286943316 0.0118058249 0.00394671271 0.0176364686 0.0287853368 0.0373017639 0.0433894992 0.0474351645 0.0498928763 0.0511759259 </row> + <row>0.0630530715 0.0624893494 0.0607208051 0.0575341173 0.052626051 0.0456772409 0.0364437327 0.0248533972 0.0110995565 0.00428371457 0.020373119 0.0358436257 0.0489970446 0.0578342415 0.0601666495 0.0537625961 0.0365174748 0.00663444307 0.0371975601 0.0956449285 0.168603644 0.255118698 0.353359222 0.460653394 0.573584735 0.688145638 0.799938977 0.904416323 0.997136176 1.07402384 1.13161695 1.1672765 1.1793505 1.1672765 1.13161683 1.07402384 0.997136116 0.904416323 0.799938917 0.688145638 0.573584735 0.460653394 0.353359193 0.255118668 0.168603644 0.0956449285 0.037197534 0.00663443003 0.0365174748 0.0537626036 0.0601666532 0.0578342155 0.0489970818 0.0358436294 0.0203731507 0.00428372808 0.0110995565 0.0248533841 0.0364437141 0.0456772335 0.0526260138 0.0575340614 0.06072082 0.0624893196 </row> + <row>0.0805943534 0.0797449797 0.0771542639 0.0727081001 0.0662561953 0.0576684214 0.0469037406 0.0340821408 0.0195540097 0.00395284733 0.0117731458 0.0263592601 0.0382558331 0.0456937701 0.0467822589 0.0396326222 0.0225008894 0.00606299937 0.0470696837 0.100962162 0.167516142 0.245779008 0.334055036 0.429940999 0.530412495 0.631956875 0.730747283 0.822844565 0.904416323 0.971956372 1.0224911 1.05375755 1.06434035 1.05375767 1.02249122 0.971956372 0.904416323 0.822844625 0.730747283 0.631956875 0.530412495 0.429941058 0.334055036 0.245779008 0.167516142 0.100962155 0.0470696539 0.00606298167 0.0225008894 0.039632611 0.0467822365 0.0456937365 0.0382557809 0.0263592284 0.011773116 0.00395284081 0.0195540097 0.0340821557 0.0469037145 0.0576684475 0.0662562475 0.0727081001 0.077154249 0.079744935 </row> + <row>0.10580299 0.104515478 0.10065525 0.0942385867 0.085316807 0.0740110353 0.0605537407 0.045330137 0.0289165284 0.0121053904 0.00408509374 0.0184239708 0.0295030531 0.035796985 0.0357450806 0.0278495643 0.0107860155 0.0164845362 0.0546087399 0.103749536 0.163518026 0.232936293 0.310436159 0.39389649 0.480718821 0.567938626 0.652365863 0.730747223 0.799938917 0.857079506 0.899751663 0.926120281 0.935039639 0.926120281 0.899751663 0.857079506 0.799938917 0.730747283 0.652365923 0.567938566 0.480718821 0.393896461 0.310436189 0.232936293 0.163518012 0.103749536 0.0546087436 0.0164845437 0.0107860155 0.0278495364 0.0357450806 0.0357970037 0.0295030419 0.0184239969 0.00408514962 0.0121054174 0.0289165284 0.0453301705 0.0605537891 0.0740110427 0.0853167474 0.0942385122 0.100655302 0.104515456 </row> + <row>0.140178084 0.138266861 0.132591888 0.123333029 0.110796385 0.0954224393 0.0777956098 0.0586489029 0.0388655774 0.0194705129 0.00161213533 0.0134684406 0.0244804025 0.0301382728 0.0292269383 0.0206725691 0.00361675792 0.0225131493 0.0579410307 0.10249266 0.15556471 0.21611537 0.282680035 0.353411824 0.42614758 0.498495013 0.567938626 0.631956875 0.688145638 0.73433876 0.768720269 0.7899189 0.79708159 0.789918959 0.768720269 0.73433882 0.688145578 0.631956935 0.567938566 0.498494983 0.42614758 0.353411853 0.282680005 0.216115385 0.15556471 0.102492645 0.0579410121 0.0225131698 0.00361675792 0.0206725709 0.0292269327 0.0301382747 0.0244803838 0.013468435 0.0016121146 0.019470524 0.0388655774 0.0586489141 0.0777956098 0.095422484 0.11079637 0.123333059 0.132591948 0.138266802 </row> + <row>0.184899196 0.182155579 0.174051613 0.160965011 0.14351058 0.122518979 0.0990087315 0.0741489455 0.0492182672 0.0255569089 0.00451593427 0.0125957178 0.024564622 0.0303245522 0.0290046372 0.0199716836 0.00286527979 0.0223770719 0.0555051155 0.0959533751 0.142851368 0.195046321 0.251138628 0.309528649 0.368472755 0.42614758 0.480718821 0.530412495 0.573584735 0.608788133 0.634829998 0.650821209 0.656213403 0.650821209 0.634829998 0.608788133 0.573584735 0.530412495 0.480718821 0.42614758 0.368472755 0.309528649 0.251138628 0.195046321 0.142851368 0.0959533751 0.0555051155 0.0223770719 0.00286527979 0.0199716836 0.0290046372 0.0303245522 0.024564622 0.0125957178 0.00451593427 0.0255569089 0.0492182672 0.0741489455 0.0990087315 0.122518979 0.14351058 0.160965011 0.174051613 0.182155579 </row> + <row>0.240637109 0.236844197 0.225671574 0.207727224 0.1839865 0.155738324 0.124515481 0.0920106769 0.0599873848 0.0301876403 0.00424403511 0.0163995977 0.0305550415 0.0373400487 0.0362106003 0.0269740112 0.00978387333 0.0148824025 0.0462600812 0.0833447427 0.124947302 0.169752255 0.216376081 0.263421953 0.309528679 0.353411853 0.39389649 0.429941088 0.460653394 0.485300183 0.503311038 0.514279544 0.517962694 0.514279604 0.503311038 0.485300153 0.460653454 0.429941058 0.39389649 0.353411853 0.309528679 0.263421953 0.216376081 0.169752255 0.124947287 0.0833447352 0.0462600738 0.0148823988 0.00978387333 0.026974 0.0362106077 0.0373400673 0.0305550657 0.0163995791 0.00424402347 0.0301876366 0.0599873848 0.0920106843 0.124515526 0.155738309 0.18398647 0.207727194 0.225671545 0.236844242 </row> + <row>0.307403237 0.302354336 0.287502199 0.2637133 0.232368335 0.195274219 0.154548973 0.11248754 0.0714210495 0.0335757807 0.000944168889 0.0248248037 0.0425085053 0.0513620824 0.0511364602 0.042062968 0.0248079151 0.00040160332 0.0298508164 0.0644691512 0.101900369 0.140614852 0.179190129 0.216376066 0.251138687 0.282680035 0.310436189 0.334055096 0.353359252 0.368299007 0.378902853 0.385229737 0.387331963 0.385229766 0.378902853 0.368299007 0.353359222 0.334055096 0.310436189 0.282680035 0.251138687 0.216376066 0.179190114 0.140614852 0.101900369 0.0644691437 0.0298508219 0.000401596451 0.0248079151 0.042062968 0.0511364676 0.0513620786 0.0425085202 0.0248247962 0.000944167376 0.0335757881 0.0714210495 0.112487495 0.154548928 0.195274293 0.23236838 0.2637133 0.287502229 0.302354276 </row> + <row>0.384452492 0.377971619 0.358919054 0.328439951 0.28835386 0.241029799 0.189225465 0.135900185 0.0840196684 0.0363641605 0.00464460766 0.037085671 0.0596406013 0.0716483742 0.0731111169 0.064651981 0.0474305823 0.023024261 0.00671346672 0.0398052931 0.0743001625 0.108408883 0.140614867 0.16975224 0.195046335 0.2161154 0.232936308 0.245779037 0.255118728 0.261535108 0.265610605 0.267836779 0.268540621 0.26783675 0.265610576 0.261535108 0.255118698 0.245779052 0.232936308 0.2161154 0.195046335 0.169752225 0.140614867 0.108408876 0.0743001625 0.0398052856 0.0067134737 0.0230242722 0.0474305823 0.0646520033 0.0731111094 0.0716483667 0.0596406236 0.0370856635 0.00464461884 0.0363641717 0.0840196684 0.135900155 0.189225435 0.241029814 0.288353771 0.328439921 0.358919054 0.377971619 </row> + <row>0.47025156 0.46221441 0.438591808 0.400817454 0.351166219 0.292592764 0.228524357 0.162621111 0.0985262096 0.0396220498 0.0111875683 0.051653903 0.0803058296 0.0965101793 0.100467891 0.0931474939 0.0761642009 0.0516159572 0.0218913946 0.0105332239 0.0432912335 0.0743001774 0.101900361 0.124947295 0.142851382 0.155564725 0.163518026 0.167516172 0.168603629 0.167914674 0.166522622 0.165304303 0.164831966 0.165304318 0.166522622 0.167914674 0.168603629 0.167516172 0.163518026 0.15556474 0.142851382 0.124947287 0.101900376 0.0743001774 0.0432912372 0.0105332229 0.0218913946 0.0516159534 0.0761642009 0.0931474939 0.100467898 0.0965101793 0.0803058445 0.0516539104 0.0111875627 0.0396220461 0.0985262096 0.162621111 0.228524342 0.292592764 0.351166189 0.400817484 0.438591838 0.46221441 </row> + <row>0.562517822 0.55287081 0.524516404 0.479173541 0.419568032 0.349236786 0.272275567 0.193048999 0.115888357 0.0447970964 0.0168107152 0.0663207173 0.102062605 0.123377681 0.130607858 0.125008464 0.108594917 0.0839376673 0.0539238788 0.021507293 0.0105332127 0.0398053043 0.0644691661 0.0833447576 0.0959534124 0.102492683 0.103749543 0.100962199 0.0956449732 0.0893950015 0.0836988986 0.0797589868 0.0783555657 0.0797589943 0.0836989284 0.0893949643 0.0956449807 0.100962214 0.103749558 0.102492675 0.0959534124 0.0833447501 0.0644691586 0.0398053117 0.0105332071 0.0215072874 0.0539239012 0.0839376822 0.108594917 0.125008449 0.130607843 0.123377688 0.102062613 0.0663207248 0.0168107022 0.044797089 0.115888357 0.193049029 0.272275567 0.349236786 0.419568062 0.479173601 0.524516404 0.55287081 </row> + <row>0.658328176 0.647103906 0.614109159 0.561329782 0.491914451 0.409947395 0.320155919 0.227574527 0.13719447 0.0536235534 0.0192162972 0.0783313513 0.121821351 0.148955598 0.160157502 0.156900972 0.141529679 0.1170168 0.0866868123 0.0539239086 0.0218914207 0.00671347464 0.0298507959 0.0462600589 0.0555051342 0.0579410195 0.0546087585 0.0470697433 0.0371975563 0.0269488655 0.0181343481 0.0122130848 0.0101303179 0.0122130997 0.0181343593 0.026948886 0.0371975675 0.0470696948 0.0546087511 0.0579410344 0.0555051342 0.0462600701 0.0298508052 0.00671346067 0.0218914282 0.0539239198 0.0866868272 0.11701677 0.141529679 0.156900957 0.160157517 0.148955554 0.121821359 0.0783313587 0.0192162842 0.0536235571 0.13719447 0.227574527 0.320155919 0.409947366 0.491914421 0.561329722 0.614109159 0.647103906 </row> + <row>0.754290819 0.741618037 0.704356909 0.644725978 0.566243052 0.473471463 0.371694177 0.266538739 0.163586348 0.0679925829 0.015850259 0.0845833644 0.136065722 0.16945906 0.1852106 0.184937552 0.171225265 0.147359654 0.11701677 0.0839376822 0.0516159683 0.0230242573 0.000401602185 0.0148823932 0.0223770794 0.0225131642 0.0164845195 0.00606303103 0.00663443049 0.0194023941 0.0302026328 0.037393868 0.0399134308 0.0373938568 0.030202629 0.0194024071 0.0066344412 0.00606304035 0.0164845176 0.0225131568 0.0223770794 0.0148824016 0.000401603233 0.0230242666 0.0516159721 0.0839376822 0.117016777 0.147359669 0.171225265 0.184937552 0.185210645 0.16945903 0.136065707 0.0845833868 0.0158502813 0.0679925755 0.163586348 0.266538739 0.371694207 0.473471522 0.566243052 0.644726038 0.704356968 0.741618037 </row> + <row>0.846767128 0.832873404 0.792011797 0.726582825 0.640394151 0.538386822 0.426284134 0.310187757 0.196155861 0.0897940323 0.00410906365 0.0818741694 0.141131207 0.180912524 0.201636165 0.204983279 0.193682849 0.171225265 0.141529664 0.108594939 0.0761642158 0.0474305786 0.0248079188 0.00978387892 0.00286526931 0.00361675094 0.0107860174 0.0225008596 0.0365174785 0.0504942089 0.0622647442 0.0700836107 0.072820276 0.0700836107 0.0622647442 0.0504942089 0.0365174785 0.0225008596 0.0107860174 0.00361675094 0.00286526931 0.00978387892 0.0248079188 0.0474305786 0.0761642158 0.108594939 0.141529664 0.171225265 0.193682849 0.204983279 0.201636165 0.180912524 0.141131207 0.0818741694 0.00410906365 0.0897940323 0.196155861 0.310187757 0.426284134 0.538386822 0.640394151 0.726582825 0.792011797 0.832873404 </row> + <row>0.932125688 0.917333305 0.873815536 0.804089904 0.712150872 0.603184998 0.483204633 0.358626693 0.23583284 0.120742254 0.0184302088 0.067178078 0.133518323 0.179487094 0.205427259 0.213003889 0.204983279 0.184937567 0.156900972 0.125008464 0.0931475088 0.0646519959 0.0420629829 0.0269740112 0.0199716929 0.0206725765 0.0278495736 0.0396325886 0.0537626222 0.0678720102 0.0797649696 0.0876695365 0.0904368609 0.087669529 0.0797650069 0.0678720102 0.053762611 0.0396325998 0.0278495625 0.0206725821 0.0199716929 0.0269740205 0.0420629792 0.064651981 0.0931475163 0.125008479 0.156900957 0.184937552 0.204983279 0.213003874 0.205427274 0.179487094 0.133518353 0.0671780929 0.0184302349 0.120742247 0.23583284 0.358626693 0.483204603 0.603184998 0.712150812 0.804089844 0.873815536 0.917333364 </row> + <row>1.00700891 0.991722167 0.946734846 0.874603927 0.779388487 0.666362405 0.541644931 0.411776483 0.283274114 0.162200004 0.0537755229 0.0379301123 0.110214919 0.161848724 0.193062499 0.205427274 0.201636195 0.185210645 0.160157502 0.130607873 0.10046792 0.0731111243 0.0511364639 0.0362105966 0.0290046036 0.0292268973 0.0357450359 0.0467821732 0.060166616 0.0736083537 0.0849758834 0.0925453082 0.095197618 0.0925453156 0.0849758759 0.0736083835 0.0601666234 0.046782162 0.0357450247 0.0292268936 0.0290046036 0.036210604 0.0511364713 0.0731111094 0.10046792 0.130607873 0.160157502 0.18521066 0.201636195 0.205427319 0.193062454 0.161848769 0.110214934 0.0379300788 0.053775534 0.162199989 0.283274114 0.411776423 0.541644931 0.666362345 0.779388487 0.874603927 0.946734786 0.991722167 </row> + <row>1.06858814 1.0532738 1.00818777 0.935840666 0.840219796 0.726509869 0.600733519 0.469338089 0.338762492 0.215016186 0.103301488 0.00770814158 0.0689993724 0.125487655 0.161848724 0.179487124 0.180912554 0.169459045 0.148955584 0.123377718 0.0965102166 0.0716483742 0.0513620973 0.0373400636 0.0303245466 0.0301382616 0.0357969813 0.0456936993 0.0578342229 0.0700993612 0.0805075169 0.0874517262 0.0898871198 0.0874517262 0.0805075318 0.0700993165 0.0578342229 0.0456937067 0.0357969813 0.0301382616 0.0303245466 0.0373400673 0.0513620824 0.0716483817 0.0965102166 0.123377725 0.148955584 0.16945906 0.180912554 0.179487109 0.161848724 0.125487655 0.068999365 0.00770815415 0.10330148 0.215016171 0.338762492 0.469338059 0.600733519 0.726509869 0.840219796 0.935840607 1.00818777 1.0532738 </row> + <row>1.11478686 1.09994841 1.05624247 0.986043811 0.893124938 0.782396078 0.659568489 0.530767381 0.402126282 0.279391438 0.167566434 0.070623666 0.00869856402 0.068999365 0.110214911 0.133518383 0.141131207 0.136065707 0.121821359 0.102062628 0.0803058445 0.059640605 0.0425085276 0.030555049 0.024564622 0.024480382 0.0295030251 0.0382557511 0.0489970669 0.0598583892 0.0690828264 0.0752407908 0.077401109 0.0752407834 0.0690828338 0.0598583892 0.0489970669 0.0382557474 0.0295030288 0.024480382 0.024564622 0.0305550508 0.0425085276 0.059640605 0.0803058371 0.102062635 0.121821366 0.136065722 0.141131207 0.133518368 0.110214911 0.068999365 0.00869856961 0.0706236586 0.167566434 0.279391408 0.402126282 0.530767381 0.659568429 0.782396138 0.893124938 0.986043751 1.05624247 1.09994829 </row> + <row>1.14445257 1.1305989 1.08977067 1.02411675 0.937054455 0.833035648 0.71724695 0.5952636 0.472685993 0.354784966 0.246182352 0.150589794 0.0706236809 0.0077081318 0.0379300639 0.0671781078 0.0818741769 0.0845833868 0.0783313736 0.0663207397 0.0516539253 0.0370856859 0.0248248093 0.0163995866 0.0125957113 0.0134684257 0.0184239671 0.0263591856 0.0358435996 0.0453236662 0.0533286445 0.0586568676 0.0605237484 0.0586568676 0.0533286519 0.0453236848 0.0358436145 0.0263592023 0.0184239633 0.0134684322 0.0125957113 0.0163995847 0.0248248074 0.0370856859 0.0516539142 0.0663207397 0.0783313736 0.0845833644 0.0818741769 0.0671781078 0.0379300751 0.00770815788 0.0706236735 0.150589779 0.246182367 0.354784966 0.472685993 0.5952636 0.71724695 0.833035648 0.937054515 1.02411675 1.08977056 1.13059902 </row> + <row>1.15745986 1.14507329 1.10854161 1.04970586 0.971496642 0.877737641 0.772892594 0.66177386 0.549235225 0.439872324 0.337750643 0.246182352 0.167566463 0.10330148 0.0537755825 0.018430246 0.00410904316 0.0158502478 0.0192162823 0.0168106891 0.0111875618 0.00464460859 0.000944184081 0.00424404116 0.00451593846 0.00161215605 0.00408510864 0.011773088 0.0203731824 0.0286943056 0.0355985165 0.0401510075 0.0417394675 0.0401509888 0.0355985314 0.0286942944 0.0203731768 0.011773116 0.00408511423 0.00161215442 0.00451593846 0.0042440379 0.000944189727 0.00464460813 0.0111875646 0.0168106798 0.019216286 0.0158502385 0.00410904316 0.0184302311 0.0537755787 0.103301488 0.167566463 0.246182367 0.337750643 0.439872354 0.549235225 0.661773741 0.772892594 0.877737522 0.971496701 1.04970586 1.10854149 1.14507329 </row> + <row>1.15473616 1.14423966 1.11324799 1.06322503 0.996502697 0.916130424 0.825678885 0.729014158 0.630059302 0.53256011 0.439872354 0.354784966 0.279391438 0.215016186 0.162200049 0.120742247 0.0897940397 0.0679925829 0.0536235422 0.0447971001 0.0396220647 0.0363641679 0.0335757956 0.0301875994 0.0255568847 0.0194705427 0.0121054249 0.00395283056 0.00428375881 0.0118058883 0.017839184 0.0217419509 0.0230919439 0.0217419583 0.0178391747 0.0118058734 0.00428374531 0.0039528436 0.0121054146 0.019470565 0.0255568847 0.0301876143 0.0335757956 0.0363641754 0.0396220647 0.0447970964 0.0536235422 0.0679925904 0.0897940397 0.120742247 0.162200049 0.215016186 0.279391438 0.354784966 0.439872295 0.53256011 0.630059302 0.729014218 0.825678945 0.916130424 0.996502817 1.06322503 1.11324799 1.14423966 </row> + <row>1.13820732 1.12993288 1.10546076 1.06582308 1.01266861 0.948160946 0.874847829 0.795508385 0.712992072 0.630059302 0.549235225 0.472685993 0.402126342 0.338762492 0.283274114 0.235832855 0.196155861 0.163586363 0.137194455 0.115888372 0.0985262096 0.0840196759 0.0714210421 0.0599873699 0.0492182523 0.0388655923 0.0289165396 0.0195539873 0.0110995481 0.00394662423 0.001508769 0.00493148342 0.00609843805 0.00493148342 0.001508769 0.00394662423 0.0110995481 0.0195539873 0.0289165396 0.0388655923 0.0492182523 0.0599873699 0.0714210421 0.0840196759 0.0985262096 0.115888372 0.137194455 0.163586363 0.196155861 0.235832855 0.283274114 0.338762492 0.402126342 0.472685993 0.549235225 0.630059302 0.712992072 0.795508385 0.874847829 0.948160946 1.01266861 1.06582308 1.10546076 1.12993288 </row> + <row>1.11066151 1.10482633 1.08751333 1.05929112 1.02107286 0.974068701 0.919723153 0.859640956 0.795508385 0.729014158 0.661773801 0.59526366 0.530767381 0.469338089 0.411776453 0.358626693 0.310187757 0.266538739 0.227574497 0.193049014 0.162621111 0.13590017 0.11248754 0.0920106918 0.0741489232 0.0586489215 0.045330178 0.0340821482 0.0248533674 0.0176365003 0.0124502638 0.00932292547 0.00827755313 0.00932293665 0.0124502704 0.0176364463 0.0248533748 0.0340821557 0.0453302339 0.0586489141 0.0741489232 0.0920106769 0.11248754 0.13590014 0.162621111 0.193049029 0.227574512 0.266538709 0.310187757 0.358626664 0.411776453 0.46933803 0.530767381 0.595263541 0.661773801 0.729014218 0.795508385 0.859640896 0.919723153 0.974068701 1.02107286 1.05929112 1.08751333 1.10482633 </row> + <row>1.07554698 1.0722338 1.06232572 1.0459187 1.02317655 0.994336963 0.959717751 0.919723272 0.874847889 0.825678945 0.772892654 0.71724695 0.659568489 0.600733519 0.541644931 0.483204603 0.426284134 0.371694177 0.320155889 0.272275507 0.228524312 0.18922542 0.154548958 0.124515451 0.099008657 0.0777955651 0.0605537482 0.046903681 0.0364436433 0.0287852734 0.0235864297 0.0205804147 0.0195977222 0.0205804203 0.0235864557 0.0287852734 0.0364436619 0.046903681 0.0605537295 0.0777955502 0.099008657 0.124515459 0.154548958 0.18922542 0.228524312 0.272275537 0.320155889 0.371694148 0.426284134 0.483204633 0.541644931 0.600733519 0.659568429 0.71724689 0.772892594 0.825678945 0.874847889 0.919723213 0.95971781 0.994336903 1.02317667 1.04591882 1.06232584 1.07223392 </row> + <row>1.0367136 1.03586161 1.03318083 1.02831161 1.0206939 1.00962603 0.994336963 0.97406882 0.948160946 0.916130483 0.877737701 0.833035648 0.782396078 0.726509869 0.666362405 0.603185117 0.538386881 0.473471493 0.409947395 0.349236816 0.292592734 0.241029769 0.195274293 0.155738354 0.122518972 0.0954224914 0.0740110949 0.057668481 0.0456772298 0.0373017751 0.0318693183 0.0288418997 0.0278727245 0.0288419239 0.0318693221 0.0373018123 0.0456772298 0.0576684475 0.0740110651 0.0954225063 0.122518972 0.155738324 0.195274293 0.241029769 0.292592734 0.349236816 0.409947395 0.473471493 0.538386881 0.603185058 0.666362464 0.726509869 0.782396078 0.833035648 0.877737641 0.916130483 0.948160946 0.97406882 0.994336963 1.00962603 1.0206939 1.02831161 1.03318083 1.03586149 </row> + <row>0.99812144 0.99952507 1.00346971 1.00918102 1.0154413 1.02069378 1.02317655 1.02107275 1.01266861 0.996502697 0.971496582 0.937054396 0.893124878 0.840219796 0.779388428 0.712150812 0.640394092 0.566242933 0.491914421 0.419568002 0.351166129 0.288353741 0.232368365 0.18398644 0.143510491 0.110796392 0.0853167549 0.0662561506 0.0526259467 0.0433894582 0.0375856422 0.0344394594 0.0334486291 0.0344394371 0.0375856236 0.0433895215 0.0526259542 0.0662561804 0.08531674 0.110796385 0.143510491 0.18398644 0.23236835 0.288353741 0.351166129 0.419568002 0.491914392 0.566242993 0.640394092 0.712150812 0.779388428 0.840219736 0.893124878 0.937054396 0.971496582 0.996502697 1.01266861 1.02107275 1.02317655 1.02069378 1.0154413 1.00918102 1.00346971 0.99952507 </row> + <row>0.963537633 0.966856539 0.976427794 0.991127014 1.00918102 1.02831149 1.0459187 1.05929112 1.06582308 1.06322503 1.04970586 1.02411675 0.986043751 0.935840607 0.874603927 0.804089904 0.726582825 0.644725919 0.561329782 0.479173541 0.400817484 0.328439951 0.26371336 0.207727239 0.16096504 0.123333141 0.0942385644 0.0727081001 0.0575341173 0.0474352054 0.0412149169 0.03790408 0.0368731096 0.0379040688 0.0412149094 0.0474352241 0.0575340949 0.0727080703 0.0942385942 0.123333082 0.16096504 0.207727239 0.26371333 0.328439921 0.400817484 0.479173541 0.561329722 0.644725978 0.726582825 0.804089904 0.874603868 0.935840607 0.986043751 1.02411675 1.04970586 1.06322503 1.06582308 1.05929112 1.0459187 1.02831149 1.00918102 0.991127074 0.976427794 0.96685648 </row> + <row>0.936245978 0.941023767 0.954880953 0.976427794 1.00346982 1.03318083 1.06232584 1.08751345 1.10546076 1.11324799 1.10854149 1.08977056 1.05624247 1.00818777 0.946734846 0.873815596 0.792011797 0.704356909 0.614109159 0.524516463 0.438591838 0.358919054 0.287502319 0.225671604 0.174051598 0.132591948 0.100655317 0.0771542639 0.0607208312 0.0498929992 0.0432998426 0.0398287065 0.0387553349 0.0398286656 0.0432998538 0.0498929583 0.0607208386 0.077154249 0.100655317 0.132591948 0.174051598 0.225671604 0.287502319 0.358919114 0.438591868 0.524516404 0.614109099 0.704356849 0.792011797 0.873815536 0.946734846 1.00818765 1.05624247 1.08977056 1.10854149 1.11324799 1.10546076 1.08751345 1.06232584 1.03318071 1.00346982 0.976427853 0.954881012 0.941023767 </row> + <row>0.918793559 0.924484372 0.941023707 0.966856539 0.99952507 1.03586149 1.0722338 1.10482633 1.12993288 1.14423954 1.14507341 1.1305989 1.09994829 1.05327368 0.991722167 0.917333305 0.832873344 0.741617918 0.647103906 0.55287075 0.462214321 0.3779715 0.302354306 0.236844122 0.18215546 0.138266832 0.104515433 0.0797448903 0.0624892302 0.0511758178 0.0443270393 0.0407414287 0.0396365114 0.0407413244 0.0443270057 0.0511758439 0.0624892265 0.0797448978 0.104515404 0.138266832 0.18215546 0.236844137 0.302354306 0.37797156 0.462214351 0.552870691 0.647103846 0.741617918 0.832873344 0.917333364 0.991722167 1.05327368 1.09994829 1.1305989 1.14507318 1.14423954 1.12993288 1.10482633 1.0722338 1.03586137 0.999525011 0.96685648 0.941023707 0.924484253 </row> + </matrix> + </sheet> + <sheet number='1' name='unnamed'> + <matrix-string title='sheet1' rows='10' cols='10' data-channel='0'> + </matrix-string> + </sheet> + </sheets> + <page number='0' title='Page 1'> + <axes3d> + <area xmm='80' ymm='35' wmm='110' hmm='95'/> + <draw-in-background enabled='1'/> + <title-attributes> + </title-attributes> + <background-attributes> + <fill element-number='-1' style='transparent' color='ff000000'/> + </background-attributes> + <opengl enabled='0' enable-transparency='0' global-transparency='0' shade-walls='1' auto-stroke='1' auto-stroke-lightness='-45'/> + <wall-thickness xy='0.05' xz='0' yz='0'/> + <edge-length x='1' y='1' z='0.75'/> + <viewpoint azimuth='54' elevation='30' distance='0'/> + <light enabled='1' azimuth='135' elevation='30' ambient-intensity='10' directed-intensity='0'/> + <perspective enabled='1' focus-distance='35'/> + <autoscale enabled='1'/> + <axis type='X' visible='1' scrollable='1'> + <dart element-number='1' style='none' size='3' /> + <dart element-number='2' style='filled' size='3' /> + <display position='0.05' default='0' opposite='0' /> + <range min='0' max='0' rounded='0'/> + <scale type='linear' base='64' reversed='0'/> + <grid-step major='-4' minor='-20'/> + <tics format='(TIC)' visible='1' outer='0' angle='0' pos1='0.01' pos2='0.01'/> + <title-position pos='0.5' distance='0.05'/> + <remembered-view number='0' min='0' max='0' scale='linear' base='10' reversed='0' rounded='0'/> + <remembered-view number='1' min='0' max='0' scale='linear' base='10' reversed='0' rounded='0'/> + <remembered-view number='2' min='0' max='0' scale='linear' base='10' reversed='0' rounded='0'/> + <title text='X'/> + <line element-number='0' style='solid' width='0' color='ff000000'/> + <line element-number='1' style='invisible' width='0' color='ff000000'/> + <line element-number='2' style='invisible' width='0' color='ff000000'/> + <font element-number='0' family='helvetica' size='10' bold='0' italic='0' color='ff000000'/> + <font element-number='1' family='helvetica' size='10' bold='0' italic='0' color='ff000000'/> + </axis> + <axis type='Y' visible='1' scrollable='1'> + <dart element-number='1' style='none' size='3' /> + <dart element-number='2' style='filled' size='3' /> + <display position='0.05' default='0' opposite='0' /> + <range min='0' max='0' rounded='0'/> + <scale type='linear' base='64' reversed='0'/> + <grid-step major='-4' minor='-20'/> + <tics format='(TIC)' visible='1' outer='0' angle='0' pos1='0.01' pos2='0.01'/> + <title-position pos='0.5' distance='0.05'/> + <remembered-view number='0' min='0' max='0' scale='linear' base='10' reversed='0' rounded='0'/> + <remembered-view number='1' min='0' max='0' scale='linear' base='10' reversed='0' rounded='0'/> + <remembered-view number='2' min='0' max='0' scale='linear' base='10' reversed='0' rounded='0'/> + <title text='Y'/> + <line element-number='0' style='solid' width='0' color='ff000000'/> + <line element-number='1' style='invisible' width='0' color='ff000000'/> + <line element-number='2' style='invisible' width='0' color='ff000000'/> + <font element-number='0' family='helvetica' size='10' bold='0' italic='0' color='ff000000'/> + <font element-number='1' family='helvetica' size='10' bold='0' italic='0' color='ff000000'/> + </axis> + <axis type='Z' visible='1' scrollable='1'> + <dart element-number='1' style='none' size='3' /> + <dart element-number='2' style='filled' size='3' /> + <display position='0.05' default='0' opposite='0' /> + <range min='0' max='0' rounded='0'/> + <scale type='log' base='10' reversed='0'/> + <grid-step major='-4' minor='-20'/> + <tics format='10<sup>(TIC TYPE="X" FORMAT="%g")</sup>' visible='1' outer='0' angle='0' pos1='0.01' pos2='0.01'/> + <title-position pos='1.1' distance='0.05'/> + <remembered-view number='0' min='0' max='0' scale='linear' base='10' reversed='0' rounded='0'/> + <remembered-view number='1' min='0' max='0' scale='linear' base='10' reversed='0' rounded='0'/> + <remembered-view number='2' min='0' max='0' scale='linear' base='10' reversed='0' rounded='0'/> + <title text='Z'/> + <line element-number='0' style='solid' width='0' color='ff000000'/> + <line element-number='1' style='invisible' width='0' color='ff000000'/> + <line element-number='2' style='invisible' width='0' color='ff000000'/> + <font element-number='0' family='helvetica' size='10' bold='0' italic='0' color='ff000000'/> + <font element-number='1' family='helvetica' size='12' bold='1' italic='0' color='ff000000'/> + </axis> + <axis type='V' visible='1' scrollable='1'> + <dart element-number='1' style='none' size='3' /> + <dart element-number='2' style='none' size='3' /> + <display position='0' default='1' opposite='0' /> + <range min='0' max='0' rounded='0'/> + <scale type='log' base='10' reversed='0'/> + <grid-step major='-4' minor='-20'/> + <tics format='<TIC>' visible='1' outer='0' angle='0' pos1='0.01' pos2='0.01'/> + <title-position pos='0.5' distance='0.05'/> + <remembered-view number='0' min='0' max='0' scale='linear' base='10' reversed='0' rounded='0'/> + <remembered-view number='1' min='0' max='0' scale='linear' base='10' reversed='0' rounded='0'/> + <remembered-view number='2' min='0' max='0' scale='linear' base='10' reversed='0' rounded='0'/> + <title text='V'/> + <line element-number='0' style='solid' width='0' color='ff000000'/> + <line element-number='1' style='solid' width='0' color='ffa0a0a4'/> + <line element-number='2' style='invisible' width='0' color='ff000000'/> + <font element-number='0' family='helvetica' size='10' bold='0' italic='0' color='ff000000'/> + <font element-number='1' family='helvetica' size='10' bold='0' italic='0' color='ff000000'/> + </axis> + <title text=''/> + <line element-number='0' style='solid' width='0' color='ff000000'/> + <line element-number='1' style='solid' width='0' color='ff000000'/> + <line element-number='2' style='solid' width='0' color='ff606060'/> + <line element-number='3' style='solid' width='0' color='ff606060'/> + <line element-number='4' style='solid' width='0' color='ff606060'/> + <fill element-number='0' style='solid' color='ffffffff'/> + <fill element-number='1' style='solid' color='ffffffff'/> + <fill element-number='2' style='solid' color='ffe0e0e0'/> + <fill element-number='3' style='solid' color='fff0f0f0'/> + <fill element-number='4' style='solid' color='fff0f0f0'/> + <gridded-contour stack-order='0'> + <legend-item visible='1'/> + <default-axis x-axis='0' y-axis='1' z-axis='2' v-axis='3'/> + <gradient type='default'> + <fill element-number='0' style='solid' color='ff000080'/> + <fill element-number='1' style='solid' color='ff008000'/> + <fill element-number='2' style='solid' color='ffff0000'/> + <fill element-number='3' style='solid' color='ffffa000'/> + <fill element-number='4' style='solid' color='ffffffc4'/> + </gradient> + <filled enabled='0'/> + <lines enabled='1'/> + <labels enabled='0' spacing='0.2'/> + <title text='Untitled contour'/> + <line element-number='0' style='invisible' width='0' color='ff000000'/> + <point element-number='0' style='invisible' fill='transparent' size='9' color='ff000000'/> + <matrix-formula title='' formula='0:4:255' transposition='0' data-channel='0'/> + <matrix-formula title='' formula='(0:4:255)'' transposition='0' data-channel='1'/> + <matrixref title='' sheet='0' row-from='0' row-step='1' row-to='-1' col-from='0' col-step='1' col-to='-1' transposition='0' data-channel='2'/> + </gridded-contour> + <surface stack-order='1'> + <legend-item visible='1'/> + <default-axis x-axis='0' y-axis='1' z-axis='2' v-axis='3'/> + <gradient type='default'> + <fill element-number='0' style='solid' color='ff000080'/> + <fill element-number='1' style='solid' color='ff008000'/> + <fill element-number='2' style='solid' color='ffff0000'/> + <fill element-number='3' style='solid' color='ffffa000'/> + <fill element-number='4' style='solid' color='ffffffc4'/> + </gradient> + <grid x-step='1' y-step='1'/> + <autodivide enabled='1'/> + <colored enabled='1'/> + <topbottom enabled='1'/> + <edges autocolor='-50'/> + <title text='Untitled surface'/> + <line element-number='0' style='solid' width='0' color='ff3e3e3e'/> + <fill element-number='0' style='solid' color='ffffffff'/> + <fill element-number='1' style='solid' color='ffffffff'/> + <point element-number='0' style='invisible' fill='transparent' size='9' color='ff000000'/> + <matrix-formula title='' formula='0:4:255' transposition='0' data-channel='0'/> + <matrix-formula title='' formula='(0:4:255)'' transposition='0' data-channel='1'/> + <matrixref title='' sheet='0' row-from='0' row-step='1' row-to='-1' col-from='0' col-step='1' col-to='-1' transposition='0' data-channel='2'/> + </surface> + <label> + <text>SURFACE</text> + <angle deg='0'/> + <align text='9' frame='9'/> + <pos x='0.333141' y='-0.116524' z='0'/> + <coord-system x='1' y='1' z='1'/> + <shadow-shift x='5' y='5'/> + <font element-number='1' family='helvetica' size='24' bold='1' italic='0' color='ff000000'/> + <fill element-number='1' style='transparent' color='ffffffff'/> + <line element-number='1' style='invisible' width='0' color='ff000000'/> + <fill element-number='2' style='transparent' color='ff000000'/> + <axes-bindings x-axis='0' y-axis='1' z-axis='2'/> + </label> + </axes3d> + <axes2d> + <area xmm='130' ymm='150' wmm='65' hmm='65'/> + <draw-in-background enabled='1'/> + <title-attributes> + </title-attributes> + <background-attributes> + <fill element-number='-1' style='transparent' color='ff000000'/> + </background-attributes> + <frame width='1'/> + <axis type='X' visible='1' scrollable='1'> + <dart element-number='1' style='none' size='3' /> + <dart element-number='2' style='none' size='3' /> + <display position='0' default='1' opposite='0' /> + <range min='0' max='0' rounded='0'/> + <scale type='linear' base='10' reversed='0'/> + <grid-step major='-4' minor='-20'/> + <tics format='(TIC)' visible='1' outer='1' angle='0' pos1='0.01' pos2='0.01'/> + <title-position pos='0.5' distance='0.05'/> + <remembered-view number='0' min='0' max='0' scale='linear' base='10' reversed='0' rounded='0'/> + <remembered-view number='1' min='0' max='0' scale='linear' base='10' reversed='0' rounded='0'/> + <remembered-view number='2' min='0' max='0' scale='linear' base='10' reversed='0' rounded='0'/> + <title text='X'/> + <line element-number='0' style='solid' width='0' color='ff000000'/> + <line element-number='1' style='invisible' width='0' color='ff000000'/> + <line element-number='2' style='invisible' width='0' color='ff000000'/> + <font element-number='0' family='helvetica' size='10' bold='0' italic='0' color='ff000000'/> + <font element-number='1' family='helvetica' size='10' bold='0' italic='0' color='ff000000'/> + </axis> + <axis type='Y' visible='1' scrollable='1'> + <dart element-number='1' style='none' size='3' /> + <dart element-number='2' style='none' size='3' /> + <display position='0' default='1' opposite='0' /> + <range min='0' max='0' rounded='0'/> + <scale type='linear' base='10' reversed='0'/> + <grid-step major='-4' minor='-20'/> + <tics format='(TIC)' visible='1' outer='1' angle='0' pos1='0.01' pos2='0.01'/> + <title-position pos='0.5' distance='0.05'/> + <remembered-view number='0' min='0' max='0' scale='linear' base='10' reversed='0' rounded='0'/> + <remembered-view number='1' min='0' max='0' scale='linear' base='10' reversed='0' rounded='0'/> + <remembered-view number='2' min='0' max='0' scale='linear' base='10' reversed='0' rounded='0'/> + <title text='Y'/> + <line element-number='0' style='solid' width='0' color='ff000000'/> + <line element-number='1' style='invisible' width='0' color='ff000000'/> + <line element-number='2' style='invisible' width='0' color='ff000000'/> + <font element-number='0' family='helvetica' size='10' bold='0' italic='0' color='ff000000'/> + <font element-number='1' family='helvetica' size='10' bold='0' italic='0' color='ff000000'/> + </axis> + <axis type='Z' visible='1' scrollable='1'> + <dart element-number='1' style='none' size='3' /> + <dart element-number='2' style='none' size='3' /> + <display position='0' default='1' opposite='0' /> + <range min='0' max='0' rounded='0'/> + <scale type='linear' base='10' reversed='0'/> + <grid-step major='-4' minor='-20'/> + <tics format='<TIC>' visible='1' outer='0' angle='0' pos1='0.01' pos2='0.01'/> + <title-position pos='0.5' distance='0.05'/> + <remembered-view number='0' min='0' max='0' scale='linear' base='10' reversed='0' rounded='0'/> + <remembered-view number='1' min='0' max='0' scale='linear' base='10' reversed='0' rounded='0'/> + <remembered-view number='2' min='0' max='0' scale='linear' base='10' reversed='0' rounded='0'/> + <title text='Z'/> + <line element-number='0' style='solid' width='0' color='ff000000'/> + <line element-number='1' style='invisible' width='0' color='ff000000'/> + <line element-number='2' style='invisible' width='0' color='ff000000'/> + <font element-number='0' family='helvetica' size='10' bold='0' italic='0' color='ff000000'/> + <font element-number='1' family='helvetica' size='10' bold='0' italic='0' color='ff000000'/> + </axis> + <axis type='V' visible='1' scrollable='1'> + <dart element-number='1' style='none' size='3' /> + <dart element-number='2' style='none' size='3' /> + <display position='0' default='1' opposite='0' /> + <range min='0' max='0' rounded='0'/> + <scale type='linear' base='10' reversed='0'/> + <grid-step major='-4' minor='0'/> + <tics format='<TIC>' visible='1' outer='0' angle='0' pos1='0.01' pos2='0.01'/> + <title-position pos='0.5' distance='0.05'/> + <remembered-view number='0' min='0' max='0' scale='linear' base='10' reversed='0' rounded='0'/> + <remembered-view number='1' min='0' max='0' scale='linear' base='10' reversed='0' rounded='0'/> + <remembered-view number='2' min='0' max='0' scale='linear' base='10' reversed='0' rounded='0'/> + <title text='V'/> + <line element-number='0' style='solid' width='0' color='ff000000'/> + <line element-number='1' style='invisible' width='0' color='ff000000'/> + <line element-number='2' style='invisible' width='0' color='ff000000'/> + <font element-number='0' family='helvetica' size='10' bold='0' italic='0' color='ff000000'/> + <font element-number='1' family='helvetica' size='10' bold='0' italic='0' color='ff000000'/> + </axis> + <title text=''/> + <fill element-number='0' style='transparent' color='ff000000'/> + <fill element-number='1' style='solid' color='ff000000'/> + <image stack-order='0'> + <legend-item visible='1'/> + <default-axis x-axis='0' y-axis='1' z-axis='2' v-axis='3'/> + <gradient type='default'> + <fill element-number='0' style='solid' color='ff000080'/> + <fill element-number='1' style='solid' color='ff008000'/> + <fill element-number='2' style='solid' color='ffff0000'/> + <fill element-number='3' style='solid' color='ffffa000'/> + <fill element-number='4' style='solid' color='ffffffc4'/> + </gradient> + <raw-mode enabled='0'/> + <use-gradient enabled='1'/> + <title text='Untitled image'/> + <matrixref title='' sheet='0' row-from='0' row-step='1' row-to='-1' col-from='0' col-step='1' col-to='-1' transposition='0' data-channel='2'/> + </image> + <label> + <text><p>PIXMAP</p> </text> + <angle deg='0'/> + <align text='9' frame='9'/> + <pos x='0.273621' y='-0.183051' z='0'/> + <coord-system x='1' y='1' z='1'/> + <shadow-shift x='5' y='5'/> + <font element-number='1' family='helvetica' size='24' bold='1' italic='0' color='ff000000'/> + <fill element-number='1' style='transparent' color='ffffffff'/> + <line element-number='1' style='invisible' width='0' color='ff000000'/> + <fill element-number='2' style='transparent' color='ff000000'/> + <axes-bindings x-axis='0' y-axis='1' z-axis='2'/> + </label> + </axes2d> + <label> + <text><p>1. Pixmap and the contour graph use the V axis to show </p> <p><wsp> </wsp>data values. </p> </text> + <angle deg='0'/> + <align text='9' frame='9'/> + <pos x='15.0905' y='14.8929' z='0'/> + <coord-system x='1' y='1' z='1'/> + <shadow-shift x='5' y='5'/> + <font element-number='1' family='helvetica' size='10' bold='0' italic='0' color='ff000000'/> + <fill element-number='1' style='transparent' color='ffffffff'/> + <line element-number='1' style='invisible' width='0' color='ff000000'/> + <fill element-number='2' style='transparent' color='ff000000'/> + <axes-bindings x-axis='-1' y-axis='-1' z-axis='-1'/> + </label> + <label> + <text><p><b><u><font size="3" style="font-size:14pt">Importing data</font></u></b></p> <p>1. Choose<b><font size="3" style="font-size:12pt"> Windows/New window/Worksheets</font></b></p> <p><wsp> </wsp>from the main menu.</p> <p>2. Choose<b><font size="3" style="font-size:12pt"> Worksheet/New sheet </font></b></p> <p>3. Hightlight a new sheet<i><font size="3" style="font-size:12pt"> "Sheet: unnamed 10x10"</font></i><wsp> </wsp>on the </p> <p><wsp> </wsp>object list.</p> <p>4. Choose<b><font size="3" style="font-size:12pt"> Worksheet/Import Data/Import Octave, MAT1.0 </font></b></p> <p>5. Click Browse button and select a file. Some</p> <p><wsp> </wsp>example MAT and ASCII files are providen on </p> <p><wsp> </wsp>the web page.</p> <p>6. Contents of the file should appear on the list - highlihgt a matrix to be </p> <p><wsp> </wsp>loaded.</p> <p>8. Click "Import"</p> </text> + <angle deg='0'/> + <align text='9' frame='9'/> + <pos x='9.89444' y='185.144' z='0'/> + <coord-system x='1' y='1' z='1'/> + <shadow-shift x='5' y='5'/> + <font element-number='1' family='helvetica' size='10' bold='0' italic='0' color='ff000000'/> + <fill element-number='1' style='transparent' color='ffffffff'/> + <line element-number='1' style='invisible' width='0' color='ff000000'/> + <fill element-number='2' style='transparent' color='ff000000'/> + <axes-bindings x-axis='-1' y-axis='-1' z-axis='-1'/> + </label> + </page> + </canvas> +</kmatplot> diff --git a/kmatplot/formula/Makefile.am b/kmatplot/formula/Makefile.am new file mode 100644 index 0000000..53bfd52 --- /dev/null +++ b/kmatplot/formula/Makefile.am @@ -0,0 +1,30 @@ +INCLUDES = $(all_includes) + +noinst_LIBRARIES = libformula.a + +libformula_a_SOURCES = \ + mpsymbol.cpp \ + mpsymbols.cpp \ + mpparsersymbol.cpp \ + mpparser.cpp \ + mpformula.cpp \ + mpdelunay.cpp + +EXTRA_DIST = \ + mpsymbol.h \ + mpsymbols.h \ + mpparsersymbol.h \ + mpparser.cpp \ + mpparser.cpp.h \ + mpformula.h \ + make_parser.sh \ + gramdiag \ + mpdelunay.h + +# +#mpparser.cpp: mpparser.y +# bison -d -o mpparser.cpp mpparser.y +# + + + diff --git a/kmatplot/formula/gramdiag b/kmatplot/formula/gramdiag new file mode 100755 index 0000000000000000000000000000000000000000..461328a3f29abac83574e169b48b558a8d5f0471 GIT binary patch literal 28380 zcmchA4}28Wwf}^Sy3*JU8kF{7T@_le5ZGh`S)!FcS^g+UAOxf|T|=^A7n5w<Km2Kl z2E(G`u$s2g`ugm9SZSYat=Ja&)K(jX694qqBBgy)sZDGAbuh8TKSgVO-QV|n?#%84 zp?&ZD-scTW=A3)aJ@?#m&OP_eojbF)gci>)Dk{>PW0Y2`5gXX9djhzAYK_VXXg=+1 zZIX70HXc_^V_u*eG&uVJ^E?Zuj<Xo&TRf4+^8&y;nMdCF+K{K=ykUl>@nm_eROL(B zLFD1AMuEOtM@hZR9|f{^K>rT%c<utulX9^Ro*tC(Y}GwHeZYA-dDGfrYp1ofOl^yG zq&Jl(<K-1953EJD1=lqIQuVMd$~6Y(IGi4wAH>P_oQLyVoIFU!@;unSGMuAvUW9Wj z&U0{Hi1U1$XF6C9b$9APx!uPHTnO7-g41iKQO;A3Un5~}M)z#R^)j6I;yeI+8m^S* z2AoHLPqy*ZxDEop8I59o6z5yOAH<dAzln2KzwV)2W6;7{T=ng`=L$5O^xJWk0e=Wr z;uSb20B?q{#Ira9z`utp@#k>X0zYWum*Tntc)5+=k82C?uiE^t0iFWhg)8Ox4$f`B z|AZ^~?ZkOEaHl<Q0^bchXXj5M?vlS7_yaEd`@r{t{vKS(?}s?`hn)6$3;v6AAI=Zs zJOKJja3#GK4zFvEcZ8FvrbH?n*5Gc<bh8;+GL>lV+^lsbVjZbgkTs_^cSgc%0U;+9 zZwn(mlIUn^(^}U>Qb|&5Y6`c;kP`b$L~CzqYl}B)t@-jTkwj!&EQvDV)<jc#1m#=f zsHG*=!MgCDmyYK4PA!>iZt7?i34paWx5bkYQbrO9EwU+=(pux4kq#}qXenet`EWWJ zX@LL~-fl^I6WE5sr>n9x5s7FE7B8ARFI-XXFRv`Xd1yKmGwKZgiqSU<c`5>pf}V?| zPdWW6c}Wc2P1oK5C#H>w#n1&&7JfmzRPa&S2Z8f=>!9vA8=a26dKP?-Ha`mnqOH$D z2YwLw=YaNMUg7I|c|`|&gjYEC4|zqW?Bf+3_yDg608jG@Nq)jBI{6`9(J7Dciq3eH zS4eh@R|JazUeQ4Zd4-@Bujr`5ydqGX;1z+Q!FZ)-*kiRrq+Y8S0$G3kn5I3mKUcLI z6uF5H;4j;in@GvoE4AYTIUEz&f++Kj9}=7`iBcuU`vhl;q6}Zh9~PV~i~5M~5}YlJ zP9okbI9nQ>PP|)iwm4c%yi;(tJUW~B4T4hx(S^k81g9pVb;M^2PK`vbCq7+pY9@LE zai8GSP?QZiUMe^>740Oh2~LegHxWPaS0qfN=Azxi2Lz`Eqqh@31RU4=;eYMZ#&3HD zPt>hg9v%2LsCFQbEn68Kcu@CP^T6vZ<0SN6UuUt%nyvdkf3>EWJu84@`ck8Ehs?(J zp4o4l?6r>ub8H(b6H8?drx%%Hqd?73ApUSR^-(Q5SHGVrx%2Iu(V1t`uRg-?36j#D z;gaYMWLujcXU~DsN9d~e3&-Kc{n-t+4;VxkhKN7H*bT=(`LVb}AB6iVCU5?SFd=ns zcJD`RdeDq0Z-zYG)mrMD-r2aM-(A>UJvv>CSnJfcYGpl0OwS!3+V-N^Rg${Y`^0{8 zEIZ4|+POu()R;NUNsUIbB&7ei?M36I)Mef$#te-yPTYPD@)t;w*ZaiJ?^6ZqQ1E4x zy4?Fjk(=2CXycsjphk8@irop+Zg>u!qpkUL*d^1};VGpUE52gAoy+xSj{Q;Db?9Tp zNhq=2c*(jH*87nUarsdXTK*oi`R3QXUwX>>`M&C>Qdh6crO`!@Q*Vt|YRdGbe{5#S z2qyVBH8~rFb5#rv*3<8y7JUNEVYPu?)kt*cxon0q7?~p|di>W&LmTevgcY;;>?a3` zsqf4o<U!UqbGfqyp4L6}M&>9}_6_oH<~1o#c%^lRSiU5i830-r%|M2F>s%$`!qnx< zbNg6NbXP&PDK6O#0Y-)OE3LWU6TZIwJ%69^n@8D8-gxNk=a*St5E%Ld>-V^>{<OK1 zf*H3CQl@N%64Y59l=Pp>?zDhGYsSu>02o@>i*`bOHs`52<KMy9#rBcEpdI7)(Z$H! z0C!W$8TtjL@CB#&^t0Jupg7fKce29e)|b#a@Ann=1EoFIwDbi)kFzrCiu5^vUj>}$ z^JX@q9j2%bMm9Q2vbt1RXH}zqb0>9b%q{gFMrFY_y2cv&vst#nIBDviGxRUa4ZgAE zPpZ7})YeyN2{TJQ8?e>qv-++0Z#?zn?>t3^cquJ9^!Cvw-zhfq?7+gaJ-M@J)a8!j zC_`8;y(?OR_gsROMb{PVayN1upP_tp>(7eb!fdgi^$Vw<ciT^)fNbO~ad3$@=yO|# z$78I39mK<jE>nJOT}uNWC|Q4Q^ssowT@IJjm8%@d>a9giYWmsC$@CQz%;n5~`Ex<A ze*q=@^$Bt1pZ6|vcqpf?vvQz?HlOeqXM2Vg^@7tXx8==?2W~&xvn)G)jkOPyu>F%S zkFxFnQ=>;ik^7jPEt@?XJo@!7(m(EJQeKOydG*$pR6Ph{0rp?3843$upM9Jzw+fz# zOP%o*UaTmxz^+^JG;bzKrx+_0>C2xS81*PCMyEXn1@-IGS!cF(c`<U3_=+o$8t-{( zRM?QhBVx;Gb^kNbYRUSN=<h}M7vyDj>;C_|<2c0WbbkwS9jCY)<z2e3&+A@HUT^g% zPR2_^4QMQ4gfF!i25|Jhiapw8fB?vC1Ds1+oW=k<X-1k_jF30>N^6`Ww5WfjH3$aR zfASRd?-TVOSFO&gzX|GhoVOR_5quXGWY7+s@V{tQ(J;X`yC(YCR*0YbH`*tcK4CSZ zNiZaBKCh?0B>3i*fjXo|wLST`Tc=3+Ln5_Z&GA<mFHZt9j*jRvenh8|nyc7NyW;3N ztgj^ZeMUEHEyOgoTkP`Nhw&Hg0A=}KwEp9yNKy08Of|N@g}+@NWec{S0GJEhV||Pc z_C;nG`j_WHVnw^<g#|qa$EoVJe9=*X(|?smqP>~JH;;WpN0W`88z=i^!qU@Ma&7u8 z86%9)Fq9M;4({&{ouI3Fv!BOb|4GCwkyZwgQD!eWWDak>(flIi#N5JT+{3h?Yy8gy zpZ^h!+Vyc$#5c8}F=+do;PYJ{vQzZi!N=4y!liHXpg)(%r7p?WV2qa>kqB~-83dch z<~0s`cO<BQh7*~?-po>fJqJ7^$KsyhGPBWxAn@eN#byt6%-Xt2a)AtO9i0k;T4zDe zW)FoIn`ghr@O$%G|BJ!>U7hCqGE=|DZtLwL<ujYkU!HrI<?ExBU@%mQHZ5~ft|rUx z{z*(XFZh?VOq~`n@hd8^=F=rxzA<zW%D{ORBg1i?F68$*)`Gv9V^i>#dexD<dtS^O zUX~sQ`)Bp9Kn+@*b?mKN?taoh?)x_3ide4*c;^g)ACQ0<An^AEk9Lh!JXyDXD`{p2 zk8XLZ|Ew*bAu5wb)mQFg_b}5Q@1BEDSkXJSG#H4?ahVs>m-Wl-<b5n@Ud%d-H;g|U zW&4fA`}NuPGg(X_1Pz%!<CU8)TWFp~Ldi7Co@7rfRSZ@<shgn^qqGqdI2QHyWezuZ z??$Oc%weVP-bZ=ry?gq4h9{wm)LAbf<le6>I>+NbY5f#41KY1L!2Ys7G|bj?Ei%s| zL4Qal$;P2z$m+U$NH^2Ny=Yc($m-X(!fkT7kR|MqzvXwx&CbW%kM$V`gTI8oZF$_^ z=Ra8^!>rBQoBc4H5q({zQvSm=y>y`LJ@g&BzOF{|cJ|F5(QC{G3q!qG?+G4CP4VtI zi`<J2nPVxR5xAA%C+RUmRxYsB+9ETpQV3#RTc!%qZS~tSeVfjmYcyCj^(9*#f{;og z2xuHsec^Zp&E{B`4V|dVhKB2em$VHo5IpE;A~b01@A{PSf_G2Du(`y_>SN3*N|L>D zyLnEgZ}SXu$q6QwZO<IuG}*i7S3>k5bNu$qi<>?K{>DX!(ZkkZ%nuyyMraUvG#dwl zjn<akRwWu?9L${bZfl2v9k+J*mfM!+zX4n7%9f+R^YpePfzyKjSzDg(vZX1OyhfQ4 z%HFibWyan!*^#oHYRA1YB|5zw&%Oq%H-G0;BW{MSj&Fkz-8Os#d>k$RZ5vXG|Edi? z=;D5g4dci<y$wa2RV&dQ>*1PCm%R1_%;<p()>W7a`TO8=HR9<`kEri8&!guf7(Hzd zE5@^3RftFML@Rq`Y4*xn?jwWjm5)5peNgwj_b3+@-~5^xIx$-n4L*(G+jw@%PvLCA zCDxXQ(D%l2V72S;W`6}^%9w86#y+_a!_brYG3;)zGjC(JG{@hbol}I)V}40c0D)Vj zUEV$Wi{SpV&9Nd%*{vpShBse|-f4`2AjVuB*1^zd%=N6Sw|=Uov}i+C-(Z%hk?ioM z3+>v?hT-5-U7qaRqM<K<MjG-Z%5{zLWbk>k#k-?Tg&??APyaa881Ig&=?PpB;{3YM zpC3eRN)hbP&pF-US#S1tXc@+4h!q+z4te*42F%72MMv3=tE3%)+sw0ZuX6jhKq%_g zFF<B?{B342y8M;J4FmVle@wj>ab~L0yz!eizlQ2D`N^d%>t)QaPyuRIA}GeJ@2B29 z=>aq#t5=Yxej7ZA<HY7U#?#(CPl+Td*qLRwBBoqX^inpkAshI&_sp(A+s0Cl#jx^O zHIq}7z|O|A!3N8_gKI9<i^wzfXI}Jfdj%0@WL)9B38vNN5)51={#@|&)MDH&{0s#$ zgZS%z(Ku-v_{pLZd2zD(a#Q~?CkMuki-r10W81~UEOz(BCvaKNv%e(xdiuap@9mrd zW%XOKm_HDLJsV0fj~Zt-mdbrlbTvo%@4Y6&|F!AY%xzWV0G;FlKbG6NZRO-F2{H#U zx0SQbLPGQgvgibhHP^4#a(jh=H3c(EOwY5-TS4}JD1jN4dX3LQDUKE(k2BAmgn3Ur zv|truR$=rTfeF^1F&j`SWe<W``iny&-Fy^SVyF%s-CR~zzcRXumHmDgepo7gXoilm zyUf*LadR$)G@!?*y|N#x9yDO$HWgz)=oo;SE(=bO+BD>`D?RDm^E33JY?(*-+4$b9 zz6R?M=EKx|?qRCuF;1({k8%Or^4@~K(E$pv7DB8Jug99m1WeX!Js59W*B~7-qpI|m zF*Ayu_b`a7R3bVaJC45G)_g8~45OG-kV_9_^+o2AL8)dDtMReqUxvtT9JHQ3YCQ(U zp{53A{7y1T){n}i2YG{VC&nn$`#!yI9WKFoE$&Vb{)Wo4`z$!?O591J)7D3C0H;;f zzYD9<o_9v2&x3pjAdA#+Px-HBWocDeu8QluQ9k`yWsOm#Fv0t#Q>o00ObLDUn5+K0 z>%vE63Id-j3Ld?Al(E0($#K`D-!P7v<0m|0uhGdp&;&agV#;MUc+A-)=JJxFLzviL z=~fFefE@MSbs>=c&>^}xf(-1BZZ(X6>&?CfBpb+LY{(huBWBkji8+Jl{gWF8(f4YW zm3Z&k2O<+OAYD>3AL!SC`cEQMr>*|b0GW1OYAz}>o-_3?!1W6^0L8h`z}%V!Ys>!~ zI-9~>BNL$7&%H;gd~iLlKXi;Dfq2N%3xpiOy<xEHqioeeaOT>|NZv*B!Fh0tHRM5F zLy7P{V%Clx$@|>L$a(%yaj*X{TqL+;z<by4kpj`ZcfAAvKD^LOmm2yfjHeeGwV%M$ z^%xAJXAY;%Gef2QwbiAd(uO{O*w9})i+x8z5@vv_OM)+Sm80R93$j50HCmk9^kL&A z<0Mvry2jW!`8%RlgD-3u&FVh&2@l$e3XB!i9&-syH~9a_uO!c}q^G~ECv>PR7dpW? z9C}Xs5naVxIA;!>e#z0`l40+iuXA#i#>!`zF}>%&1exO7_tpqF5YDVG2_D)q)ef`s zJjEg0uh=6gf&xaC<zjCMhHoDon$H-zq%8RSmg4L+Ipe9|v$y!+H0Ec^ynEyh-Mp9+ z(_T~mQZQ7K8lBarn|cq}oXru{(>pi#?9DIx`$P~Y_R*^|hv^4hrC#I9P(Q0Ikr1Dc z|G1%%Q4ymR2KWlZv+Vc{=#YqwxLM4}O<-Lvp=V1LshAPC!;VPZ?4*Z&Z-<JN*5_W& zha~G!B%3`F4I54{GF{o5TG$^dMJLuUuo}3@!CXMCs2yL3=%AD#1!{ZW3%-;3uuVOZ z^kR^@?+v9NN3kwrHkQCStc(AM&NzMo!n1Wg!2m$ZI)`9r(E2&TQC9C(D+|`w{x4*d zxM742*uBv>1Yv`r0dF>q30Hq;H(j_tv<rW6xtF0CYXqvF1w+TY*#Mt6shb@M-2I^k zNo#~2Fit)yiy4g%n)(OK#$7@E1K!MQh$iSJtYO=40rUPOmp+h7Kafk`D{E@9Hd@ng zqCa$$jJ(;sEVAT5v+-dww98oXL!<GL{?J}kNgw9nd(9;W%-S)!Iev^0I`SCTQp_d0 zP29EU_ZXo==8_+xYnPf0N6agG?YlY7iiV4kcb-gi0$VdDH)BBv_Y%Y2%tuh4nigGT z>RT}*Iycy5c{6;#rYg&&#(1*xit5ZzABF*0F2~asbO<B#6SLuf8QPmmjRLzPv(YpR z6OULgBSxC(pY$B?WlkEQr@h-4S}+CM_FY^V@B8RVnO88lnM?X|-=RM1&BjCMfEXI> zMG6_g)N+OP9gwdCxjje?SYu&f3{o=gT_qW%!N%cK46zz9PVQm7d!8?DICSPAS4Lam zk1^3%7@5tQh6lOU#!>g7KNMX2mq;~Ur*AJgl)e{hgJ|kNF8vd$3$1lz`3{KCrXQ*{ z<uFV%Vs3~5-LA-KTvVFW18TcT$E>-kE@{$w$tVr}B^5D#Wm^&LDSG$6)0~UJOf}~> zm_XT+2<sfAN^^pLPX9A*YSEfwx%AW49`qS!_<#9j8SaB!hf*JenQ815qcHDFUyutO zMQH2^?JcWWf|-1)+`IB_Bo{i?6MA@DPv}9M4~z>o9P{oN<dDh9c~59JQg`9JcO1LK zj;|sI{(v4~^`kClh<DBB#^utbW|zkbU?PCv5A|oB!Cn8IccMce(qU>FI$^H3#1s5w z>LNSF9dy<g)RcQoT`q75xJ0{Y+fr2X$<<hD(@p&nn1#;~tbWX#9KHPUchcsX)Fqx& zY2A7qq@I=5PRt=ucYdz*jH1E>IfwRVKI58<I_r(A7>ISL0KqO>_G5Nob4jWBWr=#a z$q?uagqzP9TG4AfJ+y3&`FYM}uu@oSG-AB*m{;+}(YxmzwNk+~OWaGDWw&SbS*E@n zy~;Si+BuoGR}(j#J16)n?~Y#}86$*ytm+va?|+7)RbvVC7W@^)Gbopn+lFz@z3Qbk z7Y&`?%e%}*tE<dR!+$r_l-=gd90$KgIjCozNllQOmSN5bZ-r_c_y6v1MNP-A2ASL! zkYF<kA{u|1cR1~UF@R$tO@T{9V6o}u%dqrfEGg{|mGr?*_wga05y}r4zZ$?efSaE? zUqStLJT@9F=mN9b+L=0o%j48<!(h#dnI3QEVIa$4`I+dX){U|z!+NkR!)G4#=8|K% zfEUt5ecy#wybJc9T#Z1TOP!+|Pnr5fj%z&lYQZ&*fC>f8GOwxcq~o{-vGEThav5b4 zR@z-1jg8(w*8hS+2!u6_11T@u32|e<T7YFAw>N!OXi9rR$KXzgy<FcuU0;Al(cMGi zXtB_E+<cj7Wk4(1$I2?e2#u;=74>}&=;gw9JRYr{h~B`2^O5k$)tKi8_KD;F6z0G) z$>=U-{^>WcQ(yul<V`QF)i2ZiarMyw=Klium;+*f=EN5_ej%=}I)gf&gSq>yBP+-t zEBt7j*#(JVR9n{VVE0L>2-OYON434E<0d2`BCd+gC)Ny%H-kTrr+tC%Ss#JCj<3yU z`PD0<Eu;(r`801E13$3-YzdLvz+5W)5Mbb{XwnJmk^J)u23kk>cV9x&WnTe%_^sfG zDTcM1sZXJe-LoeBU;qx8`athoz}^gQ#&UD-7<J|36xa1{F9tmC%E{gg?3#Ooln0C5 zYsz^3Qud>}!F3hyPOZh@i${jph7-%>ak6pHd4j|TNZG|7%q_DX5Sr43sgEqHkM>a@ z_1yc=ucdM9hE@tRhy{+P*z?h?!vW+*->@6;8x-j2)A1w*PmVK3{t7F7g@1=G>*XU} zKs{EuJkvc681wmajmLk&{87CNcptfsB)D7aQJTaf)3?ESrS-4m%iCseW-nTel`Sde zy&DVFo`owf&5#M&s)}VZ+~}d6p0Bi?Q)L&X8ySnLP07R)c#zl;6VIxFpnn-Vk4dV! z)5c6P!yP18E`xtzu`Iifg$k=>r8&(}hjCIpzuTAB-QC9ux~ql=YThiP#=@-Lm(_o~ z3TnkZ2J98;88~5lZ2)$jd_W$;fM9l3&-?=jB<q-DWz|lDuN~#xdFBY+0*8@#8qo1k zm@4*~j}!Lyz4s_{-gwB|N&M~S57v(UtF{W-{5a%WZmouBMnCnLOW&|wTR(cemd*SD zzFKFMBMTY0%af4+HUxvN$^IARd7Ak+B`JFQy+^r|%{cnzx90X7Tv(%KKs#PSo&A|X zP#_bVfj9$|XMV~(_E8q=@fU4NrpB+tgIy%m<@T{fIhFsl|B!r`HR`7_RqAa{Detz= zfp<M_{!wIAbYX#HP?0Q5eRP>B6uqHfjB}8Qt}KrHEx;mI$tvqw&I9y5u8-_w)6B9` zs^xI%QVOuEz~JBu1qSQE0AoRx1<?D*l+^6VkPB+W`UA+ZGyqmuLR$w4^z>EMxrkau z<|im-Tsgs73XC0dADe<bBKW&f8nnt9=d|S`b*tRXnC+5c5HPr|v~E+ggYM7f)_5~_ zKp4A0BA;32>3O#(bs_$EZ{>Y;&%2{i)yI#JOg)d?M;kaM5Fv8=C?fVL;IH)>?ujs> z9RDgx@R^6wQ!Z6no7+d~Y;CDtw{k?0)_0}IPy$O&ecAD9Dx##h@&kDAD7qae=yv_D z3cCFu6?f9iDBW_K8+EJLtE#iL7wC1?M?r_43;~oKplYM`1GV{mJ+|Lm4c4>*;>G~f zZAvFA^jY-D`nsMjPth$RlkfZa-uug=1(`krCbB*pod*Jhf?TI=?PQ{|aN0-nhYE%N z(N*{=&_Qq5(=d;2Gk${g59lYn-t`-(cP{2I)-(LG1yf{e9_|{gQ5aH4@a$jI^#!o= z_sLU3*v#2$#%sfUy_f}~5k12?whR1#Sn5I$Wq*jhfl%F$jy-C{$V$I;{hG%8XfH$^ zvHz=nxjeSR-nQ?L6Q8hVLSm^*?KdvM-pex`3$U%Uy(w{~Y;94}mx{)cz9!!W>``s; zt&Jt)9log>eDQRuGoA9a#@ZrRkJdt)IwQ@gNQ<wjBc6&z623%Q(s}V|6I;&6e_lM@ z*5X4UA2!5FDPKpreJwb&CgSZX0sFWkzBLn*jia?`S7<9DiFR(7O==TbBCSp7wv;wO zyDrX+wRXC@viVIAu*H{(``Y618-3|c-^An;UvoT>NOz{})~KeS6%&)bsh`kLRm-eK z-=vAj$qqa*srkw^-?S@yk@n8iX5SUlG@q)4V)^3D&FKVml!C4zKG_!Ri?@o%zDc5j zi7mcaK5a5Klb&)&`IdMjDLN2FzF2#Eq$SprinML^HMOE$ic?d^=8aHoWCRnR${Q&` zq@(4u^^Yj&lD{>Mea9P<b~PzqXFM58#o`@FD4}J_#FojvScfu&YRBl&TGH=JR(t}c zO+q(+<2Xe=S8M)GHIo$6seki;Ab;l&{bFadvJp+>Rt`|7tv)nuWGjX9De{jj?zZh2 z<jB{*7LE~(q5bgo$flILF1x9x<*+IiNwlbv(-M)EbaMpG+tJz<Yfkyl5rzH6XskKv zLnA+i9;9gC?{r1wt=J+S>sXif#1US&w3CKr|FBC&I+L+Bq$D@DuZ_2<3S4?QRaT#G zMf}EyEr@u2($@ypO^jf0Mm_&s`(5!ra-6xEdfMcDnni=rmQ;jJfj(z9Z$vklrF`#w z`V)(!lT^6V^H0^8+t8Co`+OT?sVFRvSEF=hF`4xKjZKM`q|dI;U6!z_A3-{<oW#wC zMV5;{{C64{x5Ey(_<a7P?OU<6i0IO?NfQHz3<zsJUj+h=_|Iu_ZNDn0M0;O~@6=Wm z@WS|zh%})Rjwd4q2<7jtAp#-Xr%BJ$@Pf(TEAJ{O7T2VcPQf_V;#-GK1hvu;5a$Xq zxuFJhW_#$vn-<U+U&H92^@Wjb4)_!O;xukJr&;wsyeHzrFneQ1d}D{Nm3-)!S6_OX zBJS$7GnQ9M{<{q7)193hW_;zY0o~Vx!7Q;Z-5%*kjn)#{JP9p)e`Ew1M$G(iFXk<I z#06j$nm?FK#C?6oRqiqDgMSw13piiJ`7X}U+jY-}abAIQ7S3yMeiG+;oS(sY2hK0! z{3g!Fa6XHZ{5hrP+B~-4YCFIOuWM+0KY$MyCgGj2vv6I}qkHfeQab{iO?d|=Uh|N0 zV{zqydopd;LEXa{R4>jloO}n1?|r?uP4^H!hAZ!;d^qviiM&IGyUh5#NJn$ylm$CJ z;%&eIjyRa7X<yaWeMpt#Oi8~@-I6%)$B}j=$#BfV*-Zck^ScS)xEW_R0UY1P*-Zck z*T1?6;J6Hxbql0vNf&&;1^>|nbEV&*U+98wa>1qx{<;h9cfnMm!{>4rywC+FT<|{u zzSWj<p9^NvSM78+{F+VEyb?OpRoOqTDbl9fFlpzz;6@kh=5r?aCY$~!uHVGjt@V>s z4o99RB;6-zzYzFRfrkaYOyD9oUAK0*z!wQTQQ&C;%j+FlNMOIDe@fsAfl~rk3Tz4- z5O}x1RRaG|;28q{Lf~qFUlTYe@Y!(qZmmY(j|zO1z*h?V34xaje6_$)foBVRv%qr% z-YM{0fxj*AJc0KMTr2Pk0*3@XA@F>GJ?Bt{1p;3p@IryB1zsfZ5`nK1_<I5`6ZkoS zmkT^3aJ|5z(6hR=6#`!@aD%`>f#Dc9mI-{lz%hZ>2;3v^rv?5efg=KcN8qTy&k5Wn z@GAn}B=BDaR`*XI!a7j5mX`E@z#9Z!Ch%r~+XViMz=ptG0^cWax4@4H+#~QW1l}g_ z>jK{<FlQg#+8qK<0DLQ;=k6}juD9X&2!7o{BP8<2@zw9U(*G*3^2u2Ue%&_tRS2Bj z@)oeBtrl2Cpsx$8Z2gkJ%BJrMtZb1*u<h19DV&}YSn1XhSXJ;i-ka;z+64Kvz$t<K zc#p1IQ@UC%@K#BGLE!BIk7L`k9Rl-@(=Ipc^w}|J-*lnB1d$DKKw!RctPZE_8l+Q) zJUVQ6?IoJ#@KHI1y1HHT%yamBTlin=kmu9gG}AF?bZZ|Gnxw!=|BnE6WO&YotDaPG z>?xZg<#b?2PG(U~C!Ml6F!R33KRDbp$E04B{sRnN-3rv+5O{%L<1v_ZYu5;Tt-z{X zTLe~pZI8gKh2~X(8wI|+jAd^Sc#XhK0)IhZ0kzo}WV;op9lx*u{|1ArlfDv58r|B1 zHdUc5OmN!u8KF@z@HK&F3jJ9hV%cheFBUi`@JxX@lB&buvkd7zdE;26x8TCDSc`SU zQsvFsv~)5tEtzPZwl+C!Zo{I*wbRz|?b)dn<@h(PIhmfOt!r+s2sg*uJGtsmj)JLK zsY%nP_$ObLkW0<f3V&c`pt^EKpt>dx&aBazqfH4Rtx%*DlWV5e_$!cuo3VAcTU3lH zRc__vGcrndBxCD3aF^*638*3gFmxZlDre>oyPEeEu2O}o{xgL~2s&f(RkM>b0yS** z43ze}>(0Y9)AJIz0b3ej_&$+lx;W2#pIm-7pFCWHX?;Awn{K7XYVz>U5b3I+%gTzG zGpcL&7YbLT@2fZHDicJ#H8ZNJDyu-Q)SWk=e>w@Pg*V`uss4&;Wyw6t0xcXPPwOYs ziYl;dZHqVAj$^w6@&d@!TH<Nke<`1`eF0h3%o1(6^KHW;-(Nujx@B8rQ(g&v7&lps z+p4x%;+s>ZPpPb^iM2Pav+>FbCKL*~#DaOnp<!C7+~Mu6ABGYd7zwI&3GhBiVGf~$ zDJrCy;qcmYtSyDN)HgKY4fUk044B{wh*|*+tBY1%J}uVK+?H;M@S_jSQ`M?PvOM~C zIxE??OpR4m&rn~9n8rnw*gBL0$K>W@3zk8qt?Nin3ok%-et%ZFBescj8&EAiGBIs! zER~$bm;G6_OQ_aJQ!1S}H5CP?HDmG8CT@=<o5?JnCV>X+nTBuz`PNPoL2*YHZA#hl zR+I;4<eQEc`oRq~C-D`5FqKu!kOLhBCgX+vbl7&dfSv01t7P$XPzR>K%|IPg$*PwG zroh1pENC<#g<B!DN|D}_ZfcPV14v=|Os2b1;V4L*!BnuVwrSxSNJa0Ubgpzb0@Fo2 zB>QLB^e{Zqs~z%uI{O+jL~hVmR@n65AdH*>g$&hDQ40#p2si~)TSZO^RLD@xRn2N@ zX-PN**j(rn?Yjb3DcBO(;N-G_REf0D(U70bqgs)=E|yPa<LuN}N8IKhJ|0l^Ymc`m ztHMrfm`&UP*SpanXS?k5cx$VZs#+x#wz-noCR^styc`wEfTH_k-jPtHGNGg=+G6bv zZ`DN6B$M+Rt5B_!wilSY8rho6Cs)#b5F4#ZR)^8q5sHAKF--{q65{0gHwP~S7k>>M zXEI_K2AvuxxW#3xN@YZ8LbE$v8L?7~h`2(-q+<BY2D=cdRc<Qk!`Ctp2U?O&mhx0- zee%>i<*iaIxp8fqW21m_R!PU_Ihyn7%2^BPdG!R8w~E}9%W=Mdva6)u7};#g6mYdN z*4Z2`m^PqHE8PV0xQrW6#+AB})7+7An7P`nGV%rvC<BYjw<brHQf3ylI9d5}Rm#}n z7_CV>I4aaurQF&sr?Lv=ly57C>WCN8sRg@}!MO|R%DpRuTPlnNxwa-pb5%+c(%uw4 zfifab>B6oj)tSl{Qo0azCt<g?NQbSZs=ON@=F3QsigKMYnIA(sRe~BIY{WHAI77{8 z$CG4p6qCp(oKm20XA>UQ%~~<ZFB8gSAfKLy#S^jAX7@0TE@0OdZf#1Y=x!((<N&~) z#zoC^k_9T+XE4kotuxjkbgCygqko=HOC;IMIciWwiy()GD}X@To021m__dpKb7~eO zcZ6t4L7hnv0VYUR&Oi^1q?($evb^e++-_B89M3qMCMj8*98rVP0(!d=KGuOpV;F>~ zGMig)hTX1atX$e@n2V{zb!o1uW4N3pV<iH)qXh_cqr`}0B;}L}%1lVqrZOcXIC)A% zg<U_I(JURy=2uZAwby7P6u`I=#9(n1{=(0kJVqArs368q=E1F!{tA2@D69-ZyQ$E| zw2e)8I)~91gcXx*4HPOOGtsuHj6D*?(f8;uE$Q}lN2$`_LOCapfLH}2^dCpS_H-(; z$(GR1?g%27KUo2m?f76&GLqPk*SoFAc1)bom~XqiiPTu&jwD9N&eR)Y9jDr@-Q9Q^ zP9pmVkzDQcv)4l`dKaal#4e_%G&bJRtfD+hsBX{R?eI=)w8OLX7?>o92}C%t(Jhb+ zG?K^;A4y1Of|VSH1ocKZWWK46HzJ({PBCKMFP&ni<~#0*d{?Xdj$<OZGl^Tsyb)~2 zESNXnCVHUEL~y~hW@MY)3RRxNi3lSGHR7t-HuA_yosi-1bRvrFIWl=+?8;ZVwkeUo z15PJjc~*sZ)^ywhVD8VjMS=6~kHkdergW^(R7c~;>7*;>ea=xiGDdb8TiXTY*mAg9 zkI{qf#7Pm|X=FQ3aVFK#?0FKp^+ry&rA>Z61Fl3_Z6l_YPNEvu(ZO7|3Q|hlJ#1`F zwquRKm2#$Wf;R?gY;lO;`fDYos=6vg0DmQ8HqGenleP^p>q;XGf(D9Dqp@HG)X(5z zlOScSP(Ulr%nXyRN=~{Qsu~1V##W3x3&O2<tS$nm`c?IeXh`Q24>opq+XDcqhmpZT z&EFIYdrTL}CRK8%!CiZvNmU^46(g9yA%uxbx$6)WH`upk1aW7j5_}v_XHrR#aCpJI zrPr+tFTHlw^eGN<-BPB_^1Bjh=gz8dp-VzbW>x0#(2}|ptHX<~t7}*>E09l}->`Ub zcxl55rdH)s7cE{KS}<p^O+BNKe%-vKOX?PfR)p-VnT0I7NNuQo-tt9tE0!*wRb9xu zZbfMMbzm4;z8o3BDK(niJQzRUyhZil#dGRcxSF(R!F5ZQhg7M0w2jke(NDM)gLsPi zfoJdn16;u?dPS?m^*kk)$O_~PsUSn-6mkq_r;uY4MuD1v2Gks*gq-6K=@EMJ{8Ndh zj%1;T3_>ge!BiQDc1j(p2<(iJz$F_;2&oQ2s-h6{v_)@9M-rP|b#k)DIw7wVWN18X z!I8?4u!nLLu!1TFp-)?GgjOU1u^8l4#UL<?y<aUD@0*k#S8%YZK<q5&OGI`$sgvQ> ziV##u-;;TuD(c9>T!@k%*Q74m9<v`Oz;Z(i!UG7QA|>n0$y4%C*6}8M$FS2D6Dmwr zp(iJ!Sl$Rn@w6SQTI9exLgB!BLd+{|N5q0yOQa<nU%MXL%w{>E12@JU_$s0*DB6{9 z<jfW&)^PxqJ40uf;J&i3Du%h+j6y3?@e#@SA(@>(L_?FDVK{GLW`IY2Aa<+GJwL?O zv~Wix!bVU4TPAy!h?w29>2%rE_H5NvIu*~)sO;eEDqF~`D$H0@k=C@c#8+8u&sW`M z4EXK2s-tZh3OCS>Q}H%jX6)D^ur}SQlp&!2ij|RB{6^(M0S<vZAcVuMZB6S=ogc+I zHpH8oxcNbiNqIXtPKDu8K9$K2RoYF?n?%BWr>aMF4;el3<{2>@&^8zkY}c1U@Kf}w zQ(Db$Yby8Tf&d504k`kIb2ZKJIXj82>V&rn7~1hUrB~*nE4YTrsaT+3D#krH;&fS} zP%+ktuyz#WDuL<%yun@&j&Y!}hf+qaO5Q%C0~n^8ZAHWV?8zurVb@}>B+@Gxdy}W9 zDu}3rsi>~5sbTY~?7<tFw^!IIc_)JI!<9FPl3!t~#FCq{z_vhE@bU#*OL8j5UVDRq z)KrMK<s&{qI%|P+P)%DfZ{955Bz&EBvX9G~z6w4km|5xfO<IoU84IzAY%v#GeKX7b zLNIkERy6*%N>yXp`d_c>f3p;|fv3@O@cHI+fBAGjuKycpS~*tUQ%!4e#fNU?iaUD+ zNk{I~%CX5eQa)$yqN%B-by|6}DT$Txmdza~sIK^!Z8?_Q%QxU=3SnUc5=LGk(pJ7M zo>IWtWKsd0*#BG3aIBRJ$iZGK$0v1T$dA+4!Cn4FqUs~MT6uFSo<Q*ybrGHrq^UjD z4Ecq#{6Q3v1~p+qjr!5MxFJe4M5*~d_xB$_MuUvPDc{V-6^}~u2lIIFDKNG)2%UV} z8W}#|&Y{}?jfyQDLdU&KlR(EOq)tAsJoyw9kMxC(dz_Adt{W%I;vzJ7RIG8QM=?&y z$30OifQ%!7eK;VW3Ufab>A07v4V6p>?9|J2;ejjnKN030sCz*$8?d`xpjtCdY-x}( z+(UH?baYno!((E(66Y=fhi(vbgCM|TUdiV^EYg#XJ1-o%_dxd^GJ5U&68lQJn{l#D z*pec9!*)P0@^cRI<FO5=L$@1y$hg;Lx}yx_k&dU~qT_ef2gvwiIPHTv=5ZHJhadN% z4NTSST>z3Tya?^I>8L*qA1dTN#v3TOefaF_S8ydi+U^GIQR6q&r`UPCIPJI}utUd> z)9wJBljo-Uwu_GMA@qXIRc*e^UKiaxpu6V`bU$#>aSz=t&|S|8?ZeSuA8@LS?RW=t z{Pz1U!1Na$q@x_q;AA^^-h<b6cB#kwz|_HX9zVlLdh+9Yp``2HD%wPfrupPA_Wj}N zlwlI-cB2Dg8-N_FmwxjCPV#b&T67rh*K-bs$ID1?VCH=bjjeShIN&hy*w3BgkE=Cp zlY`*u&|!<lh<evyOU)anp(A~vb@=xB4fv)t6u=!OF`R4%eUN>_-Hx}Scq!0PGV+{y z0lx2G++w2ob~p5kc%pDsGvkoLRSk?c3TN#qt|(kp=<J0o7R#$Rq4Jex7!MRK7mfX1 z;cSK4d#P}2@WH`7o(gBggB|lYEr`9J+ns!DLL!d-$7`{C?H>U9nc&!HgoFKwSM`N* z@XzD43gSv0$A%dk><7FS+mW6Au5d;&<<|<wrWYLaUxi;NIQ>-N7YXkCDIO7-$lv97 zAS#xx(>v6}IocGCV*H+i`zY2fcB7#G$OyaZ+Uq%LO!mD9<$1!<!AId&5kBtXK>CVP zaF(Bbn`#e#Md2#oQClBH@WeU59eou+UrT}W6WO>xmQszo@|^Ol?<U}m{)@2tb{p_s zn?LgzSNYLw#_%HS%)JNKU9SAyzz@0bJ-|C%^*s*Uv1bv!@PE4Y?6UoZ?Rk#;ZJhQ0 z7WmzHe&=gapDUmB7343~{s7$BFU|J<Wkmj%)7r!FSJr>7tD`#h8nD~P{4(UTee8ME z=Xl`!{H23)AMhp@&iMnsCh6q+fs-FSh3yLh*KXH6pR;ksw7Y@7gs#v0I@04K1e{z@ z|0{{(b$4yHvPTo}l&O0*<4XFQaOL-_v_6&3bbhoz)qj!J1N_7e-NUZ}kpA<yPQO$4 zY_RL!1^fZvci8xYzyo*bp5r#ouZQ@0)$f+D{EvYT0ROC=|2*(deNOi*w(%E%KLDI_ z8PX2|KMI^Zn>at@Gz|PXT#4s!<;Qj$dAT|KkuT_;{dWF1;QVlklYa^DEjxA37jR|y zDqQ(Z9VdSt@X~v*C*3Z;8u++>)IDh%?*QKWW!;mo<@pS7{hxFXrVqle2Y3MZDqP9` zOSta%itf4H&i@ARvVX=~?>7Dz@b`cpN2n(KA>h_m`B5>2zXE*s{gBtjbHJ;2<2&q5 z`%vz!uj!s|*!fk!cYVE3z8*MVYKJq3KU@#|Q~!!jw%GJH0)H6zjW*r|eEb8@zs>&( zz!!f*_k12#%C{R=&I>?}-al6RHt@ZO?^}UihV!Su4*;JAm^K>#&UjA!mg1LFeh>Tz z@+aH*?*ezmi}N`{2H_y`o!>(_ANX6q9|S%5R{>{yCO`fj$^rn+cv1@at^=-bFZ@1A z7<d`*hwS>e?{Wfg=l4<W1RenXJv;wC;Ldn32J!UU!1?<H-;w<DwC@711^q#r{%63Q z@yUl4z5sj$@-a=6_H)m<6EDuk`1S_y7UVm>ucBiJP66)%J=^C4z76=F?DErr-woW+ z*IeLk`4$0p#<ww;sfU5@27S&h9|!J(e*=ZSUe9sw`fiv04B-4`8^jWQei`^)lxN(g z{k{d<{d+8r0e9M4iuU#ccMczbUjjdX^4P8`<u%?8@(vJtHc#1*iRb-ot{-m^N>DW? zQpr@hwH07z`E)Eg*REK)JiK^O{R;fNi`v_U7x&8j$Z3g(*R{phHnoN2_A%U)-h|Z9 z!tng%bC!g{b3+RjU57%fUOjEq)S@MRgh>5_i#&pritT*7?ZbzWaanN#uX(Pz-Sx>` zt6iVags!VaO}4NOqQp?xI_wv~i=^w&td1~Wol0VBA(rAa+}SqYsQzM`gLY#KT4`&= zi&=Ou*&2(qwP@IDkc`-6R7w8rh*!i~Hrbh2p0i)LwRhd25(iSnJJegbN$gFG-<a;S zbJ6w|JWaOc0TQ;~IZUb_&XF9gxh;Z+XiCt|bTW$F53z*S8Shj;EE$%U8^t<!)*EiZ zP7nSbPf~LrcNSJ9B?H$&GG9i;!$iCc%*+uOcE)W~{IE?S5!)aOm0A;CJKhYn$h%o6 z$=5N_8n9`?Yg`-n13p;BO+=HL>@UP3d<^d?hc{r&I-bB5-w5~o@I61Q_okY$U5~Y> z1UxdtkMB4YDArC5LWT!tNxogDDo<*vm}+uZ-news8`*@Fj1Cx&^2q{gdn6T&w`gja zeT4L~xsflEI+-JCF64Hk&@J$Wwk=ZFwyZlz`G@TrkP9|p61H!4;D?CtRvh(-L@cVb zMYM43>g(n#Su_vsdz#-Hnmyb3t)c1g(gc3r$en_xi{a=-=Vy{e<gn-4Kch4vomPDR zFDbc6)K4Y3Q<VMHFEzQ-ArSt%Q@Al?#LqjqGm*s~XmTgv(RMOvv$ubAiMv--3Vb8h z;il&5l}+3!KP=_W<c~+i?4Nroq%%;te_6_vgWqoA&p{PZpkZ34)twTK$dXxj!Q!QJ z@jP+q{Q32v72y?g<}MB)wBfg)MiQe_p+5CnSMD77p(%HQ{03Da0b-6=2?iHeWAQY? R{VQA0BYs<}P<Xob{{Z@T8EOCk literal 0 HcmV?d00001 diff --git a/kmatplot/formula/make_parser.sh b/kmatplot/formula/make_parser.sh new file mode 100755 index 0000000..c431d35 --- /dev/null +++ b/kmatplot/formula/make_parser.sh @@ -0,0 +1,3 @@ +#!/bin/sh +bison -d -v -l -o mpparser.cpp mpparser.y +./gramdiag mpparser.cpp.output > mpparser.cpp.report \ No newline at end of file diff --git a/kmatplot/formula/mpdelunay.cpp b/kmatplot/formula/mpdelunay.cpp new file mode 100644 index 0000000..a4c81e4 --- /dev/null +++ b/kmatplot/formula/mpdelunay.cpp @@ -0,0 +1,412 @@ +/*************************************************************************** + ksdelunay.cpp + ------------------- + begin : + copyright : (C) 2001 by Kamil Dobkowski + email : kamildobk@poczta.onet.pl + ***************************************************************************/ + +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + +#include"mpdelunay.h" +#include<math.h> +#include<algo.h> +#include<qobject.h> + +//---------------------------------------------------------------------------------------------// + + +MPDelunay::MPDelunay( MPSymbolList *args, int columnFrom, int columnTo, const char *id ) +: MPSymbol( args, columnFrom, columnTo, id ) + { + m_triangle_buff = 0; + m_triangle_buff_len = 0; + m_point_data = NULL; + m_triangle_data = NULL; + m_edge_data = NULL; + m_edges = 0; + m_edge_buffer_capacity = 0; + m_point_data = NULL; + m_points = 0; + m_triangles = 0; + m_active_triangles = 0; + m_p1 = NULL; + m_p2 = NULL; + m_p3 = NULL; + m_result = NULL; + m_complete = NULL; + m_error = QString::null; + } + +//---------------------------------------------------------------------------------------------// + +MPDelunay::~MPDelunay() + { + delete[] m_triangle_buff; + } + +//---------------------------------------------------------------------------------------------// + + +void MPDelunay::checkArgs( MPError& error ) + { + stop(); + delete m_triangle_buff; m_triangle_buff = 0; + m_rows = 0; + m_cols = 0; + m_error = QString::null; + + for ( int i=0; i<m_args->count(); i++ ) m_args->at(i)->checkArgs(error); + MPSymbol::checkArgs( error ); + if ( m_args->count() != 2 ) { error.setWrongNumberOfArguments( m_args->count(), 2, this ); return; } + + triangulation( m_args->at(0), m_args->at(1), true ); + + if ( !m_error.isEmpty() ) { + error.setError( m_error,this ); + m_rows = 0; + m_cols = 0; + m_error = QString::null; + delete m_triangle_buff; m_triangle_buff = 0; + return; + } + } + +//---------------------------------------------------------------------------------------------// + +void MPDelunay::stop() + { + delete[] m_complete; + m_complete = NULL; + + delete[] m_point_data; + m_point_data = NULL; + m_points = 0; + + delete[] m_triangle_data; + m_triangle_data = NULL; + m_active_triangles = 0; + m_triangles = 0; + + delete[] m_edge_data; + m_edge_data = NULL; + m_edge_buffer_capacity = 0; + m_edges = 0; + + delete[] m_result; + m_result = NULL; + + m_p1 = NULL; + m_p2 = NULL; + m_p3 = NULL; + } + +//-------------------------------------------------------------------------// + +double MPDelunay::value( int row , int col ) + { + return m_triangle_buff[row+col*m_triangle_buff_len]; + } + + +//---------------------------------------------------------------------------------------------// + +void MPDelunay::set_error( const QString& message ) + { + m_error += message + "\n"; + } + +//---------------------------------------------------------------------------------------------// + +void MPDelunay::triangulation( MPSymbol *xColumn, MPSymbol *yColumn, bool useLargeBuffers ) + { + m_error = QString::null; + if ( xColumn->rows() != yColumn->rows() ) { + set_error( QObject::tr("X and Y must have the same number of rows !") ); + stop(); + return; + } + if ( xColumn->cols() != 1 || + yColumn->cols() != 1 ) { + set_error( QObject::tr("X and Y must be column vectors !") ); + stop(); + return; + }; + + if ( xColumn->rows() < 3 ) { + set_error( QObject::tr("There must be at least three points !") ); + stop(); + return; + } + + ///////////////////////// + // prepare input data // + ///////////////////////// + + // copy all points to the internal buffer + // internal buffer will hold also 3 vertices of bounding super triangle + m_points = xColumn->rows(); + m_point_data = new point_data_t[m_points+3]; + for( int i=0; i<m_points; i++ ) { + m_point_data[i].index = i; + m_point_data[i].x = xColumn->value( i, 0 ); + m_point_data[i].y = yColumn->value( i, 0 );; + } + + // presort values using x coordinates - simple bubble sort + sort( m_point_data, m_point_data+m_points ); + + point_data_t *new_end = unique( m_point_data, m_point_data+m_points ); + + if ( new_end != m_point_data+m_points ) { + m_points = new_end - m_point_data; + } + + if ( m_points < 3 ) { + set_error( QObject::tr("There must be at least three different points !") ); + stop(); + return; + } + + // calculate the bounding box + double x_min = m_point_data[0].x; + double y_min = m_point_data[0].y; + double x_max = m_point_data[0].x; + double y_max = m_point_data[0].y; + for( int i=1; i<m_points; i++ ) { + if ( x_min > m_point_data[i].x ) x_min = m_point_data[i].x; + if ( y_min > m_point_data[i].y ) y_min = m_point_data[i].y; + if ( x_max < m_point_data[i].x ) x_max = m_point_data[i].x; + if ( y_max < m_point_data[i].y ) y_max = m_point_data[i].y; + } + + // construct the bounding super triangle + // anti-clockwise(?) order + // this will be the default order of all triangles + m_point_data[m_points+0].x = x_min - 1.0; + m_point_data[m_points+0].y = y_min - 1.0; + m_point_data[m_points+1].x = x_min - 1.0; + m_point_data[m_points+1].y = y_max + ( y_max-y_min ) + 1.0; + m_point_data[m_points+2].x = x_max + ( x_max-x_min ) + 1.0; + m_point_data[m_points+2].y = y_min - 1.0; + m_point_data[m_points+0].index = -1; + m_point_data[m_points+1].index = -1; + m_point_data[m_points+2].index = -1; + + // allocate nessesary space for the output + // max. number of triangles is 2*(m_points+3) + m_triangles = 0; + int triangles_max = (m_points+3)*2; + m_result = new long[3*triangles_max]; // buffer for output vertices + m_p1 = m_result; + m_p2 = m_p1 + triangles_max; + m_p3 = m_p2 + triangles_max; + m_complete = new bool[triangles_max]; + + if ( useLargeBuffers ) { + m_triangle_data = new triangle_data_t[triangles_max]; + } + + // add the first triangle + add_triangle( m_points, m_points+1, m_points+2 ); + + ///////////////////////// + // start triangulation // + ///////////////////////// + + // for each point + for( int point_nr=0; point_nr<m_points; point_nr++ ) { + double curr_x = m_point_data[point_nr].x; + double curr_y = m_point_data[point_nr].y; + ////////////////////////////////////////////// + // complete edge buffer for the given point // + ////////////////////////////////////////////// + // for each triangle + for( int triangle_nr=0; triangle_nr<m_triangles; triangle_nr++ ) { + // all completed triangles are put at the end, so if + // completed triangle appeared - all remaining triangles + // should be not considered + if ( m_complete[triangle_nr] ) break; + // test if the current point is inside triangle + if ( point_in_circum_circle(curr_x,curr_y,triangle_nr) ) { + // add edges of the current triangle to the buffer + int p1 = m_p1[triangle_nr]; + int p2 = m_p2[triangle_nr]; + int p3 = m_p3[triangle_nr]; + add_edge( p1, p2 ); + add_edge( p2, p3 ); + add_edge( p3, p1 ); + // remove the current triangle from the triangle list + del_triangle( triangle_nr ); + // after removal there is a different triangle at the current index + // so we have to test this index once again + // do not increment triangle_nr in the next iteration + triangle_nr--; + } + // triangle was marked as complete - put it on the end + if ( m_complete[triangle_nr] ) { + put_at_end( triangle_nr ); + // now at the current index is a different triangle + // so we have to test this index once again + triangle_nr--; + } + } + + ///////////////////////////////////////////////////////// + // make a new triangles using edges in the edge buffer // + ///////////////////////////////////////////////////////// + // tag multiple edges + for ( int j=0; j<m_edges-1; j++ ) + for ( int k=j+1; k<m_edges; k++ ) { + edge_data_t *edge1 = &m_edge_data[j]; + edge_data_t *edge2 = &m_edge_data[k]; + if ( (edge1->p1 == edge2->p2 && edge1->p2 == edge2->p1) || + (edge1->p1 == edge2->p1 && edge1->p2 == edge2->p2) ) { + edge1->p1 = -1; + edge1->p2 = -1; + edge2->p1 = -1; + edge2->p2 = -1; + } + } + + // form a new triangle + for ( int j=0; j<m_edges; j++) { + edge_data_t *edge = &m_edge_data[j]; + if ( edge->p1 >= 0 && edge->p2 >= 0 ) add_triangle( edge->p1, edge->p2, point_nr ); + } + + // clear the edge buffer + m_edges = 0; + + // emit sig progress + //if ( (point_nr%progress_step) == 0 ) { + // //emit sigProgress( 30+point_nr*70/m_points, &cancel ); + // } + } + + // remove triangles with the supertriangle vertices + // ( supertriangle vertices have index greater then m_points-1 ) + m_active_triangles = m_triangles; + for( int triangle_nr=0; triangle_nr<m_triangles; triangle_nr++ ) { + if ( m_p1[triangle_nr] >= m_points || + m_p2[triangle_nr] >= m_points || + m_p3[triangle_nr] >= m_points ) { + del_triangle( triangle_nr ); + triangle_nr --; + } + }; + + // change index to point buffer with an index to the apriopriate row. + for( int i=0; i<m_triangles; i++ ) { + m_p1[i] = m_point_data[m_p1[i]].index; + m_p2[i] = m_point_data[m_p2[i]].index; + m_p3[i] = m_point_data[m_p3[i]].index; + } + + // free all buffers but m_result + delete m_triangle_buff; m_triangle_buff = NULL; + m_rows = m_triangles; + m_cols = 3; + m_triangle_buff_len = triangles_max; + m_triangle_buff = m_result; + m_result = NULL; + stop(); + } + +//---------------------------------------------------------------------------------------------// + +bool MPDelunay::point_in_circum_circle( double xp, double yp, int triangle ) + { + if ( m_complete[triangle] ) return false; + + // calculate circum circle + double xc,yc,r2; + if ( !m_triangle_data || m_triangle_data[triangle].r2 < 0.0 ) { + point_data_t *p1 = &m_point_data[m_p1[triangle]]; + point_data_t *p2 = &m_point_data[m_p2[triangle]]; + point_data_t *p3 = &m_point_data[m_p3[triangle]]; + double x1 = p1->x; + double y1 = p1->y; + double x2 = p2->x; + double y2 = p2->y; + double x3 = p3->x; + double y3 = p3->y; + + static const double EPSILON = 10e-100; + double m1,m2,mx1,mx2,my1,my2; + if (fabs(y1-y2) < EPSILON && fabs(y2-y3) < EPSILON) { + //set_error("Error when calculating circum circle ( points too close ? ) "); + return false; + } + + if ( fabs(y2-y1) < EPSILON ) { + m2 = - (x3-x2) / (y3-y2); + mx2 = (x2 + x3) / 2.0; + my2 = (y2 + y3) / 2.0; + xc = (x2 + x1) / 2.0; + yc = m2 * (xc - mx2) + my2; + } else if ( fabs(y3-y2) < EPSILON ) { + m1 = - (x2-x1) / (y2-y1); + mx1 = (x1 + x2) / 2.0; + my1 = (y1 + y2) / 2.0; + xc = (x3 + x2) / 2.0; + yc = m1 * (xc - mx1) + my1; + } else { + m1 = - (x2-x1) / (y2-y1); + m2 = - (x3-x2) / (y3-y2); + mx1 = (x1 + x2) / 2.0; + mx2 = (x2 + x3) / 2.0; + my1 = (y1 + y2) / 2.0; + my2 = (y2 + y3) / 2.0; + xc = (m1 * mx1 - m2 * mx2 + my2 - my1) / (m1 - m2); + yc = m1 * (xc - mx1) + my1; + } + + double dx = x2 - xc; + double dy = y2 - yc; + r2 = dx*dx + dy*dy; + + // remember circum circle + if ( m_triangle_data ) { + triangle_data_t *triangle_data = &m_triangle_data[triangle]; + triangle_data->r2 = r2; + triangle_data->xc = xc; + triangle_data->yc = yc; + } + + } + // circum circle was calculated befor - use buffered values + else if ( m_triangle_data ) { + triangle_data_t *triangle_data = &m_triangle_data[triangle]; + r2 = triangle_data->r2; + xc = triangle_data->xc; + yc = triangle_data->yc; + } + + // check if this triangle should be considered in further processing + // we have presorted points, so we are sure that further points will have + // greater x value than this point, so all further points will be outside + // of the circum circle if the current point is outside. + // if ( xc+r < xp ) then won't consider this triangle in further processing + // xc+r<xp; xc+sqrt(r2)<xp; sqrt(r2)<xp-xc; r2<(xp-xc)^2 && xp>xc + double dx2 = ( xp - xc ) * ( xp - xc ); + double dy2 = ( yp - yc ) * ( yp - yc ); + if ( xp > xc && r2 < dx2 ) { m_complete[triangle] = true; return false; } + + // check if point is inside circum circle + double d2 = dx2 + dy2; + + return ( d2 <= r2 ); + } + + + + + diff --git a/kmatplot/formula/mpdelunay.h b/kmatplot/formula/mpdelunay.h new file mode 100644 index 0000000..4c30223 --- /dev/null +++ b/kmatplot/formula/mpdelunay.h @@ -0,0 +1,207 @@ +/*************************************************************************** + ksdelunay.h + ------------------- + begin : + copyright : (C) 2001 by Kamil Dobkowski + email : kamildobk@poczta.onet.pl + ***************************************************************************/ + +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + + +#ifndef KSDELUNAY_H +#define KSDELUNAY_H + +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + +#include"mpsymbol.h" +#include<iostream.h> +#include<qstring.h> + +//---------------------------------------------------------------------------------------------// + +// input point buffer +struct point_data_t { + int index; + double x, y; + inline bool operator<( const point_data_t& p ) const { return x == p.x ? y < p.y : x < p.x; } + inline bool operator==( const point_data_t& p ) const { return x == p.x && y == p.y; } + }; + +// circum circle for each triangle +struct triangle_data_t { + double r2; + double xc; + double yc; + }; + +struct edge_data_t { + int p1; + int p2; + }; + +//---------------------------------------------------------------------------------------------// + +/** + * Performs delunay triangulation. + * @author Kamil Dobkowski + */ +class MPDelunay : public MPSymbol + { + + public: + /** + * Constructor + */ + MPDelunay( MPSymbolList *args, int columnFrom, int columnTo, const char *id ); + /** + * Destructor + */ + ~MPDelunay(); + void checkArgs( MPError& error ); + double value( int row, int col ); + protected: + /** + * Performs triangulation. Returns NULL if x and y have a different number of rows or + * operation was canceled. Returns matrix Nx3 with indicies to rows of x and y. If + * 'neighbours' is not NULL returns the second matrix with the same size as result, + * wich contains indexes to neighbouring triangles for each edge. It is optimized for + * large difference between x values. If your points differs mostly by y value you + * can invoke this method like that: result = triangulation( yColumn, xColumn ). + */ + void triangulation( MPSymbol *xColumn, MPSymbol *yColumn, bool useLargeBuffers = true ); + /** + * Returns an error string ( if triangulation returned NULL ) or warnings. + */ + QString error() const { return m_error; } + + private: + QString m_error; + int m_triangle_buff_len; + long int *m_triangle_buff; + + int m_edges; + int m_points; + int m_edge_buffer_capacity; + edge_data_t *m_edge_data; // buffer for edges + point_data_t *m_point_data; // buffer for input points + triangle_data_t *m_triangle_data; // additional triangle data when using large buffers + + int m_triangles; + int m_active_triangles; + long int *m_p1; // m_p1[n] points to the first vertex of triangle n + long int *m_p2; // m_p2[n] points to the second vertex of triangle n + long int *m_p3; // m_p3[n] points to the third vertex of triangle n + bool *m_complete; // m_complete[n] - if triangle should be considered when searching for triangles + long int *m_result; // buffer for all vertices: m_p1, m_p2, m_p3 points to its contents + + void stop(); + void set_error( const QString& message ); + inline void add_triangle( int p1, int p2, int p3 ); + inline void del_triangle( int index ); + inline void add_edge( int p1, int p2 ); + inline void put_at_end( int triangle ); + bool point_in_circum_circle( double x, double y, int triangle ); + }; + +//---------------------------------------------------------------------------------------------// + +inline void MPDelunay::add_edge( int p1, int p2 ) + { + // resize edge buffer + if ( m_edges >= m_edge_buffer_capacity ) { + m_edge_buffer_capacity = m_edge_buffer_capacity * 2 + 8; + edge_data_t *old_buffer = m_edge_data; + edge_data_t *new_buffer = new edge_data_t[m_edge_buffer_capacity]; + for( int i=0; i<m_edges; i++ ) new_buffer[i] = old_buffer[i]; + delete[] old_buffer; + m_edge_data = new_buffer; + } + + edge_data_t *edge = &m_edge_data[m_edges]; + edge->p1 = p1; + edge->p2 = p2; + m_edges++; + } + +//---------------------------------------------------------------------------------------------// + +inline void MPDelunay::add_triangle( int p1, int p2, int p3 ) +// remember to keep order - all completed triangles must be +// at the end of the list + { + // move first completed triangle to the end of the list + m_p1[m_triangles] = m_p1[m_active_triangles]; + m_p2[m_triangles] = m_p2[m_active_triangles]; + m_p3[m_triangles] = m_p3[m_active_triangles]; + m_complete[m_triangles] = true; + // put a new (uncompleted) triangle at this place + m_p1[m_active_triangles] = p1; + m_p2[m_active_triangles] = p2; + m_p3[m_active_triangles] = p3; + m_complete[m_active_triangles] = false; + // do not copy data of completed triangles - it won't be needed anymore + if ( m_triangle_data ) { + m_triangle_data[m_active_triangles].r2 = -1.0; + } + + m_triangles++; + m_active_triangles++; + } + +//---------------------------------------------------------------------------------------------// + +inline void MPDelunay::del_triangle( int index ) +// remeber to keep order - all completed triangles must be +// at the end of the list +// deletes only uncompleted triangle, in the other case, +// screws the list + { + // put the last active triangle at freed place + m_p1[index] = m_p1[m_active_triangles-1]; + m_p2[index] = m_p2[m_active_triangles-1]; + m_p3[index] = m_p3[m_active_triangles-1]; + m_complete[index] = false; + // put the last complete triangle at the place freed by the last active triangle + m_p1[m_active_triangles-1] = m_p1[m_triangles-1]; + m_p2[m_active_triangles-1] = m_p2[m_triangles-1]; + m_p3[m_active_triangles-1] = m_p3[m_triangles-1]; + m_complete[m_active_triangles-1] = true; + // do not copy the data of completed triangle + if ( m_triangle_data ) { + m_triangle_data[index] = m_triangle_data[m_active_triangles-1]; + } + m_triangles--; + m_active_triangles--; + } + +//---------------------------------------------------------------------------------------------// + +inline void MPDelunay::put_at_end( int triangle ) +// put completed triangle at the end of the list, decrease active triangle count +// remeber to keep order - all completed triangles must be +// at the end of the list + { + int p1 = m_p1[triangle]; m_p1[triangle] = m_p1[m_active_triangles-1]; m_p1[m_active_triangles-1] = p1; + int p2 = m_p2[triangle]; m_p2[triangle] = m_p2[m_active_triangles-1]; m_p2[m_active_triangles-1] = p2; + int p3 = m_p3[triangle]; m_p3[triangle] = m_p3[m_active_triangles-1]; m_p3[m_active_triangles-1] = p3; + m_complete[triangle] = false; + m_complete[m_active_triangles-1] = true; + if ( m_triangle_data ) { + triangle_data_t *d1 = &m_triangle_data[triangle]; + triangle_data_t *d2 = &m_triangle_data[m_active_triangles-1]; + triangle_data_t temp = *d1; *d1 = *d2; *d2 = temp; + } + m_active_triangles--; + } + +#endif diff --git a/kmatplot/formula/mpformula.cpp b/kmatplot/formula/mpformula.cpp new file mode 100644 index 0000000..9ddcb08 --- /dev/null +++ b/kmatplot/formula/mpformula.cpp @@ -0,0 +1,283 @@ +/*************************************************************************** + mpformula.cpp + ------------------- + begin : Sun Nov 18 2001 + copyright : (C) 2001 by Kamil + email : kamil@localhost.localdomain + ***************************************************************************/ + +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + +#include "mpformula.h" +#include <iostream.h> +#include <qstring.h> +#include <qobject.h> +// +// TODO: i18n +// ? : +// AND OR XOR +// >=, <= == + + +//---------------------------------------------------------------------------// + +void yyerr( const char *, void *location_info_ptr, void *formula_ptr ) + { + MPFormula *formula = (MPFormula *)formula_ptr; + YYLTYPE *location_info = (YYLTYPE *)location_info_ptr; + formula->m_error->setParseError( location_info->first_column, location_info->last_column ); + } + +//---------------------------------------------------------------------------// + +int yylex( MPParserSymbol *symbol_value, void *location_info_ptr, void *formula_ptr ) + { + MPFormula *formula = (MPFormula *)formula_ptr; + YYLTYPE *location_info = (YYLTYPE *)location_info_ptr; + + QString token; + QChar c = formula->curr_char(); + // eat white spaces + while( c.isSpace() ) { + c = formula->m_formula[++formula->m_char]; + } + + location_info->first_column = formula->m_char; + + // number + if ( c.isDigit() || c == '.' ) { + while ( c.isDigit() ) c = formula->apply_char( token ); + if ( c == '.' ) c = formula->apply_char( token ); + while ( c.isDigit() ) c = formula->apply_char( token ); + if ( c == 'e' || c == 'E' ) { + c = formula->apply_char( token ); + if ( c == '+' || c == '-' ) { + c = formula->apply_char( token ); + while ( c.isDigit() ) c = formula->apply_char( token ); + } + } + *symbol_value = token; + location_info->last_column = formula->m_char-1; + return NUMBER; + } + // identifier - function or variable + else if ( c.isLetter() || c == '_' ) { + while ( c.isLetterOrNumber() || c == '_' ) c = formula->apply_char( token ); + location_info->last_column = formula->m_char-1; + MPSymbol *result = formula->get_symbol( token.latin1(), NULL, location_info->first_column, location_info->last_column ); + if ( result && result->isVariable() ) { + *symbol_value = result; + return VAR; + } + else if ( result ) { + *symbol_value = result; + return FUNC; + } + else { + *symbol_value = token; + return ID; + } + } + else if ( c.isNull() ) { + location_info->last_column = formula->m_char-1; + *symbol_value = MPParserSymbol(); + return END; + } + + location_info->last_column = formula->m_char; + // make the next character the current one. + formula->m_char++; + *symbol_value = MPParserSymbol(); + return c.latin1(); + } + +//---------------------------------------------------------------------------// + +MPFactoryList MPFormula::m_global_symbols; + +//---------------------------------------------------------------------------// + +MPFormula::MPFormula() + { + m_char = 0; + m_local_symbols = NULL; + m_root_sym = NULL; + } + +//---------------------------------------------------------------------------// + +MPFormula::~MPFormula() + { + } + +//---------------------------------------------------------------------------// + +MPSymbol *MPFormula::parse( const QString& formula, MPError& error, MPFactoryList *locals ) + { + m_char = 0; + m_error = &error; + m_formula = formula; + m_root_sym = NULL; + m_local_symbols = locals; + + yyparse( (void *)this ); + + if ( m_root_sym ) { + m_root_sym->checkArgs( error ); + if ( error.hasError() ) { + delete m_root_sym; + m_root_sym = NULL; + } + } + return m_root_sym; + } + +//---------------------------------------------------------------------------// + +QChar MPFormula::curr_char() const + { + return m_formula[m_char]; + } + +//---------------------------------------------------------------------------// + +QChar MPFormula::apply_char( QString& append_to ) + { + append_to += m_formula[m_char++]; + return m_formula[m_char]; + } + +//---------------------------------------------------------------------------// + +void MPFormula::addGlobalSymbols( MPSymbolFactory *factory ) + { + m_global_symbols.prepend( factory ); + } + +//---------------------------------------------------------------------------// + +void MPFormula::delGlobalSymbols( MPSymbolFactory *factory ) + { + m_global_symbols.remove( factory ); + } + +//---------------------------------------------------------------------------// + +MPSymbol *MPFormula::get_symbol( const QString &identifier, MPSymbolList *args, int colFrom, int colTo ) +// sets undefined error in the case of error + { + // no support for unicode yet + const char *id = identifier.latin1(); + + MPSymbol *result = NULL; + + // search through local symbols + if ( m_local_symbols ) + for ( MPSymbolFactory *f=m_local_symbols->first(); ( f && !result ); f=m_local_symbols->next() ) { + result = f->create( id, args, colFrom, colTo ); + } + // search through global symbols + for ( MPSymbolFactory *f=m_global_symbols.first(); ( f && !result ); f=m_global_symbols.next() ) { + result = f->create( id, args, colFrom, colTo ); + } + + return result; + } + + +//--------------------------------------------------------------------------// +//--------------------------------------------------------------------------// +//--------------------------------------------------------------------------// +//--------------------------------------------------------------------------// +//--------------------------------------------------------------------------// +//--------------------------------------------------------------------------// + +MPFormulaError::MPFormulaError() +:MPError() + { + } + +//--------------------------------------------------------------------------// + +MPFormulaError::~MPFormulaError() + { + } + +//--------------------------------------------------------------------------// + +void MPFormulaError::setWrongNumberOfArguments( int currArgs, int correctArgs, MPSymbol *expression ) + { + if ( m_type == None ) { + MPError::setWrongNumberOfArguments( currArgs, correctArgs, expression ); + m_msg = QObject::tr(" Wrong number of arguments ( is %1, sould be %2 ). \n" ).arg(currArgs).arg(correctArgs)+standard_message( expression ); + } + } + +//--------------------------------------------------------------------------// + +void MPFormulaError::setNonconformantArgument( int arg_nr, MPSymbol *expression, MPSymbol *sym ) + { + if ( m_type == None ) { + MPError::setNonconformantArgument( arg_nr, expression, sym ); + m_msg = QObject::tr( "Nonconformat argument %1 '%2' at columns %3-%4\n" ) + .arg( arg_nr ) + .arg( expression->identifier() ) + .arg( expression->colFrom() ) + .arg( expression->colTo() ) + +standard_message( sym ); + } + } + +//--------------------------------------------------------------------------// + +void MPFormulaError::setError( const char *message, MPSymbol *expression ) + { + if ( m_type == None ) { + MPError::setError( message, expression ); + m_msg = QObject::tr(message)+"\n"+standard_message( expression ); + } + } + +//--------------------------------------------------------------------------// + +void MPFormulaError::setUndefinedSymbol( const char *symbol, int colFrom, int colTo ) + { + if ( m_type == None ) { + MPError::setUndefinedSymbol( symbol, colFrom, colTo ); + m_msg = QObject::tr(" Undefined symbol '%1' at columns %2-%3 ." ).arg( symbol ).arg( colFrom ).arg( colTo ); + } + } + +//--------------------------------------------------------------------------// + +void MPFormulaError::setParseError( int colFrom, int colTo ) + { + if ( m_type == None ) { + MPError::setParseError( colFrom, colTo ); + m_msg = QObject::tr(" Parse error at columns %2-%3 ." ).arg( colFrom ).arg( colTo ); + } + } + +//--------------------------------------------------------------------------// + +QString MPFormulaError::standard_message( MPSymbol *expression ) + { + return QObject::tr(" Evaluating '%1' at columns %2-%3 . " ) + .arg( expression->identifier() ) + .arg( expression->colFrom() ) + .arg( expression->colTo() ); + + } + + + + + + diff --git a/kmatplot/formula/mpformula.h b/kmatplot/formula/mpformula.h new file mode 100644 index 0000000..28945de --- /dev/null +++ b/kmatplot/formula/mpformula.h @@ -0,0 +1,102 @@ +/*************************************************************************** + mpformula.h + ------------------- + begin : Sun Nov 18 2001 + copyright : (C) 2001 by Kamil + email : kamil@localhost.localdomain + ***************************************************************************/ + +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + +#ifndef MPFORMULA_H +#define MPFORMULA_H + +#include <qstring.h> +#include <qptrlist.h> +#include "mpparser.cpp.h" +#include "mpparsersymbol.h" + +//---------------------------------------------------------------------------// + +/** + * List of factories + */ +class MPFactoryList : public QPtrList<MPSymbolFactory> + { + public: + MPFactoryList() : QPtrList<MPSymbolFactory>() { setAutoDelete(TRUE); } + MPFactoryList( MPSymbolFactory *oneElement ) { setAutoDelete(TRUE); append(oneElement); } + ~MPFactoryList() {} + }; + +//---------------------------------------------------------------------------// +/** + * Parses string and returns an expression tree. + * MPSymbol *QSFormula::parse( const QString& formula, MPError& error, FactoryList *locals ) + * @author Kamil + */ +class MPFormula { + friend int yylex( MPParserSymbol *symbol_value, void *location_info_ptr, void *formula_ptr ); + friend void yyerr( const char *message, void *location_info_ptr, void *formula_ptr ); + friend int yyparse( void *formula_ptr ); + public: + /** + * Constructor. + */ + MPFormula(); + /** + * Destructor + */ + virtual ~MPFormula(); + /** + * Parses the given string and returns expression. If the error occurs the NULL is + * returned and error info is passes in 'error' object. + */ + MPSymbol *parse( const QString& formula, MPError& error, MPFactoryList *locals=NULL ); + /** + * Adds global symbols. They will be shared by all QSFormula objects. + */ + static void addGlobalSymbols( MPSymbolFactory *factory ); + /** + * Removes a global symbols. + */ + static void delGlobalSymbols( MPSymbolFactory *factory ); + + private: + int m_char; + QString m_formula; + MPSymbol *m_root_sym; + MPError *m_error; + MPFactoryList *m_local_symbols; + static MPFactoryList m_global_symbols; + + QChar curr_char() const; + QChar apply_char( QString& append_to ); + MPSymbol *get_symbol( const QString &id, MPSymbolList *args, int colFrom, int colTo ); + }; + +//----------------------------------------------------------------------------------------------// + +class MPFormulaError : public MPError { + public: + MPFormulaError(); + virtual ~MPFormulaError(); + virtual void setWrongNumberOfArguments( int currArgs, int correctArgs, MPSymbol *expression ); + virtual void setNonconformantArgument( int arg_nr, MPSymbol *expression, MPSymbol *sym ); + virtual void setUndefinedSymbol( const char *symbol, int colFrom, int colTo ); + virtual void setParseError( int colFrom, int colTo ); + virtual void setError( const char *message, MPSymbol *expression ); + QString message() { return m_msg; } + private: + QString m_msg; + QString standard_message( MPSymbol *expression ); + }; + +#endif diff --git a/kmatplot/formula/mpparser.cpp b/kmatplot/formula/mpparser.cpp new file mode 100644 index 0000000..fafbaa3 --- /dev/null +++ b/kmatplot/formula/mpparser.cpp @@ -0,0 +1,1161 @@ + +/* A Bison parser, made from mpparser.y + by GNU Bison version 1.28 */ + +#define YYBISON 1 /* Identify Bison output. */ + +#define YYLSP_NEEDED + +#define NUMBER 257 +#define END 258 +#define VAR 259 +#define FUNC 260 +#define ID 261 +#define UNARY_MINUS 262 + + +#define YYDEBUG 1 +#define YYSTYPE MPParserSymbol +#define YYPARSE_PARAM formula_object +#define YYLEX_PARAM formula_object +#define YYERROR_VERBOSE 1 +//#define YYPRINT(file, type, value) debug_print( formula_object, &yylloc, type, value ) +#define yyerror(message) yyerr( message, &yylloc, formula_object ) +#include "mpformula.h" +#include "mpparsersymbol.h" +#include "mpsymbols.h" +#include <math.h> +#include <stdlib.h> +void yyerr( const char *message, void *location_info_ptr, void *formula_ptr ); +int yylex( YYSTYPE *symbol_value, void *location_info_ptr, void *formula_ptr ); +#ifndef YYSTYPE +#define YYSTYPE int +#endif + +#ifndef YYLTYPE +typedef + struct yyltype + { + int timestamp; + int first_line; + int first_column; + int last_line; + int last_column; + char *text; + } + yyltype; + +#define YYLTYPE yyltype +#endif + +#include <stdio.h> + +#ifndef __cplusplus +#ifndef __STDC__ +#define const +#endif +#endif + + + +#define YYFINAL 52 +#define YYFLAG -32768 +#define YYNTBASE 21 + +#define YYTRANSLATE(x) ((unsigned)(x) <= 262 ? yytranslate[x] : 31) + +static const char yytranslate[] = { 0, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 9, 15, + 16, 13, 11, 20, 12, 2, 14, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 10, 19, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 17, 2, 18, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 1, 3, 4, 5, 6, + 7, 8 +}; + +#if YYDEBUG != 0 +static const short yyprhs[] = { 0, + 0, 3, 5, 7, 11, 15, 19, 23, 25, 29, + 33, 35, 40, 42, 44, 46, 48, 53, 57, 61, + 64, 67, 69, 73, 75, 79, 80, 82, 86, 88 +}; + +static const short yyrhs[] = { 22, + 4, 0, 24, 0, 23, 0, 24, 10, 24, 0, + 23, 10, 24, 0, 24, 11, 25, 0, 24, 12, + 25, 0, 25, 0, 25, 13, 26, 0, 25, 14, + 26, 0, 26, 0, 26, 15, 30, 16, 0, 27, + 0, 3, 0, 7, 0, 5, 0, 6, 15, 30, + 16, 0, 17, 28, 18, 0, 15, 22, 16, 0, + 12, 27, 0, 27, 9, 0, 29, 0, 28, 19, + 29, 0, 24, 0, 29, 20, 22, 0, 0, 22, + 0, 30, 20, 22, 0, 10, 0, 30, 20, 10, + 0 +}; + +#endif + +#if YYDEBUG != 0 +static const short yyrline[] = { 0, + 30, 37, 41, 52, 56, 66, 72, 77, 82, 88, + 93, 102, 116, 121, 127, 133, 137, 143, 147, 150, + 156, 167, 173, 191, 194, 204, 207, 210, 214, 217 +}; +#endif + + +#if YYDEBUG != 0 || defined (YYERROR_VERBOSE) + +static const char * const yytname[] = { "$","error","$undefined.","NUMBER", +"END","VAR","FUNC","ID","UNARY_MINUS","'\\''","':'","'+'","'-'","'*'","'/'", +"'('","')'","'['","']'","';'","','","input","top_expr","colon_expr","expr","basic_expr", +"indexed_expr","simple_expr","matrix","vector","arg_list", NULL +}; +#endif + +static const short yyr1[] = { 0, + 21, 22, 22, 23, 23, 24, 24, 24, 25, 25, + 25, 26, 26, 27, 27, 27, 27, 27, 27, 27, + 27, 28, 28, 29, 29, 30, 30, 30, 30, 30 +}; + +static const short yyr2[] = { 0, + 2, 1, 1, 3, 3, 3, 3, 1, 3, 3, + 1, 4, 1, 1, 1, 1, 4, 3, 3, 2, + 2, 1, 3, 1, 3, 0, 1, 3, 1, 3 +}; + +static const short yydefact[] = { 0, + 14, 16, 0, 15, 0, 0, 0, 0, 3, 2, + 8, 11, 13, 26, 20, 0, 24, 0, 22, 1, + 0, 0, 0, 0, 0, 0, 26, 21, 29, 27, + 0, 19, 18, 0, 0, 5, 4, 6, 7, 9, + 10, 0, 17, 0, 23, 25, 12, 30, 28, 0, + 0, 0 +}; + +static const short yydefgoto[] = { 50, + 30, 9, 10, 11, 12, 13, 18, 19, 31 +}; + +static const short yypact[] = { 31, +-32768,-32768, -2,-32768, 31, 31, 31, 22, 32, -8, + -3, 16, 38, 2, 38, 35, 12, 21, 34,-32768, + 31, 31, 31, 31, 31, 31, 2,-32768,-32768,-32768, + 13,-32768,-32768, 31, 31, 12, 12, -3, -3, 16, + 16, 25,-32768, 15, 34,-32768,-32768,-32768,-32768, 55, + 56,-32768 +}; + +static const short yypgoto[] = {-32768, + 0,-32768, -6, 26, 27, 52,-32768, 24, 33 +}; + + +#define YYLAST 60 + + +static const short yytable[] = { 8, + 17, 22, 23, 24, 1, 16, 2, 3, 4, 25, + 26, 29, 14, 5, 36, 37, 6, 1, 7, 2, + 3, 4, 23, 24, 48, 20, 5, 17, 43, 6, + 27, 7, 44, 1, 46, 2, 3, 4, 33, 34, + 47, 21, 5, 49, 44, 6, 28, 7, 38, 39, + 32, 40, 41, 35, 51, 52, 15, 45, 0, 42 +}; + +static const short yycheck[] = { 0, + 7, 10, 11, 12, 3, 6, 5, 6, 7, 13, + 14, 10, 15, 12, 21, 22, 15, 3, 17, 5, + 6, 7, 11, 12, 10, 4, 12, 34, 16, 15, + 15, 17, 20, 3, 35, 5, 6, 7, 18, 19, + 16, 10, 12, 44, 20, 15, 9, 17, 23, 24, + 16, 25, 26, 20, 0, 0, 5, 34, -1, 27 +}; +#define YYPURE 1 + +/* -*-C-*- Note some compilers choke on comments on `#line' lines. */ + +/* This file comes from bison-1.28. */ + +/* Skeleton output parser for bison, + Copyright (C) 1984, 1989, 1990 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +/* As a special exception, when this file is copied by Bison into a + Bison output file, you may use that output file without restriction. + This special exception was added by the Free Software Foundation + in version 1.24 of Bison. */ + +/* This is the parser code that is written into each bison parser + when the %semantic_parser declaration is not specified in the grammar. + It was written by Richard Stallman by simplifying the hairy parser + used when %semantic_parser is specified. */ + +#ifndef YYSTACK_USE_ALLOCA +#ifdef alloca +#define YYSTACK_USE_ALLOCA +#else /* alloca not defined */ +#ifdef __GNUC__ +#define YYSTACK_USE_ALLOCA +#define alloca __builtin_alloca +#else /* not GNU C. */ +#if (!defined (__STDC__) && defined (sparc)) || defined (__sparc__) || defined (__sparc) || defined (__sgi) || (defined (__sun) && defined (__i386)) +#define YYSTACK_USE_ALLOCA +#include <alloca.h> +#else /* not sparc */ +/* We think this test detects Watcom and Microsoft C. */ +/* This used to test MSDOS, but that is a bad idea + since that symbol is in the user namespace. */ +#if (defined (_MSDOS) || defined (_MSDOS_)) && !defined (__TURBOC__) +#if 0 /* No need for malloc.h, which pollutes the namespace; + instead, just don't use alloca. */ +#include <malloc.h> +#endif +#else /* not MSDOS, or __TURBOC__ */ +#if defined(_AIX) +/* I don't know what this was needed for, but it pollutes the namespace. + So I turned it off. rms, 2 May 1997. */ +/* #include <malloc.h> */ + #pragma alloca +#define YYSTACK_USE_ALLOCA +#else /* not MSDOS, or __TURBOC__, or _AIX */ +#if 0 +#ifdef __hpux /* haible@ilog.fr says this works for HPUX 9.05 and up, + and on HPUX 10. Eventually we can turn this on. */ +#define YYSTACK_USE_ALLOCA +#define alloca __builtin_alloca +#endif /* __hpux */ +#endif +#endif /* not _AIX */ +#endif /* not MSDOS, or __TURBOC__ */ +#endif /* not sparc */ +#endif /* not GNU C */ +#endif /* alloca not defined */ +#endif /* YYSTACK_USE_ALLOCA not defined */ + +#ifdef YYSTACK_USE_ALLOCA +#define YYSTACK_ALLOC alloca +#else +#define YYSTACK_ALLOC malloc +#endif + +/* Note: there must be only one dollar sign in this file. + It is replaced by the list of actions, each action + as one case of the switch. */ + +#define yyerrok (yyerrstatus = 0) +#define yyclearin (yychar = YYEMPTY) +#define YYEMPTY -2 +#define YYEOF 0 +#define YYACCEPT goto yyacceptlab +#define YYABORT goto yyabortlab +#define YYERROR goto yyerrlab1 +/* Like YYERROR except do call yyerror. + This remains here temporarily to ease the + transition to the new meaning of YYERROR, for GCC. + Once GCC version 2 has supplanted version 1, this can go. */ +#define YYFAIL goto yyerrlab +#define YYRECOVERING() (!!yyerrstatus) +#define YYBACKUP(token, value) \ +do \ + if (yychar == YYEMPTY && yylen == 1) \ + { yychar = (token), yylval = (value); \ + yychar1 = YYTRANSLATE (yychar); \ + YYPOPSTACK; \ + goto yybackup; \ + } \ + else \ + { yyerror ("syntax error: cannot back up"); YYERROR; } \ +while (0) + +#define YYTERROR 1 +#define YYERRCODE 256 + +#ifndef YYPURE +#define YYLEX yylex() +#endif + +#ifdef YYPURE +#ifdef YYLSP_NEEDED +#ifdef YYLEX_PARAM +#define YYLEX yylex(&yylval, &yylloc, YYLEX_PARAM) +#else +#define YYLEX yylex(&yylval, &yylloc) +#endif +#else /* not YYLSP_NEEDED */ +#ifdef YYLEX_PARAM +#define YYLEX yylex(&yylval, YYLEX_PARAM) +#else +#define YYLEX yylex(&yylval) +#endif +#endif /* not YYLSP_NEEDED */ +#endif + +/* If nonreentrant, generate the variables here */ + +#ifndef YYPURE + +int yychar; /* the lookahead symbol */ +YYSTYPE yylval; /* the semantic value of the */ + /* lookahead symbol */ + +#ifdef YYLSP_NEEDED +YYLTYPE yylloc; /* location data for the lookahead */ + /* symbol */ +#endif + +int yynerrs; /* number of parse errors so far */ +#endif /* not YYPURE */ + +#if YYDEBUG != 0 +int yydebug; /* nonzero means print parse trace */ +/* Since this is uninitialized, it does not stop multiple parsers + from coexisting. */ +#endif + +/* YYINITDEPTH indicates the initial size of the parser's stacks */ + +#ifndef YYINITDEPTH +#define YYINITDEPTH 200 +#endif + +/* YYMAXDEPTH is the maximum size the stacks can grow to + (effective only if the built-in stack extension method is used). */ + +#if YYMAXDEPTH == 0 +#undef YYMAXDEPTH +#endif + +#ifndef YYMAXDEPTH +#define YYMAXDEPTH 10000 +#endif + +/* Define __yy_memcpy. Note that the size argument + should be passed with type unsigned int, because that is what the non-GCC + definitions require. With GCC, __builtin_memcpy takes an arg + of type size_t, but it can handle unsigned int. */ + +#if __GNUC__ > 1 /* GNU C and GNU C++ define this. */ +#define __yy_memcpy(TO,FROM,COUNT) __builtin_memcpy(TO,FROM,COUNT) +#else /* not GNU C or C++ */ +#ifndef __cplusplus + +/* This is the most reliable way to avoid incompatibilities + in available built-in functions on various systems. */ +static void +__yy_memcpy (to, from, count) + char *to; + char *from; + unsigned int count; +{ + register char *f = from; + register char *t = to; + register int i = count; + + while (i-- > 0) + *t++ = *f++; +} + +#else /* __cplusplus */ + +/* This is the most reliable way to avoid incompatibilities + in available built-in functions on various systems. */ +static void +__yy_memcpy (char *to, char *from, unsigned int count) +{ + register char *t = to; + register char *f = from; + register int i = count; + + while (i-- > 0) + *t++ = *f++; +} + +#endif +#endif + + + +/* The user can define YYPARSE_PARAM as the name of an argument to be passed + into yyparse. The argument should have type void *. + It should actually point to an object. + Grammar actions can access the variable by casting it + to the proper pointer type. */ + +#ifdef YYPARSE_PARAM +#ifdef __cplusplus +#define YYPARSE_PARAM_ARG void *YYPARSE_PARAM +#define YYPARSE_PARAM_DECL +#else /* not __cplusplus */ +#define YYPARSE_PARAM_ARG YYPARSE_PARAM +#define YYPARSE_PARAM_DECL void *YYPARSE_PARAM; +#endif /* not __cplusplus */ +#else /* not YYPARSE_PARAM */ +#define YYPARSE_PARAM_ARG +#define YYPARSE_PARAM_DECL +#endif /* not YYPARSE_PARAM */ + +/* Prevent warning if -Wstrict-prototypes. */ +#ifdef __GNUC__ +#ifdef YYPARSE_PARAM +int yyparse (void *); +#else +int yyparse (void); +#endif +#endif + +int +yyparse(YYPARSE_PARAM_ARG) + YYPARSE_PARAM_DECL +{ + register int yystate; + register int yyn; + register short *yyssp; + register YYSTYPE *yyvsp; + int yyerrstatus; /* number of tokens to shift before error messages enabled */ + int yychar1 = 0; /* lookahead token as an internal (translated) token number */ + + short yyssa[YYINITDEPTH]; /* the state stack */ + YYSTYPE yyvsa[YYINITDEPTH]; /* the semantic value stack */ + + short *yyss = yyssa; /* refer to the stacks thru separate pointers */ + YYSTYPE *yyvs = yyvsa; /* to allow yyoverflow to reallocate them elsewhere */ + +#ifdef YYLSP_NEEDED + YYLTYPE yylsa[YYINITDEPTH]; /* the location stack */ + YYLTYPE *yyls = yylsa; + YYLTYPE *yylsp; + +#define YYPOPSTACK (yyvsp--, yyssp--, yylsp--) +#else +#define YYPOPSTACK (yyvsp--, yyssp--) +#endif + + int yystacksize = YYINITDEPTH; + int yyfree_stacks = 0; + +#ifdef YYPURE + int yychar; + YYSTYPE yylval; + int yynerrs; +#ifdef YYLSP_NEEDED + YYLTYPE yylloc; +#endif +#endif + + YYSTYPE yyval; /* the variable used to return */ + /* semantic values from the action */ + /* routines */ + + int yylen; + +#if YYDEBUG != 0 + if (yydebug) + fprintf(stderr, "Starting parse\n"); +#endif + + yystate = 0; + yyerrstatus = 0; + yynerrs = 0; + yychar = YYEMPTY; /* Cause a token to be read. */ + + /* Initialize stack pointers. + Waste one element of value and location stack + so that they stay on the same level as the state stack. + The wasted elements are never initialized. */ + + yyssp = yyss - 1; + yyvsp = yyvs; +#ifdef YYLSP_NEEDED + yylsp = yyls; +#endif + +/* Push a new state, which is found in yystate . */ +/* In all cases, when you get here, the value and location stacks + have just been pushed. so pushing a state here evens the stacks. */ +yynewstate: + + *++yyssp = yystate; + + if (yyssp >= yyss + yystacksize - 1) + { + /* Give user a chance to reallocate the stack */ + /* Use copies of these so that the &'s don't force the real ones into memory. */ + YYSTYPE *yyvs1 = yyvs; + short *yyss1 = yyss; +#ifdef YYLSP_NEEDED + YYLTYPE *yyls1 = yyls; +#endif + + /* Get the current used size of the three stacks, in elements. */ + int size = yyssp - yyss + 1; + +#ifdef yyoverflow + /* Each stack pointer address is followed by the size of + the data in use in that stack, in bytes. */ +#ifdef YYLSP_NEEDED + /* This used to be a conditional around just the two extra args, + but that might be undefined if yyoverflow is a macro. */ + yyoverflow("parser stack overflow", + &yyss1, size * sizeof (*yyssp), + &yyvs1, size * sizeof (*yyvsp), + &yyls1, size * sizeof (*yylsp), + &yystacksize); +#else + yyoverflow("parser stack overflow", + &yyss1, size * sizeof (*yyssp), + &yyvs1, size * sizeof (*yyvsp), + &yystacksize); +#endif + + yyss = yyss1; yyvs = yyvs1; +#ifdef YYLSP_NEEDED + yyls = yyls1; +#endif +#else /* no yyoverflow */ + /* Extend the stack our own way. */ + if (yystacksize >= YYMAXDEPTH) + { + yyerror("parser stack overflow"); + if (yyfree_stacks) + { + free (yyss); + free (yyvs); +#ifdef YYLSP_NEEDED + free (yyls); +#endif + } + return 2; + } + yystacksize *= 2; + if (yystacksize > YYMAXDEPTH) + yystacksize = YYMAXDEPTH; +#ifndef YYSTACK_USE_ALLOCA + yyfree_stacks = 1; +#endif + yyss = (short *) YYSTACK_ALLOC (yystacksize * sizeof (*yyssp)); + __yy_memcpy ((char *)yyss, (char *)yyss1, + size * (unsigned int) sizeof (*yyssp)); + yyvs = (YYSTYPE *) YYSTACK_ALLOC (yystacksize * sizeof (*yyvsp)); + __yy_memcpy ((char *)yyvs, (char *)yyvs1, + size * (unsigned int) sizeof (*yyvsp)); +#ifdef YYLSP_NEEDED + yyls = (YYLTYPE *) YYSTACK_ALLOC (yystacksize * sizeof (*yylsp)); + __yy_memcpy ((char *)yyls, (char *)yyls1, + size * (unsigned int) sizeof (*yylsp)); +#endif +#endif /* no yyoverflow */ + + yyssp = yyss + size - 1; + yyvsp = yyvs + size - 1; +#ifdef YYLSP_NEEDED + yylsp = yyls + size - 1; +#endif + +#if YYDEBUG != 0 + if (yydebug) + fprintf(stderr, "Stack size increased to %d\n", yystacksize); +#endif + + if (yyssp >= yyss + yystacksize - 1) + YYABORT; + } + +#if YYDEBUG != 0 + if (yydebug) + fprintf(stderr, "Entering state %d\n", yystate); +#endif + + goto yybackup; + yybackup: + +/* Do appropriate processing given the current state. */ +/* Read a lookahead token if we need one and don't already have one. */ +/* yyresume: */ + + /* First try to decide what to do without reference to lookahead token. */ + + yyn = yypact[yystate]; + if (yyn == YYFLAG) + goto yydefault; + + /* Not known => get a lookahead token if don't already have one. */ + + /* yychar is either YYEMPTY or YYEOF + or a valid token in external form. */ + + if (yychar == YYEMPTY) + { +#if YYDEBUG != 0 + if (yydebug) + fprintf(stderr, "Reading a token: "); +#endif + yychar = YYLEX; + } + + /* Convert token to internal form (in yychar1) for indexing tables with */ + + if (yychar <= 0) /* This means end of input. */ + { + yychar1 = 0; + yychar = YYEOF; /* Don't call YYLEX any more */ + +#if YYDEBUG != 0 + if (yydebug) + fprintf(stderr, "Now at end of input.\n"); +#endif + } + else + { + yychar1 = YYTRANSLATE(yychar); + +#if YYDEBUG != 0 + if (yydebug) + { + fprintf (stderr, "Next token is %d (%s", yychar, yytname[yychar1]); + /* Give the individual parser a way to print the precise meaning + of a token, for further debugging info. */ +#ifdef YYPRINT + YYPRINT (stderr, yychar, yylval); +#endif + fprintf (stderr, ")\n"); + } +#endif + } + + yyn += yychar1; + if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != yychar1) + goto yydefault; + + yyn = yytable[yyn]; + + /* yyn is what to do for this token type in this state. + Negative => reduce, -yyn is rule number. + Positive => shift, yyn is new state. + New state is final state => don't bother to shift, + just return success. + 0, or most negative number => error. */ + + if (yyn < 0) + { + if (yyn == YYFLAG) + goto yyerrlab; + yyn = -yyn; + goto yyreduce; + } + else if (yyn == 0) + goto yyerrlab; + + if (yyn == YYFINAL) + YYACCEPT; + + /* Shift the lookahead token. */ + +#if YYDEBUG != 0 + if (yydebug) + fprintf(stderr, "Shifting token %d (%s), ", yychar, yytname[yychar1]); +#endif + + /* Discard the token being shifted unless it is eof. */ + if (yychar != YYEOF) + yychar = YYEMPTY; + + *++yyvsp = yylval; +#ifdef YYLSP_NEEDED + *++yylsp = yylloc; +#endif + + /* count tokens shifted since error; after three, turn off error status. */ + if (yyerrstatus) yyerrstatus--; + + yystate = yyn; + goto yynewstate; + +/* Do the default action for the current state. */ +yydefault: + + yyn = yydefact[yystate]; + if (yyn == 0) + goto yyerrlab; + +/* Do a reduction. yyn is the number of a rule to reduce with. */ +yyreduce: + yylen = yyr2[yyn]; + if (yylen > 0) + yyval = yyvsp[1-yylen]; /* implement default value of the action */ + +#if YYDEBUG != 0 + if (yydebug) + { + int i; + + fprintf (stderr, "Reducing via rule %d (line %d), ", + yyn, yyrline[yyn]); + + /* Print the symbols being reduced, and their result. */ + for (i = yyprhs[yyn]; yyrhs[i] > 0; i++) + fprintf (stderr, "%s ", yytname[yyrhs[i]]); + fprintf (stderr, " -> %s\n", yytname[yyr1[yyn]]); + } +#endif + + + switch (yyn) { + +case 1: +{ + ((MPFormula *)formula_object)->m_root_sym = yyvsp[-1].takeSym(); + YYACCEPT + ; + break;} +case 2: +{ + yyval = yyvsp[0]; + ; + break;} +case 3: +{ + yyval = new MPSymColonExpr( yyvsp[0].takeSymList(), + yylsp[0].first_column, yylsp[0].last_column, "colon expression" ); + ; + break;} +case 4: +{ + yyval = new MPSymbolList( yyvsp[-2].takeSym(), yyvsp[0].takeSym() ); + ; + break;} +case 5: +{ + /* only three-element colon expressions are allowed. + If it is more than three elements an error will be + raised during syntax checking */ + yyvsp[-2].symList()->add( yyvsp[0].takeSym() ); + yyval = yyvsp[-2]; + ; + break;} +case 6: +{ + yyval = new MPSymFunction2( MPSymFunction2::ADD, + new MPSymbolList( yyvsp[-2].takeSym(), yyvsp[0].takeSym() ), + yylsp[-1].first_column, yylsp[-1].last_column, "operator +" ); + ; + break;} +case 7: +{ + yyval = new MPSymFunction2( MPSymFunction2::SUB, + new MPSymbolList( yyvsp[-2].takeSym(), yyvsp[0].takeSym() ), + yylsp[-1].first_column, yylsp[-1].last_column, "operator -" ); + ; + break;} +case 8: +{ + yyval = yyvsp[0]; + ; + break;} +case 9: +{ + yyval = new MPSymFunction2( MPSymFunction2::MUL, + new MPSymbolList( yyvsp[-2].takeSym(), yyvsp[0].takeSym() ), + yylsp[-1].first_column, yylsp[-1].last_column, "operator *" ); + ; + break;} +case 10: +{ + yyval = new MPSymFunction2( MPSymFunction2::DIV, + new MPSymbolList( yyvsp[-2].takeSym(), yyvsp[0].takeSym() ), + yylsp[-1].first_column, yylsp[-1].last_column, "operator /" ); + ; + break;} +case 11: +{ + yyval = yyvsp[0]; + ; + break;} +case 12: +{ + // Matrix indices for example sheet(2:4,5:7) - highest priority + if ( yyvsp[-1].symList()->count() == 1 ) { + // single index for vectors + yyval = new MPSymVectorIndexer( yyvsp[-3].takeSym(), yyvsp[-1].takeSymList(), + yylsp[-2].first_column, yylsp[0].last_column, "index operator()" ); + } else { + // double index for matrices + yyval = new MPSymMatrixIndexer( yyvsp[-3].takeSym(), yyvsp[-1].takeSymList(), + yylsp[-2].first_column, yylsp[0].last_column, "index operator()" ); + } + + ; + break;} +case 13: +{ + yyval = yyvsp[0]; + ; + break;} +case 14: +{ + /* Floating-point number */ + yyval = new MPSymValue( yyvsp[0].token().toDouble(), + yylsp[0].first_column, yylsp[0].last_column, yyvsp[0].token().latin1() ); + ; + break;} +case 15: +{ + /* Identifier which is neither a variable nor function */ + ((MPFormula *)formula_object)->m_error->setUndefinedSymbol( yyvsp[0].token().latin1(), + yylsp[0].first_column, yylsp[0].last_column ); + YYABORT + ; + break;} +case 16: +{ + /* Variable, must be used without parenthesis and arguments ( see below ) */ + yyval = yyvsp[0]; + ; + break;} +case 17: +{ + /* Function - it must be called as function() or function(args) */ + // TODO: symbol ':' isn't allowed in functions - you should check it + yyvsp[-3].sym()->setArgs( yyvsp[-1].takeSymList() ); + yyval = yyvsp[-3]; + ; + break;} +case 18: +{ + /* Matrix definition [2, 3; 4, 5] */ + yyval = new MPSymMatrix( yyvsp[-1].takeSymList(), yylsp[-2].first_column, yylsp[0].last_column, "matrix" ) + ; + break;} +case 19: +{ + yyval = yyvsp[-1]; + ; + break;} +case 20: +{ + /* Unary minus has lower priority than transposition */ + yyval = new MPSymFunction1( MPSymFunction1::NEG, + new MPSymbolList( yyvsp[0].takeSym() ), + yylsp[-1].first_column, yylsp[-1].last_column, "operator unary-" ); + ; + break;} +case 21: +{ + /* Transposition */ + yyval = new MPSymTranspose( new MPSymbolList( yyvsp[-1].takeSym() ), + yylsp[0].first_column, yylsp[0].last_column, "operator ' ( transpose )" ); + ; + break;} +case 22: +{ + MPSymbol *vector = new MPSymVector( yyvsp[0].takeSymList(), + yylsp[0].first_column, yylsp[0].last_column, "row" ); + yyval = new MPSymbolList( vector ); + ; + break;} +case 23: +{ + MPSymbol *vector = new MPSymVector( yyvsp[0].takeSymList(), + yylsp[0].first_column, yylsp[0].last_column, "row" ); + yyvsp[-2].symList()->add( vector ); + yyval = yyvsp[-2]; + ; + break;} +case 24: +{ + yyval = new MPSymbolList( yyvsp[0].takeSym() ); + ; + break;} +case 25: +{ + yyvsp[-2].symList()->add( yyvsp[0].takeSym() ); + yyval = yyvsp[-2]; + ; + break;} +case 26: +{ + yyval = new MPSymbolList(); + ; + break;} +case 27: +{ + yyval = new MPSymbolList( yyvsp[0].takeSym() ); + ; + break;} +case 28: +{ + yyvsp[-2].symList()->add( yyvsp[0].takeSym() ); + yyval = yyvsp[-2]; + ; + break;} +case 29: +{ + yyval = new MPSymbolList( new MPSymColon( yylsp[0].first_column, yylsp[0].last_column, ":" ) ); + ; + break;} +case 30: +{ + /* 2 x @3.last_column */ + yyvsp[-2].symList()->add( new MPSymColon( yylsp[0].last_column, yylsp[0].last_column, ":" ) ); + yyval = yyvsp[-2]; + ; + break;} +} + /* the action file gets copied in in place of this dollarsign */ + + + yyvsp -= yylen; + yyssp -= yylen; +#ifdef YYLSP_NEEDED + yylsp -= yylen; +#endif + +#if YYDEBUG != 0 + if (yydebug) + { + short *ssp1 = yyss - 1; + fprintf (stderr, "state stack now"); + while (ssp1 != yyssp) + fprintf (stderr, " %d", *++ssp1); + fprintf (stderr, "\n"); + } +#endif + + *++yyvsp = yyval; + +#ifdef YYLSP_NEEDED + yylsp++; + if (yylen == 0) + { + yylsp->first_line = yylloc.first_line; + yylsp->first_column = yylloc.first_column; + yylsp->last_line = (yylsp-1)->last_line; + yylsp->last_column = (yylsp-1)->last_column; + yylsp->text = 0; + } + else + { + yylsp->last_line = (yylsp+yylen-1)->last_line; + yylsp->last_column = (yylsp+yylen-1)->last_column; + } +#endif + + /* Now "shift" the result of the reduction. + Determine what state that goes to, + based on the state we popped back to + and the rule number reduced by. */ + + yyn = yyr1[yyn]; + + yystate = yypgoto[yyn - YYNTBASE] + *yyssp; + if (yystate >= 0 && yystate <= YYLAST && yycheck[yystate] == *yyssp) + yystate = yytable[yystate]; + else + yystate = yydefgoto[yyn - YYNTBASE]; + + goto yynewstate; + +yyerrlab: /* here on detecting error */ + + if (! yyerrstatus) + /* If not already recovering from an error, report this error. */ + { + ++yynerrs; + +#ifdef YYERROR_VERBOSE + yyn = yypact[yystate]; + + if (yyn > YYFLAG && yyn < YYLAST) + { + int size = 0; + char *msg; + int x, count; + + count = 0; + /* Start X at -yyn if nec to avoid negative indexes in yycheck. */ + for (x = (yyn < 0 ? -yyn : 0); + x < (sizeof(yytname) / sizeof(char *)); x++) + if (yycheck[x + yyn] == x) + size += strlen(yytname[x]) + 15, count++; + msg = (char *) malloc(size + 15); + if (msg != 0) + { + strcpy(msg, "parse error"); + + if (count < 5) + { + count = 0; + for (x = (yyn < 0 ? -yyn : 0); + x < (sizeof(yytname) / sizeof(char *)); x++) + if (yycheck[x + yyn] == x) + { + strcat(msg, count == 0 ? ", expecting `" : " or `"); + strcat(msg, yytname[x]); + strcat(msg, "'"); + count++; + } + } + yyerror(msg); + free(msg); + } + else + yyerror ("parse error; also virtual memory exceeded"); + } + else +#endif /* YYERROR_VERBOSE */ + yyerror("parse error"); + } + + goto yyerrlab1; +yyerrlab1: /* here on error raised explicitly by an action */ + + if (yyerrstatus == 3) + { + /* if just tried and failed to reuse lookahead token after an error, discard it. */ + + /* return failure if at end of input */ + if (yychar == YYEOF) + YYABORT; + +#if YYDEBUG != 0 + if (yydebug) + fprintf(stderr, "Discarding token %d (%s).\n", yychar, yytname[yychar1]); +#endif + + yychar = YYEMPTY; + } + + /* Else will try to reuse lookahead token + after shifting the error token. */ + + yyerrstatus = 3; /* Each real token shifted decrements this */ + + goto yyerrhandle; + +yyerrdefault: /* current state does not do anything special for the error token. */ + +#if 0 + /* This is wrong; only states that explicitly want error tokens + should shift them. */ + yyn = yydefact[yystate]; /* If its default is to accept any token, ok. Otherwise pop it.*/ + if (yyn) goto yydefault; +#endif + +yyerrpop: /* pop the current state because it cannot handle the error token */ + + if (yyssp == yyss) YYABORT; + yyvsp--; + yystate = *--yyssp; +#ifdef YYLSP_NEEDED + yylsp--; +#endif + +#if YYDEBUG != 0 + if (yydebug) + { + short *ssp1 = yyss - 1; + fprintf (stderr, "Error: state stack now"); + while (ssp1 != yyssp) + fprintf (stderr, " %d", *++ssp1); + fprintf (stderr, "\n"); + } +#endif + +yyerrhandle: + + yyn = yypact[yystate]; + if (yyn == YYFLAG) + goto yyerrdefault; + + yyn += YYTERROR; + if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != YYTERROR) + goto yyerrdefault; + + yyn = yytable[yyn]; + if (yyn < 0) + { + if (yyn == YYFLAG) + goto yyerrpop; + yyn = -yyn; + goto yyreduce; + } + else if (yyn == 0) + goto yyerrpop; + + if (yyn == YYFINAL) + YYACCEPT; + +#if YYDEBUG != 0 + if (yydebug) + fprintf(stderr, "Shifting error token, "); +#endif + + *++yyvsp = yylval; +#ifdef YYLSP_NEEDED + *++yylsp = yylloc; +#endif + + yystate = yyn; + goto yynewstate; + + yyacceptlab: + /* YYACCEPT comes here. */ + if (yyfree_stacks) + { + free (yyss); + free (yyvs); +#ifdef YYLSP_NEEDED + free (yyls); +#endif + } + return 0; + + yyabortlab: + /* YYABORT comes here. */ + if (yyfree_stacks) + { + free (yyss); + free (yyvs); +#ifdef YYLSP_NEEDED + free (yyls); +#endif + } + return 1; +} + diff --git a/kmatplot/formula/mpparser.cpp.h b/kmatplot/formula/mpparser.cpp.h new file mode 100644 index 0000000..2a9ea5b --- /dev/null +++ b/kmatplot/formula/mpparser.cpp.h @@ -0,0 +1,27 @@ +#ifndef YYSTYPE +#define YYSTYPE int +#endif + +#ifndef YYLTYPE +typedef + struct yyltype + { + int timestamp; + int first_line; + int first_column; + int last_line; + int last_column; + char *text; + } + yyltype; + +#define YYLTYPE yyltype +#endif + +#define NUMBER 257 +#define END 258 +#define VAR 259 +#define FUNC 260 +#define ID 261 +#define UNARY_MINUS 262 + diff --git a/kmatplot/formula/mpparser.cpp.report b/kmatplot/formula/mpparser.cpp.report new file mode 100644 index 0000000..e69de29 diff --git a/kmatplot/formula/mpparser.y b/kmatplot/formula/mpparser.y new file mode 100644 index 0000000..2af5e96 --- /dev/null +++ b/kmatplot/formula/mpparser.y @@ -0,0 +1,224 @@ +%{ +#define YYDEBUG 1 +#define YYSTYPE MPParserSymbol +#define YYPARSE_PARAM formula_object +#define YYLEX_PARAM formula_object +#define YYERROR_VERBOSE 1 +//#define YYPRINT(file, type, value) debug_print( formula_object, &yylloc, type, value ) +#define yyerror(message) yyerr( message, &yylloc, formula_object ) +#include "mpformula.h" +#include "mpparsersymbol.h" +#include "mpsymbols.h" +#include <math.h> +#include <stdlib.h> +void yyerr( const char *message, void *location_info_ptr, void *formula_ptr ); +int yylex( YYSTYPE *symbol_value, void *location_info_ptr, void *formula_ptr ); +%} + +%pure_parser +%token NUMBER +%token END +%token VAR +%token FUNC +%token ID + +%left UNARY_MINUS +%left '\'' + +%% + +input: + top_expr END { + ((MPFormula *)formula_object)->m_root_sym = $1.takeSym(); + YYACCEPT + } +; + +top_expr: + expr { + $$ = $1; + } + | colon_expr { + $$ = new MPSymColonExpr( $1.takeSymList(), + @1.first_column, @1.last_column, "colon expression" ); + } +; + +/* + * Monotone sequence from:to or from:step:to. + * You can also collect all arguments in MPSymbolList and in expr -> colon_expr + * transform it into colon expr + */ +colon_expr: + expr ':' expr { + $$ = new MPSymbolList( $1.takeSym(), $3.takeSym() ); + } + | colon_expr ':' expr { + /* only three-element colon expressions are allowed. + If it is more than three elements an error will be + raised during syntax checking */ + $1.symList()->add( $3.takeSym() ); + $$ = $1; + } +; + + +expr: + expr '+' basic_expr { + $$ = new MPSymFunction2( MPSymFunction2::ADD, + new MPSymbolList( $1.takeSym(), $3.takeSym() ), + @2.first_column, @2.last_column, "operator +" ); + } + | expr '-' basic_expr { + $$ = new MPSymFunction2( MPSymFunction2::SUB, + new MPSymbolList( $1.takeSym(), $3.takeSym() ), + @2.first_column, @2.last_column, "operator -" ); + } + | basic_expr { + $$ = $1; + } +; + +basic_expr: + basic_expr '*' indexed_expr { + $$ = new MPSymFunction2( MPSymFunction2::MUL, + new MPSymbolList( $1.takeSym(), $3.takeSym() ), + @2.first_column, @2.last_column, "operator *" ); + } + | basic_expr '/' indexed_expr { + $$ = new MPSymFunction2( MPSymFunction2::DIV, + new MPSymbolList( $1.takeSym(), $3.takeSym() ), + @2.first_column, @2.last_column, "operator /" ); + } + | indexed_expr { + $$ = $1; + } +; + + +/* Each expression can be indexed - only a choosen elements will be taken + For example: sheet(3:4, 5:6) + */ +indexed_expr: + indexed_expr '(' arg_list ')' { + // Matrix indices for example sheet(2:4,5:7) - highest priority + if ( $3.symList()->count() == 1 ) { + // single index for vectors + $$ = new MPSymVectorIndexer( $1.takeSym(), $3.takeSymList(), + @2.first_column, @4.last_column, "index operator()" ); + } else { + // double index for matrices + $$ = new MPSymMatrixIndexer( $1.takeSym(), $3.takeSymList(), + @2.first_column, @4.last_column, "index operator()" ); + } + + } + | simple_expr { + $$ = $1; + } +; + +simple_expr: + NUMBER { + /* Floating-point number */ + $$ = new MPSymValue( $1.token().toDouble(), + @1.first_column, @1.last_column, $1.token().latin1() ); + } + | ID { + /* Identifier which is neither a variable nor function */ + ((MPFormula *)formula_object)->m_error->setUndefinedSymbol( $1.token().latin1(), + @1.first_column, @1.last_column ); + YYABORT + } + | VAR { + /* Variable, must be used without parenthesis and arguments ( see below ) */ + $$ = $1; + } + | FUNC '(' arg_list ')' { + /* Function - it must be called as function() or function(args) */ + // TODO: symbol ':' isn't allowed in functions - you should check it + $1.sym()->setArgs( $3.takeSymList() ); + $$ = $1; + } + | '[' matrix ']' { + /* Matrix definition [2, 3; 4, 5] */ + $$ = new MPSymMatrix( $2.takeSymList(), @1.first_column, @3.last_column, "matrix" ) + } + | '(' top_expr ')' { + $$ = $2; + } + | '-' simple_expr %prec UNARY_MINUS { + /* Unary minus has lower priority than transposition */ + $$ = new MPSymFunction1( MPSymFunction1::NEG, + new MPSymbolList( $2.takeSym() ), + @1.first_column, @1.last_column, "operator unary-" ); + } + | simple_expr '\'' { + /* Transposition */ + $$ = new MPSymTranspose( new MPSymbolList( $1.takeSym() ), + @2.first_column, @2.last_column, "operator ' ( transpose )" ); + } +; + +/** + * Matrix Example which forms 3x3 matrix: 4 5 6; 1 3 4; 5 6 7 + * Used as a part of expression + */ +matrix: + vector { + MPSymbol *vector = new MPSymVector( $1.takeSymList(), + @1.first_column, @1.last_column, "row" ); + $$ = new MPSymbolList( vector ); + } + | matrix ';' vector { + MPSymbol *vector = new MPSymVector( $3.takeSymList(), + @3.first_column, @3.last_column, "row" ); + $1.symList()->add( vector ); + $$ = $1; + } +; + +/** + * Vector - 4 5 6 or 4, 5, 6 + * used as a part of a matrix + */ +/* + | vector simple_expr { + $1.symList()->add( $2.takeSym() ); + $$ = $1; + } +*/ +vector: expr { + $$ = new MPSymbolList( $1.takeSym() ); + } + | vector ',' top_expr { + $1.symList()->add( $3.takeSym() ); + $$ = $1; + } +; + +/* + * List of arguments to function or index for example sheet(:,12) or sin(3.14) + * allows special symbol ':' used for indexer to mark the whole range + */ +arg_list: /*empty */ { + $$ = new MPSymbolList(); + } + | top_expr { + $$ = new MPSymbolList( $1.takeSym() ); + } + | arg_list ',' top_expr { + $1.symList()->add( $3.takeSym() ); + $$ = $1; + } + | ':' { + $$ = new MPSymbolList( new MPSymColon( @1.first_column, @1.last_column, ":" ) ); + } + | arg_list ',' ':' { + /* 2 x @3.last_column */ + $1.symList()->add( new MPSymColon( @3.last_column, @3.last_column, ":" ) ); + $$ = $1; + } +; + +%% diff --git a/kmatplot/formula/mpparsersymbol.cpp b/kmatplot/formula/mpparsersymbol.cpp new file mode 100644 index 0000000..01a5ee2 --- /dev/null +++ b/kmatplot/formula/mpparsersymbol.cpp @@ -0,0 +1,194 @@ +/*************************************************************************** + mpparsersymbol.cpp - description + ------------------- + begin : Sat Nov 24 2001 + copyright : (C) 2001 by Kamil + email : kamil@localhost.localdomain + ***************************************************************************/ + +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + +#include "mpparsersymbol.h" + +//-------------------------------------------------------------------------// + +struct MPParserSymbol::shared_data_t { + MPParserSymbol::Type m_type; + int m_ref_count; + QString m_token; + double m_value; + MPSymbol *m_sym; + MPSymbolList *m_sym_list; + shared_data_t() { + m_type = MPParserSymbol::Unknown; + m_ref_count = 1; + m_sym = NULL; + m_sym_list = NULL; + } + ~shared_data_t() { + delete m_sym; + delete m_sym_list; + } + shared_data_t *addRef() { + m_ref_count ++; + return this; + } + void unref() { + m_ref_count --; + if ( m_ref_count == 0 ) delete this; + } + }; + +//-------------------------------------------------------------------------// + +MPParserSymbol::MPParserSymbol() + { + m_shared_data = new shared_data_t(); + } + +//-------------------------------------------------------------------------// + +MPParserSymbol::MPParserSymbol( const MPParserSymbol& symbol ) + { + m_shared_data = symbol.m_shared_data; + m_shared_data->addRef(); + } + +//-------------------------------------------------------------------------// + +MPParserSymbol::~MPParserSymbol() + { + m_shared_data->unref(); + } + +//-------------------------------------------------------------------------// + +const MPParserSymbol &MPParserSymbol::operator =( const MPParserSymbol& symbol ) + { + m_shared_data->unref(); + m_shared_data = symbol.m_shared_data; + m_shared_data->addRef(); + return *this; + } + +//-------------------------------------------------------------------------// + +const MPParserSymbol &MPParserSymbol::operator =( const QString& token ) + { + m_shared_data->unref(); + m_shared_data = new shared_data_t(); + m_shared_data->m_token = token; + m_shared_data->m_type = Token; + return *this; + } + +//-------------------------------------------------------------------------// + +const MPParserSymbol &MPParserSymbol::operator =( double value ) + { + m_shared_data->unref(); + m_shared_data = new shared_data_t(); + m_shared_data->m_value = value; + m_shared_data->m_type = Value; + return *this; + } + +//-------------------------------------------------------------------------// + +const MPParserSymbol &MPParserSymbol::operator =( MPSymbol *sym ) + { + m_shared_data->unref(); + m_shared_data = new shared_data_t(); + m_shared_data->m_sym = sym; + m_shared_data->m_type = Sym; + return *this; + } + +//-------------------------------------------------------------------------// + +const MPParserSymbol &MPParserSymbol::operator =( MPSymbolList *symList ) + { + m_shared_data->unref(); + m_shared_data = new shared_data_t(); + m_shared_data->m_sym_list = symList; + m_shared_data->m_type = SymList; + return *this; + } + +//-------------------------------------------------------------------------// + +QString MPParserSymbol::takeToken() const + { + return m_shared_data->m_token; + } + +//-------------------------------------------------------------------------// + +double MPParserSymbol::takeValue() const + { + return m_shared_data->m_value; + } + +//-------------------------------------------------------------------------// + +MPSymbol *MPParserSymbol::takeSym() const + { + MPSymbol *result = m_shared_data->m_sym; + m_shared_data->m_sym = NULL; + m_shared_data->m_type = Unknown; + return result; + } + +//-------------------------------------------------------------------------// + +MPSymbolList *MPParserSymbol::takeSymList() const + { + MPSymbolList *result = m_shared_data->m_sym_list; + m_shared_data->m_sym_list = NULL; + m_shared_data->m_type = Unknown; + return result; + } + +//-------------------------------------------------------------------------// + +MPParserSymbol::Type MPParserSymbol::type() const + { + return m_shared_data->m_type; + } + +//-------------------------------------------------------------------------// + +QString MPParserSymbol::token() const + { + return m_shared_data->m_token; + } + +//-------------------------------------------------------------------------// + +double MPParserSymbol::value() const + { + return m_shared_data->m_value; + } + +//-------------------------------------------------------------------------// + +MPSymbol *MPParserSymbol::sym() const + { + return m_shared_data->m_sym; + } + +//-------------------------------------------------------------------------// + +MPSymbolList *MPParserSymbol::symList() const + { + return m_shared_data->m_sym_list; + } + + diff --git a/kmatplot/formula/mpparsersymbol.h b/kmatplot/formula/mpparsersymbol.h new file mode 100644 index 0000000..3ae6619 --- /dev/null +++ b/kmatplot/formula/mpparsersymbol.h @@ -0,0 +1,55 @@ +/*************************************************************************** + mpparsersymbol.h + ------------------- + begin : Sat Nov 24 2001 + copyright : (C) 2001 by Kamil + email : kamil@localhost.localdomain + ***************************************************************************/ + +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + +#ifndef MPPARSERSYMBOL_H +#define MPPARSERSYMBOL_H + +#include<qstring.h> +#include"mpsymbol.h" + +/** + * Parser symbol ( used instead an ordinary union in bison parser files. + * It provides a memory management. + * @author Kamil + */ +class MPParserSymbol { + public: + enum Type { Unknown, Token, Value, Sym, SymList }; + MPParserSymbol(); + MPParserSymbol( const MPParserSymbol& symbol ); + ~MPParserSymbol(); + const MPParserSymbol &operator =( const MPParserSymbol& symbol ); + const MPParserSymbol &operator =( const QString& token ); + const MPParserSymbol &operator =( double value ); + const MPParserSymbol &operator =( MPSymbol *sym ); + const MPParserSymbol &operator =( MPSymbolList *symList ); + Type type() const; + QString token() const; + double value() const; + MPSymbol *sym() const; + MPSymbolList *symList() const; + QString takeToken() const; + double takeValue() const; + MPSymbol *takeSym() const; + MPSymbolList *takeSymList() const; + + private: + struct shared_data_t; + shared_data_t *m_shared_data; +}; + +#endif diff --git a/kmatplot/formula/mpsymbol.cpp b/kmatplot/formula/mpsymbol.cpp new file mode 100644 index 0000000..f96495d --- /dev/null +++ b/kmatplot/formula/mpsymbol.cpp @@ -0,0 +1,223 @@ +/*************************************************************************** + mpsymbol.cpp + ------------------- + begin : Tue Nov 20 2001 + copyright : (C) 2001 by Kamil + email : kamil@localhost.localdomain + ***************************************************************************/ + +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + +#include "mpsymbol.h" +#include <string.h> + +//--------------------------------------------------------------------------// + +MPSymbol::MPSymbol( MPSymbolList *args, int columnFrom, int columnTo, const char *identifier ) + { + m_args = args; + m_rows = 0; + m_cols = 0; + m_col_from = columnFrom; + m_col_to = columnTo; + m_id = strdup(identifier); + } + +//--------------------------------------------------------------------------// + +MPSymbol::~MPSymbol() + { + delete m_args; + free(m_id); + } +//--------------------------------------------------------------------------// + +void MPSymbol::setArgs( MPSymbolList *args ) + { + delete m_args; m_args = args; + } + +//--------------------------------------------------------------------------// + +void MPSymbol::checkArgs( MPError& error ) + { + m_rows = 0; + m_cols = 0; + if ( !error.hasError() && m_args ) { + for( int i=0; i<m_args->count(); i++ ) { + m_args->at(i)->checkArgs( error ); if ( error.hasError() ) break; + if ( i>0 && !isSizeEqual( m_args->at(i), m_args->at(i-1) ) ) { + error.setNonconformantArgument( i+1, m_args->at(i), this ); + return; + } + // check if all arguments have the same size + if ( m_rows < m_args->at(i)->rows() ) m_rows = m_args->at(i)->rows(); + if ( m_cols < m_args->at(i)->cols() ) m_cols = m_args->at(i)->cols(); + } + } + } + +//--------------------------------------------------------------------------// + +bool MPSymbol::isSizeEqual( const MPSymbol *expr1, const MPSymbol *expr2 ) + { + if ( expr1->isScalar() || + expr2->isScalar() || + ( expr1->rows() == expr2->rows() && + expr1->cols() == expr2->cols() ) ) return true; + return false; + } + +//--------------------------------------------------------------------------// +//--------------------------------------------------------------------------// +//--------------------------------------------------------------------------// +//--------------------------------------------------------------------------// +//--------------------------------------------------------------------------// + +MPSymbolList::MPSymbolList() + { + } + +//--------------------------------------------------------------------------// + +MPSymbolList::MPSymbolList( MPSymbol *symbol ) + { + add( symbol ); + } + +//--------------------------------------------------------------------------// + +MPSymbolList::MPSymbolList( MPSymbol *symbol1, MPSymbol *symbol2 ) + { + add( symbol1 ); + add( symbol2 ); + } + +//--------------------------------------------------------------------------// + +MPSymbolList::~MPSymbolList() + { + for( int i=0; i<count(); i++ ) delete m_list[i]; + } + +//--------------------------------------------------------------------------// + +void MPSymbolList::add( MPSymbol *symbol ) + { + if ( symbol ) m_list.push_back( symbol ); + } + + + +//--------------------------------------------------------------------------// +//--------------------------------------------------------------------------// +//--------------------------------------------------------------------------// +//--------------------------------------------------------------------------// +//--------------------------------------------------------------------------// + +MPSymbolFactory::MPSymbolFactory() + { + } + +//--------------------------------------------------------------------------// + +MPSymbolFactory::~MPSymbolFactory() + { + } + +//--------------------------------------------------------------------------// + +/* +unicode not supported yet +bool MPSymbolFactory::wstrcmp( const wchar_t *string1, const wchar_t *string2 ) + { + if ( string1 == NULL || string2 == NULL ) return false; + while ( *string1 && *string2 && *string1 == *string2 ) { string1++; string2++; } + return ( *string1 == *string2 ); + } +*/ + +//--------------------------------------------------------------------------// +//--------------------------------------------------------------------------// +//--------------------------------------------------------------------------// +//--------------------------------------------------------------------------// +//--------------------------------------------------------------------------// + +MPError::MPError() + { + m_type = None; + m_col_from = 0; + m_col_to = 0; + } + +//--------------------------------------------------------------------------// + +MPError::~MPError() + { + } + +//--------------------------------------------------------------------------// + +void MPError::setWrongNumberOfArguments( int, int, MPSymbol *symbol ) + { + if ( m_type == None ) { + m_type = WrongNumberOfArgs; + m_col_from = symbol->colFrom(); + m_col_to = symbol->colTo(); + } + } + +//--------------------------------------------------------------------------// + +void MPError::setNonconformantArgument( int, MPSymbol *arg, MPSymbol * ) + { + if ( m_type == None ) { + m_type = NonconformantArgs; + m_col_from = arg->colFrom(); + m_col_to = arg->colTo(); + } + } + +//--------------------------------------------------------------------------// + +void MPError::setUndefinedSymbol( const char *, int colFrom, int colTo ) + { + if ( m_type == None ) { + m_type = UndefinedSymbol; + m_col_from = colFrom; + m_col_to = colTo; + } + } + +//--------------------------------------------------------------------------// + +void MPError::setParseError( int colFrom, int colTo ) + { + if ( m_type == None ) { + m_type = ParseError; + m_col_from = colFrom; + m_col_to = colTo; + } + } + +//--------------------------------------------------------------------------// + +void MPError::setError( const char *, MPSymbol *symbol ) + { + if ( m_type == None ) { + m_type = Custom; + m_col_from = symbol->colFrom(); + m_col_to = symbol->colTo(); + } + } + + + + diff --git a/kmatplot/formula/mpsymbol.h b/kmatplot/formula/mpsymbol.h new file mode 100644 index 0000000..dfcd9a3 --- /dev/null +++ b/kmatplot/formula/mpsymbol.h @@ -0,0 +1,276 @@ +/*************************************************************************** + mpsymbol.h + ------------------- + begin : Tue Nov 20 2001 + copyright : (C) 2001 by Kamil + email : kamil@localhost.localdomain + ***************************************************************************/ + +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + +#ifndef MPSYMBOL_H +#define MPSYMBOL_H + +#include<deque.h> + +//---------------------------------------------------------------------------------------------// + +class MPError; +class MPSymbol; +class MPSymbolList; + +/** + * General symbol class, it can be function or variable and generally is implemented as + * a matrix, but can be a scalar if isScalar() returns true. You get matrix arguments and have to reimplement value() + * to return function value and you can reimplement rows() and cols() to return a resulting matrix size. + * Current implementation of rows() and cols() returns a size equal to a size of arguments + * You can also reimplement checkArgs() to check a number and size of all arguments and do other init stuff. + * Default implementation returns error if the size of all arguments is not the same. + * Remember that the scalar values should be treaten in a different way. If you + * are writting, for example, ADD function which looks like this: ADD( arg1, arg2 ), you + * have to check ( in checkArgs() ) whether there are exactly two arguments and if they have the + * same size, but scalars have the size equal to any other size, like in following expression: [ 2 3 0 ] + 2 = [ 4 5 2 ] + * If two following matrices are added [ 2 3 ] + [3 4 5 ] = 'error: nonconformant arguments' should be raised + * @author Kamil + */ +class MPSymbol { + public: + /** + * Constructor. It takes a list of arguments ( can contain 0 elements ), and + * position of this expression in the formula string ( used to build error messages ). + * Identifier is copied via strdup() + */ + MPSymbol( MPSymbolList *args, int columnFrom, int columnTo, const char *identifier ); + /** + * Destructor + */ + virtual ~MPSymbol(); + /** + * Sets arguments. Usually you won't need it as you will be passing arguments to constructor + */ + virtual void setArgs( MPSymbolList *args ); + /** + * Checks if there are no syntax errors: if there are correct number of arguments, + * arguments have desired size, etc. Default implementation check if all args have + * the same size and sets the size of this expression to it. You can omit checking if + * MPError::hasError() is true, because only a first error is recordered. Rememeber + * to call firts an original implementation of this method which calls checkArgs() for all arguments. + */ + virtual void checkArgs( MPError& info ); + /** + * Returns a value of this expression for 'row' and 'col'. If this expression is a + * scalar value it has to return the same value for all 'row' and 'col' arguments. + * See General usage section for details. + * Return NaN ( =sqrt(-1.0) ) in the case of error. + * Examples: + * value( int row, int col ) { return args[0]->value(row,col)+args[1]->value(row,col); }. + * value( int row, int col ) { return sin( args[0]->value(row,col) ); }. + */ + virtual double value( int row, int col ) = 0; + /** + * Rows. Scalar functions must have only one row. + */ + int rows() const { return m_rows; } + /** + * Columns. Scalar function must have only one columns. + */ + int cols() const { return m_cols; } + /** + * Returns true if rows == 1 and cols == 1. A scalar function + * must return the same value for all arguments 'row' and 'col'. + * See value() + */ + bool isScalar() const { return rows() == 1 && cols() == 1; } + /** + * Returns true if symbol is constant - it means that no arguments will + * be passed to it. If this method returns false the symbol is a function + * and it must be called with parenthesis, even if it accepts no arguments. + * For example: 'pi' - is a constant, 'rand()' is a function. + * Default implementation returns false. + */ + virtual bool isVariable() const { return false; } + /** + * Returns an identifier of this expression + * ( it is a name of funtion or variable: 'sin, 'cos', 'pi' ). + * Example implementation: + * virtual const char *identifier() const { return "sin"; } + */ + const char *identifier() const { return m_id; } + /** + * Position of the expression in the formula string. Used to + * to build error messages. + */ + int colFrom() const { return m_col_from; } + /** + * Position of the expression in the formula string. Used to + * to build error messages. + */ + int colTo() const { return m_col_to; } + /** + * Returns true if the size of two expressions is the same ( checking isScalar() also ). + */ + static bool isSizeEqual( const MPSymbol *expression1, const MPSymbol *expression2 ); + + protected: + int m_col_from; + int m_col_to; + int m_rows; + int m_cols; + MPSymbolList *m_args; + char *m_id; + }; + +//---------------------------------------------------------------------------------------------// + +/** + * Expression list. It is usualy used as an argument list for expressions. + * For example in: sheet( 1:10, 2:3 ) - expression list passed as argument list + * for 'sheet' contains two expressions '1:10' and '2:3'. In this example : sin(3.14) + * argument list for 'sin' contains only one expression single value = '3.14'. + */ +class MPSymbolList { + public: + /** + * Constructor + */ + MPSymbolList(); + /** + * Constructor of the single element list. + */ + MPSymbolList( MPSymbol *expression ); + /** + * Constructor of the two element list. + */ + MPSymbolList( MPSymbol *expression1, MPSymbol *expression2 ); + /** + * Destructor of the two element list. + */ + virtual ~MPSymbolList(); + /** + * Add a new expression to the list. All expression are deleted in destructor,. + */ + void add( MPSymbol *expression ); + /** + * Returns a number of expressions. + */ + int count() const { return (int )m_list.size(); } + /** + * Returns expression at position 'number' on this list. + */ + MPSymbol *at( int number ) const { return m_list[number]; } + + protected: + deque<MPSymbol*> m_list; + }; + +//--------------------------------------------------------------------------------------------// + +/** + * Error info object + */ +class MPError { + public: + enum ErrorType { None = 0, WrongNumberOfArgs, NonconformantArgs, UndefinedSymbol, ParseError, Custom }; + /** + * Constructor + */ + MPError(); + /** + * Destructor + */ + virtual ~MPError(); + /** + * Wrong number of arguments. + */ + virtual void setWrongNumberOfArguments( int currArgs, int correctArgs, MPSymbol *sym ); + /** + * Nonconformant argument + */ + virtual void setNonconformantArgument( int arg_nr, MPSymbol *arg, MPSymbol *sym ); + /** + * Undefined symbol + */ + virtual void setUndefinedSymbol( const char *symbol, int colFrom, int colTo ); + /** + * Parse error. + */ + virtual void setParseError( int colFrom, int colTo ); + /** + * Sets a custom error message. + */ + virtual void setError( const char *message, MPSymbol *sym ); + /** + * Returns 'true' if there is an error already set in this object. + * Only the first error is recordered and and further setError calls + * have no effect. + */ + bool hasError() const { return m_type != None; } + /** + * Column from + */ + int colFrom() const { return m_col_from; } + /** + * Column to + */ + int colTo() const { return m_col_to; } + + protected: + ErrorType m_type; + int m_col_from; + int m_col_to; + }; + +//---------------------------------------------------------------------------------------------// + +/** + * Expression factory is used by the parser to create expression objects based on their identifiers. + */ +class MPSymbolFactory { + public: + /** + * Constructor + */ + MPSymbolFactory(); + /** + * Destructor + */ + virtual ~MPSymbolFactory(); + /** + * Create expression with given identifier ( for exaple 'sin', 'cos', 'pi' etc ) + * and arguments. Return NULL if this factory does not provide requested object. + * UNICODE symbols not supported yet + */ + virtual MPSymbol *create( const char *identifier, MPSymbolList *args, int colFrom, int colTo ) = 0; + /** + * Return a total number of objects providen by this factory. + */ + virtual int symbolCount() const = 0; + /** + * Return an identifier of an object number 'expressionNumber'. + */ + virtual const char *symbolIdentifier( int symbolNumber ) = 0; + /** + * Return a short ( few sentences ) description of an object number 'expressionNumber'. + */ + virtual const char *symbolDescription( int symbolNumber ) = 0; + /** + * Name of this factory + */ + virtual const char *name() const { return "Unnamed"; } + + + }; + + + + +//----------------------------------------------------------------------------------------------// + +#endif diff --git a/kmatplot/formula/mpsymbols.cpp b/kmatplot/formula/mpsymbols.cpp new file mode 100644 index 0000000..349a1e0 --- /dev/null +++ b/kmatplot/formula/mpsymbols.cpp @@ -0,0 +1,655 @@ +/*************************************************************************** + mpsymbols.cpp + ------------------- + begin : Sun Nov 25 2001 + copyright : (C) 2001 by Kamil + email : kamil@localhost.localdomain + ***************************************************************************/ + +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + +#include"mpsymbols.h" +#include"mpdelunay.h" +#include<qobject.h> +#include<math.h> + +//-------------------------------------------------------------------------// +//-------------------------------------------------------------------------// +//-------------------------------------------------------------------------// + +//bool MPCommonSymFactory::m_initialized = false; +//QAsciiDict<MPCommonSymFactory::item> MPCommonSymFactory::m_list; + +//-------------------------------------------------------------------------// + +MPCommonSymFactory::MPCommonSymFactory() +: MPSymbolFactory() + { + m_initialized = false; + if ( !m_initialized ) { + m_list.setAutoDelete( TRUE ); + m_list.insert( "e", new item(CONST, MPSymConstant::E, QT_TR_NOOP(" e - base of the natural logarithm.") ) ); + m_list.insert( "pi", new item(CONST, MPSymConstant::PI, QT_TR_NOOP(" pi - 3.141592..." ) ) ); + + m_list.insert( "floor", new item(FUNC1, MPSymFunction1::FLOOR, QT_TR_NOOP("floor(x) - rounds x downwards to the nearest integer.") ) ); + m_list.insert( "ceil", new item(FUNC1, MPSymFunction1::CEIL, QT_TR_NOOP("ceil(x) - rounds x upwards to the nearest integer.") ) ); + m_list.insert( "sign", new item(FUNC1, MPSymFunction1::SIGN, QT_TR_NOOP("sign(x) - returns -1 for x<0 and 1 for x>= 0.") ) ); + m_list.insert( "abs", new item(FUNC1, MPSymFunction1::ABS, QT_TR_NOOP("abs(x) - returns the absolute value of x") ) ); + m_list.insert( "sin", new item(FUNC1, MPSymFunction1::SIN, QT_TR_NOOP("sin(x) - returns the sine of x ( radians )") ) ); + m_list.insert( "sinh", new item(FUNC1, MPSymFunction1::SINH, QT_TR_NOOP("sinh(x) - returns the hyperblic sine of x ( radians )") ) ); + m_list.insert( "cos", new item(FUNC1, MPSymFunction1::COS, QT_TR_NOOP("cos(x) - returns the cosine of x ( radians )") ) ); + m_list.insert( "cosh", new item(FUNC1, MPSymFunction1::COSH, QT_TR_NOOP("cosh(x) - returns the hyperbolic cosine of x ( radians )") ) ); + m_list.insert( "tan", new item(FUNC1, MPSymFunction1::TAN, QT_TR_NOOP("tan(x) - returns the tangent of x ( radians ).") ) ); + m_list.insert( "tanh", new item(FUNC1, MPSymFunction1::TANH, QT_TR_NOOP("tanh(x) - returns the hyperbolic tangent of x ( radians )") ) ); + m_list.insert( "acos", new item(FUNC1, MPSymFunction1::ACOS, QT_TR_NOOP("acos(x) - returns the arc cosine of x for x=<-1,1>") ) ); + m_list.insert( "acosh", new item(FUNC1, MPSymFunction1::ACOSH, QT_TR_NOOP("acosh(x) - returns the inverse hyperbolic cosine of x for x>=1") ) ); + m_list.insert( "asin", new item(FUNC1, MPSymFunction1::ASIN, QT_TR_NOOP("asin(x) - returns the arc sine of x, x=<-1,1>") ) ); + m_list.insert( "asinh", new item(FUNC1, MPSymFunction1::ASINH, QT_TR_NOOP("asinh(x) - returns the inverse hyperbolic sine of x") ) ); + m_list.insert( "atan", new item(FUNC1, MPSymFunction1::ATAN, QT_TR_NOOP("atan(x) - returns the arc tangent of x. Result belongs to (-pi/2,pi/2>.") ) ); + m_list.insert( "atanh", new item(FUNC1, MPSymFunction1::ATANH, QT_TR_NOOP("atanh(x) - returns the inverse hyperbolic tangent of x.") ) ); + m_list.insert( "ln", new item(FUNC1, MPSymFunction1::LN, QT_TR_NOOP("ln(x) - returns the natural logarithm of x.") ) ); + m_list.insert( "log10", new item(FUNC1, MPSymFunction1::LOG10, QT_TR_NOOP("log10(x) - returns the base-10 logarithm of x. ") ) ); + m_list.insert( "log2", new item(FUNC1, MPSymFunction1::LOG2, QT_TR_NOOP("log2(x) - returns the base-2 logarithm of x.") ) ); + m_list.insert( "sqrt", new item(FUNC1, MPSymFunction1::SQRT, QT_TR_NOOP("sqrt(x) - returns the square root of x for x >= 0..") ) ); + + m_list.insert( "mod", new item(FUNC2, MPSymFunction2::MOD, QT_TR_NOOP("mod(x,y) - returns remainder of dividing x by y.") ) ); + m_list.insert( "min", new item(FUNC2, MPSymFunction2::MIN, QT_TR_NOOP("min(x,y) - returns the lower value of pair (x,y). ") ) ); + m_list.insert( "max", new item(FUNC2, MPSymFunction2::MAX, QT_TR_NOOP("min(x,y) - returns the greater value of pair (x,y). ") ) ); + m_list.insert( "log", new item(FUNC2, MPSymFunction2::LOG, QT_TR_NOOP("log(x,y) - returns the y-base logarithm of x. ") ) ); + m_list.insert( "pow", new item(FUNC2, MPSymFunction2::POW, QT_TR_NOOP("pow(x,y) - raises x to the power y. ") ) ); + m_list.insert( "atan2", new item(FUNC2, MPSymFunction2::ATAN2, QT_TR_NOOP("atan2(x,y) - returns the arc tangent of y/x. Result belongs to (-PI,PI>.") ) ); + m_list.insert( "delunay", new item(DELUNAY, 0, QT_TR_NOOP("delunay(x,y) - performs a delunay triangulation of points in x, y column vectors.") ) ); + m_initialized = true; + } + } + + + +//-------------------------------------------------------------------------// + +MPCommonSymFactory::~MPCommonSymFactory() + { + } + +//-------------------------------------------------------------------------// + +const char *MPCommonSymFactory::name() const + { + return QT_TR_NOOP("Built-in"); + } + +//-------------------------------------------------------------------------// + +MPSymbol *MPCommonSymFactory::create( const char *identifier, MPSymbolList *args, int colFrom, int colTo ) + { + item *new_item = m_list[identifier]; + if ( new_item ) + switch( new_item->m_type ) { + case CONST: return new MPSymConstant( (MPSymConstant::Constant )new_item->m_function, args, colFrom, colTo, identifier ); + case FUNC1: return new MPSymFunction1( (MPSymFunction1::Function )new_item->m_function, args, colFrom, colTo, identifier ); + case FUNC2: return new MPSymFunction2( (MPSymFunction2::Function )new_item->m_function, args, colFrom, colTo, identifier ); + case DELUNAY: return new MPDelunay( args, colFrom, colTo, identifier ); + } + + return NULL; + } + +//-------------------------------------------------------------------------// + +int MPCommonSymFactory::symbolCount() const + { + return m_list.count(); + } + +//-------------------------------------------------------------------------// + +const char *MPCommonSymFactory::symbolIdentifier( int symbolNumber ) + { + QAsciiDictIterator<item> it(m_list); + it += symbolNumber; + return it.currentKey(); + } + +//-------------------------------------------------------------------------// + +const char *MPCommonSymFactory::symbolDescription( int symbolNumber ) + { + QAsciiDictIterator<item> it(m_list); + it += symbolNumber; + return it.current()->m_description; + } + +//-------------------------------------------------------------------------// +//-------------------------------------------------------------------------// +//-------------------------------------------------------------------------// +//-------------------------------------------------------------------------// +//-------------------------------------------------------------------------// + + +MPSymValue::MPSymValue( double value, int columnFrom, int columnTo, const char *id ) +: MPSymbol( NULL, columnFrom, columnTo, id ) + { + m_value = value; + } + +//-------------------------------------------------------------------------// + +MPSymValue::~MPSymValue() + { + } + +//-------------------------------------------------------------------------// + +void MPSymValue::checkArgs( MPError& ) + { + m_rows = 1; + m_cols = 1; + } + +//-------------------------------------------------------------------------// + +double MPSymValue::value( int, int ) + { + return m_value; + } + +//-------------------------------------------------------------------------// +//-------------------------------------------------------------------------// +//-------------------------------------------------------------------------// +//-------------------------------------------------------------------------// +//-------------------------------------------------------------------------// +//-------------------------------------------------------------------------// + +MPSymColon::MPSymColon( int columnFrom, int columnTo, const char *id ) +: MPSymbol( NULL, columnFrom, columnTo, id ) + { + m_rows = 0; + m_cols = 0; + } + +//-------------------------------------------------------------------------// + +double MPSymColon::value( int, int ) + { + return sqrt(-1); + } + +//-------------------------------------------------------------------------// +//-------------------------------------------------------------------------// +//-------------------------------------------------------------------------// +//-------------------------------------------------------------------------// +//-------------------------------------------------------------------------// +//-------------------------------------------------------------------------// + +MPSymColonExpr::MPSymColonExpr( MPSymbolList *args, int columnFrom, int columnTo, const char *id ) +: MPSymbol( args, columnFrom, columnTo, id ) + { + } + +//-------------------------------------------------------------------------// + +MPSymColonExpr::~MPSymColonExpr() + { + } + +//-------------------------------------------------------------------------// + +void MPSymColonExpr::checkArgs( MPError& error ) + { + for ( int i=0; i<m_args->count(); i++ ) m_args->at(i)->checkArgs(error); + MPSymbol::checkArgs( error ); + if ( m_args->count() != 2 && + m_args->count() != 3 ) { + error.setWrongNumberOfArguments( m_args->count(), 3, this ); + return; + } + for ( int i=0; i<m_args->count(); i++ ) + if ( !m_args->at(i)->isScalar() ) { + error.setNonconformantArgument( i, m_args->at(i), this ); + return; + } + + if ( m_args->count() == 3 ) { + m_start = m_args->at(0)->value( 0, 0 ); + m_step = m_args->at(1)->value( 0, 0 ); + m_stop = m_args->at(2)->value( 0, 0 ); + } + else + if ( m_args->count() == 2 ) { + m_start = m_args->at(0)->value( 0, 0 ); + m_stop = m_args->at(1)->value( 0, 0 ); + m_step = 1.0; + } + if ( m_step == 0.0 ) { + error.setNonconformantArgument( 1, m_args->at(1), this ); + return; + } + m_rows = 1; + m_cols = QMAX( (int )floor( (m_stop-m_start)/m_step )+1, 0 ); + + } + +//-------------------------------------------------------------------------// + +double MPSymColonExpr::value( int, int col ) + { + return m_start + col * m_step; + } + + +//-------------------------------------------------------------------------// +//-------------------------------------------------------------------------// +//-------------------------------------------------------------------------// +//-------------------------------------------------------------------------// +//-------------------------------------------------------------------------// + +const double MPSymConstant::pi = 3.1415926535897932385; +const double MPSymConstant::e = 2.7182818284590452354; + +//-------------------------------------------------------------------------// + +MPSymConstant::MPSymConstant( Constant c, int columnFrom, int columnTo, const char *id ) +: MPSymbol( NULL, columnFrom, columnTo, id ) + { + m_c = c; + } + +//-------------------------------------------------------------------------// + +MPSymConstant::MPSymConstant( Constant c, MPSymbolList *args, int columnFrom, int columnTo, const char *id ) +: MPSymbol( args, columnFrom, columnTo, id ) + { + m_c = c; + } + +//-------------------------------------------------------------------------// + +MPSymConstant::~MPSymConstant() + { + } + +//-------------------------------------------------------------------------// + +void MPSymConstant::checkArgs( MPError& ) + { + m_rows = 1; + m_cols = 1; + } + +//-------------------------------------------------------------------------// + +double MPSymConstant::value( int, int ) + { + switch( m_c ) { + case E: return e; + case PI: return pi; + default: return sqrt(-1); + } + } + +//-------------------------------------------------------------------------// +//-------------------------------------------------------------------------// +//-------------------------------------------------------------------------// +//-------------------------------------------------------------------------// + +MPSymFunction1::MPSymFunction1( Function f, MPSymbolList *args, int columnFrom, int columnTo, const char *id ) +: MPSymbol( args, columnFrom, columnTo, id ) + { + m_f = f; + } + +//-------------------------------------------------------------------------// + +MPSymFunction1::~MPSymFunction1() + { + } + +//-------------------------------------------------------------------------// + +void MPSymFunction1::checkArgs( MPError& error ) + { + if ( m_args->count() != 1 ) error.setWrongNumberOfArguments( m_args->count(), 1, this ); + MPSymbol::checkArgs( error ); + } + +//-------------------------------------------------------------------------// + +double MPSymFunction1::value( int row, int col ) + { + double value = m_args->at(0)->value( row, col ); + switch( m_f ) { + case FLOOR: return floor( value ); + case CEIL: return ceil( value ); + case SIGN: return value >= 0 ? 1.0 : -1.0; // should return 0 for value == 0 ??? + case ABS: return fabs(value); + case COS: return cos(value); + case COSH: return cosh(value); + case SIN: return sin(value); + case SINH: return sinh(value); + case TAN: return tan(value); + case TANH: return tanh(value); + case ACOS: return acos(value); + case ACOSH: return acosh(value); + case ASIN: return asin(value); + case ASINH: return asinh(value); + case ATAN: return atan(value); + case ATANH: return atanh(value); + case LN: return log(value); + case LOG2: return log10(value)/log10(2.0); + case LOG10: return log10(value); + case SQRT: return sqrt(value); + case NEG: return -value; + default: return sqrt(-1); + }; + } + + +//-------------------------------------------------------------------------// +//-------------------------------------------------------------------------// +//-------------------------------------------------------------------------// +//-------------------------------------------------------------------------// +//-------------------------------------------------------------------------// + + +MPSymFunction2::MPSymFunction2( Function f, MPSymbolList *args, int columnFrom, int columnTo, const char *id ) +: MPSymbol( args, columnFrom, columnTo, id ) + { + m_f = f; + } + +//-------------------------------------------------------------------------// + +MPSymFunction2::~MPSymFunction2() + { + } + +//-------------------------------------------------------------------------// + +void MPSymFunction2::checkArgs( MPError& error ) + { + if ( m_args->count() != 2 ) error.setWrongNumberOfArguments( m_args->count(), 2, this ); + MPSymbol::checkArgs( error ); + } + +//-------------------------------------------------------------------------// + +double MPSymFunction2::value( int row, int col ) + { + double val1 = m_args->at(0)->value(row,col); + double val2 = m_args->at(1)->value(row,col); + switch( m_f ) { + case ADD: return val1+val2; + case SUB: return val1-val2; + case MUL: return val1*val2; + case DIV: return val2 ? val1/val2 : sqrt(-1); + case MOD: return fmod( val1, val2 ); + case MIN: return min( val1, val2 ); + case MAX: return max( val1, val2 ); + case LOG: return log10(val1)/log10(val2); + case POW: return pow( val1, val2 ); + case ATAN2: return atan2( val1, val2 ); + default: return sqrt(-1); + } + } + +//-------------------------------------------------------------------------// +//-------------------------------------------------------------------------// +//-------------------------------------------------------------------------// +//-------------------------------------------------------------------------// +//-------------------------------------------------------------------------// + + +MPSymMatrixIndexer::MPSymMatrixIndexer( MPSymbol *sym, MPSymbolList *args, int columnFrom, int columnTo, const char *id ) +: MPSymbol( args, columnFrom, columnTo, id ) + { + m_symbol = sym; + } + +//-------------------------------------------------------------------------// + +MPSymMatrixIndexer::~MPSymMatrixIndexer() + { + delete m_symbol; + } + +//-------------------------------------------------------------------------// + +void MPSymMatrixIndexer::checkArgs( MPError& error ) +// a bit complicated + { + if ( m_args->count() != 2 ) { + error.setWrongNumberOfArguments( m_args->count(), 2, this ); + return; + } + m_symbol->checkArgs( error ); + for( int i=0; i<m_args->count(); i++ ) m_args->at(i)->checkArgs(error); + if ( error.hasError() ) return; + + m_rows = index_size(m_args->at(0)) == 0 ? m_symbol->rows() : index_size(m_args->at(0)); + m_cols = index_size(m_args->at(1)) == 0 ? m_symbol->cols() : index_size(m_args->at(1)); + + for ( int row=0; row<m_rows; row++ ) + if ( index_value(m_args->at(0),row) < 0 || + index_value(m_args->at(0),row) >= m_symbol->rows() ) + error.setError( QString(QT_TR_NOOP("Invalid row index value %1")).arg(index_value(m_args->at(0),row)), this ); + for ( int col=0; col<m_cols; col++ ) + if ( index_value(m_args->at(1),col) < 0 || + index_value(m_args->at(1),col) >= m_symbol->cols() ) + error.setError( QString(QT_TR_NOOP("Invalid column index value %1")).arg(index_value(m_args->at(1),col)), this ); + } + +//-------------------------------------------------------------------------// + +double MPSymMatrixIndexer::value( int row, int col ) + { + return m_symbol->value( index_value(m_args->at(0),row), index_value(m_args->at(1),col) ); + } + +//-------------------------------------------------------------------------// + +int MPSymMatrixIndexer::index_size( MPSymbol *index ) + { + return index->rows() * index->cols(); + } + +//-------------------------------------------------------------------------// + +int MPSymMatrixIndexer::index_value( MPSymbol *index, int pos ) + { + return index->rows() == 0 ? pos : (int )floor( index->value(pos/index->cols(),pos%index->cols()) ); + } + +//-------------------------------------------------------------------------// +//-------------------------------------------------------------------------// +//-------------------------------------------------------------------------// +//-------------------------------------------------------------------------// + +MPSymVectorIndexer::MPSymVectorIndexer( MPSymbol *sym, MPSymbolList *args, int columnFrom, int columnTo, const char *id ) +: MPSymbol( args, columnFrom, columnTo, id ) + { + m_symbol = sym; + } + +//-------------------------------------------------------------------------// + +MPSymVectorIndexer::~MPSymVectorIndexer() + { + delete m_symbol; + } + +//-------------------------------------------------------------------------// + +void MPSymVectorIndexer::checkArgs( MPError& error ) +// a bit complicated + { + if ( m_args->count() != 1 ) error.setWrongNumberOfArguments( m_args->count(), 1, this ); + m_symbol->checkArgs( error ); + m_args->at(0)->checkArgs(error); + if ( m_symbol->rows() != 1 && m_symbol->cols() != 1 ) error.setError( QT_TR_NOOP("Single index only valid for vectors;"), this ); + if ( error.hasError() ) return; + + // result will be a row vector + if ( m_symbol->rows() == 1 ) { + m_cols = index_size() == 0 ? m_symbol->cols() : index_size(); + m_rows = 1; + } else { + // result will be a column vector + m_rows = index_size() == 0 ? m_symbol->rows() : index_size(); + m_cols = 1; + } + + for( int index=0;index<m_rows*m_cols; index++ ) + if ( index_value(index) < 0 || index_value(index) >= m_symbol->rows()*m_symbol->cols() ) + error.setError( QString(QT_TR_NOOP("Invalid index value %1")).arg(index_value(index)), this ); + } + +//-------------------------------------------------------------------------// + +double MPSymVectorIndexer::value( int row, int col ) + { + int index = index_value(row*m_cols+col); + return m_symbol->value( index/m_symbol->cols(), index%m_symbol->cols() ); + } + +//-------------------------------------------------------------------------// + +int MPSymVectorIndexer::index_size() + { + return m_args->at(0)->rows() * m_args->at(0)->cols(); + } + +//-------------------------------------------------------------------------// + +int MPSymVectorIndexer::index_value( int pos ) + { + MPSymbol *index = m_args->at(0); + return index->rows() == 0 ? pos : (int )floor( index->value(pos/index->cols(),pos%index->cols()) ); + } + +//-------------------------------------------------------------------------// +//-------------------------------------------------------------------------// +//-------------------------------------------------------------------------// +//-------------------------------------------------------------------------// + +MPSymTranspose::MPSymTranspose( MPSymbolList *args, int columnFrom, int columnTo, const char *id ) +: MPSymbol( args, columnFrom, columnTo, id ) + { + } + +//-------------------------------------------------------------------------// + +MPSymTranspose::~MPSymTranspose() + { + } + +//-------------------------------------------------------------------------// + +void MPSymTranspose::checkArgs( MPError& error ) + { + if ( m_args->count() != 1 ) error.setWrongNumberOfArguments( m_args->count(), 1, this ); + m_args->at(0)->checkArgs( error ); + m_rows = m_args->at(0)->cols(); + m_cols = m_args->at(0)->rows(); + } + +//-------------------------------------------------------------------------// + +double MPSymTranspose::value( int row, int col ) + { + return m_args->at(0)->value( col, row ); + } + +//-------------------------------------------------------------------------// +//-------------------------------------------------------------------------// +//-------------------------------------------------------------------------// +//-------------------------------------------------------------------------// + +MPSymVector::MPSymVector( MPSymbolList *args, int columnFrom, int columnTo, const char *id ) +: MPSymbol( args, columnFrom, columnTo, id ) + { + m_vector = NULL; + } + +//-------------------------------------------------------------------------// + +MPSymVector::~MPSymVector() + { + delete m_vector; + } + +//-------------------------------------------------------------------------// + +void MPSymVector::checkArgs( MPError& error ) + { + delete m_vector; m_vector = NULL; + MPSymbol::checkArgs( error ); + m_rows = 1; + m_cols = 0; + if ( !error.hasError() ) + for( int i=0; i<m_args->count(); i++ ) { + if ( m_args->at(i)->rows() != 1 ) { error.setNonconformantArgument( i, m_args->at(i), this ); break; } + m_cols += m_args->at(i)->cols(); + } + int curr_col = 0; + m_vector = new double[m_cols]; + for( int i=0; i<m_args->count(); i++ ) + for( int col=0; col<m_args->at(i)->cols(); col++ ) + m_vector[curr_col++] = m_args->at(i)->value(0,col); + } + +//-------------------------------------------------------------------------// + +double MPSymVector::value( int, int col ) + { + return m_vector[col]; + } + +//-------------------------------------------------------------------------// +//-------------------------------------------------------------------------// +//-------------------------------------------------------------------------// +//-------------------------------------------------------------------------// +//-------------------------------------------------------------------------// + +MPSymMatrix::MPSymMatrix( MPSymbolList *args, int columnFrom, int columnTo, const char *id ) +: MPSymbol( args, columnFrom, columnTo, id ) + { + } + +//-------------------------------------------------------------------------// + +MPSymMatrix::~MPSymMatrix() + { + } + +//-------------------------------------------------------------------------// + +void MPSymMatrix::checkArgs( MPError& error ) + { + MPSymbol::checkArgs( error ); + if ( !error.hasError() ) { + m_cols = m_args->at(0)->cols(); + m_rows = m_args->count(); + for( int i=0; i<m_args->count(); i++ ) { + if ( m_args->at(i)->rows() != 1 || + m_args->at(i)->cols() != m_cols ) { error.setNonconformantArgument( i, m_args->at(i), this ); break; } + } + } + } + +//-------------------------------------------------------------------------// + +double MPSymMatrix::value( int row, int col ) + { + return m_args->at(row)->value(0,col); + } + +//-------------------------------------------------------------------------// + + diff --git a/kmatplot/formula/mpsymbols.h b/kmatplot/formula/mpsymbols.h new file mode 100644 index 0000000..cfda6c5 --- /dev/null +++ b/kmatplot/formula/mpsymbols.h @@ -0,0 +1,197 @@ +/*************************************************************************** + mpsymbols.h + ------------------- + begin : Sun Nov 25 2001 + copyright : (C) 2001 by Kamil + email : kamil@localhost.localdomain + ***************************************************************************/ + +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + +#ifndef MPSYMBOLS_H +#define MPSYMBOLS_H + +#include"mpsymbol.h" +#include<qasciidict.h> + +//--------------------------------------------------------------------------// + +/** + * Factory which provides common symbols and constants from the standard C math library. + */ +class MPCommonSymFactory : public MPSymbolFactory { + public: + MPCommonSymFactory(); + virtual ~MPCommonSymFactory(); + virtual MPSymbol *create( const char *identifier, MPSymbolList *args, int colFrom, int colTo ); + virtual int symbolCount() const; + virtual const char *symbolIdentifier( int symbolNumber ); + virtual const char *symbolDescription( int symbolNumber ); + virtual const char *name() const; + protected: + enum ItemType { CONST, FUNC1, FUNC2, DELUNAY }; + struct item { + int m_type; + int m_function; + const char *m_description; + item( int type, int function, const char *description ) { + m_type = type; + m_function = function; + m_description = description; + } + }; + bool m_initialized; + QAsciiDict<item> m_list; + + }; + +//--------------------------------------------------------------------------// + +class MPSymColon : public MPSymbol { + public: + MPSymColon( int columnFrom, int columnTo, const char *id ); + virtual ~MPSymColon() {} + virtual void checkArgs( MPError& ) {} + virtual double value( int row, int col ); + }; + +//--------------------------------------------------------------------------// + +class MPSymColonExpr : public MPSymbol { + public: + MPSymColonExpr( MPSymbolList *args, int columnFrom, int columnTo, const char *id ); + virtual ~MPSymColonExpr(); + virtual void checkArgs( MPError& error ); + virtual double value( int row, int col ); + private: + double m_start; + double m_step; + double m_stop; + + }; + +//--------------------------------------------------------------------------// + +class MPSymValue : public MPSymbol { + public: + MPSymValue( double value, int columnFrom, int columnTo, const char *id ); + virtual ~MPSymValue(); + virtual void checkArgs( MPError& error ); + virtual double value( int row, int col ); + protected: + double m_value; + }; + +//--------------------------------------------------------------------------// + +class MPSymConstant : public MPSymbol { + public: + static const double pi; + static const double e; + enum Constant { E, PI }; + MPSymConstant( Constant c, int columnFrom, int columnTo, const char *id ); + MPSymConstant( Constant c, MPSymbolList *args, int columnFrom, int columnTo, const char *id ); + virtual ~MPSymConstant(); + virtual void checkArgs( MPError& error ); + virtual double value( int row, int col ); + virtual bool isVariable() const { return true; } + protected: + Constant m_c; + }; + +//--------------------------------------------------------------------------// + +class MPSymFunction1 : public MPSymbol { + public: + enum Function { FLOOR, CEIL, SIGN, ABS, COS, COSH, SIN, SINH, TAN, TANH, ACOS, ACOSH, ASIN, ASINH, ATAN, ATANH, LN, LOG2, LOG10, SQRT, NEG }; + MPSymFunction1( Function f, MPSymbolList *args, int columnFrom, int columnTo, const char *id ); + virtual ~MPSymFunction1(); + virtual void checkArgs( MPError& error ); + virtual double value( int row, int col ); + protected: + Function m_f; + }; + +//--------------------------------------------------------------------------// + +class MPSymFunction2 : public MPSymbol { + public: + enum Function { ADD, SUB, MUL, DIV, MOD, MIN, MAX, LOG, POW, ATAN2 }; + MPSymFunction2( Function f, MPSymbolList *args, int columnFrom, int columnTo, const char *id ); + virtual ~MPSymFunction2(); + virtual void checkArgs( MPError& error ); + virtual double value( int row, int col ); + protected: + Function m_f; + }; + +//--------------------------------------------------------------------------// + +class MPSymMatrixIndexer : public MPSymbol { + public: + MPSymMatrixIndexer( MPSymbol *sym, MPSymbolList *args, int columnFrom, int columnTo, const char *id ); + virtual ~MPSymMatrixIndexer(); + virtual void checkArgs( MPError& error ); + virtual double value( int row, int col ); + protected: + MPSymbol *m_symbol; + int index_size( MPSymbol *index ); + int index_value( MPSymbol *index, int pos ); + }; + +//--------------------------------------------------------------------------// + +class MPSymVectorIndexer : public MPSymbol { + public: + MPSymVectorIndexer( MPSymbol *sym, MPSymbolList *args, int columnFrom, int columnTo, const char *id ); + virtual ~MPSymVectorIndexer(); + virtual void checkArgs( MPError& error ); + virtual double value( int row, int col ); + protected: + MPSymbol *m_symbol; + int index_size(); + int index_value( int pos ); + }; + +//--------------------------------------------------------------------------// + +class MPSymTranspose : public MPSymbol { + public: + MPSymTranspose( MPSymbolList *args, int columnFrom, int columnTo, const char *id ); + virtual ~MPSymTranspose(); + virtual void checkArgs( MPError& error ); + virtual double value( int row, int col ); + }; + +//--------------------------------------------------------------------------// + +class MPSymVector : public MPSymbol { + public: + MPSymVector( MPSymbolList *args, int columnFrom, int columnTo, const char *id ); + virtual ~MPSymVector(); + virtual void checkArgs( MPError& error ); + virtual double value( int row, int col ); + private: + double *m_vector; + }; + +//--------------------------------------------------------------------------// + +class MPSymMatrix : public MPSymbol { + public: + MPSymMatrix( MPSymbolList *args, int columnFrom, int columnTo, const char *id ); + virtual ~MPSymMatrix(); + virtual void checkArgs( MPError& error ); + virtual double value( int row, int col ); + }; + +//--------------------------------------------------------------------------// + +#endif diff --git a/kmatplot/interface/Makefile.am b/kmatplot/interface/Makefile.am new file mode 100644 index 0000000..98ccc75 --- /dev/null +++ b/kmatplot/interface/Makefile.am @@ -0,0 +1,5 @@ +INCLUDES = $(all_includes) + +noinst_LIBRARIES = libkmatplot_interface.a +libkmatplot_interface_a_SOURCES = common.c +EXTRA_DIST = etype.h msg.h common.h common.c diff --git a/kmatplot/interface/common.c b/kmatplot/interface/common.c new file mode 100644 index 0000000..5e76d20 --- /dev/null +++ b/kmatplot/interface/common.c @@ -0,0 +1,406 @@ +/*************************************************************************** + common.c + ------------------- + begin : Sun Jun 18 2000 + copyright : (C) 2000 by Kamil Dobkowski + email : kamildobk@friko.onet.pl + ***************************************************************************/ + +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + +#include<stdio.h> +#include<errno.h> +#include<assert.h> +#include<stdlib.h> +#include<string.h> +#include<unistd.h> +#include<fcntl.h> +#include<sys/un.h> +#include<sys/stat.h> +#include<sys/types.h> +#include<sys/socket.h> + + +#include"common.h" +#include"msg.h" + +#define KMATPLOT_EXECUTABLE "kmatplot" +#define MAX_APP_NUMBER 99999 +#define STDOUT_FD 1 +#define STDERR_FD 2 + +/*--------------------------------------------------------------------------------*/ + +void _get_socket_name( int app_number, struct sockaddr_un *addr ) +/* + * Returns a socket path for the given app number. + * Example: '/tmp/.kmatplot.root.1' + */ + { + int pos; + char buff[50]; + + sprintf(buff,"%d", app_number); + memset( (char *)addr, 0, sizeof(addr) ); + addr->sun_family = AF_UNIX; + + pos = 0; + strncpy( &addr->sun_path[pos], P_tmpdir, sizeof(addr->sun_path)-pos ); pos += strlen(P_tmpdir); + strncpy( &addr->sun_path[pos], "/.kmatplot.", sizeof(addr->sun_path)-pos ); pos += strlen("/.kmatplot."); + strncpy( &addr->sun_path[pos], getenv("USER"), sizeof(addr->sun_path)-pos ); pos += strlen(getenv("USER")); + strncpy( &addr->sun_path[pos], ".", sizeof(addr->sun_path)-pos ); pos += strlen("."); + strncpy( &addr->sun_path[pos], buff, sizeof(addr->sun_path)-pos ); + + } + +/*--------------------------------------------------------------------------------*/ + +int _run_new_server( int app_number ) +/* + * Runs a new kmatplot application and returns its app number. + */ + { + int pid; + int null_fd = 0; + int ssocket_fd = 0; /* socket for the server */ + char buff[50]; + struct sockaddr_un addr; + + if ( (ssocket_fd=socket(AF_UNIX,SOCK_STREAM,0)) < 0 ) return 0; + + if ( app_number > 0 ) { + /* Bind to the given app number. */ + _get_socket_name( app_number, &addr ); + if ( bind( ssocket_fd, + (struct sockaddr *)&addr, + strlen(addr.sun_path)+ + sizeof(addr.sun_family)) < 0 ) { close(ssocket_fd); return -1; } + } else { + /* Find first unused app number */ + do { + if ( app_number > MAX_APP_NUMBER ) return -1; + _get_socket_name( ++app_number, &addr ); + } while( bind( ssocket_fd, + (struct sockaddr *)&addr, + strlen(addr.sun_path) + + sizeof(addr.sun_family )) < 0 ); + } + + listen( ssocket_fd, 1 ); + /*null_fd = open("/dev/null", O_WRONLY );*/ + sprintf( buff, "%d", ssocket_fd); + + pid = fork(); + + /** + * Child process + */ + if ( pid == 0 ) { + /*dup2( null_fd, STDOUT_FD ); // put this into kmatplot !*/ + /*dup2( null_fd, STDERR_FD ); */ + execlp( KMATPLOT_EXECUTABLE, KMATPLOT_EXECUTABLE, "--fd", buff, NULL ); + } + /** + * Parent process + */ + else if ( pid > 0 ) { + /*close( null_fd );*/ + close( ssocket_fd ); + return app_number; + } + /* + * Fork error + */ + return 0; + } + + +/*--------------------------------------------------------------------------------*/ + +int plot_connect( int app_number, int *return_app_number, int *return_socket_fd ) + { + int err; + int socket_fd; + struct sockaddr_un addr; + + if ( app_number < 0 ) return -1; + + /** + * Auto-run a new server. + */ + if ( app_number == 0 ) { + app_number = _run_new_server( 0 ); + } + if ( app_number == 0 ) return -1; + + /* + * Connect to server. + */ + _get_socket_name( app_number, &addr ); + + if ( (socket_fd=socket(AF_UNIX,SOCK_STREAM,0)) < 0 ) return -1; + err = connect( socket_fd, + (struct sockaddr *)&addr, + sizeof(addr.sun_family)+ + strlen(addr.sun_path) ); + + /* + * Server not running ? + */ + if ( err < 0 && ( errno == ECONNREFUSED || errno == ENOENT ) ) { + + unlink( addr.sun_path ); + close(socket_fd); + if ( _run_new_server( app_number ) == 0 ) return -1; + if ( (socket_fd=socket(AF_UNIX,SOCK_STREAM,0)) < 0 ) return -1; + if ( connect( socket_fd, + (struct sockaddr *)&addr, + sizeof(addr.sun_family)+ + strlen(addr.sun_path) ) < 0 ) return -1; + } + + if ( return_app_number ) *return_app_number = app_number; + if ( return_socket_fd ) *return_socket_fd = socket_fd; + + return socket_fd; + } + +/*--------------------------------------------------------------------------------*/ + +int esizeof( EType type ) + { + switch( type ) { + case EUChar: return sizeof(unsigned char); + case EShort: return sizeof(short); + case EUShort: return sizeof(unsigned short); + case ELong: return sizeof(long); + case EFloat: return sizeof(float); + case EDouble: return sizeof(double); + } + + return 0; + } + +/*--------------------------------------------------------------------------------*/ + +int _write_data( int fd, const char *data, int len ) + { + int nleft; + int bytes; + const char *ptr; + + ptr = data; + nleft = len; + while( nleft > 0 ) { + bytes = write( fd, ptr, nleft ); + if ( bytes < 0 ) break; /* error */ + nleft -= bytes; + ptr += bytes; + } + return(len - nleft); + } +/*--------------------------------------------------------------------------------*/ + +int _get_reply_code( int socket_fd ) + { + int reply_code = -1; + int result = _read_data( socket_fd, (const char*)&reply_code, sizeof(reply_code) ); + if ( result < sizeof(reply_code) ) reply_code = result; + return reply_code; + } + +/*--------------------------------------------------------------------------------*/ + +int _read_data( int fd, char *data, int len ) + { + int nleft; + int nread; + + nleft = len; + while( nleft > 0 ) { + nread = read( fd, data, nleft ); + if ( nread < 0 ) return nread; /* error */ + else + if ( nread == 0 ) break; + + nleft -= nread; + data += nread; + } + + return(len - nleft); + } + +/*--------------------------------------------------------------------------------*/ + +int plot_add_axes( int socket_fd, int axes_type ) + { + hdr_t hdr; + int bytes; + + if ( socket_fd < 0 ) return OpError; + + hdr.a.type = MsgAddAxes; + hdr.a.dlen = 0; + hdr.a.plot = -1; + hdr.a.axes = axes_type; + + /* Write header */ + bytes = _write_data( socket_fd, (const char *)&hdr, sizeof(hdr) ); + if ( bytes < (int )sizeof(hdr) ) return OpError; + + return _get_reply_code(socket_fd); + } + +/*--------------------------------------------------------------------------------*/ + +int plot_remove_axes( int socket_fd, int axes_id ) + { + hdr_t hdr; + int bytes; + + if ( socket_fd < 0 ) return OpError; + + hdr.a.type = MsgRemoveAxes; + hdr.a.dlen = 0; + hdr.a.plot = axes_id; + + /* Write header */ + bytes = _write_data( socket_fd, (const char *)&hdr, sizeof(hdr) ); + if ( bytes < (int )sizeof(hdr) ) return OpError; + + return _get_reply_code(socket_fd); + } + +/*--------------------------------------------------------------------------------*/ + +int plot_add_dataset( int socket_fd, int plot, PlotType type ) + { + hdr_t hdr; + int bytes; + + if ( socket_fd < 0 ) return OpError; + + hdr.t.type = MsgAddDataset; + hdr.t.dlen = 0; + hdr.t.dnum = -1; + hdr.t.plot = plot; + hdr.t.ptype = type; + + /* Write header */ + bytes = _write_data( socket_fd, (const char *)&hdr, sizeof(hdr) ); + if ( bytes < (int )sizeof(hdr) ) return OpError; + + return _get_reply_code(socket_fd); + } + +/*--------------------------------------------------------------------------------*/ + +int plot_remove_dataset( int socket_fd, int plot, int number ) + { + hdr_t hdr; + int bytes; + + if ( socket_fd < 0 ) return OpError; + + hdr.t.type = MsgRemoveDataset; + hdr.t.dlen = 0; + hdr.t.dnum = number; + hdr.t.plot = plot; + /*hdr.t.ptype = ;*/ + + /* Write header */ + bytes = _write_data( socket_fd, (const char *)&hdr, sizeof(hdr) ); + if ( bytes < (int )sizeof(hdr) ) return OpError; + + return _get_reply_code(socket_fd); + } + +/*--------------------------------------------------------------------------------*/ + +int plot_remove_all_datasets( int socket_fd, int plot ) + { + hdr_t hdr; + int bytes; + + if ( socket_fd < 0 ) return OpError; + + hdr.t.type = MsgRemoveAllDatasets; + hdr.t.dlen = 0; + hdr.t.dnum = -1; + hdr.t.plot = plot; + /*hdr.t.ptype = type;*/ + + /* Write header */ + bytes = _write_data( socket_fd, (const char *)&hdr, sizeof(hdr) ); + if ( bytes < (int )sizeof(hdr) ) return OpError; + + return _get_reply_code(socket_fd); + } + +/*--------------------------------------------------------------------------------*/ + +int plot_set_channel( int socket_fd, int plot, int dataset, int channel, EType etype, int rows, int cols, const void *data, int dlen, int pixelo, int lineo ) + { + int bytes; + hdr_t hdr; + + if ( socket_fd < 0 ) return OpError; + + assert( plot >= 0 ); + assert( rows > 0 ); + assert( cols > 0 ); + assert( dlen >= 0 ); + assert( data ); + + /* Default values */ + if ( pixelo == 0 ) pixelo = esizeof(etype); + if ( lineo == 0 ) lineo = cols * pixelo; + if ( dlen == 0 ) dlen = rows * cols * esizeof(etype); + + hdr.c.type = MsgChannel; + hdr.c.dnum = dataset; + hdr.c.dlen = dlen; + hdr.c.plot = plot; + hdr.c.chan = channel; + hdr.c.rows = rows; + hdr.c.cols = cols; + hdr.c.etype = etype; + hdr.c.pixelo = pixelo; + hdr.c.lineo = lineo; + + /* Write header */ + bytes = _write_data( socket_fd, (const char *)&hdr, sizeof(hdr) ); + if ( bytes < (int )sizeof(hdr) ) return OpError; + + /** Write data */ + bytes = _write_data( socket_fd, (const char *)data, dlen ); + if ( bytes < dlen ) return OpError; + + return _get_reply_code(socket_fd); + } + +/*--------------------------------------------------------------------------------*/ + + +int plot_set_property( int socket_fd, int plot, const char *property, const char *value ) + { + if ( socket_fd < 0 ) return OpError; + return OpError; + } + +/*--------------------------------------------------------------------------------*/ + + +void plot_disconnect( int socket_fd ) + { + if ( socket_fd < 0 ) return; + close(socket_fd); + } + diff --git a/kmatplot/interface/common.h b/kmatplot/interface/common.h new file mode 100644 index 0000000..616983f --- /dev/null +++ b/kmatplot/interface/common.h @@ -0,0 +1,118 @@ +/*************************************************************************** + common.h + ------------------- + begin : Sun Jun 18 2000 + copyright : (C) 2000 by Kamil Dobkowski + email : kamildobk@friko.onet.pl + ***************************************************************************/ + +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + +#ifndef __COMMON_H +#define __COMMON_H + +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + +#include "etype.h" +#include "msg.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/*--------------------------------------------------------------------------------*/ + +typedef enum { OpError = -1 } ReturnCode; + +/*--------------------------------------------------------------------------------*/ + +/** + * Connects to the plot application. Returns a file descriptor of a communication socket or + * -1 if an error occured. New application is executed if currently there is no one with + * a requested number running. + * app_number = 0 -> create a new app and return its number in 'return_app_number' + * app_number = NULL + * socket_fd = NULL + */ +int plot_connect( int app_number, int *return_app_number, int *return_socket_fd ); + +/*--------------------------------------------------------------------------------*/ + +/** + * Adds new axes and returns axes ID or <0 if error occured. + * type == 0 for 2d axes or != 0 for 3d axes + */ +int plot_add_axes( int socket_fd, int axes_type ); + +/*--------------------------------------------------------------------------------*/ + +/** + */ +int plot_remove_axes( int socket_fd, int axes_id ); + +/*--------------------------------------------------------------------------------*/ + +/** + * Adds a new dataset to the given axes. + * Returns a dataset number or <0 if ended with an error. + */ +int plot_add_dataset( int socket_fd, int axes_id, PlotType type ); + +/*--------------------------------------------------------------------------------*/ + +/** + */ +int plot_remove_dataset( int socket_fd, int axes_id, int number ); + +/*--------------------------------------------------------------------------------*/ + +/** + * + */ +int plot_remove_all_datasets( int socket_fd, int axes_id ); + +/*--------------------------------------------------------------------------------*/ + +/** + * data - pointer to data memory ordered so: + * value(row,col) = *((etype *)((char *)data+lineo*rows+pixelo*cols)) + * + * dlen - length of data in bytes. Default value is rows*cols*sizeof(etype). + * pixelo - pixel offset in bytes. Default value is sizeof(etype). + * lineo - line offset in bytes. Default value is cols*pixelo + */ +int plot_set_channel( int socket_fd, + int axes_id, int dataset, int channel, + EType etype, + int rows, int cols, + const void *data, int dlen, + int pixelo, int lineo ); + +/*--------------------------------------------------------------------------------*/ + +/** + * Not implemented + */ +int plot_set_property( int socket_fd, int axes_id, const char *property, const char *value ); + +/*--------------------------------------------------------------------------------*/ + +/** + * Close socket. + */ +void plot_disconnect( int socket_fd ); + +#ifdef __cplusplus + } +#endif + +#endif diff --git a/kmatplot/interface/etype.h b/kmatplot/interface/etype.h new file mode 100644 index 0000000..44de8fd --- /dev/null +++ b/kmatplot/interface/etype.h @@ -0,0 +1,45 @@ +/*************************************************************************** + etype.h + ------------------- + begin : Thu Jun 22 2000 + copyright : (C) 2000 by Kamil Dobkowski + email : kamildobk@friko.onet.pl + ***************************************************************************/ + +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + +#ifndef __ETYPE_H +#define __ETYPE_H + +#ifdef __cplusplus +extern "C" { +#endif + +typedef enum { PlotCurve = 0, + PlotImage = 1, + PlotContour = 2, + PlotSurface = 3, + PlotFigure = 4 + } PlotType; + +typedef enum { EDouble = 0, + EFloat = 1, + ELong = 2, + EUShort = 3, + EShort = 4, + EUChar = 5 + } EType; + +#ifdef __cplusplus + } +#endif + +#endif + diff --git a/kmatplot/interface/msg.h b/kmatplot/interface/msg.h new file mode 100644 index 0000000..569f794 --- /dev/null +++ b/kmatplot/interface/msg.h @@ -0,0 +1,106 @@ +/*************************************************************************** + msg.h + ------------------- + begin : Wed Jun 21 2000 + copyright : (C) 2000 by Kamil Dobkowski + email : kamildobk@friko.onet.pl + ***************************************************************************/ + +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + +#ifndef __MSG_H +#define __MSG_H + +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + +#include"etype.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef enum { MsgChannel, + MsgProperty, + MsgAddAxes, + MsgRemoveAxes, + MsgAddDataset, + MsgRemoveDataset, + MsgRemoveAllDatasets + } MsgType; + + +typedef struct { + MsgType type; // message type + int dlen; // data length ( excluding header ) + int plot; // axes number ( 1 - inf ) + } generic_hdr_t; + +//--------------------------------------------------------------------------------// + +typedef struct { + MsgType type; // must be MsgAddAxes, MsgRemoveAxes + int dlen; // always 0 + int plot; // axes number + int axes; // add 3d axes if != 0 + } axes_hdr_t; + +//--------------------------------------------------------------------------------// + +typedef struct { + MsgType type; // must be MsgAddDataset, MsgRemoveDataset, MsgRemoveAllDatasets + int dlen; // always 0 + int plot; + int dnum; // dataset number - valid only for MsgRemoveDataset + PlotType ptype; + } ptype_hdr_t; + +//--------------------------------------------------------------------------------// + +typedef struct { + MsgType type;// must be MsgChannel + int dlen; + int plot; + int dnum; + int chan; + int rows; + int cols; + int etype; // type of element + int lineo; // line offset + int pixelo; // pixel offset + } channel_hdr_t; + +//--------------------------------------------------------------------------------// + +typedef struct { + MsgType type; // must be MsgProperty + int dlen; + int plot; + int plen; + int vlen; + } property_hdr_t; + +//--------------------------------------------------------------------------------// + +typedef union { + generic_hdr_t h; + axes_hdr_t a; + ptype_hdr_t t; + channel_hdr_t c; + property_hdr_t p; + } hdr_t; + +#ifdef __cplusplus + } +#endif + +#endif + diff --git a/kmatplot/kmatplotshell.cpp b/kmatplot/kmatplotshell.cpp new file mode 100644 index 0000000..a80b97c --- /dev/null +++ b/kmatplot/kmatplotshell.cpp @@ -0,0 +1,1426 @@ +/*************************************************************************** + kmatplotshell.cpp + ------------------- + begin : Sat Mar 11 2000 + copyright : (C) 2000 by Kamil Dobkowski + email : kamildobk@friko.onet.pl + ***************************************************************************/ + +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + +#include "kmatplotshell.h" + +#include "kscommands.h" +#include "kssocketio.h" +#include "ksglobalmatrixlist.h" +#include "ksprojectxml.h" +#include "ksglobalsettings.h" +#include "ksworkbook.h" +#include "ksworkspace.h" +#include "kswinpageview.h" +#include "kswinworksheet.h" +#include "dialogs/ksconfiguredlg.h" +#include "widgets/qsplotview.h" + +#include <qevent.h> +#include <qlabel.h> +#include <qfiledialog.h> +#include <qapplication.h> +#include <qmessagebox.h> +#include <qstringlist.h> +#include <qfile.h> +#include <qpaintdevicemetrics.h> +#include <qprinter.h> +#include <qpainter.h> +#include <qaction.h> +#include <qmenubar.h> +#include <qtoolbar.h> +#include <qdockwindow.h> +#include <qtabwidget.h> +#include <qtextedit.h> +#include <qworkspace.h> + +// icons +#include"pixmaps/action_open.xpm" +#include"pixmaps/action_save.xpm" +#include"pixmaps/action_print.xpm" +#include"pixmaps/action_exit.xpm" + +#include"pixmaps/action_undo.xpm" +#include"pixmaps/action_redo.xpm" +#include"pixmaps/action_cut.xpm" +#include"pixmaps/action_copy.xpm" +#include"pixmaps/action_paste.xpm" +#include"pixmaps/action_delete.xpm" + +#include"pixmaps/action_wizard.xpm" +#include"pixmaps/action_curve.xpm" +#include"pixmaps/action_contour.xpm" +#include"pixmaps/action_pixmap.xpm" +#include"pixmaps/action_surface.xpm" +#include"pixmaps/action_figure.xpm" + +#include"pixmaps/panel_x.xpm" +#include"pixmaps/panel_y.xpm" +#include"pixmaps/panel_z.xpm" +#include"pixmaps/panel_v.xpm" + +#include"pixmaps/action_exportpicture.xpm" + +#include"pixmaps/action_toback.xpm" +#include"pixmaps/action_tofront.xpm" +#include"pixmaps/action_raise.xpm" +#include"pixmaps/action_lower.xpm" + +#include"pixmaps/action_arrow.xpm" +#include"pixmaps/action_label.xpm" +#include"pixmaps/action_fullpage.xpm" +#include"pixmaps/action_locate.xpm" +#include"pixmaps/action_properties.xpm" +#include"pixmaps/action_rectangle.xpm" +#include"pixmaps/action_select.xpm" +#include"pixmaps/action_zoom.xpm" +#include"pixmaps/action_worksheet.xpm" +#include"pixmaps/action_green.xpm" +#include"pixmaps/action_gray.xpm" +#include"pixmaps/action_red.xpm" + +// see main.cpp +extern KSSocketIO *kmatplot_socket; + +//-----------------------------------------------------------------------------// + +KMatplotShell::KMatplotShell( const char * ) +: QMainWindow() + { + setCaption(tr(" KMatplot ")); + resize( 710, 690 ); + m_curr_data_object = NULL; + m_workspace = new KSWorkspace( this ); + setCentralWidget( m_workspace ); + + m_workbook = new KSWorkbook( this ); + m_workbook->clear(); + m_workbook->pageAdd( new QSPage(m_workbook) ); + connect( m_workbook->commandHistory(), SIGNAL(sigNewUndo()), this, SLOT(slot_new_undo()) ); + connect( m_workbook->commandHistory(), SIGNAL(sigNewRedo()), this, SLOT(slot_new_redo()) ); + connect( m_workbook->commandHistory(), SIGNAL(sigError(const QString&)), this, SLOT(slot_show_error(const QString&)) ); + connect( m_workbook, SIGNAL(sigWorkbookChanged()), this, SLOT(slot_set_dirty()) ); + m_modified = false; + + create_actions(); + create_dock_areas(); + // QPrinter::HighResolution has problems with fonts + m_printer = new QPrinter( ); + m_printer->setFullPage(true); + m_workbook->setPrinter( m_printer ); + + if ( kmatplot_socket ) kmatplot_socket->setShell( this ); + + m_show_full_page->setOn( true ); + m_zoom_75->setOn( TRUE ); + + slot_new_undo(); + slot_new_redo(); + slot_dock_visiblity_changed( TRUE ); + + connect( m_side_dock, SIGNAL(visibilityChanged(bool)), this, SLOT(slot_dock_visiblity_changed(bool)) ); + connect( m_help_dock, SIGNAL(visibilityChanged(bool)), this, SLOT(slot_dock_visiblity_changed(bool)) ); + connect( m_bottom_dock, SIGNAL(visibilityChanged(bool)), this, SLOT(slot_dock_visiblity_changed(bool)) ); + + connect( m_file_toolbar, SIGNAL(visibilityChanged(bool)), this, SLOT(slot_dock_visiblity_changed(bool)) ); + connect( m_edit_toolbar, SIGNAL(visibilityChanged(bool)), this, SLOT(slot_dock_visiblity_changed(bool)) ); + connect( m_view_toolbar, SIGNAL(visibilityChanged(bool)), this, SLOT(slot_dock_visiblity_changed(bool)) ); + connect( m_tool_toolbar, SIGNAL(visibilityChanged(bool)), this, SLOT(slot_dock_visiblity_changed(bool)) ); + setUpLayout(); + show(); + KSWinPageView *window = new KSWinPageView( m_workspace ); + window->view()->setWorkbook( m_workbook ); + //window->hide(); + window->showMaximized(); + window->setFocus(); + //window->resize( m_workspace->size() ); + //new QWidget( m_workspace ); + //slotNewPageViewWin(); + m_modified = false; + } + +//-----------------------------------------------------------------------------// + +void KMatplotShell::create_actions() + { + // FILE + m_new = new QAction( tr("New"), tr("&New"), 0, this, "new_file" ); + connect( m_new, SIGNAL(activated()), this, SLOT(slotNew()) ); + m_open = new QAction( tr("Open"), QPixmap(action_open), tr("&Open file ..."), CTRL+Key_O, this, "open_file" ); + connect( m_open, SIGNAL(activated()), this, SLOT(slotOpen()) ); + m_merge = new QAction( tr("Merge"), tr("&Merge ..."), 0, this, "merge_file" ); + connect( m_merge, SIGNAL(activated()), this, SLOT(slotMerge()) ); + m_save_as = new QAction( tr("Save as"), tr("Save &as ..."), 0, this, "save_as" ); + connect( m_save_as, SIGNAL(activated()), this, SLOT(slotSaveAs()) ); + m_save = new QAction( tr("Save"), QPixmap(action_save), tr("&Save"), CTRL+Key_S, this, "save" ); + connect( m_save, SIGNAL(activated()), this, SLOT(slotSave()) ); + + m_print = new QAction( tr("Print"), QPixmap(action_print), tr("&Print"), CTRL+Key_P, this, "print" ); + connect( m_print, SIGNAL(activated()), this, SLOT(slotPrint()) ); + m_printer_setup = new QAction( tr("Priner"), tr("Printer Setup..."), 0, this, "printer_setup" ); + connect( m_printer_setup, SIGNAL(activated()), this, SLOT(slotPrinterSetup()) ); + + m_exit = new QAction( tr("Exit"), QPixmap(action_exit), tr("&Exit"), CTRL+Key_X, this, "exit" ); + connect( m_exit, SIGNAL(activated()), this, SLOT(close()) ); + + QPopupMenu *file = new QPopupMenu( this ); + menuBar()->insertItem( "&File", file ); + m_new->addTo( file ); + file->insertSeparator(); + m_open->addTo( file ); + m_merge->addTo( file ); + m_save_as->addTo( file ); + m_save->addTo( file ); + file->insertSeparator(); + m_print->addTo( file ); + m_printer_setup->addTo( file ); + //m_dpi->addTo( file ); + file->insertSeparator(); + m_exit->addTo( file ); + + m_file_toolbar = new QToolBar(this,"file operations"); + m_file_toolbar->setLabel(tr("File Operations")); + m_open->addTo( m_file_toolbar ); + m_save->addTo( m_file_toolbar ); + m_print->addTo( m_file_toolbar ); + + //------------------------------------------------------------------------------------------// + // EDIT + m_undo = new QAction( tr("Undo"), QPixmap(action_undo), tr("&Undo"), CTRL+Key_Z, this, "undo" ); + connect( m_undo, SIGNAL(activated()), this, SLOT(slotUndo()) ); + m_redo = new QAction( tr("Redo"), QPixmap(action_redo), tr("&Redo"), CTRL+Key_Y, this, "redo" ); + connect( m_redo, SIGNAL(activated()), this, SLOT(slotRedo()) ); + m_copy = new QAction( tr("Copy"), QPixmap(action_copy), tr("&Copy"), CTRL+Key_C, this, "copy" ); + connect( m_copy, SIGNAL(activated()), this, SLOT(slotCopy()) ); + m_copy_all = new QAction( tr("Copy all"), tr("&Copy with data"), 0, this, "copy_all" ); + connect( m_copy_all, SIGNAL(activated()), this, SLOT(slotCopyAll()) ); + m_paste = new QAction( tr("Paste"), QPixmap(action_paste), tr("&Paste"), CTRL+Key_V, this, "paste" ); + connect( m_paste, SIGNAL(activated()), this, SLOT(slotPaste()) ); + m_cut = new QAction( tr("Cut"), QPixmap(action_cut), tr("C&ut"), CTRL+Key_X, this, "cut" ); + connect( m_cut, SIGNAL(activated()), this, SLOT(slotCut()) ); + m_delete = new QAction( tr("Delete"), QPixmap(action_delete), tr("&Delete"), 0, this, "delete" ); + connect( m_delete, SIGNAL(activated()), this, SLOT(slotDelete()) ); + + // not visible + m_object_menu = new KSSimpleAction( this, tr("Object"), tr("&Object menu"), 0, this, "object_menu" ); + + QPopupMenu *edit = new QPopupMenu( this ); + menuBar()->insertItem( "&Edit", edit ); + m_undo->addTo( edit ); + m_redo->addTo( edit ); + edit->insertSeparator(); + m_cut->addTo( edit ); + m_copy->addTo( edit ); + m_copy_all->addTo( edit ); + m_paste->addTo( edit ); + m_delete->addTo( edit ); + + m_edit_toolbar = new QToolBar(this,"edit operations"); + m_edit_toolbar->setLabel(tr("Edit Operations")); + m_undo->addTo( m_edit_toolbar ); + m_cut->addTo( m_edit_toolbar ); + m_copy->addTo( m_edit_toolbar ); + m_paste->addTo( m_edit_toolbar ); + + //-------------------------------------------------------------------------------------// + // VIEW + m_zoom = new QActionGroup( this, "page_zoom", TRUE ); + m_zoom->setUsesDropDown( TRUE ); + m_zoom->setMenuText( tr("Zoom") ); + m_zoom_50 = new QAction( tr("50%"), tr("50%"), 0, m_zoom, "zoom_50", TRUE ); + m_zoom_75 = new QAction( tr("75%"), tr("75%"), 0, m_zoom, "zoom_75", TRUE ); + m_zoom_100 = new QAction( tr("100%"), tr("100%"), 0, m_zoom, "zoom_100", TRUE ); + m_zoom_150 = new QAction( tr("150%"), tr("150%"), 0, m_zoom, "zoom_150", TRUE ); + m_zoom_200 = new QAction( tr("200%"), tr("200%"), 0, m_zoom, "zoom_200", TRUE ); + connect( m_zoom, SIGNAL(selected(QAction*)), this, SLOT(slotPageZoom(QAction*)) ); + + m_show_full_page = new KSSimpleAction( this, tr("Page"), QPixmap(action_fullpage), tr("&Full page"), CTRL+Key_F, this, "full_page", TRUE ); + m_grid = new KSSimpleAction( this, tr("Grid"), tr("Grid ..."), 0, this, "grid" ); + m_ioinfo = new KSSimpleAction( this, tr("I/O"), tr("&I/O info ..."), 0, this, "io_info" ); + + m_toolbars = new QActionGroup( this, "toolbars", FALSE ); + m_toolbars->setUsesDropDown( TRUE ); + m_toolbars->setMenuText( tr("Toolbars") ); + m_show_side_dock = new QAction( tr("Objects"), tr("Show objects"), 0, m_toolbars, "side_dock", TRUE ); + m_show_help_dock = new QAction( tr("Messages"), tr("Show messages"), 0, m_toolbars, "help_dock", TRUE ); + m_show_bottom_dock = new QAction( tr("Properties/Output"), tr("Show properties/output"), 0, m_toolbars, "bottom_dock", TRUE ); + m_show_file_toolbar = new QAction( tr("File toolbar"), tr("Show file toolbar"), 0, m_toolbars, "file_toolbar", TRUE ); + m_show_edit_toolbar = new QAction( tr("Edit toolbar"), tr("Show edit toolbar"), 0, m_toolbars, "edit_toolbar", TRUE ); + m_show_view_toolbar = new QAction( tr("View toolbar"), tr("Show view toolbar"), 0, m_toolbars, "view_toolbar", TRUE ); + m_show_tool_toolbar = new QAction( tr("Tool toolbar"), tr("Show tool toolbar"), 0, m_toolbars, "tool_toolbar", TRUE ); + connect( m_show_side_dock, SIGNAL(activated()), this, SLOT(slot_show_toolbars()) ); + connect( m_show_help_dock, SIGNAL(activated()), this, SLOT(slot_show_toolbars()) ); + connect( m_show_bottom_dock, SIGNAL(activated()), this, SLOT(slot_show_toolbars()) ); + connect( m_show_file_toolbar, SIGNAL(activated()), this, SLOT(slot_show_toolbars()) ); + connect( m_show_edit_toolbar, SIGNAL(activated()), this, SLOT(slot_show_toolbars()) ); + connect( m_show_view_toolbar, SIGNAL(activated()), this, SLOT(slot_show_toolbars()) ); + connect( m_show_tool_toolbar, SIGNAL(activated()), this, SLOT(slot_show_toolbars()) ); + + QPopupMenu *view = new QPopupMenu( this ); + menuBar()->insertItem( "&View", view ); + m_zoom->addTo( view ); + view->insertSeparator(); + m_show_full_page->addTo( view ); + view->insertSeparator(); + m_ioinfo->addTo( view ); + m_grid->addTo( view ); + view->insertSeparator(); + m_toolbars->addTo( view ); + + m_view_toolbar = new QToolBar(this,"view operations"); + m_view_toolbar->setLabel(tr("View Operations")); + m_show_full_page->addTo( m_view_toolbar ); + m_zoom->addTo( m_view_toolbar ); + + //-----------------------------------------------------------------------------------------// + // GRAPH + m_wizard = new KSSimpleAction( this, tr("Wizard"), QPixmap(action_wizard), tr("&Wizard ..."), 0, this, "wizard" ); + m_new_axes2d = new KSSimpleAction( this, tr("XY axes"), tr("XY Axes"), 0, this, "new_axes2d" ); + m_new_axes3d = new KSSimpleAction( this, tr("XYZ Axes"), tr("XYZ Axes"), 0, this, "new_axes3d" ); + + m_new_curve = new KSSimpleAction( this, tr("XY plot"), QPixmap(action_curve), tr("&XY plot"), 0, this, "new_curve" ); + m_new_image = new KSSimpleAction( this, tr("Pixmap"), QPixmap(action_pixmap),tr("&Pixmap"), 0, this, "new_pixmap" ); + m_new_contour = new KSSimpleAction( this, tr("Contour"), QPixmap(action_contour), tr("C&ontour"), 0, this, "new_contour" ); + m_new_ngcontour = new KSSimpleAction( this, tr("Non Gridded contour"), QPixmap(action_contour), tr("&Non Gridded contour"), 0, this, "new_non_gridded_contour" ); + m_new_surface = new KSSimpleAction( this, tr("Surface"), QPixmap(action_surface), tr("&Surface"), 0, this, "new_surface" ); + m_new_figure = new KSSimpleAction( this, tr("Figure"), QPixmap(action_figure), tr("&Figure"), 0, this, "new_figure" ); + + m_new_xaxis = new KSSimpleAction( this, tr("X"), QPixmap(panel_x), tr("&X axis"), 0, this, "add_x_axis" ); + m_new_yaxis = new KSSimpleAction( this, tr("Y"), QPixmap(panel_y), tr("&Y axis"), 0, this, "add_y_axis" ); + m_new_zaxis = new KSSimpleAction( this, tr("Z"), QPixmap(panel_z), tr("&Z axis"), 0, this,"add_z_axis" ); + m_new_vaxis = new KSSimpleAction( this, tr("V"), QPixmap(panel_v), tr("&V axis"), 0, this, "add_v_axis" ); + + m_new_legend = new KSSimpleAction( this, tr("Legend"), tr("Legend"), 0, this, "new_legend" ); + + m_cut_dataset = new KSSimpleAction( this, tr("Cut dataset"), tr("Cut dataset"), 0, this, "cut_dataset" ); + m_copy_dataset = new KSSimpleAction( this, tr("Copy dataset"), tr("Copy dataset"), 0, this, "copy_dataset" ); + m_copy_all_dataset = new KSSimpleAction( this, tr("Copy dataset with data"), tr("Copy dataset with data"), 0, this, "copy_all_dataset" ); + m_paste_dataset = new KSSimpleAction( this, tr("Paste dataset"), tr("Paste dataset"), 0, this, "paste_dataset" ); + m_delete_dataset = new KSSimpleAction( this, tr("Delete dataset"), tr("Delete dataset"), 0, this, "delete_dataset" ); + m_raise_dataset = new KSSimpleAction( this, tr("Raise dataset"), tr("Raise dataset"), 0, this, "raise_dataset" ); + m_lower_dataset = new KSSimpleAction( this, tr("Lower dataset"), tr("Lower dataset"), 0, this, "lower_dataset" ); + m_bring_dataset_to_front = new KSSimpleAction( this, tr("Bring dataset to front"), tr("Bring dataset to front"), 0, this, "bring_dataset_to_front" ); + m_send_dataset_to_back = new KSSimpleAction( this, tr("Send dataset to back"), tr("Send dataset to back"), 0, this, "send_dataset_to_back" ); + + m_datasets = new KSSimpleAction( this, tr("Datasets"), tr("Edit datasets ..."), 0, this, "edit_datasets" ); + + + QPopupMenu *graph = new QPopupMenu( this ); + + menuBar()->insertItem( "&Graph", graph ); + m_wizard->addTo( graph ); + graph->insertSeparator(); + m_new_axes2d->addTo( graph ); + m_new_axes3d->addTo( graph ); + graph->insertSeparator(); + + QPopupMenu *graph_insert = new QPopupMenu( graph ); + graph->insertItem( "&Insert", graph_insert ); + m_new_curve->addTo( graph_insert ); + m_new_image->addTo( graph_insert ); + m_new_contour->addTo( graph_insert ); + m_new_ngcontour->addTo( graph_insert ); + m_new_surface->addTo( graph_insert ); + m_new_figure->addTo( graph_insert ); + graph_insert->insertSeparator(); + m_new_xaxis->addTo( graph_insert ); + m_new_yaxis->addTo( graph_insert ); + m_new_zaxis->addTo( graph_insert ); + m_new_vaxis->addTo( graph_insert ); + graph_insert->insertSeparator(); + m_new_legend->addTo( graph_insert ); + + QPopupMenu *graph_dataset = new QPopupMenu( graph ); + graph->insertItem( "&Current dataset", graph_dataset ); + m_cut_dataset->addTo( graph_dataset ); + m_copy_dataset->addTo( graph_dataset ); + m_copy_all_dataset->addTo( graph_dataset ); + m_paste_dataset->addTo( graph_dataset ); + m_delete_dataset->addTo( graph_dataset ); + graph_dataset->insertSeparator(); + m_raise_dataset->addTo( graph_dataset ); + m_lower_dataset->addTo( graph_dataset ); + graph_dataset->insertSeparator(); + m_bring_dataset_to_front->addTo( graph_dataset ); + m_send_dataset_to_back->addTo( graph_dataset ); + + graph->insertSeparator(); + m_datasets->addTo( graph ); + + //------------------------------------------------------------------------------------------// + // WORKSHEET + + m_new_sheet = new KSSimpleAction( this, tr("Sheet"), tr("&New sheet"), 0, this, "new_sheet" ); + m_rename_sheet = new KSSimpleAction( this, tr("Rename sheet"), tr("&Rename sheet ..."), 0, this, "rename_sheet" ); + m_new_matrix = new KSSimpleAction( this, tr("Numerical"), tr("N&umerical matrix"), 0, this, "new_matrix" ); + m_new_string = new KSSimpleAction( this, tr("String"), tr("&String matrix"), 0, this, "new_string" ); + m_new_formula = new KSSimpleAction( this, tr("Formula"), tr("&Formula matrix"), 0, this, "new_formula" ); + m_new_reference = new KSSimpleAction( this, tr("Range"), tr("&Point to: sheet cell range"), 0, this, "new_reference" ); + + m_import_octave = new KSSimpleAction( this, tr("Import"), tr("&Import Octave/MAT1.0 data ..."), 0, this, "import_data" ); + m_export_octave = new KSSimpleAction( this, tr("Export"), tr("&Export Octave ASCII data ..."), 0, this, "export_data" ); + m_detach = new KSSimpleAction( this, tr("Detach"), tr("&Detach"), 0, this, "detach" ); + m_transpose = new KSSimpleAction( this, tr("Transpose"), tr("&Transpose"), 0, this, "transpose" ); + + m_cut_sheet = new KSSimpleAction( this, tr("Cut sheet"), tr("Cut sheet"), 0, this, "cut_sheet" ); + m_copy_sheet = new KSSimpleAction( this, tr("Copy sheet"), tr("Copy sheet"), 0, this, "copy_sheet" ); + m_copy_all_sheet = new KSSimpleAction( this, tr("Copy all sheet"), tr("Copy sheet with data"), 0, this, "copy_all_sheet" ); + m_paste_sheet = new KSSimpleAction( this, tr("Paste sheet"), tr("Paste sheet"), 0, this, "paste_sheet" ); + m_delete_sheet = new KSSimpleAction( this, tr("Delete sheet"), tr("Delete sheet"), 0, this, "delete_sheet" ); + + QPopupMenu *worksheet = new QPopupMenu( this ); + menuBar()->insertItem( tr("&Worksheet"), worksheet ); + m_new_sheet->addTo( worksheet ); + m_rename_sheet->addTo( worksheet ); + QPopupMenu *new_matrix = new QPopupMenu( worksheet ); + worksheet->insertItem( tr("New matrix"), new_matrix ); + m_new_matrix->addTo( new_matrix ); + m_new_string->addTo( new_matrix ); + m_new_formula->addTo( new_matrix ); + m_new_reference->addTo( new_matrix ); + + worksheet->insertSeparator(); + QPopupMenu *import_data = new QPopupMenu( worksheet ); + worksheet->insertItem( tr("Import data"), import_data ); + m_import_octave->addTo( import_data ); + QPopupMenu *export_data = new QPopupMenu( worksheet ); + worksheet->insertItem( tr("Export data"), export_data ); + m_export_octave->addTo( export_data ); + + worksheet->insertSeparator(); + QPopupMenu *selected_sheet = new QPopupMenu( worksheet ); + worksheet->insertItem( tr("Selected sheet"), selected_sheet ); + m_cut_sheet->addTo( selected_sheet ); + m_copy_sheet->addTo( selected_sheet ); + m_copy_all_sheet->addTo( selected_sheet ); + m_paste_sheet ->addTo( selected_sheet ); + + worksheet->insertSeparator(); + m_detach->addTo( worksheet ); + m_transpose->addTo( worksheet ); + worksheet->insertSeparator(); + m_delete_sheet->addTo( worksheet ); + +//------------------------------------------------------------------------------------------// + // PAGE + + m_new_page = new QAction( tr("Page"), tr("New &page"), 0, this, "new_page" ); + connect( m_new_page, SIGNAL(activated()), this, SLOT(slotNewPage()) ); + m_rename_page = new KSSimpleAction( this, tr("Rename"), tr("&Rename ..."), 0, this, "rename_page" ); + m_delete_page = new KSSimpleAction( this, tr("Delete page"), tr("&Delete page"), 0, this, "delete_page" ); + m_page_to_front = new KSSimpleAction( this, tr("Page to front"), tr("Page to &front"), 0, this, "page_to_back" ); + m_page_to_back = new KSSimpleAction( this, tr("Page to back"), tr("Page to &back"), 0, this, "page_to_front" ); + + m_raise_page = new KSSimpleAction( this, tr("Raise page"), tr("&Raise page"), 0, this, "raise_page" ); + m_lower_page = new KSSimpleAction( this, tr("Lower page"), tr("&Lower page"), 0, this, "lower_page" ); + + m_export_picture = new KSSimpleAction( this, tr("Export picture"), QPixmap(action_exportpicture), tr("Export p&icture ..."), 0, this, "export_picture" ); + + QPopupMenu *page = new QPopupMenu( this ); + menuBar()->insertItem( "&Page", page ); + + m_new_page->addTo( page ); + page->insertSeparator(); + m_rename_page->addTo( page ); + m_delete_page->addTo( page ); + page->insertSeparator(); + m_page_to_front->addTo( page ); + m_page_to_back->addTo( page ); + page->insertSeparator(); + m_raise_page->addTo( page ); + m_lower_page->addTo( page ); + page->insertSeparator(); + m_export_picture->addTo( page ); + + //------------------------------------------------------------------------------------------// + // ARRANGE + m_send_to_back = new KSSimpleAction( this, tr("ToBack"), QPixmap(action_toback), tr("Send To Back"), 0, this, "send_to_back" ); + m_bring_to_front = new KSSimpleAction( this, tr("ToFront"), QPixmap(action_tofront), tr("Bring To Front"), 0, this, "bring_to_front" ); + m_raise = new KSSimpleAction( this, tr("Raise"), QPixmap(action_raise), tr("Raise"), 0, this, "raise" ); + m_lower = new KSSimpleAction( this, tr("Lower"), QPixmap(action_lower), tr("Lower"), 0, this, "lower" ); + m_group = new KSSimpleAction( this, tr("Group"), tr("Group"), 0, this, "group" ); + m_ungroup = new KSSimpleAction( this, tr("Ungroup"), tr("Ungroup"), 0, this, "ungroup" ); + + QPopupMenu *arrange = new QPopupMenu( this ); + menuBar()->insertItem( "&Arrange", arrange ); + m_group->addTo( arrange ); + m_ungroup->addTo( arrange ); + arrange->insertSeparator(); + m_raise->addTo( arrange ); + m_lower->addTo( arrange ); + arrange->insertSeparator(); + m_bring_to_front->addTo( arrange ); + m_send_to_back->addTo( arrange ); + + //-------------------------------------------------------------------------------------------// + // TOOLS + //QString tool_group = "Tools"; + m_tools = new QActionGroup( this, "tools", TRUE ); + m_tool_select = new QAction( tr("Select"), QPixmap(action_select), tr("Select"), 0, m_tools, "tool_select", TRUE ); + m_tool_label = new QAction( tr("Label"), QPixmap(action_label), tr("Label"), 0, m_tools, "tool_label", TRUE ); + m_tool_arrow = new QAction( tr("Arrow"), QPixmap(action_arrow), tr("Arrow"), 0, m_tools, "tool_arrow", TRUE ); + m_tool_rect = new QAction( tr("Rect"), QPixmap(action_rectangle), tr("Rect"), 0, m_tools, "tool_rectangle", TRUE ); + m_tool_zoom = new QAction( tr("Zoom"), QPixmap(action_zoom), tr("Zoom"), 0, m_tools, "tool_zoom", TRUE ); + m_tool_locate = new QAction( tr("Locate"), QPixmap(action_locate), tr("Locate"), 0, m_tools, "tool_locate", TRUE ); + connect( m_tools, SIGNAL(selected(QAction*)), this, SLOT(slotTool(QAction*)) ); + + QPopupMenu *tools = new QPopupMenu( this ); + menuBar()->insertItem( "&Tools", tools ); + m_tools->addTo( tools ); + + m_tool_toolbar = new QToolBar(this,"tools"); + m_tool_toolbar->setLabel(tr("Tools")); + m_tools->addTo( m_tool_toolbar ); + + + //--------------------------------------------------------------------------------------// + // WINDOWS + m_new_worksheet_win = new QAction( tr("Worksheet"), QPixmap(action_green), tr("Worksheets"), 0, this, "new_worksheet_window" ); + connect( m_new_worksheet_win, SIGNAL(activated()), this, SLOT(slotNewWorksheetWin()) ); + m_new_page_view_win = new QAction( tr("Page view"), QPixmap(action_red), tr("Page view"), 0, this, "new_page_view_window" ); + connect( m_new_page_view_win, SIGNAL(activated()), this, SLOT(slotNewPageViewWin()) ); + m_new_edit_data_win = new QAction( tr("Dataset"), QPixmap(action_gray), tr("Current dataset"), 0, this, "new_data_window" ); + connect( m_new_edit_data_win, SIGNAL(activated()), this, SLOT(slotNewEditDataWin()) ); + + m_tile_windows = new QAction( tr("Tile"), tr("Tile"), 0, this, "tile_windows" ); + connect( m_tile_windows, SIGNAL(activated()), this, SLOT(slotTileWindows()) ); + m_cascade_windows = new QAction( tr("Cascade"), tr("Cascade"), 0, this, "cascade_windows" ); + connect( m_cascade_windows, SIGNAL(activated()), this, SLOT(slotCascadeWindows()) ); + + m_maximize_windows = new QAction( tr("Maximize"), tr("Maximize"), 0, this, "maximize_windows" ); + connect( m_maximize_windows, SIGNAL(activated()), this, SLOT(slotMaximizeWindows()) ); + m_minimize_windows = new QAction( tr("Minimize"), tr("Minimize"), 0, this, "minimize_windows" ); + connect( m_minimize_windows, SIGNAL(activated()), this, SLOT(slotMinimizeWindows()) ); + m_close_window = new QAction( tr("Close"), tr("Close"), 0, this, "close_windows" ); + connect( m_close_window, SIGNAL(activated()), this, SLOT(slotCloseWindow()) ); + m_close_all_windows = new QAction( tr("Close all"), tr("Close all"), 0, this, "close_all_windows" ); + connect( m_close_all_windows, SIGNAL(activated()), this, SLOT(slotCloseAllWindows()) ); + + m_restore_windows = new QAction( tr("Restore"), tr("Restore"), 0, this, "restore_windows" ); + connect( m_restore_windows, SIGNAL(activated()), this, SLOT(slotRestoreWindows()) ); + m_hide_window = new QAction( tr("Hide"), tr("Hide"), 0, this, "hide_window" ); + connect( m_hide_window, SIGNAL(activated()), this, SLOT(slotHideWindow()) ); + m_show_window = new QAction( tr("Show"), tr("Show"), 0, this, "show_window" ); + connect( m_show_window, SIGNAL(activated()), this, SLOT(slotShowWindow()) ); + + QPopupMenu *windows = new QPopupMenu( this ); + menuBar()->insertItem( "&Windows", windows ); + QPopupMenu *new_window = new QPopupMenu( windows ); + windows->insertItem( tr("New window"), new_window ); + m_new_page_view_win->addTo( new_window ); + m_new_worksheet_win->addTo( new_window ); + m_new_edit_data_win->addTo( new_window ); + windows->insertSeparator(); + m_restore_windows->addTo( windows ); + m_maximize_windows->addTo( windows ); + m_minimize_windows->addTo( windows ); + windows->insertSeparator(); + m_hide_window->addTo( windows ); + m_show_window->addTo( windows ); + windows->insertSeparator(); + m_close_window->addTo( windows ); +// m_close_all_windows->addTo( windows ); + windows->insertSeparator(); + m_tile_windows->addTo( windows ); + m_cascade_windows->addTo( windows ); + + //-----------------------------------------------------------------------------------------------// + // SETTINGS actions + m_hide_sliders = new KSSimpleAction( this, tr("Sliders"), tr("Hide S&liders"), 0, this, "hide_sliders", TRUE ); + m_apply_button = new KSSimpleAction( this, tr("Apply"), tr("Show &Apply button"), 0, this, "apply_properties", TRUE ); + m_auto_apply = true; + m_hide_rulers = new KSSimpleAction( this, tr("Rulers"), tr("Hide &Rulers"), 0, this, "hide_rulers", TRUE ); + m_x11_backstoring = new KSSimpleAction( this, tr("Backstoring"), tr("X11 backstoring"), 0, this, "x11_backstoring",TRUE ); + m_configure = new QAction( tr("Configure"), tr("&Configure KMatplot ..."), 0, this, "configure_kmatplot" ); + connect( m_configure, SIGNAL(activated()), this, SLOT(slotConfigure()) ); + + QPopupMenu *settings = new QPopupMenu( this ); + menuBar()->insertItem( "&Settings", settings ); + m_apply_button->addTo( settings ); + m_x11_backstoring->addTo( settings ); + m_hide_rulers->addTo( settings ); + m_hide_sliders->addTo( settings ); + settings->insertSeparator(); + m_configure->addTo( settings ); + + //-------------------------------------------------------------------------------------------// + // HELP + m_example_simple = new QAction( tr("Simple"), tr("Simple"), 0, this, "example_simple" ); + connect( m_example_simple, SIGNAL(activated()), this, SLOT(slotExampleSimple()) ); + m_example_contour = new QAction( tr("Contour"), tr("Contour"), 0, this, "example_contour" ); + connect( m_example_contour, SIGNAL(activated()), this, SLOT(slotExampleContour()) ); + m_example_3dpath = new QAction( tr("3D path"), tr("3D path"), 0, this, "example_3dpath" ); + connect( m_example_3dpath, SIGNAL(activated()), this, SLOT(slotExamplePath3d()) ); + m_example_surface = new QAction( tr("Surface"), tr("Surface"), 0, this, "example_surface" ); + connect( m_example_surface, SIGNAL(activated()), this, SLOT(slotExampleSurface()) ); + m_example_shell = new QAction( tr("Shell"), tr("Shell"), 0, this, "example_shell" ); + connect( m_example_shell, SIGNAL(activated()), this, SLOT(slotExampleShell()) ); + m_about = new QAction( tr("About"), tr("&About ..."), 0, this, "about" ); + connect( m_about, SIGNAL(activated()), this, SLOT(slotAbout()) ); + + QPopupMenu *help = new QPopupMenu( this ); + menuBar()->insertSeparator(); + menuBar()->insertItem( "&Help", help ); + QPopupMenu *help_examples = new QPopupMenu( help ); + help->insertItem( "&Examples", help_examples ); + m_example_simple->addTo( help_examples ); + m_example_contour->addTo( help_examples ); + m_example_3dpath->addTo( help_examples ); + m_example_surface->addTo( help_examples ); + m_example_shell->addTo( help_examples ); + help->insertSeparator(); + m_about->addTo( help ); + + + } + +//-----------------------------------------------------------------------------// + +void KMatplotShell::create_dock_areas() + { + //------------------------------------------------------// + // BOTTOM DOCK + m_bottom_dock = new QDockWindow( QDockWindow::InDock, this ); + m_bottom_dock->setResizeEnabled(TRUE); + m_bottom_dock->setFixedExtentWidth( 1 ); + m_bottom_dock->setFixedExtentHeight( 1 ); + m_bottom_dock->setCloseMode( QDockWindow::Always ); + moveDockWindow( m_bottom_dock, DockBottom ); + m_bottom_tab = new QTabWidget( m_bottom_dock ); + m_bottom_dock->setWidget( m_bottom_tab ); + + // add property container + m_property_container = new KSSimpleContainer( m_bottom_tab, 500, 135 ); + m_bottom_tab->addTab( m_property_container, tr("Properties") ); + + // add console + m_output_message = new QTextEdit(m_bottom_tab); + m_output_message->setReadOnly( TRUE ); + m_output_message->setTextFormat( RichText ); + m_output_message->setUndoRedoEnabled( FALSE ); + m_output_message->setWordWrap( QTextEdit::NoWrap ); + m_bottom_tab->addTab( m_output_message, tr("Output") ); + m_console = new KSSimpleConsole( this ); + + //-------------------------------------------------------// + // SIDE DOCK + m_side_dock = new QDockWindow( QDockWindow::InDock, this ); + m_side_dock->setResizeEnabled(TRUE); + m_side_dock->setFixedExtentWidth( 1 ); + m_side_dock->setFixedExtentHeight( 1 ); + m_side_dock->setCloseMode( QDockWindow::Always ); + moveDockWindow( m_side_dock, DockLeft ); + m_side_tab = new QTabWidget( m_side_dock ); + m_side_dock->setWidget( m_side_tab ); + + // add object container + m_object_container = new KSSimpleContainer( m_side_tab, 200, 260 ); + m_side_tab->addTab( m_object_container, tr("Objects") ); + + // add datasets + //m_side_tab->addTab( new QWidget(m_side_tab), tr("Datasets") ); + + //------------------------------------------------------// + // HELP DOCK + m_help_dock = new QDockWindow( QDockWindow::InDock, this ); + m_help_dock->setResizeEnabled(TRUE); + m_help_dock->setCloseMode( QDockWindow::Always ); + moveDockWindow( m_help_dock, DockLeft ); + m_help_container = new KSSimpleContainer( m_help_dock, 200, 150 ); + m_help_dock->setWidget( m_help_container ); + + m_help_message = new QLabel( m_help_container ); + m_help_message->setTextFormat( RichText ); + m_help_message->setAlignment( AlignAuto | AlignTop | ExpandTabs | WordBreak ); + m_help_message->setFont( QFont("Arial", 9) ); + m_help_message->setIndent( 5 ); + m_help_container->setWidget( m_help_message ); + + } + +//-----------------------------------------------------------------------------// + +KMatplotShell::~KMatplotShell() + { + //if ( kmatplot_socket ) kmatplot_socket->unregisterPart( part_id ); + m_workbook->commandHistory()->clear(); + delete m_printer; + delete m_console; + } + + +//-----------------------------------------------------------------------------// + +void KMatplotShell::slot_show_toolbars() + { + if ( m_show_file_toolbar->isOn() ) m_file_toolbar->show(); else m_file_toolbar->hide(); + if ( m_show_edit_toolbar->isOn() ) m_edit_toolbar->show(); else m_edit_toolbar->hide(); + if ( m_show_view_toolbar->isOn() ) m_view_toolbar->show(); else m_view_toolbar->hide(); + if ( m_show_tool_toolbar->isOn() ) m_tool_toolbar->show(); else m_tool_toolbar->hide(); + if ( m_show_bottom_dock->isOn() ) m_bottom_dock->show(); else m_bottom_dock->hide(); + if ( m_show_side_dock->isOn() ) m_side_dock->show(); else m_side_dock->hide(); + if ( m_show_help_dock->isOn() ) m_help_dock->show(); else m_help_dock->hide(); + } + +//-----------------------------------------------------------------------------// + +void KMatplotShell::slot_dock_visiblity_changed( bool ) + { + if ( m_file_toolbar->isVisible() ) m_show_file_toolbar->setOn( TRUE ); else m_show_file_toolbar->setOn( FALSE ); + if ( m_edit_toolbar->isVisible() ) m_show_edit_toolbar->setOn( TRUE ); else m_show_edit_toolbar->setOn( FALSE ); + if ( m_view_toolbar->isVisible() ) m_show_view_toolbar->setOn( TRUE ); else m_show_view_toolbar->setOn( FALSE ); + if ( m_tool_toolbar->isVisible() ) m_show_tool_toolbar->setOn( TRUE ); else m_show_tool_toolbar->setOn( FALSE ); + if ( m_bottom_dock->isVisible() ) m_show_bottom_dock->setOn( TRUE ); else m_show_bottom_dock->setOn( FALSE ); + if ( m_side_dock->isVisible() ) m_show_side_dock->setOn( TRUE ); else m_show_side_dock->setOn( FALSE ); + if ( m_help_dock->isVisible() ) m_show_help_dock->setOn( TRUE ); else m_show_help_dock->setOn( FALSE ); + } + +//-----------------------------------------------------------------------------// + +void KMatplotShell::doAction( QAction *action ) + { + if ( m_workspace->activeWindow() ) m_workspace->activeWindow()->doAction( action ); + } + +//-----------------------------------------------------------------------------// + +void KMatplotShell::slotDataObjectSelected( QSData *data ) + { + m_curr_data_object = data; + if ( data ) m_new_edit_data_win->setEnabled( TRUE ); + else m_new_edit_data_win->setEnabled( FALSE ); + } + +//-----------------------------------------------------------------------------// + +void KMatplotShell::slotNewEditDataWin() + { + KSWinWorksheet *window = new KSWinWorksheet( m_workspace, false ); + window->resize( 200, 250 ); + window->setDataObject( m_curr_data_object ); + window->showMaximized(); + } + +//-----------------------------------------------------------------------------// + +void KMatplotShell::slotNewWorksheetWin() + { + KSWinWorksheet *window = new KSWinWorksheet( m_workspace, true ); + window->resize( 200, 250 ); + window->setDataObject( m_workbook->sheets() ); + window->showMaximized(); + } + +//-----------------------------------------------------------------------------// + +void KMatplotShell::slotNewPageViewWin() + { + KSWinPageView *window = new KSWinPageView( m_workspace ); + window->resize( 200, 250 ); + window->view()->setWorkbook( m_workbook ); + window->showMaximized(); + } + +//-----------------------------------------------------------------------------// + +void KMatplotShell::slotTileWindows() + { + m_workspace->workspace()->tile(); + } + +//-----------------------------------------------------------------------------// + +void KMatplotShell::slotCascadeWindows() + { + m_workspace->workspace()->cascade(); + } + +//-----------------------------------------------------------------------------// + +void KMatplotShell::slotMaximizeWindows() + { + if ( m_workspace->workspace()->activeWindow() ) m_workspace->workspace()->activeWindow()->showMaximized(); + } + +//-----------------------------------------------------------------------------// + +void KMatplotShell::slotRestoreWindows() + { + if ( m_workspace->workspace()->activeWindow() ) m_workspace->workspace()->activeWindow()->showNormal(); + } + +//-----------------------------------------------------------------------------// + +void KMatplotShell::slotMinimizeWindows() + { + if ( m_workspace->workspace()->activeWindow() ) m_workspace->workspace()->activeWindow()->showMinimized(); + } + +//-----------------------------------------------------------------------------// + +void KMatplotShell::slotHideWindow() + { + if ( m_workspace->workspace()->activeWindow() ) m_workspace->workspace()->activeWindow()->hide(); + } + +//-----------------------------------------------------------------------------// + +void KMatplotShell::slotShowWindow() + { + if ( m_workspace->workspace()->activeWindow() ) m_workspace->workspace()->activeWindow()->show(); + } + +//-----------------------------------------------------------------------------// + +void KMatplotShell::slotCloseWindow() + { + if ( m_workspace->workspace()->activeWindow() ) m_workspace->workspace()->activeWindow()->close(); + } + +//-----------------------------------------------------------------------------// + +void KMatplotShell::slotCloseAllWindows() + { + QWidgetList l = m_workspace->workspace()->windowList(); + + } + +//-----------------------------------------------------------------------------// + +void KMatplotShell::slotShowHelpMessage( const QString& message ) + { + m_help_message->setText( message ); + } + +//-----------------------------------------------------------------------------// + +void KMatplotShell::slotShowOutputMessage( const QString& message ) + { + if ( m_output_message->paragraphs() > 200 ) { + int parags_to_remove = m_output_message->paragraphs()-200; + for( int i=0;i<parags_to_remove;i++) m_output_message->removeParagraph( 0 ); + } + m_output_message->insertParagraph( "<p>"+message+"</p>", -1 ); + } + + +//-----------------------------------------------------------------------------// + +void KMatplotShell::toggleToolBar() +{ + /* + if (m_show_toolbar->isChecked()) + toolBar()->show(); + else + toolBar()->hide(); + */ +} + +//-----------------------------------------------------------------------------// + +bool KMatplotShell::openFile( const QString& filename ) + { + clearAll(); + bool result = mergeFile( filename ); + if ( result ) { + m_modified = false; + m_curr_file = filename; + setCaption(tr(" KMatplot - %1 ").arg(m_curr_file)); + } + return result; + } + +//-----------------------------------------------------------------------------// + +bool KMatplotShell::mergeFile( const QString& filename ) + { + QFile f( filename ); + KSProjectXML *xml = new KSProjectXML( this ); + bool result = xml->loadFromFile( f ); + delete xml; + f.close(); + if ( result ) { + m_modified = true; + setCaption(tr(" KMatplot - %1 ").arg(m_curr_file)); + } + return result; + } + +//-----------------------------------------------------------------------------// + +bool KMatplotShell::saveFile( const QString& filename ) + { + QFile f( filename ); + if ( !f.open( IO_WriteOnly ) ) return false; + KSProjectXML *xml = new KSProjectXML( this ); + bool result = xml->saveToFile( f ); + delete xml; + f.close(); + if ( result ) { + m_modified = false; + m_curr_file = filename; + setCaption(tr(" KMatplot - %1 ").arg(m_curr_file)); + } + return result; + } + +//-----------------------------------------------------------------------------// + +void KMatplotShell::slotNew() + { + if ( !m_modified || QMessageBox::warning( this, + "Closing the current document", + "The current document was modified. Close anyway ?", + QMessageBox::Ok, QMessageBox::Cancel ) == QMessageBox::Ok ) { + clearAll(); + m_workbook->pageAdd( new QSPage(m_workbook) ); + m_modified = false; + } + } + +//-----------------------------------------------------------------------------// + +void KMatplotShell::clearAll() + { + m_workbook->clear(); + m_workbook->sheets()->clearAll(); + m_curr_file = QString::null; + setCaption(tr(" KMatplot ")); + m_modified = false; + } + +//-----------------------------------------------------------------------------// + +void KMatplotShell::slotOpen() + { + if ( !m_modified || QMessageBox::warning( this, + "Closing the current document", + "The current document was modified. Close anyway ?", + QMessageBox::Ok, QMessageBox::Cancel ) == QMessageBox::Ok ) { + QString filename = QFileDialog::getOpenFileName( + m_open_path.isEmpty() ? QDir::homeDirPath() : m_open_path, + tr("*.kmp|KMatplot files (*.kmp)"), + this, "file_open", tr("Open File...") ); + if ( !filename.isEmpty() ) + if ( openFile(filename) ) { + m_open_path = filename; + } else { + QMessageBox::critical(NULL,tr("Error !"),tr("Can't open the file.")); + } + } + } + +//-----------------------------------------------------------------------------// + +void KMatplotShell::slotMerge() + { + QString filename = QFileDialog::getOpenFileName( + m_open_path.isEmpty() ? QDir::homeDirPath() : m_open_path, + tr("*.kmp|KMatplot files (*.kmp)"), + this, "file_merge", tr("Merge File...") ); + + if ( !filename.isEmpty() ) + if ( mergeFile(filename) ) { + m_open_path = filename; + } else { + QMessageBox::critical(NULL,tr("Error !"),tr("Can't open the file.")); + } + } + +//-----------------------------------------------------------------------------// + +void KMatplotShell::slotSaveAs() + { + QString filename = QFileDialog::getSaveFileName( + m_save_path.isEmpty() ? QDir::currentDirPath() : m_save_path, + tr("*.kmp|KMatplot files (*.kmp)"), + this, "file_save", + tr("Save file...") ); + if ( !filename.isEmpty() ) + if ( saveFile(filename) ) { + m_save_path = filename; + } else { + QMessageBox::critical(NULL,tr("Error !"),tr("Can't save the file.")); + } + } + +//-----------------------------------------------------------------------------// + +void KMatplotShell::slotSave() + { + if ( m_curr_file.isEmpty() ) slotSaveAs(); + else if ( !saveFile(m_curr_file) ) QMessageBox::critical(NULL,tr("Error !"),tr("Can't save the file.")); + } + +//-----------------------------------------------------------------------------// + +void KMatplotShell::closeEvent( QCloseEvent* e ) + { + if ( queryExit() ) e->accept(); else e->ignore(); + } + +//-----------------------------------------------------------------------------// + +bool KMatplotShell::queryExit() + { + if ( !m_modified || QMessageBox::warning( this, + "Exit", + "The current document was modified. Close anyway ?", + QMessageBox::Ok, QMessageBox::Cancel ) == QMessageBox::Ok ) return TRUE; + return FALSE; + } + +//-----------------------------------------------------------------------------// + +void KMatplotShell::load_example( const QString& filename ) + { + if ( !m_modified || QMessageBox::warning( this, + "Closing the current document", + "The current document was modified. Close anyway ?", + QMessageBox::Ok, QMessageBox::Cancel ) == QMessageBox::Ok ) { + openFile( KSGlobalSettings::examplePath()+"/"+filename ); + } + } + +//-----------------------------------------------------------------------------// + +void KMatplotShell::slotExampleSimple() + { + load_example( "simple.kmp" ); + } + +//-----------------------------------------------------------------------------// + +void KMatplotShell::slotExampleContour() + { + load_example( "contour.kmp" ); + } + +//-----------------------------------------------------------------------------// + +void KMatplotShell::slotExamplePath3d() + { + load_example( "path3d.kmp" ); + } + +//-----------------------------------------------------------------------------// + +void KMatplotShell::slotExampleSurface() + { + load_example( "surface.kmp" ); + } + +//-----------------------------------------------------------------------------// + +void KMatplotShell::slotExampleShell() + { + load_example( "shell.kmp" ); + } + +//-----------------------------------------------------------------------------// + +void KMatplotShell::slotAbout() + { + QString message = tr("KMatplot 0.4 \n" + "This program is distibuted under GPL licence.\n\n" + "(c) 2000-2002 Kamil Dobkowski kamildobk@poczta.onet.pl \n" + " Python module: Martin Wiechert martin.wiechert@qmx.de" ); + QMessageBox::critical( NULL, tr("Error"), message, QMessageBox::Ok, 0, 0 ); + } + +//-----------------------------------------------------------------------------// + +void KMatplotShell::slotCut() + { + if ( m_workspace->activeWindow() ) m_workspace->activeWindow()->cut(); + } + +//-----------------------------------------------------------------------------// + +void KMatplotShell::slotCopy() + { + if ( m_workspace->activeWindow() ) m_workspace->activeWindow()->copy(); + } + +//-----------------------------------------------------------------------------// + +void KMatplotShell::slotCopyAll() + { + if ( m_workspace->activeWindow() ) m_workspace->activeWindow()->copyAll(); + } + +//-----------------------------------------------------------------------------// + +void KMatplotShell::slotPaste() + { + if ( m_workspace->activeWindow() ) m_workspace->activeWindow()->paste(); + } + +//-----------------------------------------------------------// + +void KMatplotShell::slotDelete() + { + if ( m_workspace->activeWindow() ) m_workspace->activeWindow()->del(); + } + +//-----------------------------------------------------------------------------// + +void KMatplotShell::refreshSettings() + { + } + +//-------------------------------------------------------------// + +void KMatplotShell::slotNewPage() + { + m_workbook->execute( new KSCmdAddPage( new QSPage(NULL), m_workbook ) ); + } + +//-----------------------------------------------------------// + +void KMatplotShell::slot_new_undo() + { + m_undo->setEnabled( m_workbook->commandHistory()->isUndoPossible() ); + m_undo->setMenuText( tr("Undo: ")+m_workbook->commandHistory()->undoCommandTitle() ); + } + +//-----------------------------------------------------------// + +void KMatplotShell::slot_new_redo() + { + m_redo->setEnabled( m_workbook->commandHistory()->isRedoPossible() ); + m_redo->setMenuText( tr("Redo: ")+m_workbook->commandHistory()->redoCommandTitle() ); + } + +//-----------------------------------------------------------// + +void KMatplotShell::slotUndo() + { + m_workbook->commandHistory()->undo(); + } + +//-----------------------------------------------------------// + +void KMatplotShell::slotRedo() + { + m_workbook->commandHistory()->redo(); + } + +//-----------------------------------------------------------// + +void KMatplotShell::slot_set_dirty() + { + m_modified = true; + } + +//-----------------------------------------------------------// + +void KMatplotShell::slot_show_error( const QString& message ) + { + QMessageBox::critical( NULL, tr("Error"), message, QMessageBox::Ok, 0, 0 ); + } + +//-----------------------------------------------------------// + +void KMatplotShell::slotTool( QAction *action ) + { + doAction( action ); + } + +//-----------------------------------------------------------// + +void KMatplotShell::slotPageZoom( QAction */*action*/ ) + { + doAction( m_zoom ); + } + +//-----------------------------------------------------------// + +bool KMatplotShell::slotPrint() + { + bool end = false; + while( !end ) + switch( QMessageBox::information( centralWidget(), + tr("Print"), + tr("Print the current document ?"), + tr("&Print"), tr("Printer &Setup..."), tr("&Cancel"), + 0, 2 ) ) { + case 0: // Print + end = true; + break; + case 1: // Page setup + end = false; + slotPrinterSetup(); + break; + case 2: // Cancel + end = true; + return TRUE; + break; + } + + QSConsole::write(tr("Printing. Please wait...")); + slotShowHelpMessage(tr("Printing. Please wait...")); + + QPainter paint(m_printer); + QPaintDeviceMetrics pdm(m_printer); + + int print_dpi = KSGlobalSettings::useCustomPrintDpi() ? KSGlobalSettings::customPrintDpi() : 600 ; + if ( print_dpi != pdm.logicalDpiX() || print_dpi != pdm.logicalDpiY() ) { + // set resolution of the paper + paint.setWindow( 0, 0, + int(pdm.width() * print_dpi / pdm.logicalDpiX() + 0.5), + int(pdm.height() * print_dpi / pdm.logicalDpiY() + 0.5) ); + } + + m_workbook->print( &paint, m_printer, print_dpi ); + paint.end(); + QSConsole::write(tr("Done.")); + slotShowHelpMessage(tr("Done.")); + return FALSE; + } + +//-----------------------------------------------------------// + +void KMatplotShell::slotPrinterSetup() + { + m_printer->setMinMax( 1, m_workbook->pageCount() ); + if ( m_printer->setup(centralWidget()) ) m_workbook->setPrinter( m_printer ); + } + +//-----------------------------------------------------------// + +void KMatplotShell::slotConfigure() + { + KSConfigureDlg dlg; + if ( dlg.exec() ) dlg.applySettings(); + } + +//-----------------------------------------------------------// + +void KMatplotShell::disableCustomActions() + { + m_copy->setEnabled( FALSE ); + m_copy_all->setEnabled( FALSE ); + m_cut->setEnabled( FALSE ); + m_paste->setEnabled( FALSE ); + m_delete->setEnabled( FALSE ); + m_zoom->setEnabled( FALSE ); + m_datasets->setEnabled( FALSE ); +/* + m_zoom_50->setEnabled( FALSE ); + m_zoom_75->setEnabled( FALSE ); + m_zoom_100->setEnabled( FALSE ); + m_zoom_150->setEnabled( FALSE ); + m_zoom_200->setEnabled( FALSE ); +*/ + m_grid->setEnabled( FALSE ); + m_ioinfo->setEnabled( FALSE ); + + m_new_legend->setEnabled( FALSE ); + + m_wizard->setEnabled( FALSE ); + m_new_axes2d->setEnabled( FALSE ); + m_new_axes3d->setEnabled( FALSE ); + m_new_curve->setEnabled( FALSE ); + m_new_image->setEnabled( FALSE ); + m_new_contour->setEnabled( FALSE ); + m_new_ngcontour->setEnabled( FALSE ); + m_new_surface->setEnabled( FALSE ); + m_new_figure->setEnabled( FALSE ); + m_new_xaxis->setEnabled( FALSE ); + m_new_yaxis->setEnabled( FALSE ); + m_new_zaxis->setEnabled( FALSE ); + m_new_vaxis->setEnabled( FALSE ); + + m_cut_dataset->setEnabled( FALSE ); + m_copy_dataset->setEnabled( FALSE ); + m_copy_all_dataset->setEnabled( FALSE ); + m_paste_dataset->setEnabled( FALSE ); + m_delete_dataset->setEnabled( FALSE ); + m_raise_dataset->setEnabled( FALSE ); + m_lower_dataset->setEnabled( FALSE ); + m_bring_dataset_to_front->setEnabled( FALSE ); + m_send_dataset_to_back->setEnabled( FALSE ); + + m_new_sheet->setEnabled( FALSE ); + m_rename_sheet->setEnabled( FALSE ); + m_new_matrix->setEnabled( FALSE ); + m_new_string->setEnabled( FALSE ); + m_new_formula->setEnabled( FALSE ); + m_new_reference->setEnabled( FALSE ); + m_import_octave->setEnabled( FALSE ); + m_export_octave->setEnabled( FALSE ); + m_detach->setEnabled( FALSE ); + m_transpose->setEnabled( FALSE ); + + m_cut_sheet ->setEnabled( FALSE ); + m_copy_sheet->setEnabled( FALSE ); + m_copy_all_sheet->setEnabled( FALSE ); + m_paste_sheet->setEnabled( FALSE ); + m_delete_sheet->setEnabled( FALSE ); + + m_rename_page->setEnabled( FALSE ); + m_delete_page->setEnabled( FALSE ); + m_page_to_front->setEnabled( FALSE ); + m_page_to_back->setEnabled( FALSE ); + m_raise_page->setEnabled( FALSE ); + m_lower_page->setEnabled( FALSE ); + m_export_picture->setEnabled( FALSE ); + + m_bring_to_front->setEnabled( FALSE ); + m_send_to_back->setEnabled( FALSE ); + m_raise->setEnabled( FALSE ); + m_lower->setEnabled( FALSE ); + m_group->setEnabled( FALSE ); + m_ungroup->setEnabled( FALSE ); + + m_tools->setEnabled( FALSE ); +/* + m_tool_zoom->setEnabled( FALSE ); + m_tool_locate->setEnabled( FALSE ); + m_tool_select->setEnabled( FALSE ); + m_tool_label->setEnabled( FALSE ); + m_tool_arrow->setEnabled( FALSE ); + m_tool_rect->setEnabled( FALSE ); + */ + m_hide_sliders->setEnabled( FALSE ); + m_apply_button->setEnabled( FALSE ); + m_hide_rulers->setEnabled( FALSE ); + m_x11_backstoring->setEnabled( FALSE ); + m_show_full_page->setEnabled( FALSE ); + } + + + //-----------------------------------------------------------// +//-----------------------------------------------------------// +//-----------------------------------------------------------// +//-----------------------------------------------------------// +//-----------------------------------------------------------// + +KSSimpleAction::KSSimpleAction( KMatplotShell *shell, QObject *parent, const char *name, bool toggle ) +:QAction( parent, name, toggle ) + { + m_shell = shell; + connect( this, SIGNAL(activated()), this, SLOT(slot_activated()) ); + } + +//-----------------------------------------------------------// + +KSSimpleAction::KSSimpleAction( KMatplotShell *shell, const QString &text, const QIconSet &icon, const QString &menuText, QKeySequence accel, QObject *parent, const char *name, bool toggle ) +:QAction( text, icon, menuText, accel, parent, name, toggle ) + { + m_shell = shell; + connect( this, SIGNAL(activated()), this, SLOT(slot_activated()) ); + } + +//-----------------------------------------------------------// + +KSSimpleAction::KSSimpleAction ( KMatplotShell *shell, const QString & text, const QString & menuText, QKeySequence accel, QObject * parent, const char *name, bool toggle ) +:QAction( text, menuText, accel, parent, name, toggle ) + { + m_shell = shell; + connect( this, SIGNAL(activated()), this, SLOT(slot_activated()) ); + } + +//-----------------------------------------------------------// + +KSSimpleAction::~KSSimpleAction() + { + } + +//-----------------------------------------------------------// + +void KSSimpleAction::slot_activated() + { + if ( m_shell ) m_shell->doAction( this ); + } + +//-----------------------------------------------------------// +//-----------------------------------------------------------// +//-----------------------------------------------------------// +//-----------------------------------------------------------// +//-----------------------------------------------------------// + + +KSSimpleContainer::KSSimpleContainer( QWidget *parent, int w, int h, int margin ) + : QFrame( parent ) + { + m_widget = NULL; + m_size = QSize( w, h ); + m_margin = margin; + } + +//-----------------------------------------------------------// + +KSSimpleContainer::~KSSimpleContainer() + { + delete m_widget; + } + +//-----------------------------------------------------------// + +void KSSimpleContainer::setWidget( QWidget *widget ) + { + delete m_widget; + m_widget = widget; + if ( m_widget ) { + m_widget->move( m_margin, m_margin ); + m_widget->resize( width()-2*m_margin, height()-2*m_margin ); + m_widget->show(); + } + } + +//-----------------------------------------------------------// + +void KSSimpleContainer::resizeEvent ( QResizeEvent * ) + { + if ( m_widget ) { + m_widget->resize( width()-2*m_margin, height()-2*m_margin ); + } + } + +//-----------------------------------------------------------// + +QSize KSSimpleContainer::sizeHint() const + { + return m_size; + } + +//------------------------------------------------------------------------------// +//------------------------------------------------------------------------------// +//------------------------------------------------------------------------------// +//------------------------------------------------------------------------------// + +KSSimpleConsole::KSSimpleConsole( KMatplotShell *shell ) +: QSConsole() + { + m_shell = shell; + } + +//------------------------------------------------------------------------------// + +KSSimpleConsole::~KSSimpleConsole() + { + } + +//------------------------------------------------------------------------------// + +void KSSimpleConsole::appendText( const QString& message ) + { + m_shell->slotShowOutputMessage( message ); + } + +//------------------------------------------------------------------------------// diff --git a/kmatplot/kmatplotshell.h b/kmatplot/kmatplotshell.h new file mode 100644 index 0000000..8b3fb59 --- /dev/null +++ b/kmatplot/kmatplotshell.h @@ -0,0 +1,335 @@ +/*************************************************************************** + kmatplotshell.h + ------------------- + begin : Sat Mar 11 2000 + copyright : (C) 2000 by Kamil Dobkowski + email : kamildobk@friko.onet.pl + ***************************************************************************/ + +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + +#ifndef KMATPLOTSHELL_H +#define KMATPLOTSHELL_H + +#include "widgets/qsconsole.h" +#include <qmainwindow.h> +#include <qwidget.h> +#include <qaction.h> + +class QLabel; +class QDockWindow; +class QPrinter; +class QToolbar; +class QTabWidget; +class QTextEdit; +class QSData; +class KSWorkbook; +class KSWorkspace; +class KSSimpleContainer; +class KSSimpleConsole; + +/** + *@author Kamil Dobkowski + */ +class KMatplotShell : public QMainWindow { + Q_OBJECT +public: + KMatplotShell( const char *name=0 ); + virtual ~KMatplotShell(); + KSWorkbook *workbook() { return m_workbook; } + void refreshSettings(); + virtual bool openFile( const QString& filename ); + virtual bool saveFile( const QString& filename ); + virtual bool mergeFile( const QString& filename ); + KSSimpleContainer *objectContainer() const { return m_object_container; } + KSSimpleContainer *propertyContainer() const { return m_property_container; } + QDockWindow *bottomDock() const { return m_bottom_dock; } + QDockWindow *sideDock() const { return m_side_dock; } + + void disableCustomActions(); + + QAction *m_maximize_windows; + QAction *m_minimize_windows; + QAction *m_close_window; + QAction *m_close_all_windows; + QAction *m_restore_windows; + QAction *m_hide_window; + QAction *m_show_window; + QAction *m_new_worksheet_win; + QAction *m_new_page_view_win; + QAction *m_new_edit_data_win; + QAction *m_tile_windows; + QAction *m_cascade_windows; + + QAction* m_cut; + QAction* m_copy; + QAction* m_copy_all; + QAction* m_paste; + QAction* m_delete; + QAction *m_datasets; + QAction *m_object_menu; + + QActionGroup *m_zoom; + QAction *m_zoom_50; + QAction *m_zoom_75; + QAction *m_zoom_100; + QAction *m_zoom_150; + QAction *m_zoom_200; + QAction *m_grid; + QAction *m_ioinfo; + + QAction *m_new_legend; + + QAction *m_wizard; + QAction *m_new_axes2d; + QAction *m_new_axes3d; + QAction *m_new_curve; + QAction *m_new_image; + QAction *m_new_contour; + QAction *m_new_ngcontour; + QAction *m_new_surface; + QAction *m_new_figure; + QAction *m_new_xaxis; + QAction *m_new_yaxis; + QAction *m_new_zaxis; + QAction *m_new_vaxis; + + QAction *m_cut_dataset; + QAction *m_copy_dataset; + QAction *m_copy_all_dataset; + QAction *m_paste_dataset; + QAction *m_delete_dataset; + QAction *m_raise_dataset; + QAction *m_lower_dataset; + QAction *m_bring_dataset_to_front; + QAction *m_send_dataset_to_back; + + QAction *m_new_sheet; + QAction *m_rename_sheet; + QAction *m_new_matrix; + QAction *m_new_string; + QAction *m_new_formula; + QAction *m_new_reference; + QAction *m_import_octave; + QAction *m_export_octave; + QAction *m_detach; + QAction *m_transpose; + + QAction *m_cut_sheet; + QAction *m_copy_sheet; + QAction *m_copy_all_sheet; + QAction *m_paste_sheet; + QAction *m_delete_sheet; + + QAction *m_new_page; + QAction *m_rename_page; + QAction *m_delete_page; + QAction *m_page_to_front; + QAction *m_page_to_back; + QAction *m_raise_page; + QAction *m_lower_page; + QAction *m_export_picture; + + QAction *m_bring_to_front; + QAction *m_send_to_back; + QAction *m_raise; + QAction *m_lower; + QAction *m_group; + QAction *m_ungroup; + + QActionGroup *m_tools; + QAction *m_tool_zoom; + QAction *m_tool_locate; + QAction *m_tool_select; + QAction *m_tool_label; + QAction *m_tool_arrow; + QAction *m_tool_rect; + + QAction *m_hide_sliders; + QAction *m_apply_button; + QAction *m_hide_rulers; + QAction *m_x11_backstoring; + QAction *m_show_full_page; + + +public slots: + + void doAction( QAction *action ); + + void slotShowHelpMessage( const QString& message ); + void slotShowOutputMessage( const QString& message ); + void slotDataObjectSelected( QSData *data ); + + void slotNew(); + void slotOpen(); + void slotMerge(); + void slotSave(); + void slotSaveAs(); + void slotPrinterSetup(); + bool slotPrint(); + + void clearAll(); + void slotUndo(); + void slotRedo(); + void slotCut(); + void slotCopy(); + void slotCopyAll(); + void slotPaste(); + void slotDelete(); + + void slotExampleSimple(); + void slotExampleContour(); + void slotExamplePath3d(); + void slotExampleSurface(); + void slotExampleShell(); + void slotAbout(); + + void toggleToolBar(); + void slotConfigure(); + + void slotNewWorksheetWin(); + void slotNewPageViewWin(); + void slotNewEditDataWin(); + void slotMaximizeWindows(); + void slotMinimizeWindows(); + void slotRestoreWindows(); + void slotHideWindow(); + void slotShowWindow(); + void slotCloseWindow(); + void slotCloseAllWindows(); + void slotTileWindows(); + void slotCascadeWindows(); + + void slotNewPage(); + void slotPageZoom( QAction* ); + void slotTool( QAction* ); + +protected: + void create_actions(); + void create_dock_areas(); + void load_example( const QString& filename ); + virtual bool queryExit(); + virtual void closeEvent( QCloseEvent* e ); + + QPrinter *m_printer; + KSWorkbook *m_workbook; + QDockWindow *m_bottom_dock; + QDockWindow *m_side_dock; + QDockWindow *m_help_dock; + QTabWidget *m_side_tab; + QTabWidget *m_bottom_tab; + KSSimpleContainer *m_property_container; + KSSimpleContainer *m_object_container; + KSSimpleContainer *m_help_container; + QLabel *m_help_message; + QTextEdit *m_output_message; + KSSimpleConsole *m_console; + KSWorkspace *m_workspace; + QSData *m_curr_data_object; + QToolBar *m_file_toolbar; + QToolBar *m_edit_toolbar; + QToolBar *m_view_toolbar; + QToolBar *m_tool_toolbar; + QString m_curr_file; + QString m_open_path; + QString m_save_path; + + bool m_auto_apply; + bool m_modified; + + QActionGroup *m_toolbars; + QAction *m_show_side_dock; + QAction *m_show_help_dock; + QAction *m_show_bottom_dock; + QAction *m_show_file_toolbar; + QAction *m_show_edit_toolbar; + QAction *m_show_view_toolbar; + QAction *m_show_tool_toolbar; + + QAction *m_new; + QAction *m_open; + QAction *m_merge; + QAction *m_save; + QAction *m_save_as; + QAction *m_print; + QAction *m_printer_setup; + QAction *m_exit; + + QAction* m_undo; + QAction* m_redo; + QAction *m_configure; + + QAction *m_example_simple; + QAction *m_example_contour; + QAction *m_example_3dpath; + QAction *m_example_surface; + QAction *m_example_shell; + QAction *m_about; + +private slots: + void slot_set_dirty(); + void slot_new_undo(); + void slot_new_redo(); + void slot_show_error( const QString& messsage ); + void slot_dock_visiblity_changed( bool visible ); + void slot_show_toolbars(); + }; + +//------------------------------------------------------------------------------// + +class KSSimpleAction : public QAction + { + Q_OBJECT + public: + KSSimpleAction ( KMatplotShell *shell, QObject * parent, const char * name = 0, bool toggle = FALSE ); + KSSimpleAction ( KMatplotShell *shell, const QString & text, const QIconSet & icon, const QString & menuText, QKeySequence accel, QObject * parent, const char * name = 0, bool toggle = FALSE ); + KSSimpleAction ( KMatplotShell *shell, const QString & text, const QString & menuText, QKeySequence accel, QObject * parent, const char * name = 0, bool toggle = FALSE ); + virtual ~KSSimpleAction(); + + protected slots: + void slot_activated(); + + protected: + KMatplotShell *m_shell; + + }; + +//------------------------------------------------------------------------------// + +class KSSimpleContainer : public QFrame + { + Q_OBJECT + public: + KSSimpleContainer( QWidget *widget, int w, int h, int margin=0 ); + virtual ~KSSimpleContainer(); + void setWidget( QWidget *widget ); + QWidget *widget() const { return m_widget; } + virtual QSize sizeHint() const; + protected: + virtual void resizeEvent ( QResizeEvent *event ); + QWidget *m_widget; + QSize m_size; + int m_margin; + }; + +//------------------------------------------------------------------------------// + +class KSSimpleConsole : public QSConsole + { + public: + KSSimpleConsole( KMatplotShell *shell ); + virtual ~KSSimpleConsole(); + protected: + virtual void appendText( const QString& message ); + KMatplotShell *m_shell; + }; + + +#endif diff --git a/kmatplot/kscommands.cpp b/kmatplot/kscommands.cpp new file mode 100644 index 0000000..1c009ec --- /dev/null +++ b/kmatplot/kscommands.cpp @@ -0,0 +1,1850 @@ +/*************************************************************************** + kscommands.cpp + ------------------- + begin : + copyright : (C) 2001 by Kamil Dobkowski + email : kamildobk@poczta.onet.pl + ***************************************************************************/ + +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + +#include"kscommands.h" +#include"ksglobalmatrixlist.h" +#include"ksobjectfactory.h" +#include"ksmatrix.h" +#include"widgets/qscobject.h" +#include"widgets/qsaxes.h" +#include"widgets/qsplot.h" +#include<qobject.h> +#include<qvariant.h> + +//---------------------------------------------------------------------------------------------// + +KSCmdAddCObject::KSCmdAddCObject( QSCObject *object, QSCObjectCollection *parent ) +: KSCommand( QObject::tr("New object") ) + { + m_objects.setAutoDelete( TRUE ); + m_objects.append( object ); + m_parent = parent; + } + +//---------------------------------------------------------------------------------------------// + +KSCmdAddCObject::KSCmdAddCObject( QSCObjectCollection *objects, QSCObjectCollection *parent ) +: KSCommand( QObject::tr("New objects") ) + { + m_objects.setAutoDelete( TRUE ); + for( int i=0; i<objects->count(); i++ ) m_objects.append( objects->object(i) ); + m_parent = parent; + } + +//---------------------------------------------------------------------------------------------// + +KSCmdAddCObject::~KSCmdAddCObject() + { + } + +//---------------------------------------------------------------------------------------------// + +bool KSCmdAddCObject::execute() +// improve this to keep relative order of object + { + if ( !m_parent ) { + setError( QObject::tr("No page selected") ); + return false; + } + for( int i=0; i<(int )m_objects.count(); i++ ) { + m_parent->add( m_objects.at(i) ); + } + // object is owned by collection now + m_objects.setAutoDelete( false ); + return true; + } + +//---------------------------------------------------------------------------------------------// + +void KSCmdAddCObject::unexecute() + { + for( int i=0; i<(int )m_objects.count(); i++ ) { + m_parent->remove( m_parent->find(m_objects.at(i)) ); + } + // take ownership + m_objects.setAutoDelete( true ); + } + +//---------------------------------------------------------------------------------------------// +//---------------------------------------------------------------------------------------------// +//---------------------------------------------------------------------------------------------// + +//---------------------------------------------------------------------------------------------// + +KSCmdRemoveCObject::KSCmdRemoveCObject( QSCObject *object ) +: KSCommand( QObject::tr("Remove object") ) + { + m_parent = object->collection(); + m_objects.setAutoDelete( false ); + m_objects.append( object ); + m_positions.insert( ( m_parent ? m_parent->find(object) : 0 ), object ); + } + +//---------------------------------------------------------------------------------------------// + +// +// All objects in collection must have the same parent collection +// +KSCmdRemoveCObject::KSCmdRemoveCObject( QSCObjectCollection *objects ) +: KSCommand( QObject::tr("Remove objects") ) + { + m_parent = NULL; + if ( objects->count() ) m_parent = objects->object(0)->collection(); + m_objects.setAutoDelete( false ); + for( int i=0; i<objects->count(); i++ ) { + m_objects.append( objects->object(i) ); + m_positions.insert( ( m_parent ? m_parent->find(objects->object(i)) : 0 ), objects->object(i) ); + } + } + +//---------------------------------------------------------------------------------------------// + +KSCmdRemoveCObject::~KSCmdRemoveCObject() + { + } + +//---------------------------------------------------------------------------------------------// + +bool KSCmdRemoveCObject::execute() + { + if ( !m_parent ) { + setError( QObject::tr("No object selected") ); + return false; + } + for( int i=0; i<(int )m_objects.count(); i++ ) { + m_objects.at(i)->stop(); + m_parent->remove( m_parent->find(m_objects.at(i)) ); + } + // take ownership + m_objects.setAutoDelete( true ); + return true; + } + +//---------------------------------------------------------------------------------------------// + +void KSCmdRemoveCObject::unexecute() + { + QMap<int,QSCObject*>::Iterator it; + // map is sorted by position - insert all objects at previous positions + for( it = m_positions.begin(); it != m_positions.end(); ++it ) { + m_parent->insert( it.key(), it.data() ); + } + // object is owned by collection now + m_objects.setAutoDelete( false ); + } + +//---------------------------------------------------------------------------------------------// +//---------------------------------------------------------------------------------------------// +//---------------------------------------------------------------------------------------------// +//---------------------------------------------------------------------------------------------// + +// +// objects still belongs to the caller. +// All objects in collection 'objects' must have the same parent collection +// but it needn't be 'objects' itself. +// +KSCmdObjectOrder::KSCmdObjectOrder( CommandType t, QSCObjectCollection *objects, QSWorkbook * ) +: KSCommand( QObject::tr("Order object(s)") ) + { + m_type = t; + // copy collection to interanal buffer + if ( objects && objects->count() > 0 ) { + m_collection = objects->object(0)->collection(); + for ( int i=0; i<objects->count(); i++ ) { + m_objects.insert( m_collection->find(objects->object(i)), objects->object(i) ); + } + } + } + +//---------------------------------------------------------------------------------------------// + +KSCmdObjectOrder::~KSCmdObjectOrder() + { + } + +//---------------------------------------------------------------------------------------------// + +bool KSCmdObjectOrder::execute() + { + if ( m_objects.count() == 0 ) { + setError( QObject::tr("No object selected") ); + return false; + } + int min_pos = 0; + int max_pos = m_collection->count()-1; + QMap<int,QSCObject*>::Iterator it; + switch( m_type ) { + case ToFront: for( it = m_objects.begin(); it != m_objects.end(); ++it ) { + it.data()->toFront(); + } + break; + case ToBack: it = m_objects.end(); + while( it != m_objects.begin() ) { + --it; + it.data()->toBack(); + } + break; + case Raise: it = m_objects.end(); + while( it != m_objects.begin() ) { + --it; + it.data()->reorder( QMIN(it.key()+1,max_pos) ); + max_pos = max_pos - 1; + } + break; + case Lower: for( it =m_objects.begin(); it != m_objects.end(); ++it ) { + it.data()->reorder( QMAX(it.key()-1,min_pos) ); + min_pos = min_pos + 1; + } + break; + } + return true; + } + +//---------------------------------------------------------------------------------------------// + +void KSCmdObjectOrder::unexecute() + { + QMap<int,QSCObject*>::Iterator it; + // map is sorted by position - move all objects to previous positions + switch( m_type ) { + case ToFront: + case Raise: for( it = m_objects.begin(); it != m_objects.end(); ++it ) { + it.data()->reorder( it.key() ); + } + break; + case ToBack: + case Lower: it = m_objects.end(); + while( it != m_objects.begin() ) { + --it; it.data()->reorder( it.key() ); + } + break; + } + } + +//---------------------------------------------------------------------------------------------// +//---------------------------------------------------------------------------------------------// +//---------------------------------------------------------------------------------------------// +//---------------------------------------------------------------------------------------------// + +/** + * Dont mix rotate and setBox command .Object can be only rotated or only moved/resized. + */ +KSCmdTransformCObjects::KSCmdTransformCObjects( QSDrv *drv ) +: KSCommand(QObject::tr("Transform object(s)")) + { + m_drv = drv; + } + +//---------------------------------------------------------------------------------------------// + +KSCmdTransformCObjects::~KSCmdTransformCObjects() + { + delete m_drv; + } + +//---------------------------------------------------------------------------------------------// + +void KSCmdTransformCObjects::addObject( QSCObject *object ) + { + m_drv->startDrawing(); + m_old_data.insert( object, TransformData(object->box(m_drv),object->angle()) ); + m_drv->stopDrawing(); + } + +//---------------------------------------------------------------------------------------------// + +QSRectf KSCmdTransformCObjects::objectRect( QSCObject *object ) + { + return m_old_data[object].m_rect; + } + +//---------------------------------------------------------------------------------------------// + +int KSCmdTransformCObjects::objectAngle( QSCObject *object ) + { + return m_old_data[object].m_angle; + } + +//---------------------------------------------------------------------------------------------// + +void KSCmdTransformCObjects::commit() + { + m_drv->startDrawing(); + TransformDataList::Iterator element; + for( element = m_old_data.begin(); element != m_old_data.end(); ++element ) { + m_new_data.insert( element.key(), TransformData(element.key()->box(m_drv),element.key()->angle()) ); + } + m_drv->stopDrawing(); + } + +//---------------------------------------------------------------------------------------------// + +bool KSCmdTransformCObjects::execute() + { + m_drv->startDrawing(); + TransformDataList::Iterator element; + for( element = m_new_data.begin(); element != m_new_data.end(); ++element ) { + element.key()->setAngle(element.data().m_angle); + element.key()->setBox(element.data().m_rect,m_drv); + } + for( element = m_old_data.begin(); element != m_old_data.end(); ++element ) element.key()->forceUpdate(); + return true; + } + +//---------------------------------------------------------------------------------------------// + +void KSCmdTransformCObjects::unexecute() + { + m_drv->startDrawing(); + TransformDataList::Iterator element; + for( element = m_old_data.begin(); element != m_old_data.end(); ++element ) { + element.key()->setAngle(element.data().m_angle); + element.key()->setBox(element.data().m_rect,m_drv); + } + m_drv->stopDrawing(); + for( element = m_old_data.begin(); element != m_old_data.end(); ++element ) element.key()->forceUpdate(); + } + +//---------------------------------------------------------------------------------------------// +//---------------------------------------------------------------------------------------------// +//---------------------------------------------------------------------------------------------// +//---------------------------------------------------------------------------------------------// +//---------------------------------------------------------------------------------------------// + +KSCmdCObjectGroup::KSCmdCObjectGroup( QSCObjectCollection *objects, QSCObjectCollection *selection ) +: KSCommand( QObject::tr("Group objects") ) + { + m_group = NULL; + m_parent = NULL; + m_selection = selection; + if ( objects->count() ) m_parent = objects->object(0)->collection(); + m_objects.setAutoDelete( false ); + for( int i=0; i<objects->count(); i++ ) { + m_objects.append(objects->object(i)); + m_positions.insert( ( m_parent ? m_parent->find(objects->object(i)) : 0 ), objects->object(i) ); + } + } + +//---------------------------------------------------------------------------------------------// + +KSCmdCObjectGroup::~KSCmdCObjectGroup() + { + } + +//---------------------------------------------------------------------------------------------// + +bool KSCmdCObjectGroup::execute() + { + if ( !m_parent ) { + setError( QObject::tr("No page selected") ); + return false; + } + if ( m_objects.count() < 2 ) { + setError( QObject::tr("No object to group") ); + return false; + } + + m_parent->setAutoUpdates( false ); + if ( m_selection ) m_selection->setAutoUpdates( false ); + + m_group = new QSCGroup(); + for( unsigned int i=0; i<m_objects.count(); i++ ) { + m_parent->remove( m_parent->find(m_objects.at(i)) ); + m_group->objects()->add( m_objects.at(i) ); + } + m_parent->add( m_group ); + + if ( m_selection ) { + m_selection->clear(); + m_selection->add( m_group ); + } + + m_parent->setAutoUpdates( true ); + if ( m_selection ) m_selection->setAutoUpdates( true ); + + return true; + } + +//---------------------------------------------------------------------------------------------// + +void KSCmdCObjectGroup::unexecute() + { + m_parent->setAutoUpdates( false ); + if ( m_selection ) m_selection->setAutoUpdates( false ); + + m_parent->remove( m_parent->find(m_group) ); + if ( m_selection ) m_selection->clear(); + QMap<int,QSCObject*>::Iterator it; + // map is sorted by position - insert all objects at previous positions + for( it = m_positions.begin(); it != m_positions.end(); ++it ) { + m_group->objects()->remove( m_group->objects()->find(it.data()) ); + m_parent->insert( it.key(), it.data() ); + if ( m_selection ) m_selection->add( it.data() ); + } + delete m_group; m_group = NULL; + + m_parent->setAutoUpdates( true ); + if ( m_selection ) m_selection->setAutoUpdates( true ); + } + + +//---------------------------------------------------------------------------------------------// +//---------------------------------------------------------------------------------------------// +//---------------------------------------------------------------------------------------------// +//---------------------------------------------------------------------------------------------// + +KSCmdCObjectUngroup::KSCmdCObjectUngroup( QSCGroup *group, QSCObjectCollection *selection ) +: KSCommand( QObject::tr("Ungroup objects") ) + { + m_group = group; + m_parent = NULL; + m_selection = selection; + m_objects.setAutoDelete( false ); + if ( m_group ) { + m_parent = m_group->collection(); + for( int i=0; i<group->objects()->count(); i++ ) m_objects.append( m_group->objects()->object(i) ); + } + } + +//---------------------------------------------------------------------------------------------// + +KSCmdCObjectUngroup::~KSCmdCObjectUngroup() + { + } + +//---------------------------------------------------------------------------------------------// + +bool KSCmdCObjectUngroup::execute() + { + if ( !m_group ) { + setError( QObject::tr("No group selected") ); + return false; + } + m_parent->setAutoUpdates( false ); + if ( m_selection ) m_selection->setAutoUpdates( false ); + + if ( m_selection ) m_selection->clear(); + m_parent->remove( m_parent->find(m_group) ); + // map is sorted by position - insert all objects at previous positions + for( unsigned int i=0; i<m_objects.count(); i++ ) { + m_group->objects()->remove( m_group->objects()->find(m_objects.at(i)) ); + m_parent->add( m_objects.at(i) ); + if ( m_selection ) m_selection->add(m_objects.at(i)); + } + delete m_group; m_group = NULL; + + m_parent->setAutoUpdates( true ); + if ( m_selection ) m_selection->setAutoUpdates( true ); + + return true; + } + +//---------------------------------------------------------------------------------------------// + +void KSCmdCObjectUngroup::unexecute() + { + m_parent->setAutoUpdates( false ); + if ( m_selection ) m_selection->setAutoUpdates( false ); + + m_group = new QSCGroup(); + for( unsigned int i=0; i<m_objects.count(); i++ ) { + m_parent->remove(m_parent->find(m_objects.at(i))); + m_group->objects()->add(m_objects.at(i)); + } + m_parent->add( m_group ); + if ( m_selection ) { + m_selection->clear(); + m_selection->add( m_group ); + } + + m_parent->setAutoUpdates( true ); + if ( m_selection ) m_selection->setAutoUpdates( true ); + + } + +//---------------------------------------------------------------------------------------------// +//---------------------------------------------------------------------------------------------// +//---------------------------------------------------------------------------------------------// +//---------------------------------------------------------------------------------------------// + + + +KSCmdAddDataset::KSCmdAddDataset( QSPlot *plot ) +: KSCommand(QObject::tr("Add dataset")) + { + m_plot = plot; + m_axes = plot->parentAxes(); + m_delete_plot = true; + } + +//---------------------------------------------------------------------------------------------// + +KSCmdAddDataset::~KSCmdAddDataset() + { + if ( m_delete_plot ) delete m_plot; + } + +//---------------------------------------------------------------------------------------------// + +bool KSCmdAddDataset::execute() + { + m_axes->plotAdd( m_plot ); + m_delete_plot = false; + return true; + } + +//---------------------------------------------------------------------------------------------// + +void KSCmdAddDataset::unexecute() + { + m_axes->plotRemove( m_plot ); + m_delete_plot = true; + } + +//---------------------------------------------------------------------------------------------// +//---------------------------------------------------------------------------------------------// +//---------------------------------------------------------------------------------------------// +//---------------------------------------------------------------------------------------------// + +KSCmdAddDatasetGroup::KSCmdAddDatasetGroup() +: KSCommand(QObject::tr("Add datasets")) + { + m_plots.setAutoDelete( TRUE ); + } + +//---------------------------------------------------------------------------------------------// + +KSCmdAddDatasetGroup::~KSCmdAddDatasetGroup() + { + } + +//---------------------------------------------------------------------------------------------// + +void KSCmdAddDatasetGroup::addDataset( QSPlot *plot ) + { + if ( plot ) { + m_plots.append( plot ); + m_axes = plot->parentAxes(); + } + } + +//---------------------------------------------------------------------------------------------// + +bool KSCmdAddDatasetGroup::execute() + { + QSPlot *plot; + for ( plot=m_plots.first(); plot!=0; plot=m_plots.next() ) m_axes->plotAdd( plot ); + m_plots.setAutoDelete( FALSE ); + return true; + } + +//---------------------------------------------------------------------------------------------// + +void KSCmdAddDatasetGroup::unexecute() + { + QSPlot *plot; + for ( plot=m_plots.first(); plot!=0; plot=m_plots.next() ) m_axes->plotRemove( plot ); + m_plots.setAutoDelete( TRUE ); + } + +//---------------------------------------------------------------------------------------------// +//---------------------------------------------------------------------------------------------// +//---------------------------------------------------------------------------------------------// +//---------------------------------------------------------------------------------------------// + +KSCmdRemoveDataset::KSCmdRemoveDataset( QSPlot *plot ) +: KSCommand(QObject::tr("Remove dataset")) + { + m_plot = plot; + m_axes = plot ? plot->parentAxes() : NULL; + m_delete_plot = false; + } + +//---------------------------------------------------------------------------------------------// + +KSCmdRemoveDataset::~KSCmdRemoveDataset() + { + if ( m_delete_plot ) delete m_plot; + } + +//---------------------------------------------------------------------------------------------// + +bool KSCmdRemoveDataset::execute() + { + if ( !m_plot ) { + setError(QObject::tr("No dataset selected")); + return false; + } + m_pos = m_axes->plotIndex(m_plot); + m_axes->plotRemove(m_plot); + m_delete_plot = true; + return true; + } + +//---------------------------------------------------------------------------------------------// + +void KSCmdRemoveDataset::unexecute() + { + m_axes->plotInsert(m_pos,m_plot); + m_delete_plot = false; + } + +//---------------------------------------------------------------------------------------------// +//---------------------------------------------------------------------------------------------// +//---------------------------------------------------------------------------------------------// +//---------------------------------------------------------------------------------------------// + +KSCmdDatasetOrder::KSCmdDatasetOrder( CommandType t, QSPlot *plot ) +:KSCommand( QObject::tr("Order datasets") ) + { + m_type = t; + m_plot = plot; + m_axes = plot ? plot->parentAxes() : NULL; + } + +//---------------------------------------------------------------------------------------------// + +KSCmdDatasetOrder::~KSCmdDatasetOrder() + { + } + +//---------------------------------------------------------------------------------------------// + +bool KSCmdDatasetOrder::execute() + { + if ( !m_plot ) { + setError(QObject::tr("No dataset selected")); + return false; + } + m_pos = m_axes->plotIndex(m_plot); + switch( m_type ) { + case ToFront: m_axes->plotToFront(m_plot); break; + case ToBack: m_axes->plotToBack(m_plot); break; + case Raise: m_axes->plotRaise(m_plot); break; + case Lower: m_axes->plotLower(m_plot); break; + } + return true; + } + +//---------------------------------------------------------------------------------------------// + +void KSCmdDatasetOrder::unexecute() + { + switch( m_type ) { + case ToFront: m_axes->plotReorder(m_pos,m_plot); break; + case ToBack: m_axes->plotReorder(m_pos,m_plot); break; + case Raise: m_axes->plotLower(m_plot); break; + case Lower: m_axes->plotRaise(m_plot); break; + } + } + +//---------------------------------------------------------------------------------------------// +//---------------------------------------------------------------------------------------------// +//---------------------------------------------------------------------------------------------// +//---------------------------------------------------------------------------------------------// +//---------------------------------------------------------------------------------------------// + +KSCmdAddAxis::KSCmdAddAxis( QSAxis *axis ) +:KSCommand(QObject::tr("Add axis") ) + { + m_axis = axis; + m_axes = axis->parentAxes(); + m_delete_axis = true; + } + +//---------------------------------------------------------------------------------------------// + +KSCmdAddAxis::~KSCmdAddAxis() + { + if ( m_delete_axis ) delete m_axis; + } + +//---------------------------------------------------------------------------------------------// + +bool KSCmdAddAxis::execute() + { + m_axes->axisAdd( m_axis ); + m_delete_axis = false; + return true; + } + +//---------------------------------------------------------------------------------------------// + +void KSCmdAddAxis::unexecute() + { + m_axes->axisRemove( m_axis ); + m_delete_axis = true; + } + +//---------------------------------------------------------------------------------------------// +//---------------------------------------------------------------------------------------------// +//---------------------------------------------------------------------------------------------// +//---------------------------------------------------------------------------------------------// +//---------------------------------------------------------------------------------------------// + +KSCmdRemoveAxis::KSCmdRemoveAxis( QSAxis *axis ) +: KSCommand(QObject::tr("Remove axis")) + { + m_axis = axis; + m_axes = axis ? axis->parentAxes() : NULL; + m_delete_axis = false; + } + +//---------------------------------------------------------------------------------------------// + +KSCmdRemoveAxis::~KSCmdRemoveAxis() + { + if ( m_delete_axis ) delete m_axis; + } + +//---------------------------------------------------------------------------------------------// + +bool KSCmdRemoveAxis::execute() + { + if ( !m_axis ) { + setError(QObject::tr("No axis selected")); + return false; + } + m_pos = m_axes->axisIndex(m_axis); + if ( m_axes->axisRemove(m_axis) ) { + m_delete_axis = true; + } else { + setError(QObject::tr("Can't remove the last axis of a given type !")); + return false; + } + return true; + } + +//---------------------------------------------------------------------------------------------// + +void KSCmdRemoveAxis::unexecute() + { + m_axes->axisInsert( m_pos, m_axis ); + m_delete_axis = false; + } + +//---------------------------------------------------------------------------------------------// +//---------------------------------------------------------------------------------------------// +//---------------------------------------------------------------------------------------------// +//---------------------------------------------------------------------------------------------// + +KSCmdAxisOrder::KSCmdAxisOrder( CommandType t, QSAxis *axis ) +:KSCommand( QObject::tr("Order axes") ) + { + m_type = t; + m_axis = axis; + m_axes = axis ? axis->parentAxes() : NULL; + } + +//---------------------------------------------------------------------------------------------// + +KSCmdAxisOrder::~KSCmdAxisOrder() + { + } + +//---------------------------------------------------------------------------------------------// + +bool KSCmdAxisOrder::execute() + { + if ( !m_axis ) { + setError(QObject::tr("No axis selected")); + return false; + } + m_pos = m_axes->axisIndex(m_axis); + switch( m_type ) { + case ToFront: m_axes->axisToFront(m_axis); break; + case ToBack: m_axes->axisToBack(m_axis); break; + case Raise: m_axes->axisRaise(m_axis); break; + case Lower: m_axes->axisLower(m_axis); break; + } + return true; + } + +//---------------------------------------------------------------------------------------------// + +void KSCmdAxisOrder::unexecute() + { + switch( m_type ) { + case ToFront: m_axes->axisReorder(m_pos,m_axis); break; + case ToBack: m_axes->axisReorder(m_pos,m_axis); break; + case Raise: m_axes->axisLower(m_axis); break; + case Lower: m_axes->axisRaise(m_axis); break; + } + } + +//---------------------------------------------------------------------------------------------// +//---------------------------------------------------------------------------------------------// +//---------------------------------------------------------------------------------------------// +//---------------------------------------------------------------------------------------------// + +KSCmdAddPage::KSCmdAddPage( QSPage *page, QSWorkbook *workbook ) +: KSCommand(QObject::tr("Add page")) + { + m_page = page; + m_workbook = workbook; + m_delete_page = true; + } + +//---------------------------------------------------------------------------------------------// + +KSCmdAddPage::~KSCmdAddPage() + { + if ( m_delete_page ) delete m_page; + } + +//---------------------------------------------------------------------------------------------// + +bool KSCmdAddPage::execute() + { + m_workbook->pageAdd( m_page ); + m_delete_page = false; + return true; + } + +//---------------------------------------------------------------------------------------------// + +void KSCmdAddPage::unexecute() + { + m_workbook->pageRemove( m_workbook->pageFind(m_page) ); + m_delete_page = true; + } + +//---------------------------------------------------------------------------------------------// +//---------------------------------------------------------------------------------------------// +//---------------------------------------------------------------------------------------------// +//---------------------------------------------------------------------------------------------// + +KSCmdRemovePage::KSCmdRemovePage( QSPage *page, QSWorkbook *workbook ) +: KSCommand(QObject::tr("Remove page")) + { + m_page = page; + m_workbook = workbook; + m_delete_page = false; + } + +//---------------------------------------------------------------------------------------------// + +KSCmdRemovePage::~KSCmdRemovePage() + { + if ( m_delete_page ) delete m_page; + } + +//---------------------------------------------------------------------------------------------// + +bool KSCmdRemovePage::execute() + { + if (m_workbook->pageFind(m_page)<0 ) { + setError(QObject::tr("No page selected")); + return false; + } + + m_pos = m_workbook->pageFind(m_page); + m_workbook->pageRemove(m_pos); + m_delete_page = true; + return true; + } + +//---------------------------------------------------------------------------------------------// + +void KSCmdRemovePage::unexecute() + { + m_workbook->pageInsert(m_pos,m_page); + m_delete_page = false; + } + +//---------------------------------------------------------------------------------------------// +//---------------------------------------------------------------------------------------------// +//---------------------------------------------------------------------------------------------// +//---------------------------------------------------------------------------------------------// + +KSCmdPageOrder::KSCmdPageOrder( CommandType t, QSPage *page, QSWorkbook *workbook ) +:KSCommand( QObject::tr("Order pages") ) + { + m_type = t; + m_page = page; + m_workbook = workbook; + } + +//---------------------------------------------------------------------------------------------// + +KSCmdPageOrder::~KSCmdPageOrder() + { + } + +//---------------------------------------------------------------------------------------------// + +bool KSCmdPageOrder::execute() + { + if ( !m_page ) { + setError(QObject::tr("No page selected")); + return false; + } + m_pos = m_workbook->pageFind(m_page); + switch( m_type ) { + case ToFront: m_workbook->pageToFront(m_pos); break; + case ToBack: m_workbook->pageToBack(m_pos); break; + case Raise: m_workbook->pageRaise(m_pos); break; + case Lower: m_workbook->pageLower(m_pos); break; + } + return true; + } + +//---------------------------------------------------------------------------------------------// + +void KSCmdPageOrder::unexecute() + { + int page_index = m_workbook->pageFind(m_page); + switch( m_type ) { + case ToFront: m_workbook->pageReorder(m_pos,page_index); break; + case ToBack: m_workbook->pageReorder(m_pos,page_index); break; + case Raise: m_workbook->pageLower(page_index); break; + case Lower: m_workbook->pageRaise(page_index); break; + } + } + + +//---------------------------------------------------------------------------------------------// +//---------------------------------------------------------------------------------------------// +//---------------------------------------------------------------------------------------------// +//---------------------------------------------------------------------------------------------// +//---------------------------------------------------------------------------------------------// + +KSCmdAddSheet::KSCmdAddSheet( KSSheet *sheet, KSSheetList *sheetList ) +: KSCommand(QObject::tr("Add sheet")) + { + m_sheet = sheet; + m_sheet_list = sheetList; + m_delete_sheet = true; + } + +//---------------------------------------------------------------------------------------------// + +KSCmdAddSheet::~KSCmdAddSheet() + { + if ( m_delete_sheet ) delete m_sheet; + } + +//---------------------------------------------------------------------------------------------// + +bool KSCmdAddSheet::execute() + { + m_sheet_list->sheetAdd( m_sheet ); + m_delete_sheet = false; + return true; + } + +//---------------------------------------------------------------------------------------------// + +void KSCmdAddSheet::unexecute() + { + m_sheet_list->sheetRemove( m_sheet_list->sheetFind(m_sheet) ); + m_delete_sheet = true; + } + +//---------------------------------------------------------------------------------------------// +//---------------------------------------------------------------------------------------------// +//---------------------------------------------------------------------------------------------// +//---------------------------------------------------------------------------------------------// +//---------------------------------------------------------------------------------------------// + +KSCmdRemoveSheet::KSCmdRemoveSheet( KSSheet *sheet, KSSheetList *sheetList ) +: KSCommand(QObject::tr("Remove sheet")) + { + m_sheet = sheet; + m_sheet_list = sheetList; + m_delete_sheet = false; + m_cell_range_list.setAutoDelete(FALSE); + } + +//---------------------------------------------------------------------------------------------// + +KSCmdRemoveSheet::~KSCmdRemoveSheet() + { + if ( m_delete_sheet ) delete m_sheet; + } + +//---------------------------------------------------------------------------------------------// + +bool KSCmdRemoveSheet::execute() + { + if ( !m_sheet ) { + setError(QObject::tr("No sheet selected")); + return false; + } + + // nullify all pointers + m_cell_range_list.clear(); + for( int i=0; i<m_sheet->cellRangeCount(); i++ ) { + KSMatrixWorksheetCellRange *curr_matrix = m_sheet->cellRange(i); + curr_matrix->setWorksheet( -1 ); + m_cell_range_list.append( curr_matrix ); + } + + int m_pos = m_sheet_list->sheetFind(m_sheet); + m_sheet_list->sheetRemove( m_pos ); + m_delete_sheet = true; + return true; + } + +//---------------------------------------------------------------------------------------------// + +void KSCmdRemoveSheet::unexecute() + { + m_sheet_list->sheetInsert( m_pos, m_sheet ); + + // restore all pointers + int sheet_index = m_sheet_list->sheetFind(m_sheet); + for( unsigned int i=0; i<m_cell_range_list.count(); i++ ) { + m_cell_range_list.at(i)->setWorksheet(sheet_index); + } + m_cell_range_list.clear(); + + m_delete_sheet = false; + } + + +//---------------------------------------------------------------------------------------------// +//---------------------------------------------------------------------------------------------// +//---------------------------------------------------------------------------------------------// +//---------------------------------------------------------------------------------------------// + +KSCmdSheetOrder::KSCmdSheetOrder( CommandType t, KSSheet *sheet, KSSheetList *sheetList ) +:KSCommand( QObject::tr("Order sheets") ) + { + m_type = t; + m_sheet = sheet; + m_sheet_list = sheetList; + } + +//---------------------------------------------------------------------------------------------// + +KSCmdSheetOrder::~KSCmdSheetOrder() + { + } + +//---------------------------------------------------------------------------------------------// + +bool KSCmdSheetOrder::execute() + { + if ( !m_sheet ) { + setError(QObject::tr("No sheet selected")); + return false; + } + m_pos = m_sheet_list->sheetFind(m_sheet); + switch( m_type ) { + case ToFront: m_sheet_list->sheetToFront(m_pos); break; + case ToBack: m_sheet_list->sheetToBack(m_pos); break; + case Raise: m_sheet_list->sheetRaise(m_pos); break; + case Lower: m_sheet_list->sheetLower(m_pos); break; + } + return true; + } + +//---------------------------------------------------------------------------------------------// + +void KSCmdSheetOrder::unexecute() + { + int sheet_index = m_sheet_list->sheetFind(m_sheet); + switch( m_type ) { + case ToFront: m_sheet_list->sheetReorder(m_pos,sheet_index); break; + case ToBack: m_sheet_list->sheetReorder(m_pos,sheet_index); break; + case Raise: m_sheet_list->sheetLower(sheet_index); break; + case Lower: m_sheet_list->sheetRaise(sheet_index); break; + } + } + +//---------------------------------------------------------------------------------------------// +//---------------------------------------------------------------------------------------------// +//---------------------------------------------------------------------------------------------// +//---------------------------------------------------------------------------------------------// + +KSCmdSetData::KSCmdSetData( QSData *dataObject, int channel, QSMatrix *newMatrix ) +: KSCommand( QObject::tr("Set data" ) ) + { + m_data_object = dataObject; + m_channel = channel; + m_new_matrix = newMatrix; + m_delete_new_matrix = true; + } + +//---------------------------------------------------------------------------------------------// + +KSCmdSetData::~KSCmdSetData() + { + if ( m_delete_new_matrix ) delete m_new_matrix; + else delete m_old_matrix; + } + +//---------------------------------------------------------------------------------------------// + +bool KSCmdSetData::execute() + { + m_old_matrix = m_data_object->takeMatrix( m_channel, m_new_matrix ); + m_delete_new_matrix = false; + return true; + } + +//---------------------------------------------------------------------------------------------// + +void KSCmdSetData::unexecute() + { + m_new_matrix = m_data_object->takeMatrix( m_channel, m_old_matrix ); + m_delete_new_matrix = true; + } + + + +//---------------------------------------------------------------------------------------------// +//---------------------------------------------------------------------------------------------// +//---------------------------------------------------------------------------------------------// +//---------------------------------------------------------------------------------------------// +//---------------------------------------------------------------------------------------------// + +KSCmdMatrixTranspose::KSCmdMatrixTranspose(QSMatrix *matrix) + : KSCommand(QObject::tr("Transpose")) + { + m_matrix = matrix; + } + +//---------------------------------------------------------------------------------------------// + +KSCmdMatrixTranspose::~KSCmdMatrixTranspose() + { + } + +//---------------------------------------------------------------------------------------------// + +bool KSCmdMatrixTranspose::execute() + { + m_matrix->dataChanging(); + bool result = m_matrix->transpose(); + m_matrix->dataChanged(); + if ( !result ) { + setError(QObject::tr("Can't transpose this type of matrix !")); + return false; + } + return true; + } + +//---------------------------------------------------------------------------------------------// + +void KSCmdMatrixTranspose::unexecute() + { + m_matrix->dataChanging(); + m_matrix->transpose(); + m_matrix->dataChanged(); + } + + +//---------------------------------------------------------------------------------------------// +//---------------------------------------------------------------------------------------------// +//---------------------------------------------------------------------------------------------// +//---------------------------------------------------------------------------------------------// + +KSCmdSetProperties::KSCmdSetProperties( QObject *object ) +: KSCommand( "Set properties" ) + { + m_object = object; + } + +//---------------------------------------------------------------------------------------------// + +KSCmdSetProperties::~KSCmdSetProperties() + { + } + +//---------------------------------------------------------------------------------------------// + +void KSCmdSetProperties::setProperty( const char *name, const QVariant& value ) + { + if ( !m_old_properties.contains(name) ) m_old_properties.insert( name, m_object->property(name) ); + m_new_properties.insert( name, value ); + } + +//---------------------------------------------------------------------------------------------// + +bool KSCmdSetProperties::execute() + { + PropertyList::Iterator property; + for( property = m_new_properties.begin(); property != m_new_properties.end(); ++property ) { + m_object->setProperty( property.key(), property.data() ); + } + return true; + } + +//---------------------------------------------------------------------------------------------// + +void KSCmdSetProperties::unexecute() + { + PropertyList::Iterator property; + for( property = m_old_properties.begin(); property != m_old_properties.end(); ++property ) { + m_object->setProperty( property.key(), property.data() ); + } + } + +//---------------------------------------------------------------------------------------------// +//---------------------------------------------------------------------------------------------// +//---------------------------------------------------------------------------------------------// +//---------------------------------------------------------------------------------------------// + +KSCmdSetGraphicalProperties::KSCmdSetGraphicalProperties( QSGraphicalData *object ) +:KSCmdSetProperties( object ) + { + m_object = object; + } + +//---------------------------------------------------------------------------------------------// + +KSCmdSetGraphicalProperties::~KSCmdSetGraphicalProperties() + { + } + +//---------------------------------------------------------------------------------------------// + +void KSCmdSetGraphicalProperties::setFont( int element, const QSGFont& font ) + { + m_old_fonts.insert( element, m_object->font(element) ); + m_new_fonts.insert( element, font ); + } + +//---------------------------------------------------------------------------------------------// + +void KSCmdSetGraphicalProperties::setFill( int element, const QSGFill& fill ) + { + m_old_fills.insert( element, m_object->fill(element) ); + m_new_fills.insert( element, fill ); + } + +//---------------------------------------------------------------------------------------------// + +void KSCmdSetGraphicalProperties::setLine( int element, const QSGLine& line ) + { + m_old_lines.insert( element, m_object->line(element) ); + m_new_lines.insert( element, line ); + } + +//---------------------------------------------------------------------------------------------// + +void KSCmdSetGraphicalProperties::setPoint( int element, const QSGPoint& point ) + { + m_old_points.insert( element, m_object->point(element) ); + m_new_points.insert( element, point ); + } + +//---------------------------------------------------------------------------------------------// + +bool KSCmdSetGraphicalProperties::execute() + { + if ( KSCmdSetProperties::execute() ) { + QMap<int,QSGFont>::Iterator font; + for( font = m_new_fonts.begin(); font != m_new_fonts.end(); ++font ) m_object->setFont( font.key(), font.data() ); + QMap<int,QSGFill>::Iterator fill; + for( fill = m_new_fills.begin(); fill != m_new_fills.end(); ++fill ) m_object->setFill( fill.key(), fill.data() ); + QMap<int,QSGLine>::Iterator line; + for( line = m_new_lines.begin(); line != m_new_lines.end(); ++line ) m_object->setLine( line.key(), line.data() ); + QMap<int,QSGPoint>::Iterator point; + for( point = m_new_points.begin(); point != m_new_points.end(); ++point ) m_object->setPoint( point.key(), point.data() ); + return true; + } + return false; + } + +//---------------------------------------------------------------------------------------------// + +void KSCmdSetGraphicalProperties::unexecute() + { + KSCmdSetProperties::unexecute(); + QMap<int,QSGFont>::Iterator font; + for( font = m_old_fonts.begin(); font != m_old_fonts.end(); ++font ) m_object->setFont( font.key(), font.data() ); + QMap<int,QSGFill>::Iterator fill; + for( fill = m_old_fills.begin(); fill != m_old_fills.end(); ++fill ) m_object->setFill( fill.key(), fill.data() ); + QMap<int,QSGLine>::Iterator line; + for( line = m_old_lines.begin(); line != m_old_lines.end(); ++line ) m_object->setLine( line.key(), line.data() ); + QMap<int,QSGPoint>::Iterator point; + for( point = m_old_points.begin(); point != m_old_points.end(); ++point ) m_object->setPoint( point.key(), point.data() ); + } + +//---------------------------------------------------------------------------------------------// +//---------------------------------------------------------------------------------------------// +//---------------------------------------------------------------------------------------------// + + +//---------------------------------------------------------------------------------------------// +//---------------------------------------------------------------------------------------------// +//---------------------------------------------------------------------------------------------// +//---------------------------------------------------------------------------------------------// + +KSCmdSetRanges::KSCmdSetRanges( QSAxes *axes ) +: KSCommand(QObject::tr("Set axis range")) + { + m_axes = axes; + m_new_ranges.setAutoDelete( TRUE ); + m_old_ranges.setAutoDelete( TRUE ); + save_data( &m_old_ranges ); + } + +//---------------------------------------------------------------------------------------------// + +KSCmdSetRanges::~KSCmdSetRanges() + { + } + +//---------------------------------------------------------------------------------------------// + +void KSCmdSetRanges::commit() + { + save_data( &m_new_ranges ); + } + +//---------------------------------------------------------------------------------------------// + +void KSCmdSetRanges::save_data( viewList *list ) + { + for ( int axis_nr=0; axis_nr<m_axes->axisCount(); axis_nr++ ) { + axis_remembered_view_t *view = new axis_remembered_view_t(); + QSAxis *axis = m_axes->axis(axis_nr); + view->min = axis->min(); + view->max = axis->max(); + view->base = axis->scaleBase(); + view->scale = axis->scaleType(); + view->round = axis->roundRangeToTicStep(); + view->reversed = axis->reversed(); + list->insert(axis,view); + } + } + +//---------------------------------------------------------------------------------------------// + +bool KSCmdSetRanges::execute() + { + set_data( &m_new_ranges ); + return true; + } + + //---------------------------------------------------------------------------------------------// + +void KSCmdSetRanges::unexecute() + { + set_data( &m_old_ranges ); + } + +//---------------------------------------------------------------------------------------------// + +void KSCmdSetRanges::set_data( viewList *list ) + { + for ( int axis_nr=0; axis_nr<m_axes->axisCount(); axis_nr++ ) { + QSAxis *axis = m_axes->axis(axis_nr); + if ( list->find(axis) ) { + axis_remembered_view_t *view = list->find(axis); + axis->setRange( view->min, view->max ); + axis->setScaleType( view->scale ); + axis->setScaleBase( view->base ); + axis->setReversed( view->reversed ); + axis->setRoundRangeToTicStep( view->round ); + } + } + } + +//---------------------------------------------------------------------------------------------// +//---------------------------------------------------------------------------------------------// +//---------------------------------------------------------------------------------------------// +//---------------------------------------------------------------------------------------------// + +// create command ( current data is remembered ) and modify directly data - first execute does nothing, +// because data is already modified +KSCmdChangeData::KSCmdChangeData( QSMatrix *matrix, int rowFrom, int colFrom, int rowTo, int colTo ) +: KSCommand(QObject::tr("Change data")) + { + m_matrix = matrix; + m_row_from = rowFrom; + m_col_from = colFrom; + m_row_to = rowTo; + m_col_to = colTo; + m_old_data = copy_modified_range(); + m_new_data = NULL; + } + +//---------------------------------------------------------------------------------------------// + +KSCmdChangeData::~KSCmdChangeData() + { + delete m_old_data; + delete m_new_data; + } + +//---------------------------------------------------------------------------------------------// + +bool KSCmdChangeData::execute() + { + m_matrix->dataChanging(); + if ( m_new_data ) { + m_old_data = copy_modified_range(); + apply_buffer( m_new_data ); + delete m_new_data; m_new_data = NULL; + } + m_matrix->dataChanged(); + return true; + } + +//---------------------------------------------------------------------------------------------// + +void KSCmdChangeData::unexecute() + { + m_matrix->dataChanging(); + if ( m_old_data ) { + m_new_data = copy_modified_range(); + apply_buffer( m_old_data ); + delete m_old_data; m_old_data = NULL; + } + m_matrix->dataChanged(); + } + +//---------------------------------------------------------------------------------------------// + +QSMatrix *KSCmdChangeData::copy_modified_range() + { + QSMatrix *result = KSObjectFactory::cloneMatrix( m_matrix, false ); + result->resize( m_row_to-m_row_from+1, m_col_to-m_col_from+1 ); + result->copyRange( 0, 0, m_matrix, m_row_from, m_col_from, m_row_to, m_col_to ); + return result; + } + +//---------------------------------------------------------------------------------------------// + +void KSCmdChangeData::apply_buffer( QSMatrix *buffer ) + { + m_matrix->copyRange( m_row_from, m_col_from, buffer, 0, 0, buffer->rows()-1, buffer->cols()-1 ); + } + +//---------------------------------------------------------------------------------------------// +//---------------------------------------------------------------------------------------------// +//---------------------------------------------------------------------------------------------// +//---------------------------------------------------------------------------------------------// +//---------------------------------------------------------------------------------------------// +//---------------------------------------------------------------------------------------------// + +KSCmdChangeValue::KSCmdChangeValue( QSMatrix *matrix, int row, int col, const QString& new_value ) +: KSCommand(QObject::tr("Change value")) + { + m_matrix = matrix; + m_row = row; + m_col = col; + m_new_value = new_value; + m_old_value = m_matrix->string(m_row,m_col); + } + +//---------------------------------------------------------------------------------------------// + +KSCmdChangeValue::~KSCmdChangeValue() + { + } + +//---------------------------------------------------------------------------------------------// + +bool KSCmdChangeValue::execute() + { + m_matrix->dataChanging(); + m_matrix->setString(m_row,m_col,m_new_value); + m_matrix->dataChanged(); + return true; + } + +//---------------------------------------------------------------------------------------------// + +void KSCmdChangeValue::unexecute() + { + m_matrix->dataChanging(); + m_matrix->setString(m_row,m_col,m_old_value); + m_matrix->dataChanged(); + } + + + +//---------------------------------------------------------------------------------------------// +//---------------------------------------------------------------------------------------------// +//---------------------------------------------------------------------------------------------// +//---------------------------------------------------------------------------------------------// +//---------------------------------------------------------------------------------------------// +//---------------------------------------------------------------------------------------------// + +KSCmdRemoveRows::KSCmdRemoveRows( QSMatrix *matrix, int fromRow, int toRow ) +: KSCommand( QObject::tr("Remove rows") ) + { + m_matrix = matrix; + m_from_row = fromRow; + m_to_row = toRow; + m_old_data = NULL; + } + +//---------------------------------------------------------------------------------------------// + +KSCmdRemoveRows::~KSCmdRemoveRows() + { + delete m_old_data; + } + +//---------------------------------------------------------------------------------------------// + +bool KSCmdRemoveRows::execute() + { + m_matrix->dataChanging(); + // rememberd removed data + m_old_data = KSObjectFactory::cloneMatrix( m_matrix ); + m_old_data->resize( m_to_row-m_from_row+1, m_matrix->cols() ); + m_old_data->copyRange( 0, 0, m_matrix, m_from_row, 0, m_to_row, m_matrix->cols()-1 ); + //shift rows up + m_matrix->copyRange( m_from_row, 0, m_matrix, m_to_row+1, 0, m_matrix->rows()-1, m_matrix->cols()-1 ); + // resize matrix + m_matrix->resize( m_matrix->rows()-m_to_row+m_from_row-1, m_matrix->cols() ); + m_matrix->dataChanged(); + return true; + } + +//---------------------------------------------------------------------------------------------// + +void KSCmdRemoveRows::unexecute() + { + m_matrix->dataChanging(); + // resize matrix + m_matrix->resize( m_matrix->rows() +m_to_row-m_from_row+1, m_matrix->cols() ); + // shift rows down + m_matrix->copyRange( m_to_row+1, 0, m_matrix, m_from_row, 0, m_matrix->rows()-1, m_matrix->cols()-1 ); + // restore previous data + m_matrix->copyRange( m_from_row, 0, m_old_data, 0, 0, m_old_data->rows()-1, m_old_data->cols()-1 ); + delete m_old_data; m_old_data = NULL; + m_matrix->dataChanged(); + } + +//---------------------------------------------------------------------------------------------// +//---------------------------------------------------------------------------------------------// +//---------------------------------------------------------------------------------------------// +//---------------------------------------------------------------------------------------------// +//---------------------------------------------------------------------------------------------// +//---------------------------------------------------------------------------------------------// + +KSCmdRemoveCols::KSCmdRemoveCols( QSMatrix *matrix, int fromCol, int toCol ) +: KSCommand( QObject::tr("Remove columns") ) + { + m_matrix = matrix; + m_from_col = fromCol; + m_to_col = toCol; + m_old_data = NULL; + } + +//---------------------------------------------------------------------------------------------// + +KSCmdRemoveCols::~KSCmdRemoveCols() + { + delete m_old_data; + } + +//---------------------------------------------------------------------------------------------// + +bool KSCmdRemoveCols::execute() + { + m_matrix->dataChanging(); + // rememberd removed data + m_old_data = KSObjectFactory::cloneMatrix( m_matrix ); + m_old_data->resize( m_matrix->rows(), m_to_col-m_from_col+1 ); + m_old_data->copyRange( 0, 0, m_matrix, 0, m_from_col, m_matrix->rows()-1, m_to_col ); + //shift cols left + m_matrix->copyRange( 0, m_from_col, m_matrix, 0, m_to_col+1, m_matrix->rows()-1, m_matrix->cols()-1 ); + // resize matrix + m_matrix->resize( m_matrix->rows(), m_matrix->cols()-m_to_col+m_from_col-1 ); + m_matrix->dataChanged(); + return true; + } + +//---------------------------------------------------------------------------------------------// + +void KSCmdRemoveCols::unexecute() + { + m_matrix->dataChanging(); + // resize matrix + m_matrix->resize( m_matrix->rows(), m_matrix->cols() +m_to_col-m_from_col+1 ); + // shift cols right + m_matrix->copyRange( 0, m_to_col+1, m_matrix, 0, m_from_col, m_matrix->rows()-1, m_matrix->cols()-1 ); + // restore previous data + m_matrix->copyRange( 0, m_from_col, m_old_data, 0, 0, m_old_data->rows()-1, m_old_data->cols()-1 ); + delete m_old_data; m_old_data = NULL; + m_matrix->dataChanged(); + } + +//---------------------------------------------------------------------------------------------// +//---------------------------------------------------------------------------------------------// +//---------------------------------------------------------------------------------------------// +//---------------------------------------------------------------------------------------------// +//---------------------------------------------------------------------------------------------// + +KSCmdInsertRow::KSCmdInsertRow( QSMatrix *matrix, int atPos ) +: KSCommand(QObject::tr("Insert row")) + { + m_matrix = matrix; + m_at_pos = atPos; + m_old_data = NULL; + } + +//---------------------------------------------------------------------------------------------// + +KSCmdInsertRow::~KSCmdInsertRow() + { + delete m_old_data; + } + +//---------------------------------------------------------------------------------------------// + +bool KSCmdInsertRow::execute() + { + m_matrix->dataChanging(); + // rememberd the last row in the case 'resize' method is not implemented + m_old_data = KSObjectFactory::cloneMatrix( m_matrix ); + m_old_data->resize( 1, m_matrix->cols() ); + m_old_data->copyRange( 0, 0, m_matrix, m_matrix->rows()-1, 0, m_matrix->rows()-1, m_matrix->cols() ); + // resize matrix + m_matrix->resize( m_matrix->rows()+1, m_matrix->cols() ); + // shift rows down + m_matrix->copyRange( m_at_pos+1, 0, m_matrix, m_at_pos, 0, m_matrix->rows()-1, m_matrix->cols()-1 ); + m_matrix->dataChanged(); + // clear new row + if ( m_at_pos < m_matrix->rows() ) + for( int i=0; i<m_matrix->cols(); i++ ) m_matrix->setString( m_at_pos, i, QString::null ); + + return true; + } + +//---------------------------------------------------------------------------------------------// + +void KSCmdInsertRow::unexecute() + { + m_matrix->dataChanging(); + // shift rows up + m_matrix->copyRange( m_at_pos, 0, m_matrix, m_at_pos+1, 0, m_matrix->rows()-1, m_matrix->cols()-1 ); + // resize matrix + m_matrix->resize( m_matrix->rows()-1, m_matrix->cols() ); + // restore row in the case 'resize' is not implemented + m_matrix->copyRange( m_matrix->rows()-1, 0, m_old_data, 0, 0, m_old_data->rows()-1, m_old_data->cols()-1 ); + delete m_old_data; m_old_data = NULL; + m_matrix->dataChanged(); + } + +//---------------------------------------------------------------------------------------------// +//---------------------------------------------------------------------------------------------// +//---------------------------------------------------------------------------------------------// +//---------------------------------------------------------------------------------------------// +//---------------------------------------------------------------------------------------------// + + +KSCmdInsertCol::KSCmdInsertCol( QSMatrix *matrix, int atPos ) +: KSCommand(QObject::tr("Insert col")) + { + m_matrix = matrix; + m_at_pos = atPos; + m_old_data = NULL; + } + +//---------------------------------------------------------------------------------------------// + +KSCmdInsertCol::~KSCmdInsertCol() + { + delete m_old_data; + } + +//---------------------------------------------------------------------------------------------// + +bool KSCmdInsertCol::execute() + { + m_matrix->dataChanging(); + // rememberd the last col for the case 'resize' method is not implemented + m_old_data = KSObjectFactory::cloneMatrix( m_matrix ); + m_old_data->resize( m_matrix->rows(), 1 ); + m_old_data->copyRange( 0, 0, m_matrix, 0, m_matrix->cols()-1, m_matrix->rows()-1, m_matrix->cols()-1 ); + // resize matrix + m_matrix->resize( m_matrix->rows(), m_matrix->cols()+1 ); + // shift cols right + m_matrix->copyRange( 0, m_at_pos+1, m_matrix, 0, m_at_pos, m_matrix->rows()-1, m_matrix->cols()-1 ); + m_matrix->dataChanged(); + // clear new col + if ( m_at_pos < m_matrix->cols() ) + for( int i=0; i<m_matrix->rows(); i++ ) m_matrix->setString( i, m_at_pos, QString::null ); + + return true; + } + +//---------------------------------------------------------------------------------------------// + +void KSCmdInsertCol::unexecute() + { + m_matrix->dataChanging(); + // shift cols left + m_matrix->copyRange( 0, m_at_pos, m_matrix, 0, m_at_pos+1, m_matrix->rows()-1, m_matrix->cols()-1 ); + // resize matrix + m_matrix->resize( m_matrix->rows(), m_matrix->cols()-1 ); + // restore row in the case 'resize' is not implemented + m_matrix->copyRange( 0, m_matrix->cols()-1, m_old_data, 0, 0, m_old_data->rows()-1, m_old_data->cols()-1 ); + delete m_old_data; m_old_data = NULL; + m_matrix->dataChanged(); + } + +//--------------------------------------------------------------------// +//--------------------------------------------------------------------// +//--------------------------------------------------------------------// +//--------------------------------------------------------------------// + +struct KSCmdRemoveSheetCols::private_data { + KSSheet::ColumnData *columns; + }; + +KSCmdRemoveSheetCols::KSCmdRemoveSheetCols( KSSheet *sheet, int fromCol, int toCol ) +: KSCmdRemoveCols( sheet->matrix(0), fromCol, toCol ) + { + m_sheet = sheet; + m_data = new private_data(); + m_data->columns = new KSSheet::ColumnData[toCol-fromCol+1]; + } + +//--------------------------------------------------------------------// + +KSCmdRemoveSheetCols::~KSCmdRemoveSheetCols() + { + delete[] m_data->columns; + delete m_data; + } + +//--------------------------------------------------------------------// + +bool KSCmdRemoveSheetCols::execute() + { + for( int i=m_from_col; i<=m_to_col; i++ ) m_data->columns[i-m_from_col] = m_sheet->columnData(i); + + int removed_cols = m_to_col-m_from_col+1; + + // shift column headers to the left + for( int col=m_from_col; col<m_matrix->cols()-removed_cols; col++ ) { + KSSheet::ColumnData cdata = m_sheet->columnData(col+removed_cols); + cdata.column = col; + m_sheet->setColumnData( cdata ); + } + + /* + -- not finished + // shift to left all column pointers + for( int i=0; i<m_sheet->cellRangeCount(); i++ ) { + KSWorksheetCellRange *m = m_sheet->cellRange(i); + if ( m->colFrom() == m->colTo() && m->colFrom() > m_at_pos ) { + m->setColFrom( m->colFrom()-1 ); + m->setColTo( m->colTo()-1 ); + } + } + */ + return KSCmdRemoveCols::execute(); + } + +//--------------------------------------------------------------------// + +void KSCmdRemoveSheetCols::unexecute() + { + KSCmdRemoveCols::unexecute(); + m_matrix->dataChanging(); + int removed_cols = m_to_col-m_from_col+1; + // shift columns to the right + for( int col=m_matrix->cols()-1; col>=m_to_col; col-- ) { + KSSheet::ColumnData cdata = m_sheet->columnData(col-removed_cols); + cdata.column = col; + m_sheet->setColumnData( cdata ); + } + + for( int i=m_from_col; i<=m_to_col; i++ ) m_sheet->setColumnData(m_data->columns[i-m_from_col]); + m_matrix->dataChanged(); + } + +//--------------------------------------------------------------------// +//--------------------------------------------------------------------// +//--------------------------------------------------------------------// +//--------------------------------------------------------------------// +//--------------------------------------------------------------------// + +struct KSCmdInsertSheetCol::private_data { + KSSheet::ColumnData column; + }; + +KSCmdInsertSheetCol::KSCmdInsertSheetCol( KSSheet *sheet, int atPos ) +: KSCmdInsertCol( sheet->matrix(0), atPos ) + { + m_sheet = sheet; + m_data = new private_data(); + } + +//--------------------------------------------------------------------// + +KSCmdInsertSheetCol::~KSCmdInsertSheetCol() + { + delete m_data; + } + +//--------------------------------------------------------------------// + +bool KSCmdInsertSheetCol::execute() + { + m_data->column = m_sheet->columnData(m_matrix->cols()-1); + + // shift all comlumn headers to the right + for( int col=m_matrix->cols()-1; col>=m_at_pos+1; col-- ) { + KSSheet::ColumnData cdata = m_sheet->columnData(col-1); + cdata.column = col; + m_sheet->setColumnData( cdata ); + } + m_sheet->removeColumnData( m_at_pos ); + /* + // shift to right all column pointers + for( int i=0; i<m_sheet->cellRangeCount(); i++ ) { + KSWorksheetCellRange *m = m_sheet->cellRange(i); + if ( m->colFrom() == m->colTo() && m->colFrom() >= m_at_pos ) { + m->setColFrom( m->colFrom()+1 ); + m->setColTo( m->colTo()+1 ); + } + } + */ + return KSCmdInsertCol::execute(); + } + +//--------------------------------------------------------------------// + +void KSCmdInsertSheetCol::unexecute() + { + KSCmdInsertCol::unexecute(); + m_matrix->dataChanging(); + // shift all column headers to the left + for( int col=m_at_pos; col<m_matrix->cols()-1; col++ ) { + KSSheet::ColumnData cdata = m_sheet->columnData(col+1); + cdata.column = col; + m_sheet->setColumnData( cdata ); + } + /* + // shift to left all column pointers + for( int i=0; i<m_sheet->cellRangeCount(); i++ ) { + KSWorksheetCellRange *m = m_sheet->cellRange(i); + if ( m->colFrom() == m->colTo() && m->colFrom() > m_at_pos ) { + m->setColFrom( m->colFrom()-1 ); + m->setColTo( m->colTo()-1 ); + } + } + */ + m_sheet->setColumnData( m_data->column ); + m_matrix->dataChanged(); + } + +//--------------------------------------------------------------------// diff --git a/kmatplot/kscommands.h b/kmatplot/kscommands.h new file mode 100644 index 0000000..a4143fe --- /dev/null +++ b/kmatplot/kscommands.h @@ -0,0 +1,628 @@ +/*************************************************************************** + kscommands.h + ------------------- + begin : + copyright : (C) 2001 by Kamil Dobkowski + email : kamildobk@poczta.onet.pl + ***************************************************************************/ + +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + + +#ifndef KSCOMMANDS_H +#define KSCOMMANDS_H + +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + +#include"ksworkbook.h" +#include<qmap.h> +#include<qptrlist.h> +#include<qptrdict.h> +#include<qvaluelist.h> + +//---------------------------------------------------------------------------------------------// + +class QSCObject; +class QSCObjectCollection; +class KSCmdAddCObject : public KSCommand + { + public: + KSCmdAddCObject( QSCObject *object, QSCObjectCollection *parent ); + KSCmdAddCObject( QSCObjectCollection *objects, QSCObjectCollection *parent ); + virtual ~KSCmdAddCObject(); + virtual bool execute(); + virtual void unexecute(); + + protected: + QPtrList<QSCObject> m_objects; + QSCObjectCollection *m_parent; + }; + +//---------------------------------------------------------------------------------------------// + +class KSCmdRemoveCObject : public KSCommand + { + public: + KSCmdRemoveCObject( QSCObject *object ); + KSCmdRemoveCObject( QSCObjectCollection *objects ); + ~KSCmdRemoveCObject(); + virtual bool execute(); + virtual void unexecute(); + protected: + QPtrList<QSCObject> m_objects; + QMap<int,QSCObject*> m_positions; + QSCObjectCollection *m_parent; + }; + +//---------------------------------------------------------------------------------------------// + +class KSCmdObjectOrder : public KSCommand + { + public: + enum CommandType { ToFront, ToBack, Raise, Lower }; + KSCmdObjectOrder( CommandType t, QSCObjectCollection *objectCollection, QSWorkbook *workbook ); + virtual ~KSCmdObjectOrder(); + virtual bool execute(); + virtual void unexecute(); + protected: + CommandType m_type; + QSCObjectCollection *m_collection; + QMap<int,QSCObject*> m_objects; + }; + +//---------------------------------------------------------------------------------------------// + +class QSDrv; +class KSCmdTransformCObjects : public KSCommand + { + public: + KSCmdTransformCObjects( QSDrv *drv ); + virtual ~KSCmdTransformCObjects(); + void addObject( QSCObject *object ); + QSRectf objectRect( QSCObject *object ); + int objectAngle( QSCObject *object ); + void commit(); + virtual bool execute(); + virtual void unexecute(); + + private: + class TransformData { + public: + QSRectf m_rect; + int m_angle; + TransformData() { + } + TransformData( const QSRectf rect, int angle ) { + m_rect = rect; + m_angle = angle; + } + ~TransformData() { + } + }; + + typedef QMap<QSCObject*,TransformData> TransformDataList; + TransformDataList m_old_data; + TransformDataList m_new_data; + QSDrv *m_drv; + }; + +//---------------------------------------------------------------------------------------------// + +class QSCGroup; +class KSCmdCObjectGroup : public KSCommand + { + public: + KSCmdCObjectGroup( QSCObjectCollection *objects, QSCObjectCollection *selection=NULL ); + ~KSCmdCObjectGroup(); + virtual bool execute(); + virtual void unexecute(); + private: + QSCGroup *m_group; + QPtrList<QSCObject> m_objects; + QMap<int,QSCObject*> m_positions; + QSCObjectCollection *m_parent; + QSCObjectCollection *m_selection; + }; + +//---------------------------------------------------------------------------------------------// + +class KSCmdCObjectUngroup : public KSCommand + { + public: + KSCmdCObjectUngroup( QSCGroup *group, QSCObjectCollection *selection=NULL ); + ~KSCmdCObjectUngroup(); + virtual bool execute(); + virtual void unexecute(); + private: + QSCGroup *m_group; + QPtrList<QSCObject> m_objects; + QMap<int,QSCObject*> m_positions; + QSCObjectCollection *m_parent; + QSCObjectCollection *m_selection; + }; +//---------------------------------------------------------------------------------------------// +//---------------------------------------------------------------------------------------------// +//---------------------------------------------------------------------------------------------// +//---------------------------------------------------------------------------------------------// + +class QSPlot; +class KSCmdAddDataset : public KSCommand + { + public: + KSCmdAddDataset( QSPlot *plot ); + virtual ~KSCmdAddDataset(); + virtual bool execute(); + virtual void unexecute(); + protected: + QSAxes *m_axes; + QSPlot *m_plot; + bool m_delete_plot; + }; + +//---------------------------------------------------------------------------------------------// + +class KSCmdAddDatasetGroup : public KSCommand + { + public: + KSCmdAddDatasetGroup(); + virtual ~KSCmdAddDatasetGroup(); + void addDataset( QSPlot *plot ); + virtual bool execute(); + virtual void unexecute(); + protected: + QSAxes *m_axes; + QPtrList<QSPlot> m_plots; + bool m_delete_plots; + }; + +//---------------------------------------------------------------------------------------------// + +class KSCmdRemoveDataset : public KSCommand + { + public: + KSCmdRemoveDataset( QSPlot *plot ); + virtual ~KSCmdRemoveDataset(); + virtual bool execute(); + virtual void unexecute(); + protected: + int m_pos; + QSAxes *m_axes; + QSPlot *m_plot; + bool m_delete_plot; + }; + +//---------------------------------------------------------------------------------------------// + +class KSCmdDatasetOrder : public KSCommand + { + public: + enum CommandType { ToFront, ToBack, Raise, Lower }; + KSCmdDatasetOrder( CommandType t, QSPlot *plot ); + virtual ~KSCmdDatasetOrder(); + virtual bool execute(); + virtual void unexecute(); + protected: + CommandType m_type; + int m_pos; + QSAxes *m_axes; + QSPlot *m_plot; + }; + +//---------------------------------------------------------------------------------------------// +//---------------------------------------------------------------------------------------------// +//---------------------------------------------------------------------------------------------// +//---------------------------------------------------------------------------------------------// + +class QSAxis; +class KSCmdAddAxis : public KSCommand + { + public: + enum CommandType { ToFront, ToBack, Raise, Lower }; + KSCmdAddAxis( QSAxis *axis ); + virtual ~KSCmdAddAxis(); + virtual bool execute(); + virtual void unexecute(); + protected: + QSAxes *m_axes; + QSAxis *m_axis; + bool m_delete_axis; + }; + +//---------------------------------------------------------------------------------------------// + +class KSCmdRemoveAxis : public KSCommand + { + public: + KSCmdRemoveAxis( QSAxis *axis ); + virtual ~KSCmdRemoveAxis(); + virtual bool execute(); + virtual void unexecute(); + protected: + int m_pos; + QSAxes *m_axes; + QSAxis *m_axis; + bool m_delete_axis; + }; + +//---------------------------------------------------------------------------------------------// + +class KSCmdAxisOrder : public KSCommand + { + public: + enum CommandType { ToFront, ToBack, Raise, Lower }; + KSCmdAxisOrder( CommandType t, QSAxis *axis ); + virtual ~KSCmdAxisOrder(); + virtual bool execute(); + virtual void unexecute(); + protected: + CommandType m_type; + int m_pos; + QSAxes *m_axes; + QSAxis *m_axis; + }; + +//---------------------------------------------------------------------------------------------// +//---------------------------------------------------------------------------------------------// +//---------------------------------------------------------------------------------------------// +//---------------------------------------------------------------------------------------------// + +class QSPage; +class KSCmdAddPage : public KSCommand + { + public: + enum CommandType { ToFront, ToBack, Raise, Lower }; + KSCmdAddPage( QSPage *page, QSWorkbook *workbook ); + virtual ~KSCmdAddPage(); + virtual bool execute(); + virtual void unexecute(); + protected: + QSWorkbook *m_workbook; + QSPage *m_page; + bool m_delete_page; + }; + +//---------------------------------------------------------------------------------------------// + +class KSCmdRemovePage : public KSCommand + { + public: + KSCmdRemovePage( QSPage *page, QSWorkbook *workbook ); + virtual ~KSCmdRemovePage(); + virtual bool execute(); + virtual void unexecute(); + protected: + QSWorkbook *m_workbook; + int m_pos; + QSPage *m_page; + bool m_delete_page; + }; + +//---------------------------------------------------------------------------------------------// + +class KSCmdPageOrder : public KSCommand + { + public: + enum CommandType { ToFront, ToBack, Raise, Lower }; + KSCmdPageOrder( CommandType t, QSPage *page, QSWorkbook *workbook ); + virtual ~KSCmdPageOrder(); + virtual bool execute(); + virtual void unexecute(); + protected: + CommandType m_type; + int m_pos; + QSWorkbook *m_workbook; + QSPage *m_page; + }; + +//---------------------------------------------------------------------------------------------// +//---------------------------------------------------------------------------------------------// +//---------------------------------------------------------------------------------------------// +//---------------------------------------------------------------------------------------------// + +class KSSheet; +class KSSheetList; +class KSCmdAddSheet : public KSCommand + { + public: + KSCmdAddSheet( KSSheet *sheet, KSSheetList *sheetList ); + virtual ~KSCmdAddSheet(); + virtual bool execute(); + virtual void unexecute(); + protected: + KSSheetList *m_sheet_list; + KSSheet *m_sheet; + bool m_delete_sheet; + }; + +//---------------------------------------------------------------------------------------------// + +class KSMatrixWorksheetCellRange; +class KSCmdRemoveSheet : public KSCommand + { + public: + KSCmdRemoveSheet( KSSheet *sheet, KSSheetList *sheetList ); + virtual ~KSCmdRemoveSheet(); + virtual bool execute(); + virtual void unexecute(); + protected: + KSSheetList *m_sheet_list; + int m_pos; + KSSheet *m_sheet; + bool m_delete_sheet; + QPtrList<KSMatrixWorksheetCellRange> m_cell_range_list; + }; + +//---------------------------------------------------------------------------------------------// + +class KSCmdSheetOrder : public KSCommand + { + public: + enum CommandType { ToFront, ToBack, Raise, Lower }; + KSCmdSheetOrder( CommandType t, KSSheet *sheet, KSSheetList *sheetList ); + virtual ~KSCmdSheetOrder(); + virtual bool execute(); + virtual void unexecute(); + protected: + CommandType m_type; + int m_pos; + KSSheetList *m_sheet_list; + KSSheet *m_sheet; + }; + +//---------------------------------------------------------------------------------------------// +//---------------------------------------------------------------------------------------------// +//---------------------------------------------------------------------------------------------// +//---------------------------------------------------------------------------------------------// + +class QSData; +class QSMatrix; + +class KSCmdSetData : public KSCommand + { + public: + KSCmdSetData( QSData *dataObject, int channel, QSMatrix *newMatrix ); + virtual ~KSCmdSetData(); + virtual bool execute(); + virtual void unexecute(); + protected: + QSData *m_data_object; + int m_channel; + QSMatrix *m_new_matrix; + QSMatrix *m_old_matrix; + bool m_delete_new_matrix; + }; + +//---------------------------------------------------------------------------------------------// + +class KSCmdChangeData : public KSCommand + { + public: + KSCmdChangeData( QSMatrix *matrix, int rowFrom, int colFrom, int rowTo, int colTo ); + virtual ~KSCmdChangeData(); + virtual bool execute(); + virtual void unexecute(); + protected: + QSMatrix *copy_modified_range(); + void apply_buffer( QSMatrix *buffer ); + int m_row_from; + int m_col_from; + int m_row_to; + int m_col_to; + QSMatrix *m_matrix; + QSMatrix *m_old_data; + QSMatrix *m_new_data; + }; + +//---------------------------------------------------------------------------------------------// + +class KSCmdChangeValue : public KSCommand + { + public: + KSCmdChangeValue( QSMatrix *matrix, int row, int col, const QString& new_value ); + virtual ~KSCmdChangeValue(); + virtual bool execute(); + virtual void unexecute(); + protected: + QSMatrix *m_matrix; + int m_row; + int m_col; + QString m_old_value; + QString m_new_value; + }; + +//---------------------------------------------------------------------------------------------// + +class KSCmdRemoveRows : public KSCommand + { + public: + KSCmdRemoveRows( QSMatrix *matrix, int fromRow, int toRow ); + virtual ~KSCmdRemoveRows(); + bool execute(); + void unexecute(); + protected: + int m_from_row; + int m_to_row; + QSMatrix *m_old_data; + QSMatrix *m_matrix; + }; + +//---------------------------------------------------------------------------------------------// + +class KSCmdRemoveCols : public KSCommand + { + public: + KSCmdRemoveCols( QSMatrix *matrix, int fromCol, int toCol ); + virtual ~KSCmdRemoveCols(); + bool execute(); + void unexecute(); + protected: + int m_from_col; + int m_to_col; + QSMatrix *m_old_data; + QSMatrix *m_matrix; + }; + +//---------------------------------------------------------------------------------------------// + +class KSCmdRemoveSheetCols : public KSCmdRemoveCols + { + public: + KSCmdRemoveSheetCols( KSSheet *sheet, int fromCol, int toCol ); + virtual ~KSCmdRemoveSheetCols(); + bool execute(); + void unexecute(); + protected: + KSSheet *m_sheet; + struct private_data; + private_data *m_data; + }; + +//---------------------------------------------------------------------------------------------// + +class KSCmdInsertRow : public KSCommand + { + public: + KSCmdInsertRow( QSMatrix *matrix, int atPos ); + virtual ~KSCmdInsertRow(); + bool execute(); + void unexecute(); + protected: + int m_at_pos; + QSMatrix *m_old_data; + QSMatrix *m_matrix; + }; + +//---------------------------------------------------------------------------------------------// + +class KSCmdInsertCol : public KSCommand + { + public: + KSCmdInsertCol( QSMatrix *matrix, int atPos ); + virtual ~KSCmdInsertCol(); + bool execute(); + void unexecute(); + protected: + int m_at_pos; + QSMatrix *m_old_data; + QSMatrix *m_matrix; + }; + +//---------------------------------------------------------------------------------------------// + +class KSCmdInsertSheetCol : public KSCmdInsertCol + { + public: + KSCmdInsertSheetCol( KSSheet *sheet, int atPos ); + virtual ~KSCmdInsertSheetCol(); + bool execute(); + void unexecute(); + protected: + KSSheet *m_sheet; + struct private_data; + private_data *m_data; + }; + +//---------------------------------------------------------------------------------------------// + +class KSCmdMatrixTranspose : public KSCommand + { + public: + KSCmdMatrixTranspose(QSMatrix*matrix); + virtual ~KSCmdMatrixTranspose(); + virtual bool execute(); + virtual void unexecute(); + protected: + QSMatrix *m_matrix; + }; + +//---------------------------------------------------------------------------------------------// +//---------------------------------------------------------------------------------------------// +//---------------------------------------------------------------------------------------------// +//---------------------------------------------------------------------------------------------// + +class KSCmdSetProperties : public KSCommand + { + public: + KSCmdSetProperties( QObject *object ); + virtual ~KSCmdSetProperties(); + void setProperty( const char *name, const QVariant& value ); + virtual bool execute(); + virtual void unexecute(); + protected: + QObject *m_object; + typedef QMap<QCString,QVariant> PropertyList; + PropertyList m_new_properties; + PropertyList m_old_properties; + }; + +//---------------------------------------------------------------------------------------------// + +class QSGraphicalData; +class KSCmdSetGraphicalProperties : public KSCmdSetProperties + { + public: + KSCmdSetGraphicalProperties( QSGraphicalData *object ); + virtual ~KSCmdSetGraphicalProperties(); + virtual bool execute(); + virtual void unexecute(); + void setFont( int element, const QSGFont& font ); + void setFill( int element, const QSGFill& fill ); + void setLine( int element, const QSGLine& line ); + void setPoint( int element, const QSGPoint& point ); + protected: + QMap<int,QSGFont> m_new_fonts; + QMap<int,QSGFont> m_old_fonts; + QMap<int,QSGLine> m_new_lines; + QMap<int,QSGLine> m_old_lines; + QMap<int,QSGFill> m_new_fills; + QMap<int,QSGFill> m_old_fills; + QMap<int,QSGPoint> m_new_points; + QMap<int,QSGPoint> m_old_points; + QSGraphicalData *m_object; + }; + + +//---------------------------------------------------------------------------------------------// +//---------------------------------------------------------------------------------------------// +//---------------------------------------------------------------------------------------------// +//---------------------------------------------------------------------------------------------// +//---------------------------------------------------------------------------------------------// + +class KSCmdSetRanges : public KSCommand + { + public: + KSCmdSetRanges( QSAxes *axes ); + virtual ~KSCmdSetRanges(); + void commit(); + virtual bool execute(); + virtual void unexecute(); + protected: + QSAxes *m_axes; + typedef struct { + double min; + double max; + double base; + int scale; + bool round; + bool reversed; + } axis_remembered_view_t; + typedef QPtrDict<axis_remembered_view_t> viewList; + viewList m_old_ranges; + viewList m_new_ranges; + void save_data( viewList *list ); + void set_data( viewList *list ); + }; + +#endif + + + diff --git a/kmatplot/ksdataobjectfactory.cpp b/kmatplot/ksdataobjectfactory.cpp new file mode 100644 index 0000000..e04c7ad --- /dev/null +++ b/kmatplot/ksdataobjectfactory.cpp @@ -0,0 +1,588 @@ +/*************************************************************************** + ksdataobjectfactory.cpp - description + ------------------- + begin : Thu Dec 6 2001 + copyright : (C) 2001 by kamil + email : kamil@localhost.localdomain + ***************************************************************************/ + +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + +#include "ksdataobjectfactory.h" +#include "widgets/qsdata.h" +#include "widgets/qssurface.h" +#include "widgets/qscontour.h" +#include "widgets/qsimage.h" +#include "ksmatrix.h" +#include "ksworkbook.h" +#include <qwidget.h> + +//-------------------------------------------------------------------------// + +KSDataObjectFactory::KSDataObjectFactory() + { + } + +//-------------------------------------------------------------------------// + +KSDataObjectFactory::~KSDataObjectFactory() + { + } + +//-------------------------------------------------------------------------// + +MPSymbol *KSDataObjectFactory::channelVariable( QSData *object, const char *identifier, MPSymbolList *args, int columnFrom, int columnTo ) + { + // ups, ugly hack ! - do not return x and y as a vector but rather make grid from them + if ( dynamic_cast<QSImage*>(object) ) { + QSImage *plot = dynamic_cast<QSImage*>(object); + int rows = plot->matrix(QSImage::YVector) ? plot->matrix(QSImage::YVector)->rows()-1 : 0; + int cols = plot->matrix(QSImage::XVector) ? plot->matrix(QSImage::XVector)->cols()-1 : 0; + if ( plot->channelVariable( QSImage::XVector ) == identifier && object->matrix(QSImage::XVector) ) + return new MPSymQSMatrix( object->matrix(QSImage::XVector), QRect(0,0,cols,rows), args, columnFrom, columnTo, identifier ); + if ( plot->channelVariable( QSImage::YVector ) == identifier && object->matrix(QSImage::YVector) ) + return new MPSymQSMatrix( object->matrix(QSImage::YVector), QRect(0,0,cols,rows), args, columnFrom, columnTo, identifier ); + } + if ( dynamic_cast<QSGriddedContour*>(object) ) { + QSGriddedContour *plot = dynamic_cast<QSGriddedContour*>(object); + int rows = plot->matrix(QSGriddedContour::YVector) ? plot->matrix(QSGriddedContour::YVector)->rows() : 0; + int cols = plot->matrix(QSGriddedContour::XVector) ? plot->matrix(QSGriddedContour::XVector)->cols() : 0; + if ( plot->channelVariable( QSGriddedContour::XVector ) == identifier && object->matrix(QSGriddedContour::XVector) ) + return new MPSymQSMatrix( object->matrix(QSGriddedContour::XVector), QRect(0,0,cols,rows), args, columnFrom, columnTo, identifier ); + if ( plot->channelVariable( QSGriddedContour::YVector ) == identifier && object->matrix(QSGriddedContour::YVector) ) + return new MPSymQSMatrix( object->matrix(QSGriddedContour::YVector), QRect(0,0,cols,rows), args, columnFrom, columnTo, identifier ); + } + if ( dynamic_cast<QSSurface*>(object) ) { + QSSurface *plot = dynamic_cast<QSSurface*>(object); + int rows = plot->matrix(QSSurface::YVector) ? plot->matrix(QSSurface::YVector)->rows() : 0; + int cols = plot->matrix(QSSurface::XVector) ? plot->matrix(QSSurface::XVector)->cols() : 0; + if ( plot->channelVariable( QSSurface::XVector ) == identifier && object->matrix(QSSurface::XVector) ) + return new MPSymQSMatrix( object->matrix(QSSurface::XVector), QRect(0,0,cols,rows), args, columnFrom, columnTo, identifier ); + if ( plot->channelVariable( QSSurface::YVector ) == identifier && object->matrix(QSSurface::YVector) ) + return new MPSymQSMatrix( object->matrix(QSSurface::YVector), QRect(0,0,cols,rows), args, columnFrom, columnTo, identifier ); + } + for( int i=0; i<object->channelCount(); i++ ) { + if ( object->channelVariable(i) == identifier && + object->matrix(i) && + object->matrix(i)->rows() && + object->matrix(i)->cols() ) { + MPSymbol *sym = new MPSymQSMatrix( object->matrix(i), args, columnFrom, columnTo, identifier ); + return sym; + } + } + + return NULL; + } + + +//-------------------------------------------------------------------------// + +#include"dialogs/kschannellist.h" +#include"dialogs/ksmpanels.h" +#include"widgets/qsaxes2d.h" +#include"widgets/qsaxes3d.h" +#include"widgets/qscurve.h" +#include"widgets/qscontour.h" +#include"widgets/qsimage.h" +#include"widgets/qssurface.h" +#include"widgets/qsfigure.h" +#include"ksmatrix.h" +#include"ksglobalmatrixlist.h" +#include"ksmatrixeditor.h" + +#define LINE_INVISIBLE "0" +#define LINE_SOLID "1" +#define LINE_DASH "2" +#define LINE_DASHDOT "4" +#define LINE_DOT "3" +#define LINE_DASHDOTDOT "5" + + +#define FILL_TRANSPARENT "0" +#define FILL_SOLID "1" +#define FILL_HORIZ "9" +#define FILL_VERT "10" +#define FILL_CROSS "11" +#define FILL_BDIAG "12" +#define FILL_FDIAG "13" +#define FILL_DIAGCROSS "14" +#define FILL_HALF "6" +//-------------------------------------------------------------// +// TODO: i18n + +static const char *caxis[] = { + QT_TR_NOOP( "0. Tic marks" ), + QT_TR_NOOP( "1. Lines" ), + QT_TR_NOOP( "2. Fonts" ), + QT_TR_NOOP( "3. Fills" ), + }; + +static const char *daxis[] = { + QT_TR_NOOP( "<b>Labels - x axis:</b> <i></i><br> Position of user-defined tic marks on the <b>X</b> axis." ), + QT_TR_NOOP( " Line styles column vector ( M-1 rows ) "), + QT_TR_NOOP( " Font styles column vector ( M-1 rows ) "), + QT_TR_NOOP( " Fill styles column vector ( M-1 rows ) ") + }; + +//-------------------------------------------------------------// +// TODO: i18n + +static const char *caxes2d[] = { + QT_TR_NOOP( "0" ) + }; + +static const char *daxes2d[] = { + QT_TR_NOOP( "0" ) + }; + +//-------------------------------------------------------------// + + +static const char *caxes3d[] = { + QT_TR_NOOP( "0" ) + }; + +static const char *daxes3d[] = { + QT_TR_NOOP( "0" ) + }; + +//-------------------------------------------------------------// + + +static const char *ccurve[] = { + QT_TR_NOOP( "0. X" ), + QT_TR_NOOP( "1. Y" ), + QT_TR_NOOP( "2. DX" ), + QT_TR_NOOP( "3. DY" ), + QT_TR_NOOP( "4. Lines" ), + QT_TR_NOOP( "5. Fills" ), + QT_TR_NOOP( "6. Points " ), + QT_TR_NOOP( "7. Arrows" ), + QT_TR_NOOP( "8. ErrLines" ), + QT_TR_NOOP( "9. XLines" ), + QT_TR_NOOP( "10. YLines" ) + }; + +static const char *dcurve[] = { + QT_TR_NOOP( " X column vector ( M rows ) "), + QT_TR_NOOP( " Y column vector ( M rows ) "), + QT_TR_NOOP( " DX column vector ( M rows ) "), + QT_TR_NOOP( " DY column vector ( M rows ) "), + QT_TR_NOOP( " Line styles column vector ( M-1 rows ) "), + QT_TR_NOOP( " Fill styles column vector ( M-1 rows ) "), + QT_TR_NOOP( " Point styles column vector ( M rows ) "), + QT_TR_NOOP( " Arrow styles column vector ( M rows ) "), + QT_TR_NOOP( " Error line styles vector ( M rows ) "), + QT_TR_NOOP( " X line styles vector ( M rows ) "), + QT_TR_NOOP( " Y line styles vector ( M rows ) ") + }; + +//-------------------------------------------------------------// + + + +static const char *ccontour[] = { + QT_TR_NOOP( "0. X" ), + QT_TR_NOOP( "1. Y" ), + QT_TR_NOOP( "2. Z" ) + }; + +static const char *dcontour[] = { + QT_TR_NOOP( "<b>Column index</b> <i>( 1 x N vector )</i><br>" + "Contains <i>x</i> coordinates of surface points. " + "If it is empty, a default <i>(0,1,2...)</i> vector is used. " + "This vector must be monotone. " ), + QT_TR_NOOP( "<b>Row index</b> <i>( M x 1 vector )</i><br>" + "Contains <i>y</i> coordinates of surface points. " + "If it is empty, a default <i>(0,1,2...)</i> vector is used. " + "This vector must be monotone. " ), + QT_TR_NOOP( "<b>Surface values</b> <i>( M x N matrix )</i><br>" + "This matrix contains surface <i>v</i> values." + "<b>Surface value[i,j]</b> is a <i>v</i> value at the point" + "<b>(Column index[i], Row index[j])</b> " ) + }; + +//-------------------------------------------------------------// + + + +static const char *cngcontour[] = { + QT_TR_NOOP( "0. X" ), + QT_TR_NOOP( "1. Y" ), + QT_TR_NOOP( "2. Z" ), + QT_TR_NOOP( "3. TriangIdx" ), + }; + +static const char *dngcontour[] = { + QT_TR_NOOP( "<b>Points - x coords</b> <i>( N x 1 matrix )</i><br> Values at the same position in <b>x,y,z-coords</b> define coordinates of a single point. "), + QT_TR_NOOP( "<b>Points - y coords</b> <i>( N x 1 matrix )</i><br> Values at the same position in <b>x,y,z-coords</b> define coordinates of a single point. "), + QT_TR_NOOP( "<b>Points - z coords</b> <i>( N x 1 matrix )</i><br> Values at the same position in <b>x,y,z-coords</b> define coordinates of a single point. "), + QT_TR_NOOP( "<b>Triangles</b> <i>( N x 3 vector )</i><br> Each value in this matrix is an index to a row in <b>x,y,z-coords</b>. i-th row of <b>Triangles</b> describes the triangle. ") + }; + + +//-------------------------------------------------------------// + + +static const char *cimage[] = { + QT_TR_NOOP( "0. X" ), + QT_TR_NOOP( "1. Y" ), + QT_TR_NOOP( "2. R" ), + QT_TR_NOOP( "3. G" ), + QT_TR_NOOP( "4. B" ), + QT_TR_NOOP( "5. Palette " ) + }; + +static const char *dimage[] = { + QT_TR_NOOP( "<b>Column index</b> <i>( 1 x N+1 vector )</i><br>" + "This vector may be used to form a rectangular grid, where each " + "pixel spreads over a single mesh. All pixels in column <b>C</b> spread " + "from <b>Column index[C]</b> to <b>Column index[C+1]</b> on " + "the X axis. This vector must be monotone. See also <b>Row index</b>." ), + + QT_TR_NOOP( "<b>Row index</b> <i>( M+1 x 1 vector )</i><br>" + "This vector may be used to form a rectangular grid, where each " + "pixel spreads over a single mesh. All pixels in row <b>R</b> spread " + "from <b>Row index[R]</b> to <b>Row index[R+1]</b> on " + "the Y axis. This vector must be monotone. See also <b>Column index</b>." ), + + QT_TR_NOOP( "<b>Red or Index or Gray</b> <i>( M x N matrix )</i><br> " + "Pixel values. If <b>Green</b> and <b>Blue</b> channels " + "contains matrix of the same <i>M x N</i> size, this acts as " + "a red channel of a color value. If a <i>Palette</i> is not " + "empty this acts as an index to the color palette. Otherwise " + "acts a grey value of a pixel. " ), + + QT_TR_NOOP( "<b>Green</b> <i>( M x N matrix )</i><br>" + "If <b>Red</b> and <b>Blue</b> channels " + "contains matrix of the same <i>M x N</i> size, this acts as " + "a green channel of a color value. Otherwise is not used." ), + + QT_TR_NOOP( "<b>Blue</b> <i>( M x N matrix )</i><br>" + "If <b>Red</b> and <b>Green</b> channels " + "contains matrix of the same <i>M x N</i> size, this acts as " + "a green channel of a color value. Otherwise is not used." ), + + QT_TR_NOOP( "<b>Palette</b> <i>( C x 3 matrix )</i><br> " + "Color palette Each row is occupied by one color in format " + "( red, green, blue ). Channel <b>Red-Index-Gray</b> contains " + "indexes to this palette ( row number ) for each pixel." ) + + }; + +//-------------------------------------------------------------// + +static const char *csurface[] = { + QT_TR_NOOP( "0. X" ), + QT_TR_NOOP( "1. Y" ), + QT_TR_NOOP( "2. Z" ), + QT_TR_NOOP( "3. V" ) + }; + +static const char *dsurface[] = { + + QT_TR_NOOP( "<b>Column index</b> <i>( 1 x N vector )</i><br>" + "Contains <i>x</i> coordinates of surface points. " + "If it is empty, a default <i>(0,1,2...)</i> vector is used. " + "This vector must be monotone." ), + + QT_TR_NOOP( "<b>Row index</b> <i>( M x 1 vector )</i><br>" + "Contains <i>y</i> coordinates of surface points. " + "If it is empty, a default <i>(0,1,2...)</i> vector is used. " + "This vector must be monotone." ), + + QT_TR_NOOP( "<b>Surface values</b> <i>( M x N matrix )</i><br>" + "This matrix contains surface <i>z</i> values." + "<b>Surface value[i,j]</b> is a <i>z</i> value at the point" + " <b>(Column index[i], Row index[j])</b>" ), + + QT_TR_NOOP( "<b>V values</b> <i>( M x N matrix )</i><br>" + "This matrix contains surface <i>V</i> values used for " + "plotting 4D data ( x, y, z, v ) " ) + }; + +//-------------------------------------------------------------// + +static const char *cfigure[] = { + QT_TR_NOOP( "0. X" ), + QT_TR_NOOP( "1. Y" ), + QT_TR_NOOP( "2. Z" ), + QT_TR_NOOP( "3. V" ), + QT_TR_NOOP( "4. MeshIdx" ) + }; + +static const char *dfigure[] = { + QT_TR_NOOP( "<b>Facets - x coords</b> <i>( N x M matrix )</i><br>" + "Values at the same position in <b>x,y,z,v-coords</b> define coordinates of a single point. " + "i-th row of <b>x coords</b> contains <i>x</i> coordinates of vertices of " + "the i-th facet. <i>M</i> is a number of vertices of a single " + "facet."), + + QT_TR_NOOP( "<b>Facets - y coords</b> <i>( N x M matrix )</i><br>" + "Values at the same position in <b>x,y,z,v-coords</b> define coordinates of a single point. " + "i-th row of <b>y coords</b> contains <i>y</i> coordinates of vertices of " + "the i-th facet. <i>M</i> is a number of vertices of a single " + "facet."), + + QT_TR_NOOP( "<b>Facets - z coords</b> <i>( N x M matrix )</i><br>" + "Values at the same position in <b>x,y,z,v-coords</b> define coordinates of a single point. " + "i-th row of <b>x coords</b> contains <i>z</i> coordinates of vertices of " + "the i-th facet. <i>M</i> is a number of vertices of a single " + "facet."), + + QT_TR_NOOP( "<b>Facets - v coords</b> <i>( N x M matrix )</i><br>" + "Values at the same position in <b>x,y,z,v-coords</b> define coordinates of a single point. " + "i-th row of <b>v coords</b> contains <i>v</i> coordinates of of vertices of " + "the i-th facet. <i>M</i> is a number of vertices of a single " + "facet. Used when drawing 4D data."), + + QT_TR_NOOP( "<b>Facets - indices</b> <i>( A x B matrix )</i><br>" + " Each value in this matrix is an index to a row in <b>x,y,z,v-coords</b>. " + " Those matrices have only one column in this case. i-th row of <b>indices</b> describes a one facet. ") + }; + +//-------------------------------------------------------------// + +static const char *dsheet = + QT_TR_NOOP( "<b>Sheet</b><br>" + "Choose File/New from the main menu to set a new data. " + "Double click on colun header to change column data type." + "Click a left mouse button to show menu." ); + +//-------------------------------------------------------------// + +QString KSDataObjectFactory::channelNameFactory( QSData *bobject, int num ) + { + if ( dynamic_cast<QSAxis *>(bobject) ) if ( num >= 0 ) return QString( caxis[num] ); else return QObject::tr("Axis"); + else + if ( dynamic_cast<QSAxes2D *>(bobject) ) if ( num >= 0 ) return QString( caxes2d[num] ); else return QObject::tr("Axes2D"); + else + if ( dynamic_cast<QSAxes3D *>(bobject) ) if ( num >= 0 ) return QString( caxes3d[num] ); else return QObject::tr("Axes3D"); + else + if ( dynamic_cast<QSCurve *>(bobject) ) if ( num >= 0 ) return QString( ccurve[num] ); else return QObject::tr("Curve"); + else + if ( dynamic_cast<QSImage *>(bobject) ) if ( num >= 0 ) return QString( cimage[num] ); else return QObject::tr("Image"); + else + if ( dynamic_cast<QSGriddedContour *>(bobject) ) if ( num >= 0 ) return QString( ccontour[num] ); else return QObject::tr("Contour"); + else + if ( dynamic_cast<QSNonGriddedContour *>(bobject) ) if ( num >= 0 ) return QString( cngcontour[num] ); else return QObject::tr("NgContour"); + else + if ( dynamic_cast<QSSurface *>(bobject) ) if ( num >= 0 ) return QString( csurface[num] ); else return QObject::tr("Surface"); + else + if ( dynamic_cast<QSFigure *>(bobject) ) if ( num >= 0 ) return QString( cfigure[num] ); else return QObject::tr("Figure"); + else + if ( dynamic_cast<KSSheetList*>(bobject) ) return QObject::tr("Sheet list"); + else + if ( dynamic_cast<KSSheet*>(bobject) ) return QObject::tr("Sheet"); + + return QString(); + } +//-------------------------------------------------------------// + +QString KSDataObjectFactory::channelNameFactory( DataObject objectType, int num ) + { + switch( objectType ) { + case ObjectAxis: if ( num >= 0 ) return QString( caxis[num] ); else return QObject::tr("Axis"); + case ObjectAxes2D: if ( num >= 0 ) return QString( caxes2d[num] ); else return QObject::tr("Axes2D"); + case ObjectAxes3D: if ( num >= 0 ) return QString( caxes3d[num] ); else return QObject::tr("Axes3D"); + case ObjectCurve: if ( num >= 0 ) return QString( ccurve[num] ); else return QObject::tr("Curve"); + case ObjectGriddedContour: if ( num >= 0 ) return QString( ccontour[num] ); else return QObject::tr("Contour"); + case ObjectNonGriddedContour: if ( num >= 0 ) return QString( cngcontour[num] ); else return QObject::tr("NgContour"); + case ObjectImage: if ( num >= 0 ) return QString( cimage[num] ); else return QObject::tr("Image"); + case ObjectSurface: if ( num >= 0 ) return QString( csurface[num] ); else return QObject::tr("Surface"); + case ObjectFigure: if ( num >= 0 ) return QString( cfigure[num] ); else return QObject::tr("Figure"); + case ObjectSheetList: return QObject::tr("Sheet list"); + case ObjectSheet: return QObject::tr("Sheet"); + } + + return QString(); + } + +//-------------------------------------------------------------// + +QString KSDataObjectFactory::channelDescFactory( QSData *bobject, int num ) + { + if ( num >= 0 ) { + if ( dynamic_cast<QSAxis *>(bobject) ) return QString( daxis[num] ); + else + if ( dynamic_cast<QSAxes2D *>(bobject) ) return QString( daxes2d[num] ); + else + if ( dynamic_cast<QSAxes3D *>(bobject) ) return QString( daxes3d[num] ); + else + if ( dynamic_cast<QSCurve *>(bobject) ) return QString( dcurve[num] ); + else + if ( dynamic_cast<QSGriddedContour *>(bobject) ) return QString( dcontour[num] ); + else + if ( dynamic_cast<QSNonGriddedContour *>(bobject) ) return QString( dngcontour[num] ); + else + if ( dynamic_cast<QSImage *>(bobject) ) return QString( dimage[num] ); + else + if ( dynamic_cast<QSSurface *>(bobject) ) return QString( dsurface[num] ); + else + if ( dynamic_cast<QSFigure *>(bobject) ) return QString( dfigure[num] ); + else + if ( dynamic_cast<KSSheet *>(bobject) ) return QString( dsheet ); + } + return QString(); + } + +//-------------------------------------------------------------// + +int KSDataObjectFactory::channelNumber( DataObject objectType ) + { + switch( objectType ) { + case ObjectAxis: return 4; + case ObjectCurve: return 11; + case ObjectGriddedContour: return 3; + case ObjectNonGriddedContour: return 4; + case ObjectImage: return 6; + case ObjectSurface: return 4; + case ObjectFigure: return 5; + case ObjectSheet: return 1; + } + return 0; + } + +//-------------------------------------------------------------// + +QString KSDataObjectFactory::channelDescFactory( DataObject objectType, int num ) + { + if ( num >= 0 ) + switch( objectType ) { + case ObjectAxis: return QString( daxis[num] ); + case ObjectAxes2D: return QString( daxes2d[num] ); + case ObjectAxes3D: return QString( daxes3d[num] ); + case ObjectCurve: return QString( dcurve[num] ); + case ObjectGriddedContour: return QString( dcontour[num] ); + case ObjectNonGriddedContour: return QString( dngcontour[num] ); + case ObjectImage: return QString( dimage[num] ); + case ObjectSurface: return QString( dsurface[num] ); + case ObjectFigure: return QString( dfigure[num] ); + case ObjectSheet: return QString( dsheet ); + } + + return QString(); + } + +//-------------------------------------------------------------// + +QStringList KSDataObjectFactory::channelColumnTitlesFactory( QSData *object, int channel ) + { + QStringList result; + if ( channel >= 0 ) { + if ( dynamic_cast<QSAxes2D *>(object) || + dynamic_cast<QSAxes3D *>(object) || + dynamic_cast<QSAxis *>(object) && channel == 0 ) { + result += QObject::tr("value"); + result += QObject::tr("format"); + result += QObject::tr("major"); + result += QObject::tr("angle"); + } + else + if ( dynamic_cast<QSCurve*>(object) && channel == 4 || + dynamic_cast<QSCurve*>(object) && channel == 8 || + dynamic_cast<QSAxis*>(object) && channel == 1 ) { + // line + result += QObject::tr("l-style"); + result += QObject::tr("l-width"); + result += QObject::tr("l-red"); + result += QObject::tr("l-green"); + result += QObject::tr("l-blue"); + result += QObject::tr("l-alpha"); + } + else + if ( dynamic_cast<QSCurve*>(object) && channel == 5 || + dynamic_cast<QSAxis*>(object) && channel == 3 ) { + // fill + result += QObject::tr("f-style"); + result += QObject::tr("f-red"); + result += QObject::tr("f-green"); + result += QObject::tr("f-blue"); + result += QObject::tr("f-alpha"); + } + if ( dynamic_cast<QSAxis*>(object) && channel == 2 ) { + // font + result += QObject::tr("f-family"); + result += QObject::tr("f-size"); + result += QObject::tr("f-bold"); + result += QObject::tr("f-italic"); + result += QObject::tr("f-red"); + result += QObject::tr("f-green"); + result += QObject::tr("f-blue"); + result += QObject::tr("f-alpha"); + } + else + if ( dynamic_cast<QSCurve*>(object) && channel == 6 ) { + // point + result += QObject::tr("p-style"); + result += QObject::tr("p-fill"); + result += QObject::tr("p-size"); + result += QObject::tr("p-red"); + result += QObject::tr("p-green"); + result += QObject::tr("p-blue"); + result += QObject::tr("p-alpha"); + } + else + if ( dynamic_cast<QSCurve*>(object) && channel == 7 ) { + // arrow + result += QObject::tr("a1-style"); + result += QObject::tr("a1-size"); + result += QObject::tr("a2-style"); + result += QObject::tr("a2-size"); + } + else + if ( dynamic_cast<QSCurve*>(object) ) { + switch( channel ) { + case 0: result+=QObject::tr("x");break; + case 1: result+=QObject::tr("y");break; + case 2: result+=QObject::tr("dx");break; + case 3: result+=QObject::tr("dy");break; + } + } + } + return result; + } + +//-------------------------------------------------------------// + +KSMatrixEditorInterf *KSDataObjectFactory::createEditor( KSWorkbook *workbook, QSData *dataObject, int channel, QWidget *parent ) + { + if ( dynamic_cast<KSSheet*>(dataObject) && dataObject->matrix(channel) ) { + return new KSMatrixSheetEditor( workbook, dynamic_cast<KSSheet*>(dataObject), parent ); + } + else if ( dataObject->matrix(channel) ) { + return new KSMatrixEditor( workbook, dataObject->matrix(channel), parent ); + } + return NULL; + } + +// if ( dynamic_cast<KSSheet*>(matrix->dataObject()) ) return new KSMatrixSheetEditor( dynamic_cast<KSSheet*>(matrix->dataObject()), parent ); + +//-------------------------------------------------------------// + +KSMPanel *KSDataObjectFactory::createCfgPanel( QSMatrix *matrix, KSWorkbook *workbook, QWidget *parent ) + { + if ( dynamic_cast<KSMatrixString*>(matrix) ) { + return new KSMPanelString(workbook,dynamic_cast<KSMatrixString*>(matrix),parent); + } + else if ( dynamic_cast<KSMatrixWorksheetCellRange*>(matrix) ) { + return new KSMPanelRef(workbook,dynamic_cast<KSMatrixWorksheetCellRange*>(matrix),parent); + } + else if ( dynamic_cast<KSMatrix*>(matrix) ) { + return new KSMPanelMatrix(workbook,dynamic_cast<KSMatrix*>(matrix),parent); + } + else if ( dynamic_cast<KSMatrixFormula*>(matrix) ) { + return new KSMPanelFormula(workbook,dynamic_cast<KSMatrixFormula*>(matrix),parent); + } + return NULL; + } + + + diff --git a/kmatplot/ksdataobjectfactory.h b/kmatplot/ksdataobjectfactory.h new file mode 100644 index 0000000..c9c1970 --- /dev/null +++ b/kmatplot/ksdataobjectfactory.h @@ -0,0 +1,92 @@ +/*************************************************************************** + ksdataobjectfactory.h - description + ------------------- + begin : Thu Dec 6 2001 + copyright : (C) 2001 by kamil + email : kamil@localhost.localdomain + ***************************************************************************/ + +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + +#ifndef KSDATAOBJECTFACTORY_H +#define KSDATAOBJECTFACTORY_H + +#include<qstring.h> +#include<qstringlist.h> + +class QWidget; +class QSMatrix; +class QSData; +class MPSymbol; +class MPSymbolList; +class KSMPanel; +class KSMatrixEditorInterf; +class KSWorkbook; + +/** + * This is the class which provides some metadata information + * about QSData objects. Many of the methods should be really + * virtual functions of the QSData objects. + * @author kamil + */ +class KSDataObjectFactory { +public: + enum DataObject { ObjectAxis, ObjectCurve, ObjectImage, ObjectGriddedContour, ObjectNonGriddedContour, ObjectSurface, ObjectFigure, ObjectAxes2D, ObjectAxes3D, ObjectSheet, ObjectSheetList }; + /** + * Constructor + */ + KSDataObjectFactory(); + /** + * Destructor + */ + virtual ~KSDataObjectFactory(); + /** + * Returns channels as a variable 'x', 'y', 'z', 'v', 'dx', 'dy' ... etc + * For use in formulas. + */ + static MPSymbol *channelVariable( QSData *object, const char *identifier, MPSymbolList *args, int columnFrom, int columnTo ); + /** + * Returns a number of channels + */ + static int channelNumber( DataObject objectType ); + /** + * Returns a description of the given channel or the object itself( when channel is -1 ). + */ + static QString channelNameFactory( QSData *object, int channel = -1 ); + /** + * Returns a description of the given channel or the object itself( when channel is -1 ). + */ + static QString channelNameFactory( DataObject objectType, int channel = -1 ); + /** + * Returns a long description of the given channel. + */ + static QString channelDescFactory( QSData *object, int channel ); + /** + * Returns a long description of the given channel. + */ + static QString channelDescFactory( DataObject objectType, int channel ); + /** + * Returns a long description of the given channel. + */ + static QStringList channelColumnTitlesFactory( QSData *object, int channel ); + /** + * Creates editor for this matrix. + */ + static KSMatrixEditorInterf *createEditor( KSWorkbook *workbook, QSData *dataObject, int channel, QWidget *parent ); + /** + * Create and return a config panel for this matrix. + * It should have a fixed height. + */ + static KSMPanel *createCfgPanel( QSMatrix *matrix, KSWorkbook *workbook, QWidget *parent ); + + +}; + +#endif diff --git a/kmatplot/ksdatasymbolfactory.cpp b/kmatplot/ksdatasymbolfactory.cpp new file mode 100644 index 0000000..2bfd402 --- /dev/null +++ b/kmatplot/ksdatasymbolfactory.cpp @@ -0,0 +1,74 @@ +/*************************************************************************** + ksdatasymbolfactory.cpp - description + ------------------- + begin : Thu Dec 6 2001 + copyright : (C) 2001 by kamil + email : kamil@localhost.localdomain + ***************************************************************************/ + +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + +#include "ksdatasymbolfactory.h" +#include "ksworkbook.h" +#include "ksglobalmatrixlist.h" +#include "ksdataobjectfactory.h" +#include "ksmatrix.h" + +//-------------------------------------------------------------------------// + +KSDataSymbolFactory::KSDataSymbolFactory( KSWorkbook *workbook, QSData *object ) + { + m_workbook = workbook; + m_data_object = object; + m_sel_matrix = NULL; + } + +//-------------------------------------------------------------------------// + +KSDataSymbolFactory::~KSDataSymbolFactory() + { + } + +//-------------------------------------------------------------------------// + +void KSDataSymbolFactory::setSelection( QSMatrix *matrix, const QRect& range ) + { + m_sel_matrix = matrix; + m_sel_range = range; + } + +//-------------------------------------------------------------------------// + +MPSymbol *KSDataSymbolFactory::create( const char *identifier, MPSymbolList *args, int colFrom, int colTo ) + { + if ( m_sel_matrix && qstrcmp(identifier,"selection") == 0 ) { + return new MPSymQSMatrix( m_sel_matrix, m_sel_range, args, colFrom, colTo, "sel" ); + } + if ( m_data_object ) { + MPSymbol *channel = KSDataObjectFactory::channelVariable( m_data_object, identifier, args, colFrom, colTo ); + if ( channel ) return channel; + } + if ( m_workbook ) { + KSSheetList *sheets = m_workbook->sheets(); + for( int i=0; i<sheets->childCount(); i++ ) { + KSSheet *sheet = sheets->child(i); + if ( qstrcmp(sheet->name(),identifier)==0 && + sheet->matrix(0) && + sheet->matrix(0)->rows() && + sheet->matrix(0)->cols() ) + return new MPSymQSMatrix( sheet->matrix(0), args, colFrom, colTo, identifier ); + } + } + return NULL; + } + +//-------------------------------------------------------------------------// + + diff --git a/kmatplot/ksdatasymbolfactory.h b/kmatplot/ksdatasymbolfactory.h new file mode 100644 index 0000000..d97af0e --- /dev/null +++ b/kmatplot/ksdatasymbolfactory.h @@ -0,0 +1,73 @@ +/*************************************************************************** + ksdatasymbolfactory.h - description + ------------------- + begin : Thu Dec 6 2001 + copyright : (C) 2001 by kamil + email : kamil@localhost.localdomain + ***************************************************************************/ + +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + +#ifndef KSDATASYMBOLFACTORY_H +#define KSDATASYMBOLFACTORY_H + +#include "formula/mpsymbol.h" +#include <qrect.h> + +class KSWorkbook; +class QSData; +class QSMatrix; +/** + * Symbol factory for formulas, which proveides a sheets ( symbol names follows sheet titles ) + * and channels ( such as x, y, z, v, dx, dy ) + * @author kamil + */ +class KSDataSymbolFactory : public MPSymbolFactory { +public: + /** + * Constructor + * Set workbook if you want sheet variables to be available in formula. + * Set data object if you want channels variables (x, y, z ) to be available in formuls + */ + KSDataSymbolFactory( KSWorkbook *workbook, QSData *object=NULL ); + /** + * Destructor + */ + virtual ~KSDataSymbolFactory(); + /** + * Set selection if you want 'selection' symbol to be available in formula. + */ + void setSelection( QSMatrix *matrix, const QRect& range ); + /** + * Creates the given symbol. + */ + virtual MPSymbol *create( const char *identifier, MPSymbolList *args, int colFrom, int colTo ); + /** + * No description available. Returns 0. + */ + virtual int symbolCount() const { return 0; } + /** + * Returns NULL. + */ + virtual const char *symbolIdentifier( int ) { return NULL; } + /** + * Returns NULL. + */ + virtual const char *symbolDescription( int ) { return NULL; } + +protected: + KSWorkbook *m_workbook; + QSData *m_data_object; + QSMatrix *m_sel_matrix; + QRect m_sel_range; + +}; + +#endif diff --git a/kmatplot/ksglobalmatrixlist.cpp b/kmatplot/ksglobalmatrixlist.cpp new file mode 100644 index 0000000..d071517 --- /dev/null +++ b/kmatplot/ksglobalmatrixlist.cpp @@ -0,0 +1,345 @@ +/*************************************************************************** + ksglobalmatrixlist.cpp + ------------------- + begin : + + copyright : (C) 2001 by Kamil Dobkowski + email : kamildobk@poczta.onet.pl + ***************************************************************************/ + +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + +#include "ksglobalmatrixlist.h" +#include "widgets/qschildlist.h" + +//-------------------------------------------------------------// + +KSSheet::KSSheet( KSSheetList *parent ) +:QSData( parent, parent ) + { + m_matrix = NULL; + m_parent = parent; + m_insert_pos = -1; + } + +//-------------------------------------------------------------// + +KSSheet::~KSSheet() + { + delete m_matrix; + } + +//-------------------------------------------------------------// + +bool KSSheet::setMatrix( int channel, QSMatrix *m ) + { + if ( channel == 0 ) { + dataChanging(0); + delete m_matrix; + m_matrix = m; + if ( m_matrix ) m_matrix->setDataObject( this, 0 ); + dataChanged(0); + } + return true; + } + +//-------------------------------------------------------------// + +QSMatrix *KSSheet::takeMatrix( int channel, QSMatrix *newMatrix ) + { + if ( channel == 0 ) { + dataChanging(0); + QSMatrix *result = m_matrix; + if ( m_matrix ) m_matrix->setDataObject( NULL, -1 ); + m_matrix = newMatrix; + if ( newMatrix ) newMatrix->setDataObject( this, 0 ); + dataChanged(0); + return result; + } + return NULL; + } + +//-------------------------------------------------------------// + +QSMatrix *KSSheet::matrix( int channel ) const + { + if ( channel == 0 ) return m_matrix; else return NULL; + } + +//-------------------------------------------------------------// + +void KSSheet::deleteMatrix( int channel ) + { + if ( channel == 0 && m_matrix != NULL ) { + dataChanging(0); + delete m_matrix; + m_matrix = NULL; + dataChanged(0); + } + } + +//-------------------------------------------------------------// +/* +QString KSSheet::title() const + { + if ( m_matrix ) return m_matrix->title(); + return QString::null; + } +*/ +//-------------------------------------------------------------// + +void KSSheet::setColumnData( int column, ColumnType type, const QString& title ) + { + ColumnData new_data; + new_data.column = column; + new_data.type = type; + new_data.title = title; + setColumnData( new_data ); + } + +//-------------------------------------------------------------// + +bool KSSheet::isColumnDataPresent( int column ) const + { + return m_column_info.contains( column ); + } + +//-------------------------------------------------------------// + +void KSSheet::setColumnData( ColumnData data ) + { + if ( data.column >= 0 ) { + if ( data.type == ColumnUnknown && data.title.isEmpty() ) m_column_info.remove( data.column ); + else m_column_info.replace( data.column, data ); + } + } + +//-------------------------------------------------------------// + +void KSSheet::removeColumnData( int column ) + { + m_column_info.remove( column ); + } + +//-------------------------------------------------------------// + +KSSheet::ColumnData KSSheet::columnData( int column ) const + { + return m_column_info.contains( column ) ? m_column_info[column] : ColumnData( column ); + } + +//-------------------------------------------------------------// + +void KSSheet::loadStateFromStream( QDataStream& stream, QSObjectFactory *factory ) + { + QSData::loadStateFromStream( stream, factory ); + stream >> m_insert_pos; + int elements; stream >> elements; + for( int i=0; i<elements; i++ ) { + ColumnData element; + stream >> element.column; + int type; stream >> type; element.type = (ColumnType )type; + stream >> element.title; + setColumnData( element ); + } + } + +//-------------------------------------------------------------// + +void KSSheet::saveStateToStream( QDataStream& stream, QSObjectFactory *factory ) + { + QSData::saveStateToStream( stream, factory ); + stream << (int )m_parent->sheetFind(this); // insert pos + stream << (int )m_column_info.count(); + ColumnInfo::Iterator it; + for( it = m_column_info.begin(); it != m_column_info.end(); ++it ) { + stream << it.data().column; + stream << (int )it.data().type; + stream << it.data().title; + } + } + +//-------------------------------------------------------------// + +int KSSheet::cellRangeCount() const + { + return (int )m_cell_range_list.size(); + } + +//-------------------------------------------------------------// + +KSMatrixWorksheetCellRange *KSSheet::cellRange( int index ) + { + return m_cell_range_list[index]; + } + +//-------------------------------------------------------------// + +void KSSheet::cellRangeAdd( KSMatrixWorksheetCellRange *matrix ) + { + if ( matrix ) m_cell_range_list.push_back( matrix ); + } + +//-------------------------------------------------------------// + +void KSSheet::cellRangeRemove( KSMatrixWorksheetCellRange *matrix ) + { + for( int i=0; i<cellRangeCount(); i++ ) + if ( m_cell_range_list[i] == matrix ) { + m_cell_range_list.erase( m_cell_range_list.begin() + i ); + break; + } + } + + + +//-------------------------------------------------------------// +//-------------------------------------------------------------// +//-------------------------------------------------------------// +//-------------------------------------------------------------// +//-------------------------------------------------------------// + + + +KSSheetList::KSSheetList( QObject * parent, const char * name ) +:QSData( parent, NULL, name ) + { + m_sheets = new QSChildList<KSSheet>; + } + +//-------------------------------------------------------------// + +KSSheetList::~KSSheetList() + { + delete m_sheets; + } + +//-------------------------------------------------------------// + +void KSSheetList::clearAll() + { + while( childCount() ) sheetDelete( 0 ); + } + +//-------------------------------------------------------------// + +int KSSheetList::childCount() const + { + return m_sheets->count(); + } + +//-------------------------------------------------------------// + +KSSheet *KSSheetList::child( int index ) const + { + if ( index >=0 && index < childCount() ) return (*m_sheets)[index]; else return NULL; + } + +//-------------------------------------------------------------// + +void KSSheetList::sheetAdd( KSSheet *sheet ) + { + if ( sheet && sheet->insertPos() > -1 ) { + m_sheets->insert( sheet->insertPos(), sheet ); + } else { + m_sheets->add( sheet ); + } + emit sigChildAdded ( sheet ); + emit sigChildListChanged(); + } + +//-------------------------------------------------------------// + +void KSSheetList::sheetInsert( int position, KSSheet *sheet ) + { + m_sheets->insert( position, sheet ); + emit sigChildAdded ( sheet ); + emit sigChildListChanged(); + } + +//-------------------------------------------------------------// + +void KSSheetList::sheetRemove( int index ) + { + KSSheet *sheet = (*m_sheets)[index]; + if ( sheet ) { + m_sheets->remove( index ); + emit sigChildRemoved( sheet ); + emit sigChildListChanged(); + } + } + +//-------------------------------------------------------------// + +void KSSheetList::sheetDelete( int index ) + { + KSSheet *sheet = (*m_sheets)[index]; + if ( sheet ) { + m_sheets->remove( index ); + emit sigChildRemoved( sheet ); + emit sigChildListChanged(); + delete sheet; + } + } + +//-------------------------------------------------------------// + +void KSSheetList::sheetRaise( int index ) + { + m_sheets->raise( index ); + emit sigChildOrder(); + emit sigChildListChanged(); + } + +//-------------------------------------------------------------// + +void KSSheetList::sheetLower( int index ) + { + m_sheets->lower( index ); + emit sigChildOrder(); + emit sigChildListChanged(); + } + +//-------------------------------------------------------------// + +void KSSheetList::sheetToFront( int index ) + { + m_sheets->toFront( index ); + emit sigChildOrder(); + emit sigChildListChanged(); + } + +//-------------------------------------------------------------// + +void KSSheetList::sheetToBack( int index ) + { + m_sheets->toBack( index ); + emit sigChildOrder(); + emit sigChildListChanged(); + } + +//-------------------------------------------------------------// + +void KSSheetList::sheetReorder( int toPosition, int index ) + { + m_sheets->reorder( toPosition, index ); + emit sigChildOrder(); + emit sigChildListChanged(); + } + + //-------------------------------------------------------------// + +int KSSheetList::sheetFind( KSSheet *sheet ) + { + return m_sheets->find(sheet); + } + +//-------------------------------------------------------------// + diff --git a/kmatplot/ksglobalmatrixlist.h b/kmatplot/ksglobalmatrixlist.h new file mode 100644 index 0000000..78ecc1a --- /dev/null +++ b/kmatplot/ksglobalmatrixlist.h @@ -0,0 +1,240 @@ +/*************************************************************************** + ksglobalmatrixlist.h + ------------------- + version : + begin : + + copyright : (C) 2001 by Kamil Dobkowski + email : kamildobk@poczta.onet.pl + ***************************************************************************/ + +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + + +#ifndef KSGLOBALMATRIXLIST_H +#define KSGLOBALMATRIXLIST_H + +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + +#include"widgets/qsdata.h" +#include"ksmatrix.h" +#include<qmap.h> +#include<deque.h> + +//---------------------------------------------------------------------------------------------// + +class KSSheetList; + +/** + * Global sheet + */ +class KSSheet : public QSData + { + Q_OBJECT + friend class KSMatrixWorksheetCellRange; + public: + /** + * Column Type + */ + enum ColumnType { ColumnUnknown=0, ColumnX, ColumnY, ColumnZ, ColumnV, ColumnDX, ColumnDY }; + /** + * Column data + */ + class ColumnData { + public: + int column; + ColumnType type; + QString title; + ColumnData( int col = -1 ) { column = col; type = ColumnUnknown; } + ~ColumnData() {} + }; + /** + * List of column infos. + */ + typedef QMap<int,ColumnData> ColumnInfo; + /** + * Constructor. You must add the sheet to the sheet list immediately - see KSSeetList::addSheet(). + */ + KSSheet( KSSheetList *parent ); + /** + * Destructor. + */ + virtual ~KSSheet(); + /** + * Sets a new matrix as the given channel in the plot. + */ + virtual bool setMatrix( int channel, QSMatrix *m ); + /** + * Returns a matrix and sets a data to NULL. + */ + virtual QSMatrix *takeMatrix( int channel, QSMatrix *newMatrix = NULL ); + /** + * Returns matrix 'channel' if any, or NULL. + */ + virtual QSMatrix *matrix( int channel ) const; + /** + * Deletes the choosen matrix. + */ + virtual void deleteMatrix( int channel ); + /** + * Returns 1. + */ + virtual int channelCount() const { return 1; } + /** + * Sets column data + */ + void setColumnData( int column, ColumnType type, const QString& title ); + /** + * Sets data for the column + */ + void setColumnData( ColumnData data ); + /** + * Removes column data + */ + void removeColumnData( int column ); + /** + * Returns column data + */ + ColumnData columnData( int column ) const; + /** + * Checks if there is column data for the column + */ + bool isColumnDataPresent( int column ) const; + /** + * Returns a pointer on the column info list. + */ + const ColumnInfo *columnInfo() const { return &m_column_info; } + /** + * Returns a number of cell ranges + */ + int cellRangeCount() const; + /** + * Return a cell range at index 'index'. + */ + KSMatrixWorksheetCellRange *cellRange( int index ); + /** + * On which position this sheet should be inserted when adding to the sheet.list. + * This is always -1, but can be different when loading sheet from stream. + */ + int insertPos() const { return m_insert_pos; } + /** + * Loads sheet from a stream. + */ + virtual void loadStateFromStream( QDataStream& stream, QSObjectFactory *factory ); + /** + * Saves sheet to a stream. + */ + virtual void saveStateToStream( QDataStream& stream, QSObjectFactory *factory ); + + protected: + /** + * Adds cell range to the list. This is called automatically + * by KSWorksheetCellRange. Matrices are not deleted. + */ + void cellRangeAdd( KSMatrixWorksheetCellRange *matrix ); + /** + * Removes cell range from the list. + */ + void cellRangeRemove( KSMatrixWorksheetCellRange *matrix ); + + ColumnInfo m_column_info; + QSMatrix *m_matrix; + KSSheetList *m_parent; + deque<KSMatrixWorksheetCellRange*> m_cell_range_list; + int m_insert_pos; + }; + +//---------------------------------------------------------------------------------------------// + +template<class CHILD_OBJECT> class QSChildList; +/** + * The list of global sheets + */ +class KSSheetList : public QSData + { + Q_OBJECT + friend class KSSheet; + public: + /** + * Constructor + */ + KSSheetList( QObject * parent=0, const char * name=0 ); + /** + * Destructor. + */ + virtual ~KSSheetList(); + /** + * Number of child QSData objects + */ + virtual int childCount() const; + /** + * Returns a child object. Reimplemented from QSData. + */ + virtual KSSheet *child( int index ) const; + /** + * Removes all sheets + */ + virtual void clearAll(); + /** + * Adds a new sheet + */ + void sheetAdd( KSSheet *sheet ); + /** + * Inserts a sheet at a given position + */ + void sheetInsert( int position, KSSheet *sheet ); + /** + * Removes a sheet + */ + void sheetRemove( int index ); + /** + * Removes and deletes a sheet + */ + void sheetDelete( int index ); + /** + * Raises ( increases index ) sheet on the list. + */ + void sheetRaise( int index ); + /** + * Lowers ( decreases index ) sheet on the list. + */ + void sheetLower( int index ); + /** + * Brings sheet to the front ( max index ). + */ + void sheetToFront( int index ); + /** + * Sends sheet to the back ( index = 0 ) + */ + void sheetToBack( int index ); + /** + * Move sheet at position 'atPosition'. + */ + void sheetReorder( int atPosition, int index ); + /** + * Returns an index of the given sheet ot -1. + */ + int sheetFind( KSSheet *sheet ); + +// int sheetFind( const QString& title ); + + protected: + QSChildList<KSSheet> *m_sheets; + }; + +//---------------------------------------------------------------------------------------------// + + + +#endif + + diff --git a/kmatplot/ksglobalsettings.cpp b/kmatplot/ksglobalsettings.cpp new file mode 100644 index 0000000..a46d812 --- /dev/null +++ b/kmatplot/ksglobalsettings.cpp @@ -0,0 +1,159 @@ +/*************************************************************************** + ksglobalsettings.cpp + ------------------- + begin : Mon Jan 14 2002 + copyright : (C) 2002 by kamil + email : kamil@localhost.localdomain + ***************************************************************************/ + +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + +#include "ksglobalsettings.h" +#include "ksworkbook.h" +#include <qsettings.h> + + +KSGlobalSettings::settings_t KSGlobalSettings::m_settings; + +//--------------------------------------------------------------------------// + +KSGlobalSettings::KSGlobalSettings() + { + } + +//--------------------------------------------------------------------------// + +KSGlobalSettings::~KSGlobalSettings() + { + } + + //--------------------------------------------------------------------------// + +void KSGlobalSettings::setOpenSocket( bool enable ) + { + m_settings.m_open_socket = enable; + } + + //--------------------------------------------------------------------------// + +bool KSGlobalSettings::openSocket() + { + return m_settings.m_open_socket; + } + + //--------------------------------------------------------------------------// + +void KSGlobalSettings::setUndoLevels( int levels ) + { + m_settings.m_undo_levels = levels; + } + + //--------------------------------------------------------------------------// + +int KSGlobalSettings::undoLevels() + { + return m_settings.m_undo_levels; + } + + //--------------------------------------------------------------------------// + +void KSGlobalSettings::setUseCustomPrintDpi( bool enabled ) + { + m_settings.m_use_custom_dpi = enabled; + } + +//--------------------------------------------------------------------------// + +bool KSGlobalSettings::useCustomPrintDpi() + { + return m_settings.m_use_custom_dpi; + } + +//--------------------------------------------------------------------------// + +void KSGlobalSettings::setCustomPrintDpi( int dpi ) + { + m_settings.m_custom_dpi = dpi; + } + +//--------------------------------------------------------------------------// + +int KSGlobalSettings::customPrintDpi() + { + return m_settings.m_custom_dpi; + } + +//--------------------------------------------------------------------------// + +void KSGlobalSettings::setInstallPath( const QString& installPath ) + { + m_settings.m_install_path = installPath; + } + +//--------------------------------------------------------------------------// + +QString KSGlobalSettings::installPath() + { + return m_settings.m_install_path; + } + +//--------------------------------------------------------------------------// + +QString KSGlobalSettings::examplePath() + { + return m_settings.m_install_path + "/share/kmatplot/examples"; + } + +//--------------------------------------------------------------------------// + +QString KSGlobalSettings::picturePath() + { + return m_settings.m_install_path + "/share/kmatplot/pics"; + } + +//--------------------------------------------------------------------------// + +#define KEY_INSTALL_PATH "/KMatplot/installPath" +#define KEY_USE_CUSTOM_DPI "/KMatplot/useCustomPrintDpi" +#define KEY_CUSTOM_DPI "/KMatplot/customPrintDpi" +#define KEY_OPEN_SOCKET "/KMatplot/openSocket" +#define KEY_UNDO_LEVELS "/KMatplot/undoLevels" + +void KSGlobalSettings::load() + { + QSettings s; + s.insertSearchPath( QSettings::Unix, "/etc" ); + m_settings.m_install_path = s.readEntry( KEY_INSTALL_PATH, "/usr/local" ); + m_settings.m_use_custom_dpi = s.readBoolEntry( KEY_USE_CUSTOM_DPI, false ); + m_settings.m_custom_dpi = s.readNumEntry( KEY_CUSTOM_DPI, 360 ); + m_settings.m_open_socket = s.readBoolEntry( KEY_OPEN_SOCKET, false ); + m_settings.m_undo_levels = s.readNumEntry( KEY_UNDO_LEVELS, 5 ); + } + +//--------------------------------------------------------------------------// + +void KSGlobalSettings::save() + { + QSettings s; + //s.insertSearchPath( QSettings::Unix, "/etc" ); + s.writeEntry( KEY_INSTALL_PATH, m_settings.m_install_path ); + s.writeEntry( KEY_USE_CUSTOM_DPI, m_settings.m_use_custom_dpi ); + s.writeEntry( KEY_CUSTOM_DPI, m_settings.m_custom_dpi ); + s.writeEntry( KEY_OPEN_SOCKET, m_settings.m_open_socket ); + s.writeEntry( KEY_UNDO_LEVELS, m_settings.m_undo_levels ); + } + +//--------------------------------------------------------------------------// + +void KSGlobalSettings::apply() + { + KSCommandHistory::setUndoLevels( m_settings.m_undo_levels ); + } + diff --git a/kmatplot/ksglobalsettings.h b/kmatplot/ksglobalsettings.h new file mode 100644 index 0000000..944b99a --- /dev/null +++ b/kmatplot/ksglobalsettings.h @@ -0,0 +1,113 @@ +/*************************************************************************** + ksglobalsettings.h + ------------------- + begin : Mon Jan 14 2002 + copyright : (C) 2002 by kamil + email : kamil@localhost.localdomain + ***************************************************************************/ + +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + +#ifndef KSGLOBALSETTINGS_H +#define KSGLOBALSETTINGS_H + +#include<qstring.h> + +/** + * global settings path + * @author kamil + */ +class KSGlobalSettings { + + public: + /** + * Constructor + */ + KSGlobalSettings(); + /** + * Destructor + */ + ~KSGlobalSettings(); + /** + * Turns on opening socket at start + * The socket is always opened when KMatplot is run from + * withing Octave or Scilab + */ + static void setOpenSocket( bool enable ); + /** + * Returns whether socket is opened at start. + */ + static bool openSocket(); + /** + * Sets a number of undo levels + */ + static void setUndoLevels( int levels ); + /** + * Returns a number of undo levels. + */ + static int undoLevels(); + /** + * Use custom dpi when printing or a default one + */ + static void setUseCustomPrintDpi( bool enabled ); + /** + * Uses custom printing dpi or not + */ + static bool useCustomPrintDpi(); + /** + * Set custom dpi value + */ + static void setCustomPrintDpi( int dpi ); + /** + * Returns custom dpi value + */ + static int customPrintDpi(); + /** + * Sets the base directory + */ + static void setInstallPath( const QString& installPath ); + /** + * Returns the base directory + */ + static QString installPath(); + /** + * Returns installPath/share/kmatplot/examples + */ + static QString examplePath(); + /** + * Returns installPath/share/kmatplot/pics + */ + static QString picturePath(); + /** + * Loads settings from a file + */ + static void load(); + /** + * Saves settings in a file + */ + static void save(); + /** + * Sets parameters in apriopriate object, whenever it is possible. + * Currently sets 'undoLevels' + */ + static void apply(); + + private: + typedef struct { + QString m_install_path; + bool m_use_custom_dpi; + int m_custom_dpi; + bool m_open_socket; + int m_undo_levels; + } settings_t; + static settings_t m_settings; + }; + +#endif diff --git a/kmatplot/ksmatrix.cpp b/kmatplot/ksmatrix.cpp new file mode 100644 index 0000000..6222ecc --- /dev/null +++ b/kmatplot/ksmatrix.cpp @@ -0,0 +1,837 @@ +/*************************************************************************** + ksmatrix.cpp + ------------------- + begin : 01-January-2000 + copyright : (C) 2000 by Kamil Dobkowski + email : kamildobk@poczta.onet.pl + ***************************************************************************/ + +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + +#include"ksmatrix.h" +#include"widgets/qsdata.h" +#include"widgets/qsconsole.h" +#include"formula/mpformula.h" +#include"ksworkbook.h" +#include"ksglobalmatrixlist.h" +#include<qstrlist.h> +#include<qmetaobject.h> + +#include<iostream> + + +/** + * Reference points to QSData::channel ! + */ + + + + + + +//-------------------------------------------------------------// +//-------------------------------------------------------------// +//-------------------------------------------------------------// +//-------------------------------------------------------------// +//-------------------------------------------------------------// +//-------------------------------------------------------------// +//-------------------------------------------------------------// +//-------------------------------------------------------------// + + + + + + + +KSMatrix *KSMatrix::create( EType elementType ) + { + switch( elementType ) { + case EUChar: return new KSMatrixImpl<unsigned char>(EUChar); + case EUShort: return new KSMatrixImpl<unsigned short>(EUShort); + case EShort: return new KSMatrixImpl<short>(EShort); + case ELong: return new KSMatrixImpl<long>(ELong); + case EFloat: return new KSMatrixImpl<float>(EFloat); + case EDouble: return new KSMatrixImpl<double>(EDouble); + } + return NULL; + } + +//-------------------------------------------------------------// +// +// Flexible, but too much complicated +// Drop line_offset and pixel_offset and make some template specializations with '<<' instead of '*' ( used in DDE with Octave ) +// +KSMatrix::KSMatrix( EType elementType ) +:QSMatrix() + { + m_type = elementType; + m_rows = 0; + m_cols = 0; + m_ptr = NULL; + m_lo = 0; + m_po = 0; + m_delete = true; + } + +//-------------------------------------------------------------// + +EType KSMatrix::detectType() + { + double max = 0.0; + double min = 0.0; + + EType type = EUChar; + for( int r=0; r<rows(); r++ ) + for( int c=0; c<cols(); c++ ) { + double val = value(r,c); + if ( type == EUChar && val != double((unsigned char)val) ) type = EShort; + if ( type == EShort && val != double((short)val) ) type = ELong; + if ( type == ELong && val != double((long)val) ) type = EFloat; + if ( type == EFloat && val != double((float)val) ) type = EDouble; + if ( type == EDouble ) break; + + if ( r == 0 && c == 0 ) max = min = val; else { max = max<val?val:max; min = min>val?val:min; } + } + + if ( type == ELong && min >= 0x0 && max <= 0xffff ) type = EUShort; + return type; + } +//-------------------------------------------------------------// + +KSMatrix::~KSMatrix() + { + if ( m_delete ) delete m_ptr; + } + +//-------------------------------------------------------------// + +bool KSMatrix::isEditable() const + { + return true; + } + +//-------------------------------------------------------------/ + +EType KSMatrix::type() const + { + return m_type; + } + +//-------------------------------------------------------------// + +KSMatrix *KSMatrix::convertType( EType newType ) + { + KSMatrix *result = KSMatrix::create( newType ); + result->setName( name() ); + result->setDataObject( dataObject(), channel() ); + result->setRawData( new char[m_rows*m_cols*result->elementSize()], m_rows, m_cols, true ); + for ( int crow=0; crow<m_rows; crow++ ) + for ( int ccol=0; ccol<m_cols; ccol++ ) + result->setValue( crow, ccol, value(crow,ccol) ); + return result; + } + +//-------------------------------------------------------------// + +bool KSMatrix::resize( int rows, int cols ) + { + if ( rows <= 0 || cols <= 0 ) { + setRawData( NULL, 0, 0 ); + } else { + KSMatrix *new_data = KSMatrix::create( m_type ); + new_data->setRawData( new char[rows*cols*new_data->elementSize()], rows, cols, false ); + for ( int crow=0; crow<new_data->rows(); crow++ ) + for ( int ccol=0; ccol<new_data->cols(); ccol++ ) + if ( crow<m_rows && ccol<m_cols ) new_data->setValue( crow, ccol, value(crow,ccol) ); + else new_data->setValue( crow, ccol, 0.0 ); + setRawData( new_data->ptr(), new_data->rows(), new_data->cols(), true ); + delete new_data; + } + return true; + } + +//-------------------------------------------------------------// + +bool KSMatrix::transpose() + { + int temp; + temp = m_rows; m_rows = m_cols; m_cols = temp; + temp = m_lo; m_lo = m_po; m_po = temp; + return true; + } + +//-------------------------------------------------------------// + +void KSMatrix::setRawData( void *ptr, int rows, int cols, bool deleteData, int lineOffset, int pixelOffset ) + { + if ( m_delete ) delete m_ptr; + m_ptr = (char *)ptr; + m_rows = rows; + m_cols = cols; + m_delete = deleteData; + m_po = pixelOffset ? pixelOffset : elementSize(); + m_lo = lineOffset ? lineOffset : m_po*cols; + } + +//-------------------------------------------------------------// + +void KSMatrix::setMatrix( QSMatrix *matrix ) + { + setRawData( new char[matrix->rows()*matrix->cols()*elementSize()], matrix->rows(), matrix->cols(), true ); + for ( int crow=0; crow<m_rows; crow++ ) + for ( int ccol=0; ccol<m_cols; ccol++ ) + setValue( crow, ccol, matrix->value(crow,ccol) ); + } + + +//-------------------------------------------------------------// +//-------------------------------------------------------------// +//-------------------------------------------------------------// +//-------------------------------------------------------------// +//-------------------------------------------------------------// + + +KSMatrixString::KSMatrixString() + { + m_rows = 0; + m_cols = 0; + m_transposed = false; + m_string_table = NULL; + } + +//-------------------------------------------------------------// + +KSMatrixString::~KSMatrixString() + { + delete[] m_string_table; + } + +//-------------------------------------------------------------// + +bool KSMatrixString::isEditable() const + { + return true; + } + +//-------------------------------------------------------------// + +bool KSMatrixString::isString() const + { + return true; + } + +//-------------------------------------------------------------// + +void KSMatrixString::setValue( int row, int col, double value ) + { + setString( row, col, QString::number(value,'g',9) ); + } + +//-------------------------------------------------------------// + +double KSMatrixString::value( int row, int col ) + { + return string(row,col).toDouble(); + } + +//-------------------------------------------------------------// + +int KSMatrixString::cols() const + { + return m_transposed ? m_rows : m_cols; + } + +//-------------------------------------------------------------// + +int KSMatrixString::rows() const + { + return m_transposed ? m_cols : m_rows; + } + +//-------------------------------------------------------------// + +void KSMatrixString::setString( int row, int col, const QString& string ) + { + if ( m_transposed ) m_string_table[ col*m_cols+row ] = string; + else m_string_table[ row*m_cols+col ] = string; + } + +//-------------------------------------------------------------// + +QString KSMatrixString::string( int row, int col ) + { + return m_transposed ? m_string_table[col*m_cols+row] : m_string_table[row*m_cols+col]; + } + +//-------------------------------------------------------------// + +bool KSMatrixString::resize( int new_rows, int new_cols ) + { + QString *new_string_table = new QString[new_rows*new_cols]; + + for( int curr_row=0; curr_row<QMIN(new_rows,rows()); curr_row++ ) + for( int curr_col=0; curr_col<QMIN(new_cols,cols()); curr_col++ ) { + new_string_table[curr_row*new_cols+curr_col] = string(curr_row,curr_col); + } + + delete[] m_string_table; m_string_table = new_string_table; + m_rows = new_rows; + m_cols = new_cols; + m_transposed = false; + return true; + } + +//-------------------------------------------------------------// + +bool KSMatrixString::transpose() + { + m_transposed = !m_transposed; + return true; + } + +//-------------------------------------------------------------// + +void KSMatrixString::setMatrix( QSMatrix *matrix ) + { + delete[] m_string_table; + m_rows = matrix->rows(); + m_cols = matrix->cols(); + m_transposed = false; + m_string_table = new QString[m_rows*m_cols]; + for ( int crow=0; crow<m_rows; crow++ ) + for ( int ccol=0; ccol<m_cols; ccol++ ) + setString( crow, ccol, matrix->string(crow,ccol) ); + } + +//-------------------------------------------------------------// + +void KSMatrixString::loadStateFromStream( QDataStream& stream, QSObjectFactory *factory ) + { + QSMatrix::loadStateFromStream( stream, factory ); + int new_rows; stream >> new_rows; + int new_cols; stream >> new_cols; + resize( new_rows, new_cols ); + for( int row=0; row<rows(); row++ ) + for( int col=0; col<cols(); col++ ) { + QString element; stream >> element; + setString( row, col, element ); + } + } + +//-------------------------------------------------------------// + +void KSMatrixString::saveStateToStream( QDataStream& stream, QSObjectFactory *factory ) + { + QSMatrix::saveStateToStream( stream, factory ); + stream << (int )rows(); + stream << (int )cols(); + for( int row=0; row<rows(); row++ ) + for( int col=0; col<cols(); col++ ) { + QString element = string(row,col); + stream << element; + } + } + + + + + +//-------------------------------------------------------------// +//-------------------------------------------------------------// +//-------------------------------------------------------------// +//-------------------------------------------------------------// +//-------------------------------------------------------------// + + + + +KSMatrixRef::KSMatrixRef() + { + m_rows = 0; + m_cols = 0; + m_ref_matrix = NULL; + m_ref_object = NULL; + m_ref_channel = 0; + m_ref_col_from = 0; + m_ref_col_to = -1; + m_ref_col_step = 1; + m_ref_row_from = 0; + m_ref_row_to = -1; + m_ref_row_step = 1; + m_start_row = 0; + m_start_col = 0; + m_transposition = false; + m_ref_editable = false; + m_ref_string = false; + m_in_loop = false; // desn't allow circular references + } + +//-------------------------------------------------------------// + +KSMatrixRef::~KSMatrixRef() + { + } + +//-------------------------------------------------------------// + +void KSMatrixRef::setRefObject( QSData *dataObject, int channel, + int rowFrom, int rowStep, int rowTo, + int colFrom, int colStep, int colTo, + bool transposition ) + { + if ( dataObject != m_data_object || channel != m_channel ) { + if ( channel < 0 ) dataObject = NULL; + m_ref_row_from = rowFrom; + m_ref_row_to = rowTo; + m_ref_row_step = rowStep ? rowStep : 1; + m_ref_col_from = colFrom; + m_ref_col_to = colTo; + m_ref_col_step = colStep ? colStep : 1; + m_transposition = transposition; + if ( dataObject ) { + m_ref_object = dataObject; + m_ref_channel = channel; + connect ( dataObject, SIGNAL(sigDataChanged(QSData*,int)), this, SLOT(reconnect(QSData*,int)) ); + connect ( dataObject, SIGNAL(sigDeleted(QSData*)), this, SLOT(break_connection(QSData*)) ); + reconnect(); + } else { + break_connection( m_ref_object ); + } + + } + } + +//-------------------------------------------------------------// + +void KSMatrixRef::setValue( int row, int col, double value ) + { + if ( !m_in_loop ) { + m_in_loop = true; + if ( m_transposition ) m_ref_matrix->setValue( m_start_col+col*m_ref_col_step, m_start_row+row*m_ref_row_step, value ); + else m_ref_matrix->setValue( m_start_row+row*m_ref_row_step, m_start_col+col*m_ref_col_step, value ); + m_in_loop = false; + } + } + +//-------------------------------------------------------------// + +double KSMatrixRef::value( int row, int col ) + { + double result; + if ( !m_in_loop ) { + m_in_loop = true; + if ( m_transposition ) result = m_ref_matrix->value( m_start_col+col*m_ref_col_step, m_start_row+row*m_ref_row_step ); + else result = m_ref_matrix->value( m_start_row+row*m_ref_row_step, m_start_col+col*m_ref_col_step ); + m_in_loop = false; + } else { + result = sqrt(-1.0); + } + return result; + } + +//-------------------------------------------------------------// + +void KSMatrixRef::setString( int row, int col, const QString& string ) + { + if ( !m_in_loop ) { + m_in_loop = true; + if ( m_transposition ) m_ref_matrix->setString( m_start_col+col*m_ref_col_step, m_start_row+row*m_ref_row_step, string ); + else m_ref_matrix->setString( m_start_row+row*m_ref_row_step, m_start_col+col*m_ref_col_step, string ); + m_in_loop = false; + } + } + +//-------------------------------------------------------------// + +QString KSMatrixRef::string( int row, int col ) + { + QString result; + if ( !m_in_loop ) { + m_in_loop = true; + if ( m_transposition ) result = m_ref_matrix->string( m_start_col+col*m_ref_col_step, m_start_row+row*m_ref_row_step ); + else result = m_ref_matrix->string( m_start_row+row*m_ref_row_step, m_start_col+col*m_ref_col_step ); + m_in_loop = false; + } + return result; + } + +//-------------------------------------------------------------// + +void KSMatrixRef::reconnect( QSData *dataObject, int channel ) + { + if ( m_in_loop ) QSConsole::write( "Kmatplot: Circular reference !" ); + else + if ( m_ref_object && m_ref_object == dataObject && (m_ref_channel == channel || channel == -1) ) // our referenced object changed + { + m_in_loop = true; + dataChanging(); + reconnect(); + dataChanged(); + m_in_loop = false; + } + } + +//-------------------------------------------------------------// + +void KSMatrixRef::reconnect() + { + m_ref_matrix = m_ref_object->matrix( m_ref_channel ); + int ref_rows = m_ref_matrix ? m_ref_matrix->rows() : 0; + int ref_cols = m_ref_matrix ? m_ref_matrix->cols() : 0; + m_start_row = ( m_ref_row_from == -1 ) ? ref_rows-1 : m_ref_row_from; + m_start_col = ( m_ref_col_from == -1 ) ? ref_cols-1 : m_ref_col_from; + int end_row = ( m_ref_row_to == -1 ) ? ref_rows-1 : m_ref_row_to; + int end_col = ( m_ref_col_to == -1 ) ? ref_cols-1 : m_ref_col_to; + + if ( m_ref_row_step > 0 ) { + m_start_row = QMAX( m_start_row, 0 ); + end_row = QMIN( end_row, ref_rows-1 ); + m_rows = ( end_row - m_start_row ) / m_ref_row_step + 1; + } else { + m_start_row = QMIN( m_start_row, ref_rows-1 ); + end_row = QMAX( end_row, 0 ); + m_rows = ( end_row - m_start_row ) / m_ref_row_step + 1; + } + + if ( m_ref_col_step > 0 ) { + m_start_col = QMAX( m_start_col, 0 ); + end_col = QMIN( end_col, ref_cols-1 ); + m_cols = ( end_col - m_start_col ) / m_ref_col_step + 1; + } else { + m_start_col = QMIN( m_start_col, ref_cols-1 ); + end_col = QMAX( end_col, 0 ); + m_cols = ( end_col - m_start_col ) / m_ref_col_step + 1; + } + + m_rows = QMAX( m_rows, 0 ); + m_cols = QMAX( m_cols, 0 ); + + if ( m_transposition ) { + int temp = m_cols; + m_cols = m_rows; + m_rows = temp; + } + + if ( m_rows*m_cols == 0 ) m_rows = m_cols = 0; + m_ref_editable = m_ref_matrix ? m_ref_matrix->isEditable() : false; + m_ref_string = m_ref_matrix ? m_ref_matrix->isString() : false; + } + +//-------------------------------------------------------------// + +void KSMatrixRef::break_connection( QSData *dataObject ) + { + if ( m_in_loop ) QSConsole::write( "Kmatplot: Circular reference !" ); + else + if ( m_ref_object && m_ref_object == dataObject ) { + m_in_loop = true; + dataChanging(); + m_rows = 0; + m_cols = 0; + m_start_row = 0; + m_start_col = 0; + m_ref_matrix = NULL; + m_ref_object = NULL; + m_ref_channel = 0; + m_in_loop = false; + m_ref_editable = false; + m_ref_string = false; + dataChanged(); + m_in_loop = false; + } + } + +//-------------------------------------------------------------// +//-------------------------------------------------------------// +//-------------------------------------------------------------// +//-------------------------------------------------------------// +//-------------------------------------------------------------// +//-------------------------------------------------------------// +//-------------------------------------------------------------// + + +KSMatrixWorksheetCellRange::KSMatrixWorksheetCellRange( KSWorkbook *workbook ) +: KSMatrixRef() + { + m_workbook = workbook; + } + +//-------------------------------------------------------------// + +KSMatrixWorksheetCellRange::~KSMatrixWorksheetCellRange() + { + // unregister + KSSheet *curr_sheet = dynamic_cast<KSSheet*>(refObject()); + if ( curr_sheet ) curr_sheet->cellRangeRemove( this ); + } + +//-------------------------------------------------------------// + +void KSMatrixWorksheetCellRange::setWorksheet( int index ) + { + KSSheet *sheet = m_workbook->sheets()->child(index); + if ( sheet != refObject() ) { + KSSheet *curr_sheet = dynamic_cast<KSSheet*>(refObject()); + KSSheet *new_sheet = m_workbook->sheets()->child(index); + if ( curr_sheet ) curr_sheet->cellRangeRemove( this ); + setRefObject( new_sheet, 0, + rowFrom(), rowStep(), rowTo(), + colFrom(), colStep(), colTo(), + transposition() ); + if ( new_sheet ) new_sheet->cellRangeAdd( this ); + } + } + +//-------------------------------------------------------------// + +int KSMatrixWorksheetCellRange::worksheet() const + { + return m_workbook->sheets()->childIndex(refObject()); + } + +//-------------------------------------------------------------// + +void KSMatrixWorksheetCellRange::setColumn( int column ) + { + setRefObject( refObject(), 0, + 0, 1, -1, + column, 1, column, + transposition() ); + } + +//-------------------------------------------------------------// + +void KSMatrixWorksheetCellRange::setRowFrom( int row ) + { + setRefObject( refObject(), 0, + row, rowStep(), rowTo(), + colFrom(), colStep(), colTo(), + transposition() ); + } + + //-------------------------------------------------------------// + +void KSMatrixWorksheetCellRange::setColFrom( int col ) + { + setRefObject( refObject(), 0, + rowFrom(), rowStep(), rowTo(), + col, colStep(), colTo(), + transposition() ); + } + +//-------------------------------------------------------------// + +void KSMatrixWorksheetCellRange::setRowStep( int step ) + { + setRefObject( refObject(), 0, + rowFrom(), step, rowTo(), + colFrom(), colStep(), colTo(), + transposition() ); + } + +//-------------------------------------------------------------// + +void KSMatrixWorksheetCellRange::setColStep( int step ) + { + setRefObject( refObject(), 0, + rowFrom(), rowStep(), rowTo(), + colFrom(), step, colTo(), + transposition() ); + } + +//-------------------------------------------------------------// + +void KSMatrixWorksheetCellRange::setRowTo( int row ) + { + setRefObject( refObject(), 0, + rowFrom(), rowStep(), row, + colFrom(), colStep(), colTo(), + transposition() ); + } + +//-------------------------------------------------------------// + +void KSMatrixWorksheetCellRange::setColTo( int col ) + { + setRefObject( refObject(), 0, + rowFrom(), rowStep(), rowTo(), + colFrom(), colStep(), col, + transposition() ); + } + +//-------------------------------------------------------------// + +void KSMatrixWorksheetCellRange::setTransposition( bool enabled ) + { + setRefObject( refObject(), 0, + rowFrom(), rowStep(), rowTo(), + colFrom(), colStep(), colTo(), + enabled ); + } + +//-------------------------------------------------------------// + +void KSMatrixWorksheetCellRange::loadStateFromStream( QDataStream& stream, QSObjectFactory *factory ) + { + KSMatrixRef::loadStateFromStream( stream, factory ); + } + +//-------------------------------------------------------------// + +void KSMatrixWorksheetCellRange::saveStateToStream( QDataStream& stream, QSObjectFactory *factory ) + { + KSMatrixRef::saveStateToStream( stream, factory ); + } + +//-------------------------------------------------------------// +//-------------------------------------------------------------// +//-------------------------------------------------------------// +//-------------------------------------------------------------// +//-------------------------------------------------------------// + +KSMatrixFormula::KSMatrixFormula() +:QSMatrix() + { + m_formula = "0:1:10"; + m_rows = 0; + m_cols = 0; + m_data = NULL; + m_row_offset = 0; + m_col_offset = 0; + m_transposition = false; + } + +//-------------------------------------------------------------// + +KSMatrixFormula::~KSMatrixFormula() + { + delete m_data; + } + + //-------------------------------------------------------------// + +void KSMatrixFormula::setFormula( const QString& formula ) + { + m_formula = formula; + } + +//-------------------------------------------------------------// + +bool KSMatrixFormula::init( MPError& error, MPFactoryList *locals ) + { + delete m_data; + m_rows = 0; + m_cols = 0; + m_data = NULL; + m_row_offset = 0; + m_col_offset = 0; + + MPFormula f; + MPSymbol *s = f.parse( m_formula, error, locals ); + if ( s ) { + m_cols = s->cols(); + m_rows = s->rows(); + m_row_offset = m_cols; + m_col_offset = 1; + m_data = new double[m_rows*m_cols]; + for( int row=0; row<m_rows; row++ ) + for( int col=0; col<m_cols; col++ ) + m_data[row*m_cols+col] = s->value(row,col); + if ( m_transposition ) { transpose(); m_transposition = true; } + delete s; + return true; + } + return false; + } + +//-------------------------------------------------------------// + +double KSMatrixFormula::value( int row, int col ) + { + return *(m_data + m_row_offset*row + m_col_offset*col); + } + +//-------------------------------------------------------------// + +bool KSMatrixFormula::transpose() + { + int temp; + temp = m_rows; m_rows = m_cols; m_cols = temp; + temp = m_row_offset; m_row_offset = m_col_offset; m_col_offset = temp; + m_transposition = !m_transposition; + return true; + } + +//-------------------------------------------------------------// + +void KSMatrixFormula::setTransposition( bool enabled ) + { + if ( enabled != m_transposition ) { + transpose(); + } + } + //-------------------------------------------------------------------------// +//-------------------------------------------------------------------------// +//-------------------------------------------------------------------------// +//-------------------------------------------------------------------------// +//-------------------------------------------------------------------------// + +MPSymQSMatrix::MPSymQSMatrix( QSMatrix *matrix, MPSymbolList *args, int columnFrom, int columnTo, const char *id ) +: MPSymbol( args, columnFrom, columnTo, id ) + { + m_matrix = matrix; + m_range = QRect(0,0,-1,-1); + } + +//-------------------------------------------------------------------------// + +MPSymQSMatrix::MPSymQSMatrix( QSMatrix *matrix, const QRect& range, MPSymbolList *args, int columnFrom, int columnTo, const char *id ) +: MPSymbol( args, columnFrom, columnTo, id ) + { + m_matrix = matrix; + m_range = range; + } + +//-------------------------------------------------------------------------// + +MPSymQSMatrix::~MPSymQSMatrix() + { + } + +//-------------------------------------------------------------------------// + +void MPSymQSMatrix::checkArgs( MPError& ) + { + m_matrix_row_max = m_matrix->rows()-1; + m_matrix_col_max = m_matrix->cols()-1; + if ( m_range.isEmpty() ) { + m_rows = m_matrix->rows(); + m_cols = m_matrix->cols(); + } else { + m_rows = m_range.height(); + m_cols = m_range.width(); + } + } + +//-------------------------------------------------------------------------// + +double MPSymQSMatrix::value( int row, int col ) + { + return m_matrix->value( QMIN(row+m_range.top(), m_matrix_row_max ), + QMIN(col+m_range.left(), m_matrix_col_max ) ); + } + +//-------------------------------------------------------------------------// + + + + + diff --git a/kmatplot/ksmatrix.h b/kmatplot/ksmatrix.h new file mode 100644 index 0000000..deed4ce --- /dev/null +++ b/kmatplot/ksmatrix.h @@ -0,0 +1,416 @@ +/*************************************************************************** + ksmatrix.h + ------------------- + begin : 01-January-2000 + copyright : (C) 2000 by Kamil Dobkowski + email : kamildobk@poczta.onet.pl + ***************************************************************************/ + +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + + +#ifndef KSMATRIX_H +#define KSMATRIX_H + +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + +#include "widgets/qsmatrix.h" +#include "interface/etype.h" +#include "formula/mpsymbol.h" +#include <qstring.h> +#include <assert.h> +#include <qobject.h> + +class QSData; +class QWidget; +class KSProjectXML; + + + +//---------------------------------------------------------------------------------------------// + + +/** + * Ordinary matrix. + */ +class KSMatrix : public QSMatrix { + Q_OBJECT + public: + + static KSMatrix *create( EType elementType ); + /** + * Constructor + */ + KSMatrix( EType elementType ); + /** + * Destructor + */ + virtual ~KSMatrix(); + /** + * Reimplemented QSMatrix::editable + */ + virtual bool isEditable() const; + /** + * Reimplemented QSMatrix:: + */ + virtual EType type() const; + /** + * Check using what element type the matrix can be the most effectively stored. + */ + EType detectType(); + /** + * Sets the raw data. The arguments are not checked. Call it only if you know what you are doing. + */ + void setRawData( void *ptr, int rows, int col, bool deleteData=true, int lineOffset=0, int pixelOffset=0 ); + /** + * Copies this matrix. + */ + void setMatrix( QSMatrix *matrix ); + /** + * Resizes matrix ( preserves old data ). + */ + virtual bool resize( int rows, int cols ); + /** + * Transposes matrix. + */ + virtual bool transpose(); + /** + * Converts elements to a different type. Copies name() and dataObject() and channel() to the newly created matrix. + */ + KSMatrix *convertType( EType newType ); + /** + * Returns size of an element. + */ + virtual int elementSize() const = 0; + /** + * Number of rows + */ + virtual int rows() const { return m_rows; } + /** + * Number of columns + */ + virtual int cols() const { return m_cols; } + /** + * Returns size of an element. + */ + void *ptr() const { return m_ptr; } + /** + * Return line offset in bytes + */ + int lo() const { return m_lo; } + /** + * Returns element offset in bytes + */ + int po() const { return m_po; } + + protected: + int m_rows; + int m_cols; + int m_lo; + int m_po; + char *m_ptr; + bool m_delete; + EType m_type; + KSMatrix( const QSMatrix& ); + void operator=(const QSMatrix& ); + }; + +//---------------------------------------------------------------------------------------------// + +/** + * Implementation of an ordinary matrix for different element types. + * It have not Q_OBJECT macro defined ( this is a tmeplate class ) + */ +template<class ELEMENT_TYPE> +class KSMatrixImpl : public KSMatrix { + public: + KSMatrixImpl( EType elementType ): KSMatrix( elementType ) {} + virtual ~KSMatrixImpl() {} + virtual double value( int row, int col ) { + assert( row >= 0 ); + assert( col >= 0 ); + assert( col < m_cols ); + assert( row < m_rows ); + return double( *(reinterpret_cast<ELEMENT_TYPE *>(m_ptr+row*m_lo+col*m_po)) ); + } + virtual void setValue( int row, int col, double value ) { + assert( row >= 0 ); + assert( col >= 0 ); + assert( col < m_cols ); + assert( row < m_rows ); + *(reinterpret_cast<ELEMENT_TYPE *>(m_ptr+row*m_lo+col*m_po)) = (ELEMENT_TYPE )value; + } + virtual int elementSize() const { return sizeof(ELEMENT_TYPE); } + + virtual void loadStateFromStream( QDataStream& stream, QSObjectFactory *factory ) + { + KSMatrix::loadStateFromStream( stream, factory ); + int new_rows; stream >> new_rows; + int new_cols; stream >> new_cols; + ELEMENT_TYPE value; + resize( new_rows, new_cols ); + for( int row=0; row<rows(); row++ ) for( int col=0; col<cols(); col++ ) { stream >> value; setValue( row, col, value ); } + } + virtual void saveStateToStream( QDataStream& stream, QSObjectFactory *factory ) + { + KSMatrix::saveStateToStream( stream, factory ); + stream << rows(); + stream << cols(); + for( int row=0; row<rows(); row++ ) for( int col=0; col<cols(); col++ ) stream << (ELEMENT_TYPE )value(row,col); + } + + protected: + KSMatrixImpl( const QSMatrix& ) {} + void operator=(const QSMatrix& ) {} + }; + + +//---------------------------------------------------------------------------------------------// + +/** + * Class which holds its internal data as strings, not as numbers. + */ +class KSMatrixString : public QSMatrix { + Q_OBJECT +public: + KSMatrixString(); + virtual ~KSMatrixString(); + virtual bool isEditable() const; + virtual bool isString() const; + virtual bool transpose(); + virtual void setValue( int row, int col, double value ); + virtual double value( int row, int col ); + virtual void setString( int row, int col, const QString& string ); + virtual QString string( int row, int col ); + virtual int rows() const; + virtual int cols() const; + bool resize( int rows, int cols ); + void setMatrix( QSMatrix *matrix ); + virtual void loadStateFromStream( QDataStream& stream, QSObjectFactory *factory ); + virtual void saveStateToStream( QDataStream& stream, QSObjectFactory *factory ); + +protected: + int m_rows; + int m_cols; + bool m_transposed; + QString *m_string_table; + }; + + + +//---------------------------------------------------------------------------------------------// + + +/** + * Points to the selected submatrix of the other matrix. + * It traces changes in the parent matrix. + * It is bound to the channel of QSData object, not to QSMatrix itself, because it + * needs change and delete notify. + */ +class KSMatrixRef : public QSMatrix { + Q_OBJECT +public: + KSMatrixRef(); + virtual ~KSMatrixRef(); + + QSData *refObject() const { return m_ref_object; } + int refChannel() const { return m_ref_channel; } + + int refColFrom() const { return m_ref_col_from; } + int refColStep() const { return m_ref_col_step; } + int refColTo() const { return m_ref_col_to; } + + int refRowFrom() const { return m_ref_row_from; } + int refRowStep() const { return m_ref_row_step; } + int refRowTo() const { return m_ref_row_to; } + + bool refTransposition() const { return m_transposition; } + virtual bool isReference() const { return true; } + virtual bool isEditable() const { return m_ref_editable; } + virtual bool isString() const { return m_ref_string; } + virtual void setValue( int row, int col, double value ); + virtual double value( int row, int col ); + virtual void setString( int row, int col, const QString& string ); + virtual QString string( int row, int col ); + virtual int rows() const { return m_rows; } + virtual int cols() const { return m_cols; } + +protected slots: + void reconnect( QSData *, int ); + void break_connection( QSData * ); + +protected: + void reconnect(); + void setRefObject( QSData *dataObject, int channel, + int rowFrom=0, int rowStep=1, int rowTo=-1, + int colFrom=0, int colStep=1, int colTo=-1, + bool transposition=false ); + QSMatrix *m_ref_matrix; + QSData *m_ref_object; + int m_ref_channel; + int m_ref_col_from; + int m_ref_col_step; + int m_ref_col_to; + int m_ref_row_from; + int m_ref_row_step; + int m_ref_row_to; + bool m_transposition; + int m_rows; + int m_cols; + int m_start_row; + int m_start_col; + bool m_in_loop; + bool m_ref_editable; + bool m_ref_string; + }; + +//-------------------------------------------------------------// +//-------------------------------------------------------------// +//-------------------------------------------------------------// +//-------------------------------------------------------------// + +class KSWorkbook; +/** + * Points to sheet cell range + */ +class KSMatrixWorksheetCellRange : public KSMatrixRef + { + Q_OBJECT + Q_PROPERTY( int worksheet READ worksheet WRITE setWorksheet ) + Q_PROPERTY( int rowFrom READ rowFrom WRITE setRowFrom ) + Q_PROPERTY( int colFrom READ colFrom WRITE setColFrom ) + Q_PROPERTY( int rowStep READ rowStep WRITE setRowStep ) + Q_PROPERTY( int colStep READ colStep WRITE setColStep ) + Q_PROPERTY( int rowTo READ rowTo WRITE setRowTo ) + Q_PROPERTY( int colTo READ colTo WRITE setColTo ) + Q_PROPERTY( bool transposition READ transposition WRITE setTransposition ) + public: + KSMatrixWorksheetCellRange( KSWorkbook *workbook ); + virtual ~KSMatrixWorksheetCellRange(); + virtual void setWorksheet( int index ); + virtual int worksheet() const; + /** + * Sets a range to contain a single column. + */ + void setColumn( int column ); + void setRowFrom( int row ); + void setColFrom( int col ); + void setRowStep( int step ); + void setColStep( int step ); + void setRowTo( int row ); + void setColTo( int col ); + int rowFrom() const { return refRowFrom(); } + int colFrom() const { return refColFrom(); } + int rowStep() const { return refRowStep(); } + int colStep() const { return refColStep(); } + int rowTo() const { return refRowTo(); } + int colTo() const { return refColTo(); } + void setTransposition( bool enabled ); + bool transposition() const { return refTransposition(); } + virtual bool transpose() { setTransposition(!transposition()); return true; } + virtual bool isReference() const { return true; } + virtual void loadStateFromStream( QDataStream& stream, QSObjectFactory *factory ); + virtual void saveStateToStream( QDataStream& stream, QSObjectFactory *factory ); + + protected: + KSWorkbook *m_workbook; + }; + + +//-------------------------------------------------------------// +//-------------------------------------------------------------// +//-------------------------------------------------------------// +//-------------------------------------------------------------// + +class MPError; +class MPFactoryList; +class KSMatrixFormula : public QSMatrix + { + Q_OBJECT + Q_PROPERTY( QString formula READ formula WRITE setFormula ); + Q_PROPERTY( bool transposition READ transposition WRITE setTransposition ); + + public: + /** + * Constructor + */ + KSMatrixFormula(); + /** + * Destructor + */ + virtual ~KSMatrixFormula(); + /** + * Sets a formula string. This function do nothing else. + * To calculate values you must use init() + */ + void setFormula( const QString& formula ); + /** + * Returns a formula string + */ + QString formula() const { return m_formula; } + /** + * Parses formula and calculates all values. + * FactoryList is not deleted in this function. + */ + bool init( MPError& error, MPFactoryList *locals = NULL ); + virtual bool isEditable() const { return false; } + virtual double value( int row, int col ); + virtual int rows() const { return m_rows; } + virtual int cols() const { return m_cols; } + virtual bool transpose(); + void setTransposition( bool enabled ); + bool transposition() const { return m_transposition; } + protected: + QString m_formula; + int m_rows; + int m_cols; + double *m_data; + int m_row_offset; + int m_col_offset; + bool m_transposition; + }; + +//-------------------------------------------------------------// +//-------------------------------------------------------------// +//-------------------------------------------------------------// +//-------------------------------------------------------------// + +/** + * Maps parser symbol to matrix. It is only immediately use. It does + * not delete matrix in destructor.. + */ +class MPSymQSMatrix : public MPSymbol + { + public: + /** + * Constructor + */ + MPSymQSMatrix( QSMatrix *matrix, MPSymbolList *args, int columnFrom, int columnTo, const char *id ); + /** + * Constructor. Range can be greater than matrix range. Outer values are filled with the last matrix value + */ + MPSymQSMatrix( QSMatrix *matrix, const QRect& range, MPSymbolList *args, int columnFrom, int columnTo, const char *id ); + /** + * Destructor + */ + virtual ~MPSymQSMatrix(); + virtual void checkArgs( MPError& error ); + virtual double value( int row, int col ); + virtual bool isVariable() const { return true; } + private: + QSMatrix *m_matrix; + int m_matrix_row_max; + int m_matrix_col_max; + QRect m_range; + }; + +#endif diff --git a/kmatplot/ksmatrixascii.cpp b/kmatplot/ksmatrixascii.cpp new file mode 100644 index 0000000..7070159 --- /dev/null +++ b/kmatplot/ksmatrixascii.cpp @@ -0,0 +1,192 @@ +/*************************************************************************** + ksmatrixascii.cpp + ------------------- + begin : Wed Feb 9 2000 + copyright : (C) 2000 by Kamil Dobkowski + email : kamildbk@friko.onet.pl + ***************************************************************************/ + +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + +#include "ksmatrixascii.h" +#include <qtextstream.h> +#include <qdatetime.h> +#include <qstring.h> +#include <qregexp.h> +#include <memory> + +//-------------------------------------------------------------------------// + +KSMatrixASCII::KSMatrixASCII() + { + } + +//-------------------------------------------------------------------------// + +KSMatrixASCII::~KSMatrixASCII() + { + } + +//-------------------------------------------------------------------------// + +bool KSMatrixASCII::check( QDataStream &is ) + { + KSMatrix *check = read_header(is); + if ( !check ) return false; + delete check; + return true; + } + +//-------------------------------------------------------------------------// + +KSHeadersList* KSMatrixASCII::headers( QDataStream& is ) + { + KSHeadersList *result = new KSHeadersList(); + KSMatrix *hdr = NULL; + int untitled_nr = 0; + while( (hdr=read_header(is)) ) { + QCString name = hdr->name(); + if ( name.isEmpty() ) hdr->setName( name.sprintf("untitled_%d",untitled_nr++) ); + result->push_back( hdr ); + } + + return result; + } + +//-------------------------------------------------------------------------// + +KSMatrix* KSMatrixASCII::load( QDataStream& is, const QString& matrixname ) + { + auto_ptr<KSMatrix> m; + + int untitled_nr = 0; + while ( !is.atEnd() ) { + int dataPos; + auto_ptr<KSMatrix> h(read_header(is,&dataPos)); + QCString name = h->name(); + if ( name.isEmpty() ) h->setName( name.sprintf("untitled_%d",untitled_nr++) ); + if ( QString(name) == matrixname ) { is.device()->at(dataPos); m = h; break; } + } + + if ( is.atEnd() ) return NULL; + + int rows = m->rows(); + int cols = m->cols(); + + // remember that header has data set to NULL while rows and cols are sot to non-zero + m->resize( 0, 0 ); + m->resize( rows, cols ); + + double value; + QString str; + QTextStream in(is.device()); + in.setEncoding( QTextStream::Latin1 ); + for( int row=0; row<rows; row++ ) { + str = in.readLine(); + QTextIStream line(&str); + for( int col=0; col<cols; col++ ) { + value = 0.0; line >> value; m->setValue( row, col, value ); + } + } + + return m.release(); + } + +//-------------------------------------------------------------------------// + +void KSMatrixASCII::save( QDataStream& os, QSMatrix *m, const QString& matrixname ) + { + QTextStream out(os.device()); + out.precision(9); + out.setEncoding( QTextStream::Latin1 ); + out << QString("# Created by "PACKAGE" "VERSION" ") + QDateTime::currentDateTime().toString() << endl; + out << "# name: " << matrixname << endl; + out << "# type: matrix" << endl; + out << "# rows: " << m->rows() << endl; + out << "# columns: " << m->cols() << endl; + + for( int row=0; row<m->rows(); row++ ) { + for( int col=0; col<m->cols(); col++ ) out << " " << m->value(row,col); + out << endl; + } + } + +//-------------------------------------------------------------------------// + +KSMatrix *KSMatrixASCII::read_header( QDataStream& is, int* data_pos ) + { + int pos = 0; + QString str; + QTextStream in(is.device()); + in.setEncoding( QTextStream::Latin1 ); + + // + // Search a name + // + QString name; + while( str.length() == 0 ) { + if ( in.device()->atEnd() ) return NULL; + pos = in.device()->at(); + str = in.readLine(); + str = str.simplifyWhiteSpace(); + if ( str[0] == '#' ) { + if ( str.left(7) == "# name:" ) { + int end = str.find( ' ', 8 ); + if ( end == -1 ) end = str.length()-1; + name = str.mid( 7, end-7+1 ); + } + str.truncate(0); + } + } + if ( data_pos ) *data_pos = pos; in.device()->at( pos ); + + int rows = -1; + int cols = -1; + + // + // try to determine a number of rows. + // + int cpos = 0; + int ppos = 0; + double value; + QTextIStream line(&str); + cpos = line.device()->at(); + do { + ppos = cpos; + line >> value; cols++; + cpos = line.device()->at(); + } while ( ppos != cpos ); + + // + // try to determine a number of columns. + // + QRegExp num("\\s*[\\+\\-\\.]?[0-9]+"); + do { + rows++; + pos = in.device()->at(); + str = in.readLine(); + } while ( num.match(str) == 0 ); + in.device()->at(pos); // move to the begining of the last line + + // + // Return a matrix header + // + if ( cols == 0 || rows == 0 ) return NULL; + + KSMatrix *result = KSMatrix::create(EDouble); + result->setName(name); + result->setRawData( NULL, rows, cols ); + + return result; + } + + + + diff --git a/kmatplot/ksmatrixascii.h b/kmatplot/ksmatrixascii.h new file mode 100644 index 0000000..24b50eb --- /dev/null +++ b/kmatplot/ksmatrixascii.h @@ -0,0 +1,56 @@ +/*************************************************************************** + ksmatrixascii.h + ------------------- + begin : Wed Feb 9 2000 + copyright : (C) 2000 by Kamil Dobkowski + email : kamildbk@friko.onet.pl + ***************************************************************************/ + +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + +#ifndef KSMATRIXASCII_H +#define KSMATRIXASCII_H + +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + +#include "ksmatrixiohandler.h" +#include <qstring.h> + +/** + * Imports matrices from ASCII text files. + * @author Kamil Dobkowski + */ + +class KSMatrixASCII : public KSMatrixIOHandler + { + public: + KSMatrixASCII(); + ~KSMatrixASCII(); + + bool check( QDataStream &is ); + KSHeadersList* headers( QDataStream& is ); + KSMatrix* load( QDataStream& is, const QString& matrixname ); + void save( QDataStream& os, QSMatrix *m, const QString& matrixname ); + + /** + * Returns "ASCII". + */ + virtual QString format() { return QString("ASCII"); } + + private: + + + KSMatrix *read_header( QDataStream& is, int* data_pos = NULL ); + + }; + +#endif diff --git a/kmatplot/ksmatrixeditor.cpp b/kmatplot/ksmatrixeditor.cpp new file mode 100644 index 0000000..87a4cb5 --- /dev/null +++ b/kmatplot/ksmatrixeditor.cpp @@ -0,0 +1,817 @@ +/*************************************************************************** + ksmatrixeditor.cpp + ------------------- + begin : + copyright : (C) 2001 by Kamil Dobkowski + email : kamildbk@friko.onet.pl + ***************************************************************************/ + +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + +#include "ksmatrixeditor.h" +#include "formula/mpformula.h" +#include "widgets/qsconsole.h" +#include "dialogs/kssheetdlgs.h" +#include "kscommands.h" +#include "ksworkbook.h" +#include "ksobjectfactory.h" +#include "ksdatasymbolfactory.h" +#include <qlineedit.h> +#include <qspinbox.h> +#include <qradiobutton.h> +#include <qstring.h> +#include <qcombobox.h> +#include <qmultilineedit.h> +#include <qapplication.h> +#include <qpopupmenu.h> +#include <qinputdialog.h> +#include <qmessagebox.h> +#include <qpainter.h> +#include <qcursor.h> + + +//--------------------------------------------------------------------// +//--------------------------------------------------------------------// +//--------------------------------------------------------------------// +//--------------------------------------------------------------------// + +KSMatrixEditor::KSMatrixEditor( KSWorkbook *workbook, QSMatrix *matrix, QWidget *parent ) +: QTable( matrix->rows(), matrix->cols(), parent ), KSMatrixEditorInterf() + { + m_workbook = workbook; + m_buffer = matrix; + m_editable = matrix->isEditable(); + m_reference = matrix->isReference(); + m_applying = false; + setSelectionMode( Single ); + //updateContents(); + + connect( this, SIGNAL(pressed(int,int,int,const QPoint&)), this, SLOT(slot_button_pressed(int,int,int,const QPoint&)) ); + } + +//--------------------------------------------------------------------// + +KSMatrixEditor::~KSMatrixEditor() + { + } + +//--------------------------------------------------------------------// + +void KSMatrixEditor::setSelectionRange( const QRect& rect ) + { + QTableSelection selection; + selection.init( rect.top(), rect.left() ); + selection.expandTo( rect.bottom(), rect.right() ); + clearSelection(); + if ( !rect.isEmpty() ) addSelection( selection ); + } + +//--------------------------------------------------------------------// + +QRect KSMatrixEditor::selectionRange() + { + QRect result; + if ( numSelections() ) { + QTableSelection sel = selection(0); + result.setLeft( QMAX( sel.leftCol(), 0 ) ); + result.setRight( QMIN( sel.rightCol(), m_buffer->cols()-1 ) ); + result.setTop( QMAX( sel.topRow(), 0 ) ); + result.setBottom( QMIN( sel.bottomRow(), m_buffer->rows()-1 ) ); + } + return result; + } + +//--------------------------------------------------------------------// + +void KSMatrixEditor::updateContents() + { + if ( m_applying ) return; + + setNumRows( m_buffer->rows() ); + setNumCols( m_buffer->cols() ); + QHeader *hh = horizontalHeader(); + QHeader *vh = verticalHeader(); + if ( m_buffer->rows() > 5000 ) vh->hide(); + if ( m_buffer->cols() > 5000 ) hh->hide(); + + if ( numRows() > 5000 ) vh->hide(); + else for ( int crow=0; crow<numRows(); crow++ ) if ( vh ) vh->setLabel( crow, QString::number(crow) ); + if ( numCols() > 5000 ) hh->hide(); + else for ( int ccol=0; ccol<numCols(); ccol++ ) if ( hh ) hh->setLabel( ccol, QString::number(ccol) ); + + //viewport()->update(); + } + +//--------------------------------------------------------------------// + +QPoint KSMatrixEditor::editorContentsPos() + { + return QPoint( contentsX(), contentsY() ); + } + +//--------------------------------------------------------------------// + +void KSMatrixEditor::setEditorContentsPos( const QPoint& pos ) + { + setContentsPos( pos.x(), pos.y() ); + } + +//--------------------------------------------------------------------// + +void KSMatrixEditor::setColumnTitles( const QStringList& list ) + { + QHeader *hh = horizontalHeader(); + for ( int ccol=0; ccol<(int )list.count(); ccol++ ) + if ( hh && ccol<numCols() ) hh->setLabel( ccol, hh->label(ccol)+" ("+list[ccol]+")" ); + } + +//--------------------------------------------------------------------// + +bool KSMatrixEditor::isValidCell( int row, int col ) const + { + return row < m_buffer->rows() && col < m_buffer->cols() && row >= 0 && col >= 0; + } + +//--------------------------------------------------------------------// + +QRect KSMatrixEditor::cellGeometry ( int row, int col ) const + { + return QTable::cellGeometry( row, col ); + } + +//--------------------------------------------------------------------// + +void KSMatrixEditor::paintCell( QPainter *p, int row, int col, const QRect & cr, bool selected ) + { + if ( isValidCell(row,col) ) { + QColor background = white; + QColor foreground = gray; + if ( m_editable ) foreground = black; + if ( m_reference ) foreground = blue; + if ( selected ) { + background = black; + foreground = white; + } + + QRect r = cr; + r.moveBy( -cr.x(), -cr.y() ); + p->fillRect( r, background ); + p->setPen( gray ); + p->drawLine( r.bottomLeft(), r.bottomRight() ); + p->drawLine( r.bottomRight(), r.topRight() ); + p->setPen( foreground ); + p->drawText( r, AlignRight | AlignVCenter, m_buffer->string(row,col)+" " ); + } + } + +//--------------------------------------------------------------------// + +QWidget* KSMatrixEditor::createEditor ( int row, int col, bool initFromCell ) const + { + if ( isValidCell(row,col) && m_editable ) { + return new QLineEdit( initFromCell ? m_buffer->string(row,col) : QString::null, const_cast<KSMatrixEditor*>(this) ); + } + + return NULL; + } + +//--------------------------------------------------------------------// + +void KSMatrixEditor::setCellContentFromEditor ( int row, int col ) + {; + if ( isValidCell(row,col) ) { + QLineEdit *e = dynamic_cast<QLineEdit*>(cellWidget(row,col)); + if ( e && e->text() != m_buffer->string(row,col) ) { + m_applying = true; + m_workbook->execute( new KSCmdChangeValue( m_buffer,row,col,e->text() ) ); + m_applying = false; + } + } + updateCell( row, col ); + } + +//--------------------------------------------------------------------// + +void KSMatrixEditor::endEdit ( int row, int col, bool accept, bool ) + { + QTable::endEdit ( row, col, accept, FALSE ); + } + +//--------------------------------------------------------------------// + +void KSMatrixEditor::setItem ( int , int , QTableItem * ) + { + } + +//--------------------------------------------------------------------// + +QTableItem* KSMatrixEditor::item( int, int ) const + { + return NULL; + } + +//--------------------------------------------------------------------// + +void KSMatrixEditor::resizeData ( int ) + { + } + +//--------------------------------------------------------------------// + +QWidget *KSMatrixEditor::widget() + { + return this; + } + +//--------------------------------------------------------------------// + +void KSMatrixEditor::insertWidget( int row, int col, QWidget *w ) + { + QTable::insertWidget(row,col,w); + } + +//--------------------------------------------------------------------// + +QWidget *KSMatrixEditor::cellWidget( int row, int col ) const + { + return QTable::cellWidget(row,col); + } + +//--------------------------------------------------------------------// + +void KSMatrixEditor::clearCellWidget( int row, int col ) + { + QTable::clearCellWidget(row,col); + } + +//--------------------------------------------------------------------// + +void KSMatrixEditor::paintEmptyArea ( QPainter *, int, int, int, int ) + { + } +//--------------------------------------------------------------------// + +void KSMatrixEditor::slot_button_pressed( int, int, int button, const QPoint& ) + { + if ( button == RightButton ) { + QPopupMenu *menu = new QPopupMenu( this ); + int copy_id = menu->insertItem( tr("Copy") ); + int paste_id = menu->insertItem( tr("Paste") ); + menu->insertSeparator(); + + int select_range_id = menu->insertItem( tr("Select range") ); + int statistics_id = menu->insertItem( tr("Statistics") ); + menu->insertSeparator(); + + QPopupMenu *range_menu = new QPopupMenu( menu ); + int menu_fill_range_id = menu->insertItem( tr("Fill selected range"), range_menu ); + int range_value_id = range_menu->insertItem( tr("Value") ); + int range_formula_id = range_menu->insertItem( tr("Formula") ); + int range_uniform_id = range_menu->insertItem( tr("Uniform deviated random numbers") ); + int rows_sequence_id = range_menu->insertItem( tr("Fill rows by monotone sequence") ); + int cols_sequence_id = range_menu->insertItem( tr("Fill cols by monotone sequence") ); + + QPopupMenu *insert_menu = new QPopupMenu( menu ); + int menu_insert_id = menu->insertItem( tr("Insert"), insert_menu ); + int insert_row_before_id = insert_menu->insertItem( tr("Insert row before") ); + int insert_row_after_id = insert_menu->insertItem( tr("Insert row after") ); + int insert_col_before_id = insert_menu->insertItem( tr("Insert column before") ); + int insert_col_after_id = insert_menu->insertItem( tr("Insert column after") ); + + QPopupMenu *remove_menu = new QPopupMenu( menu ); + int menu_remove_id = menu->insertItem( tr("Remove"), remove_menu ); + int remove_rows_id = remove_menu->insertItem( tr("Selected rows") ); + int remove_cols_id = remove_menu->insertItem( tr("Selected cols") ); + + if ( selectionRange().isEmpty() ) { + menu->setItemEnabled( copy_id, false ); + menu->setItemEnabled( paste_id, false ); + menu->setItemEnabled( statistics_id, false ); + menu->setItemEnabled( menu_fill_range_id, false ); + menu->setItemEnabled( rows_sequence_id, false ); + menu->setItemEnabled( cols_sequence_id, false ); + menu->setItemEnabled( menu_insert_id, false ); + menu->setItemEnabled( menu_remove_id, false ); + } + + int item_id = menu->exec(QCursor::pos()); + delete menu; + + if ( item_id == copy_id ) { + slotCopy(); + } + else if ( item_id == paste_id ) { + slotPaste(); + } + else if ( item_id == statistics_id ) { + slotStatistics(); + } + else if ( item_id == select_range_id ) { + slotSelectRange(); + } + else if ( item_id == range_value_id ) { + slotFillRangeWithValue(); + } + else if ( item_id == range_formula_id ) { + slotFillRangeWithFormula(); + } + else if ( item_id == range_uniform_id ) { + slotFillRangeWithUniformNoise(); + } + else if ( item_id == rows_sequence_id ) { + slotFillRowsMonotone(); + } + else if ( item_id == cols_sequence_id ) { + slotFillColsMonotone(); + } + else if ( item_id == insert_row_before_id ) { + slotInsertRowBefore(); + } + else if ( item_id == insert_row_after_id ) { + slotInsertRowAfter(); + } + else if ( item_id == insert_col_before_id ) { + slotInsertColBefore(); + } + else if ( item_id == insert_col_after_id ) { + slotInsertColAfter(); + } + else if ( item_id == remove_rows_id ) { + slotRemoveRows(); + } + else if ( item_id == remove_cols_id ) { + slotRemoveCols(); + } + } + } + +//--------------------------------------------------------------------// + +void KSMatrixEditor::slotCopy() + { + QRect sel = selectionRange(); + if ( !sel.isEmpty() ) { + KSObjectFactory factory( m_workbook ); + QSMatrix *selection = factory.cloneMatrix( m_buffer, false ); + selection->resize( sel.height(), sel.width() ); + selection->copyRange( 0, 0, m_buffer, sel.top(), sel.left(), sel.bottom(), sel.right() ); + factory.copyQSMatrixToClipboard( selection ); + delete selection; + } + } + +//--------------------------------------------------------------------// + +void KSMatrixEditor::slotPaste() + { + QRect sel = selectionRange(); + if ( !sel.isEmpty() ) { + KSObjectFactory factory( m_workbook ); + QSMatrix *clipboard_data = factory.pasteQSMatrixFromClipboard(); + if ( clipboard_data ) { + KSCmdChangeData *cmd = new KSCmdChangeData( m_buffer, sel.top(), sel.left(), sel.bottom(), sel.right() ); + m_buffer->copyRange( sel.top(), sel.left(), clipboard_data, 0, 0, QMIN(clipboard_data->rows()-1,sel.height()-1), QMIN(clipboard_data->cols()-1,sel.width()-1) ); + delete clipboard_data; + m_workbook->execute( cmd ); + } + } + + } + +//--------------------------------------------------------------------// + +bool KSMatrixEditor::isFilledSelectedCell( int row, int col ) + { + return isSelected(row,col) && ( !m_buffer->isString() || !m_buffer->string(row,col).isEmpty() ); + } + +//--------------------------------------------------------------------// + +void KSMatrixEditor::slotStatistics() +// put statistics into a separate class some day + { + int p_cells = 0; + + QRect sel = selectionRange(); + if ( sel.isEmpty() ) return; + + //////////////////////////////////////////// + // find min, max, mean, geometrical mean // + //////////////////////////////////////////// + double p_min; + double p_max; + double p_sum = 0.0; + double p_product = 1.0; + for( int row=sel.top(); row<=sel.bottom(); row++ ) + for( int col=sel.left(); col<=sel.right(); col ++ ) if ( isFilledSelectedCell(row,col) ) { + double value = m_buffer->value(row,col); + p_cells = p_cells+1; + if ( p_cells == 1 ) p_min = p_max = value; + p_product *= value; + p_sum = p_sum + value; + p_min = QMIN( p_min, value ); + p_max = QMAX( p_max, value ); + } + double p_mean = p_sum/p_cells; + double p_geom_mean = pow( p_product, 1.0/p_cells ); + + ////////////////////////////////////////////////////////// + // find variance, standard deviation, average deviation // + ////////////////////////////////////////////////////////// + double p_dev_sum_sqrt = 0.0; + double p_dev_sum_abs = 0.0; + for( int row=sel.top(); row<=sel.bottom(); row++ ) + for( int col=sel.left(); col<=sel.right(); col ++ ) if ( isFilledSelectedCell(row,col) ) { + double value = m_buffer->value(row,col); + p_dev_sum_sqrt += (value-p_mean)*(value-p_mean); + p_dev_sum_abs += fabs(value-p_mean); + } + + double p_variance = p_dev_sum_sqrt / QMAX(p_cells-1.0,1.0); + double p_avg_dev = p_dev_sum_abs / p_cells; + double p_std_dev = sqrt(p_variance); + + ////////////////////////////////////////////////////////// + // find skewness // + ////////////////////////////////////////////////////////// + double p_dev_sum_third = 0.0; + if ( p_std_dev != 0.0 ) + for( int row=sel.top(); row<=sel.bottom(); row++ ) + for( int col=sel.left(); col<=sel.right(); col ++ ) if ( isFilledSelectedCell(row,col) ) { + double value = m_buffer->value(row,col); + p_dev_sum_third += pow( (value-p_mean)/p_std_dev, 3.0 ); + } + double p_skewness = p_dev_sum_third/p_cells; + + if ( p_cells > 0 ) { + QString info; + info += "<table border=1 cellspacing=1>"; + info += tr("<tr><td> Numbers count </td><td>%1</td></tr>").arg(p_cells); + info += tr("<tr><td> Minimum </td><td> %1 </td></tr> ").arg(p_min,0,'g',9); + info += tr("<tr><td> Maximum </td><td> %1 </td></tr>").arg(p_max,0,'g',9); + info += tr("<tr><td> Sum </td><td> %1 </td></tr>").arg(p_sum,0,'g',9); + info += tr("<tr><td> Product </td><td> %1 </td></tr>").arg(p_product,0,'g',9); + info += tr("<tr><td> Geometrical mean </td><td> %1 </td></tr>").arg(p_geom_mean,0,'g',9); + info += tr("<tr><td> Mean </td><td> %1 </td></tr>").arg(p_mean,0,'g',9); + info += tr("<tr><td> Variance </td><td> %1 </td></tr>").arg(p_variance,0,'g',9); + info += tr("<tr><td> Standard deviation </td><td> %1 </td></tr>").arg(p_std_dev,0,'g',9); + info += tr("<tr><td> Average deviation = 1/N * SUM[ABS(Xn-Xmean)] </td><td> %1 </td></tr>").arg(p_avg_dev,0,'g',9); + info += tr("<tr><td> Skewness </td><td> %1 </td></tr>").arg(p_skewness,0,'g',9); + info += "</table>"; + + QMessageBox::information( NULL, " Statistics of selected cells : ", info ); + QSConsole::write( info ); + } + } + + /* + info += tr(" Numbers count: %1 \n").arg(p_cells); + info += tr(" Minimum : %1 \n").arg(p_min,0,'g',9); + info += tr(" Maximum : %1 \n").arg(p_max,0,'g',9); + info += tr(" Sum : %1 \n").arg(p_sum,0,'g',9); + info += tr(" Product : %1 \n").arg(p_product,0,'g',9); + info += tr(" Geometrical mean : %1 \n").arg(p_geom_mean,0,'g',9); + info += "\n"; + info += tr(" Mean : %1 \n").arg(p_mean,0,'g',9); + info += tr(" Variance : %1 \n").arg(p_variance,0,'g',9); + info += tr(" Standard deviation : %1 \n").arg(p_std_dev,0,'g',9); + info += tr(" Average deviation = 1/N * SUM[ABS(Xn-Xmean)] : %1 \n").arg(p_avg_dev,0,'g',9); + info += tr(" Skewness : %1 \n").arg(p_skewness,0,'g',9); + QMessageBox::information( NULL, " Statistics of selected cells : ", info ); + */ +//--------------------------------------------------------------------// + +void KSMatrixEditor::slotSelectRange() + { + KSSheetDlgCellRange dlg( this ); + if ( dlg.exec() == QDialog::Accepted ) { + QTableSelection selection; + selection.init( dlg.rowFrom->value(), dlg.colFrom->value() ); + selection.expandTo( dlg.rowTo->value(), dlg.colTo->value() ); + addSelection( selection ); + } + } + +//--------------------------------------------------------------------// + +void KSMatrixEditor::slotFillRangeWithValue() + { + bool isOK = false; + QString value = QInputDialog::getText( tr( "Fill selection with value" ), tr( "Enter value: " ), QLineEdit::Normal, QString::null, &isOK, this ); + QRect sel = selectionRange(); + if ( isOK && !sel.isEmpty() ) { + KSCmdChangeData *cmd = new KSCmdChangeData( m_buffer, sel.top(), sel.left(), sel.bottom(), sel.right() ); + for( int row=sel.top(); row<=sel.bottom(); row++ ) + for( int col=sel.left(); col<=sel.right(); col++ ) { + m_buffer->setString( row, col, value ); + } + m_applying = true; + m_workbook->execute( cmd ); + m_applying = false; + //viewport()->update(); + } + } + +//--------------------------------------------------------------------// + +void KSMatrixEditor::slotFillRangeWithFormula() + { + bool isOK = false; + QString formula_string = QInputDialog::getText( tr( "Fill selection with formula" ), "selection=", QLineEdit::Normal, QString::null, &isOK, this ); + QRect sel = selectionRange(); + if ( isOK && !sel.isEmpty() ) { + + // local variables + KSDataSymbolFactory *locals = new KSDataSymbolFactory( m_workbook, m_buffer->dataObject() ); + locals->setSelection( m_buffer, sel ); + + MPFormula f; + MPFormulaError error; + MPFactoryList factory( locals ); + MPSymbol *expr = f.parse( formula_string, error, &factory ); + if ( expr ) { + KSCmdChangeData *cmd = new KSCmdChangeData( m_buffer, sel.top(), sel.left(), sel.bottom(), sel.right() ); + for( int row=sel.top(); row<=sel.bottom(); row++ ) + for( int col=sel.left(); col<=sel.right(); col++ ) { + int expr_row = row - sel.top(); + int expr_col = col - sel.left(); + if ( expr_col < expr->cols() && + expr_row < expr->rows() || + expr->isScalar() ) { + m_buffer->setValue( row, col, expr->value( expr_row, expr_col ) ); + } + } + m_applying = true; + m_workbook->execute( cmd ); + m_applying = false; + //viewport()->update(); + delete expr; + } else { + QMessageBox::critical( NULL, tr("Error"), error.message(), QMessageBox::Ok, 0 ); + } + } + } +//--------------------------------------------------------------------// + +void KSMatrixEditor::slotFillRangeWithUniformNoise() + { + KSSheetDlgValueRange dlg( this ); + dlg.setMinValue( 0.0 ); + dlg.setMaxValue( 1.0 ); + QRect sel = selectionRange(); + if ( dlg.exec() == QDialog::Accepted && !sel.isEmpty() ) { + double min_value = dlg.minValue(); + double max_value = dlg.maxValue(); + KSCmdChangeData *cmd = new KSCmdChangeData( m_buffer, sel.top(), sel.left(), sel.bottom(), sel.right() ); + for( int row=sel.top(); row<=sel.bottom(); row++ ) + for( int col=sel.left(); col<=sel.right(); col++ ) { + m_buffer->setValue(row,col,min_value+double(rand())/(RAND_MAX+1.0)*(max_value-min_value)); + } + m_applying = true; + m_workbook->execute( cmd ); + m_applying = false; + //viewport()->update(); + } + } + +//--------------------------------------------------------------------// + +void KSMatrixEditor::slotFillRowsMonotone() + { + KSSheetDlgSequence dlg( this ); + QRect sel = selectionRange(); + if ( dlg.exec() == QDialog::Accepted && !sel.isEmpty() ) { + int elements = sel.right() - sel.left() + 1; + double start_value = dlg.from(); + double step_value = dlg.useStep() ? dlg.to() : (dlg.to()-dlg.from())/(elements-1.0); + + KSCmdChangeData *cmd = new KSCmdChangeData( m_buffer, sel.top(), sel.left(), sel.bottom(), sel.right() ); + + for( int row=sel.top(); row<=sel.bottom(); row++ ) { + double curr_value = start_value; + if ( !dlg.reversedDirection() ) { + for( int col=sel.left(); col<=sel.right(); col++, curr_value+=step_value ) + if ( isValidCell(row,col) ) m_buffer->setValue(row,col,curr_value); + } else { + for( int col=sel.right(); col>=sel.left(); col--, curr_value+=step_value ) + if ( isValidCell(row,col) ) m_buffer->setValue(row,col,curr_value); + } + } + m_applying = true; + m_workbook->execute( cmd ); + m_applying = false; + //viewport()->update(); + } + } + +//--------------------------------------------------------------------// + +void KSMatrixEditor::slotFillColsMonotone() + { + KSSheetDlgSequence dlg( this ); + QRect sel = selectionRange(); + if ( dlg.exec() == QDialog::Accepted && !sel.isEmpty() ) { + KSCmdChangeData *cmd = new KSCmdChangeData( m_buffer, sel.top(), sel.left(), sel.bottom(), sel.right() ); + int elements = sel.bottom() - sel.top() + 1; + double start_value = dlg.from(); + double step_value = dlg.useStep() ? dlg.to() : (dlg.to()-dlg.from())/(elements-1.0); + for( int col=sel.left(); col<=sel.right(); col++ ) { + double curr_value = start_value; + if ( !dlg.reversedDirection() ) { + for( int row=sel.top(); row<=sel.bottom(); row++, curr_value+=step_value ) + if ( isValidCell(row,col) ) m_buffer->setValue(row,col,curr_value); + } else { + for( int row=sel.bottom(); row>=sel.top(); row--, curr_value+=step_value ) + if ( isValidCell(row,col) ) m_buffer->setValue(row,col,curr_value); + } + } + m_applying = true; + m_workbook->execute( cmd ); + m_applying = false; + //viewport()->update(); + } + } + +//--------------------------------------------------------------------// + +void KSMatrixEditor::slotInsertRowBefore() + { + QRect sel = selectionRange(); + if ( sel.width() == m_buffer->cols() ) { + m_workbook->execute( new KSCmdInsertRow( m_buffer, sel.top() ) ); + } + } + +//--------------------------------------------------------------------// + +void KSMatrixEditor::slotInsertRowAfter() + { + QRect sel = selectionRange(); + if ( sel.width() == m_buffer->cols() ) { + m_workbook->execute( new KSCmdInsertRow( m_buffer, sel.bottom()+1 ) ); + } + } + +//--------------------------------------------------------------------// + +void KSMatrixEditor::slotInsertColBefore() + { + QRect sel = selectionRange(); + if ( sel.height() == m_buffer->rows() ) { + m_workbook->execute( new KSCmdInsertCol( m_buffer, sel.left() ) ); + } + } + + //--------------------------------------------------------------------// + +void KSMatrixEditor::slotInsertColAfter() + { + QRect sel = selectionRange(); + if ( sel.height() == m_buffer->rows() ) { + m_workbook->execute( new KSCmdInsertCol( m_buffer, sel.right()+1 ) ); + } + } + +//--------------------------------------------------------------------// + +void KSMatrixEditor::slotRemoveRows() +// TODO : end edit + { + QRect sel = selectionRange(); + if ( sel.width() == m_buffer->cols() ) { + m_workbook->execute( new KSCmdRemoveRows( m_buffer, sel.top(), sel.bottom() ) ); + } + } + +//--------------------------------------------------------------------// + +void KSMatrixEditor::slotRemoveCols() +// TODO :: end edit + { + QRect sel = selectionRange(); + if ( sel.height() == m_buffer->rows() ) { + m_workbook->execute( new KSCmdRemoveCols( m_buffer, sel.left(), sel.right() ) ); + } + } + + +//--------------------------------------------------------------------// +//--------------------------------------------------------------------// +//--------------------------------------------------------------------// +//--------------------------------------------------------------------// +//--------------------------------------------------------------------// +//--------------------------------------------------------------------// + + +KSMatrixSheetEditor::KSMatrixSheetEditor( KSWorkbook *workbook, KSSheet *sheet, QWidget *parent ) +: KSMatrixEditor( workbook, sheet->matrix(0), parent ) + { + m_sheet = sheet; + horizontalHeader()->installEventFilter( this ); + } + +//--------------------------------------------------------------------// + +KSMatrixSheetEditor::~KSMatrixSheetEditor() + { + } + +//--------------------------------------------------------------------// + +void KSMatrixSheetEditor::updateContents() + { + if ( m_applying ) return; + KSMatrixEditor::updateContents(); + makeHeaders(); + } + +//--------------------------------------------------------------------// + +bool KSMatrixSheetEditor::eventFilter ( QObject *o, QEvent *e ) + { + if ( o == horizontalHeader() && e->type() == QEvent::MouseButtonDblClick ) { + int x = static_cast<QMouseEvent*>(e)->pos().x()+contentsX(); + headerDoubleClick( columnAt(x) ); + return TRUE; + } + return KSMatrixEditor::eventFilter( o, e ); + } + +//--------------------------------------------------------------------// + +void KSMatrixSheetEditor::headerDoubleClick( int column ) + { + KSSheetDlgColData dlg( this, m_sheet, column, 1, column ); + if ( dlg.exec() == QDialog::Accepted ) { + dlg.apply(); + makeHeaders(); + } + } + +//--------------------------------------------------------------------// + +void KSMatrixSheetEditor::makeHeaders() + { + QHeader *hh = horizontalHeader(); + if ( numCols() > 5000 ) hh->hide(); else for ( int ccol=0; ccol<numCols(); ccol++ ) if ( hh ) hh->setLabel( ccol, QString::number(ccol) ); + const KSSheet::ColumnInfo *headers; + KSSheet::ColumnInfo::ConstIterator curr; + headers = m_sheet->columnInfo(); + for( curr = headers->begin(); curr != headers->end(); ++curr ) { + QString col_type; + switch( curr.data().type ) { + case KSSheet::ColumnX: col_type=" (X)"; break; + case KSSheet::ColumnY: col_type=" (Y)"; break; + case KSSheet::ColumnZ: col_type=" (Z)"; break; + case KSSheet::ColumnV: col_type=" (V)"; break; + case KSSheet::ColumnDX: col_type=" (DX)"; break; + case KSSheet::ColumnDY: col_type=" (DY)"; break; + default: break; + } + QString title = hh->label(curr.key())+col_type; + if ( !curr.data().title.isEmpty() ) title += " - "+curr.data().title; + hh->setLabel( curr.key(), title ); + } + } + +//--------------------------------------------------------------------// + +void KSMatrixSheetEditor::slotInsertColBefore() + { + QRect sel = selectionRange(); + if ( sel.height() == m_buffer->rows() ) { + m_workbook->execute( new KSCmdInsertSheetCol( m_sheet, sel.left() ) ); + } + } + + //--------------------------------------------------------------------// + +void KSMatrixSheetEditor::slotInsertColAfter() + { + QRect sel = selectionRange(); + if ( sel.height() == m_buffer->rows() ) { + m_workbook->execute( new KSCmdInsertSheetCol( m_sheet, sel.right()+1 ) ); + } + } + +//--------------------------------------------------------------------// + +void KSMatrixSheetEditor::slotRemoveCols() +// TODO :: end edit + { + QRect sel = selectionRange(); + if ( sel.height() == m_buffer->rows() ) { + m_workbook->execute( new KSCmdRemoveSheetCols( m_sheet, sel.left(), sel.right() ) ); + } + } + + + + diff --git a/kmatplot/ksmatrixeditor.h b/kmatplot/ksmatrixeditor.h new file mode 100644 index 0000000..70f5207 --- /dev/null +++ b/kmatplot/ksmatrixeditor.h @@ -0,0 +1,142 @@ +/*************************************************************************** + ksmatrixeditor.h + ------------------- + begin : + copyright : (C) 2001 by Kamil Dobkowski + email : kamildbk@friko.onet.pl + ***************************************************************************/ + +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + +#ifndef KSMATRIXEDITOR_H +#define KSMATRIXEDITOR_H + +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + +#include <qtable.h> +#include <qlabel.h> +#include <qlineedit.h> +#include <qcheckbox.h> +#include "ksmatrix.h" +#include "ksglobalmatrixlist.h" + +/** + * Base interface for matrix editors. It is an interface and not a base class + * because QtDesigner cant generate dialogs which inherits from custom classes. + */ +class KSMatrixEditorInterf { + public: + KSMatrixEditorInterf() {} + virtual ~KSMatrixEditorInterf() {} + virtual void setColumnTitles( const QStringList& ) {} + virtual QPoint editorContentsPos() { return QPoint(); } + virtual void setEditorContentsPos( const QPoint& ) {} + virtual void setSelectionRange( const QRect& rect ) {} + virtual QRect selectionRange() { return QRect(); } + virtual void updateContents() {} + virtual QSMatrix *editedMatrix() { return NULL; } + virtual QWidget *widget() = 0; + }; + + +//--------------------------------------------------------------------------------------------------// + +class KSWorkbook; +/** + * Generic, fast matrix editor based on QTable. + * @author Kamil Dobkowski + */ +class KSMatrixEditor : public QTable, public KSMatrixEditorInterf { + Q_OBJECT + public: + KSMatrixEditor( KSWorkbook *workbook, QSMatrix *matrix, QWidget *parent ); + virtual ~KSMatrixEditor(); + virtual void setSelectionRange( const QRect& rect ); + virtual QRect selectionRange(); + virtual void updateContents(); + virtual QSMatrix *editedMatrix() { return m_buffer; } + virtual QPoint editorContentsPos(); + virtual void setEditorContentsPos( const QPoint& pos ); + virtual void setColumnTitles( const QStringList& list ); + virtual QWidget *widget(); + + virtual void setItem ( int row, int col, QTableItem * item ); + virtual QTableItem* item ( int row, int col ) const; + virtual void paintCell( QPainter *p, int row, int col, const QRect & cr, bool selected ); + virtual QRect cellGeometry ( int row, int col ) const; + + public slots: + virtual void slotCopy(); + virtual void slotPaste(); + virtual void slotSelectRange(); + virtual void slotFillRangeWithValue(); + virtual void slotFillRangeWithFormula(); + virtual void slotFillRangeWithUniformNoise(); + virtual void slotFillRowsMonotone(); + virtual void slotFillColsMonotone(); + virtual void slotInsertRowBefore(); + virtual void slotInsertRowAfter(); + virtual void slotInsertColBefore(); + virtual void slotInsertColAfter(); + virtual void slotRemoveRows(); + virtual void slotRemoveCols(); + virtual void slotStatistics(); + + protected slots: + void slot_button_pressed( int row, int col, int button, const QPoint& pos ); + + protected: + bool isFilledSelectedCell( int row, int col ); + + virtual void resizeData ( int len ); + virtual QWidget* createEditor ( int row, int col, bool initFromCell ) const; + virtual void setCellContentFromEditor ( int row, int col ); + virtual void endEdit ( int row, int col, bool accept, bool replace ); + virtual void paintEmptyArea ( QPainter * p, int cx, int cy, int cw, int ch ); + virtual bool isValidCell( int row, int col ) const; + virtual void insertWidget ( int row, int col, QWidget * w ); + virtual QWidget *cellWidget ( int row, int col ) const; + virtual void clearCellWidget ( int row, int col ); + + QSMatrix *m_buffer; + KSWorkbook *m_workbook; + bool m_reference; + bool m_editable; + bool m_applying; + }; + +//--------------------------------------------------------------------------------------------------// + +/** + * Adds editing column types and titles to the generic matrix editor. + * @author Kamil Dobkowski + */ +class KSMatrixSheetEditor : public KSMatrixEditor { + Q_OBJECT + public: + KSMatrixSheetEditor( KSWorkbook *workbook, KSSheet *sheet, QWidget *parent ); + virtual ~KSMatrixSheetEditor(); + virtual bool eventFilter ( QObject *o, QEvent *e ); + virtual void updateContents(); + public slots: + virtual void slotInsertColBefore(); + virtual void slotInsertColAfter(); + virtual void slotRemoveCols(); + protected: + void headerDoubleClick( int column ); + void makeHeaders(); + KSSheet *m_sheet; + }; + + + +#endif diff --git a/kmatplot/ksmatrixio.cpp b/kmatplot/ksmatrixio.cpp new file mode 100644 index 0000000..cf410e1 --- /dev/null +++ b/kmatplot/ksmatrixio.cpp @@ -0,0 +1,207 @@ +/*************************************************************************** + ksmatrixio.cpp + ------------------- + begin : 01-January-2000 + copyright : (C) 2000 by Kamil Dobkowski + email : kamildobk@poczta.onet.pl + ***************************************************************************/ + +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + + +#include "ksmatrixio.h" +#include "ksmatrixiohandler.h" +#include "ksmatrixmat.h" +#include "ksmatrixascii.h" + +KSHandlersList KSMatrixIO::hlist; +bool KSMatrixIO::initialized = false; + +//-------------------------------------------------------------------------// + +KSMatrixIO::KSMatrixIO( const QString& filename, int mode ) + { + if ( !initialized ) { + // initialize a file format list + addHandler( new KSMatrixMAT() ); + addHandler( new KSMatrixASCII() ); + initialized = true; + } + if ( !filename.isNull() ) openFile( filename, mode ); + } + +//-------------------------------------------------------------------------// + +KSMatrixIO::~KSMatrixIO() + { + closeFile(); + } + +//-------------------------------------------------------------------------// + +void KSMatrixIO::setDefaultHandler() + { + KSMatrixIOHandler *dhandler; + if ( !file.isReadable() ) { dformat = QString(); return; } + QDataStream s( &file ); + dhandler = findHandler( s, file.name() ); + if ( dhandler ) dformat = dhandler->format(); + else dformat = QString(); + } + +//-------------------------------------------------------------------------// + +void KSMatrixIO::openFile( const QString& filename, int mode ) + { + // close a previously opened file. + closeFile(); + file.setName( filename ); + if( file.open(mode) ) { + setDefaultHandler(); + file.resetStatus(); + file.reset(); + } else { + file.setName(QString()); + dformat = QString(); + } + } + +//-------------------------------------------------------------------------// + +void KSMatrixIO::closeFile() + { + file.close(); + file.setName(QString()); + dformat = QString(); + } + +//-------------------------------------------------------------------------// + +KSHeadersList *KSMatrixIO::loadHeaders( const QString& format ) + { + if ( !file.isOpen() ) return NULL; + KSMatrixIOHandler *handler; + QDataStream s(&file); + if ( !format.isNull() ) handler = findHandler( format ); + else if ( !dformat.isNull() ) handler = findHandler( dformat ); + else handler = findHandler( s, file.name() ); + if ( !handler ) return NULL; + file.resetStatus(); file.reset(); + return handler->headers(s); + } + +//-------------------------------------------------------------------------// + +KSMatrix *KSMatrixIO::loadMatrix( const QString& matrixname, const QString& format ) + { + if ( !file.isOpen() ) return NULL; + KSMatrixIOHandler *handler; + QDataStream s(&file); + if ( !format.isNull() ) handler = findHandler( format ); + else if ( !dformat.isNull() ) handler = findHandler( dformat ); + else handler = findHandler( s, file.name() ); + if ( !handler ) return NULL; + file.resetStatus(); file.reset(); + return handler->load( s, matrixname ); + } + +//-------------------------------------------------------------------------// + +void KSMatrixIO::saveMatrix( QSMatrix *m, const QString& matrixname, const QString& format ) + { + if ( !file.isOpen() ) return; + emit progress(0); + QDataStream s(&file); + KSMatrixIOHandler *handler = findHandler( format ); + if ( handler ) handler->save( s, m, matrixname ); + } + +//-------------------------------------------------------------------------// + +KSMatrixIOHandler *KSMatrixIO::findHandler( QDataStream& s, const QString& ) + { + KSHandlersList::iterator curr = hlist.begin(); + KSHandlersList::iterator last = hlist.end(); + s.device()->resetStatus(); s.device()->reset(); + while ( curr != last ) { + if ( (*curr)->check(s) ) break; + s.device()->resetStatus(); s.device()->reset(); + curr++; + } + + if ( curr != last ) return (*curr); + return NULL; + } + +//-------------------------------------------------------------------------// + +KSMatrixIOHandler *KSMatrixIO::findHandler( const QString& format ) + { + KSHandlersList::iterator curr = hlist.begin(); + KSHandlersList::iterator last = hlist.end(); + while ( curr != last ) { + if ( (*curr)->format() == format ) break; + curr++; + } + if ( curr != last ) return (*curr); + return NULL; + } + +//-------------------------------------------------------------------------// + +void KSMatrixIO::addHandler( KSMatrixIOHandler *handler ) + { + if ( handler ) hlist.push_back( handler ); + } + +//-------------------------------------------------------------------------// + +int KSMatrixIO::removeHandlers( const QString& format ) + { + KSHandlersList::iterator curr = hlist.begin(); + KSHandlersList::iterator last = hlist.end(); + + int result = 0; + while( curr != last ) { + if ( (*curr)->format() == format ) { + KSHandlersList::iterator last = curr; curr++; + hlist.erase( last ); result ++; + } else curr ++; + } + return result; + } + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/kmatplot/ksmatrixio.h b/kmatplot/ksmatrixio.h new file mode 100644 index 0000000..aeaa8cc --- /dev/null +++ b/kmatplot/ksmatrixio.h @@ -0,0 +1,177 @@ +/*************************************************************************** + ksmatrixio.h + ------------------- + begin : 01-January-2000 + copyright : (C) 2000 by Kamil Dobkowski + email : kamildobk@poczta.onet.pl + ***************************************************************************/ + +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + + +#ifndef KSMATRIXIO_H +#define KSMATRIXIO_H + +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + +#include"ksmatrix.h" +#include"ksmatrixiohandler.h" +#include<list.h> +#include<qstring.h> +#include<qdatastream.h> +#include<qfile.h> + + +/** + * List of matrix IO handlers - see KSMatrixIO::hlist + */ +typedef list<KSMatrixIOHandler *> KSHandlersList; + +/** + * Matix loading/saving class. This class loads matrices from files using handlers. + * Handler is a class, which loads and saves matrices to a file in one format. + * Handlers can be added or removed from the global list. + */ +class KSMatrixIO : public QObject { + + Q_OBJECT + + public: + + /** + * Constructor. Opens a file and tries to determine a file format. + * If 'filename' is empty, no file is opened and you must + * open it with 'openFile()'. + */ + KSMatrixIO( const QString& filename = QString(), int mode = IO_ReadOnly ); + + /** + * Destructor. + */ + ~KSMatrixIO(); + + /** + * Opens a file and tries to determine a file format. + */ + void openFile( const QString& filename, int mode = IO_ReadOnly ); + + /** + * Closes the currently opened file. + */ + void closeFile(); + + /** + * Returns a filename of the currently opened file ( if any ) or + * an empty QString. + */ + QString filename() const { return file.name(); } + + /** + * This method returns a list of matrices + * in the file. Matrices have valid size and + * type but no data memory is allocated ! + * Remember to delete this list after use ! + */ + KSHeadersList *loadHeaders( const QString& format = QString() ); + + /** + * Loads 'matrixname' matrix from the file. + */ + KSMatrix *loadMatrix( const QString& matrixname, const QString& format = QString() ); + + /** + * Saves 'm' matrix to the file ( which is reopened with the read/save access ). + */ + void saveMatrix( QSMatrix *m, const QString& matrixname, const QString& format ); + + /** + * Adds a new loader to the list of loaders. + * Pointer is consumed and will be deleted on exit. + */ + static void addHandler( KSMatrixIOHandler *handler ); + + /** + * Deletes all loaders, which handles 'format'. + */ + static int removeHandlers( const QString& format ); + + static KSHandlersList hlist; + + signals: + + void progress( int percent ); + + protected: + + KSMatrixIOHandler *findHandler( QDataStream &is, const QString& filename ); + KSMatrixIOHandler *findHandler( const QString& format ); + + private: + + QFile file; + QString dformat; + void setDefaultHandler(); + + static bool initialized; + }; + +#endif + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/kmatplot/ksmatrixiohandler.cpp b/kmatplot/ksmatrixiohandler.cpp new file mode 100644 index 0000000..d0651eb --- /dev/null +++ b/kmatplot/ksmatrixiohandler.cpp @@ -0,0 +1,72 @@ +/*************************************************************************** + ksmatrixiohandler.cpp + ------------------- + begin : 01-January-2000 + copyright : (C) 2000 by Kamil Dobkowski + email : kamildobk@poczta.onet.pl + ***************************************************************************/ + +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + +#include"ksmatrixiohandler.h" +//-------------------------------------------------------------------------// + +bool KSMatrixIOHandler::check( QDataStream & ) + { + return false; + } + +//-------------------------------------------------------------------------// + +KSHeadersList *KSMatrixIOHandler::headers( QDataStream& ) + { + return NULL; + } + +//-------------------------------------------------------------------------// + +KSMatrix *KSMatrixIOHandler::load( QDataStream&, const QString& ) + { + return NULL; + } + +//-------------------------------------------------------------------------// + +void KSMatrixIOHandler::save( QDataStream&, QSMatrix *, const QString& ) + { + } + +//-------------------------------------------------------------------------// + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/kmatplot/ksmatrixiohandler.h b/kmatplot/ksmatrixiohandler.h new file mode 100644 index 0000000..8e4e502 --- /dev/null +++ b/kmatplot/ksmatrixiohandler.h @@ -0,0 +1,123 @@ +/*************************************************************************** + ksmatrixiohandler.h + ------------------- + begin : 01-January-2000 + copyright : (C) 2000 by Kamil Dobkowski + email : kamildobk@poczta.onet.pl + ***************************************************************************/ + +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + +#ifndef KSMATRIXIOHANDLER_H +#define KSMATRIXIOHANDLER_H + +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + +#include"ksmatrix.h" +#include<qstring.h> +#include<qdatastream.h> +#include<qobject.h> +#include<list> + +using namespace std; + +/** + * List of matrix headers. + */ +typedef list<KSMatrix*> KSHeadersList; + +/** + * STL template specialization. + */ +inline void destroy( KSMatrix **p ) { (*p)->~KSMatrix(); } + +/** + * Abstract base class for any format handlers. + * see @ref KSMatrixIO + * @author Kamil Dobkowski + * @version 0.0.1 + */ +class KSMatrixIOHandler : public QObject + { + Q_OBJECT + + public: + + /** + * Constructor. + */ + KSMatrixIOHandler() {} + + /** + * Destructor. + */ + virtual ~KSMatrixIOHandler() {} + + /** + * Checks if this handler can decode contents of 'is'. + */ + virtual bool check( QDataStream &is ); + + /** + * This method returns a list of matrices from 'is'. + * Number of matrices is returned in 'headersNum'. + * Matrices have the valid size and type but no data memory is allocated ! + * Remember to delete this list after use ! + * Throws @ref KSException . + */ + virtual KSHeadersList *headers( QDataStream& is ); + + /** + * Loads 'matrixName' matrix from 'is'. + * Throws @ref KSException . + */ + virtual KSMatrix *load( QDataStream& is, const QString& matrixname ); + + /** + * Saves 'm' matrix to 'os'. + * Throws @ref KSException . + */ + virtual void save( QDataStream& os, QSMatrix *m, const QString& matrixname ); + + /** + * Returns the format QString. + */ + virtual QString format() = 0; + }; + +#endif + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/kmatplot/ksmatrixmat.cpp b/kmatplot/ksmatrixmat.cpp new file mode 100644 index 0000000..4f8e76a --- /dev/null +++ b/kmatplot/ksmatrixmat.cpp @@ -0,0 +1,248 @@ +/*************************************************************************** + ksmatrixmat.cpp + ------------------- + begin : 01-January-2000 + copyright : (C) 2000 by Kamil Dobkowski + email : kamildobk@poczta.onet.pl + ***************************************************************************/ + +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + + +#include"ksmatrixmat.h" +#include<memory> + +//-------------------------------------------------------------------------// + +KSMatrixMAT::KSMatrixMAT() + { + } + + +//-------------------------------------------------------------------------// + +KSMatrixMAT::~KSMatrixMAT() + { + } + +//-------------------------------------------------------------------------// + +bool KSMatrixMAT::check( QDataStream &is ) +// Filename isn't interesing but should be "*.mat" +// Check the first header in a stream + { + KSMatrix *h = read_header(is); + if ( !h ) return false; + delete h; + return true; + } + +//-----------------------------------------------------------------------// + +KSHeadersList *KSMatrixMAT::headers( QDataStream& is ) + { + KSHeadersList *result = new KSHeadersList(); + + while ( !is.atEnd() ) { + int data_size; + // read header + KSMatrix *hdr = read_header( is, NULL, NULL, &data_size ); + // end of header list + if ( !hdr ) break; + // add it to the list + result->push_back( hdr ); + // skip next header.size bytes + is.device()->at( is.device()->at()+data_size ); + } + + return result; + } + +//-------------------------------------------------------------------------// + +KSMatrix *KSMatrixMAT::load( QDataStream& is, const QString& matrixname ) + { + auto_ptr<KSMatrix> m; + bool swap; + int esize; + int dsize; + + while ( !is.atEnd() ) { + // read header + auto_ptr<KSMatrix> h(read_header( is, &swap, &esize, &dsize )); + // Check whether we found matrix, we have been looking for. + if ( h->name() == matrixname ) { m = h; break; } + // skip bytes to the next header + is.device()->at( is.device()->at()+dsize ); + // this is not the header we are looking for, delete it + } + + if ( is.atEnd() ) return NULL; + + int enumb = m->cols()*m->rows(); + int estep = enumb / 20 + 1; + int ecurr = 0; + + // alloc data, that will be managed by this object + // remember that header has data set to NULL while rows and cols are sot to non-zero + int rows = m->rows(); + int cols = m->cols(); + m->resize( 0, 0 ); + m->resize( rows, cols ); + + for( int i=0; i<m->cols(); i++ ) + for( int j=0; j<m->rows(); j++ ) { + // calculate a pointer to memory + void *ptr = (char*)m->ptr() + j*m->lo() + i*m->po(); // + part*esize; + // read esize bytes in binary format, directly to memory + if ( is.readRawBytes((char*)ptr,esize).device()->status() != IO_Ok ) return NULL; + // if endian ordering is different - swap bytes + if ( swap ) swap_bytes( ptr, esize ); + } + return m.release(); + } + +//-------------------------------------------------------------------------// + +KSMatrix *KSMatrixMAT::read_header( QDataStream& is, bool *swap_ptr, int *esize_ptr, int *data_size_ptr ) + { + Header header; + Flags flags; + + bool swap = false; + + is.readRawBytes((char*)&header.type, 4); + is.readRawBytes((char*)&header.mrows, 4); + is.readRawBytes((char*)&header.ncols, 4); + is.readRawBytes((char*)&header.imagf, 4); + is.readRawBytes((char*)&header.namlen, 4); + + if ( is.device()->status() != IO_Ok ) return NULL; + + // If 'type' is nonzero and the byte order is swapped, 'type' will be + // bigger than we expect, so we swap bytes. + // + // If 'type' is zero, it means the file was written on a little endian + // machine, and we only need to swap if we are running on a big endian + // machine. + // + int type = header.type; + +#if defined WORDS_BIGENDIAN + if ( type == 0 ) swap = true; +#endif + + if ( type < 0 || type > 9999 ) swap = true; + + if ( swap ) { + swap_bytes( &header.type, 4 ); + swap_bytes( &header.mrows, 4 ); + swap_bytes( &header.ncols, 4 ); + swap_bytes( &header.imagf, 4 ); + swap_bytes( &header.namlen, 4 ); + } + + if ( header.type < 0 || + header.type > 4052 || + header.imagf > 1 || + header.imagf < 0 ) return NULL; + + type = header.type; + + flags.T = TypeT(type % 10); type /= 10; + flags.P = TypeP(type % 10); type /= 10; + flags.O = TypeO(type % 10); type /= 10; + flags.M = TypeM(type % 10); + + if ( flags.M == VAX_D_FLOAT || + flags.M == VAX_G_FLOAT || + flags.M == CRAY || + flags.T == TEXT || + flags.T == SPARSE) return NULL; + + // Create output matrix + + EType etype; + switch( flags.P ) { + case E_DOUBLE: etype = EDouble; break; + case E_FLOAT: etype = EFloat; break; + case E_INTEGER: etype = ELong; break; + case E_SHORT: etype = EShort; break; + case E_USHORT: etype = EUShort; break; + case E_UCHAR: etype = EUChar; break; + default: return NULL; + } + + auto_ptr<KSMatrix> result( KSMatrix::create(etype) ); + QCString name( header.namlen ); + is.readRawBytes( name.data(), header.namlen ); + result->setName( name ); + + int esize = result->elementSize(); + int elementOffset = esize * (header.imagf?2:1); + int lineOffset = elementOffset * header.ncols; + int dataSize = lineOffset * header.mrows; + result->setRawData( NULL, header.mrows, header.ncols, false ); + + if ( esize_ptr ) *esize_ptr = esize; + if ( swap_ptr ) *swap_ptr = swap; + if ( data_size_ptr ) *data_size_ptr = dataSize; + return result.release(); + } + +//-------------------------------------------------------------------------// + +void KSMatrixMAT::swap_bytes( void *adr, unsigned int len ) +// But, but What is it ?! +// Swap 'len' bytes at the pointer 'adr' + { + unsigned int i; char *ptr; + for( ptr=static_cast<char *>(adr), i=0; i < len>>1; i++ ) { + char temp = ptr[i]; ptr[i] = ptr[len-i-1]; ptr[len-i-1] = temp; + } + } + +//-------------------------------------------------------------------------// + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/kmatplot/ksmatrixmat.h b/kmatplot/ksmatrixmat.h new file mode 100644 index 0000000..1dbbc95 --- /dev/null +++ b/kmatplot/ksmatrixmat.h @@ -0,0 +1,151 @@ +/*************************************************************************** + ksmatrixmat.h + ------------------- + begin : 01-January-2000 + copyright : (C) 2000 by Kamil Dobkowski + email : kamildobk@poczta.onet.pl + ***************************************************************************/ + +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + + +#ifndef KSMATRIXMAT_H +#define KSMATRIXMAT_H + +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + +#include "ksmatrixiohandler.h" + +// +// USES: #define WORDS_BIGENDIAN +// + +/** + * Loads matrices from Matlab's MAT 1.0 files. + * @author Kamil Dobkowski + * @version 0.0.1 + */ + +class KSMatrixMAT : public KSMatrixIOHandler + { + + public: + + /** + * Constructor. + */ + KSMatrixMAT(); + + /** + * Destructor. + */ + ~KSMatrixMAT(); + + bool check( QDataStream &is ); + KSHeadersList* headers( QDataStream& is ); + KSMatrix* load( QDataStream& is, const QString& matrixname ); + + /** + * Returns "MAT 1.0". + */ + virtual QString format() { return QString("MAT 1.0"); } + + private: + + enum TypeM { + IEEE_LITTLE_ENDIAN = 0, + IEEE_BIG_ENDIAN = 1, + VAX_D_FLOAT = 2, + VAX_G_FLOAT = 3, + CRAY = 4 + }; + + enum TypeO { + CORRECT = 0 + }; + + enum TypeP { + E_DOUBLE = 0, + E_FLOAT = 1, + E_INTEGER = 2, + E_SHORT = 3, + E_USHORT = 4, + E_UCHAR = 5 + }; + + enum TypeT { + FULL = 0, + TEXT = 1, + SPARSE = 2 + }; + + + struct Flags { + TypeM M; + TypeO O; + TypeP P; + TypeT T; + }; + + struct Header { + int type; // see Flags + int mrows; // rows + int ncols; // columns + int imagf; // is imaginary part present + int namlen; // name length + }; + + KSMatrix* read_header( QDataStream& is, bool *swap = NULL, int *esize = NULL, int *dsize = NULL ); + void swap_bytes( void *adr, unsigned int len ); + }; + +#endif + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/kmatplot/ksmatrixsheet.cpp b/kmatplot/ksmatrixsheet.cpp new file mode 100644 index 0000000..9bf9a87 --- /dev/null +++ b/kmatplot/ksmatrixsheet.cpp @@ -0,0 +1,24 @@ +/*************************************************************************** + ksmatrixsheet.cpp - description + ------------------- + begin : Tue Feb 26 2002 + copyright : (C) 2002 by kamil + email : kamil@localhost.localdomain + ***************************************************************************/ + +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + +#include "ksmatrixsheet.h" +/* +KSMatrixSheet::KSMatrixSheet(QWidget *parent, const char *name ) : QSMatrix(parent,name) { +} +KSMatrixSheet::~KSMatrixSheet(){ +} +*/ \ No newline at end of file diff --git a/kmatplot/ksmatrixsheet.h b/kmatplot/ksmatrixsheet.h new file mode 100644 index 0000000..d68c63e --- /dev/null +++ b/kmatplot/ksmatrixsheet.h @@ -0,0 +1,130 @@ +/*************************************************************************** + ksmatrixsheet.h - description + ------------------- + begin : Tue Feb 26 2002 + copyright : (C) 2002 by kamil + email : kamil@localhost.localdomain + ***************************************************************************/ + +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + +#ifndef KSMATRIXSHEET_H +#define KSMATRIXSHEET_H + +#include <qwidget.h> +//#include <qsmatrix.h> + +/* +//---------------------------------------------------------------------// + +class KSCellFormat { + QSGFill background; + int numericPrecision; + char numericFormat; + QString dateTimeFormat; + }; + +//----------------------------------------------------------------------// + +typedef struct { + union { + double numeric; + QString *string; + } m_value; + int m_type; + int m_format; + + bool isEmpty() const {} + void setEmpty( bool empty ); + void setType( int type ); + int type() const {} + void setValue( double value ); + void setString( const QString& string ); + double value() const; + QString string( const KSCellFormat& format ) const; + } cell_t; + +//-----------------------------------------------------------------------// + +class KSSheetColumn { + + int size(); + void resize( int new_size ); + void adjustSize(); + }; + +//-----------------------------------------------------------------------// + +/** The most complex implemetation of + * QSMatrix interface - sheet-like data with + * auto-resizing, data types, formulas and + * format assigned to individual cells. + * @author kamil + + +class KSMatrixSheet : public QSMatrix { + Q_OBJECT +public: + enum CellType { NumericType, + IntegerType, + StringType, + DateType, + TimeType, + DateTimeType, + FillType, + LineType, + FontType, + PointType, + ArrowType }; + + KSMatrixSheet(QWidget *parent=0, const char *name=0); + virtual ~KSMatrixSheet(); + + void setDefaultFormat( const KSCellFormat& format ); + const KSCellFormat &defaultFormat() const; + + void setCellType( int row, int col, CellType type ); + CellType cellType( int row, int col ) const; + + void setFormat( const KSCellFormat& format, int rowFrom, int rowTo, int colFrom, int colTo ); + const KSCellFormat &format( int row, int col ) const; + const KSCellFormat &format( int formatIndex ) const; + void changeFormat( int formatIndex, const KSCellFormat& newFormat ); + int formatIndex( int row, int col ) const; + + void clear( int rowFrom, int rowTo, int colFrom, int colTo ); + void clear( int row, int col ); + + void setCellType( int row, int col, CellType type ); + CellType cellType( int row, int col ) const; + + void insertColumns( int beforeCol, int number ); + void deleteColumns( int col, int number ); + + int columnSize( int col ) const; + + virtual bool isEmpty( int row, int col ) const; + + virtual double value( int row, int col ) = 0; + virtual QString string( int row, int col ); + virtual int rows() const = 0; + virtual int cols() const = 0; + virtual bool resize( int rows, int cols ); + virtual bool transpose() { return false; } + virtual void setValue( int row, int col, double value ); + virtual void setString( int row, int col, const QString& string ); + virtual bool isEditable() const; + virtual bool isString() const; + + //void setFormula( const QString& formula, int rowFrom, int rowTo, int colFrom, int colTo ); + //int formula( ); +}; +*/ +#endif diff --git a/kmatplot/ksobjectfactory.cpp b/kmatplot/ksobjectfactory.cpp new file mode 100644 index 0000000..a929516 --- /dev/null +++ b/kmatplot/ksobjectfactory.cpp @@ -0,0 +1,396 @@ +/*************************************************************************** + ksobjectfactory.cpp + ------------------- + begin : Tue Oct 16 2001 + copyright : (C) 2001 by kamil + email : kamil@localhost.localdomain + ***************************************************************************/ + +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + +#include "ksobjectfactory.h" +#include <qobject.h> +#include <qmetaobject.h> +#include <qbuffer.h> +#include <qdragobject.h> +#include <qapplication.h> +#include <qclipboard.h> + +#include "widgets/qsaxis.h" +#include "widgets/qsclegend.h" +#include "widgets/qsaxes2d.h" +#include "widgets/qsaxes3d.h" +#include "widgets/qscurve.h" +#include "widgets/qscontour.h" +#include "widgets/qsimage.h" +#include "widgets/qssurface.h" +#include "widgets/qsfigure.h" +#include "qscobjects.h" +#include "ksworkbook.h" +#include "ksmatrix.h" +#include "ksglobalmatrixlist.h" + + +//-------------------------------------------------------------// + +KSObjectFactory::KSObjectFactory( KSWorkbook *workbook ) +: QSObjectFactory() + { + m_workbook = workbook; + } + +//-------------------------------------------------------------// + +KSObjectFactory::~KSObjectFactory() + { + } + +//-------------------------------------------------------------// + +QSSerializable *KSObjectFactory::loadObjectFromStream( QDataStream& stream, QObject *parent ) + { + QCString class_name; + stream >> class_name; + QSSerializable *result = createObject( class_name, parent ); + if ( result ) result->loadStateFromStream( stream, this ); + return result; + } + +//-------------------------------------------------------------// + +void KSObjectFactory::saveObjectToStream( QSSerializable *object, QDataStream& stream ) + { + QSSerializable *new_object = transform_object( object, m_flags ); + stream << className( new_object ); + if ( new_object ) new_object->saveStateToStream( stream, this ); + if ( new_object != object ) delete new_object; + } + + //-------------------------------------------------------------// + +QCString KSObjectFactory::className( QSSerializable *object ) + { + QSCObject *cobject = dynamic_cast<QSCObject*>(object); + if ( dynamic_cast<KSMatrixFormula*>(object) ) { + return "KSMatrixFormula"; + } + if ( dynamic_cast< KSMatrixImpl<double>* >(object) ) { + return "KSMatrixImpl<double>"; + } + else if ( dynamic_cast< KSMatrixImpl<float>* >(object) ) { + return "KSMatrixImpl<float>"; + } + else if ( dynamic_cast< KSMatrixImpl<long int>* >(object) ) { + return "KSMatrixImpl<long>"; + } + else if ( dynamic_cast< KSMatrixImpl<unsigned short int>* >(object) ) { + return "KSMatrixImpl<ushort>"; + } + else if ( dynamic_cast< KSMatrixImpl<short int>* >(object) ) { + return "KSMatrixImpl<short>"; + } + else if ( dynamic_cast< KSMatrixImpl<unsigned char>* >(object) ) { + return "KSMatrixImpl<uchar>"; + } + // inherits QSCGroup also + else if ( cobject && cobject->isAxesShadow() && dynamic_cast<QSAxes2D*>(cobject->parentAxes()) ) { + return "QSCAxes2DShadow"; + } + // inherits QSCGroup also + else if ( cobject && cobject->isAxesShadow() && dynamic_cast<QSAxes3D*>(cobject->parentAxes()) ) { + return "QSCAxes3DShadow"; + } + else if ( dynamic_cast<QSAxis*>(object) && dynamic_cast<QSAxis*>(object)->type() == QSAxis::XAxisType ) { + return "QSAxis-X"; + } + else if ( dynamic_cast<QSAxis*>(object) && dynamic_cast<QSAxis*>(object)->type() == QSAxis::YAxisType ) { + return "QSAxis-Y"; + } + else if ( dynamic_cast<QSAxis*>(object) && dynamic_cast<QSAxis*>(object)->type() == QSAxis::ZAxisType ) { + return "QSAxis-Z"; + } + else if ( dynamic_cast<QSAxis*>(object) && dynamic_cast<QSAxis*>(object)->type() == QSAxis::VAxisType ) { + return "QSAxis-V"; + } + else if ( dynamic_cast<QSAxis*>(object) ) { + return "QSAxis-Unknown"; + } + else if ( dynamic_cast<QSCObjectCollection*>(object) ) { + return "QSCObjectCollection"; + } + else if ( dynamic_cast<QObject*>(object) ) { + return dynamic_cast<QObject*>(object)->metaObject()->className(); + } + else { + return "NULL"; + } + } + +//-------------------------------------------------------------// + +QSSerializable *KSObjectFactory::createObject( const QCString& class_name, QObject *parent ) + { + if ( class_name == "QSCObjectCollection" ) { + // no auto delete + return new QSCObjectCollection(parent,false); + } + if ( class_name == "QSCGroup" ) { + return new QSCGroup(); + } + else if ( class_name == "QSCLegend" ) { + return new QSCLegend(dynamic_cast<QSAxes*>(parent)); + } + else if ( class_name == "QSCLabel" ) { + return new QSCLabel(); + } + else if ( class_name == "QSCArrow" ) { + return new QSCArrow(); + } + else if ( class_name == "QSCRect" ) { + return new QSCRect(); + } + else if ( class_name == "QSAxes2D" ) { + return new QSAxes2D(); + } + else if ( class_name == "QSAxes3D" ) { + return new QSAxes3D(); + } + else if ( class_name == "QSCAxes2DShadow" ) { + QSAxes2D *result = new QSAxes2D(); + return result->shadowObject(); + } + else if ( class_name == "QSCAxes3DShadow" ) { + QSAxes3D *result = new QSAxes3D(); + return result->shadowObject(); + } + else if ( class_name == "QSAxis-X" ) { + return new QSAxis(QSAxis::XAxisType,dynamic_cast<QSAxes*>(parent)); + } + else if ( class_name == "QSAxis-Y" ) { + return new QSAxis(QSAxis::YAxisType,dynamic_cast<QSAxes*>(parent)); + } + else if ( class_name == "QSAxis-Z" ) { + return new QSAxis(QSAxis::ZAxisType,dynamic_cast<QSAxes*>(parent)); + } + else if ( class_name == "QSAxis-V" ) { + return new QSAxis(QSAxis::VAxisType,dynamic_cast<QSAxes*>(parent)); + } + else if ( class_name == "QSAxis-Unknown" ) { + return new QSAxis(QSAxis::UnknownAxisType,dynamic_cast<QSAxes*>(parent)); + } + else if ( class_name == "QSCurve" ) { + return new QSCurve(dynamic_cast<QSAxes*>(parent)); + } + else if ( class_name == "QSGriddedContour" ) { + return new QSGriddedContour(dynamic_cast<QSAxes*>(parent)); + } + else if ( class_name == "QSNonGriddedContour" ) { + return new QSNonGriddedContour(dynamic_cast<QSAxes*>(parent)); + } + else if ( class_name == "QSImage" ) { + return new QSImage(dynamic_cast<QSAxes*>(parent)); + } + else if ( class_name == "QSSurface" ) { + return new QSSurface(dynamic_cast<QSAxes*>(parent)); + } + else if ( class_name == "QSFigure" ) { + return new QSFigure(dynamic_cast<QSAxes*>(parent)); + } + else if ( class_name == "KSMatrixString" ) { + return new KSMatrixString(); + } + else if ( class_name == "KSMatrixFormula" ) { + return new KSMatrixFormula(); + } + else if ( class_name == "KSMatrixWorksheetCellRange" ) { + return new KSMatrixWorksheetCellRange( m_workbook ); + } + else if ( class_name == "KSMatrixImpl<double>" ) { + return KSMatrix::create( EDouble ); + } + else if ( class_name == "KSMatrixImpl<float>" ) { + return KSMatrix::create( EFloat ); + } + else if ( class_name == "KSMatrixImpl<long>" ) { + return KSMatrix::create( ELong ); + } + else if ( class_name == "KSMatrixImpl<ushort>" ) { + return KSMatrix::create( EUShort ); + } + else if ( class_name == "KSMatrixImpl<short>" ) { + return KSMatrix::create( EShort ); + } + else if ( class_name == "KSMatrixImpl<uchar>" ) { + return KSMatrix::create( EUChar ); + } + else if ( class_name == "KSSheet" ) { + return new KSSheet( dynamic_cast<KSSheetList*>(parent) ); + } + return NULL; + } + +//-------------------------------------------------------------// + +void KSObjectFactory::copyToClipboard( QSSerializable *object, const QCString& format ) + { + if ( object ) { + QBuffer buffer; + buffer.open( IO_WriteOnly ); + QDataStream data_stream( &buffer ); + saveObjectToStream( object, data_stream ); + QStoredDrag *drag = new QStoredDrag( format ); + drag->setEncodedData( buffer.buffer() ); + QApplication::clipboard()->setData(drag); + } + } + +//-------------------------------------------------------------// + +QSSerializable *KSObjectFactory::pasteFromClipboard( const QCString& format, QObject *parent ) + { + QMimeSource *src = QApplication::clipboard()->data(); + QBuffer buffer( src->encodedData(format) ); + buffer.open( IO_ReadOnly ); + QDataStream data_stream( &buffer ); + return loadObjectFromStream( data_stream, parent ); + } + +//-------------------------------------------------------------// + +void KSObjectFactory::copyQSCObjectToClipboard( QSCObject *object ) + { + copyToClipboard( object, "application/x-kmatplot-qscobject" ); + } + +//-------------------------------------------------------------// + +QSCObject *KSObjectFactory::pasteQSCObjectFromClipboard() + { + QSSerializable *result = pasteFromClipboard( "application/x-kmatplot-qscobject" ); + assert( !result || dynamic_cast<QSCObject*>(result) ); + return (QSCObject *)result; + } + +//-------------------------------------------------------------// + +void KSObjectFactory::copyQSCObjectCollectionToClipboard( QSCObjectCollection *objects ) + { + copyToClipboard( objects, "application/x-kmatplot-qscobjectcollection" ); + } + +//-------------------------------------------------------------// + +QSCObjectCollection *KSObjectFactory::pasteQSCObjectCollectionFromClipboard() + { + QSSerializable *result = pasteFromClipboard( "application/x-kmatplot-qscobjectcollection" ); + assert( !result || dynamic_cast<QSCObjectCollection*>(result) ); + return (QSCObjectCollection *)result; + } + +//-------------------------------------------------------------// + +void KSObjectFactory::copyQSPlotToClipboard( QSPlot *dataset ) + { + copyToClipboard( dataset, "application/x-kmatplot-qsplot" ); + } + +//-------------------------------------------------------------// + +QSPlot *KSObjectFactory::pasteQSPlotFromClipboard( QSAxes *parentAxes ) + { + QSSerializable *result = pasteFromClipboard( "application/x-kmatplot-qsplot", parentAxes); + assert( !result || dynamic_cast<QSPlot*>(result) ); + return (QSPlot *)result; + } + +//-------------------------------------------------------------// + +void KSObjectFactory::copyQSAxisToClipboard( QSAxis *axis ) + { + copyToClipboard( axis, "application/x-kmatplot-qsaxis" ); + } + +//-------------------------------------------------------------// + +QSAxis *KSObjectFactory::pasteQSAxisFromClipboard( QSAxes *parentAxes ) + { + QSSerializable *result = pasteFromClipboard( "application/x-kmatplot-qsaxis", parentAxes); + assert( !result || dynamic_cast<QSAxis*>(result) ); + return (QSAxis *)result; + } + +//-------------------------------------------------------------// + +void KSObjectFactory::copyQSMatrixToClipboard( QSMatrix *matrix ) + { + copyToClipboard( matrix, "application/x-kmatplot-qsmatrix" ); + } + +//-------------------------------------------------------------// + +QSMatrix *KSObjectFactory::pasteQSMatrixFromClipboard() + { + QSSerializable *result = pasteFromClipboard( "application/x-kmatplot-qsmatrix" ); + assert( !result || dynamic_cast<QSMatrix*>(result) ); + return (QSMatrix *)result; + } + +//-------------------------------------------------------------// + +void KSObjectFactory::copyKSSheetToClipboard( KSSheet *sheet ) + { + copyToClipboard( sheet, "application/x-kmatplot-kssheet" ); + } + +//-------------------------------------------------------------// + +KSSheet *KSObjectFactory::pasteKSSheetFromClipboard( KSSheetList *parent ) + { + QSSerializable *result = pasteFromClipboard( "application/x-kmatplot-kssheet",parent ); + assert( !result || dynamic_cast<KSSheet*>(result) ); + return (KSSheet *)result; + } + +//-------------------------------------------------------------// + +QSMatrix *KSObjectFactory::cloneMatrix( QSMatrix *matrix, bool copy ) + { + if ( matrix->isString() ) { + KSMatrixString *result = new KSMatrixString(); + if ( copy ) result->setMatrix( matrix ); + return result; + } + else if ( dynamic_cast<KSMatrix*>(matrix) ) { + KSMatrix *result = KSMatrix::create( dynamic_cast<KSMatrix*>(matrix)->type() ); + if ( copy ) result->setMatrix( matrix ); + return result; + } + else { + KSMatrix *result = KSMatrix::create( EDouble ); + if ( copy ) result->setMatrix( matrix ); + return result; + } + + return NULL; + } + +//-------------------------------------------------------------// + +QSSerializable *KSObjectFactory::transform_object( QSSerializable *object, int flags ) + { + // little hack + if ( flags & CopyAllData && dynamic_cast<KSMatrixWorksheetCellRange*>(object) ) + return cloneMatrix( (KSMatrixWorksheetCellRange*)object, true ); + return object; + } + + + + diff --git a/kmatplot/ksobjectfactory.h b/kmatplot/ksobjectfactory.h new file mode 100644 index 0000000..f4b82fe --- /dev/null +++ b/kmatplot/ksobjectfactory.h @@ -0,0 +1,128 @@ +/*************************************************************************** + ksobjectfactory.h + ------------------- + begin : Tue Oct 16 2001 + copyright : (C) 2001 by kamil + email : kamil@localhost.localdomain + ***************************************************************************/ + +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + +#ifndef KSOBJECTFACTORY_H +#define KSOBJECTFACTORY_H + +#include"widgets/qsserializable.h" +#include<qcstring.h> +class QSMatrix; +class QSCObject; +class QSCObjectCollection; +class QSPlot; +class QSAxis; +class QSAxes; +class KSSheet; +class KSSheetList; +class KSWorkbook; +/** + *@author kamil + */ +class KSObjectFactory : public QSObjectFactory + { + public: + /** + * Constructor + */ + KSObjectFactory( KSWorkbook *workbook ); + /** + * Destructor + */ + virtual ~KSObjectFactory(); + /** + * Loads an object from a data stream + */ + virtual QSSerializable *loadObjectFromStream( QDataStream& stream, QObject *parent=NULL ); + /** + * Saves object to a datastream. + */ + virtual void saveObjectToStream( QSSerializable *object, QDataStream& stream ); + /** + * Creates object of class 'className' + */ + virtual QSSerializable *createObject( const QCString& className, QObject *parent ); + /** + * Returns a class name of a given object + */ + virtual QCString className( QSSerializable *object ); + /** + * Clone and detach matrix. + */ + static QSMatrix *cloneMatrix( QSMatrix *matrix, bool copyData = false ); + /** + * Copies an object to a system clipboard. + */ + void copyToClipboard( QSSerializable *object, const QCString& format ); + /** + * Loads object from clipboard + */ + QSSerializable *pasteFromClipboard( const QCString& format, QObject *parent=NULL ); + /** + * Copies a canvas object to system clipboard + */ + void copyQSCObjectToClipboard( QSCObject *object ); + /** + * Loads a canvas object from clipboard + */ + QSCObject *pasteQSCObjectFromClipboard(); + /** + * Copies a canvas object collection to system clipboard + */ + void copyQSCObjectCollectionToClipboard( QSCObjectCollection *objects ); + /** + * Loads a canvas object collection from clipboard + */ + QSCObjectCollection *pasteQSCObjectCollectionFromClipboard(); + /** + * Copies dataset to clipboard + */ + void copyQSPlotToClipboard( QSPlot *dataset ); + /** + * Loads dataset from clipboard + */ + QSPlot *pasteQSPlotFromClipboard( QSAxes *parentAxes ); + /** + * Copies the axis to clipboard + */ + void copyQSAxisToClipboard( QSAxis *axis ); + /** + * Loads axis from clipboard + */ + QSAxis *pasteQSAxisFromClipboard( QSAxes *parentAxes ); + /** + * Copies matrix to clipboard + */ + void copyQSMatrixToClipboard( QSMatrix *matrix ); + /** + * Loads matrix from clipboard + */ + QSMatrix *pasteQSMatrixFromClipboard(); + /** + * Copies sheet from clipboard + */ + void copyKSSheetToClipboard( KSSheet *sheet ); + /** + * Loads sheet from clipboard + */ + KSSheet *pasteKSSheetFromClipboard( KSSheetList *parent ); + + protected: + QSSerializable *transform_object( QSSerializable *, int flags ); + KSWorkbook *m_workbook; +}; + +#endif diff --git a/kmatplot/kspanelmanager.cpp b/kmatplot/kspanelmanager.cpp new file mode 100644 index 0000000..8650c52 --- /dev/null +++ b/kmatplot/kspanelmanager.cpp @@ -0,0 +1,646 @@ +/*************************************************************************** + kspanelmanager.cpp + ------------------- + begin : Sat Oct 7 2000 + copyright : (C) 2000 by Kamil Dobkowski + email : kamildobk@friko.onet.pl + ***************************************************************************/ + +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + +#include "kspanelmanager.h" +#include "dialogs/kspanels.h" +#include "widgets/qsaxes2d.h" +#include "widgets/qsaxes3d.h" +#include "widgets/qscurve.h" +#include "widgets/qscontour.h" +#include "widgets/qsimage.h" +#include "widgets/qssurface.h" +#include "widgets/qsfigure.h" +#include "widgets/qsclegend.h" +#include "ksworkbook.h" +#include "qscobjects.h" +#include "kmatplotshell.h" +#include <qpushbutton.h> +#include <qbuttongroup.h> +#include <qvbuttongroup.h> +#include <qhgroupbox.h> +#include <qscrollview.h> +#include <qpopupmenu.h> +#include <qlayout.h> +#include <qlabel.h> +#include <qtimer.h> +#include <qobjectlist.h> +#include <qsplitter.h> +#include <qlayout.h> + +//-------------------------------------------------------------// + +struct kspanelmanager_private_data { + Qt::Orientation o; + + KMatplotShell *shell; + KSWorkbook *workbook;; + KSPanel *curr_panel; + + QSplitter *splitter; + QWidget *buttons; + QFrame *categ_area; + QScrollView *panel_area; + KSSimpleContainer *main_area; + QPopupMenu *menu; + QVButtonGroup *categ_buttons; + QButtonGroup *panel_buttons; + QPushButton *apply; + QTimer *atimer; + QTimer *rtimer; + + QGuardedPtr<QSPlotView> curr_view; + QGuardedPtr<QSCObject> curr_object; + }; + +//-------------------------------------------------------------// +//-------------------------------------------------------------// +//-------------------------------------------------------------// +//-------------------------------------------------------------// +//-------------------------------------------------------------// +//-------------------------------------------------------------// + + + +KSPanelManager::KSPanelManager( KMatplotShell *shell, QWidget *parent, const char *name ) +: QFrame(parent,name) + { + ///////////////////////// + // init panel manager // + ///////////////////////// + is_enabled = false; + pr_reading = false; + pr_applying = false; + pr_autoset = true; + resize( 355, 140 ); + setFont( QFont("Arial",11) ); + d = new kspanelmanager_private_data(); + d->shell = shell; + d->o = Horizontal; + + ///////////////////////// + // timers // + ///////////////////////// + // instead of calling readProperties directly use rather rtimer->start( 250, TRUE ); + // instead of calling applyProperties directly use rather atimer->start( 250, TRUE ); + d->rtimer = new QTimer( this ); + d->atimer = new QTimer( this ); + connect( d->rtimer, SIGNAL(timeout()), this, SLOT(slot_panel_read_properties()) ); + connect( d->atimer, SIGNAL(timeout()), this, SLOT(slot_panel_apply_properties()) ); + + ///////////////////////////////////// + // place for buttons and panels // + ///////////////////////////////////// + d->splitter = new QSplitter( Horizontal, this ); + + d->buttons = new QWidget( d->splitter ); + QGridLayout *l = new QGridLayout( d->buttons, 2, 2, 0, 5 ); + d->categ_area = new QFrame( d->buttons ); + d->categ_area->setFixedWidth( 35 ); + d->panel_area = new QScrollView( d->buttons ); + d->panel_area->setMinimumWidth( 50 ); + d->panel_area->setMinimumHeight( 50 ); + d->panel_area->setHScrollBarMode( QScrollView::AlwaysOff ); + d->panel_area->setVScrollBarMode( QScrollView::Auto ); + d->panel_area->viewport()->setBackgroundMode( PaletteBackground ); + d->panel_area->setFrameStyle( StyledPanel | Sunken ); + d->panel_area->viewport()->installEventFilter( this ); + d->apply = new QPushButton( tr("Apply"), d->buttons ); + d->apply->setDefault(true); + connect( d->apply, SIGNAL(clicked()), this, SLOT(slot_panel_apply_properties()) ); + setAutoSetProperties( true ); + + l->addWidget( d->categ_area, 0, 0 ); + l->addWidget( d->panel_area, 0, 1 ); + l->addWidget( d->apply, 1, 1 ); + d->splitter->setResizeMode( d->buttons, QSplitter::Stretch ); + + d->main_area = new KSSimpleContainer( d->splitter, 500, 130, 1 ); + d->main_area->setFrameStyle( StyledPanel | Sunken ); + d->splitter->setResizeMode( d->main_area, QSplitter::Stretch ); + + QValueList<int> sizes; + sizes.append( 200 ); + sizes.append( 500 ); + d->splitter->setSizes( sizes ); + + d->menu = new QPopupMenu( this ); + d->shell->m_cut_dataset->addTo( d->menu ); + d->shell->m_copy_dataset->addTo( d->menu ); + d->shell->m_copy_all_dataset->addTo( d->menu ); + d->shell->m_paste_dataset->addTo( d->menu ); + d->shell->m_delete_dataset->addTo( d->menu ); + d->menu->insertSeparator(); + d->shell->m_raise_dataset->addTo( d->menu ); + d->shell->m_lower_dataset->addTo( d->menu ); + d->menu->insertSeparator(); + d->shell->m_bring_dataset_to_front->addTo( d->menu ); + d->shell->m_send_dataset_to_back->addTo( d->menu ); + + /////////////////////////////// + // buttons // + /////////////////////////////// + d->categ_buttons = NULL; + d->panel_buttons = NULL; + + ////////////////////////////// + // current state // + ////////////////////////////// + d->curr_view = NULL; + d->curr_object = NULL; + d->curr_panel = NULL; + + /////////////////////////////////////// + // apply button ( hided by default ) // + /////////////////////////////////////// + + + } + +//-------------------------------------------------------------// + +KSPanelManager::~KSPanelManager() + { + // check if there is applyProperties waiting to be called + if ( d->atimer->isActive() ) slot_panel_apply_properties(); + emit dataObjectSelected( NULL ); + delete d->categ_buttons; + delete d->panel_buttons; + delete d; + } + +//-------------------------------------------------------------// + +void KSPanelManager::setView( QSPlotView *view ) + { + if ( d->curr_view ) { + disconnect( d->curr_view, SIGNAL(sigActiveObjectChanged() ), this, SLOT(slot_update_panel_list()) ); + disconnect( d->curr_view, SIGNAL(sigActiveAxesChanged() ), this, SLOT(slot_update_panel_list()) ); + disconnect( d->curr_view, SIGNAL(sigActiveAxesDatasetsChanged()), this, SLOT(slot_update_panel_list()) ); + disconnect( d->curr_view, SIGNAL(message( const QString&)), this, SLOT(slot_set_message(const QString&)) ); + } + d->curr_view = view; + d->workbook = dynamic_cast<KSWorkbook*>(view->workbook()); + if ( d->curr_view ) { + connect( d->curr_view, SIGNAL(sigActiveObjectChanged() ), this, SLOT(slot_update_panel_list()) ); + connect( d->curr_view, SIGNAL(sigActiveAxesChanged() ), this, SLOT(slot_update_panel_list()) ); + connect( d->curr_view, SIGNAL(sigActiveAxesDatasetsChanged()), this, SLOT(slot_update_panel_list()) ); + connect( d->curr_view, SIGNAL(message( const QString&)), this, SLOT(slot_set_message(const QString&)) ); + } + + slot_update_panel_list(); + } + +//-------------------------------------------------------------// + +QSPlotView *KSPanelManager::view() const + { + return (QSPlotView *)d->curr_view; + } + +//-------------------------------------------------------------// + +void KSPanelManager::setEnabled( bool enabled ) + { + is_enabled = enabled; + slot_update_panel_list(); + } + +//-------------------------------------------------------------// + +void KSPanelManager::setAutoSetProperties( bool enabled ) + { + pr_autoset = enabled; + if ( pr_autoset ) d->apply->hide(); + else d->apply->show(); + } + +//-------------------------------------------------------------// + +void KSPanelManager::slot_update_panel_list() +// called when plot changes or active object changes + { + if ( !d->curr_object.isNull() ) disconnect( d->curr_object, SIGNAL(sigUpdate()), this, SLOT(slot_update_panel_contents()) ); + if ( is_enabled ) { + // try to preserve the currently selected category + int curr_category = -1; + if ( (QSCObject *)d->curr_object == get_curr_object() && d->categ_buttons ) + curr_category = d->categ_buttons->id( d->categ_buttons->selected() ); + d->curr_object = get_curr_object(); + // create category buttons, ( and panel buttons if needed ) + category_button_factory( curr_category ); + } + if ( !d->curr_object.isNull() ) connect( d->curr_object, SIGNAL(sigUpdate()), this, SLOT(slot_update_panel_contents()) ); + } + +//-------------------------------------------------------------// + +void KSPanelManager::slot_category_selected( int category_id ) +// user pressed category button + { + panel_button_factory( category_id ); + } + +//-------------------------------------------------------------// + +void KSPanelManager::slot_panel_selected( int button_id ) +// called when new panel is selected + { + // check if contents of the currently removed panel changed + if ( d->atimer->isActive() ) { d->atimer->stop(); slot_panel_apply_properties(); } + // delete a previous panel + d->curr_panel = NULL; + d->main_area->setWidget( NULL ); + // create a new panel + if ( is_enabled && panel_button(button_id) ) d->curr_panel = panel_button(button_id)->createPanel( d->main_area ); + // show a new panel + d->main_area->setWidget( d->curr_panel ); + // watch if its properties changed + if ( d->curr_panel ) { + adjust_panel_orientation(); + slot_panel_read_properties(); + connect( d->curr_panel, SIGNAL(propertiesChanged()), this, SLOT(slot_update_graph()) ); + connect( d->curr_panel, SIGNAL(message(const QString&)), this, SLOT(slot_set_message(const QString&)) ); + } + if ( panel_button(button_id) ) emit dataObjectSelected( panel_button(button_id)->dataObject() ); + else emit dataObjectSelected( NULL ); + } + +//-------------------------------------------------------------// + +KSPanelButton *KSPanelManager::panel_button( int button_id ) + { + if ( d->panel_buttons ) return dynamic_cast<KSPanelButton*>(d->panel_buttons->find(button_id)); + return NULL; + } + +//-------------------------------------------------------------// + +void KSPanelManager::selectPanel( int category, int element ) +// show panel - called from outside + { + if ( get_curr_object() ) + if ( category >= 0 || element >= 0 ) { + + // TODO: we must somehow unifu categories of buttons and categories of graph elements + int button_category = KSPanelButton::BObject; + switch( category ) { + case QSAxes::GeneralCategory: button_category = KSPanelButton::BGeneral; break; + case QSAxes::AxisCategory: button_category = KSPanelButton::BAxes; break; + case QSAxes::GridCategory: button_category = KSPanelButton::BAxes; break; + case QSAxes::DatasetCategory: button_category = KSPanelButton::BDatasets; break; + } + + // select category + if ( d->categ_buttons ) + if ( d->categ_buttons->find(button_category) && + !d->categ_buttons->find(button_category)->isOn() ) { + d->categ_buttons->find(button_category)->animateClick(); + } + + // select panel + if ( d->panel_buttons ) + for( int button_nr=0; button_nr<d->panel_buttons->count(); button_nr++ ) { + KSPanelButton *button = panel_button(button_nr); + if ( button ) + if ( button->isButtonFor(get_curr_object(),category,element) ) { + d->panel_area->ensureVisible( button->x(), button->y() ); + if ( !button->isOn() ) button->animateClick(); + } + } + } + } + +//-------------------------------------------------------------// + +void KSPanelManager::slot_panel_apply_properties() + { + pr_applying = true; + if ( d->curr_panel ) d->curr_panel->applyProperties(); + pr_applying = false; + } + +//-------------------------------------------------------------// + +void KSPanelManager::slot_panel_read_properties() + { + pr_reading = true; + if ( d->curr_panel ) d->curr_panel->readProperties(); + pr_reading = false; + } + +//-------------------------------------------------------------// + +void KSPanelManager::slot_update_panel_contents() + { + if ( is_enabled && !pr_autoset || !pr_applying ) d->rtimer->start( 250, TRUE ); + } + +//-------------------------------------------------------------// + +void KSPanelManager::slot_update_graph() + { + if ( is_enabled && pr_autoset && !pr_reading ) d->atimer->start( 1000, TRUE ); + } + +//-------------------------------------------------------------// + +QSCObject *KSPanelManager::get_curr_object() + { + if ( d->curr_view ) if ( d->curr_view->activeObject() ) return d->curr_view->activeObject(); + return NULL; + } + + //-------------------------------------------------------------// + +void KSPanelManager::add_category_button( int category ) + { + d->categ_buttons->insert( KSPanelButton::categoryButton( (KSPanelButton::ButtonCategory )category, d->categ_buttons ), category ); + } + +//-------------------------------------------------------------// + +void KSPanelManager::arrange_button_row( const QString& title, int num_buttons, QSGraphicalData *dataObject ) + { + // fill unused space + for( int i=num_buttons; i<3; i++ ) new QWidget( d->panel_buttons ); + // add title + QLabel *label = new QLabel( title, d->panel_buttons ); + label->setIndent( 5 ); + label->setMaximumHeight( 50 ); + label->setAlignment( AlignAuto | AlignVCenter | ExpandTabs ); + if ( dataObject ) connect( dataObject, SIGNAL(sigTitleChanged(const QString&)), label, SLOT(setText(const QString&)) ); + + } + +//-------------------------------------------------------------// + +void KSPanelManager::slot_set_message( const QString& string ) + { + emit message( string ); + } + +//-------------------------------------------------------------// + +void KSPanelManager::category_button_factory( int select_category ) + { + QButtonGroup *button_group = d->categ_buttons; + + /////////////////////////////////// + // delete panel list // + /////////////////////////////////// + panel_button_factory( -1 ); + + /////////////////////////////////// + // Delete old buttons // + /////////////////////////////////// + delete d->categ_buttons; + d->categ_buttons = new QVButtonGroup( d->categ_area ); + d->categ_buttons->setFrameStyle( NoFrame ); + d->categ_buttons->setFixedSize( d->categ_area->width(), 140 ); + d->categ_buttons->setExclusive( true ); + d->categ_buttons->setInsideMargin( 3 ); + d->categ_buttons->setInsideSpacing( 0 ); + connect( d->categ_buttons, SIGNAL(pressed(int)), this, SLOT(slot_category_selected(int)) ); + + /////////////////////////////////// + // Create new buttons // + /////////////////////////////////// + QSCObject *curr_object = d->curr_object; + if ( curr_object && curr_object->isAxesShadow() ) { + add_category_button( KSPanelButton::BGeneral ); + add_category_button( KSPanelButton::BAxes ); + add_category_button( KSPanelButton::BDatasets ); + } + else if ( curr_object ) { + add_category_button( KSPanelButton::BObject ); + } + + ////////////////////////////////// + // set button panel // + ////////////////////////////////// + //d->categ_buttons->resize( d->categ_buttons->width(), d->categ_buttons->sizeHint().height() ); + d->categ_buttons->show(); + + ////////////////////////////////// + // Select the first category // + ////////////////////////////////// + if ( d->categ_buttons->find(select_category) ) { + d->categ_buttons->find(select_category)->animateClick(); + } else { + for( int i=0; i<4; i++ ) + if ( d->categ_buttons->find(i) ) { + d->categ_buttons->find(i)->animateClick(); break; + } + } + + } + +//-------------------------------------------------------------// + +void KSPanelManager::panel_button_factory( int category ) + { + QSCObject *curr_object = d->curr_object; + QButtonGroup *button_group = d->panel_buttons; + + //////////////////////////////////// + // delete currently visible panel // + //////////////////////////////////// + slot_panel_selected( -1 ); + + //////////////////////////////////////// + // delete old buttons // + //////////////////////////////////////// + d->panel_area->removeChild( d->panel_buttons ); + delete d->panel_buttons; + d->panel_buttons = new QButtonGroup( 4, Horizontal, d->panel_area->viewport() ); + d->panel_buttons->setExclusive( true ); + d->panel_buttons->setFrameStyle( NoFrame | Plain ); + d->panel_buttons->setInsideMargin( 3 ); + d->panel_buttons->setInsideSpacing( 0 ); + connect( d->panel_buttons, SIGNAL(pressed(int)), this, SLOT(slot_panel_selected(int)) ); + + + //////////////////////////////////////// + // create new buttons // + //////////////////////////////////////// + if ( curr_object && curr_object->isAxesShadow() ) { + QSAxes *axes = curr_object->parentAxes(); + + if ( category == KSPanelButton::BGeneral ) { + new KSPanelButtonRange(d->panel_buttons,d->workbook,axes); + arrange_button_row( tr("Range"), 1 ); + new KSPanelButtonGeneral(d->panel_buttons,d->workbook,axes); + arrange_button_row( tr("General"), 1 ); + } + + if ( category == KSPanelButton::BGeneral ) + if ( dynamic_cast<QSAxes2D*>(axes) ) { + QSAxes2D *axes2 = dynamic_cast<QSAxes2D*>(axes); + new KSPanelButtonFrame( d->panel_buttons, d->workbook, axes2 ); + arrange_button_row( tr("Frame"), 1 ); + } + + if ( category == KSPanelButton::BGeneral ) + if ( dynamic_cast<QSAxes3D*>(axes) ) { + QSAxes3D *axes3 = dynamic_cast<QSAxes3D*>(axes); + new KSPanelButtonCube(d->panel_buttons,d->workbook,axes3); + arrange_button_row( tr("Cube"), 1 ); + new KSPanelButtonView(d->panel_buttons,d->workbook,axes3); + arrange_button_row( tr("View"), 1 ); + new KSPanelButtonLight(d->panel_buttons,d->workbook,axes3); + arrange_button_row( tr("Light"), 1 ); + new KSPanelButtonGL(d->panel_buttons,d->workbook,axes3); + arrange_button_row( tr("OpenGL"), 1 ); + } + + if ( category == KSPanelButton::BAxes ) + for( int axis=axes->axisCount()-1; axis>=0; axis-- ) { + new KSPanelButtonAxis(d->panel_buttons,d->workbook,axes->axis(axis)); + new KSPanelButtonGrid(d->panel_buttons,d->workbook,axes->axis(axis)); + arrange_button_row( axes->axis(axis)->title(), 2, axes->axis(axis) ); + } + + if ( category == KSPanelButton::BDatasets ) + for( int dataset=axes->plotCount()-1; dataset>=0; dataset-- ) { + if ( dynamic_cast<QSCurve*>(axes->plot(dataset)) ) { + QSCurve *curve = dynamic_cast<QSCurve*>(axes->plot(dataset)); + new KSPanelButtonCurve(d->panel_buttons,d->workbook,curve); + arrange_button_row( axes->plot(dataset)->title(), 1, axes->plot(dataset) ); + } + if ( dynamic_cast<QSContour*>(axes->plot(dataset)) ) { + QSContour *contour = dynamic_cast<QSContour*>(axes->plot(dataset)); + new KSPanelButtonContour(d->panel_buttons,d->workbook,contour); + new KSPanelButtonGradient(d->panel_buttons,d->workbook,contour); + arrange_button_row( axes->plot(dataset)->title(), 2, axes->plot(dataset) ); + } + if ( dynamic_cast<QSImage*>(axes->plot(dataset)) ) { + QSImage *image = dynamic_cast<QSImage*>(axes->plot(dataset)); + new KSPanelButtonImage(d->panel_buttons,d->workbook,image); + new KSPanelButtonGradient(d->panel_buttons,d->workbook,image); + arrange_button_row( axes->plot(dataset)->title(), 2, axes->plot(dataset) ); + } + if ( dynamic_cast<QSSurface*>(axes->plot(dataset)) ) { + QSSurface *surface = dynamic_cast<QSSurface*>(axes->plot(dataset)); + new KSPanelButtonSurface(d->panel_buttons,d->workbook,surface); + new KSPanelButtonMesh(d->panel_buttons,d->workbook,surface); + arrange_button_row( axes->plot(dataset)->title(), 2, axes->plot(dataset) ); + } + if ( dynamic_cast<QSFigure*>(axes->plot(dataset)) ) { + QSFigure *figure = dynamic_cast<QSFigure*>(axes->plot(dataset)); + new KSPanelButtonFigure(d->panel_buttons,d->workbook,figure); + new KSPanelButtonMesh(d->panel_buttons,d->workbook,figure); + arrange_button_row( axes->plot(dataset)->title(), 2, axes->plot(dataset) ); + } + } + } + + if ( category == KSPanelButton::BObject ) + if ( dynamic_cast<QSCLegend*>(curr_object) ) { + QSCLegend *l = dynamic_cast<QSCLegend*>(curr_object); + new KSPanelButtonCLegend(d->panel_buttons,d->workbook,l); + arrange_button_row( tr("Legend"), 1 ); + new KSPanelButtonCLabel(d->panel_buttons,d->workbook,l); + arrange_button_row( tr("Labels"), 1 ); + new KSPanelButtonCPos(d->panel_buttons,d->workbook,l,"posX","posY","posZ","coordX","coordY","coordZ"); + arrange_button_row( tr("Position"), 1 ); + } + else + if ( dynamic_cast<QSCArrow*>(curr_object) ) { + QSCArrow *a = dynamic_cast<QSCArrow*>(curr_object); + new KSPanelButtonCArrow(d->panel_buttons,d->workbook,a); + arrange_button_row( tr("Arrow"), 1 ); + new KSPanelButtonCPos(d->panel_buttons,d->workbook,a,"originX","originY","originZ","originCoordX","originCoordY","originCoordZ"); + arrange_button_row( tr("Origin"), 1 ); + new KSPanelButtonCPos(d->panel_buttons,d->workbook,a,"endX","endY","endZ","endCoordX","endCoordY","endCoordZ"); + arrange_button_row( tr("End"), 1 ); + } + else + if ( dynamic_cast<QSCLabel*>(curr_object) ) { + QSCLabel *l = dynamic_cast<QSCLabel*>(curr_object); + new KSPanelButtonCLabel(d->panel_buttons,d->workbook,l); + arrange_button_row( tr("Label"), 1 ); + new KSPanelButtonCPos(d->panel_buttons,d->workbook,l,"posX","posY","posZ","coordX","coordY","coordZ"); + arrange_button_row( tr("Position"), 1 ); + } + else + if ( dynamic_cast<QSCRect*>(curr_object) ) { + QSCRect *r = dynamic_cast<QSCRect*>(curr_object); + new KSPanelButtonCRect(d->panel_buttons,d->workbook,r); + arrange_button_row( tr("Rectangle"), 1 ); + new KSPanelButtonCPos(d->panel_buttons,d->workbook,r,"originX","originY","originZ","originCoordX","originCoordY","originCoordZ"); + arrange_button_row( tr("First corner"), 1 ); + new KSPanelButtonCPos(d->panel_buttons,d->workbook,r,"endX","endY","endZ","endCoordX","endCoordY","endCoordZ"); + arrange_button_row( tr("Second corner"), 1 ); + } + ////////////////////////////////////////////// + // set button view // + ////////////////////////////////////////////// + //d->panel_buttons->setFixedSize( d->panel_buttons->sizeHint() ); + d->panel_buttons->show(); + d->panel_area->addChild( d->panel_buttons ); + d->panel_area->resizeContents( d->panel_buttons->sizeHint().width(), + d->panel_buttons->sizeHint().height() ); + + ////////////////////////////// + // select the first panel // + ////////////////////////////// + if ( d->panel_buttons->find(0) ) d->panel_buttons->find(0)->animateClick(); + } + +//-------------------------------------------------------------// + +bool KSPanelManager::eventFilter ( QObject *watched, QEvent *e ) + { + if ( watched == d->panel_area->viewport() && e->type() == QEvent::ContextMenu ) { + d->menu->popup( ((QContextMenuEvent*)e)->globalPos() ); + return TRUE; + } + return FALSE; + } + +//-------------------------------------------------------------// + +void KSPanelManager::setOrientation( Qt::Orientation o ) + { + d->o = o; + d->splitter->setOrientation( o ); + adjust_panel_orientation(); + } + +//-------------------------------------------------------------// + +void KSPanelManager::adjust_panel_orientation() + { + if ( d->curr_panel ) { + const QObjectList *objects = d->curr_panel->queryList( "QBoxLayout", 0, FALSE, FALSE ); + if ( objects ) { + QObjectListIt object( *objects ); + while ( (QObject*)object ) { + QBoxLayout *layout = dynamic_cast<QBoxLayout*>((QObject*)object); + if ( layout ) layout->setDirection( d->o==Horizontal ? QBoxLayout::LeftToRight : QBoxLayout::TopToBottom ); + ++object; + } + } + } + } + +//-------------------------------------------------------------// + +void KSPanelManager::resizeEvent ( QResizeEvent * ) + { + d->splitter->resize( size() ); + } diff --git a/kmatplot/kspanelmanager.h b/kmatplot/kspanelmanager.h new file mode 100644 index 0000000..98d33da --- /dev/null +++ b/kmatplot/kspanelmanager.h @@ -0,0 +1,130 @@ +/*************************************************************************** + kspanelmanager.h + ------------------- + begin : Sat Oct 7 2000 + copyright : (C) 2000 by Kamil Dobkowski + email : kamildobk@friko.onet.pl + ***************************************************************************/ + +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + +#ifndef KSPANELMANAGER_H +#define KSPANELMANAGER_H + +#include <qwidget.h> +#include <qframe.h> +#include <qguardedptr.h> +#include <qstringlist.h> +#include <qevent.h> + +#include "widgets/qscobject.h" +#include "widgets/qsplotview.h" +#include "widgets/qsaxes.h" + +class KSPanel; +class KSPanelButton; +class QSGraphicalData; +class KMatplotShell; +struct kspanelmanager_private_data; + +/** + *@author Kamil Dobkowski + */ +class KSPanelManager : public QFrame { + + Q_OBJECT + + public: + /** + * Constructor + */ + KSPanelManager( KMatplotShell *shell, QWidget *parent=0, const char *name=0); + /** + * Destructor + */ + ~KSPanelManager(); + /** + * Sets a new view to use with this panel manager. + */ + void setView( QSPlotView *view ); + /** + * Enables this panel manager to manage panels. + */ + void setEnabled( bool enabled ); + /** + * Apply properties to plot immediately after the controls change. + * Hide apply button + */ + void setAutoSetProperties( bool enabled ); + /** + * Returns enabled setting + */ + bool enabled() const { return is_enabled; } + /** + * + */ + bool autoSetProperties() const { return pr_autoset; } + /** + * Returns the current view + */ + QSPlotView *view() const; + /** + * Event filter to show a contet menu. + */ + virtual bool eventFilter ( QObject *watched, QEvent *e ); + signals: + /** + * Useful hints, help messages, etc. + */ + void message( const QString& message ); + /** + * Data object is selected ( axis, dataset ) + */ + void dataObjectSelected( QSData *data ); + + public slots: + /** + * Show requested panel. + */ + void selectPanel( int category, int element ); + /** + * Sets orientation to Horizontal/Vertical + */ + void setOrientation( Orientation s ); + + protected: + virtual void resizeEvent ( QResizeEvent *event ); + QSCObject *get_curr_object(); + void category_button_factory( int select_category = -1 ); + void panel_button_factory( int category ); + KSPanelButton *panel_button( int button_id ); + void arrange_button_row( const QString& title, int button_num, QSGraphicalData *dataObject = NULL ); + void add_category_button( int category ); + void adjust_panel_orientation(); + bool is_enabled; + bool pr_autoset; + bool pr_reading; + bool pr_applying; + struct kspanelmanager_private_data *d; + + private slots: + + void slot_update_panel_list(); + void slot_update_panel_contents(); + void slot_update_graph(); + void slot_category_selected( int category_id ); + void slot_panel_selected( int panel_id ); + void slot_panel_apply_properties(); + void slot_panel_read_properties(); + void slot_set_message( const QString& info ); + +}; + +#endif diff --git a/kmatplot/ksprojectxml.cpp b/kmatplot/ksprojectxml.cpp new file mode 100644 index 0000000..fc15779 --- /dev/null +++ b/kmatplot/ksprojectxml.cpp @@ -0,0 +1,2777 @@ +/*************************************************************************** + ksprojectxml.cpp + ------------------- + begin : Sun Feb 13 2000 + copyright : (C) 2000 by Kamil Dobkowski + email : kamildobk@friko.onet.pl + ***************************************************************************/ + +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + +#include "ksprojectxml.h" +#include "ksmatrix.h" +#include "widgets/qsconsole.h" +#include "widgets/qsaxis.h" +#include "widgets/qsaxes2d.h" +#include "widgets/qsaxes3d.h" +#include "widgets/qsplot.h" +#include "widgets/qscurve.h" +#include "widgets/qsimage.h" +#include "widgets/qscontour.h" +#include "widgets/qssurface.h" +#include "widgets/qsfigure.h" +#include "widgets/qsclegend.h" +#include "formula/mpformula.h" +#include "ksdatasymbolfactory.h" +#include "qscobjects.h" +#include "ksglobalmatrixlist.h" +#include "ksworkbook.h" +#include "kmatplotshell.h" + + +#include <qmessagebox.h> +#include <qvaluestack.h> +#include <qprinter.h> +#include <qintdict.h> +#include <qregexp.h> +#include <qmap.h> +#include <qxml.h> + + + +// +// Funkcja do zapisywania stringow +// + +typedef QMap<QString,int> attribute_names; + +#define MIMETYPE "application/x-kmatplot" + +// some tag-name ( not all ) +#define KMATPLOT "kmatplot" +#define CANVAS "canvas" +#define PAGE "page" + +#define AXES2D "axes2d" +#define AXES3D "axes3d" +#define CURVE "curve" +#define IMAGE "image" +#define CONTOUR "contour" +#define GCONTOUR "gridded-contour" +#define NGCONTOUR "non-gridded-contour" +#define SURFACE "surface" +#define FIGURE "figure" + +#define KMATPLOT "kmatplot" +#define CANVAS "canvas" +#define PAGE "page" + + + +// reading // writing: +class ksprojectxml_runtime_data : public QXmlDefaultHandler { + + public: + + ksprojectxml_runtime_data(); + ~ksprojectxml_runtime_data(); + + QFile *f; + KSWorkbook *workbook; + KMatplotShell *shell; + +///////////////////////////////// reading //////////////////////////////////////////////// + + enum ParserState { ParseKMatplot, ParseCanvas, ParseSheets, ParseSheet, ParsePage, + ParseAxes2d, ParseAxes3d, ParseAxis, ParseAxesBackground, ParseAxesTitle, + ParseMatrix, ParseMatrixRef, ParseMatrixColRef, ParseMatrixString, ParseMatrixFormula, + ParseCurve, ParseImage, ParseContour, ParseSurface, ParseFigure, + ParseGradient, + ParseCLegend, ParseCLabel, ParseCArrow, ParseCRect, ParseCGroup }; + + QValueStack<ParserState> parser_state; + QString chars; + QString error_string; + void set_error_string( const QString& string ); + int initial_sheets; + + QSPage *curr_page; + KSSheet *curr_sheet; + QSAxes *curr_axes; + QSAxis *curr_axis; + QSPlot *curr_plot; + + QSCurve *curr_curve; + QSImage *curr_image; + QSContour *curr_contour; + QSSurface *curr_surface; + QSFigure *curr_figure; + + QSMatrix *curr_matrix; + int curr_row; + + QSGFill curr_gradient_fill[5]; + int curr_gradient_type; + + QSCLegend *curr_clegend; + QSCLabel *curr_clabel; + QSCArrow *curr_carrow; + QSCRect *curr_crect; + QValueStack<QSCGroup*> curr_cgroup; + + QSAxes2D *curr_axes2d; + QSAxes3D *curr_axes3d; + + + virtual bool startDocument(); + virtual bool startElement( const QString&, const QString&, const QString&, const QXmlAttributes& ); + virtual bool endElement( const QString&, const QString&, const QString& ); + virtual bool characters( const QString& ch ); + virtual bool endDocument(); + virtual bool warning ( const QXmlParseException & exception ); + virtual bool error ( const QXmlParseException & exception ); + virtual bool fatalError ( const QXmlParseException & exception ); + + bool read_sheets_stag( const QString& name, const QXmlAttributes& attr ); + bool read_sheet_stag( const QString& name, const QXmlAttributes& attr ); + + bool read_kmatplot_stag( const QString& name, const QXmlAttributes& attr ); + bool read_canvas_stag( const QString& name, const QXmlAttributes& attr ); + bool read_page_stag( const QString& name, const QXmlAttributes& attr ); + bool read_axis_background_stag( const QString& name, const QXmlAttributes& attr ); + bool read_axis_title_stag( const QString& name, const QXmlAttributes& attr ); + bool read_axis_stag( const QString& name, const QXmlAttributes& attr ); + + bool read_curve_stag( const QString& name, const QXmlAttributes& attr ); + bool read_image_stag( const QString& name, const QXmlAttributes& attr ); + bool read_contour_stag( const QString& name, const QXmlAttributes& attr ); + bool read_surface_stag( const QString& name, const QXmlAttributes& attr ); + bool read_figure_stag( const QString& name, const QXmlAttributes& attr ); + bool read_gradient_stag( const QString& name, const QXmlAttributes& attr ); + + bool read_axes_2d_stag( const QString& name, const QXmlAttributes& attr ); + bool read_axes_3d_stag( const QString& name, const QXmlAttributes& attr ); + bool read_clegend_stag( const QString& name, const QXmlAttributes& attr ); + bool read_clabel_stag( const QString& name, const QXmlAttributes& attr ); + bool read_carrow_stag( const QString& name, const QXmlAttributes& attr ); + bool read_crect_stag( const QString& name, const QXmlAttributes& attr ); + bool read_cgroup_stag( const QString& name, const QXmlAttributes& attr ); + bool read_cobject_stag( QSCObject *object, const QString& name, const QXmlAttributes& attr ); + bool read_some_object_stag( QSCObjectCollection *collection, const QString& name, const QXmlAttributes& attr ); + + bool read_matrix_stag( const QString& name, const QXmlAttributes& attr ); + bool read_matrix_ref_stag( const QString& name, const QXmlAttributes& attr ); + bool read_matrix_col_ref_stag( const QString& name, const QXmlAttributes& attr ); + bool read_matrix_string_stag( const QString& name, const QXmlAttributes& attr ); + bool read_matrix_formula_stag( const QString& name, const QXmlAttributes& attr ); + + bool read_sheets_etag( const QString& name ); + bool read_sheet_etag( const QString& name ); + + bool read_kmatplot_etag( const QString& name ); + bool read_canvas_etag( const QString& name ); + bool read_page_etag( const QString& name ); + bool read_axis_background_etag( const QString& name ); + bool read_axis_title_etag( const QString& name ); + bool read_axis_etag( const QString& name ); + + bool read_curve_etag( const QString& name ); + bool read_image_etag( const QString& name ); + bool read_contour_etag( const QString& name ); + bool read_surface_etag( const QString& name ); + bool read_figure_etag( const QString& name ); + bool read_gradient_etag( const QString& name ); + + bool read_clegend_etag( const QString& name ); + bool read_clabel_etag( const QString& name ); + bool read_carrow_etag( const QString& name ); + bool read_crect_etag( const QString& name ); + bool read_axes_2d_etag( const QString& name ); + bool read_axes_3d_etag( const QString& name ); + bool read_cgroup_etag( const QString& name ); + + bool read_matrix_etag( const QString& name ); + bool read_matrix_ref_etag( const QString& name ); + bool read_matrix_col_ref_etag( const QString& name ); + bool read_matrix_string_etag( const QString& name ); + bool read_matrix_formula_etag( const QString& name ); + + bool read_axes( QSAxes *a, const QString& name, const QXmlAttributes& attr ); + bool read_plot( QSPlot *p, const QString& name, const QXmlAttributes& attr ); + bool read_plot_3d( QSPlot3D *p, const QString& name, const QXmlAttributes& attr ); + bool read_base( QSGraphicalData *b, const QString& name, const QXmlAttributes& attr ); + bool read_data( QSData *d, const QString& name, const QXmlAttributes& attr ); + + QSPt2 read_pt2( const QXmlAttributes& attr ); + QSPt3 read_pt3( const QXmlAttributes& attr ); + QSPt3f read_pt3f( const QXmlAttributes& attr ); + QSGFill read_fill( const QXmlAttributes& attr ); + QSGLine read_line( const QXmlAttributes& attr ); + QSGFont read_font( const QXmlAttributes& attr ); + QSGArrow read_arrow( const QXmlAttributes& attr ); + QSGPoint read_point( const QXmlAttributes& attr ); + int element_number( const QXmlAttributes& attr ); + int sheet_number( int sheet ) { return sheet+initial_sheets; } + void create_matrix( QSData *d, const QString& name, const QXmlAttributes& attr ); + QSAxes *cobject_parent_axes( const QXmlAttributes& attr ); + QObject *cobject_parent( const QXmlAttributes& attr ); + void cobject_set_default_axes( QSCObject *object, const QXmlAttributes& attr ); + bool remove_default_axes( QSAxes *axes ); + + +///////////////////////////////// writing //////////////////////////////////////////////// + + int indent; + + void xml( const QString& line ); + void write_data( QSData *data ); + void write_base( QSGraphicalData *base ); + void write_axes( QSAxes *axes ); + void write_dataset( QSPlot *plot, int stack_order ); + void write_plot_3d( QSPlot3D *plot_3d ); + void write_some_object( QSCObject *object ); + void write_object( QSCObject *object ); + void write_group( QSCGroup *object ); + void write_matrix( QSMatrix *m, int channel_nr ); + void write_line( const QSGLine& l, int element ); + void write_fill( const QSGFill& f, int element ); + void write_font( const QSGFont& f, int element ); + void write_point( const QSGPoint& p, int element ); + void write_arrow( const QSGArrow& a, int element ); + void write_point( const QSPt3f& p, const QString& name ); + void write_point( const QSPt3& p, const QString& name ); + void write_point( const QSPt2& p, const QString& name ); + void write_gradient( const QSGGradient& g ); + void write_global_matrix_list( KSSheetList *sheets ); + void write_global_matrix( int sheetNumber ); + +//////////////////////// utilities ////////////////////////////////////////////////// + + attribute_names etype; + attribute_names page_size; + attribute_names orientation; + attribute_names line_style; + attribute_names fill_style; + attribute_names point_style; + attribute_names point_fill_style; + attribute_names arrow_style; + attribute_names axis_scale; + attribute_names axis_type; + attribute_names series_type; + attribute_names gradient_type; + attribute_names column_type; + + QString xml_from_string( QString text ); + QString xml_to_string( QString text ); + QString get_attr_name( attribute_names& attr, int value ); + int get_attr_value( attribute_names& attr, const QString& name ); + }; + +//-----------------------------------------------------------// + +KSProjectXML::KSProjectXML( KMatplotShell *shell ) + { + m_shell = shell; + d = NULL; + } + +//-----------------------------------------------------------// + +KSProjectXML::~KSProjectXML() + { + free_runtime_data(); + } + +//-----------------------------------------------------------// + +void KSProjectXML::alloc_runtime_data() + { + d = new ksprojectxml_runtime_data(); + d->shell = m_shell; + d->workbook = m_shell->workbook(); + d->initial_sheets = m_shell->workbook()->sheets()->childCount(); + } + +//-----------------------------------------------------------// + +void KSProjectXML::free_runtime_data() + { + delete d; d = NULL; + } + +//-----------------------------------------------------------// + +ksprojectxml_runtime_data::ksprojectxml_runtime_data() + { + indent = 0; + + page_size.insert( "A4", QPrinter::A4 ); + page_size.insert( "B5", QPrinter::B5 ); + page_size.insert( "Letter", QPrinter::Letter ); + page_size.insert( "Legal", QPrinter::Legal ); + page_size.insert( "Executive", QPrinter::Executive ); + page_size.insert( "A0", QPrinter::A0 ); + page_size.insert( "A1", QPrinter::A1 ); + page_size.insert( "A2", QPrinter::A2 ); + page_size.insert( "A3", QPrinter::A3 ); + page_size.insert( "A5", QPrinter::A5 ); + page_size.insert( "A6", QPrinter::A6 ); + page_size.insert( "A7", QPrinter::A7 ); + page_size.insert( "A8", QPrinter::A8 ); + page_size.insert( "A9", QPrinter::A9 ); + page_size.insert( "B0", QPrinter::B0 ); + page_size.insert( "B1", QPrinter::B1 ); + page_size.insert( "B10", QPrinter::B10 ); + page_size.insert( "B2", QPrinter::B2 ); + page_size.insert( "B3", QPrinter::B3 ); + page_size.insert( "B4", QPrinter::B4 ); + page_size.insert( "B6", QPrinter::B6 ); + page_size.insert( "B7", QPrinter::B7 ); + page_size.insert( "B8", QPrinter::B8 ); + page_size.insert( "B9", QPrinter::B9 ); + page_size.insert( "C5E", QPrinter::C5E ); + page_size.insert( "Comm10E", QPrinter::Comm10E ); + page_size.insert( "DLE", QPrinter::DLE ); + page_size.insert( "Folio", QPrinter::Folio ); + page_size.insert( "Ledger", QPrinter::Ledger ); + page_size.insert( "Tabloid", QPrinter::Tabloid ); + page_size.insert( "NPageSize", QPrinter::NPageSize ); + + + orientation.insert( "Portrait", QPrinter::Portrait ); + orientation.insert( "Landscape", QPrinter::Landscape ); + + etype.insert( "double", EDouble ); + etype.insert( "float", EFloat ); + etype.insert( "long", ELong ); + etype.insert( "unsigned short", EUShort ); + etype.insert( "short", EShort ); + etype.insert( "unsigned char", EUChar ); + + fill_style.insert( "transparent", QSGFill::Transparent ); + fill_style.insert( "solid", QSGFill::Solid ); + fill_style.insert( "hlines", QSGFill::Horiz ); + fill_style.insert( "vlines", QSGFill::Vert ); + fill_style.insert( "crossing", QSGFill::Cross ); + fill_style.insert( "fdiag", QSGFill::BDiag ); + fill_style.insert( "bdiag", QSGFill::FDiag ); + fill_style.insert( "diagcross", QSGFill::DiagCross ); + fill_style.insert( "half", QSGFill::Half ); + + line_style.insert( "invisible", QSGLine::Invisible ); + line_style.insert( "solid", QSGLine::Solid ); + line_style.insert( "dash", QSGLine::Dash ); + line_style.insert( "dash-dot", QSGLine::DashDot ); + line_style.insert( "dot", QSGLine::Dot ); + line_style.insert( "dash-dot-dot", QSGLine::DashDotDot ); + + point_style.insert( "invisible", QSGPoint::Invisible ); + point_style.insert( "circle", QSGPoint::Circle ); + point_style.insert( "rectangle", QSGPoint::Rect ); + point_style.insert( "triangle", QSGPoint::Triangle ); + point_style.insert( "diamond", QSGPoint::Diamond ); + point_style.insert( "cross", QSGPoint::Cross ); + point_style.insert( "plus", QSGPoint::Plus ); + point_style.insert( "hline", QSGPoint::HLine ); + point_style.insert( "vline", QSGPoint::VLine ); + + point_fill_style.insert( "transparent", QSGPoint::Transparent ); + point_fill_style.insert( "opaque", QSGPoint::Opaque ); + point_fill_style.insert( "filled", QSGPoint::Filled ); + + arrow_style.insert( "none", QSGArrow::None ); + arrow_style.insert( "normal", QSGArrow::Arrow ); + arrow_style.insert( "filled", QSGArrow::FArrow ); + arrow_style.insert( "narrow", QSGArrow::NArrow ); + arrow_style.insert( "reversed", QSGArrow::RArrow ); + arrow_style.insert( "reversed-filled", QSGArrow::RFArrow ); + arrow_style.insert( "reversed-narrow", QSGArrow::RNArrow ); + arrow_style.insert( "rectangle", QSGArrow::Rect ); + arrow_style.insert( "diamond", QSGArrow::Diamond ); + arrow_style.insert( "circle", QSGArrow::Circle ); + arrow_style.insert( "line", QSGArrow::Line ); + arrow_style.insert( "fdiag", QSGArrow::FDiagLine ); + arrow_style.insert( "bdiag", QSGArrow::BDiagLine ); + + axis_type.insert( "X", QSAxis::XAxisType ); + axis_type.insert( "Y", QSAxis::YAxisType ); + axis_type.insert( "Z", QSAxis::ZAxisType ); + axis_type.insert( "V", QSAxis::VAxisType ); + axis_type.insert( "?", QSAxis::UnknownAxisType ); + + axis_scale.insert( "linear", QSAxis::LinearScale ); + axis_scale.insert( "log", QSAxis::LogScale ); + + series_type.insert( "lines", QSCurve::Lines ); + series_type.insert( "area", QSCurve::Area ); + series_type.insert( "ribbon", QSCurve::Ribbon ); + series_type.insert( "bars", QSCurve::Bars ); + series_type.insert( "vectors", QSCurve::Vectors ); + series_type.insert( "flux", QSCurve::Flux ); + series_type.insert( "rectangles", QSCurve::Rectangles ); + series_type.insert( "ellipses", QSCurve::Ellipses ); + series_type.insert( "left-stairs", QSCurve::LeftStairs ); + series_type.insert( "middle-stairs", QSCurve::MiddleStairs ); + series_type.insert( "right-stairs", QSCurve::RightStairs ); + + gradient_type.insert( "default", QSGGradient::GDefault ); + gradient_type.insert( "gray", QSGGradient::GGray ); + gradient_type.insert( "strange", QSGGradient::GStrange ); + gradient_type.insert( "two-colors", QSGGradient::GTwoColors ); + gradient_type.insert( "five-colors", QSGGradient::GFiveColors ); + + column_type.insert("unknown",KSSheet::ColumnUnknown ); + column_type.insert("x",KSSheet::ColumnX ); + column_type.insert("y",KSSheet::ColumnY ); + column_type.insert("z",KSSheet::ColumnZ ); + column_type.insert("v",KSSheet::ColumnV ); + column_type.insert("dx",KSSheet::ColumnDX ); + column_type.insert("dy",KSSheet::ColumnDY ); + } + +//-----------------------------------------------------------// + +ksprojectxml_runtime_data::~ksprojectxml_runtime_data() + { + } + + +//-----------------------------------------------------------// + +int ksprojectxml_runtime_data::get_attr_value( attribute_names& attr, const QString& name ) + { + if ( attr.contains(name) ) return attr[name]; + return attr.begin().data(); + } + +//-----------------------------------------------------------// + +QString ksprojectxml_runtime_data::get_attr_name( attribute_names& attr, int value ) + { + attribute_names::Iterator it; + for( it = attr.begin(); it != attr.end(); it++ ) { + if ( it.data() == value ) return it.key(); + } + return attr.begin().key(); + } + + +//-----------------------------------------------------------// +//-----------------------------------------------------------// +//-----------------------------------------------------------// +//-----------------------------------------------------------// +//-----------------------------------------------------------// + +bool KSProjectXML::saveToFile( QFile& f ) + { + QString l; + + //os.precision(9); + //os.setEncoding( QTextStream::UnicodeUTF8 ); + + alloc_runtime_data(); + d->f = &f; + + // write header + xml( "<?xml version='1.0' encoding='UTF-8'?>" ); + xml( "<!DOCTYPE kmatplot>" ); + xml( "<kmatplot mime='"MIMETYPE"' editor='KMatplot' version='0.3' url='http://kmatplot.sourceforge.net' program-author='K. Dobkowski'>" ); + d->indent++; + + // write canvas header + l = "<canvas page-size='%1' orientation='%2' dpi='%3'>"; + l = l.arg( d->get_attr_name( d->page_size, d->workbook->printer()->pageSize()) ); + l = l.arg( d->get_attr_name( d->orientation, d->workbook->printer()->orientation()) ); + l = l.arg( 72.0 ); + xml( l ); + d->indent++; + + // write sheets + d->write_global_matrix_list( m_shell->workbook()->sheets() ); + + + for( int page_nr=0; page_nr<d->workbook->pageCount(); page_nr++ ) { + d->curr_page = d->workbook->page(page_nr); + l = "<page number='%1' title='%2'>"; + l = l.arg( page_nr ); + l = l.arg( d->xml_from_string(d->curr_page->title()) ); + xml( l ); + d->indent++; + + // write objects + for( int object_nr=0; object_nr<d->curr_page->objects()->count(); object_nr++ ) { + d->write_some_object( d->curr_page->objects()->object(object_nr) ); + } + + d->indent--; + xml("</page>"); + } + + d->indent--; + xml("</canvas>"); + + d->indent--; + xml( "</kmatplot>"); + + free_runtime_data(); + return true; + } + +//-----------------------------------------------------------// + +void ksprojectxml_runtime_data::write_global_matrix_list( KSSheetList *sheets ) + { + QString l = "<sheets number='%1'>"; + l = l.arg( sheets->childCount() ); + xml( l ); + indent++; + for( int sheet_nr=0; sheet_nr<sheets->childCount(); sheet_nr++ ) { + write_global_matrix( sheet_nr ); + } + indent--; + xml("</sheets>"); + // no write_data + } + +//-----------------------------------------------------------// + +void ksprojectxml_runtime_data::write_global_matrix( int sheetNumber ) + { + KSSheet *sheet = workbook->sheets()->child(sheetNumber); + QString l = "<sheet number='%1' name='%2'>"; + l = l.arg( sheetNumber ); + l = l.arg( sheet->objectName() ); + xml( l ); + indent++; + // write column types + const KSSheet::ColumnInfo *columns = sheet->columnInfo(); + KSSheet::ColumnInfo::ConstIterator curr_col; + for( curr_col = columns->begin(); curr_col != columns->end(); ++curr_col ) { + l = "<column number='%1' title='%2' type='%3'/>"; + l = l.arg( curr_col.key() ); + l = l.arg( xml_from_string(curr_col.data().title) ); + l = l.arg( get_attr_name(column_type,curr_col.data().type) ); + xml(l); + } + write_data( sheet ); + indent--; + xml("</sheet>"); + } + +//-----------------------------------------------------------// + +void ksprojectxml_runtime_data::write_axes( QSAxes *axes ) + { + QString l; + QSAxes2D *axes_2d = dynamic_cast<QSAxes2D *>(axes); + QSAxes3D *axes_3d = dynamic_cast<QSAxes3D *>(axes); + QString type = axes_2d ? AXES2D : AXES3D; + // position and type + l = "<%1>"; + l = l.arg( type ); + xml( l ); indent++; + + // area + l = "<area xmm='%1' ymm='%2' wmm='%3' hmm='%4'/>"; + l = l.arg(axes->posMM().x); + l = l.arg(axes->posMM().y); + l = l.arg(axes->sizeMM().x); + l = l.arg(axes->sizeMM().y); + xml( l ); + + // draw in background + l = "<draw-in-background enabled='%1'/>"; + l = l.arg( axes->drawInBackground() ); + xml( l ); + + // title + xml( "<title-attributes>"); + indent++; + indent--; + xml( "</title-attributes>"); + + // background + xml("<background-attributes>"); + indent++; + write_fill( axes->background(), -1 ); + indent--; + xml("</background-attributes>"); + + // write 2d axes properties + if ( axes_2d ) { + l = "<frame width='%1'/>"; + l = l.arg( axes_2d->frameWidth() ); + xml( l ); + } + + // write 3d axes + if ( axes_3d ) { + + // OpenGL + l = "<opengl enabled='%1' enable-transparency='%2' global-transparency='%3' shade-walls='%4' auto-stroke='%5' auto-stroke-lightness='%6'/>"; + l = l.arg( axes_3d->openGL() ); + l = l.arg( axes_3d->glTransparency() ); + l = l.arg( axes_3d->glGlobalTransparency() ); + l = l.arg( axes_3d->glShadeWalls() ); + l = l.arg( axes_3d->glMeshAutoStroke() ); + l = l.arg( axes_3d->glAutoStrokeLightness() ); + xml( l ); + + // walls + l = "<wall-thickness xy='%1' xz='%2' yz='%3'/>"; + l = l.arg( axes_3d->xyWallThickness() ); + l = l.arg( axes_3d->xzWallThickness() ); + l = l.arg( axes_3d->yzWallThickness() ); + xml( l ); + + // edges + l = "<edge-length x='%1' y='%2' z='%3'/>"; + l = l.arg( axes_3d->xEdgeLength() ); + l = l.arg( axes_3d->yEdgeLength() ); + l = l.arg( axes_3d->zEdgeLength() ); + xml( l ); + + // viewpoint + l = "<viewpoint azimuth='%1' elevation='%2' distance='%3'/>"; + l = l.arg( axes_3d->azimuth() ); + l = l.arg( axes_3d->elevation() ); + l = l.arg( axes_3d->distance() ); + xml( l ); + + // light + l = "<light enabled='%1' azimuth='%2' elevation='%3' ambient-intensity='%4' directed-intensity='%5'/>"; + l = l.arg( axes_3d->light() ); + l = l.arg( axes_3d->lightAzimuth() ); + l = l.arg( axes_3d->lightElevation() ); + l = l.arg( axes_3d->ambientLight() ); + l = l.arg( axes_3d->directLight() ); + xml( l ); + + // projection + l = "<perspective enabled='%1' focus-distance='%2'/>"; + l = l.arg( axes_3d->perspective() ); + l = l.arg( axes_3d->focusDistance() ); + xml( l ); + + //autoscale + l = "<autoscale enabled='%1'/>"; + l = l.arg( axes_3d->autoscale() ); + xml( l ); + } + + // axes + for( int axis_nr=0; axis_nr<axes->axisCount(); axis_nr++ ) { + QSAxis *axis = axes->axis(axis_nr); + l = "<axis type='%1' visible='%2' scrollable='%3'>"; + l = l.arg( get_attr_name( axis_type, axis->type() ) ); + l = l.arg( axis->visible() ); + l = l.arg( axis->scrollable() ); + xml( l ); + indent++; + + write_arrow( axis->arrow1(), 1 ); + write_arrow( axis->arrow2(), 2 ); + l = "<display position='%1' default='%2' opposite='%3' />"; + l = l.arg( axis->position() ); + l = l.arg( axis->defaultPosition() ); + l = l.arg( axis->oppositePosition() ); + xml( l ); + l = "<range min='%1' max='%2' rounded='%3'/>"; + l = l.arg( axis->min() ); + l = l.arg( axis->max() ); + l = l.arg( axis->roundRangeToTicStep() ); + xml( l ); + l = "<scale type='%1' base='%2' reversed='%3'/>"; + l = l.arg( get_attr_name(axis_scale,axis->scaleType()) ); + l = l.arg( axis->scaleBase() ); + l = l.arg( axis->reversed() ); + xml( l ); + l = "<grid-step major='%1' minor='%2'/>"; + l = l.arg( axis->majorGridStep() ); + l = l.arg( axis->minorGridStep() ); + xml( l ); + l = "<tics format='%1' visible='%2' outer='%3' angle='%4' pos1='%5' pos2='%6'/>"; + l = l.arg( xml_from_string(axis->ticsFormat()) ); + l = l.arg( axis->ticsVisible() ); + l = l.arg( axis->ticsOuter() ); + l = l.arg( axis->ticsAngle() ); + l = l.arg( axis->ticLabelPos1() ); + l = l.arg( axis->ticLabelPos2() ); + xml( l ); + l = "<title-position pos='%1' distance='%2'/>"; + l = l.arg( axis->titlePosition() ); + l = l.arg( axis->titleDistance() ); + xml( l ); + + for( int i=0; i<3; i++ ) { + l = "<remembered-view number='%1' min='%2' max='%3' scale='%4' base='%5' reversed='%6' rounded='%7'/>"; + l = l.arg( i ); + l = l.arg( axis->rememberedViews[i].min ); + l = l.arg( axis->rememberedViews[i].max ); + l = l.arg( get_attr_name(axis_scale,axis->rememberedViews[i].scale) ); + l = l.arg( axis->rememberedViews[i].base ); + l = l.arg( axis->rememberedViews[i].reversed ); + l = l.arg( axis->rememberedViews[i].round ); + xml( l ); + } + + write_base( axis ); + + indent--; + xml("</axis>"); + } + + // write base object + write_base( axes ); + + // write datasets + for( int dataset_nr=0; dataset_nr<axes->plotCount(); dataset_nr++ ) { + write_dataset( axes->plot(dataset_nr), dataset_nr ); + } + + // write group object + write_group( axes->shadowObject() ); + + indent--; + l = "</%1>"; + l = l.arg( type ); + xml( l ); + } + +//-----------------------------------------------------------// + +void ksprojectxml_runtime_data::write_dataset( QSPlot *plot, int stack_order ) + { + QString l; + QString type; + QSCurve *cr = dynamic_cast<QSCurve*>(plot); + QSImage *im = dynamic_cast<QSImage*>(plot); + QSContour *ct = dynamic_cast<QSContour*>(plot); + QSSurface *sf = dynamic_cast<QSSurface*>(plot); + QSFigure *fg = dynamic_cast<QSFigure*>(plot); + + QSGriddedContour *gct = dynamic_cast<QSGriddedContour*>(plot); + QSNonGriddedContour *ngct = dynamic_cast<QSNonGriddedContour*>(plot); + + if ( cr ) type = CURVE; + else if ( im ) type = IMAGE; + else if ( gct ) type = GCONTOUR; + else if ( ngct ) type = NGCONTOUR; + else if ( sf ) type = SURFACE; + else if ( fg ) type = FIGURE; + else type = "unknown"; + + l = "<%1 stack-order='%2'>"; + l = l.arg( type ); + l = l.arg( stack_order ); + xml( l ); + indent++; + + // legend item + l = "<legend-item visible='%1'/>"; + l = l.arg( plot->legendItemVisible() ); + xml( l ); + + // default axes + l = "<default-axis x-axis='%1' y-axis='%2' z-axis='%3' v-axis='%4'/>"; + l = l.arg( plot->parentAxes()->axisIndex(plot->defaultAxis(QSAxis::XAxisType)) ); + l = l.arg( plot->parentAxes()->axisIndex(plot->defaultAxis(QSAxis::YAxisType)) ); + l = l.arg( plot->parentAxes()->axisIndex(plot->defaultAxis(QSAxis::ZAxisType)) ); + l = l.arg( plot->parentAxes()->axisIndex(plot->defaultAxis(QSAxis::VAxisType)) ); + xml( l ); + + // gradient + write_gradient( plot->gradient() ); + + // curve + if ( cr ) { + l = "<series type='%1'/>"; + l = l.arg( get_attr_name(series_type,cr->type()) ); + xml( l ); + + l = "<delta fixed-x='%1' fixed-y='%2' percent-x='%3' percent-y='%4'/>"; + l = l.arg( cr->fixedDelta().x ); + l = l.arg( cr->fixedDelta().y ); + l = l.arg( cr->percentDelta().x ); + l = l.arg( cr->percentDelta().y ); + xml( l ); + + l = "<zero x='%1' y='%2'/>"; + l = l.arg( cr->zeroPoint().x ); + l = l.arg( cr->zeroPoint().y ); + xml( l ); + + write_arrow( cr->arrow1(), 1 ); + write_arrow( cr->arrow2(), 2 ); + } + else + // image + if ( im ) { + l = "<raw-mode enabled='%1'/>"; + l = l.arg( im->rawMode() ); + xml( l ); + l = "<use-gradient enabled='%1'/>"; + l = l.arg( im->useGradient() ); + xml( l );; + } + else + // contour + if ( ct ) { + l = "<filled enabled='%1'/>"; + l = l.arg( ct->contourFills() ); + xml( l ); + + l = "<lines enabled='%1'/>"; + l = l.arg( ct->contourLines() ); + xml( l ); + + l = "<labels enabled='%1' spacing='%2'/>"; + l = l.arg( ct->contourLabels() ); + l = l.arg( ct->labelSpacing() ); + xml( l ); + } + else + // surface + if ( sf ) { + l = "<grid x-step='%1' y-step='%2'/>"; + l = l.arg( sf->xGridStep() ); + l = l.arg( sf->yGridStep() ); + xml( l ); + + write_plot_3d( sf ); + } + else + // figure + if ( fg ) { + l = "<vertex-compare accuracy='%1'/>"; + l = l.arg( fg->vertexCompareAccuracy() ); + xml( l ); + write_plot_3d( fg ); + } + + write_base( plot ); + indent--; + l = "</%1>"; + l = l.arg( type ); + xml( l ); + } +//-----------------------------------------------------------// + +void ksprojectxml_runtime_data::write_plot_3d( QSPlot3D *plot_3d ) + { + QString l; + //autodivide + l = "<autodivide enabled='%1'/>"; + l = l.arg( plot_3d->autoDivide() ); + xml( l ); + + // colored + l = "<colored enabled='%1'/>"; + l = l.arg( plot_3d->colored() ); + xml( l ); + + // topBottom + l = "<topbottom enabled='%1'/>"; + l = l.arg( plot_3d->topBottom() ); + xml( l ); + + l = "<edges autocolor='%1'/>"; + l = l.arg( plot_3d->edgeAutoColor() ); + xml( l ); + } + +//-----------------------------------------------------------// + +void ksprojectxml_runtime_data::write_base( QSGraphicalData *base ) + { + QString l = "<title text='%1'/>"; + l = l.arg( xml_from_string(base->title()) ); + xml( l ); + + for( int line_nr=0; line_nr<base->lineCount(); line_nr ++ ) + write_line( base->line(line_nr), line_nr ); + + for( int fill_nr=0; fill_nr<base->fillCount(); fill_nr ++ ) + write_fill( base->fill(fill_nr), fill_nr ); + + for( int font_nr=0; font_nr<base->fontCount(); font_nr ++ ) + write_font( base->font(font_nr), font_nr ); + + for( int point_nr=0; point_nr<base->pointCount(); point_nr ++ ) + write_point( base->point(point_nr), point_nr ); + + write_data( base ); + } + +//-----------------------------------------------------------// + +void ksprojectxml_runtime_data::write_data( QSData *data ) + { + for( int channel_nr=0; channel_nr<data->channelCount(); channel_nr++ ) + write_matrix( data->matrix(channel_nr), channel_nr ); + } + +//-----------------------------------------------------------// + +void ksprojectxml_runtime_data::write_gradient( const QSGGradient& g ) + { + QString l = "<gradient type='%1'>"; + l = l.arg( get_attr_name( gradient_type, g.type() ) ); + xml( l ); + indent++; + write_fill( g.fill(0), 0 ); + write_fill( g.fill(1), 1 ); + write_fill( g.fill(2), 2 ); + write_fill( g.fill(3), 3 ); + write_fill( g.fill(4), 4 ); + indent--; + xml("</gradient>"); + } + +//-----------------------------------------------------------// + +void ksprojectxml_runtime_data::write_some_object( QSCObject *object ) + { + QSCLegend *legend = dynamic_cast<QSCLegend *>(object); + QSCLabel *label = dynamic_cast<QSCLabel*>(object); + QSCArrow *arrow = dynamic_cast<QSCArrow*>(object); + QSCRect *rectangle = dynamic_cast<QSCRect*>(object); + QSCGroup *group = dynamic_cast<QSCGroup*>(object); + QString l; + + // axes + if ( object->isAxesShadow() ) { + write_axes( object->parentAxes() ); + } + // legend + else if ( legend ) { + xml( "<legend>" ); + indent++; + l = "<align frame='%1'/>"; + l = l.arg( legend->align() ); + xml( l ); + l = "<format columns='%1'/>"; + l = l.arg( legend->columns() ); + xml( l ); + write_point( legend->pos(), "pos" ); + write_point( legend->coord(), "coord-system" ); + write_point( legend->shadowPos(), "shadow-shift" ); + write_font( legend->font(), 1 ); + write_fill( legend->fill(), 1 ); + write_line( legend->frame(), 1 ); + write_fill( legend->shadowFill(), 2 ); + write_object( legend ); + indent--; + xml( "</legend>" ); + } + // label + else if ( label ) { + xml( "<label>" ); + indent++; + l = "<text>%1</text>"; + l = l.arg( xml_from_string(label->text()) ); + xml( l ); + l = "<angle deg='%1'/>"; + l = l.arg( label->angle() ); + xml( l ); + l = "<align text='%1' frame='%2'/>"; + l = l.arg( label->textAlign() ); + l = l.arg( label->frameAlign() ); + xml( l ); + write_point( label->pos(), "pos" ); + write_point( label->coord(), "coord-system" ); + write_point( label->shadowPos(), "shadow-shift" ); + write_font( label->font(), 1 ); + write_fill( label->fill(), 1 ); + write_line( label->frame(), 1 ); + write_fill( label->shadowFill(), 2 ); + write_object( label ); + indent--; + xml( "</label>" ); + } + // arrow + else if ( arrow ) { + xml( "<arrow>" ); + indent++; + write_point( arrow->originPos(), "begin" ); + write_point( arrow->endPos(), "end" ); + write_point( arrow->originCoord(), "coord-system-begin" ); + write_point( arrow->endCoord(), "coord-system-end" ); + write_line( arrow->line(), 1 ); + write_arrow( arrow->originArrow(), 1 ); + write_arrow( arrow->endArrow(), 2 ); + write_point( arrow->originPoint(), 1 ); + write_point( arrow->endPoint(), 2 ); + write_object( arrow ); + indent--; + xml( "</arrow>" ); + } + // rectangle + else if ( rectangle ) { + xml( "<rectangle>" ); + indent++; + l = "<type ellipse='%1'/>"; + l = l.arg( rectangle->ellipse() ); + xml( l ); + write_point( rectangle->originPos(), "begin" ); + write_point( rectangle->endPos(), "end" ); + write_point( rectangle->originCoord(), "coord-system-begin" ); + write_point( rectangle->endCoord(), "coord-system-end" ); + write_point( rectangle->shadowPos(), "shadow-shift" ); + write_fill( rectangle->fill(), 1 ); + write_line( rectangle->frame(), 1 ); + write_fill( rectangle->shadowFill(), 2 ); + write_object( rectangle ); + indent--; + xml("</rectangle>"); + } + // group + else if ( group ) { + xml( "<group>" ); + indent++; + write_group( group ); + indent--; + xml( "</group>" ); + } + } + +//-----------------------------------------------------------// + +void ksprojectxml_runtime_data::write_object( QSCObject *object ) + { + QString l = "<axes-bindings x-axis='%1' y-axis='%2' z-axis='%3'/>"; + l = l.arg( object->defaultXAxis() ); + l = l.arg( object->defaultYAxis() ); + l = l.arg( object->defaultZAxis() ); + xml( l ); + } + +//-----------------------------------------------------------// + +void ksprojectxml_runtime_data::write_group( QSCGroup *group ) + { + for ( int i=0; i<group->objects()->count(); i++ ) { + write_some_object( group->objects()->object(i) ); + } + } + +//-----------------------------------------------------------// + +void ksprojectxml_runtime_data::write_line( const QSGLine& line, int element ) + { + QString l = "<line element-number='%1' style='%2' width='%3' color='%4'/>"; + l = l.arg(element); + l = l.arg(get_attr_name(line_style,line.style)); + l = l.arg(line.width); + l = l.arg(toQString(line.color)); + xml( l ); + } + +//-----------------------------------------------------------// + +void ksprojectxml_runtime_data::write_fill( const QSGFill& f, int element ) + { + QString l = "<fill element-number='%1' style='%2' color='%3'/>"; + l = l.arg(element); + l = l.arg(get_attr_name(fill_style,f.style)); + l = l.arg(toQString(f.color)); + xml( l ); + } + +//-----------------------------------------------------------// + +void ksprojectxml_runtime_data::write_font( const QSGFont& f, int element ) + { + QString l = "<font element-number='%1' family='%2' size='%3' bold='%4' italic='%5' color='%6'/>"; + l = l.arg(element); + l = l.arg(f.family); + l = l.arg(f.size); + l = l.arg(f.bold); + l = l.arg(f.italic); + l = l.arg(toQString(f.color)); + xml( l ); + } + +//-----------------------------------------------------------// + +void ksprojectxml_runtime_data::write_point( const QSGPoint& p, int element ) + { + QString l = "<point element-number='%1' style='%2' fill='%3' size='%4' color='%5'/>"; + l = l.arg(element); + l = l.arg(get_attr_name(point_style,p.style)); + l = l.arg(get_attr_name(point_fill_style,p.fill)); + l = l.arg(p.size); + l = l.arg(toQString(p.color)); + xml( l ); + } + +//-----------------------------------------------------------// + +void ksprojectxml_runtime_data::write_arrow( const QSGArrow& a, int element ) + { + QString l = "<dart element-number='%1' style='%2' size='%3' />"; + l = l.arg(element); + l = l.arg(get_attr_name(arrow_style,a.style)); + l = l.arg(a.size); + xml( l ); + } +//-----------------------------------------------------------// + +void ksprojectxml_runtime_data::write_point( const QSPt3f& p, const QString& name ) + { + QString l = "<%1 x='%2' y='%3' z='%4'/>"; + l = l.arg( name ); + l = l.arg( p.x ); + l = l.arg( p.y ); + l = l.arg( p.z ); + xml( l ); + } + +//-----------------------------------------------------------// + +void ksprojectxml_runtime_data::write_point( const QSPt3& p, const QString& name ) + { + QString l = "<%1 x='%2' y='%3' z='%4'/>"; + l = l.arg( name ); + l = l.arg( p.x ); + l = l.arg( p.y ); + l = l.arg( p.z ); + xml( l ); + } + +//-----------------------------------------------------------// + +void ksprojectxml_runtime_data::write_point( const QSPt2& p, const QString& name ) + { + QString l = "<%1 x='%2' y='%3'/>"; + l = l.arg( name ); + l = l.arg( p.x ); + l = l.arg( p.y ); + xml( l ); + } + +//-----------------------------------------------------------// + +void ksprojectxml_runtime_data::write_matrix( QSMatrix *m, int channel ) + { + if ( m == NULL ) return; + KSMatrix *ks_matrix = dynamic_cast<KSMatrix *>(m); + KSMatrixString *ks_matrix_string = dynamic_cast<KSMatrixString *>(m); + KSMatrixFormula *ks_matrix_formula = dynamic_cast<KSMatrixFormula *>(m); + KSMatrixWorksheetCellRange *ks_matrix_ref = dynamic_cast<KSMatrixWorksheetCellRange *>(m); + + // Write subclass shell + if ( ks_matrix ) { + QString l = "<matrix title='%1' rows='%2' cols='%3' element-type='%4' data-channel='%5'>"; + l = l.arg( xml_from_string(ks_matrix->name()) ); + l = l.arg( ks_matrix->rows() ); + l = l.arg( ks_matrix->cols() ); + l = l.arg( get_attr_name(etype,ks_matrix->type()) ); + l = l.arg( channel ); + xml( l ); + indent++; + + QCString e; + for( int row=0;row<ks_matrix->rows();row++ ) { + for( int i=0; i<indent; i++ ) f->putch( '\t' ); + f->writeBlock("<row>",5); + for( int col=0;col<ks_matrix->cols();col++ ) { + e.sprintf("%.9g ",ks_matrix->value(row,col)); + f->writeBlock( e.data(), e.size()-1 ); + } + f->writeBlock("</row>",6); + f->putch( '\n' ); + } + indent--; + xml("</matrix>"); + } + else + if ( ks_matrix_ref ) { + // don't write ref channel as it is always 0 + QString l = "<matrixref title='%1' sheet='%1' row-from='%2' row-step='%3' row-to='%4' col-from='%5' col-step='%6' col-to='%7' transposition='%8' data-channel='%9'/>"; + l = l.arg( xml_from_string(ks_matrix_ref->name()) ); + l = l.arg( ks_matrix_ref->worksheet() ); + l = l.arg( ks_matrix_ref->rowFrom() ); + l = l.arg( ks_matrix_ref->rowStep() ); + l = l.arg( ks_matrix_ref->rowTo() ); + l = l.arg( ks_matrix_ref->colFrom() ); + l = l.arg( ks_matrix_ref->colStep() ); + l = l.arg( ks_matrix_ref->colTo() ); + l = l.arg( ks_matrix_ref->transposition() ); + l = l.arg( channel ); + xml( l ); + } + else + if ( ks_matrix_string ) { + QString l = "<matrix-string title='%1' rows='%2' cols='%3' data-channel='%4'>"; + l = l.arg( xml_from_string(ks_matrix_string->name()) ); + l = l.arg( ks_matrix_string->rows() ); + l = l.arg( ks_matrix_string->cols() ); + l = l.arg( channel ); + xml( l ); + indent++; + + for( int row=0;row<ks_matrix_string->rows();row++ ) + for( int col=0;col<ks_matrix_string->cols();col++ ) + if ( !ks_matrix_string->string(row,col).isEmpty() ) { + l = "<e row='%1' col='%2' string='%3'/>"; + l = l.arg( row ); + l = l.arg( col ); + l = l.arg( xml_from_string(ks_matrix_string->string(row,col)) ); + xml( l ); + } + + indent--; + xml( "</matrix-string>" ); + } + else + if ( ks_matrix_formula ) { + QString l = "<matrix-formula title='%1' formula='%2' transposition='%3' data-channel='%4'/>"; + l = l.arg( xml_from_string(ks_matrix_formula->name()) ); + l = l.arg( xml_from_string(ks_matrix_formula->formula()) ); + l = l.arg( ks_matrix_formula->transposition() ); + l = l.arg( channel ); + xml( l ); + } + + } + +//-----------------------------------------------------------// + +void ksprojectxml_runtime_data::xml( const QString& line ) + { + assert( indent >= 0 ); + for ( int i=0; i<indent; i++ ) f->putch( '\t' ); + QCString chars = line.utf8(); + f->writeBlock( chars.data(), chars.size()-1 ); + f->putch( '\n' ); + + //(*s) << line << endl; + } + +//-----------------------------------------------------------// + +void KSProjectXML::xml( const QString& line ) + { + d->xml( line ); + } + +//-----------------------------------------------------------// + +QString ksprojectxml_runtime_data::xml_from_string( QString text ) + { + text.replace( QRegExp("&"), "&" ); + text.replace( QRegExp("'"), "'" ); + text.replace( QRegExp(">"), ">" ); + text.replace( QRegExp("<"), "<" ); + text.replace( QRegExp("\""), """ ); + text.replace( QRegExp("\n"), " " ); + return text; + } + +//-----------------------------------------------------------// + +QString ksprojectxml_runtime_data::xml_to_string( QString text ) + { + text.replace( QRegExp("\\&"), "&" ); + text.replace( QRegExp("\\'"), "'" ); + text.replace( QRegExp("\\>"), ">" ); + text.replace( QRegExp("\\<"), "<" ); + text.replace( QRegExp("\\""), "\"" ); + text.replace( QRegExp(" "), "\n" ); + return text; + } + + + + + + + + + + + + +//-----------------------------------------------------------// +//-----------------------------------------------------------// +//-----------------------------------------------------------// +//-----------------------------------------------------------// + + + + + + + + + + + + + + + + + + + + + + + + +bool KSProjectXML::loadFromFile( QFile& f ) + { + m_shell->workbook()->commandHistory()->clear(); + alloc_runtime_data(); + d->f = &f; + QXmlInputSource src( f ); + QXmlSimpleReader reader; + + reader.setContentHandler( d ); + reader.setErrorHandler( d ); + bool result = reader.parse( src ); + + free_runtime_data(); + return result; + } +//-----------------------------------------------------------// + +void ksprojectxml_runtime_data::set_error_string( const QString& string ) + { + error_string += string; + //cout << "##################### ERROR: " << string << " ####################" << endl; + } + +//-----------------------------------------------------------// + +bool ksprojectxml_runtime_data::warning ( const QXmlParseException & ) + { + error_string += QObject::tr("<br/> Warning: ") + errorString(); + return TRUE; + } + +//-----------------------------------------------------------// + +bool ksprojectxml_runtime_data::error ( const QXmlParseException & ) + { + error_string += QObject::tr("<br/> <b>Error:</b> ") + errorString(); + return TRUE; + } + +//-----------------------------------------------------------// + +bool ksprojectxml_runtime_data::fatalError ( const QXmlParseException & ) + { + error_string += QObject::tr("<br/> <b>Fatal error:</b> ") + errorString(); + return TRUE; + } + +//-----------------------------------------------------------// + +bool ksprojectxml_runtime_data::startDocument() + { + parser_state.clear(); + parser_state.push( ParseKMatplot ); + error_string = QString::null; + return TRUE; + } + +//-----------------------------------------------------------// + +// There is a pair of functions of each object which is loaded !!!! +// To add a new object: +// - add a new ksprojectxml_runtime_data::ParserState value +// - add a new pair of funtions to handle start and end elements. +// - add expression to the top level read_?_stag function which starts parsing the given element. +// remeber that a begining tag belongs to the higher level read_tag_function +// <page number='1'> +// <arrow stack-order='1'> // WARNING: read_page_stag - read_page_stag must handle 'arrow' and turn 'ParserState' to 'ParseArrow' +// <begin ... // read_arrow_stag +// <end ... // read_arrow_stag +// </arrow> // read_arrow_etag +// +bool ksprojectxml_runtime_data::startElement( const QString&, const QString& name, const QString&, const QXmlAttributes& attr ) + { +// cout << " Start tag " << (const char *)name << endl; + bool result = TRUE; + switch( parser_state.top() ) { + case ParseSheets: result = read_sheets_stag( name, attr ); break; + case ParseSheet: result = read_sheet_stag( name, attr ); break; + case ParseMatrix: result = read_matrix_stag( name, attr ); break; + case ParseMatrixRef: result = read_matrix_ref_stag( name, attr ); break; + case ParseMatrixColRef: result = read_matrix_col_ref_stag( name, attr ); break; + case ParseMatrixString: result = read_matrix_string_stag( name, attr ); break; + case ParseMatrixFormula: result = read_matrix_formula_stag( name, attr ); break; + case ParseKMatplot: result = read_kmatplot_stag( name, attr ); break; + case ParseCanvas: result = read_canvas_stag( name, attr ); break; + case ParsePage: result = read_page_stag( name, attr ); break; + case ParseAxes2d: result = read_axes_2d_stag( name, attr ); break; + case ParseAxes3d: result = read_axes_3d_stag( name, attr ); break; + case ParseAxis: result = read_axis_stag( name, attr ); break; + case ParseAxesBackground: result = read_axis_background_stag( name, attr ); break; + case ParseAxesTitle: result = read_axis_title_stag( name, attr ); break; + case ParseCurve: result = read_curve_stag( name, attr ); break; + case ParseImage: result = read_image_stag( name, attr ); break; + case ParseContour: result = read_contour_stag( name, attr ); break; + case ParseSurface: result = read_surface_stag( name, attr ); break; + case ParseFigure: result = read_figure_stag( name, attr ); break; + case ParseGradient: result = read_gradient_stag( name, attr ); break; + case ParseCLegend: result = read_clegend_stag( name, attr ); break; + case ParseCLabel: result = read_clabel_stag( name, attr ); break; + case ParseCArrow: result = read_carrow_stag( name, attr ); break; + case ParseCRect: result = read_crect_stag( name, attr ); break; + case ParseCGroup: result = read_cgroup_stag( name, attr ); break; + } + chars = QString::null; +// cout << " End tag " << (const char *)name << endl; + return result; + } + +//-----------------------------------------------------------// + +bool ksprojectxml_runtime_data::endElement( const QString&, const QString& name, const QString& ) + { + bool result = TRUE; + switch( parser_state.top() ) { + case ParseSheets: result = read_sheets_etag( name ); break; + case ParseSheet: result = read_sheet_etag( name ); break; + case ParseMatrix: result = read_matrix_etag( name ); break; + case ParseMatrixRef: result = read_matrix_ref_etag( name ); break; + case ParseMatrixColRef: result = read_matrix_col_ref_etag( name ); break; + case ParseMatrixString: result = read_matrix_string_etag( name ); break; + case ParseMatrixFormula: result = read_matrix_formula_etag( name ); break; + case ParseKMatplot: result = read_kmatplot_etag( name ); break; + case ParseCanvas: result = read_canvas_etag( name ); break; + case ParsePage: result = read_page_etag( name ); break; + case ParseAxes2d: result = read_axes_2d_etag( name ); break; + case ParseAxes3d: result = read_axes_3d_etag( name ); break; + case ParseAxis: result = read_axis_etag( name ); break; + case ParseAxesBackground: result = read_axis_background_etag( name ); break; + case ParseAxesTitle: result = read_axis_title_etag( name ); break; + case ParseCurve: result = read_curve_etag( name ); break; + case ParseImage: result = read_image_etag( name ); break; + case ParseContour: result = read_contour_etag( name ); break; + case ParseSurface: result = read_surface_etag( name ); break; + case ParseFigure: result = read_figure_etag( name ); break; + case ParseGradient: result = read_gradient_etag( name ); break; + case ParseCLegend: result = read_clegend_etag( name ); break; + case ParseCLabel: result = read_clabel_etag( name ); break; + case ParseCArrow: result = read_carrow_etag( name ); break; + case ParseCRect: result = read_crect_etag( name ); break; + case ParseCGroup: result = read_cgroup_etag( name ); break; + } + chars = QString::null; + return result; + } + +//-----------------------------------------------------------// + +bool ksprojectxml_runtime_data::characters( const QString& new_chars ) + { + chars += new_chars; + return TRUE; + } + +//-----------------------------------------------------------// + +bool ksprojectxml_runtime_data::endDocument() + { + shell->refreshSettings(); + parser_state.clear(); + + if ( error_string != QString::null ) QSConsole::write( " XML parser returned :<br/><br/>" + error_string ); + + // object is auto delete list, so each remaining object + // is deleted + return TRUE; + } + +//-----------------------------------------------------------// + +bool ksprojectxml_runtime_data::read_kmatplot_stag( const QString& name,const QXmlAttributes& attr ) + { + if ( name == "kmatplot" ) { + if ( attr.value("mime") != MIMETYPE ) set_error_string( QObject::tr("<br> <br> KMatplot(XML): Incorrect MIME-TYPE ") ); + } + else + if ( name == "canvas" ) { + parser_state.push( ParseCanvas ); + QPrinter *p = workbook->printer(); + QPrinter::PageSize ps = (QPrinter::PageSize)get_attr_value( page_size, attr.value("page-size") ); + QPrinter::Orientation po = (QPrinter::Orientation)get_attr_value( orientation,attr.value("orientation") ); + p->setPageSize( ps ); + p->setOrientation( po ); + workbook->setPrinter( p ); + } else { + set_error_string( QObject::tr("<br> XML(kmatplot): Unexpected tag: ")+name ); + } + return TRUE; + } + +//-----------------------------------------------------------// + +bool ksprojectxml_runtime_data::read_kmatplot_etag( const QString& name ) + { + if ( name == "kmatplot" ) parser_state.pop(); + return TRUE; + } + +//-----------------------------------------------------------// + +bool ksprojectxml_runtime_data::read_canvas_stag( const QString& name, const QXmlAttributes& attr ) + { + if ( name == "page" ) { + parser_state.push( ParsePage ); + curr_page = new QSPage( workbook ); + curr_page->setTitle( xml_to_string(attr.value("title")) ); + workbook->pageAdd( curr_page ); + } + else if ( name == "sheets" ) { + int sheet_number = attr.value("number").toInt(); + for ( int curr_sheet=0; curr_sheet<sheet_number; curr_sheet++ ) { + workbook->sheets()->sheetAdd( new KSSheet( workbook->sheets() ) ); + } + parser_state.push( ParseSheets ); + } + else { + set_error_string( QObject::tr("<br> XML(canvas): Unexpected tag: ")+name); + } + return TRUE; + } + +//-----------------------------------------------------------// + +bool ksprojectxml_runtime_data::read_canvas_etag( const QString& name ) + { + if ( name == "canvas" ) parser_state.pop(); + return TRUE; + } + +//-----------------------------------------------------------// + +bool ksprojectxml_runtime_data::read_sheets_stag( const QString& name, const QXmlAttributes& attr ) + { + if ( name == "sheet" ) { + curr_sheet = workbook->sheets()->child(sheet_number(attr.value("number").toInt())); + curr_sheet->setObjectName( attr.value("name") ); + parser_state.push( ParseSheet ); + } + else set_error_string( QObject::tr("<br> XML(sheets): Unexpected tag: ")+name ); + return TRUE; + } + +//-----------------------------------------------------------// + +bool ksprojectxml_runtime_data::read_sheets_etag( const QString& name ) + { + if ( name == "sheets" ) parser_state.pop(); + return TRUE; + } + +//-----------------------------------------------------------// + +bool ksprojectxml_runtime_data::read_sheet_stag( const QString& name, const QXmlAttributes& attr ) + { + if ( name == "column" ) { + if ( curr_sheet ) + curr_sheet->setColumnData( attr.value("number").toInt(), + (KSSheet::ColumnType )get_attr_value(column_type,attr.value("type")), + xml_to_string(attr.value("title")) ); + } + else read_data( curr_sheet, name, attr ); + return TRUE; + } + +//-----------------------------------------------------------// + +bool ksprojectxml_runtime_data::read_sheet_etag( const QString& name ) + { + if ( name == "sheet" ) { + parser_state.pop(); + curr_sheet = NULL; + } + return TRUE; + } + +//-----------------------------------------------------------// + +bool ksprojectxml_runtime_data::read_some_object_stag( QSCObjectCollection *collection, const QString& name, const QXmlAttributes& ) + { + if ( name == AXES2D ) { + parser_state.push( ParseAxes2d ); + curr_axes = curr_axes2d = new QSAxes2D(); + collection->add( curr_axes2d->shadowObject() ); + } + else if ( name == AXES3D ) { + parser_state.push( ParseAxes3d ); + curr_axes = curr_axes3d = new QSAxes3D(); + collection->add( curr_axes3d->shadowObject() ); + } + else if ( name == "legend" ) { + parser_state.push( ParseCLegend ); + curr_clegend = new QSCLegend( NULL ); + collection->add( curr_clegend ); + } + else if ( name == "label" ) { + parser_state.push( ParseCLabel ); + curr_clabel = new QSCLabel( "" ); + collection->add( curr_clabel ); + } + else if ( name == "arrow" ) { + parser_state.push( ParseCArrow ); + curr_carrow = new QSCArrow(); + collection->add( curr_carrow ); + } + else if ( name == "rectangle" ) { + parser_state.push( ParseCRect ); + curr_crect = new QSCRect(); + collection->add( curr_crect ); + } + else if ( name == "group" ) { + parser_state.push( ParseCGroup ); + curr_cgroup.push( new QSCGroup() ); + collection->add( curr_cgroup.top() ); + } + else return false; + + return true; + } + +//-----------------------------------------------------------// + +bool ksprojectxml_runtime_data::read_page_stag( const QString& name, const QXmlAttributes& attr ) + { + if ( read_some_object_stag( curr_page->objects(), name, attr ) ) { + } + else set_error_string( QObject::tr("<br> XML(page): Unexpected tag: ")+name ); + + return TRUE; + } + +//-----------------------------------------------------------// + +bool ksprojectxml_runtime_data::read_page_etag( const QString& name ) + { + if ( name == "page" ) { + parser_state.pop(); + curr_page = NULL; + } + + return TRUE; + } + + +//-----------------------------------------------------------// +/* +QSAxes *ksprojectxml_runtime_data::cobject_parent_axes( const QXmlAttributes& attr ) + { + int parent_stack_order = attr.value("parent-axes").toInt(); + QSCObject *o = objects[parent_stack_order]; + return ( o ? o->parentAxes() : NULL ); + } + +//-----------------------------------------------------------// + +QObject *ksprojectxml_runtime_data::cobject_parent( const QXmlAttributes& ) + { + return NULL; + } + +//-----------------------------------------------------------// + +void ksprojectxml_runtime_data::cobject_set_default_axes( QSCObject *object, const QXmlAttributes& attr ) + { + if ( object->parentAxes() ) { + object->setDefaultAxis( object->parentAxes()->axis(attr.value("x-axis").toInt()) ); + object->setDefaultAxis( object->parentAxes()->axis(attr.value("y-axis").toInt()) ); + object->setDefaultAxis( object->parentAxes()->axis(attr.value("z-axis").toInt()) ); + } + } +*/ +//-----------------------------------------------------------// + +bool ksprojectxml_runtime_data::read_axes_2d_stag( const QString& name, const QXmlAttributes& attr ) + { + if ( !curr_axes2d ) return TRUE; + + if ( name == "frame" ) { + curr_axes2d->setFrameWidth( attr.value("width").toInt() ); + } + else return read_axes( curr_axes2d, name, attr ); + return TRUE; + } + +//-----------------------------------------------------------// + +bool ksprojectxml_runtime_data::read_axes_2d_etag( const QString& name ) + { + if ( name == AXES2D ) { + parser_state.pop(); + // we read all axes from file so we don't need default axes + remove_default_axes( curr_axes2d ); + curr_axes = curr_axes2d = NULL; + } + return TRUE; + } + +//-----------------------------------------------------------// + +bool ksprojectxml_runtime_data::read_axes_3d_stag( const QString& name, const QXmlAttributes& attr ) + { + if ( !curr_axes3d ) return TRUE; + + if ( name == "opengl" ) { + curr_axes3d->setOpenGL( (bool )attr.value("enabled").toInt() ); + curr_axes3d->glSetTransparency( (bool )attr.value("enable-transparency").toInt() ); + curr_axes3d->glSetGlobalTransparency( attr.value("global-transparency").toInt() ); + curr_axes3d->glSetShadeWalls( (bool )attr.value("shade-walls").toInt() ); + curr_axes3d->glSetMeshAutoStroke( (bool )attr.value("auto-stroke").toInt() ); + curr_axes3d->glSetAutoStrokeLightness( attr.value("auto-stroke-lightness").toInt() ); + } + else if ( name == "wall-thickness" ) { + curr_axes3d->setWallThickness( attr.value("xy").toDouble(), + attr.value("xz").toDouble(), + attr.value("yz").toDouble() ); + } + else if ( name == "edge-length" ) { + curr_axes3d->setEdgeLength( attr.value("x").toDouble(), + attr.value("y").toDouble(), + attr.value("z").toDouble() ); + } + + else if ( name == "viewpoint" ) { + curr_axes3d->setAzimuth( attr.value("azimuth").toInt() ); + curr_axes3d->setElevation( attr.value("elevation").toInt() ); + curr_axes3d->setDistance( attr.value("distance").toInt() ); + } + else if ( name == "perspective" ) { + curr_axes3d->setPerspective( attr.value("enabled").toInt() ); + curr_axes3d->setFocusDistance( attr.value("focus-distance").toInt() ); + } + else if ( name == "light" ) { + curr_axes3d->setLight( attr.value("enabled").toInt() ); + curr_axes3d->setLightAzimuth( attr.value("azimuth").toInt() ); + curr_axes3d->setLightElevation( attr.value("elevation").toInt() ); + curr_axes3d->setDirectLight( attr.value("directed-intensity").toInt() ); + curr_axes3d->setAmbientLight( attr.value("ambient-intensity").toInt() ); + } + else if ( name == "autoscale" ) { + curr_axes3d->setAutoscale( (bool )attr.value("enabled").toInt() ); + } + else return read_axes( curr_axes3d, name, attr ); + + return TRUE; + } + +//-----------------------------------------------------------// + +bool ksprojectxml_runtime_data::read_axes_3d_etag( const QString& name ) + { + if ( name == AXES3D ) { + parser_state.pop(); + remove_default_axes( curr_axes3d ); + curr_axes = curr_axes3d = NULL; + } + return TRUE; + } + + +//-----------------------------------------------------------// + +bool ksprojectxml_runtime_data::read_axes( QSAxes *axes, const QString& name, const QXmlAttributes& attr ) + { + if ( name == "area" ) { + axes->setPosMM( QSPt2f( attr.value("xmm").toDouble(), attr.value("ymm").toDouble() ) ); + axes->setSizeMM( QSPt2f( attr.value("wmm").toDouble(), attr.value("hmm").toDouble() ) ); + } + else if ( name == "axis" ) { + parser_state.push( ParseAxis ); + curr_axes = axes; + curr_axis = new QSAxis( (QSAxis::AxisType )get_attr_value(axis_type,attr.value("type")), curr_axes ); + curr_axis->setVisible( (bool )attr.value("visible").toInt() ); + curr_axis->setScrollable( (bool )attr.value("scrollable").toInt() ); + curr_axes->axisAdd( curr_axis ); + } + else if ( name == "draw-in-background" ) { + axes->setDrawInBackground( (bool )attr.value("enabled").toInt() ); + } + else if ( name == "title-attributes" ) { + curr_axes = axes; + parser_state.push( ParseAxesTitle ); + } + else if ( name == "background-attributes" ) { + curr_axes = axes; + parser_state.push( ParseAxesBackground ); + } + else if ( name == CURVE ) { + parser_state.push( ParseCurve ); + curr_plot = curr_curve = new QSCurve( axes ); axes->plotAdd( curr_curve ); + } + else if ( name == IMAGE ) { + parser_state.push( ParseImage ); + curr_plot = curr_image = new QSImage( axes ); axes->plotAdd( curr_image ); + } + else if ( name == CONTOUR || name == GCONTOUR ) { + parser_state.push( ParseContour ); + curr_plot = curr_contour = new QSGriddedContour( axes ); axes->plotAdd( curr_contour ); + } + else if ( name == NGCONTOUR ) { + parser_state.push( ParseContour ); + curr_plot = curr_contour = new QSNonGriddedContour( axes ); axes->plotAdd( curr_contour ); + } + else if ( name == SURFACE ) { + parser_state.push( ParseSurface ); + curr_plot = curr_surface = new QSSurface( axes ); axes->plotAdd( curr_surface ); + } + else if ( name == FIGURE ) { + parser_state.push( ParseFigure ); + curr_plot = curr_figure = new QSFigure( axes ); axes->plotAdd( curr_figure ); + } + else if ( read_some_object_stag( axes->shadowObject()->objects(), name, attr ) ) { + } + else return read_base( axes, name, attr ); + + return TRUE; + } + +//-----------------------------------------------------------// + +bool ksprojectxml_runtime_data::read_axis_stag( const QString& name, const QXmlAttributes& attr ) + { + if ( !curr_axis ) return TRUE; + + if ( name == "display" ) { + curr_axis->setPosition( attr.value("position").toDouble() ); + curr_axis->setDefaultPosition( (bool )attr.value("default").toInt() ); + curr_axis->setOppositePosition( (bool )attr.value("opposite").toInt() ); + } + else if ( name == "range" ) { + curr_axis->setRange( attr.value("min").toDouble(), attr.value("max").toDouble() ); + curr_axis->setRoundRangeToTicStep( (bool )attr.value("rounded").toInt() ); + } + else if ( name == "scale" ) { + curr_axis->setScale( (QSAxis::AxisScale )get_attr_value( axis_scale, attr.value("type") ), attr.value("base").toDouble() ); + curr_axis->setReversed( (bool )attr.value("reversed").toInt() ); + } + else if ( name == "grid-step" ) { + curr_axis->setGridStep( attr.value("major").toDouble(), attr.value("minor").toDouble() ); + } + else if ( name == "tics" ) { + curr_axis->setTicsFormat( xml_to_string(attr.value("format")) ); + curr_axis->setTicsVisible( (bool )attr.value("visible").toInt() ); + curr_axis->setTicsOuter( (bool )attr.value("outer").toInt() ); + curr_axis->setTicsAngle( (bool )attr.value("angle").toInt() ); + curr_axis->setTicLabelPos1( attr.value("pos1").toDouble() ); + curr_axis->setTicLabelPos2( attr.value("pos2").toDouble() ); + } + else if ( name == "title-position" ) { + curr_axis->setTitlePosition( attr.value("pos").toDouble() ); + curr_axis->setTitleDistance( attr.value("distance").toDouble() ); + } + else if ( name == "dart" ) { + if ( element_number( attr ) == 1 ) + curr_axis->setArrow1( read_arrow( attr ) ); + else curr_axis->setArrow2( read_arrow( attr ) ); + + } + else if ( name == "remembered-view" ) { + int nr = attr.value("number").toInt(); + if ( nr>=0 && nr<3 ) { + curr_axis->rememberedViews[nr].min = attr.value("min").toDouble(); + curr_axis->rememberedViews[nr].max = attr.value("max").toDouble(); + curr_axis->rememberedViews[nr].scale = (QSAxis::AxisScale )get_attr_value( axis_scale, attr.value("scale") ); + curr_axis->rememberedViews[nr].base = attr.value("base").toDouble(); + curr_axis->rememberedViews[nr].reversed = (bool )attr.value("reversed").toInt(); + curr_axis->rememberedViews[nr].round = (bool )attr.value("rounded").toInt(); + } + } + else read_base( curr_axis, name, attr ); + + return TRUE; + } + +//-----------------------------------------------------------// + +bool ksprojectxml_runtime_data::read_axis_etag( const QString& name ) + { + if ( name == "axis" ) { + parser_state.pop(); + curr_axis = NULL; + curr_axes = NULL; + } + return TRUE; + } + +//-----------------------------------------------------------// + +bool ksprojectxml_runtime_data::remove_default_axes( QSAxes *axes ) +// axis object when created always contains a set of default axes ( they are first on the list - +// getAxisOfType() returns always first axis of the given type ) we have all axes written +// to the file and want the axis set to be exactly the same as written so after we read axes from a +// file, we have to delete those default ones. + { + axes->axisDelete( axes->axisOfType(QSAxis::XAxisType) ); + axes->axisDelete( axes->axisOfType(QSAxis::YAxisType) ); + axes->axisDelete( axes->axisOfType(QSAxis::ZAxisType) ); + axes->axisDelete( axes->axisOfType(QSAxis::VAxisType) ); + return TRUE; + } + +//-----------------------------------------------------------// + +bool ksprojectxml_runtime_data::read_axis_background_stag( const QString& name, const QXmlAttributes& attr ) + { + if ( !curr_axes ) return TRUE; + if ( name == "fill" ) { + curr_axes->setBackground( read_fill( attr ) ); + } + else set_error_string( QObject::tr("<br> KMatplot(XML): Background-attributes - unexpected tag ") + name ); + return TRUE; + } + +//-----------------------------------------------------------// + +bool ksprojectxml_runtime_data::read_axis_title_stag( const QString& name, const QXmlAttributes& ) + { + if ( !curr_axes ) return TRUE; + set_error_string( QObject::tr("<br> KMatplot(XML): Title-attributes - unexpected tag ") + name ); + return TRUE; + } + +//-----------------------------------------------------------// + +bool ksprojectxml_runtime_data::read_axis_background_etag( const QString& name ) + { + if ( name == "background-attributes" ) { + parser_state.pop(); + curr_axes = NULL; + } + return TRUE; + } + +//-----------------------------------------------------------// + +bool ksprojectxml_runtime_data::read_axis_title_etag( const QString& name ) + { + if ( name == "title-attributes" ) { + parser_state.pop(); + curr_axes = NULL; + } + return TRUE; + } + +//-----------------------------------------------------------// + +bool ksprojectxml_runtime_data::read_curve_stag( const QString& name, const QXmlAttributes& attr ) + { + if ( !curr_curve ) return TRUE; + + if ( name == "series" ) { + curr_curve->setType( (QSCurve::SeriesType )get_attr_value(series_type,attr.value("type")) ); + } + else if ( name == "delta" ) { + curr_curve->setFixedDelta( QSPt2f( attr.value("fixed-x").toDouble(), + attr.value("fixed-y").toDouble() ) ); + curr_curve->setPercentDelta( QSPt2f( attr.value("percent-x").toDouble(), + attr.value("percent-y").toDouble() ) ); + } + else if ( name == "zero" ) { + curr_curve->setZeroPoint( QSPt2f( attr.value("x").toDouble(), + attr.value("y").toDouble() ) ); + } + else if ( name == "dart" ) { + if ( element_number( attr ) == 1 ) + curr_curve->setArrow1( read_arrow( attr ) ); + else curr_curve->setArrow2( read_arrow( attr ) ); + + } + else return read_plot( curr_curve, name, attr ); + + return TRUE; + } + +//-----------------------------------------------------------// + +bool ksprojectxml_runtime_data::read_curve_etag( const QString& name ) + { + if ( name == CURVE ) { + parser_state.pop(); + curr_plot = curr_curve = NULL; + } + return TRUE; + } + +//-----------------------------------------------------------// + +bool ksprojectxml_runtime_data::read_image_stag( const QString& name, const QXmlAttributes& attr ) + { + if ( !curr_image ) return TRUE; + + if ( name == "raw-mode" ) { + curr_image->setRawMode( (bool )attr.value("enabled").toInt() ); + } + else + if ( name == "use-gradient" ) { + curr_image->setUseGradient( (bool )attr.value("enabled").toInt() ); + } + else return read_plot( curr_image, name, attr ); + return TRUE; + } + +//-----------------------------------------------------------// + +bool ksprojectxml_runtime_data::read_image_etag( const QString& name ) + { + if ( name == IMAGE ) { + parser_state.pop(); + curr_plot = curr_image = NULL; + } + return TRUE; + } + +//-----------------------------------------------------------// + +bool ksprojectxml_runtime_data::read_contour_stag( const QString& name, const QXmlAttributes& attr ) + { + if ( !curr_contour ) return TRUE; + + if ( name == "filled" ) { + curr_contour->setContourFills( (bool )attr.value("enabled").toInt() ); + } + else if ( name == "lines" ) { + curr_contour->setContourLines( (bool )attr.value("enabled").toInt() ); + } + else if ( name == "labels" ) { + curr_contour->setContourLabels( (bool )attr.value("enabled").toInt() ); + curr_contour->setLabelSpacing( attr.value("spacing").toDouble() ); + } +/* + else if ( name == "grid-labels" ) { + curr_contour->setContourGridLabelsFormat( xml_to_string( attr.value("format") ) ); + } +*/ + else return read_plot( curr_contour, name, attr ); + + return TRUE; + } + +//-----------------------------------------------------------// + +bool ksprojectxml_runtime_data::read_contour_etag( const QString& name ) + { + if ( name == CONTOUR || name == GCONTOUR || name == NGCONTOUR ) { + parser_state.pop(); + curr_plot = curr_contour = NULL; + } + return TRUE; + } + +//-----------------------------------------------------------// + +bool ksprojectxml_runtime_data::read_surface_stag( const QString& name, const QXmlAttributes& attr ) + { + if ( !curr_surface ) return TRUE; + if ( name == "labels" ) { + curr_surface->setXGridStep( attr.value("x-step").toInt() ); + curr_surface->setYGridStep( attr.value("y-step").toInt() ); + } + return read_plot_3d( curr_surface, name, attr ); + + return TRUE; + } + +//-----------------------------------------------------------// + +bool ksprojectxml_runtime_data::read_surface_etag( const QString& name ) + { + if ( name == SURFACE ) { + parser_state.pop(); + curr_plot = curr_surface = NULL; + } + return TRUE; + } + +//-----------------------------------------------------------// + +bool ksprojectxml_runtime_data::read_figure_stag( const QString& name, const QXmlAttributes& attr ) + { + if ( !curr_figure ) return TRUE; + if ( name == "vertex-compare" ) { + curr_figure->setVertexCompareAccuracy( attr.value("accuracy").toInt() ); + } + else return read_plot_3d( curr_figure, name, attr ); + + return TRUE; + } + +//-----------------------------------------------------------// + +bool ksprojectxml_runtime_data::read_figure_etag( const QString& name ) + { + if ( name == FIGURE ) { + parser_state.pop(); + curr_plot = curr_figure = NULL; + } + return TRUE; + } + +//-----------------------------------------------------------// + +bool ksprojectxml_runtime_data::read_plot_3d( QSPlot3D *p, const QString& name, const QXmlAttributes& attr ) + { + if ( name == "colored" ) { + p->setColored( (bool )attr.value("enabled").toInt() ); + } + else if ( name == "topbottom" ) { + p->setTopBottom( (bool )attr.value("enabled").toInt() ); + } + else if ( name == "autodivide" ) { + p->setAutoDivide( (bool )attr.value("enabled").toInt() ); + } + else if ( name == "edges" ) { + p->setEdgeAutoColor( attr.value("autocolor").toInt() ); + } + else return read_plot( p, name, attr ); + + return TRUE; + } + +//-----------------------------------------------------------// + +bool ksprojectxml_runtime_data::read_plot( QSPlot *p, const QString& name, const QXmlAttributes& attr ) + { + if ( name == "legend-item" ) { + p->setLegendItemVisible( (bool )attr.value("visible").toInt() ); + } + else if ( name == "default-axis" ) { + // ups we have four initial axes, which we remove after reading an axes object. + // our new read axes starts from 4 then. + if ( !attr.value("x-axis").isEmpty() ) p->setDefaultAxis( p->parentAxes()->axis(attr.value("x-axis").toInt()+4) ); + if ( !attr.value("y-axis").isEmpty() ) p->setDefaultAxis( p->parentAxes()->axis(attr.value("y-axis").toInt()+4) ); + if ( !attr.value("z-axis").isEmpty() ) p->setDefaultAxis( p->parentAxes()->axis(attr.value("z-axis").toInt()+4) ); + if ( !attr.value("v-axis").isEmpty() ) p->setDefaultAxis( p->parentAxes()->axis(attr.value("v-axis").toInt()+4) ); + } + else if ( name == "gradient" ) { + parser_state.push( ParseGradient ); + curr_gradient_type = get_attr_value( gradient_type, attr.value("type") ); + return TRUE; + } + else return read_base( p, name, attr ); + + return TRUE; + } + +//-----------------------------------------------------------// + +bool ksprojectxml_runtime_data::read_base( QSGraphicalData *b, const QString& name, const QXmlAttributes& attr ) + { + if ( name == "fill" ) { + b->setFill( element_number(attr), read_fill(attr) ); + } + else if ( name == "font" ) { + b->setFont( element_number(attr), read_font(attr) ); + } + else if ( name == "line" ) { + b->setLine( element_number(attr), read_line(attr) ); + } + else if ( name == "point" ) { + b->setPoint( element_number(attr), read_point(attr) ); + } + else if ( name == "title" ) { + b->setTitle( xml_to_string(attr.value("text")) ); + } + else return read_data( b, name, attr ); + return TRUE; + } + +//-----------------------------------------------------------// + +bool ksprojectxml_runtime_data::read_data( QSData *d, const QString& name, const QXmlAttributes& attr ) + { + if ( name == "matrix" ) { + parser_state.push( ParseMatrix ); + create_matrix( d, name, attr ); + } + else if ( name == "matrixref" ) { + parser_state.push( ParseMatrixRef ); + create_matrix( d, name, attr ); + } + else if ( name == "matrixcolref" ) { + parser_state.push( ParseMatrixColRef ); + create_matrix( d, name, attr ); + } + else if ( name == "matrix-string" ) { + parser_state.push( ParseMatrixString ); + create_matrix( d, name, attr ); + } + else if ( name == "matrix-formula" ) { + parser_state.push( ParseMatrixFormula ); + create_matrix( d, name, attr ); + } + else set_error_string( QObject::tr("<br> KMatplot(XML): QSData - Unexpected tag ") + name ); + return TRUE; + } + +//-----------------------------------------------------------// + +bool ksprojectxml_runtime_data::read_clegend_stag( const QString& name, const QXmlAttributes& attr ) + { + if ( !curr_clegend ) return TRUE; + + if ( name == "align" ) { + curr_clegend->setAlign( attr.value("frame").toInt() ); + } + else if ( name == "format" ) { + curr_clegend->setColumns( attr.value("columns").toInt() ); + } + else if ( name == "pos" ) { + curr_clegend->setPos( read_pt3f(attr) ); + } + else if ( name == "coord-system" ) { + curr_clegend->setCoord( read_pt3(attr) ); + } + else if ( name == "shadow-shift" ) { + curr_clegend->setShadowPos( read_pt2(attr) ); + } + else if ( name == "font" ) { + curr_clegend->setFont( read_font(attr) ); + } + else if ( name == "fill" ) { + if ( element_number( attr ) == 1 ) curr_clegend->setFill( read_fill(attr) ); + else curr_clegend->setShadowFill( read_fill(attr) ); + } + else if ( name == "line" ) { + curr_clegend->setFrame( read_line(attr) ); + } + else read_cobject_stag( curr_clegend, name, attr ); + + return TRUE; + } + +//-----------------------------------------------------------// + +bool ksprojectxml_runtime_data::read_clegend_etag( const QString& name ) + { + if ( name == "legend" ) { + parser_state.pop(); + curr_clegend = NULL; + } + return TRUE; + } + +//-----------------------------------------------------------// + +bool ksprojectxml_runtime_data::read_clabel_stag( const QString& name, const QXmlAttributes& attr ) + { + if ( !curr_clabel ) return TRUE; + + if ( name == "text" ) { + // see end tag + } + else if ( name == "angle" ) { + curr_clabel->setAngle( attr.value("deg").toInt() ); + } + else if ( name == "align" ) { + curr_clabel->setFrameAlign( attr.value("frame").toInt() ); + curr_clabel->setTextAlign( attr.value("text").toInt() ); + } + else if ( name == "pos" ) { + curr_clabel->setPos( read_pt3f(attr) ); + } + else if ( name == "coord-system" ) { + curr_clabel->setCoord( read_pt3(attr) ); + } + else if ( name == "shadow-shift" ) { + curr_clabel->setShadowPos( read_pt2(attr) ); + } + else if ( name == "font" ) { + curr_clabel->setFont( read_font(attr) ); + } + else if ( name == "fill" ) { + if ( element_number( attr ) == 1 ) curr_clabel->setFill( read_fill(attr) ); + else curr_clabel->setShadowFill( read_fill(attr) ); + } + else if ( name == "line" ) { + curr_clabel->setFrame( read_line(attr) ); + } + else read_cobject_stag( curr_clabel, name, attr ); + return TRUE; + } + +//-----------------------------------------------------------// + +bool ksprojectxml_runtime_data::read_clabel_etag( const QString& name ) + { + if ( name == "text" ) { + curr_clabel->setText( chars ); + } + else if ( name == "label" ) { + parser_state.pop(); + curr_clabel = NULL; + } + + return TRUE; + } + +//-----------------------------------------------------------// + +bool ksprojectxml_runtime_data::read_carrow_stag( const QString& name, const QXmlAttributes& attr ) + { + if ( !curr_carrow ) return TRUE; + + if ( name == "begin" ) { + curr_carrow->setOriginPos( read_pt3f(attr) ); + } + else if ( name == "end" ) { + curr_carrow->setEndPos( read_pt3f(attr) ); + } + else if ( name == "coord-system-begin" ) { + curr_carrow->setOriginCoord( read_pt3(attr) ); + } + else if ( name == "coord-system-end" ) { + curr_carrow->setEndCoord( read_pt3(attr) ); + } + else if ( name == "dart" ) { + if ( element_number( attr ) == 1 ) curr_carrow->setOriginArrow( read_arrow(attr) ); + else curr_carrow->setEndArrow( read_arrow(attr) ); + } + else if ( name == "point" ) { + if ( element_number( attr ) == 1 ) curr_carrow->setOriginPoint( read_point(attr) ); + else curr_carrow->setEndPoint( read_point(attr) ); + } + else if ( name == "line" ) { + curr_carrow->setLine( read_line(attr) ); + } + else read_cobject_stag( curr_carrow, name, attr ); + + return TRUE; + } + +//-----------------------------------------------------------// + +bool ksprojectxml_runtime_data::read_carrow_etag( const QString& name ) + { + if ( name == "arrow" ) { + parser_state.pop(); + curr_carrow = NULL; + } + + return TRUE; + } + +//-----------------------------------------------------------// + +bool ksprojectxml_runtime_data::read_crect_stag( const QString& name, const QXmlAttributes& attr ) + { + if ( !curr_crect ) return TRUE; + + if ( name == "type" ) { + curr_crect->setEllipse( (bool )attr.value("ellipse").toInt() ); + } + else if ( name == "begin" ) { + curr_crect->setOriginPos( read_pt3f(attr) ); + } + else if ( name == "end" ) { + curr_crect->setEndPos( read_pt3f(attr) ); + } + else if ( name == "coord-system-begin" ) { + curr_crect->setOriginCoord( read_pt3(attr) ); + } + else if ( name == "coord-system-end" ) { + curr_crect->setEndCoord( read_pt3(attr) ); + } + else if ( name == "shadow-shift" ) { + curr_crect->setShadowPos( read_pt2(attr) ); + } + else if ( name == "fill" ) { + if ( element_number( attr ) == 1 ) curr_crect->setFill( read_fill(attr) ); + else curr_crect->setShadowFill( read_fill(attr) ); + } + else if ( name == "line" ) { + curr_crect->setFrame( read_line(attr) ); + } + else read_cobject_stag( curr_crect, name, attr ); + + return TRUE; + } + +//-----------------------------------------------------------// + +bool ksprojectxml_runtime_data::read_crect_etag( const QString& name ) + { + if ( name == "rectangle" ) { + parser_state.pop(); + curr_crect = NULL; + } + return TRUE; + } + +//-----------------------------------------------------------// + +bool ksprojectxml_runtime_data::read_cgroup_stag( const QString& name, const QXmlAttributes& attr ) + { + if ( read_some_object_stag( curr_cgroup.top()->objects(), name, attr ) ) { + } + else read_cobject_stag( curr_cgroup.top(), name, attr ); + return TRUE; + } + +//-----------------------------------------------------------// + +bool ksprojectxml_runtime_data::read_cgroup_etag( const QString& name ) + { + if ( name == "group" ) { + parser_state.pop(); + curr_cgroup.pop(); + } + return TRUE; + } + +//-----------------------------------------------------------// + +bool ksprojectxml_runtime_data::read_cobject_stag( QSCObject *object, const QString& name, const QXmlAttributes& attr ) + { + if ( name == "axes-bindings" ) { + object->setDefaultXAxis( attr.value("x-axis").toInt() ); + object->setDefaultYAxis( attr.value("y-axis").toInt() ); + object->setDefaultZAxis( attr.value("z-axis").toInt() ); + } + else set_error_string( QObject::tr("<br> KMatplot(XML): QSCObject - unexpected tag ") + name ); + + return TRUE; + } + +//-----------------------------------------------------------// + +bool ksprojectxml_runtime_data::read_matrix_stag( const QString& , const QXmlAttributes& ) + { + return TRUE; + } + +//-----------------------------------------------------------// + +bool ksprojectxml_runtime_data::read_matrix_etag( const QString& name ) + { + if ( name == "row" ) { + if ( curr_matrix && curr_row < curr_matrix->rows() ) { + double value; + QTextIStream line(&chars); + for( int col=0; col<curr_matrix->cols(); col++ ) { + value = 0.0; line >> value; + curr_matrix->setValue( curr_row, col, value ); + } + } + curr_row += 1; + } + else if ( name == "matrix" ) { + curr_matrix = NULL; + curr_row = 0; + parser_state.pop(); + } + else set_error_string( QObject::tr("<br> KMatplot(XML): Matrix - unexpected tag ") + name ); + return TRUE; + } + +//-----------------------------------------------------------// + +bool ksprojectxml_runtime_data::read_matrix_ref_stag( const QString& , const QXmlAttributes& ) + { + return TRUE; + } + +//-----------------------------------------------------------// + +bool ksprojectxml_runtime_data::read_matrix_ref_etag( const QString& name ) + { + if ( name == "matrixref" ) { + curr_matrix = NULL; + parser_state.pop(); + } + else set_error_string( QObject::tr("<br> KMatplot(XML): MatrixRef - unexpected tag ") + name ); + return TRUE; + } + +//-----------------------------------------------------------// + +bool ksprojectxml_runtime_data::read_matrix_formula_stag( const QString& , const QXmlAttributes& ) + { + return TRUE; + } + +//-----------------------------------------------------------// + +bool ksprojectxml_runtime_data::read_matrix_formula_etag( const QString& name ) + { + if ( name == "matrix-formula" ) { + curr_matrix = NULL; + parser_state.pop(); + } + else set_error_string( QObject::tr("<br> KMatplot(XML): MatrixFormula - unexpected tag ") + name ); + return TRUE; + } + +//-----------------------------------------------------------// + +bool ksprojectxml_runtime_data::read_matrix_col_ref_stag( const QString& , const QXmlAttributes& ) + { + return TRUE; + } + +//-----------------------------------------------------------// + +bool ksprojectxml_runtime_data::read_matrix_col_ref_etag( const QString& name ) + { + if ( name == "matrixcolref" ) { + curr_matrix = NULL; + parser_state.pop(); + } + else set_error_string( QObject::tr("<br> KMatplot(XML): MatrixColRef - unexpected tag ") + name ); + return TRUE; + } + +//-----------------------------------------------------------// + +bool ksprojectxml_runtime_data::read_matrix_string_stag( const QString& name, const QXmlAttributes& attr ) + { + if ( name == "e" ) { + curr_matrix->setString( attr.value("row").toInt(), attr.value("col").toInt(), xml_to_string(attr.value("string")) ); + } + else set_error_string( QObject::tr("<br> KMatplot(XML): MatrixString - unexpected tag ") + name ); + return TRUE; + } + +//-----------------------------------------------------------// + +bool ksprojectxml_runtime_data::read_matrix_string_etag( const QString& name ) + { + if ( name == "matrix-string" ) { + curr_matrix = NULL; + parser_state.pop(); + } + return TRUE; + } + +//-----------------------------------------------------------// + +bool ksprojectxml_runtime_data::read_gradient_stag( const QString& name, const QXmlAttributes& attr ) + { + if ( name == "fill" ) { + int f_number = element_number( attr ); + curr_gradient_fill[QMIN(4,QMAX(f_number,0))] = read_fill( attr ); + } + else set_error_string( QObject::tr("<br> KMatplot(XML): Gradient - unexpected tag ") + name ); + + return TRUE; + } + +//-----------------------------------------------------------// + +bool ksprojectxml_runtime_data::read_gradient_etag( const QString& name ) + { + if ( name == "gradient" ) { + parser_state.pop(); + curr_plot->setGradient( QSGGradient( curr_gradient_fill[0], + curr_gradient_fill[1], + curr_gradient_fill[2], + curr_gradient_fill[3], + curr_gradient_fill[4], + (QSGGradient::Type )curr_gradient_type) ); + } + + return TRUE; + } + +//-----------------------------------------------------------// + +int ksprojectxml_runtime_data::element_number( const QXmlAttributes& attr ) + { + return attr.value("element-number").toInt(); + } + +//-----------------------------------------------------------// + +QSGFill ksprojectxml_runtime_data::read_fill( const QXmlAttributes& attr ) + { + QSGFill result; + result.style = (QSGFill::Style )get_attr_value( fill_style, attr.value("style") ); + result.color = toQSGColor( attr.value("color") ); + return result; + } + +//-----------------------------------------------------------// + +QSGLine ksprojectxml_runtime_data::read_line( const QXmlAttributes& attr ) + { + QSGLine result; + result.style = (QSGLine::Style )get_attr_value( line_style, attr.value("style") ); + result.width = attr.value("width").toInt(); + result.color = toQSGColor( attr.value("color") ); + return result; + } + +//-----------------------------------------------------------// + +QSGFont ksprojectxml_runtime_data::read_font( const QXmlAttributes& attr ) + { + QSGFont result; + result.family = xml_to_string( attr.value("family") ); + result.size = attr.value("size").toInt(); + result.bold = (bool )attr.value("bold").toInt(); + result.italic = (bool )attr.value("italic").toInt(); + result.color = toQSGColor( attr.value("color") ); + return result; + } + +//-----------------------------------------------------------// + +QSGArrow ksprojectxml_runtime_data::read_arrow( const QXmlAttributes& attr ) + { + QSGArrow result; + result.style = (QSGArrow::Style )get_attr_value( arrow_style, attr.value("style") ); + result.size = attr.value("size").toInt(); + return result; + } + +//-----------------------------------------------------------// + +QSGPoint ksprojectxml_runtime_data::read_point( const QXmlAttributes& attr ) + { + QSGPoint result; + result.style = (QSGPoint::Style )get_attr_value( point_style, attr.value("style") ); + result.fill = (QSGPoint::Fill )get_attr_value( point_fill_style, attr.value("fill") ); + result.size = attr.value("size").toInt(); + result.color = toQSGColor( attr.value("color") ); + return result; + } + +//-----------------------------------------------------------// + +QSPt2 ksprojectxml_runtime_data::read_pt2( const QXmlAttributes& attr ) + { + return QSPt2( attr.value("x").toInt(), attr.value("y").toInt() ); + } + +//-----------------------------------------------------------// + +QSPt3 ksprojectxml_runtime_data::read_pt3( const QXmlAttributes& attr ) + { + return QSPt3( attr.value("x").toInt(), attr.value("y").toInt(), attr.value("z").toInt() ); + } + +//-----------------------------------------------------------// + +QSPt3f ksprojectxml_runtime_data::read_pt3f( const QXmlAttributes& attr ) + { + return QSPt3f( attr.value("x").toDouble(), attr.value("y").toDouble(), attr.value("z").toDouble() ); + } + +//-----------------------------------------------------------// + +void ksprojectxml_runtime_data::create_matrix( QSData *d, const QString& name, const QXmlAttributes& attr ) + { + if ( d == NULL ) { + curr_matrix = NULL; + set_error_string( QObject::tr("KMatplot(create_matrix): No data object allocated - skipping matrix.<br>") ); + return; + } + + QString title = xml_to_string( attr.value("title") ); + int channel = attr.value("data-channel").toInt(); + + if ( name == "matrix" ) { + int rows = attr.value("rows").toInt(); + int cols = attr.value("cols").toInt(); + KSMatrix *new_matrix = KSMatrix::create( (EType )get_attr_value(etype,attr.value("element-type")) ); + new_matrix->resize( rows, cols ); + curr_matrix = new_matrix; + } + else if ( name == "matrixref" ) { + KSMatrixWorksheetCellRange *new_matrix = new KSMatrixWorksheetCellRange( workbook ); + new_matrix->setWorksheet( sheet_number(attr.value("sheet").toInt()) ); + + new_matrix->setRowFrom( attr.value("row-from").toInt() ); + new_matrix->setRowStep( attr.value("row-step").toInt() ); + new_matrix->setRowTo( attr.value("row-to").toInt() ); + new_matrix->setColFrom( attr.value("col-from").toInt() ); + new_matrix->setColStep( attr.value("col-step").toInt() ); + new_matrix->setColTo( attr.value("col-to").toInt() ); + new_matrix->setTransposition( (bool )attr.value("transposition").toInt() ); + curr_matrix = new_matrix; + } + else if ( name == "matrixcolref" ) { + KSMatrixWorksheetCellRange *new_matrix = new KSMatrixWorksheetCellRange( workbook ); + new_matrix->setWorksheet( sheet_number(attr.value("sheet").toInt()) ); + + new_matrix->setColumn( attr.value("column").toInt() ); + new_matrix->setTransposition( (bool )attr.value("transposition").toInt() ); + curr_matrix = new_matrix; + } + else if ( name == "matrix-string" ) { + int rows = attr.value("rows").toInt(); + int cols = attr.value("cols").toInt(); + KSMatrixString *new_matrix = new KSMatrixString(); + new_matrix->resize( rows, cols ); + curr_matrix = new_matrix; + } + else if ( name == "matrix-formula" ) { + KSMatrixFormula *new_matrix = new KSMatrixFormula(); + new_matrix->setFormula( xml_to_string( attr.value("formula") ) ); + new_matrix->setTransposition( (bool )attr.value("transposition").toInt() ); + curr_matrix = new_matrix; + } + if ( curr_matrix ) { + curr_matrix->setName(title); + curr_matrix->setDataObject( d, channel ); + d->setMatrix( channel, curr_matrix ); + + // setting matrix failed - nonexistient channel ? + if ( d->matrix(channel) != curr_matrix ) { + delete curr_matrix; + curr_matrix = NULL; + } + + // recalculate formula matrix -> add output to console + if ( dynamic_cast<KSMatrixFormula*>(curr_matrix) ) { + KSMatrixFormula *formula_matrix = dynamic_cast<KSMatrixFormula*>(curr_matrix); + MPFactoryList factory( new KSDataSymbolFactory( workbook, formula_matrix->dataObject() ) ); + MPFormulaError error; + formula_matrix->init( error, &factory ); + if ( error.hasError() ) QSConsole::write( QObject::tr("Error parsing formula :")+formula_matrix->formula()+"<br>"+error.message() ); + } + } + + curr_row = 0; + } + +//-----------------------------------------------------------// + + + + + + + + + + + + + + + + + + + + + + diff --git a/kmatplot/ksprojectxml.h b/kmatplot/ksprojectxml.h new file mode 100644 index 0000000..3623d44 --- /dev/null +++ b/kmatplot/ksprojectxml.h @@ -0,0 +1,48 @@ +/*************************************************************************** + ksprojectxml.h + ------------------- + begin : Sun Feb 13 2000 + copyright : (C) 2000 by Kamil Dobkowski + email : kamildbk@friko.onet.pl + ***************************************************************************/ + +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + +#ifndef KSPROJECTXML_H +#define KSPROJECTXML_H + +#include <qstring.h> +#include <qfile.h> + +struct ksprojectxml_runtime_data; + +class KMatplotShell; +/** + * Loading/saving. When loading it adds new pages and doesn't delete old contents. + */ +class KSProjectXML + { + public: + KSProjectXML( KMatplotShell *shell ); + ~KSProjectXML(); + + bool saveToFile( QFile& outputFile ); + bool loadFromFile( QFile& inputFile ); + + + private: + void alloc_runtime_data(); + void free_runtime_data(); + void xml( const QString& line ); + KMatplotShell *m_shell; + ksprojectxml_runtime_data *d; + }; + +#endif diff --git a/kmatplot/kssocketio.cpp b/kmatplot/kssocketio.cpp new file mode 100644 index 0000000..3ab34f5 --- /dev/null +++ b/kmatplot/kssocketio.cpp @@ -0,0 +1,436 @@ +/*************************************************************************** + kssocketio.cpp + ------------------- + begin : Tue Jun 13 2000 + copyright : (C) 2000 by Kamil Dobkowski + email : kamildobk@friko.onet.pl + ***************************************************************************/ + +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + +#include<assert.h> +#include<stdio.h> // P_tmpdir +#include<unistd.h> // unlink +#include<fcntl.h> +#include<sys/un.h> +#include<sys/types.h> +#include<sys/socket.h> + +//#include<kapp.h> +#include<qapplication.h> +#include<qsocketnotifier.h> +#include"kssocketio.h" +#include"ksmatrix.h" +#include"kmatplotshell.h" +#include"kscommands.h" + +#include"widgets/qsconsole.h" +#include"widgets/qsaxes2d.h" +#include"widgets/qsaxes3d.h" +#include"widgets/qscurve.h" +#include"widgets/qsimage.h" +#include"widgets/qscontour.h" +#include"widgets/qssurface.h" +#include"widgets/qsfigure.h" + +//--------------------------------------------------------------// + +KSSocketIO::KSSocketIO(QObject *parent, const char *name ) + : QObject(parent,name), app_number( 0 ), socket_fd( -1 ), socket_notifier( NULL ) + { + connection.socket_notifier = NULL; + connection.socket_fd = -1; + msg.data = NULL; + m_shell = NULL; + new_message(); + available_axes_id = 0; + } + +//--------------------------------------------------------------// + +KSSocketIO::~KSSocketIO() + { + cleanup(); + } + +//--------------------------------------------------------------// + +void KSSocketIO::setShell( KMatplotShell *shell ) + { + if ( m_shell ) { + QObject::disconnect( m_shell->workbook(), SIGNAL(sigObjectAdded(QSCObject*)), this, SLOT(object_added(QSCObject*)) ); + QObject::disconnect( m_shell->workbook(), SIGNAL(sigObjectRemoved(QSCObject*)), this, SLOT(object_removed(QSCObject*)) ); + + } + m_shell = shell; + m_workbook = m_shell->workbook(); + if ( m_shell ) { + QObject::connect( m_shell->workbook(), SIGNAL(sigObjectAdded(QSCObject*)), this, SLOT(object_added(QSCObject*)) ); + QObject::connect( m_shell->workbook(), SIGNAL(sigObjectRemoved(QSCObject*)), this, SLOT(object_removed(QSCObject*)) ); + } + if ( socket_fd == -1 ) open_socket(); + } + +//--------------------------------------------------------------// + +void KSSocketIO::setFileDescriptor( int fd ) + { + assert( socket_fd == -1 ); + + struct sockaddr_un addr; unsigned int len = sizeof(addr); + memset( (char *)&addr, 0, sizeof(addr) ); + if ( getsockname( fd, (struct sockaddr *)&addr, &len ) == 0 ) { + socket_name = QCString( addr.sun_path, sizeof(addr.sun_path) ); + QCString number = socket_name; + number.remove( 0, name_prefix().length() ); + app_number = number.toUInt(); + // listen already called by a parent process + setup_socket( fd ); + } else { + QSConsole::write( tr("File descriptor %1 does not point on a valid unix socket.").arg(fd) ); + perror(""); + } + } +//--------------------------------------------------------------// + +int KSSocketIO::axesId( QSAxes *axes ) const + { + QMap<int,QSAxes*>::ConstIterator it; + for( it = m_axes.begin(); it != m_axes.end(); ++it ) + if ( it.data() == axes ) return it.key(); + return -1; + } + +//--------------------------------------------------------------// + +int KSSocketIO::registerAxes( QSAxes *axes, int id ) + { + assert( axes ); + assert( id >= 0 ); + //cout << " Registered axes " << axes << " id " << id << endl; + m_axes[id] = axes; + return id; + } + +//--------------------------------------------------------------// + +void KSSocketIO::unregisterAxes( int id ) + { + assert( id >= 0 ); + m_axes.remove( id ); + } + +//--------------------------------------------------------------// + +void KSSocketIO::open_socket() + { + assert( socket_fd == -1 ); + int socket_fd = socket( AF_UNIX, SOCK_STREAM, 0 ); + assert( socket_fd >= 0 ); + + struct sockaddr_un addr; + do { + app_number ++; + QCString number; + socket_name = name_prefix() + number.setNum(app_number); + memset( (char *)&addr, 0, sizeof(addr) ); + addr.sun_family = AF_UNIX; + strcpy( addr.sun_path, (const char *)socket_name ); + } + while( bind(socket_fd,(struct sockaddr *)&addr,strlen(addr.sun_path)+sizeof(addr.sun_family)) < 0 ); + listen( socket_fd, 1 ); + setup_socket( socket_fd ); + } + +//--------------------------------------------------------------// + +void KSSocketIO::setup_socket( int fd ) + { + socket_fd = fd; + fcntl( fd, F_SETFL, O_NONBLOCK ); + socket_notifier = new QSocketNotifier( fd, QSocketNotifier::Read, this ); + connect( socket_notifier, SIGNAL(activated(int)), this, SLOT(connection_requested(int)) ); + connect( qApp, SIGNAL(aboutToQuit()), this, SLOT(cleanup()) ); + } + +//--------------------------------------------------------------// + +void KSSocketIO::close_socket() + { + if ( socket_fd >= 0 ) { + close( socket_fd ); + delete socket_notifier; + socket_notifier = NULL; + socket_fd = -1; + unlink( (const char *)socket_name ); + app_number = 0; + socket_name = QCString(); + } + } + +//--------------------------------------------------------------// + +void KSSocketIO::cleanup() + { + disconnect(); + close_socket(); + } + +//--------------------------------------------------------------// + +void KSSocketIO::connection_requested(int) + { + accept_connection(); + } + +//--------------------------------------------------------------// + +void KSSocketIO::connection_lost() + { + disconnect(); + } + +//--------------------------------------------------------------// + +void KSSocketIO::accept_connection() + { + socket_notifier->setEnabled(false); + + assert( socket_fd >= 0 ); + assert( connection.socket_fd == -1 ); + struct sockaddr_un addr; unsigned int len = sizeof(addr); + connection.socket_fd = accept( socket_fd, (struct sockaddr *)&addr, &len ); + + fcntl( connection.socket_fd, F_SETFL, O_NONBLOCK ); + if ( connection.socket_fd >= 0 ) { + connection.socket_notifier = new QSocketNotifier( connection.socket_fd, QSocketNotifier::Read, this ); + connect( connection.socket_notifier, SIGNAL(activated(int)), this, SLOT(read_data(int)) ); + } + + } + +//--------------------------------------------------------------// + +void KSSocketIO::disconnect() + { + if ( connection.socket_fd >= 0 ) { + delete connection.socket_notifier; + connection.socket_notifier = NULL; + close( connection.socket_fd ); + connection.socket_fd = -1; + } + new_message(); + if ( socket_notifier ) + socket_notifier->setEnabled(true); + } + +//--------------------------------------------------------------// + +void KSSocketIO::read_data( int ) + { + int nread = 0; + int hsize = sizeof(msg.header); + + // + // read a message header + // + if ( msg.nread < hsize ) { + nread = read( connection.socket_fd, (char *)&msg.header + msg.nread, hsize - msg.nread ); + } + // + // read a message body + // + else + if ( msg.nread < msg.dlen ) { + nread = read( connection.socket_fd, msg.data + msg.nread - hsize, msg.dlen - msg.nread ); + } + if ( nread <= 0 ) { perror(""); connection_lost(); return; } else msg.nread += nread; + + // + // header is read + // + if ( msg.nread == hsize ) { msg.dlen = sizeof(msg.header) + msg.header.h.dlen; msg.data = new char[msg.header.h.dlen]; } + + // + // message is read. + // + if ( msg.nread >= hsize && msg.nread == msg.dlen ) { + int reply_code = message_ready(); + new_message(); + reply( reply_code ); + } + } + +//--------------------------------------------------------------// + +int KSSocketIO::message_ready() + { + int reply_code = -1; + // + // Add plot the app is run as a standalone one. + //if ( !parts.contains(msg.header.h.plot) ) return reply_code; + //KMatplotShell *shell = m_shell; + + if ( !m_shell ) return reply_code; + + QSAxes *axes = m_axes[msg.header.h.plot]; + + if ( msg.header.h.type == MsgAddAxes ) { + if ( msg.header.a.axes ) { + QSAxes *new_axes = new QSAxes3D(); + if ( m_workbook->page(0) ) m_workbook->execute( new KSCmdAddCObject(new_axes->shadowObject(),m_workbook->page(0)->objects()) ); + } else { + QSAxes *new_axes = new QSAxes2D(); + if ( m_workbook->page(0) ) m_workbook->execute( new KSCmdAddCObject(new_axes->shadowObject(),m_workbook->page(0)->objects()) ); + } + reply_code = available_axes_id; + } + else + if ( msg.header.h.type == MsgRemoveAxes ) { + if ( !axes ) return reply_code; + bool ok = m_shell->workbook()->execute( new KSCmdRemoveCObject(axes->shadowObject()) ); + if ( ok ) reply_code = 0; + } + else + if ( msg.header.h.type == MsgChannel ) { + if ( !axes ) return reply_code; + + KSMatrix *m = KSMatrix::create( (EType )msg.header.c.etype ); + assert( m ); + m->setRawData( msg.data, + msg.header.c.rows, + msg.header.c.cols, + true, + msg.header.c.lineo, + msg.header.c.pixelo ); + if ( axes->plot(msg.header.c.dnum) ) { + axes->plot(msg.header.c.dnum)->setMatrix( msg.header.c.chan, m ); + reply_code = 0; + } else delete m; + // don't delete it. + msg.data = NULL; + } + else + if ( msg.header.h.type == MsgProperty ) { + if ( !axes ) return reply_code; + } + else + if ( msg.header.h.type == MsgAddDataset ) { + if ( !axes ) return reply_code; + QSPlot *p = NULL; + +// int plots_number = axes->plotsCount(); + // Ooopss ! + switch ( msg.header.t.ptype ) { + case PlotCurve: p = new QSCurve( axes ); break; + case PlotImage: p = new QSImage( axes ); break; + case PlotContour: p = new QSGriddedContour( axes ); break; + case PlotSurface: p = new QSSurface( axes ); break; + case PlotFigure: p = new QSFigure( axes ); break; + } + + if ( p ) { + axes->plotAdd( p ); + reply_code = axes->plotCount()-1; + } else { + reply_code = -1; + } + } + else + if ( msg.header.h.type == MsgRemoveDataset ) { + if ( !axes ) return reply_code; + + if ( axes->plot(msg.header.t.dnum) ) { + QSPlot *p = axes->plot(msg.header.t.dnum); + axes->plotRemove( p ); + delete p; + reply_code = 0; + } + } + else + if ( msg.header.h.type == MsgRemoveAllDatasets ) { + if ( !axes ) return reply_code; + while( axes->plot(0) ) { + QSPlot *p = axes->plot(0); + axes->plotRemove( p ); + delete p; + } + reply_code = 0; + } + + return reply_code; + } + +//--------------------------------------------------------------// + +void KSSocketIO::new_message() + { + delete msg.data; + msg.dlen = 0; + msg.nread = 0; + msg.data = NULL; + } + +//--------------------------------------------------------------// + +void KSSocketIO::reply( int code ) + { + _write_data( connection.socket_fd, (const char *)&code, sizeof(code) ); + } + +//--------------------------------------------------------------// + +QCString KSSocketIO::name_prefix() + { + return QCString(P_tmpdir) + "/" + ".kmatplot." + getenv("USER") + "."; + } + +//--------------------------------------------------------------// + +int KSSocketIO::_write_data( int fd, const char *data, int len ) + { + int nleft; + int bytes; + const char *ptr; + + ptr = data; + nleft = len; + while( nleft > 0 ) { + bytes = write( fd, ptr, nleft ); + if ( bytes < 0 ) break; /* error */ + nleft -= bytes; + ptr += bytes; + } + + return(len - nleft); + } + +//--------------------------------------------------------------// + +void KSSocketIO::object_added( QSCObject *object ) + { + if ( object->isAxesShadow() ) { + QSAxes *axes = object->parentAxes(); + ++available_axes_id; + registerAxes( axes, available_axes_id ); + } + } + +//--------------------------------------------------------------// + +void KSSocketIO::object_removed( QSCObject *object ) + { + if ( object->isAxesShadow() ) { + QSAxes *axes= object->parentAxes(); + int axes_id = axesId(axes); + if ( axes_id >= 0 ) unregisterAxes( axes_id ); + } + } + diff --git a/kmatplot/kssocketio.h b/kmatplot/kssocketio.h new file mode 100644 index 0000000..e49ce6c --- /dev/null +++ b/kmatplot/kssocketio.h @@ -0,0 +1,145 @@ +/*************************************************************************** + kssocketio.h + ------------------- + begin : Tue Jun 13 2000 + copyright : (C) 2000 by Kamil Dobkowski + email : kamildobk@friko.onet.pl + ***************************************************************************/ + +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + +#ifndef KSSOCKETIO_H +#define KSSOCKETIO_H + + +#include <qobject.h> +#include <qcstring.h> +#include <qmap.h> +#include "interface/msg.h" +#include "widgets/qsaxes.h" + +class KMatplotShell; +class KSWorkbook; +class QSocketNotifier; + +/** + *@author Kamil Dobkowski + */ +class KSSocketIO : public QObject { + + Q_OBJECT + + public: + + /** + * Constructor. + */ + KSSocketIO(QObject *parent=0, const char *name=0); + + /** + * Destructor. + */ + ~KSSocketIO(); + + /** + * + */ + void setShell( KMatplotShell *shell ); + + /** + * + */ + KMatplotShell *shell() const { return m_shell; } + + /** + * Sets a file descriptor to use instead creating a new socket. + * This must be called before any part is registered. + */ + void setFileDescriptor( int fd ); + + /** + * + */ + int axesId( QSAxes *axes ) const; + + /** + * Register part for message dispatching under a given 'id'. + * If this id exist a previous part is unregistered. If it is + * zero, the first unused id is taken. Returns part's id. + */ + int registerAxes( QSAxes *axes, int id = 0 ); + + /** + * Unregister part. + */ + void unregisterAxes( int id ); + + /** + * Returns application unique number or -1. + */ + int appNumber() const { return app_number; } + + /** + * Returns a socket path. If there is no socket or + * a file descriptor is used this funtion returns an empty + * string. + */ + QCString socketName() const { return socket_name; } + + protected slots: + + void connection_requested(int); + void read_data(int); + void cleanup(); + void object_added( QSCObject *o ); + void object_removed( QSCObject *o ); + + protected: + + void open_socket(); + void setup_socket( int socket_fd ); + void close_socket(); + + void accept_connection(); + void connection_lost(); + void disconnect(); + void header_ready(); + int message_ready(); + void new_message(); + void reply( int code ); + int _write_data( int fd, const char *data, int len ); + QCString name_prefix(); + + int available_axes_id; + int app_number; + int socket_fd; + QSocketNotifier *socket_notifier; + QCString socket_name; + QMap<int,QSAxes*> m_axes; + KMatplotShell *m_shell; + KSWorkbook *m_workbook; + + struct { + int socket_fd; + QSocketNotifier *socket_notifier; + } connection; + + struct { + int dlen; + int nread; + hdr_t header; + char *data; + } msg; + + }; + + + +#endif diff --git a/kmatplot/kswinpageview.cpp b/kmatplot/kswinpageview.cpp new file mode 100644 index 0000000..7e25904 --- /dev/null +++ b/kmatplot/kswinpageview.cpp @@ -0,0 +1,1127 @@ +/*************************************************************************** + kswinpageview.cpp - description + ------------------- + begin : Thu Jan 17 2002 + copyright : (C) 2002 by kamil + email : kamil@localhost.localdomain + ***************************************************************************/ + +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + +#include "kswinpageview.h" + +#include "kspanelmanager.h" +#include "ksobjectfactory.h" +#include "kscommands.h" +#include "kssocketio.h" +#include "kmatplotshell.h" +#include "ksmatrix.h" +#include "qscobjects.h" +#include "qsctools.h" + +#include "ksworksheetdlg.h" +#include "widgets/qsgattr.h" +#include "widgets/qsplotview.h" +#include "widgets/qsaxes2d.h" +#include "widgets/qsaxes3d.h" +#include "widgets/qscurve.h" +#include "widgets/qsimage.h" +#include "widgets/qscontour.h" +#include "widgets/qssurface.h" +#include "widgets/qsfigure.h" +#include "widgets/qsclegend.h" +#include "widgets/qsplotview.h" + +#include "formula/mpformula.h" +#include "formula/mpsymbols.h" +#include "dialogs/ksdatasetdlg.h" +#include "dialogs/ksobjecttreedlg.h" +#include "dialogs/ksexportpicturedlg.h" +#include "dialogs/ksgriddlg.h" +#include "dialogs/ksgraphwizard.h" + +#include "pixmaps/action_red.xpm" + +#include <qpixmap.h> +#include <qaction.h> +#include <qpopupmenu.h> +#include <qinputdialog.h> +#include <qmessagebox.h> +#include <qcursor.h> + +// see main.cpp +extern KSSocketIO *kmatplot_socket; + +//--------------------------------------------------------------------------// + +KSWinPageView::KSWinPageView( KSWorkspace *workspace ) +: KSWorkspaceWindow( workspace, tr("Page view"), QPixmap(action_red) ) + { + m_curr_dataset = NULL; + + m_shell = workspace->shell(); + m_workbook = m_shell->workbook(); + m_curr_ranges_cmd = NULL; + m_curr_properties_cmd = NULL; + m_apply_button = false; + + m_view = new QSPlotView(this); + m_view->setWorkbook( m_workbook ); + m_view->setZoom( 0.75 ); + m_view->setTool( new QSToolSelect(m_shell) ); + + setContents( m_view ); + connect( m_view->selection(), SIGNAL(sigListChanged()), this, SLOT(slot_selection_changed()) ); + connect( m_view, SIGNAL(sigActiveObjectChanged()), this, SLOT(slot_selected_object_changed()) ); + connect( m_view, SIGNAL(sigActiveAxesChanged()), this, SLOT(slot_active_axes_changed()) ); + connect( m_view, SIGNAL(sigPageBarClicked()), this, SLOT(slot_show_page_popup()) ); + connect( m_view, SIGNAL(sigCurrentPageChanged()), this, SLOT(slot_curr_page_changed()) ); + connect( m_view, SIGNAL(sigSliderPressed()), this, SLOT(slot_view_slider_pressed()) ); + connect( m_view, SIGNAL(sigSliderReleased()), this, SLOT(slot_view_slider_released()) ); + connect( m_view, SIGNAL(sigScrollBarPressed()), this, SLOT(slot_view_scrollbar_pressed()) ); + connect( m_view, SIGNAL(sigScrollBarReleased()), this, SLOT(slot_view_scrollbar_released()) ); + connect( m_view, SIGNAL(sigCurrentPageTitleChanged(const QString&)), this, SLOT(slot_page_title_changed(const QString&)) ); + } + +//--------------------------------------------------------------------------// + +KSWinPageView::~KSWinPageView() + { + delete m_curr_properties_cmd; + delete m_curr_ranges_cmd; + } + +//--------------------------------------------------------------------------// + +QSPlotView *KSWinPageView::view() const + { + return m_view; + } + +//--------------------------------------------------------------------------// + +void KSWinPageView::activated() + { + m_shell->disableCustomActions(); + // page commands, export picture + slot_curr_page_changed(); + // enable cut delete etc if there is selection + slot_selection_changed(); + // enable insert xaxis, legend, edit_datasets + slot_active_axes_changed(); + + m_shell->m_paste->setEnabled( TRUE ); + + m_shell->m_object_menu->setEnabled( TRUE ); + + m_shell->m_tools->setEnabled( TRUE ); + m_shell->m_zoom->setEnabled( TRUE ); + m_shell->m_grid->setEnabled( TRUE ); + m_shell->m_ioinfo->setEnabled( TRUE ); + + m_shell->m_hide_sliders->setEnabled( TRUE ); + m_shell->m_apply_button->setEnabled( TRUE ); + m_shell->m_hide_rulers->setEnabled( TRUE ); + m_shell->m_x11_backstoring->setEnabled( TRUE ); + m_shell->m_show_full_page->setEnabled( TRUE ); + + // set a propert tool, zoom, settings, etc. + update_actions(); + } + +//------------------------------------------------------------// + +void KSWinPageView::deactivated() + { + } + +//-----------------------------------------------------------// + +void KSWinPageView::update_actions() + { + if ( dynamic_cast<QSToolZoom*>(m_view->tool()) ) m_shell->m_tool_zoom->setOn( TRUE ); + else + if ( dynamic_cast<QSToolLocate*>(m_view->tool()) ) m_shell->m_tool_locate->setOn( TRUE ); + else + if ( dynamic_cast<QSToolSelect*>(m_view->tool()) ) m_shell->m_tool_select->setOn( TRUE ); + else + if ( dynamic_cast<QSToolLabel*>(m_view->tool()) ) m_shell->m_tool_label->setOn( TRUE ); + else + if ( dynamic_cast<QSToolArrow*>(m_view->tool()) ) m_shell->m_tool_arrow->setOn( TRUE ); + else + if ( dynamic_cast<QSToolRect*>(m_view->tool()) ) m_shell->m_tool_rect->setOn( TRUE ); + else { + m_shell->m_tool_locate->setOn( FALSE ); + m_shell->m_tool_select->setOn( FALSE ); + m_shell->m_tool_label->setOn( FALSE ); + m_shell->m_tool_arrow->setOn( FALSE ); + m_shell->m_tool_rect->setOn( FALSE ); + m_shell->m_tool_zoom->setOn( FALSE ); + } + + if ( m_view->zoom() == 0.50 ) m_shell->m_zoom_50->setOn( TRUE ); + if ( m_view->zoom() == 0.75 ) m_shell->m_zoom_75->setOn( TRUE ); + if ( m_view->zoom() == 1.00 ) m_shell->m_zoom_100->setOn( TRUE ); + if ( m_view->zoom() == 1.50 ) m_shell->m_zoom_150->setOn( TRUE ); + if ( m_view->zoom() == 2.00 ) m_shell->m_zoom_200->setOn( TRUE ); + + if ( !m_view->slidersVisible() ) m_shell->m_hide_sliders->setOn( TRUE ); + else m_shell->m_hide_sliders->setOn( FALSE ); + if ( !m_view->rulersVisible() ) m_shell->m_hide_rulers->setOn( TRUE ); + else m_shell->m_hide_rulers->setOn( FALSE ); + if ( !m_view->pixmapBuffering() ) m_shell->m_x11_backstoring->setOn( TRUE ); + else m_shell->m_x11_backstoring->setOn( FALSE ); + if ( m_view->fullPage() ) m_shell->m_show_full_page->setOn( TRUE ); + else m_shell->m_show_full_page->setOn( FALSE ); + if ( m_apply_button ) m_shell->m_apply_button->setOn( TRUE ); + else m_shell->m_apply_button->setOn( FALSE ); + } + +//-----------------------------------------------------------// + +void KSWinPageView::slot_curr_page_changed() + { + if ( m_view->currentPage() ) { + m_shell->m_wizard->setEnabled( TRUE ); + m_shell->m_new_axes2d->setEnabled( TRUE ); + m_shell->m_new_axes3d->setEnabled( TRUE ); + m_shell->m_rename_page->setEnabled( TRUE ); + m_shell->m_delete_page->setEnabled( TRUE ); + m_shell->m_page_to_front->setEnabled( TRUE ); + m_shell->m_page_to_back->setEnabled( TRUE ); + m_shell->m_raise_page->setEnabled( TRUE ); + m_shell->m_lower_page->setEnabled( TRUE ); + m_shell->m_export_picture->setEnabled( TRUE ); + slot_page_title_changed( m_view->currentPage()->title() ); + } else { + m_shell->m_wizard->setEnabled( FALSE ); + m_shell->m_new_axes2d->setEnabled( FALSE ); + m_shell->m_new_axes3d->setEnabled( FALSE ); + m_shell->m_rename_page->setEnabled( FALSE ); + m_shell->m_delete_page->setEnabled( FALSE ); + m_shell->m_page_to_front->setEnabled( FALSE ); + m_shell->m_page_to_back->setEnabled( FALSE ); + m_shell->m_raise_page->setEnabled( FALSE ); + m_shell->m_lower_page->setEnabled( FALSE ); + m_shell->m_export_picture->setEnabled( FALSE ); + slot_page_title_changed( QString::null ); + } + /* + if ( view()->currentPage() ) { + m_shell->m_edit_objects->setEnabled(TRUE); + } else { + m_shell->m_edit_objects->setEnabled(FALSE); + } + */ + } + +//-----------------------------------------------------------// + +void KSWinPageView::slot_active_axes_changed() + { + m_view->bindScrollBar( QSPlotView::HorizontalBar, QSAxis::XAxisType ); + m_view->bindScrollBar( QSPlotView::VerticalBar, QSAxis::YAxisType ); + if ( dynamic_cast<QSAxes2D*>(m_view->activeAxes()) ) { + m_view->bindSlider( QSPlotView::HorizontalSlider, "", 0, 0 ); + m_view->bindSlider( QSPlotView::VerticalSlider, "", 0, 0 ); + m_view->bindSlider( QSPlotView::AdditionalSlider, "", 0, 0 ); + } + else + if ( dynamic_cast<QSAxes3D*>(m_view->activeAxes()) ) { + m_view->bindSlider( QSPlotView::HorizontalSlider, "azimuth", 0, 359 ); + m_view->bindSlider( QSPlotView::VerticalSlider, "elevation", -90, 90 ); + m_view->bindSlider( QSPlotView::AdditionalSlider, "lightAzimuth", 0, 359 ); + } + else { + m_view->bindSlider( QSPlotView::HorizontalSlider, "", 0, 0 ); + m_view->bindSlider( QSPlotView::VerticalSlider, "", 0, 0 ); + m_view->bindSlider( QSPlotView::AdditionalSlider, "", 0, 0 ); + } + + if ( m_view->activeAxes() ) { + m_shell->m_paste_dataset->setEnabled( TRUE ); + // enable actions + m_shell->m_new_curve->setEnabled( TRUE ); + m_shell->m_new_image->setEnabled( TRUE ); + m_shell->m_new_contour->setEnabled( TRUE ); + m_shell->m_new_ngcontour->setEnabled( TRUE ); + m_shell->m_new_surface->setEnabled( TRUE ); + m_shell->m_new_figure->setEnabled( TRUE ); + m_shell->m_new_legend->setEnabled( TRUE ); + m_shell->m_new_xaxis->setEnabled( TRUE ); + m_shell->m_new_yaxis->setEnabled( TRUE ); + m_shell->m_new_zaxis->setEnabled( TRUE ); + m_shell->m_new_vaxis->setEnabled( TRUE ); + m_shell->m_new_legend->setEnabled( TRUE ); + } else { + m_shell->m_paste_dataset->setEnabled( FALSE ); + // disable actions + m_shell->m_new_curve->setEnabled( FALSE ); + m_shell->m_new_image->setEnabled( FALSE ); + m_shell->m_new_contour->setEnabled( FALSE ); + m_shell->m_new_ngcontour->setEnabled( FALSE ); + m_shell->m_new_surface->setEnabled( FALSE ); + m_shell->m_new_figure->setEnabled( FALSE ); + m_shell->m_new_legend->setEnabled( FALSE ); + m_shell->m_new_xaxis->setEnabled( FALSE ); + m_shell->m_new_yaxis->setEnabled( FALSE ); + m_shell->m_new_zaxis->setEnabled( FALSE ); + m_shell->m_new_legend->setEnabled( FALSE ); + } + + if ( view()->activeAxes() ) { + m_shell->m_datasets->setEnabled(TRUE); + } else { + m_shell->m_datasets->setEnabled(FALSE); + } + } + +//-----------------------------------------------------------// + +void KSWinPageView::slot_selection_changed() + { + if ( m_view->selection()->count()>0 ) { + m_shell->m_cut->setEnabled( TRUE ); + m_shell->m_copy->setEnabled( TRUE ); + m_shell->m_copy_all->setEnabled( TRUE ); + m_shell->m_delete->setEnabled( TRUE ); + m_shell->m_bring_to_front->setEnabled( TRUE ); + m_shell->m_send_to_back->setEnabled( TRUE ); + m_shell->m_raise->setEnabled( TRUE ); + m_shell->m_lower->setEnabled( TRUE ); + } else { + m_shell->m_cut->setEnabled( FALSE ); + m_shell->m_copy->setEnabled( FALSE ); + m_shell->m_copy_all->setEnabled( FALSE ); + m_shell->m_delete->setEnabled( FALSE ); + m_shell->m_bring_to_front->setEnabled( FALSE ); + m_shell->m_send_to_back->setEnabled( FALSE ); + m_shell->m_raise->setEnabled( FALSE ); + m_shell->m_lower->setEnabled( FALSE ); + } + + if ( m_view->selection()->count()>1 ) { + m_shell->m_group->setEnabled( TRUE ); + } else { + m_shell->m_group->setEnabled( FALSE ); + } + } + +//-----------------------------------------------------------// + +void KSWinPageView::slot_selected_object_changed() + { + if ( dynamic_cast<QSCGroup*>(m_view->activeObject()) && !m_view->activeObject()->isAxesShadow() ) { + m_shell->m_ungroup->setEnabled( TRUE ); + } else { + m_shell->m_ungroup->setEnabled( FALSE ); + } + } + +//-----------------------------------------------------------// + +void KSWinPageView::slot_view_slider_pressed() + { + if ( m_view->activeAxes() ) { + delete m_curr_properties_cmd; + m_curr_properties_cmd = new KSCmdSetProperties( m_view->activeAxes() ); + // only register properties ( current value will be remembered ) + for ( int slider_nr=0; slider_nr<3; slider_nr++ ) { + QCString property_name = m_view->sliderProperty( (QSPlotView::SliderType )slider_nr); + m_curr_properties_cmd->setProperty( property_name, m_view->activeAxes()->property(property_name) ); + } + } + } + +//-----------------------------------------------------------// + +void KSWinPageView::slot_view_slider_released() + { + if ( m_curr_properties_cmd ) { + // update to new values + for ( int slider_nr=0; slider_nr<3; slider_nr++ ) { + QCString property_name = m_view->sliderProperty( (QSPlotView::SliderType )slider_nr ); + m_curr_properties_cmd->setProperty( property_name, m_view->activeAxes()->property(property_name) ); + } + m_workbook->execute( m_curr_properties_cmd ); + m_curr_properties_cmd = NULL; + } + } + +//-----------------------------------------------------------// + +void KSWinPageView::slot_view_scrollbar_pressed() + { + if ( m_view->activeAxes() ) { + delete m_curr_ranges_cmd; + m_curr_ranges_cmd = new KSCmdSetRanges( m_view->activeAxes() ); + } + } + +//-----------------------------------------------------------// + +void KSWinPageView::slot_view_scrollbar_released() + { + if ( m_curr_ranges_cmd ) { + m_curr_ranges_cmd->commit(); + m_workbook->execute( m_curr_ranges_cmd ); + m_curr_ranges_cmd = NULL; + } + } + +//--------------------------------------------------------------------------// + +void KSWinPageView::cut() + { + if ( m_view->selection()->count() > 0 ) { + KSObjectFactory factory( m_workbook ); + factory.copyQSCObjectCollectionToClipboard( m_view->selection() ); + m_workbook->execute( new KSCmdRemoveCObject( m_view->selection() ) ); + } + } + +//--------------------------------------------------------------------------// + +void KSWinPageView::copy() + { + if ( m_view->selection()->count() > 0 ) { + KSObjectFactory factory( m_workbook ); + factory.copyQSCObjectCollectionToClipboard( m_view->selection() ); + } + } + +//--------------------------------------------------------------------------// + +void KSWinPageView::copyAll() + { + if ( m_view->selection()->count() > 0 ) { + KSObjectFactory factory( m_workbook ); + factory.setFlags( KSObjectFactory::CopyAllData ); + factory.copyQSCObjectCollectionToClipboard( m_view->selection() ); + } + } + +//--------------------------------------------------------------------------// + +void KSWinPageView::paste() + { + KSObjectFactory factory( m_workbook ); + QSCObjectCollection *new_objects = factory.pasteQSCObjectCollectionFromClipboard(); + if ( new_objects ) { + bool ok = m_workbook->execute( new KSCmdAddCObject( new_objects, m_view->activeCollection() ) ); + if ( ok ) for( int i=0; i<new_objects->count(); i++ ) m_view->selection()->add( new_objects->object(i) ); + delete new_objects; + } + } + +//--------------------------------------------------------------------------// + +void KSWinPageView::del() + { + m_workbook->execute( new KSCmdRemoveCObject( m_view->selection() ) ); + } + +//--------------------------------------------------------------------------// + +void KSWinPageView::doAction( QAction* action ) + { + if ( !isActive() ) return; + if ( action == m_shell->m_delete_page ) slotDeletePage(); + if ( action == m_shell->m_rename_page ) slotRenamePage(); + if ( action == m_shell->m_page_to_front ) slotPageToFront(); + if ( action == m_shell->m_page_to_back ) slotPageToBack(); + if ( action == m_shell->m_raise_page ) slotRaisePage(); + if ( action == m_shell->m_lower_page ) slotLowerPage(); + if ( action == m_shell->m_export_picture ) slotExportPicture(); + + if ( action == m_shell->m_wizard ) slotWizard(); + if ( action == m_shell->m_new_axes2d ) slotNewAxes2D(); + if ( action == m_shell->m_new_axes3d ) slotNewAxes3D(); + if ( action == m_shell->m_new_curve ) slotNewCurve(); + if ( action == m_shell->m_new_image ) slotNewImage(); + if ( action == m_shell->m_new_contour ) slotNewContour(); + if ( action == m_shell->m_new_ngcontour ) slotNewNGContour(); + if ( action == m_shell->m_new_surface ) slotNewSurface(); + if ( action == m_shell->m_new_figure ) slotNewFigure(); + if ( action == m_shell->m_new_xaxis ) slotNewXAxis(); + if ( action == m_shell->m_new_yaxis ) slotNewYAxis(); + if ( action == m_shell->m_new_zaxis ) slotNewZAxis(); + if ( action == m_shell->m_new_vaxis ) slotNewVAxis(); + if ( action == m_shell->m_datasets ) slotDatasets(); + if ( action == m_shell->m_new_legend ) slotNewLegend(); + + if ( action == m_shell->m_bring_to_front ) slotBringToFront(); + if ( action == m_shell->m_send_to_back ) slotSendToBack(); + if ( action == m_shell->m_raise ) slotRaise(); + if ( action == m_shell->m_lower ) slotLower(); + if ( action == m_shell->m_grid ) slotGrid(); + if ( action == m_shell->m_group ) slotGroup(); + if ( action == m_shell->m_ungroup ) slotUngroup(); + + if ( action == m_shell->m_hide_sliders ) slotHideSliders(); + if ( action == m_shell->m_hide_rulers ) slotHideRulers(); + if ( action == m_shell->m_show_full_page ) slotShowFullPage(); + if ( action == m_shell->m_ioinfo ) slotIOInfo(); + + if ( action == m_shell->m_apply_button ) slotApplyButton(); + if ( action == m_shell->m_object_menu ) slotObjectMenu(); + if ( action == m_shell->m_x11_backstoring ) slotX11Backstoring(); + + if ( action == m_shell->m_zoom ) slotPageZoom(); + if ( action == m_shell->m_tool_zoom ) slotToolZoom(); + if ( action == m_shell->m_tool_arrow ) slotToolArrow(); + if ( action == m_shell->m_tool_label ) slotToolLabel(); + if ( action == m_shell->m_tool_locate ) slotToolLocate(); + if ( action == m_shell->m_tool_rect ) slotToolRect(); + if ( action == m_shell->m_tool_select ) slotToolSelect(); + + if ( action == m_shell->m_cut_dataset ) slotCutDataset(); + if ( action == m_shell->m_copy_dataset ) slotCopyDataset(); + if ( action == m_shell->m_copy_all_dataset ) slotCopyAllDataset(); + if ( action == m_shell->m_paste_dataset ) slotPasteDataset(); + if ( action == m_shell->m_delete_dataset ) slotDeleteDataset(); + if ( action == m_shell->m_raise_dataset ) slotRaiseDataset(); + if ( action == m_shell->m_lower_dataset ) slotLowerDataset(); + if ( action == m_shell->m_bring_dataset_to_front ) slotBringDatasetToFront(); + if ( action == m_shell->m_send_dataset_to_back ) slotSendDatasetToBack(); + } + +//--------------------------------------------------------------------------// + +QWidget *KSWinPageView::createObjectPanel( QWidget *parent ) + { + KSObjectTreePanel *object_panel = new KSObjectTreePanel( m_shell, m_view, parent ); + return object_panel; + } + +//--------------------------------------------------------------------------// + +QWidget *KSWinPageView::createPropertyPanel( QWidget *parent ) + { + KSPanelManager *panel_mgr = new KSPanelManager( m_shell, parent ); + panel_mgr->setView( m_view ); + panel_mgr->setEnabled( true ); + panel_mgr->setAutoSetProperties( !m_apply_button ); + panel_mgr->setOrientation( m_shell->bottomDock()->orientation() ); + connect( panel_mgr, SIGNAL(message(const QString&)), m_shell, SLOT(slotShowHelpMessage(const QString&)) ); + connect( panel_mgr, SIGNAL(dataObjectSelected(QSData*)), m_shell, SLOT(slotDataObjectSelected(QSData*)) ); + connect( panel_mgr, SIGNAL(dataObjectSelected(QSData*)), this, SLOT(slot_set_current_dataset(QSData*)) ); + connect( m_shell->bottomDock(), SIGNAL(orientationChanged(Orientation)), panel_mgr, SLOT(setOrientation(Orientation)) ); + return panel_mgr; + } + +//-----------------------------------------------------------------------------// + +void KSWinPageView::slotExportPicture() + { + KSExportPictureDlg dlg( view(), "exportpicture" ); + dlg.exec(); + } + +//-----------------------------------------------------------------------------// + +void KSWinPageView::slotDatasets() + { + KSDatasetDlg d( m_workbook, view()->activeAxes() ); + d.exec(); + } + +//-----------------------------------------------------------------------------// + +void KSWinPageView::slotIOInfo() + { + QString info; + if ( kmatplot_socket ) { + info += tr(" Application: " ) + QString::number(kmatplot_socket->appNumber()) + tr(" ( see 'ksetapp' command ) \n"); + info += tr(" Active axes: " ) + QString::number(kmatplot_socket->axesId(view()->activeAxes())) + tr(" ( see 'ksetaxes' command ) "); + info += "\n"; + info += tr(" Socket name: " ) + (const char *)kmatplot_socket->socketName(); + } else { + info += tr("Socket disabled."); + } + QMessageBox::information( this, tr("I/O Info"), info ); + } + +//-------------------------------------------------------------// + +void KSWinPageView::slotDeletePage() + { + m_workbook->execute( new KSCmdRemovePage(m_view->currentPage(),m_workbook) ); + } + +//-------------------------------------------------------------// + +void KSWinPageView::slotRenamePage() + { + if ( m_view->currentPage() ) { + bool ok_pressed = false; + QString new_title = QInputDialog::getText( tr("Enter a new page title"), QString::null, QLineEdit::Normal, m_view->currentPage()->title(), &ok_pressed, m_view ); + if ( ok_pressed ) { m_view->currentPage()->setTitle( new_title ); } + } + } + +//-------------------------------------------------------------// + +void KSWinPageView::slotPageToFront() + { + m_workbook->execute( new KSCmdPageOrder(KSCmdPageOrder::ToFront,m_view->currentPage(),m_workbook) ); + } + +//-------------------------------------------------------------// + +void KSWinPageView::slotPageToBack() + { + m_workbook->execute( new KSCmdPageOrder(KSCmdPageOrder::ToBack,m_view->currentPage(),m_workbook) ); + } + +//-------------------------------------------------------------// + +void KSWinPageView::slotRaisePage() + { + m_workbook->execute( new KSCmdPageOrder(KSCmdPageOrder::Raise,m_view->currentPage(),m_workbook) ); + } + +//-------------------------------------------------------------// + +void KSWinPageView::slotLowerPage() + { + m_workbook->execute( new KSCmdPageOrder(KSCmdPageOrder::Lower,m_view->currentPage(),m_workbook) ); + } + +//-------------------------------------------------------------// + +void KSWinPageView::slot_show_page_popup() + { + QPopupMenu *menu = new QPopupMenu( m_view ); + m_shell->m_new_page->addTo( menu ); + m_shell->m_rename_page->addTo( menu ); + m_shell->m_delete_page->addTo( menu ); + menu->insertSeparator(); + m_shell->m_raise_page->addTo( menu ); + m_shell->m_lower_page->addTo( menu ); + menu->insertSeparator(); + m_shell->m_page_to_front->addTo( menu ); + m_shell->m_page_to_back->addTo( menu ); + + menu->exec(QCursor::pos()); + delete menu; + } + +//-----------------------------------------------------------// + +void KSWinPageView::slotGroup() + { + m_workbook->execute( new KSCmdCObjectGroup( m_view->selection(), m_view->selection() ) ); + } + +//-----------------------------------------------------------// + +void KSWinPageView::slotUngroup() + { + if ( dynamic_cast<QSCGroup*>(m_view->activeObject()) ) + m_workbook->execute( new KSCmdCObjectUngroup( dynamic_cast<QSCGroup*>(m_view->activeObject()), m_view->selection() ) ); + } + + +//-----------------------------------------------------------// + +void KSWinPageView::slotBringToFront() + { + m_workbook->execute( new KSCmdObjectOrder( KSCmdObjectOrder::ToFront, m_view->selection(), m_workbook ) ); + } + +//-----------------------------------------------------------// + +void KSWinPageView::slotHideSliders() + { + bool enabled = m_shell->m_hide_sliders->isOn(); + m_view->setSlidersVisible( !enabled ); + } + +//-----------------------------------------------------------// + +void KSWinPageView::slotHideRulers() + { + bool enabled = m_shell->m_hide_rulers->isOn(); + m_view->setRulersVisible( !enabled ); + } + +//-----------------------------------------------------------// + +void KSWinPageView::slotX11Backstoring() + { + bool enabled = m_shell->m_x11_backstoring->isOn(); + m_view->setPixmapBuffering( !enabled ); + } + +//-----------------------------------------------------------// + +void KSWinPageView::slotShowFullPage() + { + bool enabled = m_shell->m_show_full_page->isOn(); + m_view->setFullPage( enabled ); + } + +//-----------------------------------------------------------// + +void KSWinPageView::slotApplyButton() + { + bool enabled = m_shell->m_apply_button->isOn(); + KSPanelManager *panel_mgr = dynamic_cast<KSPanelManager*>(m_shell->propertyContainer()->widget()); + m_apply_button = enabled; + if ( panel_mgr ) panel_mgr->setAutoSetProperties( !m_apply_button ); + } + +//-----------------------------------------------------------// + +void KSWinPageView::slotNewAxes2D() + { + QSAxes *new_axes = new QSAxes2D(); + bool ok = m_workbook->execute( new KSCmdAddCObject( new_axes->shadowObject(), m_view->currentPage()->objects() ) ); + if ( ok ) m_view->selection()->set( new_axes->shadowObject() ); + } + +//-----------------------------------------------------------// + +void KSWinPageView::slotNewAxes3D() + { + QSAxes *new_axes = new QSAxes3D(); + bool ok = m_workbook->execute( new KSCmdAddCObject( new_axes->shadowObject(), m_view->currentPage()->objects() ) ); + if ( ok ) m_view->selection()->set( new_axes->shadowObject() ); + } + +//-----------------------------------------------------------// + +bool KSWinPageView::check_axes() + { + if ( !m_view->activeAxes() ) { + QMessageBox::warning ( NULL, tr("Error"), tr("No axes selected"), QMessageBox::Ok, 0, 0 ); + return false; + } + return true; + } + + +//-----------------------------------------------------------// + +void KSWinPageView::slotNewCurve() + { + if ( check_axes() ) { + m_workbook->execute( new KSCmdAddDataset(new QSCurve(m_view->activeAxes())) ); + KSPanelManager *panel_mgr = dynamic_cast<KSPanelManager*>(m_shell->propertyContainer()->widget()); + if ( panel_mgr ) panel_mgr->selectPanel( QSAxes::DatasetCategory, m_view->activeAxes()->plotCount()-1 ); + } + } + +//-----------------------------------------------------------// + +void KSWinPageView::slotNewImage() + { + if ( check_axes() ) { + m_workbook->execute( new KSCmdAddDataset(new QSImage(m_view->activeAxes())) ); + KSPanelManager *panel_mgr = dynamic_cast<KSPanelManager*>(m_shell->propertyContainer()->widget()); + if ( panel_mgr ) panel_mgr->selectPanel( QSAxes::DatasetCategory, m_view->activeAxes()->plotCount()-1 ); + } + } + +//-----------------------------------------------------------// + +void KSWinPageView::slotNewContour() + { + if ( check_axes() ) { + m_workbook->execute( new KSCmdAddDataset(new QSGriddedContour(m_view->activeAxes())) ); + KSPanelManager *panel_mgr = dynamic_cast<KSPanelManager*>(m_shell->propertyContainer()->widget()); + if ( panel_mgr ) panel_mgr->selectPanel( QSAxes::DatasetCategory, m_view->activeAxes()->plotCount()-1 ); + } + } + +//-----------------------------------------------------------// + +void KSWinPageView::slotNewNGContour() + { + if ( check_axes() ) { + m_workbook->execute( new KSCmdAddDataset(new QSNonGriddedContour(m_view->activeAxes())) ); + KSPanelManager *panel_mgr = dynamic_cast<KSPanelManager*>(m_shell->propertyContainer()->widget()); + if ( panel_mgr ) panel_mgr->selectPanel( QSAxes::DatasetCategory, m_view->activeAxes()->plotCount()-1 ); + } + } + +//-----------------------------------------------------------// + +void KSWinPageView::slotNewSurface() +{ + if ( check_axes() ) { + m_workbook->execute( new KSCmdAddDataset(new QSSurface(m_view->activeAxes())) ); + KSPanelManager *panel_mgr = dynamic_cast<KSPanelManager*>(m_shell->propertyContainer()->widget()); + if ( panel_mgr ) panel_mgr->selectPanel( QSAxes::DatasetCategory, m_view->activeAxes()->plotCount()-1 ); + } +} + +//-----------------------------------------------------------// + +void KSWinPageView::slotNewFigure() + { + if ( check_axes() ) { + m_workbook->execute( new KSCmdAddDataset(new QSFigure(m_view->activeAxes())) ); + KSPanelManager *panel_mgr = dynamic_cast<KSPanelManager*>(m_shell->propertyContainer()->widget()); + if ( panel_mgr ) panel_mgr->selectPanel( QSAxes::DatasetCategory, m_view->activeAxes()->plotCount()-1 ); + } + } + +//-----------------------------------------------------------// + +void KSWinPageView::slotNewXAxis() + { + if ( check_axes() ) { + m_workbook->execute( new KSCmdAddAxis( new QSAxis(QSAxis::XAxisType,m_view->activeAxes()) ) ); + KSPanelManager *panel_mgr = dynamic_cast<KSPanelManager*>(m_shell->propertyContainer()->widget()); + if ( panel_mgr ) panel_mgr->selectPanel( QSAxes::AxisCategory, m_view->activeAxes()->axisCount()-1 ); + } + } + +//-----------------------------------------------------------// + +void KSWinPageView::slotNewYAxis() + { + if ( check_axes() ) { + m_workbook->execute( new KSCmdAddAxis( new QSAxis(QSAxis::YAxisType,m_view->activeAxes()) ) ); + KSPanelManager *panel_mgr = dynamic_cast<KSPanelManager*>(m_shell->propertyContainer()->widget()); + if ( panel_mgr ) panel_mgr->selectPanel( QSAxes::AxisCategory, m_view->activeAxes()->axisCount()-1 ); + } + } + +//-----------------------------------------------------------// + +void KSWinPageView::slotNewZAxis() + { + if ( check_axes() ) { + m_workbook->execute( new KSCmdAddAxis( new QSAxis(QSAxis::ZAxisType,m_view->activeAxes()) ) ); + KSPanelManager *panel_mgr = dynamic_cast<KSPanelManager*>(m_shell->propertyContainer()->widget()); + if ( panel_mgr ) panel_mgr->selectPanel( QSAxes::AxisCategory, m_view->activeAxes()->axisCount()-1 ); + } + } + +//-----------------------------------------------------------// + +void KSWinPageView::slotNewVAxis() + { + if ( check_axes() ) { + m_workbook->execute( new KSCmdAddAxis( new QSAxis(QSAxis::VAxisType,m_view->activeAxes()) ) ); + KSPanelManager *panel_mgr = dynamic_cast<KSPanelManager*>(m_shell->propertyContainer()->widget()); + if ( panel_mgr ) panel_mgr->selectPanel( QSAxes::AxisCategory, m_view->activeAxes()->axisCount()-1 ); + } + } + +//-----------------------------------------------------------// + +void KSWinPageView::slotNewLegend() + { + if ( check_axes() ) { + m_workbook->execute( new KSCmdAddCObject(new QSCLegend(m_view->activeAxes()),m_view->activeCollection()) ); + } + } + +//-----------------------------------------------------------// + +void KSWinPageView::slotGrid() + { + KSGridDlg d( m_view, this ); + d.exec(); + } + +//-------------------------------------------------------------// + +void KSWinPageView::slotObjectMenu() + { + QPopupMenu *menu = new QPopupMenu( m_view ); + m_shell->m_cut->addTo( menu ); + m_shell->m_copy->addTo( menu ); + m_shell->m_copy_all->addTo( menu ); + m_shell->m_paste->addTo( menu ); + m_shell->m_delete->addTo( menu ); + menu->insertSeparator(); + + QPopupMenu *popup_insert = new QPopupMenu( menu ); + menu->insertItem( tr("Insert"), popup_insert ); + + m_shell->m_new_curve->addTo( popup_insert ); + m_shell->m_new_image->addTo( popup_insert ); + m_shell->m_new_contour->addTo( popup_insert ); + m_shell->m_new_ngcontour->addTo( popup_insert ); + m_shell->m_new_surface->addTo( popup_insert ); + m_shell->m_new_figure->addTo( popup_insert ); + + popup_insert->insertSeparator(); + + m_shell->m_new_xaxis->addTo( popup_insert ); + m_shell->m_new_yaxis->addTo( popup_insert ); + m_shell->m_new_zaxis->addTo( popup_insert ); + m_shell->m_new_vaxis->addTo( popup_insert ); + + menu->insertSeparator(); + + m_shell->m_bring_to_front->addTo( menu ); + m_shell->m_send_to_back->addTo( menu ); + menu->insertSeparator(); + m_shell->m_raise->addTo( menu ); + m_shell->m_lower->addTo( menu ); + + menu->exec(QCursor::pos()); + } + +//-----------------------------------------------------------// + +void KSWinPageView::slotSendToBack() + { + m_workbook->execute( new KSCmdObjectOrder( KSCmdObjectOrder::ToBack, m_view->selection(), m_workbook ) ); + } + +//-----------------------------------------------------------// + +void KSWinPageView::slotRaise() + { + m_workbook->execute( new KSCmdObjectOrder( KSCmdObjectOrder::Raise, m_view->selection(), m_workbook ) ); + } + +//-----------------------------------------------------------// + +void KSWinPageView::slotLower() + { + m_workbook->execute( new KSCmdObjectOrder( KSCmdObjectOrder::Lower, m_view->selection(), m_workbook ) ); + } + +//-----------------------------------------------------------// + +void KSWinPageView::slotPageZoom() + { + if ( m_shell->m_zoom_50->isOn() ) m_view->setZoom( 0.50 ); + if ( m_shell->m_zoom_75->isOn() ) m_view->setZoom( 0.75 ); + if ( m_shell->m_zoom_100->isOn() ) m_view->setZoom( 1.00 ); + if ( m_shell->m_zoom_150->isOn() ) m_view->setZoom( 1.50 ); + if ( m_shell->m_zoom_200->isOn() ) m_view->setZoom( 2.00 ); + } + + //-----------------------------------------------------------// + +void KSWinPageView::slotToolZoom() + { + bool on = m_shell->m_tool_zoom->isOn(); + if ( on ) m_view->setTool( new QSToolZoom() ); + else m_view->setTool( NULL ); + } + +//-----------------------------------------------------------// + +void KSWinPageView::slotToolSelect() + { + bool on = m_shell->m_tool_select->isOn(); + if ( on ) m_view->setTool( new QSToolSelect(m_shell) ); + else m_view->setTool( NULL ); + } + +//-----------------------------------------------------------// + +void KSWinPageView::slotToolLabel() + { + bool on = m_shell->m_tool_label->isOn(); + if ( on ) m_view->setTool( new QSToolLabel() ); + else m_view->setTool( NULL ); + } + +//-----------------------------------------------------------// + +void KSWinPageView::slotToolArrow() + { + bool on = m_shell->m_tool_arrow->isOn(); + if ( on ) m_view->setTool( new QSToolArrow() ); + else m_view->setTool( NULL ); + } + +//-----------------------------------------------------------// + +void KSWinPageView::slotToolRect() + { + bool on = m_shell->m_tool_rect->isOn(); + if ( on ) m_view->setTool( new QSToolRect() ); + else m_view->setTool( NULL ); + } + +//-----------------------------------------------------------// + +void KSWinPageView::slotToolLocate() + { + bool on = m_shell->m_tool_locate->isOn(); + if ( on ) m_view->setTool( new QSToolLocate() ); + else m_view->setTool( NULL ); + } + +//-----------------------------------------------------------// + +void KSWinPageView::slot_page_title_changed( const QString& newTitle ) + { + setTitle( newTitle ); + } + +//-----------------------------------------------------------// + +void KSWinPageView::slotCutDataset() + { + KSObjectFactory factory( m_workbook ); + QSPlot *plot = dynamic_cast<QSPlot*>(m_curr_dataset); + QSAxis *axis = dynamic_cast<QSAxis*>(m_curr_dataset); + if ( plot ) { + factory.copyQSPlotToClipboard( plot ); + m_workbook->execute( new KSCmdRemoveDataset(plot) ); + } + if ( axis ) { + factory.copyQSAxisToClipboard( axis ); + m_workbook->execute( new KSCmdRemoveAxis(axis) ); + } + } + +//-----------------------------------------------------------// + +void KSWinPageView::slotCopyDataset() + { + KSObjectFactory factory( m_workbook ); + QSPlot *plot = dynamic_cast<QSPlot*>(m_curr_dataset); + QSAxis *axis = dynamic_cast<QSAxis*>(m_curr_dataset); + if ( plot ) { + factory.copyQSPlotToClipboard( plot ); + } + if ( axis ) { + factory.copyQSAxisToClipboard( axis ); + } + } + +//-----------------------------------------------------------// + +void KSWinPageView::slotCopyAllDataset() + { + KSObjectFactory factory( m_workbook ); + factory.setFlags( KSObjectFactory::CopyAllData ); + QSPlot *plot = dynamic_cast<QSPlot*>(m_curr_dataset); + QSAxis *axis = dynamic_cast<QSAxis*>(m_curr_dataset); + if ( plot ) { + factory.copyQSPlotToClipboard( plot ); + } + if ( axis ) { + factory.copyQSAxisToClipboard( axis ); + } + } + +//-----------------------------------------------------------// + +void KSWinPageView::slotPasteDataset() + { + if ( m_view->activeAxes() ) { + KSObjectFactory factory( m_workbook ); + QSPlot *new_plot = factory.pasteQSPlotFromClipboard( m_view->activeAxes() ); + if ( new_plot ) m_workbook->execute( new KSCmdAddDataset( new_plot ) ); + QSAxis *new_axis = factory.pasteQSAxisFromClipboard( m_view->activeAxes() ); + if ( new_axis ) m_workbook->execute( new KSCmdAddAxis( new_axis ) ); + } + } + +//-----------------------------------------------------------// + +void KSWinPageView::slotDeleteDataset() + { + QSPlot *plot = dynamic_cast<QSPlot*>(m_curr_dataset); + QSAxis *axis = dynamic_cast<QSAxis*>(m_curr_dataset); + if ( plot ) { + m_workbook->execute( new KSCmdRemoveDataset(plot) ); + } + if ( axis ) { + m_workbook->execute( new KSCmdRemoveAxis(axis) ); + } + } + +//-----------------------------------------------------------// + +void KSWinPageView::slotBringDatasetToFront() + { + if ( m_curr_dataset ) { + QSPlot *plot = dynamic_cast<QSPlot*>(m_curr_dataset); + QSAxis *axis = dynamic_cast<QSAxis*>(m_curr_dataset); + if ( plot ) m_workbook->execute( new KSCmdDatasetOrder( KSCmdDatasetOrder::ToFront,plot) ); + if ( axis ) m_workbook->execute( new KSCmdAxisOrder( KSCmdAxisOrder::ToFront,axis) ); + } + } + +//-----------------------------------------------------------// + +void KSWinPageView::slotSendDatasetToBack() + { + if ( m_curr_dataset ) { + QSPlot *plot = dynamic_cast<QSPlot*>(m_curr_dataset); + QSAxis *axis = dynamic_cast<QSAxis*>(m_curr_dataset); + if ( plot ) m_workbook->execute( new KSCmdDatasetOrder( KSCmdDatasetOrder::ToBack,plot) ); + if ( axis ) m_workbook->execute( new KSCmdAxisOrder( KSCmdAxisOrder::ToBack,axis) ); + } + } + +//-----------------------------------------------------------// + +void KSWinPageView::slotRaiseDataset() + { + if ( m_curr_dataset ) { + QSPlot *plot = dynamic_cast<QSPlot*>(m_curr_dataset); + QSAxis *axis = dynamic_cast<QSAxis*>(m_curr_dataset); + if ( plot ) m_workbook->execute( new KSCmdDatasetOrder( KSCmdDatasetOrder::Raise,plot) ); + if ( axis ) m_workbook->execute( new KSCmdAxisOrder( KSCmdAxisOrder::Raise,axis) ); + } + } + +//-----------------------------------------------------------// + +void KSWinPageView::slotLowerDataset() + { + if ( m_curr_dataset ) { + QSPlot *plot = dynamic_cast<QSPlot*>(m_curr_dataset); + QSAxis *axis = dynamic_cast<QSAxis*>(m_curr_dataset); + if ( plot ) m_workbook->execute( new KSCmdDatasetOrder( KSCmdDatasetOrder::Lower,plot) ); + if ( axis ) m_workbook->execute( new KSCmdAxisOrder( KSCmdAxisOrder::Lower,axis) ); + } + } + +//-----------------------------------------------------------// + +void KSWinPageView::slot_set_current_dataset( QSData *dataset ) + { + m_curr_dataset = dataset; + if ( m_curr_dataset ) { + m_shell->m_cut_dataset->setEnabled( TRUE ); + m_shell->m_copy_dataset->setEnabled( TRUE ); + m_shell->m_copy_all_dataset->setEnabled( TRUE ); + m_shell->m_delete_dataset->setEnabled( TRUE ); + m_shell->m_raise_dataset->setEnabled( TRUE ); + m_shell->m_lower_dataset->setEnabled( TRUE ); + m_shell->m_bring_dataset_to_front->setEnabled( TRUE ); + m_shell->m_send_dataset_to_back->setEnabled( TRUE ); + } else { + m_shell->m_cut_dataset->setEnabled( FALSE ); + m_shell->m_copy_dataset->setEnabled( FALSE ); + m_shell->m_copy_all_dataset->setEnabled( FALSE ); + m_shell->m_delete_dataset->setEnabled( FALSE ); + m_shell->m_raise_dataset->setEnabled( FALSE ); + m_shell->m_lower_dataset->setEnabled( FALSE ); + m_shell->m_bring_dataset_to_front->setEnabled( FALSE ); + m_shell->m_send_dataset_to_back->setEnabled( FALSE ); + } + } + +//-----------------------------------------------------------// + +void KSWinPageView::slotWizard() + { + KSGraphWizard dlg( m_view, m_workbook, this ); + dlg.exec(); + } \ No newline at end of file diff --git a/kmatplot/kswinpageview.h b/kmatplot/kswinpageview.h new file mode 100644 index 0000000..ccdf040 --- /dev/null +++ b/kmatplot/kswinpageview.h @@ -0,0 +1,137 @@ +/*************************************************************************** + kswinpageview.h + ------------------- + begin : Thu Jan 17 2002 + copyright : (C) 2002 by kamil + email : kamil@localhost.localdomain + ***************************************************************************/ + +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + +#ifndef KSWINPAGEVIEW_H +#define KSWINPAGEVIEW_H + +#include <qwidget.h> +#include "ksworkspace.h" + +class KSWorkbook; +class KSCmdSetRanges; +class KSCmdSetProperties; +class KMatplotShell; +class QSPlotView; +class QSData; + +/** + *@author kamil + */ +class KSWinPageView : public KSWorkspaceWindow { + Q_OBJECT + public: + KSWinPageView( KSWorkspace *workspace ); + virtual ~KSWinPageView(); + QSPlotView *view() const; + virtual void cut(); + virtual void copy(); + virtual void copyAll(); + virtual void paste(); + virtual void del(); + virtual void activated(); + virtual void deactivated(); + virtual void doAction( QAction* /*action*/ ); + virtual QWidget *createObjectPanel( QWidget *parent ); + virtual QWidget *createPropertyPanel( QWidget *parent ); + protected: + QSPlotView *m_view; + KSWorkbook *m_workbook; + KMatplotShell *m_shell; + QSData *m_curr_dataset; + KSCmdSetRanges *m_curr_ranges_cmd; + KSCmdSetProperties *m_curr_properties_cmd; + bool m_apply_button; + bool check_axes(); + void update_actions(); + + protected slots: + void slot_show_page_popup(); + void slot_curr_page_changed(); + void slot_view_slider_pressed(); + void slot_view_slider_released(); + void slot_view_scrollbar_pressed(); + void slot_view_scrollbar_released(); + void slot_selection_changed(); + void slot_selected_object_changed(); + void slot_active_axes_changed(); + + void slotDeletePage(); + void slotRenamePage(); + void slotPageToFront(); + void slotPageToBack(); + void slotRaisePage(); + void slotLowerPage(); + void slotExportPicture(); + + void slotWizard(); + void slotNewAxes2D(); + void slotNewAxes3D(); + void slotNewCurve(); + void slotNewImage(); + void slotNewContour(); + void slotNewNGContour(); + void slotNewSurface(); + void slotNewFigure(); + void slotNewXAxis(); + void slotNewYAxis(); + void slotNewZAxis(); + void slotNewVAxis(); + void slotDatasets(); + void slotNewLegend(); + + void slotBringToFront(); + void slotSendToBack(); + void slotRaise(); + void slotLower(); + void slotGrid(); + void slotGroup(); + void slotUngroup(); + + void slotHideSliders(); + void slotHideRulers(); + void slotShowFullPage(); + + void slotIOInfo(); + + void slotPageZoom(); + void slotToolArrow(); + void slotToolLabel(); + void slotToolLocate(); + void slotToolRect(); + void slotToolSelect(); + + void slotToolZoom(); + + void slotApplyButton(); + void slotObjectMenu(); + void slotX11Backstoring(); + + void slotCutDataset(); + void slotCopyDataset(); + void slotCopyAllDataset(); + void slotPasteDataset(); + void slotDeleteDataset(); + void slotRaiseDataset(); + void slotLowerDataset(); + void slotBringDatasetToFront(); + void slotSendDatasetToBack(); + + void slot_page_title_changed( const QString& newTitle ); + void slot_set_current_dataset( QSData *dataset ); +}; + +#endif diff --git a/kmatplot/kswinworksheet.cpp b/kmatplot/kswinworksheet.cpp new file mode 100644 index 0000000..148fdbc --- /dev/null +++ b/kmatplot/kswinworksheet.cpp @@ -0,0 +1,684 @@ +/*************************************************************************** + kswinworksheet.cpp + ------------------- + begin : Thu Jan 17 2002 + copyright : (C) 2002 by kamil + email : kamil@localhost.localdomain + ***************************************************************************/ + +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + +#include "kswinworksheet.h" +#include "kmatplotshell.h" +#include "kscommands.h" +#include "ksdataobjectfactory.h" +#include "ksglobalmatrixlist.h" +#include "ksobjectfactory.h" +#include "ksmatrixeditor.h" +#include "dialogs/ksimportdlg.h" +#include "dialogs/ksexportdlg.h" +#include "dialogs/ksmpanels.h" +#include "dialogs/kschannellist.h" +#include "widgets/qsdata.h" +#include "pixmaps/action_gray.xpm" +#include "pixmaps/action_green.xpm" +#include <qpixmap.h> +#include <qaction.h> +#include <qfiledialog.h> +#include <qinputdialog.h> +#include <qpopupmenu.h> + +//--------------------------------------------------------------------------// + +KSWinWorksheet::KSWinWorksheet( KSWorkspace *workspace, bool worksheet_mode ) + : KSWorkspaceWindow( workspace, tr("Worksheet"), QPixmap(action_green) ) + { + m_shell = workspace->shell(); + m_workbook = m_shell->workbook(); + m_editor = NULL; + m_data = NULL; + m_curr_data = NULL; + m_curr_channel = -1; + m_removed_data = NULL; + m_worksheet_mode = worksheet_mode; + slot_name_changed( m_curr_data, "" ); + } + +//--------------------------------------------------------------------------// + +KSWinWorksheet::~KSWinWorksheet() + { + } + +//--------------------------------------------------------------------------// + +void KSWinWorksheet::setDataObject( QSData *data ) + { + if ( m_data ) { + disconnect( m_data, SIGNAL(sigDataChanged(QSData*,int)), this, SLOT(slot_data_changed(QSData*,int)) ); + disconnect( m_data, SIGNAL(sigChildRemoved(QSData*)), this, SLOT(slot_child_removed(QSData*)) ); + disconnect( m_data, SIGNAL(sigDeleted(QSData*)), this, SLOT(slot_deleted(QSData*)) ); + disconnect( m_data, SIGNAL(sigNameChanged(QSData*,const char *)), this, SLOT(slot_name_changed(QSData*,const char*)) ); + } + if ( m_data && m_data->parentObject() ) { + disconnect( m_data->parentObject(), SIGNAL(sigChildRemoved(QSData*)), this, SLOT(slot_removed(QSData*)) ); + } + set_selected( NULL, -1 ); + m_data = data; + if ( m_data ) { + connect( m_data, SIGNAL(sigDataChanged(QSData*,int)), this, SLOT(slot_data_changed(QSData*,int)) ); + connect( m_data, SIGNAL(sigChildRemoved(QSData*)), this, SLOT(slot_child_removed(QSData*)) ); + connect( m_data, SIGNAL(sigDeleted(QSData*)), this, SLOT(slot_deleted(QSData*)) ); + connect( m_data, SIGNAL(sigNameChanged(QSData*,const char *)), this, SLOT(slot_name_changed(QSData*,const char*)) ); + } + if ( m_data && m_data->parentObject() ) { + connect( m_data->parentObject(), SIGNAL(sigChildRemoved(QSData*)), this, SLOT(slot_removed(QSData*)) ); + } + } + +//--------------------------------------------------------------------------// + +KSChannelList *KSWinWorksheet::chanList() const + { + return dynamic_cast<KSChannelList*>(m_shell->objectContainer()->widget()); + } + +//--------------------------------------------------------------------------// + +KSChannelListItem *KSWinWorksheet::selectedItem() const + { + return chanList() ? chanList()->selected() : NULL; + } + +//--------------------------------------------------------------------------// + +KSMPanel *KSWinWorksheet::settingsPanel() const + { + return dynamic_cast<KSMPanel*>(m_shell->propertyContainer()->widget()); + } + +//--------------------------------------------------------------------------// + +KSMatrixEditorInterf *KSWinWorksheet::matrixEditor() const + { + return dynamic_cast<KSMatrixEditorInterf*>(contents()); + } + +//--------------------------------------------------------------------------// + +void KSWinWorksheet::activated() + { + m_shell->disableCustomActions(); + m_shell->m_new_sheet->setEnabled( TRUE ); + m_shell->m_paste->setEnabled( TRUE ); + // disable/enable actions + set_selected( m_curr_data, m_curr_channel ); + } + +//--------------------------------------------------------------------------// + +void KSWinWorksheet::deactivated() + { + } + +//--------------------------------------------------------------------------// + +QWidget *KSWinWorksheet::createObjectPanel( QWidget *parent ) + { + KSChannelList *chan_list = new KSChannelList( parent ); + chan_list->addColumn( m_worksheet_mode ? tr("Sheets") : tr("Channels"), 85 ); + chan_list->addColumn( tr(""), 55 ); + chan_list->addColumn( tr(""), 50 ); + if ( m_worksheet_mode ) chan_list->setDataObject( m_data, false, 0, false ); + else chan_list->setDataObject( m_data, true, -1, true ); + if ( m_worksheet_mode ) m_shell->m_paste_sheet->setEnabled( TRUE ); + else m_shell->m_paste_sheet->setEnabled( FALSE ); + chan_list->select( m_curr_data, m_curr_channel ); + connect( chan_list, SIGNAL(selectionChanged()), this, SLOT(slot_channel_selected()) ); + connect( chan_list, SIGNAL(sigShowText(const QString&)), m_shell, SLOT(slotShowHelpMessage(const QString&)) ); + connect( chan_list, SIGNAL(rightButtonPressed(QListViewItem*,const QPoint&,int)), this, SLOT(slotShowMenu(QListViewItem*,const QPoint&,int)) ); + return chan_list; + } + + //--------------------------------------------------------------------------// + +QWidget *KSWinWorksheet::createPropertyPanel( QWidget *parent ) + { + return create_settings_panel(); + } + +//--------------------------------------------------------------------// + +void KSWinWorksheet::make_settings_panel() + { + m_shell->propertyContainer()->setWidget( create_settings_panel() ); + } + +//--------------------------------------------------------------------// + +KSMPanel *KSWinWorksheet::create_settings_panel() + { + KSMPanel *panel = NULL; + if ( m_curr_data && m_curr_channel >= 0 ) { + QSMatrix *matrix = m_curr_data->matrix(m_curr_channel); + if ( matrix ) { + panel = KSDataObjectFactory::createCfgPanel( matrix, m_workbook, m_shell->propertyContainer() ); + } + if ( panel ) { + panel->setOrientation( m_shell->bottomDock()->orientation() ); + connect( m_shell->bottomDock(), SIGNAL(orientationChanged(Orientation)), panel, SLOT(setOrientation(Orientation)) ); + } + } + return panel; + } + +//--------------------------------------------------------------------// + +void KSWinWorksheet::make_editor() + { + // preserve position + QPoint pos; if ( m_editor ) pos = m_editor->editorContentsPos(); + + setContents( NULL ); m_editor = NULL; + if ( m_curr_data && m_curr_channel >= 0 ) { + m_editor = KSDataObjectFactory::createEditor( m_workbook, m_curr_data, m_curr_channel, this ); + if ( m_editor ) { + m_editor->updateContents(); + m_editor->setColumnTitles( KSDataObjectFactory::channelColumnTitlesFactory(m_curr_data,m_curr_channel) ); + } + } + setContents( m_editor ? m_editor->widget() : NULL ); + + // preserve position + if ( m_editor ) m_editor->setEditorContentsPos( pos ); + } + +//--------------------------------------------------------------------------// + +void KSWinWorksheet::set_selected( QSData *dataObject, int channel ) + { + if ( m_curr_data != dataObject || m_curr_channel != channel ) { + m_curr_data = dataObject; + m_curr_channel = channel; + if ( chanList() ) chanList()->select( m_curr_data, m_curr_channel ); + if ( m_curr_data ) slot_name_changed( m_curr_data, m_curr_data->objectName() ); + else slot_name_changed( m_curr_data, "" ); + make_settings_panel(); + make_editor(); + } + + if ( m_data ) { + m_shell->m_export_octave->setEnabled( TRUE ); + } else { + m_shell->m_export_octave->setEnabled( FALSE ); + } + + if ( m_curr_data && m_curr_channel >= 0 ) { + m_shell->m_import_octave->setEnabled( TRUE ); + m_shell->m_cut->setEnabled( TRUE ); + m_shell->m_copy->setEnabled( TRUE ); + m_shell->m_copy_all->setEnabled( TRUE ); + m_shell->m_delete->setEnabled( TRUE ); + m_shell->m_new_matrix->setEnabled( TRUE ); + m_shell->m_new_string->setEnabled( TRUE ); + m_shell->m_new_formula->setEnabled( TRUE ); + m_shell->m_new_reference->setEnabled( TRUE ); + m_shell->m_detach->setEnabled( TRUE ); + m_shell->m_transpose->setEnabled( TRUE ); + } else { + m_shell->m_cut->setEnabled( FALSE ); + m_shell->m_copy->setEnabled( FALSE ); + m_shell->m_copy_all->setEnabled( FALSE ); + m_shell->m_delete->setEnabled( FALSE ); + m_shell->m_new_matrix->setEnabled( FALSE ); + m_shell->m_new_string->setEnabled( FALSE ); + m_shell->m_new_formula->setEnabled( FALSE ); + m_shell->m_new_reference->setEnabled( FALSE ); + m_shell->m_detach->setEnabled( FALSE ); + m_shell->m_transpose->setEnabled( FALSE ); + m_shell->m_import_octave->setEnabled( FALSE ); + } + + if ( dynamic_cast<KSSheet*>(m_curr_data) ) { + m_shell->m_rename_sheet->setEnabled( TRUE ); + m_shell->m_raise->setEnabled( TRUE ); + m_shell->m_lower->setEnabled( TRUE ); + m_shell->m_bring_to_front->setEnabled( TRUE ); + m_shell->m_send_to_back->setEnabled( TRUE ); + m_shell->m_cut_sheet->setEnabled( TRUE ); + m_shell->m_copy_sheet->setEnabled( TRUE ); + m_shell->m_copy_all_sheet->setEnabled( TRUE ); + m_shell->m_delete_sheet->setEnabled( TRUE ); + } else { + m_shell->m_rename_sheet->setEnabled( FALSE ); + m_shell->m_raise->setEnabled( FALSE ); + m_shell->m_lower->setEnabled( FALSE ); + m_shell->m_bring_to_front->setEnabled( FALSE ); + m_shell->m_send_to_back->setEnabled( FALSE ); + m_shell->m_cut_sheet->setEnabled( FALSE ); + m_shell->m_copy_sheet->setEnabled( FALSE ); + m_shell->m_copy_all_sheet->setEnabled( FALSE ); + m_shell->m_delete_sheet->setEnabled( FALSE ); + } + + } + +//-----------------------------------------------------------// + +void KSWinWorksheet::slot_channel_selected() + { + KSChannelListItem *citem = selectedItem(); + if ( citem && citem->isValid() ) set_selected( citem->dataObject(), citem->channel() ); + else set_selected( NULL, -1 ); + } + +//--------------------------------------------------------------------// + +void KSWinWorksheet::slot_data_changed( QSData *dataObject, int channel ) +// data was changed + { + if ( m_curr_data == dataObject && ( m_curr_channel == channel || channel == -1 ) ) { + // recreate settings panel if some bigger changes, update contents otherwise + if ( !settingsPanel() || settingsPanel()->editedMatrix() != dataObject->matrix(channel) ) + make_settings_panel(); + else settingsPanel()->updateContents(); + + // recreate editor if some bigger changes, update contents otherwise + if ( !matrixEditor() || matrixEditor()->editedMatrix() != dataObject->matrix(channel) ) + make_editor(); + else matrixEditor()->updateContents(); + } + } + +//--------------------------------------------------------------------------// + +void KSWinWorksheet::slot_child_removed( QSData *dataObject ) + { + if ( dataObject == m_curr_data ) set_selected( NULL, -1 ); + } + +//--------------------------------------------------------------------------// + +void KSWinWorksheet::slot_removed( QSData *dataObject ) +// probably user removed our data object from canvas and moved to the undo buffer + { + if ( dataObject == m_data ) { + m_removed_data = m_data; + setDataObject( NULL ); + + if ( m_removed_data ) + connect( m_removed_data, SIGNAL(sigDeleted(QSData*)), this, SLOT(slot_deleted(QSData*)) ); + + if ( m_removed_data && m_removed_data->parentObject() ) + connect( m_removed_data->parentObject(), SIGNAL(sigChildAdded(QSData*)), this, SLOT(slot_added(QSData*)) ); + } + } + +//--------------------------------------------------------------------------// + +void KSWinWorksheet::slot_added( QSData *dataObject ) +// probably user called 'undo' and put aoutr object on the canvas again + { + if ( dataObject == m_removed_data ) { + if ( m_removed_data ) + disconnect( m_removed_data, SIGNAL(sigDeleted(QSData*)), this, SLOT(slot_deleted(QSData*)) ); + + if ( m_removed_data && m_removed_data->parentObject() ) + disconnect( m_removed_data->parentObject(), SIGNAL(sigChildAdded(QSData*)), this, SLOT(slot_added(QSData*)) ); + + setDataObject( m_removed_data ); + m_removed_data = NULL; + } + } + +//--------------------------------------------------------------------------// + +void KSWinWorksheet::slot_deleted( QSData * ) + { + setDataObject( NULL ); + m_removed_data = NULL; + // opss ! + delete this; + } + +//--------------------------------------------------------------------------// + +void KSWinWorksheet::slot_name_changed( QSData *object, const char *name ) + { + if ( object == m_curr_data ) + setTitle( m_worksheet_mode ? (tr("Worksheet:")+QString(name)) : (tr("Dataset: ")+QString(name)) ); + } + +//--------------------------------------------------------------------------// + +void KSWinWorksheet::doAction( QAction* action ) + { + if ( !isActive() ) return; + if ( action == m_shell->m_rename_sheet ) slotRenameSheet(); + if ( action == m_shell->m_raise ) slotRaiseSheet(); + if ( action == m_shell->m_lower ) slotLowerSheet(); + if ( action == m_shell->m_bring_to_front ) slotBringToFrontSheet(); + if ( action == m_shell->m_send_to_back ) slotSendToBackSheet(); + if ( action == m_shell->m_new_sheet ) slotNewSheet(); + if ( action == m_shell->m_import_octave ) slotImportOctave(); + if ( action == m_shell->m_export_octave ) slotExportOctave(); + if ( action == m_shell->m_new_formula ) slotNewFormula(); + if ( action == m_shell->m_new_reference ) slotNewReference(); + if ( action == m_shell->m_new_string ) slotNewString(); + if ( action == m_shell->m_new_matrix ) slotNewMatrix(); + if ( action == m_shell->m_transpose ) slotTranspose(); + if ( action == m_shell->m_detach ) slotDetach(); + if ( action == m_shell->m_cut_sheet ) slotCutSheet(); + if ( action == m_shell->m_copy_sheet ) slotCopySheet(); + if ( action == m_shell->m_copy_all_sheet ) slotCopyAllSheet(); + if ( action == m_shell->m_paste_sheet ) slotPasteSheet(); + if ( action == m_shell->m_delete_sheet ) slotDeleteSheet(); + } + +//--------------------------------------------------------------------------// + +void KSWinWorksheet::cut() + { + KSChannelListItem *item = selectedItem(); + if ( item && item->isValid() && item->dataObject()->matrix(item->channel()) ) { + KSObjectFactory factory( m_workbook ); + factory.copyQSMatrixToClipboard( item->dataObject()->matrix(item->channel()) ); + m_workbook->execute( new KSCmdSetData(item->dataObject(),item->channel(),NULL) ); + } + } + +//--------------------------------------------------------------------------// + +void KSWinWorksheet::copy() + { + KSChannelListItem *item = selectedItem(); + if ( item && item->isValid() && item->dataObject()->matrix(item->channel()) ) { + KSObjectFactory factory( m_workbook ); + factory.copyQSMatrixToClipboard( item->dataObject()->matrix(item->channel()) ); + } + } + +//--------------------------------------------------------------------------// + +void KSWinWorksheet::copyAll() + { + KSChannelListItem *item = selectedItem(); + if ( item && item->isValid() && item->dataObject()->matrix(item->channel()) ) { + KSObjectFactory factory( m_workbook ); + factory.setFlags( QSObjectFactory::CopyAllData ); + factory.copyQSMatrixToClipboard( item->dataObject()->matrix(item->channel()) ); + } + } + +//--------------------------------------------------------------------------// + +void KSWinWorksheet::paste() + { + KSChannelListItem *item = selectedItem(); + if ( item && item->isValid() ) { + KSObjectFactory factory( m_workbook ); + QSMatrix *new_matrix = factory.pasteQSMatrixFromClipboard(); + if ( new_matrix ) { + m_workbook->execute( new KSCmdSetData(item->dataObject(),item->channel(),new_matrix) ); + } + } + } + +//--------------------------------------------------------------------------// + +void KSWinWorksheet::del() + { + KSChannelListItem *citem = selectedItem(); + if ( citem && citem->isValid() ) { + if ( citem->dataObject()->matrix(citem->channel()) ) { + m_workbook->execute( new KSCmdSetData(citem->dataObject(),citem->channel(),NULL) ); + } else { + if ( dynamic_cast<KSSheet*>(citem->dataObject()) ) + m_workbook->execute(new KSCmdRemoveSheet((KSSheet *)citem->dataObject(),m_workbook->sheets())); + } + } + } + +//--------------------------------------------------------------------// + +void KSWinWorksheet::slotBringToFrontSheet() + { + KSSheet *selected_sheet = dynamic_cast<KSSheet*>(m_curr_data); + if ( selected_sheet ) { + m_workbook->execute(new KSCmdSheetOrder(KSCmdSheetOrder::ToFront,selected_sheet,m_workbook->sheets())); + } + } + +//--------------------------------------------------------------------// + +void KSWinWorksheet::slotSendToBackSheet() + { + KSSheet *selected_sheet = dynamic_cast<KSSheet*>(m_curr_data); + if ( selected_sheet ) { + m_workbook->execute(new KSCmdSheetOrder(KSCmdSheetOrder::ToBack,selected_sheet,m_workbook->sheets())); + } + } + +//--------------------------------------------------------------------// + +void KSWinWorksheet::slotRaiseSheet() + { + KSSheet *selected_sheet = dynamic_cast<KSSheet*>(m_curr_data); + if ( selected_sheet ) { + m_workbook->execute(new KSCmdSheetOrder(KSCmdSheetOrder::Raise,selected_sheet,m_workbook->sheets())); + } + } + +//--------------------------------------------------------------------// + +void KSWinWorksheet::slotLowerSheet() + { + KSSheet *selected_sheet = dynamic_cast<KSSheet*>(m_curr_data); + if ( selected_sheet ) { + m_workbook->execute(new KSCmdSheetOrder(KSCmdSheetOrder::Lower,selected_sheet,m_workbook->sheets())); + } + } + +//-----------------------------------------------------------------------------// + +void KSWinWorksheet::slotNewSheet() + { + static int sheet_nr = 1; + KSSheet *new_sheet = new KSSheet( m_workbook->sheets() ); + KSMatrixString *new_matrix = new KSMatrixString(); + new_matrix->resize(10,10); + new_matrix->setDataObject( new_sheet, 0 ); + QCString name; + name.sprintf("sheet%d",sheet_nr++ ); + new_matrix->setName( name ); + new_sheet->setMatrix( 0, new_matrix ); + m_workbook->execute( new KSCmdAddSheet(new_sheet,m_workbook->sheets()) ); + } + +//-----------------------------------------------------------------------------// + +void KSWinWorksheet::slotRenameSheet() + { + KSSheet *selected_sheet = dynamic_cast<KSSheet*>(m_curr_data); + if ( selected_sheet ) { + bool isOK = false; + QString value = QInputDialog::getText( tr( "Rename the sheet" ), + tr( "Enter a new title: " ), + QLineEdit::Normal, + selected_sheet->objectName(), + &isOK, + this ); + if ( isOK ) selected_sheet->setObjectName( value ); + } + + } + +//-----------------------------------------------------------------------------// + +void KSWinWorksheet::slotDetach() + { + KSChannelListItem *citem = selectedItem(); + if ( citem && citem->isValid() ) { + QSMatrix *matrix = citem->dataObject()->matrix(citem->channel()); + if ( matrix ) { + KSObjectFactory factory( m_workbook ); + QSMatrix *new_matrix = factory.cloneMatrix( matrix, true ); + m_workbook->execute( new KSCmdSetData(citem->dataObject(),citem->channel(),new_matrix) ); + } + } + } + +//-----------------------------------------------------------------------------// + +void KSWinWorksheet::slotTranspose() + { + KSChannelListItem *citem = selectedItem(); + if ( citem && citem->isValid() ) { + QSMatrix *matrix = citem->dataObject()->matrix(citem->channel()); + if ( matrix ) m_workbook->execute( new KSCmdMatrixTranspose(matrix) ); + } + } + + +//-----------------------------------------------------------------------------// + +void KSWinWorksheet::slotNewMatrix() + { + KSChannelListItem *citem = selectedItem(); + if ( citem && citem->isValid() ) { + m_workbook->execute( new KSCmdSetData(citem->dataObject(),citem->channel(),KSMatrix::create(EDouble)) ); + } + } + + +//-----------------------------------------------------------------------------// + +void KSWinWorksheet::slotNewReference() + { + KSChannelListItem *citem = selectedItem(); + if ( citem && citem->isValid() ) { + m_workbook->execute( new KSCmdSetData(citem->dataObject(),citem->channel(),new KSMatrixWorksheetCellRange(m_workbook)) ); + } + } + + +//-----------------------------------------------------------------------------// + +void KSWinWorksheet::slotNewString() + { + KSChannelListItem *citem = selectedItem(); + if ( citem && citem->isValid() ) { + m_workbook->execute( new KSCmdSetData(citem->dataObject(),citem->channel(),new KSMatrixString()) ); + } + } + +//-----------------------------------------------------------------------------// + +void KSWinWorksheet::slotNewFormula() + { + KSChannelListItem *citem = selectedItem(); + if ( citem && citem->isValid() ) { + m_workbook->execute( new KSCmdSetData(citem->dataObject(),citem->channel(),new KSMatrixFormula()) ); + } + } + +//--------------------------------------------------------------------// + +void KSWinWorksheet::slotCutSheet() + { + KSSheet *selected_sheet = dynamic_cast<KSSheet*>(m_curr_data); + if ( selected_sheet ) { + KSObjectFactory factory( m_workbook ); + factory.copyKSSheetToClipboard(selected_sheet); + m_workbook->execute(new KSCmdRemoveSheet(selected_sheet,m_workbook->sheets())); + } + } + +//--------------------------------------------------------------------// + +void KSWinWorksheet::slotCopySheet() + { + KSSheet *selected_sheet = dynamic_cast<KSSheet*>(m_curr_data); + if ( selected_sheet ) { + KSObjectFactory factory( m_workbook ); + factory.copyKSSheetToClipboard(selected_sheet); + } + } + +//--------------------------------------------------------------------// + +void KSWinWorksheet::slotCopyAllSheet() + { + KSSheet *selected_sheet = dynamic_cast<KSSheet*>(m_curr_data); + if ( selected_sheet ) { + KSObjectFactory factory( m_workbook ); + factory.setFlags( KSObjectFactory::CopyAllData ); + factory.copyKSSheetToClipboard(selected_sheet); + } + } + +//--------------------------------------------------------------------// + +void KSWinWorksheet::slotPasteSheet() + { + KSObjectFactory factory( m_workbook ); + KSSheet *new_sheet = factory.pasteKSSheetFromClipboard( m_workbook->sheets() ); + if ( new_sheet ) m_workbook->execute(new KSCmdAddSheet(new_sheet,m_workbook->sheets())); + } + +//--------------------------------------------------------------------// + +void KSWinWorksheet::slotDeleteSheet() + { + KSSheet *selected_sheet = dynamic_cast<KSSheet*>(m_curr_data); + if ( selected_sheet ) { + m_workbook->execute(new KSCmdRemoveSheet(selected_sheet,m_workbook->sheets())); + } + } + +//--------------------------------------------------------------------// + +void KSWinWorksheet::slotImportOctave() + { + KSImportDlg d( m_workbook, m_curr_data, m_curr_channel ); + if ( d.exec() == QFileDialog::Accepted ) d.loadAll(); + } + +//-----------------------------------------------------------------------------// + +void KSWinWorksheet::slotExportOctave() + { + KSExportDlg d( m_data ); + if ( d.exec() == QFileDialog::Accepted ) d.saveAll(); + } + +//-----------------------------------------------------------------------------// + +void KSWinWorksheet::slotShowMenu(QListViewItem*, const QPoint& pos, int ) + { + if ( !m_worksheet_mode ) return; + QPopupMenu menu; + m_shell->m_rename_sheet->addTo( &menu ); + menu.insertSeparator(); + m_shell->m_cut_sheet->addTo( &menu ); + m_shell->m_copy_sheet->addTo( &menu ); + m_shell->m_copy_all_sheet->addTo( &menu ); + m_shell->m_paste_sheet->addTo( &menu ); + m_shell->m_delete_sheet->addTo( &menu ); + menu.insertSeparator(); + m_shell->m_raise->addTo( &menu ); + m_shell->m_lower->addTo( &menu ); + menu.insertSeparator(); + m_shell->m_bring_to_front->addTo( &menu ); + m_shell->m_send_to_back->addTo( &menu ); + menu.exec( pos ); + } + + diff --git a/kmatplot/kswinworksheet.h b/kmatplot/kswinworksheet.h new file mode 100644 index 0000000..7bd776f --- /dev/null +++ b/kmatplot/kswinworksheet.h @@ -0,0 +1,108 @@ +/*************************************************************************** + kswinworksheet.h - description + ------------------- + begin : Thu Jan 17 2002 + copyright : (C) 2002 by kamil + email : kamil@localhost.localdomain + ***************************************************************************/ + +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + +#ifndef KSWINWORKSHEET_H +#define KSWINWORKSHEET_H + +#include <qwidget.h> +#include <qpoint.h> +#include "ksworkspace.h" + +class QListViewItem; +class QSData; +class QSPlotView; +class KSWorkbook; +class KSChannelList; +class KSChannelListItem; +class KSMPanel; +class KSMatrixEditorInterf; +class KMatplotShell; + +/** + *@author kamil + */ +class KSWinWorksheet : public KSWorkspaceWindow { + Q_OBJECT + public: + KSWinWorksheet( KSWorkspace *workspace, bool worksheetMode ); + virtual ~KSWinWorksheet(); + void KSWinWorksheet::setDataObject( QSData *data ); + KSChannelList *chanList() const; + KSChannelListItem *selectedItem() const; + KSMPanel *settingsPanel() const; + KSMatrixEditorInterf *matrixEditor() const; + virtual void activated(); + virtual void deactivated(); + virtual void cut(); + virtual void copy(); + virtual void copyAll(); + virtual void paste(); + virtual void del(); + virtual void doAction( QAction* /*action*/ ); + virtual QWidget *createObjectPanel( QWidget *parent ); + virtual QWidget *createPropertyPanel( QWidget *parent ); + + public slots: + void slotRenameSheet(); + void slotRaiseSheet(); + void slotLowerSheet(); + void slotBringToFrontSheet(); + void slotSendToBackSheet(); + void slotNewSheet(); + void slotNewFormula(); + void slotNewReference(); + void slotNewString(); + void slotNewMatrix(); + void slotImportOctave(); + void slotExportOctave(); + void slotTranspose(); + void slotDetach(); + + void slotCutSheet(); + void slotCopySheet(); + void slotCopyAllSheet(); + void slotPasteSheet(); + void slotDeleteSheet(); + + void slotShowMenu(QListViewItem*, const QPoint& pos, int ); + + protected: + KSWorkbook *m_workbook; + KMatplotShell *m_shell; + KSMatrixEditorInterf *m_editor; + QSData *m_data; + QSData *m_curr_data; + QSData *m_removed_data; + int m_curr_channel; + bool m_worksheet_mode; + + void make_settings_panel(); + void make_editor(); + KSMPanel *create_settings_panel(); + void set_selected( QSData *dataObject, int channel ); + + protected slots: + void slot_channel_selected(); + void slot_data_changed( QSData *dataObject, int channel ); + void slot_child_removed( QSData *dataObject ); + void slot_added( QSData *dataObject ); + void slot_removed( QSData *dataObject ); + void slot_deleted( QSData *dataObject ); + void slot_name_changed( QSData *object, const char *name ); + }; + +#endif diff --git a/kmatplot/ksworkbook.cpp b/kmatplot/ksworkbook.cpp new file mode 100644 index 0000000..a05338a --- /dev/null +++ b/kmatplot/ksworkbook.cpp @@ -0,0 +1,188 @@ +/*************************************************************************** + ksworkbook.cpp + ------------------- + begin : + copyright : (C) 2001 by Kamil Dobkowski + email : kamildobk@poczta.onet.pl + ***************************************************************************/ + +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + +#include"ksworkbook.h" +#include"ksglobalmatrixlist.h" + +//---------------------------------------------------------------------------------------------// + +KSCommand::KSCommand( const QString& title ) + { + m_title = title; + } + +//---------------------------------------------------------------------------------------------// + +KSCommand::~KSCommand() + { + } + +//---------------------------------------------------------------------------------------------// + +void KSCommand::setError( const QString& message ) + { + m_error = message; + } + +//---------------------------------------------------------------------------------------------// +//---------------------------------------------------------------------------------------------// +//---------------------------------------------------------------------------------------------// +//---------------------------------------------------------------------------------------------// + +int KSCommandHistory::m_undo_levels = 5; + +KSCommandHistory::KSCommandHistory( QObject *parent ) +:QObject( parent ) + { + m_last_executed_command = -1; + m_command_history.setAutoDelete( TRUE ); + } + +//---------------------------------------------------------------------------------------------// + +KSCommandHistory::~KSCommandHistory() + { + } + +//---------------------------------------------------------------------------------------------// + +void KSCommandHistory::clear() + { + m_command_history.clear(); + m_last_executed_command = -1; + sigNewUndo(); + sigNewRedo(); + } + +//---------------------------------------------------------------------------------------------// + +void KSCommandHistory::setUndoLevels( int levels ) + { + m_undo_levels = levels; + } + +//---------------------------------------------------------------------------------------------// + +bool KSCommandHistory::execute( KSCommand *command ) + { + if ( command->execute() ) { + // clear all undid commands + while( isRedoPossible() ) m_command_history.removeLast(); + + m_command_history.append( command ); + + // adjust list size + while( (int )m_command_history.count() > m_undo_levels ) m_command_history.removeFirst(); + m_last_executed_command = m_command_history.count()-1; + + emit sigNewUndo(); + emit sigNewRedo(); + return true; + } else { + emit sigError( command->error() ); + delete command; + return false; + } + } + +//---------------------------------------------------------------------------------------------// + +void KSCommandHistory::undo() + { + if ( isUndoPossible() ) { + m_command_history.at(m_last_executed_command)->unexecute(); + m_last_executed_command --; + emit sigNewUndo(); + emit sigNewRedo(); + } + } + +//---------------------------------------------------------------------------------------------// + +void KSCommandHistory::redo() + { + if ( isRedoPossible() ) { + m_command_history.at(m_last_executed_command+1)->execute(); + m_last_executed_command ++; + emit sigNewUndo(); + emit sigNewRedo(); + } + } + +//---------------------------------------------------------------------------------------------// + +bool KSCommandHistory::isUndoPossible() + { + return m_last_executed_command >= 0; + } + +//---------------------------------------------------------------------------------------------// + +bool KSCommandHistory::isRedoPossible() + { + return m_last_executed_command < (int )m_command_history.count()-1; + } + +//---------------------------------------------------------------------------------------------// + +QString KSCommandHistory::undoCommandTitle() + { + if ( isUndoPossible() ) { + return m_command_history.at(m_last_executed_command)->title(); + } + return QString::null; + } + +//---------------------------------------------------------------------------------------------// + +QString KSCommandHistory::redoCommandTitle() + { + if ( isRedoPossible() ) { + return m_command_history.at(m_last_executed_command+1)->title(); + } + return QString::null; + } + +//---------------------------------------------------------------------------------------------// +//---------------------------------------------------------------------------------------------// +//---------------------------------------------------------------------------------------------// +//---------------------------------------------------------------------------------------------// + +KSWorkbook::KSWorkbook( QObject *parent ) +:QSWorkbook( parent ) + { + m_sheets = new KSSheetList( this ); + m_command_history = new KSCommandHistory( this ); + } + +//---------------------------------------------------------------------------------------------// + +KSWorkbook::~KSWorkbook() + { + } + +//---------------------------------------------------------------------------------------------// + +void KSWorkbook::clear() + { + QSWorkbook::clear(); + m_command_history->clear(); + m_sheets->clearAll(); + } + +//---------------------------------------------------------------------------------------------// + diff --git a/kmatplot/ksworkbook.h b/kmatplot/ksworkbook.h new file mode 100644 index 0000000..eccc4f0 --- /dev/null +++ b/kmatplot/ksworkbook.h @@ -0,0 +1,195 @@ +/*************************************************************************** + ksworkbook.h + ------------------- + begin : + copyright : (C) 2001 by Kamil Dobkowski + email : kamildobk@poczta.onet.pl + ***************************************************************************/ + +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + + +#ifndef KSWORKBOOK_H +#define KSWORKBOOK_H + +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + +#include<qptrlist.h> +#include<qstring.h> +#include"widgets/qsworkbook.h" + + +//---------------------------------------------------------------------------------------------// + +/** + * Command + * @author Kamil Dobkowski + */ +class KSCommand { + public: + /** + * Constructor + */ + KSCommand( const QString& title ); + /** + * Destructor + */ + virtual ~KSCommand(); + /** + * Execute command + */ + virtual bool execute() = 0; + /** + * Unexecute command + */ + virtual void unexecute() = 0; + /** + * Command title + */ + QString title() const { return m_title; } + /** + * Sets an error message + */ + void setError( const QString& message ); + /** + * Returns an error messsage + */ + QString error() const { return m_error; } + + private: + QString m_title; + QString m_error; + }; + +//---------------------------------------------------------------------------------------------// + +/** + * Command history + * @author Kamil Dobkowski + */ +class KSCommandHistory : public QObject { + Q_OBJECT + + public: + /** + * Constructor + */ + KSCommandHistory( QObject *parent=NULL ); + /** + * Destructor + */ + virtual ~KSCommandHistory(); + /** + * Clears command history and sheets + */ + void clear(); + /** + * Sets max undo levels + */ + static void setUndoLevels( int levels ); + /** + * Returns undo levels + */ + static int undoLevels() { return m_undo_levels; } + /** + * Executes command, adds it to the undo list + */ + bool execute( KSCommand *command ); + /** + * Undoes the last commands + */ + void undo(); + /** + * Redoes the last undid command + */ + void redo(); + /** + * Is command for undo available. + */ + bool isUndoPossible(); + /** + * Is command for redo available. + */ + bool isRedoPossible(); + /** + * Title of the last executed command or QString::null + */ + QString undoCommandTitle(); + /** + * Title of the last unexecuted command or QString::null + */ + QString redoCommandTitle(); + + signals: + /** + * New undo command + */ + void sigNewUndo(); + /** + * New redo command + */ + void sigNewRedo(); + /** + * Error during executing a command. + */ + void sigError( const QString& message ); + + private: + static int m_undo_levels; + int m_last_executed_command; + QPtrList<KSCommand> m_command_history; + }; + +//---------------------------------------------------------------------------------------------// + +class KSSheetList; +/** + * Extended workbook with command history and sheets. + * @author Kamil Dobkowski + */ +class KSWorkbook : public QSWorkbook + { + Q_OBJECT + public: + /** + * Constructor + */ + KSWorkbook( QObject *parent ); + /** + * Destructor + */ + virtual ~KSWorkbook(); + /** + * Clears also command history. + */ + virtual void clear(); + /** + * Command history + */ + KSCommandHistory *commandHistory() const { return m_command_history; } + /** + * Sheet list + */ + KSSheetList *sheets() const { return m_sheets; } + /** + * Calls commandHistory()->execute() + */ + bool execute( KSCommand *command ) { return m_command_history->execute( command ); } + + private: + KSSheetList *m_sheets; + KSCommandHistory *m_command_history; + }; + +//---------------------------------------------------------------------------------------------// + +#endif diff --git a/kmatplot/ksworksheetdlg.cpp b/kmatplot/ksworksheetdlg.cpp new file mode 100644 index 0000000..8978639 --- /dev/null +++ b/kmatplot/ksworksheetdlg.cpp @@ -0,0 +1,1335 @@ +/*************************************************************************** + ksworksheetdlg.cpp + ------------------- + begin : Tue Mar 6 2001 + copyright : (C) 2001 by Kamil Dobkowski + email : kamildobk@poczta.onet.pl + ***************************************************************************/ + +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ +/* +#include "ksworksheetdlg.h" +#include "dialogs/kschannellist.h" +#include "ksdataobjectfactory.h" +#include "widgets/qscurve.h" +#include "widgets/qsimage.h" +#include "widgets/qscontour.h" +#include "widgets/qssurface.h" +#include "widgets/qsfigure.h" +#include "widgets/qsaxes2d.h" +#include "widgets/qsaxes3d.h" +#include "widgets/qsplotview.h" +#include "ksglobalmatrixlist.h" +#include "ksdelunay.h" +#include "kscommands.h" +#include "ksobjectfactory.h" +#include "dialogs/ksimportdlg.h" +#include "dialogs/ksexportdlg.h" +#include "ksmatrixeditor.h" +#include "dialogs/ksmpanels.h" +#include "dialogs/kswizarddlgs.h" + +#include <qlabel.h> +#include <qmessagebox.h> +#include <qpushbutton.h> +#include <qcombobox.h> +#include <qlayout.h> +#include <qprogressdialog.h> +#include <qtabbar.h> +#include <qsplitter.h> +#include <qaction.h> +#include <qapplication.h> +#include <qpopupmenu.h> +#include <qmenubar.h> +#include <qcursor.h> + +//#include <qaction.h> +//#include <kmenubar.h> +//#include <kedittoolbar.h> +#include <qfiledialog.h> +//#include <kapp.h> + +// +// Uwzglednial selection i puste miejsca +// Editor powinien resizowac macierz +// + +// +// Co to jest m_curr_object i m_curr_page ????????????????!!!!!!!!!!!!!!!!!!!!! +// +class KSObjectListItem : public QListViewItem + { + public: + KSObjectListItem( QListView *parent, QSData *object, const QString& title ) + : QListViewItem(parent), m_object(object) { + setText( 0, title ); + } + KSObjectListItem( QListViewItem *parent, QSData *object, const QString& title ) + : QListViewItem(parent), m_object(object) { + setText( 0, title ); + } + ~KSObjectListItem() { + } + QSData *object() const { return m_object; } + private: + QSData *m_object; + }; + +//--------------------------------------------------------------------// + + +KSWorksheetDlg::KSWorksheetDlg( KSWorkbook *workbook, QSPlotView *view, QWidget *parent, const char *name ) +: QWidget( parent, name ) + { + m_view = view; + + m_workbook = workbook; + connect( m_workbook, SIGNAL(sigPageListChanged()), this, SLOT(slot_page_list_changed()) ); + connect( m_workbook->sheets(), SIGNAL(sigChildListChanged()), this, SLOT(slot_object_list_changed()) ); + connect( m_workbook->commandHistory(), SIGNAL(sigNewUndo()), this, SLOT(slot_new_undo()) ); + connect( m_workbook->commandHistory(), SIGNAL(sigNewRedo()), this, SLOT(slot_new_redo()) ); + + //setCaption(tr("Worksheet")); + //resize( 660, 450 ); + + // + // Create actions + // + /* + m_new_sheet = new QAction( tr("Sheet"), tr("&New sheet"), 0, this, "new_sheet" ); + connect( m_new_sheet, SIGNAL(activated()), this, SLOT(slotNewSheet()) ); + m_new_matrix = new QAction( tr("Numerical"), tr("N&umerical matrix"), 0, this, "new_matrix" ); + connect( m_new_matrix, SIGNAL(activated()), this, SLOT(slotNewMatrix()) ); + m_new_string = new QAction( tr("String"), tr("&String matrix"), 0, this, "new_string" ); + connect( m_new_string, SIGNAL(activated()), this, SLOT(slotNewString()) ); + m_new_formula = new QAction( tr("Formula"), tr("&Formula matrix"), 0, this, "new_formula" ); + connect( m_new_formula, SIGNAL(activated()), this, SLOT(slotNewFormula()) ); + m_new_reference = new QAction( tr("Range"), tr("&Point to: sheet cell range"), 0, this, "new_reference" ); + connect( m_new_reference, SIGNAL(activated()), this, SLOT(slotNewReference()) ); + + m_import_data = new QAction( tr("Import"), tr("&Import data ..."), 0, this, "import_data" ); + connect( m_import_data, SIGNAL(activated()), this, SLOT(slotImportData()) ); + m_export_data = new QAction( tr("Export"), tr("&Export data ..."), 0, this, "export_data" ); + connect( m_export_data, SIGNAL(activated()), this, SLOT(slotExportData()) ); + + m_close = new QAction( tr("Close"), tr("&Close"), 0, this, "close" ); + connect( m_close, SIGNAL(activated()), this, SLOT(close()) ); + + m_undo = new QAction( tr("Undo"), tr("&Undo"), CTRL+Key_Z, this, "undo" ); + connect( m_undo, SIGNAL(activated()), this, SLOT(slotUndo()) ); + m_redo = new QAction( tr("Redo"), tr("&Redo"), CTRL+Key_Y, this, "redo" ); + connect( m_redo, SIGNAL(activated()), this, SLOT(slotRedo()) ); + slot_new_undo(); + slot_new_redo(); + + m_copy = new QAction( tr("Copy"), tr("&Copy"), CTRL+Key_C, this, "copy" ); + connect( m_copy, SIGNAL(activated()), this, SLOT(slotCopy()) ); + m_copy_all = new QAction( tr("Copy all"), tr("&Copy with data"), 0, this, "copy_all" ); + connect( m_copy_all, SIGNAL(activated()), this, SLOT(slotCopyAll()) ); + m_paste = new QAction( tr("Paste"), tr("&Paste"), CTRL+Key_V, this, "paste" ); + connect( m_paste, SIGNAL(activated()), this, SLOT(slotPaste()) ); + m_cut = new QAction( tr("Cut"), tr("C&ut"), CTRL+Key_X, this, "cut" ); + connect( m_cut, SIGNAL(activated()), this, SLOT(slotCut()) ); + m_delete = new QAction( tr("Delete"), tr("&Delete"), 0, this, "delete" ); + connect( m_delete, SIGNAL(activated()), this, SLOT(slotDelete()) ); + m_detach = new QAction( tr("Detach"), tr("&Detach"), 0, this, "detach" ); + connect( m_detach, SIGNAL(activated()), this, SLOT(slotDetach()) ); + m_transpose = new QAction( tr("Transpose"), tr("&Transpose"), 0, this, "transpose" ); + connect( m_transpose, SIGNAL(activated()), this, SLOT(slotTranspose()) ); + + m_series = new QAction( tr("XY plot"), tr("Multiple XY series - use all columns: (X),(DX),Y,(DY) "), 0, this, "series" ); + connect( m_series, SIGNAL(activated()), this, SLOT(slotNewSeriesAuto()) ); + m_pixmap = new QAction( tr("Pixmap"), tr("Pixmap - Use the current sheet "), 0, this, "pixmap_direct" ); + connect( m_pixmap, SIGNAL(activated()), this, SLOT(slotNewPixmapDirect()) ); + m_contour = new QAction( tr("Contour"), tr("Use the current sheet ..."), 0, this, "contour_direct" ); + connect( m_contour, SIGNAL(activated()), this, SLOT(slotNewContourDirect()) ); + m_contour_delunay= new QAction( tr("Contour delunay"), tr("Delunay triangulation - use columns: X, Y, Z "), 0, this, "contour_delunay" ); + connect( m_contour_delunay, SIGNAL(activated()), this, SLOT(slotNewContourDelunay()) ); + m_surface = new QAction( tr("Surface"), tr(" Surface - Use the current sheet ..."), 0, this, "surface" ); + connect( m_surface, SIGNAL(activated()), this, SLOT(slotNewSurfaceDirect()) ); + m_surface_delunay = new QAction( tr("Surface delunay"), tr("Delunay triangulation - use columns: X, Y, Z "), 0, this, "surface_delunay" ); + connect( m_surface_delunay, SIGNAL(activated()), this, SLOT(slotNewSurfaceDelunay()) ); + m_figure_trajectory = new QAction( tr("Trajectory"), tr("Trajectory/Scatter - use columns: X,Y,Z "), 0, this, "figure_trajectory" ); + connect( m_figure_trajectory, SIGNAL(activated()), this, SLOT(slotNewFigureTrajectory()) ); + + // + // Build menu + // + QPopupMenu *file = new QPopupMenu( this ); + menuBar()->insertItem( "&File", file ); + m_new_sheet->addTo( file ); + file->insertSeparator(); + m_new_matrix->addTo( file ); + m_new_string->addTo( file ); + m_new_formula->addTo( file ); + m_new_reference->addTo( file ); + file->insertSeparator(); + m_import_data->addTo( file ); + m_export_data->addTo( file ); + file->insertSeparator(); + m_close->addTo( file ); + + QPopupMenu *edit = new QPopupMenu( this ); + menuBar()->insertItem( "&Edit", edit ); + m_undo->addTo( edit ); + m_redo->addTo( edit ); + edit->insertSeparator(); + m_cut->addTo( edit ); + m_copy->addTo( edit ); + m_copy_all->addTo( edit ); + m_paste->addTo( edit ); + m_delete->addTo( edit ); + edit->insertSeparator(); + m_transpose->addTo( edit ); + m_detach->addTo( edit ); + + QPopupMenu *graph = new QPopupMenu( this ); + menuBar()->insertItem( "&Graph", graph ); + m_series->addTo( graph ); + m_pixmap->addTo( graph ); + m_contour->addTo( graph ); + m_contour_delunay->addTo( graph ); + m_surface->addTo( graph ); + m_surface_delunay->addTo( graph ); + m_figure_trajectory->addTo( graph ); + + + m_main_view = this; + //new QWidget( this ); + //setCentralWidget( m_main_view ); + + m_page_list = new QComboBox( m_main_view ); + m_page_list->setEditable( false ); + m_page_list->setFixedWidth( 210 ); + + QSplitter *splitter = new QSplitter( QSplitter::Vertical, m_main_view ); + splitter->setFixedWidth( 210 ); + + m_object_list = new QListView( splitter ); + m_object_list->setSorting(-1); + m_object_list->setAllColumnsShowFocus( true ); + m_object_list->setRootIsDecorated( true ); + m_object_list->setTreeStepSize( 10 ); + m_object_list->setMultiSelection(false); + m_object_list->setVScrollBarMode( QListView::AlwaysOn ); + m_object_list->setHScrollBarMode( QListView::AlwaysOff ); + m_object_list->addColumn( tr("Objects"), 190 ); + //m_object_list->setFixedWidth( 210 ); + + m_chan_list = new KSChannelList( splitter ); + m_chan_list->addColumn( tr("Channels"), 140 ); + m_chan_list->addColumn( tr(""), 50 ); + //m_chan_list->setFixedWidth( 210 ); + + QWidget *label_place = new QWidget( m_main_view ); + label_place->setFixedHeight( 50 ); + m_chan_description = new QLabel( label_place ); + m_chan_description->setFont(QFont("helvetica", 8, 50)); + m_chan_description->move(5,0); + m_chan_description->resize( 450, 50 ); + + m_editor = NULL; + m_settings_panel = NULL; + m_settings_panel_visible = true; + + QGridLayout *layout = new QGridLayout( m_main_view, 2, 2 ); + layout->setRowStretch( 0, 0 ); + layout->setRowStretch( 1, 10 ); + layout->setRowStretch( 2, 0 ); + layout->setColStretch( 0, 0 ); + layout->setColStretch( 1, 10 ); + + layout->addWidget( m_page_list, 0, 0 ); + layout->addWidget( splitter, 1, 0 ); + + m_panel_layout = new QGridLayout( 3, 1 ); + m_panel_layout->setRowStretch( 0, 10 ); + m_panel_layout->setRowStretch( 1, 0 ); + m_panel_layout->setRowStretch( 2, 0 ); + m_panel_layout->setColStretch( 0, 10 ); + m_panel_layout->addWidget( label_place, 0, 0 ); + layout->addMultiCellLayout( m_panel_layout, 0, 1, 1, 1 ); + + m_progress_dlg = NULL; + + connect( m_page_list, SIGNAL(activated(int)), this, SLOT(slot_page_selected(int)) ); + + connect( m_object_list, SIGNAL(selectionChanged(QListViewItem*)), this, SLOT(slot_object_selected(QListViewItem*)) ); + connect( m_object_list, SIGNAL(rightButtonPressed(QListViewItem*,const QPoint&,int)), this, SLOT(slot_show_menu(QListViewItem*,const QPoint&,int)) ); + + connect( m_chan_list, SIGNAL(selectionChanged()), this, SLOT(slot_channel_selected()) ); + connect( m_chan_list, SIGNAL(sigDataChanged(QSData*,int)), this, SLOT(slot_data_changed(QSData*,int)) ); + connect( m_chan_list, SIGNAL(sigShowText(const QString&)), this, SLOT(slot_channel_description(const QString&)) ); + + m_curr_page = NULL; + m_curr_object = NULL; + recreate_page_list(); + recreate_object_list(); + } + +//--------------------------------------------------------------------// + +KSWorksheetDlg::~KSWorksheetDlg() + { + } + +//-----------------------------------------------------------// + +void KSWorksheetDlg::recreate_page_list() + { + bool selected = false; + m_page_list->clear(); + // firts item for sheet list + m_page_list->insertItem( tr("Sheet list") ); + + // next items for pages + for( int i=0; i<m_workbook->pageCount(); i++ ) { + m_page_list->insertItem( QString::number(i+1)+" : \""+m_workbook->page(i)->title()+"\"" ); + if ( m_workbook->page(i) == m_curr_page ) { + m_page_list->setCurrentItem(i+1); + selected = true; + } + } + if ( selected ) update_page_list(); else setCurrentPage( -1 ); + } + +//-----------------------------------------------------------// + +void KSWorksheetDlg::update_page_list() +// update page list to set the current page selected + { + m_page_list->setCurrentItem(m_workbook->pageFind(m_curr_page)+1); + } + +//-----------------------------------------------------------------------------// + +void KSWorksheetDlg::slot_page_list_changed() + { + recreate_page_list(); + } + +//--------------------------------------------------------------------// + +void KSWorksheetDlg::slot_page_selected( int index ) + { + setCurrentPage(index-1); + } + +//-----------------------------------------------------------// + +void KSWorksheetDlg::setCurrentPage( int index ) + { + if ( m_workbook->page(index) != m_curr_page ) { + if ( m_curr_page ) { + disconnect( m_curr_page->objects(), SIGNAL(sigListChanged()), this, SLOT(slot_object_list_changed()) ); + disconnect( m_curr_page->objects(), SIGNAL(sigDataChildListChanged()), this, SLOT(slot_object_list_changed()) ); + } + m_curr_page = m_workbook->page(index); + update_page_list(); + if ( m_curr_page ) { + connect( m_curr_page->objects(), SIGNAL(sigListChanged()), this, SLOT(slot_object_list_changed()) ); + connect( m_curr_page->objects(), SIGNAL(sigDataChildListChanged()), this, SLOT(slot_object_list_changed()) ); + } + recreate_object_list(); + } + } + +//-----------------------------------------------------------// + +void KSWorksheetDlg::recreate_object_list() +// create a list contents + { + int pos_x = m_object_list->contentsX(); + int pos_y = m_object_list->contentsY(); + + m_object_list->clear(); + + if ( m_curr_page ) + for( int i=0; i<m_curr_page->objects()->count(); i++ ) { + + // add all data object to the list + QSCObject *curr_object = m_curr_page->objects()->object(i); + if ( curr_object->isAxesShadow() ) { + QSAxes *curr_axes = curr_object->parentAxes(); + + // add parent axes object + KSObjectListItem *curr_item = new KSObjectListItem( m_object_list, NULL, KSDataObjectFactory::channelNameFactory(curr_axes) ); + + // add all child axes + KSObjectListItem *curr_axes_item = new KSObjectListItem( curr_item, NULL, tr(" Axes") ); + for( int j=0; j<curr_axes->axisCount(); j++ ) { + (void )new KSObjectListItem( curr_axes_item, curr_axes->axis(j), KSDataObjectFactory::channelNameFactory(curr_axes->axis(j)) ); + } + m_object_list->setOpen( curr_axes_item, true ); + + // add all datasets + KSObjectListItem *curr_plot_item = new KSObjectListItem( curr_item, NULL, tr(" Datasets") ); + for( int j=0; j<curr_axes->plotCount(); j++ ) { + (void )new KSObjectListItem( curr_plot_item, curr_axes->plot(j), KSDataObjectFactory::channelNameFactory(curr_axes->plot(j)) ); + } + m_object_list->setOpen( curr_plot_item, true ); + m_object_list->setOpen( curr_item, true ); + } + } + + // add sheets + KSSheetList *sheets = m_workbook->sheets(); + KSObjectListItem *curr_item = new KSObjectListItem( m_object_list, NULL, KSDataObjectFactory::channelNameFactory(m_workbook->sheets()) ); + for ( int i=0; i<sheets->childCount(); i++ ) { + (void ) new KSObjectListItem( curr_item, sheets->child(i), KSDataObjectFactory::channelNameFactory(sheets->child(i)) ); + } + m_object_list->setOpen( curr_item, true ); + update_object_list(); + + m_object_list->setContentsPos(pos_x,pos_y); + } + +//-----------------------------------------------------------// + +void KSWorksheetDlg::update_object_list() +// update object list to show the current object selected + { + bool selected = false; + QListViewItem *curr_item = m_object_list->firstChild(); + while ( curr_item ) { + KSObjectListItem *obj_item = dynamic_cast<KSObjectListItem*>(curr_item); + if ( obj_item && m_curr_object && obj_item->object() == m_curr_object ) { + selected = true; + m_object_list->setCurrentItem( obj_item ); + } + curr_item = curr_item->itemBelow(); + } + if ( !selected ) setCurrentObject( NULL ); + } + +//-----------------------------------------------------------// + +void KSWorksheetDlg::slot_object_list_changed() + { + recreate_object_list(); + } + +//-----------------------------------------------------------// + +void KSWorksheetDlg::slot_object_selected( QListViewItem *item ) + { + KSObjectListItem *obj_item = dynamic_cast<KSObjectListItem*>(item); + if ( obj_item ) setCurrentObject( obj_item->object() ); + } + +//-----------------------------------------------------------// + +void KSWorksheetDlg::setCurrentObject( QSData *object ) + { + if ( m_curr_object != object ) { + m_curr_object = object; + update_object_list(); + m_chan_list->setDataObject( object, true, -1, false ); + m_chan_list->select( object, 0 ); + slot_channel_selected(); + } + } + +//-----------------------------------------------------------// + +QSData *KSWorksheetDlg::selectedObject() const + { + KSChannelListItem *item = m_chan_list->selected(); + if ( item && item->isValid() ) return item->dataObject(); + return NULL; + } + +//-----------------------------------------------------------// + +int KSWorksheetDlg::selectedChannel() const + { + KSChannelListItem *item = m_chan_list->selected(); + if ( item && item->isValid() ) return item->channel(); + return -1; + } + +//-----------------------------------------------------------// + +QSMatrix *KSWorksheetDlg::selectedMatrix() const + { + KSChannelListItem *item = m_chan_list->selected(); + if ( item && item->isValid() ) return item->dataObject()->matrix(item->channel()); + return NULL; + } + +//-----------------------------------------------------------// + +void KSWorksheetDlg::slot_new_undo() + { + //m_undo->setEnabled( m_workbook->commandHistory()->isUndoPossible() ); + //m_undo->setText( tr("Undo: ")+m_workbook->commandHistory()->undoCommandTitle() ); + } + +//-----------------------------------------------------------// + +void KSWorksheetDlg::slot_new_redo() + { + //m_redo->setEnabled( m_workbook->commandHistory()->isRedoPossible() ); + //m_redo->setText( tr("Redo: ")+m_workbook->commandHistory()->redoCommandTitle() ); + } + +//-----------------------------------------------------------// + +void KSWorksheetDlg::slotUndo() + { + m_workbook->commandHistory()->undo(); + } + +//-----------------------------------------------------------// + +void KSWorksheetDlg::slotRedo() + { + m_workbook->commandHistory()->redo(); + } + +//-------------------------------------------------------------// + +void KSWorksheetDlg::slotCut() + { + KSChannelListItem *item = m_chan_list->selected(); + if ( item && item->isValid() && item->dataObject()->matrix(item->channel()) ) { + KSObjectFactory factory( m_workbook ); + factory.copyQSMatrixToClipboard( item->dataObject()->matrix(item->channel()) ); + m_workbook->execute( new KSCmdSetData(item->dataObject(),item->channel(),NULL) ); + } + } + +//-------------------------------------------------------------// + +void KSWorksheetDlg::slotCopy() + { + KSChannelListItem *item = m_chan_list->selected(); + if ( item && item->isValid() && item->dataObject()->matrix(item->channel()) ) { + KSObjectFactory factory( m_workbook ); + factory.copyQSMatrixToClipboard( item->dataObject()->matrix(item->channel()) ); + } + } + +//-------------------------------------------------------------// + +void KSWorksheetDlg::slotCopyAll() + { + KSChannelListItem *item = m_chan_list->selected(); + if ( item && item->isValid() && item->dataObject()->matrix(item->channel()) ) { + KSObjectFactory factory( m_workbook ); + factory.setFlags( QSObjectFactory::CopyAllData ); + factory.copyQSMatrixToClipboard( item->dataObject()->matrix(item->channel()) ); + } + } + +//-------------------------------------------------------------// + +void KSWorksheetDlg::slotPaste() + { + KSChannelListItem *item = m_chan_list->selected(); + if ( item && item->isValid() ) { + KSObjectFactory factory( m_workbook ); + QSMatrix *new_matrix = factory.pasteQSMatrixFromClipboard(); + if ( new_matrix ) { + m_workbook->execute( new KSCmdSetData(item->dataObject(),item->channel(),new_matrix) ); + } + } + } + +//-----------------------------------------------------------------------------// + +void KSWorksheetDlg::slotDelete() + { + KSChannelListItem *citem = m_chan_list->selected(); + if ( citem && citem->isValid() ) { + if ( citem->dataObject()->matrix(citem->channel()) ) { + m_workbook->execute( new KSCmdSetData(citem->dataObject(),citem->channel(),NULL) ); + } else { + if ( dynamic_cast<KSSheet*>(citem->dataObject()) ) + m_workbook->execute(new KSCmdRemoveSheet((KSSheet *)citem->dataObject(),m_workbook->sheets())); + } + } + } +//-----------------------------------------------------------------------------// + +bool KSWorksheetDlg::confirm( const QString& message ) + { + return QMessageBox::warning ( NULL, tr("Confirmation"), message, QMessageBox::Yes, QMessageBox::No, 0 ) == QMessageBox::Yes; + } + +//-----------------------------------------------------------------------------// + +KSSheet *KSWorksheetDlg::get_sheet() + { + KSChannelListItem *citem = m_chan_list->selected(); + + if ( !citem || !citem->isValid() || citem->channel() != 0 || !dynamic_cast<KSSheet*>(citem->dataObject()) ) { + QMessageBox::warning ( NULL, tr("Error"), tr("Select a source sheet first !"), QMessageBox::Ok, 0, 0 ); + return NULL; + } + return dynamic_cast<KSSheet*>(citem->dataObject()); + } + +//-----------------------------------------------------------------------------// + +QSAxes *KSWorksheetDlg::get_axes() + { + QSAxes *axes = m_view->activeAxes(); + if ( axes == NULL ) { + QMessageBox::warning ( NULL, tr("Error"), tr("Select the target axes first !"), QMessageBox::Ok, 0, 0 ); + return NULL; + } + return axes; + } + +//-----------------------------------------------------------------------------// + +bool KSWorksheetDlg::confirm_new_matrix( KSChannelListItem *citem ) + { + if ( citem && citem->isValid() ) { + if ( !citem->dataObject()->matrix(citem->channel()) || confirm(tr(" Delete the current matrix ? ")) ) { + return true; + } + } + return false; + } + +//-----------------------------------------------------------------------------// + +void KSWorksheetDlg::slotNewSheet() + { + static int sheet_nr = 1; + KSSheet *new_sheet = new KSSheet( m_workbook->sheets() ); + KSMatrixString *new_matrix = new KSMatrixString(); + new_matrix->resize(10,10); + new_matrix->setDataObject( new_sheet, 0 ); + QCString name; + name.sprintf("sheet%d",sheet_nr++ ); + new_matrix->setName( name ); + new_sheet->setMatrix( 0, new_matrix ); + m_workbook->execute( new KSCmdAddSheet(new_sheet,m_workbook->sheets()) ); + } + +//-----------------------------------------------------------------------------// + +void KSWorksheetDlg::slotDetach() + { + KSChannelListItem *citem = m_chan_list->selected(); + if ( citem && citem->isValid() ) { + QSMatrix *matrix = citem->dataObject()->matrix(citem->channel()); + if ( matrix ) { + KSObjectFactory factory( m_workbook ); + QSMatrix *new_matrix = factory.cloneMatrix( matrix, true ); + m_workbook->execute( new KSCmdSetData(citem->dataObject(),citem->channel(),new_matrix) ); + } + } + } + +//-----------------------------------------------------------------------------// + +void KSWorksheetDlg::slotTranspose() + { + KSChannelListItem *citem = m_chan_list->selected(); + if ( citem && citem->isValid() ) { + QSMatrix *matrix = citem->dataObject()->matrix(citem->channel()); + if ( matrix ) m_workbook->execute( new KSCmdMatrixTranspose(matrix) ); + } + } + + +//-----------------------------------------------------------------------------// + +void KSWorksheetDlg::slotNewMatrix() + { + KSChannelListItem *citem = m_chan_list->selected(); + if ( confirm_new_matrix(citem) ) { + m_workbook->execute( new KSCmdSetData(citem->dataObject(),citem->channel(),KSMatrix::create(EDouble)) ); + } + } + + +//-----------------------------------------------------------------------------// + +void KSWorksheetDlg::slotNewReference() + { + KSChannelListItem *citem = m_chan_list->selected(); + if ( confirm_new_matrix(citem) ) { + m_workbook->execute( new KSCmdSetData(citem->dataObject(),citem->channel(),new KSMatrixWorksheetCellRange(m_workbook)) ); + } + } + + +//-----------------------------------------------------------------------------// + +void KSWorksheetDlg::slotNewString() + { + KSChannelListItem *citem = m_chan_list->selected(); + if ( confirm_new_matrix(citem) ) { + m_workbook->execute( new KSCmdSetData(citem->dataObject(),citem->channel(),new KSMatrixString()) ); + } + } + +//-----------------------------------------------------------------------------// + +void KSWorksheetDlg::slotNewFormula() + { + KSChannelListItem *citem = m_chan_list->selected(); + if ( confirm_new_matrix(citem) ) { + m_workbook->execute( new KSCmdSetData(citem->dataObject(),citem->channel(),new KSMatrixFormula()) ); + } + } + +//-----------------------------------------------------------------------------// + +void KSWorksheetDlg::slotNewSeriesAuto() + { + KSSheet *curr_sheet = get_sheet(); + if ( !curr_sheet ) return; + QSAxes *curr_axes = get_axes(); + if ( !curr_axes ) return; + + int columns = curr_sheet->matrix(0) ? curr_sheet->matrix(0)->cols() : 0; + + int column_x = -1; + int column_y = -1; + int column_dx = -1; + int column_dy = -1; + + KSCmdAddDatasetGroup *add_datasets = new KSCmdAddDatasetGroup(); + + // Algorithm is simple and tries to be smart: + // Scan column types from left to right and remember column numbers for + // x, dx, y, dy data. If column of some type is found and there is already + // assigned column number for this type ( and there is y column + // assigned ), the new curve is created, all remembered column numbers are + // set to 'Unknown' and the process is repeated starting from that lately + // found column until all columns are scanned. Actually, when a new Y column + // is found only Y and DY values are reset, so X and DX columns can be reused + // for multiple series. + // Examples: + // columns Y1 Y2 Y3 -> three series (Y1), (Y2), (Y3) + // X DX Y1 Y2 Y3 -> (X+/-DX,Y1), (X+/-DX,Y2), (X+/-DX,Y3) + // + for(int curr_col=0;curr_col<columns;curr_col++) { + if ( curr_sheet->isColumnDataPresent(curr_col) ) { + switch( curr_sheet->columnData(curr_col).type ) { + case KSSheet::ColumnDX: + if ( column_dx != -1 && column_y != -1 ) { + add_new_series( add_datasets, curr_axes, curr_sheet, column_x, column_y, column_dx, column_dy ); + column_x = -1; + column_y = -1; + column_dx = -1; + column_dy = -1; + } + column_dx = curr_col; + break; + case KSSheet::ColumnDY: + if ( column_dy != -1 && column_y != -1 ) { + add_new_series( add_datasets, curr_axes, curr_sheet, column_x, column_y, column_dx, column_dy ); + column_dx = -1; + column_dy = -1; + // column_x, column_dy is reused for a different series + } + column_dy = curr_col; + break; + case KSSheet::ColumnX: + if ( column_x != -1 && column_y != -1 ) { + add_new_series( add_datasets, curr_axes, curr_sheet, column_x, column_y, column_dx, column_dy ); + column_x = -1; + column_y = -1; + column_dx = -1; + column_dy = -1; + } + column_x = curr_col; + break; + case KSSheet::ColumnY: + // ok series completed. + if ( column_y != -1 ) { + add_new_series( add_datasets, curr_axes, curr_sheet, column_x, column_y, column_dx, column_dy ); + column_dx = -1; + column_dy = -1; + // column_x, column_dy is reused for a different series + } + column_y = curr_col; + default: break; + } + } + } + + // the last series. + if ( column_y != -1 ) { + add_new_series( add_datasets, curr_axes, curr_sheet, column_x, column_y, column_dx, column_dy ); + } + + m_workbook->execute( add_datasets ); + } + +//-----------------------------------------------------------------------------// + +void KSWorksheetDlg::add_new_series( KSCmdAddDatasetGroup *cmd, QSAxes *axes, KSSheet *sheet, int column_x, int column_y, int column_dx, int column_dy ) + { + QSCurve *new_curve = new QSCurve( axes ); + + if ( column_x >= 0 ) { + set_column( sheet, column_x, new_curve, QSCurve::XVector ); + } + if ( column_y >= 0 ) { + set_column( sheet, column_y, new_curve, QSCurve::YVector ); + } + if ( column_dx >= 0 ) { + set_column( sheet, column_dx, new_curve, QSCurve::DXVector ); + } + if ( column_dy >= 0 ) { + set_column( sheet, column_dy, new_curve, QSCurve::DYVector ); + } + + if ( sheet->columnData(column_y).title.isEmpty() ) new_curve->setTitle( tr("Column ")+QString::number(column_y) ); + else new_curve->setTitle( sheet->columnData(column_y).title ); + + cmd->addDataset(new_curve); + } + +//-----------------------------------------------------------------------------// + +void KSWorksheetDlg::set_column( KSSheet *src_sheet, int src_column, QSData *dst_object, int dst_channel ) + { + KSMatrixWorksheetCellRange *new_data = new KSMatrixWorksheetCellRange(m_workbook); + new_data->setWorksheet( m_workbook->sheets()->childIndex(src_sheet) ); + new_data->setColumn( src_column ); + dst_object->setMatrix( dst_channel, new_data ); + } + +//-----------------------------------------------------------------------------// + +void KSWorksheetDlg::slotNewPixmapDirect() + { + KSSheet *curr_sheet = get_sheet(); + if ( !curr_sheet ) return; + QSAxes *curr_axes = get_axes(); + if ( !curr_axes ) return; + + KSMatrixWorksheetCellRange *new_data = new KSMatrixWorksheetCellRange(m_workbook); + new_data->setWorksheet( m_workbook->sheets()->childIndex(curr_sheet) ); + QSImage *new_pixmap = new QSImage( curr_axes ); + new_pixmap->setMatrix( QSImage::DataGray, new_data ); + m_workbook->execute( new KSCmdAddDataset(new_pixmap) ); + } + + +//-----------------------------------------------------------------------------// + +void KSWorksheetDlg::slotNewContourDirect() + { + KSSheet *curr_sheet = get_sheet(); + if ( !curr_sheet ) return; + QSAxes *curr_axes = get_axes(); + if ( !curr_axes ) return; + + KSWizardDlgSurface d( this, m_workbook, curr_sheet, curr_axes, false ); + d.exec(); + } + +//-----------------------------------------------------------------------------// + +void KSWorksheetDlg::slotNewContourDelunay() + { + KSSheet *curr_sheet = get_sheet(); + if ( !curr_sheet ) return; + QSAxes *curr_axes = get_axes(); + if ( !curr_axes ) return; + + int column_x = -1; + int column_y = -1; + int column_z = -1; + int columns = curr_sheet->matrix(0) ? curr_sheet->matrix(0)->cols() : 0; + for(int curr_col=0;curr_col<columns;curr_col++) { + if ( curr_sheet->isColumnDataPresent(curr_col) ) { + switch( curr_sheet->columnData(curr_col).type ) { + case KSSheet::ColumnX: column_x = curr_col; break; + case KSSheet::ColumnY: column_y = curr_col; break; + case KSSheet::ColumnZ: column_z = curr_col; break; + default: break; + } + if ( column_x >= 0 && + column_y >= 0 && + column_z >= 0 ) { + KSMatrixWorksheetCellRange *x_col = new KSMatrixWorksheetCellRange(m_workbook); + KSMatrixWorksheetCellRange *y_col = new KSMatrixWorksheetCellRange(m_workbook); + KSMatrixWorksheetCellRange *z_col = new KSMatrixWorksheetCellRange(m_workbook); + x_col->setWorksheet( m_workbook->sheets()->childIndex(curr_sheet) ); + y_col->setWorksheet( m_workbook->sheets()->childIndex(curr_sheet) ); + z_col->setWorksheet( m_workbook->sheets()->childIndex(curr_sheet) ); + x_col->setColumn( column_x ); + y_col->setColumn( column_y ); + z_col->setColumn( column_z ); + + KSDelunay *tr_object = new KSDelunay(NULL); + m_progress_dlg = new QProgressDialog( "Delunay triangulation ...", "Abort", 100, this, "progress", TRUE ); + connect( tr_object, SIGNAL(sigProgress(int,bool*)), this, SLOT(slot_progress(int,bool*)) ); + KSMatrix *triangles = tr_object->triangulation( x_col, y_col ); + delete m_progress_dlg; m_progress_dlg = NULL; + + if ( triangles ) { + QSNonGriddedContour *new_contour = new QSNonGriddedContour( curr_axes ); + new_contour->setMatrix( QSNonGriddedContour::VXCoord, x_col ); + new_contour->setMatrix( QSNonGriddedContour::VYCoord, y_col ); + new_contour->setMatrix( QSNonGriddedContour::VZCoord, z_col ); + new_contour->setMatrix( QSNonGriddedContour::Triangles, triangles ); + + m_workbook->execute( new KSCmdAddDataset(new_contour) ); + } + + if ( !tr_object->error().isEmpty() ) + QMessageBox::warning ( NULL, tr("Errors and warnings"), tr_object->error(), QMessageBox::Ok, 0, 0 ); + + + delete tr_object; + break; + } + } + } + } + + +//-----------------------------------------------------------------------------// + +void KSWorksheetDlg::slotNewSurfaceDirect() + { + KSSheet *curr_sheet = get_sheet(); + if ( !curr_sheet ) return; + QSAxes *curr_axes = get_axes(); + if ( !curr_axes ) return; + + KSWizardDlgSurface d( this, m_workbook, curr_sheet, curr_axes, true ); + d.exec(); + } + +//-----------------------------------------------------------------------------// + +void KSWorksheetDlg::slotNewSurfaceDelunay() + { + KSSheet *curr_sheet = get_sheet(); + if ( !curr_sheet ) return; + QSAxes *curr_axes = get_axes(); + if ( !curr_axes ) return; + + int column_x = -1; + int column_y = -1; + int column_z = -1; + int columns = curr_sheet->matrix(0) ? curr_sheet->matrix(0)->cols() : 0; + for(int curr_col=0;curr_col<columns;curr_col++) { + if ( curr_sheet->isColumnDataPresent(curr_col) ) { + switch( curr_sheet->columnData(curr_col).type ) { + case KSSheet::ColumnX: column_x = curr_col; break; + case KSSheet::ColumnY: column_y = curr_col; break; + case KSSheet::ColumnZ: column_z = curr_col; break; + default: break; + } + if ( column_x >= 0 && + column_y >= 0 && + column_z >= 0 ) { + KSMatrixWorksheetCellRange *x_col = new KSMatrixWorksheetCellRange(m_workbook); + KSMatrixWorksheetCellRange *y_col = new KSMatrixWorksheetCellRange(m_workbook); + KSMatrixWorksheetCellRange *z_col = new KSMatrixWorksheetCellRange(m_workbook); + x_col->setWorksheet( m_workbook->sheets()->childIndex(curr_sheet) ); + y_col->setWorksheet( m_workbook->sheets()->childIndex(curr_sheet) ); + z_col->setWorksheet( m_workbook->sheets()->childIndex(curr_sheet) ); + x_col->setColumn( column_x ); + y_col->setColumn( column_y ); + z_col->setColumn( column_z ); + + KSDelunay *tr_object = new KSDelunay(NULL); + m_progress_dlg = new QProgressDialog( "Delunay triangulation ...", "Abort", 100, this, "progress", TRUE ); + connect( tr_object, SIGNAL(sigProgress(int,bool*)), this, SLOT(slot_progress(int,bool*)) ); + KSMatrix *triangles = tr_object->triangulation( x_col, y_col ); + delete m_progress_dlg; m_progress_dlg = NULL; + if ( triangles ) { + QSFigure *new_figure = new QSFigure( curr_axes ); + new_figure->setMatrix( QSFigure::VXCoord, x_col ); + new_figure->setMatrix( QSFigure::VYCoord, y_col ); + new_figure->setMatrix( QSFigure::VZCoord, z_col ); + new_figure->setMatrix( QSFigure::VTableI, triangles ); + m_workbook->execute( new KSCmdAddDataset(new_figure) ); + } + + if ( !tr_object->error().isEmpty() ) + QMessageBox::warning ( NULL, tr("Errors and warnings"), tr_object->error(), QMessageBox::Ok, 0, 0 ); + + delete tr_object; + break; + } + } + } + } + +// curr_axes->plotAdd( new_figure ); +//-----------------------------------------------------------------------------// + +void KSWorksheetDlg::slot_progress( int percent, bool *cancel ) + { + if ( m_progress_dlg ) { + m_progress_dlg->setProgress( percent ); + qApp->processEvents(); + *cancel = m_progress_dlg->wasCancelled(); + } + } + +//-----------------------------------------------------------------------------// + +void KSWorksheetDlg::slotNewFigureTrajectory() + { + KSSheet *curr_sheet = get_sheet(); + if ( !curr_sheet ) return; + QSAxes *curr_axes = get_axes(); + if ( !curr_axes ) return; + + int column_x = -1; + int column_y = -1; + int column_z = -1; + int columns = curr_sheet->matrix(0) ? curr_sheet->matrix(0)->cols() : 0; + for(int curr_col=0;curr_col<columns;curr_col++) { + if ( curr_sheet->isColumnDataPresent(curr_col) ) { + switch( curr_sheet->columnData(curr_col).type ) { + case KSSheet::ColumnX: column_x = curr_col; break; + case KSSheet::ColumnY: column_y = curr_col; break; + case KSSheet::ColumnZ: column_z = curr_col; break; + default: break; + } + if ( column_x >= 0 && + column_y >= 0 && + column_z >= 0 ) { + QSFigure *new_figure = new QSFigure( curr_axes ); + set_column( curr_sheet, column_x, new_figure, QSFigure::VXCoord ); + set_column( curr_sheet, column_y, new_figure, QSFigure::VYCoord ); + set_column( curr_sheet, column_z, new_figure, QSFigure::VZCoord ); + m_workbook->execute( new KSCmdAddDataset(new_figure) ); + break; + } + } + } + + QString error; + if ( column_x < 0 ) error += tr("Couldn't find the X column \n"); + if ( column_y < 0 ) error += tr("Couldn't find the Y column \n"); + if ( column_z < 0 ) error += tr("Couldn't find the Z column \n"); + if ( !error.isEmpty() ) QMessageBox::warning ( NULL, tr("Warning"), error, QMessageBox::Ok, 0, 0 ); + } + +//curr_axes->plotAdd( new_figure ); + +//-----------------------------------------------------------------------------// + +void KSWorksheetDlg::toggleStatusBar() +{ +/* + if (m_show_statusbar->isChecked()) + statusBar()->show(); + else + statusBar()->hide(); + +} + +//-----------------------------------------------------------------------------// + +void KSWorksheetDlg::toggleToolBar() +{ + + if (m_show_toolbar->isChecked()) + toolBar()->show(); + else + toolBar()->hide(); + +} + +//-----------------------------------------------------------------------------// + +void KSWorksheetDlg::slotConfAccels() +{ + //KKeyDialog::configureKeys( actionCollection(), "kmatplotworksheet.rc" ); +} + +//-----------------------------------------------------------------------------// + +void KSWorksheetDlg::slotEditToolbars() +{ + //KEditToolbar dlg( actionCollection(), "kmatplotworksheet.rc" ); + //dlg.exec(); + //if ( dlg.exec() ) { applyMainWindowSettings( KGlobal::config(), "MainWindow" ); } +} + +//--------------------------------------------------------------------// + +void KSWorksheetDlg::slotSettingsPanel() + { + m_settings_panel_visible = !m_settings_panel_visible; + make_settings_panel(); + } + +//--------------------------------------------------------------------// + +void KSWorksheetDlg::slotImportData() + { + KSImportDlg d( m_workbook, m_chan_list->dataObject() ); + if ( d.exec() == QFileDialog::Accepted ) d.loadAll(); + } + +//-----------------------------------------------------------------------------// + +void KSWorksheetDlg::slotExportData() + { + KSExportDlg d( m_chan_list->dataObject() ); + if ( d.exec() == QFileDialog::Accepted ) d.saveAll(); + } + +//--------------------------------------------------------------------// + +void KSWorksheetDlg::slot_refresh_object_list() + { + } + +//--------------------------------------------------------------------// + +void KSWorksheetDlg::slot_channel_description( const QString& text ) + { + m_chan_description->setText( text ); + } + +//--------------------------------------------------------------------// + +void KSWorksheetDlg::make_settings_panel() + { + delete m_settings_panel; m_settings_panel = NULL; + KSChannelListItem *citem = m_chan_list->selected(); + if ( citem && citem->isValid() && m_settings_panel_visible ) { + QSMatrix *matrix = citem->dataObject()->matrix(citem->channel()); + if ( matrix ) { + m_settings_panel = KSDataObjectFactory::createCfgPanel( matrix, m_workbook, m_main_view ); + } + if ( m_settings_panel ) { + m_panel_layout->addWidget( m_settings_panel, 2, 0 ); + m_settings_panel->show(); + } + } + } + +//--------------------------------------------------------------------// + +void KSWorksheetDlg::make_editor() + { + // preserve position + QPoint pos; + if ( m_editor ) pos = m_editor->editorContentsPos(); + + delete m_editor; m_editor = NULL; + KSChannelListItem *citem = m_chan_list->selected(); + if ( citem && citem->isValid() ) { + m_editor = KSDataObjectFactory::createEditor( m_workbook, citem->dataObject(), citem->channel(), m_main_view ); + if ( m_editor ) { + m_editor->updateContents(); + // set attributes + m_editor->setColumnTitles( KSDataObjectFactory::channelColumnTitlesFactory(citem->dataObject(),citem->channel()) ); + // show editor + m_panel_layout->addWidget( m_editor->widget(), 1, 0 ); + m_editor->widget()->show(); + m_editor->setEditorContentsPos( pos ); + } + } + } + +//-----------------------------------------------------------// + +void KSWorksheetDlg::slot_channel_selected() + { + /* + // If object was removed calling editorm_modified() causes crash. + if ( editor_modified() || config_panel_modified() ) + if ( confirm(tr(" Apply currently edited data from the worksheet editor ? ")) ) slot_apply(); + + make_settings_panel(); + make_editor(); + } + +//--------------------------------------------------------------------// + +void KSWorksheetDlg::slot_data_changed( QSData *dataObject, int channel ) +// data was changed + { + KSChannelListItem *citem = m_chan_list->selected(); + if ( citem && + citem->isValid() && + citem->dataObject() == dataObject && + ( citem->channel() == channel || channel == -1 ) ) { + + // recreate settings panel if some bigger changes, update contents otherwise + if ( !m_settings_panel || m_settings_panel->editedMatrix() != dataObject->matrix(channel) ) make_settings_panel(); + else m_settings_panel->updateContents(); + + // recreate editor if some bigger changes, update contents otherwise + if ( !m_editor || m_editor->editedMatrix() != dataObject->matrix(channel) ) make_editor(); + else m_editor->updateContents(); + } + } + +//--------------------------------------------------------------------// + +void KSWorksheetDlg::slot_show_menu(QListViewItem*, const QPoint&, int) + { + KSWorkbook *workbook = dynamic_cast<KSWorkbook*>(m_view->workbook()); + if ( !workbook ) return; + + QPopupMenu *menu = new QPopupMenu( m_view ); + int menu_cut = menu->insertItem( tr("Cut") ); + int menu_copy = menu->insertItem( tr("Copy") ); + int menu_copy_all = menu->insertItem( tr("Copy all") ); + int menu_paste = menu->insertItem( tr("Paste") ); + int menu_delete = menu->insertItem( tr("Delete") ); + menu->insertSeparator(); + int menu_raise = menu->insertItem( tr("Raise") ); + int menu_lower = menu->insertItem( tr("Lower") ); + int menu_to_front = menu->insertItem( tr("Bring to Front") ); + int menu_to_back = menu->insertItem( tr("Send to Back") ); + + KSSheet *selected_sheet = dynamic_cast<KSSheet*>(selectedObject()); + + if ( !selected_sheet ) { + menu->setItemEnabled( menu_cut, FALSE ); + menu->setItemEnabled( menu_copy, FALSE ); + menu->setItemEnabled( menu_copy_all, FALSE ); + menu->setItemEnabled( menu_delete, FALSE ); + menu->setItemEnabled( menu_raise, FALSE ); + menu->setItemEnabled( menu_lower, FALSE ); + menu->setItemEnabled( menu_to_front, FALSE ); + menu->setItemEnabled( menu_to_back, FALSE ); + } + + int item_id = menu->exec(QCursor::pos()); + + if ( item_id == menu_cut ) { + slotCutSheet(); + } + else if ( item_id == menu_copy ) { + slotCopySheet(); + } + else if ( item_id == menu_copy_all ) { + slotCopyAllSheet(); + } + else if ( item_id == menu_paste ) { + slotPasteSheet(); + } + else if ( item_id == menu_delete ) { + slotDeleteSheet(); + } + else if ( item_id == menu_to_front ) { + slotBringToFrontSheet(); + } + else if ( item_id == menu_to_back ) { + slotSendToBackSheet(); + } + else if ( item_id == menu_raise ) { + slotRaiseSheet(); + } + else if ( item_id == menu_lower ) { + slotLowerSheet(); + } + } +//--------------------------------------------------------------------// + +void KSWorksheetDlg::slotCutSheet() + { + KSSheet *selected_sheet = dynamic_cast<KSSheet*>(selectedObject()); + if ( selected_sheet ) { + KSObjectFactory factory( m_workbook ); + factory.copyKSSheetToClipboard(selected_sheet); + m_workbook->execute(new KSCmdRemoveSheet(selected_sheet,m_workbook->sheets())); + } + } + +//--------------------------------------------------------------------// + +void KSWorksheetDlg::slotCopySheet() + { + KSSheet *selected_sheet = dynamic_cast<KSSheet*>(selectedObject()); + if ( selected_sheet ) { + KSObjectFactory factory( m_workbook ); + factory.copyKSSheetToClipboard(selected_sheet); + } + } + +//--------------------------------------------------------------------// + +void KSWorksheetDlg::slotCopyAllSheet() + { + KSSheet *selected_sheet = dynamic_cast<KSSheet*>(selectedObject()); + if ( selected_sheet ) { + KSObjectFactory factory( m_workbook ); + factory.setFlags( KSObjectFactory::CopyAllData ); + factory.copyKSSheetToClipboard(selected_sheet); + } + } + +//--------------------------------------------------------------------// + +void KSWorksheetDlg::slotPasteSheet() + { + KSObjectFactory factory( m_workbook ); + KSSheet *new_sheet = factory.pasteKSSheetFromClipboard( m_workbook->sheets() ); + if ( new_sheet ) m_workbook->execute(new KSCmdAddSheet(new_sheet,m_workbook->sheets())); + } + +//--------------------------------------------------------------------// + +void KSWorksheetDlg::slotDeleteSheet() + { + KSSheet *selected_sheet = dynamic_cast<KSSheet*>(selectedObject()); + if ( selected_sheet ) { + m_workbook->execute(new KSCmdRemoveSheet(selected_sheet,m_workbook->sheets())); + } + } + +//--------------------------------------------------------------------// + +void KSWorksheetDlg::slotBringToFrontSheet() + { + KSSheet *selected_sheet = dynamic_cast<KSSheet*>(selectedObject()); + if ( selected_sheet ) { + m_workbook->execute(new KSCmdSheetOrder(KSCmdSheetOrder::ToFront,selected_sheet,m_workbook->sheets())); + } + } + +//--------------------------------------------------------------------// + +void KSWorksheetDlg::slotSendToBackSheet() + { + KSSheet *selected_sheet = dynamic_cast<KSSheet*>(selectedObject()); + if ( selected_sheet ) { + m_workbook->execute(new KSCmdSheetOrder(KSCmdSheetOrder::ToBack,selected_sheet,m_workbook->sheets())); + } + } + +//--------------------------------------------------------------------// + +void KSWorksheetDlg::slotRaiseSheet() + { + KSSheet *selected_sheet = dynamic_cast<KSSheet*>(selectedObject()); + if ( selected_sheet ) { + m_workbook->execute(new KSCmdSheetOrder(KSCmdSheetOrder::Raise,selected_sheet,m_workbook->sheets())); + } + } + +//--------------------------------------------------------------------// + +void KSWorksheetDlg::slotLowerSheet() + { + KSSheet *selected_sheet = dynamic_cast<KSSheet*>(selectedObject()); + if ( selected_sheet ) { + m_workbook->execute(new KSCmdSheetOrder(KSCmdSheetOrder::Lower,selected_sheet,m_workbook->sheets())); + } + } +*/ \ No newline at end of file diff --git a/kmatplot/ksworksheetdlg.h b/kmatplot/ksworksheetdlg.h new file mode 100644 index 0000000..3fac55b --- /dev/null +++ b/kmatplot/ksworksheetdlg.h @@ -0,0 +1,188 @@ +/*************************************************************************** + ksworksheetdlg.h + ------------------- + begin : Tue Mar 6 2001 + copyright : (C) 2001 by Kamil Dobkowski + email : kamildobk@poczta.onet.pl + ***************************************************************************/ + +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + +#ifndef KSWORKSHEETDLG_H +#define KSWORKSHEETDLG_H + + /* +#include "ksworkbook.h" +#include "widgets/qsdata.h" +//#include <qmainwindow.h> +#include<qwidget.h> + +class QLabel; +class QGridLayout; +class QPushButton; +class QProgressDialog; +class QComboBox; +class QTabBar; +class QListView; +class QListViewItem; +class KSChannelList; +class KSChannelListItem; +class QAction; +class QSPlotView; +class KSMatrixEditorInterf; +class KSMPanel; +class QSAxes; +class KSSheet; +class KSCmdAddDatasetGroup; + + +class KSWorksheetDlg : public QWidget + { + Q_OBJECT + public: + KSWorksheetDlg( KSWorkbook *workbook, QSPlotView *view, QWidget *parent=0, const char *name=0 ); + ~KSWorksheetDlg(); + void setCurrentPage( int index ); + QSPage *currentPage() const { return m_curr_page; } + void setCurrentObject( QSData *index ); + QSData *currentObject() const { return m_curr_object; } + + QSData *selectedObject() const; + int selectedChannel() const; + QSMatrix *selectedMatrix() const; + + public slots: + virtual void slotNewSheet(); + virtual void slotNewMatrix(); + virtual void slotNewReference(); + virtual void slotNewString(); + virtual void slotNewFormula(); + + virtual void slotImportData(); + virtual void slotExportData(); + + virtual void slotUndo(); + virtual void slotRedo(); + virtual void slotCut(); + virtual void slotCopy(); + virtual void slotCopyAll(); + virtual void slotPaste(); + virtual void slotDelete(); + virtual void slotDetach(); + virtual void slotTranspose(); + + virtual void slotCutSheet(); + virtual void slotCopySheet(); + virtual void slotCopyAllSheet(); + virtual void slotPasteSheet(); + virtual void slotDeleteSheet(); + virtual void slotBringToFrontSheet(); + virtual void slotSendToBackSheet(); + virtual void slotRaiseSheet(); + virtual void slotLowerSheet(); + + virtual void slotNewSeriesAuto(); + virtual void slotNewPixmapDirect(); + virtual void slotNewContourDirect(); + virtual void slotNewContourDelunay(); + virtual void slotNewSurfaceDirect(); + virtual void slotNewSurfaceDelunay(); + virtual void slotNewFigureTrajectory(); + + virtual void slotSettingsPanel(); + virtual void slotConfAccels(); + virtual void slotEditToolbars(); + virtual void toggleStatusBar(); + virtual void toggleToolBar(); + + + private: + KSWorkbook *m_workbook; + QSPlotView *m_view; + + QSPage *m_curr_page; + QSData *m_curr_object; + int m_curr_channel; + + QWidget *m_main_view; + QComboBox *m_page_list; + QListView *m_object_list; + KSChannelList *m_chan_list; + + QLabel *m_chan_description; + QGridLayout *m_panel_layout; + QProgressDialog *m_progress_dlg; + + KSMatrixEditorInterf *m_editor; + KSMPanel *m_settings_panel; + + QAction *m_new_sheet; + QAction *m_new_matrix; + QAction *m_new_string; + QAction *m_new_formula; + QAction *m_new_reference; + QAction *m_import_data; + QAction *m_export_data; + + QAction *m_close; + + QAction *m_undo; + QAction *m_redo; + QAction* m_cut; + QAction* m_copy; + QAction* m_copy_all; + QAction* m_paste; + QAction* m_delete; + + QAction *m_transpose; + QAction *m_detach; + + QAction *m_series; + QAction *m_pixmap; + QAction *m_contour; + QAction *m_contour_delunay; + QAction *m_surface; + QAction *m_surface_delunay; + QAction *m_figure_trajectory; + + + QMap<int,QSData*> m_objects; + bool m_settings_panel_visible; + + void make_settings_panel(); + void make_editor(); + bool confirm( const QString& message ); + KSSheet *get_sheet(); + QSAxes *get_axes(); + void add_new_series( KSCmdAddDatasetGroup *cmd, QSAxes *axes, KSSheet *m, int column_x, int column_y, int column_dx, int column_dy ); + void set_column( KSSheet *src_sheet, int src_column, QSData *dst_object, int dst_channel ); + bool confirm_new_matrix( KSChannelListItem *citem ); + + void recreate_page_list(); + void update_page_list(); + void recreate_object_list(); + void update_object_list(); + + private slots: + void slot_refresh_object_list(); + void slot_data_changed( QSData *object, int channel ); + void slot_channel_description( const QString& text ); + void slot_progress( int percent, bool *cancel ); + void slot_page_selected(int); + void slot_page_list_changed(); + void slot_object_selected( QListViewItem * ); + void slot_object_list_changed(); + void slot_channel_selected(); + void slot_new_undo(); + void slot_new_redo(); + void slot_show_menu(QListViewItem*, const QPoint&, int); + }; +*/ +#endif diff --git a/kmatplot/ksworkspace.cpp b/kmatplot/ksworkspace.cpp new file mode 100644 index 0000000..a10d4b5 --- /dev/null +++ b/kmatplot/ksworkspace.cpp @@ -0,0 +1,301 @@ +/*************************************************************************** + ksworkspace.cpp - description + ------------------- + begin : Thu Jan 17 2002 + copyright : (C) 2002 by kamil + email : kamil@localhost.localdomain + ***************************************************************************/ + +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + +#include "ksworkspace.h" +#include"kmatplotshell.h" +#include"pixmaps/action_windows.xpm" + +#include<qworkspace.h> +#include<qlayout.h> +#include<qpushbutton.h> +#include<qhbuttongroup.h> +#include<qpopupmenu.h> +#include<qaction.h> +#include<qcursor.h> + +KSWorkspace::KSWorkspace( KMatplotShell *shell, const char *name ) +: QWidget(shell,name) + { + m_shell = shell; + QVBoxLayout *layout = new QVBoxLayout( this ); + m_workspace = new QWorkspace( this ); + connect( m_workspace, SIGNAL(windowActivated(QWidget*)), this, SLOT(slot_window_activated(QWidget*)) ); + m_button_bar = new QWidget( this ); + m_button_bar->setFixedHeight( 22 ); + m_button_bar->installEventFilter( this ); + layout->addWidget( m_workspace ); + layout->addWidget( m_button_bar ); + + QHBoxLayout *button_bar_layout = new QHBoxLayout( m_button_bar ); + m_buttons = new QHButtonGroup( m_button_bar ); + m_buttons->setExclusive( TRUE ); + m_buttons->setInsideMargin( 0 ); + m_buttons->setInsideSpacing( 0 ); + button_bar_layout->addWidget( m_buttons ); + button_bar_layout->addStretch( 1 ); + } + +//--------------------------------------------------------------------------// + +KSWorkspace::~KSWorkspace() + { + } + +//--------------------------------------------------------------------------// + +KSWorkspaceWindow *KSWorkspace::activeWindow() const + { + return dynamic_cast<KSWorkspaceWindow*>(m_workspace->activeWindow()); + } + +//--------------------------------------------------------------------------// + +KSWindowButton *KSWorkspace::addWindow( KSWorkspaceWindow *w ) + { + KSWindowButton *new_button = new KSWindowButton( w, m_buttons ); + new_button->show(); + return new_button; + } + +//--------------------------------------------------------------------------// + +void KSWorkspace::removeWindow( KSWorkspaceWindow *w ) + { + if ( w && w->isActive() ) windowDeactivate( w ); + if ( w ) delete w->button(); + } + +//--------------------------------------------------------------------------// + +void KSWorkspace::windowActivate( KSWorkspaceWindow *w ) + { + if ( w && !w->isActive() ) { + w->activated(); + w->setActive( TRUE ); + if ( w->button() ) w->button()->setOn( TRUE ); + m_shell->objectContainer()->setWidget( w->createObjectPanel(m_shell->objectContainer()) ); + m_shell->propertyContainer()->setWidget( w->createPropertyPanel(m_shell->propertyContainer()) ); + } + } + +//--------------------------------------------------------------------------// + +void KSWorkspace::windowDeactivate( KSWorkspaceWindow *w ) + { + if ( w && w->isActive() ) { + w->deactivated(); + w->setActive( FALSE ); + if ( w->button() ) w->button()->setOn( FALSE ); + m_shell->objectContainer()->setWidget( NULL ); + m_shell->propertyContainer()->setWidget( NULL ); + m_shell->disableCustomActions(); + } + } + +//--------------------------------------------------------------------------// + +void KSWorkspace::slot_window_activated( QWidget *w ) + { + QWidgetList window_list = m_workspace->windowList(); + for ( QWidget *curr_widget = window_list.first(); curr_widget; curr_widget = window_list.next() ) { + KSWorkspaceWindow *curr_window = dynamic_cast<KSWorkspaceWindow*>(curr_widget); + if ( curr_window && curr_window->isActive() && curr_widget != w ) windowDeactivate( curr_window ); + } + KSWorkspaceWindow *window = dynamic_cast<KSWorkspaceWindow*>(w); + if ( window && !window->isActive() ) windowActivate( window ); + } + +//--------------------------------------------------------------------------// + +bool KSWorkspace::eventFilter( QObject *o, QEvent *e ) + { + if ( e->type() == QEvent::ContextMenu && o == m_button_bar ) { + ((QContextMenuEvent *)e)->accept(); + QPopupMenu *windows = new QPopupMenu( this ); + QPopupMenu *new_window = new QPopupMenu( windows ); + windows->insertItem( tr("New window"), new_window ); + m_shell->m_new_page_view_win->addTo( new_window ); + m_shell->m_new_worksheet_win->addTo( new_window ); + m_shell->m_new_edit_data_win->addTo( new_window ); + windows->insertSeparator(); + m_shell->m_restore_windows->addTo( windows ); + m_shell->m_maximize_windows->addTo( windows ); + m_shell->m_minimize_windows->addTo( windows ); + windows->insertSeparator(); + m_shell->m_hide_window->addTo( windows ); + m_shell->m_show_window->addTo( windows ); + windows->insertSeparator(); + m_shell->m_close_window->addTo( windows ); + windows->insertSeparator(); + m_shell->m_tile_windows->addTo( windows ); + m_shell->m_cascade_windows->addTo( windows ); + windows->exec(QCursor::pos()); delete windows; + return TRUE; + } + return FALSE; + } + +//--------------------------------------------------------------------------// +//--------------------------------------------------------------------------// +//--------------------------------------------------------------------------// +//--------------------------------------------------------------------------// +//--------------------------------------------------------------------------// +//--------------------------------------------------------------------------// + + + +KSWorkspaceWindow::KSWorkspaceWindow( KSWorkspace *workspace, const QString& caption, const QPixmap& icon, WFlags f ) +:QWidget( workspace->workspace(), "workspace_window", f | WDestructiveClose ) + { + m_contents = NULL; + m_workspace = workspace; + m_active = false; + setCaption( caption ); + setIcon( icon ); + m_button = m_workspace->addWindow( this ); + } + +//--------------------------------------------------------------------------// + +KSWorkspaceWindow::~KSWorkspaceWindow() + { + m_workspace->removeWindow( this ); + } + +//--------------------------------------------------------------------------// + +void KSWorkspaceWindow::setContents( QWidget *contents ) + { + delete m_contents; + m_contents = contents; + if ( m_contents ) { + m_contents->move( 0, 0 ); + m_contents->resize( size() ); + m_contents->show(); + } + } + +//--------------------------------------------------------------------------// + +void KSWorkspaceWindow::setActive( bool enable ) + { + m_active = enable; + } + +//--------------------------------------------------------------------------// + +void KSWorkspaceWindow::resizeEvent( QResizeEvent * ) + { + if ( m_contents ) { + m_contents->move( 0, 0 ); + m_contents->resize( size() ); + } + } + +//--------------------------------------------------------------------------// + +void KSWorkspaceWindow::focusInEvent( QFocusEvent *event ) + { + QWidget::focusInEvent( event ); + } + +//--------------------------------------------------------------------------// + +void KSWorkspaceWindow::focusOutEvent( QFocusEvent *event ) + { + QWidget::focusOutEvent( event ); + } + +//--------------------------------------------------------------------------// + +void KSWorkspaceWindow::setTitle( const QString& newTitle ) + { + setCaption( newTitle ); + if ( button() ) button()->setText( newTitle ); + } + +//--------------------------------------------------------------------------// +//--------------------------------------------------------------------------// +//--------------------------------------------------------------------------// +//--------------------------------------------------------------------------// +//--------------------------------------------------------------------------// + +KSWindowButton::KSWindowButton( KSWorkspaceWindow *window, QWidget *parent ) +: QPushButton( parent ) + { + m_window = window; + setText( window->caption() ); + QPixmap pixmap = *window->icon(); + pixmap.resize( 10, 10 ); + setIconSet( pixmap ); + setFixedHeight( 22 ); + setMinimumWidth( 5 ); + setFont( QFont("Arial",9) ); + setToggleButton( TRUE ); + connect( this, SIGNAL(pressed()), this, SLOT(slot_button_pressed()) ); + } + +//--------------------------------------------------------------------------// + +KSWindowButton::~KSWindowButton() + { + } + +//--------------------------------------------------------------------------// + +void KSWindowButton::slot_button_pressed() + { + m_window->setFocus(); + } + +//--------------------------------------------------------------------------// + +void KSWindowButton::contextMenuEvent( QContextMenuEvent *e ) + { + QPopupMenu *menu = new QPopupMenu( this ); + e->accept(); + int restore_id = menu->insertItem(tr("Restore")); + int maximize_id = menu->insertItem(tr("Maximize")); + int minimize_id = menu->insertItem(tr("Minimize")); + menu->insertSeparator(); + int hide_id = menu->insertItem(tr("Hide")); + int show_id = menu->insertItem(tr("Show")); + menu->insertSeparator(); + int close_id = menu->insertItem(tr("Close")); + + int selected_id = menu->exec(QCursor::pos()); delete menu; + + if ( selected_id == restore_id ) { + m_window->showNormal(); + } + else if ( selected_id == maximize_id ) { + m_window->showMaximized(); + } + else if ( selected_id == minimize_id ) { + m_window->showMinimized(); + } + else if ( selected_id == hide_id ) { + m_window->hide(); + } + else if ( selected_id == show_id ) { + m_window->show(); + } + else if ( selected_id == close_id ) { + // ups we are deleting ourselves + m_window->close(); + } + } diff --git a/kmatplot/ksworkspace.h b/kmatplot/ksworkspace.h new file mode 100644 index 0000000..ed7fda4 --- /dev/null +++ b/kmatplot/ksworkspace.h @@ -0,0 +1,204 @@ +/*************************************************************************** + ksworkspace.h - description + ------------------- + begin : Thu Jan 17 2002 + copyright : (C) 2002 by kamil + email : kamil@localhost.localdomain + ***************************************************************************/ + +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + +#ifndef KSWORKSPACE_H +#define KSWORKSPACE_H + +#include <qwidget.h> +#include <qstring.h> +#include <qpixmap.h> +#include <qpushbutton.h> + +class QAction; +class QWorkspace; +class QPushButton; +class QHButtonGroup; +class KMatplotShell; +class KSWorkspaceWindow; +class KSWindowButton; + +/** + * MDI interface for KSWorkspace windows. + *@author kamil + */ +class KSWorkspace : public QWidget { + friend class KSWorkspaceWindow; + Q_OBJECT + public: + /** + * Constructor + */ + KSWorkspace( KMatplotShell *shell, const char *name=0 ); + /** + * Destructor + */ + virtual ~KSWorkspace(); + QWorkspace *workspace() const { return m_workspace; } + KMatplotShell *shell() const { return m_shell; } + KSWorkspaceWindow *activeWindow() const; + virtual bool eventFilter( QObject *o, QEvent *e ); + + protected: + /** + * This is called by the contructor of the workspace window. It creates window button. + */ + KSWindowButton *addWindow( KSWorkspaceWindow *w ); + /** + * Called form KSWorkspaceWindow destructor. Deactivates window if it is active and deletes + * window button. + */ + void removeWindow( KSWorkspaceWindow *w ); + /** + * Called when window 'w' is activated. Sets window active, sets window button to 'on' + * creates object and property panels. + */ + void windowActivate( KSWorkspaceWindow *w ); + /** + * Called when window 'w' is deactivated. Deactivates window, sets window button to 'off', + * deletes object and property panel. + */ + void windowDeactivate( KSWorkspaceWindow *w ); + QWorkspace *m_workspace; + KMatplotShell *m_shell; + QWidget *m_button_bar; + QHButtonGroup *m_buttons; + + protected slots: + void slot_window_activated( QWidget *w ); + }; + + +//--------------------------------------------------------------------// + +/** + * MDI child window of KSWorkspace.. + */ +class KSWorkspaceWindow : public QWidget { + friend class KSWorkspace; + public: + /** + * Constructor. + */ + KSWorkspaceWindow( KSWorkspace *workspace, const QString& caption, const QPixmap& icon, WFlags f=0 ); + /** + * Destructor. + */ + virtual ~KSWorkspaceWindow(); + /** + * Sets caption and a button title. + */ + void setTitle( const QString& newTitle ); + /** + * Return caption. + */ + QString title() const { return caption(); } + /** + * Returns if the window is active. + */ + bool isActive() const { return m_active; } + /** + * Sets the main widget. + */ + void setContents( QWidget *contents ); + /** + * Returns the main widget. + */ + QWidget *contents() const { return m_contents; } + /** + * Returns a button attached to this window. + */ + KSWindowButton *button() const { return m_button; } + /** + * Called when window is activated( gains focus ). + */ + virtual void activated() {} + /** + * Called when window is deactivated. + */ + virtual void deactivated() {} + /** + * Action cut called in the main window + */ + virtual void cut() {} + /** + * Action copy called in the main window + */ + virtual void copy() {} + /** + * Action copyAll called in the main window + */ + virtual void copyAll() {} + /** + * Action paste called in the main window + */ + virtual void paste() {} + /** + * Action delete called in the main window + */ + virtual void del() {} + /** + * The main window - KMatplotShell routes called actions to the currently active + * window by this fuction. Notice + * that the standard actions: cut, sopy, paste, delete, are not + * routed by this function but a special functions are called directly. + */ + virtual void doAction( QAction* /*action*/ ) {} + /** + * Reimplement this function to create an object ( side ) panel. + * This panel is created when windows becomes active and is deleted + * when it becomes inactive. + */ + virtual QWidget *createObjectPanel( QWidget *parent ) { return NULL; } + /** + * Reimplement this function to create an property ( bottom ) panel. + * This panel is created when windows becomes active and is deleted + * when it becomes inactive. + */ + virtual QWidget *createPropertyPanel( QWidget *parent ) { return NULL; } + + protected: + virtual void setActive( bool enable ); + virtual void resizeEvent( QResizeEvent *event ); + virtual void focusInEvent( QFocusEvent *event ); + virtual void focusOutEvent( QFocusEvent *event ); + KSWorkspace *m_workspace; + QWidget *m_contents; + KSWindowButton *m_button; + bool m_active; + }; + +//--------------------------------------------------------------------// + +/* + * Internal + */ +class KSWindowButton : public QPushButton + { + Q_OBJECT + public: + KSWindowButton( KSWorkspaceWindow *window, QWidget *parent ); + virtual ~KSWindowButton(); + virtual KSWorkspaceWindow *window() const { return m_window; } + protected: + KSWorkspaceWindow *m_window; + virtual void contextMenuEvent ( QContextMenuEvent *e ); + protected slots: + void slot_button_pressed(); + + }; + +#endif diff --git a/kmatplot/main.cpp b/kmatplot/main.cpp new file mode 100644 index 0000000..51647e6 --- /dev/null +++ b/kmatplot/main.cpp @@ -0,0 +1,73 @@ +/*************************************************************************** + main.cpp + ------------------- + begin : nie mar 5 14:43:31 CET 2000 + copyright : (C) 2000 by Kamil Dobkowski + email : kamildobk@friko.onet.pl + ***************************************************************************/ + +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + +#include <unistd.h> // open, dup2 +#include <fcntl.h> +#include <qapplication.h> +#include "kssocketio.h" +#include "kmatplotshell.h" +#include "ksglobalsettings.h" +#include "widgets/qsgattr.h" +#include "formula/mpformula.h" +#include "formula/mpsymbols.h" + +#define STDOUT_FD 1 +#define STDERR_FD 2 + +KSSocketIO *kmatplot_socket = NULL; + +int main(int argc, char *argv[]) + { + QApplication app( argc, argv ); + + // load global settings + KSGlobalSettings::load(); + KSGlobalSettings::apply(); + + // load all formula modules + MPFormula::addGlobalSymbols( new MPCommonSymFactory() ); + + // initialize socket + if ( KSGlobalSettings::openSocket() ) kmatplot_socket = new KSSocketIO(); + QCString option_fd; + for( int i=1; i<app.argc()-1; i++ ) { + if ( QCString(app.argv()[i]) == "--fd" ) option_fd = app.argv()[i+1]; + } + if ( !option_fd.isEmpty() ) { + if ( !kmatplot_socket ) kmatplot_socket = new KSSocketIO(); + // send stdout and stderr to /dev/null ... + int null_fd = open("/dev/null",O_WRONLY); + dup2( null_fd, STDOUT_FD ); + dup2( null_fd, STDERR_FD ); + // bind to open socket ( socket is opened before parent process forked ) + // see interface/common.c + kmatplot_socket->setFileDescriptor( option_fd.toUInt() ); + } + + // create the main window + KMatplotShell *shell = new KMatplotShell(); + + // load file if providen in a commandline + if ( app.argc() == 2 ) shell->openFile( app.argv()[1] ); + + // run the app + shell->show(); + app.setMainWidget(shell); + int result = app.exec(); + delete kmatplot_socket; + return result; + } diff --git a/kmatplot/octave/Makefile.am b/kmatplot/octave/Makefile.am new file mode 100644 index 0000000..b174cc3 --- /dev/null +++ b/kmatplot/octave/Makefile.am @@ -0,0 +1,50 @@ +if MAKE_OCT +bindir=$(installoctdir) +plot_scripts = kplot.oct kimage.oct kcontour.oct kmesh.oct ksetapp.oct ksetaxes.oct ksetmatrix.oct kadd.oct kremove.oct kaddaxes.oct kremoveaxes.oct kremoveall.oct +else +plot_scripts = +endif + +bin_SCRIPTS = $(plot_scripts) + +EXTRA_DIST = README.octave octave-common.h kplot.cpp kimage.cpp kcontour.cpp kmesh.cpp ksetapp.cpp ksetaxes.cpp ksetmatrix.cpp kadd.cpp kremove.cpp kremoveall.cpp kaddaxes.cpp kremoveaxes.cpp + +CLEANFILES = kplot.oct kimage.oct kcontour.oct kmesh.oct ksetapp.oct ksetaxes.oct ksetmatrix.oct kadd.oct kremove.oct kremoveall.oct \ + kplot.o kimage.o kcontour.o kmesh.o ksetapp.o ksetaxes.o ksetmatrix.o kadd.o kremove.o kremoveall.o \ + kremoveaxes.oct kaddaxes.oct kaddaxes.o kremoveaxes.o + +kplot.oct: octave-common.h kplot.cpp ../interface/libkmatplot_interface.a + $(makeoct) -v --output kplot.oct -L../interface -lkmatplot_interface kplot.cpp + +kimage.oct: octave-common.h kimage.cpp ../interface/libkmatplot_interface.a + $(makeoct) -v --output kimage.oct -L../interface -lkmatplot_interface kimage.cpp + +kcontour.oct: octave-common.h kcontour.cpp ../interface/libkmatplot_interface.a + $(makeoct) -v --output kcontour.oct -L../interface -lkmatplot_interface kcontour.cpp + +kmesh.oct: octave-common.h kmesh.cpp ../interface/libkmatplot_interface.a + $(makeoct) -v --output kmesh.oct -L../interface -lkmatplot_interface kmesh.cpp + +ksetapp.oct: octave-common.h ksetapp.cpp ../interface/libkmatplot_interface.a + $(makeoct) -v --output ksetapp.oct -L../interface -lkmatplot_interface ksetapp.cpp + +ksetaxes.oct: octave-common.h ksetaxes.cpp ../interface/libkmatplot_interface.a + $(makeoct) -v --output ksetaxes.oct -L../interface -lkmatplot_interface ksetaxes.cpp + +ksetmatrix.oct: octave-common.h ksetmatrix.cpp ../interface/libkmatplot_interface.a + $(makeoct) -v --output ksetmatrix.oct -L../interface -lkmatplot_interface ksetmatrix.cpp + +kadd.oct: octave-common.h kadd.cpp ../interface/libkmatplot_interface.a + $(makeoct) -v --output kadd.oct -L../interface -lkmatplot_interface kadd.cpp + +kremove.oct: octave-common.h kremove.cpp ../interface/libkmatplot_interface.a + $(makeoct) -v --output kremove.oct -L../interface -lkmatplot_interface kremove.cpp + +kremoveall.oct: octave-common.h kremoveall.cpp ../interface/libkmatplot_interface.a + $(makeoct) -v --output kremoveall.oct -L../interface -lkmatplot_interface kremoveall.cpp + +kaddaxes.oct: octave-common.h kaddaxes.cpp ../interface/libkmatplot_interface.a + $(makeoct) -v --output kaddaxes.oct -L../interface -lkmatplot_interface kaddaxes.cpp + +kremoveaxes.oct: octave-common.h kremoveaxes.cpp ../interface/libkmatplot_interface.a + $(makeoct) -v --output kremoveaxes.oct -L../interface -lkmatplot_interface kremoveaxes.cpp \ No newline at end of file diff --git a/kmatplot/octave/README.octave b/kmatplot/octave/README.octave new file mode 100644 index 0000000..cf20a29 --- /dev/null +++ b/kmatplot/octave/README.octave @@ -0,0 +1 @@ +Write command 'kplot(sin(0:0.1:6))' in Octave to see if it works. \ No newline at end of file diff --git a/kmatplot/octave/kadd.cpp b/kmatplot/octave/kadd.cpp new file mode 100644 index 0000000..c1de629 --- /dev/null +++ b/kmatplot/octave/kadd.cpp @@ -0,0 +1,51 @@ +/*************************************************************************** + kadd.cpp + ------------------- + begin : Sun Jun 25 2000 + copyright : (C) 2000 by Kamil Dobkowski + email : kamildobk@friko.onet.pl + ***************************************************************************/ + +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + +#include <octave/oct.h> +#include <iostream.h> +#include <errno.h> +#include "octave-common.h" + +//------------------------------------------------------------------// + +DEFUN_DLD (kadd, args, , +" usage: kadd(type)\n" +"\n" +"Adds a new dataset to the current axes:\n" +" 0 - curve\n" +" 1 - image\n" +" 2 - contour\n" +" 3 - surface\n" +" 4 - figure\n" +"See also: kremove, kremoveall, kaddaxes, kremoveaxes, ksetapp, ksetplot, kplot, kimage, kcontour, kmesh, ksetmatrix\n" ) +{ + int dataset_number = -1; + int type = (int )args(0).double_value(); + if ( type < 0 || type > 4 ) { + error("Type must be 0, 1, 2, 3, 4 ."); + } else { + int socket_fd = plot_connect( appNumber(), NULL, NULL ); + if ( socket_fd == -1 && errno < sys_nerr && errno >= 0 ) { + error( sys_errlist[errno] ); + return octave_value_list(); + } + dataset_number = plot_add_dataset( socket_fd, axesNumber(), (PlotType )type ); + plot_disconnect( socket_fd ); + } + return octave_value_list(1, octave_value((double )dataset_number) ); +} + diff --git a/kmatplot/octave/kaddaxes.cpp b/kmatplot/octave/kaddaxes.cpp new file mode 100644 index 0000000..cb8414e --- /dev/null +++ b/kmatplot/octave/kaddaxes.cpp @@ -0,0 +1,50 @@ +/*************************************************************************** + kaddaxes.cpp + ------------------- + begin : Sun Jun 25 2000 + copyright : (C) 2000 by Kamil Dobkowski + email : kamildobk@friko.onet.pl + ***************************************************************************/ + +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + +#include <octave/oct.h> +#include <iostream.h> +#include <errno.h> +#include "octave-common.h" + +//------------------------------------------------------------------// + +DEFUN_DLD (kaddaxes, args, , +" usage: kaddaxes(type)\n" +"\n" +"Adds a new axes\n" +" 0 - 2d axes\n" +" 1 - 3d axes\n" +" Sets a newly added axes as the active axes. \n" +"See also: kadd, kremove, kremove, kremoveall, ksetapp, ksetplot, kplot, kimage, kcontour, kmesh, ksetmatrix\n" ) +{ + int axes_number = -1; + int type = (int )args(0).double_value(); + if ( type < 0 || type > 1 ) { + error("Type must be 0 or 1."); + } else { + int socket_fd = plot_connect( appNumber(), NULL, NULL ); + if ( socket_fd == -1 && errno < sys_nerr && errno >= 0 ) { + error( sys_errlist[errno] ); + return octave_value_list(); + } + axes_number = plot_add_axes( socket_fd, type ); + if ( axes_number > 0 ) setAxes( axes_number ); + plot_disconnect( socket_fd ); + } + return octave_value_list(1, octave_value((double )axes_number) ); +} + diff --git a/kmatplot/octave/kcontour.cpp b/kmatplot/octave/kcontour.cpp new file mode 100644 index 0000000..0e07aad --- /dev/null +++ b/kmatplot/octave/kcontour.cpp @@ -0,0 +1,99 @@ +/*************************************************************************** + kmesh.cc + ------------------- + begin : Sun Jun 25 2000 + copyright : (C) 2000 by Kamil Dobkowski + email : kamildobk@friko.onet.pl + ***************************************************************************/ + +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + +#include <octave/oct.h> +#include <iostream.h> +#include <errno.h> +#include "octave-common.h" + +DEFUN_DLD (kcontour, args, , +" usage: kcontour(z)\n" +" kcontour(x,y,z)\n" +"\n" +"See also: ksetapp, ksetaxes, kadd, kremove, kremoveall, kaddaxes, kremoveaxes, kplot, kimage, kmesh, ksetmatrix" ) +{ + octave_value_list result(1, octave_value( -1.0) ); + + int nargin = args.length(); + if ( nargin != 1 && nargin != 3 ) { + error("wrong number of arguments"); + return result; + } + + int socket_fd = plot_connect( appNumber(), NULL, NULL ); + if ( socket_fd == -1 && errno < sys_nerr && errno >= 0 ) { + error( sys_errlist[errno] ); + return result; + } + + int dataset_number = -1; + //plot_remove_all_datasets( socket_fd, axesNumber() ); + + if ( nargin == 1 ) { + // Simple contour + Matrix m = args(0).matrix_value(); + dataset_number = plot_add_dataset( socket_fd, axesNumber(), PlotContour ); + setMatrix( socket_fd, dataset_number, 2, m ); // v + } + else + if ( nargin == 3 ) { + Matrix x = args(0).matrix_value(); + Matrix y = args(1).matrix_value(); + Matrix z = args(2).matrix_value(); + int rows = z.rows(); + int cols = z.cols(); + + // Contour normalize x to row vector + if ( x.cols() == 1 ) { Matrix temp = x.transpose(); x = Matrix(); x = temp; } + else + if ( x.rows() > 1 && x.cols() > 1 ) { + error(" x must be a vector !" ); + plot_disconnect( socket_fd ); + return result; + } + + // normalize y to column vector + if ( y.rows() == 1 ) { Matrix temp = y.transpose(); y = Matrix(); y = temp; } + else + if ( y.rows() > 1 && y.cols() > 1 ) { + error(" y must be a vector !" ); + plot_disconnect( socket_fd ); + return result; + } + + if ( rows != y.rows() ) { + error(" rows (z) must be the same as length (y)"); + plot_disconnect( socket_fd ); + return result; + } + + if ( cols != x.cols() ) { + error("colums (z) must be the same as length (x)"); + plot_disconnect( socket_fd ); + return result; + } + + dataset_number = plot_add_dataset( socket_fd, axesNumber(), PlotContour ); + setMatrix( socket_fd, dataset_number, 0, x ); + setMatrix( socket_fd, dataset_number, 1, y ); + setMatrix( socket_fd, dataset_number, 2, z ); + } + + plot_disconnect( socket_fd ); + return octave_value_list(1, octave_value((double )dataset_number) ); +} + diff --git a/kmatplot/octave/kimage.cpp b/kmatplot/octave/kimage.cpp new file mode 100644 index 0000000..7da44de --- /dev/null +++ b/kmatplot/octave/kimage.cpp @@ -0,0 +1,138 @@ +/*************************************************************************** + kimage.cc + ------------------- + begin : Sun Jun 25 2000 + copyright : (C) 2000 by Kamil Dobkowski + email : kamildobk@friko.onet.pl + ***************************************************************************/ + +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + +#include <octave/oct.h> +//#include <iostream.h> +#include <errno.h> +#include "octave-common.h" + +DEFUN_DLD ( kimage, args, , +" usage: image(V)\n" +" image(X,Y,V)\n" +" image(R,G,B)\n" +" image(X,Y,R,G,B)\n" +"\n" +"See also: kadd, kremove, kremoveall, kaddaxes, kremoveaxes, ksetapp, ksetaxes, kplot, kcontour, kmesh, ksetmatrix" ) +{ + octave_value_list result(1, octave_value(-1.0)); + int nargin = args.length (); + + if ( nargin != 1 && + nargin != 3 && + nargin != 5 ) { + error("wrong number of arguments"); + return result; + } + + int socket_fd = plot_connect( appNumber(), NULL, NULL ); + if ( socket_fd == -1 && errno < sys_nerr && errno >= 0 ) { + error( sys_errlist[errno] ); + return result; + } + + int dataset_number = plot_add_dataset( socket_fd, axesNumber(), PlotImage ); + + if ( nargin == 1 ) { + Matrix m = args(0).matrix_value(); + setMatrix( socket_fd, dataset_number, 2, m ); //r + } + else if ( nargin == 3 ) { + + Matrix xr = args(0).matrix_value(); + Matrix yg = args(1).matrix_value(); + Matrix vb = args(2).matrix_value(); + + int rows = vb.rows(); + int cols = vb.cols(); + + if ( xr.rows() == rows && + xr.cols() == cols && + yg.rows() == rows && + yg.cols() == cols ) { + setMatrix( socket_fd, dataset_number, 2, xr ); //r + setMatrix( socket_fd, dataset_number, 3, yg ); //g + setMatrix( socket_fd, dataset_number, 4, vb ); //b + + } else { + + if ( xr.rows() > 1 ) { Matrix temp = xr.transpose(); xr = Matrix(); xr = temp; } + if ( yg.cols() > 1 ) { Matrix temp = yg.transpose(); yg = Matrix(); yg = temp; } + + if ( xr.cols() != cols+1 || xr.rows() > 1 ) { + error("x must be a vector with size columns(v)+1"); + plot_disconnect( socket_fd ); + return result; + } + + if ( yg.rows() != rows+1 || yg.cols() > 1 ) { + error("y must be a vector with size rows(v)+1"); + plot_disconnect( socket_fd ); + return result; + } + + setMatrix( socket_fd, dataset_number, 0, xr ); //x + setMatrix( socket_fd, dataset_number, 1, yg ); //y + setMatrix( socket_fd, dataset_number, 2, vb ); //v + } + } + + else if ( nargin == 5 ) { + + Matrix x = args(0).matrix_value(); + Matrix y = args(1).matrix_value(); + Matrix r = args(2).matrix_value(); + Matrix g = args(3).matrix_value(); + Matrix b = args(4).matrix_value(); + + int rows = r.rows(); + int cols = r.cols(); + if ( x.rows() > 1 ) { Matrix temp = x.transpose(); x = Matrix(); x = temp; } + if ( y.cols() > 1 ) { Matrix temp = y.transpose(); y = Matrix(); y = temp; } + + if ( x.cols() != cols+1 || x.rows() > 1 ) { + error("x must be a vector with size columns(r)+1"); + plot_disconnect( socket_fd ); + return result; + } + + if ( y.rows() != rows+1 || y.cols() > 1 ) { + error("y must be a vector with size rows(r)+1"); + plot_disconnect( socket_fd ); + return result; + } + + if ( g.rows() != rows || + g.cols() != cols || + b.rows() != rows || + b.cols() != cols ) { + error(" r, g and b must have the same size"); + plot_disconnect( socket_fd ); + return result; + } + + setMatrix( socket_fd, dataset_number, 0, x ); + setMatrix( socket_fd, dataset_number, 1, y ); + setMatrix( socket_fd, dataset_number, 2, r ); + setMatrix( socket_fd, dataset_number, 3, g ); + setMatrix( socket_fd, dataset_number, 4, b ); + } + + plot_disconnect( socket_fd ); + return octave_value_list(1, octave_value((double )dataset_number) ); +} + + diff --git a/kmatplot/octave/kmesh.cpp b/kmatplot/octave/kmesh.cpp new file mode 100644 index 0000000..1d23160 --- /dev/null +++ b/kmatplot/octave/kmesh.cpp @@ -0,0 +1,111 @@ +/*************************************************************************** + kmesh.cc + ------------------- + begin : Sun Jun 25 2000 + copyright : (C) 2000 by Kamil Dobkowski + email : kamildobk@friko.onet.pl + ***************************************************************************/ + +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + +#include <octave/oct.h> +#include <iostream.h> +#include <errno.h> +#include "octave-common.h" + +DEFUN_DLD (kmesh, args, , +" usage: kmesh(z)\n" +" kmesh(x,y,z)\n" +"\n" +"See also: ksetapp, ksetaxes, kadd, kremove, kremoveall, kaddaxes, kremoveaxes, kplot, kimage, kcontour, ksetmatrix" ) +{ + octave_value_list result(1, octave_value(-1.0)); + + int nargin = args.length(); + if ( nargin != 1 && nargin != 3 ) { + error("wrong number of arguments"); + return result; + } + + int socket_fd = plot_connect( appNumber(), NULL, NULL ); + if ( socket_fd == -1 && errno < sys_nerr && errno >= 0 ) { + error( sys_errlist[errno] ); + return result; + } + + int dataset_number = -1; + //plot_remove_all_datasets( socket_fd, axesNumber() ); + + if ( nargin == 1 ) { + // Simple surface + Matrix m = args(0).matrix_value(); + dataset_number = plot_add_dataset( socket_fd, axesNumber(), PlotSurface ); + setMatrix( socket_fd, dataset_number, 0, m ); + } + else + if ( nargin == 3 ) { + Matrix x = args(0).matrix_value(); + Matrix y = args(1).matrix_value(); + Matrix z = args(2).matrix_value(); + int rows = z.rows(); + int cols = z.cols(); + + if ( x.rows() == rows && x.cols() == cols && y.rows() == rows && y.cols() == cols ) { + dataset_number = plot_add_dataset( socket_fd, axesNumber(), PlotFigure ); + // Figure + setMatrix( socket_fd, dataset_number, 0, x ); + setMatrix( socket_fd, dataset_number, 1, y ); + setMatrix( socket_fd, dataset_number, 2, z ); + + } else { + + // Surface + // normalize x to row vector + if ( x.cols() == 1 ) { Matrix temp = x.transpose(); x = Matrix(); x = temp; } + else + if ( x.rows() > 1 && x.cols() > 1 ) { + error(" x must be a vector !" ); + plot_disconnect( socket_fd ); + return result; + } + + // normalize y to column vector + if ( y.rows() == 1 ) { Matrix temp = y.transpose(); y = Matrix(); y = temp; } + else + if ( y.rows() > 1 && y.cols() > 1 ) { + error(" y must be a vector !" ); + plot_disconnect( socket_fd ); + return result; + } + + if ( rows != y.rows() ) { + error(" rows (z) must be the same as length (y)"); + plot_disconnect( socket_fd ); + return result; + } + + if ( cols != x.cols() ) { + error("colums (z) must be the same as length (x)"); + plot_disconnect( socket_fd ); + return result; + } + + dataset_number = plot_add_dataset( socket_fd, axesNumber(), PlotSurface ); + setMatrix( socket_fd, dataset_number, 0, x ); + setMatrix( socket_fd, dataset_number, 1, y ); + setMatrix( socket_fd, dataset_number, 2, z ); + } + } + + plot_disconnect( socket_fd ); + return octave_value_list(1, octave_value((double )dataset_number) ); +} + + diff --git a/kmatplot/octave/kplot.cpp b/kmatplot/octave/kplot.cpp new file mode 100644 index 0000000..8133ba7 --- /dev/null +++ b/kmatplot/octave/kplot.cpp @@ -0,0 +1,119 @@ +/*************************************************************************** + kplot.cc + ------------------- + begin : Sun Jun 25 2000 + copyright : (C) 2000 by Kamil Dobkowski + email : kamildobk@friko.onet.pl + ***************************************************************************/ + +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + +#include <octave/oct.h> +#include <iostream.h> +#include <errno.h> +#include "octave-common.h" + +DEFUN_DLD (kplot, args, , +" usage: kplot(Y)\n" +" kplot(X,Y)\n" +" kplot(X,Y, ...)\n" +"\n" +" If the first argument is a vector and the second is a matrix, the\n" +" the vector is plotted versus the columns (or rows) of the matrix.\n" +" (using whichever combination matches, with columns tried first.)\n" +"\n" +" If the first argument is a matrix and the second is a vector, the\n" +" the columns (or rows) of the matrix are plotted versus the vector.\n" +" (using whichever combination matches, with columns tried first.)\n" +"\n" +" If both arguments are vectors, the elements of y are plotted versus\n" +" the elements of x.\n" +"\n" +" If both arguments are matrices, the columns of y are plotted versus\n" +" the columns of x. In this case, both matrices must have the same\n" +" number of rows and columns and no attempt is made to transpose the\n" +" arguments to make the number of rows match.\n" +"\n" +" If only one argument is given, it is taken as the set of y\n" +" coordinates and the x coordinates are taken to be the indices of the\n" +" elements, starting with 0.\n" +"\n" +" See also: ksetapp, ksetaxes, kadd, kremove, kremoveall, kaddaxes, kremoveaxes, kimage, kcontour, kmesh, ksetmatrix" +) +{ + octave_value_list result(1, octave_value(-1.0)); + int nargin = args.length(); + + int socket_fd = plot_connect( appNumber(), NULL, NULL ); + if ( socket_fd == -1 && errno < sys_nerr && errno >= 0 ) { + error( sys_errlist[errno] ); + return result; + } + + int dataset_number = -1; + + //plot_remove_all_datasets( socket_fd, axesNumber() ); + +// +// Get the next pair of matrices from args +// + int snum = 0; // series number + for( int i=0; i<nargin; i+=2 ) { + Matrix x; + Matrix y; + if ( i+1 < nargin ) { + x = args(i+0).matrix_value(); + y = args(i+1).matrix_value(); + } else { + x = Matrix(); // empty + y = args(i).matrix_value(); + } + /** + * Y = Y.TRANSPOSE() - not working + */ + // normalize to column vectors ( if are row vectors ) + if ( x.cols() > 1 && x.rows() == 1 ) { Matrix temp = x.transpose(); x = Matrix(); x = temp; } + if ( y.cols() > 1 && y.rows() == 1 ) { Matrix temp = y.transpose(); y = Matrix(); y = temp; } + + + // fit vectors to rows or columns + if ( x.cols() == 1 && y.rows() != x.rows() ) { Matrix temp = y.transpose(); y = Matrix(); y = temp; } + if ( y.cols() == 1 && y.rows() != x.rows() ) { Matrix temp = x.transpose(); x = Matrix(); x = temp; } + + if ( x.cols() > 0 && x.rows() != y.rows() ) { + error(" matrix dimensions must match " ); + plot_disconnect( socket_fd ); + return result; + } + + // + // Send to application all series contained in this pair + // + int series = x.cols()>y.cols() ? x.cols() : y.cols(); + for ( int s=0; s<series; s++ ) { + ColumnVector xvector; + ColumnVector yvector; + dataset_number = plot_add_dataset( socket_fd, axesNumber(), PlotCurve ); + if ( x.cols() > 0 ) xvector = (s<x.cols())?x.column(s):x.column(0); + if ( y.cols() > 0 ) yvector = (s<y.cols())?y.column(s):y.column(0); + if ( x.cols() > 0 ) setMatrix( socket_fd, dataset_number, 0, Matrix(xvector) ); + if ( y.cols() > 0 ) setMatrix( socket_fd, dataset_number, 1, Matrix(yvector) ); + snum ++; + } + } + + // + // Disconnect + // + plot_disconnect( socket_fd ); + return octave_value_list( 1, octave_value((double )dataset_number) ); + } + + diff --git a/kmatplot/octave/kremove.cpp b/kmatplot/octave/kremove.cpp new file mode 100644 index 0000000..72cf34c --- /dev/null +++ b/kmatplot/octave/kremove.cpp @@ -0,0 +1,45 @@ +/*************************************************************************** + kremove.cpp + ------------------- + begin : Sun Jun 25 2000 + copyright : (C) 2000 by Kamil Dobkowski + email : kamildobk@friko.onet.pl + ***************************************************************************/ + +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + +#include <octave/oct.h> +#include <iostream.h> +#include <errno.h> +#include "octave-common.h" + +//------------------------------------------------------------------// + +DEFUN_DLD (kremove, args, , +" usage: kremove(dataset_number)\n" +"\n" +"Removes a dataset from a plot.\n" +"See also: kadd, kremoveall, ksetapp, ksetaxes, kaddaxes, kremoveaxes, kplot, kimage, kcontour, kmesh, ksetmatrix\n" ) +{ + int dataset_number = (int )args(0).double_value(); + if ( dataset_number < 0 ) { + error("Invalid dataset number."); + } else { + int socket_fd = plot_connect( appNumber(), NULL, NULL ); + if ( socket_fd == -1 && errno < sys_nerr && errno >= 0 ) { + error( sys_errlist[errno] ); + return octave_value_list(); + } + plot_remove_dataset( socket_fd, axesNumber(), dataset_number ); + plot_disconnect( socket_fd ); + } + return octave_value_list(); +} + diff --git a/kmatplot/octave/kremoveall.cpp b/kmatplot/octave/kremoveall.cpp new file mode 100644 index 0000000..3b8fdc3 --- /dev/null +++ b/kmatplot/octave/kremoveall.cpp @@ -0,0 +1,40 @@ +/*************************************************************************** + kremoveall.cc + ------------------- + begin : Sun Jun 25 2000 + copyright : (C) 2000 by Kamil Dobkowski + email : kamildobk@friko.onet.pl + ***************************************************************************/ + +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + +#include <octave/oct.h> +#include <iostream.h> +#include <errno.h> +#include "octave-common.h" + +//------------------------------------------------------------------// + +DEFUN_DLD (kremoveall, args, , +" usage: kremoveall()\n" +"\n" +"Removes all datasets from a plot\an" +"See also: ksetapp, ksetaxes, kadd, kremove, kaddaxes, kremoveaxes, kplot, kimage, kcontour, kmesh, ksetmatrix\n" ) +{ + int socket_fd = plot_connect( appNumber(), NULL, NULL ); + if ( socket_fd == -1 && errno < sys_nerr && errno >= 0 ) { + error( sys_errlist[errno] ); + return octave_value_list(); + } + plot_remove_all_datasets( socket_fd, axesNumber() ); + plot_disconnect( socket_fd ); + return octave_value_list(); +} + diff --git a/kmatplot/octave/kremoveaxes.cpp b/kmatplot/octave/kremoveaxes.cpp new file mode 100644 index 0000000..45b835e --- /dev/null +++ b/kmatplot/octave/kremoveaxes.cpp @@ -0,0 +1,45 @@ +/*************************************************************************** + kremoveaxes.cpp + ------------------- + begin : Sun Jun 25 2000 + copyright : (C) 2000 by Kamil Dobkowski + email : kamildobk@friko.onet.pl + ***************************************************************************/ + +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + +#include <octave/oct.h> +#include <iostream.h> +#include <errno.h> +#include "octave-common.h" + +//------------------------------------------------------------------// + +DEFUN_DLD (kremoveaxes, args, , +" usage: kremoveaxes(axes_id)\n" +"\n" +"Removes axes.\n" +"See also: kadd, kremove, kremoveall, ksetapp, ksetaxes, kplot, kimage, kcontour, kmesh, ksetmatrix\n" ) +{ + int axes_number = (int )args(0).double_value(); + if ( axes_number < 0 ) { + error("Invalid axes id."); + } else { + int socket_fd = plot_connect( appNumber(), NULL, NULL ); + if ( socket_fd == -1 && errno < sys_nerr && errno >= 0 ) { + error( sys_errlist[errno] ); + return octave_value_list(); + } + plot_remove_axes( socket_fd, axes_number ); + plot_disconnect( socket_fd ); + } + return octave_value_list(); +} + diff --git a/kmatplot/octave/ksetapp.cpp b/kmatplot/octave/ksetapp.cpp new file mode 100644 index 0000000..8f95dfe --- /dev/null +++ b/kmatplot/octave/ksetapp.cpp @@ -0,0 +1,49 @@ +/*************************************************************************** + ksetapp.cc + ------------------- + begin : Sun Jun 25 2000 + copyright : (C) 2000 by Kamil Dobkowski + email : kamildobk@friko.onet.pl + ***************************************************************************/ + +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + +#include <octave/oct.h> +#include <iostream.h> +#include "octave-common.h" + +#define ENV_APP_NUMBER "__kmatplot_app_num__" + +DEFUN_DLD (ksetapp, args, , +" usage: prevAppNumber = ksetapp (newAppNumber)\n" +" currAppNumber = ksetapp()\n" +"\n" +"Sets a new 'KMatplot' application as a plot output." +"Application number must be > 0." +"See also: ksetaxes, kplot, kadd, kremove, kremoveall, kaddaxes, kremoveaxes, kimage, kcontour, kmesh, ksetmatrix" ) +{ + int app_num = appNumber(); + + // + // New app number + // + if ( args.length() > 0 ) { + + int new_app_num = (int )args(0).double_value(); + if ( new_app_num <= 0 ) new_app_num = 1; + + char buff[50]; + sprintf( buff, "%d", new_app_num ); + setenv( ENV_APP_NUMBER, buff, 1 ); + } + + return octave_value_list(1, octave_value((double )app_num) ); +} + diff --git a/kmatplot/octave/ksetaxes.cpp b/kmatplot/octave/ksetaxes.cpp new file mode 100644 index 0000000..d840b4a --- /dev/null +++ b/kmatplot/octave/ksetaxes.cpp @@ -0,0 +1,39 @@ +/*************************************************************************** + ksetaxes.cc + ------------------- + begin : Sun Jun 25 2000 + copyright : (C) 2000 by Kamil Dobkowski + email : kamildobk@friko.onet.pl + ***************************************************************************/ + +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + +#include <octave/oct.h> +#include <iostream.h> +#include "octave-common.h" + +DEFUN_DLD (ksetaxes, args, , +" usage: prevAxesID = ksetaxes(newAxesID)\n" +" currAxesID = ksetaxes()\n" +"\n" +"Sets the current plot window." +"Window number must be > 0." +"See also: ksetapp, kplot, kadd, kremove, kremoveall, kaddaxes, kremoveaxes, kimage, kcontour, kmesh, ksetmatrix" ) +{ + int plot_num = axesNumber(); + + if ( args.length() > 0 ) { + int new_plot_num = (int )args(0).double_value(); + setAxes( new_plot_num ); + } + + return octave_value_list(1, octave_value((double )plot_num) ); +} + diff --git a/kmatplot/octave/ksetmatrix.cpp b/kmatplot/octave/ksetmatrix.cpp new file mode 100644 index 0000000..f1a3357 --- /dev/null +++ b/kmatplot/octave/ksetmatrix.cpp @@ -0,0 +1,54 @@ +/*************************************************************************** + ksetmatrix.cc + ------------------- + begin : Sun Jun 25 2000 + copyright : (C) 2000 by Kamil Dobkowski + email : kamildobk@friko.onet.pl + ***************************************************************************/ + +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + +#include <octave/oct.h> +#include <iostream.h> +#include <errno.h> +#include "octave-common.h" + +//------------------------------------------------------------------// + +DEFUN_DLD (ksetmatrix, args, , +" usage: ksetmatrix(dataset,channel,matrix)\n" +"\n" +"Sets the matrix 'matrix' as channel 'channel' in plot application.\n" +"See also: ksetaxes, ksetplot, kadd, kremove, kremoveall, kaddaxes, kremoveaxes, kplot, kimage, kcontour, kmesh\n" ) +{ + int dataset; + int channel; + if ( args.length() != 3 ) { + error("wrong number of arguments."); + } + else + if ( (dataset=(int )args(0).double_value()) < 0 || + (channel=(int )args(1).double_value()) < 0 ) { + error("channel and dataset number must be >= 0."); + } + else { + int socket_fd = plot_connect( appNumber(), NULL, NULL ); + if ( socket_fd == -1 && errno < sys_nerr && errno >= 0 ) { + error( sys_errlist[errno] ); + return octave_value_list(); + } + Matrix m = args(2).matrix_value(); + setMatrix( socket_fd, dataset, channel, m ); + plot_disconnect( socket_fd ); + } + + return octave_value_list(); +} + diff --git a/kmatplot/octave/octave-common.h b/kmatplot/octave/octave-common.h new file mode 100644 index 0000000..a22f106 --- /dev/null +++ b/kmatplot/octave/octave-common.h @@ -0,0 +1,67 @@ +/*************************************************************************** + octave-common.h + ------------------- + begin : Sun Jun 25 2000 + copyright : (C) 2000 by Kamil Dobkowski + email : kamildobk@friko.onet.pl + ***************************************************************************/ + +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + +#include"../interface/common.h" + +#define ENV_APP_NUMBER "__kmatplot_app_num__" +#define ENV_AXES_NUMBER "__kmatplot_axes_num__" + +//--------------------------------------------------------------------// + +int appNumber() + { + int app_num = 0; + char *app_num_str = getenv( ENV_APP_NUMBER ); + if ( app_num_str ) app_num = atoi( app_num_str ); + if ( app_num <= 0 ) app_num = 1; + return app_num; + } + +//--------------------------------------------------------------------// + +int axesNumber() + { + int axes_num = 0; + char *axes_num_str = getenv( ENV_AXES_NUMBER ); + if ( axes_num_str ) axes_num = atoi( axes_num_str ); + if ( axes_num <= 0 ) axes_num = 1; + return axes_num; + } + +//--------------------------------------------------------------------// + +void setMatrix( int socket_fd, int dataset, int channel, const Matrix& m ) + { + // remember to reorder matrix + if ( m.data() ) + plot_set_channel( socket_fd, axesNumber(), dataset, channel, + EDouble, m.rows(), m.cols(), + m.data(), 0, + m.rows()*sizeof(double), sizeof(double) ); + } + +//--------------------------------------------------------------------// + +void setAxes( int new_axes_number ) + { + if ( new_axes_number <= 0 ) new_axes_number = 1; + char buff[50]; + sprintf( buff, "%d", new_axes_number ); + setenv( ENV_AXES_NUMBER, buff, 1 ); + } + + diff --git a/kmatplot/octave/octave-core b/kmatplot/octave/octave-core new file mode 100644 index 0000000..6e2128b --- /dev/null +++ b/kmatplot/octave/octave-core @@ -0,0 +1 @@ +# Created by Octave 2.1.33, Mon Aug 27 17:28:08 2001 CEST <root@localhost.localdomain> diff --git a/kmatplot/pics/Makefile.am b/kmatplot/pics/Makefile.am new file mode 100644 index 0000000..c8fbf78 --- /dev/null +++ b/kmatplot/pics/Makefile.am @@ -0,0 +1,11 @@ +pics_DATA = graph_surface.png \ + graph_ngsurface.png \ + graph_figure.png \ + graph_xyplot.png \ + graph_contour.png \ + graph_ngcontour.png \ + graph_image.png + +picsdir = $(prefix)/share/kmatplot/pics + +EXTRA_DIST = hi32-app-kmatplot.png hi48-app-kmatplot.png lo16-app-kmatplot.png lo32-app-kmatplot.png diff --git a/kmatplot/pics/graph_contour.png b/kmatplot/pics/graph_contour.png new file mode 100644 index 0000000000000000000000000000000000000000..f1e8c36388877f2215051ee9e2b6ac82b84d4195 GIT binary patch literal 1756 zcmV<21|#{2P)<h;3K|Lk000e1NJLTq001)p001ip0ssI2T1F>}00004XF*Lt006O% z3;baP00006VoOIv0RI600RN!9r;`8x010qNS#tmY3labT3lag+-G2N4000McNliru z(gP0w7aDW`0PX+)23bi&K~#90rCB|18%Gcw2l@dP3ocs&D#U`vHi3#;0(R0WY#2a* zTk9Gnt)YU)!bqE_Fy+#Q48%nkwGs(<uORHwJQl~oKw9n<l>Y%!JZUuA+dIn6K*jNH zclPakyqR6m+9$>s@B6PEY?rp|r+oHm_>O#HjPbrN%3v@E!_fO_KAYE7oqy&w_dX{{ z;+^h6mL!SR`kt`vIg*I%(lSu_Y>e^lZL9do7}M|fH)0~9ieb6URYTnqv{!DCB}oD& zmYIPERAZtWXGvGiXY*FO<<(iX+=KOc4FhPci&m9rHUeT0L?m%IKqbn-VBqM?ZElyA zh^Qjz;yC`QBuzi1>8G^#Ql_CCV2qLaF`WmOBGX#`PfT`cotJW9V@w>!Wh2+?wI>50 z_enaoyc0uksA?#FkCD=eT5I?bzHYT!w|*od#9494qWc};wVg1>g9Av8lrfF3s-f)C zT5E|YTV&1Mrc#Q$tWhn_?x|q8`E1S*VK$(FV8a*#T1jUq5v{IPy<d9A&yST--+~P4 z7#3TOf11Rsu2yo2wKjSd@z2TSL@5P3rL$Bi6|{r8s!uK_<BPFf+S+yvBR$?Mb0uKG zDU1o$8onChL2Io;%~R4@iZO5#zaO2C<j8cE2JL{gLGEiaa5}?kwOf<R$?(<C7}M+Z zqGyq{_Bv>+g*&XZ42y`SAE(XTrVjP!d_+XqB4cDvetKe;*V8$0U1VkTm17H*o6qJi zet&WN{J6W{RZ6YCtd4#=>h*e`|NSgy)wXNAylPwr(9WZsoku%}0k#uI2y?sZO|L7N zwK;6#LA>|<o@%J!=`d&q5&?-!#4=jz=57-vp}WOEVscB7BsZo$hcH2pct}5`Q4}3N zKR$bX)@(MtB*{}8wUTL_+E84Y<Tr0E8efd1uIMm2dwq8H`b=x>AaKA*#1h>4ZjJK7 zTB8P3v^4YC{PB;E*`e@e&<?Ui79B<ou}P_`x=b`jpsH-{wRm^T!ka^7jN^EGF-FN_ zTW*}oCXrL5QJvC$YqK)pcn4*`cSLmZ=gHrrznSR0!kr^Ju<Jsk)Y~_2F(7CMyhIp= z@SAMIHt-qp2wp>VtMHK&cC;}jI*i5_V*s6gm}ZNtwp{}<j7(=~bQooeOxCedWE=<R z1#+7YPlsCT`}EM0%L$^h)9JkX>s>la!LD&X?*7~*A`qKuC=^ZLt39lB_q%jMa(-ko zJh6M2U5C2WZVgX|WtiYKz#0q&Cx4v4#?9R(suM6l(pk!#h^)nU??J}lRkk+oIJY^| zrtCOCurL4uKx-YegW>5A#Ovssew?CM$!OV<OBUNeZ*HTPs;hc#bEn~<8{Y5kciCA% zI~bjhrXQyLe!r~kOOga0XL+z*uf1&`iIWBJ4F-emeiwbg=zQc|1I=pfVGSElN}0rr z{u#w_9ERb1Hs^Z3QT#nE-97LyGE`!_v<FWQoC*t5fqvPptE&}Aq1bPJBQmK75QnG3 ze!u_r&0BO@2Tu>210PJqxuzOwb+yVCS-;<xjh)nAZ9g{yxHorllSG@3=P(Q<G3GWO zUyRX;X|0t~2rSvyIr>{vWx_3INr{Pk8L;}YqC(+=2K1%bBC|`&u;^~v<LH;-6qPM1 zoXJ?2Fy$Hl<;$0o%Smo?COJO;n8fH%2kpQvEm}w!Ti!I6CpqV<|CS1L09bVQx~9|V zD5aPop|P&&=`20^^#~+cL{Nm4+kA34!F2pNQ#^b|cYWIFbl$&z57j0ywe1>gLpPMh zQ=-G`GtzyItE!=R=U%DeGr0x_!RUOn^JwSb=>ZW<E+_CExAS0E(0zBmE3?~s<5D4| zamFn?!vaNh_q%vtcY}&~BKw*}`gh~K8n+vsy2+T>TCfC{OPrnLemEP(7h}5Vy}VM! zx6F<l2DjZd3u7YDGh#7r9;NmqNy0D$xS$<KvXv#jLgWPu%NAAM*I|pdU6i%b9()di z>M#rudH4!1Z@hUdOP3AZHY|}XvgwEE-Vb|-cW9Ry!!S&eBuNsbRPny4LMrZ{{d`7u zyEJ1Ah>8tR)EI`LF$Oy!qGq${1WB2cUD}r-qZ_(X4HfreT;ND|lxZZQ@x@pk*~_H* ydf$(X5wM-2!)Rk)rM1Sj2<}}rA}jk(0OUV_cIi)Jp31iX0000<MNUMnLSTZ4B~1(f literal 0 HcmV?d00001 diff --git a/kmatplot/pics/graph_figure.png b/kmatplot/pics/graph_figure.png new file mode 100644 index 0000000000000000000000000000000000000000..8a945cc19db08388fa4e0dc8ef62e1e72beb6643 GIT binary patch literal 2945 zcmV-{3x4#8P)<h;3K|Lk000e1NJLTq001!n001Zm0ssI2*e8V;00004XF*Lt006O% z3;baP00006VoOIv0RI600RN!9r;`8x010qNS#tmY3labT3lag+-G2N4000McNliru z(gP0w84rhE$%_C03jRq%K~#90&6r(m9M^Tne><8T4wrX#hs#}Rmm)3EwgOAC8rPPk z3Qofb;0CQ71PF>g^eIn4jO3vx5VUy+qG1d7wLqE|BL(tO6wOQeQnW$8yi_2^Mk33q zt2j1EEy-Q(jJO{h&fJ}y{orgKc9$PAWymSe_Fy0GV9!1GcmL<yJNHg(Fc|Rv%#{CY zfD=r894GtrWq<+wh=uRoc$AyGx#F)B0d5z$U9>$&9R9oJArd67n&PSnWK8qy($a}> zVxOEl`}Jk{H`Yka2wWOnPT#PmOmlV|vAVJnyIJIKtz;5^k3xRb_ue*{(}$t%RLEyX zZKsYufowB#&CFagKY!!cJRiv<f4XA-mBroS=y?Dj9DpYL5`MQ>%r7nd$E#o1|L@{u zD9i!al|!a?cPS(v$uuy=?Iw1U=Pm1%G1<vX^5%;DN2V~Ki`)ayr*Nz25dvH&Lm8$m zi|<?W3Rj<m6eO|7aKO7C9kzixcgY8%_UaBIGiq;bqqPB=rum9xU0PZ?fl1z6vH#E% zY1n6N7duWbU<&#HSvU_N+=Xo@!S6qTagM8>9rd-VN0_P<QloZrk476Ipak+5)7lzh z2nrIuKNy@)<Evjb^I6#E!v@hLyDioyxVMW6Pr;X<4?alHK{-b-z;;GD$&1)x6vyq+ zPm)$hDKtXFDF7Cs1^&k}0~(w)O+LQvZomA6lnw*BkVtS#(wQI#(BhPPl%W8h1s58i zX3(Y(g2ECcDOWf@E~fe}xg0_uB_&BHkXsOt&%+c<j#1iZ0Qiq$dVhI&u2f`-encx| zv&EvpYLm1^HRMc!a=?#Z4kT3INf3hMA`EL;SD9WIhN}5e%yjAO34su-ZeTnCH7eTx z%|4ztTFu&c^tJRT%&|Q)`kp0Qpb$1lLN7u)g*G4-V-muEG<?mn?!kw!3!l3Li-;Kj zrWeVd$2d3qg-VLtMRJ#zNK1*PLlz)AOFLpVOD2Pnq1k2~O7PPuKI(DBG><WT_?OEG z1!BluM4HtW&pk<_hMM41hv^ssd`K4Zw?Ta6D_{Q$OU@tzFm#!F(NnT%Ar7LoI}yM{ zirhs%wW#R;<N&(+hbna2oPoaJL6@B#FD)%`bT9bvso3>%B>PY%9AHo3w<tp&Dms1G z47mrl#{PGHv^=qH^;P}1u3wi@ZtjFBkwiBZ=JNH1YfDW8n?ujd&8pUE()9s8;Dap; z1zdn%tzp2A1(D$GJ=($GSUsf%$oohTU;{1sFbyFjz=PQo>)zoM-}`&(+BI@#7Xgty zt4$Wf=~-ZP$JwrV5sDvQWUrjuce}kv6M33GP@cfZjDRXl3@8hLn$GV$V{){f{&RWx z?0~{}yf`FbYK(k3Bo(9I<?~-0bt}EKk~DCYTrw%pXUJdc??=PGva|W1s~FjWZWQ#h zS2taD!>HVp<>teQ8(LY=P}ue`%~9}?PQx<wK|m7fpn(n@&|xRR6yzp|x}!kv{J^?! zKCMn0elITa*Id^V$x$)Y>rIhN9}L+Niz221g!XC$r-oWbmCVPHO?&}RR|z}Z7{6Oa zI=yFEKmp`%uAq&vbWj7b2@)Mj#UfCCdqwezsWbB_p%y-K-L7nu%M}?DhytQei!vga zI$)A^>7d>3lFeY`5HZ&3)ZpHLpEcP}@a;dd4%|jeiw9*i-lGd3;1o>48PFB<v8s1| zXw98hWT(6E{43~2A)oI}Uoz%@yW&#ysO(76XNO@|KU&S_7Y+vN_F)%7fF9^^v`M@a z&K@_89D$UB+_}IwcYqB^P(cF&QY}s^TuAV*-&;;i7N2_df^q&ubOTu3=@-sD17x%L zXkRtNbj5BsZB6=Kx6?lq%!fEIVv;USf~^>>B<8CoM@#{3udMuImb=-*+=;PZ8R$X? z{T3=D2DmF$VJ_{qx_V}zTy>a8`|82kpuANULS!>JV?t~0G(0bK8tws;))_I`F2wQU ze4r4fv0k$tX8J|3C<C?w{yjh57>{_Uph8X|on-Pd*RSGFW%c}dAw+gIfAgc@z_VVf ztEb`zk3rBkGI@PM-`J=)RmZMlJ0qrJBF&pi#}AweaK$u5f(R0M?&U`c9hd;IKzEAR zWiJ07Vtz5HYa+J*G-ZD}ZA_;`d1KA4R)!*tRgt|&1qf^-n{{{kdJ26&X`NLE$w(x? z`qnX#Mocd(E#0c4X1Vhoi98aLN2HQ7xE|UI<Z`GAPN2`u<-2i1`qGy1Aw({l?S)+_ z11aT5Gry~9I>AsG{AO)fu*Lv4WJhq<r4>6tBo1nPxZlYfWruzqA8aT<@*+ei7l>5y z&x4_fv_PLu2vPU@6C!&MsI+NMr89oJQ`z2j9J?0|SC<52GY|=ALk-76QK?O`Jq@aE zSr3bJ$n<5)+N^=busV`Z0NcQJD9n*M!<iSU`sjtr(v#>$z22-fyjs&83iHm-?<J=* zfIgX+N@r?KS=rol9EY9{NWYE?9i&IsV^gpi5}sDgXFvCGkvRIk^Pm9hT^5=cPyk;b z6vRa~cX8XGkP#_RWG`N>J}_nqWU_uc*tR!f>cJ@p>C3RbZKMQyTN{;nzZ3WmTKNum zG(9|>T7vBe>iV1S|J%ob4t09gG~eCFZ&S$d_9PCYs%m=NbJ&lQUmPVkh!VGdSyQzs zfS~UA!Dgja->FM~TuF9SjYaHj(QBy_iI&&WLpJW?)F^lOFL-|!`l|KXw@w5))M;sH zscKO5p-JHkgEig-(FdKv(>!nh#KO$|jjcwY%zoxl5J-t961mbwIh8bq^0>RM+S(?J z=mqpzfWK4M0`O7#G(7qOH$j+C&1cLTHy(L+Jv`HW^BdMLPO&|jErP?F+HeKDbGNZx z4Mb8PD~W{Ywma{<^>%817q^64(mOV8skC0Qt7Y~!fz5kcv|D)4q#>yb)@LY1Dxq$D z`#X;U;-UN9Y$0}8G7n#rT!6xJ*baq1;LS4H0+R-zUPz{eND3(~uikgUeMJaucp{L# zw4H{!9}w=kbywf-b%U1XgH6dni}-MwI}lFj#lQQ>iKTrq)9cI2KeViCc_tkU$m+y( z`husQrJiPf4z#2jiQJ4>b!X5G;)$>w^n0N(ow7I9)&15mj@)({&CuHc2VJ2m+19ZW zxQc3CG2i@`lS}(#CgACK?5xfLyeRPv77V(A)I7}KM&$FXwR5r+8QIxUheS?>{q2p? zY-R$W7s`s$*hP!r0bYxs#japOqoiQHW_>~#J(B6x%E}+VY|g2?9HPVGIf9VPb2wGP zdD<~ZfNse4scA!qWWui28{xj9X|gE`hRUAX*hT9=^I@RkKNLSXWshVUV*Tlt%v{J5 zePo<eoT+J|9Dr1qe`@4bZ|RD1suPRR@6zi6TO|?$LP=@>-6KE&1OHQec{|~o*h@=G zfBjFzxB4jH^&n2G!|**OA}Z@hpRG+=&9L#H<=mHYw<{&i8c$4;jhK(9xHv6JDnE1i z>Nl)U1$44bL%Y4Q@-@?301r|Lf*!Lo0R0GbvWJITepMl*5y5;!C4hj8%BH}$V*bf@ ztjEmPV=)cwjpgNkwk+bzr}27tJ?3XYqvDd9!fQd7c>^R~kIEh?2%)U=gP#;%`t&r9 z#RS}5S$V^<R&NzkaR9GJDt^piK0zhG3)qKOEerVb$5>qdBc=m;V|jVCSX{kT99}$! rWaR+h>y~xJG++2lh55~y{@3i+ZGSe~J=t6}00000NkvXXu0mjfG%kGO literal 0 HcmV?d00001 diff --git a/kmatplot/pics/graph_image.png b/kmatplot/pics/graph_image.png new file mode 100644 index 0000000000000000000000000000000000000000..43cee03a3b905e9fa1c86dbc6e5d7d7e3bf951a7 GIT binary patch literal 471 zcmeAS@N?(olHy`uVBq!ia0vp^#z1Vq!31K3U%d>ZSkfJR9T^xl_H+M9WCilslDyqr z82*Fcg1yTp14TFsJR*x37`TN%nDNrxx<5cc_7YEDSN2QH{0ze4d3Se)GcYiQc)B=- zRLprheWTYA2NBoxiBlqFr*oz#YU+q>iP&)Q+%^5r%ztM8Z4CL@Uea{7NleN4g1{!R zn@O9`h{l;8wSKynzv#2jy))LUZ!gP}mMQ+&tZ}m=M@4Mn_Y>cevJYL!{k*AmZsxo0 zD|`mb8#`<cO(_3)e3pX#Y=)O=#s!Q|-$iIS?=j*3@Pz+N=ew#M@t+d@nTj({C^~O4 zQ^r@#eey}e)B}fe<|KX=)Q>II*tKJ;+Vh*G{MV1`S|6CSIB!<p%WpoDPhLzZ0xB>5 z+`Ihy%r85-r-wDh-8GwE`1j6%3EdVt37w$~n&08df?F>$e)}V)f7ZQX+xz=MwVXPg zrK~YRrx_7y=A78KQ!QJe>+o64L$VibA9OzDE7s0iddC>-BA{(&RyEt-6uX(an#n8a uuJB#yicJN2MG;1?*SMduy_{0?kD={?qie9@`8&WMXYh3Ob6Mw<&;$S=#mY$l literal 0 HcmV?d00001 diff --git a/kmatplot/pics/graph_ngcontour.png b/kmatplot/pics/graph_ngcontour.png new file mode 100644 index 0000000000000000000000000000000000000000..2d0cafe8dbfadd5d38a9a1d834680200e36570c8 GIT binary patch literal 2513 zcmV;?2`=`DP)<h;3K|Lk000e1NJLTq002J#001-y0ssI2vif&R00004XF*Lt006O% z3;baP00006VoOIv0RI600RN!9r;`8x010qNS#tmY3lRVS3lRZ-WM7d0000McNliru z(gP9@AO=oT(5C<Z2~J5wK~#90)mmL>9M={86m7(qEZV6Y!&<f%3c_O=xpItR98^5l z4<*Hcb^Fxri&~7qd23^$ycA_-A{wX#Z68{Siu-2@>&IkUg}$VkaV(P9svT9b>op1~ zD_Pp&Mx7PwYA~ay4`=qyotZl;DKRnmSeD(pckcbpx!*bW+?nmz+}y;M7Ee5G0-p<+ z$2GCzIJRwX(P`7gr~l>O%&|WLux(q{b!zE&WXk#E1M8Q6jW<?*Vb6Q^oW~9;09e1m ze_@9eoqz2)gdQz;$zY9L0>JbEbL<j3F<`v@haIrDEGyo`y|P-x>K$q`N~+k!nfL5D zj}xV@u|5(AmN-{tZD$sMF*@vAnFU}wv&QJK^^-pv=Fda+;yRk985__X{eFCog}2&s zFw3s}MxH+Fg3GP48}WJy$W*2u(a($q7mi&rMu+Jgfc3_^hG7J{w{066AKO=E*@*#a zVfqpNIfB(HR`0ZTp;dOxlBzd6s}^4nqog|Xo>g|!MzG2*0Cre0N-FR#TpLGU(fZW~ zM4H2%dNX9t7=z!<^Z@{yqwfIVs}{`q!oRsf0F~yD!k+g`cy<HUG>igpLFhT80?+}y z0P8}Xol;}Vf`t6AddK<QhwSj_h=pU97-JB1Z@u;dE-zj5`n7Sa-Vy1_mwwu{raja= z04xWy2KtZ&qX4G?y8)x5S~W;`3sxB=6~|shk7kWsA{X0N*9^mmvq#J8#^^9stGIR{ zIUEnifJcYt%z1VrAjCl}X&}aC4J-$igYgXoLn;o$of6U5u~$!i_cta<D05WTb;)j} zpBOMkhpm@?ETs-W?^h@TV%o*Ddvem_MC}IjT=33v5o4q<3t%}I1z1-->!)>0M+E82 z2dS1q<>WWd6Fu9RrIau1R!@9IywZ4~&htae*#OwQYvh0eoCa79dJa}CFo1ucMm-^( zKqo@y@Y=GAvddn|)1(0GxnR36N-D}O`UXU*0{ad@b_*2%MoG2GZg?@r<vMZz0@o5h zsi&!t8xRORT~73qQ?6S%#cqK0hx3wztm_e~DV0Jrorf{H=waHW&_q<(<Y}{p8^>_- zAyzi9vH^6WQpZ9ks!ddzU^x`?xcLyzb^*dFiSDPNba=>x)VYKJI9FyV;iRx%sEF5u znpyNvuJc~vd;pvVRyLqzgKWc5ZK6_#mPIiS05={+-s>C4cS<N&H5dgCm+Samo+PCA zD^}SxMpdgkYrOt4bqk}`c<qN&PH@NDbDrL>kbc@wcN%!<V@$5&xjg|(@ug(}1n)^q zuA{yIwA>#@&BNt7(Fhxb_!M#uiD|VepGQXBX~3#sWh3C7hGHI-dc3hx4_1R4Acb|+ zi^qu&pNWjwl8p$q=JALm>cktsxqW!hl{z=4*dCMXczazE_mt2gErRG1?1h3c+$I)1 zz2Vu7U^oaV??D$P*HgJxo8f{;-7jKg0}r~uXW^E_60Yrh$cuYy>vS^h0$@2<HP{W9 zg<!<D*Rhhm;>4besT@!$`xVT1l|e;Y^R+d<de<Mx`%(jVR*hwa08bwmzeRn&=UegK ziyqI90HzM_fI9YN#-GWaeO|5XR{&s8!Hie!&Q$g*)$YvrGm=2jviRA3tZYcA2U^%2 zVK4W6D4UvxmSD&qS{B{AwxC`)pj7I>V7nro3>dl9Od3$BW8$llOPqO66g^_TXN*yD z4KeMC`Xhf#+-t}C?DJ|W^+5$Q9%elHRa}8eJ$z|dNqqsz;DYGm>~&p_)H6})ga=*n z5Ul1hfxfqcWuMHb-u2HusZhAn<{-&Yi!Dk~(Z|^nxNNAV7pe2aOa@e2%U;c8#=q9m zam%$5%y<EH0D}sD5n~!nvTyLf+Z|`0nsclR^<>D?4$lps>IM4*>dQWQ6JyS_rYEar zyjY*g0Y&?#$Eg?di85r~104XjVE^=S{O5hE>>33iv319SRm-B%nW_9w7-ZQG9lz{{ zZf=We6IyyT0f6)z6Fnr#*?rue_l%M%CQ8E1hw;7us)v*y7Kv+bhHE<Dy%lxLc-opD zqkbbfS3>k?lQE@^PbSLhlRn@R3EcD1>!UZbHDeA6k|hs|k<BZ1FaRW?m$NrZDgeEp z#?EN~ejCrus2<EzyIX_&+68tXm^Sgva;Vfp_V&DIo@2>wsdr(WoPt7p=ofdzyG6E} z=URK}pc1Bbt|G$ZckuUP?Wre`%=D@3c|GlP$4Ae1VsGLwF>+flfOJm~a$;b^#MiO( z(N3v54N101Wlzxi6%-UF7oX!)!u?vqFD|vbE3y|sHk|thil5-qD*)u(1n@G`{tWB` z1BTS(Sv#qp;-aVhtr@s8%>cr^k8nC0<olSYVzcLhf*G<*zcqW10i}G*0I7bohOe#p zTd=2;N*yRQQQ>*F-8$F}Nv7WxdvFOw4M^$-z{ss;U;qg{NgYV;#M;5k$S$AivuYxz z0l>2?joY@K{OITMK>XO2)DM7>Tg@N_k}Du9BD6K1vKCcoK*R>B$<t)BUG@O<Q)<ir zseS+y7rl|&%{cp5lIhK0+2_<lW3r(QbpC7;vO8dpAypUdpAn?`0iZSfk=sq}U?$K{ zGC%fav^!q%XhJx@2Sx!#0UcKXS$WfreQ*P3dj?4L6Bs~YAPA<o<Q12^i|@G?-*dG_ zL|1gvs#3@G`<S?glXK{}3ez;F+;$J9cJj<{NX4|P=ioHLB82plc2F#C_~UOiwQQt* ztO#^NYqKck@!~E_+=E$zX_`}pu_dD&KJk<paB7#N{y{7LE*=Sv0WllK7lNA()JTs1 z(;#DK*yc8P6J)yYIn<6lfYyPFODL%yI_&Y=fU$g1sbi!s<UPKCy@PDxFZR^bl(B8< zko&%`2)y6Ufa&1G$X7tTlS-bZqoa68<y>P%GRDroVzvp*9kTDy(03Ye+Ov-taI_11 zJA=KQ9~#NoJb!E1@bl8Q&7;71#y%VGboN_9W&nWe_wf`lTg6jAsRsa#_5iP#)R}!g zu1Tb`?>n9PNO>r7aM5!(ITv`HKdFA?M5U0kXZnD%jI_y}dC!J|nujwcwM@OcgHU^f zi2qN)aUA=d-v`gsODefP+`P0O;fwO?b|C+kg=Jax)SHYky4Am<EcQj>(fz~aap24S b->ClsU~2CBBy(H`00000NkvXXu0mjfi}ue# literal 0 HcmV?d00001 diff --git a/kmatplot/pics/graph_ngsurface.png b/kmatplot/pics/graph_ngsurface.png new file mode 100644 index 0000000000000000000000000000000000000000..468d706be2f3a65b0bf5472f8ef1748b30853e7b GIT binary patch literal 3062 zcmV<S3kmdzP)<h;3K|Lk000e1NJLTq002S&001-y0ssI2u}yhn00004XF*Lt006O% z3;baP00006VoOIv0RI600RN!9r;`8x010qNS#tmY3lRVS3lRZ-WM7d0000McNliru z(gP9@AS(-ujM4xA3v)?CK~#90)tY;78^?XeKLBA0rYI7W`H(5`mN3Owv}{?dh1jx) zyMrVvidsvuJIbT7tVyQRbnK>?q<^$Y9|Y`aGo8uQ@w9H6bTUcJIFmRta+GA;M3Kb1 zgC1q*$g(7hQe6r>@J)df2$QtPkU;-9yhwqh_-d!$!5@2jzuVmpe!IWj+gn>Ak>LNo z>?>V?uIu0X-m5EJi*4n+p&Pnk9FNB%KHm;taw6`2;7Pap(UqucMKA&{2j0K>pLLs@ zyLKKl!={kd%iit4=~Hh*+0I=@m%YYi#t6I|INf}_Zj)>8CmO~l?4Le#)Cd}~S2ltM zOv>Kvq0k4XPw6|KIN*L*S;l&o2SYdX@BaI@LZNHkhI*TA=$V7R2aJq3WUmZZBv!(L z`Od2Wclkp*KijzUsx2)QBM=CjKJkXAt(By8V`EVv3cU?7Ff<gat*sZ5u*}jVq+li| zZiQOT?cD#RWpPWM-|t^EfY0ZPk6fo<?O-IT>lYfHc&K<yK~GmtOH0ey^Fg=UEksSy z+Q#tku&dYw2qA=UcXmf&@x%wm|7xw|DJif1Kfus+z2WhP`#LTjR7H7-vs|i;PbF*# zzWNuR6O!oZ>)GbnR#H-O;OTuv@K<Ko6r#pe>>3^(PLlwl@}8|#S4SPAKl$#<@sDio zN7SWYEVxtYx~{6~3y12`IXzKY+af34eg$axO^d21fN>^x^vLs;fe{RXQ}*sL!zLgk z!EbwrzLhSa=|^wI6E#P_*t}>A$3htnf9iKVo69l`H^<21;I6u^58mw^owOKcNcMUG zBluHrf>YdokNN&Tn%$iM`2ga<Dwt^cw(rOvEs|sb-q3aZ@IkfGg~yY0MeEhb`gH}} z17ly<Q(9A7CZy7|v2mg6=(7*sSxD1~4zvCAkrzKLqzxJ4Gw0=o?M**;liM{%UR(^x z0=#kfpz5inJDR*~ZHsuelmhqPJGOII-AwDz5AQ6&4EM>Koo3~e=8aAg2(cl}00^lH zCX9db$$zq7lDl0~`FuW$!BY)mk=C||=aJHPuSBj~?0Wp6QZpQxw*)iXM;=0~W8@>b zVLMY8#(6W`C8R3LKuA@>1>>6Wb>E6$Jok)mv_q>*#u!?!-mI!9xO#19U&98^rb4-) zjwxo4-0Pg?=L`dI4~B8x40SSr`QM#s8{xt{cTSWdiWW>Vf2Rrr0-B~B*h*^$o@!c6 z95(J_sQ!tKK*d@oAgW4@vu)X9!<mJVW-!BjX1L#s42WW3btIta%{RpZRm70jo)azr z<JZWKX~x%m@>lP+cg-`zbzMKaS3R(a9_WtJH%v__yEdn8uerZ!olEv62ZnL3O_r1C z%a=p@pRP|cV8aae3#m#-mBzJ;R!0)j271n$;ZFKHg}?|}%*fj@KY%_=Q$5mrS0wXz z!|(TdTmY>d6gb$s8L5=uwdCD%*Ln|$-jR!K`*uTFo%}J3Uj*g7-t^-ZgW2}3SZkLz zRzf#@-F(<59GKxw^PNs1AsiSXgh2KJG`#^pK5`vquh!)A-3`fH-UtK&7KYu)dws~8 zlKG;PGuLqB@%&DLr}^{G6Fft{gM0`3c4M4J_Hy~Zc(fYh5~4KOzO;<X$s98bAS3|e z46>RuXlg><f!TyCVO&DIs)=0F(OqF!-Ko-v$HmncyQ)DV9KnoWhuZZ><p6D0P`6Mc zC7%kOq0mWhKNV|n6>;RbnZ+8d$WLW1%`m2k?8OX29zp;Z1|o{tjHp0V(9}79*P1m_ z`Tc&66QJ)lwS@%31kXT({Jac<rS@<p?QNib8xKE1L0%4qJ0&D!FGdg{Vcr0sAFd;Y z!H(Gvz%|X(^~GQW0s)t%RRZwyKFl$^rFcu}9YnDqjlw|EvaFozp_z}5$M}O!aq>TM z746KCXOYOo7%#yIWGBW&<gH-CxP++Sb)UKzjDPd{E1@;YYCC_u32!M~W3&vSQ~)pn z{cssVSRppsA!+S+ViuBYU4l!{gxrDAgviJ2%fhS2>_^;0vGKBRu9+kUMj#NVgjVQ- z+CqS?G4k_L4A~liegw2%hA<2#v+qw$lru<-R%9>q!zK6?G{JlDUaHYsF#BO@I!Pr) zFTnFb?e#!lHjErY{Npy8l_&vk0bK>;uR&Tp>pu}5q#%#|)md~gyi(@!Y&W|%0vJ8W z56oIl67>?;z=pgP`r!m-0wa#Fp(l`=H6>Tnn(2)|AkbHc2OQvqmND`pNFf-2(cBe} zPT}3aiB!KD8b(ZK-m#vOR{)63!vM%zAOT?f5>5aJ8^VT}V6U5R%<_^q4MW%U?|j2w zln)Sv7EmDhw+=uELYcumLz5||4h|#TH}md}8ctrh+l8pS1+y2jyOtfmOi<9F>A9lT zv|0R>zw>V>BsRg%;9wdcTccowsd88is{zVZ6OLstX4MpCA4WVY#|E}smX{Gsw*+D1 z*e&F(eADk&?wCe07`m=sxTIO{GEJK1_xmR`ZPuP_`D8V$rnDS0n(SA5B-Y%qz6lRv z4$?cw(LHyRa}#a?@P1aN9W%iZO*1u(m;9D1-rh=4f;TP_M?0(QJEo72%n<iI?Q6fL z6%Fy)F-=hvUDy9cRh{q@^D9z>w}@bj{aY9r!27Xj0OCHn2XW*hKQc?Zr^`&hsmubz z2n2?j{DW=)t(}PkKh5W(>(jiS#L#tJ{X?~Qg5$4eLV>R9{{8C6IG%Cl4loh$LKq66 z!j9Jt5R4;iNH)3><b#<=cJaA2gTYdZuD|uFKR>LQx41pYPd>@ls{D<Anc1yNV)&l+ zY42#-4`+rmUDv;SNCnDn&gGUicou+P!i#yy)_7BmZi!=O@eJ88UwTHZS;Mg}F!6n+ zu4Wu!2VQ&aHAYDEChiQ$ilS8ij_O*)Z#VF-#hh{x&9$0HYtm{88HTO|?wsRzfegUo zit_hwX=a6I;s@BP3H)tlHnb%Y30>E7&M9d<yVn<eUjw4!#3p#K1b39`XvQGzjSkqI zhm_UsmN=>%BR;D)S|xxV7xBzDwe9mQ$g!5*pF4bWPxr*J;>18SgE8-u*(5+mjEVx* zIw`qLbrjcaNDYq>I~#2jk|eQ4g|N-U=qaYVm|v$Nx*5G&hBV1bKlGozaMQo<P-A1` z0x)Kfq}^i49i=eJW~j|W*myUN&koaFVKv?QWow}fY59KtpmyxI)&7NTw|)7L>ROe_ zNxKCI#SnHLt4`kP=_S9I2lB8N(-Ed__DFYI_5WGpBEJy$d_GlG8yg!JwugHsiRG5E zdl|e<$ts>o?m2O`hr&D*0dTgH-R|54w!74Scx&-nw`ncx6Q-glul!iMxQb|s#I*`( z4dYV`-Nu<muqXMeT7x|`(CxECs^wx}p<B^_q9~7UR<!}GWSr_4u5kd@DqO3$G0bxh zCe4C9xaKT-85vjv2GD%G*>}LF4QRK@0NgREV*p}J4&(4J?$ldU`&!ydXfL5+L_PH{ z%f`UsFaZBo{OSuTMF629LPfY^R7G=Gn#1rEzbK(S71o~YTxJHA^6gL8^)!hk#}tlj z$@Js}9QT5k$#Xb%W^7i1fu)>MP!vVosAlI(_NEf=;P^O`wwX0do?#^zSmI%e=Htz3 zxtilfDm2Bz*sC+?lV8)8Qr#R{>X{M$SNt>Hu;V@0Qy-Gj81XPCp3{_u<@}_dt)*fp zilY6qMkF6#1C#F%@4>!)TJbB*z_OiE&~^1Q&r&*JkK3?ef2a_MhsMamE;#wc<15O* zavelc6vh9?f67Q<e55e`Vc}%&y2;*k@f*Z%6`g!x#Tft+%O`d39$bYq)F*$SY1%TD zKZln21dq?>({5Z>>$j=(kEyCU_uJSqY6Xvl{cq}j02c3{ugY+9^#A|>07*qoM6N<$ Ef`K3FumAu6 literal 0 HcmV?d00001 diff --git a/kmatplot/pics/graph_surface.png b/kmatplot/pics/graph_surface.png new file mode 100644 index 0000000000000000000000000000000000000000..eb5a683d6d939b0aa133bd5e81143b93204727bb GIT binary patch literal 3812 zcmV<A4jb`_P)<h;3K|Lk000e1NJLTq002e+001rs0ssI28teGv00004XF*Lt006O% z3;baP00006VoOIv0RI600RN!9r;`8x010qNS#tmY3labT3lag+-G2N4000McNliru z(gP0w6&^ubrgZ=S4q-_|K~#90-I{%H9OZq-KexBKTirf;x|4L0Rzj8)Sr{9Pkqy`e z$3DZ9B#leTOOw>Rn28At(<DqXFocp;r!pZ;pwlvt2}y<kolMG5*UdPTp~1ijuxn%d zhT{lZR%}_8S8ukY+h<Rwds+356<6EHmTbg7{rz$C>^{%#@B7`~%l@9<o^N7eg8yHl zeik>i`ko%>K4I3}Ue$2T8Ry^sTdSngG*_B64}KPUJyB-;j#l4B=m}K}kIJXz=zi~H z$44DU{^$Eve!pSp&~5c?nsvQJ@y)v9bsoM~hzMjX%Q8gp;BF^mn2OsKHZ`Lx3JNGf zl$$kA&92^}%(9iFJOB!~Ql?GQw7Yue&l!n~ZmS#GX9isRaJO&<MP`tpgP)zDW;vGZ z&bLJ8W^nECO5qza`vzqeGYTL#y=J%&MrIHZxa?|bZk=82p3Ji2b^g7NQiK6{<OqN$ z2S3t=Jfalq1m+x2p@8|F&m`H-rsK)O?SK$4fwU0<KuQ2%aB}e@r@pk+nAgk%xJZfo zQ~NAxFUo9EvJWLig%?WTPO=g@GKCdcTe0A-^72Oh>?IkR&jiB2?n=(0_M*&cda#n# z32*^~0iKB_$d)yx8@>Wr$b;5@`9t`S61hF`X|xR--LZS)YOD9hXPuu_$4e$Xtd@n8 z*d5q!z%M!3e|1QY2vI3zMu_rI$k_8i6K`Ta|EbjNef3-ULQXmzR^KyHb`;N_o$;jX z=;>&U1ioM{-f*Eh>|bL95CH_pEM@>eW;vMuAfBm`vL8ZH9yKy2$17a12?17Ho7viW z5qviN`1abGfGRX0B2sopxxabdFTANUtR!WJEuW9nRmtJadwzTGMQ9Qq(*P_9@K!@$ z{@jR&rG@AaVxJHvZC`ip^2kNpyeM0K+GcNiJ)apjgpk7nLWG0}S=P%_P_p`70R<(1 zQ0?Kp?`;03nX8fQ?MC1XVnzT<(sNx{RaH4WY#r|gK&6mXRkd?jh0MZJiHo50?sJKX zw3B~r*YNAR>_aDh_4sdI{26b&+940MpFv5=18~GESnN?53r90Ycg$RkolNqveLPln z7E=%vrCOC{)-@PqQ9#O+S>K>lYT2fc2q3e__6tkpoBz3OK`j#sh9J|~yYsgrO;>#N zhWK)yHgEH*NluR?>%?zRl%2_*#_9|OMtiK#dt17%Z*N$-dM29W6A4apJa4cwOVcF+ z7puQlnAHHdax87=WkZX~UkUXzxD4$`u2?-I6`t&S^@RmNj1av8^rq-(?s?*Ye*u<3 z$44ET|L*IPl;q)dHvjzhfxEN0`qZhBWwqM}4;*)WZ23-n!`2zS<Dagep#fE)OQ(4c z9hU>RJ$xf|$`}ub@TD@965)stf?VG64QhLj_SEuDmfK2MF=IZjzxZOg-Cc0WmeA{v zGD9mre^YUG!DR~;JpS?|rQVH+Eu%MI`=#ryS#>+``le^p`YuC`3XL7VY+LrtX_C_Z z9qp%TkS>akFmzr?Iz`^)QjOAM{X*$y<hWf@B~l$!#$=$<*wK-92$fJD<F%I(>%KkH zq}Tn@OWGln7BrpA5TWDgy2`80TB88(e}By`-_n~lJnHcQzIf}m%jZ?S?`Q#qz0W76 z)wF+m(s2-FgaxS-_y`;LMu>&TjU#Pj*Gc0@2f)CfInZHeQ2i_{MM@lp{qN5xoI2Xu zN0P~E2lldmH@yQiRAV+RpMui0|M>R0N1ke)*L?bfxp+fUOZ_QHXpAG%Meybq5@lgj zP$3jXrbyXTms2TFN-%4&QwU?SP_onDVnnGjh#1w;2roY~{Zj+pN+crS<VlZ^?;;#T zQ>nV@>^MAU^<Y#jsTmmvIRrjrS7I8KwvFPStWZ@D2JQqEd19rYVvk{(lU1K|U;?ui zdmNz?8R^HzJA0GU@_DztJ(WyqV5mswQn;d?`dg;}c1}tn)?zlcl$t0ooJ^j_P;Jk* zb=K;(jRN~lV)b%loDY5af*!OWD99A3Sbc~xn&%@OWEv(={TRopUzk_@-skkT7u(KH z>8V7*@u9(Ro(yDl%1cqFf`7g(pz(!7)qC-gO7cT&jK?27_s*(QaXRPelnJbUN_7gX z>LxIXx(#X(S7PNc=OS%7ZG?e!6n10mrzzKu&%{sSKc0+V6<_@cFY;t-d;16PCJ$&t zvy>MYhDa%nP4it-<dtc*fV<cE26`ENhY`3kIrR&~x6;R)7@0Ia1w-JvboW1Tkd}Tb zp)Leqr7;&GYXC$a)*mrLSZT8Gc#HAcB0(xeo{8VdDPi1p<C?Dh$%-h}3D%}@T^iw9 zm1}ZSfS;xkH*ZUXq70bkrXWu}p7`W~winun>Wrl^!h{8YEzJqNydMDy$Q)K0Qy>q+ zdx-auhcN|K8Xy3-_6yPyBaFhDAFTbPiXXMLb$*!4q>(mxm(39*m{9qHDe%mMQmc@p z2CSYEK6p2|^~{KB-_xGh_#{3s!lWfW@BzxAVWJQKqXbbhx!BIqTs}GW>LxP;&~U=K zy0kWKG@yr)A0&M@inizeFRs?yxaJ>zlE{vsC@4PM3GxL@h(O~xO8Dt}54(N7!;lcT z6D(R0|MxfE_RhCG*Ou7$Bx4R0I??bXp9#q3tG5ikGKc^(#GCg$SaV%f%=bp9J7Yhz z-4p<p#MH4IfQ?t^jdy=_)!IjPb?v(2hj);L9Hha4QP7~2#&JY}d>&OJG{n~+9*?)Y z{q~fA{fX%kG(Ml3Om6j465-h4qbC(#`}X!V>(?arB+2Cn>nM=Tk<XIJ;tyyeZdGSG z8OHBNzxnHn9($~y)>JjFu>8mJjc#=N0A7*q&=sWn%hlK4Gp}*w56ffajkS%^=kD6K zogCyL4?)l%$VjE;6!LnSQHM)h;?R80J&|~PO1v{_dX=dxE|8SuH4@JxkWdPqbw?a3 zbn-4XoP;qe+($(fg&bQ=TJE}2)3j(sbkJ7o7v7gKe<~{jgIla)hpe6f#QjZw`L$)z zU5*HOisJLG{rM<VYn;sBgAyo!p)s0qRC;uj99;&(>GK85jGA7%eZEsF4>#BC9qYvh zKo$Z}3PA|!eB=;?OZ7mX)7V9I1-Wr<xMlr@hg$P)UI+n<jEty-e--+m9804H0DO7U zSyA=0loBv&%tM`rmfo_I&*_Xf_`n4RA{wVMlxhrQ)L|MF>S|~|dQR9g>OB}Gh&*E_ zdhvk@l^RjdA*@jyquarRg*sKjNE-o_+&C!Q@K<+hAx#Kj2t!I4i9`r~LuRY(qureB z;m~eSaayF5LI@#*)n^%oasOTS)8Syju+9+7)v59m@}d-xCsxU#tK#QDJ0nWsvBa+% zaI-K03Y^MNt`pXAGW4Y>hbEm0K}R}k+gbqNhTGQ1VlnS>tIrZbSe9khm<%p54{Q^= z-xAh-{_`c#c#mg8%d)&d{F*p^kdSfEA*2u$1VBZ}pqG%#(6aJVQ!-my|5!k12nTY| zpi>(n1VeDlA)--$<7tlD_9fcRD*D3QaLe75m6e`H0a8lSG;L{9y_B1NCx-#}{J(i* zq?CqX078hR3zw4n*rn&_lz@|_0GdCLB@!eWVafHMni8=7dkGPwEaz?HVJuCJAO<RQ zW=IP@w5ih=&rrgVYW?(Uy~pnn6GBk6l$xupIlmBdS6h~4nx^M?#Rd1@aX)_0p%e^3 z!KDNS9Ydp{9LJ$$#rbx@7tqHu!c>CpLbiaSphB%q1PbtnexgtcQH`j+e&y}4SWHT3 z)|i0ja+7>Kl3(6@>2-hY8AnQ4H0I=jIzbSsHGok`Sr}+Gng=WC3Tqo4N}M0(jIH$D z*0D5NfXX2l%229-Lhxe`DFqdRel$PQSv+^K>Q}vp2TarS1|D?p*Os<t9NV^wCi14@ z*RDc?bcRS6Lr};!sZE^&om6YRzRbLHypArI60rVziGa$f1`QjI4Ke}IFf|%MSXGaK z7sS-Z7B?<dOH|J+9?GI?8Nw*q3eSM%q$L5{wxunXRxZE=Ge+KJJkRe3yZ+QQdH;yM zdb;+`g;4r#>mMqy!%#w9w3*Qq6A<)M1>1Va>l|?CV}1RfYnsNHA;iaVa;Wo=cX)bM z@RElR!Y~YcWDD6PS1jRVnq!jx9wYz}h-sAg6L&m3EzS$;i9h(Q1Y;ShwcdT548Rdd z9;#ym!FJF=E3EtCy0U0l@sgrbd50eK;=s1;;>u#MDXOyg>SYuPI3Pd=4aPI^h1ay+ zH+|#f!YH+VvlSHre!`F~aMY$7>@)#ricq7kTXm}li?Q*sqRV+eZQE|1*X(&$k)G#u z#Wzy%5x9Bx&K0-g_tWnXgdjw8%Jjs&iJ5@B;4c@6`w|48MyC{NG#m#B<r+gH1X;9j zxn8P!;o-3|YfKM%=iyF|fS3I|XY;0{l$K@TB1dIvG?mF@R8?Jf*;nv0Sr$R^C;zp& zWkwy$i}|p*=5N*{5AQ?^adeOjj6oin^vmbWefHjG-3hm@t}Yx71JXHrm+J8>{#ur0 z7>1p)gTbKUDm_+DCY>1@A9G#T&AWF#d?y;jwD=Xv-+p20t;Fn50@ggTHn}rN7IFnn zWynC9M<0B&<+7G&G@8w2HBD=%YZyE=SW!`Nx+|O&S^yIa4h(MHwsq~=wF?$3I9<z@ zH@9rvxiub-uU>uu9p;Pw{M`0jTjJRSIT(Wx9=Pj)4fkxQs;R24uLt(**|UAe_Byk! zuC^`^3}~gAE$t;OOLp(sZJMSb4DU^a%kc1US+s2arSmTi#%xmZq<wpPGMS98h_60J ztA5YkJ+^J9WxBDcQBjnlm2BJAb^YMMgE#-h&7TIqCuR2kopLVeJ<(fNTQ_MOIIBdO aMfqR4hhLLk0ZWVk0000<MNUMnLSTaBph=tn literal 0 HcmV?d00001 diff --git a/kmatplot/pics/graph_xyplot.png b/kmatplot/pics/graph_xyplot.png new file mode 100644 index 0000000000000000000000000000000000000000..40361cc5cea5e142515ffdfea8772aeb16759c19 GIT binary patch literal 633 zcmV-<0*3vGP)<h;3K|Lk000e1NJLTq001-q001lq0ssI2rJoE+00004XF*Lt006O% z3;baP00006VoOIv0RI600RN!9r;`8x010qNS#tmY3labT3lag+-G2N4000McNliru z(gP0w885sr=|cbj0rp8mK~#90)mU4OgD?!7ta>lplVMI)b29ITLpBLcOIrx+d{ii* zVl;kCoS>?xFwX!Wf^n?3`r^k~69E9`u0%X|<goBN8x3;Tz`rARjhF%mPPK*r)%bfV z+F>P%J>^8`8n!5+?rwUAxw*R&+R6<B0AIXbimu2_6Nut7v)_t)Rg9-xA~%i@adbM3 zoX8(J0L%^*kv`_;k+W>O0*dljSLk|$S&3fM@*&l_j+d(<Q6F`G0AQLhO&vb=E;blH zQ9+%#sF*`hBo?3|b>x`~Gf1h{Dd+M8a+4`_lg@5i$j}lat>-E-`%3E)im%Q07C90j zg!huk#vf)p9`)8vEqW;kqtzmpYNDzJ^S25X`aSq9<i-)I%~>!fR3&9q%eJzYxorx* z<q(k)`CAF*AG)gXkFagP8HO0pb$Sg$Aztg0^$~8bUokwH{)vjS%zn<cncNc?ZzH$s zQE#WY)#^!g-vdFfp?aP_I9qffm*$cXaKCT=-@)YO86iL<UZ|-?E86JMU$&wq%z0h& zb)8ov9<Vcb*Aab?Uw6zih+^pTR(h0jFOh$mC<<9BeGTQ(vsLuc@Go#bR~1Lr#xI~; zsaCG&1(a)@2rr>rbxWBEdA4$HH(s<nTe&LX@~!igYaOvn(XNd*$CF{ytW5P6BaAm1 TYuEjE00000NkvXXu0mjf5$zCY literal 0 HcmV?d00001 diff --git a/kmatplot/pics/hi32-app-kmatplot.png b/kmatplot/pics/hi32-app-kmatplot.png new file mode 100644 index 0000000000000000000000000000000000000000..03b3a6c1fc1eeabd92f94862682a312f3511665a GIT binary patch literal 2172 zcmV-?2!r>DP)<h;3K|Lk000e1NJLTq001Na001Be1^@s6dXd_W00004XF*Lt006O% z3;baP00006VoOIv0RI600RN!9r;`8x010qNS#tmY3labT3lag+-G2N4000McNliru z(E|t+FC?Op-~|8x2l+`vK~#90?U#LUROJ=MfA{WY_imD9^I=FxfDNDlMU*vYkRYNn zGFr9Mc0?U5Wu|sW6iv{PnT|!qmT9emF;@H_AjF{(gW?Ca8eu9Dsu7DJVFKYJiAf+? zvYRE@?B~6E?|u7+Xe%TTq%)n)^vvA9?t9<od7tOp^PU6$kN>fdM!Qf^9RERBK|CJ6 zxGfaLL1W`Sgb+XYS+!~visCru;p7V;)!*NLQHRoX9e`LYilR8MTCEpH=*%c9D-loq zcBPm+Ws<lg!!BN2`+^wFcWrG)Id<$YR%_A^2UipaJ9mEko%|0!{D`Rg=nWx6Ky2Ai zE<UVXE~ZV+6qS{0MOj%H4Gj%cRaKp3+qagDWZeZN^~WE7L~-$4mOgZcm_9v=oNR+G zZxDMp#v_Xh`D|w^cb3<2q@!1|S}i0JI)-78NF)GoI258$l}(#ABFhp_KmAAI@!0op zF32*QEtO^E%i2}Fn@>L3%dG2cWY`Bd^ko-KyBq2D`Y9MIv0#3&=<MvGr>6%^Q%NLL zG)*HM4s-Hk4~rN7f|V;*4vTSiR-Gdree7{rH`Ei)J!4M(=$$a*vyZUvvvyv1GLIF{ z9iX8(%EGyquzK?`G)+U2!0pZ_7K>q;20}nQ9w!!yVHk;vBlN2W9w7OWE3dKkmCqjP z&EmEKE0L~#e4SBZ9YYjfWn=s9A@b~yl?j_)S|gOPZt2=<uOl8;k!67_%Se*IGzF40 zyg8$?Z1(l@Y3u6B=s&)1$5TJaO4_zL#8pl!y*o7Kr=}n}Ks{)(c#@Mh_eA*R)C^wT z{5FY%h9pU+Nl1W%5CG<gSfe5|Z^6ARxqso!p-;EcwqNkKy)o)Ph*9>UpXezAi&x^v z!2~}Z=Oift#H`qW_qT2p0LjV8D2g4M&5kTv&WUwiLbu*=C-2r(r=EQI+23WFTH0GR zG5(OB&aKWArrGSwQXFilAEMQ#;q=2TDGFOUhA2$8V?Ei&@1J{K*lc#zudkx2stTLU zhQ(q5hA&y?CA8%Jg-p1#;I@oI$ERjS92DyglKc?eZxZM=m=&@yH|k*jpoY~iksnVY zsKRBELas&T{hBS*)YOoko<Uk#8n3;!@wAP@SDbSu^<_n~sr_)LYi5#l@h4GDx+OD> zQ$ZbF2!bJlB8weDf~JVdGS?VtP7NW;5;xfFG)7gBWTIc~qqFmCmM?!C!!X#j>r;Rc z37u1+36~a7`_{JU+qb=U_3imiQk*hoGLR~BFi9uXCE-ui`HL38lkVX2M1p2BL29yu zU+AQySP27PHheBLO+{5T-0q1OhRH}Zc|=0@ELz0OBnz*st@_!jE6F=*HIUtc_7t6X zp2?96m2Rg_bDB<<MW@*nWA>CJY6rs%rkdDo5&?^WmIUv8@K@T~yXfvdj^E#pIr2|7 zGNIbHwvl_~4C}8SFS+Z0$D}4H#-3R*Ui1a{lh@DM?tbdWhIub1gwJWPBVA=rvIbU@ zCJ{qT74#+&1W)g`Y12lLm6b(q?s#%@b4FBX#JlX34S(jVPwN+MZmFuBl99=wrh)hr zcfK+;ubA<9DN<8Y8)<3DH1_Qxnigi<v}E)S2>NvJ8;EoWw&>h`+mD#wo=9_3Gc&H5 zDNUF#o<)o9$L)6Ga3r5~mkpcLYt~dyv!N>4k?;7aIuZPNQfFb%lQ(_ZjL?zx!_JB0 zug2wq%L^tkHqAx$<ylm8Rbc6}kW!d}+Mp5-t1P_lE~ZVnoVvO?B9RE|*1ZgH7K!s( zcDU&<<8rgF|GQa#)6}C=!`byYkx(eq($ab$8Cd`lLWX@`?V}<69qEef>6GP^Lnp+7 z77V8yI^je|5B2qXSiSlgNtR`nKDbo0wH>3iwRQA_=FOhRalMPN<Hv1|)Jxh+6>G1% zX6CFJ=@}V?LI^!Se-Z%B6c@7>6iFRwgpya6NY#Ctq&2@;jrK)?L{Ad)ZkU5^=#t;> zlMWqf<;j&R*!z#Y2w@<E!Ke%4xZG@1Z`}6A*7tkgeEzj14=r1IxTW;~$bv{Da&Uj+ z{_xR`BP@UHQR#~8=~U0J7T+qf{OzZt!u)HYCxY9Z&$@N5Aj>i>2M%)g!n>shA1tM! z;suePKMB*+M^x#1@km)2D^@%)*W>Z1E|*IgGiD4PkB58iyO+|^Qam0{qNu1y{CgKz z`D_K`r9xgN^KO`fET;-hi(#4xYPY^gVPPSyhg%2+2Pi2i5k8+6!_dw@$;`j;Mly2T z<mBXBUs+lCoq7cY1r$u1%FPRILQx!|ynGq2zh2GGojaH_XAY+VJ_?I(0u&bg{64Cy zH;Uc6chT49rM>+a8#b(`w6v6HG>p&ZrLV7dbc9x{cmj{dgUjVQ>z&8rp{S_nj2_v< zG<Ad!basA?ET`i0d5K0t1Ok2n0Y3u+0V0thN=i!b`%mKYdGUHrV48{Z6UxcSp|Y}a z*msKJpswyigb;+oLxe(u3=Iu3I5<EsIEWAi)zup@42^+-egXj>et#c+e;<Q`0h*f| zX=-Z3>pj7V6Wt^d@rxTi6~)2!?eCseM#nT0=z0Q8(}>3tn5H<bmX4}MiNzwsViBUz z5YcFeNMwj`I7l!!z`#KNcN55&aX~%x7himdEL%|3IHoBOLI%ERO@$DEiD?QzAOr~U y&879tS`!eMCI}&LI#Y(l_%F@&|B5rK_CEm!84}U5o4pPI0000<MNUMnLSTZ@kr5^U literal 0 HcmV?d00001 diff --git a/kmatplot/pics/hi48-app-kmatplot.png b/kmatplot/pics/hi48-app-kmatplot.png new file mode 100644 index 0000000000000000000000000000000000000000..f464e34bc5f8c273ac9ac3b2bb7a0258d10a3356 GIT binary patch literal 3623 zcmV+?4%qRDP)<h;3K|Lk000e1NJLTq001@s001xu1^@s6S{#YM00004XF*Lt006O% z3;baP00006VoOIv0RI600RN!9r;`8x010qNS#tmY3lRVS3lRZ-WM7d0000McNliru z(E|t+EEhI!($D|^4Wvm#K~#90?V5RX6ji>*Keu{Icc-%v5)dMR0Ln5hY>I?^2A4ww zW)xzABrGBj$f%FVs5p+|FpBt4XTWo2-tnm@IOCwQOavb=k@cw%NP-H4RYLYXUA<P- zeSd_6#7QDx_+#Gjd(J&o)wk}wzwiBif46T{H~fU3@DqN*H9&MmCyHVQAU;06&H9Ll zh*sCp(Gj54HeQ%7pGSAQ`3J|^u;IOH5A<qb7}|9$pMAEIS+iym2xz3F%)FwQl<Um7 z)1YZ!Hp6@Gy?sUG{%wev&6m&Le*1^XnLDiQ1SBSol70I0#A>y(b?bKg{s8yfJ)Xb* z?UPpdEv4RJKbm$~wI=1vW_b7AwsWpii3wq9b)ArqAaimy(xuB_0DSJr+}gi8*?SI? zIBJC4yYCCpvaMklfJ9Lm&xMcxSglsfW=Ky@$82sS2(4ATuEbhm!Gbw5K0cC&@KAz* zd^T<UhzG`ZW7IDaDLPxsSKpo{Y4SZ%C{~e}m`GMu7E`87Vat{+mq-bOP>|AK%$QL) z91e~h%SYEQD|_(Z7wwMUsW}!11Q|8zPSVmIlq*(@AvRX0q+}CSH9OhxmraZq*^OZN z*DPBwh;aj>s46-_h%H2BWi3TY$>z<Qk+M-GDJ6zsASDQ)Fm&kc3>!9_!GnKB|Nb}A zyLSSb=4&^WPE<@`z<~aQheygktn5qg-Wj~IawI#l_oCP&yY`+TC;J#<Ms-8_f+SDr z!%OewF`#-2n>KxP#iQJP_at;(BNz-~813uQDa53dELt>|f`Wp`VIv}$JHLoK?~Gvb z)SgHg<hwJKY*{swtvQ8Moj*^~<nAn6S-|p?UToM^%CpNJlYjd2J7V<c(Fg&CApwb$ zjeSdLAf@EfPq))@Ptj41{b(y%EEZ<Zeuxz-#*jAq$zPv86J+h{{Rojhf`Jog-c$VX zk9iE}?`PTKNDdt@XT!#G6jyslh!*&LIx(V}-Me?A>pGgIq3ar&rV$JV@cVsuy<WUt z4*-FHk6=(k*L4B`<N6UBJopy=u(B^s=X6K*)^&@H<R+k2Rd7=e6MAh8y04DvQV*KR zN3gPiryq+Z`*1m<`rFXGUXpHca;{e6pPzmxn=IB;G%bi>=rpMZG!qA?tSr4g#8g$q z7bsxv{Qu^e7uG#Gb8Kj|UhC(r*GhR{s1@xy4_b)_Pe}k->PHs&k)?jRm;^g>J@{*M zdb>>MnuOvDq@<)?vR+f6*^VIpW&DtkkalDHQ8|`2`$^8933BMmGZ9XwbJ?L+dO$hk z=LMKQQGw#d5qjAyPyti}UeJ6nvtKBm6?hok-Ol7*4t9O#C2z+LNplj(=F&tEXkIk| zeD3R@n5wE|Z(YZc+yt_+vX)JVx5qfTDo_J{pTu|Gp#D39&D&MdZgD|9puySvAh$(Y zxhLL1?!^E~5c=6HAR$E8*}N@VwyjnhiiLJ-H@<6D?3owVF>`Dvt{aZ@>5>zd8D}-Y zF?i~uDvHW9_U-l|gkVi>9fKSe)@ohB44aOsJlw}cuw1gZXBdC~*3ARmLaFo`^mUq9 z^yqw&E}ZB4YPD4AN^nhzsjA9rFK01-Vi;+Y?|t#11ed*9HCXs=1=C|fS=ujxpZ9Pu zv6r2@qC!|Zyel*QrwmV}L9wb4?N<oaOKu9W;15c+mwC7))Jln8CqdI#^QSju6PdYl z=h2p0*M(SCRu&WD?f8;%My8)TIellLhkB2}n?t%%(V#O(xs+4oP@(GJgTLMy%Lgaj z6skc?et{_<@Vh0?c8}z<DlY?VRxFC(woog-|J`$dWX_y<%$qlldGqGCsaQujcGXra zu4~}Uk#WRXO*}CtJ>zX`%E03n_@;LpoPg|750j!DaOnZr<`;0j@qCUojMd&cii<U( z6ot|tluP4MkOl)4EBWpKQ9`h7+dt$ZkIWNy+%W=>%%8u2S+i!filtL?EN$|=yq@5q z*9XTV?uv|@wl*Y$VIj8WdP7|9wcaooY_&Gm9q{^C-#v!Rs!HDO9s?5otGb?amy3Nq zA0urx4rv+#tyZ3Vav22$`ABInV#IKylmvrXt5_;4Yuk<Us;s#0cp>TMPO`Jm!yE6c zPf@@=(PigG)8+Xww{XmtZXfqM9B?U~f4aR4HQQJc7S8I*T0#wlTHW9dn~m~I&ms;* zp@+#tMMVWIbE{Fg*63&xd{xArn3K-!*vLFy#Z!wj=0}(nZtiD=5Fn<p)S3-~T_wS; zl20@bMl76<3Q`=daYXt#8x}-$NzN!58>AcEEcqrRfXys8Mu2FC!mfaqa7E#nWlzeh zT@A0An5wGy4}Hbjx;l!>DsIQnZ+T;MG<m9@8@rgPa_XE`f;d7HibFKY>^h}Vquypv zV$!*2)$t-JvFa3CG^WNmc)!d|{|GD9CW9NCW(s{luz*)ex;YfydiVVfV=|jNVdwG2 zJL^$^i7q=2rKBww7H*>=TIYj8H;FffP!y(du))ub-OXHd=~zqx%>*Sb9iL{P8I99e z?9`|Z8W=X{>QFf83((JQ0W)Y4>V!lwfof{pR_)t&pj8}-qM#@WCX=bnIGb?g?-dmj z<3lWLtEh4~oz9}WCfOqf4Y%>hdv3-*=)}<Av%kAB420DpkOtJ(=!~1zSXW)7QBk7P zdw>OZwSh^2Gbe)h+y*`4%{0^-sH#NwOEg^)?&?BN(};?U;>eN1qQ1U?&`>9VKme1; zgb;%J?z@jKzdY1txL2fDaajd7#CGM4(cRhharT2igng`?^EQFk4EbLNDf<$BJ}!mh z-yUP!xG`+sv7O0N#*+Q%`#1*Z_&f%oH(96;Rqz?0)f?z`fiuEPd8L6hLO~G{ca4VK zZY4AG*C>j@^5x69^X7q9Jpau)T**xjrKHhhy(L)-=UE0?xY*ZBfdWQ#$f<^-G0aY1 zLTs#yn%Yuq4uvjV!Y~XEnHf*<Gw0n@91c(wrBE5I(9qLNX{~|iXMuP#s>dJ@t)NPY z)ovyAp;?55g<%*5Q<J7*xWeTAuM60BET4VH^4XJrls)-J2{=NpotUbse7-9i>m3S% zU(CC$u1CXN!X_v`rxE(+s2vqWWw(Zf+rRL7>e;blJBecw@p*hC^h+Q&?=Wsp9pzOQ z88SLVq(!DvcS^%!1%Hu-(ZhsCQ4n3sc*+c<D%rSx1983LgvDY;N{Pv8V&uq?tsZCK zhxd*@NNn53*#Owb+DV<Ay2O63T}V|DxiNaj(Zffl4IiH9UG>VUm-F)T@caElM@Qoi zHXdtgYS^`N7h}har3N^7;D4E9znegQ01S{`D+Ej^5mxkz8lqnC^*7%zXHGiF$umSo z#zJx8_zB|U<9YSfHL{6NQ~6P^29{(k#4^yrmd7r{?8@7f>e=RFkZIs2`TLJdTbh;S ztEnwz!h{K14(vbh?T{fu(1SWsN&<lZwKcVrB%TuQyZ<6eYYk3Dd@c66w~IB&uVK^~ z=oJ<WpB<?-u8J?Oe2Ltza>c|6zhLp=Od=yA`Q@*sArwJbaT#5^#<o&T)7p=_Lt^D; z%c<+pfUpVHu6}i<sYik}#uNAX{zC^ISh{qnugQ8#vz8jGR;^kmOadt+LI{o@KhB3A z{;f^xEqQ5)c<y)45jdt}REA>ITaj*w>hp*u>%IQ^8mg<SS-dzyT)cRZgoFe(ZrmU{ zMX}V`so3weBUQ=s>)v`mJ6%$KBKK&@?%lhM?^`b;BV+Uaz5AuvY^L5_Pp`OMJpcR) zqCM-q@X`w+*6swi9iiFi)~y?1VJ_KZy)|oIzw};FvSP*a;?&tf4(H~!vSLSywaZym zRa`w?nCq<69;v<2>2%()e^1W+PN%a(RaKIbl1REgso8puFMYho<#Ofve7<41UmfOH zet~ETVEy_HEc|={dW8k)w;)wNnBhM%7K^8!eNjpyir=h$g5=~GqNb*%*?Ntyyc@A{ z<?ltG-hJg0k3ZII#cNV*?dn%C^++Jb6UU;3kEV>DIO(-fW5)dh!0B|dYSk*fZ@p<# zr)}E0c`F5Z`OTyZ!yq*^nYOGqGcA>!J2#_gXPGf$x{y+`V8Np_SuZE&^HvHy``hK5 zJXzShh+I>SJ-_ZPw9_S=$URD7;c3UVEgwJCvOXgtgZ+E=)6#mGnVBEQ#>6sr?ju+% z7FMtRPa-0s$jDg2(@*_|?^|!<#t#@YXpl%wp3a2}MVL$`%F4=l_~BHVtk)80X|u$^ zg9n?5o;!E0U1Du+sZ>?P>2$JxPY$ETjBB@XeD8S1PaMzZIXM*M6#x>a(<R;RdeL&G zn~JV!+|Z*xh7rZ;)tMwG&uI61skXL`p+kmo=Ip6|>8I)b`1rmUM%%Krso0{0k1~GZ zqz*{|Oq)85t(&*9Z_i#DU%W^f8tU34C8b0tO0)H*Oi2Pj2+@3OItPe|2<O?~F6YFF zlWmf^rZ4Ei!qaTq@^Oa^0Wvc)iH(URJUqP3f!mtt0Rsk*oID+e!`X^RTS!ZrMN8|o z)n9w)lz$Dl-SzFx=;fb-+OBJFo78gg5kj=tE+OHjcCFZHzqWKl?EA;7xvxD^KcrZv t66=U$Q-E!?Y57@4eYDr^C;WfF{{bX?7t__>p=$sD002ovPDHLkV1m^_2S)$^ literal 0 HcmV?d00001 diff --git a/kmatplot/pics/lo16-app-kmatplot.png b/kmatplot/pics/lo16-app-kmatplot.png new file mode 100644 index 0000000000000000000000000000000000000000..586987ac2389ece98a90f1eb91283e08c8bf0a80 GIT binary patch literal 341 zcmV-b0jmCqP)<h;3K|Lk000e1NJLTq000mG000mO1^@s6AM^iV00004XF*Lt006O% z3;baP0003DNkl<Zc$}4z>y5-941_<V?P#dUt_jx^*W~*VvXJQZ9+rrR@r=g<t*ZD- zL<A9W%Z)L3{R~Tb_qz6=XF>Z&(0eaP%!EmF2eU;Gkw~IFN61Xvy&xF|5m#@Kk0!@) z+!dU2dKut(g3TbO^dSJ@p2(~L%Y%p@-Ah0Khk>+INk9seBw+LKJworTNU&KqF7Q;d z+n2y`)KZX{kT9mtp5Q>{QnC4mZ)Usz+`XieIZiId26jLfNbk=gxMby&daax7+6uQg zN0?c&RS*+%k$y`CyfX8heBSf^aQ8EtSGbL!O~)R>hBfK_g!liYAWssLH8bN0`WR*g nsLYJ2`uBQCqH45XJAH^R)2XM@$eyf*00000NkvXXu0mjf-6)v+ literal 0 HcmV?d00001 diff --git a/kmatplot/pics/lo32-app-kmatplot.png b/kmatplot/pics/lo32-app-kmatplot.png new file mode 100644 index 0000000000000000000000000000000000000000..b6c31f971a492532f69a2924f87f3b3cdbc5bd6d GIT binary patch literal 805 zcmV+=1KRwFP)<h;3K|Lk000e1NJLTq001BW001Be1^@s6b9#F800004XF*Lt006O% z3;baP0008qNkl<Zc$~#oTXNhm41+tl5%x^fnZz>*XJS7jS@bJO+oa))X4kST5FkYF zZV`d+3qc|Ptr_)sGwTx(@uj0y3xEOO-BD|eh``&I@RZ>0;qLpK8A0-}ZeEvHS(^MC z+X`~AHDh!I5YcKMQ6r*_QKPjQ0HU>qzgD1>5|SVZBv6eo8|+*#63C^O`ZWm2K_+$n zgmG(aXG|iRF`~_3(dxQK^7^?eWij{sv;yve`zs`X1eyV0Cno_e9}d5Z&Xz{V1vA^` zolhlDN(pzzRMyzl^&<EHCA;z5g;wnVd?u3P-2^1<^{(t7F9Btl9cF-$AOZKj<|%ww zA)k)N1SU8nw6T5ylU)U4a+)wqd2Br6iLn5e41e8$mr~;OdIbh^0Vv~nBhW?y$>snx z%&x<9{-P86+XQAqF#ru+wvy_+KYk{u44^fH;nb|qic1OHy~``$HMXe)48SIUmKM(> zh;#zF5)iv85GX)np5&Hxz;=EaZQB-;0|C^*T<8W2;$UvaJcef~_Yu*yyum?%*~^8_ z*gA<mx0+c8#IEcV0T@bQHbO1W3Dd;ylt5A-f#*8Us=j<p+W<5G1*=EQ$mJgLUlh40 zU_9n1ba~U!-#xLA0L>mSYxl|66Hw}-`!{y*dEMsT6C`~eaBuu@cLafS40R}Gzn;gh z=8fha`K)Ka2Qz+H0>O9p&t#aTKC|UA*}gt2lVjm-r#mSDSAQ<G+q=Cmj^y5fb*jis zd5%r$QGo?~apCoA?=yLR04kT{q{w3enlE*`JhNZqxwA4#_b(V4zIpJ*+mRa6OXVc( zP$s`$QpZ1(<q{7DTna#O)RRzpgPmEN+pf_*Jo~lQivd>x)5bg18$0K=OTx@Ra(iO- z*+?G9Eij#}As=Zl`**-gjJIKcTx0xtB^kBWFaP(H2U=@A0dW6I)q&f$0^cO?e;8j9 jsI~qG@Iir}0G{JF$qETpReKWd00000NkvXXu0mjffADV& literal 0 HcmV?d00001 diff --git a/kmatplot/pixmaps/Makefile.am b/kmatplot/pixmaps/Makefile.am new file mode 100644 index 0000000..35b8e78 --- /dev/null +++ b/kmatplot/pixmaps/Makefile.am @@ -0,0 +1,73 @@ +EXTRA_DIST = action_arrow.xpm \ + action_contour.xpm \ + action_copy.xpm \ + action_curve.xpm \ + action_cut.xpm \ + action_delete.xpm \ + action_exit.xpm \ + action_exportpicture.xpm \ + action_figure.xpm \ + action_fullpage.xpm \ + action_gray.xpm \ + action_green.xpm \ + action_label.xpm \ + action_locate.xpm \ + action_lower.xpm \ + action_new.xpm \ + action_open.xpm \ + action_paste.xpm \ + action_pixmap.xpm \ + action_print.xpm \ + action_properties.xpm \ + action_raise.xpm \ + action_rectangle.xpm \ + action_redo.xpm \ + action_red.xpm \ + action_save.xpm \ + action_select.xpm \ + action_surface.xpm \ + action_textbold.xpm \ + action_textcenter.xpm \ + action_textcolor.xpm \ + action_textitalic.xpm \ + action_textjustify.xpm \ + action_textleft.xpm \ + action_textright.xpm \ + action_textsubscript.xpm \ + action_textsuperscript.xpm \ + action_textunderline.xpm \ + action_toback.xpm \ + action_tofront.xpm \ + action_undo.xpm \ + action_windows.xpm \ + action_wizard.xpm \ + action_worksheet.xpm \ + action_zoom.xpm \ + panel_arrow.xpm \ + panel_axes.xpm \ + panel_box.xpm \ + panel_datasets.xpm \ + panel_frame.xpm \ + panel_general.xpm \ + panel_gl.xpm \ + panel_gradient.xpm \ + panel_gv.xpm \ + panel_gx.xpm \ + panel_gy.xpm \ + panel_gz.xpm \ + panel_label.xpm \ + panel_legend.xpm \ + panel_light.xpm \ + panel_mesh.xpm \ + panel_more.xpm \ + panel_object.xpm \ + panel_pos1.xpm \ + panel_pos2.xpm \ + panel_position.xpm \ + panel_rect.xpm \ + panel_view.xpm \ + panel_v.xpm \ + panel_x.xpm \ + panel_y.xpm \ + panel_z.xpm \ + convert.pl \ No newline at end of file diff --git a/kmatplot/pixmaps/action_arrow.xpm b/kmatplot/pixmaps/action_arrow.xpm new file mode 100644 index 0000000..0fbb429 --- /dev/null +++ b/kmatplot/pixmaps/action_arrow.xpm @@ -0,0 +1,34 @@ +/* XPM */ +static const char *action_arrow[] = { +/* width height ncolors chars_per_pixel */ +"22 22 5 1", +/* colors */ +" c #000000", +". c #A0A0A0", +"X c #7A7A7A", +"o c #FFFFFF", +"O c None", +/* pixels */ +"OOOOOOOOOOOOOOOOOOOOOO", +"OOOOOOOOOOOO OO", +"OOOOOOOOOOOO ooooo. OO", +"OOOOOOOOOOOOO ooo.. OO", +"OOOOOOOOOOOOOO o... OO", +"OOOOOOOOOOOOOO .... OO", +"OOOOOOOOOOOOO o .. OO", +"OOOOOOOOOOOO o .O X OO", +"OOOOOOOOOOO o .OOO OO", +"OOOOOOOOOO o .OOOOO.OO", +"OOOOOOOOO o .OOOOOOOOO", +"OOOOOOOO o .OOOOOOOOOO", +"OOOOOOO o .OOOOOOOOOOO", +"OOOOOO o .OOOOOOOOOOOO", +"O OOO o .OOOOOOOOOOOOO", +" o . o .OOOOOOOOOOOOOO", +"O o o .OOOOOOOOOOOOOOO", +"OO o .OOOOOOOOOOOOOOOO", +"OOO o .OOOOOOOOOOOOOOO", +"OOOO o .OOOOOOOOOOOOOO", +"OOOOO OOOOOOOOOOOOOOOO", +"OOOOOOOOOOOOOOOOOOOOOO" +}; diff --git a/kmatplot/pixmaps/action_contour.xpm b/kmatplot/pixmaps/action_contour.xpm new file mode 100644 index 0000000..89e16d6 --- /dev/null +++ b/kmatplot/pixmaps/action_contour.xpm @@ -0,0 +1,30 @@ +/* XPM */ +static const char *action_contour[] = { +/* width height ncolors chars_per_pixel */ +"16 16 7 1", +/* colors */ +" c #000000", +". c #34D300", +"X c #EFEB00", +"o c #A0A0A0", +"O c #EA0000", +"+ c #0A0A0A", +"@ c None", +/* pixels */ +"@@@@@@@@@@@@@@@@", +"@@@@@@@@@@@@@@@@", +"@@@@+++++++@@@@@", +"@@@+@@@@@@@++@@@", +"@@+@@@@@@@@@@+@@", +"@+@@++++++@@@@+@", +"+@@+@@@@@@+@@@@+", +"+@+@@@@@@@@+@@@@", +"+@+@@@@+@@@@+@@@", +"+@+@@@+@+@@@@+@@", +"+@@+@@@+@@@@+@@@", +"+@@@+@@@@@@+@@@+", +"@+@@@++++++@@@+@", +"@@+@@@@@@@@@@+@@", +"@@@++@@@@@@@+@@@", +"@@@@@+++++++@@@@" +}; diff --git a/kmatplot/pixmaps/action_copy.xpm b/kmatplot/pixmaps/action_copy.xpm new file mode 100644 index 0000000..065deaf --- /dev/null +++ b/kmatplot/pixmaps/action_copy.xpm @@ -0,0 +1,84 @@ +/* XPM */ +static const char *action_copy[] = { +/* width height ncolors chars_per_pixel */ +"16 16 61 1", +/* colors */ +" c #000000", +". c #B1B1B1", +"X c #ADADAD", +"o c #A9A9A9", +"O c #A7A7A7", +"+ c #A3A3A3", +"@ c #FAF7F5", +"# c #9D9D9D", +"$ c #979797", +"% c #E9D0AC", +"& c #F4E9DB", +"* c #BDA07A", +"= c #6D6D6D", +"- c #BFA682", +"; c #BDA280", +": c #C3B9AA", +"> c #BCB4AD", +", c #C1AA8A", +"< c #E0DEDD", +"1 c #E0E0E0", +"2 c #DEDEDE", +"3 c #DCDCDC", +"4 c #D6D6D6", +"5 c #D0D0D0", +"6 c #BEBEBE", +"7 c #C1AE96", +"8 c #BF9F73", +"9 c #BABABA", +"0 c #B8B8B8", +"q c #B6B6B6", +"w c #B2B2B2", +"e c #E6C9A3", +"r c #BF9F76", +"t c #C5BEB4", +"y c #AAAAAA", +"u c #A2A2A2", +"i c #A0A0A0", +"p c #ECD6B9", +"a c #9C9C9C", +"s c #9A9A9A", +"d c #F1E3CE", +"f c #EFDCC2", +"g c #F8F0E5", +"h c #707070", +"j c #BE9B6D", +"k c #C2B59F", +"l c #585858", +"z c #FFFFFF", +"x c #F9F9F9", +"c c #424242", +"v c #F3F3F3", +"b c #EDEDED", +"n c #E7E7E7", +"m c #F9F6F2", +"M c #303030", +"N c #E1E1E1", +"B c #BBAC94", +"V c #C3C3C3", +"C c #B5B5B5", +"Z c #BCA687", +"A c None", +/* pixels */ +"lllllllAAAAAAAAA", +"l22222=cAAAAAAAA", +"l2zzzzh@cAAAAAAA", +"l2zzzzhhccAAAAAA", +"l2zzzmg<> lllAAA", +"l2zzmg&dB y2=cAA", +"l2zmg&dfZ VzhxcA", +"l2mg&dfp; Vzhhcc", +"l2g&dfp%* Vxv1q ", +"l2&dfp%e8 6vbno ", +"lt:k7,-rj 9bnN+ ", +"l MCnN3i ", +"AAAAAAly9C.N34# ", +"AAAAAAl2bnN345s ", +"AAAAAAl60wXOua$ ", +"AAAAAAl M" +}; diff --git a/kmatplot/pixmaps/action_curve.xpm b/kmatplot/pixmaps/action_curve.xpm new file mode 100644 index 0000000..fd37fb9 --- /dev/null +++ b/kmatplot/pixmaps/action_curve.xpm @@ -0,0 +1,28 @@ +/* XPM */ +static const char *action_curve[] = { +/* width height ncolors chars_per_pixel */ +"16 16 5 1", +/* colors */ +" c #000000", +". c #A0A0A0", +"X c #FF0000", +"o c #4C4C4C", +"O c None", +/* pixels */ +"OOOOOOOOOOOOOOOO", +"OOOOOOOOOOOOOOOO", +"OXXXXOOOOOOOOOOO", +"XXXXXXOOOOOOOOOO", +"XXOOXXXOOOOOOOOO", +"OOOOOXXOOOOOOOOO", +"OOOOOOXXOOOOOOOO", +"OOOOOOXXOOOOOOOO", +"OOOOOOOXXOOOOOOO", +"OOOOOOOXXOOOOOOO", +"OOOOOOO.XXOOOOXX", +"OOOOOOOOXXOOOOXX", +"OOOOOOOOOXXOOXXX", +"OOOOOOOOOXXXXXXO", +"OOOOOOOOOOXXXXOO", +"OOOOOOOOOOOOOOOO" +}; diff --git a/kmatplot/pixmaps/action_cut.xpm b/kmatplot/pixmaps/action_cut.xpm new file mode 100644 index 0000000..1faa803 --- /dev/null +++ b/kmatplot/pixmaps/action_cut.xpm @@ -0,0 +1,28 @@ +/* XPM */ +static const char *action_cut[] = { +/* width height ncolors chars_per_pixel */ +"16 16 5 1", +/* colors */ +" c #000000", +". c #DCDCDC", +"X c #808080", +"o c #FFFFFF", +"O c None", +/* pixels */ +"OOOOOOOOOOOOOOOO", +"O OOOOOOOO O", +" OO OOOOOO o. ", +" OOO OOOO o. O", +"O OOO OOO o. OO", +"OO O o. OOO", +"OOOO o. OOOO", +"OOOOOO o. OOOOO", +"OOOOOO o. OOOOO", +"OOOO X. OOOO", +"OO O o. OOO", +"O OOO OOO o. OO", +" OOO OOOO o. O", +" OO OOOOOO o. ", +"O OOOOOOOO O", +"OOOOOOOOOOOOOOOO" +}; diff --git a/kmatplot/pixmaps/action_delete.xpm b/kmatplot/pixmaps/action_delete.xpm new file mode 100644 index 0000000..6d7bcab --- /dev/null +++ b/kmatplot/pixmaps/action_delete.xpm @@ -0,0 +1,90 @@ +/* XPM */ +static const char *action_delete[] = { +/* width height ncolors chars_per_pixel */ +"16 16 67 1", +/* colors */ +" c #000000", +". c #F4E3D5", +"X c #D7CFC9", +"o c #CD4135", +"O c #CAA98E", +"+ c #F6E7DA", +"@ c #999999", +"# c #FEFDFC", +"$ c #F7E9DE", +"% c #820202", +"& c #EED5BE", +"* c #800000", +"= c #898989", +"- c #CBAD95", +"; c #BCB7B1", +": c #F7EBE1", +"> c #D3C3B7", +", c #FBF6F2", +"< c #F1DBC7", +"1 c #E8786C", +"2 c #6D6D6D", +"3 c #6B6B6B", +"4 c #C79F80", +"5 c #D1BEAE", +"6 c #FAF1EA", +"7 c #F2DDCB", +"8 c #BEB6AF", +"9 c #FEFCFB", +"0 c #8F8984", +"q c #CFB7A5", +"w c #FCFCFC", +"e c #EAEAEA", +"r c #CDB29C", +"t c #FFC0C0", +"y c #DEDEDE", +"u c #F5E7DA", +"i c #D1BFB0", +"p c #CECECE", +"a c #CEB6A3", +"s c #F6E9DE", +"d c #F6F5F5", +"f c #E7E0D9", +"g c #F2E0D0", +"h c #C9A68A", +"j c #F4E4D5", +"k c #F0DBC7", +"l c #FAF1EB", +"z c #D5C9C0", +"x c #EED4BE", +"c c #D0BBAA", +"v c #707070", +"b c #F5E5D8", +"n c #585858", +"m c #FFFFFF", +"M c #C8A487", +"N c #F6E9DF", +"B c #424242", +"V c #ECCEB4", +"C c #F0D9C5", +"Z c #CDB19C", +"A c #303030", +"S c #E9C7AA", +"D c #CBAC93", +"F c #F3E1D1", +"G c #E2E0DE", +"H c #F7ECE2", +"J c None", +/* pixels */ +"JJnnnnnnnnnnJJJJ", +"JJnyyyyyy;n@nJJJ", +"JJnymmmmme2m@nJJ", +"JJnymmmmmwvpm@AJ", +"JJnymmmmmm=v3BAJ", +"JJnymmmmmmdG;0AJ", +"JJnymmmmmm9,f8AJ", +"JJnym1tmmt16NiAJ", +"JJnym%otto%s.cAJ", +"JJnymm%oo%$j7aAJ", +"JJnymmtoot+F<rAJ", +"JJny#to%*otkx-AJ", +"JJnyt1%Hu%o&VOAJ", +"JJnyl%:bgC%VSMAJ", +"JJnXXXz>5qZDh4AJ", +"JJnnAAAAAAAAAAAJ" +}; diff --git a/kmatplot/pixmaps/action_exit.xpm b/kmatplot/pixmaps/action_exit.xpm new file mode 100644 index 0000000..55b8286 --- /dev/null +++ b/kmatplot/pixmaps/action_exit.xpm @@ -0,0 +1,27 @@ +/* XPM */ +static const char *action_exit[] = { +/* width height ncolors chars_per_pixel */ +"16 16 4 1", +/* colors */ +" c #000000", +". c #757575", +"X c #303030", +"o c None", +/* pixels */ +"oooooooooooooooo", +"oooooooooooooooo", +"ooooooo ooooooo", +"ooooooo ooooooo", +"oooo oo oo oooo", +"oooX o o Xooo", +"oo. oo oo .oo", +"ooX .oo oo. Xoo", +"oo ooo ooo oo", +"oo ooo ooo oo", +"ooX .oo oo. Xoo", +"oo. oooooo .oo", +"oooX .oo. Xooo", +"ooooX Xoooo", +"ooooo.X X.ooooo", +"oooooooooooooooo" +}; diff --git a/kmatplot/pixmaps/action_exportpicture.xpm b/kmatplot/pixmaps/action_exportpicture.xpm new file mode 100644 index 0000000..32c25dd --- /dev/null +++ b/kmatplot/pixmaps/action_exportpicture.xpm @@ -0,0 +1,116 @@ +/* XPM */ +static const char *action_exportpicture[] = { +/* width height ncolors chars_per_pixel */ +"17 18 91 1", +/* colors */ +" c #000000", +". c #7C7A7D", +"X c #827419", +"o c #2C5677", +"O c #235578", +"+ c #040B11", +"@ c #3E3940", +"# c #73A2CD", +"$ c #CBD4DE", +"% c #014100", +"& c #4F4E4D", +"* c #C3D5E3", +"= c #5C5753", +"- c #245E0B", +"; c #6F96B8", +": c #93B4CE", +"> c #167C00", +", c #F1F6FC", +"< c #B5AFAA", +"1 c #434244", +"2 c #4D85B4", +"3 c #292E27", +"4 c #6F6F6F", +"5 c #25587C", +"6 c #6C9CBB", +"7 c #215478", +"8 c #8BB5D6", +"9 c #5D8FB6", +"0 c #595959", +"q c #468BC7", +"w c #144001", +"e c #11040F", +"r c #E0EAF1", +"t c #27669B", +"y c #134363", +"u c #4D8FC0", +"i c #413B44", +"p c #0A6000", +"a c #B1CDE3", +"s c #427497", +"d c #227900", +"f c #15476E", +"g c #002F00", +"h c #3979AF", +"j c #BCBCBC", +"k c #2C3228", +"l c #E1DAD3", +"z c #B2B2B2", +"x c #1D182D", +"c c #322C31", +"v c #41769C", +"b c #3A9F0D", +"n c #20141C", +"m c #3B383D", +"M c #8CB5D5", +"N c #4C667F", +"B c #98938E", +"V c #395D76", +"C c #417BAC", +"Z c #6CA6D9", +"A c #161311", +"S c #010003", +"D c #343335", +"F c #51512D", +"G c #5E85AA", +"H c #546F89", +"J c #91A729", +"K c #4E4E4E", +"L c #FFFFFF", +"P c #3C3A39", +"I c #AC9547", +"U c #A19846", +"Y c #1E8F00", +"T c #147C00", +"R c #CDC87E", +"E c #646363", +"W c #DDDDDD", +"Q c #343B41", +"! c #4681AF", +"~ c #71A3CC", +"^ c #4B8EC1", +"/ c #242424", +"( c #629DD1", +") c #2F7C0D", +"_ c #2D780B", +"` c #346C93", +"' c #1F8E00", +"] c #185F00", +"[ c #185700", +"{ c #000400", +"} c None", +/* pixels */ +"}}}}}}}}}}}}}}}}}", +"UXU}}}UXXU}}}UXU}", +"XXXXXXXXXXXXXXXX}", +"UXXIIIIIIIIIIIXU}", +"}XIyyO75`v6sVRX}}", +"}XIf^!uuu8,M9RX}}", +"UXIor$thuua~2RXU}", +"XXI+B<*:;(ZqCRXX}", +"XXIPE&A=lN#GHRXX}", +"UXImSD1.cnxe/RXU}", +"}XIwk@i3{[_d-RX}}", +"}XI]T%gp>Yb')RX}}", +"UXIRRRRRRRRRRLXU}", +"XXXXXXXXXXXXXXXX}", +"UXU}}}UXXU}}}UXU}", +"}}}}}}}}}}}}}}}}}", +"}}}}}}}}}}}}}}}}}", +"}}}}}}}}}}}}}}}}}" +}; diff --git a/kmatplot/pixmaps/action_figure.xpm b/kmatplot/pixmaps/action_figure.xpm new file mode 100644 index 0000000..558f2f0 --- /dev/null +++ b/kmatplot/pixmaps/action_figure.xpm @@ -0,0 +1,39 @@ +/* XPM */ +static const char *action_figure[] = { +/* width height ncolors chars_per_pixel */ +"16 16 16 1", +/* colors */ +" c #000000", +". c #0000C0", +"X c #FFA858", +"o c #800000", +"O c #FF8000", +"+ c #400000", +"@ c #FF00FF", +"# c #808080", +"$ c #000080", +"% c #585858", +"& c #008000", +"* c #303030", +"= c #004000", +"- c #A0A0A4", +"; c #0000FF", +": c None", +/* pixels */ +"::::::::::::::::", +":: #:: @::# :::", +"::%#% @@o.;. :::", +"::- # @@@ ; :::", +":::$ @@@@@ X :::", +"::: #:", +": o@# $ XXO @@@@", +" @@ ##$ XX.; @@:", +": ### X ;;.+# ", +": ##### ;.=&## ", +": &&% %%#*#:", +"::: ;;; ###%:::", +"::: ;; X ## %::", +":::#; X $ #o ::", +"::::% #::O %% ::", +"::::::::::::::::" +}; diff --git a/kmatplot/pixmaps/action_fullpage.xpm b/kmatplot/pixmaps/action_fullpage.xpm new file mode 100644 index 0000000..aef5ef6 --- /dev/null +++ b/kmatplot/pixmaps/action_fullpage.xpm @@ -0,0 +1,95 @@ +/* XPM */ +static const char *action_fullpage[] = { +/* width height ncolors chars_per_pixel */ +"16 16 72 1", +/* colors */ +" c #000000", +". c #E6E6E5", +"X c #FFFFE3", +"o c #E6E6D1", +"O c #A5A5A5", +"+ c #FFFFFA", +"@ c #E6E6BD", +"# c #9F9F9F", +"$ c #FFFFE6", +"% c #E6E6D4", +"& c #FFFFFD", +"* c #E6E6C0", +"= c #FFFFE9", +"- c #800000", +"; c #E6E6D7", +": c #FFFFEC", +"> c #E6E6DA", +", c #777777", +"< c #E6E6C6", +"1 c #FFFFEF", +"2 c #E6E6DD", +"3 c #FFFFDB", +"4 c #FFFFF2", +"5 c #FFFFDE", +"6 c #E6E6CC", +"7 c #FFFFF5", +"8 c #E6E6CF", +"9 c #FFFFF8", +"0 c #E6E6E6", +"q c #FFFFE4", +"w c #DCDCDC", +"e c #FFFFFB", +"r c #FFFFE7", +"t c #CECECE", +"y c #FFFFFE", +"u c #FFFFEA", +"i c #C0C0C0", +"p c #BABABA", +"a c #E6E6C4", +"s c #FFFFED", +"d c #ACACAC", +"f c #FFFFF0", +"g c #FFFFF3", +"h c #E6E6E1", +"j c #FFFFDF", +"k c #E6E6CD", +"l c #FFFFF6", +"z c #E6E6B9", +"x c #FFFFE2", +"c c #FFFFF9", +"v c #E6E6BC", +"b c #FFFFE5", +"n c #E6E6D3", +"m c #FFFFFC", +"M c #FFFFE8", +"N c #E6E6D6", +"B c #FFFFFF", +"V c #E6E6C2", +"C c #FFFFEB", +"Z c #E6E6D9", +"A c #FFFFEE", +"S c #E6E6C8", +"D c #FFFFF1", +"F c #D5D5D5", +"G c #FFFFDD", +"H c #E6E6CB", +"J c #C7C7C7", +"K c #FFFFF4", +"L c #FFFFE0", +"P c #FFFFF7", +"I c #B3B3B3", +"U c None", +/* pixels */ +"UUUUUUUUUUUUUUUU", +" ", +" wwwFtJipIdO### ", +" ,,,,,,,,,,,,,, ", +" 0BBBBBBBBBBBB> ", +" 0---BBB&+9---; ", +" 0--BByeclKD--n ", +" 0-B-m+P74f-C-8 ", +" 0B&+-7gfA:=rq6 ", +" .eclKD1:u-bxLS ", +" h-7-fsCM$X-5-a ", +" 2--A:=rqxjG--* ", +" Z---rbxL53---@ ", +" N%o8kHS<aV*@vz ", +" ", +"UUUUUUUUUUUUUUUU" +}; diff --git a/kmatplot/pixmaps/action_gray.xpm b/kmatplot/pixmaps/action_gray.xpm new file mode 100644 index 0000000..f145d5d --- /dev/null +++ b/kmatplot/pixmaps/action_gray.xpm @@ -0,0 +1,25 @@ +/* XPM */ +static const char *action_gray[] = { +/* width height ncolors chars_per_pixel */ +"12 12 6 1", +/* colors */ +" c #000000", +". c #7F7F7F", +"X c #808080", +"o c #FFFFFF", +"O c #404040", +"+ c None", +/* pixels */ +"++++++++++++", +"++++++++++++", +"++++++++++++", +"++++..O+++++", +"+++.oO.OX+++", +"+++.O.OOX+++", +"+++O.OOOX+++", +"++++OOOX++++", +"++++XXX+++++", +"++++++++++++", +"++++++++++++", +"++++++++++++" +}; diff --git a/kmatplot/pixmaps/action_green.xpm b/kmatplot/pixmaps/action_green.xpm new file mode 100644 index 0000000..1f6230b --- /dev/null +++ b/kmatplot/pixmaps/action_green.xpm @@ -0,0 +1,25 @@ +/* XPM */ +static const char *action_green[] = { +/* width height ncolors chars_per_pixel */ +"12 12 6 1", +/* colors */ +" c #000000", +". c #808080", +"X c #00FC00", +"o c #FFFFFF", +"O c #008000", +"+ c None", +/* pixels */ +"++++++++++++", +"++++++++++++", +"++++++++++++", +"++++XXO+++++", +"+++XoOXO.+++", +"+++XOXOO.+++", +"+++OXOOO.+++", +"++++OOO.++++", +"++++...+++++", +"++++++++++++", +"++++++++++++", +"++++++++++++" +}; diff --git a/kmatplot/pixmaps/action_label.xpm b/kmatplot/pixmaps/action_label.xpm new file mode 100644 index 0000000..b934a36 --- /dev/null +++ b/kmatplot/pixmaps/action_label.xpm @@ -0,0 +1,32 @@ +/* XPM */ +static const char *action_label[] = { +/* width height ncolors chars_per_pixel */ +"22 22 3 1", +/* colors */ +" c #000000", +". c #FFFFFF", +"X c None", +/* pixels */ +"XXXXXXXXXXXXXXXXXXXXXX", +"XXXXXXXXXXXXXXXXXXXXXX", +"XXXXXXXXXXXXXXXXXXXXXX", +"XXXXXXXXXX XXXXXXXXXX", +"XXXXXXXXX .. XXXXXXXXX", +"XXXXXXXXX .. XXXXXXXXX", +"XXXXXXXX .... XXXXXXXX", +"XXXXXXXX . .. XXXXXXXX", +"XXXXXXX . X .. XXXXXXX", +"XXXXXXX . X .. XXXXXXX", +"XXXXXX . XXX .. XXXXXX", +"XXXXXX . .. XXXXXX", +"XXXXX .......... XXXXX", +"XXXXX . .. XXXXX", +"XXXX . XXXXXXX .. XXXX", +"XXXX . XXXXXXX .. XXXX", +"XXX .... XXXX .... XXX", +"XXX XXXX XXX", +"XXXXXXXXXXXXXXXXXXXXXX", +"XXXXXXXXXXXXXXXXXXXXXX", +"XXXXXXXXXXXXXXXXXXXXXX", +"XXXXXXXXXXXXXXXXXXXXXX" +}; diff --git a/kmatplot/pixmaps/action_locate.xpm b/kmatplot/pixmaps/action_locate.xpm new file mode 100644 index 0000000..9812cfc --- /dev/null +++ b/kmatplot/pixmaps/action_locate.xpm @@ -0,0 +1,34 @@ +/* XPM */ +static const char *action_locate[] = { +/* width height ncolors chars_per_pixel */ +"16 16 11 1", +/* colors */ +" c #000000", +". c #DCDCDC", +"X c #808080", +"o c #585858", +"O c #FFFFFF", +"+ c #00C000", +"@ c #008000", +"# c #303030", +"$ c #C0FFC0", +"% c #004000", +"& c None", +/* pixels */ +"&&&&&&&&&&&& %#&", +"&&&&&&&&&&& $+@#", +"&&&&&&&&&& $++@ ", +"&&&&&&&& $++@% ", +"&&&&&&& $@++@% &", +"&&&&&&&& $@+% &&", +"&&&&&&& Oo$@ &&&", +"&&&&&& O.X $ &&&", +"&&&&& O.X & &&&&", +"&&&& O.X &&&&&&&", +"&&& O.X &&&&&&&&", +"&& O.X &&&&&&&&&", +"& O.X &&&&&&&&&&", +"& .X &&&&&&&&&&&", +" . &&&&&&&&&&&&", +" &&&&&&&&&&&&&&" +}; diff --git a/kmatplot/pixmaps/action_lower.xpm b/kmatplot/pixmaps/action_lower.xpm new file mode 100644 index 0000000..a9e4dfe --- /dev/null +++ b/kmatplot/pixmaps/action_lower.xpm @@ -0,0 +1,94 @@ +/* XPM */ +static const char *action_lower[] = { +/* width height ncolors chars_per_pixel */ +"16 16 71 1", +/* colors */ +" c #000000", +". c #0D3652", +"X c #D3E5F0", +"o c #15C1DA", +"O c #2AB4D1", +"+ c #050B12", +"@ c #1CA2C3", +"# c #0E97BF", +"$ c #060F19", +"% c #03060C", +"& c #0C026B", +"* c #53B7D4", +"= c #05151E", +"- c #64A3BD", +"; c #0C0271", +": c #1DB4D0", +"> c #1BB2CE", +", c #0B293E", +"< c #0EADCB", +"1 c #40D1DB", +"2 c #0D4864", +"3 c #1BBAD1", +"4 c #E0F1FB", +"5 c #1299BB", +"6 c #48DFE9", +"7 c #0E5775", +"8 c #BFDFEE", +"9 c #1BABCA", +"0 c #690B02", +"q c #EFF3FC", +"w c #0B0265", +"e c #14A5C9", +"r c #620B01", +"t c #1697B7", +"y c #0E94B9", +"u c #8FCCE2", +"i c #001F03", +"p c #A7DCEC", +"a c #DFEFF8", +"s c #46B8D5", +"d c #1F95B2", +"f c #106589", +"g c #337F9E", +"h c #18425F", +"j c #600A01", +"k c #0FA2C6", +"l c #10698F", +"z c #071620", +"x c #06141F", +"c c #6F0C02", +"v c #070144", +"b c #FFFFFF", +"n c #2695B1", +"m c #124D6F", +"M c #254A64", +"N c #5FC0D8", +"B c #02710C", +"V c #026F0C", +"C c #54BDD7", +"Z c #0D324C", +"A c #0E8FB6", +"S c #114560", +"D c #0FA0C4", +"F c #0E9EC3", +"G c #144059", +"H c #46DBE6", +"J c #2B91AE", +"K c #A0CBDF", +"L c #06141D", +"P c #010001", +"I c None", +/* pixels */ +"IIIIIIIIIIIIIIII", +"IIIIIIIIIIIIIIII", +"IIIIImmmMhZIIIII", +"IIIIImKqX-zIIIII", +"IIIIIm4NuJLIIIII", +"IIIIImq<1nxIIIII", +"IIIIIM4#Hd=IIIII", +"I.mmMM8y357SG,PI", +"II.gapCA#o6@f%II", +"III.gbF#D6@f$III", +"IIII.gbe6@f+IIII", +"IIIII.ga@f+IIIII", +"IIIIII.lf$IIIIII", +"IIIIIII.%IIIIIII", +"IIIIIIIIIIIIIIII", +"IIIIIIIIIIIIIIII" +}; diff --git a/kmatplot/pixmaps/action_new.xpm b/kmatplot/pixmaps/action_new.xpm new file mode 100644 index 0000000..c74ebf1 --- /dev/null +++ b/kmatplot/pixmaps/action_new.xpm @@ -0,0 +1,105 @@ +/* XPM */ +static const char *action_new[] = { +/* width height ncolors chars_per_pixel */ +"16 16 82 1", +/* colors */ +" c #000000", +". c #FBF7F3", +"X c #F4E3D5", +"o c #D7CFC9", +"O c #CAA98E", +"+ c #F6E7DA", +"@ c #999999", +"# c #FEFDFC", +"$ c #F7E9DE", +"% c #EED5BE", +"& c #898989", +"* c #CBAD95", +"= c #F2E0CF", +"- c #BCB7B1", +"; c #F7EBE1", +": c #D3C3B7", +"> c #FBF6F2", +", c #F1DBC7", +"< c #6D6D6D", +"1 c #6B6B6B", +"2 c #C79F80", +"3 c #D1BEAE", +"4 c #FAF1EA", +"5 c #F2DDCB", +"6 c #BEB6AF", +"7 c #FEFCFB", +"8 c #EED4BD", +"9 c #8F8984", +"0 c #FAF3ED", +"q c #FEFEFE", +"w c #CFB7A5", +"e c #FCFCFC", +"r c #EAEAEA", +"t c #FCF9F5", +"y c #CDB29C", +"u c #DEDEDE", +"i c #FDFBF9", +"p c #F5E7DA", +"a c #D1BFB0", +"s c #FAF2EC", +"d c #CECECE", +"f c #FEFDFD", +"g c #CEB6A3", +"h c #F6E9DE", +"j c #F6F5F5", +"k c #E7E0D9", +"l c #F2E0D0", +"z c #F8EDE3", +"x c #C9A68A", +"c c #F4E4D5", +"v c #F9EFE7", +"b c #F0DBC7", +"n c #F5E6D9", +"m c #FAF1EB", +"M c #D5C9C0", +"N c #EED4BE", +"B c #F8ECE2", +"V c #D0BBAA", +"C c #F9EEE6", +"Z c #707070", +"A c #F1DAC7", +"S c #F5E5D8", +"D c #585858", +"F c #FFFFFF", +"G c #C8A487", +"H c #F6E9DF", +"J c #FBF6F1", +"K c #424242", +"L c #ECCEB4", +"P c #F0D9C5", +"I c #FCF8F5", +"U c #CDB19C", +"Y c #303030", +"T c #E9C7AA", +"R c #FAF3EC", +"E c #CBAC93", +"W c #FFFEFE", +"Q c #FAF5EF", +"! c #F3E1D1", +"~ c #E2E0DE", +"^ c #F7ECE2", +"/ c None", +/* pixels */ +"//DDDDDDDDD/////", +"//Duuuuu-D@D////", +"//DuFFFFr<F@D///", +"//DuFFFFeZdF@Y//", +"//DuFFFFF&Z1KY//", +"//DuFFFFFj~-9Y//", +"//DuFFFFF7>k6Y//", +"//DuFFFF7.4HaY//", +"//DuFFWiQvhXVY//", +"//DuFqiJC$c5gY//", +"//DuFfI0B+!,yY//", +"//Du#IRzn!bN*Y//", +"//Duts^p=A%LOY//", +"//Dum;SlP8LTGY//", +"//DooM:3wUEx2Y//", +"//DYYYYYYYYYYY//" +}; diff --git a/kmatplot/pixmaps/action_open.xpm b/kmatplot/pixmaps/action_open.xpm new file mode 100644 index 0000000..85eb9bc --- /dev/null +++ b/kmatplot/pixmaps/action_open.xpm @@ -0,0 +1,120 @@ +/* XPM */ +static const char *action_open[] = { +/* width height ncolors chars_per_pixel */ +"16 16 97 2", +/* colors */ +" c #000000", +" . c #F8AC62", +" X c #D6D6D5", +" o c #D2D2D1", +" O c #1F1F1E", +" + c #FEC282", +" @ c #CCCCCB", +" # c #CACAC9", +" $ c #C6C6C5", +" % c #C2C2C1", +" & c #BABAB9", +" * c #B6B6B5", +" = c #AEAEAD", +" - c #565350", +" ; c #54514E", +" : c #524F4C", +" > c #A6A6A5", +" , c #A2A2A1", +" < c #A0A09F", +" 1 c #9E9E9D", +" 2 c #9A9A99", +" 3 c #4A3119", +" 4 c #949493", +" 5 c #434343", +" 6 c #ADADAB", +" 7 c #C4864E", +" 8 c #ECECEC", +" 9 c #E4E4E4", +" 0 c #686867", +" q c #DCDCDC", +" w c #DADADA", +" e c #232323", +" r c #D4D4D4", +" t c #8D8D8B", +" y c #CECECE", +" u c #4C4C4B", +" i c #4A4A49", +" p c #C4C4C4", +" a c #BCBCBC", +" s c #343433", +" d c #4E331B", +" f c #E1E1E0", +" g c #DFDFDE", +" h c #53514E", +" j c #DDDDDC", +" k c #DBDBDA", +" l c #D5D5D4", +" z c #222221", +" x c #CBCBCA", +" c c #C7C7C6", +" v c #E5A566", +" b c #C3C3C2", +" n c #C1C1C0", +" m c #BFBFBE", +" M c #FEC585", +" N c #B9B9B8", +" B c #E6E6E4", +" V c #AFAFAE", +" C c #ADADAC", +" Z c #FDC587", +" A c #ABABAA", +" S c #55524F", +" D c #A9A9A8", +" F c #53504D", +" G c #A7A7A6", +" H c #A5A5A4", +" J c #A1A1A0", +" K c #D2D2D0", +" L c #493018", +" P c #959594", +" I c #C4C4C2", +" U c #BEBEBC", +" Y c #4C4C4C", +" T c #4A4A4A", +" R c #464646", +" E c #F5F5F5", +" W c #AEAEAC", +" Q c #AAAAA8", +" ! c #6F6F6E", +" ~ c #FEC88A", +" ^ c #303030", +" / c #DBDBDB", +" ( c #949492", +" ) c #B77D44", +" _ c #CDCDCD", +" ` c #CBCBCB", +" ' c #FED39A", +" ] c #4B4B4A", +" [ c #494948", +" { c #121212", +" } c #BDBDBD", +" | c #414140", +". c #B5B5B5", +".. c #B3B3B3", +".X c #E8E8E7", +".o c #5C5A57", +".O c None", +/* pixels */ +".O.O.O.O.O.O .O.O.O.O.O.O", +".O.O.O.O.O .O .O .O.O", +".O.O.O.O .O.O.O.O.O .O.O", +".O.O.O.O.O.O.O.O.O.O.O .O.O", +".O.O.O.O.O.O.O.O.O.O .O.O", +".O d d d d.O.O.O.O.O.O.O.O.O.O.O", +" d v ' M v d d d d d d d.O.O.O.O", +" d ' Z + . . . . . . . . .O.O.O", +" d ~ + d F F S.o ; ; - - ; ", +" d + 7 : E E 8 9 q r ` p a. .. ^", +" d + 3 / g.X B g o c & C < 4 [.O", +" d ) h w k f j X x n * D < 0 z.O", +" d L _ # l l K @ % N V , P [.O.O", +" d - y U I $ b m * = H 1 ! {.O.O", +" d } > Q 6 W A G J 2 ( t [.O.O.O", +" e T i u Y u ] [ R 5 | s O.O.O.O" +}; diff --git a/kmatplot/pixmaps/action_paste.xpm b/kmatplot/pixmaps/action_paste.xpm new file mode 100644 index 0000000..83bfd8e --- /dev/null +++ b/kmatplot/pixmaps/action_paste.xpm @@ -0,0 +1,126 @@ +/* XPM */ +static const char *action_paste[] = { +/* width height ncolors chars_per_pixel */ +"16 16 103 2", +/* colors */ +" c #000000", +" . c #AFAFAF", +" X c #C0A077", +" o c #D2CC8F", +" O c #9F9F9F", +" + c #C3B59E", +" @ c #ABA062", +" # c #9B9B9B", +" $ c #999999", +" % c #979797", +" & c #959595", +" * c #C2AB89", +" = c #939393", +" - c #919191", +" ; c #8F8F8F", +" : c #BEA585", +" > c #C2A67F", +" , c #8D8D8D", +" < c #8B8B8B", +" 1 c #898989", +" 2 c #C1A174", +" 3 c #878787", +" 4 c #858585", +" 5 c #838383", +" 6 c #818181", +" 7 c #7F7F7F", +" 8 c #7D7D7D", +" 9 c #7B7B7B", +" 0 c #BFA47F", +" q c #8A7E2D", +" w c #6D6D6D", +" e c #BBB574", +" r c #716B32", +" t c #696969", +" y c #857414", +" u c #3D3D3D", +" i c #C09B6B", +" p c #3B3B3B", +" a c #393939", +" s c #5A5000", +" d c #FBF7F4", +" f c #E2E2E2", +" g c #DEDEDE", +" h c #DCDCDC", +" j c #292929", +" k c #F5E9DA", +" l c #E9C9A0", +" z c #C09F71", +" x c #F0DDC1", +" c c #C2C2C2", +" v c #BCBCBC", +" b c #BDAC92", +" n c #050505", +" m c #B6B6B6", +" M c #A49941", +" N c #C4B9A9", +" B c #A2A2A2", +" V c #BDB4AC", +" C c #9C9C9C", +" Z c #C3AF94", +" A c #969696", +" S c #929292", +" D c #909090", +" F c #8E8E8E", +" G c #8A8A8A", +" H c #F1E3CE", +" J c #E1DEDC", +" K c #808080", +" L c #7E7E7E", +" P c #7C7C7C", +" I c #7A7A7A", +" U c #787878", +" Y c #747474", +" T c #F8F0E5", +" R c #EBD0AA", +" E c #707070", +" W c #86761F", +" Q c #6A6A6A", +" ! c #686868", +" ~ c #666666", +" ^ c #232110", +" / c #4B452A", +" ( c #FFFFFF", +" ) c #444444", +" _ c #424242", +" ` c #C6BEB3", +" ' c #3C3C3C", +" ] c #3A3A3A", +" [ c #383838", +" { c #F9F6F2", +" } c #EDD6B8", +" | c #303030", +". c #2E2E2E", +".. c #F6F6DB", +".X c #262626", +".o c #242424", +".O c #D5D5D5", +".+ c #CFCFCF", +".@ c #1C1C1C", +".# c #C9C9C9", +".$ c #BFBFBF", +".% c #020202", +".& c None", +/* pixels */ +".&.&.&.&.& ^ r q s.&.&.&.&.&.&.&", +".& ' ' ' ' M ( o @ s ' ' ' '.&.&", +" u f h h W.. o e M y s c.$ v j.&", +" ' h B O W s s / / / / 8 U Y.X.&", +" ' h O C $ & ) ) ) ) ) ) ) ~.o.&", +" '.O # $ A = ) g g g g g w _.@.&", +" '.+ % & = D ) g ( ( ( ( E d _.&", +" '.# S - ; , ) g ( ( ( ( E E _ _", +" p c F , < 1 ) g ( ( ( { T J V ", +" ] v G 1 3 4 ) g ( ( { T k H b ", +" a m 4 4 5 6 ) g ( { T k H x : ", +" a . 6 K 7 L ) g { T k H x } 0 ", +" [ . 8 P 9 I ) g T k H x } R X ", +". ~ Q Q t ! ) g k H x } R l z ", +".&.%.%.%.% n ) ` N + Z * > 2 i ", +".&.&.&.&.&.& ) |" +}; diff --git a/kmatplot/pixmaps/action_pixmap.xpm b/kmatplot/pixmaps/action_pixmap.xpm new file mode 100644 index 0000000..9e92d45 --- /dev/null +++ b/kmatplot/pixmaps/action_pixmap.xpm @@ -0,0 +1,30 @@ +/* XPM */ +static const char *action_pixmap[] = { +/* width height ncolors chars_per_pixel */ +"16 16 7 1", +/* colors */ +" c #000000", +". c #34D300", +"X c #001ECC", +"o c #EADE00", +"O c #FFFFFF", +"+ c #B70000", +"@ c None", +/* pixels */ +" ", +" OOOO OOOO ", +" OOOO OOOO ", +" OOOO OOOO ", +" OOOO OOOO ", +" ", +" OOOO .... OOOO ", +" OOOO .... OOOO ", +" OOOO .... OOOO ", +" OOOO .... OOOO ", +" ", +" XXXX oooo ++++ ", +" XXXX oooo ++++ ", +" XXXX oooo ++++ ", +" XXXX oooo ++++ ", +" " +}; diff --git a/kmatplot/pixmaps/action_print.xpm b/kmatplot/pixmaps/action_print.xpm new file mode 100644 index 0000000..92f487a --- /dev/null +++ b/kmatplot/pixmaps/action_print.xpm @@ -0,0 +1,96 @@ +/* XPM */ +static const char *action_print[] = { +/* width height ncolors chars_per_pixel */ +"16 16 73 1", +/* colors */ +" c #000000", +". c #F6E2CD", +"X c #A4A1A4", +"o c #A59FA5", +"O c #A49DA4", +"+ c #A0A1A0", +"@ c #9C9D9C", +"# c #9C999C", +"$ c #9A9B9A", +"% c #8B898B", +"& c #838183", +"* c #E6CEAC", +"= c #837D83", +"- c #FFF6F6", +"; c #7B7D7B", +": c #FFF2F6", +"> c #BD9D73", +", c #BD9973", +"< c #6A656A", +"1 c #626562", +"2 c #00FF00", +"3 c #5A595A", +"4 c #5A4839", +"5 c #EED6BD", +"6 c #584637", +"7 c #EED2BD", +"8 c #DFC097", +"9 c #FFFAFF", +"0 c #F0ECF0", +"q c #EECEAC", +"w c #EEE6EE", +"e c #BDB24A", +"r c #E6E6E6", +"t c #E6E2E6", +"y c #FFF2EE", +"u c #FFEEEE", +"i c #D7D0D7", +"p c #D5CED5", +"a c #CDCECD", +"s c #CDCACD", +"d c #CDC6CD", +"f c #C5C6C5", +"g c #5A4831", +"h c #524C29", +"j c #BDBABD", +"k c #524829", +"l c #BDB6BD", +"z c #ACAAAC", +"x c #F6EEEE", +"c c #E6C29C", +"v c #DEC294", +"b c #574637", +"n c #EEE6D5", +"m c #EEE2D5", +"M c #F6EEE6", +"N c #F6EAE6", +"B c #585858", +"V c #FFFFFF", +"C c #4A444A", +"Z c #F6E2D5", +"A c #414441", +"S c #EEE2CD", +"D c #EEC28B", +"F c #EEDECD", +"G c #EEDACD", +"H c #3A3A3A", +"J c #393839", +"K c #313031", +"L c #CECBCE", +"P c #F6EADE", +"I c #F6E6DE", +"U c #EEC294", +"Y c None", +/* pixels */ +"YYYYYYYY46bYYYYY", +"YYYYYYY4VV>44YYY", +"YYYYYY4M999VZg4Y", +"YYYYYYg-99-:N.c ", +"YYYYH4u-9-:MPS> ", +"YYYH@4nxxyNPFc Y", +"YYHO3,U*ImZG53hY", +"YH@XX< ,Dq7cv ek", +"HOX@X@z1 <>,KehY", +"H0Vr+o@@#X1 1k; ", +"Hspr0Vw$@%%&&=3 ", +"HXldsat0Vr;&;3A ", +"Y 3XjdLirVV3CJ ", +"YYYY 3Xld2fAJ Y", +"YYYYYYY 3XjJ YY", +"YYYYYYYYYY YYY" +}; diff --git a/kmatplot/pixmaps/action_properties.xpm b/kmatplot/pixmaps/action_properties.xpm new file mode 100644 index 0000000..628e7d4 --- /dev/null +++ b/kmatplot/pixmaps/action_properties.xpm @@ -0,0 +1,157 @@ +/* XPM */ +static const char *action_properties[] = { +/* width height ncolors chars_per_pixel */ +"16 16 134 2", +/* colors */ +" c #000000", +" . c #8E8D88", +" X c #77684D", +" o c #BA9350", +" O c #CAC8C6", +" + c #E3BE8C", +" @ c #E5B263", +" # c #FCDEAB", +" $ c #C3C2BF", +" % c #CBCACA", +" & c #C4C4C3", +" * c #C1BDB6", +" = c #F4C585", +" - c #3C3C3A", +" ; c #B2B4B1", +" : c #D39B4A", +" > c #0070A7", +" , c #BCBCBE", +" < c #6F552D", +" 1 c #2B2A29", +" 2 c #BBB9B3", +" 3 c #A4976E", +" 4 c #35332C", +" 5 c #E8C593", +" 6 c #6F6E68", +" 7 c #2A0800", +" 8 c #CECFCF", +" 9 c #403F3D", +" 0 c #999791", +" q c #160000", +" w c #BAB6AE", +" e c #817F76", +" r c #DAB988", +" t c #CECDD2", +" y c #53524C", +" u c #FBE7B2", +" i c #B9B6B0", +" p c #DCAE6C", +" a c #696147", +" s c #252522", +" d c #F3E9D5", +" f c #8E8D89", +" g c #9B8E78", +" h c #8A8985", +" j c #2F2F2F", +" k c #76756E", +" l c #FAD39D", +" z c #8E8F8C", +" x c #E4AD59", +" c c #1F1F1F", +" v c #1D1D1D", +" b c #1B1B1B", +" n c #CCCCCC", +" m c #848382", +" M c #2C2A25", +" N c #71716C", +" B c #3A3A36", +" V c #EEBD7D", +" C c #B7B3AA", +" Z c #514028", +" A c #6E6D6C", +" S c #B5B3AB", +" D c #7E7C75", +" F c #A39F96", +" G c #B89358", +" H c #CFCFCB", +" J c #F6E4C3", +" K c #DDA64E", +" L c #6A6861", +" P c #E7D2B4", +" I c #CDA35F", +" U c #1A1A19", +" Y c #CFCCC4", +" T c #81807E", +" R c #D19D4F", +" E c #D4D5D6", +" W c #988D7A", +" Q c #3F3F3D", +" ! c #61605B", +" ~ c #504E47", +" ^ c #4D4C44", +" / c #686865", +" ( c #8C8B85", +" ) c #BCBDBE", +" _ c #403E37", +" ` c #84837D", +" ' c #F9E5B1", +" ] c #C79C55", +" [ c #C59A53", +" { c #333334", +" } c #36342D", +" | c #CECECC", +". c #BBBAB6", +".. c #DFBF94", +".X c #CAC7BE", +".o c #0B0B09", +".O c #2F2E29", +".+ c #DFA44B", +".@ c #2C2A26", +".# c #060504", +".$ c #050503", +".% c #ABA59C", +".& c #4E3C23", +".* c #9C9480", +".= c #6D6D69", +".- c #F0BE76", +".; c #C1C2C2", +".: c #FDF5BE", +".> c #A59782", +"., c #6E6F6D", +".< c #5400BE", +".1 c #D9D6CC", +".2 c #B4B1AB", +".3 c #E3D4C2", +".4 c #2E2E2E", +".5 c #999897", +".6 c #C6C5C3", +".7 c #B9975D", +".8 c #E1AC56", +".9 c #695940", +".0 c #312F2A", +".q c #0B0A08", +".w c #E3A74E", +".e c #AFAA9F", +".r c #AEAA9E", +".t c #C29D69", +".y c #F3E0C4", +".u c #B4B5B1", +".i c #767674", +".p c #F8D6A1", +".a c #FCE7B2", +".s c #F2DFBC", +".d c #262522", +".f c None", +/* pixels */ +".f.f.f.f.f.f.f.f.f.f.f.f.f.f.f.f", +".f.f.f.f.f.f.f 9 9.f.f.f.f.f.f.f", +".f.f.f v.f.f 9 ) , Q.f.f c.f.f.f", +".f.f b t 9 / D.r.e e.= 9 E U.f.f", +".f.f.f 9.; W G [ ].7.* 8 9.f.f.f", +".f.f.f A g :.w.8 @.- p.>.i.f.f.f", +" - T h.% o.+ R.& Z + l.t C f m {", +" B & O w I K <.f.f X #...X H % j", +".f.o.O F r x =.9 a.: ' P i.0.q.f", +".f.f.f y * 5 V.p u.a.s.1 !.f.f.f", +".f.f 1. 0.2.3.y J d Y S |.4.f.f", +".f.# ` 2 L _ N ;.u k _ 6 n z.$.f", +".f.f s ^ }.f 9 $.6 9.f 4 ~.d.f.f", +".f.f.f.f.f.f.f ( ..f.f.f.f.f.f.f", +".f.f.f.f.f.f.f.@ M.f.f.f.f.f.f.f", +".f.f.f.f.f.f.f.f.f.f.f.f.f.f.f.f" +}; diff --git a/kmatplot/pixmaps/action_raise.xpm b/kmatplot/pixmaps/action_raise.xpm new file mode 100644 index 0000000..5fff299 --- /dev/null +++ b/kmatplot/pixmaps/action_raise.xpm @@ -0,0 +1,105 @@ +/* XPM */ +static const char *action_raise[] = { +/* width height ncolors chars_per_pixel */ +"16 16 82 1", +/* colors */ +" c #000000", +". c #1390B4", +"X c #2F0500", +"o c #155474", +"O c #0A263B", +"+ c #710C02", +"@ c #1CA2C3", +"# c #159ABC", +"$ c #0E97BF", +"% c #27BED4", +"& c #138DB0", +"* c #0F5D7E", +"= c #155A7A", +"- c #194A6A", +"; c #0F4B6A", +": c #59C3DA", +"> c #07182A", +", c #2CC7D5", +"< c #CDEBF6", +"1 c #7DA0B8", +"2 c #B6DAE9", +"3 c #43D5DE", +"4 c #081E31", +"5 c #0A1929", +"6 c #DDEFF8", +"7 c #5486A3", +"8 c #FDFCFD", +"9 c #FDFAFD", +"0 c #0A121F", +"q c #42556D", +"w c #1CB8D5", +"e c #48DFE9", +"r c #80C2DB", +"t c #287C9F", +"y c #9EDAEB", +"u c #4BBFD8", +"i c #E2F0F9", +"p c #17587A", +"a c #155678", +"s c #1BB9D0", +"d c #135476", +"f c #19B3CE", +"g c #14A5C9", +"h c #18415D", +"j c #50B3CF", +"k c #819EBA", +"l c #0B273C", +"z c #0A273B", +"x c #010304", +"c c #2A98B3", +"v c #105375", +"b c #C3162E", +"n c #124C6D", +"m c #0EA0C5", +"M c #1B4F6F", +"N c #2294B1", +"B c #1290B5", +"V c #58ACC5", +"C c #323E01", +"Z c #214764", +"A c #3CD7E1", +"S c #9DDEEE", +"D c #061625", +"F c #20374F", +"G c #178EAC", +"H c #22BAD1", +"J c #71D1E0", +"K c #14839F", +"L c #124D6F", +"P c #000101", +"I c #081C2D", +"U c #071C2C", +"Y c #116C92", +"T c #1197B9", +"R c #1B4B6A", +"E c #082033", +"W c #114760", +"Q c #50C1D9", +"! c #071728", +"~ c #3C5C73", +"^ c #06101D", +"/ c None", +/* pixels */ +"////////////////", +"////////////////", +"///////L0///////", +"//////okp4//////", +"/////-k6.a!/////", +"////Rk8:A.=!////", +"///Mk8JfmeBd>///", +"//nki:f$$mA@v^//", +"/vFx WS$H#*P /", +"/////v<T3NO/////", +"/////v9T3cz/////", +"/////v<T,Gz/////", +"/////vrVHK /////", +"/////v5IU /////", +"////////////////", +"////////////////" +}; diff --git a/kmatplot/pixmaps/action_rectangle.xpm b/kmatplot/pixmaps/action_rectangle.xpm new file mode 100644 index 0000000..11a9bda --- /dev/null +++ b/kmatplot/pixmaps/action_rectangle.xpm @@ -0,0 +1,32 @@ +/* XPM */ +static const char *action_rectangle[] = { +/* width height ncolors chars_per_pixel */ +"20 20 5 1", +/* colors */ +" c #000000", +". c #281818", +"X c #A0A0A0", +"o c #FFFFFF", +"O c None", +/* pixels */ +"OOOOOOOOOOOOOOOOOOOO", +"O..................O", +"O.oooooooooooooooo.O", +"O.oooooooooooooooo.O", +"O.ooXXXXXXXXXXXXXX.O", +"O.ooXXXXXXXXXXXXXX.O", +"O.ooXXXXXXXXXXXXXX.O", +"O.ooXXXXXXXXXXXXXX.O", +"O.ooXXXXXXXXXXXXXX.O", +"O.ooXXXXXXXXXXXXXX.O", +"O.ooXXXXXXXXXXXXXX.O", +"O.ooXXXXXXXXXXXXXX.O", +"O.ooXXXXXXXXXXXXXX.O", +"O.ooXXXXXXXXXXXXXX.O", +"O.ooXXXXXXXXXXXXXX.O", +"O.ooXXXXXXXXXXXXXX.O", +"O.ooXXXXXXXXXXXXXX.O", +"O.ooXXXXXXXXXXXXXX.O", +"O..................O", +"OOOOOOOOOOOOOOOOOOOO" +}; diff --git a/kmatplot/pixmaps/action_red.xpm b/kmatplot/pixmaps/action_red.xpm new file mode 100644 index 0000000..00f4091 --- /dev/null +++ b/kmatplot/pixmaps/action_red.xpm @@ -0,0 +1,25 @@ +/* XPM */ +static const char *action_red[] = { +/* width height ncolors chars_per_pixel */ +"12 12 6 1", +/* colors */ +" c #000000", +". c #800000", +"X c #FF0000", +"o c #808080", +"O c #FFFFFF", +"+ c None", +/* pixels */ +"++++++++++++", +"++++++++++++", +"++++++++++++", +"++++XX.+++++", +"+++XO.X.o+++", +"+++X.X..o+++", +"+++.X...o+++", +"++++...o++++", +"++++ooo+++++", +"++++++++++++", +"++++++++++++", +"++++++++++++" +}; diff --git a/kmatplot/pixmaps/action_redo.xpm b/kmatplot/pixmaps/action_redo.xpm new file mode 100644 index 0000000..c04e1d5 --- /dev/null +++ b/kmatplot/pixmaps/action_redo.xpm @@ -0,0 +1,93 @@ +/* XPM */ +static const char *action_redo[] = { +/* width height ncolors chars_per_pixel */ +"16 16 70 1", +/* colors */ +" c #000000", +". c #142724", +"X c #020005", +"o c #9DC6AA", +"O c #041714", +"+ c #88AB9C", +"@ c #C0D1C9", +"# c #173A23", +"$ c #214A30", +"% c #1B422A", +"& c #0D2419", +"* c #CFE0D4", +"= c #040B06", +"- c #163321", +"; c #224B30", +": c #14311F", +"> c #36A34D", +", c #90BD9F", +"< c #C1CECC", +"1 c #245135", +"2 c #071112", +"3 c #AFBEBA", +"4 c #0A1F18", +"5 c #000001", +"6 c #123926", +"7 c #1E4335", +"8 c #468166", +"9 c #43BA5C", +"0 c #050A0C", +"q c #03080A", +"w c #2F9645", +"e c #234E33", +"r c #B2D1BC", +"t c #3BB057", +"y c #0A1910", +"u c #5AB975", +"i c #0B281E", +"p c #3FAF57", +"a c #BFD0C8", +"s c #224B31", +"d c #143120", +"f c #050D0E", +"g c #227D37", +"h c #081914", +"j c #10211F", +"k c #5AA77B", +"l c #010003", +"z c #C2DBCA", +"x c #0F2417", +"c c #143D29", +"v c #153220", +"b c #259039", +"n c #DBEADF", +"m c #050E0D", +"M c #1B4029", +"N c #030C0B", +"B c #55AE72", +"V c #0D3525", +"C c #7BA08A", +"Z c #3E9951", +"A c #2A8F3D", +"S c #090F10", +"D c #42B75B", +"F c #050B0C", +"G c #03090A", +"H c #BDCEC7", +"J c #38774E", +"K c #1E472E", +"L c #162D26", +"P c None", +/* pixels */ +"PPPPPPPPPPPPPPPP", +"PPPPPPPPPPPPPPPP", +"PPPPPKKePPPPPPPP", +"PPPM%3n<$sPPPPPP", +"PP-a,gggn@$PPPP1", +"PvHggwt9ggn;PP1#", +"PdgJ7iicpDgn$1C#", +"xg1hPPPPm6>go+z#", +"=g4PPPPPPPV>gA*#", +"y&NPPPPPPPOgbZr#", +"PG2PPPPPPhgBuk8#", +"P5jqPPPPlllXll :", +"PPFLmPPPPPPPPPPP", +"PPPf.SPPPPPPPPPP", +"PPPPP505PPPPPPPP", +"PPPPPPPPPPPPPPPP" +}; diff --git a/kmatplot/pixmaps/action_save.xpm b/kmatplot/pixmaps/action_save.xpm new file mode 100644 index 0000000..2f975be --- /dev/null +++ b/kmatplot/pixmaps/action_save.xpm @@ -0,0 +1,101 @@ +/* XPM */ +static const char *action_save[] = { +/* width height ncolors chars_per_pixel */ +"16 16 78 1", +/* colors */ +" c #000000", +". c #9D9D9D", +"X c #959595", +"o c #919191", +"O c #858585", +"+ c #818181", +"@ c #7D7D7D", +"# c #7B7B7B", +"$ c #777777", +"% c #737373", +"& c #6F6F6F", +"* c #6B6B6B", +"= c #696969", +"- c #676767", +"; c #636363", +": c #616161", +"> c #575757", +", c #555555", +"< c #535353", +"1 c #515151", +"2 c #4F4F4F", +"3 c #FCFCFC", +"4 c #494949", +"5 c #FAFAFA", +"6 c #474747", +"7 c #F6F6F6", +"8 c #ECECEC", +"9 c #EAEAEA", +"0 c #353535", +"q c #E6E6E6", +"w c #333333", +"e c #2D2D2D", +"r c #292929", +"t c #D8D8D8", +"y c #D4D4D4", +"u c #D0D0D0", +"i c #CCCCCC", +"p c #BEBEBE", +"a c #B8B8B8", +"s c #050505", +"d c #030303", +"f c #AEAEAE", +"g c #A0A0A0", +"h c #9E9E9E", +"j c #989898", +"k c #949494", +"l c #929292", +"z c #909090", +"x c #8A8A8A", +"c c #848484", +"v c #828282", +"b c #808080", +"n c #7E7E7E", +"m c #7C7C7C", +"M c #7A7A7A", +"N c #787878", +"B c #767676", +"V c #6A6A6A", +"C c #666666", +"Z c #585858", +"A c #565656", +"S c #525252", +"D c #505050", +"F c #FFFFFF", +"G c #FBFBFB", +"H c #F9F9F9", +"J c #424242", +"K c #404040", +"L c #3E3E3E", +"P c #3A3A3A", +"I c #343434", +"U c #323232", +"Y c #2C2C2C", +"T c #DBDBDB", +"R c #1C1C1C", +"E c #C9C9C9", +"W c #0C0C0C", +"Q c None", +/* pixels */ +"QQQQIIIgQQQQQQQQ", +"QQQAhSl-IIgQQQQQ", +"QQQIcCtFFT;IIgQQ", +"QQjezfFFFFFF9>II", +"QQZxvtFFFFFFF&Es", +"QQr$:FFFFFFF9PpS", +"QhYmt77FFFF3*XSg", +"Q2bB+CaFGGFHPidQ", +"QrB%MnvvV+5bD.SQ", +"Qw#ZNZZ*=->4xSgQ", +"A+,kFq+J1<>LyWQQ", +"0L68q8qFF644oSQQ", +"@I 98989K14OSgQQ", +"QQgIIIq8U1LuRQQQ", +"QQQQQgIIIL>.SQQQ", +"QQQQQQQQgIIIQQQQ" +}; diff --git a/kmatplot/pixmaps/action_select.xpm b/kmatplot/pixmaps/action_select.xpm new file mode 100644 index 0000000..e327456 --- /dev/null +++ b/kmatplot/pixmaps/action_select.xpm @@ -0,0 +1,30 @@ +/* XPM */ +static const char *action_select[] = { +/* width height ncolors chars_per_pixel */ +"20 20 3 1", +/* colors */ +" c #000000", +". c #FFFFFF", +"X c None", +/* pixels */ +"XXXXXXXXXXXXXXXXXXXX", +"XXXXXX XXXXXXXXXXXXX", +"XXXXXX XXXXXXXXXXXX", +"XXXXXX . XXXXXXXXXXX", +"XXXXXX .. XXXXXXXXXX", +"XXXXXX ... XXXXXXXXX", +"XXXXXX .... XXXXXXXX", +"XXXXXX ..... XXXXXXX", +"XXXXXX ...... XXXXXX", +"XXXXXX ....... XXXXX", +"XXXXXX ..... XXXXX", +"XXXXXX ..... XXXXXXX", +"XXXXXX . ... XXXXXX", +"XXXXXX XX .. XXXXXX", +"XXXXXXXXXX ... XXXXX", +"XXXXXXXXXXX .. XXXXX", +"XXXXXXXXXXX .. XXXXX", +"XXXXXXXXXXXX XXXXX", +"XXXXXXXXXXXXXXXXXXXX", +"XXXXXXXXXXXXXXXXXXXX" +}; diff --git a/kmatplot/pixmaps/action_surface.xpm b/kmatplot/pixmaps/action_surface.xpm new file mode 100644 index 0000000..fb068a2 --- /dev/null +++ b/kmatplot/pixmaps/action_surface.xpm @@ -0,0 +1,29 @@ +/* XPM */ +static const char *action_surface[] = { +/* width height ncolors chars_per_pixel */ +"16 16 6 1", +/* colors */ +" c #000000", +". c #34D300", +"X c #EFEB00", +"o c #A0A0A0", +"O c #EA0000", +"+ c None", +/* pixels */ +"++++++++++++++++", +"++++++ ++++++", +"+++++ XXXX +++++", +"+++++ +++++", +"++++ X XX X ++++", +"++++ X XX X ++++", +"++++ XX ++++", +"+++ OO OO +++", +"+++ O OOOO O +++", +"++ O OOOO OO ++", +"++ OOOO ++", +"+ .. . . .. +", +"+ .. ...... .. +", +"++ ...... ++", +"++++ ++++", +"++++++++++++++++" +}; diff --git a/kmatplot/pixmaps/action_textbold.xpm b/kmatplot/pixmaps/action_textbold.xpm new file mode 100644 index 0000000..796ac4d --- /dev/null +++ b/kmatplot/pixmaps/action_textbold.xpm @@ -0,0 +1,27 @@ +/* XPM */ +static const char * action_textbold[] = { +"22 22 2 1", +" c None", +". c #000000", +" ", +" ", +" ", +" ", +" ......... ", +" ... ... ", +" ... ... ", +" ... ... ", +" ... ... ", +" ... ... ", +" ........ ", +" ... .... ", +" ... .... ", +" ... ... ", +" ... ... ", +" ... ... ", +" ... ... ", +" .......... ", +" ", +" ", +" ", +" "}; diff --git a/kmatplot/pixmaps/action_textcenter.xpm b/kmatplot/pixmaps/action_textcenter.xpm new file mode 100644 index 0000000..ce6f936 --- /dev/null +++ b/kmatplot/pixmaps/action_textcenter.xpm @@ -0,0 +1,26 @@ +/* XPM */ +static const char *action_textcenter[] = { +/* width height ncolors chars_per_pixel */ +"16 16 3 1", +/* colors */ +" c #000000", +". c #FFFFFF", +"X c None", +/* pixels */ +"XXXXXXXXXXXXXXXX", +"XXXXXXXXXXXXXXXX", +"XXXXXXXXXXXXXXXX", +"X X", +"XXXXXXXXXXXXXXXX", +"XXX XXX", +"XXXXXXXXXXXXXXXX", +"X X", +"XXXXXXXXXXXXXXXX", +"XXX XXX", +"XXXXXXXXXXXXXXXX", +"X X", +"XXXXXXXXXXXXXXXX", +"XXX XXX", +"XXXXXXXXXXXXXXXX", +"XXXXXXXXXXXXXXXX" +}; diff --git a/kmatplot/pixmaps/action_textcolor.xpm b/kmatplot/pixmaps/action_textcolor.xpm new file mode 100644 index 0000000..d09faeb --- /dev/null +++ b/kmatplot/pixmaps/action_textcolor.xpm @@ -0,0 +1,46 @@ +/* XPM */ +static const char *action_textcolor[] = { +/* width height ncolors chars_per_pixel */ +"16 16 23 1", +/* colors */ +" c #000000", +". c #FFA858", +"X c #004040", +"o c #DCDCDC", +"O c #C0C0FF", +"+ c #404000", +"@ c #008080", +"# c #A0A0A0", +"$ c #C05800", +"% c #808080", +"& c #C00000", +"* c #000080", +"= c #FFFFFF", +"- c #00C000", +"; c #00C0C0", +": c #008000", +"> c #303030", +", c #C0FFFF", +"< c #C0FFC0", +"1 c #C3C3C3", +"2 c #FFDCA8", +"3 c #8080FF", +"4 c None", +/* pixels */ +"444 44444444444", +"44 =o 44444 444", +"4 =oo 4444 o1 44", +" =o=o= 44 oo11 4", +" oo 1 44 o11o 4", +" o 44 o 4 133*1 ", +" o 44 oo o13O*1 ", +" oo +ooooo1***1 ", +" oooooooooo1111 ", +" oo..$oooo;;@1 4", +" oo.2$1##1;,@1 4", +" 1o$$&--:#@@X% 4", +"4 oo1-<:%1## 44", +"44 o11:::%o1 444", +"444> oo1#1 444", +"44444 444444" +}; diff --git a/kmatplot/pixmaps/action_textitalic.xpm b/kmatplot/pixmaps/action_textitalic.xpm new file mode 100644 index 0000000..6bc404c --- /dev/null +++ b/kmatplot/pixmaps/action_textitalic.xpm @@ -0,0 +1,26 @@ +/* XPM */ +static const char *action_textitalic[] = { +/* width height ncolors chars_per_pixel */ +"16 16 3 1", +/* colors */ +" c #000000", +". c #FFFFFF", +"X c None", +/* pixels */ +"XXXXXXXXXXXXXXXX", +"XXXXXXXXXXXXXXXX", +"XXXXXXXXXXXXXXXX", +"XXXXXXX XXXXX", +"XXXXXXXX XXXXXX", +"XXXXXXXX XXXXXX", +"XXXXXXX XXXXXX", +"XXXXXXX XXXXXXX", +"XXXXXXX XXXXXXX", +"XXXXXXX XXXXXXX", +"XXXXXX XXXXXXX", +"XXXXXX XXXXXXXX", +"XXXXXX XXXXXXXX", +"XXXXX XXXXXXX", +"XXXXXXXXXXXXXXXX", +"XXXXXXXXXXXXXXXX" +}; diff --git a/kmatplot/pixmaps/action_textjustify.xpm b/kmatplot/pixmaps/action_textjustify.xpm new file mode 100644 index 0000000..02fd35c --- /dev/null +++ b/kmatplot/pixmaps/action_textjustify.xpm @@ -0,0 +1,27 @@ +/* XPM */ +static const char *action_textjustify[] = { +"22 22 2 1", +" c None", +". c #000000", +" ", +" ", +" ................. ", +" ", +" ................. ", +" ", +" ................. ", +" ", +" ................. ", +" ", +" ................. ", +" ", +" ................. ", +" ", +" ................. ", +" ", +" ................. ", +" ", +" ............. ", +" ", +" ", +" "}; diff --git a/kmatplot/pixmaps/action_textleft.xpm b/kmatplot/pixmaps/action_textleft.xpm new file mode 100644 index 0000000..e1014d4 --- /dev/null +++ b/kmatplot/pixmaps/action_textleft.xpm @@ -0,0 +1,26 @@ +/* XPM */ +static const char *action_textleft[] = { +/* width height ncolors chars_per_pixel */ +"16 16 3 1", +/* colors */ +" c #000000", +". c #FFFFFF", +"X c None", +/* pixels */ +"XXXXXXXXXXXXXXXX", +"XXXXXXXXXXXXXXXX", +"XXXXXXXXXXXXXXXX", +"X X", +"XXXXXXXXXXXXXXXX", +"X XXXXX", +"XXXXXXXXXXXXXXXX", +"X X", +"XXXXXXXXXXXXXXXX", +"X XXXXX", +"XXXXXXXXXXXXXXXX", +"X X", +"XXXXXXXXXXXXXXXX", +"X XXXXX", +"XXXXXXXXXXXXXXXX", +"XXXXXXXXXXXXXXXX" +}; diff --git a/kmatplot/pixmaps/action_textright.xpm b/kmatplot/pixmaps/action_textright.xpm new file mode 100644 index 0000000..760ec70 --- /dev/null +++ b/kmatplot/pixmaps/action_textright.xpm @@ -0,0 +1,26 @@ +/* XPM */ +static const char *action_textright[] = { +/* width height ncolors chars_per_pixel */ +"16 16 3 1", +/* colors */ +" c #000000", +". c #FFFFFF", +"X c None", +/* pixels */ +"XXXXXXXXXXXXXXXX", +"XXXXXXXXXXXXXXXX", +"XXXXXXXXXXXXXXXX", +"X X", +"XXXXXXXXXXXXXXXX", +"XXXXX X", +"XXXXXXXXXXXXXXXX", +"X X", +"XXXXXXXXXXXXXXXX", +"XXXXX X", +"XXXXXXXXXXXXXXXX", +"X X", +"XXXXXXXXXXXXXXXX", +"XXXXX X", +"XXXXXXXXXXXXXXXX", +"XXXXXXXXXXXXXXXX" +}; diff --git a/kmatplot/pixmaps/action_textsubscript.xpm b/kmatplot/pixmaps/action_textsubscript.xpm new file mode 100644 index 0000000..006524c --- /dev/null +++ b/kmatplot/pixmaps/action_textsubscript.xpm @@ -0,0 +1,28 @@ +/* XPM */ +static const char *action_textsubscript[] = { +/* width height ncolors chars_per_pixel */ +"16 16 5 1", +/* colors */ +" c #000000", +". c #0000C0", +"X c #000099", +"o c #800080", +"O c None", +/* pixels */ +"OOOOOOOOOOOOOOOO", +" OOOOOOO", +" OOOOOOO OOOOOOO", +" OOOOOOO OOOOOOO", +" OOOOOOO OOOOOOO", +" OOOOOOO OOOOOOO", +" OOOOOOO OOOOOOO", +" OOOOOOO OOOOOOO", +" OOOOOOO OOOOOOO", +" OOOOOOO", +"OOOOOOOOOOOoOOoO", +"OOOOOOOOOOoooooo", +"OOOOOOOOOOOOooOO", +"OOOOOOOOOOOooOOO", +"OOOOOOOOOooooooO", +"OOOOOOOOOOoOOoOO" +}; diff --git a/kmatplot/pixmaps/action_textsuperscript.xpm b/kmatplot/pixmaps/action_textsuperscript.xpm new file mode 100644 index 0000000..d5af592 --- /dev/null +++ b/kmatplot/pixmaps/action_textsuperscript.xpm @@ -0,0 +1,29 @@ +/* XPM */ +static const char *action_textsuperscript[] = { +/* width height ncolors chars_per_pixel */ +"16 16 6 1", +/* colors */ +" c #000000", +". c #0000C0", +"X c #000099", +"o c #800080", +"O c #10DFA1", +"+ c None", +/* pixels */ +"++++++++++++++++", +"+++++++++++o++o+", +"++++++++++oooooo", +"++++++++++++oo++", +"+++++++++++oo+++", +"+++++++++oooooo+", +"++++++++++o++o++", +" +++++++", +" +++++++ +++++++", +" +++++++ +++++++", +" +++++++ +++++++", +" +++++++ +++++++", +" +++++++ +++++++", +" +++++++ +++++++", +" +++++++ +++++++", +" +++++++" +}; diff --git a/kmatplot/pixmaps/action_textunderline.xpm b/kmatplot/pixmaps/action_textunderline.xpm new file mode 100644 index 0000000..8d11b56 --- /dev/null +++ b/kmatplot/pixmaps/action_textunderline.xpm @@ -0,0 +1,26 @@ +/* XPM */ +static const char *action_textunderline[] = { +/* width height ncolors chars_per_pixel */ +"16 16 3 1", +/* colors */ +" c #000000", +". c #FFFFFF", +"X c None", +/* pixels */ +"XXXXXXXXXXXXXXXX", +"XXXXXXXXXXXXXXXX", +"XXX XXX XXX", +"XXXX XXXXX XXXX", +"XXXX XXXXX XXXX", +"XXXX XXXXX XXXX", +"XXXX XXXXX XXXX", +"XXXX XXXXX XXXX", +"XXXX XXXXX XXXX", +"XXXX XXXXX XXXX", +"XXXX XXXXX XXXX", +"XXXXX XXX XXXXX", +"XXXXXX XXXXXX", +"XXXXXXXXXXXXXXXX", +"XXX XXX", +"XXXXXXXXXXXXXXXX" +}; diff --git a/kmatplot/pixmaps/action_toback.xpm b/kmatplot/pixmaps/action_toback.xpm new file mode 100644 index 0000000..1602839 --- /dev/null +++ b/kmatplot/pixmaps/action_toback.xpm @@ -0,0 +1,94 @@ +/* XPM */ +static const char *action_toback[] = { +/* width height ncolors chars_per_pixel */ +"16 16 71 1", +/* colors */ +" c #000000", +". c #0D3652", +"X c #D3E5F0", +"o c #15C1DA", +"O c #2AB4D1", +"+ c #050B12", +"@ c #1CA2C3", +"# c #0E97BF", +"$ c #060F19", +"% c #03060C", +"& c #0C026B", +"* c #53B7D4", +"= c #05151E", +"- c #64A3BD", +"; c #0C0271", +": c #1DB4D0", +"> c #1BB2CE", +", c #0B293E", +"< c #0EADCB", +"1 c #40D1DB", +"2 c #0D4864", +"3 c #1BBAD1", +"4 c #E0F1FB", +"5 c #1299BB", +"6 c #48DFE9", +"7 c #0E5775", +"8 c #BFDFEE", +"9 c #1BABCA", +"0 c #690B02", +"q c #EFF3FC", +"w c #0B0265", +"e c #14A5C9", +"r c #620B01", +"t c #1697B7", +"y c #0E94B9", +"u c #8FCCE2", +"i c #001F03", +"p c #A7DCEC", +"a c #DFEFF8", +"s c #46B8D5", +"d c #1F95B2", +"f c #106589", +"g c #337F9E", +"h c #18425F", +"j c #600A01", +"k c #0FA2C6", +"l c #10698F", +"z c #071620", +"x c #06141F", +"c c #6F0C02", +"v c #070144", +"b c #FFFFFF", +"n c #2695B1", +"m c #124D6F", +"M c #254A64", +"N c #5FC0D8", +"B c #02710C", +"V c #026F0C", +"C c #54BDD7", +"Z c #0D324C", +"A c #0E8FB6", +"S c #114560", +"D c #0FA0C4", +"F c #0E9EC3", +"G c #144059", +"H c #46DBE6", +"J c #2B91AE", +"K c #A0CBDF", +"L c #06141D", +"P c #010001", +"I c None", +/* pixels */ +"IIIIIIIIIIIIIIII", +"IIIIIIIIIIIIIIII", +"IIIIImmmMhZIIIII", +"IIIIImKqX-zIIIII", +"IIIIIm4NuJLIIIII", +"IIIIImq<1nxIIIII", +"IIIIIM4#Hd=IIIII", +"I.mmMM8y357SG,PI", +"II.gapCA#o6@f%II", +"III.gbF#D6@f$III", +"IIII.gbe6@f+IIII", +"IIIII.ga@f+IIIII", +"IIIIII.lf$IIIIII", +"IIIIIII.%IIIIIII", +"III III", +"IIIIIIIIIIIIIIII" +}; diff --git a/kmatplot/pixmaps/action_tofront.xpm b/kmatplot/pixmaps/action_tofront.xpm new file mode 100644 index 0000000..b27f042 --- /dev/null +++ b/kmatplot/pixmaps/action_tofront.xpm @@ -0,0 +1,105 @@ +/* XPM */ +static const char *action_tofront[] = { +/* width height ncolors chars_per_pixel */ +"16 16 82 1", +/* colors */ +" c #000000", +". c #1390B4", +"X c #2F0500", +"o c #155474", +"O c #0A263B", +"+ c #710C02", +"@ c #1CA2C3", +"# c #159ABC", +"$ c #0E97BF", +"% c #27BED4", +"& c #138DB0", +"* c #0F5D7E", +"= c #155A7A", +"- c #194A6A", +"; c #0F4B6A", +": c #59C3DA", +"> c #07182A", +", c #2CC7D5", +"< c #CDEBF6", +"1 c #7DA0B8", +"2 c #B6DAE9", +"3 c #43D5DE", +"4 c #081E31", +"5 c #0A1929", +"6 c #DDEFF8", +"7 c #5486A3", +"8 c #FDFCFD", +"9 c #FDFAFD", +"0 c #0A121F", +"q c #42556D", +"w c #1CB8D5", +"e c #48DFE9", +"r c #80C2DB", +"t c #287C9F", +"y c #9EDAEB", +"u c #4BBFD8", +"i c #E2F0F9", +"p c #17587A", +"a c #155678", +"s c #1BB9D0", +"d c #135476", +"f c #19B3CE", +"g c #14A5C9", +"h c #18415D", +"j c #50B3CF", +"k c #819EBA", +"l c #0B273C", +"z c #0A273B", +"x c #010304", +"c c #2A98B3", +"v c #105375", +"b c #C3162E", +"n c #124C6D", +"m c #0EA0C5", +"M c #1B4F6F", +"N c #2294B1", +"B c #1290B5", +"V c #58ACC5", +"C c #323E01", +"Z c #214764", +"A c #3CD7E1", +"S c #9DDEEE", +"D c #061625", +"F c #20374F", +"G c #178EAC", +"H c #22BAD1", +"J c #71D1E0", +"K c #14839F", +"L c #124D6F", +"P c #000101", +"I c #081C2D", +"U c #071C2C", +"Y c #116C92", +"T c #1197B9", +"R c #1B4B6A", +"E c #082033", +"W c #114760", +"Q c #50C1D9", +"! c #071728", +"~ c #3C5C73", +"^ c #06101D", +"/ c None", +/* pixels */ +"////////////////", +"/// ///", +"///////L0///////", +"//////okp4//////", +"/////-k6.a!/////", +"////Rk8:A.=!////", +"///Mk8JfmeBd>///", +"//nki:f$$mA@v^//", +"/vFx WS$H#*P /", +"/////v<T3NO/////", +"/////v9T3cz/////", +"/////v<T,Gz/////", +"/////vrVHK /////", +"/////v5IU /////", +"////////////////", +"////////////////" +}; diff --git a/kmatplot/pixmaps/action_undo.xpm b/kmatplot/pixmaps/action_undo.xpm new file mode 100644 index 0000000..57362f4 --- /dev/null +++ b/kmatplot/pixmaps/action_undo.xpm @@ -0,0 +1,93 @@ +/* XPM */ +static const char *action_undo[] = { +/* width height ncolors chars_per_pixel */ +"16 16 70 1", +/* colors */ +" c #000000", +". c #142724", +"X c #020005", +"o c #9DC6AA", +"O c #041714", +"+ c #88AB9C", +"@ c #C0D1C9", +"# c #173A23", +"$ c #214A30", +"% c #1B422A", +"& c #0D2419", +"* c #CFE0D4", +"= c #040B06", +"- c #163321", +"; c #224B30", +": c #14311F", +"> c #36A34D", +", c #90BD9F", +"< c #C1CECC", +"1 c #245135", +"2 c #071112", +"3 c #AFBEBA", +"4 c #0A1F18", +"5 c #000001", +"6 c #123926", +"7 c #1E4335", +"8 c #468166", +"9 c #43BA5C", +"0 c #050A0C", +"q c #03080A", +"w c #2F9645", +"e c #234E33", +"r c #B2D1BC", +"t c #3BB057", +"y c #0A1910", +"u c #5AB975", +"i c #0B281E", +"p c #3FAF57", +"a c #BFD0C8", +"s c #224B31", +"d c #143120", +"f c #050D0E", +"g c #227D37", +"h c #081914", +"j c #10211F", +"k c #5AA77B", +"l c #010003", +"z c #C2DBCA", +"x c #0F2417", +"c c #143D29", +"v c #153220", +"b c #259039", +"n c #DBEADF", +"m c #050E0D", +"M c #1B4029", +"N c #030C0B", +"B c #55AE72", +"V c #0D3525", +"C c #7BA08A", +"Z c #3E9951", +"A c #2A8F3D", +"S c #090F10", +"D c #42B75B", +"F c #050B0C", +"G c #03090A", +"H c #BDCEC7", +"J c #38774E", +"K c #1E472E", +"L c #162D26", +"P c None", +/* pixels */ +"PPPPPPPPPPPPPPPP", +"PPPPPPPPPPPPPPPP", +"PPPPPPPPeKKPPPPP", +"PPPPPPs$<n3%MPPP", +"1PPPP$@nggg,a-PP", +"#1PP;ngg9twggHvP", +"#C1$ngDpcii7JgdP", +"#z+og>6mPPPPh1gx", +"#*Ag>VPPPPPPP4g=", +"#rZbgOPPPPPPPN&y", +"#8kuBghPPPPPP2GP", +": llXlllPPPPqj5P", +"PPPPPPPPPPPmLFPP", +"PPPPPPPPPPS.fPPP", +"PPPPPPPP505PPPPP", +"PPPPPPPPPPPPPPPP" +}; diff --git a/kmatplot/pixmaps/action_windows.xpm b/kmatplot/pixmaps/action_windows.xpm new file mode 100644 index 0000000..2b349ad --- /dev/null +++ b/kmatplot/pixmaps/action_windows.xpm @@ -0,0 +1,77 @@ +/* XPM */ +static const char *action_windows[] = { +/* width height ncolors chars_per_pixel */ +"17 16 54 1", +/* colors */ +" c #2C6863", +". c #466E6C", +"X c #256462", +"o c #878787", +"O c #555555", +"+ c #1386AF", +"@ c #FEFEFE", +"# c #FCFCFC", +"$ c #FAFAFA", +"% c #147A9C", +"& c #F8F8F8", +"* c #F6F6F6", +"= c #F4F4F4", +"- c #F2F2F2", +"; c #F0F0F0", +": c #EEEEEE", +"> c #ECECEC", +", c #EAEAEA", +"< c #38837D", +"1 c #588496", +"2 c #E8E8E8", +"3 c #E6E6E6", +"4 c #096990", +"5 c #225956", +"6 c #377971", +"7 c #3E8C85", +"8 c #255C58", +"9 c #075D83", +"0 c #0A5C7C", +"q c #127394", +"w c #0C6484", +"e c #1998C2", +"r c #FFFFFF", +"t c #FDFDFD", +"y c #FBFBFB", +"u c #2B6E6A", +"i c #F9F9F9", +"p c #F7F7F7", +"a c #F5F5F5", +"s c #337A75", +"d c #317873", +"f c #F1F1F1", +"g c #EFEFEF", +"h c #0F6C8D", +"j c #0F7CA4", +"k c #E9E9E9", +"l c #168FB8", +"z c #E7E7E7", +"x c #409088", +"c c #26615E", +"v c #0C739A", +"b c #075474", +"n c #C3C3C3", +"m c None", +/* pixels */ +"mmmmmccmmmmmmmmmm", +"mmmmmcrccmmmmmmmm", +"mmmmOonoxccmmmmmm", +"mmmmOao67<sccmmmm", +"mmmO-ptp duXccmm", +"mmmOfapaf>855rn.m", +"mmOffapaf>zzono.m", +"999999999999zoOmm", +"9rnel+jv4rn9zzOmm", +"9no%qhw0bno9zOmmm", +"O@r@ty&=;,3OzOmmm", +"O@@@#$p=g,3OOmmmm", +"O#t#yi*-:23OOmmmm", +"O$y$ip=;>z3Ommmmm", +"Op&p*=f:k33Ommmmm", +"OOOOOOOOOOOOmmmmm" +}; diff --git a/kmatplot/pixmaps/action_wizard.xpm b/kmatplot/pixmaps/action_wizard.xpm new file mode 100644 index 0000000..51f6ba1 --- /dev/null +++ b/kmatplot/pixmaps/action_wizard.xpm @@ -0,0 +1,33 @@ +/* XPM */ +static const char *action_wizard[] = { +/* width height ncolors chars_per_pixel */ +"16 16 10 1", +/* colors */ +" c #000000", +". c #DCDCDC", +"X c #C0C000", +"o c #808080", +"O c #FFFFFF", +"+ c #FFFF00", +"@ c #FFFFC0", +"# c #303030", +"$ c #C3C3C3", +"% c None", +/* pixels */ +"%%%%%%%%%% @%%%%", +"%%%%%%% @% +% @%", +"%%%%%%%% +X+X+%%", +"%%%%%%%%%X@@@X%%", +"%%%%%% @++@O@++@", +"%%%%%%%% X@@@X%%", +"%%%%%%% O+X+X+%%", +"%%%%%% O@O +% @%", +"%%%%% O.$ @%%%%", +"%%%% O.$ %%%%%%%", +"%%% $o$ %%%%%%%%", +"%% $o# %%%%%%%%%", +"% $o# %%%%%%%%%%", +" $o# %%%%%%%%%%%", +"$o# %%%%%%%%%%%%", +"o# %%%%%%%%%%%%%" +}; diff --git a/kmatplot/pixmaps/action_worksheet.xpm b/kmatplot/pixmaps/action_worksheet.xpm new file mode 100644 index 0000000..da8dbee --- /dev/null +++ b/kmatplot/pixmaps/action_worksheet.xpm @@ -0,0 +1,29 @@ +/* XPM */ +static const char *action_worksheet[] = { +/* width height ncolors chars_per_pixel */ +"16 16 6 1", +/* colors */ +" c #000000", +". c #008080", +"X c #FFFFFF", +"o c #EDEDED", +"O c #303030", +"+ c None", +/* pixels */ +"OO ", +"O..O.. .. .. .. ", +"OO O ", +"O..OXX XX XX XX ", +"O..OXX XX XX XX ", +"OO O ", +"O..OXX XXOXX XX ", +"O..OXXOXXOXX XX ", +"OOOOOOOOOO ", +"O..OXXOXXOXX XX ", +"O..OXXOXXOXX XX ", +"OOOOOOOOOO ", +"O..O++O++O++O++O", +"O..O+XO++O++O++O", +"OOOOOOOOOOOOOOOO", +"++++++++++++++++" +}; diff --git a/kmatplot/pixmaps/action_zoom.xpm b/kmatplot/pixmaps/action_zoom.xpm new file mode 100644 index 0000000..932f603 --- /dev/null +++ b/kmatplot/pixmaps/action_zoom.xpm @@ -0,0 +1,92 @@ +/* XPM */ +static const char *action_zoom[] = { +/* width height ncolors chars_per_pixel */ +"16 16 69 1", +/* colors */ +" c #000000", +". c #707071", +"X c #ADE4E8", +"o c #71C6CE", +"O c #8FDFE8", +"+ c #76D7E3", +"@ c #D7E5E6", +"# c #53C9D4", +"$ c #60C1CD", +"% c #404041", +"& c #AED6DB", +"* c #ADD6DA", +"= c #D5F2F4", +"- c #90D5DB", +"; c #C5E9EE", +": c #00FFFF", +"> c #76CBD5", +", c #CED8D9", +"< c #68C6D1", +"1 c #3F3F3F", +"2 c #89C8D0", +"3 c #79CAD4", +"4 c #7CC9CD", +"5 c #7F8281", +"6 c #B9DADE", +"7 c #DCF2F3", +"8 c #272727", +"9 c #EAFBFA", +"0 c #85CCD2", +"q c #B0EAEF", +"w c #ADDDE2", +"e c #0B0B0B", +"r c #090909", +"t c #070707", +"y c #010101", +"u c #3EAAB3", +"i c #B9DBE0", +"p c #B6D9DD", +"a c #DEF5F7", +"s c #90D9DF", +"d c #CDECF0", +"f c #CAEAED", +"g c #AFE9F0", +"h c #95E1EA", +"j c #3F3F40", +"k c #A8D1D5", +"l c #8BD7E0", +"z c #BEEDF1", +"x c #C3EAEC", +"c c #6FC4CE", +"v c #6DC4CC", +"b c #A8DEE5", +"n c #C1D4D6", +"m c #E3F3F4", +"M c #FFFFFF", +"N c #8ADBE5", +"B c #D0F1F5", +"V c #00C0C0", +"C c #D7E5E8", +"Z c #7AC4CB", +"A c #78D8E3", +"S c #BAECEF", +"D c #43B2BC", +"F c #E3F4F3", +"G c #C3C3C3", +"H c #101010", +"J c #0E0E0E", +"K c #020202", +"L c None", +/* pixels */ +"LLLL81JLLLLLLLLL", +"LLjK,Cn jLLLLLLL", +"Lj5m7;bX5jLLLLLL", +"LyF9azsvS LLLLLL", +"Hp=aBgOo3ieLLLLL", +"8@xzqh+$0drLLLLL", +"ekwlNA#D4& LLLLL", +"L z>c<Duz LLLLLL", +"Lj5z-Z2z5 :LLLLL", +"LLj 6f* %: LLLL", +"LLLLytyLV .G LLL", +"LLLLLLLLL %.G LL", +"LLLLLLLLLL %.G L", +"LLLLLLLLLLL %.G ", +"LLLLLLLLLLLL %. ", +"LLLLLLLLLLLLL L" +}; diff --git a/kmatplot/pixmaps/convert.pl b/kmatplot/pixmaps/convert.pl new file mode 100755 index 0000000..3f735e3 --- /dev/null +++ b/kmatplot/pixmaps/convert.pl @@ -0,0 +1,18 @@ +#!/usr/bin/perl + +$dirname="./"; +opendir( DIR, $dirname ); +while( defined($file = readdir(DIR)) ) { + if ( $file =~ /\.png$/ ) { + $inputfile = $file; + $file =~ s/\.png$/\.xpm/; + $outputfile = $file; + $file =~ s/\.xpm$//; + $iconname = $file; + #generate alpha mask + system("cat $dirname/$inputfile | pngtopnm -alpha > alpha_mask.ppm"); + #generate icon + system("cat $dirname/$inputfile | pngtopnm | ppmtoxpm -alphamask=alpha_mask.ppm -name $iconname | sed -e 's/char \\*/const char \\*/' > $dirname/$outputfile \n"); + } + } +closedir( DIR ); \ No newline at end of file diff --git a/kmatplot/pixmaps/file.list b/kmatplot/pixmaps/file.list new file mode 100644 index 0000000..a9fb520 --- /dev/null +++ b/kmatplot/pixmaps/file.list @@ -0,0 +1,2 @@ +cvs add action_contour.xpm action_copy.xpm action_curve.xpm action_cut.xpm action_delete.xpm action_exit.xpm action_exportpicture.xpm action_figure.xpm action_fullpage.xpm action_gray.xpm action_green.xpm action_label.xpm action_locate.xpm action_lower.xpm action_new.xpm action_open.xpm action_paste.xpm action_pixmap.xpm action_print.xpm action_properties.xpm action_raise.xpm action_rectangle.xpm action_redo.xpm action_red.xpm action_save.xpm action_select.xpm action_surface.xpm action_textbold.xpm action_textcenter.xpm action_textcolor.xpm action_textitalic.xpm action_textjustify.xpm action_textleft.xpm action_textright.xpm action_textsubscript.xpm action_textsuperscript.xpm action_textunderline.xpm action_toback.xpm action_tofront.xpm action_undo.xpm action_windows.xpm action_wizard.xpm action_worksheet.xpm action_zoom.xpm Makefile.am palette_color.xpm panel_arrow.xpm panel_axes.xpm panel_box.xpm panel_datasets.xpm panel_frame.xpm panel_general.xpm panel_gl.xpm panel_gradient.xpm panel_gv.xpm panel_gx.xpm panel_gy.xpm panel_gz.xpm panel_label.xpm panel_legend.xpm panel_light.xpm panel_mesh.xpm panel_more.xpm panel_object.xpm panel_pos1.xpm panel_pos2.xpm panel_position.xpm panel_rect.xpm panel_view.xpm panel_v.xpm panel_x.xpm panel_y.xpm panel_z.xpm convert.pl + diff --git a/kmatplot/pixmaps/panel_arrow.xpm b/kmatplot/pixmaps/panel_arrow.xpm new file mode 100644 index 0000000..0246b91 --- /dev/null +++ b/kmatplot/pixmaps/panel_arrow.xpm @@ -0,0 +1,31 @@ +/* XPM */ +static const char *panel_arrow[] = { +/* width height ncolors chars_per_pixel */ +"16 16 8 1", +/* colors */ +" c #000000", +". c #7F7F7F", +"X c #A0A0A0", +"o c #FF0000", +"O c #7A7A7A", +"+ c #FFFFFF", +"@ c #4C4C4C", +"# c None", +/* pixels */ +"################", +"####### #", +"####### +++++X #", +"#######. +++XX #", +"########. +XXX #", +"######### XXXX #", +"######## + XX #", +"####### + X# O #", +"###### + X### #", +"# ### + X#####X#", +" + # + X########", +"# + + X#########", +"## + X##########", +"##+ X ##########", +"#### X #########", +"##### ##########" +}; diff --git a/kmatplot/pixmaps/panel_axes.xpm b/kmatplot/pixmaps/panel_axes.xpm new file mode 100644 index 0000000..ebbd7a6 --- /dev/null +++ b/kmatplot/pixmaps/panel_axes.xpm @@ -0,0 +1,26 @@ +/* XPM */ +static const char *panel_axes[] = { +/* width height ncolors chars_per_pixel */ +"16 16 3 1", +/* colors */ +" c #000000", +". c #666666", +"X c None", +/* pixels */ +"XX XXX X XXXXXX", +"X XX X XXXXXX", +" XX XXXXXXX", +"XX XXXX XXXXXXX", +"XX XXXX XXXX X ", +"XX XXXXXXXXX X ", +"XX XXXXXXXXXX X", +"XX XXXXXXXXX X ", +"XX XXXXXXXXX X ", +"XX XXXXXXXXXXXX", +"XX XXXXXXXXX XX", +"XX XXXXXXXXX X", +"XX ", +"XX ", +"XXXXXXXXXXXXX X", +"XXXXXXXXXXXXX XX" +}; diff --git a/kmatplot/pixmaps/panel_box.xpm b/kmatplot/pixmaps/panel_box.xpm new file mode 100644 index 0000000..275dc69 --- /dev/null +++ b/kmatplot/pixmaps/panel_box.xpm @@ -0,0 +1,29 @@ +/* XPM */ +static const char *panel_box[] = { +/* width height ncolors chars_per_pixel */ +"16 16 6 1", +/* colors */ +" c #000000", +". c #CCCCCC", +"X c #FFFFFF", +"o c #FFFFC0", +"O c #E5E5E5", +"+ c None", +/* pixels */ +"++++++++++++++++", +"+++++++ +++++++", +"+++++ XX +++++", +"+++ XXXXXX +++", +"+ XXXXXXXXXX ++", +"+ X XXXXXX ++", +"+ XXX XX OO ++", +"+ XXXXX OOOO ++", +"+ XXXXX OOOOO ++", +"+ XXXXX OOOOO ++", +"+ XXXXX OOOOO ++", +"+ XXXXX OOOOO ++", +"+ XXXXX OOOO ++", +"++ XXX OO ..++", +"++++ X ....++", +"++++++ .....+++" +}; diff --git a/kmatplot/pixmaps/panel_datasets.xpm b/kmatplot/pixmaps/panel_datasets.xpm new file mode 100644 index 0000000..31ff839 --- /dev/null +++ b/kmatplot/pixmaps/panel_datasets.xpm @@ -0,0 +1,27 @@ +/* XPM */ +static const char *panel_datasets[] = { +/* width height ncolors chars_per_pixel */ +"16 16 4 1", +/* colors */ +" c #000000", +". c #007F00", +"X c #FF0000", +"o c None", +/* pixels */ +"oooooooooooooooo", +"oooooooooooooooo", +"oXXXXooooooooo..", +".XXXXXooooooo...", +"..ooXXXooooo...o", +"..oooXXooooo..oo", +"o..oooXXooo..ooo", +"o..oooXXooo..ooo", +"oo..oooXXo..oooo", +"oo..oooXXo..oooo", +"ooo..oooX..oooXX", +"ooo..oooX..oooXX", +"ooo...oo...ooXXX", +"oooo......XXXXXo", +"ooooo....oXXXXoo", +"oooooooooooooooo" +}; diff --git a/kmatplot/pixmaps/panel_frame.xpm b/kmatplot/pixmaps/panel_frame.xpm new file mode 100644 index 0000000..b9ffcec --- /dev/null +++ b/kmatplot/pixmaps/panel_frame.xpm @@ -0,0 +1,29 @@ +/* XPM */ +static const char *panel_frame[] = { +/* width height ncolors chars_per_pixel */ +"16 16 6 1", +/* colors */ +" c #000000", +". c #999999", +"X c #CCCCCC", +"o c #FFFFFF", +"O c #FFFFC0", +"+ c None", +/* pixels */ +"++++++++++++++++", +"++ +", +"++ ooooooooooo .", +"++ ooooooooooo .", +"++ ooooooooooo .", +"++ ooooooooooo .", +"++ ooooooooooo .", +"++ ooooooooooo .", +"++ ooooooooooo .", +"++ ooooooooooo .", +"++ ooooooooooo .", +"++ ooooooooooo .", +"++ ooooooooooo .", +"++ .", +"+++.............", +"++++++++++++++++" +}; diff --git a/kmatplot/pixmaps/panel_general.xpm b/kmatplot/pixmaps/panel_general.xpm new file mode 100644 index 0000000..f899660 --- /dev/null +++ b/kmatplot/pixmaps/panel_general.xpm @@ -0,0 +1,32 @@ +/* XPM */ +static const char *panel_general[] = { +/* width height ncolors chars_per_pixel */ +"16 16 9 1", +/* colors */ +" c #000000", +". c #DCDCDC", +"X c #A0A0A0", +"o c #808080", +"O c #585858", +"+ c #FFFFFF", +"@ c #303030", +"# c #C3C3C3", +"$ c None", +/* pixels */ +"$$$ $$$$$$$", +"$$$ oO..X $$$$$", +"$$$$ #OO.#X $$$$", +" $$ #O.X $$$$", +" +X $$ O..X $$$", +" +... OO...X $$$", +" O++........X $", +"@+OO++.......XX ", +" #.+OOOOX++....X", +"$ #.##XOOO++...", +"$$$ X###XOO++.", +"$$$$$$ ..XOO+", +"$$$$$$$$$$ ..XO", +"$$$$$$$$$$$$ ..", +"$$$$$$$$$$$$$$ ", +"$$$$$$$$$$$$$$$$" +}; diff --git a/kmatplot/pixmaps/panel_gl.xpm b/kmatplot/pixmaps/panel_gl.xpm new file mode 100644 index 0000000..9999069 --- /dev/null +++ b/kmatplot/pixmaps/panel_gl.xpm @@ -0,0 +1,30 @@ +/* XPM */ +static const char *panel_gl[] = { +/* width height ncolors chars_per_pixel */ +"16 16 7 1", +/* colors */ +" c #000000", +". c #333333", +"X c #007F00", +"o c #7F0000", +"O c #827F00", +"+ c #FFFF00", +"@ c None", +/* pixels */ +"@@@@@@@@@@@@@@@@", +"@@@@@@@@@@@@@@@@", +"@@@@@@@@@@@@@@@@", +"@@@@@@@@@@@@@@@@", +"@@@@....@@@..@@@", +"@@...@...@@..@@@", +"@@..@@@..@@..@@@", +"@..@@@@@@@@..@@@", +"@..@@@...@@..@@@", +"@..@@@...@@..@@@", +"@@..@@@..@@..@@@", +"@@...@...@@..@@@", +"@@@....@.@@.....", +"@@@@@@@@@@@@@@@@", +"@@@@@@@@@@@@@@@@", +"@@@@@@@@@@@@@@@@" +}; diff --git a/kmatplot/pixmaps/panel_gradient.xpm b/kmatplot/pixmaps/panel_gradient.xpm new file mode 100644 index 0000000..3b22da8 --- /dev/null +++ b/kmatplot/pixmaps/panel_gradient.xpm @@ -0,0 +1,42 @@ +/* XPM */ +static const char *panel_gradient[] = { +/* width height ncolors chars_per_pixel */ +"16 16 19 1", +/* colors */ +" c #000000", +". c #0000C0", +"X c #FFA858", +"o c #00FF00", +"O c #FFC0C0", +"+ c #FF8000", +"@ c #C0C0FF", +"# c #C0C000", +"$ c #FF0000", +"% c #000080", +"& c #FFFF00", +"* c #FFFFC0", +"= c #00C000", +"- c #008000", +"; c #C0FFC0", +": c #FFDCA8", +"> c #808000", +", c #0000FF", +"< c None", +/* pixels */ +"<<<<<<<<<<<<<<<<", +"<<<<<<<<<<<<<<<<", +"<<<<<<<<<<<<<<<<", +"<<<<<<<<<<<<<<<<", +" <<<<<<<<<<", +" OO$$ <<<<<<<<<<", +" OO$$ <<<<<<<<<", +" ::+X++ <<<<<<<<", +" +++X++ <<<<<<", +" **#&##>> <<<<<<", +" ###&##>> <<<<", +" ;;=o==---- <<<<", +" ===o==---- <<<<", +" @@.,..%.%% <<<<", +" @@.,..%.%% <<<<", +" <<<<" +}; diff --git a/kmatplot/pixmaps/panel_gv.xpm b/kmatplot/pixmaps/panel_gv.xpm new file mode 100644 index 0000000..32afb35 --- /dev/null +++ b/kmatplot/pixmaps/panel_gv.xpm @@ -0,0 +1,29 @@ +/* XPM */ +static const char *panel_gv[] = { +/* width height ncolors chars_per_pixel */ +"16 16 6 1", +/* colors */ +" c #000000", +". c #7F7F7F", +"X c #CCCCCC", +"o c #FFFFFF", +"O c #FFFFC0", +"+ c None", +/* pixels */ +"+++++++++++ +++ ", +"++++.++.+++ +++ ", +"++++.++.+++ +++ ", +"++++.++.+++ +++ ", +"++.........+ + +", +"++++.++.++++ + +", +"++++.++.+++++ ++", +"++.........+++++", +"++++.++.++.+++++", +"++++.++.++.+++++", +"++.............+", +"++++.++.++.+++++", +"++++.++.++.+++++", +"++++.++.++.+++++", +"++++++++++++++++", +"++++++++++++++++" +}; diff --git a/kmatplot/pixmaps/panel_gx.xpm b/kmatplot/pixmaps/panel_gx.xpm new file mode 100644 index 0000000..22cfc5e --- /dev/null +++ b/kmatplot/pixmaps/panel_gx.xpm @@ -0,0 +1,29 @@ +/* XPM */ +static const char *panel_gx[] = { +/* width height ncolors chars_per_pixel */ +"16 16 6 1", +/* colors */ +" c #000000", +". c #7F7F7F", +"X c #CCCCCC", +"o c #FFFFFF", +"O c #FFFFC0", +"+ c None", +/* pixels */ +"+++++++++++ +++ ", +"++++.++.+++ +++ ", +"++++.++.++++ + +", +"++++.++.+++++ ++", +"++.........+ + +", +"++++.++.+++ +++ ", +"++++.++.+++ +++ ", +"++.........+++++", +"++++.++.++.+++++", +"++++.++.++.+++++", +"++.............+", +"++++.++.++.+++++", +"++++.++.++.+++++", +"++++.++.++.+++++", +"++++++++++++++++", +"++++++++++++++++" +}; diff --git a/kmatplot/pixmaps/panel_gy.xpm b/kmatplot/pixmaps/panel_gy.xpm new file mode 100644 index 0000000..dc7fc54 --- /dev/null +++ b/kmatplot/pixmaps/panel_gy.xpm @@ -0,0 +1,29 @@ +/* XPM */ +static const char *panel_gy[] = { +/* width height ncolors chars_per_pixel */ +"16 16 6 1", +/* colors */ +" c #000000", +". c #7F7F7F", +"X c #CCCCCC", +"o c #FFFFFF", +"O c #FFFFC0", +"+ c None", +/* pixels */ +"+++++++++++ +++ ", +"++++.++.+++ +++ ", +"++++.++.++++ + +", +"++++.++.+++++ ++", +"++.........++ ++", +"++++.++.+++++ ++", +"++++.++.+++++ ++", +"++.........+++++", +"++++.++.++.+++++", +"++++.++.++.+++++", +"++.............+", +"++++.++.++.+++++", +"++++.++.++.+++++", +"++++.++.++.+++++", +"++++++++++++++++", +"++++++++++++++++" +}; diff --git a/kmatplot/pixmaps/panel_gz.xpm b/kmatplot/pixmaps/panel_gz.xpm new file mode 100644 index 0000000..addb581 --- /dev/null +++ b/kmatplot/pixmaps/panel_gz.xpm @@ -0,0 +1,29 @@ +/* XPM */ +static const char *panel_gz[] = { +/* width height ncolors chars_per_pixel */ +"16 16 6 1", +/* colors */ +" c #000000", +". c #7F7F7F", +"X c #CCCCCC", +"o c #FFFFFF", +"O c #FFFFC0", +"+ c None", +/* pixels */ +"+++++++++++ ", +"++++.++.+++++++ ", +"++++.++.++++++ +", +"++++.++.+++++ ++", +"++.........+ +++", +"++++.++.+++ ++++", +"++++.++.+++ ", +"++.........+++++", +"++++.++.++.+++++", +"++++.++.++.+++++", +"++.............+", +"++++.++.++.+++++", +"++++.++.++.+++++", +"++++.++.++.+++++", +"++++++++++++++++", +"++++++++++++++++" +}; diff --git a/kmatplot/pixmaps/panel_label.xpm b/kmatplot/pixmaps/panel_label.xpm new file mode 100644 index 0000000..aeb6160 --- /dev/null +++ b/kmatplot/pixmaps/panel_label.xpm @@ -0,0 +1,27 @@ +/* XPM */ +static const char *panel_label[] = { +/* width height ncolors chars_per_pixel */ +"16 16 4 1", +/* colors */ +" c #000000", +". c #DCDCDC", +"X c #FFFFFF", +"o c None", +/* pixels */ +"oooooooooooooooo", +"oooooooooooooooo", +"oo .ooooooo .oo", +"oo .oooooo . .o", +"oooooooooooooooo", +"oo .o .oo .o", +"o .o . .o . .o .", +"o .o . .o . .ooo", +"o . .o .ooo", +"o .o . .o . .ooo", +"o .o . .o . .o .", +"o .o . .oo .o", +"oooooooooooooooo", +"oooooooooooooooo", +"oooooooooooooooo", +"oooooooooooooooo" +}; diff --git a/kmatplot/pixmaps/panel_legend.xpm b/kmatplot/pixmaps/panel_legend.xpm new file mode 100644 index 0000000..583e598 --- /dev/null +++ b/kmatplot/pixmaps/panel_legend.xpm @@ -0,0 +1,29 @@ +/* XPM */ +static const char *panel_legend[] = { +/* width height ncolors chars_per_pixel */ +"16 16 6 1", +/* colors */ +" c #000000", +". c #A0A0A0", +"X c #FFFFFF", +"o c #FFFFC0", +"O c #303030", +"+ c None", +/* pixels */ +"++++++++++++++++", +"++++++++++++++++", +"+++ +++", +"+++ XXXXXXXX O++", +"+++ XOOOX X O++", +"+++ XO.OXXXX O++", +"+++ XO.OXXXX O++", +"+++ XO.OXXXX O++", +"+++ XO.OXXXo O++", +"+++ XO.OXXXo O++", +"+++ XO.OXooo O++", +"+++ XOOOX o O++", +"+++ XoXooooo O++", +"+++ O++", +"++++OOOOOOOOOO++", +"++++++++++++++++" +}; diff --git a/kmatplot/pixmaps/panel_light.xpm b/kmatplot/pixmaps/panel_light.xpm new file mode 100644 index 0000000..bc6da79 --- /dev/null +++ b/kmatplot/pixmaps/panel_light.xpm @@ -0,0 +1,35 @@ +/* XPM */ +static const char *panel_light[] = { +/* width height ncolors chars_per_pixel */ +"16 16 12 1", +/* colors */ +" c #000000", +". c #FFA858", +"X c #DCDCDC", +"o c #A0A0A0", +"O c #808080", +"+ c #585858", +"@ c #FFFFFF", +"# c #FFFF00", +"$ c #FFFFC0", +"% c #303030", +"& c #FFDCA8", +"* c None", +/* pixels */ +"***** ******", +"**** #&&&# *****", +"*** #$.&.## ****", +"** #&.&$&.&# ***", +"** #.&&$&..# ***", +"** #.&$@$&.# ***", +"** #$$ $#&## ***", +"*** #& # ## ****", +"**** ## ## *****", +"**** .# #. *****", +"***** # # ******", +"***** X ******", +"***** XO+ ******", +"***** +Oo ******", +"***** %+% ******", +"****** *******" +}; diff --git a/kmatplot/pixmaps/panel_mesh.xpm b/kmatplot/pixmaps/panel_mesh.xpm new file mode 100644 index 0000000..4af120b --- /dev/null +++ b/kmatplot/pixmaps/panel_mesh.xpm @@ -0,0 +1,58 @@ +/* XPM */ +static const char *panel_mesh[] = { +/* width height ncolors chars_per_pixel */ +"16 16 35 1", +/* colors */ +" c #000000", +". c #336600", +"X c #FF3300", +"o c #999999", +"O c #330000", +"+ c #666600", +"@ c #FFCC33", +"# c #660000", +"$ c #996600", +"% c #003333", +"& c #999966", +"* c #990000", +"= c #CC6600", +"- c #333333", +"; c #CCCCCC", +": c #003300", +"> c #CC0000", +", c #FF6600", +"< c #663333", +"1 c #999933", +"2 c #333300", +"3 c #FF0000", +"4 c #663300", +"5 c #FF9933", +"6 c #666666", +"7 c #FFFFFF", +"8 c #993300", +"9 c #CC9900", +"0 c #000033", +"q c #006600", +"w c #CC3300", +"e c #FF9900", +"r c #FFCC66", +"t c #FFFFCC", +"y c None", +/* pixels */ +"yyyyyyyyyyyyyyyy", +"yyyyyyyy--2----y", +"yyyyyy-21r-&&&-y", +"yyyyy-2942<----y", +"yyyy28 4911@r<yy", +"yyy##O=ee$95@-yy", +"yy2O*4,,=24442yy", +"yyO>3#4O42===2yy", +"y-48#O>XX4XX,-yy", +"y-2O##333#XXX-yy", +"y::+448w**333-yy", +"y:q.2242OO###yyy", +"y%qq::2-yyyyyyyy", +"y%%:yyyyyyyyyyyy", +"y0yyyyyyyyyyyyyy", +"yyyyyyyyyyyyyyyy" +}; diff --git a/kmatplot/pixmaps/panel_more.xpm b/kmatplot/pixmaps/panel_more.xpm new file mode 100644 index 0000000..abb6f27 --- /dev/null +++ b/kmatplot/pixmaps/panel_more.xpm @@ -0,0 +1,25 @@ +/* XPM */ +static const char *panel_more[] = { +/* width height ncolors chars_per_pixel */ +"16 16 2 1", +/* colors */ +" c #000000", +". c None", +/* pixels */ +"................", +"................", +"..... ..........", +"..... .........", +"..... ........", +"..... .......", +"..... ......", +"..... .....", +"..... .....", +"..... ......", +"..... .......", +"..... ........", +"..... .........", +"..... ..........", +"................", +"................" +}; diff --git a/kmatplot/pixmaps/panel_object.xpm b/kmatplot/pixmaps/panel_object.xpm new file mode 100644 index 0000000..5765043 --- /dev/null +++ b/kmatplot/pixmaps/panel_object.xpm @@ -0,0 +1,29 @@ +/* XPM */ +static const char *panel_object[] = { +/* width height ncolors chars_per_pixel */ +"16 16 6 1", +/* colors */ +" c #000000", +". c #007F00", +"X c #7F0000", +"o c #827F00", +"O c #FFFF00", +"+ c None", +/* pixels */ +"++++++++.....+++", +"+++++++.......++", +"++++++.........+", +"++++++.........+", +"++++++....o....+", +"++++++...oOo...+", +"+XXXXXX.oOOOo..+", +"+XXXXXXoOOOOOo++", +"+XXXXXoOOOOOOOo+", +"+XXXXoOOOOOOOOOo", +"+XXXXooooooooooo", +"+XXXXXXXXXX+++++", +"+XXXXXXXXXX+++++", +"+XXXXXXXXXX+++++", +"+XXXXXXXXXX+++++", +"++++++++++++++++" +}; diff --git a/kmatplot/pixmaps/panel_pos1.xpm b/kmatplot/pixmaps/panel_pos1.xpm new file mode 100644 index 0000000..bf82bb4 --- /dev/null +++ b/kmatplot/pixmaps/panel_pos1.xpm @@ -0,0 +1,31 @@ +/* XPM */ +static const char *panel_pos1[] = { +/* width height ncolors chars_per_pixel */ +"16 16 8 1", +/* colors */ +" c #000000", +". c #7F7F7F", +"X c #A0A0A0", +"o c #FF0000", +"O c #7A7A7A", +"+ c #FFFFFF", +"@ c #4C4C4C", +"# c None", +/* pixels */ +"################", +"################", +"############ #", +"########### +++ ", +"########### +++ ", +"########### +++ ", +"# ### ### #", +"# ### ## #######", +"# ### # #######", +"# ### ## #######", +"# ### #######", +"# ###### #######", +"# ###### #######", +"# ###### #######", +"# ##### ######", +"################" +}; diff --git a/kmatplot/pixmaps/panel_pos2.xpm b/kmatplot/pixmaps/panel_pos2.xpm new file mode 100644 index 0000000..1d55435 --- /dev/null +++ b/kmatplot/pixmaps/panel_pos2.xpm @@ -0,0 +1,31 @@ +/* XPM */ +static const char *panel_pos2[] = { +/* width height ncolors chars_per_pixel */ +"16 16 8 1", +/* colors */ +" c #000000", +". c #7F7F7F", +"X c #A0A0A0", +"o c #FF0000", +"O c #7A7A7A", +"+ c #FFFFFF", +"@ c #4C4C4C", +"# c None", +/* pixels */ +"################", +"################", +"############ #", +"########### +++ ", +"########### +++ ", +"########### +++ ", +"# ## ## #", +"# ### ### #####", +"# ### #### #####", +"# ### #### #####", +"# #### ######", +"# ###### #######", +"# ##### ########", +"# #### #########", +"# #### #####", +"################" +}; diff --git a/kmatplot/pixmaps/panel_position.xpm b/kmatplot/pixmaps/panel_position.xpm new file mode 100644 index 0000000..067496f --- /dev/null +++ b/kmatplot/pixmaps/panel_position.xpm @@ -0,0 +1,26 @@ +/* XPM */ +static const char *panel_position[] = { +/* width height ncolors chars_per_pixel */ +"16 16 3 1", +/* colors */ +" c #000000", +". c #FFFFFF", +"X c None", +/* pixels */ +"XXXXXXX XXXXXXX", +"XXXXXX XXXXXX", +"XXXXX XXXXX", +"XXXXXXX XXXXXXX", +"XXXXXXX XXXXXXX", +"XX XXXX XXXX XX", +"X XXXX XXXX X", +" ", +" ", +"X XXXX XXXX X", +"XX XXXX XXXX XX", +"XXXXXXX XXXXXXX", +"XXXXXXX XXXXXXX", +"XXXXX XXXXX", +"XXXXXX XXXXXX", +"XXXXXXX XXXXXXX" +}; diff --git a/kmatplot/pixmaps/panel_rect.xpm b/kmatplot/pixmaps/panel_rect.xpm new file mode 100644 index 0000000..8d126e0 --- /dev/null +++ b/kmatplot/pixmaps/panel_rect.xpm @@ -0,0 +1,29 @@ +/* XPM */ +static const char *panel_rect[] = { +/* width height ncolors chars_per_pixel */ +"16 16 6 1", +/* colors */ +" c #000000", +". c #7F7F7F", +"X c #FF0000", +"o c #FFFFFF", +"O c #4C4C4C", +"+ c None", +/* pixels */ +"++++++++++++++++", +"+ +", +"+ oooooooooooo +", +"+ o........... +", +"+ o........... +", +"+ o........... +", +"+ o........... +", +"+ o........... +", +"+ o........... +", +"+ o........... +", +"+ o........... +", +"+ o........... +", +"+ o........... +", +"+ o........... +", +"+ +", +"++++++++++++++++" +}; diff --git a/kmatplot/pixmaps/panel_v.xpm b/kmatplot/pixmaps/panel_v.xpm new file mode 100644 index 0000000..202dc6e --- /dev/null +++ b/kmatplot/pixmaps/panel_v.xpm @@ -0,0 +1,29 @@ +/* XPM */ +static const char *panel_v[] = { +/* width height ncolors chars_per_pixel */ +"16 16 6 1", +/* colors */ +" c #000000", +". c #7F7F7F", +"X c #CCCCCC", +"o c #FFFFFF", +"O c #FFFFC0", +"+ c None", +/* pixels */ +"+++++++++++ +++ ", +"+++++++++++ +++ ", +"+++++++++++ +++ ", +"+++++++++++ +++ ", +"++++++++++++ + +", +"++++++++++++ + +", +"+++++++++++++ ++", +"++++++++++++++++", +"++++++++++++ +++", +"++++++++++++ ++", +" +", +" +", +"++++++++++++ ++", +"++++++++++++ +++", +"++++++++++++++++", +"++++++++++++++++" +}; diff --git a/kmatplot/pixmaps/panel_view.xpm b/kmatplot/pixmaps/panel_view.xpm new file mode 100644 index 0000000..d298921 --- /dev/null +++ b/kmatplot/pixmaps/panel_view.xpm @@ -0,0 +1,27 @@ +/* XPM */ +static const char *panel_view[] = { +/* width height ncolors chars_per_pixel */ +"16 16 4 1", +/* colors */ +" c #000000", +". c #800080", +"X c #FFFFFF", +"o c None", +/* pixels */ +"oooooooooooooooo", +"oooooooo ooooooo", +"oooooooo ooooooo", +"oooooooo ooooooo", +"ooooo ooooo", +"ooo ... ooo", +"oo .. oo ooo oo", +"oo . ooo oooo o", +" ... o ooo o", +"o oo oooo oo", +"oo ooo ooo oo", +"ooo ooo oooo", +"oooooooo ooooooo", +"oooooooo ooooooo", +"oooooooooooooooo", +"oooooooooooooooo" +}; diff --git a/kmatplot/pixmaps/panel_x.xpm b/kmatplot/pixmaps/panel_x.xpm new file mode 100644 index 0000000..c186cbe --- /dev/null +++ b/kmatplot/pixmaps/panel_x.xpm @@ -0,0 +1,29 @@ +/* XPM */ +static const char *panel_x[] = { +/* width height ncolors chars_per_pixel */ +"16 16 6 1", +/* colors */ +" c #000000", +". c #7F7F7F", +"X c #CCCCCC", +"o c #FFFFFF", +"O c #FFFFC0", +"+ c None", +/* pixels */ +"+++++++++++ +++ ", +"+++++++++++ +++ ", +"++++++++++++ + +", +"+++++++++++++ ++", +"++++++++++++ + +", +"+++++++++++ +++ ", +"+++++++++++ +++ ", +"++++++++++++++++", +"++++++++++++ +++", +"++++++++++++ ++", +" +", +" +", +"++++++++++++ ++", +"++++++++++++ +++", +"++++++++++++++++", +"++++++++++++++++" +}; diff --git a/kmatplot/pixmaps/panel_y.xpm b/kmatplot/pixmaps/panel_y.xpm new file mode 100644 index 0000000..545fafa --- /dev/null +++ b/kmatplot/pixmaps/panel_y.xpm @@ -0,0 +1,29 @@ +/* XPM */ +static const char *panel_y[] = { +/* width height ncolors chars_per_pixel */ +"16 16 6 1", +/* colors */ +" c #000000", +". c #7F7F7F", +"X c #CCCCCC", +"o c #FFFFFF", +"O c #FFFFC0", +"+ c None", +/* pixels */ +"+++++++++++ +++ ", +"+++++++++++ +++ ", +"++++++++++++ + +", +"+++++++++++++ ++", +"+++++++++++++ ++", +"+++++++++++++ ++", +"+++++++++++++ ++", +"++++++++++++++++", +"++++++++++++ +++", +"++++++++++++ ++", +" +", +" +", +"++++++++++++ ++", +"++++++++++++ +++", +"++++++++++++++++", +"++++++++++++++++" +}; diff --git a/kmatplot/pixmaps/panel_z.xpm b/kmatplot/pixmaps/panel_z.xpm new file mode 100644 index 0000000..d4ae08e --- /dev/null +++ b/kmatplot/pixmaps/panel_z.xpm @@ -0,0 +1,29 @@ +/* XPM */ +static const char *panel_z[] = { +/* width height ncolors chars_per_pixel */ +"16 16 6 1", +/* colors */ +" c #000000", +". c #7F7F7F", +"X c #CCCCCC", +"o c #FFFFFF", +"O c #FFFFC0", +"+ c None", +/* pixels */ +"+++++++++++ ", +"+++++++++++++++ ", +"++++++++++++++ +", +"+++++++++++++ ++", +"++++++++++++ +++", +"+++++++++++ ++++", +"+++++++++++ ", +"++++++++++++++++", +"++++++++++++ +++", +"++++++++++++ ++", +" +", +" +", +"++++++++++++ ++", +"++++++++++++ +++", +"++++++++++++++++", +"++++++++++++++++" +}; diff --git a/kmatplot/python/KMatplot.py b/kmatplot/python/KMatplot.py new file mode 100644 index 0000000..97c58bd --- /dev/null +++ b/kmatplot/python/KMatplot.py @@ -0,0 +1,161 @@ +"""Low-level interface to KMatplot. + +Does roughly the same as interface/common.c. +All functions are members of class kmpProcess. The constructor starts and +connects to a KMatplot session. +""" + +__version__ = 0.3 +__author__ = 'Martin Wiechert <martin.wiechert@gmx.de>' +__date__ = 'December 19, 2001' + +import socket +import os +import struct +import tempfile +import commands +import paths + +class Error (Exception): + pass + +# Build environment for kmatplot call. +env = os.environ.copy () +for name in ('KDEDIR', 'KDEDIRS'): + if env.has_key (name): + if not paths.KMPDIR in env [name].split (':'): + env [name] = env [name] + ':' + paths.KMPDIR + else: + env [name] = paths.KMPDIR + +SizeOfInt = len (struct.pack ('i', 1)) # FIXME: There must be a better way... + +# Enums etc. from interface/msg.h and interface/etype.h. +MsgChannel, MsgProperty, MsgAddAxes, MsgRemoveAxes, MsgAddDataset, \ +MsgRemoveDataset, MsgRemoveAllDatasets = range (7) + +PlotCurve, PlotImage, PlotContour, PlotSurface, PlotFigure = range (5) + +EDouble, EFloat, ELong, EUShort, EShort, EUChar = range (6) + +esizeof = 6 * [0] +esizeof [EUChar] = len (struct.pack ('B', 1)) +esizeof [EShort] = len (struct.pack ('h', 1)) +esizeof [EUShort] = len (struct.pack ('H', 1)) +esizeof [ELong] = len (struct.pack ('L', 1)) +esizeof [EFloat] = len (struct.pack ('f', 1)) +esizeof [EDouble] = len (struct.pack ('d', 1)) + +# A dictionary Numeric typecodes to 'ETypes'. +etype = {} +etype ['l'] = etype ['i'] = ELong +etype ['s'] = EShort +etype ['1'] = EUChar +etype ['f'] = EFloat +etype ['d'] = EDouble + +class header: # Mimics union hdr_t from interface/msg.h. + def __init__ (self): + self.keys = ['type', 'dlen', 'plot', 'axes', 'dnum', 'plen', 'ptype', + 'chan', 'vlen', 'rows', 'cols', 'etype', 'lineo', + 'pixelo'] + self.maxkeys = 10 + def __str__ (self): + data = [getattr (self, a) for a in self.keys if hasattr (self, a)] + data += (self.maxkeys - len (data)) * [0] + return apply (struct.pack, [self.maxkeys * 'i'] + data) + +class kmpProcess: + def __init__ (self): + s = socket.socket (socket.AF_UNIX, socket.SOCK_STREAM) + sname = tempfile.mktemp (os.environ ['USER'] + '.kmatplot.py') + s.bind (sname) + s.listen (1) + os.spawnve (os.P_NOWAIT, paths.KMPEXEC, + [paths.KMPEXEC, '--fd', str (s.fileno ())], env) + s.close () + self.socket = socket.socket (socket.AF_UNIX, socket.SOCK_STREAM) + self.socket.connect (sname) + + def get_reply_code (self): + return struct.unpack ('i', self.socket.recv (SizeOfInt)) [0] + + def add_axes (self, axes_type): + hdr = header () + hdr.type = MsgAddAxes + hdr.dlen = 0 + hdr.plot = -1 + hdr.axes = axes_type + self.socket.send (str (hdr)) + return self.get_reply_code () + + def remove_axes (self, axes_id): + hdr = header () + hdr.type = MsgRemoveAxes + hdr.dlen = 0 + hdr.plot = axes_id + hdr.axes = -1 # Dummy. + self.socket.send (str (hdr)) + return self.get_reply_code () + + def add_dataset (self, plot, type): + hdr = header () + hdr.type = MsgAddDataset + hdr.dlen = 0 + hdr.dnum = -1 + hdr.plot = plot + hdr.ptype = type + self.socket.send (str (hdr)) + return self.get_reply_code () + + def remove_dataset (self, plot, number): + hdr = header () + hdr.type = MsgRemoveDataset + hdr.dlen = 0 + hdr.dnum = number + hdr.plot = plot + hdr.ptype = -1 # Dummy. + self.socket.send (str (hdr)) + return self.get_reply_code () + + def remove_all_datasets (self, plot): + hdr = header () + hdr.type = MsgRemoveAllDatasets + hdr.dlen = 0 + hdr.dnum = -1 # Dummy. + hdr.plot = plot + hdr.ptype = -1 # Dummy. + self.socket.send (str (hdr)) + return self.get_reply_code () + + def set_channel (self, plot, dataset, channel, data): + hdr = header () + hdr.type = MsgChannel + s = data.shape + if len (s) == 1: + s = (s[0], 1) + hdr.rows, hdr.cols = s + hdr.etype = etype [data.typecode ()] + hdr.pixelo = esizeof [hdr.etype] + hdr.lineo = hdr.cols * hdr.pixelo + hdr.dlen = hdr.rows * hdr.cols * hdr.pixelo + hdr.dnum = dataset + hdr.plot = plot + hdr.chan = channel + self.socket.send (str (hdr)) + self.socket.send (data.tostring ()) + return self.get_reply_code () + + def set_property (self, plot, property, value): + # Not functional yet. + hdr = header () + hdr.type = MsgProperty + hdr.plen = len (property) + hdr.vlen = len (value) + hdr.dlen = hdr.plen + hdr.vlen + hdr.plot = plot + self.socket.send (str (hdr)) + self.socket.send (property + value) # FIXME: verify syntax + return self.get_reply_code () + + diff --git a/kmatplot/python/Makefile.am b/kmatplot/python/Makefile.am new file mode 100644 index 0000000..06bb0f8 --- /dev/null +++ b/kmatplot/python/Makefile.am @@ -0,0 +1,20 @@ +if MAKE_PYTHON +kplotdir=$(PYTHONMODDIR)/site-packages/kplot +kplotconfigdir=$(PYTHONMODDIR)/site-packages/ +python_scripts = KMatplot.py kplot.py _kplot.py paths.py +config_scripts = kplot.pth +else +python_scripts = +config_scripts = +endif + +kplot_SCRIPTS = $(python_scripts) +kplotconfig_SCRIPTS = $(config_scripts) + +paths.py: Makefile + echo "KMPDIR='$(prefix)'" > paths.py + echo "KMPEXEC='$(bindir)/kmatplot'" >> paths.py + +EXTRA_DIST = README.python KMatplot.py kplot.py _kplot.py kplot.pth +CLEANFILES = paths.py + diff --git a/kmatplot/python/README.python b/kmatplot/python/README.python new file mode 100644 index 0000000..2390b43 --- /dev/null +++ b/kmatplot/python/README.python @@ -0,0 +1,13 @@ +Example kplot session: + +>>> from Numeric import * +>>> from kplot import kplot +>>> +>>> t = arange (-pi, pi, pi/20.) +>>> p = kplot () +>>> p.plot (t, sin (t)) +>>> p.surface (sin (outerproduct (t, t)), t, t) + + +For documentation type from bash +pydoc kplot \ No newline at end of file diff --git a/kmatplot/python/_kplot.py b/kmatplot/python/_kplot.py new file mode 100644 index 0000000..568f79b --- /dev/null +++ b/kmatplot/python/_kplot.py @@ -0,0 +1,231 @@ +"""Auxillary classes for kplot.py which we do not want the user to see.""" + +__version__ = 0.3 +__author__ = "Martin Wiechert <martin.wiechert@gmx.de>" +__date__ = "December 19, 2001" + +import KMatplot as kmp +import Numeric +import kplot + +class _kplane: # curve [/ bar graph / arrows] + """Represents 2d data like a curve or bar graph or plane arrow set""" + + def __init__ (self, subplot, mask, data): + self.parent = subplot + self.id = self.parent.parent.proc.add_dataset (self.parent.id, + kmp.PlotCurve) + for i in range (len (data)): # (len gives number of rows.) + self.parent.parent.proc.set_channel (self.parent.id, self.id, + 'XYxy'.find (mask [i]), + data [i, :]) + +class _kmap: # surface / contour / pixmap + """Represents a scalar valued map from the plane. + (I.e. a surface or contour or pixmap.)""" + + def __init__ (self, subplot, type, data): + self.parent = subplot + self.id = self.parent.parent.proc.add_dataset (self.parent.id, type) + for i in range (len (data)): + if data [i]: + self.parent.parent.proc.set_channel (self.parent.id, self.id, + (i - 1) % 3, data [i]) + +class _kpoly: # polygons + """Represents a polygon set in space.""" + + def __init__ (self, subplot, X, Y, Z): + self.parent = subplot + self.id = self.parent.parent.proc.add_dataset (self.parent.id, + kmp.PlotFigure) + for i in range (3): + self.parent.parent.proc.set_channel (self.parent.id, self.id, + i, [X, Y, Z] [i]) + +class _ksubplot: + """Maintains one set of axes.""" + + def __init__ (self, plot): + self.parent = plot + self.hold = 1 + self._3d = None + self.sets = [] + # Attributes 'id' and 'current' are created with first 'plot' call. + + def _shrink (self, kw): + """Replaces dX, dY by x, y (to simplify parsing). + Check keyword legality.""" + + kw = kw.replace ('dX', 'x') + kw = kw.replace ('dY', 'y') + # Check legality. + X = kw.count ('X') + Y = kw.count ('Y') + x = kw.count ('x') + y = kw.count ('y') + # Any of the above letters at most once, no other letters, + # composite keywords must contain Y. + if X > 1 or Y > 1 or x > 1 or y > 1 or X + Y + x + y != len (kw) or \ + (Y == 0 and len (kw) > 1): + raise kplot.Error, 'Unknown keyword.' + return kw + + def _plot_curve (self, kw, data): + """Plots one curve.""" + + if len (data) % len (kw): + raise kplot.Error, 'Mismatched number of rows.' + for i in range (0, len (data), len (kw)): + self.sets.append (_kplane (self, kw, data [i : i + len (kw), :])) + + def plot (self, args, kwargs): + """Plots one or more curves""" + + # Most of the code is for sorting out data according to keywords. + # See kplot.kplot.plot doc string for keyword semantics. + + # First handle hold and axes status. + if self._3d != 0: # wrong axes or no axes at all + if self._3d == 1: # wrong axes - erase all + self.parent.proc.remove_all_datasets (self.id) + self.sets = [] + self.parent.proc.remove_axes (self.id) + self._3d = 0 + self.id = self.parent.proc.add_axes (self._3d) + elif not self.hold: + self.parent.proc.remove_all_datasets (self.id) + self.sets = [] + + # Now tackle arguments. + # Composite keywords are independent (as they carry complete data + # for one (or even multiple) plot(s)). So they are passed instantly. + # All others (positional and one-letter keywords) are collected and + # then plotted in one go. + # Compatibility of positional and one-letter keyword args is checked + # via args_given. + coll_args = {} # Collect arguments here. + if args: # First look for positional arguments. + n = len (args) + if n == 1: + synth_kw = 'Y' + else: + synth_kw = 'XYxy' [:n] + for i in range (n): + coll_args [synth_kw [i]] = args [i] + if n > 2: + args_given = 2 # error bars ... + else: + args_given = 1 # ... only coordinates ... + else: + args_given = 0 # ... nothing + synth_kw = '' + for kw in kwargs.keys (): + kws = self._shrink (kw) + if len (kws) > 1: # Mixed data - plot instantly. + if not len (kwargs [kw].shape) == 2: + raise Error, 'Matrix expected.' + self._plot_curve (kws, kwargs [kw]) + # Data given separately for X, Y, dX, dY - keep track, but check + # for compatibility with positional arguments first. + elif args_given == 2 or (args_given == 1 and kws in 'XY'): + raise kplot.Error, 'Too many keyword arguments.' + else: + synth_kw = synth_kw + kws + coll_args [kws] = kwargs [kw] + + # Finally plot collected arguments if there are any. + if coll_args: + if not 'Y' in synth_kw: + raise kplot.Error, 'Y data missing.' + # All data must have the same shape as Y-data. + # Exception: If multiple curves are given, X may still be just one + # row, because a common X-axis is feasible. + sh = coll_args ['Y'].shape + if len (sh) > 2: + raise Error, 'Matrix or vector expected' + if ('x' in synth_kw and coll_args ['x'].shape != sh) or \ + ('y' in synth_kw and coll_args ['y'].shape != sh) or \ + ('X' in synth_kw and not (coll_args ['X'].shape == sh or + (len (coll_args ['X'].shape) == 1 and + len (coll_args ['X']) == sh [-1]))): + raise kplot.Error, 'Mismatched shapes.' + n = len (synth_kw) + data = Numeric.zeros ((n, sh [-1]), 'd') # container for data mix + if len (sh) == 1: # just one curve + for i in range (n): # mix data ... + data [i, :] = coll_args [synth_kw [i]] + self._plot_curve (synth_kw, data) # ... and send + else: # multiple curves + if 'X' in synth_kw and len (coll_args ['X'].shape) == 1: + # Common X-axis + # Put 'X' to the end, set it once and for all and trick + # the subsequent loop into overlooking it. + synth_kw = synth_kw.replace ('X', '') + 'X' + n -= 1 + data [n, :] = coll_args ['X'] + for j in range (sh [0]): + for i in range (n): # mix data ... + data [i, :] = coll_args [synth_kw [i]] [j, :] + self._plot_curve (synth_kw, data) # ... and send + self.current = len (self.sets) - 1 + + def plane_map (self, args, type): + """Plots a surface or contour or pixmap.""" + + # First handle hold and axes status. + _3d = type == kmp.PlotSurface # Surfaces are 3d, which contours and + # pixmaps are not. + if self._3d != _3d: # wrong axes or no axes at all + if self._3d == (not _3d): # wrong axes - erase all + self.parent.proc.remove_all_datasets (self.id) + self.sets = [] + self.parent.proc.remove_axes (self.id) + self._3d = _3d + self.id = self.parent.proc.add_axes (self._3d) + elif not self.hold: + self.parent.proc.remove_all_datasets (self.id) + self.sets = [] + + if not len (args [0].shape) == 2: + raise kplot.Error, 'Matrix expected.' + # Check if scaling vectors are ok if given. + # Note that for pixmaps they must be one cell larger, + # because they denote pixel edges. + if not args [-2] or (len (args [-2].shape) == 1 and + len (args [-2]) == args [0].shape [1] + + (type == kmp.PlotImage)) and \ + not args [-1] or (len (args [-1].shape) == 1 and + len (args [-1]) == args [0].shape [0] + + (type == kmp.PlotImage)): + if args [-1]: # KMatplot wants a column vector here. + args [-1] = args [-1] [:, Numeric.NewAxis] + self.sets.append (_kmap (self, type, args)) # Send. + else: + raise kplot.Error, 'Shapes do not match.' + self.current = len (self.sets) - 1 + + def polygon (self, X, Y, Z): + """Plots a set of polygons.""" + + # First handle hold and axes status. + if self._3d != 1: # wrong axes or no axes at all + if self._3d == 0: # wrong axes - erase all + self.parent.proc.remove_all_datasets (self.id) + self.sets = [] + self.parent.proc.remove_axes (self.id) + self._3d = 1 + self.id = self.parent.proc.add_axes (self._3d) + elif not self.hold: + self.parent.proc.remove_all_datasets (self.id) + self.sets = [] + + if len (X.shape) == 1: + X, Y, Z = [i [:, Numeric.NewAxis] for i in [X, Y, Z]] + elif len (X.shape) == 2: + X, Y, Z = [Numeric.transpose (i) for i in [X, Y, Z]] + else: + raise kplot.Error, 'Matrix or vector expected.' + self.sets.append (_kpoly (self, X, Y, Z)) + self.current = len (self.sets) - 1 + diff --git a/kmatplot/python/kplot.pth b/kmatplot/python/kplot.pth new file mode 100644 index 0000000..bd9ffbd --- /dev/null +++ b/kmatplot/python/kplot.pth @@ -0,0 +1 @@ +kplot diff --git a/kmatplot/python/kplot.py b/kmatplot/python/kplot.py new file mode 100644 index 0000000..333fd0d --- /dev/null +++ b/kmatplot/python/kplot.py @@ -0,0 +1,166 @@ +"""This module allows plotting via KMatplot. + +As you need Numeric arrays to send any data you will have to import module +Numeric. + +Instantiating class kplot starts and connects to a KMatplot session. +Plot via members plot, surface, polygon, pixmap and contour. +""" + +__version__ = 0.3 +__author__ = "Martin Wiechert <martin.wiechert@gmx.de>" +__date__ = "December 19, 2001" +__credits__ = """Guido van Rossum (Python) +Kamil Dobkowski (KMatplot) +Nathaniel Gray (gracePlot.py) +""" + +import KMatplot as kmp +import _kplot + +class Error (Exception): + pass + +class kplot: + """Instantiating this class starts and connects to a KMatplot session. + + You can have multiple subplots. + Attribute 'current' contains the number of the active subplot which all + plotting is directed to. Add new subplots with the 'subplot' function. + + Function 'hold' toggles between overlay and overwrite mode. In the latter + the current (sub)plot will be erased before new data are sent. Default is + overlay mode. + """ + + def __init__ (self): + self.proc = kmp.kmpProcess () + self.subplots = [] + self.subplot () + + def subplot (self): # FIXME geometry management missing + """Starts a new subplot and directs future drawing to it. + + Switch between subplots via attribute 'current'.""" + + self.current = len (self.subplots) + self.subplots.append (_kplot._ksubplot (self)) + + def hold (self, switch = None): + """Pass 1 for overlay mode, 0 for overwrite mode or nothing to toggle. + + Only the current subplot is affected. + + Obviously you cannot overlay 2d and 3d plots, so if you try this the + hold status will be silently ignored.""" + + if switch is None: + self.subplots [self.current].hold = \ + not self.subplots [self.current].hold + else: + self.subplots [self.current].hold = switch + + def plot (self, *args, **kwargs): + """Plots a 2d curve, possibly with error bars. + + There are essentially three ways to pass data: + + 1) By keyword arguments X, Y, dX, dY: + One curve is plotted per row in Y. If dX or dY are specified + they must have the same shape as Y. + If X is specified it must either have the same shape as Y or + be one-dimensional and be as long as the rows in Y. + + 2) By keyword arguments XY / XYdX / XYdY / XYdXdY / YdX / YdY / YdXdY: + One curve per 2 / 3 / 3 / 4 / 2 / 2 / 3 rows in the input array. + Number of rows must be a multiple of 2 / 3 / 3 / 4 / 2 / 2 / 3. + You may also use permutations like YdYX if your data happen to + come in that order. + + 3) By positional arguments: + One argument is interpreted as Y. + Two to four arguments are treated as X, Y [, dX [, dY]] + Same shape requirements as in 1). + If you give only one or two arguments you may in addition + use dX / dY keyword arguments. + """ + + self.subplots [self.current].plot (args, kwargs) + + def arrows (self, X, Y, dX, dY): + """Draws a set of plane arrows. + + Arrows start at X, Y and extend by dX, dY. + + arrows (X, Y, dX, dY) + + All arguments are required and must have same size, i.e. number of + elements. Shapes are ignored. + + *** Not yet implemented. *** + """ + + pass # FIXME: implement it (and adjust doc string). + # self.subplots [self.current].plot ( + # [X.flat, Y.flat, dX.flat, dY.flat], {}, kmp.PlotVectors ?) + + def surface (self, Z, X = None, Y = None): + """Plots a surface. + + surface (Z [, X] [, Y]) + + Z must be a matrix. + X, Y must be vectors of sizes number of columns of Z, + number of rows of Z respectively. + """ + + self.subplots [self.current].plane_map ([Z, X, Y], kmp.PlotSurface) + + def polygon (self, X, Y, Z): + """Plots one or more polygons in space. + + polygon (X, Y, Z) + + All arguments are required and must be of same shape. + Either vectors (one polygon) or matrices (one polygon per row). + """ + + if not (X.shape == Y.shape and X.shape ==Z.shape): + raise Error, 'Arguments must have same shapes.' + self.subplots [self.current].polygon (X, Y, Z) + + def contour (self, Z, X = None, Y = None): + """Plots a colour-coded height map. + + contour (Z [, X] [, Y]) + + Z must be a matrix. + X, Y must be vectors of sizes number of columns of Z, + number of rows of Z respectively. + """ + + self.subplots [self.current].plane_map ([Z, X, Y], kmp.PlotContour) + + def pixmap (self, red, green = None, blue = None, X = None, Y = None): + """Plots a possibly scaled possibly coloured pixmap. + + pixmap (red [,green, blue] [, X] [, Y]) + + If green and blue are not specified output is not red but greyscaled. + + red, green, blue must be a matrices of same shape. + X, Y must be vectors of sizes number of columns of Z + 1, + number of rows of Z + 1 respectively. + """ + + if green or blue: + if not (green and blue): + raise Error, 'Green and blue can only be specified together.' + if not (red.shape == green.shape and red.shape == blue.shape): + raise Error, 'Colours must have same shapes.' + self.subplots [self.current].plane_map ([red, green, blue, None, X, Y], + kmp.PlotImage) + + + + diff --git a/kmatplot/qscobjects.cpp b/kmatplot/qscobjects.cpp new file mode 100644 index 0000000..9c97888 --- /dev/null +++ b/kmatplot/qscobjects.cpp @@ -0,0 +1,974 @@ +/*************************************************************************** + qscobjects.cpp + ------------------- + begin : Sun Jan 30 2000 + copyright : (C) 2000 by Kamil Dobkowski + email : kamildbk@friko.onet.pl + ***************************************************************************/ + +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + +#include"qscobjects.h" +#include"widgets/qsdrv.h" +#include"widgets/qsaxes.h" +#include<qfontmetrics.h> +#include<qpainter.h> +#include<qpoint.h> +#include<qregion.h> +#include<math.h> + +//-------------------------------------------------------------// +//-------------------------------------------------------------// +//-------------------------------------------------------------// + +QSCLabel::QSCLabel( const QString& init_text, QObject *parent ) +:QSCObject( parent ) + { + m_edited = false; + m_text = init_text; + m_angle = 0; + m_cursor = 0; + m_shadow_pos.x = 5; + m_shadow_pos.y = 5; + m_pos.set( 0.0, 0.0, 0.0 ); + m_axis.set( QSAxes::normCoord, QSAxes::normCoord, QSAxes::normCoord ); + m_frame_align = m_text_align = Qt::AlignTop | Qt::AlignLeft ; + m_fill.style = QSGFill::Transparent; + m_shadow_fill.style = QSGFill::Transparent; + m_shadow_fill.color = QSGColor( 0, 0, 0 ); + m_frame.style = QSGLine::Invisible; + } + +//-------------------------------------------------------------// + +QSCLabel::~QSCLabel() + { + } + +//-------------------------------------------------------------// + +void QSCLabel::setEditMode( bool enabled ) + { + m_edited = enabled; + } + +//-------------------------------------------------------------// + +void QSCLabel::setCursorHint( int pos ) + { + m_cursor = pos; + } + + +//-------------------------------------------------------------// + +void QSCLabel::rotate( int degs, QSDrv * ) + { + parametersChanging(); + m_angle += degs; + parametersChanged(); + } + +//-------------------------------------------------------------// + +QSPt2f QSCLabel::rCenter( QSDrv *drv ) + { + QSPt2f pts[4]; + QSPt3f p1 = mixedToCanvas(m_pos,m_axis.x,m_axis.y,m_axis.z,drv->dpi); + drv->setFont( m_font ); + drv->getRTextBoundingPoly( pts, QSPt2f(p1.x,p1.y), m_angle, m_text, m_text_align ); + + QSPt2f a; + QSPt2f b; + if ( m_text_align & Qt::AlignLeft ) { + b = pts[0]; a = pts[3] - pts[0]; + } + else + if ( m_text_align & Qt::AlignRight ) { + b = pts[1]; a = pts[2] - pts[1]; + } + else { + QSPt2f m1 = pts[1]-pts[0]; + QSPt2f m2 = pts[2]-pts[3]; + m1 = pts[0] + QSPt2f( m1.x/2.0, m1.y/2.0 ); + m2 = pts[3] + QSPt2f( m2.x/2.0, m2.y/2.0 ); + b = m1; a = m2 - m1; + } + + double t = 0.0; + if ( m_text_align & Qt::AlignVCenter ) t = 0.5; + else + if ( m_text_align & Qt::AlignBottom ) t = 1.0; + + + return QSPt2f( t*a.x+b.x, t*a.y+b.y ); + } + +//-------------------------------------------------------------// + +void QSCLabel::setBox( const QSRectf& r, QSDrv *drv ) + { + parametersChanging(); + // moved on canvas by d pixels ( we ingnore sizes ) + // remember that r.pos != pos, so we cannot set pos = r,pos + QSPt2f d = r.normalize().pos - box( drv ).pos; + + QSPt3f cpos = mixedToCanvas( m_pos, m_axis.x, m_axis.y, m_axis.z, drv->dpi ); + cpos.x += d.x; + cpos.y += d.y; + m_pos = canvasToMixed( cpos, m_axis.x, m_axis.y, m_axis.z, drv->dpi ); + parametersChanged(); + } + +//-------------------------------------------------------------// + +QSRectf QSCLabel::box( QSDrv *drv ) + { + QSPt2f pts[4]; + QSPt3f p1 = mixedToCanvas(m_pos,m_axis.x,m_axis.y,m_axis.z,drv->dpi); + drv->setFont( m_font ); + drv->getRTextBoundingPoly( pts, QSPt2f(p1.x,p1.y), m_angle, m_text, m_text_align ); + + double min_x = pts[0].x; + double max_x = pts[0].x; + double min_y = pts[0].y; + double max_y = pts[0].y; + for( int i=1; i<4; i++ ) { + min_x = QMIN( min_x, pts[i].x ); + max_x = QMAX( max_x, pts[i].x ); + min_y = QMIN( min_y, pts[i].y ); + max_y = QMAX( max_y, pts[i].y ); + } + return QSRectf( min_x, min_y, max_x-min_x+1, max_y-min_y+1 ); + } + +//-------------------------------------------------------------// + +void QSCLabel::draw( QSDrv *drv, bool, bool ) + { + if ( m_edited ) return; + QSPt2f pts[4]; + QSPt2f shad = QSPt2f(drv->toPixels(m_shadow_pos.x), drv->toPixels(m_shadow_pos.y)); + QSPt3f p1 = mixedToCanvas(m_pos,m_axis.x,m_axis.y,m_axis.z,drv->dpi); + drv->setFont( m_font ); + drv->getRTextBoundingPoly( pts, QSPt2f(p1.x,p1.y), m_angle, m_text, m_text_align ); + + if ( m_shadow_fill.style != QSGFill::Transparent ) { + for ( int i=0; i<4; i++ ) pts[i] = pts[i] + shad; + drv->setLine( QSGLine::invisibleLine ); + drv->setFill( m_shadow_fill ); + drv->drawPoly( pts, 4 ); + for ( int i=0; i<4; i++ ) pts[i] = pts[i] - shad; + } + if ( m_fill.style != QSGFill::Transparent || + m_frame.style != QSGLine::Invisible ) { + drv->setFill( m_fill ); + drv->setLine( m_frame ); + drv->drawPoly( pts, 4 ); + } + + drv->setFont( m_font ); + QSPt3f p = mixedToCanvas(m_pos,m_axis.x,m_axis.y,m_axis.z,drv->dpi); + drv->drawRText( QSPt2f(p.x,p.y), m_angle, m_text, m_text_align ); + emit sigDrawEnds( this ); + } + +//-------------------------------------------------------------// + +void QSCLabel::insertString( int pos, const QString& s ) + { + m_text.insert( pos, s ); + } + +//-------------------------------------------------------------// + +void QSCLabel::deleteString( int pos, int len ) + { + m_text.remove( pos, len ); + } + +//-------------------------------------------------------------// + +QString QSCLabel::name() + { + return QString(tr("Label: ")) + m_text.simplifyWhiteSpace(); + } + +//-------------------------------------------------------------// + +void QSCLabel::setText( const QString& text ) + { + SET_COBJECT_PROPERTY( m_text, text ); + } + +//-------------------------------------------------------------// + +void QSCLabel::setAngle( int angle ) + { + SET_COBJECT_PROPERTY( m_angle, angle ); + } + +//-------------------------------------------------------------// + +void QSCLabel::setFrameAlign( int align ) + { + SET_COBJECT_PROPERTY( m_frame_align, align ); + } + +//-------------------------------------------------------------// + +void QSCLabel::setTextAlign( int align ) + { + SET_COBJECT_PROPERTY( m_text_align, align ); + } + +//-------------------------------------------------------------// + +void QSCLabel::setPos( const QSPt3f& pos ) + { + SET_COBJECT_PROPERTY( m_pos, pos ); + } + +//-------------------------------------------------------------// + +void QSCLabel::setPosX( double value ) + { + SET_COBJECT_PROPERTY( m_pos.x, value ); + } + +//-------------------------------------------------------------// + +void QSCLabel::setPosY( double value ) + { + SET_COBJECT_PROPERTY( m_pos.y, value ); + } + +//-------------------------------------------------------------// + +void QSCLabel::setPosZ( double value ) + { + SET_COBJECT_PROPERTY( m_pos.z, value ); + } + +//-------------------------------------------------------------// + +void QSCLabel::setCoord( const QSPt3& coordSystem ) + { + SET_COBJECT_PROPERTY( m_axis, coordSystem ); + } + +//-------------------------------------------------------------// + +void QSCLabel::setCoordX( int coordSystem ) + { + SET_COBJECT_PROPERTY( m_axis.x, coordSystem ); + } + +//-------------------------------------------------------------// + +void QSCLabel::setCoordY( int coordSystem ) + { + SET_COBJECT_PROPERTY( m_axis.y, coordSystem ); + } + +//-------------------------------------------------------------// + +void QSCLabel::setCoordZ( int coordSystem ) + { + SET_COBJECT_PROPERTY( m_axis.z, coordSystem ); + } + +//-------------------------------------------------------------// + +void QSCLabel::setFont( const QSGFont& font ) + { + SET_COBJECT_PROPERTY( m_font, font ); + } + +//-------------------------------------------------------------// + +void QSCLabel::setFontProperty( const QString& data ) + { + QSGFont new_font = toQSGFont(data); + setFont( new_font ); + } + +//-------------------------------------------------------------// + +void QSCLabel::setFill( const QSGFill& fill ) + { + SET_COBJECT_PROPERTY( m_fill, fill ); + } + +//-------------------------------------------------------------// + +void QSCLabel::setFillProperty( const QString &data ) + { + QSGFill new_fill = toQSGFill(data); + setFill( new_fill ); + } + +//-------------------------------------------------------------// + +void QSCLabel::setFrame( const QSGLine& line ) + { + SET_COBJECT_PROPERTY( m_frame, line ); + } + +//-------------------------------------------------------------// + +void QSCLabel::setFrameProperty( const QString& data ) + { + QSGLine new_line = toQSGLine(data); + setFrame( new_line ); + } + +//-------------------------------------------------------------// + +void QSCLabel::setShadowFill( const QSGFill& fill ) + { + SET_COBJECT_PROPERTY( m_shadow_fill, fill ); + } + +//-------------------------------------------------------------// + +void QSCLabel::setShadowFillProperty( const QString& data ) + { + QSGFill new_shadow_fill = toQSGFill(data); + setShadowFill( new_shadow_fill ); + } + +//-------------------------------------------------------------// + +void QSCLabel::setShadowPos( const QSPt2& shift ) + { + SET_COBJECT_PROPERTY( m_shadow_pos, shift ); + } + +//-------------------------------------------------------------// + +void QSCLabel::setShadowPosX( int value ) + { + SET_COBJECT_PROPERTY( m_shadow_pos.x, value ); + } + +//-------------------------------------------------------------// + +void QSCLabel::setShadowPosY( int value ) + { + SET_COBJECT_PROPERTY( m_shadow_pos.y, value ); + } + +//-------------------------------------------------------------// + + + + + + + + + + + +//-------------------------------------------------------------// +//-------------------------------------------------------------// +//-------------------------------------------------------------// +//-------------------------------------------------------------// +//-------------------------------------------------------------// +//-------------------------------------------------------------// + + + + + + + + + + + + + + + +QSCArrow::QSCArrow( QObject *parent ) +:QSCObject( parent ) + { + m_end1.set( 0.1, 0.5, 0.0 ); + m_end2.set( 0.1, 0.5, 0.0 ); + m_axis1.set( QSAxes::normCoord, QSAxes::normCoord, QSAxes::normCoord ); + m_axis2.set( QSAxes::normCoord, QSAxes::normCoord, QSAxes::normCoord ); + m_end2style.style = QSGArrow::FArrow; + m_end1style.style = QSGArrow::None; + + m_visible = true; + } + +//-------------------------------------------------------------// + +QSCArrow::~QSCArrow() + { + } + + +//-------------------------------------------------------------// + +void QSCArrow::draw( QSDrv *drv, bool, bool ) + { + if ( !m_visible ) return; + QSPt3f pos1 = mixedToCanvas(m_end1,m_axis1.x,m_axis1.y,m_axis1.z,drv->dpi); + QSPt3f pos2 = mixedToCanvas(m_end2,m_axis2.x,m_axis2.y,m_axis2.z,drv->dpi); + QSPt2f p1 = QSPt2f(pos1.x,pos1.y); + QSPt2f p2 = QSPt2f(pos2.x,pos2.y); + drv->drawPoint( p1, m_end1point ); + drv->drawPoint( p2, m_end2point ); + drv->setLine( m_line ); + drv->drawArrow( p1, p2, m_end1style, m_end2style ); + emit sigDrawEnds( this ); + } + + +//-------------------------------------------------------------// + +bool QSCArrow::isHit( const QSPt2f &p, QSDrv* drv ) + { + return QSCObject::isHit( p, drv ); + } + +//-------------------------------------------------------------// + +void QSCArrow::rotate( int deg, QSDrv *drv ) + { + parametersChanging(); + QSPt3f cp1 = mixedToCanvas( m_end1, m_axis1.x, m_axis1.y, m_axis1.z, drv->dpi ); + QSPt3f cp2 = mixedToCanvas( m_end2, m_axis2.x, m_axis2.y, m_axis2.z, drv->dpi ); + + QWMatrix m; + QSPt2f rc = rCenter( drv ); + m.translate( rc.x, rc.y ); + m.rotate( deg ); + m.translate( -rc.x, -rc.y ); + + QSPt3f _cp1; + QSPt3f _cp2; + _cp1.z = cp1.z; + _cp2.z = cp2.z; + m.map( cp1.x, cp1.y, &_cp1.x, &_cp1.y ); + m.map( cp2.x, cp2.y, &_cp2.x, &_cp2.y ); + + m_end1 = canvasToMixed( _cp1, m_axis1.x, m_axis1.y, m_axis1.z, drv->dpi ); + m_end2 = canvasToMixed( _cp2, m_axis2.x, m_axis2.y, m_axis2.z, drv->dpi ); + parametersChanged(); + } + + +//-------------------------------------------------------------// + +void QSCArrow::setBox( const QSRectf& r, QSDrv *drv ) + { + parametersChanging(); + // preserve z + QSPt3f cp1 = mixedToCanvas( m_end1, m_axis1.x, m_axis1.y, m_axis1.z, drv->dpi ); + QSPt3f cp2 = mixedToCanvas( m_end2, m_axis2.x, m_axis2.y, m_axis2.z, drv->dpi ); + + QSPt3f p1( r.pos.x, r.pos.y, cp1.z ); + QSPt3f p2( r.pos.x+r.size.x, r.pos.y+r.size.y, cp2.z ); + + m_end1 = canvasToMixed( p1, m_axis1.x, m_axis1.y, m_axis1.z, drv->dpi ); + m_end2 = canvasToMixed( p2, m_axis2.x, m_axis2.y, m_axis2.z, drv->dpi ); + + parametersChanged(); + } + +//-------------------------------------------------------------// + +QSRectf QSCArrow::box( QSDrv *drv ) + { + QSPt3f cp1 = mixedToCanvas(m_end1, m_axis1.x, m_axis1.y, m_axis1.z, drv->dpi ); + QSPt3f cp2 = mixedToCanvas(m_end2, m_axis2.x, m_axis2.y, m_axis2.z, drv->dpi ); + return QSRectf( cp1.x, cp1.y, cp2.x-cp1.x, cp2.y-cp1.y ); + } + +//-------------------------------------------------------------// + +QSPt2f QSCArrow::rCenter( QSDrv *drv ) + { + QSRectf r = box( drv ); + QSPt2f center( r.pos.x+r.size.x/2.0, r.pos.y+r.size.y/2.0 ); + return center; + } + +//-------------------------------------------------------------// + +void QSCArrow::setEditMode( bool enabled ) + { + m_visible = !enabled; + } + +//-------------------------------------------------------------// + +void QSCArrow::setOriginPos( const QSPt3f& pos ) + { + SET_COBJECT_PROPERTY( m_end1, pos ); + } + +//-------------------------------------------------------------// + +void QSCArrow::setOriginX( double x ) + { + SET_COBJECT_PROPERTY( m_end1.x, x ); + } + +//-------------------------------------------------------------// + +void QSCArrow::setOriginY( double y ) + { + SET_COBJECT_PROPERTY( m_end1.y, y ); + } + +//-------------------------------------------------------------// + +void QSCArrow::setOriginZ( double z ) + { + SET_COBJECT_PROPERTY( m_end1.z, z ); + } + +//-------------------------------------------------------------// + +void QSCArrow::setEndPos( const QSPt3f& pos ) + { + SET_COBJECT_PROPERTY( m_end2, pos ); + } + +//-------------------------------------------------------------// + +void QSCArrow::setEndX( double x ) + { + SET_COBJECT_PROPERTY( m_end2.x, x ); + } + +//-------------------------------------------------------------// + +void QSCArrow::setEndY( double y ) + { + SET_COBJECT_PROPERTY( m_end2.y, y ); + } + +//-------------------------------------------------------------// + +void QSCArrow::setEndZ( double z ) + { + SET_COBJECT_PROPERTY( m_end2.z, z ); + } + +//-------------------------------------------------------------// + +void QSCArrow::setOriginCoord( const QSPt3& coordSystem ) + { + SET_COBJECT_PROPERTY( m_axis1, coordSystem ) + } + +//-------------------------------------------------------------// + +void QSCArrow::setOriginCoordX( int coordSystem ) + { + SET_COBJECT_PROPERTY( m_axis1.x, coordSystem ) + } + +//-------------------------------------------------------------// + +void QSCArrow::setOriginCoordY( int coordSystem ) + { + SET_COBJECT_PROPERTY( m_axis1.y, coordSystem ) + } + +//-------------------------------------------------------------// + +void QSCArrow::setOriginCoordZ( int coordSystem ) + { + SET_COBJECT_PROPERTY( m_axis1.z, coordSystem ) + } + +//-------------------------------------------------------------// + +void QSCArrow::setEndCoord( const QSPt3& coordSystem ) + { + SET_COBJECT_PROPERTY( m_axis2, coordSystem ) + } + +//-------------------------------------------------------------// + +void QSCArrow::setEndCoordX( int coordSystem ) + { + SET_COBJECT_PROPERTY( m_axis2.x, coordSystem ) + } + +//-------------------------------------------------------------// + +void QSCArrow::setEndCoordY( int coordSystem ) + { + SET_COBJECT_PROPERTY( m_axis2.y, coordSystem ) + } + +//-------------------------------------------------------------// + +void QSCArrow::setEndCoordZ( int coordSystem ) + { + SET_COBJECT_PROPERTY( m_axis2.z, coordSystem ) + } + +//-------------------------------------------------------------// + +void QSCArrow::setOriginArrow( const QSGArrow& arrow ) + { + SET_COBJECT_PROPERTY( m_end1style, arrow ); + } + +//-------------------------------------------------------------// + +void QSCArrow::setOriginArrowProperty( const QString& data ) + { + QSGArrow new_arrow = toQSGArrow( data ); + setOriginArrow( new_arrow ); + } + +//-------------------------------------------------------------// + +void QSCArrow::setOriginPoint( const QSGPoint& point ) + { + SET_COBJECT_PROPERTY( m_end1point, point ); + } + +//-------------------------------------------------------------// + +void QSCArrow::setOriginPointProperty( const QString& data ) + { + QSGPoint new_point = toQSGPoint( data ); + setOriginPoint( new_point ); + } + +//-------------------------------------------------------------// + +void QSCArrow::setEndArrow( const QSGArrow& arrow ) + { + SET_COBJECT_PROPERTY( m_end2style, arrow ); + } + +//-------------------------------------------------------------// + +void QSCArrow::setEndArrowProperty( const QString& data ) + { + QSGArrow new_arrow = toQSGArrow( data ); + setEndArrow( new_arrow ); + } + +//-------------------------------------------------------------// + +void QSCArrow::setEndPoint( const QSGPoint& point ) + { + SET_COBJECT_PROPERTY( m_end2point, point ); + } + +//-------------------------------------------------------------// + +void QSCArrow::setEndPointProperty( const QString& data ) + { + QSGPoint new_point = toQSGPoint( data ); + setEndPoint( new_point ); + } + +//-------------------------------------------------------------// + +void QSCArrow::setLine( const QSGLine& line ) + { + SET_COBJECT_PROPERTY( m_line, line ); + } + +//-------------------------------------------------------------// + +void QSCArrow::setLineProperty( const QString& data ) + { + QSGLine new_line = toQSGLine( data ); + setLine( new_line ); + } + +//-------------------------------------------------------------// +//-------------------------------------------------------------// +//-------------------------------------------------------------// +//-------------------------------------------------------------// + + +QSCRect::QSCRect( QObject *parent ) +:QSCObject( parent ) + { + m_shadow_fill.style = QSGFill::Transparent; + m_shadow_fill.color = QSGColor( 0, 0, 0 ); + m_shadow_pos.x = 5; + m_shadow_pos.y = 5; + m_end1.set( 0.1, 0.5, 0.0 ); + m_end2.set( 0.5, 0.1, 0.0 ); + m_ellipse = false; + m_axis1.set( QSAxes::normCoord, QSAxes::normCoord, QSAxes::normCoord ); + m_axis2.set( QSAxes::normCoord, QSAxes::normCoord, QSAxes::normCoord ); + } + +//-------------------------------------------------------------// + +QSCRect::~QSCRect() + { + } + +//-------------------------------------------------------------// + +void QSCRect::draw( QSDrv *drv, bool, bool ) + { + QSPt3f p1 = mixedToCanvas( m_end1, m_axis1.x, m_axis1.y, m_axis1.z, drv->dpi ); + QSPt3f p2 = mixedToCanvas( m_end2, m_axis2.x, m_axis2.y, m_axis2.z, drv->dpi ); + QSPt2f pos1 = QSPt2f( p1.x, p1.y ); + QSPt2f pos2 = QSPt2f( p2.x, p2.y ); + QSPt2f shad = QSPt2f(drv->toPixels(m_shadow_pos.x),drv->toPixels(m_shadow_pos.y)); + + if ( m_shadow_fill.style != QSGFill::Transparent ) { + drv->setLine( QSGLine::invisibleLine ); + drv->setFill( m_shadow_fill ); + if ( m_ellipse ) drv->drawEllipse( pos1+shad, pos2+shad ); + else drv->drawRect( pos1+shad, pos2+shad ); + } + + drv->setFill( m_fill ); + drv->setLine( m_frame ); + if ( m_ellipse ) drv->drawEllipse( pos1, pos2 ); + else drv->drawRect( pos1, pos2 ); + emit sigDrawEnds( this ); + } + +//-------------------------------------------------------------// + +QSRectf QSCRect::box( QSDrv *drv ) + { + QSPt3f cp1 = mixedToCanvas( m_end1, m_axis1.x, m_axis1.y, m_axis1.z, drv->dpi ); + QSPt3f cp2 = mixedToCanvas( m_end2, m_axis2.x, m_axis2.y, m_axis2.z, drv->dpi ); + return QSRectf( cp1.x, cp1.y, cp2.x-cp1.x, cp2.y-cp1.y ).normalize(); + } + + +//-------------------------------------------------------------// + +void QSCRect::setBox( const QSRectf& r, QSDrv *drv ) + { + parametersChanging(); + // preserve a depth + QSPt3f cp1 = mixedToCanvas( m_end1, m_axis1.x, m_axis1.y, m_axis1.z, drv->dpi ); + QSPt3f cp2 = mixedToCanvas( m_end2, m_axis2.x, m_axis2.y, m_axis2.z, drv->dpi ); + + QSRectf rn = r.normalize(); + cp1.set( rn.pos.x, rn.pos.y, cp1.z ); + cp2.set( rn.pos.x+rn.size.x, rn.pos.y+rn.size.y, cp2.z ); + + m_end1 = canvasToMixed( cp1, m_axis1.x, m_axis1.y, m_axis1.z, drv->dpi ); + m_end2 = canvasToMixed( cp2, m_axis2.x, m_axis2.y, m_axis2.z, drv->dpi ); + parametersChanged(); + } + +//-------------------------------------------------------------// + +bool QSCRect::isHit( const QSPt2f &p, QSDrv* drv ) + { + QRegion r( box(drv).rect(), m_ellipse ? QRegion::Ellipse : QRegion::Rectangle ); + return r.contains( QPoint(int(p.x+0.5),int(p.y+0.5)) ); + } + +//-------------------------------------------------------------// + +void QSCRect::setEllipse( bool ellipse ) + { + SET_COBJECT_PROPERTY( m_ellipse, ellipse ); + } + +//-------------------------------------------------------------// + +void QSCRect::setOriginPos( const QSPt3f& pos ) + { + SET_COBJECT_PROPERTY( m_end1, pos ); + } + +//-------------------------------------------------------------// + +void QSCRect::setOriginX( double x ) + { + SET_COBJECT_PROPERTY( m_end1.x, x ); + } + +//-------------------------------------------------------------// + +void QSCRect::setOriginY( double y ) + { + SET_COBJECT_PROPERTY( m_end1.y, y ); + } + +//-------------------------------------------------------------// + +void QSCRect::setOriginZ( double z ) + { + SET_COBJECT_PROPERTY( m_end1.z, z ); + } + +//-------------------------------------------------------------// + +void QSCRect::setEndPos( const QSPt3f& pos ) + { + SET_COBJECT_PROPERTY( m_end2, pos ); + } + +//-------------------------------------------------------------// + +void QSCRect::setEndX( double x ) + { + SET_COBJECT_PROPERTY( m_end2.x, x ); + } + +//-------------------------------------------------------------// + +void QSCRect::setEndY( double y ) + { + SET_COBJECT_PROPERTY( m_end2.y, y ); + } + +//-------------------------------------------------------------// + +void QSCRect::setEndZ( double z ) + { + SET_COBJECT_PROPERTY( m_end2.z, z ); + } + +//-------------------------------------------------------------// + +void QSCRect::setOriginCoord( const QSPt3& coordSystem ) + { + SET_COBJECT_PROPERTY( m_axis1, coordSystem ) + } + +//-------------------------------------------------------------// + +void QSCRect::setOriginCoordX( int coordSystem ) + { + SET_COBJECT_PROPERTY( m_axis1.x, coordSystem ) + } + +//-------------------------------------------------------------// + +void QSCRect::setOriginCoordY( int coordSystem ) + { + SET_COBJECT_PROPERTY( m_axis1.y, coordSystem ) + } + +//-------------------------------------------------------------// + +void QSCRect::setOriginCoordZ( int coordSystem ) + { + SET_COBJECT_PROPERTY( m_axis1.z, coordSystem ) + } + +//-------------------------------------------------------------// + +void QSCRect::setEndCoord( const QSPt3& coordSystem ) + { + SET_COBJECT_PROPERTY( m_axis2, coordSystem ) + } + +//-------------------------------------------------------------// + +void QSCRect::setEndCoordX( int coordSystem ) + { + SET_COBJECT_PROPERTY( m_axis2.x, coordSystem ) + } + +//-------------------------------------------------------------// + +void QSCRect::setEndCoordY( int coordSystem ) + { + SET_COBJECT_PROPERTY( m_axis2.y, coordSystem ) + } + +//-------------------------------------------------------------// + +void QSCRect::setEndCoordZ( int coordSystem ) + { + SET_COBJECT_PROPERTY( m_axis2.z, coordSystem ) + } + +//-------------------------------------------------------------// + +void QSCRect::setFill( const QSGFill& fill ) + { + SET_COBJECT_PROPERTY( m_fill, fill ); + } + +//-------------------------------------------------------------// + +void QSCRect::setFillProperty( const QString &data ) + { + QSGFill new_fill = toQSGFill(data); + setFill( new_fill ); + } + +//-------------------------------------------------------------// + +void QSCRect::setFrame( const QSGLine& line ) + { + SET_COBJECT_PROPERTY( m_frame, line ); + } + +//-------------------------------------------------------------// + +void QSCRect::setFrameProperty( const QString& data ) + { + QSGLine new_line = toQSGLine(data); + setFrame( new_line ); + } + +//-------------------------------------------------------------// + +void QSCRect::setShadowFill( const QSGFill& fill ) + { + SET_COBJECT_PROPERTY( m_shadow_fill, fill ); + } + +//-------------------------------------------------------------// + +void QSCRect::setShadowFillProperty( const QString& data ) + { + QSGFill new_shadow_fill = toQSGFill(data); + setShadowFill( new_shadow_fill ); + } + +//-------------------------------------------------------------// + +void QSCRect::setShadowPos( const QSPt2& shift ) + { + SET_COBJECT_PROPERTY( m_shadow_pos, shift ); + } + +//-------------------------------------------------------------// + +void QSCRect::setShadowPosX( int value ) + { + SET_COBJECT_PROPERTY( m_shadow_pos.x, value ); + } + +//-------------------------------------------------------------// + +void QSCRect::setShadowPosY( int value ) + { + SET_COBJECT_PROPERTY( m_shadow_pos.y, value ); + } + +//-------------------------------------------------------------// diff --git a/kmatplot/qscobjects.h b/kmatplot/qscobjects.h new file mode 100644 index 0000000..1c9ef8f --- /dev/null +++ b/kmatplot/qscobjects.h @@ -0,0 +1,363 @@ +/*************************************************************************** + qscobjects.h + ------------------- + begin : Sun Jan 30 2000 + copyright : (C) 2000 by Kamil Dobkowski + email : kamildbk@friko.onet.pl + ***************************************************************************/ + +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + + +#ifndef QSCOBJECTS_H +#define QSCOBJECTS_H + +#include"widgets/qscoord.h" +#include"widgets/qsgattr.h" +#include"widgets/qscobject.h" +#include<qstring.h> + +//-----------------------------------------------------------------------// + +/** + * Draw a simple text on a canvas. + * @author Kamil Dobkowski + */ +class QSCLabel : public QSCObject + { + Q_OBJECT + Q_PROPERTY( int textAlign READ textAlign WRITE setTextAlign ) + Q_PROPERTY( int frameAlign READ frameAlign WRITE setFrameAlign ) + Q_PROPERTY( int angle READ angle WRITE setAngle ) + Q_PROPERTY( QString text READ text WRITE setText ) + Q_PROPERTY( double posX READ posX WRITE setPosX ) + Q_PROPERTY( double posY READ posY WRITE setPosY ) + Q_PROPERTY( double posZ READ posZ WRITE setPosZ ) + Q_PROPERTY( int coordX READ coordX WRITE setCoordX ) + Q_PROPERTY( int coordY READ coordY WRITE setCoordY ) + Q_PROPERTY( int coordZ READ coordZ WRITE setCoordZ ) + Q_PROPERTY( QString font READ fontProperty WRITE setFontProperty ) + Q_PROPERTY( QString fill READ fillProperty WRITE setFillProperty ) + Q_PROPERTY( QString frame READ frameProperty WRITE setFrameProperty ) + Q_PROPERTY( QString shadowFill READ shadowFillProperty WRITE setShadowFillProperty ) + Q_PROPERTY( int shadowPosX READ shadowPosX WRITE setShadowPosX ) + Q_PROPERTY( int shadowPosY READ shadowPosY WRITE setShadowPosY ) + + public: + QSCLabel( const QString& text=QString::null, QObject *parent=NULL ); + ~QSCLabel(); + + int style() { return Rotateable | Moveable; } + void insertString( int pos, const QString& s ); + void deleteString( int pos, int len ); + void setCursorHint( int pos ); + int cursorHint() const { return m_cursor; } + + void draw( QSDrv *drv, bool blocking=true, bool transparent=true ); + void setBox( const QSRectf& r, QSDrv *drv ); + void rotate( int deg, QSDrv *drv ); + QSPt2f rCenter( QSDrv *drv ); + QSRectf box( QSDrv *drv ); + QString name(); + + void setEditMode( bool enabled ); + bool editMode() const { return m_edited; } + + void setText( const QString& text ); + QString text() const { return m_text; } + void setAngle( int angle ); + int angle() const { return m_angle; } + void setFrameAlign( int align ); + int frameAlign() const { return m_frame_align; } + void setTextAlign( int align ); + int textAlign() const { return m_text_align; } + void setPos( const QSPt3f& pos ); + void setPosX( double value ); + void setPosY( double value ); + void setPosZ( double value ); + QSPt3f pos() const { return m_pos; } + double posX() const { return m_pos.x; } + double posY() const { return m_pos.y; } + double posZ() const { return m_pos.z; } + void setCoord( const QSPt3& coordSystem ); + void setCoordX( int coordSystem ); + void setCoordY( int coordSystem ); + void setCoordZ( int coordSystem ); + QSPt3 coord() const { return m_axis; } + int coordX() const { return m_axis.x; } + int coordY() const { return m_axis.y; } + int coordZ() const { return m_axis.z; } + void setFont( const QSGFont& font ); + void setFontProperty( const QString& data ); + QSGFont font() const { return m_font; } + QString fontProperty() const { return toQString(m_font); } + void setFill( const QSGFill& fill ); + void setFillProperty( const QString &data ); + QSGFill fill() const { return m_fill; } + QString fillProperty() const { return toQString(m_fill); } + void setFrame( const QSGLine& line ); + void setFrameProperty( const QString& data ); + QSGLine frame() const { return m_frame; } + QString frameProperty() const { return toQString(m_frame); } + void setShadowFill( const QSGFill& fill ); + void setShadowFillProperty( const QString& data ); + QSGFill shadowFill() const { return m_shadow_fill; } + QString shadowFillProperty() const { return toQString(m_shadow_fill); } + void setShadowPos( const QSPt2& shift ); + void setShadowPosX( int shift ); + void setShadowPosY( int shift ); + QSPt2 shadowPos() const { return m_shadow_pos; } + int shadowPosX() const { return m_shadow_pos.x; } + int shadowPosY() const { return m_shadow_pos.y; } + + protected: + int m_text_align; + int m_frame_align; + int m_angle; + QSPt3f m_pos; + QSPt3 m_axis; + QString m_text; + QSGFill m_fill; + QSGLine m_frame; + QSGFont m_font; + QSPt2 m_shadow_pos; + QSGFill m_shadow_fill; + int m_cursor; + bool m_edited; + }; + + +//-----------------------------------------------------------------------// + +/** + * Draw an arrow on a canvas. + * @author Kamil Dobkowski + */ +class QSCArrow : public QSCObject { + Q_OBJECT + Q_PROPERTY( double originX READ originX WRITE setOriginX ) + Q_PROPERTY( double originY READ originY WRITE setOriginY ) + Q_PROPERTY( double originZ READ originZ WRITE setOriginZ ) + Q_PROPERTY( double endX READ endX WRITE setEndX ) + Q_PROPERTY( double endY READ endY WRITE setEndY ) + Q_PROPERTY( double endZ READ endZ WRITE setEndZ ) + Q_PROPERTY( int originCoordX READ originCoordX WRITE setOriginCoordX ) + Q_PROPERTY( int originCoordY READ originCoordY WRITE setOriginCoordY ) + Q_PROPERTY( int originCoordZ READ originCoordZ WRITE setOriginCoordZ ) + Q_PROPERTY( int endCoordX READ endCoordX WRITE setEndCoordX ) + Q_PROPERTY( int endCoordY READ endCoordY WRITE setEndCoordY ) + Q_PROPERTY( int endCoordZ READ endCoordZ WRITE setEndCoordZ ) + Q_PROPERTY( QString originArrow READ originArrowProperty WRITE setOriginArrowProperty ) + Q_PROPERTY( QString originPoint READ originPointProperty WRITE setOriginPointProperty ) + Q_PROPERTY( QString endArrow READ endArrowProperty WRITE setEndArrowProperty ) + Q_PROPERTY( QString endPoint READ endPointProperty WRITE setEndPointProperty ) + Q_PROPERTY( QString line READ lineProperty WRITE setLineProperty ) + + public: + QSCArrow( QObject *parent=NULL ); + ~QSCArrow(); + int style() { return Resizeable | Moveable; } + + void draw( QSDrv *drv, bool blocking=true, bool transparent=true ); + bool isHit( const QSPt2f &p, QSDrv* drv ); + void setBox( const QSRectf& r, QSDrv *drv ); + void rotate( int deg, QSDrv *drv ); + QSPt2f rCenter( QSDrv *drv ); + QSRectf box( QSDrv *drv ); + QString name() { return tr("Arrow"); } + void setEditMode( bool enabled ); + bool editMode() const { return !m_visible; } + + void setOriginPos( const QSPt3f& pos ); + void setOriginX( double x ); + void setOriginY( double y ); + void setOriginZ( double z ); + QSPt3f originPos() const { return m_end1; } + double originX() const { return m_end1.x; } + double originY() const { return m_end1.y; } + double originZ() const { return m_end1.z; } + + void setEndPos( const QSPt3f& pos ); + void setEndX( double x ); + void setEndY( double y ); + void setEndZ( double z ); + QSPt3f endPos() const { return m_end2; } + double endX() const { return m_end2.x; } + double endY() const { return m_end2.y; } + double endZ() const { return m_end2.z; } + + void setOriginCoord( const QSPt3& coordSystem ); + void setOriginCoordX( int coordSystem ); + void setOriginCoordY( int coordSystem ); + void setOriginCoordZ( int coordSystem ); + QSPt3 originCoord() const { return m_axis1; } + int originCoordX() const { return m_axis1.x; } + int originCoordY() const { return m_axis1.y; } + int originCoordZ() const { return m_axis1.z; } + + void setEndCoord( const QSPt3& coordSystem ); + void setEndCoordX( int coordSystem ); + void setEndCoordY( int coordSystem ); + void setEndCoordZ( int coordSystem ); + QSPt3 endCoord() const { return m_axis2; } + int endCoordX() const { return m_axis2.x; } + int endCoordY() const { return m_axis2.y; } + int endCoordZ() const { return m_axis2.z; } + + void setOriginArrow( const QSGArrow& arrow ); + void setOriginArrowProperty( const QString& data ); + QSGArrow originArrow() const { return m_end1style; } + QString originArrowProperty() const { return toQString(m_end1style); } + + void setOriginPoint( const QSGPoint& point ); + void setOriginPointProperty( const QString& data ); + QSGPoint originPoint() const { return m_end1point; } + QString originPointProperty() const { return toQString(m_end1point); } + + void setEndArrow( const QSGArrow& arrow ); + void setEndArrowProperty( const QString& data ); + QSGArrow endArrow() const { return m_end2style; } + QString endArrowProperty() const { return toQString(m_end2style); } + + void setEndPoint( const QSGPoint& point ); + void setEndPointProperty( const QString& data ); + QSGPoint endPoint() const { return m_end2point; } + QString endPointProperty() const { return toQString(m_end2point); } + + void setLine( const QSGLine& line ); + void setLineProperty( const QString& data ); + QSGLine line() const { return m_line; } + QString lineProperty() const { return toQString(m_line); } + + protected: + QSPt3f m_end1; + QSPt3f m_end2; + QSPt3 m_axis1; + QSPt3 m_axis2; + bool m_visible; + QSGArrow m_end1style; + QSGArrow m_end2style; + QSGPoint m_end1point; + QSGPoint m_end2point; + QSGLine m_line;; + }; + +//-----------------------------------------------------------------------// + +/** + * Draw an ellipse on a canvas. + * @author Kamil Dobkowski + */ +class QSCRect : public QSCObject { + Q_OBJECT + Q_PROPERTY( double originX READ originX WRITE setOriginX ) + Q_PROPERTY( double originY READ originY WRITE setOriginY ) + Q_PROPERTY( double originZ READ originZ WRITE setOriginZ ) + Q_PROPERTY( double endX READ endX WRITE setEndX ) + Q_PROPERTY( double endY READ endY WRITE setEndY ) + Q_PROPERTY( double endZ READ endZ WRITE setEndZ ) + Q_PROPERTY( int originCoordX READ originCoordX WRITE setOriginCoordX ) + Q_PROPERTY( int originCoordY READ originCoordY WRITE setOriginCoordY ) + Q_PROPERTY( int originCoordZ READ originCoordZ WRITE setOriginCoordZ ) + Q_PROPERTY( int endCoordX READ endCoordX WRITE setEndCoordX ) + Q_PROPERTY( int endCoordY READ endCoordY WRITE setEndCoordY ) + Q_PROPERTY( int endCoordZ READ endCoordZ WRITE setEndCoordZ ) + Q_PROPERTY( QString shadowFill READ shadowFillProperty WRITE setShadowFillProperty ) + Q_PROPERTY( int shadowPosX READ shadowPosX WRITE setShadowPosX ) + Q_PROPERTY( int shadowPosY READ shadowPosY WRITE setShadowPosY ) + Q_PROPERTY( QString fill READ fillProperty WRITE setFillProperty ) + Q_PROPERTY( QString frame READ frameProperty WRITE setFrameProperty ) + Q_PROPERTY( bool ellipse READ ellipse WRITE setEllipse ) + + public: + QSCRect( QObject *parent=NULL ); + ~QSCRect(); + + void setEllipse( bool ellipse ); + bool ellipse() const { return m_ellipse; } + + void setOriginPos( const QSPt3f& pos ); + void setOriginX( double x ); + void setOriginY( double y ); + void setOriginZ( double z ); + QSPt3f originPos() const { return m_end1; } + double originX() const { return m_end1.x; } + double originY() const { return m_end1.y; } + double originZ() const { return m_end1.z; } + + void setEndPos( const QSPt3f& pos ); + void setEndX( double x ); + void setEndY( double y ); + void setEndZ( double z ); + QSPt3f endPos() const { return m_end2; } + double endX() const { return m_end2.x; } + double endY() const { return m_end2.y; } + double endZ() const { return m_end2.z; } + + void setOriginCoord( const QSPt3& coordSystem ); + void setOriginCoordX( int coordSystem ); + void setOriginCoordY( int coordSystem ); + void setOriginCoordZ( int coordSystem ); + QSPt3 originCoord() const { return m_axis1; } + int originCoordX() const { return m_axis1.x; } + int originCoordY() const { return m_axis1.y; } + int originCoordZ() const { return m_axis1.z; } + + void setEndCoord( const QSPt3& coordSystem ); + void setEndCoordX( int coordSystem ); + void setEndCoordY( int coordSystem ); + void setEndCoordZ( int coordSystem ); + QSPt3 endCoord() const { return m_axis2; } + int endCoordX() const { return m_axis2.x; } + int endCoordY() const { return m_axis2.y; } + int endCoordZ() const { return m_axis2.z; } + + void setFrame( const QSGLine& line ); + void setFrameProperty( const QString& data ); + QSGLine frame() const { return m_frame; } + QString frameProperty() const { return toQString(m_frame); } + + void setFill( const QSGFill& fill ); + void setFillProperty( const QString &data ); + QSGFill fill() const { return m_fill; } + QString fillProperty() const { return toQString(m_fill); } + + void setShadowFill( const QSGFill& fill ); + void setShadowFillProperty( const QString& data ); + QSGFill shadowFill() const { return m_shadow_fill; } + QString shadowFillProperty() const { return toQString(m_shadow_fill); } + void setShadowPos( const QSPt2& shift ); + void setShadowPosX( int shift ); + void setShadowPosY( int shift ); + QSPt2 shadowPos() const { return m_shadow_pos; } + int shadowPosX() const { return m_shadow_pos.x; } + int shadowPosY() const { return m_shadow_pos.y; } + + void draw( QSDrv *drv, bool blocking=true, bool transparent=true ); + int style() { return Resizeable | Moveable; } + void setBox( const QSRectf& r, QSDrv *drv ); + bool isHit( const QSPt2f &p, QSDrv* drv ); + QSRectf box( QSDrv *drv ); + QString name() { return m_ellipse ? tr("Ellipse") : tr("Rectangle"); } + + protected: + bool m_ellipse; + QSPt3f m_end1; + QSPt3f m_end2; + QSPt3 m_axis1; + QSPt3 m_axis2; + QSGFill m_fill; + QSGLine m_frame; + QSPt2 m_shadow_pos; + QSGFill m_shadow_fill; + }; + +#endif + diff --git a/kmatplot/qsctools.cpp b/kmatplot/qsctools.cpp new file mode 100644 index 0000000..939511a --- /dev/null +++ b/kmatplot/qsctools.cpp @@ -0,0 +1,1271 @@ +/*************************************************************************** + qsctools.cpp + ------------------- + begin : Sun Jan 30 2000 + copyright : (C) 2000 by Kamil Dobkowski + email : kamildbk@friko.onet.pl + ***************************************************************************/ + +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + + +#include"qsctools.h" +#include"qscobjects.h" +#include"kspanelmanager.h" +#include"ksworkbook.h" +#include"kscommands.h" +#include"widgets/qsdrvqt.h" +#include"widgets/qsdrvhittest.h" +#include"widgets/qsplotview.h" +#include"widgets/qsaxes2d.h" +#include"widgets/qsaxes3d.h" +#include"widgets/qsaxis.h" +#include"dialogs/kstextedit.h" +#include<qcursor.h> +#include<qlabel.h> +#include<qpainter.h> +#include<qpopupmenu.h> +#include<qpen.h> +#include<math.h> +#include"kmatplotshell.h" + +//-------------------------------------------------------------// + +QSToolLabel::QSToolLabel( QObject *parent ) +: QSTool( parent ) + { + } + +//-------------------------------------------------------------// + +QSToolLabel::~QSToolLabel() + { + } + +//-------------------------------------------------------------// + +void QSToolLabel::activate( QSPlotView *p ) + { + QSTool::activate( p ); + m_view->showUserMessage( tr("Label tool\n" + "Click on a canvas to create a new label. " + "If the axis object is currently selected the " + "newly created label will became its child object " + "and can be positioned relative to its parents position. " + "Click on a existing label to edit it. ") ); + } + +//-------------------------------------------------------------// + +void QSToolLabel::deactivate() + { + // WE CANT set selection in deactivate. + // selection get first sigPageRemoved - it clear itself, next PlotView gets page removed, + // calls deactivate, and in deactivate we select an object which was removed with this page. + //m_view->selection()->set( active ); + QSTool::deactivate(); + } + +//-------------------------------------------------------------// + +void QSToolLabel::canvasClicked( const QPoint& pos, int ) + { + QSCLabel *clicked = dynamic_cast<QSCLabel*>(m_view->objectAt(pos,true)); + + QSCLabel *edited_label; + if ( !clicked ) { + edited_label = new QSCLabel(); + edited_label->setBox( QSRectf( pos.x(), pos.y(), 10, 10 ), driver() ); + } else { + edited_label = clicked; + } + + KSTextEditDlg dlg(m_view,edited_label->text(),edited_label->font()); + if ( dlg.exec() ) edited_label->setText( dlg.text() ); + + if ( !clicked ) { + if ( edited_label->text().isEmpty() ) { + delete edited_label; + } else { + QSRectf box = edited_label->box(driver()); + if ( dynamic_cast<KSWorkbook*>(m_view->workbook())->execute( new KSCmdAddCObject(edited_label,m_view->activeCollection()) ) ) + edited_label->setBox( box, driver() ); + } + } else { + if ( edited_label->text().isEmpty() ) { + dynamic_cast<KSWorkbook*>(m_view->workbook())->execute( new KSCmdRemoveCObject(edited_label) ); + } + } + + } + + +//-------------------------------------------------------------// +//-------------------------------------------------------------// +//-------------------------------------------------------------// + + + +class QSToolSelect::Handle { + public: + enum Type { + Selected, + Resize, + Rotate, + RCenter, + Special + }; + enum AlignFlags { + HCenter = 1U<<0, + VCenter = 1U<<1, + Left = 1U<<2, + Right = 1U<<3, + Top = 1U<<4, + Bottom = 1U<<5 + }; + Type m_type; + int m_align; + QSCObject *m_object; + QPoint m_pos; + QRect m_rect; + int m_number; + QCursor m_cursor; + + //----------------------------------------------// + + Handle( const QPoint& pos, QSCObject *object, Type type, int align=HCenter|VCenter, int number=-1 ) { + m_pos = pos; + m_object = object; + m_type = type; + m_align = align; + m_number = number; + switch( m_type ) { + case Special: m_rect = QRect( 0, 0, 5, 5 ); break; + default: m_rect = QRect( 0, 0, 7, 7 ); break; + } + m_rect.moveCenter( m_pos ); + if ( align & Left ) m_rect.moveTopRight( QPoint(m_pos.x(),m_rect.top()) ); + if ( align & Right ) m_rect.moveTopLeft( QPoint(m_pos.x(),m_rect.top()) ); + if ( align & Top ) m_rect.moveBottomLeft( QPoint(m_rect.left(),m_pos.y()) ); + if ( align & Bottom ) m_rect.moveTopLeft( QPoint(m_rect.left(),m_pos.y()) ); + } + + ~Handle() { + } + + //--------------------------------------------// + + void paint( QPainter *p ) { + p->setPen( Qt::SolidLine ); + p->setBrush( Qt::NoBrush ); + switch( m_type ) { + case Resize: p->fillRect( m_rect, black ); break; + case Selected: p->drawRect( m_rect ); break; + case Rotate: p->drawEllipse( m_rect ); break; + case Special: p->drawEllipse( m_rect ); break; + case RCenter: p->drawEllipse( m_rect ); + p->drawPoint( m_pos ); break; + } + } + + //-------------------------------------------// + + QCursor cursor() { + if ( m_type == Rotate ) { + return QCursor(Qt::crossCursor); + } + if ( m_type == Resize ) { + if ( m_align & HCenter ) return QCursor(Qt::sizeVerCursor); + if ( m_align & VCenter ) return QCursor(Qt::sizeHorCursor); + if ( m_align & Top ) { + if ( m_align & Left ) return QCursor(Qt::sizeFDiagCursor); + if ( m_align & Right ) return QCursor(Qt::sizeBDiagCursor); + } + if ( m_align & Bottom ) { + if ( m_align & Left ) return QCursor(Qt::sizeBDiagCursor); + if ( m_align & Right ) return QCursor(Qt::sizeFDiagCursor); + } + } + + return QCursor(Qt::arrowCursor); + } + }; + +//-------------------------------------------------------------// + +QSToolSelect::QSToolSelect( KMatplotShell *shell, QObject *parent ) +: QSTool( parent ) + { + m_state = StateNormal; + m_shell = shell; + m_handles.setAutoDelete( TRUE ); + m_handles_visible = false; + } + +//-------------------------------------------------------------// + +QSToolSelect::~QSToolSelect() + { + } + +//-------------------------------------------------------------// + +void QSToolSelect::make_new_handles() + { + m_handles.clear(); + QSSelection *curr_sel = m_view->selection(); + for( int object_nr=0; object_nr<curr_sel->count(); object_nr++ ) { + QSCObject *curr_obj = curr_sel->object(object_nr); + QSRectf curr_box = curr_obj->box(driver()).normalize(); + QSPt2f curr_rcenter = curr_obj->rCenter(driver()); + QRect rect = curr_box.rect(); + QPoint rcenter = curr_rcenter.point(); + bool is_resizeable = curr_obj->style() & QSCObject::Resizeable; + bool is_rotateable = curr_obj->style() & QSCObject::Rotateable; + if ( m_state == StateNormal || !is_rotateable ) { + Handle::Type type = is_resizeable ? Handle::Resize : Handle::Selected; + m_handles.append( new Handle( QPoint(rect.center().x(),rect.top()), curr_obj, type, Handle::HCenter|Handle::Top ) ); + m_handles.append( new Handle( QPoint(rect.center().x(),rect.bottom()), curr_obj, type, Handle::HCenter|Handle::Bottom ) ); + m_handles.append( new Handle( QPoint(rect.left(),rect.center().y()), curr_obj, type, Handle::VCenter|Handle::Left ) ); + m_handles.append( new Handle( QPoint(rect.right(),rect.center().y()), curr_obj, type, Handle::VCenter|Handle::Right ) ); + + m_handles.append( new Handle( rect.topLeft(), curr_obj, type, Handle::Top|Handle::Left ) ); + m_handles.append( new Handle( rect.topRight(), curr_obj, type, Handle::Top|Handle::Right ) ); + m_handles.append( new Handle( rect.bottomLeft(), curr_obj, type, Handle::Bottom|Handle::Left ) ); + m_handles.append( new Handle( rect.bottomRight(), curr_obj, type, Handle::Bottom|Handle::Right ) ); + } + else + if ( m_state == StateRotate ) { + m_handles.append( new Handle( rect.topLeft(), curr_obj, Handle::Rotate, Handle::Top|Handle::Left ) ); + m_handles.append( new Handle( rect.topRight(), curr_obj, Handle::Rotate, Handle::Top|Handle::Right ) ); + m_handles.append( new Handle( rect.bottomLeft(), curr_obj, Handle::Rotate, Handle::Bottom|Handle::Left ) ); + m_handles.append( new Handle( rect.bottomRight(), curr_obj, Handle::Rotate, Handle::Bottom|Handle::Right ) ); + m_handles.append( new Handle( rcenter, curr_obj, Handle::RCenter ) ); + } + } + } + +//-------------------------------------------------------------// + +void QSToolSelect::paint_handles() + { + if ( m_view->fullPage() ) { + QPainter p(m_view->canvasWidget()); + p.setRasterOp( Qt::NotXorROP ); + for( unsigned int i=0; i<m_handles.count(); i++ ) m_handles.at(i)->paint(&p); + m_handles_visible = !m_handles_visible; + } + } + +//-------------------------------------------------------------// + +void QSToolSelect::show_handles() + { + if ( !m_handles_visible ) paint_handles(); + } + +//-------------------------------------------------------------// + +void QSToolSelect::hide_handles() + { + if ( m_handles_visible ) paint_handles(); + } + +//-------------------------------------------------------------// + +QSToolSelect::Handle *QSToolSelect::handle_at( const QPoint& pos ) + { + if ( m_handles_visible && m_view->currentPage() && m_view->selection()->rootCollection() == m_view->currentPage()->objects() ) + for ( unsigned int i=0; i<m_handles.count(); i++ ) + if ( m_handles.at(i)->m_rect.contains(pos) ) return m_handles.at(i); + return NULL; + } + +//-------------------------------------------------------------// + +QSCObject *QSToolSelect::selected_at( const QPoint& pos ) + { + if ( m_view->currentPage() && m_view->selection()->rootCollection() == m_view->currentPage()->objects() ) { + return m_view->selection()->objectAt( QSPt2f(pos.x(),pos.y()), driver() ); + } + return NULL; + } + +//-------------------------------------------------------------// + +void QSToolSelect::activate( QSPlotView *p ) + { + QSTool::activate( p ); + m_state = StateNormal; + connect( m_view->selection(), SIGNAL(sigListChanged()), this, SLOT(slot_selection_changed()) ); + m_view->showUserMessage(tr("Select tool\n" + "Click to select an object pointed by cursor. " + "CTRL+Click selects an object inside a group. " + "SHIFT+Click adds/removes an object from the selection. " + "Drag with SHIFT button pressed to move smoothly. " + "Click again on the selected object to turn on a rotate mode. " + "Right-button click shows menu. " + "Middle-button click selects a property panel of the element under mouse pointer.") ); + make_new_handles(); + show_handles(); + } + + +//-------------------------------------------------------------// + +void QSToolSelect::deactivate() + { + disconnect( m_view->selection(), SIGNAL(sigListChanged()), this, SLOT(slot_selection_changed()) ); + hide_handles(); + m_handles.clear(); + QSTool::deactivate(); + } + +//-------------------------------------------------------------// + +void QSToolSelect::slot_selection_changed() + { + hide_handles(); + make_new_handles(); + show_handles(); + m_view->showUserMessage( QString(tr(" %1 objects selected.")).arg(m_view->selection()->count()) ); + } + +//-------------------------------------------------------------// + +void QSToolSelect::draw() + { + m_handles_visible = false; + if ( m_view->fullPage() && m_view->currentPage() && m_view->selection()->rootCollection() == m_view->currentPage()->objects() ) { + make_new_handles(); + show_handles(); + } + } + +//-------------------------------------------------------------// + +void QSToolSelect::canvasMove( const QPoint& pos ) + { + if ( !m_view->fullPage() ) return; + Handle *handle = handle_at(pos); + if ( handle ) { + m_view->canvasWidget()->setCursor( handle->cursor() ); + return; + } + /* + QSCObject *object = selected_at(pos); + if ( object ) { + m_view->canvasWidget()->setCursor( sizeAllCursor ); + return; + } + */ + m_view->canvasWidget()->setCursor( arrowCursor ); + } + +//-------------------------------------------------------------// + +void QSToolSelect::canvasMiddleButtonClicked( const QPoint& pos, int ) + { + if ( m_view->activeObject() && m_view->activeObject()->busy() ) m_view->activeObject()->stop(); + if ( m_view->activeObject() && !m_view->activeObject()->busy() ) { + KSPanelManager *panel_manager = dynamic_cast<KSPanelManager*>(m_shell->propertyContainer()->widget()); + // test hit - select panel + if ( panel_manager ) { + QSDrvHitTest drv( QSPt2f(pos.x(),pos.y()) ); + drv.setDC(new QPainter(m_view->canvasWidget()),m_view->dpi(),true); + connect(&drv,SIGNAL(hitDetected(int,int)),panel_manager,SLOT(selectPanel(int,int))); + // hack - axes can be in a single view mode and redrawing axes object + // redraw object on page, not zoomed in a single view... + // Driver is not created on the stack ( why ? ) so do blocking redraw + if ( m_view->activeObject()->isAxesShadow() ) { + m_view->activeObject()->parentAxes()->drawPlot( &drv, true, true ); + } else { + m_view->activeObject()->draw( &drv, true, true ); + } + } + } + } + +//-------------------------------------------------------------// + +void QSToolSelect::canvasClicked( const QPoint& pos, int keyState ) + { + if ( m_view->fullPage() ) { + QSCObject *clicked_object = selected_at(pos); + if ( clicked_object == NULL || (keyState&ControlButton) ) clicked_object = m_view->objectAt(pos,(keyState&ControlButton)); + // user clicked on a new object with Shift pressed - add/remove object from selection + if ( keyState & Qt::ShiftButton ) { + m_state = StateNormal; + m_view->selection()->turn( clicked_object ); + } + // user clicked on selected object - turn on/off rotation mode + else if ( m_view->selection()->contains(clicked_object) ) { + m_state = m_state==StateNormal?StateRotate:StateNormal; + m_view->selection()->set( clicked_object ); + } + // user clicked on some object - select it + else { + m_state = StateNormal; + m_view->selection()->set( clicked_object ); + } + } + } + +//-------------------------------------------------------------// + +bool QSToolSelect::canvasDragStart( const QPoint& pos, int keyState ) + { + m_view->currentPage()->objects()->stop(); + m_drag_handle = NULL; + m_drag_object = NULL; + m_move_prev_d = QSPt2f(); + // check if handle clicked + if ( handle_at(pos) ) { + m_drag_handle = handle_at(pos); + create_transform_cmd(); + paint_selected_objects(); + } + // check if selected object clicked - moving objects + else if ( selected_at(pos) ) { + m_drag_object = selected_at(pos); + create_transform_cmd(); + paint_selected_objects(); + } + // check if other object was clicked + else if ( m_view->objectAt(pos,(keyState&ControlButton)) ) { + QSCObject *clicked_object = m_view->objectAt(pos,(keyState&ControlButton)); + m_view->selection()->set(clicked_object); + m_drag_object = clicked_object; + create_transform_cmd(); + paint_selected_objects(); + } + // selecting using bounding frame + else if ( keyState & Qt::ShiftButton ) { + paint_frame( pos, pos ); + } + // selecting using bounding frame + else { + m_view->selection()->clear(); + paint_frame( pos, pos ); + } + + return true; + } + +//-------------------------------------------------------------// + +void QSToolSelect::canvasDragMove( const QPoint& pos, const QPoint& prevPos, const QPoint& startPos, int keyState, int, int ) + { + // draging some handle + if ( m_drag_handle ) { + switch( m_drag_handle->m_type ) { + case Handle::Resize: drag_resize_handle_by( pos-startPos, keyState, m_drag_handle ); break; + case Handle::Rotate: drag_rotate_handle( startPos, pos, keyState, m_drag_handle ); break; + } + } + // moving a group of objects + else if ( m_drag_object ) { + move_selected_by( pos-startPos, keyState ); + } + // selecting using bounding frame + else { + paint_frame( prevPos, startPos ); + paint_frame( pos, startPos ); + } + } + +//-------------------------------------------------------------// + +void QSToolSelect::canvasDragEnd( const QPoint& pos, const QPoint& startPos, int, int ) + { + // dragging some handle + if ( m_drag_handle ) { + paint_selected_objects(); + m_transform_cmd->commit(); + dynamic_cast<KSWorkbook*>(m_view->workbook())->execute( m_transform_cmd ); + m_transform_cmd = NULL; + } + // moving a group of objects + else if ( m_drag_object ) { + paint_selected_objects(); + m_transform_cmd->commit(); + dynamic_cast<KSWorkbook*>(m_view->workbook())->execute( m_transform_cmd ); + m_transform_cmd = NULL; + } + // selecting using bounding frame + else { + paint_frame( pos, startPos ); + QSRectf bounding_rect = QSRectf( QSPt2f(startPos), QSPt2f(pos), true ); + for( int i=0; i<m_view->currentPage()->objects()->count(); i++ ) { + QSCObject *object = m_view->currentPage()->objects()->object(i); + QSRectf curr_rect = object->box(driver()); + if ( bounding_rect.contains(curr_rect.pos) && + bounding_rect.contains(curr_rect.pos+curr_rect.size) ) { + m_view->selection()->add(object); + } + } + } + } + +//-------------------------------------------------------------// + +bool QSToolSelect::eventMousePress( QMouseEvent* e ) + { + if ( e->button() == Qt::RightButton ) { + m_shell->doAction( m_shell->m_object_menu ); + return TRUE; + } + return QSTool::eventMousePress( e ); + } +//-------------------------------------------------------------// + +void QSToolSelect::drag_rotate_handle( const QPoint& startPos, const QPoint& currPos, int keyState, Handle *handle ) + { + QSCObject *object = handle->m_object; + if ( handle->m_type == Handle::Rotate ) { + QSPt2f center = object->rCenter(driver()); + int new_angle = snapAngle( int(angle( center, startPos, currPos )) + m_transform_cmd->objectAngle(object), keyState ); + if ( new_angle != object->angle() ) { + paint_selected_objects(); + object->setAutoUpdates(false); + object->setAngle(new_angle); + object->setAutoUpdates(true); + paint_selected_objects(); + } + } + } + +//-------------------------------------------------------------// + +void QSToolSelect::drag_resize_handle_by( const QPoint& mouseShift, int keyState, Handle *handle ) + { + QSCObject *object = handle->m_object; + if ( handle->m_type == Handle::Resize ) { + QSRectf rect = m_transform_cmd->objectRect( object ); + if ( handle->m_align & Handle::Top ) { + rect.setTopLeft( QSPt2f( rect.topLeft().x, snapToGridY( rect.topLeft().y + mouseShift.y(), keyState ) ) ); + } + if ( handle->m_align & Handle::Bottom ) { + rect.setBottomRight( QSPt2f( rect.bottomRight().x, snapToGridY( rect.bottomRight().y + mouseShift.y(), keyState ) ) ); + } + if ( handle->m_align & Handle::Left ) { + rect.setTopLeft( QSPt2f( snapToGridX( rect.topLeft().x + mouseShift.x(), keyState ), rect.topLeft().y ) ); + } + if ( handle->m_align & Handle::Right ) { + rect.setBottomRight( QSPt2f( snapToGridX( rect.bottomRight().x + mouseShift.x(), keyState ), rect.bottomRight().y ) ); + } + + if ( rect.normalize() != object->box(driver()).normalize() ) { + paint_selected_objects(); + object->setAutoUpdates(false); + object->setBox(rect,driver()); + object->setAutoUpdates(true); + paint_selected_objects(); + } + } + } + +//-------------------------------------------------------------// + +void QSToolSelect::move_selected_by( const QPoint& mouseShift, int keyState ) + { + // find top-left corner of selection + QSPt2f selection_pos; + for( int i=0; i<m_view->selection()->count(); i++ ) { + QSCObject *object = m_view->selection()->object(i); + QSPt2f pos = m_transform_cmd->objectRect( object ).normalize().pos; + if ( i==0 ) selection_pos = pos; + selection_pos.x = QMIN( pos.x, selection_pos.x ); + selection_pos.y = QMIN( pos.y, selection_pos.y ); + } + + // shift the corner, snap to grid, and calculate resulting move distance + QSPt2f new_pos = snapToGrid( selection_pos+QSPt2f(mouseShift), keyState ); + QSPt2f d = new_pos-selection_pos; + // move all object by this distance + if ( m_move_prev_d != d ) { + paint_selected_objects(); + for( int i=0; i<m_view->selection()->count(); i++ ) { + QSCObject *object = m_view->selection()->object(i); + QSRectf box = m_transform_cmd->objectRect( object ); + box.pos = box.pos + d; + object->setAutoUpdates(false); + object->setBox(box,driver()); + object->setAutoUpdates(true); + } + m_move_prev_d = d; + paint_selected_objects(); + } + } + +//-------------------------------------------------------------// + +void QSToolSelect::create_transform_cmd() + { + QSDrvQt *drv = new QSDrvQt(); + drv->setDC(new QPainter(m_view->canvasWidget()),m_view->dpi(),true); + m_transform_cmd = new KSCmdTransformCObjects( drv ); + for( int i=0; i<m_view->selection()->count(); i++ ) { + QSCObject *object = m_view->selection()->object(i); + m_transform_cmd->addObject( object ); + } + } + +//-------------------------------------------------------------// + +int QSToolSelect::angle( const QSPt2f& rcenter, const QPoint& click_pos, const QPoint& mouse_pos ) + { + double A2 = mouse_pos.y() - rcenter.y; + double B2 = rcenter.x - mouse_pos.x(); + + double A1 = click_pos.y() - rcenter.y; + double B1 = rcenter.x - click_pos.x(); + + return int( atan2(A1*B2-A2*B1,A1*A2+B1*B2)*180.0/3.141592 + 0.5 ); + } + +//-------------------------------------------------------------// + +void QSToolSelect::paint_object( QSCObject* object ) + { + object->stop(); + QPainter p ( m_view->canvasWidget() ); + p.setRasterOp( Qt::NotXorROP ); + //QSRectf r = object->box(driver()); + object->paintSkeleton( &p, driver()->dpi ); + } + +//-------------------------------------------------------------// + +void QSToolSelect::paint_selected_objects() + { + m_view->selection()->stop(); + QPainter p ( m_view->canvasWidget() ); + p.setRasterOp( Qt::NotXorROP ); + m_view->selection()->paintSkeleton( &p, driver()->dpi ); + /* + for( int i=0; i<m_view->selection()->objectCount(); i++ ) { + paint_object( m_view->selection()->object(i) ); + } + */ + } + +//-------------------------------------------------------------// + +void QSToolSelect::paint_frame( const QPoint& p1, const QPoint& p2 ) + { + QRect r( p1, p2 ); + QPainter p ( m_view->canvasWidget() ); + p.setRasterOp( Qt::NotXorROP ); + p.setPen( Qt::DotLine ); + p.setBrush( Qt::NoBrush ); + p.drawRect( r ); + } + + +//-------------------------------------------------------------// +//-------------------------------------------------------------// +//-------------------------------------------------------------// +//-------------------------------------------------------------// + + +QSToolZoom::QSToolZoom( QObject *parent ) +:QSTool( parent ) + { + m_active_axes = NULL; + } + +//-------------------------------------------------------------// + +QSToolZoom::~QSToolZoom() + { + } + +//-------------------------------------------------------------// + +void QSToolZoom::activate( QSPlotView *init_view ) + { + QSTool::activate( init_view ); + erase_crossmark = false; + + // is the selected object on the current page ? + if ( m_view->currentPage() && + m_view->currentPage()->objects()->find( m_view->activeObject()) >= 0 ) + m_active_axes = m_view->activeObject()->parentAxes(); + + m_view->showUserMessage(tr("Zoom tool\n" + "Click and drag over selected axes to set a new range." + "Press a right button to zoom out. " + "Double click to set a default zoom. " + "Only scrollable axes are zoomed. ") ); + } + +//-------------------------------------------------------------// + +void QSToolZoom::deactivate() + { + if ( erase_crossmark ) draw_crossmark(p1); + m_active_axes = NULL; + QSTool::deactivate(); + } + + +//-------------------------------------------------------------// + +void QSToolZoom::draw() + { + erase_crossmark = false; + } + +//-------------------------------------------------------------// + +void QSToolZoom::canvasRightButtonClicked( const QPoint& pos, int ) + { + bool busy = ( m_active_axes && m_active_axes->state() == QSAxes::Busy ); + if ( erase_crossmark && !busy ) draw_crossmark(p1); + erase_crossmark = false; + zoom_out(pos); + } + +//-------------------------------------------------------------// + +bool QSToolZoom::canvasDragStart( const QPoint& pos, int ) + { + if ( find_plane(pos) ) { + p1 = p2 = world_point( pos ); + if ( erase_crossmark ) draw_crossmark(p1); + draw_frame(); + return true; + } + return false; + } + +//-------------------------------------------------------------// + +void QSToolZoom::canvasDragMove( const QPoint& pos, const QPoint&, const QPoint&, int, int, int ) + { + draw_frame(); + p2 = world_point( pos ); + draw_frame(); + } + +//-------------------------------------------------------------// + +void QSToolZoom::canvasDragEnd( const QPoint&, const QPoint&, int, int ) + { + draw_frame(); + erase_crossmark = false; + if ( p1 != p2 ) zoom_in( p1, p2 ); + } + +//-------------------------------------------------------------// + +void QSToolZoom::canvasMove( const QPoint& pos ) + { + bool busy = ( m_active_axes && m_active_axes->state() == QSAxes::Busy ); + if ( erase_crossmark && !busy ) draw_crossmark(p1); + erase_crossmark = false; + if ( find_plane(pos) ) { + p1=world_point(pos); + if ( !busy ) { draw_crossmark(p1); erase_crossmark = true; } + m_view->showUserMessage(message(p1)); + } else { + m_view->showUserMessage( QString(tr("OUT OF AREA ")) ); + } + } + +//-------------------------------------------------------------// + +void QSToolZoom::canvasDoubleClicked( const QPoint&, int ) + { + p1 = p2 = QSPt3f( 0.0, 0.0, 0.0 ); + zoom_in( p1, p2 ); + } + +//-------------------------------------------------------------// + +QSPt3f QSToolZoom::world_point( const QPoint& click_pos ) +// returns point in world coordinates + { + QSPt3f result; + QSPt2 canvas_pos( click_pos.x(), click_pos.y() ); + QSAxes *axes = m_active_axes; + QSAxes3D *axes3d = dynamic_cast<QSAxes3D*>(axes); + if ( axes3d ) { + + // find a straight line crossing focuspoint + // and point on the plane of the screen + QSPt3f pos1 = axes->proj()->canvas3ToWorld3D(QSPt3f(canvas_pos.x,canvas_pos.y,0.0)); + QSPt3f pos2 = axes->proj()->canvas3ToWorld3D(QSPt3f(canvas_pos.x,canvas_pos.y,1.0)); + + // focuspoint + if ( axes3d->perspective() ) pos2 = axes3d->p3D()->eye; + + // 'f' - it is a point where all three planes cross. + QSPt3f f = axes3d->proj()->furthest(); + + // Inf will be good for other functions to mark that the point is invalid + QSPt3f inf(-1.0,-1.0,-1.0); + if ( plane == PlaneYZ && pos1.x == pos2.x ) return inf; + if ( plane == PlaneXZ && pos1.y == pos2.y ) return inf; + if ( plane == PlaneXY && pos1.z == pos2.z ) return inf; + + // Where our straightline crosses the choosen plane ? + double t = 0.0; + if ( plane == PlaneYZ ) t = ( f.x - pos1.x ) / ( pos2.x - pos1.x ); + if ( plane == PlaneXZ ) t = ( f.y - pos1.y ) / ( pos2.y - pos1.y ); + if ( plane == PlaneXY ) t = ( f.z - pos1.z ) / ( pos2.z - pos1.z ); + + // Calculate x,y,z from t + result = f; + if ( plane != PlaneYZ ) result.x = pos1.x + t * ( pos2.x - pos1.x ); + if ( plane != PlaneXZ ) result.y = pos1.y + t * ( pos2.y - pos1.y ); + if ( plane != PlaneXY ) result.z = pos1.z + t * ( pos2.z - pos1.z ); + } else { + result = axes->proj()->canvas3ToWorld3D( QSPt3f(canvas_pos.x,canvas_pos.y,0.0) ); + } + + return result; + } + +//-------------------------------------------------------------// + +void QSToolZoom::draw_frame() + { + QSPt3f p[4]; + QSPt2 cp[4]; + p[0] = p1; + p[1] = (plane == PlaneXY) ? QSPt3f( p1.x, p2.y, p1.z ) : QSPt3f( p1.x, p1.y, p2.z ); + p[2] = p2; + p[3] = (plane == PlaneXY) ? QSPt3f( p2.x, p1.y, p1.z ) : QSPt3f( p2.x, p2.y, p1.z ); + for( int i=0; i<4; i++ ) { + QSPt3f curr_p = m_active_axes->proj()->world3DToCanvas3(p[i]); + cp[i].x = int(curr_p.x+0.5); + cp[i].y = int(curr_p.y+0.5); + } + + QPainter paint( m_view->canvasWidget() ); + paint.setRasterOp( Qt::NotXorROP ); paint.setPen( Qt::DotLine ); + for ( int i=0; i<4; i++ ) paint.drawLine(cp[i].x,cp[i].y,cp[(i+1)%4].x,cp[(i+1)%4].y); + draw_crossmark( p1 ); + draw_crossmark( p2 ); + QString info = QString(tr("From: \n"))+message(p1)+QString("\n")+QString(tr("To: \n"))+message(p2); + m_view->showUserMessage(info); + } + +//-------------------------------------------------------------// + +void QSToolZoom::zoom_out( const QPoint& click_pos ) + { + if ( find_plane(click_pos) ) { + QSPt3f pos = world_point( click_pos ); + QSPt3f min( pos.x-1.0, pos.y-1.0, pos.z-1.0); + QSPt3f max( pos.x+1.0, pos.y+1.0, pos.z+1.0); + zoom_in(min,max); + } + } + +//-------------------------------------------------------------// + +void QSToolZoom::zoom_in( const QSPt3f& p1, const QSPt3f& p2 ) +// zoom all axes + { + QSAxes *axes = m_active_axes; + if ( axes ) { + KSCmdSetRanges *cmd = new KSCmdSetRanges( axes ); + for( int axis_nr=0; axis_nr<axes->axisCount(); axis_nr++ ) { + QSAxis *axis = axes->axis(axis_nr); + if ( axis->scrollable() ) { + if ( plane != PlaneYZ && axis->type() == QSAxis::XAxisType ) axis->setRange( axis->worldToData(p1.x), axis->worldToData(p2.x) ); + if ( plane != PlaneXZ && axis->type() == QSAxis::YAxisType ) axis->setRange( axis->worldToData(p1.y), axis->worldToData(p2.y) ); + if ( plane != PlaneXY && axis->type() == QSAxis::ZAxisType ) axis->setRange( axis->worldToData(p1.z), axis->worldToData(p2.z) ); + } + } + cmd->commit(); + KSWorkbook *workbook = dynamic_cast<KSWorkbook*>(m_view->workbook()); + workbook->execute( cmd ); + } + } + +//-------------------------------------------------------------// + +bool QSToolZoom::find_plane( const QPoint& canvas_pos ) +// sets an internal variable plane; + { + if ( m_active_axes ) + if (dynamic_cast<QSAxes3D*>(m_active_axes)) { + for( int i=0; i<3; i++ ) { + plane = (Plane )i; + QSPt3f pos = world_point( canvas_pos ); + switch( plane ) { + case PlaneXY: if ( pos.x>0.0 && pos.x<1.0 && pos.y>0.0 && pos.y<1.0 ) return true; + case PlaneXZ: if ( pos.x>0.0 && pos.x<1.0 && pos.z>0.0 && pos.z<1.0 ) return true; + case PlaneYZ: if ( pos.y>0.0 && pos.y<1.0 && pos.z>0.0 && pos.z<1.0 ) return true; + } + } + } else { + QSPt3f pos = world_point( canvas_pos ); + plane = PlaneXY; + //if ( pos.x>0.0 && pos.x<1.0 && pos.y>0.0 && pos.y<1.0 ) return true; + //return false; + return true; + } + return false; + } + +//-------------------------------------------------------------// + +void QSToolZoom::draw_crossmark( const QSPt3f& pos ) + { + if ( !m_active_axes ) return; + + QSPt3f f; + QSPt3f min[2]; + QSPt3f max[2]; + + min[0] = min[1] = QSPt3f(-0.02,-0.02,-0.02); + max[0] = max[1] = QSPt3f( 1.02, 1.02, 1.02); + QSAxes3D *axes3d = dynamic_cast<QSAxes3D*>(m_active_axes); + if ( axes3d ) f=axes3d->proj()->furthest(); + switch( plane ) { + case PlaneXY: min[0].z=min[1].z=max[0].z=max[1].z=f.z; + min[0].x=max[0].x=pos.x; + min[1].y=max[1].y=pos.y; + break; + case PlaneXZ: min[0].y=min[1].y=max[0].y=max[1].y=f.y; + min[0].x=max[0].x=pos.x; + min[1].z=max[1].z=pos.z; + break; + case PlaneYZ: min[0].x=min[1].x=max[0].x=max[1].x=f.x; + min[0].y=max[0].y=pos.y; + min[1].z=max[1].z=pos.z; + break; + } + + QSPt3f p[2]; + QSPt3f q[2]; + p[0] = m_active_axes->proj()->world3DToCanvas3(min[0]); + p[1] = m_active_axes->proj()->world3DToCanvas3(min[1]); + q[0] = m_active_axes->proj()->world3DToCanvas3(max[0]); + q[1] = m_active_axes->proj()->world3DToCanvas3(max[1]); + QPainter paint( m_view->canvasWidget() ); + paint.setRasterOp( Qt::NotXorROP ); paint.setPen( Qt::SolidLine ); + paint.drawLine( int(p[0].x+0.5), int(p[0].y+0.5), int(q[0].x+0.5), int(q[0].y+0.5) ); + paint.drawLine( int(p[1].x+0.5), int(p[1].y+0.5), int(q[1].x+0.5), int(q[1].y+0.5) ); + + } + +//-------------------------------------------------------------// + +QString QSToolZoom::message( const QSPt3f& p ) + { + QString message; + //int x_nr = 1; + //int y_nr = 1; + //int z_nr = 1; + QSAxes *axes = m_active_axes; + + if ( axes ) + for ( int axis_nr=0; axis_nr<axes->axisCount(); axis_nr++ ) { + QSAxis *axis = axes->axis(axis_nr); + if ( axis->scrollable() ) + switch(axis->type()) { + case QSAxis::XAxisType: message += QString("X \"")+axis->title()+QString("\" = ")+QString::number(axis->worldToData(p.x))+QString("\n");break; + case QSAxis::YAxisType: message += QString("Y \"")+axis->title()+QString("\" = ")+QString::number(axis->worldToData(p.y))+QString("\n");break; + case QSAxis::ZAxisType: message += QString("Z \"")+axis->title()+QString("\" = ")+QString::number(axis->worldToData(p.z))+QString("\n");break; + default: break; + } + } + return message; + } + +//-------------------------------------------------------------// + +//-------------------------------------------------------------// +//-------------------------------------------------------------// +//-------------------------------------------------------------// + + +QSToolArrow::QSToolArrow( QObject *parent ) +:QSTool( parent ) + { + m_new_object = NULL; + } + +//-------------------------------------------------------------// + +QSToolArrow::~QSToolArrow() + { + } + +//-------------------------------------------------------------// + +void QSToolArrow::activate( QSPlotView *init_view ) + { + QSTool::activate( init_view ); + m_view->showUserMessage(tr("Arrow tool. \n" + "If the axis object is currently selected the " + "newly created arrow will became its child object " + "and can be positioned relative to its parents position. ") ); + m_view->canvasWidget()->setCursor( crossCursor ); + } + +//-------------------------------------------------------------// + +void QSToolArrow::deactivate() + { + QSTool::deactivate(); + delete m_new_object; m_new_object = NULL; + } + +//-------------------------------------------------------------// + +void QSToolArrow::draw() + { + } + +//-------------------------------------------------------------// + +bool QSToolArrow::canvasDragStart( const QPoint& pos, int keyState ) + { + m_new_object = new QSCArrow(); + m_new_object->setBox( QSRectf( snapToGrid(pos,keyState), snapToGrid(pos,keyState) ), driver() ); + paint_object(); + return true; + } + +//-------------------------------------------------------------// + +void QSToolArrow::canvasDragMove( const QPoint& pos, const QPoint&, const QPoint& startPos, int keyState, int, int startKeyState ) + { + paint_object(); + m_new_object->setBox( QSRectf( snapToGrid(pos,keyState), snapToGrid(startPos,startKeyState), false ), driver() ); + paint_object(); + } + +//-------------------------------------------------------------// + +void QSToolArrow::canvasDragEnd( const QPoint& pos, const QPoint& startPos, int keyState, int startKeyState ) + { + paint_object(); + if ( snapToGrid(pos,keyState) != snapToGrid(startPos,startKeyState) ) { + if ( dynamic_cast<KSWorkbook*>(m_view->workbook())->execute( new KSCmdAddCObject(m_new_object,m_view->activeCollection()) ) ) { + m_new_object->setBox( QSRectf( snapToGrid(pos,keyState), snapToGrid(startPos,startKeyState), false ), driver() ); + } + } else { + delete m_new_object; + } + m_new_object = NULL; + } + +//-------------------------------------------------------------// + +void QSToolArrow::paint_object() + { + QPainter p ( m_view->canvasWidget() ); + p.setRasterOp( Qt::NotXorROP ); + m_new_object->paint( &p, driver()->dpi ); + } + +//-------------------------------------------------------------// +//-------------------------------------------------------------// +//-------------------------------------------------------------// + +QSToolRect::QSToolRect( QObject *parent ) +:QSTool( parent ) + { + } + +//-------------------------------------------------------------// + +QSToolRect::~QSToolRect() + { + } + +//-------------------------------------------------------------// + +void QSToolRect::activate( QSPlotView *init_view ) + { + QSTool::activate( init_view ); + m_view->showUserMessage(tr("Rectangle/Ellipse tool." + "If the axis object is currently selected the " + "newly created rectangle will became its child object " + "and can be positioned relative to its parents position. ")); + m_view->canvasWidget()->setCursor( crossCursor ); + m_new_object = NULL; + } + +//-------------------------------------------------------------// + +void QSToolRect::deactivate() + { + delete m_new_object; m_new_object = NULL; + QSTool::deactivate(); + } + +//-------------------------------------------------------------// + +void QSToolRect::draw() + { + } + +//-------------------------------------------------------------// + +bool QSToolRect::canvasDragStart( const QPoint& pos, int keyState ) + { + m_new_object = new QSCRect(); + m_new_object->setBox( QSRectf(snapToGrid(pos,keyState),QSPt2f()), driver() ); + paint_object(); + return true; + } + +//-------------------------------------------------------------// + +void QSToolRect::canvasDragMove( const QPoint& pos, const QPoint&, const QPoint& startPos, int keyState, int, int startKeyState ) + { + paint_object(); + m_new_object->setBox( QSRectf(snapToGrid(pos,keyState),snapToGrid(startPos,startKeyState),false), driver() ); + paint_object(); + } + +//-------------------------------------------------------------// + +void QSToolRect::canvasDragEnd( const QPoint& pos, const QPoint& startPos, int keyState, int startKeyState ) + { + paint_object(); + if ( snapToGrid(pos,keyState) != snapToGrid(startPos,startKeyState) ) { + if ( dynamic_cast<KSWorkbook*>(m_view->workbook())->execute( new KSCmdAddCObject(m_new_object,m_view->activeCollection()) ) ) { + m_new_object->setBox( QSRectf(snapToGrid(pos,keyState),snapToGrid(startPos,startKeyState),false), driver() ); + } + } else { + delete m_new_object; + } + m_new_object = NULL; + } + +//-------------------------------------------------------------// + +void QSToolRect::paint_object() + { + QPainter p ( m_view->canvasWidget() ); + p.setRasterOp( Qt::NotXorROP ); + if ( m_new_object ) m_new_object->paintSkeleton( &p, driver()->dpi ); + } + +//-------------------------------------------------------------// +//-------------------------------------------------------------// +//-------------------------------------------------------------// +//-------------------------------------------------------------// + + +QSToolLocate::QSToolLocate( QObject *parent ) +:QSTool( parent ) + { + m_info = QString(); + m_popup = NULL; + } + +//-------------------------------------------------------------// + +QSToolLocate::~QSToolLocate() + { + } + +//-------------------------------------------------------------// + +void QSToolLocate::activate( QSPlotView *init_view ) + { + QSTool::activate( init_view ); + m_view->showUserMessage(tr("Locate tool\n" + "Click on a datapoint inside the active axes..")); + draw(); + } + +//-------------------------------------------------------------// + +void QSToolLocate::deactivate() + { + draw_info( false ); + QSTool::deactivate(); + } + +//-------------------------------------------------------------// + +void QSToolLocate::draw() + { + m_info = QString(); + delete m_popup; m_popup = NULL; + } + +//-------------------------------------------------------------// + +void QSToolLocate::canvasMove( const QPoint& pos ) + { + if ( m_view->currentPage() && + m_view->activeAxes() && + m_view->activeAxes()->shadowObject()->box(driver()).contains(QSPt2f(pos.x(),pos.y())) && + m_view->currentPage()->objects()->find(m_view->activeAxes()->shadowObject()) >= 0 ) { + m_view->canvasWidget()->setCursor( pointingHandCursor ); + } else { + m_view->canvasWidget()->setCursor( arrowCursor ); + } + } + +//-------------------------------------------------------------// + +void QSToolLocate::canvasClicked( const QPoint& pos, int ) + { + draw_info( false ); + if ( m_view->activeAxes() ) { + QSPt2f p( pos.x(), pos.y() ); + if ( (m_info=m_view->activeAxes()->posInfo(p)) == QString::null ) m_info = QString("?"); + m_pos = QPoint( int(p.x+0.5), int(p.y+0.5) ); + draw_info(); + m_view->showUserMessage( m_info ); + } + } + +//-------------------------------------------------------------// + +void QSToolLocate::canvasRightButtonClicked( const QPoint&, int ) + { + } + +//-------------------------------------------------------------// + +void QSToolLocate::draw_info( bool show_popup ) + { + if ( m_popup ) { delete m_popup; m_popup = NULL; } + if ( m_info.isEmpty() || m_view->activeAxes()->state() != QSAxes::Waiting ) return; + + QWidget *canvas = m_view->canvasWidget(); + + QPainter p ( canvas ) ; + p.setRasterOp( Qt::NotXorROP ); + p.drawLine( 0, m_pos.y(), canvas->width()-1, m_pos.y() ); + p.drawLine( m_pos.x(), 0, m_pos.x(), canvas->height()-1 ); + p.end(); + + if ( show_popup ) { + m_popup = new QLabel( m_info, canvas, "locate", Qt::WStyle_Customize | Qt::WType_Popup ); + m_popup->setFrameStyle( QFrame::Panel | QFrame::Raised ); + m_popup->setCursor( pointingHandCursor ); + m_popup->move( canvas->mapToGlobal(QPoint(m_pos.x()+20,m_pos.y()+20)) ); + m_popup->show(); + } + } + + + + + + + + diff --git a/kmatplot/qsctools.h b/kmatplot/qsctools.h new file mode 100644 index 0000000..f30eb86 --- /dev/null +++ b/kmatplot/qsctools.h @@ -0,0 +1,210 @@ +/*************************************************************************** + qsctools.h + ------------------- + begin : Sun Jan 30 2000 + copyright : (C) 2000 by Kamil Dobkowski + email : kamildbk@friko.onet.pl + ***************************************************************************/ + +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + +#ifndef QSCANVASSTDTOOLS_H +#define QSCANVASSTDTOOLS_H + +#include"widgets/qscoord.h" +#include"widgets/qsctool.h" +#include<qptrlist.h> + +class QLabel; +class QSDrvQt; +class QSCLabel; +class QSCArrow; +class QSCRect; +class QSCObject; +class QSAxes; + +//-------------------------------------------------------------// + +class QSToolLabel : public QSTool + { + Q_OBJECT + public: + QSToolLabel( QObject *parent = NULL ); + virtual ~QSToolLabel(); + void activate( QSPlotView *parent ); + void deactivate(); + + protected: + void canvasClicked( const QPoint& pos, int ); + }; + + +//-------------------------------------------------------------// + +class KMatplotShell; +class KSCmdTransformCObjects; +class QSToolSelect : public QSTool + { + Q_OBJECT + public: + QSToolSelect( KMatplotShell *shell, QObject *parent = NULL ); + virtual ~QSToolSelect(); + void activate( QSPlotView *parent ); + void deactivate(); + void draw(); + + protected: + virtual void canvasMiddleButtonClicked( const QPoint& pos, int ); + virtual void canvasClicked( const QPoint& pos, int ); + virtual bool canvasDragStart( const QPoint& pos, int ); + virtual void canvasDragMove( const QPoint& pos, const QPoint& prevPos, const QPoint& startPos, int, int, int ); + virtual void canvasDragEnd( const QPoint& pos, const QPoint& startPos, int, int ); + virtual void canvasMove( const QPoint& pos ); + bool eventMousePress( QMouseEvent* e ); + + private slots: + void slot_selection_changed(); + + private: + enum State { StateNormal, StateRotate } m_state; + KMatplotShell *m_shell; + + KSCmdTransformCObjects *m_transform_cmd; + void create_transform_cmd(); + void move_selected_by( const QPoint& mouseShift, int keyState ); + + class Handle; + QPtrList<Handle> m_handles; + void make_new_handles(); + void show_handles(); + void hide_handles(); + void paint_handles(); + Handle *handle_at( const QPoint& pos ); + bool m_handles_visible; + Handle *m_drag_handle; + QSPt2f m_move_prev_d; + void drag_resize_handle_by( const QPoint& mouseShift, int keyState, Handle *handle ) ; + void drag_rotate_handle( const QPoint& startPos, const QPoint& currPos, int keyState, Handle *handle ) ; + + QSCObject *m_drag_object; + QSCObject *selected_at( const QPoint& pos ); + void paint_object( QSCObject* object ); + void paint_selected_objects(); + + void paint_frame( const QPoint& p1, const QPoint& p2 ); + int angle( const QSPt2f& rcenter, const QPoint& click_pos, const QPoint& mouse_pos ); + }; + +//-------------------------------------------------------------// + +class QSToolZoom : public QSTool + { + Q_OBJECT + public: + QSToolZoom( QObject *parent = NULL ); + ~QSToolZoom(); + void activate( QSPlotView *parent ); + void deactivate(); + void draw(); + + protected: + bool canvasDragStart( const QPoint& pos, int keyState ); + void canvasDragMove( const QPoint& pos, const QPoint& prevPos, const QPoint& startPos, int keyState, int, int ); + void canvasDragEnd( const QPoint& pos, const QPoint& startPos, int keyState, int ); + void canvasRightButtonClicked( const QPoint& pos, int keyState ); + void canvasDoubleClicked( const QPoint& pos, int keyState ); + void canvasMove( const QPoint& pos ); + + private: + QSAxes *m_active_axes; + QSPt3f p1; + QSPt3f p2; + bool erase_crossmark; + enum Plane { PlaneXY =0, PlaneXZ =1, PlaneYZ =2 } plane; + bool find_plane( const QPoint& canvas_pos ); + QSPt3f world_point( const QPoint& canvas_pos ); + void draw_frame(); + QString message( const QSPt3f& p ); + void draw_crossmark( const QSPt3f& pos ); + void zoom_out( const QPoint& click_pos ); + void zoom_in( const QSPt3f& p1, const QSPt3f& p2 ); + }; + +//-------------------------------------------------------------// + +class QSToolArrow : public QSTool + { + Q_OBJECT + public: + QSToolArrow( QObject *parent = NULL ); + ~QSToolArrow(); + void activate( QSPlotView *parent ); + void deactivate(); + void draw(); + + protected: + bool canvasDragStart( const QPoint& pos, int keyState ); + void canvasDragMove( const QPoint& pos, const QPoint& prevPos, const QPoint& startPos, int keyState, int, int ); + void canvasDragEnd( const QPoint& pos, const QPoint& startPos, int keyState, int ); + + private: + void paint_object(); + QSCArrow *m_new_object; + }; + +//-------------------------------------------------------------// + + +class QSToolRect : public QSTool + { + Q_OBJECT + public: + QSToolRect( QObject *parent = NULL ); + ~QSToolRect(); + void activate( QSPlotView *parent ); + void deactivate(); + void draw(); + + protected: + bool canvasDragStart( const QPoint& pos, int ); + void canvasDragMove( const QPoint& pos, const QPoint& prevPos, const QPoint& startPos, int, int, int ); + void canvasDragEnd( const QPoint& pos, const QPoint& startPos, int, int ); + + private: + void paint_object(); + QSCRect *m_new_object; + }; + +//-------------------------------------------------------------// + +class QSToolLocate : public QSTool + { + Q_OBJECT + public: + QSToolLocate( QObject *parent = NULL ); + ~QSToolLocate(); + void activate( QSPlotView *parent ); + void deactivate(); + void draw(); + + protected: + void canvasClicked( const QPoint& pos, int ); + void canvasMove( const QPoint& pos ); + void canvasRightButtonClicked( const QPoint& pos, int ); + private: + QLabel *m_popup; + QString m_info; + QPoint m_pos; + QSRectf m_locate_area; + void draw_info( bool show_popup = true ); + }; + +#endif + diff --git a/kmatplot/scilab/Makefile.am b/kmatplot/scilab/Makefile.am new file mode 100644 index 0000000..afee4eb --- /dev/null +++ b/kmatplot/scilab/Makefile.am @@ -0,0 +1,12 @@ +if MAKE_SCILAB +noinst_SCRIPTS = plots.o +else +noinst_SCRIPTS = +endif + +plots.o: plots.c ../interface/common.c ../interface/common.h ../interface/etype.h ../interface/msg.h + $(CC) $(CFLAGS) -I$(libscidir) -O -c plots.c -o plots.o + +CLEANFILES = plots.o +EXTRA_DIST = README.Scilab plots.c plots.sci kplot.sci kmesh.sci kimage.sci kcontour.sci + diff --git a/kmatplot/scilab/README.Scilab b/kmatplot/scilab/README.Scilab new file mode 100644 index 0000000..1ac2616 --- /dev/null +++ b/kmatplot/scilab/README.Scilab @@ -0,0 +1,68 @@ +Scilab interface. +Run Scilab from this directory and type: +exec('plots.sci'); +to load all functions into Scilab. + +Functions defined in plots.o: + +ksetapp Sets the active plot application. + See View->I/O info ... to find out a number of a running app. + + Usage: + ksetapp(app_number) + curr_app_number = ksetapp(0) + + +ksetaxes Sets the active axes in a plot app. ( see menu View->I/O info... ) + + Usage: + ksetaxes(axes_number) + curr_axes_number = ksetaxes(0) + +kaddaxes Adds a new axes object and makes it the current one. + 0 - 2D axes + 1 - 3D axes + + Usage: + axes_number = kaddaxes(axes_number) + +kadd Adds a new dataset to the current axes. + Types are: + 0 - curve, + 1 - image, + 2 - surface, + 3 - figure. + + Usage: + dataset_number = kadd(dataset_type) + + +kremove Removes a dataset from the current axes + + Usage: + kremove(dataset_number) + + +kremoveall Removes all datasets from the current axes + + Usage: + kremoveall() + + +ksetmatrix Sets a matrix as a plot channel. + See File/Import Data to see descriptions of channels. + + Usage: + ksetmatrix(dataset_number,channel_number,matrix) + + + + +Functions defined in *.sci files: + +kplot +kimage +kcontour +kmesh + +Examine sources for a short description of usage. Rememer to add axes before creating plots. \ No newline at end of file diff --git a/kmatplot/scilab/kcontour.sci b/kmatplot/scilab/kcontour.sci new file mode 100644 index 0000000..5d66c4b --- /dev/null +++ b/kmatplot/scilab/kcontour.sci @@ -0,0 +1,28 @@ +function [result]=kcontour(x,y,z) +// +// kcontour(z) - plots contour +// kcontour(x,y,z) - plots contour versus x,y rows. x,y must be monotone +// +result=1 +[out in]=argn(0) +if in==1 then +// kremoveall(); + dataset = kadd(2); + ksetmatrix(dataset,2,x); // z +elseif in==3 then + kremoveall(); + dataset = kadd(2); + if size(x,2) <> size(z,2) then, x=x', end + if size(y,1) <> size(z,1) then, y=y', end + + if size(x,2) <> size(z,2) then, error("length(x) must be equal to cols(z) !"); result=0, end + if size(y,1) <> size(z,1) then, error("length(y) must be equal to rows(z) !"); result=0, end + + ksetmatrix(dataset,0,x); // x + ksetmatrix(dataset,1,y); // y + ksetmatrix(dataset,2,z); // z +else + result = 0; + error("Wrong number of arguments !"); +end +end \ No newline at end of file diff --git a/kmatplot/scilab/kimage.sci b/kmatplot/scilab/kimage.sci new file mode 100644 index 0000000..d9bcc30 --- /dev/null +++ b/kmatplot/scilab/kimage.sci @@ -0,0 +1,41 @@ +function [result]=kimage(x,y,r,g,b) +// +// image(gray) - plots matrix gray +// image(x,y,gray) - plots matrix gray versus vectors x and y. +// length(x) = cols(gray)+1, length(y) = rows(gray)+1 +// x and y must be monotone +// image(r,g,b) - plots rgb matrices. +// image(x,y,r,g,b) - plots rgb matrices versus x,y vectors. + +result=1; +[out, in]=argn(0); +// kremoveall(); +dataset = kadd(1); // function defined in plots.o +if in==1 then + ksetmatrix(dataset,2,x); // gray +elseif in==5 then + ksetmatrix(dataset,0,x); // x + ksetmatrix(dataset,1,y); // y + ksetmatrix(dataset,2,r); // r + ksetmatrix(dataset,3,g); // g + ksetmatrix(dataset,4,b); // b +elseif in==3 then + if size(x)==size(y) & size(y)==size(r) then + ksetmatrix(dataset,2,x); // r + ksetmatrix(dataset,3,y); // g + ksetmatrix(dataset,4,r); // b + else + if size(x,2) <> size(r,2)+1 then, x=x', end + if size(y,1) <> size(r,1)+1 then, y=y', end + + if size(x,2) <> size(r,2)+1 then, error("length(x) must be equal to cols(gray)+1 !"); result=0, end + if size(y,1) <> size(r,1)+1 then, error("length(y) must be equal to rows(gray)+1 !"); result=0, end + ksetmatrix(dataset,0,x); // x + ksetmatrix(dataset,1,y); // y + ksetmatrix(dataset,2,r); // gray + end +else + error("Wrong number of arguments !"); + result = 0; +end +end \ No newline at end of file diff --git a/kmatplot/scilab/kmesh.sci b/kmatplot/scilab/kmesh.sci new file mode 100644 index 0000000..54ff872 --- /dev/null +++ b/kmatplot/scilab/kmesh.sci @@ -0,0 +1,46 @@ +function [result]=kmesh(x,y,z) +// +// mesh(z) - plots z-surface +// mesh(x,y,z) - plots z surface versus x,y rows. x,y must be monotone +// mesh(facets_x,facets_y,facets_z) - plots figure +// +// all matrices have the same size +// rows(facets_*) = number of vertices in a single facet ( 3d polygon ) +// cols(facets_*) = number of facets ( 3d polygons ) +// if rows(facets_*) == 1 plots a 3d trajectory +// facets_x = x coordinates, facets_y = y coordinates, facets_z = z coordinates +// +result=1 +[out in]=argn(0) +if in==1 then +// surface +// kremoveall(); + dataset = kadd(3); + ksetmatrix(dataset,2,x); // z +elseif in==3 then + if size(x)==size(y) & size(y)==size(z) then + // kremoveall(); + dataset = kadd(4); + // 3d figure + ksetmatrix(dataset,0,x); // facets x + ksetmatrix(dataset,1,y); // facets y + ksetmatrix(dataset,2,z); // facets z + else + // surface + // kremoveall(); + dataset = kadd(3); + if size(x,2) <> size(z,2) then, x=x', end + if size(y,1) <> size(z,1) then, y=y', end + + if size(x,2) <> size(z,2) then, error("length(x) must be equal to cols(z) !"); result=0, end + if size(y,1) <> size(z,1) then, error("length(y) must be equal to rows(z) !"); result=0, end + + ksetmatrix(dataset,0,x); // x + ksetmatrix(dataset,1,y); // y + ksetmatrix(dataset,2,z); // z + end +else + result = 0; + error("Wrong number of arguments !"); +end +end \ No newline at end of file diff --git a/kmatplot/scilab/kplot.sci b/kmatplot/scilab/kplot.sci new file mode 100644 index 0000000..b33796e --- /dev/null +++ b/kmatplot/scilab/kplot.sci @@ -0,0 +1,31 @@ +function [result]=kplot(x,y) +// +// plot(x,y) - plots rows y versus rows x, or rows y versus vector x +// plot(x) - simply rows x +// +[out, in]=argn(0) +// kremoveall(); +if in==1 then + [xrows xcols] = size(x); + for k=1:xrows + dataset = kadd(0); + ksetmatrix(dataset,1,x(k,:)'); // simply rows x, k-1 is used instead of dataset + end + result = 1; +elseif in==2 then + [xrows xcols] = size(x); + [yrows ycols] = size(y); + for k=1:yrows + dataset = kadd(0); + if k<=xrows then + ksetmatrix(dataset,0,x(k,:)') // rows x + else + ksetmatrix(dataset,0,x(1,:)') // single vector x for all y rows + end + ksetmatrix(dataset,1,y(k,:)'); // versus rows y, k-1 is used instead of dataset + end + result = 1; +else + error("Wrong number of arguments !"); + result = 0; +end diff --git a/kmatplot/scilab/plots.c b/kmatplot/scilab/plots.c new file mode 100644 index 0000000..f6bf04d --- /dev/null +++ b/kmatplot/scilab/plots.c @@ -0,0 +1,375 @@ + +#include <routines/stack-c.h> +#include"../interface/common.c" + +#define ENV_APP_NUMBER "__kmatplot_app_num__" +#define ENV_AXES_NUMBER "__kmatplot_axes_num__" + +/*--------------------------------------------------------------------*/ + +int appNumber() + { + int app_num = 0; + char *app_num_str = getenv( ENV_APP_NUMBER ); + if ( app_num_str ) app_num = atoi( app_num_str ); + if ( app_num <= 0 ) app_num = 1; + return app_num; + } + +/*--------------------------------------------------------------------*/ + +int axesNumber() + { + int axes_num = 0; + char *axes_num_str = getenv( ENV_AXES_NUMBER ); + if ( axes_num_str ) axes_num = atoi( axes_num_str ); + if ( axes_num <= 0 ) axes_num = 1; + return axes_num; + } + +/*--------------------------------------------------------------------*/ + +void setMatrix( int socket_fd, int dataset, int channel, int rows, int cols, double *data ) + { + plot_set_channel( socket_fd, axesNumber(), dataset, channel, + EDouble, rows, cols, + data, 0, rows*sizeof(double), sizeof(double) ); + } + +/*--------------------------------------------------------------------*/ + +void setAxes( int new_axes_number ) + { + char buff[50]; + if ( new_axes_number <= 0 ) new_axes_number = 1; + sprintf( buff, "%d", new_axes_number ); + setenv( ENV_AXES_NUMBER, buff, 1 ); + } + +/*---------------------------------------------------------------*/ +/*---------------------------------------------------------------*/ +/*---------------------------------------------------------------*/ + +int ksetapp(char *fname) +/* +// Sets a new app number and returns a previous app number. +// If you don't want to change the current app number write: +// current_app = ksetapp(0); // if app is < 1 it won't be changed. +*/ +{ + int m; + int rows; + int cols; + int prev_app; + int curr_app; + + CheckRhs(1,1); + CheckLhs(1,1); + GetRhsVar( 1, "i", &rows, &cols, &m ); + + prev_app = appNumber(); + curr_app = *istk(m); + if ( curr_app > 0 ) { + char buff[50]; + sprintf( buff, "%d", curr_app ); + setenv( ENV_APP_NUMBER, buff, 1 ); + } + + rows = 1; cols = 1; + CreateVar( 2, "i", &rows, &cols, &m ); *istk(m) = prev_app; + LhsVar(1) = 2; + PutLhsVar(); + return(0); +} + +/*---------------------------------------------------------------*/ + +int ksetaxes(char *fname) +{ + int m; + int rows; + int cols; + int prev_plot; + int curr_plot; + + CheckRhs(1,1); + CheckLhs(1,1); + GetRhsVar( 1, "i", &rows, &cols, &m ); + + prev_plot = axesNumber(); + curr_plot = *istk(m); + if ( curr_plot > 0 ) setAxes( curr_plot ); + + rows = 1; cols = 1; + CreateVar( 2, "i", &rows, &cols, &m ); *istk(m) = prev_plot; + LhsVar(1) = 2; + PutLhsVar(); + return(0); +} + +/*---------------------------------------------------------------*/ + +int kadd(char *fname) +/* +// Adds a new dataset +// 0 - curve +// 1 - image +// 2 - surface +// 3 - figure +*/ +{ + int m; + int rows; + int cols; + int type; + int dataset_number = -1; + + CheckRhs(1,1); + CheckLhs(1,1); + GetRhsVar(1,"i",&rows,&cols,&m); + + type = *istk(m); + if ( type < 0 || type > 3 ) { + sciprint("Type must be 0, 1, 2, 3 ."); Error(999); + return 0; + } else { + int socket_fd = plot_connect( appNumber(), NULL, NULL ); + if ( socket_fd == -1 && errno >= 0 ) { + sciprint( "Error: %s", strerror(errno) ); + return 0; + } + + dataset_number = plot_add_dataset( socket_fd, axesNumber(), (PlotType )type ); + plot_disconnect( socket_fd ); + } + + rows = 1; cols = 1; + CreateVar( 2, "i", &rows, &cols, &m ); *istk(m) = dataset_number; + LhsVar(1) = 2; + PutLhsVar(); + return(0); + } +/*---------------------------------------------------------------*/ + +int kaddaxes(char *fname) +{ + int m; + int rows; + int cols; + int type; + int axes_number = -1; + + CheckRhs(1,1); + CheckLhs(1,1); + GetRhsVar(1,"i",&rows,&cols,&m); + + type = *istk(m); + if ( type < 0 || type > 1 ) { + sciprint("Type must be 0 for 2d axes or 1 for 3d axes."); Error(999); + return 0; + } else { + int socket_fd = plot_connect( appNumber(), NULL, NULL ); + if ( socket_fd == -1 && errno >= 0 ) { + sciprint( "Error: %s", strerror(errno) ); + return 0; + } + + axes_number = plot_add_axes( socket_fd, type ); + if ( axes_number > 0 ) setAxes( axes_number ); + plot_disconnect( socket_fd ); + } + + rows = 1; cols = 1; + CreateVar( 2, "i", &rows, &cols, &m ); *istk(m) = axes_number; + LhsVar(1) = 2; + PutLhsVar(); + return(0); + } + +/*---------------------------------------------------------------*/ + +int kremoveaxes(char *fname) +/* +// Removes axes: +// axes_id - axes id +*/ +{ + int m; + int rows; + int cols; + int axes_number = -1; + + CheckRhs(1,1); + CheckLhs(1,1); + GetRhsVar(1,"i",&rows,&cols,&m); + + axes_number = *istk(m); + if ( axes_number < 0 ) { + sciprint("Wrong axes id"); Error(999); + return 0; + } else { + int socket_fd = plot_connect( appNumber(), NULL, NULL ); + if ( socket_fd == -1 && errno >= 0 ) { + sciprint( "Error: %s", strerror(errno) ); + return 0; + } + + plot_remove_axes( socket_fd, axes_number ); + plot_disconnect( socket_fd ); + } + + rows = 1; cols = 1; + CreateVar( 2, "i", &rows, &cols, &m ); *istk(m) = 1; + LhsVar(1) = 2; + PutLhsVar(); + return(0); + } + +/*---------------------------------------------------------------*/ + +int kremove(char *fname) +/* +// Removes dataset: +// dataset_number - dataset number +*/ +{ + int m; + int rows; + int cols; + int dataset_number = -1; + + CheckRhs(1,1); + CheckLhs(1,1); + GetRhsVar(1,"i",&rows,&cols,&m); + + dataset_number = *istk(m); + if ( dataset_number < 0 ) { + sciprint("Wrong dataset number"); Error(999); + return 0; + } else { + int socket_fd = plot_connect( appNumber(), NULL, NULL ); + if ( socket_fd == -1 && errno >= 0 ) { + sciprint( "Error: %s", strerror(errno) ); + return 0; + } + + plot_remove_dataset( socket_fd, axesNumber(), dataset_number ); + plot_disconnect( socket_fd ); + } + + rows = 1; cols = 1; + CreateVar( 2, "i", &rows, &cols, &m ); *istk(m) = 1; + LhsVar(1) = 2; + PutLhsVar(); + return(0); + } + +/*---------------------------------------------------------------*/ + +int kremoveall(char *fname) +/* +// Removes all datasets: +// no arguments +*/ +{ + int m; + int rows; + int cols; + int socket_fd; + + CheckRhs(0,0); + CheckLhs(1,1); + /*GetRhsVar(1,"i",&rows,&cols,&m);*/ + + socket_fd = plot_connect( appNumber(), NULL, NULL ); + if ( socket_fd == -1 && errno >= 0 ) { + sciprint( "Error: %s", strerror(errno) ); + return 0; + } + + plot_remove_all_datasets( socket_fd, axesNumber() ); + plot_disconnect( socket_fd ); + + rows = 1; cols = 1; + CreateVar( 1, "i", &rows, &cols, &m ); *istk(m) = 1; + LhsVar(1) = 1; + PutLhsVar(); + return(0); + } + +/*---------------------------------------------------------------*/ + +int ksetmatrix(char *fname) +/* +// Set channel data. +// ksetmatrix( dataset, channel_number, matrix ); +*/ + { + int m; + int rows; + int cols; + int chan; + int dataset_number; + int socket_fd; + + CheckRhs(3,3); + CheckLhs(1,1); + + GetRhsVar(1,"i",&rows,&cols,&m); + dataset_number = *istk(m); + if ( dataset_number < 0 ) { + sciprint("Wrong dataset number !"); Error(999); + return 0; + } + + GetRhsVar(2,"i",&rows,&cols,&m); + chan = *istk(m); + if ( chan < 0 ) { + sciprint("Wrong channel number !"); Error(999); + return 0; + } + + GetRhsVar(3,"d",&rows,&cols,&m); + socket_fd = plot_connect( appNumber(), NULL, NULL ); + if ( socket_fd == -1 && errno >= 0 ) { + sciprint( "Error: %s", strerror(errno) ); + return 0; + } + + setMatrix( socket_fd, dataset_number, chan, rows, cols, stk(m) ); + plot_disconnect( socket_fd ); + + rows = 1; cols = 1; + CreateVar( 4, "i", &rows, &cols, &m ); *istk(m) = 1; + LhsVar(1) = 4; + PutLhsVar(); + return(0); + } + +/*---------------------------------------------------------------*/ + +static TabF Tab[]={ + {ksetapp, "ksetapp"}, + {ksetaxes, "ksetaxes"}, + {kaddaxes, "kaddaxes"}, + {kremoveaxes,"kremoveaxes"}, + {kadd, "kadd"}, + {kremove, "kremove" }, + {ksetmatrix, "ksetmatrix"}, + {kremoveall, "kremoveall"} + +}; + + +int C2F(plots)() +{ + Rhs = Max(0, Rhs); + (*(Tab[Fin-1].f))(Tab[Fin-1].name); + return 0; +} + + +/*---------------------------------------------------------------*/ + + + diff --git a/kmatplot/scilab/plots.sci b/kmatplot/scilab/plots.sci new file mode 100644 index 0000000..33a0103 --- /dev/null +++ b/kmatplot/scilab/plots.sci @@ -0,0 +1,8 @@ +// KMatplot interface +// it seems that the last fuction is not linked ?? +addinter('plots.o', 'plots', ['ksetapp', 'ksetaxes', 'kaddaxes', 'kremoveaxes', 'kadd', 'kremove', 'ksetmatrix', 'kremoveall' ]); +getf('kplot.sci'); +getf('kmesh.sci'); +getf('kimage.sci'); +getf('kcontour.sci'); + diff --git a/kmatplot/widgets/Makefile.am b/kmatplot/widgets/Makefile.am new file mode 100644 index 0000000..f62b71a --- /dev/null +++ b/kmatplot/widgets/Makefile.am @@ -0,0 +1,69 @@ +INCLUDES = $(all_includes) + +KDE_OPTIONS = qtonly +noinst_LIBRARIES = libplot.a +libplot_a_METASOURCES = AUTO +libplot_a_SOURCES = qsconsole.cpp \ + qsserializable.cpp \ + qscoord.cpp \ + qsgattr.cpp \ + qsmatrix.cpp \ + qsdata.cpp \ + qsruler.cpp \ + qsgraphicaldata.cpp \ + qsaxes.cpp \ + qsaxis.cpp \ + qsaxes2d.cpp \ + qsaxes3d.cpp \ + qsplot.cpp \ + qsprojection.cpp \ + qsprojection2d.cpp \ + qsprojection3d.cpp \ + qsdrv.cpp \ + qsdrvqt.cpp \ + qsdrvhittest.cpp \ + qsdrvopengl.cpp \ + qssegment.cpp \ + qscurve.cpp \ + qscontour.cpp \ + qsimage.cpp \ + qsfigure.cpp \ + qssurface.cpp \ + qscobject.cpp \ + qsplotview.cpp \ + qsclegend.cpp \ + qsctool.cpp \ + qsworkbook.cpp + +EXTRA_DIST = qsconsole.h \ + qsserializable.h \ + qsdrvhittest.h \ + qsdata.h \ + qsruler.h \ + qsprojection.h \ + qsprojection2d.h \ + qsprojection3d.h \ + qsgraphicaldata.h \ + qsplotview.h \ + qscobject.h \ + qsctool.h \ + qscoord.h \ + qsdrv.h \ + qsdrvqt.h \ + qsdrvopengl.h \ + qsgattr.h \ + qsmatrix.h \ + qsplot.h \ + qsclegend.h \ + qssegment.h \ + qscurve.h \ + qssurface.h \ + qsfigure.h \ + qsimage.h \ + qscontour.h \ + qsaxes.h \ + qsaxis.h \ + qsaxes2d.h \ + qsaxes3d.h \ + qschildlist.h \ + qsworkbook.h diff --git a/kmatplot/widgets/qsaxes.cpp b/kmatplot/widgets/qsaxes.cpp new file mode 100644 index 0000000..d1d773b --- /dev/null +++ b/kmatplot/widgets/qsaxes.cpp @@ -0,0 +1,1092 @@ +/*************************************************************************** + qsaxes.cpp + ------------------- + begin : 01-January-2000 + + copyright : (C) 2000 by Kamil Dobkowski + email : kamildobk@poczta.onet.pl + ***************************************************************************/ + +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + +#include"qsaxes.h" +#include"qsaxis.h" +#include"qsplot.h" +#include"qschildlist.h" +#include<assert.h> +#include<math.h> +#include<algo.h> +#include<qregexp.h> +#include<qtimer.h> +#include<qpainter.h> + + + +struct QSAxes::qsaxes_private_data { + QSChildList<QSPlot> m_plots; + QSChildList<QSAxis> m_axes; + }; + +//-------------------------------------------------------------// + +QSCAxesShadow::QSCAxesShadow( QSAxes *parent ) +: QSCGroup(parent) { + m_parent_axes = parent; + connect( parent, SIGNAL(sigUpdate()), this, SLOT(slot_update()) ); + connect( objects(), SIGNAL(sigAdded(QSCObject*)), this, SLOT(slot_object_added(QSCObject*)) ); + connect( objects(), SIGNAL(sigRemoved(QSCObject*)), this, SLOT(slot_object_removed(QSCObject*)) ); + } + +//-------------------------------------------------------------// + +QSCAxesShadow::~QSCAxesShadow() { + // parent axes object deletes itself after QSAxesShadow has been deleted. + // see QSAxes::childEvent + } + +//-------------------------------------------------------------// + +void QSCAxesShadow::setAutoUpdates( bool enabled ) { + QSCObject::setAutoUpdates( enabled ); + m_parent_axes->setAutoUpdates( enabled ); + } + +//-------------------------------------------------------------// + +void QSCAxesShadow::forceUpdate() { + m_parent_axes->forceUpdate(); + } + +//-------------------------------------------------------------// + +void QSCAxesShadow::slot_update() { + QSCGroup::forceUpdate(); + } + +//-------------------------------------------------------------// + +void QSCAxesShadow::setParentAxes( QSAxes * ) { + // can't change parent axes + } + +//-------------------------------------------------------------// + +void QSCAxesShadow::setBox( const QSRectf& rect, QSDrv *drv ) { + QSRectf r = rect.normalize(); + m_parent_axes->setPosMM( QSPt2f( QSCoord::pixelsToMM(r.pos.x,drv->dpi), + QSCoord::pixelsToMM(r.pos.y,drv->dpi)) ); + m_parent_axes->setSizeMM( QSPt2f( QSCoord::pixelsToMM(r.size.x,drv->dpi), + QSCoord::pixelsToMM(r.size.y,drv->dpi)) ); + m_parent_axes->setCanvasRect(m_parent_axes->calculateCanvasRect(drv->dpi)); + } + +//-------------------------------------------------------------// + +QSRectf QSCAxesShadow::box( QSDrv *drv ) { + return QSRectf( QSCoord::mmToPixels(m_parent_axes->posMM().x,drv->dpi), + QSCoord::mmToPixels(m_parent_axes->posMM().y,drv->dpi), + QSCoord::mmToPixels(m_parent_axes->sizeMM().x,drv->dpi), + QSCoord::mmToPixels(m_parent_axes->sizeMM().y,drv->dpi) ); + } + +//-------------------------------------------------------------// + +bool QSCAxesShadow::isHit( const QSPt2f &p, QSDrv* drv ) + { + return box(drv).contains(p) || m_objects->objectAt(p,drv,true); + } + +//-------------------------------------------------------------// + +bool QSCAxesShadow::isAxesShadow() { + return true; + } + +//-------------------------------------------------------------// + +int QSCAxesShadow::style() { + return Resizeable | Moveable; + } + +//-------------------------------------------------------------// + +QString QSCAxesShadow::name() { + return QString(tr("Axes: "))+m_parent_axes->title(); + } + +//-------------------------------------------------------------// + +void QSCAxesShadow::draw( QSDrv *drv, bool blocking, bool transparent ) { + connect( m_parent_axes, SIGNAL(sigDrawEnds()), this, SLOT(slot_draw_ends()) ); + connect( m_parent_axes, SIGNAL(sigUserDraw(QSDrv*,bool,bool)), this, SLOT(slot_draw_objects(QSDrv*,bool,bool)) ); + bool blocking_drawing = !m_parent_axes->drawInBackground() || blocking; + m_parent_axes->setCanvasRect(m_parent_axes->calculateCanvasRect(drv->dpi)); + m_parent_axes->drawPlot( drv, blocking_drawing, transparent ); + } + +//-------------------------------------------------------------// + +void QSCAxesShadow::paint( QPainter *p, double dpi, bool blocking, bool transparent ) { + connect( m_parent_axes, SIGNAL(sigDrawEnds()), this, SLOT(slot_draw_ends()) ); + connect( m_parent_axes, SIGNAL(sigUserDraw(QSDrv*,bool,bool)), this, SLOT(slot_draw_objects(QSDrv*,bool,bool)) ); + bool blocking_drawing = !m_parent_axes->drawInBackground() || blocking; + m_parent_axes->setCanvasRect(m_parent_axes->calculateCanvasRect(dpi)); + m_parent_axes->paintPlot( p, dpi, blocking_drawing, transparent ); + } + +//-------------------------------------------------------------// + +void QSCAxesShadow::slot_draw_objects( QSDrv *drv, bool blocking, bool transparent ) { + disconnect( m_parent_axes, SIGNAL(sigUserDraw(QSDrv*,bool,bool)), this, SLOT(slot_draw_objects(QSDrv*,bool,bool)) ); + m_objects->draw( drv, blocking, transparent ); + } + +//-------------------------------------------------------------// + +void QSCAxesShadow::paintSkeleton( QPainter *p, double dpi ) { + m_parent_axes->setCanvasRect(m_parent_axes->calculateCanvasRect(dpi)); + m_parent_axes->paintSkeleton(p,dpi,true); + m_objects->paintSkeleton(p,dpi); + } + +//-------------------------------------------------------------// + +void QSCAxesShadow::slot_draw_ends() { + disconnect( m_parent_axes, SIGNAL(sigDrawEnds()), this, SLOT(slot_draw_ends()) ); + emit sigDrawEnds( this ); + } + +//-------------------------------------------------------------// + +bool QSCAxesShadow::busy() const { + return ( m_parent_axes->state() == QSAxes::Busy ); + } + +//-------------------------------------------------------------// + +void QSCAxesShadow::stop() { + m_parent_axes->stop(); + } + + //-------------------------------------------------------------// + +void QSCAxesShadow::loadStateFromStream( QDataStream& stream, QSObjectFactory *factory ) { + QSCGroup::loadStateFromStream( stream, factory ); + parentAxes()->loadStateFromStream( stream, factory ); + } + +//-------------------------------------------------------------// + +void QSCAxesShadow::saveStateToStream( QDataStream& stream, QSObjectFactory *factory ) { + QSCGroup::saveStateToStream( stream, factory ); + parentAxes()->saveStateToStream( stream, factory ); + } + +//-------------------------------------------------------------// + +void QSCAxesShadow::slot_object_added( QSCObject *object ) +// we hope that this signal is received by this object before any other object which also connects +// to QSCObjectCollection::sigAdded will get this signal. So this other object will see a newly added object +// which has already parentAxes() property set. + { + object->setParentAxes( m_parent_axes ); + } + +//-------------------------------------------------------------// + +void QSCAxesShadow::slot_object_removed( QSCObject *object ) + { + object->setParentAxes( NULL ); + } + +//-------------------------------------------------------------// + +QSCAxesShadow *QSAxes::shadowObject() + { + if ( !m_shadow_object ) m_shadow_object = new QSCAxesShadow( this ); + return m_shadow_object; + } + +//-------------------------------------------------------------// + +void QSAxes::childEvent ( QChildEvent *e ) + { + if ( e->removed() && e->child() == shadowObject() ) delete this; + } + + +//-------------------------------------------------------------// +//-------------------------------------------------------------// +//-------------------------------------------------------------// +//-------------------------------------------------------------// +//-------------------------------------------------------------// +//-------------------------------------------------------------// + + +QSAxes::QSAxes(QObject* parent, const QSProjection *proj, const char* name ) +:QSGraphicalData(parent, NULL, name ) + { + m_internal_state = Waiting; + m_bkg_handler = true; + m_auto_updates = true; + m_is_complete = false; + m_axes_only = false; + m_really_fast = false; + m_delete_driver = false; + m_runtime_data_allocated = false; + m_shadow_object = NULL; + m_bckg_fill = QSGFill::transparentFill; + m_transformation_rect = false; + m_draw_in_background = true; + m_proj = proj; + + m_curr_dpi = 72.0; + m_cpos.set( 0.0, 0.0 ); + m_csize.set( 100.0, 100.0 ); + m_pos_mm.set( 20.0, 20.0 ); + m_size_mm.set( 100.0, 100.0 ); + + m_m.l = 0; + m_m.r = 0; + m_m.t = 0; + m_m.b = 0; + + d = new qsaxes_private_data(); + + m_timer = new QTimer( this ); + connect( m_timer, SIGNAL(timeout()), this, SLOT(work_proc()) ); + + // default axes + axisAdd( new QSAxis( QSAxis::XAxisType, this ) ); + axisAdd( new QSAxis( QSAxis::YAxisType, this ) ); + axisAdd( new QSAxis( QSAxis::ZAxisType, this ) ); + axisAdd( new QSAxis( QSAxis::VAxisType, this ) ); + + } + +//-------------------------------------------------------------// + +QSAxes::~QSAxes() + { + stop(); + delete d; + } + +//-------------------------------------------------------------// +//-------------------------------------------------------------// +//-------------------------------------------------------------// +// Graphics attributes + +void QSAxes::setPosMM( const QSPt2f& new_pos_mm ) + { + SET_PROPERTY( m_pos_mm, new_pos_mm ); + } + +//-------------------------------------------------------------// + +void QSAxes::setXPosMM( double x_mm ) + { + SET_PROPERTY( m_pos_mm.x, x_mm ); + } + +//-------------------------------------------------------------// + +void QSAxes::setYPosMM( double y_mm ) + { + SET_PROPERTY( m_pos_mm.y, y_mm ); + } + +//-------------------------------------------------------------// + +void QSAxes::setSizeMM( const QSPt2f& new_size_mm ) + { + SET_PROPERTY( m_size_mm, new_size_mm ); + } + +//-------------------------------------------------------------// + +void QSAxes::setWidthMM( double w_mm ) + { + SET_PROPERTY( m_size_mm.x, w_mm ); + } + +//-------------------------------------------------------------// + +void QSAxes::setHeightMM( double h_mm ) + { + SET_PROPERTY( m_size_mm.y, h_mm ); + } + +//-------------------------------------------------------------// + +void QSAxes::setDrawInBackground( bool enabled ) + { + SET_PROPERTY( m_draw_in_background, enabled ); + } + +//-------------------------------------------------------------// + +void QSAxes::setAxesOnly( bool enabled ) + { + SET_PROPERTY( m_axes_only, enabled ); + } + +//-------------------------------------------------------------// + +void QSAxes::setBackground( const QSGFill& fill ) + { + SET_PROPERTY( m_bckg_fill, fill ); + } + +//-------------------------------------------------------------// + +QSGFill QSAxes::background() const + { + return m_transparent ? m_bckg_fill : QSGFill(); + } + +//-------------------------------------------------------------// + +void QSAxes::set_background_property( const QString& value ) + { + setBackground( toQSGFill(value) ); + } + +//-------------------------------------------------------------// + +QString QSAxes::background_property() const + { + return toQString(background()); + } + +//-------------------------------------------------------------// + +void QSAxes::setAutoUpdates( bool enabled ) + { + m_auto_updates = enabled; + } + + +//-------------------------------------------------------------// +//-------------------------------------------------------------// +//-------------------------------------------------------------// +//-------------------------------------------------------------// +//-------------------------------------------------------------// +//-------------------------------------------------------------// + +double QSAxes::canvasToNormalizedX( double value ) const + { + return m_csize.x>0.0 ? ((value-m_cpos.x)/m_csize.x) : 0.0; + } + +//-------------------------------------------------------------// + +double QSAxes::canvasToNormalizedY( double value ) const + { + return m_csize.y>0.0 ? ((value-m_cpos.y)/m_csize.y) : 0.0; + } + +//-------------------------------------------------------------// + +QSPt2f QSAxes::canvasToNormalized( const QSPt2f& pos ) const + { + return QSPt2f( m_csize.x>0.0 ? ((pos.x-m_cpos.x)/m_csize.x) : 0.0, + m_csize.y>0.0 ? ((pos.y-m_cpos.y)/m_csize.y) : 0.0 ); + } + +//-------------------------------------------------------------// + +double QSAxes::normalizedXToCanvas( double x ) const + { + return m_cpos.x + x * m_csize.x; + } + +//-------------------------------------------------------------// + +double QSAxes::normalizedYToCanvas( double y ) const + { + return m_cpos.y + y * m_csize.y; + } + +//-------------------------------------------------------------// + +QSPt2f QSAxes::normalizedToCanvas( const QSPt2f& pos ) const + { + return QSPt2f( m_cpos.x + pos.x * m_csize.x, + m_cpos.y + pos.y * m_csize.y ); + } + +//-------------------------------------------------------------// +//-------------------------------------------------------------// + +QSPt2f QSAxes::dataToCanvas( const QSPt3f& pos, QSAxis *xAxis, QSAxis *yAxis, QSAxis *zAxis ) const + { + return m_proj->world3DToCanvas( QSPt3f( xAxis->dataToWorld( pos.x ), + yAxis->dataToWorld( pos.y ), + zAxis->dataToWorld( pos.z ) ) ); + } + +//-------------------------------------------------------------// + +QSPt2f QSAxes::dataToCanvas( const QSPt2f& pos, QSAxis *xAxis, QSAxis *yAxis ) const + { + return m_proj->world2DToCanvas( QSPt2f( xAxis->dataToWorld( pos.x ), + yAxis->dataToWorld( pos.y ) ) ); + } + + + + +//-------------------------------------------------------------// +//-------------------------------------------------------------// +//-------------------------------------------------------------// +//-------------------------------------------------------------// +// d->m_plots + +//-------------------------------------------------------------// + +int QSAxes::plotCount() const + { + return d->m_plots.count(); + } + +//-------------------------------------------------------------// + +void QSAxes::plotAdd( QSPlot *p ) + { + if ( p ) { + parametersChanging(); + d->m_plots.add( p ); + emit sigChildAdded( p ); + emit sigChildListChanged(); + parametersChanged(); + } + } + +//-------------------------------------------------------------// + +void QSAxes::plotInsert( int beforePos, QSPlot *p ) + { + if ( p ) { + parametersChanging(); + d->m_plots.insert( beforePos, p ); + emit sigChildAdded( p ); + emit sigChildListChanged(); + parametersChanged(); + } + } + +//-------------------------------------------------------------// + +void QSAxes::plotRemove( QSPlot *p ) +// not deleted +// signal emmited after removal !!!!!! + { + if ( p ) { + parametersChanging(); + if ( d->m_plots.remove(d->m_plots.find(p)) ) { + emit sigChildRemoved( p ); + emit sigChildListChanged(); + } + parametersChanged(); + } + } + +//-------------------------------------------------------------// + +void QSAxes::plotDelete( QSPlot *p ) + { + if ( p ) { + parametersChanging(); + if ( d->m_plots.remove(d->m_plots.find(p)) ) { + emit sigChildRemoved( p ); + emit sigChildListChanged(); + delete p; + } + parametersChanged(); + } + } + +//-------------------------------------------------------------// + +QSPlot *QSAxes::plot( int index ) const + { + return d->m_plots[index]; + } + +//-------------------------------------------------------------// + +int QSAxes::plotIndex( QSPlot *o ) const + { + return d->m_plots.find(o); + } + + +//-------------------------------------------------------------// + +void QSAxes::plotToFront( QSPlot *o ) + { + parametersChanging(); + d->m_plots.toFront( d->m_plots.find(o) ); + emit sigChildOrder(); + emit sigChildListChanged(); + parametersChanged(); + } + +//-------------------------------------------------------------// + +void QSAxes::plotToBack( QSPlot *o ) + { + parametersChanging(); + d->m_plots.toBack( d->m_plots.find(o) ); + emit sigChildOrder(); + emit sigChildListChanged(); + parametersChanged(); + } + +//-------------------------------------------------------------// + +void QSAxes::plotLower( QSPlot *o ) + { + parametersChanging(); + d->m_plots.lower( d->m_plots.find(o) ); + emit sigChildOrder(); + emit sigChildListChanged(); + parametersChanged(); + } + +//-------------------------------------------------------------// + +void QSAxes::plotRaise( QSPlot *o ) + { + parametersChanging(); + d->m_plots.raise( d->m_plots.find(o) ); + emit sigChildOrder(); + emit sigChildListChanged(); + parametersChanged(); + } + +//-------------------------------------------------------------// + +void QSAxes::plotReorder( int position, QSPlot *o ) + { + parametersChanging(); + d->m_plots.reorder( position, d->m_plots.find(o) ); + emit sigChildOrder(); + emit sigChildListChanged(); + parametersChanged(); + } + +//-------------------------------------------------------------// +//-------------------------------------------------------------// +//-------------------------------------------------------------// +//-------------------------------------------------------------// +//-------------------------------------------------------------// +//-------------------------------------------------------------// + +int QSAxes::axisCount() const + { + return d->m_axes.count(); + } + +//-------------------------------------------------------------// + +void QSAxes::axisAdd( QSAxis *p ) + { + if ( p ) { + parametersChanging(); + d->m_axes.add( p ); + emit sigChildAdded( p ); + emit sigChildListChanged(); + parametersChanged(); + } + } + +//-------------------------------------------------------------// + +void QSAxes::axisInsert( int beforePos, QSAxis *p ) + { + if ( p ) { + parametersChanging(); + d->m_axes.insert( beforePos, p ); + emit sigChildAdded( p ); + emit sigChildListChanged(); + parametersChanged(); + } + } + +//-------------------------------------------------------------// + +bool QSAxes::axisRemove( QSAxis *a ) +// not deleted +// signal emitted after removal !!!!! + { + if ( a ) { + // can't remove the last axis of the given type + int axes_count = 0; + for( int i=0; i<axisCount(); i++ ) if ( axis(i)->type() == a->type() ) axes_count++; + if ( axes_count < 2 && a->type() != QSAxis::UnknownAxisType ) return false; + + parametersChanging(); + if ( d->m_axes.remove(d->m_axes.find(a)) ) { + emit sigChildRemoved( a ); + emit sigChildListChanged(); + } + parametersChanged(); + return true; + } + return false; + } + +//-------------------------------------------------------------// + +bool QSAxes::axisDelete( QSAxis *a ) + { + if ( a ) { + // can't remove the last axis of the given type + int axes_count = 0; + for( int i=0; i<axisCount(); i++ ) if ( axis(i)->type() == a->type() ) axes_count++; + if ( axes_count < 2 ) return false; + + parametersChanging(); + if ( d->m_axes.remove(d->m_axes.find(a)) ) { + emit sigChildRemoved( a ); + emit sigChildListChanged(); + delete a; + } + parametersChanged(); + return true; + } + return false; + } + +//-------------------------------------------------------------// + +QSAxis *QSAxes::axis( int index ) const + { + return d->m_axes[index]; + } + +//-------------------------------------------------------------// + +int QSAxes::axisIndex( QSAxis *o ) const + { + return d->m_axes.find(o); + } + +//-------------------------------------------------------------// + +QSAxis *QSAxes::axisOfType( int type ) const + { + for ( int axis_nr=0; axis_nr<axisCount(); axis_nr++ ) + if ( axis(axis_nr)->type() == type ) return axis(axis_nr); + + return NULL; + } + +//-------------------------------------------------------------// + +void QSAxes::axisToFront( QSAxis *o ) + { + parametersChanging(); + d->m_axes.toFront( d->m_axes.find(o) ); + emit sigChildOrder(); + emit sigChildListChanged(); + parametersChanged(); + } + +//-------------------------------------------------------------// + +void QSAxes::axisToBack( QSAxis *o ) + { + parametersChanging(); + d->m_axes.toBack( d->m_axes.find(o) ); + emit sigChildOrder(); + emit sigChildListChanged(); + parametersChanged(); + } + +//-------------------------------------------------------------// + +void QSAxes::axisLower( QSAxis *o ) + { + parametersChanging(); + d->m_axes.lower( d->m_axes.find(o) ); + emit sigChildOrder(); + emit sigChildListChanged(); + parametersChanged(); + } + +//-------------------------------------------------------------// + +void QSAxes::axisRaise( QSAxis *o ) + { + parametersChanging(); + d->m_axes.raise( d->m_axes.find(o) ); + emit sigChildOrder(); + emit sigChildListChanged(); + parametersChanged(); + } + +//-------------------------------------------------------------// + +void QSAxes::axisReorder( int position, QSAxis *o ) + { + parametersChanging(); + d->m_axes.reorder( position, d->m_axes.find(o) ); + emit sigChildOrder(); + emit sigChildListChanged(); + parametersChanged(); + } + +//-------------------------------------------------------------// +//-------------------------------------------------------------// +//-------------------------------------------------------------// +//-------------------------------------------------------------// +//-------------------------------------------------------------// + +int QSAxes::childCount() const + { + return axisCount()+plotCount(); + } + +//-------------------------------------------------------------// + +QSData *QSAxes::child( int index ) const + { + return ( index < axisCount() ? (QSData *)axis(index) : (QSData *)plot(index-axisCount()) ); + } + +//-------------------------------------------------------------// +//-------------------------------------------------------------// +//-------------------------------------------------------------// +// Parameters/Data changing + +//-------------------------------------------------------------// + +void QSAxes::parametersChanging() + { + stop(); + QSGraphicalData::parametersChanging(); + } + +//-------------------------------------------------------------// + +void QSAxes::parametersChanged() + { + stop(); + if ( m_auto_updates ) emit sigUpdate(); + } + +//-------------------------------------------------------------// + +void QSAxes::dataChanging( QSData *object, int channel ) + { + stop(); + QSGraphicalData::dataChanging( object, channel ); + } + +//-------------------------------------------------------------// + +void QSAxes::dataChanged( QSData *object, int channel ) + { + stop(); + QSGraphicalData::dataChanged(object,channel); + if ( m_auto_updates ) emit sigUpdate(); + } + + + +//-------------------------------------------------------------// +//-------------------------------------------------------------// +//-------------------------------------------------------------// +// Redrawing + +//-------------------------------------------------------------// + +void QSAxes::start( QSDrv *init_drv, bool blocking, bool transparent ) + { + if ( m_internal_state == Busy ) stop(); + m_bkg_handler = !blocking && !m_axes_only; + if ( m_bkg_handler ) { + m_drv = init_drv->copy(); + m_delete_driver = true; + } else { + m_drv = init_drv; + m_delete_driver = false; + } + + m_curr_dpi = m_drv->dpi; + m_is_complete = false; + m_blocking = blocking; + m_transparent = transparent; + d->m_plots.setPos( 0 ); + + m_drv->setCurrentElement( GeneralCategory, 0 ); + m_internal_state = Busy; + allocRuntimeData(); + m_runtime_data_allocated = true; + calculate_auto_ranges(); + axisRangesCalculated(); + + // draw minor grid + if ( !m_really_fast ) + for( int axis=0; axis < d->m_axes.count(); axis++ ) { + m_drv->setCurrentElement( GridCategory, axis ); + drawGrid( d->m_axes[axis], false ); + } + + // draw major grid + if ( !m_really_fast ) + for( int axis=0; axis < d->m_axes.count(); axis++ ) { + m_drv->setCurrentElement( GridCategory, axis ); + drawGrid( d->m_axes[axis], true ); + } + + // draw axes + for( int axis=0; axis < d->m_axes.count(); axis++ ) { + m_drv->setCurrentElement( AxisCategory, axis ); + drawAxis( d->m_axes[axis] ); + } + + // start drawing datasets - see work_proc() for the rest. + m_curr_dataset_nr = 0; + m_drv->setClipping( true ); + if ( d->m_plots.isValidPos() && !m_axes_only ) { + m_drv->setCurrentElement( DatasetCategory, m_curr_dataset_nr++ ); + m_current_started = d->m_plots.current()->start(); + if ( m_bkg_handler ) m_timer->start( 0, FALSE ); + else while( d->m_plots.isValidPos() ) work_proc(); + } else { + d->m_plots.setPos( d->m_plots.count() ); // immediately move to the end + stop(); + } + } + + +//-------------------------------------------------------------// + +void QSAxes::work_proc() +// drawing datasets + { + if ( !m_current_started || !d->m_plots.current()->step() ) { + d->m_plots.current()->end(); + d->m_plots.setPos( d->m_plots.pos() + 1 ); + if ( d->m_plots.isValidPos() ) { + m_drv->setCurrentElement( DatasetCategory, m_curr_dataset_nr++ ); + m_current_started = d->m_plots.current()->start(); + } else { + stop(); + } + } + } + +//-------------------------------------------------------------// + +void QSAxes::stop() +// stop drawing now. +// Make sure that next drawing will start from beginnig. + { + if ( m_internal_state == Busy ) { + // not completed ! + if ( d->m_plots.isValidPos() ) { d->m_plots.current()->end(); } + emit sigUserDraw( m_drv, m_blocking, m_transparent ); + m_timer->stop(); + } + + d->m_plots.setPos( d->m_plots.count() ); + if ( m_runtime_data_allocated ) freeRuntimeData(); + m_runtime_data_allocated = false; + if ( m_delete_driver ) delete m_drv; + m_delete_driver = false; + m_drv = NULL; + + if ( m_internal_state == Busy ) { + m_internal_state = Waiting; + emit sigDrawEnds(); + } + } + + +//-------------------------------------------------------------// + +void QSAxes::calculate_auto_ranges() + { + // initialize axes + for ( int axis=0; axis<d->m_axes.count(); axis++ ) { + bool first_time = true; + bool is_data = false; + double data_min = 1.0; + double data_max = 1.0; + for ( int i=0; i<d->m_plots.count(); i++ ) { + double min = 0.0; + double max = 0.0; + if ( d->m_plots[i]->getAxisRange(d->m_axes[axis],min,max) ) { + is_data = true; + if ( first_time ) { + first_time = false; + data_min = min; + data_max = max; + } else { + data_min = QMIN( data_min, min ); + data_max = QMAX( data_max, max ); + } + } + } + + d->m_axes[axis]->initAxis( data_min, data_max, is_data ); + } + } + +//-------------------------------------------------------------// + +QString QSAxes::posInfo( QSPt2f& pos ) + { + QString result = QString::null; + for( int i=plotCount()-1; i>=0; i-- ) + if ( (result=plot(i)->posInfo(pos)) != QString::null ) { + result = tr(" You clicked at:\n\n Plot ") + QString::number(i) + QString(" : ") + plot(i)->title() + "\n\n" + result; + return result; + } + return result; + } + +//-------------------------------------------------------------// + +QSRectf QSAxes::calculateCanvasRect( double dpi ) + { + return QSRectf( QSCoord::mmToPixels(posMM().x,dpi), + QSCoord::mmToPixels(posMM().y,dpi), + QSCoord::mmToPixels(sizeMM().x,dpi), + QSCoord::mmToPixels(sizeMM().y,dpi) ); + } + + +//-------------------------------------------------------------// + +void QSAxes::paintSkeleton( QPainter *p, double dpi, bool reallyFast ) + { + m_really_fast = reallyFast; + bool m_prev_axes_only = m_axes_only; + m_axes_only = true; + paintPlot(p,dpi,true,true); + m_axes_only = m_prev_axes_only; + m_really_fast = false; + } + +//-------------------------------------------------------------// + +void QSAxes::initMappings( QSDrv *init_drv ) + { + if ( !state() ) { + calculate_auto_ranges(); + m_drv = init_drv; + m_curr_dpi = m_drv->dpi; + } + } + +//-------------------------------------------------------------// + +void QSAxes::setCanvasRect( const QSRectf& r ) + { + m_cpos.x = r.pos.x; + m_cpos.y = r.pos.y; + m_csize.x = r.size.x; + m_csize.y = r.size.y; + } + +//-------------------------------------------------------------// + +void QSAxes::setFitToCanvasRect( bool enabled ) + { + m_transformation_rect = enabled; + } + +//-------------------------------------------------------------// + +void QSAxes::rememberCurrentView( int index ) + { + if ( index >=0 && index < 3 ) + for( int i=0; i<axisCount(); i++ ) axis(i)->rememberCurrentView( index ); + } + +//-------------------------------------------------------------// + +void QSAxes::setRememberedView( int index ) + { + if ( index >=0 && index < 3 ) + for( int i=0; i<axisCount(); i++ ) axis(i)->setRememberedView( index ); + } + +//-------------------------------------------------------------// + +void QSAxes::loadStateFromStream( QDataStream& stream, QSObjectFactory *factory ) + { + QSGraphicalData::loadStateFromStream( stream, factory ); + + // load all axes + int axes_to_delete = axisCount(); + int axis_count; stream >> axis_count; + for( int i=0; i<axis_count; i++ ) { + QSAxis *new_axis = dynamic_cast<QSAxis*>(factory->loadObjectFromStream(stream,this)); + assert( new_axis ); axisAdd( new_axis ); + } + for( int i=0; i<axes_to_delete; i++ ) { + axisDelete( axis(0) ); + } + + // load datasets + for( int i=0; i<plotCount(); i++ ) { + plotDelete( plot(i) ); + } + int plot_count; stream >> plot_count; + for( int i=0; i<plot_count; i++ ) { + QSPlot *new_plot = dynamic_cast<QSPlot*>(factory->loadObjectFromStream(stream,this)); + assert( new_plot ); plotAdd( new_plot ); + } + } + +//-------------------------------------------------------------// + +void QSAxes::saveStateToStream( QDataStream& stream, QSObjectFactory *factory ) + { + QSGraphicalData::saveStateToStream( stream, factory ); + // save all axes + stream << (int)axisCount(); + for( int i=0; i<axisCount(); i++ ) { + factory->saveObjectToStream( axis(i), stream ); + } + // save all datasets + stream << (int)plotCount(); + for( int i=0; i<plotCount(); i++ ) { + factory->saveObjectToStream( plot(i), stream ); + } + } + +//-------------------------------------------------------------// +//-------------------------------------------------------------// +//-------------------------------------------------------------// +//-------------------------------------------------------------// +//-------------------------------------------------------------// +//-------------------------------------------------------------// + +QSAxesChild::QSAxesChild( QSAxes *parentAxes, const char *name ) +:QSGraphicalData(NULL,parentAxes,name) + { + assert(parentAxes); + m_axes = parentAxes; + } + + //-------------------------------------------------------------// + +QSAxesChild::~QSAxesChild() + { + } + diff --git a/kmatplot/widgets/qsaxes.h b/kmatplot/widgets/qsaxes.h new file mode 100644 index 0000000..a8d7ccb --- /dev/null +++ b/kmatplot/widgets/qsaxes.h @@ -0,0 +1,723 @@ +/*************************************************************************** + qsaxes.h + ------------------- + version : 0.1 + begin : 01-January-2000 + + copyright : (C) 2000 by Kamil Dobkowski + email : kamildobk@poczta.onet.pl + ***************************************************************************/ + +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + + +#ifndef QSAXES_H +#define QSAXES_H + +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + +#include<math.h> +#include<list.h> +#include<qstring.h> +#include<qptrlist.h> +#include"qsgraphicaldata.h" +#include"qsdrv.h" +#include"qscobject.h" +#include"qsprojection.h" + +class QTimer; +class QSPlot; +class QSAxes; + +/** + * \brief Simple QSCObject wrapper around QSAxes + * + * QSAxes doesn't inherit QCObject ( multimple inheritance from QObject is not allowed ), instead + * a shadow QSCObject is providen, so use:axes->shadowObject() instead of casting. Notice that + * this object inherits QSCGroup, so all objects added to this group will be bound with this axes - + * it will allow them to to use this axes coordinate system, for example arrow could point at + * some area of a graph. Constructor is a private memeber. You have to create an QSAxes2D or QSAxes3D + * first and use QSAxes::shadowObject() to get a pointer to this object. + */ +class QSCAxesShadow : public QSCGroup { + friend class QSAxes; + Q_OBJECT + public: + /** + * Destructor. + */ + virtual ~QSCAxesShadow(); + virtual void setAutoUpdates( bool enabled ); + /** + * Can't change parent axes. This method does nothing. + */ + virtual void setParentAxes( QSAxes * ); + virtual void setBox( const QSRectf& rect, QSDrv *drv ); + virtual QSRectf box( QSDrv *drv ); + virtual bool isHit( const QSPt2f &p, QSDrv* drv ); + virtual bool isAxesShadow(); + virtual int style(); + virtual QString name(); + virtual void draw( QSDrv *drv, bool blocking, bool transparent ); + virtual void paintSkeleton( QPainter *p, double dpi = 72.0 ); + virtual void paint( QPainter *p, double dpi = 72.0, bool blocking=true, bool transparent=true ); + virtual bool busy() const; + virtual void stop(); + virtual void loadStateFromStream( QDataStream& stream, QSObjectFactory *factory ); + virtual void saveStateToStream( QDataStream& stream, QSObjectFactory *factory ); + + public slots: + virtual void forceUpdate(); + + protected: + /** + * Protected constructor. Use QSAxes::shadowObject() to create QSCAxesShadow object. + */ + QSCAxesShadow( QSAxes *parent ); + + private slots: + virtual void slot_object_added( QSCObject *object ); + virtual void slot_object_removed( QSCObject *object ); + virtual void slot_draw_objects( QSDrv *drv, bool, bool ); + virtual void slot_update(); + void slot_draw_ends(); + + }; + +//----------------------------------------------------------------------------------------------------// + +/** + * \brief Base graph object + * + * Base class for all axes.Generaly it holds a list of axes and datasets.There can be any number of axes in this + * object. They are avaliable as a simple list without further interpretation. Axes also implements QSCObject ( canvas + * object ) interface, so can be added to the canvas. Warning: It does not inherit QSCObject ( problem + * with multiple inheritance ) directly, you must create such object with shadowObject() method. This object can repaint + * itself using a given painter or driver. It takes much time to repaint a graph if it contains many datapoints, + * so it can be repainted in the background see paint() ( 'blocking' argument ), state(), stop(). sigDrawEnds() + * When it state changes and it needs redrawing it notify it using sigUpdate() . + * @author Kamil Dobkowski + */ +class QSAxes : public QSGraphicalData + { + Q_OBJECT + friend class QSPlot; + Q_PROPERTY( double xPosMM READ xPosMM WRITE setXPosMM ) + Q_PROPERTY( double yPosMM READ yPosMM WRITE setYPosMM ) + Q_PROPERTY( double widthMM READ widthMM WRITE setWidthMM ) + Q_PROPERTY( double heightMM READ heightMM WRITE setHeightMM ) + Q_PROPERTY( bool drawInBackground READ drawInBackground WRITE setDrawInBackground ) + Q_PROPERTY( bool axesOnly READ axesOnly WRITE setAxesOnly ) + Q_PROPERTY( QString background READ background_property WRITE set_background_property ) + + public: + /** + * Current state. + * @see #state + */ + enum InternalState { Waiting = 0, Busy }; + /** + * See mixedToCanvas() , canvasToMixed(). When data point is to be drawn its coordinates are first mapped to + * world coordinate system using QSPlot::defaultAxis() and QSAxis::dataToWorld(). Notice that each dataset can + * use a different set of axes. World coorinate system is a simple (1,1) square for QSAxes2D, and (1,1,1) cube + * for QSAxes3D. Next if point is 'outside' axes ( has coordinates lower than 0.0 or greater than 1.0 ) is + * trown out, see proj() and QSProjection::clipPoint2(). If it is visible its coordinates are mapped to canvas + * ( screen ) coordinates using proj() and QSProjection::world2DToCanvas() and the point is drawn on the screen. + * You can next map canvas coordinates to mm's ( it is a matter of a dpi scale factor ). There are also normCoordinates, + * but they are rarely used. + */ + enum CoordinateSystem { mmCoord, normCoord, worldCoord, dataCoord }; + /** + * Element category ( used by QSDrvHitTest ). You can find out which element is currently drawn + * using QSDrv::currentElement(), of course you will be able to call this function only if drawing + * is done in the background. See state() . + */ + enum ElementCategory { GeneralCategory, AxisCategory, GridCategory, DatasetCategory, UnknownCategory }; + /** + * Constructor. + */ + QSAxes( QObject * parent, const QSProjection *proj, const char * name=0 ); + /** + * Destructor. + */ + virtual ~QSAxes(); + /** + * Returns the current state. + * Drawing - means that work is in progress at the moment (. + * using background handler callback ). + * Waiting - work is finished. + * You can stop drawing at any time by calling 'stop()'. + */ + InternalState state() const { return m_internal_state; } + /** + * Stops drawing immediately. + */ + virtual void stop(); + /** + * Returns true if a last plot drawing operation was complete + * or false if was stopped before end. + */ + bool complete() const { return m_is_complete; } + + //----------------------------------------------------------------// + /** + * Set position on a page in mm. This is not used by this class. + * It is only a useful hint. If you want to set the paint area + * basing on this parameter you must call setCanvasRect instead: + * QSCShadowObject uses this properties to find its size. + * Example: setCanvasRect( calculateCanvasRect(dpi) ) + */ + void setPosMM( const QSPt2f& pos_mm ); + /** + * Sets x position + */ + void setXPosMM( double x_mm ); + /** + * Sets y position + */ + void setYPosMM( double y_mm ); + /** + * Sets size of the axes on a page in mm. This is not used by this class + * It is only a useful hint.If you want to set the paint area you must + * call setCanvasRect instead. Example: setCanvasRect( calculateCanvasRect(dpi) ) + * QSCShadowObject uses this properties to calculate its size. + */ + void setSizeMM( const QSPt2f& size_mm ); + /** + * Sets width in mm. + */ + void setWidthMM( double w_mm ); + /** + * Sets height in mm + */ + void setHeightMM( double h_mm ); + /** + * Returns position of the axes on the page in mm. + */ + QSPt2f posMM() const { return m_pos_mm; } + /** + * Returns position of the axes on the page in mm. + */ + double xPosMM() const { return m_pos_mm.x; } + /** + * Returns position of the axes on the page in mm. + */ + double yPosMM() const { return m_pos_mm.y; } + /** + * Returns size of the axes in mm. + */ + QSPt2f sizeMM() const { return m_size_mm; } + /** + * Returns size of the axes in mm. + */ + double widthMM() const { return m_size_mm.x; } + /** + * Returns size of the axes in mm. + */ + double heightMM() const { return m_size_mm.y; } + /** + * Calculates canvas area from canvasPosMM() and canvasSizeMM() + */ + QSRectf calculateCanvasRect( double dpi = 72.0 ); + /** + * Sets the canvas rectangle to be painted. There is no 'paremetersChanged()' + * or any other notification ! + */ + void setCanvasRect( const QSRectf& r ); + /** + * Returns canvas position. + * Result valid only during drawing - see @ref #state . + */ + QSRectf canvasRect() const { return QSRectf( m_cpos.x, m_cpos.y, m_csize.x, m_csize.y ); } + /** + * Turn on a spectial mode of fitting to canvas rect. There is no 'paremetersChanged()' + * or any other notification. + */ + void setFitToCanvasRect( bool enabled ); + /** + * + */ + bool fitToCanvasRect() const { return m_transformation_rect; } + /** + * This is only a hint. You must pass 'blocking' value each time + * tou call paintPlot or drawPlot + */ + void setDrawInBackground( bool enabled ); + /** + * See 'setDrawInBackground()' + */ + bool drawInBackground() const { return m_draw_in_background; } + + //-------------------------------------------------------------// + + /** + * Draws only axes ( not datasets ) -fast mode. + */ + void setAxesOnly( bool enabled ); + /** + * Return an axes only setting. + */ + bool axesOnly() const { return m_axes_only; } + /** + * Sets the background color. + */ + void setBackground( const QSGFill& fill ); + /** + * Returns the current background color. + */ + QSGFill background() const; + + //------------------------------------------------------------// + /** + * Remembered view contains such parameters as axis min ,axis max, axis scale, axis reversed. + * Up to three different views can be remembered ( index must be in 0-2 ). + */ + virtual void rememberCurrentView( int index ); + + /** + * Sets the view properties + */ + virtual void setRememberedView( int index ); + + //------------------------------------------------------------// + /** + * Triggers transformation update after you modified 'setCanvasRect', datasets, axes etc. + * It is called also when redrawing, so there is no need to call it by hand. + */ + virtual void initMappings( QSDrv *drv ); + /** + * Canvas coordinates are on-screen pixels coordinates. See 'canvasPos()' and 'canvasSize()'. + * Normalized coordinates maps canvas coordinates to <0,1> rectangle. + * Example: canvasToNormalized(canvasPos()) returns ( 0.0, 0.0 ) point. + * See also 'initMappings()' + */ + double canvasToNormalizedX( double value ) const ; + /** + * See canvasToNormalizedX() + */ + double canvasToNormalizedY( double value ) const ; + /** + * See canvasToNormalizedX() + */ + QSPt2f canvasToNormalized( const QSPt2f& pos ) const; + /** + * See canvasToNormalizedX() + */ + double normalizedXToCanvas( double value ) const ; + /** + * See canvasToNormalizedX() + */ + double normalizedYToCanvas( double value ) const ; + /** + * See canvasToNormalizedX() + */ + QSPt2f normalizedToCanvas( const QSPt2f& pos ) const; + /** + * From data to screen coordinates. + * See also 'initMappings()' + */ + QSPt2f dataToCanvas( const QSPt3f& pos, QSAxis *xAxis, QSAxis *yAxis, QSAxis *zAxis ) const; + /** + * From data to screen coordinates. + * See also 'initMappings()' + */ + QSPt2f dataToCanvas( const QSPt2f& pos, QSAxis *xAxis, QSAxis *yAxis ) const; + /** + * From mixed type coordinates to canvas. Not all combinations of CoordinateSystems are allowed in all cases. + * In in_coords parameter you can describe which coordinate system is used for each point coordinate. See + * CoordinateSystem . + */ + virtual QSPt3f mixedToCanvas( const QSPt3f& pos, CoordinateSystem in_coords[3], double dpi, QSAxis *xAxis, QSAxis *yAxis, QSAxis *zAxis ) const = 0; + /** + * From canvas to mixed coordinates. In out_coords parameter you can request which coordinate system + * should be used for each output coordinate. Not all combinations of CoordinateSystems are allowed in all cases. + * See CoordinateSystem . + */ + virtual QSPt3f canvasToMixed( const QSPt3f& pos, CoordinateSystem out_coords[3], double dpi, QSAxis *xAxis, QSAxis *yAxis, QSAxis *zAxis ) const = 0; + + //------------------------------------------------------------// + + /** + * Controls if method 'updatePlot()' will be called automatically + * after any parameter ( by set... method ) or data ( setMatrix... ) changes. + */ + void setAutoUpdates( bool enabled ); + /** + * Returns the auto-updates setting. + */ + bool autoUpdates() const { return m_auto_updates; } + + //----------------------------------------------------------------// + + /** + * The same as axisCount()+plotCount(). + */ + virtual int childCount() const; + /** + * Returns a child object - it is a joined list of child axes and + * child plots. + */ + virtual QSData *child( int index ) const; + + //----------------------------------------------------------------// + + /** + * Returns a total number of child plots. + */ + int plotCount() const; + /** + * Adds a new plot to the list. Emits sigChildAdded(). + * The newly constructed object should be immediately added + * to the child list. + */ + void plotAdd( QSPlot *p ); + /** + * Adds a new plot to the list. Emits sigChildAdded(). + * The newly constructed object should be immediately added + * to the child list. + */ + void plotInsert( int beforePos, QSPlot *p ); + /** + * Removes a dataset from the dataset list but doesn't delete it. + * Emits sigChildRemoved ( all child datasets are deleted in destructor however ). + */ + void plotRemove( QSPlot *p ); + /** + * Removes and deletes a dataset from the dataset list. Emits sigChildRemoved + * It doesn't remove it nor deletes it if it is not found on the child list. + */ + void plotDelete( QSPlot *p ); + /** + * Returns a plot at the index 'index'. + * Plots are numbered from 0 ( at the back ) to + * plotCount()-1 ( at the front ). + */ + QSPlot *plot( int index ) const ; + /** + * Returns the current index of the given plot. + */ + int plotIndex( QSPlot *o ) const ; + /** + * Moves the given object to the front. Emits sigChildOrder. + */ + void plotToFront( QSPlot *o ); + /** + * Moves the given object to the back. Emits sigChildDOrder. + */ + void plotToBack( QSPlot *o ); + /** + * Raises the given object. Emits sigChildOrder. + */ + void plotRaise( QSPlot *o ); + /** + * Lowers the given object. Emits sigChildOrder. + */ + void plotLower( QSPlot * o ); + /** + * Reorderes the given object. Emits sigChildOrder. + */ + void plotReorder( int position, QSPlot * o ); + + //----------------------------------------------------------------// + + + /** + * Returns a total number of child axes. + */ + int axisCount() const; + /** + * Adds a new axis to the list. Emits sigChildAdded(). + * The newly constructed axis object should be immediately added + * to the child list. + */ + void axisAdd( QSAxis *axis ); + /** + * Adds a new axis to the list. Emits sigChildAdded(). + * The newly constructed axis object should be immediately added + * to the child list. + */ + void axisInsert( int position, QSAxis *axis ); + /** + * Removes an axis from the axis list but doesn't delete it + * ( all child axes are deleted in destructor however ). + * You can't remove an axis if it is the last axis of the + * given type ( there always must be at least a one X,Y,V,Z axis present ). + * Operation is silently ignored in the case, and function returns false;. + * Emits sigChildRemoved + */ + bool axisRemove( QSAxis *axis ); + /** + * Removes and deletes an axis from the axis list + * You can't remove an axis if it is the last axis of the + * given type ( there always must be at least a one X,Y,V,Z axis present ). + * Operation is silently ignored in the case, and function returns false;. + * Emits sigChildRemoved + */ + bool axisDelete( QSAxis *axis ); + /** + * Returns axis of a given type. Returned axis is always first axis found + * ( with the lowest index ). axisType has type of QSAxis::AxisType. + */ + QSAxis *axisOfType( int axisType ) const; + /** + * Returns an axis at the index 'index'. + * Axes are numbered from 0 ( at the back ) to + * axisCount()-1 ( at the front ). + */ + QSAxis *axis( int index ) const; + /** + * Returns the current index of the given axis. + */ + int axisIndex( QSAxis *axis ) const ; + /** + * Moves the given axis to the front. Emits sigChildOrder. + */ + void axisToFront( QSAxis *axis ); + /** + * Moves the given axis to the back. Emits sigChildDOrder. + */ + void axisToBack( QSAxis *axis ); + /** + * Raises the given axis. Emits sigChildOrder. + */ + void axisRaise( QSAxis *axis ); + /** + * Lowers the given axis. Emits sigChildOrder. + */ + void axisLower( QSAxis *axis ); + /** + * Reorderes the given axis. Emits sigChildOrder. + */ + void axisReorder( int position, QSAxis *axis ); + + //----------------------------------------------------------------// + //----------------------------------------------------------------// + + /** + * Returns a shadow object. It has the same position and size as axes. + * When this position is changed by object->setBox a position and size + * of this object is updated ( see 'posMM()' and 'sizeMM()' ). + * Do not delete it. + */ + QSCAxesShadow *shadowObject(); + + //----------------------------------------------------------------// + + /** + * Info about the given point + */ + virtual QString posInfo( QSPt2f& pos ); + + //--------------------------------------------------------------------------// + + /** + * Paints the plot to the given painter, 'dpi' is used to calculate + * a pixel-height of points and fonts. If blocking is true, this function + * returns after drawing ends ( may take a while ). If blocking is false + * driver is copied using QSDrv::copy(), this function returns immediately, + * drawing is continued in a timer event + */ + virtual void paintPlot( QPainter *p, double dpi=72.0, bool blocking=true, bool transparent=true ) = 0; + /** + * Paints the plot with the given driver, 'drv->dpi' is used to calculate + * a pixel-height of points and fonts. If blocking is true, this function + * returns after drawing ends ( may take a while ). If blocking is false + * driver is copied using QSDrv::copy(), this function returns immediately, + * drawing is continued in a timer event + */ + virtual void drawPlot( QSDrv *drv, bool blocking=true, bool transparent=true ) = 0; + /** + * Paints (fast )simplified version of this object + */ + virtual void paintSkeleton( QPainter *p, double dpi=72.0, bool reallyFast=false ); + /** + * Emits sigUpdate + */ + void forceUpdate() { emit sigUpdate(); } + /** + * + */ + QSDrv *run_gDriver() const { return m_drv; } + /** + * + */ + double run_dpi() const { return m_curr_dpi; } + /** + * Returns a projection used by this axis object. + */ + const QSProjection *proj() const { return m_proj; } + + //----------------------------------------------------------------// + + void set_background_property( const QString& value ); + QString background_property() const; + /** + * Restores all axes and datasets. + */ + virtual void loadStateFromStream( QDataStream& stream, QSObjectFactory *factory ); + /** + * Saves all axes and datasets. + */ + virtual void saveStateToStream( QDataStream& stream, QSObjectFactory *factory ); + + signals: + /** + * Emitted after any data change in child plots and an axes object itself. + */ + void sigDataChanged( QSGraphicalData *b, int channel ); + /** + * + */ + void sigUpdate(); + /** + * After all ranges and transforms are calculated + */ + void sigRangesValid(); + /** + * Emitted when draw ends but before graphics is closed. + */ + void sigUserDraw( QSDrv *drv, bool blocking, bool transparent ); + /** + * Emitted when draw ends, after graphics has been closed. + */ + void sigDrawEnds(); + + //----------------------------------------------------------------// + + protected: + + /** + * Reimplemented. Calls stop(). + */ + virtual void dataChanging( QSData *object, int channel = -1 ); + /** + * Reimplemented. Emits sigDataChanged() and ( see setAutoUpdates() ) sigUpdate(). + */ + virtual void dataChanged( QSData *object, int channel = -1 ); + /** + * Reimplemented. Calls stop(). + */ + virtual void parametersChanging(); + /** + * Reimplemented. Emits ( see setAutoUpdates() ) sigUpdate(). + */ + virtual void parametersChanged(); + /** + * Starts redrawing process. + */ + virtual void start( QSDrv *drv, bool blocking, bool transparent ); + /** + * Called when all ranges are calculated. + * Default implementation emits 'sigRangesValid' + */ + virtual void axisRangesCalculated() { emit sigRangesValid(); } + /** + * This function is called in 'start()' before drawing starts. + * Default implementation does nothing. + */ + virtual void allocRuntimeData() {} + /** + * This function is called in 'stop()' after drawing stops. + * Default implementation does nothing. + */ + virtual void freeRuntimeData() {} + /** + * Draws an axis. It is reimplemented in QSAxes2D and QSAxes3D + */ + virtual void drawAxis( QSAxis */*axis*/ ) {} + /** + * Draws an axis grid. It is reimplemented in QSAxes2D and QSAxes3D + */ + virtual void drawGrid( QSAxis */*axis*/, bool /*major*/ ) {} + /** + * Reimplemented from QObject + */ + virtual void childEvent ( QChildEvent * ); + + struct margins_t { + int l; + int r; + int t; + int b; + } m_m; + + InternalState m_internal_state; + QSGFill m_bckg_fill; + QSPt2f m_csize; + QSPt2f m_cpos; + QSPt2f m_pos_mm; + QSPt2f m_size_mm; + double m_curr_dpi; + QSDrv *m_drv; + bool m_bkg_handler; + bool m_axes_only; + bool m_really_fast; + bool m_blocking; + bool m_transparent; + QSCAxesShadow *m_shadow_object; + bool m_transformation_rect; + bool m_draw_in_background; + const QSProjection *m_proj; + int m_curr_dataset_nr; + + private: + struct qsaxes_private_data; + qsaxes_private_data *d; + QTimer *m_timer; + + // change to fields + bool m_runtime_data_allocated; + bool m_current_started; + bool m_is_complete; + bool m_auto_updates; + bool m_delete_driver; + double m_almost_zero; + void calculate_auto_ranges(); + + private slots: + void work_proc(); +}; + +//---------------------------------------------------------------------------------------------------// + +/** + * \brief Object which have a parent axes. + * + * Axis or dataset + * @author Kamil Dobkowski + */ +class QSAxesChild : public QSGraphicalData + { + Q_OBJECT + public: + /** + * Constructor. The object should be added immediately to the + * Axes child list. + */ + QSAxesChild( QSAxes *parentAxes, const char *name=0 ); + /** + * Destructor + */ + virtual ~QSAxesChild(); + /** + * Returns parent axes. + */ + QSAxes *parentAxes() const { return m_axes; } + + protected: + QSAxes *m_axes; + }; + +#endif + + + diff --git a/kmatplot/widgets/qsaxes2d.cpp b/kmatplot/widgets/qsaxes2d.cpp new file mode 100644 index 0000000..66049fe --- /dev/null +++ b/kmatplot/widgets/qsaxes2d.cpp @@ -0,0 +1,500 @@ +/*************************************************************************** + qsaxes2d.cpp + ------------------- + begin : 01-January-2000 + copyright : (C) 2000 by Kamil Dobkowski + email : kamildobk@poczta.onet.pl + ***************************************************************************/ + +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + + +#include "qsaxes2d.h" +#include "qsaxis.h" +#include "qsdrvqt.h" +#include <math.h> +#include <assert.h> + +struct axes2d_runtime_data { + }; + +//-------------------------------------------------------------// + +QSAxes2D::QSAxes2D(QObject* parent, const char * name) +:QSAxes(parent,&t,name) + { + t.matrixI( t.T ); + m_drv = NULL; + +#define CHANNELS_NUM 0 +#define FONTS_NUM 0 +#define FILLS_NUM 2 +#define LINES_NUM 0 +#define POINTS_NUM 0 + + initChannelTable( CHANNELS_NUM ); + initAttributeTables( FONTS_NUM, FILLS_NUM, LINES_NUM, POINTS_NUM ); + default_settings(); + m_is_graphics_active = false; + } + +//-------------------------------------------------------------// + +QSAxes2D::~QSAxes2D() + { + } + +//--------------------------------------------------------------// + +void QSAxes2D::drawAxis( QSAxis *axis ) + { + int axis_number = axisIndex(axis); + if ( axis->visible() ) + if ( axis->type() == QSAxis::XAxisType || + axis->type() == QSAxis::YAxisType ) { + + /////////////////////////// + // draw axis line // + /////////////////////////// + + QSPt2f axis_p1( 0.0, 0.0 ); + QSPt2f axis_p2( 1.0, 1.0 ); + double pos = axis->position(); + if ( axis->defaultPosition() ) pos = 0.0; + if ( axis->oppositePosition() ) pos = 1.0 - pos; + if ( axis->type() == QSAxis::XAxisType ) axis_p1.y = axis_p2.y = pos; + if ( axis->type() == QSAxis::YAxisType ) axis_p1.x = axis_p2.x = pos; + + // little hack for better look + QSPt2f cp1 = t.world2DToCanvas( axis_p1 ); + QSPt2f cp2 = t.world2DToCanvas( axis_p2 ); + if ( axis->type() == QSAxis::XAxisType && axis_p1.y > 0.5 ) { cp1.y -= 1.0; cp2.y -= 1.0; } + if ( axis->type() == QSAxis::YAxisType && axis_p1.x < 0.5 ) { cp1.x -= 1.0; cp2.x -= 1.0; } + + // draw line + m_drv->setLine( axis->line(QSAxis::AxisLine) ); + if ( axis->reversed() ) m_drv->drawArrow( cp2, cp1, axis->arrow1(), axis->arrow2() ); + else m_drv->drawArrow( cp1, cp2, axis->arrow1(), axis->arrow2() ); + + /////////////////////////////////// + // draw tic marks and labels // + /////////////////////////////////// + + // tic direction & lenght & line + QSPt2f tic_direction( 0.0, 0.0 ); + if ( axis->type() == QSAxis::XAxisType ) tic_direction.y = 1.0; + if ( axis->type() == QSAxis::YAxisType ) tic_direction.x = 1.0; + if ( axis->ticsOuter() ) tic_direction.set(-tic_direction.x,-tic_direction.y); + if ( axis->oppositePosition() ) tic_direction.set(-tic_direction.x,-tic_direction.y); + double tic_len_x = 0.015 * m_csize.y / m_csize.x; + double tic_len_y = 0.015; + QSPt2f tic_length( tic_direction.x*tic_len_x, tic_direction.y*tic_len_y ); + QSGLine tic_line = axis->line(QSAxis::AxisLine); tic_line.style = QSGLine::Solid; + + // tic label align + int align = 0; + if ( axis->type() == QSAxis::XAxisType ) align = AlignHCenter | ( axis->oppositePosition() ? AlignBottom : AlignTop ); + if ( axis->type() == QSAxis::YAxisType ) align = AlignVCenter | ( axis->oppositePosition() ? AlignLeft : AlignRight ); + + // draw tic marks and labels + int tic_nr = 0; + QSPt2f label_pos; + QSPt2f tic_pos = axis_p1; // x ( for x axis ) or y ( for y axis ) will be set in the future. + list<QSAxisTic>::const_iterator curr = axis->tics()->begin(); + list<QSAxisTic>::const_iterator last = axis->tics()->end(); + m_drv->setCurrentElement( QSAxes::GridCategory, axis_number ); + if ( !m_really_fast ) // a little hack for paintSkeleton + while( curr != last ) { + // modify align for rotated labels + int tics_align = align; + if ( tics_align & AlignHCenter ) { + if ( curr->m_angle > 0 ) tics_align = tics_align & ~AlignHCenter | AlignLeft; // clear AlignHCenter and set AlignLeft + if ( curr->m_angle < 0 ) tics_align = tics_align & ~AlignHCenter | AlignRight; // clear AlignHCenter and set AlignRight + } + + // tic mark + if ( axis->type() == QSAxis::XAxisType ) tic_pos.x = curr->m_pos; // p1-p2 vertical line + if ( axis->type() == QSAxis::YAxisType ) tic_pos.y = curr->m_pos; // p1-p2 horizontal line + if ( axis->ticsVisible() && curr->m_major ) { + m_drv->setLine( tic_line ); + m_drv->drawLine2( tic_pos, tic_pos+tic_length ); + } + + // tic_label + double shift = (tic_nr%2) ? axis->ticLabelPos2() : axis->ticLabelPos1(); + QSPt2f label_shift( tic_direction.x*shift, tic_direction.y*shift ); + if ( axis->ticsOuter() ) label_pos = tic_pos + tic_length + label_shift; + else label_pos = tic_pos - label_shift; + + m_drv->setFont( curr->m_font ); + m_drv->drawRText2( label_pos, curr->m_angle, curr->m_label, tics_align ); + + if ( curr->m_major ) tic_nr++; + curr++; + } + + /////////////////////// + // draw title // + /////////////////////// + + // Y axes have rotated titles + int angle = 0; + if ( axis->type() == QSAxis::YAxisType ) if ( axis->oppositePosition() ) angle = 90; else angle = -90; + + // position axis at axis->titlePosition() + double shift_direction = axis->oppositePosition() ? 1.0 : -1.0; + if ( axis->type() == QSAxis::XAxisType ) { label_pos.x = axis->titlePosition(); label_pos.y += shift_direction * axis->titleDistance(); } + if ( axis->type() == QSAxis::YAxisType ) { label_pos.y = axis->titlePosition(); label_pos.x += shift_direction * axis->titleDistance(); } + + // draw title ( if isn't paintg only skeleton ) + m_drv->setCurrentElement( QSAxes::AxisCategory, axis_number ); + m_drv->setFont( axis->font(QSAxis::TitleFont) ); + if ( !m_really_fast ) m_drv->drawRTextBox2( label_pos, angle, axis->title(), align ); + } + } + +/* + QSPt2f label_max_size; + // size of the label + QSPt2f curr_label_size = m_drv->rTextSize( curr->m_angle, curr->m_label ); + label_max_size.x = QMAX( label_max_size.x, curr_label_size.x ); + label_max_size.y = QMAX( label_max_size.y, curr_label_size.y ); +*/ +/* + // move title away from axis on distance label_max_size + axis->titleDistance + if ( axis->type() == QSAxis::YAxisType ) shift_direction = -shift_direction; + if ( axis->oppositePosition() ) shift + QSPt2f clabel_pos = t.world2DToCanvas( label_pos ); + if ( axis->type() == QSAxis::XAxisType ) label_pos.y += label_max_size.y; + if ( axis->type() == QSAxis::YAxisType ) label_pos.x += label_max_size.x; +*/ +// QSPt2f middle = t.world2DToCanvas( QSPt2f(axis->titlePosition(),axis->titlePosition()) ); +// label_pos = label_pos + label_max_size; + + //QSPt2f cp1 = t.world2DToCanvas( axis_p1 ); + //QSPt2f cp2 = t.world2DToCanvas( axis_p2 ) + d; + + //if ( axis->type() == QSAxis::XAxisType ) d.y = -ticlen( 0, true ); + //if ( axis->type() == QSAxis::YAxisType ) d.x = ticlen( 0, true ); + +//-------------------------------------------------------------// + +void QSAxes2D::drawGrid( QSAxis *axis, bool major ) + { + if ( axis->visible() ) + if ( axis->type() == QSAxis::XAxisType || + axis->type() == QSAxis::YAxisType ) { + list<QSAxisTic>::const_iterator curr = axis->tics()->begin(); + list<QSAxisTic>::const_iterator last = axis->tics()->end(); + while ( curr != last ) { + if ( curr->m_major == major ) { + QSPt2f p1( 0.0, 0.0 ); + QSPt2f p2( 1.0, 1.0 ); + if ( axis->type() == QSAxis::XAxisType ) p1.x = p2.x = curr->m_pos; + if ( axis->type() == QSAxis::YAxisType ) p1.y = p2.y = curr->m_pos; + m_drv->setLine( curr->m_line ); + m_drv->drawLine2( p1, p2 ); + } + curr++; + } + } + } + + +//-------------------------------------------------------------// + +double QSAxes2D::ticlen( int, bool major ) + { + return m_csize.y*(major?10.0:6.0)/1000.0; + } + +//-------------------------------------------------------------// + +void QSAxes2D::allocRuntimeData() + { + QSAxes::allocRuntimeData(); + //d = new axes2d_runtime_data(); + } + +//-------------------------------------------------------------// + +void QSAxes2D::freeRuntimeData() + { + //delete d; d = NULL; + QSAxes::freeRuntimeData(); + } + +//-------------------------------------------------------------// + +void QSAxes2D::setFrameWidth( int width ) + { + if ( width < 0 ) width = 0; + SET_PROPERTY( m_framew, width ); + } + +//-------------------------------------------------------------// + +void QSAxes2D::axisRangesCalculated() + { + init_2dtr(); + // activate graphics + assert( !m_is_graphics_active ); + m_is_graphics_active = true; + m_drv->startDrawing(); + draw_axes(); + QSAxes::axisRangesCalculated(); + } + + +//-------------------------------------------------------------// + +void QSAxes2D::stop() + { + if ( m_is_graphics_active ) { + m_is_graphics_active = false; + m_drv->stopDrawing(); + } + QSAxes::stop(); + } + +//-------------------------------------------------------------// + +void QSAxes2D::init_2dtr() + { + // left-top corner + QSPt2f tf( m_cpos.x, m_cpos.y ); + + // right bottom corner + QSPt2f bf( m_cpos.x+m_csize.x, + m_cpos.y+m_csize.y ); + + // the axis frame + double framew = m_drv->toPixels(frameWidth()); + // for better look on a raster devices + if ( frameWidth() > 0 && framew < 1.0 ) framew = 1.0; + tf.x += framew; + tf.y += framew; + /* + bf.x -= framew; + bf.y -= framew; + */ + + t.matrixI( t.T ); + + // ( 0,0 ) is in bottom,left corner. + t.applyS( t.T, 1.0, -1.0 ); + t.applyT( t.T, 0.0, 1.0 ); + + // scale (0,0,1,1) rectangle to (tf, bf) rectangle + t.applyViewport( t.T, tf.x, tf.y, bf.x-tf.x, bf.y-tf.y ); + + // remember inversion for further use + t.inv( t.IT, t.T ); + + // Clip rectangle + // added + 1 to bf + t.setClipRect( tf.x, tf.y, bf.x, bf.y ); + } + +//-------------------------------------------------------------// + +void QSAxes2D::draw_axes() + { + /* + QSPt2f p1; + QSPt2f p2; + //t.getClipRect( &p1.x, &p1.y, &p2.x, &p2.y ); + */ + + m_drv->setLine( QSGLine::invisibleLine ); + QSPt2f p1 = m_cpos; + QSPt2f p2 = m_cpos + m_csize; + + // the axis frame + double framew = m_drv->toPixels(frameWidth()); + // for better look on a raster devices + if ( frameWidth() > 0 && framew < 1.0 ) framew = 1.0; + QSPt2f canvas_p1( p1.x+framew, p1.y+framew ); + QSPt2f canvas_p2( p2.x+framew, p2.y+framew ); + + // frame + if ( m_framew > 0 ) { + m_drv->setFill( fill(FrameFill) ); + draw_rect( p1, QSPt2f(canvas_p2.x,canvas_p1.y) ); // top edge + draw_rect( QSPt2f(canvas_p1.x,p2.y), canvas_p2 ); // bottom edge + draw_rect( p1, QSPt2f(canvas_p1.x,canvas_p2.y) ); // left edge + draw_rect( QSPt2f(p2.x,canvas_p1.y), canvas_p2 ); // right edge + } + + // interior + QSGFill f = fill(RectFill); + if ( !m_transparent && f.style == QSGFill::Transparent ) f = QSGFill(); + m_drv->setFill( f ); + draw_rect( canvas_p1, p2 ); + } + +//-------------------------------------------------------------// + +void QSAxes2D::draw_rect( const QSPt2f& p1, const QSPt2f& p2 ) + { + QSPt2f p[2]; + + p[0].set( QMIN(p1.x,p2.x), QMIN(p1.y,p2.y) ); + p[1].set( QMAX(p1.x,p2.x), QMAX(p1.y,p2.y) ); + + if ( p[0].x == p[1].x ) p[1].x += 1.0; + if ( p[0].y == p[1].y ) p[1].y += 1.0; + + QSPt2f pts[4]; + pts[0] = p[0]; + pts[1] = QSPt2f( p[1].x, p[0].y ); + pts[2] = p[1]; + pts[3] = QSPt2f( p[0].x, p[1].y ); + + m_drv->drawPoly( pts, 4 ); + } + +//-------------------------------------------------------------// + +void QSAxes2D::default_settings() + { + m_framew = 1; + QSGFill f; + f.color.set( 0, 0, 0 ); + m_settings.fills[FrameFill] = f; + + m_settings.fills[RectFill] = QSGFill::transparentFill; + } + +//-------------------------------------------------------------// +//-------------------------------------------------------------// +//-------------------------------------------------------------// + +void QSAxes2D::paintPlot( QPainter *painter, double dpi, bool blocking, bool transparent ) + { + if ( painter ) { + if ( m_internal_state == Busy ) stop(); + QSDrvQt qtdrv; + qtdrv.setProjection( &t ); + qtdrv.setDC(painter,dpi,false); // don't delete QPainter + start( &qtdrv, blocking, transparent ); + } + } + +//-------------------------------------------------------------// + +void QSAxes2D::drawPlot( QSDrv *init_drv, bool blocking, bool transparent ) + { + if ( init_drv ) { + if ( m_internal_state == Busy ) stop(); + init_drv->setProjection( &t ); + start( init_drv, blocking, transparent ); + } + } + +//-------------------------------------------------------------// +//-------------------------------------------------------------// +//-------------------------------------------------------------// +//-------------------------------------------------------------// +//-------------------------------------------------------------// + +void QSAxes2D::initMappings( QSDrv *drv ) + { + QSAxes::initMappings( drv ); + if ( !state() ) { + allocRuntimeData(); + init_2dtr(); + freeRuntimeData(); + drv->startDrawing(); + drv->stopDrawing(); + } + } + + + +//-------------------------------------------------------------// + +QString QSAxes2D::posInfo( QSPt2f& pos ) + { + QString result = QSAxes::posInfo( pos ); + return result; + } + +//-------------------------------------------------------------// + +QSPt3f QSAxes2D::mixedToCanvas( const QSPt3f& pos, CoordinateSystem in_coords[3], double dpi, QSAxis *xAxis, QSAxis *yAxis, QSAxis *zAxis ) const + { + QSPt3f result( 0.0, 0.0, 0.0 ); + + switch( in_coords[0] ) { + case mmCoord: result.x = QSCoord::mmToPixels( pos.x, dpi ); break; + case normCoord: result.x = normalizedXToCanvas( pos.x ); break; + case worldCoord: result.x = t.world2DToCanvasX( pos.x ); break; + case dataCoord: result.x = t.world2DToCanvasX( xAxis->dataToWorld(pos.x) ); break; + } + switch( in_coords[1] ) { + case mmCoord: result.y = QSCoord::mmToPixels( pos.y, dpi ); break; + case normCoord: result.y = normalizedYToCanvas( pos.y ); break; + case worldCoord: result.y = t.world2DToCanvasY( pos.y ); break; + case dataCoord: result.y = t.world2DToCanvasY( yAxis->dataToWorld(pos.y) ); break; + } + switch( in_coords[2] ) { + case mmCoord: result.z = QSCoord::mmToPixels( pos.z, dpi ); break; + case normCoord: break; // no normalized z + case worldCoord: result.z = t.world2DToCanvasZ( pos.z ); break; + case dataCoord: result.z = t.world2DToCanvasZ( zAxis->dataToWorld(pos.z) ); break; + } + + return result; + } + +//-------------------------------------------------------------// + +QSPt3f QSAxes2D::canvasToMixed( const QSPt3f& pos, CoordinateSystem out_coords[3], double dpi, QSAxis *xAxis, QSAxis *yAxis, QSAxis *zAxis ) const + { + QSPt3f result; + switch( out_coords[0] ) { + case mmCoord: result.x = QSCoord::pixelsToMM( pos.x, dpi ); break; + case normCoord: result.x = canvasToNormalizedX( pos.x ); break; + case worldCoord: result.x = t.canvasXToWorld2D( pos.x ); break; + case dataCoord: result.x = xAxis->worldToData( t.canvasXToWorld2D(pos.x) ); break; + } + switch( out_coords[1] ) { + case mmCoord: result.y = QSCoord::pixelsToMM( pos.y, dpi ); break; + case normCoord: result.y = canvasToNormalizedY( pos.y ); break; + case worldCoord: result.y = t.canvasYToWorld2D( pos.y ); break; + case dataCoord: result.y = yAxis->worldToData( t.canvasYToWorld2D(pos.y) ); break; + } + switch( out_coords[2] ) { + case mmCoord: result.z = QSCoord::pixelsToMM( pos.z, dpi ); break; + case normCoord: break; // no normalized z + case worldCoord: result.z = t.canvasZToWorld2D( pos.z ); break; + case dataCoord: result.z = zAxis->worldToData( t.canvasZToWorld2D(pos.z) ); break; + } + return result; + } + +//-------------------------------------------------------------// + +void QSAxes2D::loadStateFromStream( QDataStream& stream, QSObjectFactory *factory ) + { + QSAxes::loadStateFromStream( stream, factory ); + } + +//-------------------------------------------------------------// + +void QSAxes2D::saveStateToStream( QDataStream& stream, QSObjectFactory *factory ) + { + QSAxes::saveStateToStream( stream, factory ); + } + + + + diff --git a/kmatplot/widgets/qsaxes2d.h b/kmatplot/widgets/qsaxes2d.h new file mode 100644 index 0000000..6d091a8 --- /dev/null +++ b/kmatplot/widgets/qsaxes2d.h @@ -0,0 +1,137 @@ +/*************************************************************************** + qsaxes2d.h + ------------------- + begin : 01-January-2000 + copyright : (C) 2000 by Kamil Dobkowski + email : kamildobk@poczta.onet.pl + ***************************************************************************/ + +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + + +#ifndef QSAXES2D_H +#define QSAXES2D_H + +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + +#include"qsaxes.h" +#include"qsprojection2d.h" + +/** + * \brief Ordinary XY axes + * + * @author Kamil Dobkowski + */ +class QSAxes2D : public QSAxes + { + Q_OBJECT + Q_PROPERTY( int frameWidth READ frameWidth WRITE setFrameWidth ) + + public: + /** + * Constructor. + */ + QSAxes2D(QObject* parent=0, const char * name=0); + /** + * Destructor. + */ + ~QSAxes2D(); + /** + * Reimplemented. + */ + virtual void stop(); + /** + * Sets a width of the frame. + */ + void setFrameWidth( int width ); + /** + * Returns a frame width. + */ + int frameWidth() const { return m_framew; } + /** + * Reimplemented + */ + virtual void initMappings( QSDrv *drv ); + /** + * From mixed type coordinates to canvas. Allows freely mixing of coordinate systems, but Z can't be normCoordinate + */ + virtual QSPt3f mixedToCanvas( const QSPt3f& pos, CoordinateSystem in_coords[3], double dpi, QSAxis *xAxis, QSAxis *yAxis, QSAxis *zAxis ) const ; + /** + * From canvas to mixed coordinates. Allows freely mixing of coordinate systems, but Z can't be normCoordinate. + */ + virtual QSPt3f canvasToMixed( const QSPt3f& pos, CoordinateSystem out_coords[3], double dpi, QSAxis *xAxis, QSAxis *yAxis, QSAxis *zAxis ) const ; + /** + * Reimplemented + */ + virtual void paintPlot( QPainter *p, double dpi=72.0, bool blocking=true, bool transparent=true ); + /** + * Reimplemented + */ + virtual void drawPlot( QSDrv *drv, bool blocking=true, bool transparent=true ); + /** + * Reimplemented + */ + virtual QString posInfo( QSPt2f& pos ); + /** + * Fill elements. See QSGraphicalData::setFill() + */ + enum FillElement { + RectFill = 0, + FrameFill + }; + + virtual void loadStateFromStream( QDataStream& stream, QSObjectFactory *factory ); + virtual void saveStateToStream( QDataStream& stream, QSObjectFactory *factory ); + + protected: + /** + * Reimplemented from @ref QSPlot::axisRangesCalculated . + */ + void axisRangesCalculated(); + /** + * Reimplemented + */ + void allocRuntimeData(); + /** + * Reimplemented + */ + void freeRuntimeData(); + /** + * Reimplemented + */ + virtual void drawAxis( QSAxis *axis ); + /** + * Reimplemented + */ + virtual void drawGrid( QSAxis *axis, bool major ); + + private: + QSProjection2D t; + int m_framew; + bool m_is_graphics_active; + struct axes2d_runtime_data; + struct axes2d_runtime_data *d; + void default_settings(); + void init_2dtr(); + void draw_axes(); + void draw_rect( const QSPt2f& p1, const QSPt2f& p2 ); + double ticlen( int axis, bool major ); + + }; + +/** + * \example demo2d.cpp + * + * Example of how to use QSAxes2D + */ +#endif + diff --git a/kmatplot/widgets/qsaxes3d.cpp b/kmatplot/widgets/qsaxes3d.cpp new file mode 100644 index 0000000..8e8c53d --- /dev/null +++ b/kmatplot/widgets/qsaxes3d.cpp @@ -0,0 +1,1279 @@ +/*************************************************************************** + qsaxes3d.cpp + ------------------- + begin : 01-January-2000 + copyright : (C) 2000 by Kamil Dobkowski + email : kamildobk@poczta.onet.pl + ***************************************************************************/ + +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + + +#include"qsaxes3d.h" +#include"qsaxis.h" +#include"qsdrvopengl.h" +#include"qsdrvqt.h" +#include<assert.h> +#include<math.h> +#include<algo.h> + +struct QSAxes3D::qsaxes3d_runtime_data { + QSPt3f side_norms[6]; + QSGFill wall_fills[6]; + QSGLine wall_lines[6]; + bool v_max[4]; + bool v_min[4]; + bool v_fir[4]; + bool v_sec[4]; + bool has_grid[6][6]; + bool has_grid_opposite[6][6]; + }; + +//-------------------------------------------------------------// +//-------------------------------------------------------------// +//-------------------------------------------------------------// + +QSAxes3D::QSAxes3D(QObject * parent, const char * name) +:QSAxes(parent,&t,name) + { + m_drv = NULL; + m_gl.enabled = false; + + // default values + m_gl.transparency = false; + m_gl.shadewalls = true; + m_gl.autostroke = true; + m_gl.autostrokel = -45; + m_gl.globaltr = 0; + + m_view.azimuth = 45; + m_view.elevation = 30; + m_view.lightAzimuth = 135; + m_view.lightElevation = 30; + + m_view.distance = 0; + m_view.directLight = 0; + m_view.ambientLight = 10; + m_view.focus = 35; + + m_view.perspective = false; + m_view.lighted = false; + m_view.autoscale = true; + m_is_graphics_active = false; + + m_view.xEdge = 1.0; + m_view.yEdge = 1.0; + m_view.zEdge = 0.75; + + m_view.xyThick = 0.05; + m_view.xzThick = 0.0; + m_view.yzThick = 0.0; + + t.matrixI( t.M ); + t.matrixI( t.P ); + t.matrixI( t.T ); + + d = NULL; + + #define CHANNELS_NUM 0 + #define FONTS_NUM 0 + #define FILLS_NUM 5 + #define LINES_NUM 5 + #define POINTS_NUM 0 + + initChannelTable( CHANNELS_NUM ); + initAttributeTables( FONTS_NUM, FILLS_NUM, LINES_NUM, POINTS_NUM ); + defaultSettings(); + } + +//-------------------------------------------------------------// + +QSAxes3D::~QSAxes3D() + { + } + +//-------------------------------------------------------------// + +void QSAxes3D::setEdgeLength( double xEdge, double yEdge, double zEdge ) + { + if ( xEdge != m_view.xEdge || + yEdge != m_view.yEdge || + zEdge != m_view.zEdge ) { + parametersChanging(); + if ( xEdge > 0.0 ) m_view.xEdge = xEdge; + if ( yEdge > 0.0 ) m_view.yEdge = yEdge; + if ( zEdge > 0.0 ) m_view.zEdge = zEdge; + parametersChanged(); + } + } + +//-------------------------------------------------------------// + +void QSAxes3D::setXEdgeLength( double length ) + { + if ( length > 0.0 ) { + SET_PROPERTY( m_view.xEdge, length ); + } + } + +//-------------------------------------------------------------// + +void QSAxes3D::setYEdgeLength( double length ) + { + if ( length > 0.0 ) { + SET_PROPERTY( m_view.yEdge, length ); + } + } + +//-------------------------------------------------------------// + +void QSAxes3D::setZEdgeLength( double length ) + { + if ( length > 0.0 ) { + SET_PROPERTY( m_view.zEdge, length ); + } + } + +//-------------------------------------------------------------// + +void QSAxes3D::drawAxis( QSAxis *axis ) + { + if ( axis->visible() ) + if ( axis->type() == QSAxis::XAxisType || + axis->type() == QSAxis::YAxisType || + axis->type() == QSAxis::ZAxisType ) { + QSPt3f f = t.furthest(); + QSPt3f l = t.left(); + QSPt3f p1( opposite_side(f.x), opposite_side(f.y), f.z ); + QSPt3f p2( opposite_side(f.x), opposite_side(f.y), f.z ); + + if ( axis->type() == QSAxis::ZAxisType ) p1 = p2 = QSPt3f( l.x, + l.y, + 0.0 ); + + if ( axis->oppositePosition() ) p1 = p2 = QSPt3f( opposite_side(p1.x), + opposite_side(p1.y), + opposite_side(p1.z) ); + // tic direction and length + QSPt3f d = p1 - f; + double xAxisScale; + double yAxisScale; + double zAxisScale; + double tic_len = 15.0 / 500.0; + get_axis_lengths( &xAxisScale, &yAxisScale, &zAxisScale ); + switch( axis->type() ) { + case QSAxis::XAxisType: p1.x = 0.0; p2.x = 1.0; d.x = 0.0; break; + case QSAxis::YAxisType: p1.y = 0.0; p2.y = 1.0; d.y = 0.0; break; + case QSAxis::ZAxisType: p1.z = 0.0; p2.z = 1.0; d.z = 0.0; break; + } + + // take care about thickness + for( int side=0; side<6; side++ ) { + if ( point_on_side(p1,side) && + point_on_side(p2,side) && + point_on_side( f,side) ) { + QSPt3f thick = thickness( side ); + p1 = p1 + thick; + p2 = p2 + thick; + } + } + + // take care about position + double pos = axis->defaultPosition() ? 0.0 : axis->position(); + p1 = p1 + QSPt3f( d.x*pos, d.y*pos, d.z*pos ); + p2 = p2 + QSPt3f( d.x*pos, d.y*pos, d.z*pos ); + + // draw axis line + m_drv->setLine( axis->line(QSAxis::AxisLine) ); + if ( axis->reversed() ) m_drv->drawArrow( t.world3DToCanvas(p2), t.world3DToCanvas(p1), axis->arrow1(), axis->arrow2() ); + else m_drv->drawArrow( t.world3DToCanvas(p1), t.world3DToCanvas(p2), axis->arrow1(), axis->arrow2() ); + + // draw tics and labels + int tic_nr = 0; + m_drv->setCurrentElement( QSAxes::GridCategory, axisIndex(axis) ); + QSGLine tic_line = axis->line(QSAxis::AxisLine); tic_line.style = QSGLine::Solid; + list<QSAxisTic>::const_iterator curr = axis->tics()->begin(); + list<QSAxisTic>::const_iterator last = axis->tics()->end(); + if ( !m_really_fast ) // a little hack for paintSkeleton + while ( curr != last ) { + if ( curr->m_major ) { + switch( axis->type() ) { + case QSAxis::XAxisType: p1.x = curr->m_pos; break; + case QSAxis::YAxisType: p1.y = curr->m_pos; break; + case QSAxis::ZAxisType: p1.z = curr->m_pos; break; + } + + p2 = p1 + QSPt3f( d.x*tic_len/xAxisScale, d.y*tic_len/yAxisScale, d.z*tic_len ); + if ( axis->ticsVisible() ) { + m_drv->setLine( tic_line ); + draw_line( p1, p2 ); + } + + double tic_shift = (tic_nr%2) ? axis->ticLabelPos2() : axis->ticLabelPos1(); + p2 = p2 + QSPt3f( tic_shift*d.x, tic_shift*d.y, tic_shift*d.z ); + m_drv->setFont( curr->m_font ); + m_drv->drawRTextBox( t.world3DToCanvas(p2), curr->m_angle, curr->m_label, get_label_align(p1,p2,axis->type()) ); + tic_nr++; + } + curr++; + } + + // draw title + m_drv->setFont( axis->font(QSAxis::TitleFont) ); + m_drv->setCurrentElement( QSAxes::AxisCategory, axisIndex(axis) ); + switch( axis->type() ) { + case QSAxis::XAxisType: p1.x = axis->titlePosition(); break; + case QSAxis::YAxisType: p1.y = axis->titlePosition(); break; + case QSAxis::ZAxisType: p1.z = axis->titlePosition(); break; + } + p2 = p1 + QSPt3f( axis->titleDistance()*d.x*4.0, + axis->titleDistance()*d.y*4.0, + axis->titleDistance()*d.z*4.0 ); + m_drv->drawText3( p2, axis->title(), get_label_align(p1,p2,axis->type()) ); + } + } + +//-------------------------------------------------------------// + +bool QSAxes3D::point_on_side( const QSPt3f& p, int side ) + { + QSPt3f p1( 0.0, 0.0, 0.0 ); + QSPt3f p2( 1.0, 1.0, 1.0 ); + QSPt3f pts[4]; + QSPt3f norm[5]; + get_side_wall( p1, p2, side, pts, norm ); + for( int i=0; i<4; i++ ) if ( pts[i] == p ) return true; + return false; + } + +//-------------------------------------------------------------// + +void QSAxes3D::drawGrid( QSAxis *axis, bool major ) + { + QSPt3f p1; + QSPt3f p2; + bool wall_visible; + + QSPt3f pts[4]; + QSPt3f norm[5]; + + if ( axis->visible() ) + if ( axis->type() == QSAxis::XAxisType || + axis->type() == QSAxis::YAxisType || + axis->type() == QSAxis::ZAxisType ) + for( int wall=0; wall<6; wall++ ) { + get_axis_wall( wall, &p1, &p2, &wall_visible ); + + bool has_grid = false; + if ( axis->oppositePosition() ) has_grid = d->has_grid_opposite[axis->type()][wall]; + else has_grid = d->has_grid[axis->type()][wall]; + + // draw thick wall side by side + if ( has_grid && wall_visible ) + for( int side=0; side<6; side++ ) { + get_side_wall( p1, p2, side, pts, norm ); + if ( visible(pts[0],norm[0]) ) draw_grid( axis, major, pts, norm ); + } + } + } + +//-------------------------------------------------------------// + +void QSAxes3D::draw_grid( QSAxis *axis, bool major, QSPt3f pts[4], QSPt3f norm[5] ) + { + QSPt3f p1 = pts[0]; + QSPt3f p2 = pts[2]; + switch( axis->type() ) { + case QSAxis::XAxisType: if ( p1.x == p2.x || ( p1.y == p2.y && p1.z == p2.z ) ) return; break; + case QSAxis::YAxisType: if ( p1.y == p2.y || ( p1.x == p2.x && p1.z == p2.z ) ) return; break; + case QSAxis::ZAxisType: if ( p1.z == p2.z || ( p1.x == p2.z && p1.y == p2.y ) ) return; break; + } + list<QSAxisTic>::const_iterator curr = axis->tics()->begin(); + list<QSAxisTic>::const_iterator last = axis->tics()->end(); + while ( curr != last ) { + if ( curr->m_major == major ) { + QSPt3f p[2]; + p[0] = pts[0]; + p[1] = pts[2]; + switch( axis->type() ) { + case QSAxis::XAxisType: p[0].x = p[1].x = curr->m_pos; break; + case QSAxis::YAxisType: p[0].y = p[1].y = curr->m_pos; break; + case QSAxis::ZAxisType: p[0].z = p[1].z = curr->m_pos; break; + } + + QSPt3f n[2]; + t.clipVertexNormals( pts, 4, p, 2, &norm[1], n ); + m_drv->setLine( curr->m_line ); + draw_line( p[0], p[1], n ); + } + curr++; + } + } + +//-------------------------------------------------------------// + +void QSAxes3D::get_side_wall( const QSPt3f& p1, const QSPt3f& p2, int side_nr, QSPt3f result_pts[4], QSPt3f result_norm[5] ) +// return a side wall parameters of a cube defined by p1, p2 + { + result_norm[0] = d->side_norms[side_nr]; + + QSPt3f min( QMIN(p1.x,p2.x), QMIN(p1.y,p2.y), QMIN(p1.z,p2.z) ); + QSPt3f max( QMAX(p1.x,p2.x), QMAX(p1.y,p2.y), QMAX(p1.z,p2.z) ); + + // make sure that all vertices are ordered in CW direction + bool *v_fir = d->v_fir; + bool *v_sec = d->v_sec; + if ( side_nr == 0 || side_nr == 3 || side_nr == 4 ) { v_fir = d->v_sec; v_sec = d->v_fir; } + + // one should point to v_min or v_max, another one to v_fir, and another to v_sec + bool *v_x = result_norm[0].x<0.0 ? d->v_min : ( result_norm[0].x>0.0 ? d->v_max : v_fir ); + bool *v_y = result_norm[0].y<0.0 ? d->v_min : ( result_norm[0].y>0.0 ? d->v_max : v_fir ); + bool *v_z = result_norm[0].z<0.0 ? d->v_min : ( result_norm[0].z>0.0 ? d->v_max : v_sec ); + if ( v_x == v_y ) v_y = v_sec; + for( int i=0; i<4; i++ ) { + if ( v_x[i] ) result_pts[i].x = max.x; else result_pts[i].x = min.x; + if ( v_y[i] ) result_pts[i].y = max.y; else result_pts[i].y = min.y; + if ( v_z[i] ) result_pts[i].z = max.z; else result_pts[i].z = min.z; + } + + // normal to vertices + for( int i=1; i<5; i++ ) { + result_norm[i] = result_norm[0]; + + // modified for a better look + if ( result_norm[i].x == 0.0 ) result_norm[i].x = result_pts[i-1].x == max.x ? 0.3 : -0.3; + if ( result_norm[i].y == 0.0 ) result_norm[i].y = result_pts[i-1].y == max.y ? 0.3 : -0.3; + if ( result_norm[i].z == 0.0 ) result_norm[i].z = result_pts[i-1].z == max.z ? 0.3 : -0.3; + result_norm[i] = t.normalize( result_norm[i] ); + } + } +//-------------------------------------------------------------// + +void QSAxes3D::get_axis_wall( int wall_nr, QSPt3f *result_p1, QSPt3f *result_p2, bool *visible ) + { + QSPt3f p1( 0.0, 0.0, 0.0 ); + QSPt3f p2( 1.0, 1.0, 1.0 ); + QSPt3f pts[4]; + QSPt3f norm[5]; + get_side_wall( p1, p2, wall_nr, pts, norm ); + + // draw only rear walls + QSPt3f f = t.furthest(); + *visible = false; for ( int i=0; i<4; i++ ) if ( pts[i] == f ) *visible = true; + + *result_p1 = pts[0]; + *result_p2 = pts[2] + thickness( wall_nr ); + } + +//-------------------------------------------------------------// + +QSPt3f QSAxes3D::thickness( int wall_nr ) + { + QSPt3f p1( 0.0, 0.0, 0.0 ); + QSPt3f p2( 1.0, 1.0, 1.0 ); + QSPt3f pts[4]; + QSPt3f norm[5]; + get_side_wall( p1, p2, wall_nr, pts, norm ); + return QSPt3f( norm[0].x*m_view.yzThick, + norm[0].y*m_view.xzThick, + norm[0].z*m_view.xyThick ); + } + +//-------------------------------------------------------------// + +bool QSAxes3D::visible( const QSPt3f& p, const QSPt3f& norm ) + { + if ( perspective() ) t.dvector = p - t.eye; + return ( t.dotProduct(norm,t.dvector) <= 0.0 ); + } + +//-------------------------------------------------------------// + +void QSAxes3D::draw_line( QSPt3f p1, QSPt3f p2, QSPt3f *normals ) + { + QSPt3f enormals[2]; + m_drv->drawLine3( p1, p2, normals ? normals : enormals ); + } +//-------------------------------------------------------------// + +double QSAxes3D::opposite_side( double value ) + { + return value < 0.5 ? 1.0 : 0.0; + } + +//-------------------------------------------------------------// + +void QSAxes3D::allocRuntimeData() + { + QSAxes::allocRuntimeData(); + d = new qsaxes3d_runtime_data(); + d->side_norms[0] = QSPt3f( 0.0, 0.0, -1.0 ); // min xy + d->side_norms[1] = QSPt3f( 0.0, 0.0, 1.0 ); // max xy + d->side_norms[2] = QSPt3f( 0.0, -1.0, 0.0 ); // min xz + d->side_norms[3] = QSPt3f( 0.0, 1.0, 0.0 ); // max xz + d->side_norms[4] = QSPt3f( -1.0, 0.0, 0.0 ); // min yz + d->side_norms[5] = QSPt3f( 1.0, 0.0, 0.0 ); // max yz + + bool v_max[4] = { true, true, true, true }; + bool v_min[4] = { false, false, false, false }; + bool v_fir[4] = { false, false, true, true }; + bool v_sec[4] = { false, true, true, false }; + + for( int i=0; i<4; i++ ) { + d->v_max[i] = v_max[i]; + d->v_min[i] = v_min[i]; + d->v_fir[i] = v_fir[i]; + d->v_sec[i] = v_sec[i]; + } + + d->wall_fills[0] = fill( XYWallFill ); + d->wall_fills[1] = fill( XYWallFill ); + d->wall_fills[2] = fill( XZWallFill ); + d->wall_fills[3] = fill( XZWallFill ); + d->wall_fills[4] = fill( YZWallFill ); + d->wall_fills[5] = fill( YZWallFill ); + + d->wall_lines[0] = line( XYWallLine ); + d->wall_lines[1] = line( XYWallLine ); + d->wall_lines[2] = line( XZWallLine ); + d->wall_lines[3] = line( XZWallLine ); + d->wall_lines[4] = line( YZWallLine ); + d->wall_lines[5] = line( YZWallLine ); + + for( int i=0; i<6; i++ ) + for( int j=0; j<6; j++ ) { + d->has_grid[i][j] = false; + d->has_grid_opposite[i][j] = false; + } + d->has_grid[QSAxis::XAxisType][0] = true; + d->has_grid[QSAxis::XAxisType][1] = true; + d->has_grid[QSAxis::YAxisType][0] = true; + d->has_grid[QSAxis::YAxisType][1] = true; + d->has_grid[QSAxis::ZAxisType][2] = true; + d->has_grid[QSAxis::ZAxisType][3] = true; + d->has_grid[QSAxis::ZAxisType][4] = true; + d->has_grid[QSAxis::ZAxisType][5] = true; + + d->has_grid_opposite[QSAxis::XAxisType][2] = true; + d->has_grid_opposite[QSAxis::XAxisType][3] = true; + d->has_grid_opposite[QSAxis::YAxisType][4] = true; + d->has_grid_opposite[QSAxis::YAxisType][5] = true; + d->has_grid_opposite[QSAxis::ZAxisType][2] = true; + d->has_grid_opposite[QSAxis::ZAxisType][3] = true; + d->has_grid_opposite[QSAxis::ZAxisType][4] = true; + d->has_grid_opposite[QSAxis::ZAxisType][5] = true; + } + +//-------------------------------------------------------------// + +void QSAxes3D::freeRuntimeData() + { + delete d; d = NULL; + QSAxes::freeRuntimeData(); + } + +//-------------------------------------------------------------// + +void QSAxes3D::stop() +// stop drawing now. +// Clean-up + { + if ( m_is_graphics_active ) { + m_is_graphics_active = false; + m_drv->stopDrawing(); + } + QSAxes::stop(); + } + +//-------------------------------------------------------------// + +void QSAxes3D::axisRangesCalculated() + { + assert( m_drv ); + init_3dtr(); + assert( !m_is_graphics_active ); + m_is_graphics_active = true; + m_drv->startDrawing(); + + //QSGFill f = background(); + //if ( !m_transparent && f.style == QSGFill::Transparent ) f = QSGFill(); + m_drv->clearCanvas( background(), QSPt2f( m_cpos.x, m_cpos.y ), QSPt2f( m_csize.x, m_csize.y ) ); + m_drv->setTopBottom( false ); + m_cnormals = m_drv->cNormals(); + m_ccolors = m_drv->cColors(); + m_corder = m_drv->cOrdering(); + if ( m_cnormals == QSDrv::NoNormals && m_view.lighted ) m_cnormals = QSDrv::MeshNormal; + //drawAxes( 1 ); + draw_box(); + if ( m_axes_only ) draw_arrow(); + QSAxes::axisRangesCalculated(); + } + +//-------------------------------------------------------------// +// cout << " norm " << norm[0].x << ","<< norm[0].y << "," << norm[0].z << endl; +void QSAxes3D::draw_box() + { + QSPt3f p1; + QSPt3f p2; + bool wall_visible; + QSPt3f pts[4]; + QSPt3f norm[5]; + QSGFill fills[4]; + + for( int wall=0; wall<6; wall++ ) { + get_axis_wall( wall, &p1, &p2, &wall_visible ); + if ( wall_visible ) { + for( int i=0; i<4; i++ ) fills[i] = d->wall_fills[wall]; + m_drv->setLine( d->wall_lines[wall] ); + m_drv->setFill( d->wall_fills[wall] ); + + // draw thick wall side by side + for( int side=0; side<6; side++ ) { + get_side_wall( p1, p2, side, pts, norm ); + if ( visible(pts[0],norm[0]) ) m_drv->drawPoly3( pts, 4, norm, fills ); + } + } + } + } + + + +//-------------------------------------------------------------// +//-------------------------------------------------------------// +//-------------------------------------------------------------// +//-------------------------------------------------------------// + +void QSAxes3D::paintPlot( QPainter *paint, double dpi, bool blocking, bool transparent ) + { + if ( paint ) + #ifdef HAVE_GL + if ( m_gl.enabled ) { + if ( m_internal_state == Busy ) stop(); + QSDrvOpenGL gl_drv; + gl_drv.setAlpha( m_gl.transparency ); + gl_drv.setShadeWalls( m_gl.shadewalls ); + gl_drv.setGlobalTransparency( m_gl.globaltr ); + gl_drv.setMeshAutoStroke( m_gl.autostroke ); + gl_drv.setAutoStrokeLightness( m_gl.autostrokel ); + gl_drv.setProjection( &t ); + gl_drv.setDC( paint, dpi, false ); + gl_drv.init( this ); + start( &gl_drv, blocking, transparent ); + } + else + #endif + { + if ( m_internal_state == Busy ) stop(); + QSDrvQt qt_drv; + qt_drv.setProjection( &t ); + qt_drv.setDC(paint,dpi,false); // do not delete QPainter + start( &qt_drv, blocking, transparent ); + } + } + +//-------------------------------------------------------------// + +void QSAxes3D::paintSkeleton( QPainter *p, double dpi, bool reallyFast ) + { + bool prev_gl = m_gl.enabled; + m_gl.enabled = false; + QSAxes::paintSkeleton( p, dpi, reallyFast ); + m_gl.enabled = prev_gl; + } + +//-------------------------------------------------------------// + +void QSAxes3D::drawPlot( QSDrv *init_drv, bool blocking, bool transparent ) + { + if ( init_drv ) { + if ( m_internal_state == Busy ) stop(); + init_drv->setProjection( &t ); + start( init_drv, blocking, transparent ); + } + } + +//-------------------------------------------------------------// +//-------------------------------------------------------------// +//-------------------------------------------------------------// +//-------------------------------------------------------------// + +//-------------------------------------------------------------// + +#define EPS 1e-5 + +int QSAxes3D::get_label_align( const QSPt3f& p1, const QSPt3f& p2, int axis ) + { + int halign = AlignHCenter; + int valign = AlignVCenter; + QSPt2f c1 = t.world3DToCanvas( p1 ); + QSPt2f c2 = t.world3DToCanvas( p2 ); + if ( c2.x - c1.x > EPS ) halign = AlignLeft; + if ( c2.x - c1.x < -EPS ) halign = AlignRight; + if ( c2.y - c1.y > EPS ) valign = AlignTop; + if ( c2.y - c1.y < -EPS ) valign = AlignBottom; + + + // Opps ! Corrrect this by hand + switch( axis ) { + case QSAxis::XAxisType: + case QSAxis::YAxisType: if ( valign == AlignVCenter ) valign = AlignTop; break; + case QSAxis::ZAxisType: valign = AlignVCenter; break; + } + + return halign | valign; + } + +//-------------------------------------------------------------// + + + +//-------------------------------------------------------------// +//-------------------------------------------------------------// +//-------------------------------------------------------------// +//-------------------------------------------------------------// + + + +void QSAxes3D::setOpenGL( bool enabled ) + { + SET_PROPERTY(m_gl.enabled,enabled); + } + +//-------------------------------------------------------------// + +void QSAxes3D::setAzimuth( int angle ) + { + angle = angle % 360; + if ( angle < 0 ) angle += 360; + SET_PROPERTY(m_view.azimuth,angle); + } + +//-------------------------------------------------------------// + +void QSAxes3D::setElevation( int angle ) + { + if ( angle > 90 ) angle = 90; + if ( angle < -90 ) angle = -90; + SET_PROPERTY(m_view.elevation,angle); + } + +//-------------------------------------------------------------// + +void QSAxes3D::setFocusDistance( int d ) + { + d = d % 51; + SET_PROPERTY( m_view.focus, d ); + } + +//-------------------------------------------------------------// + +void QSAxes3D::setDistance( int d ) + { + d = d % 51; + SET_PROPERTY( m_view.distance, d ); + } + +//-------------------------------------------------------------// + +void QSAxes3D::setLightAzimuth( int angle ) + { + angle = angle % 360; + if ( angle < 0 ) angle += 360; + SET_PROPERTY( m_view.lightAzimuth, angle ); + } + +//-------------------------------------------------------------// + +void QSAxes3D::setLightElevation( int angle ) + { + if ( angle > 90 ) angle = 90; + if ( angle < -90 ) angle = -90; + SET_PROPERTY( m_view.lightElevation, angle ); + } + +//-------------------------------------------------------------// + +void QSAxes3D::setDirectLight( int lightness ) + { + lightness = lightness % 51; + SET_PROPERTY( m_view.directLight, lightness ); + } + +//-------------------------------------------------------------// + +void QSAxes3D::setAmbientLight( int lightness ) + { + lightness = lightness % 51; + SET_PROPERTY( m_view.ambientLight, lightness ); + } + +//-------------------------------------------------------------// + +void QSAxes3D::setLight( bool enabled ) + { + SET_PROPERTY( m_view.lighted, enabled ); + } + +//-------------------------------------------------------------// + +void QSAxes3D::setPerspective( bool enabled ) + { + SET_PROPERTY( m_view.perspective, enabled ); + } + +//-------------------------------------------------------------// + +void QSAxes3D::setAutoscale( bool enabled ) + { + SET_PROPERTY( m_view.autoscale, enabled ); + } + +//-------------------------------------------------------------// + +void QSAxes3D::setWallThickness( double xy, double xz, double yz ) + { + if ( xy != m_view.xyThick || + xz != m_view.xzThick || + yz != m_view.yzThick ) { + parametersChanging(); + if ( xy >= 0.0 ) m_view.xyThick = xy; + if ( xz >= 0.0 ) m_view.xzThick = xz; + if ( yz >= 0.0 ) m_view.yzThick = yz; + parametersChanged(); + } + } + +//-------------------------------------------------------------// + +void QSAxes3D::setXYWallThickness( double thickness ) + { + if ( thickness > 0.0 ) { + SET_PROPERTY( m_view.xyThick, thickness ); + } + } + +//-------------------------------------------------------------// + +void QSAxes3D::setXZWallThickness( double thickness ) + { + if ( thickness > 0.0 ) { + SET_PROPERTY( m_view.xzThick, thickness ); + } + } + +//-------------------------------------------------------------// + +void QSAxes3D::setYZWallThickness( double thickness ) + { + if ( thickness > 0.0 ) { + SET_PROPERTY( m_view.yzThick, thickness ); + } + } + +//-------------------------------------------------------------// + +void QSAxes3D::glSetTransparency( bool enabled ) + { + SET_PROPERTY( m_gl.transparency, enabled ); + } + +//-------------------------------------------------------------// + +void QSAxes3D::glSetGlobalTransparency( int value ) + { + SET_PROPERTY( m_gl.globaltr, value ); + } + +//-------------------------------------------------------------// + +void QSAxes3D::glSetShadeWalls( bool enable ) + { + SET_PROPERTY( m_gl.shadewalls, enable ); + } + +//-------------------------------------------------------------// + +void QSAxes3D::glSetMeshAutoStroke( bool enable ) + { + SET_PROPERTY( m_gl.autostroke, enable ); + } + +//-------------------------------------------------------------// + +void QSAxes3D::glSetAutoStrokeLightness( int value ) + { + SET_PROPERTY( m_gl.autostrokel, value ); + } + + +//-------------------------------------------------------------// +//-------------------------------------------------------------// +//-------------------------------------------------------------// +//-------------------------------------------------------------// + + +void QSAxes3D::defaultSettings() + { + QSGColor c; + QSGLine line; + QSGFill fill; + + line.style = QSGLine::Solid; + line.color = c.set( 96, 96, 96 ); + m_settings.lines[XYWallLine] = line; + m_settings.lines[XZWallLine] = line; + m_settings.lines[YZWallLine] = line; + + fill.color = c.set( 224, 224, 224 ); + m_settings.fills[XYWallFill] = fill; + fill.color = c.set( 240, 240, 240 ); + m_settings.fills[XZWallFill] = fill; + m_settings.fills[YZWallFill] = fill; + } + +//-------------------------------------------------------------// + +void QSAxes3D::draw_arrow() + { + QSGLine l; + m_drv->setLine( l ); + + double xlen; + double ylen; + double zlen; + + get_axis_lengths( &xlen, &ylen, &zlen ); + + double m[4][4]; + + t.matrixI( m ); + + t.applyR( m, + 0.0, + m_view.lightElevation ); + + t.applyR( m, + 0.0, + 0.0, + -m_view.lightAzimuth); + + t.applyS( m, + 1.0/xlen, + 1.0/ylen, + 1.0/zlen ); + + t.applyS( m, 0.5, 0.5, 0.5 ); + t.applyT( m, 0.5, 0.5, 0.5 ); + + QSPt3f p1; + QSPt3f p2; + + draw_line( t.worldTransformation( m, p1.set( 0.0, 0.0, 0.0 ) ), + t.worldTransformation( m, p2.set( 0.0, 0.5, 0.5 ) ) ); + draw_line( t.worldTransformation( m, p1.set( 0.0, 0.5, 0.5 ) ), + t.worldTransformation( m, p2.set( 0.0, 0.5, 0.17 ) ) ); + draw_line( t.worldTransformation( m, p1.set( 0.0, 0.5, 0.17 ) ), + t.worldTransformation( m, p2.set( 0.0, 1.0, 0.17 ) ) ); + draw_line( t.worldTransformation( m, p1.set( 0.0, 1.0, 0.17 ) ), + t.worldTransformation( m, p2.set( 0.0, 1.0, -0.17 ) ) ); + draw_line( t.worldTransformation( m, p1.set( 0.0, 1.0, -0.17 ) ), + t.worldTransformation( m, p2.set( 0.0, 0.5, -0.17 ) ) ); + draw_line( t.worldTransformation( m, p1.set( 0.0, 0.5, -0.17 ) ), + t.worldTransformation( m, p2.set( 0.0, 0.5, -0.5 ) ) ); + draw_line( t.worldTransformation( m, p1.set( 0.0, 0.5, -0.5 ) ), + t.worldTransformation( m, p2.set( 0.0, 0.0, 0.0 ) ) ); + } + + +//-------------------------------------------------------------// + +void QSAxes3D::get_cube_min_max( QSPt3f* min, QSPt3f *max ) + { + min->set( 0.0, 0.0, 0.0 ); + max->set( 1.0, 1.0, 1.0 ); + for( int wall=0; wall<6; wall++ ) { + QSPt3f p1, p2; + bool visible; + get_axis_wall( wall, &p1, &p2, &visible ); + if ( visible ) { + min->set( QMIN(min->x,p1.x), QMIN(min->y,p1.y), QMIN(min->z,p1.z) ); + min->set( QMIN(min->x,p2.x), QMIN(min->y,p2.y), QMIN(min->z,p2.z) ); + max->set( QMAX(max->x,p1.x), QMAX(max->y,p1.y), QMAX(max->z,p1.z) ); + max->set( QMAX(max->x,p2.x), QMAX(max->y,p2.y), QMAX(max->z,p2.z) ); + } + } + } + +//-------------------------------------------------------------// + +void QSAxes3D::init_3dtr() + { + // + // Scale, transform and fit (1,1,1) cube + // y + // ^ / z + // | / + // --->x + + // transformation matrix + t.matrixI( t.M ); + t.matrixI( t.P ); + t.matrixI( t.T ); + + // make the z axis vertical + t.applyR( t.M, 0.0, -90.0 ); + + // shift to the middle + t.applyT( t.M, -0.5, -0.5, 0.5 ); + + // apply lengths set by user + double xAxisScale; + double yAxisScale; + double zAxisScale; + + get_axis_lengths( &xAxisScale, + &yAxisScale, + &zAxisScale ); + + t.applyS( t.M, + xAxisScale, + zAxisScale, + yAxisScale ); + + QSPt3f cmin; + QSPt3f cmax; + get_cube_min_max( &cmin, &cmax ); + double xlen = (cmax.x-cmin.x)*xAxisScale; + double ylen = (cmax.y-cmin.y)*yAxisScale; + double zlen = (cmax.z-cmin.z)*zAxisScale; + + // translate to make sure that all coordinates have + // z value lower than 0 ( see focus ). + double max_diagonal = sqrt( xlen*xlen + ylen*ylen + zlen*zlen ) / 2.0; + + // focus distance from 0 ( 1/101 ) to inf ( 101/1 ) + // normalize to max_diagonal + double focus = (51.0+focusDistance()) / + (51.0-focusDistance()) * + max_diagonal; + + double x1 = -1; + double x2 = 1; + double y1 = -1; + double y2 = 1; + double z1 = focus; + double z2 = focus+3*max_diagonal; + + if ( perspective() ) { + t.frustum( t.P, x1, x2, y1, y2, z1, z2 ); + t.setProjection( x1, x2, y1, y2, z1, z2, true ); + } else { + t.ortho( t.P, x1, x2, y1, y2, z1, z2 ); + t.setProjection( x1, x2, y1, y2, z1, z2, false ); + } + + // Scalling matrix. Because I don't know how to deal with frustums, + // wanting to fit axes to a view volume I always scale and fit to + // the cube. I apply modelview matrix, next + // projection matrix ( transforming frustrum into a cube ), fit to + // the cube and next apply the inversed projection matrix ( back to frustum ). . + // resulting modelview = M*P*S*P-1, resulting projection=P + // overall transform M*P*S*P-1*P = M*P*S + QSProjection3D::Matrix S; + t.matrixI( S ); + if ( autoscale() ) { + + t.applyR( t.M, + -azimuth(), + 0.0 ); + + t.applyR( t.M, + 0.0, + elevation() ); + + t.applyT( t.M, + 0.0, + 0.0, + -focus-1.01*max_diagonal ); // round-off errors + + // transformation needs min and max coordinates + // of an axis box to be set ( for autoscaling etc. ) + get_cube_min_max( &t.bmin, &t.bmax ); + + // autoscale + t.fit( S ); + + } else { + + // fit to screen only when graph is in arbitrary choosen positions. + QSProjection3D::Matrix oM; + + t.copy( oM, t.M ); + + double angle1 = t.radToDeg(atan(yAxisScale/xAxisScale)); + double angle2 = t.radToDeg(atan( sqrt(xAxisScale*xAxisScale+ + yAxisScale*yAxisScale) / + zAxisScale )); + + // check a scale ratio at the first position + t.applyR( t.M, + angle1, + angle2 ); + + t.applyT( t.M, + 0.0, + 0.0, + -focus-max_diagonal ); + + QSProjection3D::Matrix S1; + t.fit( S1 ); + + // the second position + t.copy( t.M, oM ); + + t.applyR( t.M, + angle1, + 90.0 ); + + t.applyT( t.M, + 0.0, + 0.0, + -focus-1.01*max_diagonal ); // round-off errors + + QSProjection3D::Matrix S2; + t.fit( S2 ); + + // apply a smaller scale ratio + if ( S1[0][0] < S2[0][0] ) t.copy( S, S1 ); + else t.copy( S, S2 ); + + // viewpoint + t.copy( t.M, oM ); + + t.applyR( t.M, + -azimuth(), + 0.0 ); + + t.applyR( t.M, + 0.0, + elevation() ); + + t.applyT( t.M, + 0.0, + 0.0, + -focus-max_diagonal ); + + // transformation needs min and max coordinates + // of an axis box to be set + get_cube_min_max( &t.bmin, &t.bmax ); + } + + // Scale set by user + double scale = (distance()+50.0)/50.0; + // tics not working well ( something wrong with drawLine in OpenGL + // when line starts at the border of the view volume ) + if ( scale == 1.0 ) scale = 0.99; + t.applyS( S, scale, scale, 1.0 ); + //cout << " S MATRIX " << endl; + //QSProjection3D::matrix_to_stdout( S ); + //cout << endl; + + // incorporate scale matrix in M matrix + QSProjection3D::Matrix P1; + t.inv( P1, t.P ); + + QSProjection3D::Matrix SCALE; + t.matrixI( SCALE ); + t.multiply( SCALE, t.P ); + t.multiply( SCALE, S ); + t.multiply( SCALE, P1 ); + //cout << " SCALE MATRIX " << endl; + //QSProjection3D::matrix_to_stdout( SCALE ); + //cout << endl; + + t.multiply( t.M, SCALE ); + + // make a general transformation matrix + t.copy( t.T, t.M ); + t.multiply( t.T, t.P ); + + // 0, 0 in the top-left corner + t.applyS( t.T, 1.0, -1.0, 1.0 ); + + // apply ( and remember ) the viewport transformation + t.applyViewport( t.T, m_cpos.x, m_cpos.y, m_csize.x, m_csize.y ); + t.setViewport( m_cpos.x, m_cpos.y, m_csize.x, m_csize.y ); + + // + // focus vector ( top/bottom detection ) + // + QSPt3f p; QSProjection3D::Matrix temp; + + t.inv( temp, t.M ); + t.eye = t.worldTransformation(temp, p.set(0.0,0.0,0.0)); + + if ( !perspective() ) + t.dvector = t.normalize( t.worldTransformation( temp, p.set(0.0, 0.0, -1.0) ) - t.eye ); + else + t.dvector = QSPt3f( 0.0, 0.0, 0.0 ); + + t.multiply( temp, t.M ); + + //-----------------------// + + // + // light vector in 3D world coordinates + // + t.matrixI( temp ); + + t.applyR( temp, + 0.0, + lightElevation() ); + + t.applyR( temp, + 0.0, + 0.0, + -lightAzimuth() ); + + t.applyS( temp, + 1.0/xAxisScale, + 1.0/yAxisScale, + 1.0/zAxisScale ); + + t.lvector = t.normalize( t.worldTransformation(temp, p.set(0.0, 1.0, 0.0)) ); + + t.setLight( light() ); + t.setLightParameters( t.lvector, ambientLight(), directLight() ); + } + +//-------------------------------------------------------------// + +void QSAxes3D::get_axis_lengths( double *x, double *y, double *z ) +// see set..AxisLength() + { + double xlen = m_view.xEdge; + double ylen = m_view.yEdge; + double zlen = m_view.zEdge; + + double min_len = min(min(xlen,ylen),zlen); + if ( x ) *x = xlen/min_len; + if ( y ) *y = ylen/min_len; + if ( z ) *z = zlen/min_len; + } + +//-------------------------------------------------------------// +//-------------------------------------------------------------// +//-------------------------------------------------------------// +//-------------------------------------------------------------// +//-------------------------------------------------------------// + +void QSAxes3D::initMappings( QSDrv *m_drv ) + { + QSAxes::initMappings( m_drv ); + if ( !state() ) { + allocRuntimeData(); + init_3dtr(); + freeRuntimeData(); + m_drv->startDrawing(); + m_drv->stopDrawing(); + } + } + +//-------------------------------------------------------------// + +QSPt3f QSAxes3D::mixedToCanvas( const QSPt3f& pos, CoordinateSystem in_coords[3], double dpi, QSAxis *xAxis, QSAxis *yAxis, QSAxis *zAxis ) const +// doesn't check if coordinates are right +// if there is at least one dataCoord or worldCoord all remaining normCoords and mmCoord are treaten as worldCoord + { + bool is_3d = false; + QSPt3f result = pos; + + if ( in_coords[0] == dataCoord ) { result.x = xAxis->dataToWorld( pos.x ); is_3d = true; } + if ( in_coords[1] == dataCoord ) { result.y = yAxis->dataToWorld( pos.y ); is_3d = true; } + if ( in_coords[2] == dataCoord ) { result.z = zAxis->dataToWorld( pos.z ); is_3d = true; } + + if ( in_coords[0] == worldCoord ) { result.x = pos.x; is_3d = true; } + if ( in_coords[1] == worldCoord ) { result.y = pos.y; is_3d = true; } + if ( in_coords[2] == worldCoord ) { result.z = pos.z; is_3d = true; } + + if ( is_3d ) { + result = t.world3DToCanvas3( result ); + } else { + if ( in_coords[0] == normCoord ) result.x = normalizedXToCanvas( pos.x ); + if ( in_coords[1] == normCoord ) result.y = normalizedYToCanvas( pos.y ); + if ( in_coords[2] == normCoord ) result.z = pos.z; + + if ( in_coords[0] == mmCoord ) result.x = QSCoord::mmToPixels( pos.x, dpi ); + if ( in_coords[1] == mmCoord ) result.y = QSCoord::mmToPixels( pos.y, dpi ); + if ( in_coords[2] == mmCoord ) result.z = QSCoord::mmToPixels( pos.z, dpi ); + } + + return result; + } + +//-------------------------------------------------------------// + +QSPt3f QSAxes3D::canvasToMixed( const QSPt3f& pos, CoordinateSystem out_coords[3], double dpi, QSAxis *xAxis, QSAxis *yAxis, QSAxis *zAxis ) const +// if there is at least one dataCoord or worldCoord all remaining normCoords and mmCoord are treaten as worldCoord + { + QSPt3f result; + + bool is_3d = false; + if ( out_coords[0] == worldCoord ) is_3d = true; + if ( out_coords[1] == worldCoord ) is_3d = true; + if ( out_coords[2] == worldCoord ) is_3d = true; + + result = t.canvas3ToWorld3D( pos ); + + if ( out_coords[0] == dataCoord ) { result.x = xAxis->worldToData( result.x ); is_3d = true; } + if ( out_coords[1] == dataCoord ) { result.y = yAxis->worldToData( result.y ); is_3d = true; } + if ( out_coords[2] == dataCoord ) { result.z = zAxis->worldToData( result.z ); is_3d = true; } + + if ( !is_3d ) { + if ( out_coords[0] == normCoord ) result.x = canvasToNormalizedX( pos.x ); + if ( out_coords[1] == normCoord ) result.y = canvasToNormalizedY( pos.y ); + if ( out_coords[2] == normCoord ) result.z = pos.z; + + if ( out_coords[0] == mmCoord ) result.x = QSCoord::pixelsToMM( pos.x, dpi ); + if ( out_coords[1] == mmCoord ) result.y = QSCoord::pixelsToMM( pos.y, dpi ); + if ( out_coords[2] == mmCoord ) result.z = QSCoord::pixelsToMM( pos.z, dpi ); + } + + return result; + } + +//-------------------------------------------------------------// + +void QSAxes3D::loadStateFromStream( QDataStream& stream, QSObjectFactory *factory ) + { + QSAxes::loadStateFromStream( stream, factory ); + } + +//-------------------------------------------------------------// + +void QSAxes3D::saveStateToStream( QDataStream& stream, QSObjectFactory *factory ) + { + QSAxes::saveStateToStream( stream, factory ); + } + + + + + + + + + + + + + + + diff --git a/kmatplot/widgets/qsaxes3d.h b/kmatplot/widgets/qsaxes3d.h new file mode 100644 index 0000000..7c6307a --- /dev/null +++ b/kmatplot/widgets/qsaxes3d.h @@ -0,0 +1,562 @@ +/*************************************************************************** + qsaxes3d.h + ------------------- + begin : 01-January-2000 + copyright : (C) 2000 by Kamil Dobkowski + email : kamildobk@poczta.onet.pl + ***************************************************************************/ + +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + + +#ifndef QSAXES3D_H +#define QSAXES3D_H + +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + +#include"qsaxes.h" +#include"qsprojection3d.h" + + + + +/** + * \brief Ordinary XYZ axes + * + * @author Kamil Dobkowski + */ +class QSAxes3D : public QSAxes + { + Q_OBJECT + Q_PROPERTY( bool openGL READ openGL WRITE setOpenGL ) + Q_PROPERTY( bool glTransparency READ glTransparency WRITE glSetTransparency ) + Q_PROPERTY( int glGlobalTransparency READ glGlobalTransparency WRITE glSetGlobalTransparency ) + Q_PROPERTY( bool glShadeWalls READ glShadeWalls WRITE glSetShadeWalls ) + Q_PROPERTY( bool glMeshAutoStroke READ glMeshAutoStroke WRITE glSetMeshAutoStroke ) + Q_PROPERTY( int glAutoStrokeLightness READ glAutoStrokeLightness WRITE glSetAutoStrokeLightness ) + + Q_PROPERTY( double xEdgeLength READ xEdgeLength WRITE setXEdgeLength ) + Q_PROPERTY( double yEdgeLength READ yEdgeLength WRITE setYEdgeLength ) + Q_PROPERTY( double zEdgeLength READ zEdgeLength WRITE setZEdgeLength ) + Q_PROPERTY( double xyWallThickness READ xyWallThickness WRITE setXYWallThickness ) + Q_PROPERTY( double xzWallThickness READ xzWallThickness WRITE setXZWallThickness ) + Q_PROPERTY( double yzWallThickness READ yzWallThickness WRITE setYZWallThickness ) + + Q_PROPERTY( int azimuth READ azimuth WRITE setAzimuth ) + Q_PROPERTY( int elevation READ elevation WRITE setElevation ) + Q_PROPERTY( int distance READ distance WRITE setDistance ) + Q_PROPERTY( int focusDistance READ focusDistance WRITE setFocusDistance ) + Q_PROPERTY( int lightAzimuth READ lightAzimuth WRITE setLightAzimuth ) + Q_PROPERTY( int lightElevation READ lightElevation WRITE setLightElevation ) + Q_PROPERTY( int directLight READ directLight WRITE setDirectLight ) + Q_PROPERTY( int ambientLight READ ambientLight WRITE setAmbientLight ) + + Q_PROPERTY( bool perspective READ perspective WRITE setPerspective ) + Q_PROPERTY( bool autoscale READ autoscale WRITE setAutoscale ) + Q_PROPERTY( bool light READ light WRITE setLight ) + + + public: + /** + * Constructor. + */ + QSAxes3D(QObject* parent=0, const char * name=0); + /** + * Destructor. + */ + virtual ~QSAxes3D(); + /** + * Reimplemented from @ref QSPlot::stop . + */ + void stop(); + /** + * + */ + void setOpenGL( bool enabled ); + /** + * OpenGL + */ + bool openGL() const { return m_gl.enabled; } + /** + * + */ + void glSetTransparency( bool enabled ); + /** + * Range <0,255> + */ + void glSetGlobalTransparency( int value ); + /** + * + */ + void glSetShadeWalls( bool enabled ); + /** + * + */ + void glSetMeshAutoStroke( bool enable ); + /** + * + */ + void glSetAutoStrokeLightness( int value ); + /** + * + */ + bool glTransparency() const { return m_gl.transparency; } + /** + * + */ + bool glShadeWalls() const { return m_gl.shadewalls; } + /** + * + */ + int glGlobalTransparency() const { return m_gl.globaltr; } + /** + * + */ + bool glMeshAutoStroke() const { return m_gl.autostroke; } + /** + * + */ + int glAutoStrokeLightness() const { return m_gl.autostrokel; } + /** + * Sets lenghts of the edges of the axis cube. + */ + void setEdgeLength( double xEdge, double yEdge, double zEdge ); + /** + * Sets lenght of the x edge. + */ + void setXEdgeLength( double lenght ); + /** + * Sets lenght of the x edge. + */ + void setYEdgeLength( double lenght ); + /** + * Sets lenght of the x edge. + */ + void setZEdgeLength( double lenght ); + /** + * Returns the lenght of the x edge. + */ + double xEdgeLength() const { return m_view.xEdge; } + /** + * Returns the lenght of the y edge. + */ + double yEdgeLength() const { return m_view.yEdge; } + /** + * Returns the lenght of the z edge. + */ + double zEdgeLength() const { return m_view.zEdge; } + /** + * Sets a thickness of the axis walls. + */ + void setWallThickness( double xy, double xz, double yz ); + /** + * Sets a thickness of the xy wall. + */ + void setXYWallThickness( double thickness ); + /** + * Sets a thickness of the xz wall. + */ + void setXZWallThickness( double thickness ); + /** + * Sets a thickness of the yz wall. + */ + void setYZWallThickness( double thickness ); + /** + * Returns a thickness of the xy wall. + */ + double xyWallThickness() const { return m_view.xyThick; } + /** + * Returns a thickness of the xz wall. + */ + double xzWallThickness() const { return m_view.xzThick; } + /** + * Returns a thickness of the yz wall. + */ + double yzWallThickness() const { return m_view.yzThick; } + /** + * Returns the current azimuth. + */ + int azimuth() const { return m_view.azimuth; } + /** + * Returns the current elevation. + */ + int elevation() const { return m_view.elevation; } + /** + * Returns the current distance. + */ + int distance() const { return m_view.distance; } + /** + * Returns the current focus distance. + */ + int focusDistance() const { return m_view.focus; } + /** + * Returns the current light source direction + */ + int lightAzimuth() const { return m_view.lightAzimuth; } + /** + * Returns the current light source direction. + */ + int lightElevation() const { return m_view.lightElevation; } + /** + * Returns the current intensity of the directed light source . + */ + int directLight() const { return m_view.directLight; } + /** + * Returns the current intensity of the ambient light source . + */ + int ambientLight() const { return m_view.ambientLight; } + /** + * Enables/disables the perspective projection. + */ + void setPerspective( bool enabled ); + /** + * Enables/disables the autoscale. If the autoscale is turned on, + * the graph size is fitted to the widget area ( when 'distance' is zero ). + * The graph size may change, when it is turned in the 3d space, to + * fit exactly to the widget. + */ + void setAutoscale( bool enabled ); + /** + * Enables/disables the light source. + */ + void setLight( bool enabled ); + /** + * Returns the current light setting. + */ + bool light() const { return m_view.lighted; } + /** + * Returns the current perspective setting. + */ + bool perspective() const { return m_view.perspective; } + /** + * Returns the current autoscale setting. + */ + bool autoscale() const { return m_view.autoscale; } + /** + * Sets all fonts, fills and lines to their default values. + */ + void defaultSettings(); + /** + * Returns transformation. + */ + const QSProjection3D *p3D() const { return &t; } + /** + * Reimplemented + */ + virtual void initMappings( QSDrv *drv ); + /** + * From mixed type coordinates to canvas. You can't mix world, data coordinates with other types, + * ( you can mix world and data of course ). Z can't be normCoordinate. + */ + virtual QSPt3f mixedToCanvas( const QSPt3f& pos, CoordinateSystem in_coords[3], double dpi, QSAxis *xAxis, QSAxis *yAxis, QSAxis *zAxis ) const; + /** + * From canvas to mixed coordinates. You can't mix world, data coordinates with other types + * ( you can mix world and data of course ). Z can't be normCoordinate. + */ + virtual QSPt3f canvasToMixed( const QSPt3f& pos, CoordinateSystem out_coords[3], double dpi, QSAxis *xAxis, QSAxis *yAxis, QSAxis *zAxis ) const; + /** + * Reimplemented + */ + virtual void paintPlot( QPainter *p, double dpi=72.0, bool blocking=true, bool transparent=true ); + /** + * Reimplemented + */ + virtual void drawPlot( QSDrv *drv, bool blocking=true, bool transparent=true ); + /** + * Reimpemented + */ + virtual void paintSkeleton( QPainter *p, double dpi=72.0, bool reallyFast=false ); + /** + * Just see QSGraphicalData::setFill() . + */ + enum FillElement { + BWallFill, + RWallFill, + XYWallFill, + XZWallFill, + YZWallFill + }; + /** + * Just see QSGraphicalData::setLine(). + */ + enum LineElement { BoxLine = 0, + TicsLine, + XYWallLine, + XZWallLine, + YZWallLine + }; + + virtual void loadStateFromStream( QDataStream& stream, QSObjectFactory *factory ); + virtual void saveStateToStream( QDataStream& stream, QSObjectFactory *factory ); + + public slots: + /** + * Sets the viewpoint position. Azimuth must be in the range < 0 deg, 359 deg >. + */ + void setAzimuth( int angle ); + /** + * Sets the viewpoint position. Elevation must be in the range <-90 deg, 90 deg> + */ + void setElevation( int angle ); + /** + * Sets the distance from the viewpoint to the screen. + * Value must be in the range < -50, 50 >. This means graph + * has its size in the range from 0% (-50), to 200 % (50). + * Zero ( 100% ) is default. + */ + void setDistance( int d ); + /** + * Sets the distance from the screen to the focus point. + * Value must be in the range < -50, 50 >. This means + * almost the same as 'distance()' for -50 and + * almost INF for (50). Default is 0. + * @see QSPlot3D::setPerspective + */ + void setFocusDistance( int d ); + /** + * Sets the direction of the light source. + * Value must be in the range <0, 359> deg. + * Light source is always directed to the center of the axis box. + * @see QSPlot3D::setLight + */ + void setLightAzimuth( int azimuth ); + /** + * Sets the direction of the light source. + * Value is in the range < -90, 90 deg >. + * @see QSPlot3D::setLight + */ + void setLightElevation( int elevation ); + /** + * Sets the intensity of the directed light source. + * Value must be in the range <-50, 50> + * @see QSPlot3D::setLight + */ + void setDirectLight( int lightness ); + /** + * Sets the intensity of the ambient light source. + * Value has to be in the range <-50, 50> + */ + void setAmbientLight( int lightness ); + + protected: + virtual void axisRangesCalculated(); + virtual void allocRuntimeData(); + virtual void freeRuntimeData(); + virtual void drawAxis( QSAxis *axis ); + virtual void drawGrid( QSAxis *axis, bool major ); + + private: + // drawing parameters + struct view_t { + + int azimuth; + int elevation; + int distance; + int focus; + int lightAzimuth; + int lightElevation; + int directLight; + int ambientLight; + bool lighted; + bool perspective; + bool autoscale; + double xEdge; + double yEdge; + double zEdge; + double xyThick; + double xzThick; + double yzThick; + } m_view; + + struct gl_t { + bool enabled; + bool transparency; + bool autostroke; + bool shadewalls; + int autostrokel; + int globaltr; + } m_gl; + + QSProjection3D t; + QSDrv::CNormals m_cnormals; + QSDrv::CColors m_ccolors; + QSDrv::COrdering m_corder; + + class qsaxes3d_runtime_data; + qsaxes3d_runtime_data *d; + + bool m_is_graphics_active; + void init_3dtr(); + void draw_arrow(); + void draw_box(); + void draw_grid( QSAxis *axis, bool major, QSPt3f p[4], QSPt3f norm[5] ); + void draw_line( QSPt3f p1, QSPt3f p2, QSPt3f *normals = NULL ); + void get_side_wall( const QSPt3f& p1, const QSPt3f& p2, int side_nr, QSPt3f result_pts[4], QSPt3f result_norm[5] ); + void get_axis_wall( int wall_nr, QSPt3f *p1, QSPt3f *p2, bool *visible ); + void get_axis_lengths( double *xaxis_scale, double *yaxis_scale, double *zaxis_scale ); + void get_cube_min_max( QSPt3f* min, QSPt3f *max ); + int get_label_align( const QSPt3f& p1, const QSPt3f& p2, int axis ); + bool visible( const QSPt3f& p, const QSPt3f& norm ); + double opposite_side( double value ); + QSPt3f thickness( int wall_nr ); + bool point_on_side( const QSPt3f& p, int side ); + + }; + +/** + * \example demo3d.cpp + * + * Example of how to use QSAxes2D + */ + +#endif + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/kmatplot/widgets/qsaxis.cpp b/kmatplot/widgets/qsaxis.cpp new file mode 100644 index 0000000..2ddd27e --- /dev/null +++ b/kmatplot/widgets/qsaxis.cpp @@ -0,0 +1,1054 @@ +/*************************************************************************** + qsaxis.cpp + ------------------- + begin : + + copyright : (C) 2001 by Kamil Dobkowski + email : kamildobk@poczta.onet.pl + ***************************************************************************/ + +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + +#include"qsaxis.h" +#include<assert.h> +#include<qregexp.h> +#include<algo.h> + + +//-------------------------------------------------------------// +//-------------------------------------------------------------// +//-------------------------------------------------------------// +//-------------------------------------------------------------// +//-------------------------------------------------------------// + + +QSAxisTic::QSAxisTic( double value, bool major ) + { + m_value = value; + m_major = major; + m_pos = 0.0; + m_angle = 0; + m_is_fill_defined = false; + } + +//-------------------------------------------------------------// + +QSAxisTic::~QSAxisTic() + { + } + +//-------------------------------------------------------------// + +/* +bool QSAxisTic::operator<( const QSAxisTic& t ) + { + return m_value < t.m_value ; + } +*/ + +//-------------------------------------------------------------// +//-------------------------------------------------------------// +//-------------------------------------------------------------// +//-------------------------------------------------------------// +//-------------------------------------------------------------// + +const double QSAxis::minScaleBase = 1.001; +const double QSAxis::minLogValue = 1e-200; +const double QSAxis::minRange = 1e-200; +const double QSAxis::minRangeValue = -1e200; +const double QSAxis::maxRangeValue = 1e200; + + +QSAxis::QSAxis( AxisType type, QSAxes *parentAxes, const char *name ) +:QSAxesChild( parentAxes, name ) + { + m_type = type; + m_visible = true; + m_opposite = false; + m_scale = LinearScale; + m_round = false; + m_reversed = false; + m_scrollable = true; + m_default = true; + m_pos = 0.0; + m_min = 0.0; + m_max = 0.0; + m_vmin = 1.0; + m_vmax = 10.0; + m_dmax = 0.0; + m_dmin = 0.0; + m_majd = -4.0; + m_mind = -20.0; + m_base = 10.0; + m_wscale = 1.0; + m_wmin = 0.0; + m_tics_angle = 0; + m_tics_outer = false; + m_tics_visible = true; + m_tics_format = "(TIC)"; + m_tic_label_pos1 = 0.01; + m_tic_label_pos2 = 0.01; + m_title_position = 0.5; + m_title_distance = 0.05; + + switch( m_type ) { + case XAxisType: setTitle( "X" ); break; + case YAxisType: setTitle( "Y" ); break; + case ZAxisType: setTitle( "Z" ); break; + case VAxisType: setTitle( "V" ); m_mind = 0.0; break; + } + for( int i=0; i<3; i++ ) rememberCurrentView( i ); + + static const int CHANNELS_NUM = 4; + static const int FONTS_NUM = 2; + static const int FILLS_NUM = 0; + static const int LINES_NUM = 3; + static const int POINTS_NUM = 0; + initChannelTable( CHANNELS_NUM ); + initAttributeTables( FONTS_NUM, FILLS_NUM, LINES_NUM, POINTS_NUM ); + + m_settings.lines[MajorGridLine].style = QSGLine::Invisible; + m_settings.lines[MinorGridLine].style = QSGLine::Invisible; + } + +//-------------------------------------------------------------// + +QSAxis::~QSAxis() + { + } + //-------------------------------------------------------------// + +void QSAxis::setTitlePosition( double value ) + { + SET_PROPERTY( m_title_position, value ); + } + +//-------------------------------------------------------------// + +void QSAxis::setTitleDistance( double value ) + { + SET_PROPERTY( m_title_distance, value ); + } + +//-------------------------------------------------------------// + +void QSAxis::setTicLabelPos1( double pos ) + { + SET_PROPERTY( m_tic_label_pos1, pos ); + } + +//-------------------------------------------------------------// + +void QSAxis::setTicLabelPos2( double pos ) + { + SET_PROPERTY( m_tic_label_pos2, pos ); + } + +//-------------------------------------------------------------// + +void QSAxis::setVisible( bool enabled ) + { + SET_PROPERTY( m_visible, enabled ); + } + +//-------------------------------------------------------------// + +void QSAxis::setOppositePosition( bool enabled ) + { + SET_PROPERTY( m_opposite, enabled ); + } + +//-------------------------------------------------------------// + +void QSAxis::setDefaultPosition( bool enabled ) + { + SET_PROPERTY( m_default, enabled ); + } + +//-------------------------------------------------------------// + +void QSAxis::setScrollable( bool enabled ) + { + SET_PROPERTY( m_scrollable, enabled ); + } + +//-------------------------------------------------------------// + +void QSAxis::setArrow1( const QSGArrow& arrow ) + { + SET_PROPERTY( m_arrow1, arrow ); + } + +//-------------------------------------------------------------// + +void QSAxis::setArrow2( const QSGArrow& arrow ) + { + SET_PROPERTY( m_arrow2, arrow ); + } + +//-------------------------------------------------------------// + +void QSAxis::set_arrow1_property( const QString& data ) + { + setArrow1(toQSGArrow(data)); + } + +//-------------------------------------------------------------// + +void QSAxis::set_arrow2_property( const QString& data ) + { + setArrow2(toQSGArrow(data)); + } + +//-------------------------------------------------------------// + +QString QSAxis::arrow1_property() const + { + return toQString(arrow1()); + } + +//-------------------------------------------------------------// + +QString QSAxis::arrow2_property() const + { + return toQString(arrow2()); + } + +//-------------------------------------------------------------// + +void QSAxis::setRange( double min, double max ) + { + if ( min > max ) { double temp = min; min = max; max = temp; } + if ( max == min ) max = min = 0.0; + if ( m_min != min || m_max != max ) { + parametersChanging(); + if ( m_min != min ) m_min = min; + if ( m_max != max ) m_max = max; + parametersChanged(); + } + } + +//-------------------------------------------------------------// + +void QSAxis::setRangeMin( double min ) + { + if ( min != m_min ) { + parametersChanging(); + m_min = min; + parametersChanged(); + } + } + +//-------------------------------------------------------------// + +void QSAxis::setRangeMax( double max ) + { + if ( max != m_max ) { + parametersChanging(); + m_max = max; + parametersChanged(); + } + } + +//-------------------------------------------------------------// + +void QSAxis::setScale( AxisScale scale, double base ) + { + if ( scale != LinearScale && scale != LogScale ) return; + if ( base < minScaleBase ) base = minScaleBase; + + if ( scale != m_scale || base != m_base ) { + parametersChanging(); + m_scale = scale; + m_base = base; + parametersChanged(); + } + } + +//-------------------------------------------------------------// + +void QSAxis::setScaleType( int scale ) + { + if ( scale != LinearScale && scale != LogScale ) return; + SET_PROPERTY( m_scale, (AxisScale )scale ); + } + +//-------------------------------------------------------------// + +void QSAxis::setScaleBase( double base ) + { + if ( base < minScaleBase ) base = minScaleBase; + SET_PROPERTY( m_base, base ); + } + +//-------------------------------------------------------------// + +void QSAxis::setPosition( double pos ) + { + if ( m_pos != pos ) { + parametersChanging(); + if ( pos == 0.0 ) m_default = true; + else m_default = false; + m_pos = pos; + parametersChanged(); + } + } + +//-------------------------------------------------------------// + +void QSAxis::setTicsFormat( const QString& format ) + { + SET_PROPERTY( m_tics_format, format ); + } + +//-------------------------------------------------------------// + +void QSAxis::setReversed( bool reversed ) + { + SET_PROPERTY( m_reversed, reversed ); + } + +//-------------------------------------------------------------// + +double QSAxis::min( AxisRange type ) const + { + switch( type ) { + case RangeSet: return m_min ; break; + case RangeVisible: return m_vmin; break; + case RangeData: return m_dmin; break; + } + + return 1.0; + } + +//-------------------------------------------------------------// + +double QSAxis::max( AxisRange type ) const + { + switch( type ) { + case RangeSet: return m_max ; break; + case RangeVisible: return m_vmax; break; + case RangeData: return m_dmax; break; + } + return 10.0; + } + +//-------------------------------------------------------------// + +void QSAxis::setRoundRangeToTicStep( bool enabled ) + { + SET_PROPERTY( m_round, enabled ); + } + +//-------------------------------------------------------------// + +void QSAxis::setGridStep( double major, double minor ) + { + if ( m_majd != major || + m_mind != minor ) { + parametersChanging(); + m_majd = major; + m_mind = minor; + parametersChanged(); + } + } + +//-------------------------------------------------------------// + +void QSAxis::setMajorGridStep( double step ) + { + SET_PROPERTY( m_majd, step ); + } + +//-------------------------------------------------------------// + +void QSAxis::setMinorGridStep( double step ) + { + SET_PROPERTY( m_mind, step ); + } + +//-------------------------------------------------------------// + +void QSAxis::setTicsOuter( bool enabled ) + { + SET_PROPERTY( m_tics_outer, enabled ); + } + +//-------------------------------------------------------------// + +void QSAxis::setTicsVisible( bool visible ) + { + SET_PROPERTY( m_tics_visible, visible ); + } + +//-------------------------------------------------------------// + +void QSAxis::setTicsAngle( int angle ) + { + SET_PROPERTY( m_tics_angle, angle ); + } + +//-------------------------------------------------------------// + +#define QSAXES_MINUS_INF -10 +// +// w = (value-min)/(max-min) +// wscale = 1.0/(max-min) +// wmin = min/(max-min) +// +#define AXIS_TO_WORLD_LINEAR(value) (m_wscale*(value)-m_wmin) +// +// w = (log(value)-log(min))/(log(max)-log(min)) +// wscale = 1.0/[log10(logbase)*(log(max)-log(min))] +// wmin = log(min)/(log(max)-log(min)) +// +#define AXIS_TO_WORLD_LOG(value) ((value)>0.0?m_wscale*log10(value)-m_wmin:QSAXES_MINUS_INF) +// +// Summary: +// +#define AXIS_TO_WORLD_NORMAL(value) (m_scale==LinearScale?AXIS_TO_WORLD_LINEAR(value):AXIS_TO_WORLD_LOG(value)) +#define AXIS_TO_WORLD(w) (m_reversed?1.0-AXIS_TO_WORLD_NORMAL(w):AXIS_TO_WORLD_NORMAL(w)) + +//-------------------------------------------------------------// + +double QSAxis::dataToWorld( double value ) const + { + return AXIS_TO_WORLD(value); + } + +//-------------------------------------------------------------// + +// +// value = w*(max-min)+min +// wscale = 1.0/(max-min) +// wmin = min/(max-min) +// +#define WORLD_TO_AXIS_LINEAR(w) (((w)+m_wmin)/m_wscale) +// +// value = 10^(w*(log(max)-log(min))+log(min)) +// wscale = 1.0/[log10(logbase)*(log(max)-log(min))] +// wmin = log(min)/(log(max)-log(min)) +// +#define WORLD_TO_AXIS_LOG(w) (pow(10,(w+m_wmin)/m_wscale)) +// +// Summary: +// +#define WORLD_TO_AXIS_NORMAL(w) (m_scale==LinearScale?WORLD_TO_AXIS_LINEAR(w):WORLD_TO_AXIS_LOG(w)) +#define WORLD_TO_AXIS(w) (m_reversed?WORLD_TO_AXIS_NORMAL(1.0-(w)):WORLD_TO_AXIS_NORMAL(w)) + +//-------------------------------------------------------------// + +double QSAxis::worldToData( double value ) const + { + return WORLD_TO_AXIS(value); + } + +//-------------------------------------------------------------// + +void QSAxis::initAxis( double dataMin, double dataMax, bool is_data ) + { + m_dmin = dataMin; + m_dmax = dataMax; + init_ranges(is_data); + init_axis_mappings(); + init_tics(); + } + +//-------------------------------------------------------------// + +void QSAxis::init_ranges( bool is_data ) + { + double visible_min = 1.0; + double visible_max = 10.0; + + if ( m_min < m_max ) { + // user set range + visible_min = m_min; + visible_max = m_max; + } else { + if ( is_data ) + if ( m_dmax > m_dmin ) { + // auto-calculated range 1 + visible_min = m_dmin; + visible_max = m_dmax; + } else { + // auto-calculated range 2 + visible_min = floor( m_dmin ); + visible_max = ceil( m_dmax ); + } + } + + // NaN + if ( visible_min != visible_min ) visible_min = 0.0; + if ( visible_max != visible_max ) visible_max = 0.0; + + // visible_min must be ALWAYS > visible_max + if ( visible_min == visible_max ) { + // we are here only if floor( m_dmin ) == ceil( m_dmax ) + visible_min -= 1.0; + visible_max += 1.0; + } + if ( visible_min >= visible_max ) { + // only if some NaN + visible_max = visible_min + 1.0; + } + + // adjust log scale + if ( m_scale == LogScale && visible_min < minLogValue ) { + visible_min = minLogValue; + if ( visible_max <= visible_min ) visible_max = 1.0; + } + + // max values + visible_min = QMAX( visible_min, minRangeValue ); + visible_max = QMIN( visible_max, maxRangeValue ); + + // min range + if ( visible_max-visible_min < minRange ) { + if ( visible_min + minRange <= maxRangeValue ) visible_max = visible_min + minRange; + else visible_min = visible_max - minRange; + } + + m_vmin = visible_min; + m_vmax = visible_max; + } + +//-------------------------------------------------------------// + +void QSAxis::init_axis_mappings() + { + double min = m_vmin; + double max = m_vmax; + if ( m_scale==LogScale ) { + min = _log( min, m_base ); + max = _log( max, m_base ); + } + + m_wmin = min/(max-min); + m_wscale = 1.0/(max-min); + + if ( m_scale==LogScale ) m_wscale = m_wscale/log10(m_base); + } + +//-------------------------------------------------------------// + +void QSAxis::find_closest( double *valM, int *valE, const double MSD[], int MSD_number ) +// Rounds valM*10^valE to closest value that have the most significant digit +// as in table MSD. MSD must contain numbers in range < 1.0, 10.0 ). Numbers +// with more than one digit are allowed. + { + double d1, d2; + double resultM; + int resultE; + + int i; + + if ( MSD_number > 0 ) { + double minMSD = MSD[0]; + double maxMSD = MSD[0]; + + for ( i=0; i< MSD_number; i++ ) { + if ( MSD[i] < minMSD ) minMSD = MSD[i]; + if ( MSD[i] > maxMSD ) maxMSD = MSD[i]; + } + + // check max(MSD[]) * 10^(valE-1) + d1 = fabs(*valM - 0.1*maxMSD); + resultM = maxMSD; + resultE = *valE-1; + + // check all values: MSD[]*10^valE + for( i=0; i < MSD_number; i++ ) { + d2 = fabs(*valM - MSD[i]); + if ( d2 < d1 ) { + d1 = d2; + resultM = MSD[i]; + resultE = *valE; + } + } + + // check min(MSD[]) * 10^(valE+1) + d2 = fabs(*valM - 10.0*minMSD); + if ( d2 < d1 ) { + resultM = minMSD; + resultE = *valE+1; + } + + *valM = resultM; + *valE = resultE; + } + } + +//-------------------------------------------------------------// + +void QSAxis::to_float_point( double value, double *mantissa, int *exponent ) +// Decompose 'value' into 'mantissa'*10^'exponent' +// Mantissa is in the range <1.0, 10.0) +// value must be greater than 0. + { + if ( value > 0.0 ) { + int e = (int )floor( log10(value) ); + if ( mantissa ) *mantissa = value/pow(10.0,e); + if ( exponent ) *exponent = e; + } else { + if ( mantissa ) *mantissa = value; + if ( exponent ) *exponent = 1; + } + + } + + /* + int e = 0; + while( value >= 10.0 ) { e+=1; value/=10.0; } + while( value < 1.0 && value > 0 ) { e-=1; value*=10.0; } + */ + +//-------------------------------------------------------------// + +void QSAxis::init_tics() + { + m_tics.erase( m_tics.begin(), m_tics.end() ); + + // Default Style for auto-generated tics + init_auto_tics_values(); + list<QSAxisTic>::iterator curr_tic = m_tics.begin(); + list<QSAxisTic>::iterator end_tic = m_tics.end(); + while ( curr_tic != end_tic ) { + curr_tic->m_pos = dataToWorld(curr_tic->m_value); + curr_tic->m_font = font( TicsFont ); + curr_tic->m_angle = m_tics_angle; + if ( curr_tic->m_major ) { + curr_tic->m_line = line( MajorGridLine ); + sprintfTic(curr_tic->m_label,curr_tic->m_value); + } else { + curr_tic->m_line = line( MinorGridLine ); + } + curr_tic++; + }; + + // Add user tics + m_last_tic.m_value = m_vmin; + QSMatrix* tics_values = matrix(TicsChannel); + QSGFill default_fill; default_fill.color.set( 0, 0, 0 ); + if ( tics_values ) { + int cols = tics_values->cols(); + if ( cols > 0 ) + for ( int row=0; row<tics_values->rows(); row++ ) { + // default values + QSAxisTic new_tic( tics_values->value(row,0) ); + new_tic.m_pos = dataToWorld( new_tic.m_value ); + new_tic.m_angle = m_tics_angle; + new_tic.m_major = true; + sprintfTic( new_tic.m_label, new_tic.m_value); + + // user provided values ( if any ) + if ( cols > 1 && !tics_values->string(row,1).isEmpty() ) sprintfTic( new_tic.m_label, new_tic.m_value, tics_values->string(row,1) ); + if ( cols > 2 && !tics_values->string(row,2).isEmpty() ) new_tic.m_major = (bool )tics_values->value(row,2); + if ( cols > 3 && !tics_values->string(row,3).isEmpty() ) new_tic.m_angle = (int )tics_values->value(row,3); + + new_tic.m_line = lineFromData( matrix(LineStyles), row, 0, line( new_tic.m_major ? MajorGridLine : MinorGridLine ) ); + new_tic.m_font = fontFromData( matrix(FontStyles), row, 0, font( TicsFont ) ); + new_tic.m_fill = fillFromData( matrix(FillStyles), row, 0, default_fill ); + + // use provided fill or plot's default fill + if ( matrix(FillStyles) && + matrix(FillStyles)->rows() > row && + matrix(FillStyles)->cols() > 0 && + !matrix(FillStyles)->string(row,0).isEmpty() ) new_tic.m_is_fill_defined = true; + + // Only fill is important - how to fill area above the last level + if ( new_tic.m_value >= m_vmin && new_tic.m_value <= m_vmax ) m_tics.push_back( new_tic ); + else if ( new_tic.m_value > m_vmax && ( new_tic.m_value < m_last_tic.m_value || m_last_tic.m_value <= m_vmax) ) m_last_tic = new_tic; + } + } + // Sort tics + if ( !is_sorted(m_tics.begin(),m_tics.end()) ) m_tics.sort(); + + } + +//-------------------------------------------------------------// + + +void QSAxis::init_auto_tics_values() +// TODO: +// adjust when user tics are given, + { + double majnumber = m_majd; + double minnumber = m_mind; + + // no tics + if ( majnumber == 0.0 ) { + return; + } + + + //****************************************** + //* tics steps * + //****************************************** + + if ( majnumber > 0.0 ) { + // minor tics + if ( minnumber != 0.0 ) { + minnumber = fabs(minnumber); + for( double i=ceil(m_vmin/minnumber)*minnumber; i<m_vmax; i+=minnumber ) + m_tics.push_back( QSAxisTic(i,false) ); + } + // major tics + for( double i=ceil(m_vmin/majnumber)*majnumber; i<m_vmax; i+=majnumber ) + m_tics.push_back( QSAxisTic(i,true) ); + return; + } + + //****************************************** + //* tics density * + //****************************************** + + majnumber = fabs(majnumber); + minnumber = fabs(minnumber); + + double max; + double min; + + if ( m_scale == LinearScale ) { + max = m_vmax/m_base; + min = m_vmin/m_base; + } else { + max = _log( m_vmax, m_base ); + min = _log( m_vmin, m_base ); + } + + double M; + int E; + + // preferred distance - in the next step it wiil be rounded + // to find some good-looking value. + double d = ( max - min ) / majnumber; + + double base = m_base; + AxisScale s = m_scale; + + // + // log scale that will have linear tics + // + // if step is lower than 1 and no tic base^integer is visible + // use an ordinary linear grid + // 11 (11.2) (11.4) (11.6) (11.8) 12 + if ( s == LogScale && d <= 1.5 && floor(max) < min ) { + + base = 10.0; + + s = LinearScale; + d = (pow( base, max ) - pow( base, max-d )) / base; + max = pow( base, max ) / base; + min = pow( base, min ) / base; + } + + // + // ------------ Log-Linear (logit ) scale ------------- + // + // if step is one, or is lower than 1 but at least + // one tic base^integer is visible. + // (10^1) 20 30 40 50 60 70 80 90 (10^2) 100 200 300 400 500 ... + if ( s == LogScale && d <= 1.5 && floor(max) >= min ) { + + // fill the list + // major step is always base^1 + if ( m_round ) { + max = ceil( max ); + min = floor( min ); + + m_vmin = pow( base, min ); + m_vmax = pow( base, max ); + } + + int minor = 0; + int step = 1; + + // try to adjust the minor tics number according to + // the given value of minnumber + if ( minnumber>0.0 ) { + minor = int(ceil(base))-1; + step = int(floor( minor * (max-min) / minnumber + 0.5 )); if ( step < 1 ) step = 1; + minor = minor/step; + } + + for ( double i = floor(min); i<=max; i+=1.0 ) { + + if ( i >= min ) m_tics.push_back( QSAxisTic(pow(base,i)) ); + + if ( minnumber ) { + to_float_point( pow(base,i), &M, &E ); // minor tic step + + double mind = floor( M ) * pow( 10.0, E ) * step; + + for( int j=0; j<minor-1; j++ ) { + double minpos = pow(base,i)+(j+1.0)*mind; + if ( minpos >= m_vmin && + minpos <= m_vmax ) + m_tics.push_back( QSAxisTic(minpos,false) ); + } + } + } + + return; + } + + // + // ----------- Log scale ---------------------------- + // + // step is greater than 1. + // scale is of the form - major (minor) (minor) ... + // 2^10 (2^12) (2^14) (2^16) (2^18) 2^20 .... + if ( s == LogScale && d >= 1.5 ) { + + double mind = 1.0; + + // minor step - round to integer value + if ( minnumber > 0.0 ) { + mind = (max-min) / minnumber; + mind = floor( mind+0.5 ); + if ( mind < 1.0 ) mind = 1.0; + } + + int MTN; + + // rounded major step + if ( d > mind ) { MTN = (int )floor( d/mind + 0.5 ); d = MTN*mind; } + else { MTN = 1; d = floor( d + 0.5 ); } + + if ( m_round ) { + max = ceil( max/d ) * d; + min = floor( min/d ) * d; + m_vmin = pow( base, min ); + m_vmax = pow( base, max ); + } + + for ( double i = floor(min); i<=max; i+=d ) { + if ( i >= min ) m_tics.push_back( QSAxisTic(pow(base,i)) ); + if ( minnumber ) + for( int j=0; j<MTN-1; j++ ) { + double minpos = i+(j+1)*mind; + if ( minpos >= min && minpos <= max ) + m_tics.push_back( QSAxisTic(pow(base,minpos),false) ); + + } + } + return; + } + + // + // -------- Linear scale ------------ + // + if ( s == LinearScale ) { + double r[7]; + + to_float_point( d, &M, &E ); + + double MSN = M; + + if ( E >=0 ) { + // round if step > 1.0 + // avaliable, the most significant numbers are: 1, 15, 2, 25, 3, 4, 5 + r[0] = 1.0; r[1] = 2.0; r[2] = 3.0; r[3] = 4.0; r[4] = 5.0; + find_closest( &MSN, &E, r, 5 ); + } else { + // round if step < 1.0 + // avialiable, the most significant numbers are: 1, 2, 5 + r[0] = 1.0; r[1] = 2.0; r[2] = 2.5; r[3] = 5.0; + find_closest( &MSN, &E, r, 4 ); + } + + double major = MSN*pow( 10.0, E )*base; + + double MTN; // minor tics per major tic + + if ( minnumber > 0.0 ) { + // Calculate preferred minor tick distance in data units + double mind = (max-min) / minnumber ; if ( mind <= 0.0 ) mind = 1.0; // assert( mind > 0.0 ); + + // minor tics number per major tick + to_float_point( MSN*pow( 10.0, E )/mind, &MTN, &E ); + + // round M to values 1, 2, 5, 2*MSN + r[0] = 1.0; r[1] = 2.0; r[2] = 2.0*MSN; r[3] = 5.0; + find_closest( &MTN, &E, r, 4 ); + } else { + // no minor tics + E = -1; + } + + // no minor tics + if ( E < 0 ) { MTN = 1.0; E = 0; } + + int minor = int(floor(MTN) * pow(10.0, E))-1; + + if ( m_round ) { + m_vmin = floor( m_vmin/major ) * major; + m_vmax = ceil( m_vmax/major ) * major; + init_axis_mappings(); + } + + // fill the list + double tic_first = floor(m_vmin/major)*major; + double tic_last = m_vmax; + double tic_value = tic_first; + int tic_number = (int )ceil((tic_last-tic_first)/major)+1; + for ( int i=0; i<tic_number; i++ ) { + if ( tic_value >= m_vmin && tic_value <= m_vmax ) m_tics.push_back( QSAxisTic(round_tic(tic_value)) ); + for( int j=0; j<minor; j++ ) { + double tic_minor_value = tic_value+(j+1.0)*major/(minor+1.0); + if ( tic_minor_value >= m_vmin && tic_minor_value <= m_vmax ) m_tics.push_back( QSAxisTic(round_tic(tic_minor_value),false) ); + } + tic_value += major; + } + } + } + +//cout << "adding tic " << round_tic(i) << " number " << QString::number((tic_to-tic_from)/major,'g',16) << endl; + +//-------------------------------------------------------------// + +double QSAxis::round_tic( double v ) + { + double almost_zero = (m_vmax-m_vmin) * 10e-14; + return fabs(v)<almost_zero?0.0:v; + } + +//-------------------------------------------------------------// + +void QSAxis::sprintfTic( QString& buffer, double value, const QString& format ) + { + double v[4]; + + // 0 - value + // 1 - factor + // 2 - base + // 3 - exponent + v[0] = value; + v[2] = m_base; + v[1] = (m_scale != LinearScale) ? 1.0 : value/v[2]; + v[3] = (m_scale == LinearScale) ? 1.0 : _log(value,v[2]); + + sprintfTic( buffer, format==QString::null?m_tics_format:format, v[0], v[1], v[2], v[3] ); + } + +//-------------------------------------------------------------// + +void QSAxis::sprintfTic( QString& buffer, const QString& tic_format, double value, double factor, double base, double exponent ) + { + + buffer = tic_format; + + int pos = 0; + int len = buffer.length(); + + while ( pos < len ) { + int beg = buffer.find( '(', pos ); if ( beg == -1 ) break; + int end = buffer.find( ')', beg ); if ( end == -1 ) break; + + QString format = buffer.mid( beg, end-beg+1 ); + + if ( format.find("TIC",0) != -1 ) { + int mpos = 0; + + // + // Default values + // + QString type("V"); + QString cformat("%g"); + + // + // Check type: + // V -value, + // B - base, + // F - factor, + // X - exponent + // + if ( (mpos=format.find(QRegExp("TYPE=\"[VFBX]\""),0)) != -1 ) + type = format.mid(mpos+6,1); + + // + // C-styled formatting codes. + // + QRegExp cstyle("FORMAT=\"%[\\-\\+\\s]*[0-9]*\\.?[0-9]*[fFgGeE]\""); + if ( (mpos=format.find(cstyle,0)) != -1 ) + cformat = format.mid( mpos+8, format.find("\"",mpos+8)-mpos-8 ); + + + // + // Replace a marker vith a C-formatted value + // + QString result; + + if ( type == "F" ) result.sprintf( cformat, factor ); + else if ( type == "B" ) result.sprintf( cformat, base ); + else if ( type == "X" ) result.sprintf( cformat, exponent ); + else result.sprintf( cformat, value ); + + buffer.replace( beg, end-beg+1, result ); + end = beg + result.length() - 1; + } + + pos = end+1; + } + + } + +//-------------------------------------------------------------// + +void QSAxis::rememberCurrentView( int index ) + { + if ( index >=0 && index < 3 ) { + rememberedViews[index].min = m_min; + rememberedViews[index].max = m_max; + rememberedViews[index].base = m_base; + rememberedViews[index].scale = m_scale; + rememberedViews[index].round = m_round; + rememberedViews[index].reversed = m_reversed; + } + } + +//-------------------------------------------------------------// + +void QSAxis::setRememberedView( int index ) + { + if ( index >=0 && index < 3 ) { + setRange( rememberedViews[index].min, rememberedViews[index].max ); + setScaleType( rememberedViews[index].scale ); + setScaleBase( rememberedViews[index].base ); + setRoundRangeToTicStep( rememberedViews[index].round ); + setReversed( rememberedViews[index].reversed ); + } + } + +//-------------------------------------------------------------// + +void QSAxis::loadStateFromStream( QDataStream& stream, QSObjectFactory *factory ) + { + QSAxesChild::loadStateFromStream( stream, factory ); + } + +//-------------------------------------------------------------// + +void QSAxis::saveStateToStream( QDataStream& stream, QSObjectFactory *factory ) + { + QSAxesChild::saveStateToStream( stream, factory ); + } + +//-------------------------------------------------------------// + +QSAxis::ColumnType QSAxis::columnType( int channel, int column ) const + { + } + + + + + diff --git a/kmatplot/widgets/qsaxis.h b/kmatplot/widgets/qsaxis.h new file mode 100644 index 0000000..6939d6c --- /dev/null +++ b/kmatplot/widgets/qsaxis.h @@ -0,0 +1,510 @@ +/*************************************************************************** + qsaxis.h + ------------------- + version : 0.1 + begin : + copyright : (C) 2001 by Kamil Dobkowski + email : kamildobk@poczta.onet.pl + ***************************************************************************/ + +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + + +#ifndef QSAXIS_H +#define QSAXIS_H + +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + +#include"qsaxes.h" +#include<qstring.h> +#include<math.h> +#include<list.h> + + +//---------------------------------------------------------------------------------------------------// + +/** + * \brief Tic mark on the axis + * + * Tic mark on the axis. + * @author Kamil Dobkowski + */ +class QSAxisTic; +class QSAxisTic { + + public: + double m_value; // value of the tic + bool m_major; // major or minor tics + double m_pos; // tic position on axis in world coordnates + int m_angle; // label angle + QString m_label; + QSGFont m_font; + QSGLine m_line; + QSGFill m_fill; // used to fill area below the tic + bool m_is_fill_defined; + QSAxisTic( double value = 0.0, bool major = true ); + ~QSAxisTic(); + bool operator<( const QSAxisTic& t ) { return m_pos < t.m_pos; } + }; + +//---------------------------------------------------------------------------------------------------// + +/** + * MOC have problems if it is internal QSAxis class !. + */ +typedef struct { + double min; + double max; + double base; + int scale; + bool round; + bool reversed; + } axis_remembered_view_t; + +//---------------------------------------------------------------------------------------------------// + +/** + * \brief Single axis which can be added to QSAxes + * + * Axis. Its main funtion is to map values from data coordinates to world coordinates ( visible range on the axis + * is mapped to <0,1> ) - see dataToWorld() and from world coordinates to data - see worldToData(). + * It can also calculate its auto range and tic mark positions, see tics(). initAxis() forces to recalculate all + * parameters. QSAxes object holds a list of QSAxis child objects. See also QSAxes::CoordinateSystem + * @author Kamil Dobkowski + */ +class QSAxis : public QSAxesChild + { + Q_OBJECT + friend class QSAxes; + Q_PROPERTY( bool visible READ visible WRITE setVisible ) + Q_PROPERTY( bool oppositePosition READ oppositePosition WRITE setOppositePosition ) + Q_PROPERTY( bool defaultPosition READ defaultPosition WRITE setDefaultPosition ) + Q_PROPERTY( bool reversed READ reversed WRITE setReversed ) + Q_PROPERTY( bool scrollable READ scrollable WRITE setScrollable ) + + Q_PROPERTY( QString arrow1 READ arrow1_property WRITE set_arrow1_property ) + Q_PROPERTY( QString arrow2 READ arrow2_property WRITE set_arrow2_property ) + Q_PROPERTY( double min READ rangeMin WRITE setRangeMin ) + Q_PROPERTY( double max READ rangeMax WRITE setRangeMax ) + Q_PROPERTY( int scaleType READ scaleType WRITE setScaleType ) + Q_PROPERTY( double scaleBase READ scaleBase WRITE setScaleBase ) + Q_PROPERTY( double majorGridStep READ majorGridStep WRITE setMajorGridStep ) + Q_PROPERTY( double minorGridStep READ minorGridStep WRITE setMinorGridStep ) + + Q_PROPERTY( double position READ position WRITE setPosition ) + Q_PROPERTY( bool ticsVisible READ ticsVisible WRITE setTicsVisible ) + Q_PROPERTY( bool ticsOuter READ ticsOuter WRITE setTicsOuter ) + Q_PROPERTY( QString ticsFormat READ ticsFormat WRITE setTicsFormat ) + Q_PROPERTY( int ticsAngle READ ticsAngle WRITE setTicsAngle ) + Q_PROPERTY( bool roundRangeToTicStep READ roundRangeToTicStep WRITE setRoundRangeToTicStep ) + + Q_PROPERTY( double ticLabelPos1 READ ticLabelPos1 WRITE setTicLabelPos1 ) + Q_PROPERTY( double ticLabelPos2 READ ticLabelPos2 WRITE setTicLabelPos2 ) + Q_PROPERTY( double titlePosition READ titlePosition WRITE setTitlePosition ) + Q_PROPERTY( double titleDistance READ titleDistance WRITE setTitleDistance ) + + public: + /** + * Minimum logarithm value. Default is 1e-200 + */ + static const double minLogValue; + /** + * Minimum value of the logarithm base. Default is 1.001 + */ + static const double minScaleBase; + /** + * Minimum value shown on the axis. Default is -1e200 + */ + static const double minRangeValue; + /** + * Maximum value shown on the axis. Default is 1e200 + */ + static const double maxRangeValue; + /** + * Minimum rangeMax-rangeMin Default 1e-200 + */ + static const double minRange; + + /** + * The axis scale. + */ + enum AxisScale { LinearScale, LogScale }; + /** + * Requested axis range. See min() + */ + enum AxisRange { RangeSet, RangeVisible, RangeData }; + /** + * Type of the axis. + */ + enum AxisType { XAxisType, YAxisType, ZAxisType, VAxisType, UnknownAxisType }; + /** + * Constructor. You have to add the axis to the parent child list immediately - + * see QSAxes::axisAdd() + */ + QSAxis( AxisType type, QSAxes *parentAxes, const char *name=0 ); + /** + * Destructor + */ + virtual ~QSAxis(); + /** + * Maps value from an visible axis range to <0,1>. See QSAxes::CoordinateSystem + */ + double dataToWorld( double value ) const; + /** + * Maps a value from <0,1> to visible axis range. See QSAxes::CoordinateSystem + */ + double worldToData( double value ) const; + /** + * Returns the axis type. + */ + AxisType type() const { return m_type; } + /** + * Hides/shows an axis + */ + void setVisible( bool enabled ); + /** + * Places an axis on the opposite side. + */ + void setOppositePosition( bool enabled ); + /** + * Places an axis at a default position ( opposite or not ). + */ + void setDefaultPosition( bool enabled ); + /** + * Reverse direction of an axis. + */ + void setReversed( bool reversed ); + /** + * Sets if this axis should be scrolled when scrollbars are moved in a plot view.. + */ + void setScrollable( bool enabled ); + /** + * Returns if the axis is visible + */ + bool visible() const { return m_visible; } + /** + * Returns whether the axis is placed on the opposite side. + */ + bool oppositePosition() const { return m_opposite; } + /** + * Returns if axis is placed at a default position. + */ + bool defaultPosition() const { return m_default; } + /** + * Turns on a reversed direction on a given axis. + */ + bool reversed() const { return m_reversed; } + /** + * Returns a scrollable state + */ + bool scrollable() const { return m_scrollable; } + /** + * Sets a beginng arrow style. + */ + void setArrow1( const QSGArrow& arrow ); + /** + * Sets an ending arrow style + */ + void setArrow2( const QSGArrow& arrow ); + /** + * Returns a begging arrow style + */ + QSGArrow arrow1() const { return m_arrow1; } + /** + * Sets an ending arrow style. + */ + QSGArrow arrow2() const { return m_arrow2; } + /** + * Sets the range of the given axis to '< min, max >'. + * If 'min' == 'max', auto range is turned on. + */ + void setRange( double min, double max ); + /** + * Sets the range of the given axis to '< min, max >'. + * If 'min' == 'max', auto range is turned on. + */ + void setRangeMin( double min ); + /** + * Sets the range of the given axis to '< min, max >'. + * If 'min' == 'max', auto range is turned on. + */ + void setRangeMax( double max ); + /** + * Sets the axis scale type. + */ + void setScale( AxisScale scale, double base = 10.0 ); + /** + * Sets the axis scale type. + */ + void setScaleType( int scale ); + /** + * Sets the axis scale type. + */ + void setScaleBase( double base ); + /** + * Sets a position of the given axis in world coordinates. + */ + void setPosition( double pos ); + /** + * Returns the axis range . Notice that 'RangeSet' may be + * different from 'RangeVisible'. If you set range to + * <-10, 10> and turn on 'LogScale' the visible range will + * be <minLogValue,10>. 'RangeVisible' and + * 'RangeData' are calculated when plot is redrawn the first + * time ( parent axes object calls initAxis() ), so returned values may be invalid + * sometimes. You can call parentAxes()->initMappings() to force recalculation of ranges + * immediately. + */ + double min( AxisRange type = RangeSet ) const; + /** + * Returns the axis range . See min() + */ + double max( AxisRange type = RangeSet ) const; + /** + * Returns the axis range . See min() + */ + double rangeMin() const { return min(); } + /** + * Returns the axis range . See min() + */ + double rangeMax() const { return max(); } + /** + * Returns the current scale base. + */ + double scaleBase() const { return m_base; } + /** + * Returns the current scale type. + */ + int scaleType() const { return m_scale; } + /** + * Returns the current position. + */ + double position() const { return m_pos; } + /** + * Sets a new grid density. + */ + void setGridStep( double major = -4.0, double minor = -20.0 ); + /** + * Sets a new grid step/density. + */ + void setMajorGridStep( double step ); + /** + * Sets a new grid step/density. + */ + void setMinorGridStep( double step ); + /** + * Returns a major grid step/density. + */ + double majorGridStep() const { return m_majd; } + /** + * Returns a minor grid step/density. + */ + double minorGridStep() const { return m_mind; } + /** + * Tics are generated each time 'initAxis' is called. + */ + const list<QSAxisTic> *tics() const { return &m_tics; } + /** + * For internal use. Only + */ + const QSAxisTic &lastTic() const { return m_last_tic; } + /** + * Sets lengths of tics. + */ + void setTicsVisible( bool visible ); + /** + * Outer or inner tic marks.. + */ + void setTicsOuter( bool enabled ); + /** + * Sets the tics print format for the given axis. + */ + void setTicsFormat( const QString& format ); + /** + * Sets the angle of the tic label. + */ + void setTicsAngle( int angle ); + /** + * Adjust range for the given axis to contain an whole number of tic marks. + */ + void setRoundRangeToTicStep( bool enabled ); + /** + * Returns the label format. + */ + QString ticsFormat() const { return m_tics_format; } + /** + * Returns the tic label angle + */ + int ticsAngle() const { return m_tics_angle; } + /** + * Returns a major tic's length. + */ + bool ticsVisible() const { return m_tics_visible; } + /** + * Outer or inner tic marks + */ + bool ticsOuter() const { return m_tics_outer; } + /** + * Returns the adjust setting. + */ + bool roundRangeToTicStep() const { return m_round; } + /** + * Sets the distance from the axis of the odd tic labels. + */ + void setTicLabelPos1( double pos ); + /** + * Sets the distance from the axis of the even tic labels. + */ + void setTicLabelPos2( double pos ); + /** + * Returns the distance from the axis of the odd tic labels. + */ + double ticLabelPos1() const { return m_tic_label_pos1; } + /** + * Returns the distance from the axis of the even tic labels. + */ + double ticLabelPos2() const { return m_tic_label_pos2; } + /** + * Sets the position of the title ( parallel to the axis ) + */ + void setTitlePosition( double value ); + /** + * Sets the distance of the title from the axis + */ + void setTitleDistance( double value ); + /** + * Returns the position of the title ( parallel to the axis ) + */ + double titlePosition() const { return m_title_position; } + /** + * Returns the distance of the title from the axis + */ + double titleDistance() const { return m_title_distance; } + + /** + * Makes a text of the tic with value 'value' on axis 'axis' and + * writes it to 'buffer'. + */ + void sprintfTic( QString& buffer, double value, const QString& format = QString::null ); + /** + * Remembered view contains such parameters as axis min ,axis max, axis scale, axis reversed. + * Up to four different views can be remembered ( index must be in 0-3 ). + */ + virtual void rememberCurrentView( int index ); + + /** + * Sets the view properties + */ + virtual void setRememberedView( int index ); + + void set_arrow1_property( const QString& data ); + void set_arrow2_property( const QString& data ); + QString arrow1_property() const; + QString arrow2_property() const; + virtual ColumnType columnType( int channel, int column ) const; + virtual void loadStateFromStream( QDataStream& stream, QSObjectFactory *factory ); + virtual void saveStateToStream( QDataStream& stream, QSObjectFactory *factory ); + + /** + * Channels. + */ + enum Channels { + TicsChannel = 0, + LineStyles = 1, + FontStyles = 2, + FillStyles = 3 + }; + /** + * Line elements. + */ + enum LineElement { + AxisLine = 0, + MajorGridLine, + MinorGridLine + }; + /** + * Font elements. + */ + enum FontElement { + TitleFont = 0, + TicsFont + }; + + /** + * Makes a text of the tic with value 'value' with + * format 'format' and writes it to 'buffer'. + */ + static void sprintfTic( QString& buffer, const QString& format, double value, double factor, double base, double exponent ); + + axis_remembered_view_t rememberedViews[3]; + + protected: + /** + * This function is called by parent axes each time plot is repainted. + * It should calculate range, coordinate mappings and tic positions. + */ + virtual void initAxis( double dataMin, double dataMax, bool isData = true ); + + private: + bool m_visible; + AxisType m_type; // type of the axis + bool m_opposite; + bool m_default; // default position + QSGArrow m_arrow1; + QSGArrow m_arrow2; + double m_min; // min set by user + double m_max; // max set by user + double m_vmin; // visible axis min + double m_vmax; // visible axis max + double m_dmax; // data min + double m_dmin; // data max + double m_base; // axis scale base + AxisScale m_scale; // scale type + double m_pos; // length proportional to other axes lengths + bool m_round; // adjust range to contain an integer number of tics. + bool m_reversed; // reversed axis direction + bool m_scrollable; + + double m_majd; // major density + double m_mind; // minor density + + QString m_tics_format; // format of tics values + bool m_tics_outer; // outer tics + bool m_tics_visible; // show tics + int m_tics_angle; + + double m_wscale; // see axisToWorld + double m_wmin; // see axisToWorld + + double m_tic_label_pos1; + double m_tic_label_pos2; + + double m_title_position; + double m_title_distance; + + + list<QSAxisTic> m_tics; // QList ?! + QSAxisTic m_last_tic; + + void init_axis_mappings(); + void init_ranges( bool is_data ); + void find_closest( double *valM, int *valE, const double MSD[], int MSD_number ); + void to_float_point( double value, double *mantissa, int *exponent ); + void init_tics(); + void init_auto_tics_values(); + double round_tic( double v ); + }; + +#endif + + + diff --git a/kmatplot/widgets/qschildlist.h b/kmatplot/widgets/qschildlist.h new file mode 100644 index 0000000..2fe4057 --- /dev/null +++ b/kmatplot/widgets/qschildlist.h @@ -0,0 +1,119 @@ +/*************************************************************************** + qschildlist.h - description + ------------------- + begin : Thu Aug 23 2001 + copyright : (C) 2001 by kamil + email : kamil@localhost.localdomain + ***************************************************************************/ + +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + +#ifndef QSCHILDLIST_H +#define QSCHILDLIST_H + +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + +#include<deque.h> + +/** + * \brief Internal class + * + * Class intended for internal use as a internal child list for QSData objects. + * You can also remember one iterator position, see setPosition() position(), + * current(). All object must not be allocated on a stack. This list doesn't allow NULL memebers. + * @author Kamil Dobkowski + */ +template<class CHILD_OBJECT> +class QSChildList { + public: + QSChildList( bool autoDelete = true ) { + m_index = 0; + m_auto_delete = autoDelete; + } + ~QSChildList() { + while( count() ) del(0); + } + void setPos( int index ) { + m_index = index; + } + int pos() const { + return m_index; + } + CHILD_OBJECT *current() const { + return operator[]( m_index ); + } + bool isValidPos() const { + return valid(m_index); + } + int count() const { + return (int )m_child_list.size(); + } + void add( CHILD_OBJECT *object ) { + insert( count(), object ); + } + void insert( int before_pos, CHILD_OBJECT *object ) { + before_pos = QMIN( before_pos, count() ); + before_pos = QMAX( before_pos, 0 ); + if ( object ) m_child_list.insert( m_child_list.begin()+before_pos, object ); + } + CHILD_OBJECT *remove( int index ) { + if ( valid(index) ) { + CHILD_OBJECT *object = m_child_list[index]; + m_child_list.erase( m_child_list.begin() + index ); + return object; + } + return NULL; + } + void del( int index ) { + if ( m_auto_delete ) delete remove(index); else remove(index); + } + void toFront( int index ) { + if ( valid(index) ) m_child_list.push_back( remove(index) ); + } + void toBack( int index ) { + if ( valid(index) ) m_child_list.push_front( remove(index) ); + } + void raise( int index ) { + if ( index<count()-1 ) reorder( index+1, index ); + } + void lower( int index ) { + if ( index>0 ) reorder( index-1, index ); + } + void reorder( int position, int index ) { + position = QMIN( position, count() ); + position = QMAX( position, 0 ); + if ( valid(index) ) { + CHILD_OBJECT *object = remove(index); + m_child_list.insert( m_child_list.begin() + position, object ); + } + } + int find( CHILD_OBJECT *object ) const { + for( int i=0; i<count(); i++ ) if ( m_child_list[i] == object ) return i; + return -1; + } + CHILD_OBJECT *operator[]( int index ) const { + return valid(index) ? m_child_list[index] : NULL; + } + inline bool valid( int index ) const { + return ( index<count() && index>=0 ); + } + inline bool autoDelete() const { + return m_auto_delete; + } + private: + int m_index; + bool m_auto_delete; + deque<CHILD_OBJECT*> m_child_list; + }; + +#endif + diff --git a/kmatplot/widgets/qsclegend.cpp b/kmatplot/widgets/qsclegend.cpp new file mode 100644 index 0000000..900e3d5 --- /dev/null +++ b/kmatplot/widgets/qsclegend.cpp @@ -0,0 +1,355 @@ +/*************************************************************************** + qslegend.cpp + ------------------- + begin : 01-January-2001 + copyright : (C) 2001 by Kamil Dobkowski + email : kamildobk@poczta.onet.pl + ***************************************************************************/ + +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + +#include"qsclegend.h" +#include"qsaxes.h" +#include"qsplot.h" + +const double QSCLegend::frmSpace = 10.0; +const double QSCLegend::rowSpace = 5.0; +const double QSCLegend::colSpace = 8.0; + +QSCLegend::QSCLegend( QSAxes *parentAxes, QObject *parent ) +:QSCObject( parent ) + { + setParentAxes(parentAxes); + m_pos.set( 0.9, 0.1, 0.0 ); + m_axis.set( QSAxes::normCoord, QSAxes::normCoord, QSAxes::normCoord ); + m_align = Qt::AlignTop | Qt::AlignRight; + m_columns = 1; + m_shadow_pos.x = 3; + m_shadow_pos.y = 3; + m_shadow_fill.color = QSGColor( 0, 0, 0 ); + m_shadow_fill.style = QSGFill::Solid; + m_fill.style = QSGFill::Solid; + m_fill.color = QSGColor( 255, 255, 255 ); + m_frame.style = QSGLine::Solid; + } + +//-------------------------------------------------------------// + +QSCLegend::~QSCLegend() + { + } + +//-------------------------------------------------------------// + +void QSCLegend::setBox( const QSRectf& rect, QSDrv *drv ) + { + // moved on canvas by d pixels ( we ingnore size ) + parametersChanging(); + QSRectf r = rect.normalize(); + QSPt2f d = r.pos - box( drv ).pos; + QSPt3f cpos = mixedToCanvas( m_pos, m_axis.x, m_axis.y, m_axis.z, drv->dpi ); + cpos.x += d.x; + cpos.y += d.y; + m_pos = canvasToMixed( cpos, m_axis.x, m_axis.y, m_axis.z, drv->dpi ); + parametersChanged(); + } + +//-------------------------------------------------------------// + +QSRectf QSCLegend::box( QSDrv *drv ) + { + QSRectf r; + do_everything( drv, r, get_height(drv), false ); + return r; + } + +//-------------------------------------------------------------// + +void QSCLegend::draw( QSDrv *drv, bool, bool ) + { + QSRectf r; + double height = get_height(drv); + do_everything( drv, r, height, false ); + + // draw frame + double x1 = r.pos.x; + double y1 = r.pos.y; + double x2 = r.pos.x+r.size.x; + double y2 = r.pos.y+r.size.y; + double sdx = drv->toPixels(m_shadow_pos.x); + double sdy = drv->toPixels(m_shadow_pos.y); + + if ( m_shadow_fill.style != QSGFill::Transparent ) { + drv->setLine( QSGLine::invisibleLine ); + drv->setFill( m_shadow_fill ); + drv->drawRect( QSPt2f(x1+sdx,y1+sdy), + QSPt2f(x2+sdx,y2+sdy) ); + } + if ( m_fill.style != QSGFill::Transparent || + m_frame.style != QSGLine::Invisible ) { + drv->setFill( m_fill ); + drv->setLine( m_frame ); + drv->drawRect( QSPt2f(x1,y1), + QSPt2f(x2,y2) ); + } + + // draw legend items + do_everything( drv, r, height, true ); + emit sigDrawEnds( this ); + } + +//-------------------------------------------------------------// + +void QSCLegend::do_everything( QSDrv *drv, QSRectf& rect, double average_height, bool draw ) + { + int plots = parentAxes() ? parentAxes()->plotCount() : 0; + double fspace = drv->toPixels(frmSpace); + double rspace = drv->toPixels(rowSpace); + double cspace = drv->toPixels(colSpace); + drv->setFont( m_font ); + double max_col_width = 0.0; + QSPt2f cpos; + + if ( draw ) { + cpos.x = rect.pos.x; + cpos.y = rect.pos.y; + } else { + QSPt3f cpos3 = mixedToCanvas( m_pos, m_axis.x, m_axis.y, m_axis.z, drv->dpi ); + cpos.set( cpos3.x, cpos3.y ); + } + + QSPt2f size( 0.0, 0.0 ); + QSPt2f curr_pos( 0.0, 0.0 ); + QSPt2f marg( fspace, fspace ); + for ( int i=plots-1; i>=0; i-- ) { + if ( parentAxes()->plot(i)->legendItemVisible() ) { + drv->setFont( m_font ); + QSPt2f curr_size = parentAxes()->plot(i)->legendItemSize(drv); + if ( draw ) { + drv->setFont( m_font ); + QSPt2f item_pos = cpos+marg+curr_pos; + parentAxes()->plot(i)->drawLegendItem( QSPt2f(item_pos.x,item_pos.y), drv ); + } + size.set( QMAX(size.x,curr_pos.x+curr_size.x), + QMAX(size.y,curr_pos.y+curr_size.y) ); + curr_pos.y += curr_size.y + rspace; + max_col_width = QMAX( max_col_width, curr_size.x ); + if ( curr_pos.y > average_height ) { + curr_pos.y = 0.0; + curr_pos.x += max_col_width + cspace; + max_col_width = 0.0; + } + } + } + size = size + marg + marg; + + if ( !draw ) { + rect = QSRectf(cpos.x,cpos.y,size.x,size.y); + if ( m_align & AlignVCenter ) rect.pos.y -= rect.size.y/2.0; + if ( m_align & AlignHCenter ) rect.pos.x -= rect.size.x/2.0; + if ( m_align & AlignBottom ) rect.pos.y -= rect.size.y; + if ( m_align & AlignRight ) rect.pos.x -= rect.size.x; + } + } + +//-------------------------------------------------------------// + +double QSCLegend::get_height( QSDrv *drv ) + { + double total_height = 0.0; + int plots = parentAxes() ? parentAxes()->plotCount() : 0; + // fixed values are given when dpi is 72 + double rspace = drv->toPixels(rowSpace); + + // sets default font + for ( int i=0; i<plots; i++ ) + if ( parentAxes()->plot(i)->legendItemVisible() ) { + drv->setFont( m_font ); + total_height += parentAxes()->plot(i)->legendItemSize(drv).y + rspace; + } + return (double )total_height / m_columns; + } + +//-------------------------------------------------------------// + +QString QSCLegend::name() + { + return tr("Legend: ") + (m_parent_axes ? m_parent_axes->title() : QString::null); + } + +//-------------------------------------------------------------// + +void QSCLegend::setColumns( int columns ) + { + SET_COBJECT_PROPERTY( m_columns, columns ); + } + +//-------------------------------------------------------------// + +void QSCLegend::setAlign( int align ) + { + SET_COBJECT_PROPERTY( m_align, align ); + } + +//-------------------------------------------------------------// + +void QSCLegend::setPos( const QSPt3f& pos ) + { + SET_COBJECT_PROPERTY( m_pos, pos ); + } + +//-------------------------------------------------------------// + +void QSCLegend::setPosX( double value ) + { + SET_COBJECT_PROPERTY( m_pos.x, value ); + } + +//-------------------------------------------------------------// + +void QSCLegend::setPosY( double value ) + { + SET_COBJECT_PROPERTY( m_pos.y, value ); + } + +//-------------------------------------------------------------// + +void QSCLegend::setPosZ( double value ) + { + SET_COBJECT_PROPERTY( m_pos.z, value ); + } + +//-------------------------------------------------------------// + +void QSCLegend::setCoord( const QSPt3& coordSystem ) + { + SET_COBJECT_PROPERTY( m_axis, coordSystem ); + } + +//-------------------------------------------------------------// + +void QSCLegend::setCoordX( int coordSystem ) + { + SET_COBJECT_PROPERTY( m_axis.x, coordSystem ); + } + +//-------------------------------------------------------------// + +void QSCLegend::setCoordY( int coordSystem ) + { + SET_COBJECT_PROPERTY( m_axis.y, coordSystem ); + } + +//-------------------------------------------------------------// + +void QSCLegend::setCoordZ( int coordSystem ) + { + SET_COBJECT_PROPERTY( m_axis.z, coordSystem ); + } + +//-------------------------------------------------------------// + +void QSCLegend::setFont( const QSGFont& font ) + { + SET_COBJECT_PROPERTY( m_font, font ); + } + +//-------------------------------------------------------------// + +void QSCLegend::setFontProperty( const QString& data ) + { + QSGFont new_font = toQSGFont(data); + setFont( new_font ); + } + +//-------------------------------------------------------------// + +void QSCLegend::setFill( const QSGFill& fill ) + { + SET_COBJECT_PROPERTY( m_fill, fill ); + } + +//-------------------------------------------------------------// + +void QSCLegend::setFillProperty( const QString &data ) + { + QSGFill new_fill = toQSGFill(data); + setFill( new_fill ); + } + +//-------------------------------------------------------------// + +void QSCLegend::setFrame( const QSGLine& line ) + { + SET_COBJECT_PROPERTY( m_frame, line ); + } + +//-------------------------------------------------------------// + +void QSCLegend::setFrameProperty( const QString& data ) + { + QSGLine new_line = toQSGLine(data); + setFrame( new_line ); + } + +//-------------------------------------------------------------// + +void QSCLegend::setShadowFill( const QSGFill& fill ) + { + SET_COBJECT_PROPERTY( m_shadow_fill, fill ); + } + +//-------------------------------------------------------------// + +void QSCLegend::setShadowFillProperty( const QString& data ) + { + QSGFill new_shadow_fill = toQSGFill(data); + setShadowFill( new_shadow_fill ); + } + +//-------------------------------------------------------------// + +void QSCLegend::setShadowPos( const QSPt2& shift ) + { + SET_COBJECT_PROPERTY( m_shadow_pos, shift ); + } + +//-------------------------------------------------------------// + +void QSCLegend::setShadowPosX( int value ) + { + SET_COBJECT_PROPERTY( m_shadow_pos.x, value ); + } + +//-------------------------------------------------------------// + +void QSCLegend::setShadowPosY( int value ) + { + SET_COBJECT_PROPERTY( m_shadow_pos.y, value ); + } + +//-------------------------------------------------------------// + +void QSCLegend::loadStateFromStream( QDataStream& stream, QSObjectFactory *factory ) + { + QSCObject::loadStateFromStream( stream, factory ); + } + +//-------------------------------------------------------------// + +void QSCLegend::saveStateToStream( QDataStream& stream, QSObjectFactory *factory ) + { + QSCObject::saveStateToStream( stream, factory ); + } + +//-------------------------------------------------------------// + + + diff --git a/kmatplot/widgets/qsclegend.h b/kmatplot/widgets/qsclegend.h new file mode 100644 index 0000000..b01f33a --- /dev/null +++ b/kmatplot/widgets/qsclegend.h @@ -0,0 +1,129 @@ +/*************************************************************************** + qsclegend.h + ------------------- + begin : 01-January-2001 + copyright : (C) 2000 by Kamil Dobkowski + email : kamildobk@poczta.onet.pl + ***************************************************************************/ + +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + + +#ifndef QSCLEGEND_H +#define QSCLEGEND_H + +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + +#include"qscobject.h" + + + +/** + * \brief Graph legend + * Graph legend - it automatically displays items for all datasets in the parent graph.. + */ +class QSCLegend : public QSCObject + { + Q_OBJECT + Q_PROPERTY( int columns READ columns WRITE setColumns ) + Q_PROPERTY( int align READ align WRITE setAlign ) + Q_PROPERTY( double posX READ posX WRITE setPosX ) + Q_PROPERTY( double posY READ posY WRITE setPosY ) + Q_PROPERTY( double posZ READ posZ WRITE setPosZ ) + Q_PROPERTY( int coordX READ coordX WRITE setCoordX ) + Q_PROPERTY( int coordY READ coordY WRITE setCoordY ) + Q_PROPERTY( int coordZ READ coordZ WRITE setCoordZ ) + Q_PROPERTY( QString font READ fontProperty WRITE setFontProperty ) + Q_PROPERTY( QString fill READ fillProperty WRITE setFillProperty ) + Q_PROPERTY( QString frame READ frameProperty WRITE setFrameProperty ) + Q_PROPERTY( QString shadowFill READ shadowFillProperty WRITE setShadowFillProperty ) + Q_PROPERTY( int shadowPosX READ shadowPosX WRITE setShadowPosX ) + Q_PROPERTY( int shadowPosY READ shadowPosY WRITE setShadowPosY ) + + public: + /** + * Constructor. parentAxes must exist ( must not be NULL ). + */ + QSCLegend( QSAxes *parentAxes, QObject *parent=NULL ); + virtual ~QSCLegend(); + virtual int style() { return Moveable; } + virtual void draw( QSDrv *drv, bool blocking=true, bool transparent=true ); + virtual void setBox( const QSRectf& r, QSDrv *drv ); + virtual QSRectf box( QSDrv *drv ); + virtual QString name(); + + void setColumns( int columns ); + int columns() const { return m_columns; } + void setAlign( int align ); + int align() const { return m_align; } + void setPos( const QSPt3f& pos ); + void setPosX( double value ); + void setPosY( double value ); + void setPosZ( double value ); + QSPt3f pos() const { return m_pos; } + double posX() const { return m_pos.x; } + double posY() const { return m_pos.y; } + double posZ() const { return m_pos.z; } + void setCoord( const QSPt3& coordSystem ); + void setCoordX( int coordSystem ); + void setCoordY( int coordSystem ); + void setCoordZ( int coordSystem ); + QSPt3 coord() const { return m_axis; } + int coordX() const { return m_axis.x; } + int coordY() const { return m_axis.y; } + int coordZ() const { return m_axis.z; } + void setFont( const QSGFont& font ); + void setFontProperty( const QString& data ); + QSGFont font() const { return m_font; } + QString fontProperty() const { return toQString(m_font); } + void setFill( const QSGFill& fill ); + void setFillProperty( const QString &data ); + QSGFill fill() const { return m_fill; } + QString fillProperty() const { return toQString(m_fill); } + void setFrame( const QSGLine& line ); + void setFrameProperty( const QString& data ); + QSGLine frame() const { return m_frame; } + QString frameProperty() const { return toQString(m_frame); } + void setShadowFill( const QSGFill& fill ); + void setShadowFillProperty( const QString& data ); + QSGFill shadowFill() const { return m_shadow_fill; } + QString shadowFillProperty() const { return toQString(m_shadow_fill); } + void setShadowPos( const QSPt2& shift ); + void setShadowPosX( int shift ); + void setShadowPosY( int shift ); + QSPt2 shadowPos() const { return m_shadow_pos; } + int shadowPosX() const { return m_shadow_pos.x; } + int shadowPosY() const { return m_shadow_pos.y; } + virtual void loadStateFromStream( QDataStream& stream, QSObjectFactory *factory ); + virtual void saveStateToStream( QDataStream& stream, QSObjectFactory *factory ); + + protected: + int m_columns; + int m_align; + QSPt3f m_pos; + QSPt3 m_axis; + QSGFont m_font; + QSGFill m_fill; + QSGLine m_frame; + QSGFill m_shadow_fill; + QSPt2 m_shadow_pos; + + private: + static const double frmSpace ; + static const double rowSpace ; + static const double colSpace ; + void do_everything( QSDrv *drv, QSRectf& rect, double average_height, bool draw ); + double get_height( QSDrv *drv ); + }; + +#endif + diff --git a/kmatplot/widgets/qscobject.cpp b/kmatplot/widgets/qscobject.cpp new file mode 100644 index 0000000..1356026 --- /dev/null +++ b/kmatplot/widgets/qscobject.cpp @@ -0,0 +1,946 @@ +/*************************************************************************** + qscobject.cpp + ------------------- + begin : Sun Jan 9 2000 + copyright : (C) 2000 by Kamil Dobkowski + email : kamildbk@friko.onet.pl + ***************************************************************************/ + +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + +#include "qscobject.h" +#include "qsdrvqt.h" +#include "qsaxes.h" +#include "qsaxis.h" +#include "qschildlist.h" +#include <math.h> +#include <qmetaobject.h> +#include <qcstring.h> +#include <qvariant.h> +#include <assert.h> + +//-------------------------------------------------------------// + +QSCObjectCollection::QSCObjectCollection( QObject *parent, bool autoDelete ) +: QObject(parent), QSSerializable() + { + m_auto_updates = true; + m_objects = new QSChildList<QSCObject>(autoDelete); + } + +//-------------------------------------------------------------// + +QSCObjectCollection::~QSCObjectCollection() + { + stop(); + delete m_objects; + //cout << "deleting object collection" << endl; + } + +//-------------------------------------------------------------// + +void QSCObjectCollection::setAutoUpdates( bool enable ) + { + if ( m_auto_updates != enable ) { + m_auto_updates = enable; + listChanged(); + changed(); + } + } + + +//-------------------------------------------------------------// + +int QSCObjectCollection::count() const + { + return m_objects->count(); + } + //-------------------------------------------------------------// + +bool QSCObjectCollection::tempAutoUpdatesOff() + { + bool result = m_auto_updates; + m_auto_updates = false; + return result; + } + +//-------------------------------------------------------------// + +void QSCObjectCollection::tempAutoUpdatesRestore( bool enable ) + { + m_auto_updates = enable; + } + +//-------------------------------------------------------------// + +void QSCObjectCollection::clear() + { + parametersChanging(); + bool temp = tempAutoUpdatesOff(); + while( count() ) removeDelete(0); + tempAutoUpdatesRestore( temp ); + listChanged(); + parametersChanged(); + } + +//-------------------------------------------------------------// + +void QSCObjectCollection::add( QSCObject *newObject ) + { + insert( count(), newObject ); + } + +//-------------------------------------------------------------// + +void QSCObjectCollection::insert( int position, QSCObject *newObject ) + { + if ( newObject && find(newObject) < 0 ) { + parametersChanging(); + if ( m_objects->autoDelete() ) newObject->stop(); + m_objects->insert( position, newObject ); + connect( newObject, SIGNAL(sigUpdate()), this, SLOT(slot_object_changed()) ); + if ( newObject->isAxesShadow() ) { + connect( newObject->parentAxes(), SIGNAL(sigChildListChanged()), this, SLOT(slot_data_child_list_changed()) ); + } + if ( dynamic_cast<QSCGroup*>(newObject) ) { + QSCGroup *group = (QSCGroup *)newObject; + connect( group->objects(), SIGNAL(sigAdded(QSCObjectCollection*,QSCObject*)), this, SLOT(slot_added(QSCObjectCollection*,QSCObject*)) ); + connect( group->objects(), SIGNAL(sigRemoved(QSCObjectCollection*,QSCObject*)), this, SLOT(slot_removed(QSCObjectCollection*,QSCObject*)) ); + connect( group->objects(), SIGNAL(sigOrderChanged(QSCObjectCollection*)), this, SLOT(slot_order_changed(QSCObjectCollection*)) ); + connect( group->objects(), SIGNAL(sigListChanged(QSCObjectCollection*)), this, SLOT(slot_list_changed(QSCObjectCollection*)) ); + connect( group->objects(), SIGNAL(sigDataChildListChanged()), this, SLOT(slot_data_child_list_changed()) ); + } + if ( m_objects->autoDelete() ) { + newObject->setCollection(this); + } + emit sigAdded( newObject ); + emit sigAdded( this, newObject ); + listChanged(); + parametersChanged(); + } + } + +//-------------------------------------------------------------// + +void QSCObjectCollection::remove( int index ) + { + QSCObject *object_to_remove = object( index ); + if ( object_to_remove ) { + parametersChanging(); + if ( m_objects->autoDelete() ) { + object_to_remove->stop(); + object_to_remove->setCollection(NULL); + } + if ( object_to_remove->isAxesShadow() ) { + disconnect( object_to_remove->parentAxes(), SIGNAL(sigChildListChanged()), this, SLOT(slot_data_child_list_changed()) ); + } + if ( dynamic_cast<QSCGroup*>(object_to_remove) ) { + QSCGroup *group = (QSCGroup *)object_to_remove; + disconnect( group->objects(), SIGNAL(sigAdded(QSCObjectCollection*,QSCObject*)), this, SLOT(slot_added(QSCObjectCollection*,QSCObject*)) ); + disconnect( group->objects(), SIGNAL(sigRemoved(QSCObjectCollection*,QSCObject*)), this, SLOT(slot_removed(QSCObjectCollection*,QSCObject*)) ); + disconnect( group->objects(), SIGNAL(sigOrderChanged(QSCObjectCollection*)), this, SLOT(slot_order_changed(QSCObjectCollection*)) ); + disconnect( group->objects(), SIGNAL(sigListChanged(QSCObjectCollection*)), this, SLOT(slot_list_changed(QSCObjectCollection*)) ); + disconnect( group->objects(), SIGNAL(sigDataChildListChanged()), this, SLOT(slot_data_child_list_changed()) ); + } + disconnect( object_to_remove, SIGNAL(sigUpdate()), this, SLOT(slot_object_changed()) ); + m_objects->remove( index ); + emit sigRemoved( object_to_remove ); + emit sigRemoved( this, object_to_remove ); + listChanged(); + parametersChanged(); + } + } + +//-------------------------------------------------------------// + +void QSCObjectCollection::removeDelete( int index ) + { + QSCObject *object_to_delete = object( index ); + if ( object_to_delete ) { + remove( index ); + if ( m_objects->autoDelete() ) delete object_to_delete; + } + } + +//-------------------------------------------------------------// + +void QSCObjectCollection::raise( int index ) + { + parametersChanging(); + m_objects->raise( index ); + orderChanged(); + parametersChanged(); + } + +//-------------------------------------------------------------// + +void QSCObjectCollection::lower( int index ) + { + parametersChanging(); + m_objects->lower( index ); + orderChanged(); + parametersChanged(); + } + +//-------------------------------------------------------------// + +void QSCObjectCollection::toFront( int index ) + { + parametersChanging(); + m_objects->toFront( index ); + orderChanged(); + parametersChanged(); + } + +//-------------------------------------------------------------// + +void QSCObjectCollection::toBack( int index ) + { + parametersChanging(); + m_objects->toBack( index ); + orderChanged(); + parametersChanged(); + } + +//-------------------------------------------------------------// + +void QSCObjectCollection::reorder( int position, int index ) + { + parametersChanging(); + m_objects->reorder( position, index ); + orderChanged(); + parametersChanged(); + } + +//-------------------------------------------------------------// + +int QSCObjectCollection::find( QSCObject *object ) const + { + return m_objects->find( object ); + } + +//-------------------------------------------------------------// + +QSCObject *QSCObjectCollection::object( int index ) const + { + return (*m_objects)[index]; + } + +//-------------------------------------------------------------// + +void QSCObjectCollection::paintSkeleton( QPainter *p, double dpi ) + { + for( int i=0; i<count(); i++ ) object(i)->paintSkeleton( p, dpi ); + } + +//-------------------------------------------------------------// + +void QSCObjectCollection::paint( QPainter *p, double dpi, bool blocking, bool transparent ) + { + for( int i=0; i<count(); i++ ) { + object(i)->paint( p, dpi, blocking, transparent ); + if ( object(i)->busy() ) connect( object(i), SIGNAL(sigDrawEnds(QSCObject*)), this, SLOT(slot_draw_ends(QSCObject*)) ); + } + slot_draw_ends(NULL); + } + +//-------------------------------------------------------------// + +void QSCObjectCollection::draw( QSDrv *drv, bool blocking, bool transparent ) + { + for( int i=0; i<count(); i++ ) { + object(i)->draw( drv, blocking, transparent ); + if ( object(i)->busy() ) connect( object(i), SIGNAL(sigDrawEnds(QSCObject*)), this, SLOT(slot_draw_ends(QSCObject*)) ); + } + slot_draw_ends(NULL); + } + +//-------------------------------------------------------------// + +void QSCObjectCollection::slot_draw_ends( QSCObject *object ) + { + if ( object ) disconnect( object, SIGNAL(sigDrawEnds(QSCObject*)), this, SLOT(slot_draw_ends(QSCObject*)) ); + if ( !busy() ) emit sigDrawEnds(); + } + +//-------------------------------------------------------------// + +bool QSCObjectCollection::busy() const + { + for( int i=0; i<count(); i++ ) if ( object(i)->busy() ) return true; + return false; + } + +//-------------------------------------------------------------// + +void QSCObjectCollection::stop() + { + for( int i=0; i<count(); i++ ) object(i)->stop(); + } + +//-------------------------------------------------------------// + +QSCObject *QSCObjectCollection::objectAt( const QSPt2f &p, QSDrv* drv, bool recursive ) + { + for( int i=count()-1; i>=0; i-- ) + if ( object(i)->isHit(p,drv) ) + if ( recursive && dynamic_cast<QSCGroup*>(object(i)) ) { + QSCObject *hit_object = ((QSCGroup*)(object(i)))->objects()->objectAt( p, drv, recursive ); + return hit_object ? hit_object : object(i); + } else { + return object(i); + } + return NULL; + } + +//-------------------------------------------------------------// + +bool QSCObjectCollection::contains( QSCObject *checkedObject, bool recursive ) + { + if ( find(checkedObject) >= 0 ) return true; + if ( recursive ) + for( int i=0; i<count(); i++ ) if ( dynamic_cast<QSCGroup*>(object(i)) ) { + if ( ((QSCGroup*)(object(i)))->objects()->contains( checkedObject, recursive ) ) return true; + } + return false; + } + +//-------------------------------------------------------------// + +void QSCObjectCollection::loadStateFromStream( QDataStream& stream, QSObjectFactory *factory ) +// we dont load auto-delete + { + clear(); + int object_count; stream >> object_count; + for( int i=0; i<object_count; i++ ) { + QSCObject *new_object = dynamic_cast<QSCObject *>(factory->loadObjectFromStream(stream)); + assert( new_object ); add( new_object ); + } + } + +//-------------------------------------------------------------// + +void QSCObjectCollection::saveStateToStream( QDataStream& stream, QSObjectFactory *factory ) +// we dont save auto-delete + { + QSSerializable::saveStateToStream( stream, factory ); + stream << (int )count(); + for( int i=0; i<count(); i++ ) factory->saveObjectToStream( object(i), stream ); + } + +//-------------------------------------------------------------// + +void QSCObjectCollection::parametersChanging() + { + emit sigParametersChanging(); + } + +//-------------------------------------------------------------// + +void QSCObjectCollection::parametersChanged() + { + emit sigParametersChanged(); + changed(); + } + +//-------------------------------------------------------------// + +void QSCObjectCollection::orderChanged() + { + emit sigOrderChanged(); + emit sigOrderChanged( this ); + listChanged(); + } + +//-------------------------------------------------------------// + +void QSCObjectCollection::listChanged() + { + if ( m_auto_updates ) { + emit sigListChanged(); + emit sigListChanged( this ); + } + } + +//-------------------------------------------------------------// + +void QSCObjectCollection::changed() + { + if ( m_auto_updates ) emit sigChanged(); + } + +//-------------------------------------------------------------// + +void QSCObjectCollection::slot_added( QSCObjectCollection *collection, QSCObject*object ) + { + emit sigAdded( collection, object ); + } + +//-------------------------------------------------------------// + +void QSCObjectCollection::slot_removed( QSCObjectCollection *collection, QSCObject *object ) + { + emit sigRemoved( collection, object ); + } + +//-------------------------------------------------------------// + +void QSCObjectCollection::slot_order_changed( QSCObjectCollection *collection ) + { + emit sigOrderChanged( collection ); + } + +//-------------------------------------------------------------// + +void QSCObjectCollection::slot_list_changed( QSCObjectCollection *collection ) + { + if ( m_auto_updates ) emit sigListChanged( collection ); + } + +//-------------------------------------------------------------// + +void QSCObjectCollection::slot_object_changed() + { + changed(); + } + +//---------------------------------------------------------------------------------------------------// + +void QSCObjectCollection::slot_data_child_list_changed() + { + emit sigDataChildListChanged(); + } + +//-------------------------------------------------------------// + + +//-------------------------------------------------------------// +//-------------------------------------------------------------// +//-------------------------------------------------------------// +//-------------------------------------------------------------// + //-------------------------------------------------------------// + +QSCObject::QSCObject( QObject *parent ): +QObject(parent), QSSerializable() + { + m_group = NULL; + m_collection = NULL; + m_parent_axes = NULL; + m_auto_updates = true; + m_default_axis[0] = NULL; + m_default_axis[1] = NULL; + m_default_axis[2] = NULL; + } + +//-------------------------------------------------------------// + +QSCObject::~QSCObject() + { + } + +//-------------------------------------------------------------// + +void QSCObject::setParentAxes( QSAxes *axes ) + { + if ( axes != m_parent_axes ) { + parametersChanging(); + if ( m_parent_axes ) { + m_default_axis[0] = NULL; + m_default_axis[1] = NULL; + m_default_axis[2] = NULL; + disconnect( m_parent_axes, SIGNAL(sigChildRemoved(QSData*)), this, SLOT(axisRemoved(QSData*)) ); + disconnect( m_parent_axes, SIGNAL(sigDeleted(QSData*)), this, SLOT(parentAxesRemoved(QSData*)) ); + } + m_parent_axes = axes; + if ( m_parent_axes ) { + m_default_axis[0] = m_parent_axes->axisOfType(QSAxis::XAxisType); + m_default_axis[1] = m_parent_axes->axisOfType(QSAxis::YAxisType); + m_default_axis[2] = m_parent_axes->axisOfType(QSAxis::ZAxisType); + connect( m_parent_axes, SIGNAL(sigChildRemoved(QSData*)), this, SLOT(axisRemoved(QSData*)) ); + connect( m_parent_axes, SIGNAL(sigDeleted(QSData*)), this, SLOT(parentAxesRemoved(QSData*)) ); + } + parametersChanged(); + } + } + +//-------------------------------------------------------------// + +void QSCObject::setCollection( QSCObjectCollection *parent ) + { + m_collection = parent; + } + +//-------------------------------------------------------------// + +void QSCObject::setGroup( QSCGroup *group ) + { + m_group = group; + } + +//-------------------------------------------------------------// + +void QSCObject::raise() + { + if ( m_collection ) m_collection->raise( m_collection->find(this) ); + } + +//-------------------------------------------------------------// + +void QSCObject::lower() + { + if ( m_collection ) m_collection->lower( m_collection->find(this) ); + } + +//-------------------------------------------------------------// + +void QSCObject::toFront() + { + if ( m_collection ) m_collection->toFront( m_collection->find(this) ); + } + +//-------------------------------------------------------------// + +void QSCObject::toBack() + { + if ( m_collection ) m_collection->toBack( m_collection->find(this) ); + } + +//-------------------------------------------------------------// + +void QSCObject::reorder( int newPosition ) + { + if ( m_collection ) m_collection->reorder( newPosition, m_collection->find(this) ); + } + +//-------------------------------------------------------------// + +void QSCObject::axisRemoved( QSData *removedObject ) + { + if ( m_parent_axes ) { + if ( m_default_axis[0] == removedObject ) m_default_axis[0] = m_parent_axes->axisOfType(QSAxis::XAxisType); + if ( m_default_axis[1] == removedObject ) m_default_axis[1] = m_parent_axes->axisOfType(QSAxis::YAxisType); + if ( m_default_axis[2] == removedObject ) m_default_axis[2] = m_parent_axes->axisOfType(QSAxis::ZAxisType); + } + } + +//-------------------------------------------------------------// + +void QSCObject::parentAxesRemoved( QSData *removedObject ) + { + if ( removedObject == m_parent_axes ) { + setParentAxes(NULL); + } + } + +//-------------------------------------------------------------// + +QSAxis *QSCObject::defaultAxis( int axisType ) const + { + if ( axisType == QSAxis::XAxisType || + axisType == QSAxis::YAxisType || + axisType == QSAxis::ZAxisType ) { + return m_default_axis[axisType]; + } + return NULL; + } + +//-------------------------------------------------------------// + +void QSCObject::setDefaultAxis( QSAxis *axis ) + { + if ( axis && + axis->parentAxes() == m_parent_axes && + ( axis->type() == QSAxis::XAxisType || + axis->type() == QSAxis::YAxisType || + axis->type() == QSAxis::ZAxisType ) ) { + parametersChanging(); + m_default_axis[axis->type()] = axis; + parametersChanged(); + } + } + +//-------------------------------------------------------------// + +QSPt3f QSCObject::mixedToCanvas( const QSPt3f& pos, int xCoordIn, int yCoordIn, int zCoordIn, double dpi ) + { + QSPt3f result; + + if ( m_parent_axes ) { + QSAxes::CoordinateSystem in_coord[3]; + in_coord[0] = (QSAxes::CoordinateSystem )xCoordIn; + in_coord[1] = (QSAxes::CoordinateSystem )yCoordIn; + in_coord[2] = (QSAxes::CoordinateSystem )zCoordIn; + result = m_parent_axes->mixedToCanvas( pos, in_coord, dpi, m_default_axis[0], m_default_axis[1], m_default_axis[2] ); + } else { + result = QSPt3f( QSCoord::mmToPixels( pos.x, dpi ), + QSCoord::mmToPixels( pos.y, dpi ), + QSCoord::mmToPixels( pos.z, dpi ) ); + } + + return result; + } + +//-------------------------------------------------------------// + +QSPt3f QSCObject::canvasToMixed( const QSPt3f& pos, int xCoordOut, int yCoordOut, int zCoordOut, double dpi ) + { + QSPt3f result; + + if ( m_parent_axes ) { + QSAxes::CoordinateSystem out_coord[3]; + out_coord[0] = (QSAxes::CoordinateSystem )xCoordOut; + out_coord[1] = (QSAxes::CoordinateSystem )yCoordOut; + out_coord[2] = (QSAxes::CoordinateSystem )zCoordOut; + result = m_parent_axes->canvasToMixed( pos, out_coord, dpi, m_default_axis[0], m_default_axis[1], m_default_axis[2] ); + } else { + result = QSPt3f( QSCoord::pixelsToMM( pos.x, dpi ), + QSCoord::pixelsToMM( pos.y, dpi ), + QSCoord::pixelsToMM( pos.z, dpi ) ); + } + return result; + } + +//-------------------------------------------------------------// + +void QSCObject::setAutoUpdates( bool enabled ) + { + m_auto_updates = enabled; + } + +//-------------------------------------------------------------// + +void QSCObject::paintSkeleton( QPainter *p, double dpi ) + { + QSCObject::paint( p, dpi ); + } + +//-------------------------------------------------------------// + +void QSCObject::paint( QPainter *p, double dpi, bool blocking, bool transparent ) + { + QSDrvQt qtdrv; + qtdrv.setDC(p,dpi,false); + draw( &qtdrv, blocking, transparent ); + } + +//-------------------------------------------------------------// + +void QSCObject::setBox( const QSRectf&, QSDrv* ) + { + } + +//-------------------------------------------------------------// + +QSRectf QSCObject::box( QSDrv * ) + { + return QSRectf(); + } + +//-------------------------------------------------------------// + +void QSCObject::setAngle( int ) + { + } + +//-------------------------------------------------------------// + +QSPt2f QSCObject::rCenter( QSDrv * ) + { + return QSPt2f(); + } + + +//-------------------------------------------------------------// + +void QSCObject::parametersChanging() + { + stop(); + } + +//-------------------------------------------------------------// + +void QSCObject::parametersChanged() + { + if ( m_auto_updates ) { + emit sigUpdate( this ); + emit sigUpdate(); + } + } + +//-------------------------------------------------------------// + +void QSCObject::forceUpdate() + { + emit sigUpdate( this ); + emit sigUpdate(); + } + +//-------------------------------------------------------------// + +void QSCObject::setDefaultXAxis( int axisIndex ) + { + setDefaultAxis( m_parent_axes ? m_parent_axes->axis(axisIndex) : NULL ); + } + +//-------------------------------------------------------------// + +void QSCObject::setDefaultYAxis( int axisIndex ) + { + setDefaultAxis( m_parent_axes ? m_parent_axes->axis(axisIndex) : NULL ); + } + +//-------------------------------------------------------------// + +void QSCObject::setDefaultZAxis( int axisIndex ) + { + setDefaultAxis( m_parent_axes ? m_parent_axes->axis(axisIndex) : NULL ); + } + +//-------------------------------------------------------------// + +int QSCObject::defaultXAxis() const + { + return m_parent_axes ? m_parent_axes->axisIndex(m_default_axis[QSAxis::XAxisType]) : -1; + } + +//-------------------------------------------------------------// + +int QSCObject::defaultYAxis() const + { + return m_parent_axes ? m_parent_axes->axisIndex(m_default_axis[QSAxis::YAxisType]) : -1; + } + +//-------------------------------------------------------------// + +int QSCObject::defaultZAxis() const + { + return m_parent_axes ? m_parent_axes->axisIndex(m_default_axis[QSAxis::ZAxisType]) : -1; + } + +//-------------------------------------------------------------// + +QSCObjectCollection *QSCObject::rootCollection() + { + QSCGroup *curr_group = group(); + while( curr_group && curr_group->group() ) curr_group = curr_group->group(); + if ( curr_group ) return curr_group->collection(); + else return collection(); + } + +//-------------------------------------------------------------// + +void QSCObject::loadStateFromStream( QDataStream& stream, QSObjectFactory *factory ) + { + QSSerializable::loadStateFromStream( stream, factory ); + QMetaObject *meta_object = metaObject(); + QStrList properties = meta_object->propertyNames( TRUE ); + for( unsigned int property_nr=0; property_nr<properties.count(); property_nr++ ) { + QCString property_name; + QVariant property_value; + stream >> property_name >> property_value; + setProperty(property_name,property_value); + } + } + +//-------------------------------------------------------------// + +void QSCObject::saveStateToStream( QDataStream& stream, QSObjectFactory *factory ) + { + QSSerializable::saveStateToStream( stream, factory ); + QMetaObject *meta_object = metaObject(); + QStrList properties = meta_object->propertyNames( TRUE ); + for( unsigned int property_nr=0; property_nr<properties.count(); property_nr++ ) { + stream << QCString(properties.at(property_nr)) << property(properties.at(property_nr)); + } + } + +//-------------------------------------------------------------// +//-------------------------------------------------------------// +//-------------------------------------------------------------// +//-------------------------------------------------------------// + +QSCGroup::QSCGroup( QObject *parent ) +: QSCObject(parent) + { + m_w_minus = false; + m_h_minus = false; + m_objects = new QSCObjectCollection( this ); + connect( m_objects, SIGNAL(sigChanged()), this, SLOT(slot_collection_changed()) ); + connect( m_objects, SIGNAL(sigParametersChanging()), this, SLOT(parametersChanging()) ); + connect( m_objects, SIGNAL(sigParametersChanged()), this, SLOT(parametersChanged()) ); + connect( m_objects, SIGNAL(sigAdded(QSCObject*)), this, SLOT(slot_object_added(QSCObject*)) ); + connect( m_objects, SIGNAL(sigRemoved(QSCObject*)), this, SLOT(slot_object_removed(QSCObject*)) ); + } + +//-------------------------------------------------------------// + +QSCGroup::~QSCGroup() + { + } + +//-------------------------------------------------------------// + +void QSCGroup::paintSkeleton( QPainter *p, double dpi ) + { + m_objects->paintSkeleton( p, dpi ); + } + +//-------------------------------------------------------------// + +void QSCGroup::paint( QPainter *p, double dpi, bool blocking, bool transparent ) + { + connect( m_objects, SIGNAL(sigDrawEnds()), this, SLOT(slot_draw_ends()) ); + m_objects->paint( p, dpi, blocking, transparent ); + } + +//-------------------------------------------------------------// + +void QSCGroup::draw( QSDrv *drv, bool blocking, bool transparent ) + { + connect( m_objects, SIGNAL(sigDrawEnds()), this, SLOT(slot_draw_ends()) ); + m_objects->draw( drv, blocking, transparent ); + } + +//-------------------------------------------------------------// + +void QSCGroup::slot_draw_ends() + { + disconnect( m_objects, SIGNAL(sigDrawEnds()), this, SLOT(slot_draw_ends()) ); + emit sigDrawEnds( this ); + } + +//-------------------------------------------------------------// + +bool QSCGroup::busy() const + { + return m_objects->busy(); + } + +//-------------------------------------------------------------// + +void QSCGroup::stop() + { + m_objects->stop(); + } + +//-------------------------------------------------------------// + +bool QSCGroup::isHit( const QSPt2f &p, QSDrv* drv ) + { + return (m_objects->objectAt(p,drv) != NULL); + } + +//-------------------------------------------------------------// + +void QSCGroup::setBox( const QSRectf& new_rect, QSDrv *drv ) + { + // Ups !!! + // allow rectangles with size < 0 (mirroring ) + QSRectf newRect = new_rect; + if ( newRect.size.x >= 0.0 && newRect.size.x < 1.0 ) newRect.size.x = 1.0; + if ( newRect.size.y >= 0.0 && newRect.size.y < 1.0 ) newRect.size.y = 1.0; + if ( newRect.size.x < 0.0 && newRect.size.x > -1.0 ) newRect.size.x = -1.0; + if ( newRect.size.y < 0.0 && newRect.size.y > -1.0 ) newRect.size.y = -1.0; + + parametersChanging(); + disconnect( m_objects, SIGNAL(sigChanged()), this, SLOT(slot_collection_changed()) ); + QSRectf rect = box(drv); + QSPt2f scale; + scale.x = newRect.size.x/rect.size.x; + scale.y = newRect.size.y/rect.size.y; + for( int i=0;i<objects()->count(); i++ ) { + QSRectf curr_rect = objects()->object(i)->box(drv); + curr_rect.pos = QSPt2f( ((curr_rect.pos.x-rect.pos.x)*scale.x+newRect.pos.x), + ((curr_rect.pos.y-rect.pos.y)*scale.y+newRect.pos.y) ); + curr_rect.size.x *= scale.x; + curr_rect.size.y *= scale.y; + objects()->object(i)->setBox(curr_rect,drv); + } + if ( (newRect.size.x < 0.0) != m_w_minus ) m_w_minus = !m_w_minus; + if ( (newRect.size.y < 0.0) != m_h_minus ) m_h_minus = !m_h_minus; + connect( m_objects, SIGNAL(sigChanged()), this, SLOT(slot_collection_changed()) ); + parametersChanged(); + } + +//-------------------------------------------------------------// + +QSRectf QSCGroup::box( QSDrv *drv ) + { + QSRectf result; + if ( objects()->count() > 0 ) { + result = objects()->object(0)->box(drv).normalize(); + for( int i=1; i<objects()->count(); i++ ) result.unite( objects()->object(i)->box(drv).normalize() ); + } + if ( m_w_minus ) { result.pos.x += result.size.x; result.size.x = -result.size.x; } + if ( m_h_minus ) { result.pos.y += result.size.y; result.size.y = -result.size.y; } + return result; + } + +//-------------------------------------------------------------// + +QString QSCGroup::name() + { + return tr("Group of %1 objects").arg(objects()->count()); + } + +//-------------------------------------------------------------// + +void QSCGroup::setParentAxes( QSAxes *axes ) + { + QSCObject::setParentAxes( axes ); + for( int i=0; i<objects()->count(); i++ ) objects()->object(i)->setParentAxes( axes ); + } + +//-------------------------------------------------------------// + +void QSCGroup::slot_collection_changed() + { + emit sigUpdate(this); + emit sigUpdate(); + } + +//-------------------------------------------------------------// + +void QSCGroup::slot_object_added( QSCObject *object ) +// we hope that this signal is received by this object before any other object which also connects +// to QSCObjectCollection::sigAdded will get this signal. So this other object will see a newly added object +// which has already group() property set. + { + object->setGroup( this ); + object->setParentAxes( parentAxes() ); + } + +//-------------------------------------------------------------// + +void QSCGroup::slot_object_removed( QSCObject *object ) + { + object->setGroup( NULL ); + object->setParentAxes( NULL ); + } + +//-------------------------------------------------------------// + +void QSCGroup::loadStateFromStream( QDataStream& stream, QSObjectFactory *factory ) + { + QSCObject::loadStateFromStream( stream, factory ); + int w_minus; stream >> w_minus; m_w_minus = (bool )w_minus; + int h_minus; stream >> h_minus; m_h_minus = (bool )h_minus; + m_objects->loadStateFromStream( stream, factory ); + } + +//-------------------------------------------------------------// + +void QSCGroup::saveStateToStream( QDataStream& stream, QSObjectFactory *factory ) + { + QSCObject::saveStateToStream( stream, factory ); + stream << (int)m_w_minus; + stream << (int)m_h_minus; + m_objects->saveStateToStream( stream, factory ); + } diff --git a/kmatplot/widgets/qscobject.h b/kmatplot/widgets/qscobject.h new file mode 100644 index 0000000..f78cbb9 --- /dev/null +++ b/kmatplot/widgets/qscobject.h @@ -0,0 +1,580 @@ +/*************************************************************************** + qscobject.h + ------------------- + begin : Sun Jan 9 2000 + copyright : (C) 2000 by Kamil Dobkowski + email : kamildbk@friko.onet.pl + ***************************************************************************/ + +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + +#ifndef QSCOBJECT_H +#define QSCOBJECT_H + +#include"qsdrv.h" +#include"qsserializable.h" +#include<qobject.h> + +//-------------------------------------------------------------------------------------------------// +class QSCObject; +template<class CHILD_OBJECT> class QSChildList; + +/** + * \brief List of QSCObject's + * + * Object collection- it holds a list of QSCObjects. QSCGroup and QSPage contains object collections. + * Selection in QSPlotView is also an object collection. See also: QSCObject + */ +class QSCObjectCollection : public QObject, public QSSerializable + { + Q_OBJECT + public: + /** + * Constructor. set 'autoDelete' to false if you dont want objects + * to be deleted when collection is deleted or when callig 'removeDelete'. + */ + QSCObjectCollection( QObject *parent=NULL, bool autoDelete=true ); + /** + * Destructor. If autoDelete is true deletes all objects + */ + ~QSCObjectCollection(); + /** + * Blocks / Enables and sends sigListChanged and sigChanged + */ + void setAutoUpdates( bool enable ); + /** + * Returns auto updates setting. + */ + bool autoUpdates() const { return m_auto_updates; } + /** + * Returns true if selection doesn't contain any object. + */ + bool isEmpty() const { return count() == 0; } + /** + * Number of objects in collection. + */ + int count() const; + /** + * Deletes ( if autoDelete is false - only removes ) all objects in collection. + */ + void clear(); + /** + * Adds a new object to the collection. + */ + void add( QSCObject *newObject ); + /** + * Insert object into the collection at the given position ( 0 - at the back, count() - at the front ). + */ + virtual void insert( int position, QSCObject *object ); + /** + * Removes an object at the position 'index' from the collection + */ + virtual void remove( int index ); + /** + * Removes an object at the position 'index' from the collection and deletes it ( if autoDelete is true ). + */ + void removeDelete( int index ); + /** + * Raises an object at the position 'index'. + */ + void raise( int index ); + /** + * Lowers an object at the position 'index'. + */ + void lower( int index ); + /** + * Brings to front an object at the position 'index'. + */ + void toFront( int index ); + /** + * Sends to back an object at the position 'index'. + */ + void toBack( int index ); + /** + * Moves to position 'position' an object at the position 'index'. + */ + void reorder( int position, int index ); + /** + * Returns the position of the object 'object'. + */ + int find( QSCObject *object ) const; + /** + * Returns object at the position 'index' + */ + QSCObject *object( int index ) const; + /** + * Paints skeletons of all objects. + */ + void paintSkeleton( QPainter *p, double dpi = 72.0 ); + /** + * Paints all object. If 'blocking' is false painter is copied using QSDrvQt::copyPainter + * each object gets its own painter object, and paints itself in the background. + */ + void paint( QPainter *p, double dpi = 72.0, bool blocking=true, bool transparent=true ); + /** + * Draws all object using the given driver. If blocking is false, driver is copied using + * QSDrv::copy() and each object gets its own driver object and draws itself in the background. + */ + void draw( QSDrv *drv, bool blocking=true, bool transparent=true ); + /** + * Returns if there is a busy object in this group. + */ + bool busy() const; + /** + * Stops drawing. + */ + void stop(); + /** + * Returns object at position 'p'. + */ + QSCObject *objectAt( const QSPt2f &p, QSDrv* drv, bool recursive=false ); + /** + * Returns if selection contains given object + */ + bool contains( QSCObject *object, bool recursive=false ); + /** + * Saves all objects + */ + virtual void loadStateFromStream( QDataStream& stream, QSObjectFactory *factory ); + /** + * Loads all objects + */ + virtual void saveStateToStream( QDataStream& stream, QSObjectFactory *factory ); + + signals: + /** + * Emitted before collection is changed + */ + void sigParametersChanging(); + /** + * Emitted after collection was changed + */ + void sigParametersChanged(); + /** + * Object added. + */ + void sigAdded( QSCObject *o ); + /** + * Object added to the collection 'collection' ( which is this collection or the collection of any QSCGroup object in this collection ). + */ + void sigAdded( QSCObjectCollection *collection, QSCObject *o ); + /** + * Object removed from this collection + */ + void sigRemoved( QSCObject *o ); + /** + * Object added to the collection 'collection'. + */ + void sigRemoved( QSCObjectCollection *collection, QSCObject *o ); + /** + * Object raised, lowered, reordered. + */ + void sigOrderChanged(); + /** + * Order of objects changed ( including all grouped object ) + */ + void sigOrderChanged( QSCObjectCollection *collection ); + /** + * Object list changed. + */ + void sigListChanged(); + /** + * Object list changed. + */ + void sigListChanged( QSCObjectCollection *collection ); + /** + * Emitted when QSData child object list ( QSAxis and QSPlot are child objects of QSAxes ) has changed. + * Emmitted for all QSData objects ( QSAxes ) in this collection. I really needed such signal. + */ + void sigDataChildListChanged(); + /** + * Object on the list changed. Collection needs redrawing + */ + void sigChanged(); + /** + * Draw ends. + */ + void sigDrawEnds(); + + protected: + bool m_auto_updates; + QSChildList<QSCObject> *m_objects; + virtual void parametersChanging(); + virtual void parametersChanged(); + virtual void orderChanged(); + virtual void listChanged(); + virtual void changed(); + bool tempAutoUpdatesOff(); + void tempAutoUpdatesRestore( bool enable ); + + private slots: + void slot_object_changed(); + void slot_data_child_list_changed(); + void slot_added(QSCObjectCollection*,QSCObject*); + void slot_removed(QSCObjectCollection*,QSCObject*); + void slot_order_changed(QSCObjectCollection*); + void slot_list_changed(QSCObjectCollection*); + void slot_draw_ends(QSCObject*); + }; + +//-------------------------------------------------------------------------------------------------// + +class QSAxes; +class QSAxis; +class QSData; +class QSCGroup; + +#define SET_COBJECT_PROPERTY( property, new_value ) if ((property)!=(new_value)) { parametersChanging(); (property)=(new_value); parametersChanged(); } + +/** + * \brief Base class for canvas objects which can be displayed on a page. + * + * It can paint itself using the given painter - see paint(). Sometimes it takes much time to draw some + * objects such as graphs with many datapoints, so it supports drawing in the background. See paint() ( 'blocking' argument ), + * busy(), stop(), sigDrawEnds() methods. QSCObject is usually a member of some object collection, see collection(). It can be + * the main object collection of QSPage, but it can be also QSCGroup collection if object is grouped with others. In this case group() + * method returns a pointer to this group. QSCObject can be bound to some QSAxes object - see setParentAxes(). It is useful when, for example, + * QSCArrow should point at some data point in your graph. You can transform coordinates between various coordinate systems + * using mixedToCanvas(), canvasToMixed(). Notice that a single QSAxes object can have many coordinate systems, defined by + * every set of its axes. So you can choose which axes you want to use - see setDefaultXAxis(), setDefaultYAxis(), setDefaultZAxis(). + * OQSCObject notifies when its parameters are changing, so it needs redrawing - see sigUpdate(). Use setBox() for positioning and resizing + * the object. + * @author Kamil Dobkowski + */ +class QSCObject : public QObject, public QSSerializable { + friend class QSCObjectCollection; + friend class QSCGroup; + Q_OBJECT + Q_PROPERTY( int defaultXAxis READ defaultXAxis WRITE setDefaultXAxis ) + Q_PROPERTY( int defaultYAxis READ defaultYAxis WRITE setDefaultYAxis ) + Q_PROPERTY( int defaultZAxis READ defaultZAxis WRITE setDefaultZAxis ) + public: + /** + * Constructor. + */ + QSCObject( QObject *parent=NULL ); + /** + * Destructor. Removes an object from a parent child list. + */ + virtual ~QSCObject(); + /** + * Returns object's parent group if it is grouped or NULL. + */ + QSCGroup *group() const { return m_group; } + /** + * Returns collection to which this object belongs to or NULL. If collection is not autoDelete + * object doesn't belong to it. + */ + QSCObjectCollection *collection() const { return m_collection; } + /** + * Returns a root group of this object It digs through all group hierarchy. + * It will be usually the main object collection on QSPage. + */ + QSCObjectCollection *rootCollection(); + /** + * Sets a parent axes object. Position of this object can be set + * as a relative to the parent object position. This function is called by + * QSAxes object ( or rather by its shadow QSCObject ), when this object is + * grouped with axes. + */ + virtual void setParentAxes( QSAxes *axes ); + /** + * Returns a parent axes or NULL + */ + QSAxes *parentAxes() const { return m_parent_axes; } + /** + * Style of this object. + */ + enum Style { Rotateable = 1U<<0, + Resizeable = 1U<<1, + Moveable = 1U<<2 }; + /** + * Returns a bitwise-OR of Style values. Informs the parent what actions + * on this object are allowed. Currently not used. + */ + virtual int style() { return 0; } + /** + * Control whether sigParametersChnged emits sigUpdate + */ + virtual void setAutoUpdates( bool enabled ); + /** + * Returns auto-update state + */ + bool autoUpdates() const { return m_auto_updates; } + /** + * Raises object on a parent collection stack. + */ + virtual void raise(); + /** + * Lowers object on a parent collection stack. + */ + virtual void lower(); + /** + * Brings object to front on a parent collection stack. + */ + virtual void toFront(); + /** + * Sends object to back on a parent collection stack. + */ + virtual void toBack(); + /** + * Moves object to position 'newPosition' on a parent collection stack. + */ + virtual void reorder( int newPosition ); + /** + * Paint simplified version of this object ( called when resizing, redrawing ). + */ + virtual void paintSkeleton( QPainter *p, double dpi = 72.0 ); + /** + * Requests a repaint operation. If blocking is false the painter is copied using QSDrvQt::copyPainter(), + * this function returns and drawing is performed in the background + */ + virtual void paint( QPainter *p, double dpi = 72.0, bool blocking=true, bool transparent=true ); + /** + * Requests a repaint operation. If blocking is false the driver is copied using QSDrv::copy(), + * this function returns and drawing is performed in the background + */ + virtual void draw( QSDrv *drv, bool blocking=true, bool transparent=true ) = 0; + /** + * When drawing is in background + */ + virtual bool busy() const { return false; } + /** + * Stops repainting immediately. This should be reimplemented if you allowind to repaint + * object in background. + */ + virtual void stop() {} + /** + * Return true if object is hit by mouse click. + */ + virtual bool isHit( const QSPt2f &p, QSDrv* drv ) { return box(drv).contains(p); } + /** + * Resize to canvas rect. Rect can be unnormalized ( size can be < 0 ). + * Drv ( its dpi value ) is used to map this values to mm's, + * calculating sizes of text labels, etc. + */ + virtual void setBox( const QSRectf& canvas_rect, QSDrv *drv ); + /** + * Return a bounding box of the object. Result rect can be unnormalized ( size can be < 0 ) + * Drv is used to obtains size of text labels etc. + */ + virtual QSRectf box( QSDrv *drv ); + /** + * Called when a new angle is set. + */ + virtual void setAngle( int deg ); + /** + * Returns the current angle + */ + virtual int angle() const { return 0; } + /** + * Return a center of a rotation. + */ + virtual QSPt2f rCenter( QSDrv *drv ); + /** + * Returns an object's name ( for a list of object etc. ) + */ + virtual QString name() { return tr("Unknown object"); } + /** + * Don't change it. It must always return 'false'. Do not reimplement this function in your own objects !. + */ + virtual bool isAxesShadow() { return false; } + /** + * Sets default X,Y or Z axia. Does not emit sigUpdate. + */ + void setDefaultAxis( QSAxis *axis ); + /** + * Default X,Y or Z axis. + */ + QSAxis *defaultAxis( int axisType ) const; + /** + * Maps position 'pos' to canvas ( screen ) coords. It is a simple wrapper around + * QSAxes::mixedToCanvas(). If there are no parent axes it always maps mmToPixels + * Returns a depth also. See QSAxes::CoordinateSystem + */ + QSPt3f mixedToCanvas( const QSPt3f& pos, int xCoordIn, int yCoordIn, int zCoordIn, double dpi ); + /** + * If there are no parent axes it always maps pixlesToMM. Useful tool to use in your own objects. + * See QSAxes::CoordinateSystem + */ + QSPt3f canvasToMixed( const QSPt3f& pos, int xCoordOut, int yCoordOut, int zCoordOut, double dpi ); + /** + * Sets the default axis. + */ + void setDefaultXAxis( int axisIndex ); + /** + * Sets the default axis. + */ + void setDefaultYAxis( int axisIndex ); + /** + * Sets the default axis. + */ + void setDefaultZAxis( int axisIndex ); + /** + * Returns an index of the default axis + */ + int defaultXAxis() const; + /** + * Returns an index of the default axis + */ + int defaultYAxis() const; + /** + * Returns an index of the default axis + */ + int defaultZAxis() const; + /** + * Saves all QObject properties + */ + virtual void loadStateFromStream( QDataStream& stream, QSObjectFactory *factory ); + /** + * Restores all QObject properties + */ + virtual void saveStateToStream( QDataStream& stream, QSObjectFactory *factory ); + + public slots: + /** + * Calls stop() + */ + virtual void parametersChanging(); + /** + * Emits sigUpdate() + */ + virtual void parametersChanged(); + /** + * Emits sigUpdate() + */ + virtual void forceUpdate(); + + signals: + void sigDrawEnds( QSCObject *me ); + /** + * Parameters has changed + */ + void sigUpdate( QSCObject *me ); + /** + * Parameters has changed ( the same as a signal above ). + */ + void sigUpdate(); + + protected: + QSAxes *m_parent_axes; + QSAxis *m_default_axis[3]; + bool m_auto_updates; + QSCObjectCollection *m_collection; + QSCGroup *m_group; + /** + * Called by collection when this object is inserted or removed (collection=NULL) from its list. + */ + virtual void setCollection( QSCObjectCollection *collection ); + /** + * Called when object is grouped or ungrouped(group=NULL) + */ + virtual void setGroup( QSCGroup *group ); + + private slots: + /** + * Checks if default axis is removed, if it is binds to another axis + */ + void axisRemoved( QSData *removedObject ); + /** + * Checks if parent axes are removed, Sets a parent axes to NULL in this case. + */ + void parentAxesRemoved( QSData *removedObject ); + }; + +//-------------------------------------------------------------------------------------------------// + +/** + * \brief Group of QSCObject s, which is also QSCObject. + * + * All its functionality is exposed through its object collection - see objects(). + */ +class QSCGroup : public QSCObject + { + Q_OBJECT + public: + /** + * Constructor + */ + QSCGroup( QObject *parent=NULL ); + /** + * Destructor + */ + virtual ~QSCGroup(); + /** + * Sets parent axes in all contained objects. + */ + virtual void setParentAxes( QSAxes *axes ); + /** + * Returns a list of grouped object. + */ + QSCObjectCollection *objects() const { return m_objects; } + /** + * Default style is Moveable | Resizeable + */ + virtual int style() { return Moveable | Resizeable; } + /** + * Reimplemented + */ + virtual void paintSkeleton( QPainter *p, double dpi = 72.0 ); + /** + * Reimplemented + */ + virtual void paint( QPainter *p, double dpi = 72.0, bool blocking=true, bool transparent=true ); + /** + * Reimplemented + */ + virtual void draw( QSDrv *drv, bool blocking=true, bool transparent=true ); + /** + * Reimplemented + */ + virtual bool busy() const; + /** + * Reimplemented + */ + virtual void stop(); + /** + * Reimplemented + */ + virtual bool isHit( const QSPt2f &p, QSDrv* drv ); + /** + * Reimplemented + */ + virtual void setBox( const QSRectf& canvas_rect, QSDrv *drv ); + /** + * Reimplemented + */ + virtual QSRectf box( QSDrv *drv ); + /** + * Reimplemented + */ + virtual QString name(); + /** + * Reimplemented + */ + virtual void loadStateFromStream( QDataStream& stream, QSObjectFactory *factory ); + /** + * Reimplemented + */ + virtual void saveStateToStream( QDataStream& stream, QSObjectFactory *factory ); + + protected: + QSCObjectCollection *m_objects; + bool m_w_minus; + bool m_h_minus; + + protected slots: + void slot_draw_ends(); + void slot_collection_changed(); + void slot_object_added( QSCObject * ); + void slot_object_removed( QSCObject * ); + }; + +#endif diff --git a/kmatplot/widgets/qsconsole.cpp b/kmatplot/widgets/qsconsole.cpp new file mode 100644 index 0000000..afef992 --- /dev/null +++ b/kmatplot/widgets/qsconsole.cpp @@ -0,0 +1,53 @@ +/*************************************************************************** + qsconsole.cpp - description + ------------------- + begin : Wed Jan 16 2002 + copyright : (C) 2002 by kamil + email : kamil@localhost.localdomain + ***************************************************************************/ + +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + +#include "qsconsole.h" + +QSConsole *QSConsole::m_default_console = NULL; + +//-------------------------------------------------------------------------// + +QSConsole::QSConsole() + { + m_default_console = this; + } + +//-------------------------------------------------------------------------// + +QSConsole::~QSConsole() + { + if ( m_default_console == this ) m_default_console = NULL; + } + +//-------------------------------------------------------------------------// + +void QSConsole::write( const QString& message ) + { + if ( m_default_console ) m_default_console->appendText( message ); + } + +//-------------------------------------------------------------------------// + +void QSConsole::appendText( const QString& ) + { + // lost in space + } + +//-------------------------------------------------------------------------// + + + diff --git a/kmatplot/widgets/qsconsole.h b/kmatplot/widgets/qsconsole.h new file mode 100644 index 0000000..e5a6a47 --- /dev/null +++ b/kmatplot/widgets/qsconsole.h @@ -0,0 +1,58 @@ +/*************************************************************************** + qsconsole.h - description + ------------------- + begin : Wed Jan 16 2002 + copyright : (C) 2002 by kamil + email : kamil@localhost.localdomain + ***************************************************************************/ + +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + +#ifndef QSCONSOLE_H +#define QSCONSOLE_H + +#include<qstring.h> + +/** + * \brief Sink for text messages generated by the library + * + * You will have to reimplement this class if you want to receive text messages from this library. + * Notice a little trick - if you create an object of this class a static pointer is set to this object. + * in the constructor. + * @author kamil + */ +class QSConsole { + public: + /** + * Constructor. Calls m_default_console = this. + */ + QSConsole(); + /** + * Destructor. Calls if ( m_default_console == this ) m_default_console = NULL. + */ + virtual ~QSConsole(); + /** + * Use this function to write text to the default console + */ + static void write( const QString& message ); + + protected: + /** + * You have to reimplement this function in your own custom console. + */ + virtual void appendText( const QString& message ) = 0; + /** + * Pointer to the default console. It is auto set when you creates + * an console object. + */ + static QSConsole *m_default_console; + }; + +#endif diff --git a/kmatplot/widgets/qscontour.cpp b/kmatplot/widgets/qscontour.cpp new file mode 100644 index 0000000..308057d --- /dev/null +++ b/kmatplot/widgets/qscontour.cpp @@ -0,0 +1,1902 @@ +/*************************************************************************** + qscontour.cpp + ------------------- + begin : 01-January-2000 + copyright : (C) 2000 by Kamil Dobkowski + email : kamildobk@poczta.onet.pl + ***************************************************************************/ + +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + + +#include "qscontour.h" +#include "qsconsole.h" +#include <math.h> +#include <list.h> +#include <algo.h> +#include <vector.h> +#include <assert.h> + +const double QSContour::EPS_VALUE = 1e-100; + +/** + * Possible problems + */ +struct QSContour::contour_levels_data { + int number; + QSGFill *fill; + QSGLine *line; + QSGFont *font; + int *angle; + double *value; + double *zvalue; + QString *label; + list<QSPt2f> *labels_pos; + }; + +#define MAX_BUFF_SIZE 10 + +struct QSContour::contour_runtime_data { + enum Stage { Prepare = 0, + DrawingFills = 1, + DrawingGrid = 2, + DrawingLines = 3, + DrawingLabels = 4, + DrawingPoints = 5, + DrawingEnds = 6 } stage; + int pi, pj; + int curr_level; + int triangles; + QSAxis *xaxis; + QSAxis *yaxis; + QSAxis *vaxis; + bool rectangle_grid; + contour_levels_data level; + int stack_ptr; + int stack_triangle[3]; + int stack_edge[3]; + bool stack_first[3]; + bool label_drawn; + + QSPt3f buff1[MAX_BUFF_SIZE]; + QSPt3f buff2[MAX_BUFF_SIZE]; + QSPt3f buff3[MAX_BUFF_SIZE]; + QSPt2f cbuff1[MAX_BUFF_SIZE]; + + QSPt2f rbuff[4]; + bool rbuff_is_empty; + int rbuff_curr_level; + + list<QSPt2f> curr_line; + double curr_line_len; + QSPt2f curr_pos; + + char *processed_triangles; + inline void set_triangle_processed( int triangle_number ); + inline bool triangle_processed( int triangle_number ); + inline void stack_push( int triangle, int edge, bool is_first ); + inline void stack_pop( int *triangle, int *edge, bool *is_first ); + }; + + + +//-------------------------------------------------------------// + +bool QSContour::contour_runtime_data::triangle_processed( int triangle_number ) +// 0x01 & ( d->processed_triangles[triangle_number/8] >> (triangle_number%8) ) + { + return 0x01 & ( processed_triangles[triangle_number>>3] >> (triangle_number&0x07) ); + } + +//-------------------------------------------------------------// + +void QSContour::contour_runtime_data::set_triangle_processed( int triangle_number ) + { + processed_triangles[triangle_number>>3] |= 1U<<(triangle_number&0x07); + } + +//-------------------------------------------------------------// + +void QSContour::contour_runtime_data::stack_push( int triangle, int edge, bool first ) + { + assert( stack_ptr < 2 && stack_ptr >= 0 ); + stack_triangle[stack_ptr] = triangle; + stack_edge[stack_ptr] = edge; + stack_first[stack_ptr++] = first; + } + +//-------------------------------------------------------------// + +void QSContour::contour_runtime_data::stack_pop( int *triangle, int *edge, bool *first ) + { + assert( stack_ptr < 3 && stack_ptr > 0 ); + *triangle = stack_triangle[--stack_ptr]; + *edge = stack_edge[stack_ptr]; + *first = stack_first[stack_ptr]; + } + +//-------------------------------------------------------------// +//-------------------------------------------------------------// + +QSContour::QSContour(QSAxes* parent, const char * name) +:QSPlot2D(parent,name) + { + assert( parent ); + m_label_spacing = 0.2; + m_labels = true; + m_fills = true; + m_lines = true; + m_title_str = tr("Untitled contour"); + + #define FILLS_NUM 0 + #define FONTS_NUM 0 + #define LINES_NUM 1 + #define POINTS_NUM 1 + + initAttributeTables( FONTS_NUM, FILLS_NUM, LINES_NUM, POINTS_NUM ); + m_settings.lines[Grid] = QSGLine::invisibleLine; + } + +//-------------------------------------------------------------// + +QSContour::~QSContour() + { + } + +//-------------------------------------------------------------// + +void QSContour::setContourFills( bool visible ) + { + SET_PROPERTY( m_fills, visible ); + } + +//-------------------------------------------------------------// + +void QSContour::setContourLines( bool visible ) + { + SET_PROPERTY( m_lines, visible ); + } + +//-------------------------------------------------------------// + +void QSContour::setContourLabels( bool visible ) + { + SET_PROPERTY( m_labels, visible ); + } + +//-------------------------------------------------------------// + +void QSContour::setLabelSpacing( double value ) + { + if ( value > 0.0 ) + SET_PROPERTY( m_label_spacing, value ); + } + +//-------------------------------------------------------------// +//-------------------------------------------------------------// +//-------------------------------------------------------------// +//-------------------------------------------------------------// + +void QSContour::allocRuntimeData() + { + QSPlot2D::allocRuntimeData(); + d = new contour_runtime_data(); + + d->pi = 0; + d->curr_level = 0; + d->xaxis = defaultAxis(QSAxis::XAxisType); + d->yaxis = defaultAxis(QSAxis::YAxisType); + d->vaxis = defaultAxis(QSAxis::VAxisType); + d->rectangle_grid = rectangleGrid(); + + d->level.number = 0; + d->level.fill = NULL; + d->level.font = NULL; + d->level.angle = NULL; + d->level.line = NULL; + d->level.value = NULL; + d->level.zvalue = NULL; + d->level.label = NULL; + d->level.labels_pos = NULL; + + d->stack_ptr = 0; + d->processed_triangles = NULL; + + d->rbuff_is_empty = true; + d->rbuff_curr_level = -1; + } + + + +//-------------------------------------------------------------// + +void QSContour::freeRuntimeData() + { + delete[] d->processed_triangles; + free_levels_data( &d->level ); + delete d; d = NULL; + QSPlot2D::freeRuntimeData(); + } + + + +//-------------------------------------------------------------// +//-------------------------------------------------------------// +//-------------------------------------------------------------// +//-------------------------------------------------------------// +//-------------------------------------------------------------// + +void QSContour::calculate_levels_data( contour_levels_data *level ) +// each level contains also a fill style used to fill areas below this level. +// przerobic legendItemSize + { + QSAxis *axis = defaultAxis( QSAxis::VAxisType ); + const list<QSAxisTic> *tics = axis->tics(); + + level->number = tics->size(); + level->value = new double[level->number+2]; + level->zvalue = new double[level->number+2]; + level->fill = new QSGFill[level->number+2]; + level->line = new QSGLine[level->number+2]; + level->font = new QSGFont[level->number+2]; + level->angle = new int[level->number+2]; + level->label = new QString[level->number+2]; + level->labels_pos = new list<QSPt2f>[level->number+2]; + + // first level at 0, all data below this level is drawn as transparent + level->line[0] = QSGLine::invisibleLine; + level->fill[0] = QSGFill::Transparent; + level->value[0] = 0.0; + level->label[0] = QString::null; + level->zvalue[0] = axis->rangeMin(); + level->number = level->number+1; + + // all tics from axis + list<QSAxisTic>::const_iterator curr_tic = tics->begin(); + for( int i=1; i<level->number; i++ ) { + level->line[i] = curr_tic->m_line; + level->font[i] = curr_tic->m_font; + level->angle[i] = curr_tic->m_angle; + level->value[i] = curr_tic->m_pos; + level->label[i] = curr_tic->m_label; + level->zvalue[i] = curr_tic->m_value; + level->fill[i] = curr_tic->m_fill; + // put gradient to axis + if ( !curr_tic->m_is_fill_defined ) m_gradient.fill( level->value[i], level->fill[i] ); + curr_tic++; + } + + // the last level + if ( level->value[level->number-1] < 1.0 ) { + level->line[level->number] = QSGLine::invisibleLine; + level->value[level->number] = 1.0; + level->label[level->number] = QString::null;; + level->zvalue[level->number] = axis->rangeMax(); + if ( !axis->reversed() && axis->lastTic().m_is_fill_defined ) + level->fill[level->number] = axis->lastTic().m_fill; + else m_gradient.fill( 1.0, level->fill[level->number] ); + level->number = level->number+1; + } + } + +//-------------------------------------------------------------// + +void QSContour::free_levels_data( contour_levels_data *level ) + { + delete[] level->fill; + delete[] level->font; + delete[] level->angle; + delete[] level->line; + delete[] level->value; + delete[] level->zvalue; + delete[] level->label; + delete[] level->labels_pos; + level->fill = NULL; + level->font = NULL; + level->angle = NULL; + level->line = NULL; + level->value = NULL; + level->zvalue = NULL; + level->label = NULL; + level->labels_pos = NULL; + } + +//-------------------------------------------------------------// + +bool QSContour::start() + { + QSPlot2D::start(); + d->stage = contour_runtime_data::Prepare; + return true; + } + +//-------------------------------------------------------------// + +bool QSContour::step() + { + switch( d->stage ) { + case contour_runtime_data::Prepare: call_prepare(); break; + case contour_runtime_data::DrawingFills: drawing_fills(); break; + case contour_runtime_data::DrawingGrid: drawing_grid(); break; + case contour_runtime_data::DrawingLines: drawing_lines(); break; + case contour_runtime_data::DrawingLabels: drawing_labels(); break; + case contour_runtime_data::DrawingPoints: drawing_points(); break; + default: return false; + } + return true; + } + +//-------------------------------------------------------------// + +void QSContour::call_prepare() + { + if ( prepare() ) { + d->pi = 0; + d->triangles = triangles(); + calculate_levels_data( &d->level ); + start_drawing_fills(); + } + } + +//-------------------------------------------------------------// + +void QSContour::start_drawing_fills() + { + m_drv->setFill( QSGFill::transparentFill ); + m_drv->setLine( QSGLine::invisibleLine ); + d->stage = contour_runtime_data::DrawingFills; + if ( !m_fills ) start_drawing_grid(); + } + +//-------------------------------------------------------------// + +void QSContour::drawing_fills() + { + QSPt3f min; // bounding cube + QSPt3f max; + + QSPt3f *inpts; // rotating buffers - input points + QSPt3f *abpts; // above points + QSPt3f *unpts; // under points + int ninpts; + int nabpts; + int nunpts; + + //QSGLine line; + QSPt2f buff[MAX_BUFF_SIZE]; + + int curr_step = 0; + while( d->pi < d->triangles ) { + // try to process the whole rectangle ( for faster redrawing ) + if ( (d->pi%4)==0 && d->rectangle_grid ) { + getRectangle( d->pi, d->buff1 ); + if ( draw_rectangle( d->buff1 ) ) { d->pi = d->pi + 4; continue; } + } + + flush_rectangle_buffer(); + + // get triangle + getTriangle( d->pi++, d->buff1 ); + + // bounding cube + min.x = d->buff1[0].x; min.x = QMIN(min.x,d->buff1[1].x); min.x = QMIN(min.x,d->buff1[2].x); + max.x = d->buff1[0].x; max.x = QMAX(max.x,d->buff1[1].x); max.x = QMAX(max.x,d->buff1[2].x); + min.y = d->buff1[0].y; min.y = QMIN(min.y,d->buff1[1].y); min.y = QMIN(min.y,d->buff1[2].y); + max.y = d->buff1[0].y; max.y = QMAX(max.y,d->buff1[1].y); max.y = QMAX(max.y,d->buff1[2].y); + min.z = d->buff1[0].z; min.z = QMIN(min.z,d->buff1[1].z); min.z = QMIN(min.z,d->buff1[2].z); + max.z = d->buff1[0].z; max.z = QMAX(max.z,d->buff1[1].z); max.z = QMAX(max.z,d->buff1[2].z); + + // check if is out of xy area + if ( !(min.x>1.0 || max.x<0.0 || min.y>1.0 || max.y<0.0) ) { + inpts = d->buff1; + ninpts = 3; + abpts = d->buff2; + unpts = d->buff3; + // draw levels + int level_nr = find_level_greater_than( min.z ); + while( level_nr<d->level.number && ninpts>0 ) { + // divide polygon to: under part ( under contour level ) and upper part ( over contour level ) + cut_polygon( d->level.value[level_nr], inpts, ninpts, abpts, &nabpts, unpts, &nunpts ); + // draw polygon under + if ( d->level.fill[level_nr].style != QSGFill::Transparent && nunpts > 1 ) { + for( int j=0; j<nunpts; j++ ) { buff[j].set( unpts[j].x, unpts[j].y ); } + m_drv->setFill( d->level.fill[level_nr] ); + m_drv->drawPoly2( buff, nunpts ); + } + // rotate buffers + QSPt3f *temp = inpts; inpts = abpts; ninpts = nabpts; abpts = temp; + // next level + level_nr++; + } + } + + // end with this little part ... + if ( curr_step++ > work_steps && m_bkg_handler ) return; + } + + // end drawing + flush_rectangle_buffer(); + start_drawing_grid(); + } + +//-------------------------------------------------------------// + +int QSContour::find_level_greater_than( double value ) +// find first level > value or return level.number if all levels are lower then value + { + double *first_level = &d->level.value[0]; + double *after_last_level = &d->level.value[d->level.number]; + double *ptr = lower_bound( first_level, after_last_level, value ); + int result = ptr < after_last_level ? ptr-first_level : d->level.number; + return result; + } + +//-------------------------------------------------------------// +/* +pts, rbuff layout + +0 _________ 1 + |\ / | + | \ / | + | \ | -> drawing direction + | / \ | + |/_______\| +3 2 + +*/ +bool QSContour::draw_rectangle( const QSPt3f pts[4] ) +// tries to draw rectangle if it is fully contained in some level ( single color ) +// or returns false otherwise. +// This function does not draw rectangles immediately on the screen but rather +// tries to collect them into the longer horizontal strips. + { + double min_z = pts[0].z; min_z = QMIN(min_z,pts[1].z); min_z = QMIN(min_z,pts[2].z); min_z = QMIN(min_z,pts[3].z); + double max_z = pts[0].z; max_z = QMAX(max_z,pts[1].z); max_z = QMAX(max_z,pts[2].z); max_z = QMAX(max_z,pts[3].z); + int level_nr = find_level_greater_than( max_z ); + // check if it is fully contained in some level ( drawn in single color ) + if ( level_nr == 0 || d->level.value[level_nr-1] <= min_z ) { + // try to join the new rectangle to the longer strip + if ( !d->rbuff_is_empty && + d->rbuff_curr_level == level_nr && + d->rbuff[1].y == pts[1].y && + d->rbuff[2].y == pts[2].y ) { + d->rbuff[1].x = pts[1].x; + d->rbuff[2].x = pts[2].x; + } else { + // flush rectangle buffer to the screen, and set it to the new rectangle + flush_rectangle_buffer(); + d->rbuff[0].x = pts[0].x; d->rbuff[0].y = pts[0].y; + d->rbuff[1].x = pts[1].x; d->rbuff[1].y = pts[1].y; + d->rbuff[2].x = pts[2].x; d->rbuff[2].y = pts[2].y; + d->rbuff[3].x = pts[3].x; d->rbuff[3].y = pts[3].y; + d->rbuff_is_empty = false; + d->rbuff_curr_level = level_nr; + } + return true; + } + return false; + } + + //-------------------------------------------------------------// + +void QSContour::flush_rectangle_buffer() +// draws the strip of rectangles collected by draw rectangle + { + if ( !d->rbuff_is_empty && d->rbuff_curr_level < d->level.number ) { + m_drv->setFill( d->level.fill[d->rbuff_curr_level] ); + m_drv->drawPoly2( d->rbuff, 4 ); + d->rbuff_is_empty = true; + } + } + +//-------------------------------------------------------------// + +void QSContour::start_drawing_grid() + { + d->stage = contour_runtime_data::DrawingGrid; + } + +//-------------------------------------------------------------// + +void QSContour::drawing_grid() + { + drawGrid(); + start_drawing_lines(); + } + +//-------------------------------------------------------------// + +void QSContour::start_drawing_lines() + { + d->pi = 0; + d->stack_ptr = 0; + d->curr_level = 0; + if ( m_lines ) { + init_triangle_buffer(); + d->stage = contour_runtime_data::DrawingLines; + } else { + start_drawing_points(); + } + } + +//-------------------------------------------------------------// + +void QSContour::drawing_lines() + { + int curr_step = 0; + while( d->curr_level < d->level.number ) { + double level = d->level.value[d->curr_level]; + + if ( d->level.line[d->curr_level].style == QSGLine::Invisible && + d->level.label[d->curr_level] == QString::null ) { + d->curr_level++; + continue; + } + + while( d->pi < d->triangles ) { + + // tracing contour line when stack isn't empty + while( d->stack_ptr > 0 ) { + int t, e; bool is_first; d->stack_pop( &t, &e, &is_first ); + + // if this triangle was processed make its neighboutr the current triangle + // if there is no neighbour or the neighbour is already processed - end with this + // tracing ( Wow ! Look at those operators ! ) + if ( d->triangle_processed(t) ) + if ( !getNeighbouringTriangle(&t,&e) || d->triangle_processed(t) ) { end_contour(d->curr_level); continue; } + + getTriangle( t, d->buff1, level ); + if ( is_first ) start_contour( d->buff1[e], d->buff1[(e+1)%3], d->curr_level ); + + // find cross point on other edges + if ( e != 0 && (d->buff1[0].z<level) != (d->buff1[1].z<level) ) { d->stack_push(t,0,false ); draw_contour(d->buff1[0],d->buff1[1],d->curr_level); } + else + if ( e != 1 && (d->buff1[1].z<level) != (d->buff1[2].z<level) ) { d->stack_push(t,1,false ); draw_contour(d->buff1[1],d->buff1[2],d->curr_level); } + else + if ( e != 2 && (d->buff1[2].z<level) != (d->buff1[0].z<level) ) { d->stack_push(t,2,false ); draw_contour(d->buff1[2],d->buff1[0],d->curr_level); } + + d->set_triangle_processed(t); + + // put assert( d->stack_ptr != 0 ) rather + if ( d->stack_ptr == 0 ) end_contour(d->curr_level); + + // end with this little part ... + if ( curr_step++ > work_steps && m_bkg_handler ) return; + } + + // search for triangles where we can start a isocurve tracing algorithm + if ( !d->triangle_processed(d->pi) ) { + + // try to process the whole rectangle ( for faster redrawing ) + if ( (d->pi%4)==0 && d->rectangle_grid ) { + getRectangle( d->pi, d->buff1 ); + double min_z = d->buff1[0].z; min_z = QMIN(min_z,d->buff1[1].z); min_z = QMIN(min_z,d->buff1[2].z); min_z = QMIN(min_z,d->buff1[3].z); + double max_z = d->buff1[0].z; max_z = QMAX(max_z,d->buff1[1].z); max_z = QMAX(max_z,d->buff1[2].z); max_z = QMAX(max_z,d->buff1[3].z); + if ( (min_z<level) == (max_z<level) ) { d->pi = d->pi + 4; continue; } + } + + // check if the current triangle crosses the current level + // put on the stack the first found point ( its triangle and edge ) + // put it two times ( it will be traced in both directions ) + getTriangle( d->pi, d->buff1, level ); + if ( (d->buff1[0].z<level) != (d->buff1[1].z<level) ) { d->stack_push(d->pi,0,true); d->stack_push(d->pi,0,true); } + else + if ( (d->buff1[1].z<level) != (d->buff1[2].z<level) ) { d->stack_push(d->pi,1,true); d->stack_push(d->pi,1,true); } + else + if ( (d->buff1[2].z<level) != (d->buff1[0].z<level) ) { d->stack_push(d->pi,2,true); d->stack_push(d->pi,2,true); } + } + + d->pi++; + // end with this little part ... + if ( curr_step++ > work_steps && m_bkg_handler ) return; + } + + init_triangle_buffer(); + d->curr_level++; d->pi= 0; + } + + start_drawing_labels(); + } + +//-------------------------------------------------------------// + +void QSContour::start_drawing_labels() + { + d->curr_level = 0; + d->stage = contour_runtime_data::DrawingLabels; + } + +//-------------------------------------------------------------// + +void QSContour::drawing_labels() + { + while( d->curr_level < d->level.number ) { + m_drv->setFont( d->level.font[d->curr_level] ); + list<QSPt2f>::iterator first = d->level.labels_pos[d->curr_level].begin(); + list<QSPt2f>::iterator last = d->level.labels_pos[d->curr_level].end(); + list<QSPt2f>::iterator curr = first; + + while( curr != last ) m_drv->drawRText2( *curr++, d->level.angle[d->curr_level], d->level.label[d->curr_level], AlignVCenter | AlignHCenter ); + + d->level.labels_pos[d->curr_level].erase( first, last ); + d->curr_level++; + } + + start_drawing_points(); + } + +//-------------------------------------------------------------// + +void QSContour::start_drawing_points() + { + d->stage = contour_runtime_data::DrawingPoints; + } + +//-------------------------------------------------------------// + +void QSContour::drawing_points() + { + drawPoints(); + d->stage = contour_runtime_data::DrawingEnds; + } + +//-------------------------------------------------------------// + +void QSContour::end() + { + // all clean-up work is done in freeRuntimeData() + QSPlot2D::end(); + } + +//-------------------------------------------------------------// + +void QSContour::init_triangle_buffer() + { + int size = d->triangles/8+7; + if ( !d->processed_triangles ) d->processed_triangles = new char[size]; + char *ptr = d->processed_triangles; + for( int i=0; i<size; i++ ) *ptr++ = 0; + } + +//-------------------------------------------------------------// + +void QSContour::start_contour( const QSPt3f& p1, const QSPt3f& p2, int level ) +// start contour 'level' one the edge from p1 to p2 + { + // calculate the position where the contour plane crosses the edge + double t = (p2.z-p1.z) ? (d->level.value[level]-p1.z)/(p2.z-p1.z) : 0.0; + QSPt2f w = QSPt2f(p1.x+t*(p2.x-p1.x),p1.y+t*(p2.y-p1.y)); + + d->label_drawn = false; + // clean the buffer + d->curr_pos = w; + d->curr_line_len = 0.0; + d->curr_line.erase( d->curr_line.begin(), d->curr_line.end() ); + + m_drv->setFont( d->level.font[level] ); + m_drv->setLine( d->level.line[level] ); + m_drv->beginPolyline2( w ); + } + +//-------------------------------------------------------------// + +#define GRID_SPACING 0.8 + +void QSContour::draw_contour( const QSPt3f& p1, const QSPt3f& p2, int level ) +// draw conotur line to the edge (p1,p1) +// accumulate lines in buffer instead of direct drawing. When line in +// buffer has a apriopriate length, flush the buffer using draw_line_buffer + { + // calculate position where the level plane crosses the edge + double t = (p2.z-p1.z) ? (d->level.value[level]-p1.z)/(p2.z-p1.z) : 0.0; + QSPt2f new_pos = QSPt2f( p1.x + t*(p2.x-p1.x), p1.y + t*(p2.y-p1.y) ); + + // don't draw, write the point to the buffer + d->curr_line.push_back( new_pos ); + + // calculate the length of a line in the buffer + d->curr_line_len += distance( new_pos, d->curr_pos ); + d->curr_pos = new_pos; + + // if the line has an apriopriate length draw it on the screen + if ( d->curr_line_len > m_label_spacing*2.0 ) { draw_line_buffer( level ); d->curr_line_len = 0.0; } + } + +//-------------------------------------------------------------// + +void QSContour::end_contour( int level ) + { + draw_line_buffer( level ); + m_drv->endPolyline2(); + } + +//-------------------------------------------------------------// + +void QSContour::draw_line_buffer( int level ) + { + list<QSPt2f>::iterator first = d->curr_line.begin(); + list<QSPt2f>::iterator last = d->curr_line.end(); + list<QSPt2f>::iterator curr = first; + + // calculate the position of the label - in the middle of this segment + if ( m_labels && !d->label_drawn && first != last && !d->level.label[level].isEmpty() && d->curr_line_len > m_label_spacing ) { + // search for the middle + QSPt2f prev = *curr; + double curr_len = 0; + while( curr != last ) { + curr_len += distance( *curr, prev ); + if ( curr_len > m_label_spacing*(0.5*(level%3)+0.5) ) { + // calculate the position of the curve label + QSPt2f lpos = QSPt2f( prev.x+(curr->x-prev.x)/2, prev.y+(curr->y-prev.y)/2 ); + m_drv->setPolylineLabelPlace2( d->level.label[level], lpos, d->level.angle[level] ); + d->level.labels_pos[level].push_back( lpos ); + d->label_drawn = true; + break; + } + prev = *curr; curr++; + } + } else { + // turns off labels + m_drv->setPolylineLabelPlace2( QString::null, QSPt2f(), 0 ); + } + + // draw contour line ( leave the place for the label ) + curr = first; + while( curr != last ) m_drv->drawPolylineTo2( *curr++ ); + + d->curr_line.erase( first, last ); + } + +//-------------------------------------------------------------// + + +void QSContour::cut_polygon( double level, const QSPt3f *pts, int npts, + QSPt3f *above_pts, int *above_npts, + QSPt3f *under_pts, int *under_npts, + QSPt3f *cross_line, int *cross_npts ) + { + bool p_under; + bool s_under; + *above_npts = 0; + *under_npts = 0; + if ( cross_npts ) *cross_npts = 0; + + const QSPt3f *p; + const QSPt3f *s = &pts[npts-1]; s_under = ( s->z <= level ); + for( int i=0; i<npts; i++ ) { + p = &pts[i]; p_under = ( p->z <= level ); + + if ( p_under && s_under ) under_pts[(*under_npts)++] = *p; + else + if ( !p_under && !s_under ) above_pts[(*above_npts)++] = *p; + else { + double t = (level-s->z)/(p->z-s->z); + QSPt3f c( s->x + t*(p->x-s->x), + s->y + t*(p->y-s->y), + level ); + under_pts[(*under_npts)++] = c; + above_pts[(*above_npts)++] = c; + if ( cross_line && cross_npts ) cross_line[(*cross_npts)++]=c; + + if ( p_under ) under_pts[(*under_npts)++] = *p; + if ( !p_under ) above_pts[(*above_npts)++] = *p; + } + + s = p; s_under = p_under; + } + } + + +//-------------------------------------------------------------// + +QString QSContour::posInfo( QSPt2f& pos ) + { + QString result = QString::null; + if ( m_busy ) return result; + + //QSPt2f p = m_axes->fcanvasToWorld( QSPt2f(pos.x,pos.y) ); + QSRectf clip_area( pos.x-2.0, pos.y-2.0, 5.0, 5.0 ); + + allocRuntimeData(); + calculate_levels_data( &d->level ); + d->triangles = triangles(); + + int triangle = triangleAtPos( pos ); + + if ( triangle >= 0 ) { + QSPt3f pts[3]; + QSPt2f ppts[5]; + for( int i=0; i<d->level.number; i++ ) { + getTriangle( triangle, pts, d->level.value[i] ); + int nabpts = 0; + int nunpts = 0; + int ncpts = 0; + + cut_polygon( d->level.value[i], pts, 3, d->buff1, &nabpts, d->buff2, &nunpts, d->buff3, &ncpts ); + + // hit at contour filled area + if ( result.isEmpty() && m_fills && d->level.fill[i].style != QSGFill::Transparent && nunpts > 0 ) { + for( int j=0; j<nunpts; j++ ) ppts[j] = m_proj->world2DToCanvas( QSPt2f(d->buff2[j].x,d->buff2[j].y) ); + if ( QSProjection::pointInPoly(pos,ppts,nunpts) ) { + result = QString(tr(" Level "))+QString::number(i)+"\n"; + result += QString(tr(" Level max z-value = "))+QString::number(d->level.zvalue[i])+" \n"; + if ( i>0 ) result += QString(tr(" Level min z-value = "))+QString::number(d->level.zvalue[i-1])+" \n"; + result += "\n"; + } + } + + // hit exactly at contour line + if ( m_lines && d->level.line[i].style != QSGLine::Invisible && ncpts>1 ) { + d->cbuff1[0] = m_proj->world2DToCanvas( QSPt2f(d->buff3[0].x,d->buff3[0].y) ); + d->cbuff1[1] = m_proj->world2DToCanvas( QSPt2f(d->buff3[1].x,d->buff3[1].y) ); + if ( m_proj->clipLine(&d->cbuff1[0],&d->cbuff1[1],clip_area.pos,clip_area.size) ) { + result = QString(tr(" Level "))+QString::number(i)+"\n"; + result += QString(tr(" Level z-value = "))+QString::number(d->level.zvalue[i])+" \n"; + result += "\n"; + } + } + + // hit exacty at triangle vertex + if ( i == 0 ) + if ( point(PointMark).style != QSGPoint::Invisible || line(Grid).style != QSGLine::Invisible ) + for( int j=0; j<3; j++ ) + if ( clip_area.contains( m_proj->world2DToCanvas( QSPt2f(pts[j].x,pts[j].y) ) ) ) + result += vertexInfo(triangle,j,pos); + } + } + + freeRuntimeData(); + return result; + } + + + +//-------------------------------------------------------------// + +bool QSContour::isClicked( const QSPt2f& pos ) + { + QSPt2f p = pos; + if ( posInfo(p) != QString::null ) return true; + return false; + } + +//-------------------------------------------------------------// + +#define BOX_SPACE 2.0 +#define BOX_WIDTH 20.0 +#define BOX_HEIGHT 100.0 + +QSPt2f QSContour::legendItemSize( QSDrv *drv ) + { + double boxSpace = drv->toPixels(BOX_SPACE); + QSPt2f boxSize( drv->toPixels(BOX_WIDTH), + drv->toPixels(BOX_HEIGHT) ); + QSPt2f tsize = drv->rTextSize( 270, title() ); + QSPt2f lsize; + QString label; + int nr_labels = 0; +// int axis = defaultAxis(QSAxes::VAxisType); + contour_levels_data level; + calculate_levels_data( &level ); + for ( int i=0; i<level.number; i++ ) { + if ( !level.label[i].isEmpty() ) { + QSPt2f size = drv->textSize( level.label[i] ); + lsize.x = QMAX(lsize.x, size.x); + lsize.y = QMAX(lsize.y, size.y); + nr_labels++; + } + } + + free_levels_data( &level ); + boxSize.y = QMAX(boxSize.y,nr_labels*lsize.y); + return QSPt2f( tsize.x+boxSpace+boxSize.x+boxSpace+boxSpace+boxSpace+lsize.x, QMAX(tsize.y,boxSize.y) ); + } + +//-------------------------------------------------------------// + +void QSContour::drawLegendItem( const QSPt2f& pos, QSDrv *drv ) + { + double boxSpace = drv->toPixels(BOX_SPACE); + QSPt2f boxSize( drv->toPixels(BOX_WIDTH), + drv->toPixels(BOX_HEIGHT) ); + + contour_levels_data level; + calculate_levels_data( &level ); + + // title + QSPt2f tsize = drv->rTextSize( 270, title() ); + double height = boxSize.y = legendItemSize(drv).y; + drv->drawRText( QSPt2f(pos.x,pos.y+height/2.0), 270, title(), AlignHCenter | AlignTop ); + + double y0 = pos.y+(height-boxSize.y)/2.0; + double x1 = pos.x+tsize.x+boxSpace; + double x2 = x1+boxSize.x-1; + + // gradient + for( int e=0; e<3; e++ ) { + double prev_pos = 0.0; + double curr_pos = 0.0; + + for ( int i=0; i<level.number; i++ ) { + prev_pos = curr_pos; + curr_pos = level.value[i]; + if ( prev_pos <= 1.0 && curr_pos >= 0.0 ) { + double y1 = y0 + (1.0-QMAX(0.0,prev_pos)) * (boxSize.y-1) ; + double y2 = y0 + (1.0-QMIN(1.0,curr_pos)) * (boxSize.y-1) ; + if ( e == 1 && m_fills ) { + drv->setFill( level.fill[i] ); + drv->setLine( QSGLine::invisibleLine ); + QSPt2f pts[4]; + pts[0].set(x1,y1); + pts[1].set(x2,y1); + pts[2].set(x2,y2); + pts[3].set(x1,y2); + drv->drawPoly( pts, 4 ); + } + if ( curr_pos>=0.0 && curr_pos<=1.0 ) { + if ( e == 2 && m_lines ) { + drv->setLine( level.line[i] ); + drv->drawLine( QSPt2f(x1+1,y2), QSPt2f(x2-2,y2) ); + } + if ( e == 0 && !level.label[i].isEmpty() ) { + drv->drawText( QSPt2f(x2+boxSpace+boxSpace+boxSpace,y2), level.label[i], AlignLeft | AlignVCenter ); + } + } + } + } + } + + free_levels_data( &level ); + } + + +//-------------------------------------------------------------// + +void QSContour::loadStateFromStream( QDataStream& stream, QSObjectFactory *factory ) + { + QSPlot2D::loadStateFromStream( stream, factory ); + } + +//-------------------------------------------------------------// + +void QSContour::saveStateToStream( QDataStream& stream, QSObjectFactory *factory ) + { + QSPlot2D::saveStateToStream( stream, factory ); + } + + + + +//-------------------------------------------------------------// +//-------------------------------------------------------------// +//-------------------------------------------------------------// +//-------------------------------------------------------------// +//-------------------------------------------------------------// + +struct QSGriddedContour::gridded_contour_runtime_data { + QSAxis *xaxis; + QSAxis *yaxis; + QSAxis *vaxis; + QSMatrix *xvector; + QSMatrix *yvector; + QSMatrix *data; + int w; + int h; + int dw; // working area width + int dh; // working area height + bool is_x_vector; + bool is_y_vector; + QSPt2 min; + QSPt2 max; + int curr_x_pos; + int curr_y_pos; + int curr_grid_number; + QSPt3f curr_grid[5]; + }; + +QSGriddedContour::QSGriddedContour(QSAxes* parent, const char * name) +:QSContour( parent, name ) + { + d = NULL; + m_dmin = 0.0; + m_dmax = 0.0; + m_evalid = false; + static const int CHANNELS_NUM = 3; + initChannelTable( CHANNELS_NUM ); + } + + //-------------------------------------------------------------// + +QSGriddedContour::~QSGriddedContour() + { + } + +//-------------------------------------------------------------// + +int QSGriddedContour::triangles() +// each grid mesh is divided into four triangles + { + return QMAX(0,d->dw-1)*QMAX(0,d->dh-1)*4; + } + +//-------------------------------------------------------------// + + + +/* + + Triangle numbers + + ___________________ + |\ 1 / |\ 5 / + | \ / | \ / + | 0 \ 2 | 4 \ 6 .... + | / 3 \ | / 7 \ + |/_______\|/_______\ + + + Number of vertices in buffer + +0 _________ 1 + |\ / | + | \ / | + | \ | 4 - in the middle + | / \ | + |/_______\| +3 2 + + Triangle vertices +1 0 + |\ /| 2 + | \ 2/ | / \ + | / 2 0 --- 1 \ | 1---0 + |/ \ / \| +0 2 1 + + edge 0 is between 0 and 1 + edge 1 is between 1 and 2 + edge 3 is between 2 and 0 +*/ +void QSGriddedContour::getTriangle( int number, QSPt3f pts[3], double level ) + { + load_mesh_into_buffer( number ); + + int tr_number = number % 4; + + switch( tr_number ) { + case 0: pts[0] = d->curr_grid[3]; pts[1] = d->curr_grid[0]; pts[2] = d->curr_grid[4]; break; + case 1: pts[0] = d->curr_grid[0]; pts[1] = d->curr_grid[1]; pts[2] = d->curr_grid[4]; break; + case 2: pts[0] = d->curr_grid[1]; pts[1] = d->curr_grid[2]; pts[2] = d->curr_grid[4]; break; + case 3: pts[0] = d->curr_grid[2]; pts[1] = d->curr_grid[3]; pts[2] = d->curr_grid[4]; break; + default: break; + } + + // we don't want our triangle to cross a level plane exactly at an vertex + if ( pts[0].z == level ) pts[0].z += EPS_VALUE; + if ( pts[1].z == level ) pts[1].z += EPS_VALUE; + if ( pts[2].z == level ) pts[2].z += EPS_VALUE; + } + +//-------------------------------------------------------------// + +void QSGriddedContour::getRectangle( int triangleNumber, QSPt3f pts[4] ) + { + load_mesh_into_buffer( triangleNumber ); + pts[0] = d->curr_grid[0]; + pts[1] = d->curr_grid[1]; + pts[2] = d->curr_grid[2]; + pts[3] = d->curr_grid[3]; + } + +//-------------------------------------------------------------// + +void QSGriddedContour::load_mesh_into_buffer( int triangleNumber ) +// loads mesh ( rectangle ) to the d->curr_grid buffer + { + int gr_number = triangleNumber >> 2 ; // divide by 4 + + // check if is in buffer + if ( gr_number != d->curr_grid_number ) { + + int x_pos = d->min.x + gr_number % (d->dw-1); + int y_pos = d->min.y + gr_number / (d->dw-1); + + // most requests will be with the increased x_pos + if ( x_pos == d->curr_x_pos+1 && y_pos == d->curr_y_pos ) { + d->curr_grid[0] = d->curr_grid[1]; + d->curr_grid[3] = d->curr_grid[2]; + } else { + d->curr_grid[0].x = d->curr_grid[3].x = xvector(x_pos); + d->curr_grid[0].y = yvector(y_pos+0); + d->curr_grid[3].y = yvector(y_pos+1); + d->curr_grid[0].z = d->data->value(y_pos+0,x_pos); + d->curr_grid[3].z = d->data->value(y_pos+1,x_pos); + d->curr_grid[0] = dataToWorldV( d->curr_grid[0] ); + d->curr_grid[3] = dataToWorldV( d->curr_grid[3] ); + } + + d->curr_grid[1].x = d->curr_grid[2].x = xvector(x_pos+1); + d->curr_grid[1].y = yvector(y_pos+0); + d->curr_grid[2].y = yvector(y_pos+1); + d->curr_grid[1].z = d->data->value(y_pos+0,x_pos+1); + d->curr_grid[2].z = d->data->value(y_pos+1,x_pos+1); + d->curr_grid[1] = dataToWorldV( d->curr_grid[1] ); + d->curr_grid[2] = dataToWorldV( d->curr_grid[2] ); + + d->curr_grid[4] = d->curr_grid[0] + + d->curr_grid[1] + + d->curr_grid[2] + + d->curr_grid[3]; + d->curr_grid[4].x /= 4.0; + d->curr_grid[4].y /= 4.0; + d->curr_grid[4].z /= 4.0; + + d->curr_grid_number = gr_number; + d->curr_x_pos = x_pos; + d->curr_y_pos = y_pos; + } + } + +//-------------------------------------------------------------// + +bool QSGriddedContour::getNeighbouringTriangle( int *number, int *edge ) + { + //int grid_x; + //int grid_y; + int tr_number = *number & 0x03; + switch( *edge ) { + case 1: *number = tr_number==3 ? *number-3 : *number+1; *edge = 2; return true; + case 2: *number = tr_number==0 ? *number+3 : *number-1; *edge = 1; return true; + case 0: { + int grid_number = *number>>2; + int grid_x = grid_number % (d->dw-1); + int grid_y = grid_number / (d->dw-1); + switch( tr_number ) { + case 0: if ( grid_x > 0 ) { *number -= 2; return true; } else return false; + case 1: if ( grid_y > 0 ) { *number -= (d->dw-1 << 2) - 2; return true; } else return false; + case 2: if ( grid_x < d->dw-2 ) { *number += 2; return true; } else return false; + case 3: if ( grid_y < d->dh-2 ) { *number += (d->dw-1 << 2) - 2; return true; } else return false; + } + } + } + return false; + } + +//-------------------------------------------------------------// + +bool QSGriddedContour::getAxisRange( QSAxis *axis, double& min, double& max ) + { + allocRuntimeData(); + if ( d->w == 0 || d->h == 0 ) { freeRuntimeData(); return false; } + + if ( !m_evalid ) { + for( int j=0; j<d->h; j++ ) { + for( int i=0; i<d->w; i++ ) { + double vmax; + double vmin; + vmax = vmin = value(j,i,Data); + if ( i == 0 && j == 0 ) { + m_dmax = vmax; + m_dmin = vmin; + } else { + m_dmin = QMIN( m_dmin, vmin ); + m_dmax = QMAX( m_dmax, vmax ); + } + } // for ( i= .. + } // for ( j= ... + m_evalid = true; + } + + double xmin = xvector(0); + double xmax = xvector(d->w-1); + double ymin = yvector(0); + double ymax = yvector(d->h-1); + if ( xmin > xmax ) { double xtemp = xmin; xmin = xmax; xmax = xtemp; } + if ( ymin > ymax ) { double ytemp = ymin; ymin = ymax; ymax = ytemp; } + + if ( axis == d->xaxis ) { min = xmin; max = xmax; } + else if ( axis == d->yaxis ) { min = ymin; max = ymax; } + else if ( axis == d->vaxis ) { min = m_dmin; max = m_dmax; } + else { freeRuntimeData(); return false; } + + freeRuntimeData(); + return true; + } + +//-------------------------------------------------------------// + +QString QSGriddedContour::vertexInfo( int t, int v, QSPt2f& pos ) + { + QString result = QString::null; + + QSPt3f buff[MAX_BUFF_SIZE]; + getTriangle( t, buff ); + + int row = 0; + int col = 0; + if ( v!=2 ) { + switch( ((t%4)+v)%4 ) { + case 0: col = d->curr_x_pos; row = d->curr_y_pos+1; break; + case 1: col = d->curr_x_pos; row = d->curr_y_pos ; break; + case 2: col = d->curr_x_pos+1; row = d->curr_y_pos ; break; + case 3: col = d->curr_x_pos+1; row = d->curr_y_pos+1; break; + } + double x = xvector(col); + double y = yvector(row); + double z = d->data->value(row,col); + pos = m_axes->dataToCanvas( QSPt2f(x,y), d->xaxis, d->yaxis ); + result = tr(" Data point: \n"); + result += tr(" row = ")+QString::number(row)+tr(", col = ")+QString::number(col)+" \n"; + result += tr(" X = ")+QString::number(x) + "\n"; + result += tr(" Y = ")+QString::number(y) + "\n"; + result += tr(" Z = ")+QString::number(z) + "\n"; + result += "\n"; + } + + return result; + } + +//-------------------------------------------------------------// + +int QSGriddedContour::triangleAtPos( const QSPt2f& pos ) +// the very ineffective + { + QSPt2f pts[3]; + //QSPt2f p = m_proj->canvasToWorld2D( QSPt2f(pos.x,pos.y) ); + QSPt3f buff[MAX_BUFF_SIZE]; + int triangles_count = triangles(); + for ( int i=0; i<triangles_count; i++ ) { + getTriangle( i, buff ); + pts[0] = m_proj->world2DToCanvas( QSPt2f(buff[0].x,buff[0].y) ); //.set( buff[0].x, buff[0].y ); + pts[1] = m_proj->world2DToCanvas( QSPt2f(buff[1].x,buff[1].y) ); //.set( buff[1].x, buff[1].y ); + pts[2] = m_proj->world2DToCanvas( QSPt2f(buff[2].x,buff[2].y) ); //.set( buff[2].x, buff[2].y ); + if ( QSProjection::pointInPoly(pos,pts,3) ) return i; + } + return -1; + } + +//-------------------------------------------------------------// + +void QSGriddedContour::dataChanged( int channel ) +// Ouu. We need to calculate new extremes in data +// Refresh data on screen also. + { + if ( channel == Data || channel == -1 ) m_evalid = false; + QSContour::dataChanged( channel ); + } + +//-------------------------------------------------------------// + +void QSGriddedContour::allocRuntimeData() + { + QSContour::allocRuntimeData(); + d = new gridded_contour_runtime_data(); + d->xaxis = defaultAxis(QSAxis::XAxisType); + d->yaxis = defaultAxis(QSAxis::YAxisType); + d->vaxis = defaultAxis(QSAxis::VAxisType); + d->curr_grid_number = -999; + d->curr_x_pos = -999; + d->curr_y_pos = -999; + d->is_x_vector = false; + d->is_y_vector = false; + d->w = matrixCols( Data ); + d->h = matrixRows( Data ); + d->data = matrix( Data ); + d->xvector = matrix( XVector ); + d->yvector = matrix( YVector ); + if ( matrixCols( XVector ) == d->w && + matrixRows( XVector ) > 0 ) d->is_x_vector = true; + else d->is_x_vector = false; + + if ( matrixRows( YVector ) == d->h && + matrixCols( YVector ) > 0 ) d->is_y_vector = true; + else d->is_y_vector = false; + calculate_data_range(); + } + +//-------------------------------------------------------------// + +void QSGriddedContour::freeRuntimeData() + { + QSContour::freeRuntimeData(); + delete d; d = NULL; + } + +//-------------------------------------------------------------// + +void QSGriddedContour::drawGrid() + { + if ( line(Grid).style == QSGLine::Invisible ) return; + + m_drv->setLine( line(Grid) ); + int pi = d->min.x; + int pj = d->min.y; + + while( pi >= d->min.x && pi <= d->max.x ) { + QSPt2f p1 = dataToWorld(QSPt2f(xvector(pi),yvector(0) ) ); + QSPt2f p2 = dataToWorld(QSPt2f(xvector(pi),yvector(d->h-1)) ); + m_drv->drawLine2( p1, p2 ); + pi++; + } + + while( pj >= d->min.y && pj <= d->max.y ) { + QSPt2f p1 = dataToWorld(QSPt2f(xvector(0), yvector(pj)) ); + QSPt2f p2 = dataToWorld(QSPt2f(xvector(d->w-1),yvector(pj)) ); + m_drv->drawLine2( p1, p2 ); + pj++; + } + } + +//-------------------------------------------------------------// + +void QSGriddedContour::drawPoints() + { + if ( point(PointMark).style == QSGPoint::Invisible ) return; + + int pi = d->min.x; + int pj = d->min.y; + + QString label; + QSGPoint point_style = point(PointMark); + while( pj >= d->min.y && pj <= d->max.y ) { + while( pi >= d->min.x && pi <= d->max.x ) { + m_drv->drawPoint2( dataToWorld(QSPt2f(xvector(pi),yvector(pj))), point_style ); + pi++; + } + pj++; pi = d->min.x; + } + } + +//-------------------------------------------------------------// + +double QSGriddedContour::yvector( int row ) + { + return d->is_y_vector ? d->yvector->value(row,0) : row; + } + +//-------------------------------------------------------------// + +double QSGriddedContour::xvector( int col ) + { + return d->is_x_vector ? d->xvector->value(0,col) : col; + } + +//-------------------------------------------------------------// + +void QSGriddedContour::calculate_data_range() +// which grid rectangles are to be drawn +// ( including those partialy overlapping a drawing area ) + { + int i; + bool is_p_in; + bool is_c_in; + double cvalue = 0.0; + double pvalue = 0.0; + + d->min.x = d->w; // empty area + d->max.x = -1; + for( i=0;i<d->w;i++ ) { + pvalue = cvalue; + cvalue = d->xaxis->dataToWorld(xvector(i)); + is_p_in = ( pvalue >= 0.0 && pvalue <= 1.0 && i>0 ); + is_c_in = ( cvalue >= 0.0 && cvalue <= 1.0 && i>0 ); + if ( is_c_in || is_p_in ) { + d->min.x = QMIN( d->min.x, i-1 ); + d->max.x = QMAX( d->max.x, i ); + } + if ( i>0 && pvalue < 0.0 && cvalue > 1.0 || + i>0 && cvalue < 0.0 && pvalue > 1.0 ) { + d->min.x = i-1; d->max.x = i; + } + } + + d->min.y = d->h; // empty area + d->max.y = -1; + for( i=0;i<d->h;i++ ) { + pvalue = cvalue; + cvalue = d->yaxis->dataToWorld(yvector(i)); + is_p_in = ( pvalue >= 0.0 && pvalue <= 1.0 && i>0 ); + is_c_in = ( cvalue >= 0.0 && cvalue <= 1.0 && i>0 ); + if ( is_c_in || is_p_in ) { + d->min.y = QMIN( d->min.y, i-1 ); + d->max.y = QMAX( d->max.y, i ); + } + if ( i>0 && pvalue < 0.0 && cvalue > 1.0 || + i>0 && cvalue < 0.0 && pvalue > 1.0 ) { + d->min.y = i-1; + d->max.y = i; + } + } + + d->dw = QMAX( 0, d->max.x-d->min.x+1 ); + d->dh = QMAX( 0, d->max.y-d->min.y+1 ); + } + +//-------------------------------------------------------------// + +void QSGriddedContour::loadStateFromStream( QDataStream& stream, QSObjectFactory *factory ) + { + QSContour::loadStateFromStream( stream, factory ); + } + +//-------------------------------------------------------------// + +void QSGriddedContour::saveStateToStream( QDataStream& stream, QSObjectFactory *factory ) + { + QSContour::saveStateToStream( stream, factory ); + } + +//-------------------------------------------------------------// + +QString QSGriddedContour::channelVariable( int channel ) const + { + switch( channel ) { + case Data: return "v"; + case XVector: return "x"; + case YVector: return "y"; + } + return QString::null; + } + +//-------------------------------------------------------------// + +QSGriddedContour::ColumnType QSGriddedContour::columnType( int, int ) const + { + return ColumnUnknown; + } + + + + +//-------------------------------------------------------------// +//-------------------------------------------------------------// +//-------------------------------------------------------------// +//-------------------------------------------------------------// +//-------------------------------------------------------------// +//-------------------------------------------------------------// + +struct QSNonGriddedContour::non_gridded_contour_runtime_data { + QSAxis *xaxis; + QSAxis *yaxis; + QSAxis *vaxis; + int m_npoints; + int m_ntriangles; + QSMatrix *m_points_x; + QSMatrix *m_points_y; + QSMatrix *m_points_z; + QSMatrix *m_triangles; + int *m_index_to_visible_list; + vector<int> m_visible_triangles; + bool m_use_visible_list; + int curr_triangle; + + inline int triangles() { + return m_use_visible_list ? m_visible_triangles.size() : m_ntriangles; + } + inline int visible_to_real( int triangle_index ) { + return m_use_visible_list ? m_visible_triangles[triangle_index] : triangle_index; + } + inline int real_to_visible( int triangle_index ) { + return m_use_visible_list ? m_index_to_visible_list[triangle_index] : triangle_index; + } + inline int edge( int triangle, int triangle_edge ) { + return triangle*3+triangle_edge; + } + inline int triangle( int edge ) { + return edge/3; + } + inline int triangle_edge( int edge ) { + return edge%3; + } + inline int point_1_index( int edge ) { + return (int )m_triangles->value( triangle(edge), triangle_edge(edge) ); + } + inline int point_2_index( int edge ) { + return (int )m_triangles->value( triangle(edge), (triangle_edge(edge)+1)%3 ); + } + + inline bool edges_equal( int edge1, int edge2 ) { + int edge1_p1 = point_1_index( edge1 ); + int edge1_p2 = point_2_index( edge1 ); + int edge2_p1 = point_1_index( edge2 ); + int edge2_p2 = point_2_index( edge2 ); + if ( QMIN(edge1_p1,edge1_p2) == QMIN(edge2_p1,edge2_p2) && + QMAX(edge1_p1,edge1_p2) == QMAX(edge2_p1,edge2_p2) ) return true; + return false; + } + + // compare edges + struct edge_comp_t : public binary_function<int, int, bool> { + // if we sort edge buffer using this compare functiona all + // shared edges will be on neighbouring positions + bool operator()( int edge1, int edge2 ) { + // compare + int edge1_p1 = d->point_1_index( edge1 ); + int edge1_p2 = d->point_2_index( edge1 ); + int edge2_p1 = d->point_1_index( edge2 ); + int edge2_p2 = d->point_2_index( edge2 ); + + // remember that the same edge is when: + // edge1_p1 == edge2_p2 && edge1_p2 == edge2_p1 or + // edge1_p1 == edge2_p1 && edge1_p2 == edge2_p2 + // this is the same as: + // QMIN(edge1_p1,edge1_p2) == QMIN(edge1_p1,edge1_p2) && + // QMAX(edge1_p1,edge1_p2) == QMAX(edge1_p1,edge1_p2) && + int edge1_min = QMIN(edge1_p1,edge1_p2); + int edge2_min = QMIN(edge2_p1,edge2_p2); + if ( edge1_min < edge2_min ) { + return true; + } + else if ( edge1_min == edge2_min ) { + int edge1_max = QMAX(edge1_p1,edge1_p2); + int edge2_max = QMAX(edge2_p1,edge2_p2); + return edge1_max < edge2_max; + } + else return false; + } + non_gridded_contour_runtime_data *d; + } edge_comp; + + }; + + //-------------------------------------------------------------// + +QSNonGriddedContour::QSNonGriddedContour(QSAxes* parent, const char * name) +:QSContour( parent, name ) + { + d = NULL; + m_evalid = false; + m_neighbours[0] = NULL; + m_neighbours[1] = NULL; + m_neighbours[2] = NULL; + static const int CHANNELS_NUM = 4; + initChannelTable( CHANNELS_NUM ); + } + + //-------------------------------------------------------------// + +QSNonGriddedContour::~QSNonGriddedContour() + { + delete[] m_neighbours[0]; + delete[] m_neighbours[1]; + delete[] m_neighbours[2]; + } + +//-------------------------------------------------------------// + +int QSNonGriddedContour::triangleAtPos( const QSPt2f& pos ) + { + QSPt2f pts[3]; + QSPt3f buff[MAX_BUFF_SIZE]; + int triangles_count = triangles(); + for ( int i=0; i<triangles_count; i++ ) { + getTriangle( i, buff ); + pts[0] = m_proj->world2DToCanvas( QSPt2f(buff[0].x,buff[0].y) ); + pts[1] = m_proj->world2DToCanvas( QSPt2f(buff[1].x,buff[1].y) ); + pts[2] = m_proj->world2DToCanvas( QSPt2f(buff[2].x,buff[2].y) ); + if ( QSProjection::pointInPoly(pos,pts,3) ) return i; + } + return -1; + } + +//-------------------------------------------------------------// + +QString QSNonGriddedContour::vertexInfo( int triangle, int vertex, QSPt2f& ) + { + // map a visible index to a "real" index + triangle = d->visible_to_real(triangle); + int point_index = (int )d->m_triangles->value(triangle,vertex); + QSPt3f p = point( point_index ); + QString result = tr(" Data point: \n"); + result += tr(" Vertex table: row = ")+QString::number(point_index)+" \n"; + result += tr(" Triangles: row = ")+QString::number(triangle)+tr(", col = ")+QString::number(vertex)+" \n"; + result += tr(" X = ")+QString::number(p.x) + "\n"; + result += tr(" Y = ")+QString::number(p.y) + "\n"; + result += tr(" Z = ")+QString::number(p.z) + "\n"; + return result; + } + +//-------------------------------------------------------------// + +QSPt3f QSNonGriddedContour::point( int index ) + { + if ( index < 0 || index >= d->m_points_x->rows() ) { + QSConsole::write(tr(" Contour %1 : Bad index detected. Index value = %2. ").arg(title()).arg(index) ); + return QSPt3f( sqrt(-1.0), sqrt(-1.0), sqrt(-1.0) ); + } + return QSPt3f( d->m_points_x->value(index,0), + d->m_points_y->value(index,0), + d->m_points_z->value(index,0) ); + } + +//-------------------------------------------------------------// + +bool QSNonGriddedContour::getAxisRange( QSAxis *axis, double& min, double& max ) + { + allocRuntimeData(); + if ( d->m_npoints == 0 ) { + freeRuntimeData(); + return false; + } + if ( !m_evalid ) { + QSPt3f p = point( 0 ); + m_xmin = p.x; + m_xmax = p.x; + m_ymin = p.y; + m_ymax = p.y; + m_zmin = p.z; + m_zmax = p.z; + for( int i=1; i<d->m_npoints; i++ ) { + QSPt3f p = point( i ); + m_xmin = QMIN( m_xmin, p.x ); + m_xmax = QMAX( m_xmax, p.x ); + m_ymin = QMIN( m_ymin, p.y ); + m_ymax = QMAX( m_ymax, p.y ); + m_zmin = QMIN( m_zmin, p.z ); + m_zmax = QMAX( m_zmax, p.z ); + } + m_evalid = true; + } + + if ( axis == d->xaxis ) { min = m_xmin; max = m_xmax; } + else if ( axis == d->yaxis ) { min = m_ymin; max = m_ymax; } + else if ( axis == d->vaxis ) { min = m_zmin; max = m_zmax; } + else { freeRuntimeData(); return false; } + + freeRuntimeData(); + return true; + } + +//-------------------------------------------------------------// + +void QSNonGriddedContour::dataChanged( int channel ) + { + if ( channel == -1 || channel == VXCoord || channel == VYCoord || channel == VZCoord ) m_evalid = false; + if ( channel == -1 || channel == VXCoord || channel == VYCoord || channel == VZCoord || channel == Triangles ) { + delete[] m_neighbours[0]; m_neighbours[0] = NULL; + delete[] m_neighbours[1]; m_neighbours[1] = NULL; + delete[] m_neighbours[2]; m_neighbours[2] = NULL; + } + QSContour::dataChanged( channel ); + } + +//-------------------------------------------------------------// + +void QSNonGriddedContour::allocRuntimeData() + { + QSContour::allocRuntimeData(); + d = new non_gridded_contour_runtime_data(); + d->xaxis = defaultAxis(QSAxis::XAxisType); + d->yaxis = defaultAxis(QSAxis::YAxisType); + d->vaxis = defaultAxis(QSAxis::VAxisType); + + d->m_ntriangles = matrixCols( Triangles ); + d->m_triangles = matrix( Triangles ); + + d->m_npoints = 0; + if ( matrixRows( VXCoord ) == matrixRows( VYCoord ) && + matrixRows( VXCoord ) == matrixRows( VZCoord ) && + matrixCols( VXCoord ) > 0 && + matrixCols( VYCoord ) > 0 && + matrixCols( VZCoord ) > 0 ) { + d->m_npoints = matrixRows( VXCoord ); + } + + d->m_ntriangles = 0; + if ( matrixCols( Triangles ) == 3 ) { + d->m_ntriangles = matrixRows( Triangles ); + } + + d->m_points_x = matrix( VXCoord ); + d->m_points_y = matrix( VYCoord ); + d->m_points_z = matrix( VZCoord ); + d->edge_comp.d = d; + + if ( m_neighbours[0] == NULL ) search_for_neighbours(); + d->m_index_to_visible_list = new int[d->m_ntriangles]; + d->m_use_visible_list = false; + d->curr_triangle = 0; + } + +//-------------------------------------------------------------// + +void QSNonGriddedContour::freeRuntimeData() + { + delete[] d->m_index_to_visible_list; + delete d; d = NULL; + QSContour::freeRuntimeData(); + } + +//-------------------------------------------------------------// + +int QSNonGriddedContour::triangles() + { + // there is a little trick. This object can provide two list of + // triangles - full or visible ones, depending if a list of visible + // triangles is calculated. The list of triangles should be available + // immediately after allocRuntimeData(), but for optimized drawing + // we provide a list of visible triangles after prepare(). We cannot + // provide a list of visible triangles immediately after allorRuntime data + // because it takes much time to make such list and this must be done in the + // background. + return d->triangles(); + } + +//-------------------------------------------------------------// + +bool QSNonGriddedContour::getNeighbouringTriangle( int *number, int *edge ) + { + // map visible triangle index to a "real" triangle index + int triangle = d->visible_to_real(*number); + int neighbouring_edge = m_neighbours[*edge][triangle]; + if ( neighbouring_edge >= 0 ) { + // map a "real" index to a visible index + *number = d->real_to_visible( d->triangle(neighbouring_edge) ); + *edge = d->triangle_edge(neighbouring_edge); + if ( *number >= 0 ) return true; + } + return false; + } + +//-------------------------------------------------------------// + +void QSNonGriddedContour::getTriangle( int number, QSPt3f pts[3], double level ) + { + // map visible triangle index to a "real" triangle index + int triangle = d->visible_to_real(number); + pts[0] = dataToWorldV( point( (int )d->m_triangles->value(triangle,0) ) ); + pts[1] = dataToWorldV( point( (int )d->m_triangles->value(triangle,1) ) ); + pts[2] = dataToWorldV( point( (int )d->m_triangles->value(triangle,2) ) ); + if ( pts[0].z == level ) pts[0].z += EPS_VALUE; + if ( pts[1].z == level ) pts[1].z += EPS_VALUE; + if ( pts[2].z == level ) pts[2].z += EPS_VALUE; + } + +//-------------------------------------------------------------// + +void QSNonGriddedContour::drawGrid() + { + if ( line(Grid).style == QSGLine::Invisible ) return; + QSPt3f pts[3]; + m_drv->setLine( line(Grid) ); + for( int i=0; i<triangles(); i++ ) { + getTriangle( i, pts ); + for( int j=0; j<3; j++ ) { + QSPt3f *p1 = &pts[j]; + QSPt3f *p2 = &pts[(j+1)%3]; + m_drv->drawLine2( QSPt2f(p1->x,p1->y), QSPt2f(p2->x,p2->y) ); + } + } + } + +//-------------------------------------------------------------// + +void QSNonGriddedContour::drawPoints() + { + if ( QSGraphicalData::point(PointMark).style == QSGPoint::Invisible ) return; + + QSGPoint point_style = QSGraphicalData::point(PointMark); + for( int i=0; i<d->m_npoints; i++ ) { + QSPt3f p = dataToWorldV( point( i ) ); + if ( p.x >= 0.0 && p.x <= 1.0 && + p.y >= 0.0 && p.y <= 1.0 ) + m_drv->drawPoint2( QSPt2f(p.x,p.y), point_style ); + } + } + +//-------------------------------------------------------------// + +void QSNonGriddedContour::search_for_neighbours() + { + // create list of all edges in data + int edges = d->m_ntriangles*3; + int *edge_buffer = new int[edges]; + for( int edge=0; edge<edges; edge++ ) edge_buffer[edge]=edge; + + // sort this list this list first by p1, second by p2 + // if the two edges have the same points (p1,p2) + // they will be neighbours on this list after sorting + sort( edge_buffer, edge_buffer+edges, d->edge_comp ); + + // fill the neighbours list + delete[] m_neighbours[0]; + delete[] m_neighbours[1]; + delete[] m_neighbours[2]; + m_neighbours[0] = new int[d->m_ntriangles]; + m_neighbours[1] = new int[d->m_ntriangles]; + m_neighbours[2] = new int[d->m_ntriangles]; + + for( int i=0; i<3; i++ ) + for( int j=0; j<d->m_ntriangles; j++ ) + m_neighbours[i][j] = -1; + + for( int i=0; i<edges-1; i++ ) { + int edge1 = edge_buffer[i]; + int edge2 = edge_buffer[i+1]; + if ( d->edges_equal( edge1, edge2 ) ) { + m_neighbours[d->triangle_edge(edge1)][d->triangle(edge1)] = edge2; + m_neighbours[d->triangle_edge(edge2)][d->triangle(edge2)] = edge1; + } + } + + delete[] edge_buffer; + } + +//-------------------------------------------------------------// + +bool QSNonGriddedContour::prepare() +// all triangles are visible + { + int curr_step = 0; + int steps = work_steps * 10; + QSPt3f pts[3]; + QSPt2f clip_pos( 0.0, 0.0 ); + QSPt2f clip_area( 1.0, 1.0 ); + while( d->curr_triangle < d->m_ntriangles ) { + pts[0] = dataToWorldV( point( (int )d->m_triangles->value(d->curr_triangle,0) ) ); + pts[1] = dataToWorldV( point( (int )d->m_triangles->value(d->curr_triangle,1) ) ); + pts[2] = dataToWorldV( point( (int )d->m_triangles->value(d->curr_triangle,2) ) ); + QSPt2f p1( pts[0].x, pts[0].y ); + QSPt2f p2( pts[1].x, pts[1].y ); + QSPt2f p3( pts[2].x, pts[2].y ); + if ( QSProjection::clipLine( &p1, &p2, clip_pos, clip_area ) || + QSProjection::clipLine( &p2, &p3, clip_pos, clip_area ) || + QSProjection::clipLine( &p3, &p1, clip_pos, clip_area ) ) { + d->m_visible_triangles.push_back( d->curr_triangle ); + d->m_index_to_visible_list[d->curr_triangle] = d->m_visible_triangles.size()-1; + } else { + d->m_index_to_visible_list[d->curr_triangle] = -1; + } + d->curr_triangle++; + // end with this little part ... + if ( curr_step++ > steps && m_bkg_handler ) return false; + } + d->m_use_visible_list = true; + return true; + } + +//-------------------------------------------------------------// + +void QSNonGriddedContour::loadStateFromStream( QDataStream& stream, QSObjectFactory *factory ) + { + QSContour::loadStateFromStream( stream, factory ); + } + +//-------------------------------------------------------------// + +void QSNonGriddedContour::saveStateToStream( QDataStream& stream, QSObjectFactory *factory ) + { + QSContour::saveStateToStream( stream, factory ); + } + +//-------------------------------------------------------------// + +QString QSNonGriddedContour::channelVariable( int channel ) const + { + switch( channel ) { + case VXCoord: return "x"; + case VYCoord: return "y"; + case VZCoord: return "z"; + case Triangles: return "i"; + } + return QString::null; + } + +//-------------------------------------------------------------// + +QSNonGriddedContour::ColumnType QSNonGriddedContour::columnType( int channel, int column ) const + { + if ( channel == VXCoord && column == 0 ) return ColumnX; + if ( channel == VYCoord && column == 0 ) return ColumnY; + if ( channel == VZCoord && column == 0 ) return ColumnZ; + } + + + diff --git a/kmatplot/widgets/qscontour.h b/kmatplot/widgets/qscontour.h new file mode 100644 index 0000000..2744583 --- /dev/null +++ b/kmatplot/widgets/qscontour.h @@ -0,0 +1,379 @@ +/*************************************************************************** + qscontour.h + ------------------- + begin : 01-January-2000 + copyright : (C) 2000 by Kamil Dobkowski + email : kamildobk@poczta.onet.pl + ***************************************************************************/ + +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + + +#ifndef QSCONTOUR_H +#define QSCONTOUR_H + +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif +#include"qsaxes.h" +#include"qsplot.h" +#include<math.h> + + +/** + * \brief Abstract base class for contour datasets. + * + * Draws contours. It contains a pure virtual functions which must be + * reimplemented to get it to work. + * @author Kamil Dobkowski + */ +class QSContour : public QSPlot2D + { + Q_OBJECT + Q_PROPERTY( bool contourFills READ contourFills WRITE setContourFills ) + Q_PROPERTY( bool contourLines READ contourLines WRITE setContourLines ) + Q_PROPERTY( bool contourLabels READ contourLabels WRITE setContourLabels ) + Q_PROPERTY( double labelSpacing READ labelSpacing WRITE setLabelSpacing ) + + public: + /** + * Constructor. + */ + QSContour(QSAxes* parent, const char * name=0); + /** + * Destructor. + */ + virtual ~QSContour(); + + void setContourFills( bool visible ); + void setContourLines( bool visible ); + void setContourLabels( bool visible ); + void setLabelSpacing( double labelSpacing ); + + bool contourFills() const { return m_fills; } + bool contourLines() const { return m_lines; } + bool contourLabels() const { return m_labels; } + double labelSpacing() const { return m_label_spacing; } + + virtual QString posInfo( QSPt2f& pos ); + virtual bool isClicked( const QSPt2f& pos ); + virtual QSPt2f legendItemSize( QSDrv *drv ); + virtual void drawLegendItem( const QSPt2f& pos, QSDrv *drv ); + + virtual void loadStateFromStream( QDataStream& stream, QSObjectFactory *factory ); + virtual void saveStateToStream( QDataStream& stream, QSObjectFactory *factory ); + /** + * See QSGraphicalData::setPoint() + */ + enum PointElement { PointMark = 0 }; + /** + * See QSGraphicalData::setLine() + */ + enum LineElement { Grid = 0 }; + + protected: + + /** + * See getTriangle() + */ + static const double EPS_VALUE; + + virtual void allocRuntimeData(); + virtual void freeRuntimeData(); + virtual bool start(); + /** + * This will be called until it returns true and can be reimplemented for + * some in the background stuff. + */ + virtual bool prepare() { return true; } + virtual bool step(); + virtual void end(); + /** + * Returns a total number of triangles. + */ + virtual int triangles() = 0; + /** + * Returns triangle number 'number'. + * The first edge is between pts[0] and pts[1] + * the second one is between pts[1] and pts[2] + * the third one is between pts[2] and pts[0] + * point z values must not be equal to level. If there is such point add EPS_VALUE + * to its z coordinate. + * see: getNeighboutingTriangle() + */ + virtual void getTriangle( int number, QSPt3f pts[3], double level = -10.0 ) = 0; + /** + * Returns if there is a neighbouring triangle. In 'number' and 'edge' + * returns a neighbouring triangle and edge of triangle 'number' and edge 'edge'. + */ + virtual bool getNeighbouringTriangle( int *number, int *edge ) = 0; + /** + * Returns a number of a triangle which contains the point 'pos' if any or -1. + * Used by 'isClicked' and 'posInfo' subroutines. + * Nothing really nessesary + */ + virtual int triangleAtPos( const QSPt2f& pos ) = 0; + /** + * Returns info about the vertex 'v' of the triangle 't'. + * Nothing really nessesary + */ + virtual QString vertexInfo( int t, int v, QSPt2f& pos ) = 0; + /** + * Draw grid ( lines connecting data points ) + */ + virtual void drawGrid() = 0; + /** + * Draw point marks + */ + virtual void drawPoints() = 0; + /** + * Reimplement this to return true if the contour is drawn over rectangle grid. + * The getRectangle() method should be reimplemented too in this case. Rectangles + * are assumed be divided into four triangles. Rectangle 0 contains triangles 0-3, + * rectangle 1 contains triangles 4-7 etc ... + */ + virtual bool rectangleGrid() const { return false; } + /** + * Reimplement this to return rectangle coordinates if the contour is drawn over rectangle grid. + * The rectangleGrid() method should be reimplemented too in this case. Rectangles + * are assumed be divided into four triangles. Rectangle 0 contains triangles 0-3, + * rectangle 1 contains triangles 4-7 etc ... The function id provided for efficiency only. + * Whole rectangles ( four triangles ) will be processed in a single step during drawing. + */ + virtual void getRectangle( int triangleNumber, QSPt3f pts[4] ) {} + + + private: + bool m_labels; + bool m_fills; + bool m_lines; + double m_label_spacing; + struct contour_runtime_data; + struct contour_levels_data; + struct contour_runtime_data *d; + + void init_triangle_buffer(); + void call_prepare(); + void start_drawing_fills(); + void drawing_fills(); + void start_drawing_grid(); + void drawing_grid(); + void start_drawing_lines(); + void drawing_lines(); + void start_drawing_labels(); + void drawing_labels(); + void start_drawing_points(); + void drawing_points(); + + void calculate_levels_data( contour_levels_data *data ); + void free_levels_data( contour_levels_data *data ); + void start_contour( const QSPt3f& p1, const QSPt3f& p2, int level ); + void draw_contour( const QSPt3f& p1, const QSPt3f& p2, int level ); + void end_contour( int level ); + void draw_line_buffer( int level ); + + void cut_polygon( double level, const QSPt3f *pts, int npts, + QSPt3f *above_pts, int *above_npts, + QSPt3f *under_pts, int *under_npts, + QSPt3f *cross_line = NULL, int *cross_npts = NULL ); + inline double distance( const QSPt2f& p1, const QSPt2f& p2 ); + int find_level_greater_than( double value ); + void flush_rectangle_buffer(); + bool draw_rectangle( const QSPt3f pts[4] ); + }; + + +inline double QSContour::distance( const QSPt2f& p1, const QSPt2f& p2 ) + { + return sqrt((p1.x-p2.x)*(p1.x-p2.x)+(p1.y-p2.y)*(p1.y-p2.y)); + } + +//------------------------------------------------------------------------------------------------------------------// + + +/** + * \brief Dataset : Draws contours over gridded data. + * + * Data format is described in QSGriddedContour::Channels . See also QSAxes::plotAdd() . + * @author Kamil Dobkowski + */ +class QSGriddedContour : public QSContour + { + Q_OBJECT + public: + /** + * Descriptive names of data channels. See QSData::setMatrix(). + * Data contains Z values, + * XVector ( optional ) contains x coordinates of a grid, YVector ( optional ) contains y coordinates of a grid. + * cols(XVector) == cols(Data) and rows(YVector) == rows(Data), both vectors must be monotone. + */ + enum Channels { + XVector = 0, + YVector = 1, // Column vector, monotone. Size 1 x h+1 + Data = 2 + }; + /** + * Destructor. + */ + QSGriddedContour(QSAxes* parent, const char * name=0); + /** + * Destructor. + */ + virtual ~QSGriddedContour(); + virtual ColumnType columnType( int channel, int column ) const; + virtual QString channelVariable( int channel ) const; + virtual void loadStateFromStream( QDataStream& stream, QSObjectFactory *factory ); + virtual void saveStateToStream( QDataStream& stream, QSObjectFactory *factory ); + + protected: + virtual bool getAxisRange( QSAxis *axis, double& min, double& max ); + virtual void dataChanged( int channel = -1 ); + virtual void allocRuntimeData(); + virtual void freeRuntimeData(); + virtual int triangles(); + virtual void getTriangle( int number, QSPt3f pts[3], double level = -10.0 ); + virtual bool getNeighbouringTriangle( int *number, int *edge ); + virtual int triangleAtPos( const QSPt2f& pos ); + virtual QString vertexInfo( int t, int v, QSPt2f& pos ); + virtual void drawGrid(); + virtual void drawPoints(); + virtual bool rectangleGrid() const { return true; } + virtual void getRectangle( int triangleNumber, QSPt3f pts[4] ); + + private: + double m_dmin; + double m_dmax; + bool m_evalid; + void calculate_data_range(); + double xvector( int col ); + double yvector( int row ); + struct gridded_contour_runtime_data; + gridded_contour_runtime_data *d; + void load_mesh_into_buffer( int triangleNumber ); + }; + +//------------------------------------------------------------------------------------------------------------------// + + +/** + * \brief Dataset: Draws contours over non-gridded data. + * + * Data format is described in QSNonGriddedContour::Channels . See also QSAxes::plotAdd() . + * @author Kamil Dobkowski + */ +class QSNonGriddedContour : public QSContour + { + Q_OBJECT + public: + /** + * Descriptive names of data channels. See QSData::setMatrix(). + * VXCoords, VYCoord, VZCoord must have a one column and the same number of rows. + * VXCoord contains x coordinates, VYCords contains y coordinates, and VZCoord contains z coordinates. + * The same row in all those matrices defines a one data point, so we have rows(VXCoord) data points. + * Triangles must have three columns and must contain indices to rows in Coord matrices, so one index + * defines one point. One row in Triangles defines a one traingle. Such matrix can be calculated by + * triangulating the given set of points, Traiangles is required because this object just can't draw + * contour using only data points. + */ + enum Channels { + VXCoord = 0, + VYCoord = 1, + VZCoord = 2, + Triangles = 3 // size 3 x number of triangles + }; + /** + * Destructor. + */ + QSNonGriddedContour(QSAxes* parent, const char * name=0); + /** + * Destructor. + */ + virtual ~QSNonGriddedContour(); + virtual ColumnType columnType( int channel, int column ) const; + virtual QString channelVariable( int channel ) const; + virtual void loadStateFromStream( QDataStream& stream, QSObjectFactory *factory ); + virtual void saveStateToStream( QDataStream& stream, QSObjectFactory *factory ); + + protected: + virtual bool getAxisRange( QSAxis *axis, double& min, double& max ); + virtual void dataChanged( int channel = -1 ); + virtual bool prepare(); + virtual void allocRuntimeData(); + virtual void freeRuntimeData(); + virtual int triangles(); + virtual void getTriangle( int number, QSPt3f pts[3], double level = -10.0 ); + virtual bool getNeighbouringTriangle( int *number, int *edge ); + virtual int triangleAtPos( const QSPt2f& pos ); + virtual QString vertexInfo( int t, int v, QSPt2f& pos ); + virtual void drawGrid(); + virtual void drawPoints(); + + private: + bool m_evalid; + double m_xmax; + double m_ymax; + double m_zmax; + double m_xmin; + double m_ymin; + double m_zmin; + int *m_neighbours[3]; + struct non_gridded_contour_runtime_data; + non_gridded_contour_runtime_data *d; + QSPt3f point( int index ); + void search_for_neighbours(); + void make_visible_triangles_list(); + }; + + + +#endif + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/kmatplot/widgets/qscoord.cpp b/kmatplot/widgets/qscoord.cpp new file mode 100644 index 0000000..d163a58 --- /dev/null +++ b/kmatplot/widgets/qscoord.cpp @@ -0,0 +1,258 @@ +/*************************************************************************** + qscoord.cpp + ------------------- + begin : 01-January-2000 + copyright : (C) 2000 by Kamil Dobkowski + email : kamildobk@poczta.onet.pl + ***************************************************************************/ + +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + + +#include "qscoord.h" + +//-------------------------------------------------------------// +/* +ostream& operator<<( ostream& s, const QSPt& p ) + { + return s << "(" << p.x << ", " << p.y << ")" ; + } +*/ +//-------------------------------------------------------------// + +QSPt2 operator+ ( const QSPt2& p1, const QSPt2& p2 ) + { + return QSPt2( p1.x+p2.x, p1.y+p2.y ); + } + +//-------------------------------------------------------------// + +QSPt2 operator- ( const QSPt2& p1, const QSPt2& p2 ) + { + return QSPt2( p1.x-p2.x, p1.y-p2.y ); + } + +//-------------------------------------------------------------// + +bool operator==( const QSPt2& p1, const QSPt2& p2 ) + { + return p1.x == p2.x && p1.y == p2.y; + } + +//-------------------------------------------------------------// + +bool operator!=( const QSPt2& p1, const QSPt2& p2 ) + { + return !( p1 == p2 ); + } + +//-------------------------------------------------------------// +/* +ostream& operator<<( ostream& s, const QSPt3& p ) + { + return s << "(" << p.x << ", " << p.y << ", " << p.z << ")" ; + } +*/ +//-------------------------------------------------------------// + +QSPt3 operator+ ( const QSPt3& p1, const QSPt3& p2 ) + { + return QSPt3( p1.x+p2.x, p1.y+p2.y, p1.z+p2.z ); + } + +//-------------------------------------------------------------// + +QSPt3 operator- ( const QSPt3& p1, const QSPt3& p2 ) + { + return QSPt3( p1.x-p2.x, p1.y-p2.y, p1.z-p2.z ); + } + +//-------------------------------------------------------------// + +bool operator==( const QSPt3& p1, const QSPt3& p2 ) + { + return p1.x == p2.x && p1.y == p2.y && p1.z == p2.z; + } + +//-------------------------------------------------------------// + +bool operator!=( const QSPt3& p1, const QSPt3& p2 ) + { + return !( p1 == p2 ); + } + +//-------------------------------------------------------------// +/* +ostream& operator<<( ostream& s, const QSPtf& p ) + { + return s << "(" << p.x << ", " << p.y << ")" ; + } +*/ +//-------------------------------------------------------------// + +QSPt2f operator+ ( const QSPt2f& p1, const QSPt2f& p2 ) + { + return QSPt2f( p1.x+p2.x, p1.y+p2.y ); + } + +//-------------------------------------------------------------// + +QSPt2f operator- ( const QSPt2f& p1, const QSPt2f& p2 ) + { + return QSPt2f( p1.x-p2.x, p1.y-p2.y ); + } + +//-------------------------------------------------------------// + +bool operator==( const QSPt2f& p1, const QSPt2f& p2 ) + { + return p1.x == p2.x && p1.y == p2.y; + } + +//-------------------------------------------------------------// + +bool operator!=( const QSPt2f& p1, const QSPt2f& p2 ) + { + return !( p1 == p2 ); + } + +//-------------------------------------------------------------// +/* +ostream& operator<<( ostream& s, const QSPt3f& p ) + { + return s << "(" << p.x << ", " << p.y << ", " << p.z << ")" ; + } +*/ +//-------------------------------------------------------------// + +QSPt3f operator+ ( const QSPt3f& p1, const QSPt3f& p2 ) + { + return QSPt3f( p1.x+p2.x, p1.y+p2.y, p1.z+p2.z ); + } + +//-------------------------------------------------------------// + +QSPt3f operator- ( const QSPt3f& p1, const QSPt3f& p2 ) + { + return QSPt3f( p1.x-p2.x, p1.y-p2.y, p1.z-p2.z ); + } + +//-------------------------------------------------------------// + +bool operator==( const QSPt3f& p1, const QSPt3f& p2 ) + { + return p1.x == p2.x && p1.y == p2.y && p1.z == p2.z; + } + +//-------------------------------------------------------------// + +bool operator!=( const QSPt3f& p1, const QSPt3f& p2 ) + { + return !( p1 == p2 ); + } + +//-------------------------------------------------------------// + +bool operator==( const QSRectf& r1, const QSRectf& r2 ) + { + return r1.pos == r2.pos && r1.size == r2.size; + } + +//-------------------------------------------------------------// + +bool operator!=( const QSRectf& r1, const QSRectf& r2 ) + { + return !( r1 == r2 ); + } + +//-------------------------------------------------------------// + +bool QSRectf::contains( const QSPt2f& point ) const + { + QSRectf r = QSRectf(pos,size).normalize(); + return point.x >= r.pos.x && point.x <= r.pos.x+r.size.x && point.y >= r.pos.y && point.y <= r.pos.y+r.size.y; + } + +//-------------------------------------------------------------// + +QSRectf QSRectf::normalize() const + { + return QSRectf( size.x<0 ? pos.x+size.x : pos.x, + size.y<0 ? pos.y+size.y : pos.y, + size.x<0 ? -size.x : size.x, + size.y<0 ? -size.y : size.y ); + } + +//-------------------------------------------------------------// + +QSRectf QSRectf::normalizeWidth() const + { + return QSRectf( size.x<0 ? pos.x+size.x : pos.x, + pos.y, + size.x<0 ? -size.x : size.x, + size.y ); + } + +//-------------------------------------------------------------// + +QSRectf QSRectf::normalizeHeight() const + { + return QSRectf( pos.x, + size.y<0 ? pos.y+size.y : pos.y, + size.x, + size.y<0 ? -size.y : size.y ); + } + +//-------------------------------------------------------------// + +QRect QSRectf::rect() const + { + return QRect( int(pos.x+0.5), + int(pos.y+0.5), + int(pos.x+size.x+0.5)-int(pos.x+0.5), + int(pos.y+size.y+0.5)-int(pos.y+0.5) ); + } + +//-------------------------------------------------------------// + +void QSRectf::setTopLeft( const QSPt2f& p ) { + if ( size.x >= 0 ) setP1( QSPt2f(p.x, p1().y) ); else setP2( QSPt2f(p.x, p2().y) ); + if ( size.y >= 0 ) setP1( QSPt2f(p1().x, p.y) ); else setP2( QSPt2f(p2().x, p.y) ); + } + +//-------------------------------------------------------------// + +void QSRectf::setBottomRight( const QSPt2f& p ) { + if ( size.x < 0 ) setP1( QSPt2f(p.x, p1().y) ); else setP2( QSPt2f(p.x, p2().y) ); + if ( size.y < 0 ) setP1( QSPt2f(p1().x, p.y) ); else setP2( QSPt2f(p2().x, p.y) ); + } + +//-------------------------------------------------------------// + +QSPt2f QSRectf::topLeft() const { + return QSPt2f( QMIN(pos.x,pos.x+size.x), QMIN(pos.y,pos.y+size.y) ); + } + +//-------------------------------------------------------------// + +QSPt2f QSRectf::bottomRight() const { + return QSPt2f( QMAX(pos.x,pos.x+size.x), QMAX(pos.y,pos.y+size.y) ); + } + +//-------------------------------------------------------------// + +void QSRectf::unite( const QSRectf& rect ) { + setTopLeft( QSPt2f( QMIN( topLeft().x, rect.topLeft().x ), + QMIN( topLeft().y, rect.topLeft().y ) ) ); + setBottomRight( QSPt2f( QMAX( bottomRight().x, rect.bottomRight().x ), + QMAX( bottomRight().y, rect.bottomRight().y ) ) ); + } + + diff --git a/kmatplot/widgets/qscoord.h b/kmatplot/widgets/qscoord.h new file mode 100644 index 0000000..3ce3e35 --- /dev/null +++ b/kmatplot/widgets/qscoord.h @@ -0,0 +1,329 @@ +/*************************************************************************** + qscoord.h + ------------------- + begin : 01-January-2000 + copyright : (C) 2000 by Kamil Dobkowski + email : kamildobk@poczta.onet.pl + ***************************************************************************/ + +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + + +#ifndef QSCOORD_H +#define QSCOORD_H + +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + +#include<qwindowdefs.h> +#include<qrect.h> +#include<qpoint.h> + + +/** + * \brief Base class for point objects. + * + * @author Kamil Dobkowski + */ +class QSCoord { + public: + static inline double mmToPixels( double mm, double dpi=72.0 ) { return mm*dpi/25.4; } + static inline double pixelsToMM( double pixels, double dpi=72.0 ) { return pixels*25.4/dpi; } + static inline double pointsToPixels( double points, double dpi=72.0 ) { return points*dpi/72.0; } + static inline double pixelsToPoints( double pixels, double dpi=72.0 ) { return pixels*72.0/dpi; } + }; + + +//-------------------------------------------------------------// + +/** + * \brief The point on the screen. + * + * Used internally. + * @author Kamil Dobkowski + */ +class QSPt2 : public QSCoord { + public: + // exactly as defined in QPoint + #if defined(_OS_MAC_) + QCOORD y; + QCOORD x; + #else + QCOORD x; + QCOORD y; + #endif + + explicit QSPt2( const QPoint& p ) { + set( p.x(), p.y() ); + } + QSPt2( int newX=0, int newY=0 ) { + set( newX, newY ); + } + ~QSPt2() { + } + QSPt2 &set( int newX, int newY ) { + x=newX; + y=newY; + return *this; + } + QPoint point() const { + return QPoint( x, y ); + } + //friend ostream& operator<<( ostream& s, const QSPt2& p ); + friend QSPt2 operator+ ( const QSPt2& p1, const QSPt2& p2 ); + friend QSPt2 operator- ( const QSPt2& p1, const QSPt2& p2 ); + friend bool operator==( const QSPt2& p1, const QSPt2& p2 ); + friend bool operator!=( const QSPt2& p1, const QSPt2& p2 ); + }; + +//-------------------------------------------------------------// + +/** + * \brief The point in the 3D space. + * + * Used internally. + * @author Kamil Dobkowski + */ +class QSPt3 : public QSCoord { + public: + + int x; + int y; + int z; + + QSPt3( int newX=0, int newY=0, int newZ=0 ) { + set( newX, newY, newZ ); + } + ~QSPt3() { + } + QSPt3 &set( int newX, int newY, int newZ ) { + x=newX; + y=newY; + z=newZ; + return *this; + } + //friend ostream& operator<<( ostream& s, const QSPt3& p ); + friend QSPt3 operator+ ( const QSPt3& p1, const QSPt3& p2 ); + friend QSPt3 operator- ( const QSPt3& p1, const QSPt3& p2 ); + friend bool operator==( const QSPt3& p1, const QSPt3& p2 ); + friend bool operator!=( const QSPt3& p1, const QSPt3& p2 ); + }; + +//-------------------------------------------------------------// + +/** + * \brief The point on the screen with the floating-point coordinates. + * + * Used internally. + * @author Kamil Dobkowski + */ +class QSPt2f : public QSCoord { + public: + double x; + double y; + + explicit QSPt2f( const QPoint& p ) { + set( p.x(), p.y() ); + } + QSPt2f( double newX=0.0, double newY=0.0 ) { + set( newX, newY ); + } + ~QSPt2f() { + } + QSPt2f &set( double newX, double newY ) { + x=newX; + y=newY; + return *this; + } + QPoint point() const { + return QPoint( int(x+0.5), int(y+0.5) ); + } + //friend ostream& operator<<( ostream& s, const QSPt2f& p ); + friend QSPt2f operator+ ( const QSPt2f& p1, const QSPt2f& p2 ); + friend QSPt2f operator- ( const QSPt2f& p1, const QSPt2f& p2 ); + friend bool operator==( const QSPt2f& p1, const QSPt2f& p2 ); + friend bool operator!=( const QSPt2f& p1, const QSPt2f& p2 ); + }; + +//-------------------------------------------------------------// + +/** + * \brief The point in th 3D space with the floating-point coordinates. + * + * Used internally. + * @author Kamil Dobkowski + */ +class QSPt3f : public QSCoord { + public: + + double x; + double y; + double z; + + QSPt3f( double newX=0.0, double newY=0.0, double newZ=0.0 ) { + set( newX, newY, newZ ); + } + ~QSPt3f() { + } + QSPt3f &set( double newX, double newY, double newZ ) { + x=newX; + y=newY; + z=newZ; + return *this; + } + //friend ostream& operator<<( ostream& s, const QSPt3f& p ); + friend QSPt3f operator+ ( const QSPt3f& p1, const QSPt3f& p2 ); + friend QSPt3f operator- ( const QSPt3f& p1, const QSPt3f& p2 ); + friend bool operator==( const QSPt3f& p1, const QSPt3f& p2 ); + friend bool operator!=( const QSPt3f& p1, const QSPt3f& p2 ); + }; + +//-------------------------------------------------------------// + + +/** + * \brief Rectangle with floating point coordinates. + */ +class QSRectf : public QSCoord + { + public: + /** + * Position of this rectangle. + */ + QSPt2f pos; + /** + * Size of this rectangle. + */ + QSPt2f size; + /** + * Constructor + */ + QSRectf() { + } + /** + * Constructor + */ + explicit QSRectf( const QRect& r ) { + pos.x = r.left(); pos.y = r.top(); size.x = r.width(); size.y = r.height(); + } + /** + * Constructor + */ + QSRectf( const QSPt2f& p2, const QSPt2f& p1, bool norm ) { + pos = p1; + size = p2-p1; + if ( norm ) { QSRectf r = normalize(); pos = r.pos; size = r.size; } + } + /** + * Constructor + */ + QSRectf( const QSPt2f& initPos, const QSPt2f& initSize ) { + pos = initPos; + size = initSize; + } + /** + * Constructor + */ + QSRectf( double x, double y, double w, double h ) { + pos.x = x; + pos.y = y; + size.x = w; + size.y = h; + } + /** + * Destructor + */ + ~QSRectf() { + } + /** + * P1 is point at 'pos'. This function changes 'pos' and 'size' of this rectangle + * but never changes P2 + */ + void setP1( const QSPt2f& p ) { + size = size - (p-pos); + pos = p; + } + /** + * P2 is the point at 'pos'+'size'. This function changes 'size' of this rectangle, + * but never changes 'size'. + */ + void setP2( const QSPt2f& p ) { + size = p-pos; + } + /** + * Returns 'pos'. + */ + QSPt2f p1() const { + return pos; + } + /** + * Returns 'pos'+'size' + */ + QSPt2f p2() const { + return pos+size; + } + /** + * Sets top-left ( with minimal coordinates ) corner of this rectange. Doesnt change bottom-right corner. + */ + void setTopLeft( const QSPt2f& p ); + /** + * Sets bottom-right ( with maximum coordinates ) corner of this rectangle to 'p'. + * Never changes topLeft corner.. + */ + void setBottomRight( const QSPt2f& p ); + /** + * Returns coordinates of the top-left corner ( the corner closest to (0,0) ). + */ + QSPt2f topLeft() const; + /** + * Returns coordinates of bottom-left corner ( the corner furthermost from (0,0) ) + */ + QSPt2f bottomRight() const; + /** + * Returns if point is inside the rectangle + */ + bool contains( const QSPt2f& pos ) const; + /** + * Unites the rectangle with other rectangle. + */ + void unite( const QSRectf& rect ); + /** + * Normalizes rectangle ( makes size > 0 ) + */ + QSRectf normalize() const; + /** + * Normalizes width ( makes it > 0 ) + */ + QSRectf normalizeWidth() const; + /** + * Normalizes height ( makes it > 0 ) + */ + QSRectf normalizeHeight() const; + /** + * Rounds coordinates and converst rectangle to QRect. + */ + QRect rect() const; + friend bool operator==( const QSRectf& r1, const QSRectf& r2 ); + friend bool operator!=( const QSRectf& r1, const QSRectf& r2 ); + }; + +#endif + + + + + + + + + + + diff --git a/kmatplot/widgets/qsctool.cpp b/kmatplot/widgets/qsctool.cpp new file mode 100644 index 0000000..2630ac4 --- /dev/null +++ b/kmatplot/widgets/qsctool.cpp @@ -0,0 +1,299 @@ +/*************************************************************************** + qsctool.cpp + ------------------- + begin : Sun Jan 30 2000 + copyright : (C) 2000 by Kamil Dobkowski + email : kamildbk@friko.onet.pl + ***************************************************************************/ + +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + +#include"qsctool.h" +#include"qsdrvqt.h" +#include"qsplotview.h" +#include<qpainter.h> + +QSTool::QSTool( QObject *parent ) +: QObject( parent ) + { + m_drv = NULL; + m_view = NULL; + m_state = StateReady; + m_snap_to_grid = false; + } + +//-------------------------------------------------------------// + +QSTool::~QSTool() + { + deactivate(); + } + +//-------------------------------------------------------------// + +void QSTool::activate( QSPlotView *parent_view ) + { + m_view = parent_view; + m_state = StateReady; + } + +//-------------------------------------------------------------// + +void QSTool::deactivate() + { + release_driver(); + m_view = NULL; + } + +//-------------------------------------------------------------// + +bool QSTool::canvasEvent( QEvent *e ) + { + switch ( e->type() ) { + case QEvent::MouseButtonDblClick: return eventMouseDblClick( static_cast<QMouseEvent*>(e) ); + case QEvent::MouseButtonPress: return eventMousePress( static_cast<QMouseEvent*>(e) ); + case QEvent::MouseButtonRelease: return eventMouseRelease( static_cast<QMouseEvent*>(e) ); + case QEvent::MouseMove: return eventMouseMove( static_cast<QMouseEvent*>(e) ); + case QEvent::KeyPress: return eventKeyPress( static_cast<QKeyEvent*>(e) ); + case QEvent::KeyRelease: return eventKeyRelease( static_cast<QKeyEvent*>(e) ); + default: break; + } + return FALSE; + } + +//-------------------------------------------------------------// + +bool QSTool::eventMouseDblClick( QMouseEvent *e ) + { + if ( m_state == StateReady && e->button() == Qt::LeftButton ) { + canvasDoubleClicked( e->pos(), e->state() ); + return true; + } + return false; + } + +//-------------------------------------------------------------// + +bool QSTool::eventMousePress( QMouseEvent *e ) + { + if ( m_state == StateReady ) { + if ( e->button() == Qt::RightButton ) { + m_state = StateRightButtonPressed; + return true; + } + else if ( e->button() == Qt::MidButton ) { + m_state = StateMiddleButtonPressed; + return true; + } + else if ( e->button() == Qt::LeftButton ) { + m_state = StateLeftButtonPressed; + m_drag_start_pos = e->pos(); + m_drag_start_key = e->state(); + m_drag_prev_pos = e->pos(); + m_drag_prev_key = e->state(); + return true; + } + } + return false; + } + +//-------------------------------------------------------------// + +bool QSTool::eventMouseRelease( QMouseEvent *e ) + { + if ( m_state == StateRightButtonPressed && e->button() == Qt::RightButton ) { + m_state = StateReady; + canvasRightButtonClicked( e->pos(), e->state() ); + return true; + } + if ( m_state == StateMiddleButtonPressed && e->button() == Qt::MidButton ) { + m_state = StateReady; + canvasMiddleButtonClicked( e->pos(), e->state() ); + return true; + } + if ( m_state == StateLeftButtonPressed && e->button() == Qt::LeftButton ) { + m_state = StateReady; + canvasClicked( e->pos(), e->state() ); + return true; + } + if ( m_state == StateDragging && e->button() == Qt::LeftButton ) { + m_state = StateReady; + canvasDragMove( e->pos(), m_drag_prev_pos, m_drag_start_pos, e->state(), m_drag_prev_key, m_drag_start_key ); + canvasDragEnd( e->pos(), m_drag_start_pos, e->state(), m_drag_start_key ); + return true; + } + return false; + } + +//-------------------------------------------------------------// + +bool QSTool::eventMouseMove( QMouseEvent *e ) + { + if ( m_state == StateLeftButtonPressed && (e->state() & Qt::LeftButton) ) { + // eliminate some noise moves + if ( abs(m_drag_start_pos.x()-e->pos().x()) > 2 || + abs(m_drag_start_pos.y()-e->pos().y()) > 2 || + (m_drag_start_key& Qt::ShiftButton) ) + if ( canvasDragStart( m_drag_start_pos, e->state() ) ) { + m_state = StateDragging; + canvasDragMove( e->pos(), m_drag_prev_pos, m_drag_start_pos, e->state(), m_drag_prev_key, m_drag_start_key ); + m_drag_prev_pos = e->pos(); + m_drag_prev_key = e->state(); + } else { + m_state = StateReady; + } + return true; + } + else if ( m_state == StateDragging && (e->state() & Qt::LeftButton) ) { + canvasDragMove( e->pos(), m_drag_prev_pos, m_drag_start_pos, e->state(), m_drag_prev_key, m_drag_start_key ); + m_drag_prev_pos = e->pos(); + m_drag_prev_key = e->state(); + return true; + } + else if ( m_state == StateReady ) { + canvasMove( e->pos() ); + return true; + } + return false; + } + + +//-------------------------------------------------------------// + +bool QSTool::eventKeyPress( QKeyEvent* ) + { + return false; + } + + //-------------------------------------------------------------// + +bool QSTool::eventKeyRelease( QKeyEvent* ) + { + return false; + } + +//-------------------------------------------------------------// + +void QSTool::canvasClicked( const QPoint&, int ) + { + } + +//------------------------------------------------------------- + +void QSTool::canvasMiddleButtonClicked( const QPoint&, int ) + { + } + +//------------------------------------------------------------- + +void QSTool::canvasRightButtonClicked( const QPoint&, int ) + { + } + +//-------------------------------------------------------------// + +bool QSTool::canvasDragStart( const QPoint&, int ) + { + return false; + } + +//------------------------------------------------------------- + +void QSTool::canvasDragMove( const QPoint&, const QPoint&, const QPoint&, int, int, int ) + { + } + +//------------------------------------------------------------- + +void QSTool::canvasDragEnd( const QPoint&, const QPoint&, int, int ) + { + } + +//-------------------------------------------------------------// + +void QSTool::canvasMove( const QPoint& ) + { + } + +//-------------------------------------------------------------// + +void QSTool::canvasDoubleClicked( const QPoint&, int ) + { + } + +//-------------------------------------------------------------// + +QSDrvQt *QSTool::driver() + { + if ( !m_drv ) { + m_drv = new QSDrvQt(); + m_drv->setDC(new QPainter(m_view->canvasWidget()),m_view->dpi(),true); + m_drv->startDrawing(); + } + return m_drv; + } + +//-------------------------------------------------------------// + +void QSTool::release_driver() + { + if ( m_drv ) { + m_drv->stopDrawing(); + delete m_drv; m_drv = NULL; + } + } + +//-------------------------------------------------------------// + +double QSTool::snapToGridX( double canvas_x, int keyState ) + { + double result = canvas_x; + double spacing_x = m_view->gridSpacingX(); + if ( m_view->gridVisible() && spacing_x > 0.0 && !(keyState & Qt::ShiftButton) ) + result = QSCoord::mmToPixels( floor(QSCoord::pixelsToMM(canvas_x,driver()->dpi)/spacing_x+0.5)*spacing_x, driver()->dpi ); + return result; + } + +//-------------------------------------------------------------// + +double QSTool::snapToGridY( double canvas_y, int keyState ) + { + double result = canvas_y; + double spacing_y = m_view->gridSpacingY(); + if ( m_view->gridVisible() && spacing_y > 0.0 && !(keyState & Qt::ShiftButton) ) + result = QSCoord::mmToPixels( floor(QSCoord::pixelsToMM(canvas_y,driver()->dpi)/spacing_y+0.5)*spacing_y, driver()->dpi ); + return result; + } + +//-------------------------------------------------------------// + +QSPt2f QSTool::snapToGrid( const QPoint& pos, int keyState ) + { + return snapToGrid( QSPt2f(pos), keyState ); + } + +//-------------------------------------------------------------// + +QSPt2f QSTool::snapToGrid( const QSPt2f& pos, int keyState ) + { + return QSPt2f( snapToGridX(pos.x,keyState), snapToGridY(pos.y,keyState) ); + } + +//-------------------------------------------------------------// + +int QSTool::snapAngle( int angle, int keyState ) + { + if ( !(keyState & Qt::ShiftButton) ) angle = int(angle/15)*15; + return angle; + } + + + + diff --git a/kmatplot/widgets/qsctool.h b/kmatplot/widgets/qsctool.h new file mode 100644 index 0000000..0169685 --- /dev/null +++ b/kmatplot/widgets/qsctool.h @@ -0,0 +1,176 @@ +/*************************************************************************** + qsctool.h + ------------------- + begin : Sun Jan 30 2000 + copyright : (C) 2000 by Kamil Dobkowski + email : kamildbk@friko.onet.pl + ***************************************************************************/ + +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + +#ifndef QSCTOOL_H +#define QSCTOOL_H + +#include<qobject.h> +#include<qevent.h> +#include"qscoord.h" + +class QSPlotView; +class QSDrvQt; + + /** + * \brief Tool creates and edits QSCObject's on the canvas. + * + * It works in conjuction with QSPlotView, see QSPlotView::setTool(). + * It do nothing, but offers virtual functions notifing about some events + * on the canvas such as mouse button click, key press, drag, etc. See also + * activate(), deactivate(). + */ +class QSTool : public QObject + { + Q_OBJECT + public: + /** + * Constructor. + */ + QSTool( QObject *parent = NULL ); + /** + * Destructor + */ + virtual ~QSTool(); + /** + * Called when the tool is activated. QSPlotView::currentPage(), QSPlotView::zoom(), QSPlotView::dpi() + * QSPlotView::fullPage() are constant between activate() and deactivate(). If zoom is going to change + * deactivate() is called, zoom changes and activate() is called next(). + * + */ + virtual void activate( QSPlotView *parentView ); + /** + * Called when the tool is deactivated. Tools should not perform any action when they are deactivated. + */ + virtual void deactivate(); + /** + * Mouse and key event handler for a canvas. + * If event wasn't proccesed this function should + * return FALSE. There is no need to use this + * function directly - use canvas...() functions insted. + */ + virtual bool canvasEvent( QEvent *e ); + /** + * Intended to draw handles, frames etc. around active objects. + * Called when drawing ends in a parent widget + * ( after graphics has been closed ). + */ + virtual void draw() {} + + protected: + /** + * Canvas event. Left button click over the canvas. 'button' consist of 'ButtonState' flags ORed together + */ + virtual void canvasClicked( const QPoint& pos, int keyState ); + /** + * Canvas event. Middle button click over the canvas. + */ + virtual void canvasMiddleButtonClicked( const QPoint& pos, int keyState ); + /** + * Canvas event. Right mouse button pressed over the canvas. + */ + virtual void canvasRightButtonClicked( const QPoint& pos, int keyState ); + /** + * Right button double-click. Warning ! two canvasClicked events are emitted before they are became double click event. + */ + virtual void canvasDoubleClicked( const QPoint& pos, int keyState ); + /** + * Canvas event. Drags start - user pressed the mouse and is going to move the mouse with the button pressed. + * If function returns false drag is not started ( canvasDragEnd() is not emitted in this case ). + */ + virtual bool canvasDragStart( const QPoint& pos, int keyState ); + /** + * Canvas event. User drags ( moves the mouse with the button pressed ) around. + */ + virtual void canvasDragMove( const QPoint& pos, const QPoint& prevPos, const QPoint& startPos, int keyState, int prevKeyState, int startKeyState ); + /** + * Canvas event. User relesed mouse pointer after drawing operation. It is guaranteed that + * the last mouse canvasDragMove event had the same 'pos' as this event. + */ + virtual void canvasDragEnd( const QPoint& pos, const QPoint& startPos, int keyState, int startKeyState ); + /** + * Mouse move over the canvas. This event is not sent during dragging + */ + virtual void canvasMove( const QPoint& pos ); + /** + * Rounds canvas coordinates to view's grid.( if SHIFT key is not pressed ). + */ + QSPt2f snapToGrid( const QPoint& pos, int keyState=0 ); + /** + * Rounds canvas coordinates to view's grid.( if SHIFT key is not pressed ). + */ + QSPt2f snapToGrid( const QSPt2f& pos, int keyState=0 ); + /** + * Rounds x canvas coordinate to view's grid.Always set + * 'snap_to_grid' to true. + */ + double snapToGridX( double canvas_x, int keyState=0 ); + /** + * Rounds y canvas coordinate to view's grid. + */ + double snapToGridY( double canvas_y, int keyState=0 ); + /** + * Rounds range + */ + int snapAngle( int angle, int keyState=0 ); + /** + * Canvas event - this is low-level function. + */ + virtual bool eventMouseDblClick( QMouseEvent * ); + /** + * Canvas event - this is low-level function. Use 'canvasClicked' instead. + */ + virtual bool eventMousePress( QMouseEvent* ); + /** + * Canvas event - this is low-level function. Use 'canvasClicked' instead. + */ + virtual bool eventMouseRelease( QMouseEvent* ); + /** + * Canvas event - this is low-level function. Use 'canvasDragMove' instead. + */ + virtual bool eventMouseMove( QMouseEvent* ); + /** + * Canvas event - this is low-level function. + */ + virtual bool eventKeyPress( QKeyEvent* ); + /** + * Canvas event - this is low-level function. + */ + virtual bool eventKeyRelease( QKeyEvent* ); + /** + * Returns a graphics driver, which can be used to draw on the canvas, and + * enters in th edit mode. + */ + QSDrvQt *driver(); + + QSDrvQt *m_drv; + QSPlotView *m_view; + private: + enum State { StateReady = 0, + StateLeftButtonPressed, + StateMiddleButtonPressed, + StateRightButtonPressed, + StateDragging }; + State m_state; + bool m_snap_to_grid; + QPoint m_drag_start_pos; + QPoint m_drag_prev_pos; + int m_drag_start_key; + int m_drag_prev_key; + void release_driver(); + }; + +#endif diff --git a/kmatplot/widgets/qscurve.cpp b/kmatplot/widgets/qscurve.cpp new file mode 100644 index 0000000..2d3a4ca --- /dev/null +++ b/kmatplot/widgets/qscurve.cpp @@ -0,0 +1,676 @@ +/*************************************************************************** + qscurve.cpp + ------------------- + begin : 01-January-2000 + copyright : (C) 2000 by Kamil Dobkowski + email : kamildobk@poczta.onet.pl + ***************************************************************************/ + +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + + +#include "qscurve.h" +#include <assert.h> + +#define SET_PROPERTY( property, new_value ) if ((property)!=(new_value)) { parametersChanging(); (property)=(new_value); parametersChanged(); } + +struct curve_runtime_data { + int stage; + int pk; + QSAxis *xaxis; + QSAxis *yaxis; + int cpass; + int tpass; + bool ipass; + QSMatrix *sx; + QSMatrix *sy; + QSMatrix *dx; + QSMatrix *dy; + int xw; + int yw; + bool delete_po; + bool shasx; + bool shasdx; + bool shasdy; + QSSegment *po; + QSPt2f zero; + QSPt2f curr_pos; + QSPt2f curr_delta; + QSGFill curr_fill; + QSGLine curr_line; + QSGPoint curr_point; + QSGLine curr_err_line; + QSGArrow curr_arrow_1; + QSGArrow curr_arrow_2; + QSGLine curr_x_line; + QSGLine curr_y_line; + }; + +//-------------------------------------------------------------// + +QSCurve::QSCurve(QSAxes * parent, const char * name) +:QSPlot2D(parent,name) + { + assert( parent ); + d = NULL; + m_title_str = tr("Untitled curve"); + m_evalid = false; + m_type = Lines; + m_po = NULL; + m_xmin = 0.0; + m_xmax = 0.0; + m_ymin = 0.0; + m_ymax = 0.0; + m_zero.set(0.0,0.0); + m_pdelta.set(0.0,0.0); + m_fdelta.set(0.0,0.0); + + #define CHANNELS_NUM 11 + #define FILLS_NUM 1 + #define FONTS_NUM 0 + #define LINES_NUM 4 + #define POINTS_NUM 1 + + initChannelTable( CHANNELS_NUM ); + initAttributeTables( FONTS_NUM, FILLS_NUM, LINES_NUM, POINTS_NUM ); + + m_settings.lines[ErrorLine] = QSGLine::invisibleLine; + m_settings.lines[XLine] = QSGLine::invisibleLine; + m_settings.lines[YLine] = QSGLine::invisibleLine; + m_settings.fills[BaseFill] = QSGFill::transparentFill; + } + +//-------------------------------------------------------------// + +QSCurve::~QSCurve() + { + delete m_po; + } + +//-------------------------------------------------------------// + +void QSCurve::dataChanged( int channel ) + { + m_evalid = false; + QSPlot2D::dataChanged( channel ); + } + +//-------------------------------------------------------------// + +void QSCurve::allocRuntimeData() + { + QSPlot2D::allocRuntimeData(); + d = new curve_runtime_data(); + d->po = NULL; + d->stage = 0; + d->delete_po = false; + d->pk = 0; + d->sx = matrix( XVector ); + d->sy = matrix( YVector ); + d->dx = matrix( DXVector ); + d->dy = matrix( DYVector ); + d->xw = matrixRows( XVector ); + d->yw = matrixRows( YVector ); + d->shasx = ( matrixRows(XVector) == d->yw ); + d->shasdx = ( matrixRows(DXVector) == d->yw ); + d->shasdy = ( matrixRows(DYVector) == d->yw ); + d->xaxis = defaultAxis(QSAxis::XAxisType); + d->yaxis = defaultAxis(QSAxis::YAxisType); + } + +//-------------------------------------------------------------// + +void QSCurve::freeRuntimeData() + { + if ( d->delete_po ) delete d->po; + delete d; d = NULL; + QSPlot2D::freeRuntimeData(); + } + +//-------------------------------------------------------------// + +void QSCurve::get_values( int index ) + { + d->curr_pos.x = d->shasx ? d->sx->value(index,0) : index; + d->curr_pos.y = d->sy->value(index,0); + d->curr_delta.x = m_fdelta.x + ( d->shasdx ? d->dx->value(index,0) : 0.0 ) + m_pdelta.x*d->curr_pos.x/100.0; + d->curr_delta.y = m_fdelta.y + ( d->shasdy ? d->dy->value(index,0) : 0.0 ) + m_pdelta.y*d->curr_pos.y/100.0; + } + +//-------------------------------------------------------------// + +void QSCurve::get_attributes( int index ) + { + d->curr_point = pointFromData( matrix(PointStyles), index, 0, m_settings.points[PointMark] ); + d->curr_fill = fillFromData( matrix(FillStyles), index, 0, m_settings.fills[BaseFill] ); + d->curr_line = lineFromData( matrix(LineStyles), index, 0, m_settings.lines[BaseLine] ); + d->curr_arrow_1 = arrowFromData( matrix(ArrowStyles), index, 0, arrow1() ); + d->curr_arrow_2 = arrowFromData( matrix(ArrowStyles), index, 2, arrow2() ); + d->curr_err_line = lineFromData( matrix(ErrorLineStyles), index, 0, m_settings.lines[ErrorLine] ); + d->curr_x_line = lineFromData( matrix(XLineStyles), index, 0, m_settings.lines[XLine] ); + d->curr_y_line = lineFromData( matrix(YLineStyles), index, 0, m_settings.lines[YLine] ); + } + +//-------------------------------------------------------------// + +bool QSCurve::getAxisRange( QSAxis *axis, double& min, double& max ) + { + allocRuntimeData(); + if ( d->yw == 0 ) { freeRuntimeData(); return false; } + + if ( !m_evalid ) { + d->pk = 0; + // if we should care about +/-dx or only +dx + bool dminus = (line(ErrorLine).style != QSGLine::Invisible || m_type == Ribbon); + while ( d->pk<d->yw ) { + get_values( d->pk++ ); + QSPt2f p1 = dminus ? d->curr_pos-d->curr_delta : d->curr_pos; + QSPt2f p2 = d->curr_pos+d->curr_delta; + + if ( m_xmin > p1.x || d->pk == 1 ) m_xmin = p1.x; + if ( m_xmax < p1.x || d->pk == 1 ) m_xmax = p1.x; + if ( m_xmin > p2.x ) m_xmin = p2.x; + if ( m_xmax < p2.x ) m_xmax = p2.x; + + if ( m_ymin > p1.y || d->pk == 1 ) m_ymin = p1.y; + if ( m_ymax < p1.y || d->pk == 1 ) m_ymax = p1.y; + if ( m_ymin > p2.y ) m_ymin = p2.y; + if ( m_ymax < p2.y ) m_ymax = p2.y; + } + m_evalid = true; + } + + if ( axis == d->xaxis ) { min = m_xmin; max = m_xmax; } + else if ( axis == d->yaxis ) { min = m_ymin; max = m_ymax; } + else { freeRuntimeData(); return false; } + + freeRuntimeData(); + return true; + } + +//-------------------------------------------------------------// + +bool QSCurve::start() + { + QSPlot2D::start(); + d->stage = 0; + d->pk = 0; + d->zero = dataToWorld(m_zero); + d->stage = StartDrawLines; + return true; + } + +//-------------------------------------------------------------// + +bool QSCurve::step() + { + switch( d->stage ) { + case StartDrawLines: start_draw_lines(); break; + case DrawLines: draw_lines(); break; + case StartDrawSeries: start_draw_series(); break; + case DrawSeries: draw_series(); break; + case StartDrawErrorbars: start_draw_errorbars(); break; + case DrawErrorbars: draw_errorbars(); break; + case StartDrawPointMarks: start_draw_pointmarks(); break; + case DrawPointMarks: draw_pointmarks(); break; + default: return false; + } + return true; + } + +//-------------------------------------------------------------// + +void QSCurve::end() + { + QSPlot2D::end(); + } + +//-------------------------------------------------------------// + +void QSCurve::start_draw_lines() + { + d->pk=0; + if ( line(XLine).style == QSGLine::Invisible && + line(YLine).style == QSGLine::Invisible && + !isChannel(XLineStyles) && + !isChannel(YLineStyles) ) { + d->stage = StartDrawSeries; + } else { + d->stage = DrawLines; + } + } + +//-------------------------------------------------------------// + +void QSCurve::draw_lines() + { + QSPt2f p1; + QSPt2f p2; + int curr_step = 0; + while( d->pk<d->yw ) { + get_values( d->pk ); get_attributes( d->pk ); d->pk ++; + QSPt2f pos = dataToWorld(d->curr_pos); + + // horizontal line + p1.set( d->zero.x, pos.y ); + p2.set( pos.x, pos.y ); + m_drv->setLine( d->curr_x_line ); + m_drv->drawLine2(p1,p2); + + // vertical line + p1.set( pos.x, d->zero.y ); + p2.set( pos.x, pos.y ); + m_drv->setLine( d->curr_y_line ); + m_drv->drawLine2(p1,p2); + + if ( ++curr_step > work_steps && m_bkg_handler ) return; + } + d->stage = StartDrawSeries; + } + +//-------------------------------------------------------------// + +void QSCurve::create_po() + { + d->delete_po = true; + switch( m_type ) { + case Lines: d->po = new QSSLines(); break; + case Area: d->po = new QSSPolys(QSSPolys::Area); break; + case Ribbon: d->po = new QSSPolys(QSSPolys::Ribbon); break; + case Bars: d->po = new QSSBars(); break; + case Vectors: d->po = new QSSFigures(QSSFigures::Vectors); break; + case Flux: d->po = new QSSFigures(QSSFigures::Flux); break; + case Rectangles: d->po = new QSSFigures(QSSFigures::Rectangles); break; + case Ellipses: d->po = new QSSFigures(QSSFigures::Ellipses); break; + case LeftStairs: d->po = new QSSStairs(QSSStairs::Left ); break; + case MiddleStairs:d->po = new QSSStairs(QSSStairs::Middle ); break; + case RightStairs: d->po = new QSSStairs(QSSStairs::Right ); break; + default: d->po = m_po; d->delete_po = false; break; + } + } + +//-------------------------------------------------------------// + +void QSCurve::start_draw_series() + { + create_po(); + d->pk = 0; + d->ipass = false; + d->tpass = d->po->startDraw( this ); + if ( d->tpass > 0 ) { + d->cpass = 0; + d->ipass = true; + d->stage = DrawSeries; + d->po->initPass( 0 ); + } + } + +//-------------------------------------------------------------// + +void QSCurve::draw_series() + { + int curr_step = 0; + + while( d->ipass && d->pk<d->yw ) { + get_values( d->pk ); get_attributes( d->pk ); + d->po->drawSegment( d->pk, + d->curr_pos, + d->curr_delta, + d->curr_line, + d->curr_fill, + d->curr_arrow_1, + d->curr_arrow_2 ); + d->pk++; + if ( ++curr_step > work_steps && m_bkg_handler ) return; + } + + d->po->endPass(); + d->pk = 0; + d->cpass = d->cpass ++; + + if ( d->cpass >= d->tpass ) { + // stop drawing + d->po->stopDraw(); + if ( d->delete_po ) { delete d->po; d->po = NULL; } + d->stage = StartDrawErrorbars; + } else { + // start new pass + d->po->initPass(d->cpass); + } + } + +//-------------------------------------------------------------// + +void QSCurve::start_draw_errorbars() + { + d->pk = 0; + if ( line(ErrorLine).style == QSGLine::Invisible && !isChannel(ErrorLineStyles) ) { + d->stage = StartDrawPointMarks; + } else { + d->stage = DrawErrorbars; + } + } + +//-------------------------------------------------------------// + +void QSCurve::draw_errorbars() + { + int curr_step = 0; + while( d->pk<d->yw ) { + get_values( d->pk ); get_attributes( d->pk ); d->pk++; + + // vertical ( y ) error bar + m_drv->setLine( d->curr_err_line ); + m_drv->drawArrow2( dataToWorld(QSPt2f(d->curr_pos.x,d->curr_pos.y-d->curr_delta.y)), + dataToWorld(QSPt2f(d->curr_pos.x,d->curr_pos.y+d->curr_delta.y)), + d->curr_arrow_2, + d->curr_arrow_2 ); + // horizontal ( x ) error bar + m_drv->setLine( d->curr_err_line ); + m_drv->drawArrow2( dataToWorld(QSPt2f(d->curr_pos.x-d->curr_delta.x,d->curr_pos.y)), + dataToWorld(QSPt2f(d->curr_pos.x+d->curr_delta.x,d->curr_pos.y)), + d->curr_arrow_1, + d->curr_arrow_1 ); + + if ( ++curr_step > work_steps && m_bkg_handler ) return; + } + d->pk = 0; + d->stage = StartDrawPointMarks; + } + + + +//-------------------------------------------------------------// + +void QSCurve::start_draw_pointmarks() + { + d->pk = 0; + if ( point(PointMark).style == QSGPoint::Invisible && !isChannel(PointStyles) ) { + d->stage = Stop; + } else { + d->stage = DrawPointMarks; + } + } + +//-------------------------------------------------------------// + +void QSCurve::draw_pointmarks() + { + int curr_step = 0; + while( d->pk<d->yw ) { + get_values( d->pk ); get_attributes( d->pk ); d->pk++; + m_drv->drawPoint2( dataToWorld(d->curr_pos), d->curr_point ); + if ( ++curr_step > work_steps && m_bkg_handler ) return; + } + d->pk = 0; d->stage = Stop; + } + +//-------------------------------------------------------------// + +void QSCurve::setType( int type ) + { + if ( type >= Lines && type <= User ) + if ( m_type != type ) { + parametersChanging(); + m_type = (SeriesType )type; + m_evalid = false; + parametersChanged(); + } + } + +//-------------------------------------------------------------// + +void QSCurve::setPercentDelta( const QSPt2f& new_delta ) + { + if ( m_pdelta != new_delta ) { + parametersChanging(); + m_pdelta = new_delta; + m_evalid = false; + parametersChanged(); + } + } + +//-------------------------------------------------------------// + +void QSCurve::setPercentDX( double value ) + { + if ( m_pdelta.x != value ) { + parametersChanging(); + m_pdelta.x = value; + m_evalid = false; + parametersChanged(); + } + } + +//-------------------------------------------------------------// + +void QSCurve::setPercentDY( double value ) + { + if ( m_pdelta.y != value ) { + parametersChanging(); + m_pdelta.y = value; + m_evalid = false; + parametersChanged(); + } + } + +//-------------------------------------------------------------// + +void QSCurve::setFixedDelta( const QSPt2f& new_delta ) + { + if ( m_fdelta != new_delta ) { + parametersChanging(); + m_fdelta = new_delta; + m_evalid = false; + parametersChanged(); + } + } + +//-------------------------------------------------------------// + +void QSCurve::setFixedDX( double value ) + { + if ( m_fdelta.x != value ) { + parametersChanging(); + m_fdelta.x = value; + m_evalid = false; + parametersChanged(); + } + } + +//-------------------------------------------------------------// + +void QSCurve::setFixedDY( double value ) + { + if ( m_fdelta.y != value ) { + parametersChanging(); + m_fdelta.y = value; + m_evalid = false; + parametersChanged(); + } + } + +//-------------------------------------------------------------// + +void QSCurve::setZeroPoint( const QSPt2f& new_zero ) + { + SET_PROPERTY( m_zero, new_zero ); + } + +//-------------------------------------------------------------// + +void QSCurve::setZeroLevelX( double x ) + { + SET_PROPERTY( m_zero.x, x ); + } + +//-------------------------------------------------------------// + +void QSCurve::setZeroLevelY( double y ) + { + SET_PROPERTY( m_zero.y, y ); + } + +//-------------------------------------------------------------// + +void QSCurve::setPObject( QSSegment *new_po ) + { + if ( m_po != new_po ) { + parametersChanging(); + delete m_po; m_po = new_po; + parametersChanged(); + } + } + +//-------------------------------------------------------------// + +void QSCurve::setArrow1( const QSGArrow& astyle ) + { + SET_PROPERTY( m_arrow1, astyle ); + } + +//-------------------------------------------------------------// + +void QSCurve::setArrow2( const QSGArrow& astyle ) + { + SET_PROPERTY( m_arrow2, astyle ); + } + +//-------------------------------------------------------------// + +QString QSCurve::posInfo( QSPt2f& pos ) + { + if ( m_busy ) return QString::null; + + QSPt2f p; + double dp = 100.0; + QString result = QString::null; + + allocRuntimeData(); + while( d->pk<d->yw ) { + get_values( d->pk ); + QSPt2f p1 = m_axes->dataToCanvas(d->curr_pos,d->xaxis,d->yaxis); + double d1 = (p1.x-pos.x)*(p1.x-pos.x)+(p1.y-pos.y)*(p1.y-pos.y); + if ( d1 < 5.0*5.0 && d1 < dp ) { + dp = d1; + p = p1; + result = QString(tr("Index ")) + QString::number(d->pk) + "\n"; + result += QString(tr("X = ")) + QString::number(d->curr_pos.x) + "\n"; + result += QString(tr("Y = ")) + QString::number(d->curr_pos.y) + "\n"; + if ( d->shasdx ) result += QString(tr("DX = ")) + QString::number(d->dx->value(0,d->pk)) + "\n"; + if ( d->shasdy ) result += QString(tr("DY = ")) + QString::number(d->dy->value(0,d->pk)) + "\n"; + result += QString(tr("Delta DX = ")) + QString::number(d->curr_delta.x) + "\n"; + result += QString(tr("Delta DY = ")) + QString::number(d->curr_delta.y) + "\n"; + if ( d->curr_delta.x ) result += QString(tr("X-delta = ")) + QString::number(d->curr_pos.x-d->curr_delta.x) + "\n"; + if ( d->curr_delta.x ) result += QString(tr("X+delta = ")) + QString::number(d->curr_pos.x+d->curr_delta.x) + "\n"; + if ( d->curr_delta.y ) result += QString(tr("Y-delta = ")) + QString::number(d->curr_pos.y-d->curr_delta.y) + "\n"; + if ( d->curr_delta.y ) result += QString(tr("Y+delta = ")) + QString::number(d->curr_pos.y+d->curr_delta.y) + "\n"; + } + d->pk++; + } + freeRuntimeData(); + + if ( result != QString::null ) pos.set( p.x, p.y ); + return result; + } + +//-------------------------------------------------------------// +//-------------------------------------------------------------// +//-------------------------------------------------------------// +//-------------------------------------------------------------// +//-------------------------------------------------------------// + +#define BOX_SIZE 20 +#define BOX_SPACE 5 + +//-------------------------------------------------------------// + +QSPt2f QSCurve::legendItemSize( QSDrv *drv ) + { + double boxSize = drv->toPixels(BOX_SIZE); + double boxSpace = drv->toPixels(BOX_SPACE); + QSPt2f tsize = drv->textSize( title() ); + return QSPt2f(boxSize+boxSpace+tsize.x,QMAX(tsize.y,boxSize)); + } + +//-------------------------------------------------------------// + +void QSCurve::drawLegendItem( const QSPt2f& pos, QSDrv *drv ) + { + double boxSize = drv->toPixels(BOX_SIZE); + double boxSpace = drv->toPixels(BOX_SPACE); + QSPt2f tsize = drv->textSize( title() ); + double height = QMAX(tsize.y,boxSize); + + QSPt2f bpos( pos.x, pos.y+(height-boxSize)/2.0 ); + QSPt2f tpos( pos.x+boxSpace+boxSize, pos.y+(height-tsize.y)/2.0 ); + drv->drawText( tpos, title(), AlignLeft | AlignTop ); + drv->setLine(line(BaseLine)); + if ( fill(BaseFill).style != QSGFill::Transparent ) { + drv->setFill( fill(BaseFill) ); + drv->drawRect( bpos, QSPt2f(bpos.x+boxSize,bpos.y+boxSize) ); + } else { + drv->drawLine( QSPt2f(pos.x,pos.y+height/2.0), QSPt2f(pos.x+boxSize,pos.y+height/2.0) ); + } + + if ( point(PointMark).style != QSGPoint::Invisible ) { + drv->drawPoint( QSPt2f(pos.x+boxSize/2.0,pos.y+height/2.0), point(PointMark) ); + } + } + + +//-------------------------------------------------------------// + +void QSCurve::loadStateFromStream( QDataStream& stream, QSObjectFactory *factory ) + { + QSPlot2D::loadStateFromStream( stream, factory ); + } + +//-------------------------------------------------------------// + +void QSCurve::saveStateToStream( QDataStream& stream, QSObjectFactory *factory ) + { + QSPlot2D::saveStateToStream( stream, factory ); + } + +//-------------------------------------------------------------// + +QString QSCurve::channelVariable( int channel ) const + { + switch( channel ) { + case XVector: return "x"; + case YVector: return "y"; + case DXVector: return "dx"; + case DYVector: return "dy"; + case LineStyles: return "line"; + case FillStyles: return "fill"; + case PointStyles: return "point"; + case ArrowStyles: return "arrow"; + case ErrorLineStyles: return "eline"; + case XLineStyles: return "xline"; + case YLineStyles: return "yline"; + } + return QString::null; + } + +//-------------------------------------------------------------// + +QSCurve::ColumnType QSCurve::columnType( int channel, int column ) const + { + } + + +//-------------------------------------------------------------// + + + + + + diff --git a/kmatplot/widgets/qscurve.h b/kmatplot/widgets/qscurve.h new file mode 100644 index 0000000..a163ce9 --- /dev/null +++ b/kmatplot/widgets/qscurve.h @@ -0,0 +1,380 @@ +/*************************************************************************** + qscurve.h + ------------------- + begin : 01-January-2000 + copyright : (C) 2000 by Kamil Dobkowski + email : kamildobk@poczta.onet.pl + ***************************************************************************/ + +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + + +#ifndef QSCURVE_H +#define QSCURVE_H + +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + +#include"qsaxes.h" +#include"qsplot.h" +#include"qscoord.h" +#include"qssegment.h" + +//-------------------------------------------------------------------// + + + +/** + * \brief Dataset: XY plot. + * + * Base class for parametric curves. The appearance of QSCurve can be customized by setting your own + * QSSegment object, see setPObject() . Data format is described in QSCurve::Channels .See also QSAxes::plotAdd() . + * @author Kamil Dobkowski + */ +class QSCurve : public QSPlot2D + { + Q_OBJECT + Q_PROPERTY( int type READ type WRITE setType ) + Q_PROPERTY( double fixedDX READ fixedDX WRITE setFixedDX ) + Q_PROPERTY( double fixedDY READ fixedDY WRITE setFixedDY ) + Q_PROPERTY( double percentDX READ percentDX WRITE setPercentDX ) + Q_PROPERTY( double percentDY READ percentDY WRITE setPercentDY ) + Q_PROPERTY( double zeroLevelX READ zeroLevelX WRITE setZeroLevelX ) + Q_PROPERTY( double zeroLevelY READ zeroLevelY WRITE setZeroLevelY ) + Q_PROPERTY( QString arrow1 READ arrow1Property WRITE setArrow1Property ) + Q_PROPERTY( QString arrow2 READ arrow2Property WRITE setArrow2Property ) + + public: + + /** + * Descriptive names of data channels. See QSData::setMatrix() + * All channels must be column vectors with the same number of rows. + * Values from the same row from all matrices define a one data point. + * XVector contains the x coordinate, YVector contains the y coordinate, DX + * vector contain the dx coordinate ( used for vectors, error bars etc ), + * DY vector contains the dy coordinate, and other vectors contain other attributes. + */ + enum Channels { + XVector = 0, + YVector = 1, + DXVector = 2, + DYVector = 3, + LineStyles = 4, + FillStyles = 5, + PointStyles = 6, + ArrowStyles = 7, + ErrorLineStyles = 8, + XLineStyles = 9, + YLineStyles = 10 + }; + + + /** + * Types of the series. + * @see #setPlotType + */ + enum SeriesType { + Lines = 0, + Area, + Ribbon, + Bars, + Vectors, + Flux, + Rectangles, + Ellipses, + LeftStairs, + MiddleStairs, + RightStairs, + User + }; + + /** + * Constructor. + */ + QSCurve( QSAxes* parent, const char * name=0 ); + /** + * Destructor. + */ + ~QSCurve(); + /** + * Sets a new plot type. See 'SeriesType' + */ + void setType( int type ); + /** + * Returns the plot type. + */ + int type() const { return m_type; } + /** + * Delta acts as a DX,DY channel with fixed values. + * Used when drawing vectors, error-bars, rectangle-type plots. + * Total delta value is calculated as follows ( example for DX ): + * DX[i] = DXVector[i] + FixedDelta.X + PercentDelta.X*DXVector[i]/100.0; + * Error is assumed to be +-delta. + */ + void setFixedDelta( const QSPt2f& delta ); + /** + * Sets a new fixed delta value. + */ + void setFixedDX( double value ); + /** + * Sets a new fixed delta value. + */ + void setFixedDY( double value ); + /** + * Delta PDX[i] = PercentDelta.X*YVector[i]/100.0. + * Total delta value is calculated as follows ( example for DX ): + * DX[i] = DXVector[i] + FixedDelta.X + PercentDelta.X*DXVector[i]/100.0; + */ + void setPercentDelta( const QSPt2f& delta ); + /** + * Sets a percent delta + */ + void setPercentDX( double value ); + /** + * Sets a percent delta + */ + void setPercentDY( double value ); + /** + * Returns a fixed delta value. + */ + QSPt2f fixedDelta() const { return m_fdelta; } + /** + * Returns a fixed delta value. + */ + double fixedDX() const { return m_fdelta.x; } + /** + * Returns a fixed delta value. + */ + double fixedDY() const { return m_fdelta.y; } + /** + * Returns a delta value. + */ + QSPt2f percentDelta() const { return m_pdelta; } + /** + * Returns a delta value. + */ + double percentDX() const { return m_pdelta.x; } + /** + * Returns a delta value. + */ + double percentDY() const { return m_pdelta.y; } + /** + * Sets a zero level. It is the y value from which, for example, + * sample lines starts. + */ + void setZeroPoint( const QSPt2f& p ); + /** + * Sets zero level. + */ + void setZeroLevelX( double x ); + /** + * Sets zero level. + */ + void setZeroLevelY( double y ); + /** + * Returns the zero-level. + */ + QSPt2f zeroPoint() const { return m_zero; } + /** + * Returns the zero-level. + */ + double zeroLevelX() const { return m_zero.x; } + /** + * Returns the zero-level. + */ + double zeroLevelY() const { return m_zero.y; } + /** + * Sets a new plot object. Normally there is no need to use it. + * Pointer is consumed and will be deleted when not needed. + * Remember that also 'User' plot type must be set. + */ + void setPObject( QSSegment *po ); + /** + * Returns the plot object or NULL. + */ + QSSegment *pObject() const { return m_po; } + /** + * This is usable only for vectors or errorbars. + */ + void setArrow1( const QSGArrow& astyle ); + /** + * This is usable only for vectors or errorbars. + */ + void setArrow2( const QSGArrow& astyle ); + /** + * Sets arrow property + */ + void setArrow1Property( const QString& value ) { setArrow1(toQSGArrow(value)); } + /** + * Sets arrow property + */ + void setArrow2Property( const QString& value ) { setArrow2(toQSGArrow(value)); } + /** + * Returns arrow1 + */ + QSGArrow arrow1() const { return m_arrow1; } + /** + * Returns arrow2 + */ + QSGArrow arrow2() const { return m_arrow2; } + /** + * Returns arrow1 property + */ + QString arrow1Property() const { return toQString(arrow1()); } + /** + * Returns arrow2 property + */ + QString arrow2Property() const { return toQString(arrow2()); } + + + virtual QString posInfo( QSPt2f& pos ); + virtual QSPt2f legendItemSize( QSDrv *drv ); + virtual void drawLegendItem( const QSPt2f& pos, QSDrv *drv ); + virtual void loadStateFromStream( QDataStream& stream, QSObjectFactory *factory ); + virtual void saveStateToStream( QDataStream& stream, QSObjectFactory *factory ); + virtual QString channelVariable( int channel ) const; + virtual ColumnType columnType( int channel, int column ) const; + /** + * See QSGraphicalData::setFill() + */ + enum FillElement { + BaseFill = 0 + }; + + /** + * See QSGraphicalData::setLine() + */ + enum LineElement { + BaseLine = 0, + ErrorLine = 1, + XLine = 2, + YLine = 3 + }; + + /** + * See QSGraphicalData::setPoint() + */ + enum PointElement { + PointMark = 0 + }; + + protected: + + virtual void dataChanged( int channel = -1 ); + virtual void allocRuntimeData(); + virtual void freeRuntimeData(); + virtual bool getAxisRange( QSAxis *axis, double& min, double& max ); + virtual bool start(); + virtual bool step(); + virtual void end(); + + private: + SeriesType m_type; + QSPt2f m_zero; + QSPt2f m_fdelta; + QSPt2f m_pdelta; + QSGArrow m_arrow1; + QSGArrow m_arrow2; + QSSegment *m_po; + double m_xmin, m_xmax; + double m_ymin, m_ymax; + bool m_evalid; // extremes valid + struct curve_runtime_data *d; + + enum Stage { + StartDrawLines = 0, + DrawLines = 1, + StartDrawSeries = 2, + DrawSeries = 3, + StartDrawErrorbars = 4, + DrawErrorbars = 5, + StartDrawPointMarks = 6, + DrawPointMarks = 7, + Stop = 8 }; + + void create_po(); + void get_values( int index ); + void get_attributes( int index ); + void start_draw_errorbars(); + void draw_errorbars(); + void start_draw_series(); + void draw_series(); + void start_draw_lines(); + void draw_lines(); + void start_draw_pointmarks(); + void draw_pointmarks(); + }; + + + +#endif + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/kmatplot/widgets/qsdata.cpp b/kmatplot/widgets/qsdata.cpp new file mode 100644 index 0000000..35387ad --- /dev/null +++ b/kmatplot/widgets/qsdata.cpp @@ -0,0 +1,169 @@ +/*************************************************************************** + qbase.cpp + ------------------- + begin : 01-January-2001 + + copyright : (C) 2001 by Kamil Dobkowski + email : kamildobk@poczta.onet.pl + ***************************************************************************/ + +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + +#include "qsgraphicaldata.h" +#include <qstrlist.h> +#include <qmetaobject.h> +#include <qvariant.h> +#include <iostream> + +//-------------------------------------------------------------// + +QSData::QSData( QObject * parent, QSData *parentObject, const char * name ) +:QObject( parent, name ), QSSerializable() + { + m_parent_object = parentObject; + } + +//-------------------------------------------------------------// + +QSData::~QSData() + { + emit sigDeleted(this); + } + +//-------------------------------------------------------------// + +void QSData::setObjectName( const char *name ) + { + setName( name ); + emit sigNameChanged( name ); + nameChanged( this, name ); + } + +//-------------------------------------------------------------// + +bool QSData::setMatrix( int, QSMatrix * ) + { + return false; + } + +//-------------------------------------------------------------// + +QSMatrix *QSData::matrix( int ) const + { + return NULL; + } + +//-------------------------------------------------------------// + +QSMatrix *QSData::takeMatrix( int, QSMatrix* ) + { + return NULL; + } + +//-------------------------------------------------------------// + +void QSData::deleteMatrix( int ) + { + } + +//-------------------------------------------------------------// + +int QSData::channelCount() const + { + return 0; + } + +//-------------------------------------------------------------// + +void QSData::dataChanging( int channel ) + { + dataChanging( this, channel ); + } + +//-------------------------------------------------------------// + +void QSData::dataChanged( int channel ) + { + dataChanged( this, channel ); + } + + //-------------------------------------------------------------// + +void QSData::dataChanging( QSData *object, int channel ) + { + if ( m_parent_object ) m_parent_object->dataChanging( object, channel ); + } + +//-------------------------------------------------------------// + +void QSData::dataChanged( QSData *object, int channel ) + { + emit sigDataChanged( object, channel ); + if ( m_parent_object ) m_parent_object->dataChanged( object, channel ); + } + +//-------------------------------------------------------------// + +int QSData::childIndex( QSData *searched_child ) const + { + for( int child_nr=0; child_nr<childCount(); child_nr++ ) + if ( child(child_nr) == searched_child ) return child_nr; + + return -1; + } + +//-------------------------------------------------------------// + +void QSData::nameChanged( QSData *object, const char *newName ) + { + emit sigNameChanged( object, newName ); + if ( m_parent_object ) m_parent_object->nameChanged( object, newName ); + } + +//-------------------------------------------------------------// + +void QSData::loadStateFromStream( QDataStream& stream, QSObjectFactory *factory ) + { + QSSerializable::loadStateFromStream( stream, factory ); + // load properties + QMetaObject *meta_object = metaObject(); + QStrList properties = meta_object->propertyNames( TRUE ); + for( unsigned int property_nr=0; property_nr<properties.count(); property_nr++ ) { + QCString property_name; + QVariant property_value; + stream >> property_name >> property_value; + setProperty(property_name,property_value); + } + // load matrices + for( int i=0; i<channelCount(); i++ ) { + setMatrix( i, dynamic_cast<QSMatrix*>(factory->loadObjectFromStream(stream)) ); + } + } + +//-------------------------------------------------------------// + +void QSData::saveStateToStream( QDataStream& stream, QSObjectFactory *factory ) + { + QSSerializable::saveStateToStream( stream, factory ); + // save properties + QMetaObject *meta_object = metaObject(); + QStrList properties = meta_object->propertyNames( TRUE ); + for( unsigned int property_nr=0; property_nr<properties.count(); property_nr++ ) { + stream << QCString(properties.at(property_nr)) << property(properties.at(property_nr)); + } + // save matrices + for( int i=0; i<channelCount(); i++ ) { + factory->saveObjectToStream(matrix(i),stream); + } + } + + + + diff --git a/kmatplot/widgets/qsdata.h b/kmatplot/widgets/qsdata.h new file mode 100644 index 0000000..a5350b7 --- /dev/null +++ b/kmatplot/widgets/qsdata.h @@ -0,0 +1,232 @@ +/*************************************************************************** + qdata.h + ------------------- + version : + begin : + + copyright : (C) 2000 by Kamil Dobkowski + email : kamildobk@poczta.onet.pl + ***************************************************************************/ + +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + + +#ifndef QSDATA_H +#define QSDATA_H + +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + +#include"qsgattr.h" +#include"qsmatrix.h" +#include"qsserializable.h" +#include<qobject.h> +#include<qstring.h> +#include<math.h> + +//-------------------------------------------------------------------------------------------------------------// + +/** + * \brief Object which contains data ( list of matrices ) + * + * Object, which contains data - a list of matrices, see setMatrix(), matrix(). This class is + * inherited by all dataset types: QSSurface, QSCurve, etc. and axes : QSAxes2D, QSAxes3D etc. + * For example an ordinary XYPlot ( QSCurve ) contains XVector, YVector, DX Vector, DYVector. and draws all succesive + * ( x, y ,dx, dy ) points as a curve with error bars. This object can own child QSData objects, for example: axes + * contains curves ( but curves have no furher child object ) - see child(), childCount(), childIndex(). This is only an + * interface class and does not contain implementation of matrix list. + * If you are going to change data ( change value of some matrix element, etc ) you have to notify QSData object using + * dataChanging(), dataChanged() before and after the change, and it notifies outside world about this fact using + * sigDataChanged() . + * @see QSMatrix + * @author Kamil Dobkowski + */ +class QSData : public QObject, public QSSerializable + { + Q_OBJECT + + public: + /** + * Column type + */ + enum ColumnType { + ColumnUnknown = 0, + ColumnX, + ColumnY, + ColumnZ, + ColumnV, + ColumnDX, + ColumnDY, + ColumnSize, + ColumnWidth, + ColumnLineStyle, + ColumnFillStyle, + ColumnPointStyle, + ColumnPointFill, + ColumnArrowStyle, + ColumnFontFamily, + ColumnFontSize, + ColumnFontBold, + ColumnFontItalic, + ColumnRed, + ColumnGreen, + ColumnBlue, + ColumnAlpha, + ColumnByte, + ColumnInt, + ColumnBool, + ColumnString + }; + /** + * Constructor + */ + QSData( QObject *parent=NULL, QSData *parentObject=NULL, const char *name=0 ); + /** + * Destructor. It should delete all child object as well. + */ + virtual ~QSData(); + /** + * The same as setName() but emits nameChanged( const char *newName ). + */ + virtual void setObjectName( const char *name ); + /** + * The same as name() + */ + const char *objectName() const { return name(); } + /** + * Sets a new matrix as the given channel in the plot. + */ + virtual bool setMatrix( int channel, QSMatrix *m ); + /** + * Returns matrix 'channel' if any, or NULL. + */ + virtual QSMatrix *matrix( int channel ) const; + /** + * Gives ownership of the matrix to caller and + * sets data to newMatrix. + */ + virtual QSMatrix *takeMatrix( int channel, QSMatrix *newMatrix = NULL ); + /** + * Deletes the choosen matrix. + */ + virtual void deleteMatrix( int channel ); + /** + * Returns the total number of channels. + */ + virtual int channelCount() const; + /** + * This function is called before data is changed by 'setMatrix' + * method. You should also call it by hand, when you are going to change + * the data in any matrix.. + * It informs derived classes to stop a drawing process if it is in progress at the + * moment. + * Default implementation calls dataChanging( this, channel ), + */ + virtual void dataChanging( int channel = -1 ); + /** + * This function is called after data has changed by 'setMatrix' + * method. You should also call it by hand, when you have changed + * the data in any matrix. + * It informs derived classes to mark old max and min data values as invalid, + * and informs them that they should repaint themselves. + * Default implementation calls dataChanging( this, channel ), + */ + virtual void dataChanged( int channel = -1 ); + /** + * Returns the parent object. + */ + virtual QSData *parentObject() const { return m_parent_object; } + /** + * Number of child QSData objects + */ + virtual int childCount() const { return 0; } + /** + * Returns a child object + */ + virtual QSData *child( int index ) const { return NULL; } + /** + * Returns a child index. + */ + virtual int childIndex( QSData *child ) const; + /** + * Returns a variable name ( 'x', 'y', 'z', 'v' etc ) for use in formulas. + */ + virtual QString channelVariable( int channel ) const { return QString::null; } + /** + * Metadata - type of the given column. It should be reimplemented in derived classes. + * Used to create editors in sheet + */ + virtual ColumnType columnType( int channel, int column ) const { return ColumnUnknown; } + /** + * Restores all QObject properties. Loads all matrices + */ + virtual void loadStateFromStream( QDataStream& stream, QSObjectFactory *factory ); + /** + * Saves all QObjects properties. Saves all matrices. + */ + virtual void saveStateToStream( QDataStream& stream, QSObjectFactory *factory ); + + signals: + /** + * Name of this object has changed + */ + void sigNameChanged( const char *name ); + /** + * Name of this object has changed + */ + void sigNameChanged( QSData *thisOrChildObject, const char *name ); + /** + * Data has changed in this or any child object. + */ + void sigDataChanged( QSData *thisOrChildObject, int channel ); + /** + * A new child object was added to the child list. + */ + void sigChildAdded( QSData *newChild ); + /** + * Child object is about to be removed from the list. + */ + void sigChildRemoved( QSData *removedChild ); + /** + * Index of some child object was changed ( the list was reordered ). + */ + void sigChildOrder(); + /** + * sigChildAdded() + sigChildRemoved() + sigChildOrder() + */ + void sigChildListChanged(); + /** + * Ups ! It is emmited from destructor of this object. + */ + void sigDeleted( QSData *thisObject ); + + protected: + /** + * Does nothing. This function collects all 'dataChanging()' calls from this object and child objects. + * if parent is not NULL calls parent->dataChanging( this, channel ); + */ + virtual void dataChanging( QSData *object, int channel = -1 ); + /** + * Emits sigDataChanged(). This function collects all 'dataChanged()' calls from this object and child objects. + * and if parent is not NULL calls parent->dataChanged( this, channel ); + */ + virtual void dataChanged( QSData *object, int channel = -1 ); + /** + * + */ + virtual void nameChanged( QSData *object, const char *newName ); + + QSData *m_parent_object; + }; + +#endif + + diff --git a/kmatplot/widgets/qsdrv.cpp b/kmatplot/widgets/qsdrv.cpp new file mode 100644 index 0000000..756d4da --- /dev/null +++ b/kmatplot/widgets/qsdrv.cpp @@ -0,0 +1,701 @@ +/*************************************************************************** + qsdrv.cpp + ------------------- + begin : 01-January-2000 + copyright : (C) 2000 by Kamil Dobkowski + email : kamildobk@poczta.onet.pl + ***************************************************************************/ + +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + + +#include "qsdrv.h" +#include <qwmatrix.h> +#include <math.h> +#include <iostream> + +//-------------------------------------------------------------// + +QSCanvasDrv::QSCanvasDrv() + { + dpi = 72.0; + } + +//-------------------------------------------------------------// + +QSCanvasDrv::~QSCanvasDrv() + { + stopDrawing(); + } + +//-------------------------------------------------------------// + +void QSCanvasDrv::startDrawing() + { + } + +//-------------------------------------------------------------// + +void QSCanvasDrv::stopDrawing() + { + } + +//-------------------------------------------------------------// + +void QSCanvasDrv::drawPoint( const QSPt2f& pos, const QSGPoint& point ) + { + if ( point.style != QSGPoint::Invisible ) { + double size = toPixels(point.size); + QSPt2f p1( pos.x - size/2.0, pos.y - size/2.0 ); + QSPt2f p2( p1.x + size, p1.y + size ); + + QSGLine cl = currentLine(); + QSGFill cf = currentFill(); + QSGLine l; l.color = point.color; l.width = int(floor(size/15.0+0.5)); + QSGFill f; + if ( point.fill == QSGPoint::Filled ) f.color = point.color; + if ( point.fill == QSGPoint::Transparent ) f.style = QSGFill::Transparent; + + if ( cf != f ) setFill( f ); + if ( cl != l ) setLine( l ); + + QSPt2f p[4]; + switch( point.style ) { + case QSGPoint::Circle: + drawEllipse(p1,p2); + break; + + case QSGPoint::Rect: + drawRect( p1, p2 ); + break; + + case QSGPoint::Triangle + : p[0].set( pos.x, p1.y ); + p[1].set( p2.x, p2.y ); + p[2].set( p1.x, p2.y ); + drawPoly( p, 3 ); + break; + + case QSGPoint::Diamond: + p[0].set( pos.x, p1.y ); + p[1].set( p2.x, pos.y ); + p[2].set( pos.x, p2.y ); + p[3].set( p1.x, pos.y ); + drawPoly( p, 4 ); + break; + + case QSGPoint::Cross: + drawLine( p1, p2 ); + drawLine( p[0].set(p2.x,p1.y), p[1].set(p1.x,p2.y) ); + break; + + case QSGPoint::Plus: + drawLine( p[0].set(p1.x,pos.y), p[1].set(p2.x,pos.y) ); + drawLine( p[0].set(pos.x,p1.y), p[1].set(pos.x,p2.y) ); + break; + + case QSGPoint::HLine: + drawLine( p[0].set(p1.x,pos.y), p[1].set(p2.x,pos.y) ); + break; + + case QSGPoint::VLine: + drawLine( p[0].set(pos.x,p1.y), p[1].set(pos.x,p2.y) ); + break; + default: break; + } + } + } + +//-------------------------------------------------------------// + +/* { number_of_vertices, x1, y1, x2, y2, ... } */ + +// arrow +static const double arrow_A[] = { 4, 0, 0, -2, -1, -1, 0, -2, 1 }; +// filled arrow +static const double arrow_FA[] = { 3, 0, 0, -2, -1, -2, 1 }; +// narrow arrow +static const double arrow_NA[] = { 3, 0, 0, -3, -1, -3, 1 }; +// reversed arrow +static const double arrow_RA[] = { 4, 0, 0, 2, -1, 1, 0, 2, 1 }; +// reversed filled arrow +static const double arrow_RFA[] = { 3, 0, 0, 2, -1, 2, 1 }; +// reversed narrow arrow +static const double arrow_RNA[] = { 3, 0, 0, 3, -1, 3, 1 }; +// rectangle +static const double arrow_R[] = { 4, -1, -1, 1, -1, 1, 1, -1, 1 }; +// diamond +static const double arrow_D[] = { 4, -1, 0, 0, -1, 1, 0, 0, 1 }; +// line +static const double arrow_L[] = { 2, 0, -1, 0, 1 }; +// fdiag line +static const double arrow_F[] = { 2, -1,-1, 1, 1 }; +// bdiag line +static const double arrow_B[] = { 2, -1, 1, 1, -1 }; + +static const double *arrows[] = { NULL, + arrow_A, + arrow_FA, + arrow_NA, + arrow_RA, + arrow_RFA, + arrow_RNA, + arrow_R, + arrow_D, + NULL, + arrow_L, + arrow_F, + arrow_B }; + +//-------------------------------------------------------------// + +void QSCanvasDrv::drawDart( const QSPt2f& pos, double angle, const QSGArrow& arrow ) + { + if ( arrow.style == QSGArrow::None ) return; + + double scale = toPixels( arrow.size ); + + QSGLine cl = currentLine(); + QSGLine l; l.color = cl.color; setLine( l ); + QSGFill f; f.color = cl.color; setFill( f ); + + if ( arrow.style == QSGArrow::Circle ) { + double size = scale;; + QSPt2f p1( pos.x - size, pos.y - size ); + QSPt2f p2( pos.x + size, pos.y + size ); + drawEllipse( p1, p2 ); + return; + } + + QSPt2f p[4]; QWMatrix m; + m.translate( pos.x, pos.y ); m.rotate( angle ); m.scale( scale, scale ); + for( int i=0; i<arrows[arrow.style][0]; i++ ) m.map( arrows[arrow.style][i*2+1], + arrows[arrow.style][i*2+2], + &p[i].x, &p[i].y ); + if (arrows[arrow.style][0] > 2 ) drawPoly( p, (int )arrows[arrow.style][0] ); + else drawLine( p[0], p[1] ); + } + +//-------------------------------------------------------------// + +void QSCanvasDrv::drawArrow( const QSPt2f& p1, const QSPt2f& p2, const QSGArrow& p1style, const QSGArrow& p2style ) + { + double angle = ( p1 == p2 ) ? 0.0 : atan2(p2.y-p1.y,p2.x-p1.x)*180.0/3.141592; + + drawLine( p1, p2 ); + drawDart( p1, angle+180.0, p1style ); + drawDart( p2, angle+ 0.0, p2style ); + } + +//-------------------------------------------------------------// + +void QSCanvasDrv::drawRTextBox( const QSPt2f &pos, int angle, const QString& text, int align ) + { + QSPt2f text_size = rTextSize( angle, text ); + QSPt2f text_pos = pos; + if ( align & AlignLeft ) text_pos.x += text_size.x/2.0; + if ( align & AlignRight ) text_pos.x -= text_size.x/2.0; + if ( align & AlignTop ) text_pos.y += text_size.y/2.0; + if ( align & AlignBottom ) text_pos.y -= text_size.y/2.0; + drawRText( text_pos, angle, text, AlignVCenter | AlignHCenter ); + } + +//-------------------------------------------------------------// + +QSPt2f QSCanvasDrv::rTextSize( int angle, const QString& text ) + { + QSPt2f pts[4]; + getRTextBoundingPoly( pts, QSPt2f(0,0), angle, text ); + QSPt2f min; + QSPt2f max; + min.x = QMIN(pts[0].x,pts[1].x); min.x = QMIN(min.x,pts[2].x); min.x = QMIN(min.x,pts[3].x); + min.y = QMIN(pts[0].y,pts[1].y); min.y = QMIN(min.y,pts[2].y); min.y = QMIN(min.y,pts[3].y); + max.x = QMAX(pts[0].x,pts[1].x); max.x = QMAX(max.x,pts[2].x); max.x = QMAX(max.x,pts[3].x); + max.y = QMAX(pts[0].y,pts[1].y); max.y = QMAX(max.y,pts[2].y); max.y = QMAX(max.y,pts[3].y); + return QSPt2f( max.x-min.x+1.0, max.y-min.y+1.0 ); + } + + +//-------------------------------------------------------------// +/* +void QSCanvasDrv::drawRText( const QSPt2f&, int, const QString&, int ) + { + } + +//-------------------------------------------------------------// + +void QSCanvasDrv::getRTextBoundingPoly( QSPt2f [4], const QSPt2f&, int, const QString&, int ) + { + } + +//-------------------------------------------------------------// + +void QSCanvasDrv::beginPolyline( const QSPt2f& ) + { + } + +//-------------------------------------------------------------// + +void QSCanvasDrv::drawPolylineTo( const QSPt2f& ) + { + } +*/ + +//-------------------------------------------------------------// + +void QSCanvasDrv::getPixmapBuffer( PixmapBuffer *buff, int, int ) + { + buff->ptr = NULL; + } + +//-------------------------------------------------------------// + +void QSCanvasDrv::drawPixmap( const QSPt2f&, PixmapBuffer * ) + { + } + + + +//-------------------------------------------------------------// +//-------------------------------------------------------------// +//-------------------------------------------------------------// +//-------------------------------------------------------------// +//-------------------------------------------------------------// +//-------------------------------------------------------------// + +QSDrv::QSDrv() +:QSCanvasDrv() + { + m_t = NULL; + m_clipping = false; + m_pts = NULL; + m_cpts2 = NULL; + m_cpts3 = NULL; + m_cedges = NULL; + m_ncpts2 = 0; + m_ncpts3 = 0; + m_max_cedges = 0; + m_max_pts = 0; + m_max_cpts2 = 0; + m_max_cpts3 = 0; + m_top_bottom = false; + m_category = -1; + m_element = -1; + } + +//-------------------------------------------------------------// + +QSDrv::~QSDrv() + { + } + +//-------------------------------------------------------------// + +void QSDrv::setProjection( const QSProjection *t ) + { + m_t = t; + } + +//-------------------------------------------------------------// + +void QSDrv::setCurrentElement( int category, int element ) + { + m_category = category; + m_element = element; + } + +//-------------------------------------------------------------// + +void QSDrv::setClipping( bool enabled ) + { + m_clipping = enabled; + } + +//-------------------------------------------------------------// + +void QSDrv::setTopBottom( bool enabled ) + { + m_top_bottom = enabled; + } + +//-------------------------------------------------------------// + +void QSDrv::setBottomFill( const QSGFill& f ) + { + m_bottom_fill = f; + } + +//-------------------------------------------------------------// + +void QSDrv::startDrawing() + { + QSCanvasDrv::startDrawing(); + } + +//-------------------------------------------------------------// + +void QSDrv::stopDrawing() + { + delete[] m_pts; m_pts = NULL; m_max_pts = 0; + delete[] m_cpts2; m_cpts2 = NULL; m_ncpts2 = 0; m_max_cpts2 = 0; + delete[] m_cpts3; m_cpts3 = NULL; m_ncpts3 = 0; m_max_cpts3 = 0; + m_category = -1; + m_element = -1; + QSCanvasDrv::stopDrawing(); + } + +//-------------------------------------------------------------// +//-------------------------------------------------------------// +//-------------------------------------------------------------// +//-------------------------------------------------------------// +//-------------------------------------------------------------// + +void QSDrv::drawPoly3( const QSPt3f pts3[], int npoints, const QSPt3f *norm, const QSGFill *fills, const bool edges[], int edgeAutoColor ) +// if driver uses something else except norm[0], colors[0] you must +// reimplement this function to clipVertexColors and clipVertexNormals + { + const bool *in_edges = NULL; + const QSPt3f *in_pts3 = NULL; + int in_npts3 = 0; + if ( m_clipping ) { + QSProjection::ClipResult clip = clip_poly( pts3, npoints, edges ); + if ( clip == QSProjection::Accepted ) { in_pts3 = pts3; in_npts3 = npoints; in_edges = edges; } + else + if ( clip == QSProjection::Clipped ) { in_pts3 = m_cpts3; in_npts3 = m_ncpts3; in_edges = m_cedges; } + else + if ( clip == QSProjection::Rejected ) return; + } else { + in_pts3 = pts3; in_npts3 = npoints; + } + + map_to_screen( in_pts3, in_npts3 ); +// if ( m_stage > 0 ) { + QSGFill f = fills[0]; + m_t->shade( f, norm[0], m_pts, in_npts3, (m_top_bottom?&m_bottom_fill:NULL) ); + setFill( f ); + drawPoly( m_pts, in_npts3, in_edges, edgeAutoColor ); + } + + /* + if ( cNormals() == VertexNormals || 1 ) { + QSPt3f no_norm[2]; + for( int i=0; i<npoints; i++ ) { + QSPt3f n( norm[i+1].x/5.0, norm[i+1].y/5.0, norm[i+1].z/5.0 ); + drawLine3( pts3[i], pts3[i]+n, no_norm ); + } + } + */ +//-------------------------------------------------------------// + +void QSDrv::drawLine3( const QSPt3f& pos1, const QSPt3f& pos2, const QSPt3f [2] ) + { + if ( m_clipping ) { + QSPt3f p1 = pos1; QSPt3f p2 = pos2; + if ( m_t->clipLine3(&p1,&p2) ) drawLine( m_t->world3DToCanvas(p1), m_t->world3DToCanvas(p2) ); + } else { + drawLine( m_t->world3DToCanvas(pos1), m_t->world3DToCanvas(pos2) ); + } + } + +//-------------------------------------------------------------// + +void QSDrv::drawText3( const QSPt3f& pos, const QString& text, int align ) + { + if ( !m_clipping || (m_clipping && m_t->clipPoint3(pos)) ) + drawText( m_t->world3DToCanvas(pos), text, align ); + } + +//-------------------------------------------------------------// + +void QSDrv::drawPoint3( const QSPt3f& pos, const QSGPoint& point ) + { + if ( !m_clipping || (m_clipping && m_t->clipPoint3(pos)) ) + drawPoint( m_t->world3DToCanvas(pos), point ); + } + +//-------------------------------------------------------------// + +void QSDrv::clearCanvas( const QSGFill&, const QSPt2f&, const QSPt2f& ) + { + } + +//-------------------------------------------------------------// + +void QSDrv::drawLine2( const QSPt2f &one, const QSPt2f &two ) + { + if ( m_clipping ) { + QSPt2f p1 = one; + QSPt2f p2 = two; + if ( m_t->clipLine2(&p1,&p2) ) drawLine( m_t->world2DToCanvas(p1), m_t->world2DToCanvas(p2) ); + } else { + drawLine( m_t->world2DToCanvas(one), m_t->world2DToCanvas(two) ); + } + } + +//-------------------------------------------------------------// + +void QSDrv::drawRect2( const QSPt2f &p1, const QSPt2f &p2 ) + { + if ( !m_clipping || (m_clipping && (m_t->clipPoint2(p1) || m_t->clipPoint2(p2))) ) + drawRect( m_t->world2DToCanvas(p1), m_t->world2DToCanvas(p2) ); + } + +//-------------------------------------------------------------// + +void QSDrv::drawPoly2( const QSPt2f pts[], int npoints, const bool edges[], int edgeAutoColor ) + { + if ( m_clipping ) { + QSProjection::ClipResult clip = clip_poly( pts, npoints, edges ); + if ( clip == QSProjection::Accepted ) { + map_to_screen( pts, npoints ); + drawPoly( m_pts, npoints, edges, edgeAutoColor ); + } + else + if ( clip == QSProjection::Clipped ) { + map_to_screen( m_cpts2, m_ncpts2 ); + drawPoly( m_pts, m_ncpts2, m_cedges, edgeAutoColor ); + } + } else { + map_to_screen( pts, npoints ); + drawPoly( m_pts, npoints, edges, edgeAutoColor ); + } + } + +//-------------------------------------------------------------// + +void QSDrv::drawEllipse2( const QSPt2f& p1, const QSPt2f& p2 ) + { + if ( !m_clipping || (m_clipping && (m_t->clipPoint2(p1) || m_t->clipPoint2(p2))) ) + drawEllipse( m_t->world2DToCanvas(p1), m_t->world2DToCanvas(p2) ); + } + +//-------------------------------------------------------------// + +void QSDrv::drawText2( const QSPt2f &pos, const QString& text, int align ) + { + if ( !m_clipping || (m_clipping && m_t->clipPoint2(pos)) ) + drawText( m_t->world2DToCanvas(pos), text, align ); + } + +//-------------------------------------------------------------// + +void QSDrv::drawRText2( const QSPt2f &pos, int angle, const QString& text, int align ) + { + if ( !m_clipping || (m_clipping && m_t->clipPoint2(pos)) ) + drawRText( m_t->world2DToCanvas(pos), angle, text, align ); + } + +//-------------------------------------------------------------// + +void QSDrv::drawRTextBox2( const QSPt2f &pos, int angle, const QString& text, int align ) + { + if ( !m_clipping || (m_clipping && m_t->clipPoint2(pos)) ) + drawRTextBox( m_t->world2DToCanvas(pos), angle, text, align ); + } + +//-------------------------------------------------------------// + +void QSDrv::drawPoint2( const QSPt2f& pos, const QSGPoint& style ) + { + if ( !m_clipping || (m_clipping && m_t->clipPoint2(pos)) ) + drawPoint( m_t->world2DToCanvas(pos), style ); + } + +//-------------------------------------------------------------// + +void QSDrv::drawDart2( const QSPt2f& pos, double angle, const QSGArrow& style ) + { + drawDart( m_t->world2DToCanvas(pos), angle, style ); + } + +//-------------------------------------------------------------// + +void QSDrv::drawArrow2( const QSPt2f& pos1, const QSPt2f& pos2, const QSGArrow& p1style, const QSGArrow& p2style ) + { + if ( m_clipping ) { + QSPt2f p1 = pos1; + QSPt2f p2 = pos2; + QSGArrow s1 = p1style; + QSGArrow s2 = p2style; + if (m_t->clipLine2(&p1,&p2)) { + if ( p1 != pos1 ) s1.style = QSGArrow::None; + if ( p2 != pos2 ) s2.style = QSGArrow::None; + drawArrow( m_t->world2DToCanvas(p1), m_t->world2DToCanvas(p2), s1, s2 ); + } + } else { + drawArrow( m_t->world2DToCanvas(pos1), m_t->world2DToCanvas(pos2), p1style, p2style ); + } + } + +//-------------------------------------------------------------// + +void QSDrv::beginPolyline2( const QSPt2f& pos ) + { + m_curr_polyline_pos = pos; + beginPolyline( m_t->world2DToCanvas(pos) ); + } + +//-------------------------------------------------------------// + +void QSDrv::drawPolylineTo2( const QSPt2f& pos ) + { + if ( m_clipping ) { + QSPt2f p1 = m_curr_polyline_pos; + QSPt2f p2 = pos; + if (m_t->clipLine2(&p1,&p2)) { + + QSPt2f canvas_p1 = m_t->world2DToCanvas(p1); + QSPt2f canvas_p2 = m_t->world2DToCanvas(p2); + if (p1!=m_curr_polyline_pos) { + endPolyline(); + beginPolyline(canvas_p1); + } + + // leave a place for a label + QSPt2f label_p1 = canvas_p1; + QSPt2f label_p2 = canvas_p2; + QSProjection::ClipResult clip_result = m_t->clipLine( &label_p1, &label_p2, m_polyline_label_pos, m_polyline_label_size ); + // skip + if ( clip_result == QSProjection::Accepted ) { + endPolyline(); + beginPolyline( canvas_p2 ); + } + else + // draw normal line + if ( clip_result == QSProjection::Rejected ) { + drawPolylineTo( canvas_p2 ); + } + else + // draw clipped line + if ( clip_result == QSProjection::Clipped ) { + if ( canvas_p1 != label_p1 && + canvas_p2 != label_p2 ) { + drawPolylineTo( label_p1 ); + endPolyline(); beginPolyline( label_p2 ); + drawPolylineTo( canvas_p2 ); + } + else + if ( canvas_p1 != label_p1 ) { + drawPolylineTo( label_p1 ); + } + else + if ( canvas_p2 != label_p2 ) { + endPolyline(); beginPolyline( label_p2 ); + drawPolylineTo( canvas_p2 ); + } + } + + } + } else { + drawPolylineTo( m_t->world2DToCanvas(pos) ); + } + + m_curr_polyline_pos = pos; + } + +//-------------------------------------------------------------// + +void QSDrv::endPolyline2() + { + endPolyline(); + } + +//-------------------------------------------------------------// + +QSPt2f QSDrv::currPolylinePos2() + { + return m_curr_polyline_pos; + } + +//-------------------------------------------------------------// + +void QSDrv::setPolylineLabelPlace2( const QString& label, const QSPt2f& label_place, int angle ) + { + if ( !label.isEmpty() ) { + QSPt2f size = rTextSize( angle, label ); + m_polyline_label_size = size; + m_polyline_label_pos = m_t->world2DToCanvas( label_place ); + m_polyline_label_pos.x -= size.x/2.0; + m_polyline_label_pos.y -= size.y/2.0; + } else { + m_polyline_label_size = QSPt2f(); + } + } + +//-------------------------------------------------------------// + +QSProjection::ClipResult QSDrv::clip_poly( const QSPt2f *pts, int npoints, const bool edges[] ) + { + int clip_buff_size = npoints<<2; + if ( clip_buff_size > m_max_cpts2 ) { delete[] m_cpts2; m_max_cpts2 = clip_buff_size; m_cpts2 = new QSPt2f[m_max_cpts2]; } + if ( clip_buff_size > m_max_cedges ) { delete[] m_cedges; m_max_cedges = clip_buff_size; m_cedges = new bool[m_max_cedges]; } + + return m_t->clipPoly2( pts, npoints, m_cpts2, &m_ncpts2, m_max_cpts2, m_cedges, edges ); + } + +//-------------------------------------------------------------// + +QSProjection::ClipResult QSDrv::clip_poly( const QSPt3f *pts, int npoints, const bool edges[] ) + { + int clip_buff_size = npoints<<2; + if ( clip_buff_size > m_max_cpts3 ) { delete[] m_cpts3; m_max_cpts3 = clip_buff_size; m_cpts3 = new QSPt3f[m_max_cpts3]; } + if ( clip_buff_size > m_max_cedges ) { delete[] m_cedges; m_max_cedges = clip_buff_size; m_cedges = new bool[m_max_cedges]; } + + QSPt3f bbox[2]; m_t->getPoly3Cube( pts, npoints, bbox ); + return m_t->clipPoly3( pts, npoints, m_cpts3, &m_ncpts3, m_max_cpts3, bbox, m_cedges, edges ); + } + +//-------------------------------------------------------------// + +void QSDrv::map_to_screen( const QSPt2f *pts, int npoints ) + { + if ( npoints > m_max_pts ) { delete[] m_pts; m_max_pts = npoints; m_pts = new QSPt2f[m_max_pts]; } + for( int i=0; i<npoints; i++ ) m_pts[i] = m_t->world2DToCanvas( pts[i] ); + } + +//-------------------------------------------------------------// + +void QSDrv::map_to_screen( const QSPt3f *pts, int npoints ) + { + if ( npoints > m_max_pts ) { delete[] m_pts; m_max_pts = npoints; m_pts = new QSPt2f[m_max_pts]; } + for( int i=0; i<npoints; i++ ) m_pts[i] = m_t->world3DToCanvas( pts[i] ); + } + +//-------------------------------------------------------------// + +void QSDrv::copySettingsFrom( const QSDrv *drv ) + { + setProjection( drv->projection() ); + } + + + /** + * Converts points (1/72 inch) to pixels - "pixels = points*dpi/72". + * All fixed sizes must be converted by this function. + * There must not be fixed pixel-sizes ! + * ( all legend sizes, spaces, shadows shifts etc must have its fixed size in points ) + */ + //inline int toPixels( int points ) { return int(QSCoord::pointsToPixels(points,dpi)+0.5); } + + +/* + + //if ( cl != l ) setLine( cl ); + //if ( cf != f ) setFill( cf ); + + //if ( cf != f ) setFill( cf ); + //if ( cl != l ) setLine( cl ); + + + //if ( cl != l ) setLine( l ); + //if ( cf != f ) setFill( f ); + +// QSGFill cf = currentFill(); + */ diff --git a/kmatplot/widgets/qsdrv.h b/kmatplot/widgets/qsdrv.h new file mode 100644 index 0000000..5197cdd --- /dev/null +++ b/kmatplot/widgets/qsdrv.h @@ -0,0 +1,529 @@ +/*************************************************************************** + qsdrv.h + ------------------- + begin : 01-January-2000 + copyright : (C) 2000 by Kamil Dobkowski + email : kamildobk@poczta.onet.pl + ***************************************************************************/ + +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + + +#ifndef QSGDRIVER_H +#define QSGDRIVER_H + +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + +#include "qscoord.h" +#include "qsgattr.h" +#include "qsprojection.h" + +//------------------------------------------------------------------------------------------------// + +/** + * \brief Abstract graphics driver. + * + * Most functions need to be reimplemented. Font, point, arrow sizes are + * in points, so 'dpi' must be used to convert it to pixels, line width is an exception. Despite all + * coordinates are float, they are pixel coordinates. Function startDrawing() is used to initialize the graphics driver, + * and function stopDrawing() is called when drawing is finished. + */ +class QSCanvasDrv : public Qt + { + public: + + double dpi; + /** + * Converts points to pixels - "pixels = points*dpi/72.0". + */ + inline double toPixels( double points ) { return QSCoord::pointsToPixels(points,dpi); } + /** + * Converts pixels to points + */ + inline double toPoints( double pixels ) { return QSCoord::pixelsToPoints(pixels,dpi); } + /** + * Constructor + */ + QSCanvasDrv(); + /** + * Destructor + */ + virtual ~QSCanvasDrv(); + /** + * Returns a copy of this object. + */ + virtual QSCanvasDrv *copy() = 0; + /** + * This method is called to activate the graphics context + * when drawing starts. + */ + virtual void startDrawing(); + /** + * This function is called when drawing ends. + */ + virtual void stopDrawing(); + /** + * Draw a line. + */ + virtual void drawLine( const QSPt2f &one, const QSPt2f &two ) = 0; + /** + * Draw a rectangle. + */ + virtual void drawRect( const QSPt2f &p1, const QSPt2f &p2 ) = 0; + /** + * Draw a polygon defined by 'npoints' points in 'pts'. + * Can change the current line ( if edgeAuto color != 0 ) + */ + virtual void drawPoly( const QSPt2f pts[], int npoints, const bool edges[] = NULL, int edgesAutoColor = 0 ) = 0; + /** + * Draws a circle. + */ + virtual void drawEllipse( const QSPt2f& p1, const QSPt2f& p2 ) = 0; + /** + * Draw a text. + */ + virtual void drawText( const QSPt2f &pos, const QString& text, int align = AlignLeft | AlignBottom ) = 0; + /** + * Return the size of the text that will be printed by the corresponding + * @ref QSDrv::drawText function. + */ + virtual QSPt2f textSize( const QString& text ) = 0; + /** + * Draw a rotated text. This must be reimplemented. + */ + virtual void drawRText( const QSPt2f &pos, int angle, const QString& text, int align = AlignLeft | AlignBottom ) = 0; + /** + * Draw a rotated text. Aligns the bounding rectangle, not the bounding poly. No need to be reimplemented + */ + virtual void drawRTextBox( const QSPt2f &pos, int angle, const QString& text, int align = AlignLeft | AlignBottom ); + /** + * Return size of a rotated text. This must be reimplemented. + */ + virtual void getRTextBoundingPoly( QSPt2f outPts[4], const QSPt2f &pos, int angle, const QString& text, int align = AlignLeft | AlignBottom ) = 0; + /** + * Returns the size of a roated text. Default implementation is provided using 'getRTextBoundingPoly' + */ + virtual QSPt2f rTextSize( int angle, const QString& text ); + /** + * Draws a point. Because point contains its own color attr. it can change + * current fill and line settings + * It has a default implementation already. + */ + virtual void drawPoint( const QSPt2f& pos, const QSGPoint& style ); + /** + * Draws a line end. It can change current fill settings. + * It has a default implementation already. + */ + virtual void drawDart( const QSPt2f& pos, double angle, const QSGArrow& style ); + /** + * Draws an arrow. It can change current fill and line settings. + * It has a default implementation already. + */ + virtual void drawArrow( const QSPt2f& p1, const QSPt2f& p2, const QSGArrow& p1style, const QSGArrow& p2style ); + /** + * Set the current fill . + */ + virtual void setFill( const QSGFill &f ) = 0; + /** + * Set the current font. + */ + virtual void setFont( const QSGFont &f ) = 0; + /** + * Set the current line style. + */ + virtual void setLine( const QSGLine &l ) = 0; + /** + * This function should return the current font. + */ + virtual QSGFont currentFont() { return QSGFont(); } + /** + * This function should return the current fill. + */ + virtual QSGFill currentFill() { return QSGFill(); } + /** + * This function should return the current line. + */ + virtual QSGLine currentLine() { return QSGLine(); } + + //----------------------------------------------------------------------// + // 2D DRIVER + /** + * Starts to draw a polyline. + */ + virtual void beginPolyline( const QSPt2f& pos ) = 0; + /** + * Draw the next line segment. Wach out for setLine() call during drawPolyline2() + */ + virtual void drawPolylineTo( const QSPt2f& pos ) = 0; + /** + * Ends polyline. + */ + virtual void endPolyline() {} + /** + * Returns the current pen position. + */ + virtual QSPt2f currPolylinePos() { return QSPt2f(); } + /** + * Pixmap buffer for the 2d graphics driver. + */ + struct PixmapBuffer { + /** + * Pointer to the memory buffer, which will be filled with + * pixel values. Pixel at the position (x,y) has his position + * in memory calculated as below: + * char *ppos = ptr+y*lo+x*po + * or if it is RGB : + * char *rpos = ppos; + * char *gpos = rpos+co; + * char *bpos = gpos+co; + * Notice that all values: 'lo', 'po', 'co' may be lower + * than zero. Currently only RGB mode is supported. + */ + unsigned char *ptr; + /** + * Byte ofseet between two succesive lines in memory. + * ( scanline length in bytes ). + */ + int lo; + /** + * Byte offset between two succesive pixels in memory. + */ + int po; + /** + * Byte offset between two succesive channels (Red, Green, Blue) + */ + int co; + /** + * Buffer capacity in lines. It means that buffer length is + * at last: len=lines*lo. + */ + int lines; + }; + /** + * This method is always called before @ref QSDrv::drawPixmap. + * The struct 'PixmapBuffer' must be filled with correct values. + * Pixmap width is requested to be equal to 'pwidth', pixmap height + * must be lower or equal to pheight ( see field 'lines' in 'PixmapBuffer' ). + */ + virtual void getPixmapBuffer( PixmapBuffer *buff, int pwidth, int pheight ); + /** + * Draw a pixmap. Notice that the pixmap buffer will be always + * the last requested one.'getPixmapBuffer' / 'drawPixmap' pair + * is always called together. + */ + virtual void drawPixmap( const QSPt2f& pos, PixmapBuffer *data ); + }; + + +//------------------------------------------------------------------------------------------------// + +/** + * \brief Abstract extedned graphic driver. + * + * Abstract base class for graphics drivers with 3D functions and logical cordinates. It expects all coordinates to be + * world coordinates - it means that all values between 0.0 and 1.0 are inside + * an axis cube/box, while others are outside of it. Generally those functions + * don't need to be reimplemented. Default implementation simply maps all coordinates + * to the screen ( using providen projection object ) and calls functions from QSCanvasDrv. + * This driver should additionaly do clipping as provided by QSProjection object. + * @author Kamil Dobkowski + */ +class QSDrv : public QSCanvasDrv + { + public: + /** + * Normal mode. See @ref #drawPoly3 . + */ + enum CNormals { VertexNormals, MeshNormal, NoNormals }; + /** + * Color mode. See @ref #drawPoly3 . + */ + enum CColors { VertexColors, MeshColor }; + /** + * Ordering. See @ref #drawPoly3 . + */ + enum COrdering { FurtherFirst, NearerFirst, NoOrdering }; + /** + * Constructor. See also setProjection() + */ + QSDrv(); + /** + * Destructor + */ + virtual ~QSDrv(); + /** + * Returns a copy of this object. + */ + virtual QSDrv *copy() = 0; + /** + * Copies a pointer to a projection object + */ + void copySettingsFrom( const QSDrv *drv ); + /** + * Sets a projection object used by this driver. None method of this interface can be called + * if projection is not set. Projection is not owned by this object, it only holds a pointer. + */ + virtual void setProjection( const QSProjection *t ); + /** + * Returns a projection object used by this driver. + */ + const QSProjection *projection() const { return m_t; } + /** + * Reimplemented + */ + virtual void startDrawing(); + /** + * Reimplemented + */ + virtual void stopDrawing(); + /** + * Turns on clipping when drawing ( ..2(), *3() methods ). Must be called after startDrawing() + * Always clips polygons,lines,points using clipPoly2,clipLine2,clipPoint2,clipPoint3, clipPoly3. + */ + virtual void setClipping( bool enabled ); + /** + * Returns the current clipping setting. + */ + bool clipping() const { return m_clipping ; } + /** + * Sets a currently drawn element. It has no meaning for this objects - just a pair of ints. + * It is called by a graphic object, which uses this driver. + * It can be used for example in QSHitDrv to see what part of an object was exacly hit + * by mouse. It can be read, but further interpretation must be done in an other place. + * It is reset to -1, -1 in stopDrawing(). See QSAxes::ElementCategory + */ + virtual void setCurrentElement( int category, int element ); + /** + * Returns a currently drawn element See QSAxes::ElementCategory + */ + int currentElement() const { return m_element; } + /** + * Returns a category of the currently drawn element. See QSAxes::ElementCategory + */ + int currentCategory() const { return m_category; } + /** + * Turns on top/bottom detection for drawPoly3 + */ + virtual void setTopBottom( bool enabled ); + /** + * Is top/bottom detection turned on ? + */ + bool topBottom() const { return m_top_bottom; } + /** + * Sets a bottom fill + */ + virtual void setBottomFill( const QSGFill& fill ); + /** + * Returns the current bottom fill + */ + QSGFill bottomFill() const { return m_bottom_fill; } + /** + * Return a normals mode required by this driver. + */ + virtual CNormals cNormals() const { return MeshNormal; } + /** + * Returns a color mode required by this driver. + */ + virtual CColors cColors() const { return MeshColor; } + /** + * Returns an ordering required by this driver. + */ + virtual COrdering cOrdering() const { return FurtherFirst; } + + //----------------------------------------------------------------------// + // 2D DRIVER + /** + * Clear the canvas. + */ + virtual void clearCanvas( const QSGFill& f, const QSPt2f& pos, const QSPt2f& size ); + /** + * The same as QS + */ + virtual void drawLine2( const QSPt2f &one, const QSPt2f &two ); + /** + * Draw a rectangle. + */ + virtual void drawRect2( const QSPt2f &p1, const QSPt2f &p2 ); + /** + * Draw a polygon defined by 'npoints' points in 'pts'. + * Can change the current line ( if edgeAuto color != 0 ) + */ + virtual void drawPoly2( const QSPt2f pts[], int npoints, const bool edges[] = NULL, int edgeAutoColor = 0 ); + /** + * Draws a circle. + */ + virtual void drawEllipse2( const QSPt2f& p1, const QSPt2f& p2 ); + /** + * Draw a text. + */ + virtual void drawText2( const QSPt2f &pos, const QString& text, int align = AlignLeft | AlignBottom ); + /** + * Draw a rotated text. This must be reimplemented. + */ + virtual void drawRText2( const QSPt2f &pos, int angle, const QString& text, int align = AlignLeft | AlignBottom ); + /** + * Draw a rotated text. Aligns the bounding rectangle, not the bounding poly. No need to be reimplemented + */ + virtual void drawRTextBox2( const QSPt2f &pos, int angle, const QString& text, int align = AlignLeft | AlignBottom ); + /** + * Draws a point. Because point contains its own color attr. it can change + * current fill and line settings + * It has a default implementation already. + */ + virtual void drawPoint2( const QSPt2f& pos, const QSGPoint& style ); + /** + * Draws a line end. It can change current fill settings. + * It has a default implementation already. + */ + virtual void drawDart2( const QSPt2f& pos, double angle, const QSGArrow& style ); + /** + * Draws an arrow. It can change current fill and line settings. + * It has a default implementation already. + */ + virtual void drawArrow2( const QSPt2f& p1, const QSPt2f& p2, const QSGArrow& p1style, const QSGArrow& p2style ); + /** + * Starts to draw a polyline. + */ + virtual void beginPolyline2( const QSPt2f& pos ); + /** + * Ups ! a little hack. Leave place for the label in the current polyline + */ + virtual void setPolylineLabelPlace2( const QString& label, const QSPt2f& label_place, int label_angle ); + /** + * Draw the next line segment. + */ + virtual void drawPolylineTo2( const QSPt2f& pos ); + /** + * Ends polyline. + */ + virtual void endPolyline2(); + /** + * Returns the current pen position. + */ + virtual QSPt2f currPolylinePos2(); + + //----------------------------------------------------------------------// + // 3D DRIVER + + /** + * Draws a 3d polygon with 'npoints' vertices in 'pts' table. + * Each vertex has its color in 'colors' table. If 'VertexColors' + * is set, then color for each vertex is calculated separately, + * otherwise only colors[0] is set to the color of the whole polygon. + * Each vertex has its normal vector in 'norm', but the first position in + * this table is always occupied by a normal to the whole polygon. + * If 'MeshNormals' is set, the normal to the polygon, norm[0], is calculated. + * If 'VertexNormals' is set, a normal for each vertex is calculated separately + * but the normal to the polygon is also calculated and set as 'norm[0]'. + * If none of this two flags is set, contents of the table is undefined + * Default implementation maps 3d points on 2d plane and draws 2d polygon. + * Can change the current fill and the current line ( if edgeAuto color != 0 ) + */ + virtual void drawPoly3( const QSPt3f pts[], int npoints, + const QSPt3f *norm, const QSGFill *colors, + const bool edges[] = NULL, int edgeAutoColor = 0 ); + /** + * Draws a line. + * Default implementation maps 3d points on 2d plane and draws 2d line. + */ + virtual void drawLine3( const QSPt3f& begin, const QSPt3f& end, const QSPt3f norm[2] ); + /** + * Draws a text at the given position. + * Defaul implementation maps 3d point on 2d plane and draws text.. + */ + virtual void drawText3( const QSPt3f& pos, const QString& text, int align = AlignLeft | AlignBottom ); + /** + * Draw a point mark. + */ + virtual void drawPoint3( const QSPt3f& pos, const QSGPoint& point ); + + + protected: + + int m_element; + int m_category; + bool m_top_bottom; + QSGFill m_bottom_fill; + + const QSProjection *m_t; + bool m_clipping; + QSPt2f m_curr_polyline_pos; + + // clipped 2d coordinates + QSPt2f *m_cpts2; + int m_ncpts2; + int m_max_cpts2; + QSProjection::ClipResult clip_poly( const QSPt2f *pts, int npoints, const bool edges[] ); + + // clipped 3d coordinated + QSPt3f *m_cpts3; + int m_ncpts3; + int m_max_cpts3; + QSProjection::ClipResult clip_poly( const QSPt3f *pts, int npoints, const bool edges[] ); + + // buffer for screen coordinates + QSPt2f *m_pts; + int m_max_pts; + void map_to_screen( const QSPt2f *pts, int npoints ); + void map_to_screen( const QSPt3f *pts, int npoints ); + + // clipped edges + bool *m_cedges; + int m_max_cedges; + + QSPt2f m_polyline_label_pos; + QSPt2f m_polyline_label_size; + + }; + +#endif + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/kmatplot/widgets/qsdrvhittest.cpp b/kmatplot/widgets/qsdrvhittest.cpp new file mode 100644 index 0000000..547c143 --- /dev/null +++ b/kmatplot/widgets/qsdrvhittest.cpp @@ -0,0 +1,192 @@ +/*************************************************************************** + qsdrvhittest.cpp + ------------------- + begin : 01-January-2000 + copyright : (C) 2000 by Kamil Dobkowski + email : kamildobk@poczta.onet.pl + ***************************************************************************/ + +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + +#include"qsdrvhittest.h" +#include<assert.h> + + +// +// After each hit test the depth ( z-coordinate ) of hit point should be +// calculated ( maybe in QSProjection ). The final hit should be one with the +// smallest z-coordinate +// +//-------------------------------------------------------------// + +QSDrvHitTest::QSDrvHitTest( const QSPt2f& hitPosition, QObject *parent ) +:QObject(parent), QSDrvQt() + { + m_hit_pos = hitPosition; + m_hit_category = -1; + m_hit_element = -1; + m_is_hit = false; + } + +//-------------------------------------------------------------// + +QSDrvHitTest::~QSDrvHitTest() + { + if ( m_is_hit ) emit hitDetected( m_hit_category, m_hit_element ); + } + +//-------------------------------------------------------------/ + +/* +QSDrvHitTest *QSDrvHitTest::copy() + { + return dynamic_cast< QSDrvHitTest* >(privcopy()); + } +*/ +//-------------------------------------------------------------/ + +QSDrvQt *QSDrvHitTest::privcopy() const + { + QSDrvHitTest *result = new QSDrvHitTest( m_hit_pos ); + result->copySettingsFrom( this ); + return result; + } + +//-------------------------------------------------------------// + +void QSDrvHitTest::copySettingsFrom( const QSDrvHitTest *drv ) + { + QSDrvQt::copySettingsFrom( drv ); + } + +//-------------------------------------------------------------// + +void QSDrvHitTest::clearCanvas( const QSGFill&, const QSPt2f&, const QSPt2f& ) + { + } + +//-------------------------------------------------------------// + +void QSDrvHitTest::drawLine( const QSPt2f &begin, const QSPt2f &end ) + { + if ( m_curr_line.style != QSGLine::Invisible ) { + QSPt2f p1 = begin; + QSPt2f p2 = end; + if ( QSProjection::clipLine( &p1, &p2, QSPt2f(m_hit_pos.x-2.0,m_hit_pos.y-2.0), QSPt2f(4.0,4.0) ) ) hit(); + } + } + +//-------------------------------------------------------------// + +void QSDrvHitTest::drawEllipse( const QSPt2f& p1, const QSPt2f& p2 ) + { + drawRect( p1, p2 ); + } + +//-------------------------------------------------------------// + +void QSDrvHitTest::drawRect( const QSPt2f &p1, const QSPt2f &p2 ) + { + if ( m_curr_line.style != QSGLine::Invisible && + m_curr_fill.style != QSGFill::Transparent ) { + QSRectf r = QSRectf( p1, p2-p1 ).normalize(); + r.size.x += 1.0; + r.size.y += 1.0; + if ( r.contains(m_hit_pos) ) hit(); + } + } + +//-------------------------------------------------------------// + +void QSDrvHitTest::drawPoly( const QSPt2f p[], int npoints, const bool edges[], int edgeAutoColor ) + { + if ( m_curr_line.style != QSGLine::Invisible || + m_curr_fill.style != QSGFill::Transparent ) + if ( QSProjection::pointInPoly(m_hit_pos,p,npoints) ) hit(); + } + +//-------------------------------------------------------------// + +void QSDrvHitTest::drawText( const QSPt2f &pos, const QString& text, int align ) +// ups ! + { + drawRText( pos, 0, text, align ); + } + +//-------------------------------------------------------------// + +void QSDrvHitTest::drawRText( const QSPt2f &pos, int angle, const QString& text, int align ) + { + QSPt2f p[4]; + getRTextBoundingPoly( p, pos, angle, text, align ); + if ( QSProjection::pointInPoly(m_hit_pos,p,4) ) hit(); + } + +//-------------------------------------------------------------// + +void QSDrvHitTest::getPixmapBuffer( PixmapBuffer *buff, int pwidth, int pheight ) + { + QSDrvQt::getPixmapBuffer( buff, pwidth, pheight ); + m_curr_pixmap_width = pwidth; + } + +//-------------------------------------------------------------// + +void QSDrvHitTest::drawPixmap( const QSPt2f& pos, PixmapBuffer *buff ) + { + QSRectf r( pos.x, pos.y, m_curr_pixmap_width, buff->lines ); + if ( r.contains( m_hit_pos ) ) hit(); + } + +//-------------------------------------------------------------// + +void QSDrvHitTest::beginPolyline( const QSPt2f& pos ) + { + m_curr_polyline_pos = pos; + } + +//-------------------------------------------------------------// + +void QSDrvHitTest::drawPolylineTo( const QSPt2f& pos ) + { + drawLine( m_curr_polyline_pos, pos ); + m_curr_polyline_pos = pos; + } + +//-------------------------------------------------------------// + +void QSDrvHitTest::endPolyline() + { + } + +//-------------------------------------------------------------// + +void QSDrvHitTest::setFill( const QSGFill &f ) + { + m_curr_fill = f; + } + +//-------------------------------------------------------------// + +void QSDrvHitTest::setLine( const QSGLine &l ) + { + m_curr_line = l; + } + +//-------------------------------------------------------------// + +void QSDrvHitTest::hit() + { + m_is_hit = true; + m_hit_category = currentCategory(); + m_hit_element = currentElement(); + } + + diff --git a/kmatplot/widgets/qsdrvhittest.h b/kmatplot/widgets/qsdrvhittest.h new file mode 100644 index 0000000..e8875cc --- /dev/null +++ b/kmatplot/widgets/qsdrvhittest.h @@ -0,0 +1,159 @@ +/*************************************************************************** + qsdrvhittest.h + ------------------- + begin : 01-January-2000 + copyright : (C) 2000 by Kamil Dobkowski + email : kamildobk@poczta.onet.pl + ***************************************************************************/ + +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + +#ifndef QSDRVHITTEST_H +#define QSDRVHITTEST_H + +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + +#include<qobject.h> +#include"qsdrvqt.h" + +//-------------------------------------------------------------// + +/** + * \brief Implementation of QSDrv for testing which graph element is at the given position + * + * Hit testing driver. To find out if an object was hit you must repaint it with + * QSHitDrv and next check if isHit() flag is set. QSHitDrv also emits signal + * hitDetected when isHit() flag is set and QSHitDrv is being deleted - so you can + * also use it when drawing in background. To find out what element was drawn, when hit + * was detected call hitCategory() and hitElement(). + * @author Kamil Dobkowski + */ +class QSDrvHitTest : public QObject, public QSDrvQt + { + Q_OBJECT + + public: + QSDrvHitTest( const QSPt2f& hitPosition, QObject *parent = NULL ); + virtual ~QSDrvHitTest(); + virtual QSDrvHitTest *copy() const { return dynamic_cast< QSDrvHitTest* >(privcopy()); } + void copySettingsFrom( const QSDrvHitTest *drv ); + bool isHit() const { return m_is_hit; } + int hitCategory() const { return m_category; } + int hitElement() const { return m_element; } + QSPt2f hitPosition() const { return m_hit_pos; } + virtual void clearCanvas( const QSGFill& f, const QSPt2f& pos, const QSPt2f& size ); + virtual void drawLine( const QSPt2f &one, const QSPt2f &two ); + virtual void beginPolyline( const QSPt2f& pos ); + virtual void drawPolylineTo( const QSPt2f& pos ); + virtual void endPolyline(); + virtual QSPt2f currPolylinePos() { return m_curr_polyline_pos; } + virtual void drawRect( const QSPt2f &p1, const QSPt2f &p2 ); + virtual void drawPoly( const QSPt2f pts[], int npoints, const bool edges[] = NULL, int edgeAutoColor = 0 ); + virtual void drawEllipse( const QSPt2f& p1, const QSPt2f& p2 ); + virtual void drawText( const QSPt2f &pos, const QString& text, int align = AlignLeft | AlignBottom ); + virtual void drawRText( const QSPt2f &pos, int angle, const QString& text, int align = AlignLeft | AlignBottom ); + virtual void getPixmapBuffer( PixmapBuffer *buff, int pwidth, int pheight ); + virtual void drawPixmap( const QSPt2f& pos, PixmapBuffer *data ); + virtual void setFill( const QSGFill &f ); + virtual void setLine( const QSGLine &l ); + signals: + void hitDetected( int hitCategory, int hitElement ); + protected: + QSPt2f m_hit_pos; + bool m_is_hit; + int m_hit_category; + int m_hit_element; + int m_curr_pixmap_width; + QSGFill m_curr_fill; + QSGLine m_curr_line; + void hit(); + private: + QSDrvQt *privcopy() const; + }; + + +#endif + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/kmatplot/widgets/qsdrvopengl.cpp b/kmatplot/widgets/qsdrvopengl.cpp new file mode 100644 index 0000000..b0767e2 --- /dev/null +++ b/kmatplot/widgets/qsdrvopengl.cpp @@ -0,0 +1,739 @@ +/*************************************************************************** + qsdrvopengl.cpp + ------------------- + begin : 01-January-2000 + copyright : (C) 2000 by Kamil Dobkowski + email : kamildobk@poczta.onet.pl + ***************************************************************************/ + +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + + +#include "qsdrvopengl.h" + +#ifdef HAVE_GL +#include "qsconsole.h" +#include "qsaxes3d.h" +#include <qapplication.h> +#include <qpainter.h> +#include <qpixmap.h> +#include <qbitmap.h> +#include <qpicture.h> +#include <qpen.h> +#include <assert.h> +#include <math.h> + +/** + * What a mess ! + */ + +//-------------------------------------------------------------// + +QSDrvOpenGL::QSDrvOpenGL() +:QSDrvQt() + { + m_alpha = false; + dpaint = false; + m_shade_walls = true; + m_auto_stroke = true; + m_global_transparency = 0; + m_stroke_lightness = -45; + pasize = 0; + pix = NULL; + pic = NULL; + pgl = NULL; + ppic = NULL; + points = NULL; + m_opaint = NULL; + } + +//-------------------------------------------------------------// + +QSDrvOpenGL::~QSDrvOpenGL() + { + //cout << " open gl destructor " << endl; + } + +//-------------------------------------------------------------// + +QSDrvOpenGL *QSDrvOpenGL::copy() + { + QSDrvOpenGL *result = new QSDrvOpenGL(); + result->copySettingsFrom( this ); + return result; + } + +//-------------------------------------------------------------// + +void QSDrvOpenGL::copySettingsFrom( const QSDrvOpenGL *drv ) + { + QSDrvQt::copySettingsFrom( drv ); + setAlpha( drv->alpha() ); + setShadeWalls( drv->shadeWalls() ); + setGlobalTransparency( drv->globalTransparency() ); + setMeshAutoStroke( drv->meshAutoStroke() ); + setAutoStrokeLightness( drv->meshAutoStrokeLightness() ); + init( drv->parentAxes() ); + } + +//-------------------------------------------------------------// + +QSDrvOpenGL::CNormals QSDrvOpenGL::cNormals() const + { + return VertexNormals; + } + +//-------------------------------------------------------------// + +QSDrvOpenGL::CColors QSDrvOpenGL::cColors() const + { + return VertexColors; + } + +//-------------------------------------------------------------// + +QSDrvOpenGL::COrdering QSDrvOpenGL::cOrdering() const +// Nearer first not working good with light enabled because +// further polygons overwrites closer ones ( depth function is LEQUAL ) + { + return m_alpha || m_axes3->light() ? FurtherFirst : NearerFirst; + } + +//-------------------------------------------------------------// + +void QSDrvOpenGL::setAlpha( bool enabled ) + { + m_alpha = enabled; + } + +//-------------------------------------------------------------// + +void QSDrvOpenGL::setShadeWalls( bool enabled ) + { + m_shade_walls = enabled; + } + +//-------------------------------------------------------------// + +void QSDrvOpenGL::setGlobalTransparency( unsigned char value ) + { + m_global_transparency = value; + } + +//-------------------------------------------------------------// + +void QSDrvOpenGL::setMeshAutoStroke( bool enabled ) + { + m_auto_stroke = enabled; + } + +//-------------------------------------------------------------// + +void QSDrvOpenGL::setAutoStrokeLightness( int value ) + { + m_stroke_lightness = value; + } + +//-------------------------------------------------------------// + +void QSDrvOpenGL::glError() + { + int error; + while ( (error=glGetError()) ) { + switch( error ) { + case GL_INVALID_ENUM: QSConsole::write("Open GL Error: GL_INVALID_ENUM"); break; + case GL_INVALID_VALUE: QSConsole::write("Open GL Error: GL_INVALID_VALUE"); break; + case GL_INVALID_OPERATION: QSConsole::write("Open GL Error: GL_INVALID_OPERATION"); break; + case GL_STACK_OVERFLOW: QSConsole::write("Open GL Error: GL_STACK_OVERFLOW"); break; + case GL_STACK_UNDERFLOW: QSConsole::write("Open GL Error: GL_STACK_UNDERFLOW"); break; + case GL_OUT_OF_MEMORY: QSConsole::write("Open GL Error: GL_OUT_OF_MEMORY"); break; + default: QSConsole::write("Open GL Error: UNKNOWN"); break; + } + } + } + +//-------------------------------------------------------------// + +void QSDrvOpenGL::loadMatrix( const double m[4][4] ) + { + GLdouble M[16]; + for ( int i=0; i<16; i++ ) M[i] = GLdouble( m[i%4][i/4] ); + glLoadMatrixd( M ); + } + +//-------------------------------------------------------------// + +void QSDrvOpenGL::setDC( QPainter *p, double init_dpi, bool delete_painter ) + { + QSDrvQt::setDC(p,init_dpi,delete_painter); + } + +//-------------------------------------------------------------// + +#define MARG 5 + +void QSDrvOpenGL::init( QSAxes3D *parent ) + { + m_axes3 = parent; + t = m_axes3->p3D(); + + // + // Create context + // + // pdev - is a paint device on which we draw all stuff + // OpenGL doesn't support printing so when the external + // paint device is used pdev is a pixmap, which is next + // flushed to the external device. + // paint - is an additional painter for drawing text etc. + // + QPaintDevice *gl_dev; + + m_opaint = m_paint; + if ( m_opaint->device()->isExtDev() ) { + //cout << "KMatplot: Creating oixmap, picture and painter " << endl; + pix = new QPixmap( toInt(m_axes3->canvasRect().size.x), + toInt(m_axes3->canvasRect().size.y) ); + gl_dev = pix; + pic = new QPicture(); + ppic = new QPainter( pic ); + m_paint = ppic; + } else { + m_paint = m_opaint; + gl_dev = m_opaint->device(); + } + + // + // Context's format. + // + QGLFormat f; + f.setDoubleBuffer( false ); + + // + // + // Only if device is an external device ????????????????????????????????????????????????????????????? + // + //f.setDirectRendering( FALSE ); + + pgl = new QGLContext( f, gl_dev ); + pgl->create(); + pgl->makeCurrent(); + + //cout << "KMatplot: Checking viewport size. " << endl; + GLint maxSize[2]; glGetIntegerv( GL_MAX_VIEWPORT_DIMS, maxSize ); + if ( m_axes3->canvasRect().size.x > maxSize[0] || + m_axes3->canvasRect().size.y > maxSize[1] ) { + //cout << "KMatplot: Resizing pixmap. " << endl; + QSConsole::write( QObject::tr( + "OpenGL: Trying to set %1, %2 viewport ( probably during printing ). <br>" + "OpenGL: This OpenGL implementation supports only %3, %4 viewports !<br>") + .arg(toInt(m_axes3->canvasRect().size.x)) + .arg(toInt(m_axes3->canvasRect().size.y)) + .arg(maxSize[0]) + .arg(maxSize[1]) + ); + if ( pix ) { + delete pgl; + pix->resize( maxSize[0], maxSize[1] ); + pgl = new QGLContext( f, pix ); + pgl->create(); + pgl->makeCurrent(); + } + //cout << "KMatplot: Resizing done. " << endl; + } + + if ( pix ) { + //cout << "KMatplot: Clear pixmap. " << endl; + QPainter p( pix ); + p.fillRect( pix->rect(), white ); + } + + } + +//-------------------------------------------------------------// + +void QSDrvOpenGL::stopDrawing() + { + //cout << "KMatplot: Finishing. " << endl; + + // finish with GL + if ( pgl ) { + pgl->makeCurrent(); + glFlush(); + glDeleteLists( plist, 1 ); + } + + //cout << "KMatplot: Deleted gl lists. " << endl; + + // finish with QPicture + if ( ppic ) ppic->end(); + + //cout << "KMatplot: QPicture ended. " << endl; + + // draw pixmap on painter + if ( pix ) { + if ( pix->width() != m_axes3->canvasRect().size.x || + pix->height() != m_axes3->canvasRect().size.y ) { + //cout << "KMatplot: Drawing pixmap.init " << endl; + double scalex = m_axes3->canvasRect().size.x/pix->width(); + double scaley = m_axes3->canvasRect().size.y/pix->height(); + bool xform = m_opaint->hasWorldXForm(); + m_opaint->setWorldXForm( TRUE ); + m_opaint->saveWorldMatrix(); + m_opaint->scale( scalex, scaley ); + + // Not working when printing + //pix->setMask( pix->createHeuristicMask() ); + //cout << "KMatplot: Drawing scaled pixmap. " << endl; + m_opaint->drawPixmap( (int )floor( 0.5 + 1.0/scalex * m_axes3->canvasRect().pos.x ), + (int )floor( 0.5 + 1.0/scaley * m_axes3->canvasRect().pos.y ), + *pix ); + m_opaint->restoreWorldMatrix(); + m_opaint->setWorldXForm( xform ); + //cout << "KMatplot: Drawing scaled pixmap.done." << endl; + } else { + //cout << "KMatplot: Drawing pixmap. " << endl; + m_opaint->drawPixmap( toInt(m_axes3->canvasRect().pos.x), + toInt(m_axes3->canvasRect().pos.y), + *pix ); + } + } + + //cout << "KMatplot: Flushing QPicture!. " << endl; + + // draw QPicture on painter + if ( pic ) m_opaint->drawPicture( *pic ); + + //restore oryginal painter + m_paint = m_opaint; + + //cout << "KMatplot: Deleting objects !. " << endl; + + m_opaint = NULL; + delete ppic; ppic = NULL; + delete pgl; pgl = NULL; + delete pix; pix = NULL; + delete pic; pic = NULL; + delete points; points = NULL; + pasize = 0; + + + QSDrvQt::stopDrawing(); + //cout << "KMatplot: Drawing Finished !. \n\n\n" << endl; + } + +//-------------------------------------------------------------// + +void QSDrvOpenGL::setCurrentElement( int category, int element ) + { + if ( category == QSAxes::DatasetCategory && element == 0 ) { + // Clear the buffer after axis box is drawn, but before the first + // dataset is drawn.Depth test with the axis box is not needed because + // all datasets are clipped already to the axis box + glClear( GL_DEPTH_BUFFER_BIT ); + glDisable( GL_CULL_FACE ); + //cout << " clearing a depth buffer bit " << endl; + } + QSDrvQt::setCurrentElement( category, element ); + } + +//-------------------------------------------------------------// + +void QSDrvOpenGL::startDrawing() + { + //cout << "KMatplot: Start drawing " << endl; + QSDrvQt::startDrawing(); + + // + // Activate context + // + pgl->makeCurrent(); + axis_mode = m_axes3->axesOnly(); + //if ( stage > 0 ) trv = m_global_transparency; else trv = 0; + trv = m_global_transparency; + + // + // Dont mess the plot with the axis box. + // + glClear( GL_DEPTH_BUFFER_BIT ); + + // + // Apply modelview matrix. + // + double MS[4][4]; + glMatrixMode( GL_MODELVIEW ); + t->copy( MS, t->M ); + loadMatrix( MS ); + glError(); + + // + // Apply projection matrix. + // + double PS[4][4]; + glMatrixMode( GL_PROJECTION ); + t->copy( PS, t->P ); + loadMatrix( PS ); + glError(); + + // + // now our plot is drawn in ( -1.0, -1.0, 0.0 ) ( 1.0, 1.0, 1.0 ) box + // an we must rescale its x,y sizes to the viewport, but unfortunately + // the viewpor is given so, that (0,0) is at the top-left corner, and + // OpenGL accepts coordinates starting at the bottom-left corner. + // + + + // + // Apply viewport matrix. + // + double x; + double y; + double w; + double h; + + // the same as canvas size and pos. + t->getViewport( &x, + &y, + &w, + &h, + NULL, + NULL ); + + glError(); + // -1 because of pixmap printing + if ( pix ) + glViewport( GLint(0), + GLint(0), + GLsizei(pix->width()-1), + GLsizei(pix->height()-1) ); + else + glViewport( GLint(x), + GLint(m_paint->viewport().height()-h-y), + GLsizei(w-1), + GLsizei(h-1) ); + + glError(); + + // + // + // + glEnable(GL_POLYGON_OFFSET_FILL); + glPolygonOffset(1.0, 1.0); + glEnable( GL_DEPTH_TEST ); + glDepthFunc( GL_LESS ); + glShadeModel(GL_SMOOTH); + + if ( t->light() ) { + GLfloat params[4]; + QSGColor color; + + if ( !m_shade_walls ) { + glDisable( GL_LIGHTING ); + glDisable( GL_COLOR_MATERIAL ); + } else { + glEnable(GL_LIGHTING); + glError(); + glEnable( GL_COLOR_MATERIAL ); + glError(); + } + + // + // light settings + // + //glLightModeli(GL_LIGHT_MODEL_LOCAL_VIEWER, 1); + glFrontFace( GL_CW ); + glEnable( GL_CULL_FACE ); + //glEnable( GL_NORMALIZE ); + glLightModeli( GL_LIGHT_MODEL_TWO_SIDE, 1 ); + + // + // lightness ( ambient light ) + // + glEnable(GL_LIGHT0); + // This simply looks good, no special theory. + params[0] = params[1] = params[2] = 0.35 + + (t->ambientLight()+50.0)/64.0 - + (t->directedLight()+50.0)/64.0; + params[3] = 1.0; + glLightModelfv( GL_LIGHT_MODEL_AMBIENT, params ); + glError(); + + // + // light intensity ( directional light ) + // + GLfloat ldir[4]; + ldir[0] = (GLfloat )t->lvector.x; + ldir[1] = (GLfloat )t->lvector.y; + ldir[2] = (GLfloat )t->lvector.z; + ldir[3] = (GLfloat )0.0; + glLightfv(GL_LIGHT0, GL_POSITION, ldir ); + //cout <<" LIGHT VECTOR " << t->lvector.x << "," << t->lvector.y << ","<<t->lvector.z<<endl; + glError(); + + GLfloat lint[4]; + lint[0] = lint[1] = lint[2] = (t->directedLight()+50.0)/48.0; + lint[3] = 1.0; + glLightfv(GL_LIGHT0, GL_DIFFUSE, lint ); + glError(); + glLightfv(GL_LIGHT0, GL_SPECULAR, lint ); + glError(); + + //glLightfv(GL_LIGHT0, GL_AMBIENT, lint ); + //glLightf(GL_LIGHT0, GL_SPOT_CUTOFF, 80.0 ); + + // + // top + // + glColorMaterial( GL_FRONT, GL_AMBIENT_AND_DIFFUSE ); + + // + // bottom + // + color = m_bottom_fill.color; + params[0] = color.r/255.0; + params[1] = color.g/255.0; + params[2] = color.b/255.0; + params[3] = (color.a-trv)/255.0; + glMaterialfv( GL_BACK, GL_AMBIENT_AND_DIFFUSE, params ); + glError(); + + } else { + + glDisable( GL_LIGHTING ); + glDisable( GL_COLOR_MATERIAL ); + + } + + if ( m_alpha ) { + glEnable(GL_BLEND); + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + } + + + // only one time + //if ( stage == 0 ) + plist = glGenLists(1); + + glError(); + //cout << "KMatplot: start drawing done. " << endl; + } + +//-------------------------------------------------------------// + +void QSDrvOpenGL::setClipping( bool enabled ) + { + QSDrvQt::setClipping( enabled ); + if ( enabled ) { + // x y z w >= 0 + double cp1[4] = { 0.0, 0.0, 1.0, 0.0 }; // z >= 0 + double cp2[4] = { 0.0, 0.0, -1.0, 1.0 }; // z <= 1 + double cp3[4] = { 1.0, 0.0, 0.0, 0.0 }; // x >= 0 + double cp4[4] = { -1.0, 0.0, 0.0, 1.0 }; // x <= 1 + double cp5[4] = { 0.0, 1.0, 0.0, 0.0 }; // y >= 0 + double cp6[4] = { 0.0, -1.0, 0.0, 1.0 }; // y <= 1 + glClipPlane( GL_CLIP_PLANE0, cp1 ); + glClipPlane( GL_CLIP_PLANE1, cp2 ); + glClipPlane( GL_CLIP_PLANE2, cp3 ); + glClipPlane( GL_CLIP_PLANE3, cp4 ); + glClipPlane( GL_CLIP_PLANE4, cp5 ); + glClipPlane( GL_CLIP_PLANE5, cp6 ); + glEnable( GL_CLIP_PLANE0 ); + glEnable( GL_CLIP_PLANE1 ); + glEnable( GL_CLIP_PLANE2 ); + glEnable( GL_CLIP_PLANE3 ); + glEnable( GL_CLIP_PLANE4 ); + glEnable( GL_CLIP_PLANE5 ); + } else { + glDisable( GL_CLIP_PLANE0 ); + glDisable( GL_CLIP_PLANE1 ); + glDisable( GL_CLIP_PLANE2 ); + glDisable( GL_CLIP_PLANE3 ); + glDisable( GL_CLIP_PLANE4 ); + glDisable( GL_CLIP_PLANE5 ); + } + } + +//-------------------------------------------------------------// + +void QSDrvOpenGL::clearCanvas( const QSGFill& f, const QSPt2&, const QSPt2& ) + { + pgl->makeCurrent(); + glClear( GL_DEPTH_BUFFER_BIT ); + if ( f.style != QSGFill::Transparent ) { + glClearColor( f.color.r / 255.0, + f.color.g / 255.0, + f.color.b / 255.0, + f.color.a / 255.0 ); + + glClear( GL_COLOR_BUFFER_BIT ); + } + + lcolor[0] = GLubyte(0); + lcolor[1] = GLubyte(0); + lcolor[2] = GLubyte(0); + lcolor[3] = GLubyte(0); + } + +//-------------------------------------------------------------// + +#define EPS 1e-15 + +void QSDrvOpenGL::drawPoly3( const QSPt3f pts[], int npoints, + const QSPt3f *normals, const QSGFill *colors, const bool *edges, int edgeAutoColor ) + { + int i; + pgl->makeCurrent(); + + if ( !axis_mode && colors[0].style != QSGFill::Transparent ) { + + glPolygonMode( GL_FRONT_AND_BACK, GL_FILL ); + glBegin( GL_POLYGON ); + + for ( i=0; i<npoints; i++ ) { + + glColor4ub( colors[i].color.r, + colors[i].color.g, + colors[i].color.b, + (GLubyte )max(int(colors[i].color.a)-trv,0)); + + glNormal3d( normals[i+1].x, + normals[i+1].y, + normals[i+1].z ); + + if ( i == 0 || + fabs(pts[i].x-pts[i-1].x) > EPS || + fabs(pts[i].y-pts[i-1].y) > EPS || + fabs(pts[i].z-pts[i-1].z) > EPS ) + glVertex3d( pts[i].x, pts[i].y, pts[i].z ); + } + + glEnd(); + } + + if ( lcolor[3] ) { + glPolygonMode( GL_FRONT_AND_BACK, GL_LINE ); + glBegin( GL_POLYGON ); + if ( !m_auto_stroke ) glColor4ubv( lcolor ); + for ( i=0; i<npoints; i++ ) { + + + if ( m_auto_stroke ) { + int r = colors[i].color.r+m_stroke_lightness; + int g = colors[i].color.g+m_stroke_lightness; + int b = colors[i].color.b+m_stroke_lightness; + + if ( m_stroke_lightness > 0 ) { + r = min(r,255); + g = min(g,255); + b = min(b,255); + } + else + if ( m_stroke_lightness < 0 ) { + r = max(r,0); + g = max(g,0); + b = max(b,0); + } + + glColor4ub( (GLubyte )r, (GLubyte )g, (GLubyte )b, colors[i].color.a ); + } + + glNormal3d( normals[i+1].x, + normals[i+1].y, + normals[i+1].z ); + if ( i == 0 || + fabs(pts[i].x-pts[i-1].x) > EPS || + fabs(pts[i].y-pts[i-1].y) > EPS || + fabs(pts[i].z-pts[i-1].z) > EPS ) + glVertex3d( pts[i].x, pts[i].y, pts[i].z ); + } + + glEnd(); + } + } + +//-------------------------------------------------------------// + +void QSDrvOpenGL::drawLine3( const QSPt3f& begin, const QSPt3f& end, const QSPt3f norm[2] ) + { + if ( lcolor[3] ) { + pgl->makeCurrent(); + glBegin( GL_LINES ); + glColor4ubv( lcolor ); + + // first + if ( norm ) + glNormal3d( norm[0].x, + norm[0].y, + norm[0].z ); + glVertex3d( begin.x, begin.y, begin.z ); + + // end + if ( norm ) + glNormal3d( norm[1].x, + norm[1].y, + norm[1].z ); + + glVertex3d( end.x, end.y, end.z ); + //cout << " GL line from "<<begin.x<<","<<begin.y<<","<<begin.z<<" - "<<end.x<<","<<end.y<<","<<end.z<<endl; + glEnd(); + } + } + + + +//-------------------------------------------------------------// + +void QSDrvOpenGL::setFill( const QSGFill &f ) +// Obsolete. All fill setting is done in drawPoly3() + { + glColor4ub( f.color.r, + f.color.g, + f.color.b, + f.color.a ); + + // if stage = 2 + QSDrvQt::setFill( f ); + } + +//-------------------------------------------------------------// + +void QSDrvOpenGL::setLine( const QSGLine &l ) + { + glLineWidth( l.width?toPixels(l.width):0.1 ); + lcolor[0] = GLubyte(l.color.r); + lcolor[1] = GLubyte(l.color.g); + lcolor[2] = GLubyte(l.color.b); + lcolor[3] = ( l.style == QSGLine::Invisible ? 0 : GLubyte(l.color.a) ); + // if stage == 2 + QSDrvQt::setLine( l ); + } + + + //-------------------------------------------------------------// + +#endif // HAVE_GL + + //glEnable( GL_LINE_SMOOTH ); + //glShadeModel( GL_FLAT ); + //glEnable( GL_LINE_SMOOTH ); + //glEnable( GL_LINE_SMOOTH ); + //glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + //glHint (GL_LINE_SMOOTH_HINT, GL_DONT_CARE); + + //glPolygonMode( GL_FRONT_AND_BACK, GL_FILL ); + //glLineWidth( 0.5 ) ; +/* + if ( stage == 0 && !m_shade_walls ) { + glDisable( GL_LIGHTING ); + glDisable( GL_COLOR_MATERIAL ); + } else { + glEnable(GL_LIGHTING); + glEnable( GL_COLOR_MATERIAL ); + } +*/ \ No newline at end of file diff --git a/kmatplot/widgets/qsdrvopengl.h b/kmatplot/widgets/qsdrvopengl.h new file mode 100644 index 0000000..107832c --- /dev/null +++ b/kmatplot/widgets/qsdrvopengl.h @@ -0,0 +1,181 @@ +/*************************************************************************** + qsdrvopengl.h + ------------------- + begin : 01-January-2000 + copyright : (C) 2000 by Kamil Dobkowski + email : kamildobk@poczta.onet.pl + ***************************************************************************/ + +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + + +#ifndef QSDRVOPENGL_H +#define QSDRVOPENGL_H + +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + +#ifdef HAVE_GL + +#include "qsdrvqt.h" +#include <qgl.h> + +class QPainter; +class QPixmap; +class QPicture; +class QSAxes3D; +class QSProjection3D; + +/** + * \brief OpenGL 3d graphics driver. + * + * Notice that it is suppesed to use only with QSAxes3D.and it uses Qt for drawing 2D, text etc. + * @author Kamil Dobkowski + */ +class QSDrvOpenGL : public QSDrvQt + { + public: + /** + * Constructor. + */ + QSDrvOpenGL(); + /** + * Destructor. + */ + virtual ~QSDrvOpenGL(); + /** + * Returns new copy of this driver with all settings set. + */ + virtual QSDrvOpenGL *copy(); + /** + * Copies all settings from another driver + */ + void copySettingsFrom( const QSDrvOpenGL *drv ); + /** + * Enable/disable alpha. + */ + void setAlpha( bool enabled ); + /** + * Shade walls + */ + void setShadeWalls( bool enabled ); + /** + * Global transparency + */ + void setGlobalTransparency( unsigned char value ); + /** + * Mesh stoke auto-colors + */ + void setMeshAutoStroke( bool enabled ); + /** + * How mush mesh stroke is lighter than a mesh fill + */ + void setAutoStrokeLightness( int value ); + /** + * Returns alpha setting. + */ + bool alpha() const { return m_alpha; } + /** + * Returns shade walls setting + */ + bool shadeWalls() const { return m_shade_walls; } + /** + * Returns global transparency + */ + int globalTransparency() const { return m_global_transparency; } + /** + * Returns if mesh auto stroke colors is enabled + */ + bool meshAutoStroke() const { return m_auto_stroke; } + /** + * Returns how much auto stroke is lighter than mesh fill color. + */ + int meshAutoStrokeLightness() const { return m_stroke_lightness; } + /** + * Prepare driver + */ + void init( QSAxes3D *parent ); + /** + * Returns parent axes + */ + QSAxes3D *parentAxes() const { return m_axes3; } + virtual void setClipping( bool enabled ); + virtual void setCurrentElement( int category, int element ); + virtual CNormals cNormals() const; + virtual CColors cColors() const; + virtual COrdering cOrdering() const; + /** + * Sets a painter for this driver. If deletePainter is true, painter + * will be deleted in destructor. If p->device() isn't an external one, + * no world or view transformation of the painter are used. + */ + virtual void setDC( QPainter *p, double dpi = 72, bool deletePainter = false ); + virtual void startDrawing(); + virtual void stopDrawing(); + + virtual void clearCanvas( const QSGFill& f, const QSPt2& pos, const QSPt2& size ); + virtual void drawPoly3( const QSPt3f pts[], int npoints, + const QSPt3f *nor, const QSGFill *col, const bool *edges = NULL, int edgeAutoColor = 0 ); + virtual void drawLine3( const QSPt3f& begin, const QSPt3f& end, const QSPt3f norm[2] ); + virtual void setFill( const QSGFill &f ); + virtual void setLine( const QSGLine &l ); + + protected: + QSAxes3D *m_axes3; + QPainter *m_opaint; + QGLContext *pgl; + QPainter *ppic; + QPixmap *pix; + QPicture *pic; + QPointArray *points; + + GLuint plist; + GLubyte color[4]; + GLubyte lcolor[4]; + + bool axis_mode; + bool m_alpha; + bool m_shade_walls; + bool m_auto_stroke; + bool dpaint; + int m_global_transparency; + int trv; + int m_stroke_lightness; + int pasize; + + const QSProjection3D *t; + void loadMatrix( const double m[4][4] ); + void get_qpainter_wmatrix( const QPainter *p, double m[4][4] ); + void glError(); + }; + +#endif // HAVE_GL +#endif + + + + + + + + + + + + + + + + + + + + diff --git a/kmatplot/widgets/qsdrvqt.cpp b/kmatplot/widgets/qsdrvqt.cpp new file mode 100644 index 0000000..26ad914 --- /dev/null +++ b/kmatplot/widgets/qsdrvqt.cpp @@ -0,0 +1,595 @@ +/*************************************************************************** + qsdrvqt.cpp + ------------------- + begin : 01-January-2000 + copyright : (C) 2000 by Kamil Dobkowski + email : kamildobk@poczta.onet.pl + ***************************************************************************/ + +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + +#include"qsdrvqt.h" +#include<assert.h> +#include<math.h> +#include<qfont.h> +#include<qimage.h> +#include<qwidget.h> +#include<qpaintdevice.h> +#include <qsimplerichtext.h> + +#include<iostream.h> + +//-------------------------------------------------------------// + +QSDrvQt::QSDrvQt() +:QSDrv() + { + dpi = 72; + m_delete_painter = false; + m_paint = NULL; + + m_pixmap = NULL; + m_cfill.style = QSGFill::Transparent; + } + +//-------------------------------------------------------------// + +QSDrvQt::~QSDrvQt() + { + if ( m_delete_painter ) delete m_paint; + delete m_pixmap; + } + +//-------------------------------------------------------------// + +void QSDrvQt::setDC( QPainter *p, double new_dpi, bool delete_painter ) + { + assert( p ); + + if ( m_delete_painter ) delete m_paint; + + m_paint = p; + dpi = new_dpi; + m_delete_painter = delete_painter; + m_paint->moveTo( 0, 0 ); + } + +//-------------------------------------------------------------// + +void QSDrvQt::startDrawing() + { + QSDrv::startDrawing(); + } + +//-------------------------------------------------------------// + +void QSDrvQt::stopDrawing() + { + QSDrv::stopDrawing(); + delete m_pixmap; + m_pixmap = NULL; + } + +//-------------------------------------------------------------// + +void QSDrvQt::clearCanvas( const QSGFill& f, const QSPt2f& pos, const QSPt2f& size ) + { + m_paint->fillRect( toInt(pos.x), toInt(pos.y), toInt(size.x), toInt(size.y), toQBrush(f) ); + } + +//-------------------------------------------------------------// + +void QSDrvQt::drawLine( const QSPt2f &begin, const QSPt2f &end ) + { + m_paint->drawLine( toInt(begin.x), toInt(begin.y), toInt(end.x), toInt(end.y) ); + } + +//-------------------------------------------------------------// + +void QSDrvQt::drawEllipse( const QSPt2f& p1, const QSPt2f& p2 ) + { + m_paint->drawEllipse( toInt(p1.x), toInt(p1.y), toInt(p2.x-p1.x+1), toInt(p2.y-p1.y+1) ); + } + + +//-------------------------------------------------------------// + +void QSDrvQt::drawRect( const QSPt2f &p1, const QSPt2f &p2 ) + { + m_paint->drawRect( toInt(p1.x), toInt(p1.y), toInt(p2.x-p1.x+1), toInt(p2.y-p1.y+1) ); + } + +//-------------------------------------------------------------// + +void QSDrvQt::drawPoly( const QSPt2f p[], int npoints, const bool edges[], int edgeAutoColor ) + { + if ( edges && m_curr_pen.style() != NoPen ) m_paint->setPen( NoPen ); + else if ( edgeAutoColor ) set_auto_pen( edgeAutoColor ); + + if ( npoints > m_vert_array.size() ) m_vert_array.resize(npoints); + for( int i=0; i<npoints; i++ ) m_vert_array.setPoint( i, toInt(p[i].x), toInt(p[i].y) ); + m_paint->drawPolygon( m_vert_array, FALSE, 0, npoints ); + + // draw edges + if ( edges && m_curr_pen.style() != NoPen ) { + if ( npoints*2 > m_edge_array.size() ) m_edge_array.resize(npoints*2); + int nlines = 0; + if ( edges[0] ) { + m_edge_array.putPoints( 0, 2, toInt(p[npoints-1].x), + toInt(p[npoints-1].y), + toInt(p[0].x), + toInt(p[0].y) ); + nlines++; + } + for( int i=1; i<npoints; i++ ) if ( edges[i] ) { + m_edge_array.putPoints( nlines*2, 2, m_vert_array, i-1 ); + nlines++; + } + + if ( edgeAutoColor ) set_auto_pen( edgeAutoColor ); else m_paint->setPen( m_curr_pen ); + m_paint->drawLineSegments( m_edge_array, 0, nlines ); + } + } + +//-------------------------------------------------------------// + +void QSDrvQt::set_auto_pen( int autoColor ) + { + m_paint->setPen( QPen( QColor( + QMIN(255,QMAX(0,m_cfill.color.r+autoColor)), + QMIN(255,QMAX(0,m_cfill.color.g+autoColor)), + QMIN(255,QMAX(0,m_cfill.color.b+autoColor))), + m_curr_pen.width(), + m_curr_pen.style() ) ); + } + + //cout << " npoints " << npoints << endl; + //if ( npoints < 3 ) cout << " NPOINTS < 3 " << endl << endl; + +//-------------------------------------------------------------// + +void QSDrvQt::drawText( const QSPt2f &pos, const QString& text, int align ) + { + drawRText( pos, 0, text, align ); + } + +//-------------------------------------------------------------// + +QSPt2f QSDrvQt::textSize( const QString& text ) + { + QSimpleRichText label(text,toQFont(m_curr_font,72.0)); + label.setWidth( 0x0fffffff ); + return QSPt2f(label.widthUsed()*dpi/72.0,label.height()*dpi/72.0); + } + +//-------------------------------------------------------------// + +void QSDrvQt::drawRText( const QSPt2f &pos, int angle, const QString& text, int align ) + { + QSimpleRichText label(text,toQFont(m_curr_font,72.0)); + label.setWidth( 0x0fffffff ); + label.setWidth( label.widthUsed() ); + QColorGroup color; color.setColor( QColorGroup::Text, m_paint->pen().color() ); + QPoint pos_aligned = align_rect(QRect(toInt(pos.x),toInt(pos.y),label.widthUsed(),label.height()),align); + bool xform = m_paint->hasWorldXForm(); + m_paint->saveWorldMatrix(); + m_paint->setWorldXForm( TRUE ); + m_paint->translate( toInt(pos.x), + toInt(pos.y)); + m_paint->rotate( angle ); + m_paint->scale(dpi/72.0,dpi/72.0); + m_paint->translate( pos_aligned.x()-toInt(pos.x), + pos_aligned.y()-toInt(pos.y) ); + label.draw( m_paint, + 0, 0, + QRect(0,0,label.widthUsed(),label.height()), + color ); + m_paint->restoreWorldMatrix(); + m_paint->setWorldXForm( xform ); + } + +//-------------------------------------------------------------// + +void QSDrvQt::getRTextBoundingPoly( QSPt2f out[4], const QSPt2f &pos, int angle, const QString& text, int align ) + { + QSimpleRichText label(text,toQFont(m_curr_font,72.0)); + label.setWidth( 0x0fffffff ); + label.setWidth( label.widthUsed() ); + QPoint pos_aligned = align_rect(QRect(toInt(pos.x),toInt(pos.y),label.widthUsed(),label.height()),align); + QWMatrix m; + m.translate(toInt(pos.x), + toInt(pos.y)); + m.rotate( angle ); + m.scale(dpi/72.0,dpi/72.0); + m.translate( pos_aligned.x()-toInt(pos.x), + pos_aligned.y()-toInt(pos.y) ); + QPointArray pa = m.map(QPointArray(QRect(0,0,label.widthUsed(),label.height()))); + for ( int i=0; i<4; i++ ) out[i].set( pa.point(i).x(), pa.point(i).y() ); + } + +//-------------------------------------------------------------// + +QPoint QSDrvQt::align_rect( const QRect& r, int align ) + { + QPoint p(r.x(),r.y()); + + if ( align & AlignRight ) p.setX( r.x()-r.width() ); + else + if ( align & AlignHCenter ) p.setX( p.x()-r.width()/2 ); + + if ( align & AlignBottom ) p.setY( p.y()-r.height() ); + else + if ( align & AlignVCenter ) p.setY( p.y()-r.height()/2 ); + + return p; + } + +//-------------------------------------------------------------// + +#define QSG2DRIVERQT_PIXMAP_BUFFER_SIZE 65536 + +void QSDrvQt::getPixmapBuffer( PixmapBuffer *buff, int pwidth, int pheight ) +// always called before drawPixmap + { + if ( m_pixmap ) if ( m_pixmap->width() != pwidth ) { + delete m_pixmap; + m_pixmap = NULL; + } + + if ( m_pixmap == NULL ) { + int height = QSG2DRIVERQT_PIXMAP_BUFFER_SIZE / pwidth / 4; + if ( height < 1 ) height = 1; + if ( height > pheight ) height = pheight; + m_pixmap = new QImage( pwidth, height, 32 ); + + } + + buff->lines = m_pixmap->height(); + buff->lo = m_pixmap->bytesPerLine(); + buff->po = 4; + + if ( QImage::systemByteOrder() == QImage::BigEndian ) { + buff->ptr = m_pixmap->bits(); + buff->co = 1; + } else { + buff->ptr = m_pixmap->bits()+3; + buff->co = -1; + } + + if ( buff->lines > pheight ) buff->lines = pheight; + } + +//-------------------------------------------------------------// + +void QSDrvQt::drawPixmap( const QSPt2f& pos, PixmapBuffer *buff ) +// always draw the last requested m_pixmap buffer. + { + assert( m_pixmap ); + // Preferences + m_paint->drawImage( toInt(pos.x), toInt(pos.y), *m_pixmap, 0, 0, m_pixmap->width(), buff->lines, Qt::ColorOnly | Qt::ThresholdDither | Qt::AvoidDither ); + } + +//-------------------------------------------------------------// + +#define SPACE 3 // space length +#define DASH 6 +#define DOT 2 +#define PAD 0 + +const int QSDrvQt::defpatterns[4][6] = { + // line, space, line, space, ... + { DASH, SPACE, DASH, SPACE, DASH, SPACE }, // dash + { DOT, SPACE, DOT, SPACE, DOT, SPACE }, // dot + { DASH, SPACE, DOT, SPACE, PAD, PAD }, // dash - dot + { DASH, SPACE, DOT, SPACE, DOT, SPACE } // dash - dot - dot + }; + + +//-------------------------------------------------------------// + +void QSDrvQt::beginPolyline( const QSPt2f& pos ) + { + // prepare pattern + const int *lpattern; + switch( m_line.style ) { + case QSGLine::Dash: lpattern = defpatterns[0]; break; + case QSGLine::Dot: lpattern = defpatterns[1]; break; + case QSGLine::DashDot: lpattern = defpatterns[2]; break; + case QSGLine::DashDotDot: lpattern = defpatterns[3]; break; + default: lpattern = NULL; break; + }; + m_curr_polyline_style = m_line.style; + + // scale pattern using dpi * line_width / 72 + double scale = toPixels(QMAX((double )m_line.width,1.0)); + if ( lpattern ) for( int i=0; i<6; i++ ) m_curr_polyline_pattern[i] = lpattern[i]*scale; + else m_curr_polyline_pattern[0] = -1.0; + + // current position + m_curr_polyline_t = 0.0; + m_curr_polyline_pos = pos; + + // pattern length + m_curr_polyline_pattern_length = 0.0; + for( int i=0; i<6; i++ ) m_curr_polyline_pattern_length += m_curr_polyline_pattern[i]; + + // convert a pattern from lengths to positons 5, 3, 5, 3 -> 5, 8, 13, 16 + for( int i=1; i<6; i++ ) m_curr_polyline_pattern[i] += m_curr_polyline_pattern[i-1]; + + // set qt graphics context - always use solid line + QPen cpen = m_paint->pen(); + if ( cpen.style() != Qt::NoPen ) { cpen.setStyle( Qt::SolidLine ); m_paint->setPen( cpen ); } + + m_paint->moveTo( int(floor(pos.x+0.5)), int(floor(pos.y+0.5)) ); + } + +//-------------------------------------------------------------// + +void QSDrvQt::drawPolylineTo( const QSPt2f& pos ) + { + if ( m_curr_polyline_style != m_line.style ) { endPolyline(); beginPolyline( m_curr_polyline_pos ); } + + // obvious cases + if ( m_curr_polyline_pattern[0] == -1.0 ) { + m_paint->lineTo( int(floor(pos.x+0.5)), + int(floor(pos.y+0.5)) ); + return; + } + + // length of this segment + double length = sqrt( (m_curr_polyline_pos.x-pos.x)*(m_curr_polyline_pos.x-pos.x) + + (m_curr_polyline_pos.y-pos.y)*(m_curr_polyline_pos.y-pos.y) ); + // If t changes from min to max, (x,y) changes + // from (curr_polyline_pos.x,curr_polyline_pos.y) to (pos.x,pos.y) + double ax = length > 0.0 ? ( pos.x - m_curr_polyline_pos.x ) / length : 0.0; + double ay = length > 0.0 ? ( pos.y - m_curr_polyline_pos.y ) / length : 0.0; + + // find index to m_curr_polyline_pattern at position t + int pattern_index = 0; + m_curr_polyline_t = fmod( m_curr_polyline_t, m_curr_polyline_pattern_length ); + for( int i=0; i<6; i++ ) if ( m_curr_polyline_pattern[i] > m_curr_polyline_t ) { pattern_index = i; break; } + + // t changes from m_curr_polyline_t to length + double t; + QSPt2f curr_pos; + while(1) { + // draws a m_line to t + t = (pattern_index/6)*m_curr_polyline_pattern_length + m_curr_polyline_pattern[pattern_index%6] - m_curr_polyline_t; + curr_pos.x = m_curr_polyline_pos.x + QMIN(t,length)*ax; + curr_pos.y = m_curr_polyline_pos.y + QMIN(t,length)*ay; + // even position - space, odd position in a pattern - m_line + bool is_space = pattern_index & 0x01; + // draw a m_line or leave a space + if ( is_space ) m_paint->moveTo( int(floor(curr_pos.x+0.5)), int(floor(curr_pos.y+0.5)) ); + else m_paint->lineTo( int(floor(curr_pos.x+0.5)), int(floor(curr_pos.y+0.5)) ); + pattern_index = pattern_index+1; + + // ok. end with this segment + if ( t >= length ) break; + } + + m_curr_polyline_t += length; + m_curr_polyline_pos = pos; + } + +//-------------------------------------------------------------// + +void QSDrvQt::endPolyline() + { + setLine(m_line); + } + +//-------------------------------------------------------------// +//QBrush br( Qt::gray ); + +void QSDrvQt::setFill( const QSGFill &f ) + { + //QBrush b = toQBrush(f); + //b.setStyle ( Qt::SolidPattern ); + if ( m_cfill != f ) { m_cfill = f; m_paint->setBrush( toQBrush(f) ); } + } + +//-------------------------------------------------------------// + +void QSDrvQt::setFont( const QSGFont &f ) + { + m_curr_font = f; + QFont font = toQFont(f,dpi); + //font.setPixelSizeFloat( toPixels(double(f.size)) ); + m_paint->setFont( font ); + m_paint->setPen( toQColor(f.color) ); + } + +//-------------------------------------------------------------// + +void QSDrvQt::setLine( const QSGLine &l ) + { + m_line = l; + m_curr_pen = toQPen(l); + m_paint->setPen( m_curr_pen ); + } + +//-------------------------------------------------------------// + +QSGFont QSDrvQt::toQSGFont( const QFont &f, const QColor &c, double dpi ) + { + QSGFont result; + result.family = f.family() ; + result.size = int(QSCoord::pixelsToPoints(f.pointSizeFloat(),dpi) + 0.5); + result.bold = f.bold(); + result.italic = f.italic(); + result.color = QSGColor( c.red(), c.green(), c.blue() ); + + return result; + } + +//-------------------------------------------------------------// + +QFont QSDrvQt::toQFont( const QSGFont &f, double dpi ) + { + QFont result; + result.setFamily( f.family ); + result.setPointSizeFloat( QSCoord::pointsToPixels(f.size,dpi) ); + result.setBold( f.bold ); + result.setItalic( f.italic ); + return result; + } + +//-------------------------------------------------------------// + +QSGColor QSDrvQt::toQSGColor( const QColor &c ) + { + return QSGColor( c.red(), c.green(), c.blue() ); + } + +//-------------------------------------------------------------// + +QColor QSDrvQt::toQColor( const QSGColor &c ) + { + return QColor( c.r, c.g, c.b ); + } + +//-------------------------------------------------------------// + +QSGFill QSDrvQt::toQSGFill( const QBrush &b ) + { + QSGFill result; + + switch( b.style() ) { + case Qt::SolidPattern: result.style = QSGFill::Solid; break; + case Qt::HorPattern: result.style = QSGFill::Horiz; break; + case Qt::VerPattern: result.style = QSGFill::Vert; break; + case Qt::CrossPattern: result.style = QSGFill::Cross; break; + case Qt::FDiagPattern: result.style = QSGFill::FDiag; break; + case Qt::BDiagPattern: result.style = QSGFill::BDiag; break; + case Qt::DiagCrossPattern: result.style = QSGFill::DiagCross; break; + case Qt::Dense4Pattern: result.style = QSGFill::Half; break; + default: result.style = QSGFill::Transparent; break; + } + + result.color = toQSGColor( b.color() ); + return result; + } + +//-------------------------------------------------------------// + +QBrush QSDrvQt::toQBrush( const QSGFill &f ) + { + QBrush result; + switch( f.style ) { + case QSGFill::Solid: result.setStyle( Qt::SolidPattern ); break; + case QSGFill::Horiz: result.setStyle( Qt::HorPattern ); break; + case QSGFill::Vert: result.setStyle( Qt::VerPattern ); break; + case QSGFill::Cross: result.setStyle( Qt::CrossPattern ); break; + case QSGFill::FDiag: result.setStyle( Qt::FDiagPattern ); break; + case QSGFill::BDiag: result.setStyle( Qt::BDiagPattern ); break; + case QSGFill::DiagCross: result.setStyle( Qt::DiagCrossPattern ); break; + case QSGFill::Half: result.setStyle( Qt::Dense4Pattern ); break; + default: result.setStyle( Qt::NoBrush ); break; + } + + result.setColor( toQColor(f.color) ); + return result; + } + +//-------------------------------------------------------------// + +QSGLine QSDrvQt::toQSGLine( const QPen &p ) + { + QSGLine result; + + switch( p.style() ) { + case Qt::NoPen: result.style = QSGLine::Invisible; break; + case Qt::SolidLine: result.style = QSGLine::Solid; break; + case Qt::DashLine: result.style = QSGLine::Dash; break; + case Qt::DotLine: result.style = QSGLine::Dot; break; + case Qt::DashDotLine: result.style = QSGLine::DashDot; break; + case Qt::DashDotDotLine: result.style = QSGLine::DashDotDot; break; + default: result.style = QSGLine::Solid; break; + } + + result.width = p.width(); + result.color = toQSGColor( p.color() ); + + return result; + } + +//-------------------------------------------------------------// + +QPen QSDrvQt::toQPen( const QSGLine &p ) + { + Qt::PenStyle s; + + switch( p.style ) { + case QSGLine::Invisible: s = Qt::NoPen; break; + case QSGLine::Solid: s = Qt::SolidLine; break; + case QSGLine::Dash: s = Qt::DashLine; break; + case QSGLine::Dot: s = Qt::DotLine; break; + case QSGLine::DashDot: s = Qt::DashDotLine; break; + case QSGLine::DashDotDot: s = Qt::DashDotDotLine; break; + default: s = Qt::SolidLine; break; + } + + //return QPen( toQColor( p.color ), p.width, s, Qt::SquareCap, Qt::BevelJoin ); + return QPen( toQColor( p.color ), p.width, s ); + } + +//-------------------------------------------------------------// + +QSGFont QSDrvQt::currentFont() + { + return toQSGFont( m_paint->font(), m_paint->pen().color() ); + } + +//-------------------------------------------------------------// + +QSGFill QSDrvQt::currentFill() + { + return toQSGFill( m_paint->brush() ); + } + +//-------------------------------------------------------------// + +QSGLine QSDrvQt::currentLine() + { + return toQSGLine( m_paint->pen() ); + } + +//-------------------------------------------------------------// + +QSDrvQt *QSDrvQt::copy() + { + QSDrvQt *new_drv = new QSDrvQt(); + new_drv->copySettingsFrom( this ); + return new_drv; + } + +//-------------------------------------------------------------// + +void QSDrvQt::copySettingsFrom( const QSDrvQt *drv ) + { + QSDrv::copySettingsFrom( drv ); + setDC( copyPainter(drv->painter()), drv->dpi, true ); + } + +//-------------------------------------------------------------// + +QPainter *QSDrvQt::copyPainter( const QPainter *painter ) + { + QPainter *new_painter = new QPainter( painter->device() ); + new_painter->setRasterOp( painter->rasterOp() ); + new_painter->setWindow( painter->window() ); + new_painter->setViewport( painter->viewport() ); + new_painter->setWorldMatrix( painter->worldMatrix() ); + new_painter->setViewXForm( painter->hasViewXForm() ); + new_painter->setWorldXForm( painter->hasWorldXForm() ); + return new_painter; + } + diff --git a/kmatplot/widgets/qsdrvqt.h b/kmatplot/widgets/qsdrvqt.h new file mode 100644 index 0000000..ee8d92e --- /dev/null +++ b/kmatplot/widgets/qsdrvqt.h @@ -0,0 +1,237 @@ + +/*************************************************************************** + qsdrvqt.h + ------------------- + begin : 01-January-2000 + copyright : (C) 2000 by Kamil Dobkowski + email : kamildobk@poczta.onet.pl + ***************************************************************************/ + +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + +#ifndef QSDRVQT_H +#define QSDRVQT_H + +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + +#include"qsdrv.h" +#include<math.h> +#include<qpainter.h> + +class QImage; + +//-------------------------------------------------------------// + +/** + * \brief Implementation of QSDrv for Qt. + * @author Kamil Dobkowski + */ +class QSDrvQt : public QSDrv + { + public: + /** + * Constructor. + */ + QSDrvQt(); + /** + * Destructor. + */ + virtual ~QSDrvQt(); + /** + * Returns a copy of this object. + */ + virtual QSDrvQt *copy(); + /** + * Creates and returns a copy of painter. + */ + static QPainter *copyPainter( const QPainter *painter ); + /** + * Copies painter, dpi settings. + */ + void copySettingsFrom( const QSDrvQt *drv ); + /** + * Sets a painter. If deletePainter is true, painter is deleted in destructor. + * This driver calls neither p->start(), nor p->stop() + */ + virtual void setDC( QPainter *p, double dpi = 72.0, bool deletePainter = false ); + /** + * Returns painter + */ + QPainter *painter() const { return m_paint; } + /** + * Returns 'delete' painter setting + */ + bool deletePainter() const { return m_delete_painter; } + + /** + * Reimplemented from @ref QSDrv::startDraw . + */ + void startDrawing(); + /** + * Reimplemented from @ref QSDrv::stopDraw . + * Doesn,t call paint->end(). + */ + void stopDrawing(); + + void clearCanvas( const QSGFill& f, const QSPt2f& pos, const QSPt2f& size ); + void drawLine( const QSPt2f &one, const QSPt2f &two ); + void beginPolyline( const QSPt2f& pos ); + void drawPolylineTo( const QSPt2f& pos ); + void endPolyline(); + QSPt2f currPolylinePos() { return m_curr_polyline_pos; } + void drawRect( const QSPt2f &p1, const QSPt2f &p2 ); + void drawPoly( const QSPt2f pts[], int npoints, const bool edges[] = NULL, int edgeAutoColor = 0 ); + void drawEllipse( const QSPt2f& p1, const QSPt2f& p2 ); + void drawText( const QSPt2f &pos, const QString& text, int align = AlignLeft | AlignBottom ); + QSPt2f textSize( const QString& text ); + void drawRText( const QSPt2f &pos, int angle, const QString& text, int align = AlignLeft | AlignBottom ); + void getRTextBoundingPoly( QSPt2f outPts[4], const QSPt2f &pos, int angle, const QString& text, int align = AlignLeft | AlignBottom ); + void getPixmapBuffer( PixmapBuffer *buff, int pwidth, int pheight ); + void drawPixmap( const QSPt2f& pos, PixmapBuffer *data ); + void setFill( const QSGFill &f ); + void setFont( const QSGFont &f ); + void setLine( const QSGLine &l ); + QSGFont currentFont(); + QSGFill currentFill(); + QSGLine currentLine(); + /** + * Converts 'QFont' to 'QSGFont' . + */ + static QSGFont toQSGFont( const QFont &f, const QColor &c, double dpi = 72.0 ); + /** + * Converts 'QSGFont' to 'QFont' . + */ + static QFont toQFont( const QSGFont &f, double dpi = 72.0 ); + /** + * Converts 'QColor' to 'QSGColor' . + */ + static QSGColor toQSGColor( const QColor &c ); + /** + * Converts 'QSGColor' to 'QColor' . + */ + static QColor toQColor( const QSGColor &c ); + /** + * Converts 'QBrush' to 'QSGFill' . + */ + static QSGFill toQSGFill( const QBrush &b ); + /** + * Converts 'QSGFill' to 'QBrush' . + */ + static QBrush toQBrush( const QSGFill &f ); + /** + * Converts 'QPen' to 'QSGLine' . + */ + static QSGLine toQSGLine( const QPen &p ); + /** + * Converts 'QSGLine' to 'QPen' . + */ + static QPen toQPen( const QSGLine &p ); + + protected: + QPainter *m_paint; + QPointArray m_vert_array; + QPointArray m_edge_array; + QImage *m_pixmap; + QSGLine m_line; + QSGFill m_cfill; + QSGFont m_curr_font; + bool m_delete_painter; + QPen m_curr_pen; + + QSPt2f m_curr_polyline_pos; + int m_curr_polyline_style; + double m_curr_polyline_t; + double m_curr_polyline_pattern_length; + double m_curr_polyline_pattern[6]; + static const int defpatterns[4][6]; + QPoint align_rect( const QRect& r, int align ); + inline int toInt( double value ) { return int(value+0.5); } + void set_auto_pen( int autoColor ); + }; + + +#endif + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/kmatplot/widgets/qsfigure.cpp b/kmatplot/widgets/qsfigure.cpp new file mode 100644 index 0000000..30ed74c --- /dev/null +++ b/kmatplot/widgets/qsfigure.cpp @@ -0,0 +1,939 @@ +/*************************************************************************** + qsfigure.cpp + ------------------- + begin : 01-January-2000 + copyright : (C) 2000 by Kamil Dobkowski + email : kamildobk@poczta.onet.pl + ***************************************************************************/ + +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + + +#include "qsfigure.h" +#include "qsdrv.h" +#include "qsconsole.h" +#include <algo.h> +#include <assert.h> + +// +// Draw order ( painer algorithm ) +// 1. For each facet remember its index and z-depth in depth_sorted_facets +// 2. Sort depth_sorted_facets +// 3. From depth_sorted_facets.beign() to depth_sorted_facets.end() +// get index to facet +// draw facet +// +// +// Calculating normal to vertices +// Normal to vertex is calculated as an average of normals to all +// facets which contain this vertex. Unfortunately the same vertex may +// be put a few times ito a vertex table - so you should compare all vertices to find out +// which of them are actually the same vertex. +// 1. For each VERTEX put its global index to sorted_global_vertex_table +// 2. Sort it using vcomp or icomp object +// - map all coordinates to <0,1> and round to the m_accuracy digits after the point +// - sort by x, next by y, next by z, +// 3. Now all the same vertices on the screen are also neighbours in sorted_global_vertex_table. +// When drawing: +// 4. But how you can find vertex for example nr. 5 in sorted_global_vertex_table. +// Index 5 in pos_in_sorted_global_vertex_table points to the position in sorted_global_vertex_table where the vertex nr 5 +// resides. +// 5. Now potentially equal vertices are: +// sorted_global_vertex_table[pos_in_sorted_global_vertex_table[5]+1], sorted_global_vertex_table[pos_in_sorted_global_vertex_table[5]+2], .. +// sorted_global_vertex_table[pos_in_sorted_global_vertex_table[5]-1], sorted_global_vertex_table[pos_in_sorted_global_vertex_table[5]-2], .. +// Check them to find out if they are really equal .. +// 6. For each equal vertex find out to which facet it belongs, calculate normal to this facet. +// 7. Sum all normals and calculate an average +// We need something less complicated ! +//-------------------------------------------------------------// + +struct QSFigure::figure_runtime_data { + enum stage { OrderVertices = 0, + InitFind = 1, + FindNeighbours = 2, + InitDraw = 3, + DrawFigure = 4, + Finished = 5 }; + + int pi; + int pj; + + QSAxis *xaxis; + QSAxis *yaxis; + QSAxis *zaxis; + QSAxis *vaxis; + int first_vertex; // order vertices in signle facet ( clockwise or anti-clockwise ) + int vertex_step; + + int stage; + int cmode; // see CMode + int vertex_count; + int facet_count; + + bool is_4d_data; // is v coordinate available + bool is_index_table; // use indexes to build polygons + bool is_ordered; // is a special drawing order + + QSPt3f *vertex_data_buff; // vertices of the current facet - temporary buffer ( length vertex_count ) + // vertex number 'nr' of the given facet doesn't need to have position + // 'nr' in this buffer - order can be reversed ( normals ! ) see + // d->first_vertex and d->vertex_step + QSPt3f *vertex_world_buff; // as above - vertices in the world3D coordinates - temporary buffer ( vertex_count ) + double *vertex_value_buff; + QSPt3f *vertex_temp_buff; // another temporary buffer for vertices of some facet. ( vertex_count ) + QSPt3f *vertex_norm_buff; // normals to vertices buffer plus normat to the whole facet ( vertex_count+1) + + + QSMatrix *xm; + QSMatrix *ym; + QSMatrix *zm; + QSMatrix *vm; + QSMatrix *im; + + QSGPoint point_mark; + + // description of a single facet + struct facet_t { + int i; double z; + }; + + vector<facet_t>* depth_sorted_facets; + + // Object for comparing depth of facets. Used with depth_sorted_facets - Ordering facets. + struct comp_t : public binary_function<facet_t, facet_t, bool> { + inline bool operator()( const facet_t& f1, const facet_t& f2 ) { return furthermost_first ? f1.z<f2.z : f1.z>f2.z; } + bool furthermost_first; // further first + } comp; + + // Object for comparing vertices of facets. + // Find the same vertices for an average normal calculating. + // 1. compare x coordinate + // 2. compare y coordinate + // 3. compare z coordinate + struct vcomp_t : public binary_function<int, int, bool> { + // return global_vertex(v1) < global_vertex(v2) + // v1 and v2 are normalized numbers + bool operator()( int v1, int v2 ) { + int vertex1 = d->vertex( v1 ); + int vertex2 = d->vertex( v2 ); + int facet1 = d->facet( v1 ); + int facet2 = d->facet( v2 ); + double val1 = vroundx(d->xm->value(facet1,vertex1)); + double val2 = vroundx(d->xm->value(facet2,vertex2)); + if ( val1 > val2 ) return false; + else if ( val1 == val2 ) { + val1 = vroundy(d->ym->value(facet1,vertex1)); + val2 = vroundy(d->ym->value(facet2,vertex2)); + if ( val1 > val2 ) return false; + else if ( val1 == val2 ) { + val1 = vroundz(d->zm->value(facet1,vertex1)); + val2 = vroundz(d->zm->value(facet2,vertex2)); + if ( val1 >= val2 ) return false; + } + } + return true; + } + + // map to <0,1> and round to ac digits after the point + inline double vroundx( double value ) { return floor((value-minx)*acsx+0.5); } + inline double vroundy( double value ) { return floor((value-miny)*acsy+0.5); } + inline double vroundz( double value ) { return floor((value-minz)*acsz+0.5); } + figure_runtime_data *d; + double acsx; // accuracy/scalex + double acsy; // accuracy/scaley + double acsz; // accuracy/scalez + double minx; + double miny; + double minz; + } vcomp; + + // Compare vertices of facets for the case with the table of indices. + // Find the same vertices for an average normal calculating. + struct icomp_t : public binary_function<int, int, bool> { + // return global_vertex(v1) < global_vertex(v2) + inline bool operator()( int v1, int v2 ) { + return (int)d->im->value(d->facet(v1),d->vertex(v1)) < (int)d->im->value(d->facet(v2),d->vertex(v2)); + } + figure_runtime_data *d; + } icomp; + + vector<facet_t>::iterator bit; + vector<facet_t>::iterator eit; + vector<int>* sorted_global_vertex_table; + vector<int>::iterator bvit; + vector<int>::iterator evit; + vector<int>* pos_in_sorted_global_vertex_table; + + // returns index which vertex 'vertex' of facet 'facet' has in 'pos_to_sorted_global_vertex_table' + inline int global_vertex_index( int facet, int vertex ) { + return facet*vertex_count+vertex; + } + + inline int facet( int global_vertex_index ) { + return global_vertex_index/vertex_count; + } + + inline int vertex( int global_vertex_index ) { + return global_vertex_index%vertex_count; + } + + vector<int>* processed_facets; // neighbouring facets ( vertex_count ? ) + + inline bool facet_processed( int facet ) { + return binary_search(processed_facets->begin(),processed_facets->end(),facet); + } + inline void set_facet_processed( int facet ) { + processed_facets->insert(lower_bound(processed_facets->begin(),processed_facets->end(),facet),facet); + } + inline void clear_processed_facets() { + processed_facets->erase( processed_facets->begin(),processed_facets->end() ); + } + + }; + +/* + enum CMode { One, + MAuto, + VAuto, + MUserG, + MUserRGB, + MUserRGBA, + VUserG, + VUserRGB, + VUserRGBA }; +*/ +// QSGFill *vertex_fill_buff; // fills of vertices buffer ( vertex_count ) + +//-------------------------------------------------------------// + +QSFigure::QSFigure(QSAxes* parent, const char * name) +:QSPlot3D(parent,name) + { + assert( parent ); + m_accuracy = 4; + m_extremes_valid = false; + m_minmax_v_valid = false; + m_title_str = tr("Untitled figure"); + m_dmin.set( 0.0, 0.0, 0.0 ); + m_dmax.set( 0.0, 0.0, 0.0 ); + m_vmin = 0.0; + m_vmax = 0.0; + #define CHANNELS_NUM 5 + initChannelTable( CHANNELS_NUM ); + } + +//-------------------------------------------------------------// + +QSFigure::~QSFigure() + { + } + +//-------------------------------------------------------------// + + +void QSFigure::setVertexCompareAccuracy( int accuracy ) + { + SET_PROPERTY( m_accuracy, accuracy ); + } + +//-------------------------------------------------------------// + +void QSFigure::dataChanged( int channel ) +// Ouu. We need to calculate new extremes in data +// Refresh data on screen also. + { + if ( channel == -1 || + channel == VXCoord || + channel == VYCoord || + channel == VZCoord || + channel == VTableI ) m_extremes_valid = false; + if ( channel == VVCoord ) m_minmax_v_valid = false; + QSPlot3D::dataChanged( channel ); + } + +//-------------------------------------------------------------// + +void QSFigure::allocRuntimeData() + { + QSPlot3D::allocRuntimeData(); + d = new figure_runtime_data(); + + d->depth_sorted_facets = NULL; + d->vertex_data_buff = NULL; + d->vertex_norm_buff = NULL; + d->vertex_world_buff = NULL; + d->vertex_value_buff = NULL; + d->vertex_temp_buff = NULL; +// d->vertex_fill_buff = NULL; + + d->sorted_global_vertex_table = NULL; + d->pos_in_sorted_global_vertex_table = NULL; + d->processed_facets = NULL; + + d->xaxis = defaultAxis(QSAxis::XAxisType); + d->yaxis = defaultAxis(QSAxis::YAxisType); + d->zaxis = defaultAxis(QSAxis::ZAxisType); + d->vaxis = defaultAxis(QSAxis::VAxisType); + + d->stage = 0; + init_data(); + bool vertex_order_reverse = false; + if (d->xaxis->reversed()) vertex_order_reverse = !vertex_order_reverse; + if (d->yaxis->reversed()) vertex_order_reverse = !vertex_order_reverse; + if (d->zaxis->reversed()) vertex_order_reverse = !vertex_order_reverse; + + if ( vertex_order_reverse ) { d->first_vertex = d->vertex_count-1; d->vertex_step= - 1; } + else { d->first_vertex = 0; d->vertex_step = 1; } + + d->point_mark = m_settings.points[PointMark]; + } + +//-------------------------------------------------------------// + +void QSFigure::init_data() +// Check sizes of tables and which table with vertices we will be using. + { + d->facet_count = 0; + d->vertex_count = 0; + if ( matrixCols( VXCoord ) == matrixCols( VYCoord ) && + matrixRows( VXCoord ) == matrixRows( VYCoord ) && + matrixCols( VYCoord ) == matrixCols( VZCoord ) && + matrixRows( VYCoord ) == matrixRows( VZCoord ) && + matrixRows( VXCoord ) > 0 && + matrixCols( VXCoord ) > 0 ) { + d->facet_count = matrixRows( VXCoord ); + d->vertex_count = matrixCols( VXCoord ); + } + + d->is_4d_data = false; + if ( matrixCols( VVCoord ) == matrixCols( VXCoord ) && + matrixRows( VVCoord ) == matrixRows( VXCoord ) ) { + d->is_4d_data = true; + } + + d->is_index_table = false; + if ( matrixCols( VTableI ) > 0 && matrixRows( VTableI ) > 0 ) { + d->is_index_table = true; + d->vertex_count = matrixCols( VTableI ); + d->facet_count = matrixRows( VTableI ); + } + + // clip buffers etc. + if ( d->vertex_count > 40 ) { + d->vertex_count = 0; + d->facet_count = 0; + } + + // ordering of facets + d->is_ordered = ( m_corder != QSDrv::NoOrdering ); + d->comp.furthermost_first = ( m_corder == QSDrv::FurtherFirst ); + + // facets data + d->xm = matrix( VXCoord ); + d->ym = matrix( VYCoord ); + d->zm = matrix( VZCoord ); + d->vm = matrix( VVCoord ); + d->im = matrix( VTableI ); + } + +//-------------------------------------------------------------// + +void QSFigure::freeRuntimeData() + { + free_buffers(); + delete d; d=NULL; + QSPlot3D::freeRuntimeData(); + } + +//-------------------------------------------------------------// + +bool QSFigure::getAxisRange( QSAxis *axis, double& min, double& max ) + { + allocRuntimeData(); + if ( d->facet_count == 0 || d->vertex_count == 0 ) { + freeRuntimeData(); + return false; + } + + if ( !m_extremes_valid || !m_minmax_v_valid ) { + QSPt3f *vertex_buff = new QSPt3f[d->vertex_count+1]; + double *value_buff = new double[d->vertex_count+1]; + for( int pi=0; pi<d->facet_count; pi++ ) { + QSPt3f facet_min; + QSPt3f facet_max; + double value_min; + double value_max; + get_facet( pi, vertex_buff, value_buff ); + facet_max.x = facet_min.x = vertex_buff[0].x; + facet_max.y = facet_min.y = vertex_buff[0].y; + facet_max.z = facet_min.z = vertex_buff[0].z; + value_min = value_max = value_buff[0]; + for ( int k=1; k<d->vertex_count; k++ ) { + double x = vertex_buff[k].x ; + double y = vertex_buff[k].y ; + double z = vertex_buff[k].z ; + double v = value_buff[k]; + if ( x < facet_min.x ) facet_min.x = x; + if ( y < facet_min.y ) facet_min.y = y; + if ( z < facet_min.z ) facet_min.z = z; + if ( x > facet_max.x ) facet_max.x = x; + if ( y > facet_max.y ) facet_max.y = y; + if ( z > facet_max.z ) facet_max.z = z; + if ( v < value_min ) value_min = v; + if ( v > value_max ) value_max = v; + } + + if ( facet_min.x < m_dmin.x || pi == 0 ) m_dmin.x = facet_min.x; + if ( facet_min.y < m_dmin.y || pi == 0 ) m_dmin.y = facet_min.y; + if ( facet_min.z < m_dmin.z || pi == 0 ) m_dmin.z = facet_min.z; + + if ( facet_max.x > m_dmax.x || pi == 0 ) m_dmax.x = facet_max.x; + if ( facet_max.y > m_dmax.y || pi == 0 ) m_dmax.y = facet_max.y; + if ( facet_max.z > m_dmax.z || pi == 0 ) m_dmax.z = facet_max.z; + + if ( value_min < m_vmin || pi == 0 ) m_vmin = value_min; + if ( value_max > m_vmax || pi == 0 ) m_vmax = value_max; + } + + delete[] vertex_buff; + delete[] value_buff; + m_extremes_valid = true; + m_minmax_v_valid = true; + } + + if ( axis==d->xaxis ) { min = m_dmin.x; max = m_dmax.x; } + else if ( axis==d->yaxis ) { min = m_dmin.y; max = m_dmax.y; } + else if ( axis==d->zaxis ) { min = m_dmin.z; max = m_dmax.z; } + else if ( axis==d->vaxis && !d->is_4d_data ) { min = m_dmin.z; max = m_dmax.z; } + else if ( axis==d->vaxis && d->is_4d_data ) { min = m_vmin; max = m_vmax; } + else { freeRuntimeData(); return false; } + + freeRuntimeData(); + return true; + } +//-------------------------------------------------------------// + +void QSFigure::get_facet( int facet, QSPt3f *vert, double *values ) +// Return all vertex of an 'nr' facet in 'vert' table. +// This table must be large enough to contain all vertices. + { + int i = d->first_vertex; + if ( d->is_index_table ) { + for( int vertex=0; vertex<d->vertex_count; vertex++, i+=d->vertex_step ) { + int vertex_index = int( d->im->value( facet, vertex ) ); + if ( vertex_index <0 || vertex_index >= d->xm->rows() ) { + QSConsole::write( tr("Figure:%1 : Invalid index %2 at row=%3, col=%4 ").arg(title()).arg(vertex_index).arg(facet).arg(vertex) ); + vert[i].set(sqrt(-1.0),sqrt(-1.0),sqrt(-1.0)); + if ( d->is_4d_data && values ) values[i] = sqrt(-1.0); + } else { + vert[i].set( d->xm->value( vertex_index, 0 ), + d->ym->value( vertex_index, 0 ), + d->zm->value( vertex_index, 0 ) ); + if ( d->is_4d_data && values ) values[i] = d->vm->value( vertex_index, 0 ); + } + } + } else { + for( int vertex=0; vertex<d->vertex_count; vertex++, i+=d->vertex_step ) { + vert[i].set( d->xm->value( facet, vertex ), + d->ym->value( facet, vertex ), + d->zm->value( facet, vertex ) ); + if ( d->is_4d_data && values ) values[i] = d->vm->value( facet, vertex ); + } + } + } + +//-------------------------------------------------------------// + +bool QSFigure::start() + { + QSPlot3D::start(); + + if ( d->facet_count == 0 || d->vertex_count == 0 ) return false; + alloc_buffers(); +// init_colors(); + d->stage = 0; + d->pi = 0; + d->pj = 0; + return true; + } +//-------------------------------------------------------------// + +void QSFigure::alloc_buffers() + { + assert( d ); + free_buffers(); + + d->vertex_data_buff = new QSPt3f[d->vertex_count]; + d->vertex_value_buff = new double[d->vertex_count]; + d->vertex_world_buff = new QSPt3f[d->vertex_count]; + d->vertex_temp_buff = new QSPt3f[d->vertex_count]; + d->vertex_norm_buff = new QSPt3f[d->vertex_count+1]; +// d->vertex_fill_buff = new QSGFill[d->vertex_count]; + + if ( d->is_ordered ) d->depth_sorted_facets = new vector<figure_runtime_data::facet_t>( d->facet_count ); + + if ( m_cnormals == QSDrv::VertexNormals ) { + d->sorted_global_vertex_table = new vector<int>( d->vertex_count*d->facet_count ); + d->pos_in_sorted_global_vertex_table = new vector<int>( d->vertex_count*d->facet_count ); + d->processed_facets = new vector<int>(); + d->processed_facets->reserve( d->vertex_count ); + } + } + +//-------------------------------------------------------------// + +void QSFigure::free_buffers() + { + assert( d ); + + delete d->depth_sorted_facets; d->depth_sorted_facets = NULL; + delete d->sorted_global_vertex_table; d->sorted_global_vertex_table = NULL; + delete d->pos_in_sorted_global_vertex_table; d->pos_in_sorted_global_vertex_table = NULL; + delete d->processed_facets; d->processed_facets = NULL; + + delete[] d->vertex_data_buff; d->vertex_data_buff = NULL; + delete[] d->vertex_value_buff; d->vertex_value_buff = NULL; + delete[] d->vertex_world_buff; d->vertex_world_buff = NULL; + delete[] d->vertex_temp_buff; d->vertex_temp_buff = NULL; + delete[] d->vertex_norm_buff; d->vertex_norm_buff = NULL; +// delete[] d->vertex_fill_buff; d->vertex_fill_buff = NULL; + + } + +//-------------------------------------------------------------// + +/* +void QSFigure::init_colors() +// Uff !! + { + assert( d ); + + if ( !colored() ) { d->cmode = figure_runtime_data::One; return; } + + if ( m_ccolors == QSDrv::VertexColors ) d->cmode = figure_runtime_data::VAuto; + else d->cmode = figure_runtime_data::MAuto; + + } +*/ + + +//-------------------------------------------------------------// +/* +void QSFigure::get_facet_colors( int findex, QSGFill *vertex_fill_buff ) +// vertex_world_buff must be defined +// + { + int k; + double sum = 0.0; + switch( d->cmode ) { + case figure_runtime_data::VAuto: + for( k=0; k<d->vertex_count; k++ ) m_gradient.fill( d->vertex_world_buff[k].z, vertex_fill_buff[k] ); + break; + case figure_runtime_data::MAuto: + for( k=0; k<d->vertex_count; k++ ) sum+=d->vertex_world_buff[k].z; + m_gradient.fill( sum/d->vertex_count, vertex_fill_buff[0] ); + break; + default: vertex_fill_buff[0] = fill(TMeshFill); + if ( m_ccolors == QSDrv::VertexColors ) for( k=0; k<d->vertex_count; k++ ) vertex_fill_buff[k] = vertex_fill_buff[0]; + break; + } + + } +*/ + +//-------------------------------------------------------------// +//-------------------------------------------------------------// + +bool QSFigure::step() + { + switch( d->stage ) { + case figure_runtime_data::OrderVertices: order_vertices_step(); break; + case figure_runtime_data::InitFind: init_find_neighbours(); break; + case figure_runtime_data::FindNeighbours: find_neighbours_step(); break; + case figure_runtime_data::InitDraw: init_draw_figure(); break; + case figure_runtime_data::DrawFigure: draw_figure_step(); break; + default: return false; + } + return true; + } + +//-------------------------------------------------------------// + +void QSFigure::end() + { + free_buffers(); + QSPlot3D::end(); + } + + +//-------------------------------------------------------------// + +void QSFigure::order_vertices_step() + { + if ( !d->is_ordered ) { d->pi = 0; d->stage ++; return; } + + double z; + double maxz; + double minz; + + int curr_step = 0; + while ( d->pi<d->facet_count ) { + get_facet( d->pi, d->vertex_data_buff ); + minz = maxz = m_axes->proj()->world3DToCanvas3(dataToWorld(d->vertex_data_buff[0])).z; + for ( int k=1; k<d->vertex_count; k++ ) { + z = m_axes->proj()->world3DToCanvas3(dataToWorld(d->vertex_data_buff[k])).z; + if ( z > maxz ) maxz = z; + if ( z < minz ) minz = z; + } + + (*d->depth_sorted_facets)[d->pi].i = d->pi; + (*d->depth_sorted_facets)[d->pi].z = d->comp.furthermost_first ? minz : maxz; + d->pi++; if ( ++curr_step > work_steps && m_bkg_handler ) return; + } + + d->bit = d->depth_sorted_facets->begin(); + d->eit = d->depth_sorted_facets->end(); + make_heap( d->bit, d->eit, d->comp ); + + d->pi = 0; d->stage ++; + } + +//-------------------------------------------------------------// + +void QSFigure::init_find_neighbours() + { + if ( m_cnormals == QSDrv::VertexNormals ) { + d->icomp.d = d; + d->vcomp.d = d; + + double accuracy = pow( 10, m_accuracy ); + d->vcomp.minx = m_dmin.x; + d->vcomp.miny = m_dmin.y; + d->vcomp.minz = m_dmin.z; + + if ( m_dmax.x > m_dmin.x ) d->vcomp.acsx = accuracy/(m_dmax.x-m_dmin.x); + else d->vcomp.acsx = accuracy; + if ( m_dmax.y > m_dmin.y ) d->vcomp.acsy = accuracy/(m_dmax.y-m_dmin.y); + else d->vcomp.acsy = accuracy; + if ( m_dmax.z > m_dmin.z ) d->vcomp.acsz = accuracy/(m_dmax.z-m_dmin.z); + else d->vcomp.acsz = accuracy; + + for( int global_vertex=0; global_vertex<d->vertex_count*d->facet_count; global_vertex++ ) + (*d->sorted_global_vertex_table)[global_vertex] = global_vertex; + + d->bvit = d->sorted_global_vertex_table->begin(); + d->evit = d->sorted_global_vertex_table->end(); + // sorting make_heap + pop_heap + if ( d->is_index_table ) make_heap( d->bvit, d->evit, d->icomp ); + else make_heap( d->bvit, d->evit, d->vcomp ); + + + } + + d->stage ++; + } + +//-------------------------------------------------------------// + +void QSFigure::find_neighbours_step() + { + if ( m_cnormals != QSDrv::VertexNormals ) { d->pi=0 ; d->stage ++; return; } + int curr_step = 0; + while ( d->evit != d->bvit ) { + if ( d->is_index_table ) pop_heap( d->bvit, d->evit, d->icomp ); + else pop_heap( d->bvit, d->evit, d->vcomp ); + d->evit --; if ( ++curr_step > work_steps && m_bkg_handler ) return; + } + + for( int k=0; k<d->facet_count*d->vertex_count; k++ ) + (*d->pos_in_sorted_global_vertex_table)[(*d->sorted_global_vertex_table)[k]]=k; + + d->pi = 0; d->stage ++; + } + +//-------------------------------------------------------------// + +void QSFigure::init_draw_figure() + { + m_drv->setLine( line(MeshLine) ); + d->pi = 0; d->stage ++; + } + +//-------------------------------------------------------------// + +void QSFigure::draw_figure_step() +// facet_count - number of facets +// vertex_count - number of vertices in a facet +// vertex_world_buff[] - buffer of coordinates of vertices +// vertex_fill_buff[] - buffer of fills of vertices +// vertex_norm_buff[0] - normal to the current facet +// vertex_norm_buff[] - buffer of normals to vertices +// + { + int facet; + int curr_step = 0; + while( d->pi< d->facet_count ) { + + // Get the current facet. + if ( d->is_ordered ) { pop_heap( d->bit, d->eit, d->comp ); d->eit--; } + facet = d->is_ordered?(*d->eit).i:d->pi; + get_facet( facet, d->vertex_data_buff, d->vertex_value_buff ); + + // Prepare all vertices. + map_facet_to_world( d->vertex_data_buff, d->vertex_world_buff ); + + // Update vertex_fill_buff with colors. +// get_facet_colors( facet, d->vertex_fill_buff ); + + // The normal to the current facet. + if ( m_cnormals != QSDrv::NoNormals ) d->vertex_norm_buff[0] = QSProjection::normal( d->vertex_world_buff, d->vertex_count ); + + // Normals to the vertices of the current facet + if ( m_cnormals == QSDrv::VertexNormals && d->vertex_count > 2 ) get_facet_normals( facet, &d->vertex_norm_buff[1] ); + + // Draw the final polygon. + double *value_buff = NULL; + if ( d->is_4d_data ) { + for( int i=0; i<d->vertex_count; i++ ) d->vertex_value_buff[i] = d->vaxis->dataToWorld( d->vertex_value_buff[i] ); + value_buff = d->vertex_value_buff; + } + if ( d->vertex_count > 2 ) drawPolygon( d->vertex_world_buff, d->vertex_count, d->vertex_norm_buff, value_buff ); + else + // lines + if ( d->vertex_count == 2 ) m_drv->drawLine3( d->vertex_world_buff[0], d->vertex_world_buff[1], NULL ); // no vertex_norm_buff + + // trajectory/scatter plot + if ( d->vertex_count == 1 && facet > 0 && m_settings.lines[MeshLine].style != QSGLine::Invisible ) { + // connect succesive points with a line + // further end can overdraw closer end ! + QSPt3f temp_wbuff[2]; +// QSGFill temp_fbuff[2]; + get_facet( facet-1, temp_wbuff ); + map_facet_to_world( temp_wbuff, temp_wbuff ); +// get_facet_colors( facet-1, temp_fbuff ); + temp_wbuff[1] = d->vertex_world_buff[0]; +// temp_fbuff[1] = d->vertex_fill_buff[0]; + m_drv->drawLine3( temp_wbuff[0], temp_wbuff[1], NULL ); + draw_point_marks( 2, temp_wbuff ); + } + else + // draw points + draw_point_marks( d->vertex_count, d->vertex_world_buff ); + + d->pi++; + if ( ++curr_step > work_steps && m_bkg_handler ) return; + } + + d->stage ++; + } + +//-------------------------------------------------------------// + +void QSFigure::draw_point_marks( int number, const QSPt3f* vertex_world_buff ) +// points shoud be sorted by position ( further first or closer first ) + { + if ( d->point_mark.style != QSGPoint::Invisible ) + for ( int k=0; k<number; k++ ) { + /* + if ( d->cmode == figure_runtime_data::MUserG || + d->cmode == figure_runtime_data::MUserRGB || + d->cmode == figure_runtime_data::MUserRGBA ) d->point_mark.color = vertex_fill_buff[0].color; + if ( d->cmode == figure_runtime_data::VUserG || + d->cmode == figure_runtime_data::VUserRGB || + d->cmode == figure_runtime_data::VUserRGBA ) d->point_mark.color = vertex_fill_buff[k+1].color; + */ + if ( m_axes->proj()->clipPoint3(vertex_world_buff[k]) ) { + m_drv->drawPoint3( vertex_world_buff[k], d->point_mark ); + } + } + m_drv->setLine( m_settings.lines[MeshLine] ); + m_drv->setFill( m_settings.fills[TMeshFill] ); + } + +//-------------------------------------------------------------// + +void QSFigure::map_facet_to_world( const QSPt3f *vertex_data_buff, QSPt3f *vertex_world_buff ) + { + for( int k=0; k<d->vertex_count; k++ ) vertex_world_buff[k] = dataToWorld( vertex_data_buff[k] ); + } + +//#include<iostream.h> + +void QSFigure::get_facet_normals( int facet, QSPt3f *normals ) +// For each vertex accumulate normals of facet itself and all neighouring facets ( and next normalize the result ). +// Neighbouring facets are ones which share current vertex with this facet, How to find shared vertices +// ( it is difficult if the same vertex is put a few times into a vertex table ): +// 1. for each vertex of the facet - find this vertex in sorted_global_vertex_table[] +// 2. Test if neighbouring ( at previous and next positions ) vertices in this table have the same coordinates as our vertex: +// 3. If they have find a facet which they belong to, calculate normal to this facet and add this normal to the result +// . ( Take next vertex of a facet and go to 2 ) +// 4. Normalize the result + { + int i=d->first_vertex; + for( int vertex=0; vertex<d->vertex_count; vertex++, i+=d->vertex_step ) { + ///////////////////////////////////////////// + // Calculate normal for vertex 'vertex' // + ///////////////////////////////////////////// + normals[i].set( 0.0, 0.0, 0.0 ); + int bindex1 = (*d->pos_in_sorted_global_vertex_table)[d->global_vertex_index(facet,vertex)]; + // test next position and add normal of current facet + get_vertex_normal( bindex1, bindex1, 1, &normals[i] ); + // test previous positions + get_vertex_normal( bindex1, bindex1-1, -1, &normals[i] ); + d->clear_processed_facets(); + normals[i] = QSProjection::normalize( normals[i] ); + } + } + +//-------------------------------------------------------------// + +void QSFigure::get_vertex_normal( int vertex_index, int search_start_index, int search_index_step, QSPt3f *normal ) +// Calculate normal for vertex sorted_global_vertex_table[bindex1], by adding +// normals to all facets which the current vertex belongs to. +// Check only in one direction + { + int curr_index = search_start_index; + while( is_equal(vertex_index,curr_index) ) { + //Find a facet which vertex 'vert_index2' belongs to. All indices are indices to sorted_vertex_table . + int findex = d->facet( (*d->sorted_global_vertex_table)[curr_index] ); + + ////////////////////////////////////////////// + // add normal of facet findex to the result// + ////////////////////////////////////////////// + if ( !d->facet_processed(findex) ) { + d->set_facet_processed(findex); + get_facet( findex, d->vertex_temp_buff ); + map_facet_to_world( d->vertex_temp_buff, d->vertex_temp_buff ); + *normal = *normal + QSProjection::normal( d->vertex_temp_buff, d->vertex_count ); + } + curr_index += search_index_step; + } + } + +//-------------------------------------------------------------// + +bool QSFigure::is_equal( int index1, int index2 ) +// Compare two wertices sorted_global_vertex_table[index1] == sorted_global_vertex_table[index2]. + { + int gnum = d->vertex_count*d->facet_count-1; + + if ( index1 < 0 || index1 > gnum || + index2 < 0 || index2 > gnum ) return false; + + int v1 = (*d->sorted_global_vertex_table)[index1]; + int v2 = (*d->sorted_global_vertex_table)[index2]; + + int vertex1 = d->vertex( v1 ); + int vertex2 = d->vertex( v2 ); + int facet1 = d->facet( v1 ); + int facet2 = d->facet( v2 ); + + if ( d->is_index_table ) return int(d->im->value(facet1,vertex1)) == int(d->im->value(facet2,vertex2)); + + return d->vcomp.vroundx(d->xm->value(facet1,vertex1)) == d->vcomp.vroundx(d->xm->value(facet2,vertex2)) && + d->vcomp.vroundy(d->ym->value(facet1,vertex1)) == d->vcomp.vroundy(d->ym->value(facet2,vertex2)) && + d->vcomp.vroundz(d->zm->value(facet1,vertex1)) == d->vcomp.vroundz(d->zm->value(facet2,vertex2)) ; + } + +//-------------------------------------------------------------// + +QString QSFigure::posInfo( QSPt2f& pos ) + { + if ( m_busy ) return QString::null; + allocRuntimeData(); + + QSPt2f p; + double pz = 0.0; + bool init = false; + double pdistance = 10.0*10.0; + QString result = QString::null; + QSPt3f *vertex_buff = new QSPt3f[d->vertex_count+1]; + double *value_buff = new double[d->vertex_count+1]; + for ( int f=0; f<d->facet_count; f++ ) { + get_facet( f, vertex_buff, value_buff ); + for ( int k=0; k<d->vertex_count; k++ ) { + QSPt3f dpos = vertex_buff[k];; + double value = value_buff[k]; + QSPt3f wpos = dataToWorld(dpos); + QSPt3f cpos = m_proj->world3DToCanvas3(wpos); + double distance = (pos.x-cpos.x)*(pos.x-cpos.x)+(pos.y-cpos.y)*(pos.y-cpos.y); + if ( distance < 5.0*5.0 && distance < pdistance && (cpos.z<pz||!init) ) { + pdistance = distance; + init = true; pz = cpos.z; p = QSPt2f(cpos.x,cpos.y); + result = QString(tr("row = "))+QString::number(f)+ "\n"; + result += QString(tr("col = "))+QString::number(k)+ "\n"; + result += QString(tr("X = "))+QString::number(dpos.x)+ "\n"; + result += QString(tr("Y = "))+QString::number(dpos.y)+ "\n"; + result += QString(tr("Z = "))+QString::number(dpos.z)+ "\n"; + if ( d->is_4d_data ) + result += QString(tr("V = "))+QString::number(value)+ "\n"; + } + } + } + delete[] vertex_buff; + delete[] value_buff; + freeRuntimeData(); + if ( result != QString::null ) pos = p; + return result; + } +//-------------------------------------------------------------// + +QSPt2f QSFigure::legendItemSize( QSDrv *drv ) + { + return standardLegendItemSize( drv, defaultAxis(QSAxis::ZAxisType), title() ); + } + +//-------------------------------------------------------------// + +void QSFigure::drawLegendItem( const QSPt2f& pos, QSDrv *drv ) + { + drawStandardLegendItem( pos, drv, defaultAxis(QSAxis::ZAxisType), title(), &m_gradient ); + } + +//-------------------------------------------------------------// + +void QSFigure::loadStateFromStream( QDataStream& stream, QSObjectFactory *factory ) + { + QSPlot3D::loadStateFromStream( stream, factory ); + } + +//-------------------------------------------------------------// + +void QSFigure::saveStateToStream( QDataStream& stream, QSObjectFactory *factory ) + { + QSPlot3D::saveStateToStream( stream, factory ); + } + +//-------------------------------------------------------------// + +QString QSFigure::channelVariable( int channel ) const + { + switch( channel ) { + case VXCoord: return "x"; + case VYCoord: return "y"; + case VZCoord: return "z"; + case VVCoord: return "v"; + case VTableI: return "i"; + } + return QString::null; + } + +//-------------------------------------------------------------// + +QSFigure::ColumnType QSFigure::columnType( int channel, int column ) const + { + } + + + + + + + diff --git a/kmatplot/widgets/qsfigure.h b/kmatplot/widgets/qsfigure.h new file mode 100644 index 0000000..9852690 --- /dev/null +++ b/kmatplot/widgets/qsfigure.h @@ -0,0 +1,174 @@ +/*************************************************************************** + qsfigure.h + ------------------- + begin : 01-January-2000 + copyright : (C) 2000 by Kamil Dobkowski + email : kamildobk@poczta.onet.pl + ***************************************************************************/ + +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + + +#ifndef QSFIGURE_H +#define QSFIGURE_H + +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + +#include"qsaxes.h" +#include"qsplot.h" +#include<vector.h> +#include<math.h> + + + + +/** + * \brief Dataset : 3D figure + * + * Dataset which draws any set of 3d polygons. Data format is described in QSFigure::Channels . + * See also : QSAxes::plotAdd() + */ + +class QSFigure : public QSPlot3D + { + Q_OBJECT + Q_PROPERTY( int vertexCompareAccuracy READ vertexCompareAccuracy WRITE setVertexCompareAccuracy ) + + public: + + /** + * Descriptive names of data channels. See QSData::setMatrix(). + * VXCoord, VYCoord, VZCoord, VVCoord ( V is optional ) must be matrices with the same size. + * VXCoord contains x coordinates, VYCord contains y coordinates, and VZCoord contains z coordinates. + * The same row in all matrices describes one polygon. The same column in this row descripes a one vertex. + * So there is rows polygons and all polygons have cols vertices. If VTableI is not empty and VXCoords, + * VYCoords, VZCoords contain a single column other format is used. VTableI contains indexes + * to the row in Coords matrices. One index defines a one data point. One row in VTable in describes one polygon. + * There is rows(VTableI) polygons, which have cols(VTableI) vertices. + */ + enum Channels { VXCoord = 0, + VYCoord = 1, + VZCoord = 2, + VVCoord = 3, + VTableI = 4 }; + + /** + * Constructor. + */ + QSFigure( QSAxes* parent, const char * name=0 ); + /** + * Destructor. + */ + virtual ~QSFigure(); + /** + * Accuracy is used to detect if two vertices are in fact the same vertex, + * so two polygons are neighbours. Coordinates of vertices are mapped to + * the range <-1,1> and rounded to 'accuracy' places after the point before + * comparing. 'accuracy' must be larger than 0. + * Valid only if the gr. driver uses normals to vertices ( OpenGL ). + */ + void setVertexCompareAccuracy( int accuracy ); + /** + * Returns the vertex compare accuracy. + */ + int vertexCompareAccuracy() const { return m_accuracy; } + + virtual QString posInfo( QSPt2f& pos ); + virtual QSPt2f legendItemSize( QSDrv *drv ); + virtual void drawLegendItem( const QSPt2f& pos, QSDrv *drv ); + virtual void loadStateFromStream( QDataStream& stream, QSObjectFactory *factory ); + virtual void saveStateToStream( QDataStream& stream, QSObjectFactory *factory ); + virtual ColumnType columnType( int channel, int column ) const; + virtual QString channelVariable( int channel ) const; + + protected: + + virtual void dataChanged( int channel = -1 ); + virtual void allocRuntimeData(); + virtual void freeRuntimeData(); + virtual bool getAxisRange( QSAxis *axis, double& min, double& max ); + virtual bool start(); + virtual bool step(); + virtual void end(); + + private: + struct figure_runtime_data; + struct figure_runtime_data *d; + + int m_accuracy; // vertex comparing accuracy. + bool m_extremes_valid; // are extremes valid + bool m_minmax_v_valid; + QSPt3f m_dmin; // minimum value in data + QSPt3f m_dmax; // maximum value in data + double m_vmin; + double m_vmax; + + void init_data(); + void init_draw(); + void init_colors(); + void init_draw_figure(); + + void alloc_buffers(); + void free_buffers(); + + void order_vertices_step(); + void init_find_neighbours(); + void find_neighbours_step(); + void draw_figure_step(); + + bool is_equal( int bindex1, int bindex2 ); + void get_facet( int nr, QSPt3f *vert, double *values=NULL ); + void get_facet_colors( int findex, QSGFill *fbuff ); + void get_facet_normals( int findex, QSPt3f *normals ); + void get_vertex_normal( int bindex1, int bindex2, int inc, QSPt3f *normal ); + void draw_point_marks( int number, const QSPt3f* wbuff ); + void map_facet_to_world( const QSPt3f *vbuff, QSPt3f *wbuff ); + }; + +#endif + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/kmatplot/widgets/qsgattr.cpp b/kmatplot/widgets/qsgattr.cpp new file mode 100644 index 0000000..e5eff66 --- /dev/null +++ b/kmatplot/widgets/qsgattr.cpp @@ -0,0 +1,577 @@ +/*************************************************************************** + qsgattr.cpp + ------------------- + begin : 01-January-2000 + copyright : (C) 2000 by Kamil Dobkowski + email : kamildobk@poczta.onet.pl + ***************************************************************************/ + +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + + +#include "qsgattr.h" +#include "qstringlist.h" +#include<math.h> + +//-------------------------------------------------------------// +//-------------------------------------------------------------// +//-------------------------------------------------------------// +//-------------------------------------------------------------// +//-------------------------------------------------------------// + +QSGColor::QSGColor() +: r(0U), g(0U), b(0U), a(255U) + { + } + +//-------------------------------------------------------------// + +QSGColor::QSGColor( unsigned char red, + unsigned char green, + unsigned char blue, + unsigned char alpha ) +: r(red), g(green), b(blue), a(alpha) + { + } + +//-------------------------------------------------------------// + +const QSGColor &QSGColor::set( unsigned char red, + unsigned char green, + unsigned char blue, + unsigned char alpha ) + { + r = red; g = green; b = blue; a = alpha; + return *this; + } + +//-------------------------------------------------------------// + +bool operator==( const QSGColor& c1, const QSGColor& c2 ) + { + return c1.r == c2.r && + c1.g == c2.g && + c1.b == c2.b && + c1.a == c2.a; + } + +//-------------------------------------------------------------// + +bool operator!=( const QSGColor& c1, const QSGColor& c2 ) + { + return !(c1 == c2); + } + +//-----------------------------------------------------------// + +QString toQString( const QSGColor& c ) + { + QString s; + return s.sprintf("%.2x%.2x%.2x%.2x", c.a, c.r, c.g, c.b ); + } + +//-----------------------------------------------------------// + +QSGColor toQSGColor( const QString& s ) + { + unsigned long value = s.toULong( NULL, 16 ); + QSGColor c; + c.a = (unsigned char )((value & 0xFF000000 ) >> 24 ); + c.r = (unsigned char )((value & 0x00FF0000 ) >> 16 ); + c.g = (unsigned char )((value & 0x0000FF00 ) >> 8 ); + c.b = (unsigned char )((value & 0x000000FF ) ); + return c; + } + +//-------------------------------------------------------------// + +/* +ostream& operator<<( ostream& s, QSGColor &color ) + { + s << "(" << int(color.r) << "," << int(color.g) << "," << int(color.b) << "," << int(color.a) << ")"; + return s; + } +*/ + +//-------------------------------------------------------------// +//-------------------------------------------------------------// +//-------------------------------------------------------------// +//-------------------------------------------------------------// + +const QSGFill QSGFill::transparentFill = QSGFill(QSGFill::Transparent); + +QSGFill::QSGFill() + { + // default fill + style = Solid; + color = QSGColor( 255, 255, 255 ); + } + +//-------------------------------------------------------------// + +QSGFill::QSGFill( Style init_style ) + { + style = init_style; + } + +//-------------------------------------------------------------// + +bool operator==( const QSGFill& f1, const QSGFill& f2 ) + { + return f1.style == f2.style && f1.color == f2.color; + } + +//-------------------------------------------------------------// + +bool operator!=( const QSGFill& f1, const QSGFill& f2 ) + { + return !(f1 == f2); + } + + //-------------------------------------------------------------// + +QString toQString( const QSGFill& fill ) + { + return QString::number(fill.style) + "; " + toQString(fill.color) + ";"; + } + +//-------------------------------------------------------------// + +QSGFill toQSGFill( const QString& string ) + { + QStringList args = QStringList::split( ";", string, TRUE ); + QSGFill result; + result.style = (QSGFill::Style )args[0].toInt(); + result.color = toQSGColor(args[1]); + return result; + } + +//-------------------------------------------------------------// +/* +ostream& operator<<( ostream& s, QSGFill &fill ) + { + s << "(" << int(fill.style) << "," << fill.color << ")"; + return s; + } +*/ + +//-------------------------------------------------------------// +//-------------------------------------------------------------// +//-------------------------------------------------------------// +//-------------------------------------------------------------// + +QSGFont::QSGFont() +:family("helvetica"), size(10), bold(false), italic(false) + { + color = QSGColor( 0, 0, 0 ); + } + +//-------------------------------------------------------------// + +QSGFont::QSGFont( const QSGFont& f ) + { + operator=( f ); + } + +//-------------------------------------------------------------// + +void QSGFont::operator=( const QSGFont& f ) + { + family = f.family; + color = f.color; + size = f.size; + bold = f.bold; + italic = f.italic; + } + +//-------------------------------------------------------------// + +bool operator==( const QSGFont& f1, const QSGFont& f2 ) + { + return f1.size == f2.size && + f1.bold == f2.bold && + f1.italic == f2.italic && + f1.color == f2.color && + f1.family == f2.family ; + } + +//-------------------------------------------------------------// + +bool operator!=( const QSGFont& f1, const QSGFont& f2 ) + { + return !(f1 == f2); + } + +//-------------------------------------------------------------// + +QString toQString( const QSGFont& font ) + { + return font.family + "; " + QString::number(font.size) + "; " + QString::number(font.bold) + "; " + + QString::number(font.italic) + "; " + toQString(font.color) + ";"; + } + +//-------------------------------------------------------------// + +QSGFont toQSGFont( const QString& string ) + { + QSGFont result; + QStringList args = QStringList::split( ";", string, TRUE ); + result.family = args[0].stripWhiteSpace(); + result.size = args[1].toInt(); + result.bold = (bool )args[2].toInt(); + result.italic = (bool )args[3].toInt(); + result.color = toQSGColor(args[4]); + return result; + } + +//-------------------------------------------------------------// + +/* +ostream& operator<<( ostream& s, QSGFont &font ) + { + s << "(" << font.family << "," << font.size << "," << font.bold << "," << font.italic << "," << font.color << ")"; + return s; + } +*/ + +//-------------------------------------------------------------// +//-------------------------------------------------------------// +//-------------------------------------------------------------// +//-------------------------------------------------------------// + +const QSGLine QSGLine::invisibleLine = QSGLine(QSGLine::Invisible); + +QSGLine::QSGLine() + { + // default fill + style = Solid; + width = 0; +// color = QSGColor( 0, 0, 0 ); + } + +//-------------------------------------------------------------// + +QSGLine::QSGLine( Style init_style ) + { + style = init_style; + width = 0; + } + +//-------------------------------------------------------------// + +bool operator==( const QSGLine& l1, const QSGLine& l2 ) + { + return l1.color == l2.color && + l1.style == l2.style && + l1.width == l2.width ; + } + +//-------------------------------------------------------------// + +bool operator!=( const QSGLine& l1, const QSGLine& l2 ) + { + return !(l1 == l2); + } + +//-------------------------------------------------------------// + +QString toQString( const QSGLine& line ) + { + return QString::number(line.style) + "; " + QString::number(line.width) + "; " + toQString(line.color)+";"; + } + +//-------------------------------------------------------------// + +QSGLine toQSGLine( const QString& string ) + { + QStringList args = QStringList::split( ";", string, TRUE ); + QSGLine result; + result.style = (QSGLine::Style )args[0].toInt(); + result.width = args[1].toInt(); + result.color = toQSGColor(args[2]); + return result; + } + +//-------------------------------------------------------------// + +/* +ostream& operator<<( ostream& s, QSGLine &line ) + { + s << "(" << int(line.style) << "," << line.width << "," << line.color << ")"; + return s; + } +*/ + +//-------------------------------------------------------------// +//-------------------------------------------------------------// +//-------------------------------------------------------------// +//-------------------------------------------------------------// + +QSGPoint::QSGPoint() + { + style = Invisible; + fill = Transparent; + size = 9; + } + +//-------------------------------------------------------------// + +bool operator==( const QSGPoint& p1, const QSGPoint& p2 ) + { + return p1.style == p2.style && p1.fill == p2.fill && p1.size == p2.size && p1.color == p2.color; + } + +//-------------------------------------------------------------// + +bool operator!=( const QSGPoint& p1, const QSGPoint& p2 ) + { + return !operator==(p1,p2); + } + +//-------------------------------------------------------------// + +QString toQString( const QSGPoint& point ) + { + return QString::number(point.style) + "; " + QString::number(point.fill) + "; " + QString::number(point.size) + "; " + toQString(point.color) + ";"; + } + +//-------------------------------------------------------------// + +QSGPoint toQSGPoint( const QString& string ) + { + QStringList args = QStringList::split( ";", string, TRUE ); + QSGPoint result; + result.style = (QSGPoint::Style )args[0].toInt(); + result.fill = (QSGPoint::Fill )args[1].toInt(); + result.size = args[2].toInt(); + result.color = toQSGColor(args[3]); + return result; + } + +//-------------------------------------------------------------// +//-------------------------------------------------------------// + //-------------------------------------------------------------// +//-------------------------------------------------------------// + +QSGArrow::QSGArrow() + { + style = None; + size = 3; + } + +//-------------------------------------------------------------// + +bool operator==( const QSGArrow& a1, const QSGArrow& a2 ) + { + return a1.style == a2.style && a1.size == a2.size; + } + +//-------------------------------------------------------------// + +bool operator!=( const QSGArrow& a1, const QSGArrow& a2 ) + { + return !(a1 == a2); + } + +//-------------------------------------------------------------// + +QString toQString( const QSGArrow& arrow ) + { + return QString::number(arrow.style) + "; " + QString::number(arrow.size) + "; "; + } + +//-------------------------------------------------------------// + +QSGArrow toQSGArrow( const QString& string ) + { + QSGArrow result; + QStringList args = QStringList::split( ";", string, TRUE ); + result.style = (QSGArrow::Style )args[0].toInt(); + result.size = args[1].toInt(); + return result; + + } + +//-------------------------------------------------------------// + +//-----------------------------------------------------------// +//-----------------------------------------------------------// +//-----------------------------------------------------------// +//-----------------------------------------------------------// + + +//-------------------------------------------------------------// + +QString toQString( const QSGGradient& gradient ) + { + return QString::number(gradient.t) + "| " + + toQString(gradient.f[0])+"| " + + toQString(gradient.f[1])+"| " + + toQString(gradient.f[2])+"| " + + toQString(gradient.f[3])+"| " + + toQString(gradient.f[4])+"| "; + } + +//-------------------------------------------------------------// + +QSGGradient toQSGGradient( const QString& string ) + { + QStringList args = QStringList::split( "|", string, TRUE ); + QSGGradient result; + result.t = (QSGGradient::Type )args[0].toInt(); + result.f[0] = toQSGFill(args[1]); + result.f[1] = toQSGFill(args[2]); + result.f[2] = toQSGFill(args[3]); + result.f[3] = toQSGFill(args[4]); + result.f[4] = toQSGFill(args[5]); + return result; + } + +//-----------------------------------------------------------// + +bool operator==( const QSGGradient& g1, const QSGGradient& g2 ) + { + return g1.isEqualTo( g2 ); + } + +//-----------------------------------------------------------// + +bool operator!=( const QSGGradient& g1, const QSGGradient& g2 ) + { + return !g1.isEqualTo( g2 ); + } + + +//-------------------------------------------------------------// + +QSGGradient::QSGGradient( Type init_t ) + { + t = init_t; + set_default_colors(); + } + +//-------------------------------------------------------------// + +QSGGradient::QSGGradient( const QSGFill& f0, const QSGFill& f4 ) + { + f[0] = f0; + f[4] = f4; + t = GTwoColors; + } + +//-------------------------------------------------------------// + +QSGGradient::QSGGradient( const QSGFill& f0, const QSGFill& f1, const QSGFill& f2, const QSGFill& f3, const QSGFill& f4, Type init_t ) + { + t = init_t; + set_default_colors(); + if ( t == GFiveColors || t == GTwoColors ) { + f[0] = f0; + f[1] = f1; + f[2] = f2; + f[3] = f3; + f[4] = f4; + } + } + +//-------------------------------------------------------------// + +QSGGradient::~QSGGradient() + { + } + + //-------------------------------------------------------------// + +QSGFill& QSGGradient::fill( double level, QSGFill& result ) const + { + level = QMAX( level, 0.0 ); + level = QMIN( level, 1.0 ); + + if ( t == GTwoColors || t == GGray ) { + result.style = level < 0.5 ? f[0].style : f[4].style; + result.color.r = (unsigned char )(f[0].color.r + level * ( f[4].color.r - f[0].color.r )); + result.color.g = (unsigned char )(f[0].color.g + level * ( f[4].color.g - f[0].color.g )); + result.color.b = (unsigned char )(f[0].color.b + level * ( f[4].color.b - f[0].color.b )); + result.color.a = (unsigned char )(f[0].color.a + level * ( f[4].color.a - f[0].color.a ));; + } else { + int temp = (int )floor( level * 4.0 * 256.0 + 0.5 ); + + unsigned int level = (unsigned int )QMIN( QMAX(temp, 0), 4*256 ); + unsigned int col_num = level >> 8; // divide by 256 + unsigned int col_rem = level & 0x0ff; // remainder 0-255 + + result.style = f[col_num].style; + const QSGColor& c0 = f[col_num].color; + const QSGColor& c1 = f[QMIN(col_num+1,4)].color; + + // interpolate colors + result.color.r = ( c0.r * (256U - col_rem) + c1.r * col_rem ) >> 8; + result.color.g = ( c0.g * (256U - col_rem) + c1.g * col_rem ) >> 8; + result.color.b = ( c0.b * (256U - col_rem) + c1.b * col_rem ) >> 8; + result.color.a = ( c0.a * (256U - col_rem) + c1.a * col_rem ) >> 8; + } + + return result; + } + +//-------------------------------------------------------------// + +bool QSGGradient::isEqualTo( const QSGGradient& gradient ) const + { + if ( gradient.fill(0) == f[0] && + gradient.fill(1) == f[1] && + gradient.fill(2) == f[2] && + gradient.fill(3) == f[3] && + gradient.fill(4) == f[4] && + gradient.type() == t ) return true; + return false; + } + +//-------------------------------------------------------------// + +void QSGGradient::set_default_colors() + { + if ( t == GTwoColors || t == GGray ) { + f[0].color.set( 128, 128, 128 ); + f[4].color.set( 240, 240, 240 ); + } + else if ( t == GFiveColors || t == GDefault ) { + f[0].color.set( 0, 0, 128 ); + f[1].color.set( 0, 128, 0 ); + f[2].color.set( 255, 0, 0 ); + f[3].color.set( 255, 160, 0 ); + f[4].color.set( 255, 255, 196 ); + } + else if ( t == GStrange ) { + f[0].color.set( 128, 0, 128 ); + f[1].color.set( 128, 128, 0 ); + f[2].color.set( 0, 255, 0 ); + f[3].color.set( 0, 255, 255 ); + f[4].color.set( 255, 255, 255 ); + } + } + + +//-------------------------------------------------------------// + /** + * Gradient + * @author Kamil Dobkowski + +class QSGGradient : public QSGAttr { + public: + QSGGradient() {} + virtual ~QSGGradient() {}; + virtual QSGFill& fill( double level, QSGFill& fill ) const; + virtual bool isEqualTo( const QSGGradient& gradient ) const; + friend bool operator==( const QSGGradient&, const QSGGradient& ); + friend bool operator!=( const QSGGradient&, const QSGGradient& ); + }; +*/ + diff --git a/kmatplot/widgets/qsgattr.h b/kmatplot/widgets/qsgattr.h new file mode 100644 index 0000000..0782c71 --- /dev/null +++ b/kmatplot/widgets/qsgattr.h @@ -0,0 +1,299 @@ +/*************************************************************************** + qsgattr.h + ------------------- + begin : 01-January-2000 + copyright : (C) 2000 by Kamil Dobkowski + email : kamildobk@poczta.onet.pl + ***************************************************************************/ + +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + + +#ifndef QSGATTRIBUTE_H +#define QSGATTRIBUTE_H + +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + +#include<qnamespace.h> +#include<qstring.h> +#include<qdom.h> + +/** + * \brief Base class for all graphics attributes. + * @author Kamil Dobkowski + */ +class QSGAttr {}; + +//-------------------------------------------------------------// + +/** + * \brief Color definition. + * @author Kamil Dobkowski + */ +class QSGColor : public QSGAttr { + public: + unsigned char r; + unsigned char g; + unsigned char b; + unsigned char a; + /** + * Creates a black color. + */ + QSGColor(); + QSGColor( unsigned char red, + unsigned char green, + unsigned char blue, + unsigned char alpha = 255U ); + const QSGColor &set( unsigned char red, + unsigned char green, + unsigned char blue, + unsigned char alpha = 255U ); + friend bool operator==( const QSGColor&, const QSGColor& ); + friend bool operator!=( const QSGColor&, const QSGColor& ); + friend QString toQString( const QSGColor& a ); + friend QSGColor toQSGColor( const QString& s ); + }; + + //-------------------------------------------------------------// + +/** + * \brief Font definition. + * @author Kamil Dobkowski + */ +class QSGFont : public QSGAttr { + public: + QString family; + int size; // points + bool bold; + bool italic; + QSGColor color; + /** + * Creates "helvetica" 10pts, black font. + */ + QSGFont(); + QSGFont( const QSGFont& f ); + void operator=( const QSGFont& f ); + friend bool operator==( const QSGFont&, const QSGFont& ); + friend bool operator!=( const QSGFont&, const QSGFont& ); + friend QString toQString( const QSGFont& font ); + friend QSGFont toQSGFont( const QString& string ); + }; + +//-------------------------------------------------------------// + +/** + * \brief Line style definition. + * @author Kamil Dobkowski + */ +class QSGLine : public QSGAttr { + + public: + static const QSGLine invisibleLine; + + /** Line type. */ + enum Style { Invisible = Qt::NoPen, + Solid = Qt::SolidLine, + Dash = Qt::DashLine, + DashDot = Qt::DashDotLine, + Dot = Qt::DotLine, + DashDotDot = Qt::DashDotDotLine }; + Style style; + int width; + QSGColor color; + + /** + * Creates a solid, black, 0-width line. + */ + QSGLine(); + QSGLine( Style style ); + friend bool operator==( const QSGLine&, const QSGLine& ); + friend bool operator!=( const QSGLine&, const QSGLine& ); + friend QString toQString( const QSGLine& line ); + friend QSGLine toQSGLine( const QString& string ); + }; + + + +//-------------------------------------------------------------// + +/** + * \brief Fill definition. + * @author Kamil Dobkowski + */ +class QSGFill : public QSGAttr { + + public: + + static const QSGFill transparentFill; + + /** Fill style. */ + enum Style { Transparent = Qt::NoBrush, + Solid = Qt::SolidPattern, + Horiz = Qt::HorPattern, + Vert = Qt::VerPattern, + Cross = Qt::CrossPattern, + BDiag = Qt::BDiagPattern, + FDiag = Qt::FDiagPattern, + DiagCross = Qt::DiagCrossPattern, + Half = Qt::Dense5Pattern }; + + Style style; + QSGColor color; + + /** + * Creates a solid, white fill. + */ + QSGFill(); + QSGFill( Style style ); + friend bool operator==( const QSGFill&, const QSGFill& ); + friend bool operator!=( const QSGFill&, const QSGFill& ); + friend QString toQString( const QSGFill& fill ); + friend QSGFill toQSGFill( const QString& string ); + }; + + + +//-------------------------------------------------------------// + +/** + * \brief Point mark style definition + * @author Kamil Dobkowski + */ +class QSGPoint : public QSGAttr { + + public: + + enum Style { Invisible = 0, + Circle, + Rect, + Triangle, + Diamond, + Cross, + Plus, + HLine, + VLine + }; + enum Fill { + Transparent = 0, + Opaque, + Filled + }; + + Style style; + Fill fill; + int size; // points + QSGColor color; + + /** + * Creates black point, with size 5 and style - Invisible. + */ + QSGPoint(); + friend bool operator==( const QSGPoint&, const QSGPoint& ); + friend bool operator!=( const QSGPoint&, const QSGPoint& ); + friend QString toQString( const QSGPoint& point ); + friend QSGPoint toQSGPoint( const QString& string ); + }; + +//-------------------------------------------------------------// + +/** + * \brief Arrow dart style definition + * @author Kamil Dobkowski + */ +class QSGArrow: public QSGAttr { + + public: + + /** + * Arrow style. 'F' - filled, 'R' - reversed, 'N' - narrow. + */ + enum Style { None = 0, + Arrow = 1, + FArrow = 2, + NArrow = 3, + RArrow = 4, + RFArrow = 5, + RNArrow = 6, + Rect = 7, + Diamond = 8, + Circle = 9, + Line = 10, + FDiagLine = 11, + BDiagLine = 12 + }; + int style; + int size; + + /** + * Creates an arrow with size 5 and style - None. + */ + QSGArrow(); + + friend bool operator==( const QSGArrow&, const QSGArrow& ); + friend bool operator!=( const QSGArrow&, const QSGArrow& ); + friend QString toQString( const QSGArrow& arrow ); + friend QSGArrow toQSGArrow( const QString& string ); + }; + +//-------------------------------------------------------------// + +/** + * \brief Gradient style definition + * + * Gradient is an object which returns a fill style for each parameter value between 0.0 and 1.0, see fill() + *@author kamil + */ +class QSGGradient : public QSGAttr { + + public: + enum Type { GDefault, GGray, GStrange, GTwoColors, GFiveColors }; + + QSGGradient( Type t = GDefault ); + QSGGradient( const QSGFill& f0, + const QSGFill& f4 ); + QSGGradient( const QSGFill& f0, + const QSGFill& f1, + const QSGFill& f2, + const QSGFill& f3, + const QSGFill& f4, + Type t = GFiveColors ); + virtual ~QSGGradient(); + /** + * Sets 'fill' argument to some fill style for level values between 0.0 and 1.0. + * Returns 'fill' + */ + virtual QSGFill& fill( double level, QSGFill& fill ) const; + virtual bool isEqualTo( const QSGGradient& gradient ) const; + + QSGFill fill( int nr ) const { return f[nr]; } + Type type() const { return t; } + friend bool operator==( const QSGGradient&, const QSGGradient& ); + friend bool operator!=( const QSGGradient&, const QSGGradient& ); + friend QString toQString( const QSGGradient& arrow ); + friend QSGGradient toQSGGradient( const QString& string ); + protected: + + Type t; + QSGFill f[5]; + bool m_all_colors; + void set_default_colors(); + }; + + +//-------------------------------------------------------------// + +#endif + + + + + diff --git a/kmatplot/widgets/qsgraphicaldata.cpp b/kmatplot/widgets/qsgraphicaldata.cpp new file mode 100644 index 0000000..28d0f6a --- /dev/null +++ b/kmatplot/widgets/qsgraphicaldata.cpp @@ -0,0 +1,393 @@ +/*************************************************************************** + qgraphicsldata.cpp + ------------------- + begin : 01-January-2001 + + copyright : (C) 2001 by Kamil Dobkowski + email : kamildobk@poczta.onet.pl + ***************************************************************************/ + +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + +#include "qsgraphicaldata.h" + +//-------------------------------------------------------------// + +QSGraphicalData::QSGraphicalData( QObject *parent, QSGraphicalData *parentObject, const char * name ) +:QSData( parent, parentObject, name ) + { + m_parent_base_object = parentObject; + m_channels_count = 0; + m_channels = NULL; + m_settings.lines = NULL; + m_settings.fills = NULL; + m_settings.fonts = NULL; + m_settings.points = NULL; + m_settings.lines_count = 0; + m_settings.fills_count = 0; + m_settings.fonts_count = 0; + m_settings.points_count = 0; + } + +//-------------------------------------------------------------// + +QSGraphicalData::~QSGraphicalData() + { + int i; + for ( i=0; i< m_channels_count; i++ ) delete m_channels[i]; + delete[] m_settings.lines; + delete[] m_settings.fills; + delete[] m_settings.fonts; + delete[] m_settings.points; + } + +//-------------------------------------------------------------// + +void QSGraphicalData::setTitle( const QString& new_title ) + { + if ( m_title_str != new_title ) { + parametersChanging(); + m_title_str = new_title; + emit sigTitleChanged( m_title_str ); + parametersChanged(); + } + } +//-------------------------------------------------------------// + +void QSGraphicalData::initChannelTable( int channels_num ) + { + m_channels_count = channels_num; + m_channels = new QSMatrix*[m_channels_count]; + for ( int i=0; i<m_channels_count; i++ ) m_channels[i] = NULL; + } + +//-------------------------------------------------------------// + +void QSGraphicalData::initAttributeTables( int fonts_num, int fills_num, int lines_num, int points_num ) + { + m_settings.fonts_count = fonts_num; + m_settings.fills_count = fills_num; + m_settings.lines_count = lines_num; + m_settings.points_count = points_num; + m_settings.fonts = new QSGFont[fonts_num]; + m_settings.fills = new QSGFill[fills_num]; + m_settings.lines = new QSGLine[lines_num]; + m_settings.points = new QSGPoint[points_num]; + } + +//-------------------------------------------------------------// + +bool QSGraphicalData::setMatrix( int channel, QSMatrix *m ) + { + if ( channel >= 0 && channel < m_channels_count ) { + dataChanging(channel); + delete m_channels[channel]; + m_channels[channel] = m; + if ( m ) m->setDataObject( this, channel ); + dataChanged(channel); + return true; + } + return false; + } + +//-------------------------------------------------------------// + +QSMatrix *QSGraphicalData::matrix( int channel ) const + { + return channel < m_channels_count ? m_channels[channel] : NULL; + } + +//-------------------------------------------------------------// + +QSMatrix *QSGraphicalData::takeMatrix( int channel, QSMatrix *newMatrix ) + { + if ( channel >= 0 && channel < m_channels_count && m_channels[channel] != newMatrix ) { + dataChanging(channel); + QSMatrix *result = m_channels[channel]; + if ( result ) result->setDataObject( NULL, -1 ); + m_channels[channel] = newMatrix; + if ( newMatrix ) newMatrix->setDataObject( this, channel ); + dataChanged(channel); + return result; + } + return NULL; + } + +//-------------------------------------------------------------// + +void QSGraphicalData::deleteMatrix( int channel ) + { + if ( channel >=0 && channel < m_channels_count && m_channels[channel] ) { + dataChanging(channel); + delete m_channels[channel]; + m_channels[channel] = NULL; + dataChanged(channel); + } + } + +//-------------------------------------------------------------// + +bool QSGraphicalData::isChannel( int channel ) const + { + if (channel<m_channels_count ) + if ( m_channels[channel] != NULL ) + if ( m_channels[channel]->cols() > 0 && + m_channels[channel]->rows() > 0 ) return true; + return false; + } + +//-------------------------------------------------------------// + +void QSGraphicalData::setFont( int e, const QSGFont &font ) + { + if ( e >= 0 && e < m_settings.fonts_count && m_settings.fonts[e] != font ) { + parametersChanging(); + m_settings.fonts[e] = font; + parametersChanged(); + } + } + +//-------------------------------------------------------------// + +void QSGraphicalData::setFill( int e, const QSGFill &fill ) + { + if ( e >= 0 && e < m_settings.fills_count && m_settings.fills[e] != fill ) { + parametersChanging(); + m_settings.fills[e] = fill; + parametersChanged(); + } + } + +//-------------------------------------------------------------// + +void QSGraphicalData::setLine( int e, const QSGLine &line ) + { + if ( e >= 0 && e < m_settings.lines_count && m_settings.lines[e] != line ) { + parametersChanging(); + m_settings.lines[e] = line; + parametersChanged(); + } + } + +//-------------------------------------------------------------// + +void QSGraphicalData::setPoint( int e, const QSGPoint &point ) + { + if ( e >= 0 && e < m_settings.points_count && m_settings.points[e] != point ) { + parametersChanging(); + m_settings.points[e] = point; + parametersChanged(); + } + } + +//-------------------------------------------------------------// + +void QSGraphicalData::parametersChanging() + { + if ( m_parent_base_object ) m_parent_base_object->parametersChanging(); + } + +//-------------------------------------------------------------// + +void QSGraphicalData::parametersChanged() + { + if ( m_parent_base_object ) m_parent_base_object->parametersChanged(); + } + +//-------------------------------------------------------------// + +QSGFont QSGraphicalData::fontFromData( QSMatrix *source, int row, int start_col, const QSGFont& default_value ) + { + QSGFont result = default_value; + if ( source && source->rows() > row ) { + int cols = source->cols() - start_col; + if ( cols>0 && !source->string(row,start_col+0).isEmpty() ) result.family = source->string(row,start_col+0); + if ( cols>1 && !source->string(row,start_col+1).isEmpty() ) result.size = (int )source->value(row,start_col+1); + if ( cols>2 && !source->string(row,start_col+2).isEmpty() ) result.bold = (bool )source->value(row,start_col+2); + if ( cols>3 && !source->string(row,start_col+3).isEmpty() ) result.italic = (bool )source->value(row,start_col+3); + result.color = colorFromData( source, row, start_col+4, result.color ); + } + return result; + } + +//-------------------------------------------------------------// + +QSGFill QSGraphicalData::fillFromData( QSMatrix *source, int row, int start_col, const QSGFill& default_value ) + { + QSGFill result = default_value; + if ( source && source->rows() > row ) { + int cols = source->cols() - start_col; + if ( cols>0 && !source->string(row,start_col+0).isEmpty() ) result.style = (QSGFill::Style )(long)source->value(row,start_col+0); + result.color = colorFromData( source, row, start_col+1, result.color ); + } + return result; + } + +//-------------------------------------------------------------// + +QSGLine QSGraphicalData::lineFromData( QSMatrix *source, int row, int start_col, const QSGLine& default_value ) + { + QSGLine result = default_value; + if ( source && source->rows() > row ) { + int cols = source->cols() - start_col; + if ( cols>0 && !source->string(row,start_col+0).isEmpty() ) result.style = (QSGLine::Style )(long)source->value(row,start_col+0); + if ( cols>1 && !source->string(row,start_col+1).isEmpty() ) result.width = (int )source->value(row,start_col+1); + result.color = colorFromData( source, row, start_col+2, result.color ); + } + return result; + } + +//-------------------------------------------------------------// + +QSGPoint QSGraphicalData::pointFromData( QSMatrix *source, int row, int start_col, const QSGPoint& default_value ) + { + QSGPoint result = default_value; + if ( source && source->rows() > row ) { + int cols = source->cols() - start_col; + if ( cols>0 && !source->string(row,start_col+0).isEmpty() ) result.style = (QSGPoint::Style )(long)source->value(row,start_col+0); + if ( cols>1 && !source->string(row,start_col+1).isEmpty() ) result.fill = (QSGPoint::Fill )(long)source->value(row,start_col+1); + if ( cols>2 && !source->string(row,start_col+2).isEmpty() ) result.size = (int )source->value(row,start_col+2); + result.color = colorFromData( source, row, start_col+3, result.color ); + } + return result; + } + +//-------------------------------------------------------------// + +QSGArrow QSGraphicalData::arrowFromData( QSMatrix *source, int row, int start_col, const QSGArrow& default_value ) + { + QSGArrow result = default_value; + if ( source && source->rows() > row ) { + int cols = source->cols() - start_col; + if ( cols>0 && !source->string(row,start_col+0).isEmpty() ) result.style = (QSGArrow::Style )(long)source->value(row,start_col+0); + if ( cols>1 && !source->string(row,start_col+1).isEmpty() ) result.size = (int )source->value(row,start_col+1); + } + return result; + } + +//-------------------------------------------------------------// + +QSGColor QSGraphicalData::colorFromData( QSMatrix *source, int row, int start_col, const QSGColor& default_value ) + { + QSGColor result = default_value; + if ( source && source->rows() > row ) { + int cols = source->cols() - start_col; + if ( cols>0 && !source->string(row,start_col+0).isEmpty() ) result.r = (unsigned char )source->value(row,start_col+0); + if ( cols>1 && !source->string(row,start_col+1).isEmpty() ) result.g = (unsigned char )source->value(row,start_col+1); + if ( cols>2 && !source->string(row,start_col+2).isEmpty() ) result.b = (unsigned char )source->value(row,start_col+2); + if ( cols>3 && !source->string(row,start_col+3).isEmpty() ) result.a = (unsigned char )source->value(row,start_col+3); + } + return result; + } + +//-------------------------------------------------------------// + +QSGraphicalData::ColumnType QSGraphicalData::fontColumnFormat( int column ) + { + switch( column ) { + case 0: return ColumnFontFamily; + case 1: return ColumnSize; + case 2: return ColumnFontBold; + case 3: return ColumnFontItalic; + default: return colorColumnFormat( column-4 ); + } + } + +//-------------------------------------------------------------// + +QSGraphicalData::ColumnType QSGraphicalData::fillColumnFormat( int column ) + { + switch( column ) { + case 0: return ColumnFillStyle; + default: return colorColumnFormat( column-1 ); + } + } + +//-------------------------------------------------------------// + +QSGraphicalData::ColumnType QSGraphicalData::lineColumnFormat( int column ) + { + switch( column ) { + case 0: return ColumnLineStyle; + case 1: return ColumnWidth; + default: return colorColumnFormat( column-2 ); + } + } + +//-------------------------------------------------------------// + +QSGraphicalData::ColumnType QSGraphicalData::pointColumnFormat( int column ) + { + switch( column ) { + case 0: return ColumnPointStyle; + case 1: return ColumnPointFill; + case 2: return ColumnSize; + default: return colorColumnFormat( column-3 ); + } + } + +//-------------------------------------------------------------// + +QSGraphicalData::ColumnType QSGraphicalData::arrowColumnFormat( int column ) + { + switch( column ) { + case 0: return ColumnArrowStyle; + case 1: return ColumnSize; + default: return ColumnUnknown; + } + } + +//-------------------------------------------------------------// + +QSGraphicalData::ColumnType QSGraphicalData::colorColumnFormat( int column ) + { + switch( column ) { + case 0: return ColumnRed; + case 1: return ColumnGreen; + case 2: return ColumnBlue; + case 3: return ColumnAlpha; + default: return ColumnUnknown; + } + } + +//-------------------------------------------------------------// + +void QSGraphicalData::loadStateFromStream( QDataStream& stream, QSObjectFactory *factory ) + { + QSData::loadStateFromStream( stream, factory ); + QString data; + // load fonts + for( int i=0; i<fontCount(); i++ ) { stream >> data; setFont( i, toQSGFont(data) ); } + // load fills + for( int i=0; i<fillCount(); i++ ) { stream >> data; setFill( i, toQSGFill(data) ); } + // load lines + for( int i=0; i<lineCount(); i++ ) { stream >> data; setLine( i, toQSGLine(data) ); } + // load points + for( int i=0; i<pointCount(); i++ ) { stream >> data; setPoint( i, toQSGPoint(data) ); } + } + +//-------------------------------------------------------------// + +void QSGraphicalData::saveStateToStream( QDataStream& stream, QSObjectFactory *factory ) + { + QSData::saveStateToStream( stream, factory ); + // save fonts + for( int i=0; i<fontCount(); i++ ) stream << toQString(font(i)); + // save fills + for( int i=0; i<fillCount(); i++ ) stream << toQString(fill(i)); + // save lines + for( int i=0; i<lineCount(); i++ ) stream << toQString(line(i)); + // save points + for( int i=0; i<pointCount(); i++ ) stream << toQString(point(i)); + } + + + + diff --git a/kmatplot/widgets/qsgraphicaldata.h b/kmatplot/widgets/qsgraphicaldata.h new file mode 100644 index 0000000..ef233b1 --- /dev/null +++ b/kmatplot/widgets/qsgraphicaldata.h @@ -0,0 +1,268 @@ +/*************************************************************************** + qgraphicaldata.h + ------------------- + version : 0.2 + begin : 01-January-2001 + copyright : (C) 2000 by Kamil Dobkowski + email : kamildobk@poczta.onet.pl + ***************************************************************************/ + +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + + +#ifndef QSGRAPHICALDATA_H +#define QSGRAPHICALDATA_H + +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + +#include"qsdata.h" + +#define SET_PROPERTY( property, new_value ) if ((property)!=(new_value)) { parametersChanging(); (property)=(new_value); parametersChanged(); } + +/** + * \brief Data object which holds a set of graphics attributes such as fonts, fills, line styles etc. + * + * See new functions : setFill(), setFont(), setLine(), setPoint(). + * Contains also implementation of the QSData interface. + * @author Kamil Dobkowski + */ +class QSGraphicalData : public QSData + { + Q_OBJECT + Q_PROPERTY( QString title READ title WRITE setTitle ) + + public: + /** + * Constructor + */ + QSGraphicalData( QObject *parent=0, QSGraphicalData *parentObject=0, const char *name=0 ); + /** + * Destructor. + */ + virtual ~QSGraphicalData(); + /** + * Sets a plot title. + */ + void setTitle( const QString& title ); + /** + * Returns title. + */ + QString title() const { return m_title_str; } + /** + * Sets a new matrix as the given channel in the plot. + */ + virtual bool setMatrix( int channel, QSMatrix *m ); + /** + * Returns matrix 'channel' if any, or NULL. + * Notice that you should not operate on it during drawing ( see QSAxes::state ) + * because this affects internal iterator positions in those matrices. + */ + virtual QSMatrix *matrix( int channel ) const; + /** + * Deletes the choosen matrix. + */ + virtual void deleteMatrix( int channel ); + /** + * Return matrix and sets data to NULL. + */ + virtual QSMatrix *takeMatrix( int channel, QSMatrix *newMatrix ); + /** + * Returns the total number of channels. + */ + int channelCount() const { return m_channels_count; } + /** + * Returns value at the position (x, y) from the channel 'channel'. + * You have to pass correct arguments to this function because + * it does not perform any channel or range checking. + */ + inline double value( int row, int col, int channel ) { return m_channels[channel]->value(row,col); } + /** + * Returs the height of the choosen matrix or 0 if it is not set. + */ + int matrixRows( int channel ) const { return channel<m_channels_count?(m_channels[channel]?m_channels[channel]->rows():0):0; } + /** + * Returs the width of the choosen matrix or 0 if it is not set. + */ + int matrixCols( int channel ) const { return channel<m_channels_count?(m_channels[channel]?m_channels[channel]->cols():0):0; } + /** + * Returns 'true' if matrix at the given channel exist. + */ + bool isChannel( int channel ) const; + /** + * Sets the font for the 'e' element. + */ + void setFont( int e, const QSGFont &font ); + /** + * Sets the fill for the 'e' element. + */ + void setFill( int e, const QSGFill &fill ); + /** + * Set a line style for the 'e' element. + */ + void setLine( int e, const QSGLine &line ); + /** + * Set a point style for the 'e' element. + */ + void setPoint( int e, const QSGPoint &point ); + /** + * Returns a font style of the given element + */ + QSGFont font( int e ) const { return e<m_settings.fonts_count?m_settings.fonts[e]:QSGFont(); } + /** + * Returns a fill style of the given element + */ + QSGFill fill( int e ) const { return e<m_settings.fills_count?m_settings.fills[e]:QSGFill(); } + /** + * Returns a point style of the given element + */ + QSGLine line( int e ) const { return e<m_settings.lines_count?m_settings.lines[e]:QSGLine(); } + /** + * Returns a point style of the given element + */ + QSGPoint point( int e ) const { return e<m_settings.points_count?m_settings.points[e]:QSGPoint(); } + /** + * Returns the total number of font elements. + */ + int fontCount() const { return m_settings.fonts_count; } + /** + * Returns the total number of fill elements. + */ + int fillCount() const { return m_settings.fills_count; } + /** + * Returns the total number of line elements. + */ + int lineCount() const { return m_settings.lines_count; } + /** + * Returns the total number of points elements. + */ + int pointCount() const { return m_settings.points_count; } + /** + * Restores all graphics atributes + */ + virtual void loadStateFromStream( QDataStream& stream, QSObjectFactory *factory ); + /** + * Saves all graphics attributes + */ + virtual void saveStateToStream( QDataStream& stream, QSObjectFactory *factory ); + + signals: + /** + * Title has changed. + */ + void sigTitleChanged( const QString& newTitle ); + + protected: + /** + * Reads font from matrix. Row formst is [ family(text), size, bold, italic, red, green. blue, alpha ) ] + */ + static QSGFont fontFromData( QSMatrix *source, int row, int start_col, const QSGFont& default_value ); + /** + * Reads fill style from matrix. Row format is [ style, red, green, blue, alpha ] + */ + static QSGFill fillFromData( QSMatrix *source, int row, int start_col, const QSGFill& default_value ); + /** + * Reads a line style from matrix. Row format is [ style, width, red, green, blue, alpha ] + */ + static QSGLine lineFromData( QSMatrix *source, int row, int start_col, const QSGLine& default_value ); + /** + * Reads a point form matrix. Row format is [ style, fill, size, red, green, blue, alpha ] + */ + static QSGPoint pointFromData( QSMatrix *source, int row, int start_col, const QSGPoint& default_value ); + /** + * Reads an arrow style from matrix. Row format is [ style, size ] + */ + static QSGArrow arrowFromData( QSMatrix *source, int row, int start_col, const QSGArrow& default_value ); + /** + * Reads a color from matrix. Row format is [ red, green, blue, alpha ] + */ + static QSGColor colorFromData( QSMatrix *source, int row, int start_col, const QSGColor& default_value ); + /** + * Standard column types for font. See fontFromData(). + */ + static ColumnType fontColumnFormat( int column ); + /** + * Standard column types for font. See fillFromData(). + */ + static ColumnType fillColumnFormat( int column ); + /** + * Standard column types for font. See lineFromData(). + */ + static ColumnType lineColumnFormat( int column ); + /** + * Standard column types for point. See pointFromData(). + */ + static ColumnType pointColumnFormat( int column ); + /** + * Standard column types for arrow. See arrowFromData(). + */ + static ColumnType arrowColumnFormat( int column ); + /** + * Standard column types for font. See colorFromData(). + */ + static ColumnType colorColumnFormat( int column ); + + /** + * Allocates memory for channels + */ + void initChannelTable( int channels_num ); + /** + * Allocates memory for fonts, fills, ... tables. + */ + void initAttributeTables( int fonts_num, int fills_num, int lines_num, int points_num ); + /** + * This function is called before any parameter change. + * This function can be reimplemented but unfortunately there is no + * information, which parameter has changed. + * It informs derived classes to stop the drawing process. + * Default implementation calls parent->paremerersChanging() + */ + virtual void parametersChanging(); + /** + * This function is called after any parameter change. + * This function can be reimplemented but unfortunately there is no + * information, which parameter has changed. + * It informs derived classes that they should repaint themselves. + * Default implementation calls parent->parametersChanging(); + */ + virtual void parametersChanged(); + /** + * Calculates a logarithm of value 'value'. + * Fix it to remember log10(logBase); + */ + double _log( double value, double logBase = 10.0 ) { return log10(value)/log10(logBase); } + /** + * fonts, fills and lines styles + */ + struct settings_t { + QSGFont *fonts; + QSGFill *fills; + QSGLine *lines; + QSGPoint *points; + int fonts_count; + int fills_count; + int lines_count; + int points_count; + } m_settings; + + /** + * list of matrices + */ + QSMatrix **m_channels; + int m_channels_count; + + QString m_title_str; + QSGraphicalData *m_parent_base_object; + }; + +#endif + + diff --git a/kmatplot/widgets/qsimage.cpp b/kmatplot/widgets/qsimage.cpp new file mode 100644 index 0000000..305ffd3 --- /dev/null +++ b/kmatplot/widgets/qsimage.cpp @@ -0,0 +1,663 @@ +/*************************************************************************** + qsimage.cpp + ------------------- + begin : 01-January-2000 + copyright : (C) 2000 by Kamil Dobkowski + email : kamildobk@poczta.onet.pl + ***************************************************************************/ + +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + + +#include "qsimage.h" +#include <math.h> +#include <assert.h> + +struct QSImage::image_runtime_data { + enum Type { RGBImage, GrayImage, IndexedImage } type; + struct { + QSPt2 p1; + QSPt2 p2; + } rarea; // area to refresh + int pi; + int pj; + int lines; + int curr_x_index; + int curr_y_index; + QSAxis *xaxis; + QSAxis *yaxis; + QSAxis *vaxis; + QSMatrix *rm; + QSMatrix *gm; + QSMatrix *bm; + QSMatrix *pm; + int w, h, ph; + int *xbuff; + int *ybuff; + bool is_x_vector; + bool is_y_vector; + QSGFill fill; + QSDrv::PixmapBuffer buff; + }; + +#define CHANNELS_NUM 6 + +//-------------------------------------------------------------// + +QSImage::QSImage(QSAxes* parent, const char * name) +:QSPlot2D(parent,name) + { + assert( parent ); + m_use_gradient = true; + m_axes = parent; + m_evalid = false; + m_rawmode = false; + m_title_str = tr("Untitled image"); + m_dmin = 0.0; + m_dmax = 0.0; + initChannelTable( CHANNELS_NUM ); + initAttributeTables( 0, 0, 0, 0 ); + } + +//-------------------------------------------------------------// + +QSImage::~QSImage() + { + } + +//-------------------------------------------------------------// + +void QSImage::setUseGradient( bool enable ) + { + if ( m_use_gradient != enable ) { + parametersChanging(); + m_use_gradient = enable; + parametersChanged(); + } + } + +//-------------------------------------------------------------// + +void QSImage::setRawMode( bool enabled ) + { + if ( m_rawmode != enabled ) { + parametersChanging(); + m_rawmode = enabled; + m_evalid = false; + parametersChanged(); + } + } + +//-------------------------------------------------------------// + +void QSImage::allocRuntimeData() + { + QSPlot2D::allocRuntimeData(); + d = new image_runtime_data(); + d->is_x_vector = false; + d->is_y_vector = false; + d->xbuff = NULL; + d->ybuff = NULL; + d->pi = 0; + d->pj = 0; + d->xaxis = defaultAxis(QSAxis::XAxisType); + d->yaxis = defaultAxis(QSAxis::YAxisType); + d->vaxis = defaultAxis(QSAxis::VAxisType); + d->w = matrixCols( DataRed ); + d->h = matrixRows( DataRed ); + d->ph = matrixRows( Palette ); + d->rm = matrix( DataRed ); + d->gm = matrix( DataGreen ); + d->bm = matrix( DataBlue ); + d->pm = matrix( Palette ); + + // detect image type + d->type = image_runtime_data::GrayImage; + + if ( matrixCols( Palette ) == 3 && + matrixRows( Palette ) > 0 ) d->type = image_runtime_data::IndexedImage; + if ( matrixCols( DataGreen ) == d->w && + matrixRows( DataGreen ) == d->h && + matrixCols( DataBlue ) == d->w && + matrixRows( DataBlue ) == d->h ) d->type = image_runtime_data::RGBImage; + + if ( matrixCols( XVector ) == d->w+1 && + matrixRows( XVector ) > 0 ) d->is_x_vector = true; + else d->is_x_vector = false; + + if ( matrixRows( YVector ) == d->h+1 && + matrixCols( YVector ) > 0 ) d->is_y_vector = true; + else d->is_y_vector = false; + + + if ( m_rawmode ) { m_dmin = 0.0; m_dmax = 255.0; m_evalid = true; } + } + +//-------------------------------------------------------------// + +void QSImage::freeRuntimeData() + { + delete[] d->xbuff; d->xbuff = NULL; + delete[] d->ybuff; d->ybuff = NULL; + delete d; d = NULL; + QSPlot2D::freeRuntimeData(); + } + +//-------------------------------------------------------------// + +bool QSImage::getAxisRange( QSAxis *axis, double& min, double& max ) + { + allocRuntimeData(); + if ( d->w == 0 || d->h == 0 ) { freeRuntimeData(); return false; } + + if ( !m_evalid ) { + for( int j=0; j<d->h; j++ ) { + for( int i=0; i<d->w; i++ ) { + double vmax; + double vmin; + vmax = vmin = value(j,i,DataRed); + if ( d->type == image_runtime_data::RGBImage ) { + double vg = value( j, i, DataGreen ); + double vb = value( j, i, DataBlue ); + vmax = QMAX( vmax, QMAX( vg, vb ) ); + vmin = QMIN( vmin, QMIN( vg, vb ) ); + } + if ( i == 0 && j == 0 ) { + m_dmax = vmax; + m_dmin = vmin; + } else { + m_dmin = QMIN( m_dmin, vmin ); + m_dmax = QMAX( m_dmax, vmax ); + } + } // for ( i= .. + } // for ( j= ... + m_evalid = true; + } + + double xmin = d->is_x_vector ? matrix(XVector)->value(0,0) : 0.0; + double xmax = d->is_x_vector ? matrix(XVector)->value(0,d->w) : d->w; + double ymin = d->is_y_vector ? matrix(YVector)->value(0,0) : 0.0; + double ymax = d->is_y_vector ? matrix(YVector)->value(d->h,0) : d->h; + if ( xmin > xmax ) { double xtemp = xmin; xmin = xmax; xmax = xtemp; } + if ( ymin > ymax ) { double ytemp = ymin; ymin = ymax; ymax = ytemp; } + + if ( axis == d->xaxis ) { min = xmin; max = xmax; } + else if ( axis == d->yaxis ) { min = ymin; max = ymax; } + else if ( axis == d->vaxis && m_rawmode ) { min = 0.0; max = 255.0; } + else if ( axis == d->vaxis && !m_rawmode ) { min = m_dmin; max = m_dmax; } + else { freeRuntimeData(); return false; } + + freeRuntimeData(); + return true; + } + +//-------------------------------------------------------------// + +bool QSImage::start() + { + QSPlot2D::start(); + + if ( !init_buffers() ) return false; + + // Init loops + d->pi = d->rarea.p1.x; + d->pj = d->rarea.p1.y; + d->curr_x_index = -999999; // see set_rgb + d->curr_y_index = -999999; + d->lines = 0; + return true; + } + +//-------------------------------------------------------------// + +bool QSImage::init_buffers() + { + // detect + QSPt2f p1; + QSPt2f p2; + p1.x = d->is_x_vector ? matrix(XVector)->value(0,0) : 0.0; + p1.y = d->is_y_vector ? matrix(YVector)->value(0,0) : 0.0; + p2.x = d->is_x_vector ? matrix(XVector)->value(0,d->w) : d->w; + p2.y = d->is_y_vector ? matrix(YVector)->value(d->h,0) : d->h; + + p1 = m_axes->dataToCanvas(p1,d->xaxis,d->yaxis); + p2 = m_axes->dataToCanvas(p2,d->xaxis,d->yaxis); + + QSPt2 cp1( int(p1.x+0.5), int(p1.y+0.5) ); + QSPt2 cp2( int(p2.x+0.5), int(p2.y+0.5) ); + + if ( cp1.x > cp2.x ) { int temp = cp1.x; cp1.x = cp2.x; cp2.x = temp; } + if ( cp1.y > cp2.y ) { int temp = cp1.y; cp1.y = cp2.y; cp2.y = temp; } + + + // Intersect refresh area with clipping area + // clipping area is set in plot2d as an interior + // of the axis box. + if ( !clip_rect(cp1,cp2) ) return false; + + // where bitmap starts + d->rarea.p1 = cp1; + d->rarea.p2 = cp2; + + // X index buffer + // index buffer tells, for each screen pixel between rarea.x1 and + // rarea.x2, which data column is to be drawn at this position + d->xbuff = new int[d->rarea.p2.x-d->rarea.p1.x+1]; + for ( int i=0; i<d->w; i++ ) { // for each data column + double dx1 = d->is_x_vector ? matrix(XVector)->value(0,i) : i; + double dx2 = d->is_x_vector ? matrix(XVector)->value(0,i+1) : i+1; + int cx1 = int(m_axes->dataToCanvas( QSPt2f(dx1,0.0), d->xaxis, d->yaxis ).x+0.5); //start pos of this column on the screen + int cx2 = int(m_axes->dataToCanvas( QSPt2f(dx2,0.0), d->xaxis, d->yaxis ).x+0.5); // end pos of this column on the screen + if ( cx2 < cx1 ) { int temp = cx1; cx1 = cx2; cx2 = temp; } + for ( int j=cx1; j<=cx2; j++ ) // for ach screen pixel beetween cx2 an cx1 + if ( j>=d->rarea.p1.x && j<=d->rarea.p2.x ) d->xbuff[j-d->rarea.p1.x] = i; + } + + // Y index buffer + d->ybuff = new int[d->rarea.p2.y-d->rarea.p1.y+1]; + for ( int i=0; i<d->h; i++ ) { + double dy1 = d->is_y_vector ? matrix(YVector)->value(i,0) : i; + double dy2 = d->is_y_vector ? matrix(YVector)->value(i+1,0) : i+1; + int cy1 = int(m_axes->dataToCanvas( QSPt2f(0.0,dy1), d->xaxis, d->yaxis ).y+0.5); + int cy2 = int(m_axes->dataToCanvas( QSPt2f(0.0,dy2), d->xaxis, d->yaxis ).y+0.5); + if ( cy2 < cy1 ) { int temp = cy1; cy1 = cy2; cy2 = temp; } + for ( int j=cy1; j<=cy2; j++ ) + if ( j>=d->rarea.p1.y && j<=d->rarea.p2.y ) d->ybuff[j-d->rarea.p1.y] = i; + } + + return true; + } + +//-------------------------------------------------------------// + +bool QSImage::clip_rect( QSPt2& p1, QSPt2& p2 ) + { + int cx1; + int cy1; + int cx2; + int cy2; + //dynamic_cast<const QSProjection2D*>(m_axes->proj())->getClipRect( &cx1, &cy1, &cx2, &cy2 ); + QSPt2f pos1 = m_axes->proj()->world2DToCanvas( QSPt2f(0.0,0.0) ); + QSPt2f pos2 = m_axes->proj()->world2DToCanvas( QSPt2f(1.0,1.0) ); + cx1 = QMIN( int(pos1.x+0.5), int(pos2.x+0.5) ); + cy1 = QMIN( int(pos1.y+0.5), int(pos2.y+0.5) ); + cx2 = QMAX( int(pos1.x+0.5), int(pos2.x+0.5) ); + cy2 = QMAX( int(pos1.y+0.5), int(pos2.y+0.5) ); + int x01; + int y01; + int x02; + int y02; + if ( cx1 > p1.x ) x01 = cx1; else x01 = p1.x; + if ( cy1 > p1.y ) y01 = cy1; else y01 = p1.y; + if ( cx2 < p2.x ) x02 = cx2; else x02 = p2.x; + if ( cy2 < p2.y ) y02 = cy2; else y02 = p2.y; + + x02 -= 1; + y02 -= 1; + + if ( x02-x01 > 0 && y02-y01 > 0 ) { + p1.x = x01; p1.y = y01; + p2.x = x02; p2.y = y02; + return true; + } + + return false; + } +//-------------------------------------------------------------// + +void QSImage::end() + { + // all clean-up work is done in freeRuntimeData() + QSPlot2D::end(); + } + +//-------------------------------------------------------------// + +void QSImage::dataChanged( int channel ) +// Ouu. We need to calculate new extremes in data +// Refresh data on screen also. + { + m_evalid = false; + m_dmin = m_dmax = 0.0; + QSPlot2D::dataChanged( channel ); + } + +//-------------------------------------------------------------// + +bool QSImage::step() + { + int curr_step = 0; + while( d->pj <= d->rarea.p2.y ) { + + // Get pixmap buffer for the next buff.lines lines + if ( d->lines == 0 ) { + d->buff.ptr = NULL; + m_drv->getPixmapBuffer( &d->buff, d->rarea.p2.x-d->rarea.p1.x+1, d->rarea.p2.y-d->pj+1 ); + if ( d->buff.ptr == NULL || d->buff.lines == 0 ) { return false; } + m_ptr = d->buff.ptr; + d->lines = d->buff.lines; + } + int ypos = d->ybuff[d->pj-d->rarea.p1.y]; + + // Write scanlines to the buffer + while( d->pi <= d->rarea.p2.x ) { + set_rgb( m_ptr, d->xbuff[d->pi-d->rarea.p1.x], ypos ); + d->pi ++; m_ptr += d->buff.po; + if ( curr_step++ > (work_steps<<5) && m_bkg_handler ) return true; + } + d->pj ++; + + // Draw pixmap + if ( --d->lines == 0 ) { + QSPt2 ppos( d->rarea.p1.x, d->pj-d->buff.lines ); + m_drv->drawPixmap( QSPt2f( ppos.x, ppos.y ), &d->buff ); + } + + // Set pointer to the next scanline + m_ptr = d->buff.ptr + (d->buff.lines-d->lines) * d->buff.lo; + d->pi = d->rarea.p1.x; + } + + return false; + } + +//-------------------------------------------------------------// + +void QSImage::set_rgb( unsigned char* p, int x_index, int y_index ) + { + double dr = 0.0; + double dg = 0.0; + double db = 0.0; + + if ( d->curr_x_index != x_index || + d->curr_y_index != y_index ) { + + dr = d->rm->value(y_index,x_index);//c + if ( d->type == image_runtime_data::RGBImage ) { + dg = d->gm->value(y_index,x_index);//c + db = d->bm->value(y_index,x_index);//c + } + // convert from data to world + if ( !m_rawmode ) { + if ( !m_use_gradient ) { + dr = d->vaxis->dataToWorld(dr)*255.0+0.5; + if ( d->type == image_runtime_data::RGBImage ) { + dg = d->vaxis->dataToWorld(dg)*255.0+0.5; + db = d->vaxis->dataToWorld(db)*255.0+0.5; + } + } else { + m_gradient.fill( d->vaxis->dataToWorld(dr), d->fill ); + m_r = d->fill.color.r; + m_g = d->fill.color.g; + m_b = d->fill.color.b; + } + } + + // take a palette value + if ( !m_use_gradient ) + if ( d->type == image_runtime_data::IndexedImage ) { + if ( dr < 0 ) dr = 0; + if ( dr > d->ph-1 ) dr = d->ph-1; + + int pindex = int(dr); + + dr = d->pm->value( pindex,0 ); //c + dg = d->pm->value( pindex,1 ); + db = d->pm->value( pindex,2 ); + } + + if ( !m_use_gradient ) { + if ( dr < 0.0 ) dr = 0.0; + if ( dr > 255.0 ) dr = 255.0; + } + + // finally set m_r, m_g, m_b values + if ( !m_use_gradient ) + if ( d->type == image_runtime_data::GrayImage ) { + m_r = m_g = m_b = (unsigned char )dr; + } else { + if ( dg < 0.0 ) dg = 0.0; + if ( db < 0.0 ) db = 0.0; + if ( dg > 255.0 ) dg = 255.0; + if ( db > 255.0 ) db = 255.0; + + m_r = (unsigned char )dr; + m_g = (unsigned char )dg; + m_b = (unsigned char )db; + } + + d->curr_x_index = x_index; + d->curr_y_index = y_index; + } + + *p = 255; p += d->buff.co;// alpha + *p = m_r; p += d->buff.co; + *p = m_g; p += d->buff.co; + *p = m_b; + } + +//-------------------------------------------------------------// + +QString QSImage::posInfo( QSPt2f& p ) + { + if ( m_busy ) return QString::null; + + int pindex; + QString result; + allocRuntimeData(); + if ( !init_buffers() ) { freeRuntimeData(); return QString::null; } + + QSPt2 pos( int(p.x+0.5), int(p.y+0.5) ); + if ( pos.x >= d->rarea.p1.x && pos.x <= d->rarea.p2.x && + pos.y >= d->rarea.p1.y && pos.y <= d->rarea.p2.y ) { + + QSPt2 index( d->xbuff[pos.x-d->rarea.p1.x], d->ybuff[pos.y-d->rarea.p1.y] ); + result = QString(tr(" row = ")) + QString::number(index.y) + "\n"; + result += QString(tr(" col = ")) + QString::number(index.x) + "\n"; + + //QSPt2f p = m_proj->canvasToWorld2D( pos ); + //p = worldToData( p ); + //result += QString(tr(" X = ")) + QString::number(p.x) + "\n"; + //result += QString(tr(" Y = ")) + QString::number(p.y) + "\n"; + + switch( d->type ) { + case image_runtime_data::GrayImage: + result += QString(tr(" value = ")) + QString::number(d->rm->value(index.y,index.x)) + "\n"; + break; + case image_runtime_data::RGBImage: + result += QString(tr(" R = ")) + QString::number(d->rm->value(index.y,index.x)) + "\n"; + result += QString(tr(" G = ")) + QString::number(d->gm->value(index.y,index.x)) + "\n"; + result += QString(tr(" B = ")) + QString::number(d->bm->value(index.y,index.x)) + "\n"; + break; + case image_runtime_data::IndexedImage: + pindex = (int )d->rm->value(index.y,index.x); pindex = QMAX( pindex, 0 ); pindex = QMIN( pindex, d->ph-1 ); + result += QString(tr(" palette index = ")) + QString::number(pindex) + "\n"; + result += QString(tr(" R = ")) + QString::number(d->pm->value(pindex,0)) + "\n"; + result += QString(tr(" G = ")) + QString::number(d->pm->value(pindex,1)) + "\n"; + result += QString(tr(" B = ")) + QString::number(d->pm->value(pindex,2)) + "\n"; + /* + result += QString(tr(" G = ")) + QString::number(d->pm->ncol()) + "\n"; + result += QString(tr(" B = ")) + QString::number(d->pm->ncol()) + "\n"; + */ + default: break; + } + } + freeRuntimeData(); + return result; + } + +//-------------------------------------------------------------// + +bool QSImage::isClicked( const QSPt2f& pos ) + { + if ( m_busy ) return false; + allocRuntimeData(); + if ( !init_buffers() ) { freeRuntimeData(); return false; } + if ( pos.x >= d->rarea.p1.x && pos.x <= d->rarea.p2.x && + pos.y >= d->rarea.p1.y && pos.y <= d->rarea.p2.y ) return true; + freeRuntimeData(); + return false; + } + +//-------------------------------------------------------------// + +#define BOX_SPACE 2.0 +#define BOX_WIDTH 20.0 +#define BOX_HEIGHT 100.0 + +QSPt2f QSImage::legendItemSize( QSDrv *drv ) + { + double boxSpace = drv->toPixels(BOX_SPACE); + QSPt2f boxSize( drv->toPixels(BOX_WIDTH), + drv->toPixels(BOX_HEIGHT) ); + QSPt2f tsize = drv->rTextSize( 270, title() ); + QSPt2f lsize; + int nr_labels = 0; + QSAxis *axis = defaultAxis(QSAxis::VAxisType); + const list<QSAxisTic> *tics = axis->tics(); + list<QSAxisTic>::const_iterator curr = tics->begin(); + list<QSAxisTic>::const_iterator last = tics->end(); + while( curr != last ) { + if ( !(*curr).m_major ) { curr++; continue; } + if ( !(*curr).m_label.isEmpty() ) { + QSPt2f size = drv->rTextSize( (*curr).m_angle, (*curr).m_label ); + lsize.x = QMAX(lsize.x, size.x); + lsize.y = QMAX(lsize.y, size.y); + } + curr++; + nr_labels++; + } + + boxSize.y = QMAX(boxSize.y,nr_labels*lsize.y); + return QSPt2f( tsize.x+boxSpace+boxSize.x+boxSpace+boxSpace+boxSpace+lsize.x, QMAX(tsize.y,boxSize.y) ); + } + +//-------------------------------------------------------------// + +void QSImage::drawLegendItem( const QSPt2f& pos, QSDrv *drv ) + { + double boxSpace = drv->toPixels(BOX_SPACE); + QSPt2f boxSize( drv->toPixels(BOX_WIDTH), + drv->toPixels(BOX_HEIGHT) ); + + // detect image type and number of colors in gradient + int h = 256; + int type = image_runtime_data::GrayImage; + if ( matrixCols( Palette ) == 3 && + matrixRows( Palette ) > 0 ) { type = image_runtime_data::IndexedImage; h = matrixRows( Palette ); } + if ( matrixCols( DataGreen ) == matrixCols( DataRed ) && + matrixRows( DataGreen ) == matrixRows( DataRed ) && + matrixCols( DataBlue ) == matrixCols( DataRed ) && + matrixRows( DataBlue ) == matrixRows( DataRed ) ) type = image_runtime_data::RGBImage; + + // title + QSPt2f tsize = drv->rTextSize( 270, title() ); + double height = boxSize.y = legendItemSize(drv).y; + drv->drawRText( QSPt2f(pos.x,pos.y+height/2), 270, title(), AlignHCenter | AlignTop ); + + // gradient + QSAxis *axis = defaultAxis(QSAxis::VAxisType); + QSPt2f cpos( pos.x+tsize.x+boxSpace, pos.y+(height-boxSize.y)/2.0 ); + drv->setLine( QSGLine::invisibleLine ); + for ( int i=0; i<h; i++ ) { + int index = h-i-1; + QSGFill f; + QSPt2f p1( cpos.x, cpos.y+i*boxSize.y/h); + QSPt2f p2( cpos.x+boxSize.x, cpos.y+(i+1)*boxSize.y/h); + double x01 = cpos.x+boxSize.x/3.0; + double x02 = cpos.x+boxSize.x*2.0/3.0; + switch ( type ) { + case image_runtime_data::GrayImage: + if ( m_use_gradient ) m_gradient.fill( double(h-i)/h, f ); + else f.color = QSGColor( index, index, index); + drv->setFill( f ); + drv->drawRect( p1, p2 ); + break; + case image_runtime_data::IndexedImage: + /* + f.color = QSGColor( (unsigned char )matrix(Palette)->value(index,0), + (unsigned char )matrix(Palette)->ncol(), + (unsigned char )matrix(Palette)->ncol() ); + */ + f.color = QSGColor( (unsigned char )matrix(Palette)->value(index,0), + (unsigned char )matrix(Palette)->value(index,1), + (unsigned char )matrix(Palette)->value(index,2) ); + + drv->setFill( f ); + drv->drawRect( p1, p2 ); + break; + case image_runtime_data::RGBImage: + f.color = QSGColor( index, 0, 0 ); drv->setFill( f ); + drv->drawRect( QSPt2f(p1.x,p1.y), QSPt2f(x01,p2.y) ); + f.color = QSGColor( 0, index, 0 ); drv->setFill( f ); + drv->drawRect( QSPt2f(x01,p1.y), QSPt2f(x02,p2.y) ); + f.color = QSGColor( 0, 0, index ); drv->setFill( f ); + drv->drawRect( QSPt2f(x02,p1.y), QSPt2f(p2.x,p2.y) ); + break; + } + } + /* + // frame + drv->setFill( QSGFill::transparentFill ); + drv->drawRect( cpos, cpos+boxSize ); + */ + QSGLine l; drv->setLine( l ); + cpos.x = cpos.x+boxSize.x; + + // labels + const list<QSAxisTic> *tics = axis->tics(); + list<QSAxisTic>::const_iterator curr = tics->begin(); + list<QSAxisTic>::const_iterator last = tics->end(); + while( curr != last ) { + if ( !(*curr).m_major ) { curr++; continue; } + double ypos = cpos.y+ (1.0-(*curr).m_pos)*boxSize.y+0.5; + drv->drawLine( QSPt2f(cpos.x,ypos), QSPt2f(cpos.x+boxSpace,ypos) ); + drv->drawRText( QSPt2f(cpos.x+boxSpace+boxSpace+boxSpace,ypos), (*curr).m_angle, (*curr).m_label, AlignLeft | AlignVCenter ); + curr++; + } + } + +//-------------------------------------------------------------// + +void QSImage::loadStateFromStream( QDataStream& stream, QSObjectFactory *factory ) + { + QSPlot2D::loadStateFromStream( stream, factory ); + } + +//-------------------------------------------------------------// + +void QSImage::saveStateToStream( QDataStream& stream, QSObjectFactory *factory ) + { + QSPlot2D::saveStateToStream( stream, factory ); + } + +//-------------------------------------------------------------// + +QString QSImage::channelVariable( int channel ) const + { + switch( channel ) { + case DataRed: return "r"; + case DataGreen: return "g"; + case DataBlue: return "b"; + case Palette: return "p"; + case XVector: return "x"; + case YVector: return "y"; + } + return QString::null; + } + +//-------------------------------------------------------------// + +QSImage::ColumnType QSImage::columnType( int channel, int column ) const + { + } + + + diff --git a/kmatplot/widgets/qsimage.h b/kmatplot/widgets/qsimage.h new file mode 100644 index 0000000..ad85b67 --- /dev/null +++ b/kmatplot/widgets/qsimage.h @@ -0,0 +1,169 @@ +/*************************************************************************** + qsimage.h + ------------------- + begin : 01-January-2000 + copyright : (C) 2000 by Kamil Dobkowski + email : kamildobk@poczta.onet.pl + ***************************************************************************/ + +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + + +#ifndef QSIMAGE_H +#define QSIMAGE_H + +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif +#include"qsaxes.h" +#include"qsplot.h" +#include"qsdrv.h" + + + +/** + * \brief Dataset: Draws pixmaps + * + * Data format is described in QSImage::Channels . See also QSAxes::plotAdd() . + * @author Kamil Dobkowski + */ +class QSImage : public QSPlot2D + { + Q_OBJECT + Q_PROPERTY( bool rawMode READ rawMode WRITE setRawMode ) + Q_PROPERTY( bool useGradient READ useGradient WRITE setUseGradient ) + + public: + /** + * Descriptive names of data channels. See QSData::setMatrix(). + * DataRed is required, other matrices are optional. DataRed, DataIndex, DataGray are the different names + * for the same channel. DataRed, DataGreen, DataBlue must have the same size. + * XVector ( optional ) contains x coordinates of a grid, YVector ( optional ) contains y coordinates of a grid. + * cols(XVector) == cols(DataRed)+1, rows(YVector) == rows(DataRed)+1, both vectors must be monotone. + */ + enum Channels { + XVector = 0, // Row vector, monotone. Size w+1 x 1 + YVector = 1, // Column vector, monotone. Size 1 x h+1 + DataRed = 2, // 2 Matrix. Size: w x h ( size is width x height ). + DataIndex = 2, // 2 + DataGray = 2, // 2 + DataGreen = 3, // Matrix. Size w x h + DataBlue = 4, // Matrix. Size w x h + Palette = 5 // Matrix. Size 3 x ? + }; + /** + * Constructor. + */ + QSImage(QSAxes* parent, const char * name=0); + /** + * Destructor. + */ + ~QSImage(); + /** + * Sets the raw mode. In the raw mode the value axis has + * fixed range 0-255, and there is no mapping of data values + * to the axis. + */ + void setRawMode( bool enabled ); + /** + * Returns the current state of the raw mode setting. + */ + bool rawMode() const { return m_rawmode; } + /** + * Use gradient instead of gray levels + */ + void setUseGradient( bool enable ); + /** + * if using gradient + */ + bool useGradient() const { return m_use_gradient; } + + virtual QString posInfo( QSPt2f& pos ); + virtual bool isClicked( const QSPt2f& pos ); + virtual QSPt2f legendItemSize( QSDrv *drv ); + virtual void drawLegendItem( const QSPt2f& pos, QSDrv *drv ); + virtual void loadStateFromStream( QDataStream& stream, QSObjectFactory *factory ); + virtual void saveStateToStream( QDataStream& stream, QSObjectFactory *factory ); + virtual ColumnType columnType( int channel, int column ) const; + virtual QString channelVariable( int channel ) const; + + protected: + + virtual void dataChanged( int channel = -1 ); + virtual void allocRuntimeData(); + virtual void freeRuntimeData(); + virtual bool getAxisRange( QSAxis *axis, double& min, double& max ); + virtual bool start(); + virtual bool step(); + virtual void end(); + + private: + + bool m_evalid; + bool m_rawmode; + bool m_use_gradient; + double m_dmin; + double m_dmax; + unsigned char m_r; + unsigned char m_g; + unsigned char m_b; + unsigned char *m_ptr; + struct image_runtime_data; + struct image_runtime_data *d; + + bool init_buffers(); + bool clip_rect( QSPt2& p1, QSPt2& p2 ); + void set_rgb( unsigned char* ptr, int x_index, int y_index ); + }; + +#endif + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/kmatplot/widgets/qsmatrix.cpp b/kmatplot/widgets/qsmatrix.cpp new file mode 100644 index 0000000..7a93323 --- /dev/null +++ b/kmatplot/widgets/qsmatrix.cpp @@ -0,0 +1,169 @@ +/*************************************************************************** + qsmatrix.cpp + ------------------- + begin : Wed Oct 24 2001 + copyright : (C) 2001 by kamil + email : kamil@localhost.localdomain + ***************************************************************************/ + +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + +#include"qsmatrix.h" +#include"qsdata.h" +#include<qmetaobject.h> +#include<qstrlist.h> +#include<qvariant.h> + +//-------------------------------------------------------------// + +QSMatrix::QSMatrix() +: QObject(), QSSerializable() + { + m_data_object = NULL; + m_channel = -1; + } + +//-------------------------------------------------------------// + +QSMatrix::~QSMatrix() + { + } + +//-------------------------------------------------------------// + +void QSMatrix::setDataObject( QSData *data, int channel ) + { + m_data_object = data; + m_channel = channel; + } + +//-------------------------------------------------------------// + +void QSMatrix::setValue( int, int, double ) + { + } + +//-------------------------------------------------------------// + +void QSMatrix::setString( int row, int col, const QString& string ) + { + setValue( row, col, string.toDouble() ); + } + +//-------------------------------------------------------------// + +bool QSMatrix::resize( int, int ) + { + return false; + } + +//-------------------------------------------------------------// + +bool QSMatrix::isEditable() const + { + return false; + } + +//-------------------------------------------------------------// + +bool QSMatrix::isReference() const + { + return false; + } + +//-------------------------------------------------------------// + +bool QSMatrix::isString() const + { + return false; + } + +//-------------------------------------------------------------// + +void QSMatrix::dataChanging() + { + if ( m_data_object ) m_data_object->dataChanging(m_channel); + } + +//-------------------------------------------------------------// + +void QSMatrix::dataChanged() + { + if ( m_data_object ) m_data_object->dataChanged(m_channel); + } +//-------------------------------------------------------------// + +void QSMatrix::loadStateFromStream( QDataStream& stream, QSObjectFactory *factory ) + { + QSSerializable::loadStateFromStream( stream, factory ); + // load properties + QMetaObject *meta_object = metaObject(); + QStrList properties = meta_object->propertyNames( TRUE ); + for( unsigned int property_nr=0; property_nr<properties.count(); property_nr++ ) { + QCString property_name; + QVariant property_value; + stream >> property_name >> property_value; + setProperty(property_name,property_value); + } + } + +//-------------------------------------------------------------// + +void QSMatrix::saveStateToStream( QDataStream& stream, QSObjectFactory *factory ) + { + QSSerializable::saveStateToStream( stream, factory ); + // save properties + QMetaObject *meta_object = metaObject(); + QStrList properties = meta_object->propertyNames( TRUE ); + for( unsigned int property_nr=0; property_nr<properties.count(); property_nr++ ) { + stream << QCString(properties.at(property_nr)) << property(properties.at(property_nr)); + } + } +//-------------------------------------------------------------// + +void QSMatrix::copyRange( int dstRowStart, int dstColStart, QSMatrix *srcMatrix, int srcRowStart, int srcColStart, int srcRowEnd, int srcColEnd ) + { + int startCol; + int endCol; + int colStep; + if ( srcColStart > dstColStart ) { + startCol = srcColStart; endCol = srcColEnd; colStep = 1; + } else { + startCol = srcColEnd; endCol = srcColStart; colStep = -1; + } + + int startRow; + int endRow; + int rowStep; + if ( srcRowStart > dstRowStart ) { + startRow = srcRowStart; endRow = srcRowEnd; rowStep = 1; + } else { + startRow = srcRowEnd; endRow = srcRowStart; rowStep = -1; + } + + int row = startRow; + while( row >= srcRowStart && row <= srcRowEnd ) { + int col = startCol; + while( col >= srcColStart && col <= srcColEnd ) { + int dst_row = dstRowStart + row - srcRowStart; + int dst_col = dstColStart + col - srcColStart; + if ( row >= 0 && dst_row >= 0 && + col >= 0 && dst_col >= 0 && + dst_row < rows() && row < srcMatrix->rows() && + dst_col < cols() && col < srcMatrix->cols() ) { + if ( isString() ) setString( dst_row, dst_col, srcMatrix->string( row, col ) ); + else setValue( dst_row, dst_col, srcMatrix->value( row, col ) ); + } + col += colStep; + } + row += rowStep; + } + } + diff --git a/kmatplot/widgets/qsmatrix.h b/kmatplot/widgets/qsmatrix.h new file mode 100644 index 0000000..17dad10 --- /dev/null +++ b/kmatplot/widgets/qsmatrix.h @@ -0,0 +1,158 @@ +/*************************************************************************** + qsmatrix.h + ------------------- + begin : 01-January-2000 + copyright : (C) 2000 by Kamil Dobkowski + email : kamildobk@poczta.onet.pl + ***************************************************************************/ + +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + +#ifndef QSMATRIX_H +#define QSMATRIX_H + +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif +#include<qstring.h> +#include<qobject.h> +#include"qsserializable.h" + +class QSData; + +/** + * \brief Matrix class contains data used by QSData + * + * If you want your data to be used by this library you will have to make your implementation of this class. + * It is not as complicated as it looks. You will have to reimplement only : rows(), cols(), value() and optionally string(). + * There are other functions, which can be implemented: setValue(), setString(), resize(), transpose(), + * isReference(), isEditable(), isString(), loadStateFromStream(), saveStateToStream() + * Those memebers are not used by this library, but you will probably want to implement them in nontrivial projects for your own use.. + * + * When you call QSData::setMatrix(), setDataObject() is invoked. Later you can find out the parent object with dataObject() method. + * When you are going to change the data stored in the matrix you will have to call dataChanging() before and dataChanged() + * after the change. This notifies the parent QSData object about the change. It is important because it can be busy drawing the data + * at the moment and changing it during the operation can cause the crash. + * + * see QSData::setMatrix() + */ +class QSMatrix : public QObject, public QSSerializable { + Q_OBJECT + public: + /** + * Constructor + */ + QSMatrix(); + /** + * Destructor. Emits 'sigDeleting()' + */ + virtual ~QSMatrix(); + /** + * Returns a value at position ( row, col ) in this matrix, + * converted to 'double'. This method must be redefined. + */ + virtual double value( int row, int col ) = 0; + /** + * Returns string at position ( row, col ). + * Default implementation calls value() and + * converts the result to string. + */ + virtual QString string( int row, int col ) { return QString::number(value(row,col),'g',9); } + /** + * Returns the number of rows in this matrix. + */ + virtual int rows() const = 0; + /** + * Return the number of columns in this matrix. + */ + virtual int cols() const = 0; + /** + * Resizes matrix ( preserves old data ). This should be reimplemented for + * each matrix type.Default implementation does nothing and returns 'false' ( 'operation not implemented' ) + */ + virtual bool resize( int rows, int cols ); + /** + * Does transposition. This should be reimplemented. Default implementation does nothing and returns 'false' + *( which means 'operation not implemented' ). + */ + virtual bool transpose() { return false; } + /** + * Copy range.'dst' can be the same matrix. + */ + void copyRange( int row, int col, QSMatrix *src, int srcStartRow, int srcStartCol, int srcEndRow, int srcEndCol ); + /** + * Sets a data object. It is called atomatically by QSData object, so + * there is no need to call it by hand. + */ + virtual void setDataObject( QSData *data, int channel ); + /** + * Returns data object + */ + QSData *dataObject() const { return m_data_object; } + /** + * Returns channel + */ + int channel() const { return m_channel; } + /** + * This should be reimplemented to set a new value if editable() is TRUE. + * Doesn't call dataChanging() and dataChanged. + */ + virtual void setValue( int row, int col, double value ); + /** + * Set string + */ + virtual void setString( int row, int col, const QString& string ); + /** + * If true editor will be painted in blue. + */ + virtual bool isReference() const; + /** + * If is editable using 'setValue()' this function should return true. + * Returns false by default. + */ + virtual bool isEditable() const; + /** + * Returns if this matrix holds elements as string raher than matrix. + */ + virtual bool isString() const; + /** + * Calls QSData::dataChanging() + */ + virtual void dataChanging(); + /** + * Calls QSData::dataChanged() + */ + virtual void dataChanged(); + /** + * Loads all properties + */ + virtual void loadStateFromStream( QDataStream& stream, QSObjectFactory *factory ); + /** + * Saves all properties + */ + virtual void saveStateToStream( QDataStream& stream, QSObjectFactory *factory ); + + protected: + QSData *m_data_object; + int m_channel; + + QSMatrix( const QSMatrix& ); + void operator=(const QSMatrix& ); + + }; +#endif + + + + + + + + diff --git a/kmatplot/widgets/qsplot.cpp b/kmatplot/widgets/qsplot.cpp new file mode 100644 index 0000000..3aeaaa7 --- /dev/null +++ b/kmatplot/widgets/qsplot.cpp @@ -0,0 +1,821 @@ +/*************************************************************************** + qsplot.cpp + ------------------- + begin : 01-January-2000 + + copyright : (C) 2000 by Kamil Dobkowski + email : kamildobk@poczta.onet.pl + ***************************************************************************/ + +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + +#include"qsplot.h" +#include"qsaxis.h" +#include"qsaxes3d.h" +#include"qsprojection3d.h" +#include<assert.h> +#include<vector.h> +#include<algo.h> + +QSPlot::QSPlot(QSAxes* parent, const char * name ) +:QSAxesChild( parent, name ) + { + assert( parent ); + m_busy = false; + m_is_legend = true; + m_axes = parent; + m_drv = NULL; + + // default axes + for( int axis_type=0; axis_type<5; axis_type++ ) m_daxes[axis_type] = m_axes->axisOfType((QSAxis::AxisType )axis_type); + + m_title_str = tr("Untitled plot"); + connect( m_axes, SIGNAL(sigChildRemoved(QSData*)), this, SLOT(axisRemoved(QSData*)) ); + } + +//-------------------------------------------------------------// + +QSPlot::~QSPlot() + { + } + +//-------------------------------------------------------------// + +void QSPlot::axisRemoved( QSData *axis ) +// find another axis to bind to + { + for( int axis_type=0; axis_type<5; axis_type++ ) + if ( m_daxes[axis_type] == axis ) m_daxes[axis_type] = m_axes->axisOfType((QSAxis::AxisType )axis_type); + } + +//-------------------------------------------------------------// + +void QSPlot::setDefaultAxis( QSAxis *axis ) + { + if ( axis && axis->parentAxes() == m_axes ) SET_PROPERTY( m_daxes[axis->type()], axis ); + } + +//-------------------------------------------------------------// + +void QSPlot::setDefaultXAxis( int axisIndex ) + { + setDefaultAxis( m_axes->axis(axisIndex) ); + } + +//-------------------------------------------------------------// + +void QSPlot::setDefaultYAxis( int axisIndex ) + { + setDefaultAxis( m_axes->axis(axisIndex) ); + } + +//-------------------------------------------------------------// + +void QSPlot::setDefaultZAxis( int axisIndex ) + { + setDefaultAxis( m_axes->axis(axisIndex) ); + } + +//-------------------------------------------------------------// + +void QSPlot::setDefaultVAxis( int axisIndex ) + { + setDefaultAxis( m_axes->axis(axisIndex) ); + } + +//-------------------------------------------------------------// + +QSPt2f QSPlot::dataToWorld( const QSPt2f& p ) const + { + return QSPt2f( m_daxes[QSAxis::XAxisType]->dataToWorld(p.x), + m_daxes[QSAxis::YAxisType]->dataToWorld(p.y) ); + } + +//-------------------------------------------------------------// + +QSPt3f QSPlot::dataToWorld( const QSPt3f& p ) const + { + return QSPt3f( m_daxes[QSAxis::XAxisType]->dataToWorld(p.x), + m_daxes[QSAxis::YAxisType]->dataToWorld(p.y), + m_daxes[QSAxis::ZAxisType]->dataToWorld(p.z) ); + } + +//-------------------------------------------------------------// + +QSPt3f QSPlot::dataToWorldV( const QSPt3f& p ) const + { + return QSPt3f( m_daxes[QSAxis::XAxisType]->dataToWorld(p.x), + m_daxes[QSAxis::YAxisType]->dataToWorld(p.y), + m_daxes[QSAxis::VAxisType]->dataToWorld(p.z) ); + } + +//-------------------------------------------------------------// + +QSPt2f QSPlot::worldToData( const QSPt2f& p ) const + { + return QSPt2f( m_daxes[QSAxis::XAxisType]->worldToData(p.x), + m_daxes[QSAxis::YAxisType]->worldToData(p.y) ); + } + +//-------------------------------------------------------------// + +QSPt3f QSPlot::worldToData( const QSPt3f& p ) const + { + return QSPt3f( m_daxes[QSAxis::XAxisType]->worldToData(p.x), + m_daxes[QSAxis::YAxisType]->worldToData(p.y), + m_daxes[QSAxis::ZAxisType]->worldToData(p.z) ); + } + +//-------------------------------------------------------------// + +QSPt3f QSPlot::worldToDataV( const QSPt3f& p ) const + { + return QSPt3f( m_daxes[QSAxis::XAxisType]->worldToData(p.x), + m_daxes[QSAxis::YAxisType]->worldToData(p.y), + m_daxes[QSAxis::VAxisType]->worldToData(p.z) ); + } + +//-------------------------------------------------------------// + +void QSPlot::setLegendItemVisible( bool visible ) + { + SET_PROPERTY( m_is_legend, visible ); + } + +//-------------------------------------------------------------// + +bool QSPlot::start() + { + allocRuntimeData(); + m_busy = true; + return false; + } + +//-------------------------------------------------------------// + +bool QSPlot::step() + { + return false; + } + +//-------------------------------------------------------------// + +void QSPlot::end() + { + freeRuntimeData(); + m_busy = false; + } + +//-------------------------------------------------------------// + +void QSPlot::allocRuntimeData() + { + assert( m_axes ); + m_cpos = m_axes->m_cpos; + m_csize = m_axes->m_csize; + m_bkg_handler = m_axes->m_bkg_handler; + m_curr_dpi = m_axes->run_dpi(); + m_drv = m_axes->run_gDriver(); + m_proj = m_axes->proj(); + } + +//-------------------------------------------------------------// + +void QSPlot::freeRuntimeData() + { + m_drv = NULL; + } + +//-------------------------------------------------------------// + +bool QSPlot::getAxisRange( QSAxis*, double&, double& ) + { + return false; + } + + //-------------------------------------------------------------// + +QString QSPlot::posInfo( QSPt2f& ) + { + return QString::null; + } + + //-------------------------------------------------------------// + +QSPt2f QSPlot::legendItemSize( QSDrv * ) + { + return QSPt2f(0,0); + } + +//-------------------------------------------------------------// + +void QSPlot::drawLegendItem( const QSPt2f&, QSDrv * ) + { + } + +//-------------------------------------------------------------// + +void QSPlot::setGradient( const QSGGradient& newGradient ) + { + if ( m_gradient != newGradient ) { + parametersChanging(); + m_gradient = newGradient; + parametersChanged(); + } + } + +//-------------------------------------------------------------// + +void QSPlot::setGradientProperty( const QString& string ) + { + setGradient( toQSGGradient(string) ); + } + +//-------------------------------------------------------------// + +void QSPlot::loadStateFromStream( QDataStream& stream, QSObjectFactory *factory ) + { + QSAxesChild::loadStateFromStream( stream, factory ); + } + +//-------------------------------------------------------------// + +void QSPlot::saveStateToStream( QDataStream& stream, QSObjectFactory *factory ) + { + QSAxesChild::saveStateToStream( stream, factory ); + } + + + +//-------------------------------------------------------------// +//-------------------------------------------------------------// +//-------------------------------------------------------------// +//-------------------------------------------------------------// +//-------------------------------------------------------------// +//-------------------------------------------------------------// + +QSPlot2D::QSPlot2D( QSAxes *parentAxes, const char *name ) +:QSPlot( parentAxes, name ) + { + } + +//-------------------------------------------------------------// + +QSPlot2D::~QSPlot2D() + { + } + +//-------------------------------------------------------------// +//-------------------------------------------------------------// +//-------------------------------------------------------------// +//-------------------------------------------------------------// +//-------------------------------------------------------------// +//-------------------------------------------------------------// + +#define MAX_BUFF_SIZE 60 + +struct QSPlot3D::plot3d_runtime_data { + QSPlot3D *m_plot; + const QSProjection *m_proj; + double *first_level; + double *last_level; + double *after_last_level; + int nlevels; + double *level_values; + QSGFill *level_fills; + QSGLine *level_lines; + QSGFill polygon_fills[MAX_BUFF_SIZE]; + QSPt3f polygon_normals[MAX_BUFF_SIZE]; + QSPt3f canvas_buff[MAX_BUFF_SIZE]; + QSPt3f clip_buff_1[MAX_BUFF_SIZE]; + QSPt3f clip_buff_2[MAX_BUFF_SIZE]; + QSPt3f clip_buff_3[MAX_BUFF_SIZE]; + double clip_value_buff_1[MAX_BUFF_SIZE]; + double clip_value_buff_2[MAX_BUFF_SIZE]; + double clip_value_buff_3[MAX_BUFF_SIZE]; + bool edge_buff_1[MAX_BUFF_SIZE]; + bool edge_buff_2[MAX_BUFF_SIZE]; + bool edge_buff_3[MAX_BUFF_SIZE]; + bool all_edges[MAX_BUFF_SIZE]; // filled with true + QSDrv *m_drv; + QSDrv::CNormals m_cnormals; + QSDrv::CColors m_ccolors; + QSDrv::COrdering m_corder; + int find_level_greater_than( double value ); + void draw_divided_polygon( const QSPt3f pts[], int npoints, const QSPt3f *norm, const bool *edges, int auto_color ); + void draw_4d_polygon( const QSPt3f pts[], int npoints, const QSPt3f *norm, const double *values, const bool *edges, int auto_color ); + inline void draw_simple_polygon( const QSPt3f pts[], int npoints, + const QSPt3f *norm, const QSGFill& f, + const bool *edges = NULL, int auto_color = 0 ); + inline void draw_clipped_polygon( const QSPt3f pts[], int npoints, + const QSPt3f *norm, const QSGFill& f, + QSPt3f clip_pts[], int nclip_pts, + bool *edges = NULL, int auto_color = 0 ); + void cut_polygon( double level, const QSPt3f *pts, int npts, const bool *in_edges, + QSPt3f *above_pts, int *above_npts, bool *above_edges, + QSPt3f *under_pts, int *under_npts, bool *under_edges ); + void cut_polygon4d( double level, + const QSPt3f *input_pts, int input_npts, const double *input_values, const bool *in_edges, + QSPt3f *above_pts, int *above_npts, double *above_values, bool *above_edges, + QSPt3f *under_pts, int *under_npts, double *under_values, bool *under_edges ); + }; + + //-------------------------------------------------------------// + +QSPlot3D::QSPlot3D( QSAxes* parent, const char * name ) +:QSPlot( parent, name ) + { + d = NULL; + m_edge_auto_color = -50; + m_divide = false; + m_clipping = true; + m_topbottom = true; + m_colored = true; + + #define FONTS_NUM 0 + #define FILLS_NUM 2 + #define LINES_NUM 1 + #define POINTS_NUM 1 + + initAttributeTables( FONTS_NUM, FILLS_NUM, LINES_NUM, POINTS_NUM ); + } + +//-------------------------------------------------------------// + +QSPlot3D::~QSPlot3D() + { + } + +//-------------------------------------------------------------// + +void QSPlot3D::setEdgeAutoColor( int value ) + { + SET_PROPERTY( m_edge_auto_color, value ); + } + +//-------------------------------------------------------------// + +void QSPlot3D::setClipping( bool clipping ) + { + m_clipping = clipping; + } + +//-------------------------------------------------------------// + +void QSPlot3D::setTopBottom( bool enabled ) + { + SET_PROPERTY( m_topbottom, enabled ); + } + +//-------------------------------------------------------------// + +void QSPlot3D::setAutoDivide( bool enabled ) + { + SET_PROPERTY( m_divide, enabled ); + } + +//-------------------------------------------------------------// + +void QSPlot3D::setColored( bool enabled ) + { + SET_PROPERTY( m_colored, enabled ); + } + +//-------------------------------------------------------------// + +#define BOX_SPACE 2.0 +#define BOX_WIDTH 20.0 +#define BOX_HEIGHT 100.0 + +QSPt2f QSPlot3D::standardLegendItemSize( QSDrv *m_drv, QSAxis *axis, const QString& title ) + { + double boxSpace = m_drv->toPixels(BOX_SPACE); + QSPt2f boxSize( m_drv->toPixels(BOX_WIDTH), + m_drv->toPixels(BOX_HEIGHT) ); + QSPt2f tsize = m_drv->rTextSize( 270, title ); + QSPt2f lsize; + int nr_labels = 0; + const list<QSAxisTic> *tics = axis->tics(); + list<QSAxisTic>::const_iterator curr = tics->begin(); + list<QSAxisTic>::const_iterator last = tics->end(); + while( curr != last ) { + if ( !(*curr).m_major ) { + curr++; + continue; + } + if ( !(*curr).m_label.isEmpty() ) { + QSPt2f size = m_drv->rTextSize( (*curr).m_angle, (*curr).m_label ); + lsize.x = QMAX(lsize.x, size.x); + lsize.y = QMAX(lsize.y, size.y); + } + curr++; + nr_labels++; + } + + boxSize.y = QMAX(boxSize.y,nr_labels*lsize.y); + return QSPt2f( tsize.x+boxSpace+boxSize.x+boxSpace+boxSpace+boxSpace+lsize.x, QMAX(tsize.y,boxSize.y) ); + } + +//-------------------------------------------------------------// + +void QSPlot3D::drawStandardLegendItem( const QSPt2f& pos, QSDrv *m_drv, QSAxis *axis, const QString& title, const QSGGradient *gradient ) + { + double boxSpace = m_drv->toPixels(BOX_SPACE); + QSPt2f boxSize( m_drv->toPixels(BOX_WIDTH), + m_drv->toPixels(BOX_HEIGHT) ); + + // title + QSPt2f tsize = m_drv->rTextSize( 270, title ); + double height = boxSize.y = standardLegendItemSize(m_drv,axis,title).y; + m_drv->drawRText( QSPt2f(pos.x,pos.y+height/2.0), 270, title, AlignHCenter | AlignTop ); + + // gradient + QSGFill f; + int h=256; + QSPt2f m_cpos( pos.x+tsize.x+boxSpace, pos.y+(height-boxSize.y)/2.0 ); + m_drv->setLine( QSGLine::invisibleLine ); + for ( int i=0; i<h; i++ ) { + gradient->fill( double(h-i)/h, f ); + m_drv->setFill( f ); + QSPt2f p1( m_cpos.x, m_cpos.y+i*boxSize.y/h); + QSPt2f p2( m_cpos.x+boxSize.x, m_cpos.y+(i+1)*boxSize.y/h); + m_drv->drawRect( p1, p2 ); + } + + + QSGLine l; m_drv->setLine( l ); + m_cpos.x = m_cpos.x+boxSize.x; + + // labels + const list<QSAxisTic> *tics = axis->tics(); + list<QSAxisTic>::const_iterator curr = tics->begin(); + list<QSAxisTic>::const_iterator last = tics->end(); + while( curr != last ) { + double ypos = m_cpos.y+(1.0-(*curr).m_pos)*boxSize.y; + if ( (*curr).m_major ) m_drv->drawLine( QSPt2f(m_cpos.x,ypos), QSPt2f(m_cpos.x-2.0*boxSpace,ypos) ); + else m_drv->drawLine( QSPt2f(m_cpos.x,ypos), QSPt2f(m_cpos.x-0.5*boxSpace,ypos) ); + m_drv->drawRText( QSPt2f(m_cpos.x+boxSpace+boxSpace+boxSpace,ypos), (*curr).m_angle, (*curr).m_label, AlignLeft | AlignVCenter ); + curr++; + } + } + +//-------------------------------------------------------------// + +void QSPlot3D::allocRuntimeData() + { + QSPlot::allocRuntimeData(); + d = new plot3d_runtime_data(); + d->m_plot = this; + d->m_drv = m_drv; + d->m_proj = m_proj; + if ( m_drv ) { + m_cnormals = d->m_cnormals = m_drv->cNormals(); + m_ccolors = d->m_ccolors = m_drv->cColors(); + m_corder = d->m_corder = m_drv->cOrdering(); + if ( m_cnormals == QSDrv::NoNormals ) m_cnormals = d->m_cnormals = QSDrv::MeshNormal; // was && light() + } + + QSAxis *axis = m_daxes[QSAxis::VAxisType]; + const list<QSAxisTic> *tics = m_daxes[QSAxis::VAxisType]->tics(); + + d->nlevels = tics->size(); + d->level_values = new double[d->nlevels+2]; + d->level_fills = new QSGFill[d->nlevels+2]; + d->level_lines = new QSGLine[d->nlevels+2]; + + // the first level at 0.0 ( everything under will be transparent + d->level_lines[0] = QSGLine::invisibleLine; + d->level_fills[0] = QSGFill::Transparent; + d->level_values[0] = 0.0; + d->nlevels = d->nlevels+1; + + // all tics from axis + list<QSAxisTic>::const_iterator curr_tic = tics->begin(); + for( int i=1; i<d->nlevels; i++ ) { + d->level_lines[i] = curr_tic->m_line; + d->level_values[i] = curr_tic->m_pos; + d->level_fills[i] = curr_tic->m_fill; + // put gradient to axis + if ( !curr_tic->m_is_fill_defined ) { + if ( colored() ) m_gradient.fill( d->level_values[i], d->level_fills[i] ); + else d->level_fills[i] = m_settings.fills[TMeshFill]; + } + curr_tic++; + } + + // the last level above the last tic + if ( d->level_values[d->nlevels-1] < 1.0 ) { + d->level_lines[d->nlevels] = QSGLine::invisibleLine; + d->level_values[d->nlevels] = 1.0; + // take this in a special way + if ( !axis->reversed() && axis->lastTic().m_is_fill_defined ) + d->level_fills[d->nlevels] = axis->lastTic().m_fill; + else m_gradient.fill( 1.0, d->level_fills[d->nlevels] ); + if ( !colored() ) d->level_fills[d->nlevels] = m_settings.fills[TMeshFill]; + d->nlevels = d->nlevels+1; + } + + d->first_level = &d->level_values[0]; + d->last_level = &d->level_values[d->nlevels-1]; + d->after_last_level = &d->level_values[d->nlevels]; + + for( int i=0; i<MAX_BUFF_SIZE; i++ ) d->all_edges[i] = true; + if ( d->m_drv ) { + d->m_drv->setTopBottom( topBottom() ); + d->m_drv->setBottomFill( fill(BMeshFill) ); + } + } + +//-------------------------------------------------------------// + +void QSPlot3D::freeRuntimeData() + { + delete[] d->level_lines; + delete[] d->level_fills; + delete[] d->level_values; + QSPlot::freeRuntimeData(); + delete d; d=NULL; + } + +//-------------------------------------------------------------// + +// +// WYKOSIC FILL I OBLICZAC WLASNORECZNIE +// +// + + +void QSPlot3D::drawPolygon( const QSPt3f pts[], int npoints, QSPt3f *norm, const double *values, const bool *edges ) +// if tvertex != -1 then norm[0] is not nessesary + { + if ( !m_divide ) { + if ( m_ccolors == QSDrv::VertexColors ) { + for( int i=0; i<npoints; i++ ) + if ( colored() ) m_gradient.fill( pts[i].z, d->polygon_fills[i] ); + else d->polygon_fills[i] = m_settings.fills[TMeshFill]; + } else { + if ( colored() ) { + double sum_z = 0.0; for( int i=0; i<npoints; i++ ) sum_z += pts[i].z; + m_gradient.fill( sum_z/npoints, d->polygon_fills[0] ); + } else { + d->polygon_fills[0] = m_settings.fills[TMeshFill]; + } + } + m_drv->drawPoly3( pts, npoints, norm, d->polygon_fills, edges, m_edge_auto_color ); + } else { + if ( !values ) d->draw_divided_polygon( pts, npoints, norm, edges, m_edge_auto_color ); + else d->draw_4d_polygon( pts, npoints, norm, values, edges, m_edge_auto_color ); + } + + } + +//-------------------------------------------------------------// + +void QSPlot3D::plot3d_runtime_data::draw_divided_polygon( const QSPt3f pts[], int npoints, const QSPt3f *norm, const bool *edges, int auto_color ) +// draws polygon cut by z levels + { + if ( npoints == 0 ) return; + + double min_z = pts[0].z; + double max_z = pts[0].z; + for( int i=1; i<npoints; i++ ) { + double curr_z = pts[i].z; + min_z = QMIN( min_z, curr_z ); + max_z = QMAX( max_z, curr_z ); + } + + + // first level + int start_level = find_level_greater_than( min_z ); + + // try to avoid complicated processing if it is not absolutely needed + if ( start_level<nlevels && level_values[start_level]<max_z ) { + + int ninput_pts = npoints; + int nabove_pts = 0; + int nunder_pts = 0; + QSPt3f *input_pts = const_cast<QSPt3f*>(pts); + QSPt3f *above_pts = clip_buff_1; + QSPt3f *under_pts = clip_buff_2; + bool *in_edges = edges ? const_cast<bool*>(edges) : all_edges; + bool *under_edges = edge_buff_1; + bool *above_edges = edge_buff_2; + + // the level plane crosses through out polygon + int level_nr = start_level; + while( level_nr<nlevels && ninput_pts > 0 ) { + cut_polygon( level_values[level_nr], + input_pts, ninput_pts, in_edges, + above_pts, &nabove_pts, above_edges, + under_pts, &nunder_pts, under_edges ); + + // draw polygon under the current level + // TO CHECK: why it sometimes produces nunder_pts==0 + if ( level_nr>0 && nunder_pts>0 ) draw_clipped_polygon( pts, npoints, norm, level_fills[level_nr], under_pts, nunder_pts, under_edges, auto_color ); + + // in first pass stop to use pts ( which is const ) + if ( input_pts == pts ) { input_pts = clip_buff_3; in_edges = edge_buff_3; } + + // rotate buffers: input_pts <-> above_pts + QSPt3f *temp_pts = input_pts; input_pts = above_pts; above_pts = temp_pts; ninput_pts = nabove_pts; + bool *temp_edges = in_edges; in_edges = above_edges; above_edges = temp_edges; + level_nr++; + } + } else { + // polygon contained in the level - no cuts or polygon above the highest level or below the lowest one ( out of drawing area ) + if ( start_level<nlevels && start_level>0 ) draw_simple_polygon( pts, npoints, norm, level_fills[start_level], edges, auto_color ); + } + } + +//-------------------------------------------------------------// + +void QSPlot3D::plot3d_runtime_data::draw_4d_polygon( const QSPt3f pts[], int npoints, const QSPt3f *norm, const double *values, const bool *edges, int auto_color ) +// dravs polygons cut by the v levels ( 4d data ) + { + if ( npoints == 0 ) return; + + double min_v = values[0]; + double max_v = values[0]; + for( int i=1; i<npoints; i++ ) { + double curr_v = values[i]; + min_v = QMIN( min_v, curr_v ); + max_v = QMAX( max_v, curr_v ); + } + + int level_nr = find_level_greater_than( min_v ); + if ( level_nr<nlevels && level_values[level_nr]<max_v ) { + + int ninput_pts = npoints; + int nabove_pts = 0; + int nunder_pts = 0; + QSPt3f *input_pts = const_cast<QSPt3f*>(pts); + double *input_val = const_cast<double*>(values); + QSPt3f *above_pts = clip_buff_1; + double *above_val = clip_value_buff_1; + QSPt3f *under_pts = clip_buff_2; + double *under_val = clip_value_buff_2; + bool *in_edges = edges ? const_cast<bool*>(edges) : all_edges; + bool *under_edges = edge_buff_1; + bool *above_edges = edge_buff_2; + + while( level_nr<nlevels && ninput_pts>0 ) { + cut_polygon4d( level_values[level_nr], + input_pts, ninput_pts, input_val, in_edges, + above_pts, &nabove_pts, above_val, above_edges, + under_pts, &nunder_pts, under_val, under_edges ); + + // draw polygon under the current level ( do not draw anything under level 0 ) + if ( level_nr>0 ) draw_clipped_polygon( pts, npoints, norm, level_fills[level_nr], under_pts, nunder_pts, under_edges, auto_color ); + + // in first pass stop to use pts ( which is const ) + if ( input_pts == pts ) { input_pts = clip_buff_3; input_val = clip_value_buff_3; in_edges = edge_buff_3; } + + // rotate buffers: input_pts <-> above_pts + QSPt3f *temp_pts = input_pts; input_pts = above_pts; above_pts = temp_pts; + double *temp_val = input_val; input_val = above_val; above_val = temp_val; + bool *temp_edges = in_edges; in_edges = above_edges; above_edges = temp_edges; + ninput_pts = nabove_pts; + level_nr++; + } + } else { + // polygon is contained in some level or it is above all levels all it is under all levels ( not drawn in the last two cases ) + if ( level_nr<nlevels && level_nr>0 ) draw_simple_polygon( pts, npoints, norm, level_fills[level_nr], edges, auto_color ); + } + + } + +//-------------------------------------------------------------// + +inline void QSPlot3D::plot3d_runtime_data::draw_simple_polygon( const QSPt3f pts[], int npoints, const QSPt3f *norm, const QSGFill& f, const bool *edges, int auto_color ) + { + polygon_fills[0] = f; + if ( m_ccolors == QSDrv::VertexColors ) for( int i=1; i<npoints; i++ ) polygon_fills[i] = f; + m_drv->drawPoly3( pts, npoints, norm, polygon_fills, edges, auto_color ); + } + +//-------------------------------------------------------------// + +inline void QSPlot3D::plot3d_runtime_data::draw_clipped_polygon( const QSPt3f pts[], int npoints, const QSPt3f *norm, const QSGFill& f, QSPt3f clip_pts[], int nclip_pts, bool *edges, int auto_color ) + { + polygon_fills[0] = f; + if ( m_ccolors == QSDrv::VertexColors ) for( int i=1; i<nclip_pts; i++ ) polygon_fills[i] = f; + + polygon_normals[0] = norm[0]; + if ( m_cnormals == QSDrv::VertexNormals ) QSProjection::clipVertexNormals( pts, npoints, clip_pts, nclip_pts, &norm[1], &polygon_normals[1] ); + + m_drv->drawPoly3( clip_pts, nclip_pts, polygon_normals, polygon_fills, edges, auto_color ); + } + +//-------------------------------------------------------------// + +int QSPlot3D::plot3d_runtime_data::find_level_greater_than( double value ) +// find first level > value or return d->nlevels if all levels are lower then value + { + double *ptr = lower_bound( first_level, after_last_level, value ); + int result = ptr < after_last_level ? ptr-first_level : nlevels; + return result; + } + +//-------------------------------------------------------------// + +void QSPlot3D::plot3d_runtime_data::cut_polygon( double level, const QSPt3f *pts, int npts, const bool *in_edges, + QSPt3f *above_pts, int *above_npts, bool *above_edges, + QSPt3f *under_pts, int *under_npts, bool *under_edges ) + { + bool p_under; + bool s_under; + *above_npts = 0; + *under_npts = 0; + const QSPt3f *p; + const QSPt3f *s = &pts[npts-1]; s_under = ( s->z <= level ); + for( int i=0; i<npts; i++ ) { + p = &pts[i]; p_under = ( p->z <= level ); + + if ( p_under && s_under ) { under_edges[(*under_npts)] = in_edges[i]; under_pts[(*under_npts)++] = *p; } + else + if ( !p_under && !s_under ) { above_edges[(*above_npts)] = in_edges[i]; above_pts[(*above_npts)++] = *p; } + else { + double t = (level-s->z)/(p->z-s->z); + QSPt3f c( s->x + t*(p->x-s->x), + s->y + t*(p->y-s->y), + level ); + + if ( p_under ) under_edges[(*under_npts)] = false; else under_edges[(*under_npts)] = in_edges[i]; + if ( !p_under ) above_edges[(*above_npts)] = false; else above_edges[(*above_npts)] = in_edges[i]; + under_pts[(*under_npts)++] = c; + above_pts[(*above_npts)++] = c; + + if ( p_under ) { under_edges[(*under_npts)] = in_edges[i]; under_pts[(*under_npts)++] = *p; } + if ( !p_under ) { above_edges[(*above_npts)] = in_edges[i]; above_pts[(*above_npts)++] = *p; } + } + + s = p; s_under = p_under; + } + } + +//-------------------------------------------------------------// + +void QSPlot3D::plot3d_runtime_data::cut_polygon4d( double level, + const QSPt3f *input_pts, int input_npts, const double *input_val, const bool *in_edges, + QSPt3f *above_pts, int *above_npts, double *above_val, bool *above_edges, + QSPt3f *under_pts, int *under_npts, double *under_val, bool *under_edges ) + { + bool p_under; + bool s_under; + *above_npts = 0; + *under_npts = 0; + + const QSPt3f *p; + const double *pv; + const QSPt3f *s = &input_pts[input_npts-1]; + const double *sv = &input_val[input_npts-1]; + s_under = ( *sv <= level ); + for( int i=0; i<input_npts; i++ ) { + p = &input_pts[i]; + pv = &input_val[i]; + p_under = ( *pv <= level ); + + if ( p_under && s_under ) { under_edges[(*under_npts)] = in_edges[i]; under_pts[*under_npts] = *p; under_val[*under_npts] = *pv; (*under_npts)++; } + else + if ( !p_under && !s_under ) { above_edges[(*above_npts)] = in_edges[i]; above_pts[*above_npts] = *p; above_val[*above_npts] = *pv; (*above_npts)++; } + else { + double t = (level-*sv)/(*pv-*sv); + QSPt3f c( s->x + t*(p->x-s->x), + s->y + t*(p->y-s->y), + s->z + t*(p->z-s->z) ); + + if ( p_under ) under_edges[(*under_npts)] = false; else under_edges[(*under_npts)] = in_edges[i]; + if ( !p_under ) above_edges[(*above_npts)] = false; else above_edges[(*above_npts)] = in_edges[i]; + under_pts[*under_npts] = c; under_val[*under_npts] = level; (*under_npts)++; + above_pts[*above_npts] = c; above_val[*above_npts] = level; (*above_npts)++; + + if ( p_under ) { under_edges[(*under_npts)] = in_edges[i]; under_pts[*under_npts] = *p; under_val[*under_npts] = *pv; (*under_npts)++; } + if ( !p_under ) { above_edges[(*above_npts)] = in_edges[i]; above_pts[*above_npts] = *p; above_val[*above_npts] = *pv; (*above_npts)++; } + } + + s = p; sv = pv; s_under = p_under; + } + } + +//-------------------------------------------------------------// + +void QSPlot3D::loadStateFromStream( QDataStream& stream, QSObjectFactory *factory ) + { + QSPlot::loadStateFromStream( stream, factory ); + } + +//-------------------------------------------------------------// + +void QSPlot3D::saveStateToStream( QDataStream& stream, QSObjectFactory *factory ) + { + QSPlot::saveStateToStream( stream, factory ); + } + +//-------------------------------------------------------------// diff --git a/kmatplot/widgets/qsplot.h b/kmatplot/widgets/qsplot.h new file mode 100644 index 0000000..eb8f7e8 --- /dev/null +++ b/kmatplot/widgets/qsplot.h @@ -0,0 +1,388 @@ +/*************************************************************************** + qsplot.h + ------------------- + version : 0.1 + begin : 01-January-2000 + copyright : (C) 2000 by Kamil Dobkowski + email : kamildobk@poczta.onet.pl + ***************************************************************************/ + +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + + +#ifndef QSPLOT_H +#define QSPLOT_H + +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + +#include"qsaxes.h" +#include"qsaxis.h" +#include"qsdrv.h" +#include<qstring.h> +#include<math.h> + + + +/** + * \brief Dataset, which can be diplayed using QSAxes + * + * Dataset, which can be diplayed using QSAxes, see QSAxes::plotAdd(). You can bind this dataset to some axes + * in the parent object using setDefaultAxis(). You can map coordinates from data to world coordinates using + * worldToData(). QSPlot contains support for drawing legends, see drawLegendItem(), legendItemSize(). QSCLegend + * uses them extensively. There is also support for 'Data picker' tool implemented, see posInfo(). + * For implementing your own dataset types you will have to reimplement : getAxisRange(), start(), step(), end(), + * and also drawLegendItem(), legendItemSize(), posInfo(), and optionaly allocRuntimeData(), freeRuntimeData(). + * @author Kamil Dobkowski + */ +class QSPlot : public QSAxesChild + { + Q_OBJECT + friend class QSAxes; + Q_PROPERTY( int defaultXAxis READ defaultXAxis WRITE setDefaultXAxis ) + Q_PROPERTY( int defaultYAxis READ defaultYAxis WRITE setDefaultYAxis ) + Q_PROPERTY( int defaultZAxis READ defaultZAxis WRITE setDefaultZAxis ) + Q_PROPERTY( int defaultVAxis READ defaultVAxis WRITE setDefaultVAxis ) + Q_PROPERTY( bool legendItemVisible READ legendItemVisible WRITE setLegendItemVisible ) + Q_PROPERTY( QString gradient READ gradientProperty WRITE setGradientProperty ) + public: + /** + * Constructor. You must add the plot immedialtely to the parent child list + * ( see QSAxes::plotAdd() ) + */ + QSPlot( QSAxes *parentAxes=0, const char *name=0 ); + /** + * Destructor. + */ + virtual ~QSPlot(); + /** + * Sets an axis to which to bind to. Type of this axis is taken from QSAxis::type() . + */ + void setDefaultAxis( QSAxis *axis ); + /** + * Sets the default axis. + */ + void setDefaultXAxis( int axisIndex ); + /** + * Sets the default axis. + */ + void setDefaultYAxis( int axisIndex ); + /** + * Sets the default axis. + */ + void setDefaultZAxis( int axisIndex ); + /** + * Sets the default axis. + */ + void setDefaultVAxis( int axisIndex ); + /** + * Returns an index of the default axis + */ + int defaultXAxis() const { return m_axes->axisIndex(m_daxes[QSAxis::XAxisType]); } + /** + * Returns an index of the default axis + */ + int defaultYAxis() const { return m_axes->axisIndex(m_daxes[QSAxis::YAxisType]); } + /** + * Returns an index of the default axis + */ + int defaultZAxis() const { return m_axes->axisIndex(m_daxes[QSAxis::ZAxisType]); } + /** + * Returns an index of the default axis + */ + int defaultVAxis() const { return m_axes->axisIndex(m_daxes[QSAxis::VAxisType]); } + /** + * Returns default axis. 'axisType' must be one of + * QSAxes::AxisType' ! + */ + QSAxis *defaultAxis( int axisType ) const { return m_daxes[axisType]; } + /** + * Sets a gradient object + */ + void setGradient( const QSGGradient& gradient ); + /** + * Returns a gradient + */ + const QSGGradient gradient() const { return m_gradient; } + /** + * Show legend item corresponding to this plot in legend object + */ + void setLegendItemVisible( bool visible ); + /** + * Returns legend setting. + */ + bool legendItemVisible() const { return m_is_legend; } + /** + * Returns info or QString::null + */ + virtual QString posInfo( QSPt2f& pos ); + /** + * Returns item size + */ + virtual QSPt2f legendItemSize( QSDrv *drv ); + /** + * Draw legend item at position 'pos' + */ + virtual void drawLegendItem( const QSPt2f& pos, QSDrv *drv ); + /** + * Maps a point from an visible axis range to <0,1> + */ + QSPt2f dataToWorld( const QSPt2f& p ) const; + /** + * Maps a point from an visible axis range to <0,1> + */ + QSPt3f dataToWorld( const QSPt3f& p ) const; + /** + * Maps a point from an visible axis range to <0,1> + */ + QSPt3f dataToWorldV( const QSPt3f& p ) const; + /** + * Maps a point from <0,1> to an visible axis range. + */ + QSPt2f worldToData( const QSPt2f& p ) const; + /** + * Maps a point from <0,1> to an visible axis range + */ + QSPt3f worldToData( const QSPt3f& p ) const; + /** + * Maps a point from <0,1> to an visible axis range + */ + QSPt3f worldToDataV( const QSPt3f& p ) const; + /** + * Sets a new gradient. + */ + void setGradientProperty( const QString& string ); + /** + * Returns gradient as QString + */ + QString gradientProperty() const { return toQString(m_gradient); } + + virtual void loadStateFromStream( QDataStream& stream, QSObjectFactory *factory ); + virtual void saveStateToStream( QDataStream& stream, QSObjectFactory *factory ); + + protected slots: + /** + * Check if this plot is not bound to a removed axis. + * if it is, find another axis of the same type - there + * always should be at least one such axis.. + */ + virtual void axisRemoved( QSData *object ); + + protected: + /** + * Must be reimplemented and return data range on each axis or + * false when no data is set. This functions is always called + * outside 'start()' and 'end()' ! + */ + virtual bool getAxisRange( QSAxis *axis, double& min, double& max ); + /** + * Start drawing. Called by parent axes. + * Time-expensive operations should be + * performed in little parts during 'step()' + * call. If returns false - 'end()' is called + * immediately, if returns true - 'step()' is + * called next. + */ + virtual bool start(); + /** + * This function will be called to make drawing + * until it returns false. Notice that drawing + * should be stopped at any time. Even if this + * function returns true parent axes object may + * decide to call end(). + */ + virtual bool step(); + /** + * This can be called by parent axes to stop drawing. + * Normally called after 'step()' returned false; + */ + virtual void end(); + /** + * Called from start(). Everyting which goes to start() may be put here. + * inits m_curr_driver, m_curr_dpi, m_csize, m_cpos fields with values + * taken from parent axes + */ + virtual void allocRuntimeData(); + /** + * Called from end().Everyting which goes to end() may be put here. + */ + virtual void freeRuntimeData(); + + static const int work_steps = 30; + + bool m_busy; + bool m_is_legend; + int m_bkg_handler; + double m_curr_dpi; + QSDrv *m_drv; + QSPt2f m_csize; + QSPt2f m_cpos; + QSAxis *m_daxes[5]; + QSAxes *m_axes; + QSGGradient m_gradient; + const QSProjection *m_proj; + }; + +//--------------------------------------------------------------------------------------// + +/** + * \brief 2D Dataset + * + * Ups ,,, There is no new functionality added to this class, yet. It is the same as QSPlot.. + * @author Kamil Dobkowski + */ +class QSPlot2D : public QSPlot + { + Q_OBJECT + public: + /** + * Constructor. + */ + QSPlot2D( QSAxes *parentAxes, const char *name=0 ); + /** + * Destructor. + */ + virtual ~QSPlot2D(); + }; + +//--------------------------------------------------------------------------------------// + + + +/** + * \brief 3D Dataset + * + * Base class for all 3d datasets ( which draw 3d mesh ). Allows setting + * mesh parameters, which are used to initialize QSDrv and to draw 3d polygons + * with drawPolygon(). + * @author Kamil Dobkowski + */ +class QSPlot3D : public QSPlot + { + Q_OBJECT + Q_PROPERTY( bool colored READ colored WRITE setColored ) + Q_PROPERTY( bool topBottom READ topBottom WRITE setTopBottom ) + Q_PROPERTY( bool autoDivide READ autoDivide WRITE setAutoDivide ) + Q_PROPERTY( int edgeAutoColor READ edgeAutoColor WRITE setEdgeAutoColor ) + + public: + /** + * Constructor. + */ + QSPlot3D( QSAxes *parentAxes, const char *name=0 ); + /** + * Destructor. + */ + virtual ~QSPlot3D(); + /** + * Enables/disables coloring of the 3d mesh. + */ + void setColored( bool enabled ); + /** + * + */ + void setTopBottom( bool enabled ); + /** + * + */ + void setAutoDivide( bool enabled ); + /** + * + */ + void setEdgeAutoColor( int value ); + /** + * + */ + void setClipping( bool clipping ); + /** + * + */ + bool topBottom() const { return m_topbottom; } + /** + * + */ + bool autoDivide() const { return m_divide; } + /** + * + */ + int edgeAutoColor() const { return m_edge_auto_color; } + /** + * + */ + bool clipping() { return m_clipping; } + /** + * Returns the current color setting. + */ + bool colored() const { return m_colored; } + + virtual void loadStateFromStream( QDataStream& stream, QSObjectFactory *factory ); + virtual void saveStateToStream( QDataStream& stream, QSObjectFactory *factory ); + /** + * See QSGraphicalData::setFill() + */ + enum FillElement { + TMeshFill, + BMeshFill + }; + /** + * See QSGraphicalData::setLine() + */ + enum LineElement { + MeshLine + }; + /** + * See QSGraphicalData::setPoint() + */ + enum PointElement { + PointMark + }; + + protected: + + bool m_clipping; + bool m_colored; + int m_edge_auto_color; + bool m_divide; + bool m_topbottom; + QSDrv::CNormals m_cnormals; + QSDrv::CColors m_ccolors; + QSDrv::COrdering m_corder; + /** + * Draws a surface mesh. It is almost the same as QSDrv::drawPoly3(), but draws using a nice colored gradient ( divides polygon into levels ). + * If 'values' is not NULL draws 4D data, 'values' must be table with npoints elements int this case. + */ + void drawPolygon( const QSPt3f pts[], int npoints, QSPt3f *norm, const double *values=NULL, const bool *edges=NULL ); + /** + * Reimplemented. Inits m_ccolors, m_cnormals, m_corder + */ + virtual void allocRuntimeData(); + /** + * Called from end().Everyting which goes to end() may be put here. + */ + virtual void freeRuntimeData(); + /** + * Draws gradient legend + */ + virtual QSPt2f standardLegendItemSize( QSDrv *drv, QSAxis *axis, const QString& title ); + /** + * Draws gradient legend + */ + virtual void drawStandardLegendItem( const QSPt2f& pos, QSDrv *drv, QSAxis *axis, const QString& title, const QSGGradient *gradient ); + + private: + struct plot3d_runtime_data; + struct plot3d_runtime_data *d; + }; + +#endif + + + diff --git a/kmatplot/widgets/qsplotview.cpp b/kmatplot/widgets/qsplotview.cpp new file mode 100644 index 0000000..ba6c2be --- /dev/null +++ b/kmatplot/widgets/qsplotview.cpp @@ -0,0 +1,1445 @@ +/*************************************************************************** + qsplotview.cpp + ------------------- + begin : 01-January-2000 + copyright : (C) 2000 by Kamil Dobkowski + email : kamildobk@poczta.onet.pl + ***************************************************************************/ + +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + + +#include"qsplotview.h" +#include"qsdrvqt.h" +#include"qsdrvhittest.h" +#include"qsruler.h" + +#include<qpixmap.h> +#include<qtimer.h> +#include<qapplication.h> +#include<qcursor.h> +#include<qpaintdevicemetrics.h> +#include<qprinter.h> +#include<qslider.h> +#include<qscrollbar.h> +#include<qevent.h> +#include<qlayout.h> +#include<qpushbutton.h> +#include<qpopupmenu.h> +#include<qtabbar.h> +#include<qinputdialog.h> +#include<qmessagebox.h> + +#include<math.h> + +#ifdef Q_WS_X11 +#include<X11/X.h> +#include<X11/Xlib.h> +#endif + +#define SHADOW_WIDTH 3 +#define SLIDER_WIDTH 16 +#define SCROLLBAR_RANGE 10000.0 + +//-------------------------------------------------------------// + +QSSelection::QSSelection( QObject *parent ) +: QSCObjectCollection( parent, false ) + { + m_workbook = NULL; + m_curr_collection = NULL; + m_root_collection = NULL; + } + +//-------------------------------------------------------------// + +QSSelection::~QSSelection() + { + } + +//-------------------------------------------------------------// + +void QSSelection::set( QSCObject *object ) + { + parametersChanging(); + bool temp = tempAutoUpdatesOff(); + clear(); + if ( object ) { + set_collection( object ); + add( object ); + } + tempAutoUpdatesRestore( temp ); + listChanged(); + parametersChanged(); + } + +//-------------------------------------------------------------// + +void QSSelection::turn( QSCObject *objectToSwitch ) + { + if ( find(objectToSwitch) < 0 ) add( objectToSwitch ); else remove( find(objectToSwitch) ); + } + +//-------------------------------------------------------------// + +void QSSelection::insert( int position, QSCObject *objectToAdd ) + { + if ( objectToAdd && find(objectToAdd) < 0 ) { + if ( !collection() || collection()->find(objectToAdd) < 0 ) clear(); + set_collection( objectToAdd ); + QSCObjectCollection::insert( position, objectToAdd ); + } + } + +//-------------------------------------------------------------// + +void QSSelection::remove( int index ) + { + if ( object(index) ) { + QSCObjectCollection::remove( index ); + if ( isEmpty() ) set_collection( NULL ); + } + } + +//-------------------------------------------------------------// + +void QSSelection::set_collection( QSCObject *object ) + { + if ( m_root_collection ) { + disconnect( m_root_collection, SIGNAL(sigRemoved(QSCObjectCollection*,QSCObject*)), this, SLOT(slot_object_removed(QSCObjectCollection*,QSCObject*)) ); + } + if ( object ) { + m_curr_collection = object->collection(); + m_root_collection = object->rootCollection(); + } else { + m_curr_collection = NULL; + m_root_collection = NULL; + } + if ( m_root_collection ) { + connect( m_root_collection, SIGNAL(sigRemoved(QSCObjectCollection*,QSCObject*)), this, SLOT(slot_object_removed(QSCObjectCollection*,QSCObject*)) ); + } + } + +//-------------------------------------------------------------// + +void QSSelection::set_workbook( QSWorkbook *workbook ) + { + if ( m_workbook != workbook ) { + if ( !isEmpty() ) clear(); + if ( m_workbook ) disconnect( m_workbook, SIGNAL(sigPageRemoved(QSPage*)), this, SLOT(slot_page_removed(QSPage*)) ); + m_workbook = workbook; + if ( m_workbook ) connect( m_workbook, SIGNAL(sigPageRemoved(QSPage*)), this, SLOT(slot_page_removed(QSPage*)) ); + } + } + +//-------------------------------------------------------------// + +void QSSelection::slot_object_removed( QSCObjectCollection*, QSCObject *removedObject ) + { + if ( find(removedObject) >= 0 ) remove( find(removedObject) ); + else + if ( dynamic_cast<QSCGroup*>(removedObject) ) { + // if group contains a one object from our selection + // it must contain all objects so we must clear the whole selection ! + if ( ((QSCGroup*)(removedObject))->objects()->contains(object(0),true) ) clear(); + } + } + +//-------------------------------------------------------------// + +void QSSelection::slot_page_removed( QSPage *page ) + { + if ( page->objects() == m_root_collection ) clear(); + } + + + +//-------------------------------------------------------------// +//-------------------------------------------------------------// +//-------------------------------------------------------------// +//-------------------------------------------------------------// +//-------------------------------------------------------------// + +QSRangeScrollBar::QSRangeScrollBar( QWidget *parent ) +: QScrollBar( 0, 0, 1, 1, 0, QScrollBar::Horizontal, parent ) + { + m_axes = NULL; + m_type = QSAxis::UnknownAxisType; + m_updating_range = false; + m_updating_scrollbars = false; + m_min = 0.0; + m_max = 1.0; + } + +//-------------------------------------------------------------// + +QSRangeScrollBar::~QSRangeScrollBar() + { + } + +//-------------------------------------------------------------// + +void QSRangeScrollBar::setAxes( QSAxes *axes, QSAxis::AxisType type ) + { + m_axes = axes; + m_type = type; + updateScrollbar(); + } + +//-------------------------------------------------------------// + +void QSRangeScrollBar::updateScrollbar() + { + if ( m_updating_range ) return; + + m_updating_scrollbars = true; + + // calculate data range on joined axes in world coordinates + double min = 0.0; + double max = 1.0; + + if ( m_axes && m_type != QSAxis::UnknownAxisType ) + for( int axis_nr=0; axis_nr<m_axes->axisCount(); axis_nr++ ) { + QSAxis *curr_axis = m_axes->axis(axis_nr); + if ( curr_axis->type() == m_type && curr_axis->scrollable() ) { + double data_min = curr_axis->dataToWorld(curr_axis->min(QSAxis::RangeData)); + double data_max = curr_axis->dataToWorld(curr_axis->max(QSAxis::RangeData)); + // Not always data_min < data_max, if axis range is reversed it will be reversed + // so real data_min is QMIN( data_min, data_max ) + min = QMIN( min, QMIN( data_min, data_max ) ); + max = QMAX( max, QMAX( data_min, data_max ) ); + } + } + + // remember for further processing + m_min = min; + m_max = max; + + // visible range in normalized world coordinates ( v_max = v_min + 1.0 ) + double v_min = 0.0 - min; + + // range on axes in normalized coordinates + max = max - min; + min = min - min; // always 0 + + // Map to integer: < 0.0, max > -> < 0, SCROLLBAR_RANGE > + // slider range <0,max-1.0> + setRange( 0, int( (max-1.0)/max*SCROLLBAR_RANGE+0.5 ) ); + // page_step = 1.0 + setPageStep( int( 1.0/max*SCROLLBAR_RANGE+0.5 ) ); + + // value = v_min + int curr_value = int( v_min/max*SCROLLBAR_RANGE+0.5 ); + // reverse direction of the vertical scrollbar + setValue( orientation() == Horizontal ? curr_value : maxValue() - curr_value ); + + m_updating_scrollbars = false; + } + +//-------------------------------------------------------------// + +void QSRangeScrollBar::updateRange() + { + if ( m_updating_scrollbars ) return; + + m_updating_range = true; + + // reverse direction of the vertical scrollbar + int curr_value = orientation() == Horizontal ? value() : maxValue() - value(); + + // Map to float: < 0, SCROLLBAR_RANGE > -> < m_min, m_max > + double v_min = double(curr_value)/SCROLLBAR_RANGE*(m_max-m_min)+m_min; + double v_max = v_min + 1.0; + + // some round-offs + if ( curr_value == maxValue() ) { + v_min = m_max-1.0; + v_max = m_max; + } + + if ( m_axes && m_type != QSAxis::UnknownAxisType ) + for( int axis_nr=0; axis_nr<m_axes->axisCount(); axis_nr++ ) { + QSAxis *curr_axis = m_axes->axis(axis_nr); + if ( curr_axis->type() == m_type && curr_axis->scrollable() ) { + curr_axis->setRange( curr_axis->worldToData(v_min), + curr_axis->worldToData(v_max) ); + } + } + + m_updating_range = false; + } + +//-------------------------------------------------------------// +//-------------------------------------------------------------// +//-------------------------------------------------------------// +//-------------------------------------------------------------// +//-------------------------------------------------------------// +//-------------------------------------------------------------// + + + +QSPlotView::QSPlotView(QWidget *parent, const char *name ) + : QWidget(parent,name) + { + m_refresh_buffer = new QTimer( this ); + connect( m_refresh_buffer, SIGNAL(timeout()), this, SLOT(slot_refresh_screen_buffer()) ); + m_screen_buffer_valid = false; + m_screen_buffer = NULL; + m_workbook = NULL; + m_curr_page = NULL; + m_active_axes = NULL; + m_ctool = NULL; + m_active_object = NULL; + m_tool_activated = false; + m_tool_activating = false; + m_screen_buffering = true; + m_selection = new QSSelection( this ); + connect( m_selection, SIGNAL(sigListChanged()), this, SLOT(slot_selection_changed()) ); + + m_page_margins_visible = true; + + m_full_page = true; + m_zoom = 1.0; + + m_grid_visible = true; + m_grid_x = 5; + m_grid_y = 5; + + m_rulers_visible = true; + m_hruler = NULL; + m_vruler = NULL; + + m_sliders_visible = true; + m_hscrollbar = NULL; + m_vscrollbar = NULL; + + m_page_list = NULL; + + for( int i=0; i<3; i++ ) { + m_sliders[i].slider = NULL; + m_sliders[i].min = 0; + m_sliders[i].max = 0; + } + + for( int i=0; i<2; i++ ) { + m_scrollbars[i].scrollbar = NULL; + m_scrollbars[i].type = QSAxis::UnknownAxisType; + } + + m_interior = new QWidget( this ); + m_interior->installEventFilter(this); + m_interior->setBackgroundColor( lightGray ); + m_interior->show(); + + m_shadow = new QWidget( m_interior ); + m_shadow->setBackgroundColor( black ); + + m_canvas = new QWidget( m_interior ); + m_canvas->installEventFilter(this); + m_canvas->setBackgroundMode( NoBackground ); + + m_layout = new QGridLayout( this, 5, 6 ); + + // scaled main view + m_layout->setRowStretch( 1, 10 ); + m_layout->setColStretch( 1, 0 ); + m_layout->setColStretch( 2, 10 ); + m_layout->addMultiCellWidget( m_interior, 1, 1, 1, 2 ); + + m_layout->setColStretch( 0, 0 ); + m_layout->setColStretch( 3, 0 ); + m_layout->setColStretch( 4, 0 ); + m_layout->setColStretch( 5, 0 ); + m_layout->setColStretch( 6, 0 ); + + m_layout->setRowStretch( 0, 0 ); + m_layout->setRowStretch( 2, 0 ); + m_layout->setRowStretch( 3, 0 ); + m_layout->setRowStretch( 4, 0 ); + + m_pages.setAutoDelete( FALSE ); + + recreate_gui(); + } + +//-------------------------------------------------------------// + +QSPlotView::~QSPlotView() + { + if ( m_curr_page && m_curr_page->objects()->busy() ) m_curr_page->objects()->stop(); + delete m_ctool; + delete m_screen_buffer; + } + +//-------------------------------------------------------------// + +void QSPlotView::setPixmapBuffering( bool enabled ) + { + m_screen_buffering = enabled; + set_backstore_internal( !m_screen_buffering ); + } + +//-------------------------------------------------------------// + +void QSPlotView::slot_selection_changed() + { + if ( selection()->count() == 1 ) { + set_active_object( selection()->object(0), true ); + } else { + set_active_object( NULL, true ); + } + } + +//-------------------------------------------------------------// + +void QSPlotView::recreate_gui() + { + recreate_rulers(); + recreate_parameter_scrollbars(); + recreate_parameter_sliders(); + recreate_canvas_scrollbars(); + recreate_page_bar(); + adjust_canvas_size(); + } + +//-------------------------------------------------------------// + +void QSPlotView::recreate_rulers() + { + if ( m_full_page && m_rulers_visible ) { + if ( !m_hruler ) m_hruler = new QSRuler( QSRuler::Horizontal, this ); + if ( !m_vruler ) m_vruler = new QSRuler( QSRuler::Vertical, this ); + m_hruler->setUnit( UnitMillimeter ); + m_vruler->setUnit( UnitMillimeter ); + m_layout->addMultiCellWidget( m_hruler, 0, 0, 1, 2 ); + m_layout->addWidget( m_vruler, 1, 0 ); + m_hruler->show(); + m_vruler->show(); + } else { + delete m_hruler; + delete m_vruler; + m_hruler = NULL; + m_vruler = NULL; + } + + update_rulers(); + } + +//-------------------------------------------------------------// + +void QSPlotView::update_rulers() +// sync rulers with canvas position + { + if ( m_hruler && m_vruler ) { + m_hruler->setZoom( (float )m_zoom ); + m_vruler->setZoom( (float )m_zoom ); + m_hruler->updateVisibleArea( -m_canvas->x(), -m_canvas->y() ); + m_vruler->updateVisibleArea( -m_canvas->x(), -m_canvas->y() ); + } + } + +//-------------------------------------------------------------// + +void QSPlotView::recreate_parameter_scrollbars() + { + // create only sliders which have type != UnknownAxiType + for( int i=0; i<2; i++ ) { + if ( m_active_axes && m_sliders_visible && !m_full_page && m_scrollbars[i].type != QSAxis::UnknownAxisType ) { + if ( !m_scrollbars[i].scrollbar ) m_scrollbars[i].scrollbar = new QSRangeScrollBar( this ); + connect( m_scrollbars[i].scrollbar, SIGNAL(sliderPressed() ), this, SLOT(slot_scrollbar_pressed() ) ); + connect( m_scrollbars[i].scrollbar, SIGNAL(sliderReleased()), this, SLOT(slot_scrollbar_released()) ); + } else { + delete m_scrollbars[i].scrollbar; m_scrollbars[i].scrollbar = NULL; + } + } + + if ( m_scrollbars[0].scrollbar ) { + connect( m_scrollbars[0].scrollbar, SIGNAL(valueChanged(int)), this, SLOT(slot_hscrollbar_moved(int)) ); + m_scrollbars[0].scrollbar->setOrientation( QScrollBar::Horizontal ); + m_layout->addMultiCellWidget( m_scrollbars[0].scrollbar, 3, 3, 1, 2 ); + m_scrollbars[0].scrollbar->show(); + } + if ( m_scrollbars[1].scrollbar ) { + connect( m_scrollbars[1].scrollbar, SIGNAL(valueChanged(int)), this, SLOT(slot_vscrollbar_moved(int)) ); + m_scrollbars[1].scrollbar->setOrientation( QScrollBar::Vertical ); + m_layout->addWidget( m_scrollbars[1].scrollbar, 1, 4 ); + m_scrollbars[1].scrollbar->show(); + } + + update_parameter_scrollbars(); + } + +//-------------------------------------------------------------// + +void QSPlotView::update_parameter_scrollbars() +// sync scrollbars with parameter value + { + if ( m_scrollbars[0].scrollbar ) m_scrollbars[0].scrollbar->setAxes( m_active_axes, m_scrollbars[0].type ); + if ( m_scrollbars[1].scrollbar ) m_scrollbars[1].scrollbar->setAxes( m_active_axes, m_scrollbars[1].type ); + } + +//-------------------------------------------------------------// + +void QSPlotView::slot_hscrollbar_moved( int ) + { + m_scrollbars[0].scrollbar->updateRange(); + } + +//-------------------------------------------------------------// + +void QSPlotView::slot_vscrollbar_moved( int ) + { + m_scrollbars[1].scrollbar->updateRange(); + } + +//-------------------------------------------------------------// + +void QSPlotView::recreate_parameter_sliders() + { + for( int i=0; i<3; i++ ) { + // create only sliders with non empty property value and with min != max + if ( !m_full_page && m_sliders_visible && !m_sliders[i].property.isEmpty() && m_sliders[i].min != m_sliders[i].max ) { + if ( m_sliders[i].slider == NULL ) { + m_sliders[i].slider = new QSlider( m_sliders[i].min, m_sliders[i].max, 1, m_sliders[i].min, QSlider::Vertical, this ); + connect( m_sliders[i].slider, SIGNAL(sliderPressed() ), this, SLOT(slot_slider_pressed() ) ); + connect( m_sliders[i].slider, SIGNAL(sliderReleased()), this, SLOT(slot_slider_released()) ); + } + } else { + delete m_sliders[i].slider; m_sliders[i].slider = NULL; + } + } + + // Horizontal slider + if ( m_sliders[0].slider ) { + connect( m_sliders[0].slider, SIGNAL(valueChanged(int)), this, SLOT(slot_hslider_moved(int)) ); + m_sliders[0].slider->setFixedHeight( SLIDER_WIDTH ); + m_sliders[0].slider->setOrientation( QSlider::Horizontal ); + m_layout->addMultiCellWidget( m_sliders[0].slider, 4, 4, 1, 2 ); + m_sliders[0].slider->show(); + } + // Vertical slider + if ( m_sliders[1].slider ) { + connect( m_sliders[1].slider, SIGNAL(valueChanged(int)), this, SLOT(slot_vslider_moved(int)) ); + m_sliders[1].slider->setFixedWidth( SLIDER_WIDTH ); + m_layout->addWidget(m_sliders[1].slider, 1, 5 ); + m_sliders[1].slider->show(); + } + // Additional slider + if ( m_sliders[2].slider ) { + connect( m_sliders[2].slider, SIGNAL(valueChanged(int)), this, SLOT(slot_aslider_moved(int)) ); + m_sliders[2].slider->setFixedWidth( SLIDER_WIDTH ); + m_layout->addWidget(m_sliders[2].slider, 1, 6 ); + m_sliders[2].slider->show(); + } + + update_parameter_sliders(); + } + +//-------------------------------------------------------------// + +void QSPlotView::update_parameter_sliders() +// sync sliders with parameter values + { + if ( m_active_axes ) for ( int i=0; i<3; i++ ) + if ( m_sliders[i].slider ) m_sliders[i].slider->setValue( m_active_axes->property( m_sliders[i].property ).toInt() ); + } + +//-------------------------------------------------------------// + +void QSPlotView::slot_hslider_moved( int value ) + { + if ( m_active_axes ) m_active_axes->setProperty( m_sliders[HorizontalSlider].property, value ); + } + +//-------------------------------------------------------------// + +void QSPlotView::slot_vslider_moved( int value ) + { + if ( m_active_axes ) m_active_axes->setProperty( m_sliders[VerticalSlider].property, value ); + } + +//-------------------------------------------------------------// + +void QSPlotView::slot_aslider_moved( int value ) + { + if ( m_active_axes ) m_active_axes->setProperty( m_sliders[AdditionalSlider].property, value ); + } + +//-------------------------------------------------------------// + +void QSPlotView::slot_slider_pressed() + { + if ( m_active_axes ) m_active_axes->setAxesOnly( true ); + emit sigSliderPressed(); + } + +//-------------------------------------------------------------// + +void QSPlotView::slot_slider_released() + { + if ( m_active_axes ) m_active_axes->setAxesOnly( false ); + emit sigSliderReleased(); + } + +//-------------------------------------------------------------// + +void QSPlotView::slot_scrollbar_pressed() + { + emit sigScrollBarPressed(); + } + +//-------------------------------------------------------------// + +void QSPlotView::slot_scrollbar_released() + { + emit sigScrollBarReleased(); + } + +//-------------------------------------------------------------// + +void QSPlotView::recreate_canvas_scrollbars() + { + if ( m_full_page ) { + // horizontal scrollbar + if ( !m_hscrollbar ) m_hscrollbar = new QScrollBar( 0, 0, 1, 1, 0, QScrollBar::Horizontal, this ); + m_hscrollbar->setOrientation( QScrollBar::Horizontal ); + connect( m_hscrollbar, SIGNAL(valueChanged(int)), this, SLOT(slot_update_canvas_pos(int)) ); + m_layout->addWidget(m_hscrollbar, 2, 2 ); + m_hscrollbar->show(); + // veritcal slider + if ( !m_vscrollbar ) m_vscrollbar = new QScrollBar( 0, 0, 1, 1, 0, QScrollBar::Vertical, this ); + m_vscrollbar->setOrientation( QScrollBar::Vertical ); + connect( m_vscrollbar, SIGNAL(valueChanged(int)), this, SLOT(slot_update_canvas_pos(int)) ); + m_layout->addWidget(m_vscrollbar, 1, 3 ); + m_vscrollbar->show(); + } else { + delete m_hscrollbar; m_hscrollbar = NULL; + delete m_vscrollbar; m_vscrollbar = NULL; + } + + update_canvas_scrollbars(); + } + +//-------------------------------------------------------------// + +void QSPlotView::update_canvas_scrollbars() +// sync scrollbars with cancvas pos/size value + { + if ( m_hscrollbar ) { + m_hscrollbar->setRange( -5, QMAX(-5,m_canvas->width()-m_interior->width()+5) ); + m_hscrollbar->setPageStep( m_interior->width() ); + m_hscrollbar->setValue( -m_canvas->x() ); + } + if ( m_vscrollbar ) { + m_vscrollbar->setRange( -5, QMAX(-5,m_canvas->height()-m_interior->height()+5) ); + m_vscrollbar->setPageStep( m_interior->height() ); + m_vscrollbar->setValue( -m_canvas->y() ); + } + } + +//-------------------------------------------------------------// + +void QSPlotView::slot_update_canvas_pos(int) +// sync canvas pos with sliders + { + if ( m_full_page && m_hscrollbar && m_vscrollbar ) { + if ( m_canvas->width() <= m_interior->width() ) m_canvas->move( (m_interior->width()-m_canvas->width())/2,m_canvas->y() ); + else m_canvas->move( -m_hscrollbar->value(),m_canvas->y() ); + if ( m_canvas->height() <= m_interior->height() ) m_canvas->move( m_canvas->x(), (m_interior->height()-m_canvas->height())/2 ); + else m_canvas->move( m_canvas->x(), -m_vscrollbar->value() ); + m_shadow->move( m_canvas->x()+SHADOW_WIDTH, m_canvas->y()+SHADOW_WIDTH ); + update_rulers(); + } + } + +//-------------------------------------------------------------// + +void QSPlotView::recreate_page_bar() + { + // create page list + if ( m_full_page ) { + if ( !m_page_list ) { + m_page_list = new QTabBar( this ); + m_layout->addWidget( m_page_list, 2, 1 ); + m_page_list->setShape( QTabBar::TriangularBelow ); + m_page_list->setFixedWidth( 20 ); + m_page_list->setFixedHeight( 10 ); + m_page_list->installEventFilter( this ); // show page management popup + m_page_list->show(); + connect( m_page_list, SIGNAL(selected(int)), this, SLOT(slot_page_tab_selected(int)) ); + } + + // remove all tabs + QIntDictIterator<QSPage> it( m_pages ); + while ( it.current() ) { + QTab *curr_tab = m_page_list->tab( it.currentKey() ); + m_page_list->removeTab( curr_tab ); + // should I or shouldn't I + //delete curr_tab; + ++it; + } + m_pages.clear(); + + if ( m_workbook ) { + for( int page_nr=0; page_nr<m_workbook->pageCount(); page_nr++ ) { + int id = m_page_list->insertTab( new QTab(m_workbook->page(page_nr)->title()), page_nr ); + m_pages.insert( id, m_workbook->page(page_nr) ); + } + m_page_list->layoutTabs(); + m_page_list->setFixedWidth( QMAX(20,QMIN(m_page_list->sizeHint().width(),250)) ); + m_page_list->setFixedHeight( QMAX(10,m_page_list->sizeHint().height()) ); + } + } else { + delete m_page_list; m_page_list = NULL; m_pages.clear(); + } + + update_page_bar(); + } + +//-------------------------------------------------------------// + +void QSPlotView::update_page_bar() +// sync page_bar with current page value + { + QIntDictIterator<QSPage> it( m_pages ); + while ( it.current() ) { + if ( it.current() == currentPage() ) { + if ( m_page_list ) m_page_list->setCurrentTab( it.currentKey() ); + return; + } + ++it; + } + if ( m_page_list ) m_page_list->setCurrentTab( -1 ); + } + +//-------------------------------------------------------------// + +void QSPlotView::slot_page_tab_selected( int tab_id ) + { + if ( m_workbook ) setCurrentPage( m_workbook->pageFind(m_pages[tab_id]) ); + } + +//-------------------------------------------------------------// + +void QSPlotView::updateCanvas() + { + m_screen_buffer_valid = false; + m_canvas->update(); + } + +//-------------------------------------------------------------// + +void QSPlotView::adjust_canvas_size() +// resize page to the correct size + { + int width; + int height; + + if ( m_full_page ) { + // default values + int w_mm = 210; + int h_mm = 297; + // take page size from workbook + if ( m_workbook && m_workbook->printer() ) { + QPaintDeviceMetrics pdm(m_workbook->printer()); + w_mm = pdm.widthMM(); + h_mm = pdm.heightMM(); + } + QRect r( 0, 0, + int(QSCoord::mmToPixels(w_mm,dpi())+0.5), + int(QSCoord::mmToPixels(h_mm,dpi())+0.5) ); + width = r.width(); + height = r.height(); + } else { + // single view mode + width = m_interior->width(); + height = m_interior->height(); + } + + m_canvas->resize( width, height ); + + if ( m_canvas->width() <= m_interior->width() ) { + int x = ( m_interior->width() - m_canvas->width() ) / 2; + int y = m_canvas->y(); + m_canvas->move( x, y ); + } else { + if ( m_canvas->x() > 0 ) m_canvas->move( 0, m_canvas->y() ); + } + + if ( m_canvas->height() <= m_interior->height() ) { + int x = m_canvas->x(); + int y = ( m_interior->height() - m_canvas->height() ) / 2; + m_canvas->move( x, y ); + } else { + if ( m_canvas->y() > 0 ) m_canvas->move( m_canvas->x(), 0 ); + } + + m_shadow->move( m_canvas->x()+SHADOW_WIDTH, + m_canvas->y()+SHADOW_WIDTH ); + m_shadow->resize( m_canvas->size() ); + + // invalidate pixmap buffer + if ( m_screen_buffer && + ( m_screen_buffer->width() != m_canvas->width() || + m_screen_buffer->height() != m_canvas->height() ) ) m_screen_buffer_valid = false; + + // hide pages if there is no current page + if ( !m_curr_page ) { + m_shadow->hide(); + m_canvas->hide(); + } else { + m_shadow->show(); + m_canvas->show(); + } + + if ( m_full_page ) { + update_canvas_scrollbars(); + update_rulers(); + } + } + +//-------------------------------------------------------------// + +void QSPlotView::setWorkbook( QSWorkbook *workbook ) +// wach out canvas size changes - printer() + { + if ( m_workbook != workbook ) { + if ( m_workbook ) { + disconnect( m_workbook, SIGNAL(sigPrinterChanged()), this, SLOT(adjust_canvas_size()) ); + disconnect( m_workbook, SIGNAL(sigPageRemoved(QSPage*)), this, SLOT(slot_page_removed(QSPage*)) ); + disconnect( m_workbook, SIGNAL(sigPageAdded(QSPage*)), this, SLOT(slot_page_added(QSPage*)) ); + disconnect( m_workbook, SIGNAL(sigPageOrder()), this, SLOT(slot_page_order()) ); + disconnect( m_workbook, SIGNAL(sigPageListChanged()), this, SLOT(slot_page_list_changed()) ); + disconnect( m_workbook, SIGNAL(sigObjectRemoved(QSCObject*)), this, SLOT(slot_object_removed(QSCObject*)) ); + } + m_workbook = workbook; + m_selection->set_workbook( workbook ); + if ( m_workbook ) { + connect( m_workbook, SIGNAL(sigPrinterChanged()), this, SLOT(adjust_canvas_size()) ); + connect( m_workbook, SIGNAL(sigPageRemoved(QSPage*)), this, SLOT(slot_page_removed(QSPage*)) ); + connect( m_workbook, SIGNAL(sigPageAdded(QSPage*)), this, SLOT(slot_page_added(QSPage*)) ); + connect( m_workbook, SIGNAL(sigPageOrder()), this, SLOT(slot_page_order()) ); + connect( m_workbook, SIGNAL(sigPageListChanged()), this, SLOT(slot_page_list_changed()) ); + connect( m_workbook, SIGNAL(sigObjectRemoved(QSCObject*)), this, SLOT(slot_object_removed(QSCObject*)) ); + } + recreate_page_bar(); // new number of pages + adjust_canvas_size(); // new printer() - page size + setCurrentPage( 0 ); // new current page + } + } + +//-------------------------------------------------------------// + +void QSPlotView::slot_page_removed( QSPage *page ) + { + //if ( page->objectFind(activeObject())>=0 ) setActiveObject( NULL ); + // page isn't deleted yet so we can disconnect all signals safely + if ( page == currentPage() ) setCurrentPage( 0 ); + } + +//-------------------------------------------------------------// + +void QSPlotView::slot_page_added( QSPage *page ) + { + //recreate_page_bar(); + if ( currentPage() == NULL ) setCurrentPage( m_workbook->pageFind(page) ); + } + +//-------------------------------------------------------------// + +void QSPlotView::slot_page_order() + { + } + +//-------------------------------------------------------------// + +void QSPlotView::slot_page_list_changed() + { + recreate_page_bar(); + } + +//-------------------------------------------------------------// + +void QSPlotView::slot_object_removed( QSCObject * ) + { + // object isnt deleted yet so we can disconnect all signals safely + //if ( object == activeObject() ) setActiveObject( NULL ); + } + +//-------------------------------------------------------------// + +void QSPlotView::setCurrentPage( int index ) + { + QSPage *new_page = m_workbook ? m_workbook->page(index) : NULL; + if ( new_page != m_curr_page ) { + if ( m_curr_page && m_curr_page->objects()->busy() ) m_curr_page->objects()->stop(); + deactivate_tool(); + // hope that page isn't deleted yet + if ( m_curr_page ) { + disconnect( m_curr_page, SIGNAL(sigPageChanged()), this, SLOT(updateCanvas()) ); + disconnect( m_curr_page, SIGNAL(sigTitleChanged(const QString&)), this, SLOT(slot_curr_page_title_changed(const QString&)) ); + disconnect( m_curr_page->objects(), SIGNAL(sigListChanged()), this, SLOT(slot_curr_page_object_list_changed()) ); + } + m_curr_page = new_page; + if ( m_curr_page ) { + connect( m_curr_page, SIGNAL(sigPageChanged()), this, SLOT(updateCanvas()) ); + connect( m_curr_page, SIGNAL(sigTitleChanged(const QString&)), this, SLOT(slot_curr_page_title_changed(const QString&)) ); + connect( m_curr_page->objects(), SIGNAL(sigListChanged()), this, SLOT(slot_curr_page_object_list_changed()) ); + } + update_page_bar(); + activate_tool(); // page can't change when tool is active + adjust_canvas_size(); // hide page if is null + updateCanvas(); + emit sigCurrentPageChanged(); + } + } + +//-------------------------------------------------------------// + +void QSPlotView::slot_curr_page_object_list_changed() + { + emit sigCurrentPageObjectListChanged(); + } + +//-------------------------------------------------------------// + +void QSPlotView::set_active_object( QSCObject *o, bool ) + { + if ( m_active_object != o ) { + //if ( !tool ) deactivate_tool(); + m_active_object = o; + set_active_axes( o ? o->parentAxes() : NULL ); + //if ( !tool ) activate_tool(); + emit sigActiveObjectChanged(); + if ( !m_full_page ) updateCanvas(); + } + } + +//-------------------------------------------------------------// + +void QSPlotView::activate_tool() + { + if ( m_ctool && !m_tool_activated && !m_tool_activating ) { + // if in activate() or deactivate() you change active axes + // there can appear infinity loop ->set_active_axes -> deactivate -> set_active_axes ... + m_tool_activating = true; + m_tool_activated = true; + m_ctool->activate(this); + m_tool_activating = false; + } + } + +//-------------------------------------------------------------// + +void QSPlotView::deactivate_tool() + { + if ( m_ctool && m_tool_activated && !m_tool_activating ) { + m_tool_activating = true; + m_tool_activated = false; + m_ctool->deactivate(); + // clean after tool - set default values. + m_canvas->setCursor( ArrowCursor ); + m_canvas->setFocusPolicy(QWidget::NoFocus); + m_tool_activating = false; + } + } + +//-------------------------------------------------------------// + +void QSPlotView::set_active_axes( QSAxes *axes ) + { + if ( m_active_axes != axes ) { + deactivate_tool(); + clean(); + m_active_axes = axes; + init(); + activate_tool(); + emit sigActiveAxesChanged(); + } + } + +//-------------------------------------------------------------// + +void QSPlotView::init() +// called after new active axes has been set + { + if ( m_active_axes ) { + connect(m_active_axes,SIGNAL(sigUpdate()),this,SLOT(slot_active_axes_modified()) ); + connect(m_active_axes,SIGNAL(sigRangesValid()),this,SLOT(slot_active_axes_ranges_changed()) ); + connect(m_active_axes,SIGNAL(sigChildRemoved(QSData*)),this,SLOT(slot_active_axes_changed(QSData*))); + connect(m_active_axes,SIGNAL(sigChildAdded(QSData*)),this,SLOT(slot_active_axes_changed(QSData*))); + connect(m_active_axes,SIGNAL(sigChildOrder()),this,SLOT(slot_active_axes_order())); + } + + set_backstore_internal( !m_screen_buffering ); + update_parameter_scrollbars(); + update_parameter_sliders(); + } + +//-------------------------------------------------------------// + +void QSPlotView::clean() +// called when active axes are to be changed + { + if ( m_active_axes ) { + disconnect(m_active_axes, SIGNAL(sigUpdate()), this, SLOT(slot_active_axes_modified()) ); + disconnect(m_active_axes,SIGNAL(sigRangesValid()),this,SLOT(slot_active_axes_ranges_changed())); + disconnect(m_active_axes,SIGNAL(sigChildRemoved(QSData*)),this,SLOT(slot_active_axes_changed(QSData*))); + disconnect(m_active_axes,SIGNAL(sigChildAdded(QSData*)),this,SLOT(slot_active_axes_changed(QSData*))); + disconnect(m_active_axes,SIGNAL(sigChildOrder()),this,SLOT(slot_active_axes_order())); + } + } + +//-------------------------------------------------------------// + +void QSPlotView::slot_active_axes_changed( QSData * ) + { + emit sigActiveAxesDatasetsChanged(); + } + +//-------------------------------------------------------------// + +void QSPlotView::slot_active_axes_order() + { + emit sigActiveAxesDatasetsChanged(); + } + +//-------------------------------------------------------------// + +void QSPlotView::slot_active_axes_modified() + { + update_parameter_sliders(); + } + +//-------------------------------------------------------------// + +void QSPlotView::slot_active_axes_ranges_changed() +// called EVERY times plot is redrawn ( not only when ranges really change ) + { + update_parameter_scrollbars(); + } + +//-------------------------------------------------------------// + +QSCObject *QSPlotView::objectAt( const QPoint& p, bool recursive ) + { + QSCObject *result = NULL; + if ( m_full_page && m_curr_page ) { + QSPt2f pos( p.x(), p.y() ); + QSDrvHitTest drv(pos); + drv.setDC(new QPainter(m_canvas),dpi(),true); + drv.startDrawing(); // needed + result = m_curr_page->objects()->objectAt(pos,&drv,recursive); + } else { + if ( m_active_axes ) return m_active_axes->shadowObject(); + } + + return result; + } + + +//-------------------------------------------------------------// + +void QSPlotView::setGridSpacing( int x_mm, int y_mm ) + { + if ( m_grid_x != x_mm || + m_grid_y != y_mm ) { + m_grid_x = x_mm; + m_grid_y = y_mm; + updateCanvas(); + } + } + +//-------------------------------------------------------------// + +void QSPlotView::setGridVisible( bool visible ) + { + if ( m_grid_visible != visible ) { + m_grid_visible = visible; + updateCanvas(); + } + } + +//-------------------------------------------------------------// + +void QSPlotView::setPageMarginsVisible( bool visible ) + { + if ( m_page_margins_visible != visible ) { + m_page_margins_visible = visible; + updateCanvas(); + } + } + +//-------------------------------------------------------------// + +void QSPlotView::setRulersVisible( bool visible ) + { + if ( m_rulers_visible != visible ) { + m_rulers_visible = visible; + recreate_rulers(); + } + } + +//-------------------------------------------------------------// + +void QSPlotView::setFullPage( bool enabled ) + { + if ( m_full_page != enabled ) { + deactivate_tool(); + m_full_page = enabled; + recreate_gui(); // hide rulers/scrollbars - show sliders + adjust_canvas_size(); // fit/unfit canvas to the view area + activate_tool(); + } + } + +//-------------------------------------------------------------// + +void QSPlotView::setZoom( double new_zoom ) + { + if ( new_zoom >= 0.1 && new_zoom < 5.0 ) { + deactivate_tool(); + m_zoom = new_zoom; + adjust_canvas_size(); + activate_tool(); + } + } + +//-------------------------------------------------------------// + +void QSPlotView::bindSlider( QSPlotView::SliderType t, const char* property, int min, int max ) + { + m_sliders[t].property = property; + m_sliders[t].min = min; + m_sliders[t].max = max; + recreate_parameter_sliders(); + } + +//-------------------------------------------------------------// + +void QSPlotView::bindScrollBar( QSPlotView::ScrollBarType t, QSAxis::AxisType type ) + { + m_scrollbars[t].type = type; + recreate_parameter_scrollbars(); + } + +//-------------------------------------------------------------// + +void QSPlotView::setSlidersVisible( bool visible ) + { + if ( m_sliders_visible != visible ) { + m_sliders_visible = visible; + recreate_parameter_scrollbars(); + recreate_parameter_sliders(); + } + } + +//-------------------------------------------------------------// + +void QSPlotView::setTool( QSTool *t ) + { + if ( t != m_ctool ) { + deactivate_tool(); + delete m_ctool; + m_ctool = t; + if ( m_ctool ) { + activate_tool(); + m_canvas->setMouseTracking(TRUE); + } else { + m_canvas->setMouseTracking(FALSE); + showUserMessage( QString::null ); + } + } + } + +//-------------------------------------------------------------// + +void QSPlotView::draw_tool() +// tool can provide its own drawing procedure ( handles, cursors, etc. ) +// this is called after page is drawn + { + //emit message( "Time " + QString::number(time.msecsTo(QTime::currentTime()))+" ms." ); + if ( m_ctool && m_tool_activated ) m_ctool->draw(); + } + +//-------------------------------------------------------------// + +bool QSPlotView::eventFilter( QObject *o, QEvent *e ) + { + if ( o == m_canvas ) { + // why not working in switch-case - strange bug in Qt ?? + // simply ignore Focus events ( no redraws when focus changes !! ) + if ( dynamic_cast<QFocusEvent *>(e) ) return TRUE; + switch( e->type() ) { + // avoid some unwise clip restrictions in Qt + case QEvent::Paint: + QApplication::postEvent( m_canvas, new QEvent(QEvent::User) ); + return TRUE; + // here we have no permament clip area. + case QEvent::User: + draw_page(); return TRUE; + // turn on X11- backstoring + case QEvent::Show: + set_backstore_internal( !m_screen_buffering ); break; + // do not repaint if m_canvas gets focus. + // - repainting is too time-expensive + // ( OK, we block all focus events ! ). + //case QEvent::FocusIn: + //case QEvent::FocusOut: + // pass all events to the tool currently active + default: + if ( m_ctool && m_tool_activated ) return m_ctool->canvasEvent( e ); + } + } + else if ( o == m_interior ) { + // in single view mode canvas fits to the view area + if ( e->type() == QEvent::Resize ) { + adjust_canvas_size(); + return FALSE; + } + } + else if ( o == m_page_list && m_page_list ) { + if ( e->type() == QEvent::MouseButtonPress ) + if ( ((QMouseEvent *)e)->button() == QEvent::RightButton ) emit sigPageBarClicked(); + } + return FALSE; + } + +//-------------------------------------------------------------// + +bool QSPlotView::confirm( const QString& message ) + { + return QMessageBox::warning( NULL, tr("Confirmation"), message, QMessageBox::Yes, QMessageBox::No, 0 ) == QMessageBox::Yes; + } + +//-------------------------------------------------------------// + +void QSPlotView::draw_page() + { + // just update screen from a buffer if the buffer exists + if ( m_screen_buffering && m_screen_buffer && m_screen_buffer_valid ) { + slot_refresh_screen_buffer(); + return; + } + + // we must draw all from the begining + // stop all pending drawing operations + if ( m_curr_page && + m_curr_page->objects()->busy() ) + m_curr_page->objects()->stop(); + + if ( m_active_axes && + m_active_axes->shadowObject()->busy() ) + m_active_axes->shadowObject()->stop(); + + // delete an old screen buffer + delete m_screen_buffer; m_screen_buffer = NULL; + + // paint device can be m_screen_buffer or directly m_canvas + QPaintDevice *paint_device; + if ( m_screen_buffering ) { + m_screen_buffer = new QPixmap( m_canvas->width(), m_canvas->height() ); + m_screen_buffer_valid = true; + paint_device = m_screen_buffer; + } else { + paint_device = m_canvas; + } + + // ok start flushing bitmap to screen at given intervals + if ( m_screen_buffering ) m_refresh_buffer->start( 300 ); + // draw page - can stop timer if there is no jobs in the background + if ( m_full_page ) draw_full_page( paint_device ); else draw_single_view( paint_device ); + // + if ( !m_screen_buffering ) draw_tool(); + + } + +//-------------------------------------------------------------// + +void QSPlotView::draw_single_view( QPaintDevice *paint_device ) + { + QPainter p( paint_device ); + QRect r = m_canvas->rect(); + + // draw margins + int mw = r.width() * 15 / 100; + int mh = r.height() * 15 / 100; + + QRect m; + m = r; m.setBottom( m.top()+mh ); p.fillRect( m, white ); + m = r; m.setTop( m.bottom()-mh ); p.fillRect( m, white ); + m = r; m.setRight( m.left()+mw ); p.fillRect( m, white ); + m = r; m.setLeft( m.right()-mw ); p.fillRect( m, white ); + + r.setTop( r.top()+mh ); + r.setBottom( r.bottom()-mh ); + r.setLeft( r.left()+mw ); + r.setRight( r.right()-mw ); + + if ( m_active_axes ) { + m_perf_monitor.start(); + connect( m_active_axes, SIGNAL(sigDrawEnds()), this, SLOT(slot_axes_draw_ends()) ); + m_active_axes->setCanvasRect( QSRectf( r.x(), r.y(), r.width(), r.height() ) ); + m_active_axes->paintPlot( &p, dpi(), false, false ); + } else { + p.fillRect( r, white ); + } + } + +//-------------------------------------------------------------// + +void QSPlotView::draw_full_page( QPaintDevice *paint_device ) + { + QPainter p( paint_device ); + + // page color - always white + p.fillRect( m_canvas->rect(), white ); + + // draw margins + if ( m_workbook && m_workbook->printer() ) { + QRect margs = m_canvas->rect(); + + // draw frame + p.setPen( black ); + p.setBrush( NoBrush ); + p.drawRect( margs ); + + // draw margins + QPaintDeviceMetrics pdm(m_workbook->printer()); + int mw = m_workbook->printer()->margins().width() * m_canvas->width() / pdm.width(); + int mh = m_workbook->printer()->margins().height() * m_canvas->height() / pdm.height(); + + margs.setTop( mh ); + margs.setLeft( mw ); + margs.setRight( margs.right() - mw + 1 ); + margs.setBottom( margs.bottom() - mh + 1 ); + + p.setBrush( NoBrush ); + p.setPen( QPen( blue, 0, DotLine ) ); + if ( m_page_margins_visible ) p.drawRect( margs ); + } + + if ( m_grid_visible ) draw_grid( &p ); + if ( m_curr_page ) { + connect( m_curr_page->objects(), SIGNAL(sigDrawEnds()), this, SLOT(slot_page_draw_ends()) ); + m_curr_page->paint( &p, dpi(), false ); + } + } + +//-------------------------------------------------------------// + +void QSPlotView::draw_grid( QPainter *p ) + { + double x_step = QSCoord::mmToPixels((double)m_grid_x,dpi()); + double y_step = QSCoord::mmToPixels((double)m_grid_y,dpi()); + double curr_y_pos = y_step; + double curr_x_pos = x_step; + if ( x_step >= 2.0 && y_step >= 2.0 ) { + p->setPen( gray ); + while( curr_y_pos < m_canvas->rect().bottom() ) { + while ( curr_x_pos < m_canvas->rect().right() ) { + p->drawPoint( int(curr_x_pos+0.5), int(curr_y_pos+0.5) ); + curr_x_pos += x_step; + } + curr_x_pos = x_step; + curr_y_pos += y_step; + } + } + } + +//-------------------------------------------------------------// + +void QSPlotView::showUserMessage( const QString& msg ) + { + emit message( msg ); + } + +//-------------------------------------------------------------// + +void QSPlotView::set_backstore_internal( bool enabled ) + { + #ifdef Q_WS_X11 + XSetWindowAttributes attributes; + // NotUseful, WhenMapped or Always + if ( enabled ) attributes.backing_store = Always; + else attributes.backing_store = NotUseful; + XChangeWindowAttributes( m_canvas->x11Display(), + m_canvas->winId(), + CWBackingStore, + &attributes ); + #endif + } + +//-------------------------------------------------------------// + +bool QSPlotView::backstore_internal() + { + bool result = false; + #ifdef Q_WS_X11 + XWindowAttributes attributes; + // NotUseful, WhenMapped or Always + XGetWindowAttributes( m_canvas->x11Display(), m_canvas->winId(), &attributes ); + result = (attributes.backing_store != NotUseful ); + #endif + return result; + } + +//-------------------------------------------------------------// + +QSCObjectCollection *QSPlotView::activeCollection() const + { + if ( currentPage() && + dynamic_cast<QSCGroup*>(activeObject()) && + currentPage()->objects() == activeObject()->rootCollection() ) { + return ((QSCGroup *)activeObject())->objects(); + } + else if ( currentPage() ) { + return currentPage()->objects(); + } + return NULL; + } + +//-------------------------------------------------------------// + +void QSPlotView::slot_axes_draw_ends() + { + if ( !m_full_page ) showUserMessage( QString(" Drawing time ")+QString::number(m_perf_monitor.elapsed())+" ms." ); + disconnect( m_active_axes, SIGNAL(sigDrawEnds()), this, SLOT(slot_axes_draw_ends()) ); + slot_refresh_screen_buffer(); + m_refresh_buffer->stop(); + } + +//-------------------------------------------------------------// + +void QSPlotView::slot_page_draw_ends() + { + disconnect( m_curr_page->objects(), SIGNAL(sigDrawEnds()), this, SLOT(slot_page_draw_ends()) ); + slot_refresh_screen_buffer(); + m_refresh_buffer->stop(); + } + +//-------------------------------------------------------------// + +void QSPlotView::slot_refresh_screen_buffer() + { + if ( m_screen_buffer ) { + bitBlt( m_canvas, 0, 0, m_screen_buffer, 0, 0, m_screen_buffer->width(), m_screen_buffer->height(), CopyROP, TRUE ); + draw_tool(); + } + } + +//-------------------------------------------------------------// + +void QSPlotView::slot_curr_page_title_changed( const QString& new_title ) + { + emit sigCurrentPageTitleChanged( new_title ); + } + +//-------------------------------------------------------------// diff --git a/kmatplot/widgets/qsplotview.h b/kmatplot/widgets/qsplotview.h new file mode 100644 index 0000000..d88ab19 --- /dev/null +++ b/kmatplot/widgets/qsplotview.h @@ -0,0 +1,492 @@ +/*************************************************************************** + qsplotview.h + ------------------- + begin : 01-January-2000 + copyright : (C) 2000 by Kamil Dobkowski + email : kamildobk@poczta.onet.pl + ***************************************************************************/ + +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + + +#ifndef QSPLOTVIEW_H +#define QSPLOTVIEW_H + +#include "qscoord.h" +#include "qsaxes.h" +#include "qsaxis.h" +#include "qsctool.h" +#include "qsworkbook.h" +#include <qdatetime.h> +#include <qcstring.h> +#include <qwidget.h> +#include <qscrollbar.h> +#include <qintdict.h> +#include <qptrlist.h> + +class QTimer; +class QPixmap; +class QSRuler; +class QSRangeScrollBar; +class QPushButton; +class QTabBar; +class QPopupMenu; +class QScrollBar; +class QGridLayout; +class QEvent; +class QSlider; +class QSPlotView; + +/** + * \brief Holds a list of selected objects for QSPlotView + * + * Notice that selection doesn't own its objects, so QSCObject::colection() doesn't return selection but some + * other collection ( QSPage::objects() for example ) which the object belongs to. + * Only object which belongs to the same collection can be selected at one time. + * Before an object from another collection is added selection is cleared. + */ +class QSSelection : public QSCObjectCollection + { + friend class QSPlotView; + Q_OBJECT + public: + /** + * Constructor + */ + QSSelection( QObject *parent=NULL ); + /** + * Destructor + */ + virtual ~QSSelection(); + /** + * Returns the selection default collection. + */ + QSCObjectCollection *collection() const { return m_curr_collection; } + /** + * Returns the selection default collection. + */ + QSCObjectCollection *rootCollection() const { return m_root_collection; } + /** + * Set selection to this object. + */ + void set( QSCObject *object ); + /** + * Adds a new object to the selection or removes selected object. + */ + void turn( QSCObject *object ); + /** + * Adds object to a selection + */ + virtual void insert( int position, QSCObject *object ); + /** + * Removes selected object from the selection + */ + virtual void remove( int index ); + + + private: + QSWorkbook *m_workbook; + QSCObjectCollection *m_curr_collection; + QSCObjectCollection *m_root_collection; + void set_workbook( QSWorkbook *workbook ); + void set_collection( QSCObject *object ); + + private slots: + void slot_object_removed(QSCObjectCollection*,QSCObject*); + void slot_page_removed( QSPage *page ); + }; + +//-----------------------------------------------------------------// + +/** + * \brief View class for QSWorkbook document + * + * Just call setWorkbook(). View updates itself + * automatically when workbook changes. It also manages + * canvas tools, see setTool(). Some object in the workbook can + * be selected, see selection(). + * @author Kamil Dobkowski + */ +class QSPlotView : public QWidget { + Q_OBJECT + public: + /** + * See bindScrollBar() + */ + enum ScrollBarType { HorizontalBar = 0, VerticalBar = 1 }; + /** + * See bindSlider() + */ + enum SliderType { HorizontalSlider = 0, VerticalSlider = 1, AdditionalSlider = 2 }; + /** + * Constructor. + */ + QSPlotView(QWidget *parent=0, const char *name=0); + /** + * Destructor. + */ + virtual ~QSPlotView(); + /** + * Sets a workbook. + */ + void setWorkbook( QSWorkbook *workbook ); + /** + * Returns a default workbook. + */ + QSWorkbook *workbook() const { return m_workbook; } + /** + * Returns pointer to the current page. See slot setCurrentPage(). + */ + QSPage *currentPage() const { return m_curr_page; } + /** + * Returns selection + */ + QSSelection *selection() const { return m_selection; } + /** + * Enables/disables pixmap buffering. + */ + void setPixmapBuffering( bool enabled ); + /** + * Returns if pixmap buffering is on + */ + bool pixmapBuffering() const { return m_screen_buffering; } + /** + * Sets a new tool. + */ + void setTool( QSTool *t ); + /** + * Turns on/off the full page mode. + */ + void setFullPage( bool enabled ); + /** + * Sets a zoom value. Currently accepts values between 0.1 and 5.0. + */ + void setZoom( double zoom ); + /** + * Sets grid spacing + */ + void setGridSpacing( int x_mm, int y_mm ); + /** + * Shows/hides grid + */ + void setGridVisible( bool visible ); + /** + * Shows/hides rulers + */ + void setRulersVisible( bool visible ); + /** + * Shows/hides sliders and scrollbars + */ + void setSlidersVisible( bool visible ); + /** + * Shows/hides page margin + */ + void setPageMarginsVisible( bool visible ); + /** + * Returns the currently active object. If selection contains + * only one object - it becames active object, active object is + * NULL if selection contains more than a one object. + */ + QSCObject *activeObject() const { return m_active_object; } + /** + * Returns the active axes or NULL.( active means a parent axes of the selected object ). + */ + QSAxes *activeAxes() const { return m_active_axes; } + /** + * Default parent collection for newly created objects. + * If QSGroup s selected this is QSCGroup, if not this is QSPage or NULL. + */ + QSCObjectCollection *activeCollection() const; + /** + * Returns a grid spacing + */ + int gridSpacingX() const { return m_grid_x; } + /** + * Returns a grid spacing + */ + int gridSpacingY() const { return m_grid_y; } + /** + * Is grid visible. + */ + bool gridVisible() const { return m_grid_visible; } + /** + * Are rulers visible. + */ + bool rulersVisible() const { return m_rulers_visible; } + /** + * Returns the current 'slider' state. + */ + bool slidersVisible() const { return m_sliders_visible; } + /** + * Is page margin visible. + */ + bool pageMarginsVisible() const { return m_page_margins_visible; } + /** + * Returns a full page setting. + */ + bool fullPage() const { return m_full_page; } + /** + * Return zoom value + */ + double zoom() const { return m_zoom; } + /** + * Current dpi of the canvas. It is calculated as follows: zoom*72.0 + */ + double dpi() const { return m_full_page ? m_zoom * 72.0 : 72.0; } + /** + * Designates a scrollbar to set a range on the given axis. + * This applies only to the active axes object. + * Only bounded scrollbars are visible. To unbind call this + * function with axis = UnknownAxisType. Those settings are valid even + * after plot object has changed. + */ + void bindScrollBar( ScrollBarType t, QSAxis::AxisType axisType ); + /** + * Designates a slider to set a given property of an active axes. + * To unbind call this function with 'property' set to QSCString::null. + */ + void bindSlider( SliderType t, const char *property, int min, int max ); + /** + * A bumber of axis or UnknownAxisType. + */ + QSAxis::AxisType scrollBarAxis( ScrollBarType t ) const { return m_scrollbars[t].type; } + /** + * Returns a property name or null. + */ + QCString sliderProperty( SliderType t ) const { return m_sliders[t].property; } + /** + * Returns a min value or 0. + */ + int sliderMin( SliderType t ) const { return m_sliders[t].min; } + /** + * Returns a max value or 0. + */ + int sliderMax( SliderType t ) const { return m_sliders[t].max; } + /** + * Returns the currently selected tool + */ + QSTool *tool() const { return m_ctool; } + /** + * Returns a canvas. + */ + QWidget *canvasWidget() const { return m_canvas; } + /** + * Returns object at position 'pos' or NULL. if 'recursive' is + * true it digs through all QSCGroups. + */ + QSCObject *objectAt( const QPoint& pos, bool recursive = true ); + /** + * Shows a user message. Emits message() signal. + */ + void showUserMessage( const QString& msg ); + /** + * Reimplemented + */ + bool eventFilter( QObject *, QEvent* ); + + public slots: + /** + * Sets the current ( displayed ) page + */ + void setCurrentPage( int index ); + /** + * Updates canvas. There should be no need to call this directly. + * It is always called when the current page changes. + */ + void updateCanvas(); + + signals: + /** + * Status messages. Emmited mainly by tools during their work. + */ + void message( const QString& msg ); + /** + * Emitted when a selected object changes. + */ + void sigActiveObjectChanged(); + /** + * Emitted when an active object changes, + * Notice that an active axes can change in this case too. + */ + void sigActiveAxesChanged(); + /** + * Added removed reordered. + */ + void sigActiveAxesDatasetsChanged(); + /** + * Current page was changed - see: setCurrentPage() . + */ + void sigCurrentPageChanged(); + /** + * Current page title has changed + */ + void sigCurrentPageTitleChanged( const QString& newTitle ); + /** + * Current page object list was changed. + */ + void sigCurrentPageObjectListChanged(); + /** + * Mouse right-button click over page bar. + */ + void sigPageBarClicked(); + /** + * Slider pressed + */ + void sigSliderPressed(); + /** + * Slider released + */ + void sigSliderReleased(); + /** + * Scrollbar pressed + */ + void sigScrollBarPressed(); + /** + * Scrollbar released + */ + void sigScrollBarReleased(); + + private: + QSWorkbook *m_workbook; + QSPage *m_curr_page; + QSSelection *m_selection; + bool m_full_page; + QSAxes *m_active_axes; + QGridLayout *m_layout; + QWidget *m_canvas; + QWidget *m_shadow; + QWidget *m_interior; + QSTool *m_ctool; + bool m_tool_activated; + bool m_tool_activating; + QSCObject *m_active_object; + double m_zoom; + int m_grid_x; + int m_grid_y; + bool m_grid_visible; + bool m_page_margins_visible; + bool m_screen_buffering; + bool m_screen_buffer_valid; + QPixmap *m_screen_buffer; + QTimer *m_refresh_buffer; + QTime m_perf_monitor; + + bool m_rulers_visible; + QSRuler *m_hruler; + QSRuler *m_vruler; + + bool m_sliders_visible; + QScrollBar *m_hscrollbar; + QScrollBar *m_vscrollbar; + + QTabBar *m_page_list; + QIntDict<QSPage> m_pages; + + struct slider_data_t { + QSlider *slider; + int min; + int max; + QCString property; + } m_sliders[3]; + + struct scrollbar_data_t { + QSRangeScrollBar *scrollbar; + QSAxis::AxisType type; + } m_scrollbars[2]; + + void set_backstore_internal( bool enabled ); + bool backstore_internal(); + void recreate_gui(); + void recreate_rulers(); + void recreate_parameter_scrollbars(); + void recreate_parameter_sliders(); + void recreate_canvas_scrollbars(); + void recreate_page_bar(); + + void update_rulers(); + void update_parameter_scrollbars(); + void update_parameter_sliders(); + void update_canvas_scrollbars(); + void update_page_bar(); + + void init(); + void clean(); + void activate_tool(); + void deactivate_tool(); + void set_active_object( QSCObject *o, bool tool = false ); + void set_active_axes( QSAxes *axes ); + void draw_tool(); + void draw_page(); + void draw_grid( QPainter *p ); + void draw_full_page( QPaintDevice *paint_device ); + void draw_single_view( QPaintDevice *paint_device ); + void show_page_popup(); + + bool confirm( const QString& message ); + + private slots: + void slot_selection_changed(); + void adjust_canvas_size(); + void slot_page_removed( QSPage *page ); + void slot_page_added( QSPage *page ); + void slot_page_order(); + void slot_curr_page_object_list_changed(); + void slot_page_tab_selected(int); + void slot_active_axes_modified(); + void slot_active_axes_ranges_changed(); + void slot_active_axes_changed(QSData*); + void slot_active_axes_order(); + void slot_update_canvas_pos(int); + void slot_object_removed( QSCObject *object ); + void slot_hslider_moved( int ); + void slot_vslider_moved( int ); + void slot_aslider_moved( int ); + void slot_slider_pressed(); + void slot_slider_released(); + void slot_scrollbar_pressed(); + void slot_scrollbar_released(); + void slot_hscrollbar_moved( int ); + void slot_vscrollbar_moved( int ); + void slot_page_list_changed(); + void slot_refresh_screen_buffer(); + void slot_page_draw_ends(); + void slot_axes_draw_ends(); + void slot_curr_page_title_changed( const QString& new_title ); + }; + +//-------------------------------------------------------------// + +class QSRangeScrollBar : public QScrollBar + { + Q_OBJECT + public: + QSRangeScrollBar( QWidget *parent ); + virtual ~QSRangeScrollBar(); + void setAxes( QSAxes *axes, QSAxis::AxisType type ); + void updateScrollbar(); + void updateRange(); + private: + QSAxes *m_axes; + QSAxis::AxisType m_type; + bool m_updating_range; + bool m_updating_scrollbars; + double m_min; + double m_max; + }; + + + + + + + + +#endif + diff --git a/kmatplot/widgets/qsprojection.cpp b/kmatplot/widgets/qsprojection.cpp new file mode 100644 index 0000000..582b690 --- /dev/null +++ b/kmatplot/widgets/qsprojection.cpp @@ -0,0 +1,1025 @@ +/*************************************************************************** + qsprojection.cpp + ------------------- + begin : 01-January-2000 + copyright : (C) 2000 by Kamil Dobkowski + email : kamildobk@poczta.onet.pl + ***************************************************************************/ + +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + + +#include "qsprojection.h" +#include "qsconsole.h" +#include <math.h> + +const double QSProjection::pi = 3.141592653589793115997963468544185161590576171875; + +#define QS_CLIP_BUFFER_SIZE 60 // QMAX number of vertices in clipped polygons clipPoly2 and clipPoly3 + +//-------------------------------------------------------------// + +QSProjection::QSProjection() + { + m_light = false; + m_ambient_light = 0; + m_directed_light = 0; + } + +//-------------------------------------------------------------// + +QSProjection::~QSProjection() + { + } +//-------------------------------------------------------------// + +void QSProjection::setLight( bool enabled ) + { + m_light = enabled; + } + +//-------------------------------------------------------------// + +void QSProjection::setLightParameters( const QSPt3f& lightVector, int ambientLight, int directedLight ) + { + m_light_vector = lightVector; + m_ambient_light = ambientLight; + m_directed_light = directedLight; + } + +//-------------------------------------------------------------// + +bool QSProjection::pointInPoly( const QSPt2f& pos, const QSPt2f* pts, int npts ) +// comp.graphics.algorithms.faq + { + int i; + int j; + bool result = false; + for ( i=0, j=npts-1; i<npts; j=i++ ) { + if ( ( (pts[i].y<=pos.y && pos.y<pts[j].y) || + (pts[j].y<=pos.y && pos.y<pts[i].y) ) && + pos.x < (pts[j].x-pts[i].x) * (pos.y-pts[i].y) / (pts[j].y-pts[i].y) + pts[i].x ) + result = !result; + } + return result; + } + +//-------------------------------------------------------------// + +void QSProjection::clipVertexNormals( const QSPt3f in[], int inpoints, const QSPt3f clip[], int clipoints, const QSPt3f innorm[], QSPt3f outnorm[] ) + { + + for ( int j=0; j<clipoints; j++ ) { + int p1[2]; + int p2[2]; + double t1; + double t2; + double t3; + + get_interpolation_params( in, inpoints, clip[j], p1, p2, &t1, &t2, &t3 ); + + QSPt3f p3[2]; + p3[0] = normalize( interpolation( innorm[p1[0]], innorm[p1[1]], t1 ) ); + p3[1] = normalize( interpolation( innorm[p2[0]], innorm[p2[1]], t2 ) ); + + outnorm[j] = normalize( interpolation( p3[0], p3[1], t3 ) ); + } + + } + +//-------------------------------------------------------------// + +void QSProjection::clipVertexColors( const QSPt3f in[], int inpoints, const QSPt3f clip[], int clipoints, const QSGFill incol[], QSGFill outcol[] ) + { + for ( int j=0; j<clipoints; j++ ) { + int p1[2]; + int p2[2]; + double t1; + double t2; + double t3; + + get_interpolation_params( in, inpoints, clip[j], p1, p2, &t1, &t2, &t3 ); + + QSGFill p3[2]; + p3[0] = interpolation( incol[p1[0]], incol[p1[1]], t1 ); + p3[1] = interpolation( incol[p2[0]], incol[p2[1]], t2 ); + + outcol[j] = interpolation( p3[0], p3[1], t3 ); + } + + } + +//-------------------------------------------------------------// + +void QSProjection::get_interpolation_params(const QSPt3f in[], int inpoints, const QSPt3f& clip, int p1[2], int p2[2], double *t1, double *t2, double *t3 ) +// +// t1 1-t1 +// p1[0] | p1[1] +// --------------\ . +// | t3| \ . +// | + clip \ . +// | 1-t3| | . interpolation straight line is always vertical +// | | / . +// ----------------/ . +// p2[1] | p2[0] +// t2-1 t2 +// + { + int lnum = 0; + int pass = 0; + + int p[2][2]; + double t[2]; + // + // In maximum three passes. + // + while( lnum<2 && pass<3 ) { + + lnum = 0; + + int curr; + int prev = inpoints-1; + for( int i=0; i<inpoints; i++ ) { + curr = i; + + if ( (pass == 0 && (in[prev].x<clip.x) != (in[curr].x<clip.x)) || + (pass == 1 && (in[prev].y<clip.y) != (in[curr].y<clip.y)) || + (pass == 2 && (in[prev].z<clip.z) != (in[curr].z<clip.z)) ) { + + p[lnum][0] = prev; + p[lnum][1] = curr; + + switch( pass ) { + case 0: t[lnum] = (clip.x-in[prev].x)/(in[curr].x-in[prev].x); break; + case 1: t[lnum] = (clip.y-in[prev].y)/(in[curr].y-in[prev].y); break; + case 2: t[lnum] = (clip.z-in[prev].z)/(in[curr].z-in[prev].z); break; + } + + if ( ++lnum == 2 ) break; + + } else if ( in[curr].x == clip.x && + in[curr].y == clip.y && + in[curr].z == clip.z ) { + + p[0][0] = curr; + p[0][1] = curr; + p[1][0] = curr; + p[1][1] = curr; + t[0] = 0.0; + t[1] = 0.0; + lnum = 2; + + break; + } + + prev = curr; + } + + pass++; + } + + if ( lnum == 2 ) { + + p1[0] = p[0][0]; + p1[1] = p[0][1]; + p2[0] = p[1][0]; + p2[1] = p[1][1]; + + *t1 = t[0]; + *t2 = t[1]; + + QSPt3f p3[2]; + + p3[0] = interpolation( in[p1[0]], in[p1[1]], *t1 ); + p3[1] = interpolation( in[p2[0]], in[p2[1]], *t2 ); + + // Take care about round-off errors + int c = 0; + double d = 0.0; + + if ( fabs(p3[0].x-p3[1].x) > d ) { d=fabs(p3[0].x-p3[1].x); c=1; } + if ( fabs(p3[0].y-p3[1].y) > d ) { d=fabs(p3[0].y-p3[1].y); c=2; } + if ( fabs(p3[0].z-p3[1].z) > d ) { d=fabs(p3[0].z-p3[1].z); c=3; } + + switch( c ) { + case 1: *t3 = (clip.x-p3[0].x)/(p3[1].x-p3[0].x); break; + case 2: *t3 = (clip.y-p3[0].y)/(p3[1].y-p3[0].y); break; + case 3: *t3 = (clip.z-p3[0].z)/(p3[1].z-p3[0].z); break; + default: *t3 = 0.0; break; + } + + } else { + + QSConsole::write("ERROR: QSProjection::get_interpolation_params."); + + p1[0] = p1[1] = 0; + p2[0] = p2[1] = 0; + + *t1 = 0.0; + *t2 = 0.0; + *t3 = 0.0; + + } + } + +//-------------------------------------------------------------// + +QSPt3f QSProjection::interpolation( const QSPt3f& p1, const QSPt3f& p2, double t ) +// +// For t=0.0 returns p1. +// For t=1.0 returns p2. +// For t =(0.0, 1.0) returns the point on the straigth line from p1 to p2. +// + { + QSPt3f result; + result.x = p1.x + t*(p2.x-p1.x); + result.y = p1.y + t*(p2.y-p1.y); + result.z = p1.z + t*(p2.z-p1.z); + return result; + } + +//-------------------------------------------------------------// + +QSGFill QSProjection::interpolation( const QSGFill& f1, const QSGFill& f2, double t ) +// +// For t=0.0 returns f1. +// For t=1.0 returns f2. +// For t =(0.0, 1.0) returns the fill between f1 and f2. +// + { + QSGFill result; + + result.style = f1.style; // Style must be the same in f1 and f2 + + result.color.r = (unsigned char)floor(f1.color.r + t*(f2.color.r-f1.color.r) + 0.5); + result.color.g = (unsigned char)floor(f1.color.g + t*(f2.color.g-f1.color.g) + 0.5); + result.color.b = (unsigned char)floor(f1.color.b + t*(f2.color.b-f1.color.b) + 0.5); + result.color.a = (unsigned char)floor(f1.color.a + t*(f2.color.a-f1.color.a) + 0.5); + return result; + } + +//-------------------------------------------------------------// + +void QSProjection::getPoly3Cube( const QSPt3f in[], int inpoints, QSPt3f c[2] ) +// r[0] - min coordinates +// r[1] - max coordinates + { + c[0].x = c[1].x = in[0].x; + c[0].y = c[1].y = in[0].y; + c[0].z = c[1].z = in[0].z; + + for( int i=1; i<inpoints; i++ ) { + c[0].x = QMIN( in[i].x, c[0].x ); c[1].x = QMAX( in[i].x, c[1].x ); + c[0].y = QMIN( in[i].y, c[0].y ); c[1].y = QMAX( in[i].y, c[1].y ); + c[0].z = QMIN( in[i].z, c[0].z ); c[1].z = QMAX( in[i].z, c[1].z ); + } + + } + +//-------------------------------------------------------------// + + +QSPt3f QSProjection::normal( const QSPt3f v[4], bool norm ) +// Normal to the surface defined by its vertices. +// J.D. Foley, ... "Wstêp do grafiki komputerowej" +// ( "Introduction to Computer Graphics" ). +// Chapter 9.1.2 + { + QSPt3f result; + + // area of the projection of the mesh + // on (y,z) surface . + result.x = (v[1].z+v[0].z)*(v[1].y-v[0].y) + + (v[2].z+v[1].z)*(v[2].y-v[1].y) + + (v[3].z+v[2].z)*(v[3].y-v[2].y) + + (v[0].z+v[3].z)*(v[0].y-v[3].y) ; + + result.y = (v[1].x+v[0].x)*(v[1].z-v[0].z) + + (v[2].x+v[1].x)*(v[2].z-v[1].z) + + (v[3].x+v[2].x)*(v[3].z-v[2].z) + + (v[0].x+v[3].x)*(v[0].z-v[3].z) ; + + result.z = (v[1].y+v[0].y)*(v[1].x-v[0].x) + + (v[2].y+v[1].y)*(v[2].x-v[1].x) + + (v[3].y+v[2].y)*(v[3].x-v[2].x) + + (v[0].y+v[3].y)*(v[0].x-v[3].x) ; + + if ( norm ) result = normalize( result ); + return result; + } + +//-------------------------------------------------------------// + +QSPt3f QSProjection::normal( const QSPt3f *v, int npoints, bool norm ) +// Normal to the surface defined by its vertices. +// J.D. Foley, ... "Wstêp do grafiki komputerowej" +// ( "Introduction to Computer Graphics" ). +// Chapter 9.1.2 + { + QSPt3f result( 0.0, 0.0, 0.0 ); + + int s = npoints - 1; + int p = 0; + + while( p < npoints ) { + + result.x += (v[p].z+v[s].z)*(v[p].y-v[s].y); + result.y += (v[p].x+v[s].x)*(v[p].z-v[s].z); + result.z += (v[p].y+v[s].y)*(v[p].x-v[s].x); + + s = p; + p = p+1; + }; + + if ( norm ) result = normalize( result ); + return result; + } + +//-------------------------------------------------------------// + +QSPt3f QSProjection::normalize( QSPt3f vector ) + { + double len = sqrt( vector.x*vector.x + + vector.y*vector.y + + vector.z*vector.z ); + if ( len ) { + vector.x /= len; + vector.y /= len; + vector.z /= len; + } + + return vector; + } + +//-------------------------------------------------------------// + +double QSProjection::dotProduct( const QSPt3f& p1, const QSPt3f& p2 ) + { + return p1.x*p2.x + p1.y*p2.y + p1.z*p2.z; + } + +//-------------------------------------------------------------// + +QSPt3f QSProjection::vectorProduct( const QSPt3f& p1, const QSPt3f& p2 ) + { + return QSPt3f( p1.y*p2.z - p1.z*p2.y, p1.z*p2.x - p1.x*p2.z, p1.x*p2.y - p1.y*p2.x ); + } + +//-------------------------------------------------------------// + +bool QSProjection::isBottom( const QSPt2f pts[], int npoints ) + { + double area = 0; int p0 = npoints - 1; int p1 = 0; + while( p1 < npoints ) { + area += pts[p0].x*pts[p1].y - pts[p1].x*pts[p0].y; + p0 = p1; p1 = p1+1; + }; + return ( area < 0.0 ); + } + +//-------------------------------------------------------------// + +bool QSProjection::isBottom( const QSPt3f pts[], int npoints ) + { + double area = 0; int p0 = npoints - 1; int p1 = 0; + while( p1 < npoints ) { + area += pts[p0].x*pts[p1].y - pts[p1].x*pts[p0].y; + p0 = p1; p1 = p1+1; + }; + return ( area < 0.0 ); + } + +//-------------------------------------------------------------// + +bool QSProjection::isFlat( const QSPt3f pts[], int npoints ) + { + if ( npoints<4 ) return true; + bool bottom = isBottom( pts[0], pts[1], pts[2] ); + for( int t=1;t<npoints-2;t++ ) + if ( bottom != isBottom(pts[0],pts[t+1],pts[t+2]) ) return false; + return true; + } + +//-------------------------------------------------------------// + +bool QSProjection::isCorrect( const double values[4] ) + { + return !(QMAX(values[0],values[2]) < QMIN(values[1],values[3]) || QMAX(values[1],values[3]) < QMIN(values[0],values[2])); + } + +//-------------------------------------------------------------// + +bool QSProjection::isCorrect( const QSPt3f pts[4] ) + { + return !(QMAX(pts[0].z,pts[2].x) < QMIN(pts[1].z,pts[3].z) || QMAX(pts[1].z,pts[3].z) < QMIN(pts[0].z,pts[2].z)); + } + +//-------------------------------------------------------------// + +void QSProjection::triangulate1( int triangleNumber, const QSPt3f pts[], int npoints, QSPt3f triangle[3], bool edges[3] ) + { + triangle[0] = pts[0]; + triangle[1] = pts[triangleNumber+1]; + triangle[2] = pts[triangleNumber+2]; + edges[0] = triangleNumber==npoints-3?true:false; + edges[1] = triangleNumber==0?true:false; + edges[2] = true; + } + + +//-------------------------------------------------------------// +//-------------------------------------------------------------// +//-------------------------------------------------------------// +//-------------------------------------------------------------// +//-------------------------------------------------------------// + + + +//-------------------------------------------------------------// + +QSProjection::ClipResult QSProjection::clipPoint2( const QSPt2f& p1 ) const + { + static const double cmin_x = 0.0; + static const double cmax_x = 1.0; + static const double cmin_y = 0.0; + static const double cmax_y = 1.0; + + if ( p1.x > cmax_x || + p1.x < cmin_x || + p1.y > cmax_y || + p1.y < cmin_y ) return Rejected; + return Accepted; + } + +//-------------------------------------------------------------// + +QSProjection::ClipResult QSProjection::clipLine2( QSPt2f* p0, QSPt2f* p1 ) const +// Cohen-Sutherland's method. +// J. D. Foley, ... +// "Wprowadzenie do grafiki komputerowej" ( "Introduction to computer graphics" ) +// Chap 3.9 + { + static const double cmin_x = 0.0; + static const double cmax_x = 1.0; + static const double cmin_y = 0.0; + static const double cmax_y = 1.0; + + QSPt2f cp; + + union { + unsigned int all; + struct { + unsigned int l : 1; // left + unsigned int r : 1; // right + unsigned int t : 1; // top + unsigned int b : 1; // bottom + } bit; + } outcode0, outcode1, outcodeOut; + + outcode0.all = 0; + outcode1.all = 0; + + if ( p0->y > cmax_y ) outcode0.bit.t = 1; else if ( p0->y < cmin_y ) outcode0.bit.b = 1; + if ( p0->x > cmax_x ) outcode0.bit.r = 1; else if ( p0->x < cmin_x ) outcode0.bit.l = 1; + + if ( p1->y > cmax_y ) outcode1.bit.t = 1; else if ( p1->y < cmin_y ) outcode1.bit.b = 1; + if ( p1->x > cmax_x ) outcode1.bit.r = 1; else if ( p1->x < cmin_x ) outcode1.bit.l = 1; + + if ( (outcode0.all | outcode1.all) == 0 ) return Accepted; + + while( 1 ) + if ( (outcode0.all | outcode1.all) == 0 ) return Clipped; + else if ( (outcode0.all & outcode1.all) != 0 ) return Rejected; + else { + if ( outcode0.all != 0 ) outcodeOut = outcode0; + else outcodeOut = outcode1; + + if ( outcodeOut.bit.t ) { + cp.y = cmax_y; + cp.x = p0->x+(p1->x-p0->x)*(cmax_y-p0->y)/(p1->y-p0->y); + } else if ( outcodeOut.bit.b ) { + cp.y = cmin_y; + cp.x = p0->x+(p1->x-p0->x)*(cmin_y-p0->y)/(p1->y-p0->y); + } else if ( outcodeOut.bit.r ) { + cp.x = cmax_x; + cp.y = p0->y+(p1->y-p0->y)*(cmax_x-p0->x)/(p1->x-p0->x); + } else if ( outcodeOut.bit.l ) { + cp.x = cmin_x; + cp.y = p0->y+(p1->y-p0->y)*(cmin_x-p0->x)/(p1->x-p0->x); + } + + if ( outcodeOut.all == outcode0.all ) { + p0->x = cp.x; + p0->y = cp.y; + outcode0.all = 0; + if ( p0->y > cmax_y ) outcode0.bit.t = 1; else if ( p0->y < cmin_y ) outcode0.bit.b = 1; + if ( p0->x > cmax_x ) outcode0.bit.r = 1; else if ( p0->x < cmin_x ) outcode0.bit.l = 1; + } else { + p1->x = cp.x; + p1->y = cp.y; + outcode1.all = 0; + if ( p1->y > cmax_y ) outcode1.bit.t = 1; else if ( p1->y < cmin_y ) outcode1.bit.b = 1; + if ( p1->x > cmax_x ) outcode1.bit.r = 1; else if ( p1->x < cmin_x ) outcode1.bit.l = 1; + } + } + } + +//-------------------------------------------------------------// + +QSProjection::ClipResult QSProjection::clipLine( QSPt2f* p0, QSPt2f* p1, const QSPt2f& clip_pos, const QSPt2f& clip_area ) +// Cohen-Sutherland's method. +// J. D. Foley, ... +// "Wprowadzenie do grafiki komputerowej" ( "Introduction to computer graphics" ) +// Chap 3.9 + { + const double cmin_x = clip_pos.x; + const double cmin_y = clip_pos.y; + const double cmax_x = clip_pos.x+clip_area.x; + const double cmax_y = clip_pos.y+clip_area.y; + + QSPt2f cp; + + union { + unsigned int all; + struct { + unsigned int l : 1; // left + unsigned int r : 1; // right + unsigned int t : 1; // top + unsigned int b : 1; // bottom + } bit; + } outcode0, outcode1, outcodeOut; + + outcode0.all = 0; + outcode1.all = 0; + + if ( p0->y > cmax_y ) outcode0.bit.t = 1; else if ( p0->y < cmin_y ) outcode0.bit.b = 1; + if ( p0->x > cmax_x ) outcode0.bit.r = 1; else if ( p0->x < cmin_x ) outcode0.bit.l = 1; + + if ( p1->y > cmax_y ) outcode1.bit.t = 1; else if ( p1->y < cmin_y ) outcode1.bit.b = 1; + if ( p1->x > cmax_x ) outcode1.bit.r = 1; else if ( p1->x < cmin_x ) outcode1.bit.l = 1; + + if ( (outcode0.all | outcode1.all) == 0 ) return Accepted; + + while( 1 ) + if ( (outcode0.all | outcode1.all) == 0 ) return Clipped; + else if ( (outcode0.all & outcode1.all) != 0 ) return Rejected; + else { + if ( outcode0.all != 0 ) outcodeOut = outcode0; + else outcodeOut = outcode1; + + if ( outcodeOut.bit.t ) { + cp.y = cmax_y; + cp.x = p0->x+(p1->x-p0->x)*(cmax_y-p0->y)/(p1->y-p0->y); + } else if ( outcodeOut.bit.b ) { + cp.y = cmin_y; + cp.x = p0->x+(p1->x-p0->x)*(cmin_y-p0->y)/(p1->y-p0->y); + } else if ( outcodeOut.bit.r ) { + cp.x = cmax_x; + cp.y = p0->y+(p1->y-p0->y)*(cmax_x-p0->x)/(p1->x-p0->x); + } else if ( outcodeOut.bit.l ) { + cp.x = cmin_x; + cp.y = p0->y+(p1->y-p0->y)*(cmin_x-p0->x)/(p1->x-p0->x); + } + + if ( outcodeOut.all == outcode0.all ) { + p0->x = cp.x; + p0->y = cp.y; + outcode0.all = 0; + if ( p0->y > cmax_y ) outcode0.bit.t = 1; else if ( p0->y < cmin_y ) outcode0.bit.b = 1; + if ( p0->x > cmax_x ) outcode0.bit.r = 1; else if ( p0->x < cmin_x ) outcode0.bit.l = 1; + } else { + p1->x = cp.x; + p1->y = cp.y; + outcode1.all = 0; + if ( p1->y > cmax_y ) outcode1.bit.t = 1; else if ( p1->y < cmin_y ) outcode1.bit.b = 1; + if ( p1->x > cmax_x ) outcode1.bit.r = 1; else if ( p1->x < cmin_x ) outcode1.bit.l = 1; + } + } + } + +//-------------------------------------------------------------// + +QSProjection::ClipResult QSProjection::clipPoly2( const QSPt2f in[], int inpoints, QSPt2f out[], int *outpoints, int maxpoints, bool outedges[], const bool inedges[] ) const + { + static const double cmin_x = 0.0; + static const double cmax_x = 1.0; + static const double cmin_y = 0.0; + static const double cmax_y = 1.0; + + int i; + int nr; + + QSPt2f c[2]; + + c[0].x = c[1].x = in[0].x; + c[0].y = c[1].y = in[0].y; + + for( int i=1; i<inpoints; i++ ) { + c[0].x = QMIN( in[i].x, c[0].x ); c[1].x = QMAX( in[i].x, c[1].x ); + c[0].y = QMIN( in[i].y, c[0].y ); c[1].y = QMAX( in[i].y, c[1].y ); + } + + if ( c[0].x >= cmin_x && c[1].x <= cmax_x && + c[0].y >= cmin_y && c[1].y <= cmax_y ) return Accepted; + + if ( ( c[0].x > cmax_x || c[1].x < cmin_x ) && + ( c[0].y > cmax_y || c[1].y < cmin_y ) ) return Rejected; + + // init clipping + QSPt2f buff[QS_CLIP_BUFFER_SIZE]; + bool edge_buff[QS_CLIP_BUFFER_SIZE]; + + int opts = QMIN( QS_CLIP_BUFFER_SIZE, maxpoints ); + int ipts = QMIN( QS_CLIP_BUFFER_SIZE, inpoints ); + + for( i=0; i<ipts; i++ ) { buff[i] = in[i]; if ( outedges ) edge_buff[i] = inedges ? inedges[i] : true; } + + // clip poly to the rectangle ( by four half-planes ). + for( int plane=0; plane<4; plane++ ) { + + QSPt2f p; + QSPt2f s = buff[ipts-1]; + + bool s_inside = true; // no compiler warning + switch( plane ) { + case 0: s_inside = ( s.x >= cmin_x ); break; + case 1: s_inside = ( s.x <= cmax_x ); break; + case 2: s_inside = ( s.y >= cmin_y ); break; + case 3: s_inside = ( s.y <= cmax_y ); break; + } + + nr = 0; + for( i=0; i<ipts; i++ ) { + p = buff[i]; + bool p_inside = true; + switch( plane ) { + case 0: p_inside = ( p.x >= cmin_x ); break; + case 1: p_inside = ( p.x <= cmax_x ); break; + case 2: p_inside = ( p.y >= cmin_y ); break; + case 3: p_inside = ( p.y <= cmax_y ); break; + } + + // edge inside the clip area - pass it to the output + if ( p_inside && s_inside ) { + if ( nr<opts ) { + if ( outedges ) outedges[nr] = edge_buff[i]; + out[nr++] = p; + } + } + else + // edge crosses the boundary of the clip area + if ( p_inside != s_inside ) { // line from s to p crosses boundary + double t = 0.0; + switch( plane ) { + case 0: t = double(cmin_x-s.x)/(p.x-s.x); break; + case 1: t = double(cmax_x-s.x)/(p.x-s.x); break; + case 2: t = double(cmin_y-s.y)/(p.y-s.y); break; + case 3: t = double(cmax_y-s.y)/(p.y-s.y); break; + } + QSPt2f c; + c.x = s.x + t*(p.x-s.x); + c.y = s.y + t*(p.y-s.y); + if ( nr<opts ) { + if ( outedges ) if ( p_inside ) outedges[nr] = false; else outedges[nr] = edge_buff[i]; + out[nr++] = c; + } + if ( p_inside ) if ( nr<opts ) { + if ( outedges ) outedges[nr] = edge_buff[i]; + out[nr++] = p; + } + } + + s = p; + s_inside = p_inside; + } // for ( i=0; i<npoints ... + + for( i=0; i<nr; i++ ) { buff[i] = out[i]; if ( outedges ) edge_buff[i] = outedges[i]; } + ipts = nr; + } // for( plane=0; + + if ( outpoints ) *outpoints = nr; + + return ( nr ) ? Clipped : Rejected; + } + +//-------------------------------------------------------------// + +QSProjection::ClipResult QSProjection::clipPoint3( const QSPt3f& pos ) const + { + static const double cmin_x = 0.0; + static const double cmax_x = 1.0; + static const double cmin_y = 0.0; + static const double cmax_y = 1.0; + static const double cmin_z = 0.0; + static const double cmax_z = 1.0; + + if ( pos.x >= cmin_x && pos.x <= cmax_x && + pos.y >= cmin_y && pos.y <= cmax_y && + pos.z >= cmin_z && pos.z <= cmax_z ) return Accepted; + + return Rejected; + } +//-------------------------------------------------------------// + + +QSProjection::ClipResult QSProjection::clipLine3( QSPt3f* p0, QSPt3f* p1 ) const + { + static const double cmin_x = 0.0; + static const double cmax_x = 1.0; + static const double cmin_y = 0.0; + static const double cmax_y = 1.0; + static const double cmin_z = 0.0; + static const double cmax_z = 1.0; + + union { + unsigned int all; + struct { + unsigned int l : 1; // left + unsigned int r : 1; // right + unsigned int t : 1; // top + unsigned int b : 1; // bottom + unsigned int f : 1; // front + unsigned int k : 1; // back + } bit; + } outcode0, outcode1, outcodeOut; + + outcode0.all = 0; + outcode1.all = 0; + + if ( p0->y > cmax_y ) outcode0.bit.t = 1; else if ( p0->y < cmin_y ) outcode0.bit.b = 1; + if ( p0->x > cmax_x ) outcode0.bit.r = 1; else if ( p0->x < cmin_x ) outcode0.bit.l = 1; + if ( p0->z > cmax_z ) outcode0.bit.k = 1; else if ( p0->z < cmin_z ) outcode0.bit.f = 1; + + if ( p1->y > cmax_y ) outcode1.bit.t = 1; else if ( p1->y < cmin_y ) outcode1.bit.b = 1; + if ( p1->x > cmax_x ) outcode1.bit.r = 1; else if ( p1->x < cmin_x ) outcode1.bit.l = 1; + if ( p1->z > cmax_z ) outcode0.bit.k = 1; else if ( p1->z < cmin_z ) outcode0.bit.f = 1; + + if ( (outcode0.all | outcode1.all) == 0 ) return Accepted; + + QSPt3f cp; + double t; + while( 1 ) + if ( (outcode0.all | outcode1.all) == 0 ) return Clipped; + else if ( (outcode0.all & outcode1.all) != 0 ) return Rejected; + else { + if ( outcode0.all != 0 ) outcodeOut = outcode0; + else outcodeOut = outcode1; + + if ( outcodeOut.bit.t ) { + t = (cmax_y-p0->y)/(p1->y-p0->y); + cp.y = cmax_y; + cp.x = p0->x+(p1->x-p0->x)*t; + cp.z = p0->z+(p1->z-p0->z)*t; + } else if ( outcodeOut.bit.b ) { + t = (cmin_y-p0->y)/(p1->y-p0->y); + cp.y = cmin_y; + cp.x = p0->x+(p1->x-p0->x)*t; + cp.z = p0->z+(p1->z-p0->z)*t; + } else if ( outcodeOut.bit.r ) { + t = (cmax_x-p0->x)/(p1->x-p0->x); + cp.x = cmax_x; + cp.y = p0->y+(p1->y-p0->y)*t; + cp.z = p0->z+(p1->z-p0->z)*t; + } else if ( outcodeOut.bit.l ) { + t = (cmin_x-p0->x)/(p1->x-p0->x); + cp.x = cmin_x; + cp.y = p0->y+(p1->y-p0->y)*t; + cp.z = p0->z+(p1->z-p0->z)*t; + } else if ( outcodeOut.bit.f ) { + t = (cmin_z-p0->z)/(p1->z-p0->z); + cp.z = cmin_z; + cp.x = p0->x+(p1->x-p0->x)*t; + cp.y = p0->y+(p1->y-p0->y)*t; + } else if ( outcodeOut.bit.k ) { + t = (cmax_z-p0->z)/(p1->z-p0->z); + cp.z = cmax_z; + cp.x = p0->x+(p1->x-p0->x)*t; + cp.y = p0->y+(p1->y-p0->y)*t; + } + + if ( outcodeOut.all == outcode0.all ) { + p0->x = cp.x; + p0->y = cp.y; + p0->z = cp.z; + outcode0.all = 0; + if ( p0->y > cmax_y ) outcode0.bit.t = 1; else if ( p0->y < cmin_y ) outcode0.bit.b = 1; + if ( p0->x > cmax_x ) outcode0.bit.r = 1; else if ( p0->x < cmin_x ) outcode0.bit.l = 1; + if ( p0->z > cmax_z ) outcode0.bit.k = 1; else if ( p0->z < cmin_z ) outcode0.bit.f = 1; + } else { + p1->x = cp.x; + p1->y = cp.y; + p1->z = cp.z; + outcode1.all = 0; + if ( p1->y > cmax_y ) outcode1.bit.t = 1; else if ( p1->y < cmin_y ) outcode1.bit.b = 1; + if ( p1->x > cmax_x ) outcode1.bit.r = 1; else if ( p1->x < cmin_x ) outcode1.bit.l = 1; + if ( p1->z > cmax_z ) outcode0.bit.k = 1; else if ( p1->z < cmin_z ) outcode0.bit.f = 1; + } + } + } + +//-------------------------------------------------------------// + +QSProjection::ClipResult QSProjection::clipPoly3( const QSPt3f in[], int inpoints, QSPt3f out[], int *outpoints, int maxpoints, const QSPt3f c[2], bool outedges[], const bool inedges[] ) const + { + static const double cmin_x = 0.0; + static const double cmax_x = 1.0; + static const double cmin_y = 0.0; + static const double cmax_y = 1.0; + static const double cmin_z = 0.0; + static const double cmax_z = 1.0; + + int i; + int nr; + + // check if a mesh is inside of the axis box. + if ( c[0].x >= cmin_x && c[1].x <= cmax_x && + c[0].y >= cmin_y && c[1].y <= cmax_y && + c[0].z >= cmin_z && c[1].z <= cmax_z ) return Accepted; + + // check if a mesh is outside of the axis box. + if ( ( c[0].x > cmax_x || c[1].x < cmin_x ) && + ( c[0].y > cmax_y || c[1].y < cmin_y ) && + ( c[0].z > cmax_z || c[1].z < cmin_z ) ) return Rejected; + + // init clipping + QSPt3f buff[QS_CLIP_BUFFER_SIZE]; + bool edge_buff[QS_CLIP_BUFFER_SIZE]; + + int opts = QMIN( QS_CLIP_BUFFER_SIZE, maxpoints ); + int ipts = QMIN( QS_CLIP_BUFFER_SIZE, inpoints ); + + for( i=0; i<ipts; i++ ) { buff[i] = in[i]; if ( outedges ) edge_buff[i] = inedges ? inedges[i] : true; } + + // clip mesh to the axis box ( by six planes ) + for( int plane=0; plane<6; plane++ ) { + + QSPt3f p; + QSPt3f s = buff[ipts-1]; + + bool s_inside = true; // no compiler warning + switch( plane ) { + case 0: s_inside = ( s.x >= cmin_x ); break; + case 1: s_inside = ( s.x <= cmax_x ); break; + case 2: s_inside = ( s.y >= cmin_y ); break; + case 3: s_inside = ( s.y <= cmax_y ); break; + case 4: s_inside = ( s.z >= cmin_z ); break; + case 5: s_inside = ( s.z <= cmax_z ); break; + } + + nr = 0; + + for( i=0; i<ipts; i++ ) { + p = buff[i]; + + bool p_inside = true; + switch( plane ) { + case 0: p_inside = ( p.x >= cmin_x ); break; + case 1: p_inside = ( p.x <= cmax_x ); break; + case 2: p_inside = ( p.y >= cmin_y ); break; + case 3: p_inside = ( p.y <= cmax_y ); break; + case 4: p_inside = ( p.z >= cmin_z ); break; + case 5: p_inside = ( p.z <= cmax_z ); break; + } + + // edge inside the clip area + if ( p_inside && s_inside ) { + if ( nr<opts ) { + if ( outedges ) outedges[nr] = edge_buff[i]; + out[nr++] = p; + } + } + else + // line from s to p crosses the boundary of the clipping area + if ( p_inside != s_inside ) { + double t = 0.0; + switch( plane ) { + case 0: t = (cmin_x-s.x)/(p.x-s.x); break; + case 1: t = (cmax_x-s.x)/(p.x-s.x); break; + case 2: t = (cmin_y-s.y)/(p.y-s.y); break; + case 3: t = (cmax_y-s.y)/(p.y-s.y); break; + case 4: t = (cmin_z-s.z)/(p.z-s.z); break; + case 5: t = (cmax_z-s.z)/(p.z-s.z); break; + } + + QSPt3f c; + c.x = s.x + t*(p.x-s.x); + c.y = s.y + t*(p.y-s.y); + c.z = s.z + t*(p.z-s.z); + if ( nr<opts ) { + if ( outedges ) if ( p_inside ) outedges[nr] = false; else outedges[nr] = edge_buff[i]; + out[nr++] = c; + } + if ( p_inside ) if ( nr<opts ) { + if ( outedges ) outedges[nr] = edge_buff[i]; + out[nr++] = p; + } + } + + s = p; + s_inside = p_inside; + } // for ( i=0; i<npoints ... + + for( i=0; i<nr; i++ ) { buff[i] = out[i]; if ( outedges ) edge_buff[i] = outedges[i]; } + ipts = nr; + } // for( plane=0; plane<5 ... + + if ( outpoints ) *outpoints = nr; + + return ( nr ) ? Clipped : Rejected; + } + +// out[ nr<opts ? nr++ : nr-1 ] = p; +// out[ nr<opts ? nr++ : nr-1 ] = c; +// if ( p_inside ) out[ nr<opts ? nr++ : nr-1 ] = p; + +//-------------------------------------------------------------// + +void QSProjection::shade( QSGFill &fill, const QSPt3f& normal, const QSPt2f* canvas_pts, int npoints, QSGFill *bottomFill ) const +// Uff ! + { + if ( fill.style == QSGFill::Transparent ) return; + + double dratio = 4.0; + if ( bottomFill && isBottom( canvas_pts, npoints ) ) { fill = *bottomFill; dratio = -4.0; } + + if ( !m_light ) return; + + unsigned int r = fill.color.r; + unsigned int g = fill.color.g; + unsigned int b = fill.color.b; + + // reverse bottom + double directed_light = dratio*dotProduct( m_light_vector, normal )*(m_directed_light+50.0); + double ratio = 256.0 - (m_directed_light+50.0)*3.0 + QMAX(directed_light,0.0) + m_ambient_light*4.0; + unsigned int shade = QMAX( 0, int(ratio) ); + + // shade with distant light source + r = (shade * r) >> 8; + g = (shade * g) >> 8; + b = (shade * b) >> 8; + + fill.color.r = (unsigned char )QMIN( 255U, QMAX( r, 0U ) ); + fill.color.g = (unsigned char )QMIN( 255U, QMAX( g, 0U ) ); + fill.color.b = (unsigned char )QMIN( 255U, QMAX( b, 0U ) ); + } + +//-------------------------------------------------------------// + +QSPt3f QSProjection::furthest() const + { + return QSPt3f(0.0,0.0,0.0); + } + +//-------------------------------------------------------------// + +QSPt2f QSProjection::middle() const + { + return QSPt2f(0.0,0.0); + } + + + + + /** + * Maps 'p' to the screen coordinates. + * + virtual QSPt2 world3DToScreen( const QSPt3f &p ) const ; + + +//-------------------------------------------------------------// + +QSPt2 QSProjection::world3DToScreen( const QSPt3f &p ) const + { + return world2DToScreen( map(p) ); + } + + + * Maps the point to the screen coordinates. + + virtual QSPt2 world2DToScreen( const QSPt2f& p ) const = 0; + + * Maps 'p' to the screen coordinates and returns the Z coordinate ( depth ). + +// virtual double world3DToScreenDepth( const QSPt3f &p ) const; + +//-------------------------------------------------------------// + +QSPt2f QSProjection::world3DToScreenF( const QSPt3f &p ) const + { + return world2DToScreenF( map(p) ); + } + +//-------------------------------------------------------------// + +double QSProjection::world3DToScreenDepth( const QSPt3f &p ) const + { + return (1.0-p.z); + } +*/ diff --git a/kmatplot/widgets/qsprojection.h b/kmatplot/widgets/qsprojection.h new file mode 100644 index 0000000..321bbd2 --- /dev/null +++ b/kmatplot/widgets/qsprojection.h @@ -0,0 +1,313 @@ +/*************************************************************************** + qsprojection.h + ------------------- + begin : 01-January-2000 + copyright : (C) 2000 by Kamil Dobkowski + email : kamildobk@poczta.onet.pl + ***************************************************************************/ + +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + + +#ifndef QSPROJECTION_H +#define QSPROJECTION_H + +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + +#include"qscoord.h" +#include"qsgattr.h" + +class QSAxes; +/** + * \brief Base class for 2D,3D world -> screen transformations. + * + * Transformations maps points from world coordinates ( 2d,3d space ) to + * screen(canvas) coordinates and also clips polygon and lines to the viewport. Each axes object such as QSAxes2D, QSAxes3D + * provides its own implementation of transformation object which can be acessed through this interface, see QSAxes::proj() + * There are two sets of functions: first which maps coordinates from 2D world + * to screen and the second, which maps coordinates from 3D world to screen. The first set should be used + * by 2d plots and the second should be used by 3d plots. Projection can treat mappings from world2D in a + * special way allowing plotting 2d datasets on a different planes etc. This will be detailed in the next version. + * Notice that QSAxes2D also provides world3DToCanvas() methods allowing drawing 3D datasets on 2D axes. + * Projection expect all world coordinates to be in range 0.0-1.0. + * see world2DToCanvas() and world2DToCanvas3() world3DToCanvas() world3DToCanvas3() furthest() middle() + * canvas3ToWorld3D() + */ +class QSProjection { + public: + /** + * PI + */ + static const double pi; + /** + * Degrees to radians + */ + static inline double degToRad( double deg ) { return deg*pi/180.0; } + /** + * Radians to degrees + */ + static inline double radToDeg( double rad ) { return rad*180.0/pi; } + /** + * Clipping result. + * @see #clipLine + * @see #clipPoly + */ + enum ClipResult { Rejected = 0, Clipped, Accepted }; + /** + * Constructor + */ + QSProjection(); + /** + * Destructor + */ + virtual ~QSProjection(); + /** + * Turns on lighting. + */ + virtual void setLight( bool enabled ); + /** + * Sets light parameters + */ + virtual void setLightParameters( const QSPt3f& lightVector, int ambientLight, int directedLight ); + /** + * Is light turned on ? + */ + bool light() const { return m_light; } + /** + * light direction - normalized vector + */ + QSPt3f lightVector() const { return m_light_vector; } + /** + * ambient light intensity ( -50,50 ) + */ + int ambientLight() const { return m_ambient_light; } + /** + * directed light intensity ( -50, 50 ) + */ + int directedLight() const { return m_directed_light; } + /** + * Maps the point to the screen coordinates+depth. + */ + virtual QSPt3f world2DToCanvas3( const QSPt2f& p ) const = 0; + /** + * Maps the point to the screen coordinates - the same as + * world2DToCanvas3() but the depth is not returned. Provided + * only for efficiency. + */ + virtual QSPt2f world2DToCanvas( const QSPt2f& p ) const = 0; + /** + * Maps 'p' to the screen coordinates.+ depth + */ + virtual QSPt3f world3DToCanvas3( const QSPt3f &p ) const = 0; + /** + * Maps 'p' to the screen coordinates. - the same as + * world3DToCanvas3() but the depth not returned. Provided + * only for efficiency. + */ + virtual QSPt2f world3DToCanvas( const QSPt3f &p ) const = 0; + /** + * Maps 'p' from canvas coordinates to world coordinates. + */ + virtual QSPt3f canvas3ToWorld3D( const QSPt3f &p ) const = 0; + /** + * + */ + QSPt2f map( const QSPt3f& pos ) const { return QSPt2f( pos.x, pos.y ); } + /** + * + */ + QSPt3f map( const QSPt2f& pos ) const { return QSPt3f( pos.x, pos.y, 0.0 ); } + /** + * Returns a point from [(0, 0, 0) ( 1, 1, 1 )] cube, which has the greatest + * z coordinate and all its three neighbourng walls are visible. + * @see QSProjection3D::T + */ + virtual QSPt3f furthest() const; + /** + * Middle point + */ + virtual QSPt2f middle() const; + /** + * Tests if point is inside the clipping area. Returns 'Rejected' or 'Accepted'. + */ + virtual ClipResult clipPoint2( const QSPt2f& p1 ) const; + /** + * Clips a line defined by 'p1' and 'p2' to the clipping rectangle. + * Returns a state of the operation: + * 'Clipped' - the line was clipped and coordinates of points were written to 'out', + * 'Rejected' - the line was thrown away ( coordinates not modified ), + * 'Accepted' - the line is inside the clipping rectangle ( coordinates were not modified ). + * @see #setClipRect + */ + virtual ClipResult clipLine2( QSPt2f* p1, QSPt2f* p2 ) const; + /** This method clips a polygon defined by 'npoints' points in 'in' to the clip rectangle + * and returns a new polygon in 'out'. Table 'out' must be large enough to contain all + * vertices after clipping. The maximum size of this table must be given as 'maxpoints'. + * If 'outedges' array is passed returns edges to be drawn ( those will be all unclipped edges ), + * you can pass a table with an initial edge state in 'inedges'. + * Returns a state of the operation: + * 'Clipped' - the polygon was clipped and coordinates of points were written to 'out', + * 'Rejected' - the polygon was thrown away ( coordinates in 'out...' were not modified ), + * 'Accepted' - the polygon is inside the clipping rectangle ( coordinates in 'out...' were not modified ). + * @see #setClipRect + */ + virtual ClipResult clipPoly2( const QSPt2f in[], int inpoints, QSPt2f out[], int *outpoints, int maxout, bool outedges[] = NULL, const bool inedges[] = NULL ) const; + /** + * Tests if point is inside the clipping space. Returns 'Rejected' or 'Accepted'. + */ + virtual ClipResult clipPoint3( const QSPt3f& pos ) const; + /** + * Clips line. + */ + virtual ClipResult clipLine3( QSPt3f* p1, QSPt3f* p2 ) const; + /** + * This method clips the polygon defined by 'npoints' points in 'in' to the axis box [(0,0,0),(1,1,1)] + * and returns a new mesh in 'out'. Table 'out' must be large enough to contain all vertices after clipping. + * The size of this table must be given in 'maxpoints'. + * If 'outedges' array is passed returns edges to be drawn ( those will be all unclipped edges ), + * you can pass a table with an initial edge state in 'inedges'. + * Returns a state of the operation: + * 'Clipped' - the polygon was clipped and coordinates of points were written to 'out', + * 'Rejected' - the polygon was thrown away ( coordinates not modified ), + * 'Acccepted' - the polygon is inside the axis box ( coordinates were not modified ). + */ + virtual ClipResult clipPoly3( const QSPt3f in[], int inpoints, QSPt3f out[], int *outpoints, int maxpoints, const QSPt3f cube[2], bool outedges[] = NULL, const bool inedges[] = NULL ) const; + /** + * Shades 'fill' color. + */ + virtual void shade( QSGFill &fill, const QSPt3f& normal, const QSPt2f* canvas_pts, int npoints, QSGFill *bottomFill ) const; + + //-----------------------------------------------------------------------------------------------------// + + /** + * Tests if point 'pos' is inside polygon 'pts'. No need to reimplement. + */ + static bool pointInPoly( const QSPt2f& pos, const QSPt2f* pts, int npts ); + + //-----------------------------------------------------------------------------------------------------// + + /** + * Returns 'p1 * p2' . + */ + static double dotProduct( const QSPt3f& p1, const QSPt3f& p2 ); + /** + * Returns 'p1 x p2' . + */ + static QSPt3f vectorProduct( const QSPt3f& p1, const QSPt3f& p2 ); + /** + * Returns the normal to the given quad. + */ + static QSPt3f normal( const QSPt3f vertices[4], bool normalize = true ); + /** + * Returns the normal to the given polygon. + */ + static QSPt3f normal( const QSPt3f *v, int npoints, bool normalize = true ); + /** + * Normalize vector. + */ + static QSPt3f normalize( QSPt3f vector ); + /** + * Calculates a bounding box of the polygon defined by 'inpoints' vertices in in[] and + * writes it to the 'cube[]' table. + */ + static void getPoly3Cube( const QSPt3f in[], int inpoints, QSPt3f cube[2] ); + /** + * + */ + static ClipResult clipLine( QSPt2f* p0, QSPt2f* p1, const QSPt2f& clip_pos, const QSPt2f& clip_area ); + /** + * Calculates interpolated normals. With the given polygon defined by 'inpoint' vertices 'in[]', and normals + * to those vertices in 'innors[]', calculates normals at 'clippoints' points 'clip[]' interpolating + * respective normals of the polygon and writes them to 'outnors[]', which must have size equal to 'clippoints'. + * All points in 'clip[]' must lie inside the given polygon. + */ + static void clipVertexNormals( const QSPt3f in[], int inpoints, const QSPt3f clip[], int clipoints, const QSPt3f innors[], QSPt3f outnor[] ); + /** + * Calculates interpolated colors. With the given polygon defined by 'inpoints' vertices 'in[]', and colors + * of those vertices in 'incols[]', calculates colors at 'clippoints' points 'clip[]' interpolating + * respective colors of the polygon and writes them to 'outcols[]', which must have size equal to 'clippoints'. + * All points in 'clip[]' must lie inside the given polygon. + */ + static void clipVertexColors( const QSPt3f in[], int inpoints, const QSPt3f clip[], int clipoints, const QSGFill incol[], QSGFill outcol[] ); + /** + * Checks wheather a bottom side of the given polygon is visible. All points are in canvas coordinates. + */ + static bool isBottom( const QSPt2f pts[], int npoints ); + /** + * Checks wheather a bottom side of the given polygon is visible. All points are in canvas coordinates. + */ + static bool isBottom( const QSPt3f pts[], int npoints ); + /** + * The special version for triangles of the above function. All points are in canvas coordinates. + */ + static inline bool isBottom( const QSPt3f &p0,const QSPt3f &p1, const QSPt3f &p2 ) { + return 0.0 > p2.x*p0.y - p0.x*p2.y + p0.x*p1.y - p1.x*p0.y + p1.x*p2.y - p2.x*p1.y; + } + /** + * Triangulates the given polygon and checks if all triangles have the same side visible ( all have top or all have the bottom side visible ). All points are in canvas coordinates. + */ + static bool isFlat( const QSPt3f pts[], int npoints ); + static bool isCorrect( const QSPt3f pts[4] ); + static bool isCorrect( const double values[4] ); + /* + * Extracs triangle from polygon. This methods divides polygon into npoints-2 triangles. + */ + static void triangulate1( int triangleNumber, const QSPt3f pts[], int npoints, QSPt3f triangle[3], bool edges[3] ); + + protected: + bool m_light; + QSPt3f m_light_vector; + int m_ambient_light; + int m_directed_light; + + private: + static QSPt3f interpolation( const QSPt3f& p1, const QSPt3f& p2, double t ); + static QSGFill interpolation( const QSGFill& f1, const QSGFill& f2, double t ); + static void get_interpolation_params(const QSPt3f in[], int inpoints, const QSPt3f& clip, int p1[2], int p2[2], double *t1, double *t2, double *t3 ); + }; + +#endif + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/kmatplot/widgets/qsprojection2d.cpp b/kmatplot/widgets/qsprojection2d.cpp new file mode 100644 index 0000000..b6db8e9 --- /dev/null +++ b/kmatplot/widgets/qsprojection2d.cpp @@ -0,0 +1,283 @@ +/*************************************************************************** + qsprojection2d.cpp + ------------------- + begin : 01-January-2000 + copyright : (C) 2000 by Kamil Dobkowski + email : kamildobk@poczta.onet.pl + ***************************************************************************/ + +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + + +#include "qsprojection2d.h" +#include<math.h> + + + +QSProjection2D::QSProjection2D() +:QSProjection() + { + } + +//-------------------------------------------------------------// + +QSProjection2D::~QSProjection2D() + { + } + +//-------------------------------------------------------------// + +void QSProjection2D::matrixI( Matrix m ) + { + int i, j; + for ( j=0; j<3; j++ ) for( i=0; i<3; i++ ) m[j][i] = 0.0; + m[0][0] = 1.0; + m[1][1] = 1.0; + m[2][2] = 1.0; + } + +//-------------------------------------------------------------// + +void QSProjection2D::multiply( Matrix A, Matrix B ) +// apply transformation +// A = B*A + { + int i, j, k; + Matrix result; + + for( i=0; i<3; i++ ) + for (j=0; j<3; j++ ) { + result[i][j] = 0.0; + for( k=0; k<3; k++ ) result[i][j] += B[i][k]*A[k][j]; + } + + for( i=0; i<3; i++) for( j=0; j<3; j++) A[i][j] = result[i][j]; + } + + +//-------------------------------------------------------------// + +void QSProjection2D::copy( Matrix dst, const Matrix src ) + { + int i, j; + for ( i=0; i<3; i++) for( j=0; j<3; j++ ) dst[i][j] = src[i][j]; + } + + +//-------------------------------------------------------------// + +void QSProjection2D::applyT( Matrix m, double dx, double dy ) +// translate +// | 0 0 dx | +// | 0 0 dy | +// | 0 0 1 | + { + Matrix temp; + + matrixI( temp ); + + temp[0][2] = dx; + temp[1][2] = dy; + + multiply( m, temp ); + } + + +//-------------------------------------------------------------// + +void QSProjection2D::applyS( Matrix m, double sx, double sy ) +// scale +// | sx 0 0 | +// | 0 sy 0 | +// | 0 0 1 | + { + Matrix temp; + + matrixI( temp ); + + temp[0][0] = sx ; + temp[1][1] = sy ; + + multiply( m, temp ); + } + + +//-------------------------------------------------------------// + +void QSProjection2D::applyViewport( Matrix m, double x, double y, double w, double h ) +// maps (0,0,1,1) rectangle to the (x,y,w,h) rectangle. + { + applyS( m, w, h ); + applyT( m, x, y ); + } + +//-------------------------------------------------------------// + +double QSProjection2D::world2DToCanvasX( double x ) const +// all implementations are slightly modified, simplified worldTransformation() - nothing special + { + return x*T[0][0] + T[0][2]; + } + +//-------------------------------------------------------------// + +double QSProjection2D::world2DToCanvasY( double y ) const +// all implementations are slightly modified, simplified worldTransformation() - nothing special + { + return y*T[1][1] + T[1][2]; + } + +//-------------------------------------------------------------// + +double QSProjection2D::world2DToCanvasZ( double z ) const + { + return 1.0-z; + } + +//-------------------------------------------------------------// + +double QSProjection2D::canvasXToWorld2D( double x ) const +// all implementations are slightly modified, simplified worldTransformation() - nothing special +// it does not depend on y so we can set y==0 and simplify + { + double w = IT[2][0]*x + IT[2][2]; + return (x*IT[0][0] + IT[0][2])/w; + } + +//-------------------------------------------------------------// + +double QSProjection2D::canvasYToWorld2D( double y ) const +// all implementations are slightly modified, simplified worldTransformation() - nothing special +// it does not depend on x so we can set x==0 and simplify + { + double w = IT[2][1]*y + IT[2][2]; + return (y*IT[1][1] + IT[1][2])/w; + } + +//-------------------------------------------------------------// + +double QSProjection2D::canvasZToWorld2D( double z ) const + { + return 1.0-z; + } + +//-------------------------------------------------------------// + +QSPt2f QSProjection2D::worldTransformation( const Matrix m, const QSPt2f& p ) const + { + double w = m[2][0]*p.x + m[2][1]*p.y + m[2][2]; + return QSPt2f( (p.x*m[0][0] + p.y*m[0][1] + m[0][2])/w, + (p.x*m[1][0] + p.y*m[1][1] + m[1][2])/w ); + } + +//-------------------------------------------------------------// + +QSPt2f QSProjection2D::world2DToCanvas( const QSPt2f& p ) const +// all implementations are slightly modified, simplified worldTransformation() - nothing special + { + return QSPt2f( p.x*T[0][0] + p.y*T[0][1] + T[0][2], + p.x*T[1][0] + p.y*T[1][1] + T[1][2] ); + } + +//-------------------------------------------------------------// + +QSPt3f QSProjection2D::world2DToCanvas3( const QSPt2f& p ) const +// all implementations are slightly modified, simplified worldTransformation() - nothing special + { + return QSPt3f( p.x*T[0][0] + p.y*T[0][1] + T[0][2], + p.x*T[1][0] + p.y*T[1][1] + T[1][2], + 0.0 ); + } + +//-------------------------------------------------------------// + +QSPt2f QSProjection2D::world3DToCanvas( const QSPt3f& p ) const +// all implementations are slightly modified, simplified worldTransformation() - nothing special + { + return QSPt2f( p.x*T[0][0] + p.y*T[0][1] + T[0][2], + p.x*T[1][0] + p.y*T[1][1] + T[1][2] ); + } + +//-------------------------------------------------------------// + +QSPt3f QSProjection2D::world3DToCanvas3( const QSPt3f& p ) const +// all implementations are slightly modified, simplified worldTransformation() - nothing special + { + return QSPt3f( p.x*T[0][0] + p.y*T[0][1] + T[0][2], + p.x*T[1][0] + p.y*T[1][1] + T[1][2], + 1.0-p.z ); + } + +//-------------------------------------------------------------// + +QSPt3f QSProjection2D::canvas3ToWorld3D( const QSPt3f &pos ) const +// all implementations are slightly modified, simplified worldTransformation() - nothing special + { + QSPt2f p = worldTransformation( IT, QSPt2f(pos.x,pos.y) ); + return QSPt3f( p.x, p.y, 1.0-pos.z ); + } + +//-------------------------------------------------------------// + +void QSProjection2D::inv( Matrix result, const Matrix m ) +// + { + double detR = m[0][0]*m[1][1]*m[2][2] + + m[0][1]*m[1][2]*m[2][0] + + m[0][2]*m[1][0]*m[2][1] - + m[0][2]*m[1][1]*m[2][0] - + m[0][0]*m[1][2]*m[2][1] - + m[0][1]*m[1][0]*m[2][2]; + + if ( detR != 0.0 ) { + result[0][0] = ( m[1][1]*m[2][2] - m[1][2]*m[2][1] ) / detR; + result[1][0] = ( m[1][2]*m[2][0] - m[1][0]*m[2][2] ) / detR; + result[2][0] = ( m[1][0]*m[2][1] - m[1][1]*m[2][0] ) / detR; + result[0][1] = ( m[0][2]*m[2][1] - m[0][1]*m[2][2] ) / detR; + result[1][1] = ( m[0][0]*m[2][2] - m[0][2]*m[2][0] ) / detR; + result[2][1] = ( m[0][1]*m[2][0] - m[0][0]*m[2][1] ) / detR; + result[0][2] = ( m[0][1]*m[1][2] - m[0][2]*m[1][1] ) / detR; + result[1][2] = ( m[0][2]*m[1][0] - m[0][0]*m[1][2] ) / detR; + result[2][2] = ( m[0][0]*m[1][1] - m[0][1]*m[1][0] ) / detR; + } + } + +//-------------------------------------------------------------// + + +void QSProjection2D::setClipRect( double x1, double y1, double x2, double y2 ) + { + m_cmin.x = QMIN(x1,x2); + m_cmin.y = QMIN(y1,y2); + m_cmax.x = QMAX(x1,x2); + m_cmax.y = QMAX(y1,y2); + } + +//-------------------------------------------------------------// + +void QSProjection2D::getClipRect( double *x1, double *y1, double *x2, double *y2 ) const + { + if (x1) *x1 = m_cmin.x; + if (y1) *y1 = m_cmin.y; + if (x2) *x2 = m_cmax.x; + if (y2) *y2 = m_cmax.y; + } + + + + + + + + + + + + diff --git a/kmatplot/widgets/qsprojection2d.h b/kmatplot/widgets/qsprojection2d.h new file mode 100644 index 0000000..fff47c0 --- /dev/null +++ b/kmatplot/widgets/qsprojection2d.h @@ -0,0 +1,168 @@ +/*************************************************************************** + qsprojection2d.h + ------------------- + begin : 01-January-2000 + copyright : (C) 2000 by Kamil Dobkowski + email : kamildobk@poczta.onet.pl + ***************************************************************************/ + +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + + +#ifndef QSPROJECTION2D_H +#define QSPROJECTION2D_H + +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + +#include"qsprojection.h" + +/** + * \brief Implementation of QSProjection for use in QSAxes2D. + * @author Kamil Dobkowski + */ +class QSProjection2D : public QSProjection { + + public: + typedef double Matrix[3][3]; + Matrix T; + Matrix IT; + /** + * constructor. + */ + QSProjection2D(); + /** + * destructor. + */ + virtual ~QSProjection2D(); + /** + * Makes 'matrix' a unity matrix. + */ + static void matrixI( Matrix m ); + /** + * Matrix multiplication : 'A = B*A' + */ + static void multiply( Matrix A, Matrix B ); + /** + * Copies the given matrix : 'dst = src' . + */ + static void copy( Matrix dst, const Matrix src ); + /** + * Apply shift ( translate ). + */ + static void applyT( Matrix m, double dx, double dy ); + /** + * Apply scaling. + */ + static void applyS( Matrix m, double sx, double sy ); + /** + * Calculates inversion of 'm'. + */ + static void inv( Matrix result, const Matrix m ); + /** + * Apply viewport transformation. + */ + static void applyViewport( Matrix m, double x, double y, double w, double h ); + /** + * Maps the X to the screen coordinates. + */ + double world2DToCanvasX( double x ) const; + /** + * Maps the Y to the screen coordinates. + */ + double world2DToCanvasY( double y ) const; + /** + * Maps the Z to the screen coordinates. + */ + double world2DToCanvasZ( double z ) const; + /** + * Maps the X from screen coordinates + */ + double canvasXToWorld2D( double x ) const; + /** + * Maps the Z from screen coordinates + */ + double canvasYToWorld2D( double y ) const; + /** + * Maps the Z from screen coordinates + */ + double canvasZToWorld2D( double z ) const; + /** + * Reimplemented. Maps the point to the screen coordinates. + */ + virtual QSPt2f world2DToCanvas( const QSPt2f& p ) const; + /** + * Reimplemented. Maps the point to the screen coordinates. + */ + virtual QSPt3f world2DToCanvas3( const QSPt2f& p ) const; + /** + * Reimplemented. Maps the point to the screen coordinates. + */ + virtual QSPt2f world3DToCanvas( const QSPt3f& p ) const; + /** + * Reimplemented. Maps the point to the screen coordinates. + */ + virtual QSPt3f world3DToCanvas3( const QSPt3f& p ) const; + /** + * Reimplemented. + */ + virtual QSPt3f canvas3ToWorld3D( const QSPt3f &p ) const; + /** + * Reimplemented. Applies transformation 'm' to 'p'. + */ + virtual QSPt2f worldTransformation( const Matrix m, const QSPt2f& p ) const; + + void setClipRect( double x1, double y1, double x2, double y2 ); + void getClipRect( double *x1, double *y1, double *x2, double *y2 ) const; + + private: + // clip rectangle + QSPt2f m_cmin; + QSPt2f m_cmax; + }; + + +#endif + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/kmatplot/widgets/qsprojection3d.cpp b/kmatplot/widgets/qsprojection3d.cpp new file mode 100644 index 0000000..6661b9d --- /dev/null +++ b/kmatplot/widgets/qsprojection3d.cpp @@ -0,0 +1,695 @@ +/*************************************************************************** + qsprojection3d.cpp + ------------------- + begin : 01-January-2000 + copyright : (C) 2000 by Kamil Dobkowski + email : kamildobk@poczta.onet.pl + ***************************************************************************/ + +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + +#include"qsprojection3d.h" +#include<assert.h> +#include<math.h> +#include<qapplication.h> // qWarning. +#include<iostream> +#include<stdio.h> + +//-------------------------------------------------------------// + +QSProjection3D::QSProjection3D() + { + } + +//-------------------------------------------------------------// + +QSProjection3D::~QSProjection3D() + { + } + +//-------------------------------------------------------------// + +void QSProjection3D::matrixI( Matrix m ) +// unit matrix + { + int i, j; + for ( j=0; j<4; j++ ) for( i=0; i<4; i++ ) m[j][i] = 0.0; + m[0][0] = 1.0; + m[1][1] = 1.0; + m[2][2] = 1.0; + m[3][3] = 1.0; + } + +//-------------------------------------------------------------// + +void QSProjection3D::applyT( Matrix m, double dx, double dy, double dz ) +// translate +// | 0 0 0 dx | +// | 0 0 0 dy | +// | 0 0 0 dz | +// | 0 0 0 1 | + { + Matrix temp; + matrixI( temp ); + + temp[0][3] = dx; + temp[1][3] = dy; + temp[2][3] = dz; + + multiply( m, temp ); + } + +//-------------------------------------------------------------// + +void QSProjection3D::applyS( Matrix m, double sx, double sy, double sz ) +// scale +// | sx 0 0 0 | +// | 0 sy 0 0 | +// | 0 0 sz 0 | +// | 0 0 0 1 | + { + Matrix temp; + matrixI( temp ); + + temp[0][0] = sx ; + temp[1][1] = sy ; + temp[2][2] = sz ; + + multiply( m, temp ); + } + +//-------------------------------------------------------------// + +void QSProjection3D::applyR( Matrix m, double alfay, double alfax, double alfaz ) +// rotate first about the y axis (alfay angle) and next about the x axis (alfax angle) +// angles should be in degrees +// | cosA 0 sinA 0 | +// | 0 1 0 0 | about the y axis +// | -sinA 0 cosA 0 | +// +// | 1 0 0 0 | +// | 0 cosB -sinB 0 | x axis +// | 0 sinB cosB 0 | +// | 0 0 0 1 | + { + Matrix temp; + + double A = degToRad(alfay); + double B = degToRad(alfax); + double C = degToRad(alfaz); + + matrixI( temp ); + temp[0][0] = cos( A ); + temp[0][2] = sin( A ); + temp[2][0] = -sin( A ); + temp[2][2] = cos( A ); + + multiply( m, temp ); + matrixI( temp ); + temp[1][1] = cos( B ); + temp[1][2] = -sin( B ); + temp[2][1] = sin( B ); + temp[2][2] = cos( B ); + + if ( alfaz != 0.0 ) { + multiply( m, temp ); + matrixI( temp ); + temp[0][0] = cos( C ); + temp[0][1] = -sin( C ); + temp[1][0] = sin( C ); + temp[1][1] = cos( C ); + } + + multiply( m, temp ); + } +//-------------------------------------------------------------// + +void QSProjection3D::copy( Matrix dst, const Matrix src ) + { + int i; + int j; + for ( i=0; i<4; i++) for( j=0; j<4; j++ ) dst[i][j] = src[i][j]; + } + +//-------------------------------------------------------------// + +void QSProjection3D::multiply( Matrix A, const Matrix B ) +// apply transformation +// A = B*A + { + int i, j, k; + Matrix result; + + for( i=0; i<4; i++ ) + for (j=0; j<4; j++ ) { + result[i][j] = 0.0; + for( k=0; k<4; k++ ) result[i][j] += B[i][k]*A[k][j]; + } + + for( i=0; i<4; i++) for( j=0; j<4; j++) A[i][j] = result[i][j]; + } + + +//-------------------------------------------------------------// + +void QSProjection3D::matrix_to_stdout( const Matrix& m ) + { + + int i, j; + for( i=0; i<4; i++) { + for( j=0; j<4; j++) { + printf("%e ", m[i][j] ); + } + printf("\n"); + } + printf("\n"); + printf("\n"); + fflush(NULL); + + } + +//-------------------------------------------------------------// + +QSPt3f QSProjection3D::worldTransformation( const Matrix m, const QSPt3f &p ) + { + QSPt3f result; + + double w = m[3][0] * p.x + m[3][1] * p.y + m[3][2] * p.z + m[3][3] ; + + result.x = ( m[0][0] * p.x + m[0][1] * p.y + m[0][2] * p.z + m[0][3] ) / w; + result.y = ( m[1][0] * p.x + m[1][1] * p.y + m[1][2] * p.z + m[1][3] ) / w; + result.z = ( m[2][0] * p.x + m[2][1] * p.y + m[2][2] * p.z + m[2][3] ) / w; + + return result; + } + +//-------------------------------------------------------------// + +void QSProjection3D::ortho( Matrix m, double l, double r, double b, double t, double n, double f ) + { + matrixI( m ); + + assert( r > l ); + assert( t > b ); + assert( f > n ); + + m[0][0] = 2.0 / ( r - l ); m[0][3] = -( r+l ) / ( r-l ); + m[1][1] = 2.0 / ( t - b ); m[1][3] = -( t+b ) / ( t-b ); + m[2][2] = -2.0 / ( f - n ); m[2][3] = -( f+n ) / ( f-n ); + + } + +//-------------------------------------------------------------// + +void QSProjection3D::frustum( Matrix m, double l, double r, double b, double t, double n, double f ) + { + matrixI( m ); + + assert( r > l ); + assert( t > b ); + assert( f > n ); + + m[0][0] = 2.0*n / ( r-l ); m[0][2] = ( r+l ) / ( r-l ); + m[1][1] = 2.0*n / ( t-b ); m[1][2] = ( t+b ) / ( t-b ); + m[2][2] = -( f+n ) / ( f-n ); m[2][3] = -2.0*f*n / ( f-n ); + + m[3][2] = -1.0; m[3][3] = 0.0; + } + +//-------------------------------------------------------------// + +void QSProjection3D::setProjection( double l, double r, double b, double t, double n, double f, bool p ) + { + m_proj[0] = l; + m_proj[1] = r; + m_proj[2] = b; + m_proj[3] = t; + m_proj[4] = n; + m_proj[5] = f; + + m_perspective = p; + } + +//-------------------------------------------------------------// + +void QSProjection3D::getProjection( double *l, double *r, double *b, double *t, double *n, double *f, bool *p ) const + { + if ( l ) *l = m_proj[0]; + if ( r ) *r = m_proj[1]; + if ( b ) *b = m_proj[2]; + if ( t ) *t = m_proj[3]; + if ( n ) *n = m_proj[4]; + if ( f ) *f = m_proj[5]; + if ( p ) *p = m_perspective; + } + + + +//-------------------------------------------------------------// + +void QSProjection3D::applyViewport( Matrix m, double x, double y, double w, double h, double n, double f ) +// Maps +// x from <-1, 1> to <x, x+w> +// y from <-1, 1> to <y, y+h> + + { + Matrix k; + + matrixI( k ); + + applyS( k, + w/2.0, + h/2.0, + (f-n)/2.0 ); + + applyT( k, + x+w/2.0, + y+h/2.0, + (f+n)/2.0 ); + + multiply( m, k ); + } + +//-------------------------------------------------------------// + +void QSProjection3D::setViewport( double x, double y, double w, double h, double n, double f ) + { + m_view[0] = x; + m_view[1] = y; + m_view[2] = w; + m_view[3] = h; + m_view[4] = n; + m_view[5] = f; + } + +//-------------------------------------------------------------// + +void QSProjection3D::getViewport( double *x, double *y, double *w, double *h, double *n, double *f ) const + { + if ( x ) *x = m_view[0]; + if ( y ) *y = m_view[1]; + if ( w ) *w = m_view[2]; + if ( h ) *h = m_view[3]; + if ( n ) *n = m_view[4]; + if ( f ) *f = m_view[5]; + } + +//-------------------------------------------------------------// + +void QSProjection3D::fit( Matrix& S ) +// Fit 1,1,1 cube, so it fits to (0,1)(0,1) canvas +// + { + Matrix m; + + copy( m, M ); multiply( m, P ); + + double min_x = 0.0; + double min_y = 0.0; + double max_x = 0.0; + double max_y = 0.0; + + QSPt3f p2; + QSPt3f p3; + for( int z=0; z<=1; z+=1 ) + for( int y=0; y<=1; y+=1 ) + for( int x=0; x<=1; x+=1 ) + { + double x_corner = ( x == 0 ? bmin.x : bmax.x ); + double y_corner = ( y == 0 ? bmin.y : bmax.y ); + double z_corner = ( z == 0 ? bmin.z : bmax.z ); + + p2 = worldTransformation( m, p3.set( x_corner, y_corner, z_corner ) ); + + if ( x == 0 && + y == 0 && + z == 0 ) { + min_x = max_x = p2.x; + min_y = max_y = p2.y; + } + + min_x = QMIN( min_x, p2.x ); + max_x = QMAX( max_x, p2.x ); + min_y = QMIN( min_y, p2.y ); + max_y = QMAX( max_y, p2.y ); + } + + double scale = 1.0; + + if ( min_x != max_x && + min_y != max_y ) scale = QMIN( 2.0/(max_x-min_x), + 2.0/(max_y-min_y) ); + + matrixI( S ); + applyS( S, + scale, + scale, + 1.0 ); + + + applyT( S, + -min_x*scale-1.0 + (2.0-(max_x-min_x)*scale)/2.0, + -min_y*scale-1.0 + (2.0-(max_y-min_y)*scale)/2.0, + 0.0 ); + + } + + +//-------------------------------------------------------------// + +QSPt2f QSProjection3D::middle() const + { + Matrix m; copy( m, T ); + + QSPt2f middle = QSPt2f( 0.0, 0.0 ); + + if ( m_perspective ) { + double a11 = m[0][0]*m[3][2] - m[0][2]*m[3][0]; + double a12 = m[0][1]*m[3][2] - m[0][2]*m[3][1]; + double ab1 = m[0][2]*m[3][3] - m[0][3]*m[3][2]; + + double a21 = m[1][0]*m[3][2] - m[1][2]*m[3][0]; + double a22 = m[1][1]*m[3][2] - m[1][2]*m[3][1]; + double ab2 = m[1][2]*m[3][3] - m[3][2]*m[1][3]; + + double dA = a11*a22 - a12*a21; + double dX = ab1*a22 - a12*ab2; + double dY = a11*ab2 - ab1*a21; + + middle.x = dX/dA; + middle.y = dY/dA; + } else { + QSPt3f p = nearest(); + middle = QSPt2f(p.x,p.y); + } + + return middle; + } + +//-------------------------------------------------------------// + +QSPt3f QSProjection3D::furthest() const + { + Matrix t; + + matrixI( t ); + copy( t, M ); + multiply( t, P ); + + QSPt3f r; + QSPt3f u; + QSPt3f m; + QSPt3f s; + QSPt3f z = worldTransformation( t, u.set( 0.0, 0.0, 0.0 ) ); + + bool initialized = false; + + for( int z=0; z<=1; z+=1 ) + for( int y=0; y<=1; y+=1 ) + for( int x=0; x<=1; x+=1 ) + { + double x_corner = ( x == 0 ? 0.0 : 1.0 ); + double y_corner = ( y == 0 ? 0.0 : 1.0 ); + double z_corner = ( z == 0 ? 0.0 : 1.0 ); + + QSPt3f p = worldTransformation( t, u.set( x_corner, y_corner, z_corner ) ); + + // Point is valid only if all three neighbouring walls are visible + // Calculate normals and check if it is. + QSPt3f vx = worldTransformation( t, s.set( 1.0, u.y, 0.0 ) ) - + worldTransformation( t, s.set( 0.0, u.y, 0.0 ) ); + + QSPt3f vy = worldTransformation( t, s.set( u.x, 0.0, 0.0 ) ) - + worldTransformation( t, s.set( u.x, 1.0, 0.0 ) ); + + QSPt3f vz = worldTransformation( t, s.set( u.x, u.y, 1.0 ) ) - + worldTransformation( t, s.set( u.x, u.y, 0.0 ) ); + + QSPt3f nxz = vectorProduct( vx, vz ); if ( u.y ) nxz.set( -nxz.x, -nxz.y, -nxz.z ); + QSPt3f nyz = vectorProduct( vy, vz ); if ( u.x ) nyz.set( -nyz.x, -nyz.y, -nyz.z ); + QSPt3f nxy = vectorProduct( vx, vy ); if ( u.z ) nxy.set( -nxy.x, -nxy.y, -nxy.z ); + + + if ( nxz.z > 0.0 || + nyz.z > 0.0 || + nxy.z > 0.0 ) continue; + + // init in the first pass + if ( !initialized ) { + r = u; + m = p; + initialized = true; + continue; + } + + // if there are may points with z = min, choose the one with the smallest y coord, + // if there are many points with the same z=min, y=min, choose the one with the + // smallest x coord. + + if ( fabs(p.z-m.z) < 1e-15 ) { + + if ( m.x > p.x && fabs(p.y-m.y) < 1e-15 ) { + r = u; + m = p; + continue; + } + + if ( m.y > p.y ) { + r = u; + m = p; + continue; + } + } + + // choose the one with the greater z coord + if ( p.z > m.z ) { + r = u; + m = p; + continue; + } + } + + return r; + } + +//-------------------------------------------------------------// + +QSPt3f QSProjection3D::nearest() const + { + QSPt3f result = furthest(); + result.x = result.x ? 0.0 : 1.0 ; + result.y = result.y ? 0.0 : 1.0 ; + result.z = result.z ? 0.0 : 1.0 ; + return result; + } + +//-------------------------------------------------------------// + +QSPt3f QSProjection3D::left() const + { + Matrix m; + copy( m, M ); multiply( m, P ); + + QSPt3f f = furthest(); + QSPt3f a = QSPt3f( f.x?0.0:1.0, f.y, f.z ); + QSPt3f b = QSPt3f( f.x, f.y?0.0:1.0, f.z ); + + if ( worldTransformation( m, a ).x < + worldTransformation( m, b ).x ) return a; + + return b; + } + +//-------------------------------------------------------------// + +QSPt3f QSProjection3D::right() const + { + QSPt3f r = left(); + r.set( r.x?0.0:1.0, r.y?0.0:1.0, r.z ); + return r; + } + + + +//-------------------------------------------------------------// + +void QSProjection3D::ludcmp( Matrix a, int indx[4], double *d ) +// +// "Numerical Recipes in C" www.nr.com Chap. 2.3 +// + { + int i, imax=0, j, k; + double big, dum, sum, temp; + double vv[4]; + + int n = 4; + + *d=1.0; + for(i=1;i<=n;i++) { + big=0.0; + for(j=1;j<=n;j++) if ((temp=fabs(a[i-1][j-1])) > big) big = temp; + if ( big == 0.0 ) return; + vv[i-1]=1.0/big; + } + + for(j=1;j<=n;j++) { + for(i=1;i<j;i++) { + sum=a[i-1][j-1]; + for (k=1;k<i;k++) sum -= a[i-1][k-1]*a[k-1][j-1]; + a[i-1][j-1] = sum; + } + + big=0.0; + for(i=j;i<=n;i++) { + sum=a[i-1][j-1]; + for (k=1;k<j;k++) sum -= a[i-1][k-1]*a[k-1][j-1]; + a[i-1][j-1]=sum; + + if ( (dum=vv[i-1]*fabs(sum)) >= big ) { + big = dum; + imax = i; + } + } + + if (j != imax) { + for (k=1;k<=n;k++) { + dum=a[imax-1][k-1]; + a[imax-1][k-1]=a[j-1][k-1]; + a[j-1][k-1]=dum; + } + + *d = -(*d); + vv[imax-1]=vv[j-1]; + } + + indx[j-1] = imax; + if( a[j-1][j-1] == 0.0 ) a[j-1][j-1] = 1e-20; + + if ( j != n ) { + dum=1.0/(a[j-1][j-1]); + for(i=j+1;i<=n;i++) a[i-1][j-1] *= dum; + } + } + } + +//-------------------------------------------------------------// + +void QSProjection3D::lubksb( Matrix a, int indx[4], double b[] ) +// +// "Numerical Recipes in C" www.nr.com Chap. 2.3 +// + { + int i; + int j; + int ip; + int ii = 0; + int n = 4; + + double sum; + + for( i=1; i<=n; i++ ) { + ip=indx[i-1]; + sum=b[ip-1]; + b[ip-1]=b[i-1]; + if (ii) for (j=ii;j<=i-1;j++) sum -= a[i-1][j-1]*b[j-1]; + else if (sum) ii=i; + b[i-1]=sum; + } + + for ( i=n; i>=1; i--) { + sum=b[i-1]; + for (j=i+1; j<=n; j++) sum -= a[i-1][j-1]*b[j-1]; + b[i-1]=sum/a[i-1][i-1]; + } + } + +//-------------------------------------------------------------// + +void QSProjection3D::inv( Matrix y, const Matrix m ) +// +// "Numerical Recipes in C" www.nr.com Chap. 2.3 +// + { + Matrix a; + + int i; + int j; + + int n = 4; + int indx[4]; + + double d; + double col[4]; + + copy( a, m ); ludcmp( a, indx, &d ); + + for( j = 0; j < n; j++ ) { + for( i=0; i<n ;i++ ) col[i]=0.0; + col[j]=1.0; lubksb( a, indx, col ); + for( i=0; i<n; i++ ) y[i][j]=col[i]; + } + } + +//-------------------------------------------------------------// + +QSPt2f QSProjection3D::world2DToCanvas( const QSPt2f& p ) const + { + return world3DToCanvas( QSPt3f(p.x,p.y,0.0) ); + } + +//-------------------------------------------------------------// + +QSPt3f QSProjection3D::world2DToCanvas3( const QSPt2f& p ) const + { + return world3DToCanvas3( QSPt3f(p.x,p.y,0.0) ); + } + +//-------------------------------------------------------------// + +QSPt2f QSProjection3D::world3DToCanvas( const QSPt3f &p ) const + { + QSPt2f result; + result.x = T[0][0] * p.x + T[0][1] * p.y + T[0][2] * p.z + T[0][3] ; + result.y = T[1][0] * p.x + T[1][1] * p.y + T[1][2] * p.z + T[1][3] ; + if ( m_perspective ) { + double w = T[3][0] * p.x + T[3][1] * p.y + T[3][2] * p.z + T[3][3] ; + result.x /= w; + result.y /= w; + } + return result; + } + +//-------------------------------------------------------------// + +QSPt3f QSProjection3D::world3DToCanvas3( const QSPt3f &p ) const + { + QSPt3f result; + result.x = T[0][0] * p.x + T[0][1] * p.y + T[0][2] * p.z + T[0][3] ; + result.y = T[1][0] * p.x + T[1][1] * p.y + T[1][2] * p.z + T[1][3] ; + result.z = T[2][0] * p.x + T[2][1] * p.y + T[2][2] * p.z + T[2][3] ; + if ( m_perspective ) { + double w = T[3][0] * p.x + T[3][1] * p.y + T[3][2] * p.z + T[3][3] ; + result.x /= w; + result.y /= w; + result.z /= w; + } + return result; + } + +//-------------------------------------------------------------// + +QSPt3f QSProjection3D::canvas3ToWorld3D( const QSPt3f &p ) const +// very slow - inverts matrix each time is called + { + Matrix T1; + inv( T1, T ); + return worldTransformation(T1,p); + } + diff --git a/kmatplot/widgets/qsprojection3d.h b/kmatplot/widgets/qsprojection3d.h new file mode 100644 index 0000000..ebee872 --- /dev/null +++ b/kmatplot/widgets/qsprojection3d.h @@ -0,0 +1,206 @@ +/*************************************************************************** + qsprojection3d.h + ------------------- + begin : 01-January-2000 + copyright : (C) 2000 by Kamil Dobkowski + email : kamildobk@poczta.onet.pl + ***************************************************************************/ + +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + +#ifndef QSPROJECTION3D_H +#define QSPROJECTION3D_H + +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + + +#include"qsprojection.h" + +/** + * \brief Implementation of QSProjection for use in QSAxes3D + * @author Kamil Dobkowski + */ +class QSProjection3D : public QSProjection { + + public: + + typedef double Matrix[4][4]; + /** + * The modelview matrix;. + * + */ + Matrix M; + /** + * The projection matrix. + */ + Matrix P; + /** + * The transformation matrix. + * t = @ref QSProjection3D::S * @ref QSProjection3D::P * @ref QSProjection3D::M . + */ + Matrix T; + /** + * The light vector. + */ + QSPt3f lvector; + /** + * The direction vector. Valid only if a perspective is off. + * ( world coordinates ) + */ + QSPt3f dvector; + /** + * Eye ( focuspoint ) position in world coordinates. Valid only + * if perspective is on. + */ + QSPt3f eye; + /** + * Box minimum ( box + wall thickness ) in world coordinates. + * + */ + QSPt3f bmin; + /** + * Box maximum ( box + wall thickness ) in world coordinates. + */ + QSPt3f bmax; + /** + * constructor. + */ + QSProjection3D(); + /** + * destuctor. + */ + virtual ~QSProjection3D(); + static void matrix_to_stdout( const Matrix& m ); + /** + * Makes 'matrix' the unity matrix. + */ + static void matrixI( Matrix m ); + /** + * Matrix multiplication : 'A = B*A' + */ + static void multiply( Matrix A, const Matrix B ); + /** + * Calculates inversion of the given matrix. + */ + static void inv( Matrix result, const Matrix m ); + /** + * Copies the given matrix : 'dst = src' . + */ + static void copy( Matrix dst, const Matrix src ); + /** + * Shift ( translate ). + */ + static void applyT( Matrix m, double dx, double dy, double dz ); + /** + * Scale . + */ + static void applyS( Matrix m, double sx, double sy, double sz ); + /** + * Rotation. + */ + static void applyR( Matrix m, double alfay, double alfax, double alfaz = 0.0 ); + /** + * Apply an othogonal projection. + */ + static void ortho( Matrix m, double l, double r, double b, double t, double n, double f ); + /** + * Apply a perspective projection. + */ + static void frustum( Matrix m, double l, double r, double b, double t, double n, double f ); + /** + * Apply a viewport transformation. + */ + static void applyViewport( Matrix m, double x, double y, double w, double h, double n = 0.0, double f = 1.0 ); + /** + * Applies any transformation, given in 'T' to 'p'. + */ + static QSPt3f worldTransformation( const Matrix T, const QSPt3f &p ); + + + void setProjection( double l, double r, double b, double t, double n, double f, bool perspective ); + void getProjection( double *l, double *r, double *b, double *t, double *n, double *f, bool *perspective ) const; + void setViewport( double x, double y, double w, double h, double n = 0.0, double f = 0.0 ); + void getViewport( double *x, double *y, double *w, double *h, double *n, double *f ) const; + /** + * Fit the [(0,0,0) (1,1,1)] cube to the screen area. + * As result makes changes to @ref QSProjection3D::S matrix. + * @see QSProjection3D::M + * @see QSProjection3D::P + */ + void fit( Matrix& S ); + /** + * @see QSProjection3D::T + */ + virtual QSPt2f middle() const; + /** + * Returns a point from [(0, 0, 0) ( 1, 1, 1 )] cube, which has the greatest + * z coordinate and all its three neighbourng walls are visible. + * @see QSProjection3D::T + */ + virtual QSPt3f furthest() const; + /** + * Returns a point opposite to @ref QSProjection3D::furthest . + */ + QSPt3f nearest() const; + /** + * Returns a point which lies at the left to the @ref QSProjection3D::furthest on the screen . + */ + QSPt3f left() const; + /** + * Returns an opposite point to @ref QSProjection3D::left . + */ + QSPt3f right() const; + /** + * Reimplemented. Maps the point to the screen coordinates. + */ + virtual QSPt2f world2DToCanvas( const QSPt2f& p ) const; + /** + * Reimplemented. Maps the point to the screen coordinates. + */ + virtual QSPt3f world2DToCanvas3( const QSPt2f& p ) const; + /** + * Reimplemented. Maps the point to the screen coordinates. + */ + virtual QSPt2f world3DToCanvas( const QSPt3f& p ) const; + /** + * Reimplemented. Maps the point to the screen coordinates. + */ + virtual QSPt3f world3DToCanvas3( const QSPt3f& p ) const; + /** + * Reimplemented. Maps the point to the screen coordinates. + */ + virtual QSPt3f canvas3ToWorld3D( const QSPt3f &p ) const; + + private: + + bool m_perspective; + + double m_proj[6]; + double m_view[6]; + + static void ludcmp( Matrix a, int indx[4], double *d ); + static void lubksb( Matrix a, int indx[4], double b[] ); + + + }; + +#endif + + + + + + + + + + diff --git a/kmatplot/widgets/qsruler.cpp b/kmatplot/widgets/qsruler.cpp new file mode 100644 index 0000000..a7465e3 --- /dev/null +++ b/kmatplot/widgets/qsruler.cpp @@ -0,0 +1,479 @@ +/* + * Copyright (C) 2000-2001 theKompany.com & Dave Marotti + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ +#include "qsruler.h" +#include <stdlib.h> +#include <math.h> + +//------------------------------------------------------------// + +/* + * Functions for converting + * Point <-> Inch <-> Millimeter<-> Pica <-> Centimetre <-> Didot <-> Cicero + * 1 Inch = 72 pt = 6 pica = 25.4 mm = 67.54151050 dd = 5.628459208 cc + */ + +float cvtPtToMm(float value) +{ + return 25.4 * value / 72.0; +} + //------------------------------------------------------------// +float cvtPtToCm(float value) +{ + return 2.54 * value / 72.0; +} +//------------------------------------------------------------// +float cvtPtToPica(float value) +{ + return value / 12.0; +} + //------------------------------------------------------------// +float cvtPicaToPt(float value) +{ + return value * 12.0; +} +//------------------------------------------------------------// +float cvtPtToInch(float value) +{ + return value / 72.0; +} +//------------------------------------------------------------// + +float cvtPtToDidot(float value) +{ + return value * 1238.0 / 1157.0; // 1157 dd = 1238 pt +} + +//------------------------------------------------------------// + +float cvtPtToCicero(float value) +{ + return value * 1238.0 / (1157.0 * 12.0); // 1 cc = 12 dd +} + +//------------------------------------------------------------// + +float cvtInchToPt(float value) +{ + return value * 72.0; +} + +//------------------------------------------------------------// + +float cvtMmToPt(float value) +{ + return value / 25.4 * 72.0; +} + + //------------------------------------------------------------// + +float cvtCmToPt(float value) +{ + return value / 2.54 * 72.0; +} + +//------------------------------------------------------------// + +float cvtDidotToPt(float value) +{ + return value * 1157.0 / 1238.0; +} + +//------------------------------------------------------------// + +float cvtCiceroToPt(float value) +{ + return value * (1157.0 * 12.0) / 1238.0; +} + +//------------------------------------------------------------// + +float cvtPtToUnit(int unit, float value) +{ + switch (unit) { + case UnitMillimeter: + return cvtPtToMm (value); + break; + case UnitPica: + return cvtPtToPica (value); + break; + case UnitInch: + return cvtPtToInch (value); + break; + case UnitCentimeter: + return cvtPtToCm (value); + break; + case UnitDidot: + return cvtPtToDidot (value); + break; + case UnitCicero: + return cvtPtToCicero (value); + break; + default: + return value; + } +} + +//------------------------------------------------------------// + +float cvtUnitToPt(int unit, float value) +{ + switch (unit) { + case UnitMillimeter: + return cvtMmToPt (value); + break; + case UnitInch: + return cvtInchToPt (value); + break; + case UnitCentimeter: + return cvtCmToPt (value); + break; + case UnitDidot: + return cvtDidotToPt (value); + break; + case UnitPica: + return cvtPicaToPt (value); + break; + case UnitCicero: + return cvtCiceroToPt (value); + break; + default: + return value; + } +} + +//------------------------------------------------------------// + +#define MARKER_WIDTH 1 +#define MARKER_HEIGHT 20 + +#define RULER_SIZE 20 + +QSRuler::QSRuler(Orientation o, QWidget *parent, const char *name) +: QFrame(parent, name, WRepaintNoErase | WResizeNoErase ) +{ + setBackgroundMode(NoBackground); + setFrameStyle(Box | Sunken/*Raised*/); + setLineWidth(1); + setMidLineWidth(0); + orientation = o; + munit = UnitPoint; + m_pZoom = 1.0; + firstVisible = 0; + buffer = 0L; + currentPosition = -1; + + if (orientation == Horizontal) { + setFixedHeight(RULER_SIZE); + initMarker(MARKER_WIDTH, MARKER_HEIGHT); + } else { + setFixedWidth(RULER_SIZE); + initMarker(MARKER_HEIGHT, MARKER_WIDTH); + } + + const char* nums[] = { + "70 7 2 1", + " c Black", + "X c None", + "XX XXXXXX XXXX XXXX XXXXXX XXX XXXX XXX XXX XXXX XX", + "X XXX XXXX XXX XXX XX XXX XXXX XXX XXXXXXX XXXXXXXXX XX XXX XX XXX X", + "X XXX XXXXX XXXXXXX XXXXXX XXX X XXX XXXXXX XXXXXXXXX XXX XXX XX XXX X", + "X XXX XXXXX XXXXX XXXXX XXX XX XXX XXX XXXXXX XXXX XXXX X", + "X XXX XXXXX XXXX XXXXXXXXX XX XXXXXX XX XXX XXXX XXXX XXX XXXXXX X", + "X XXX XXXXX XXX XXXXXX XXX XXXXX XXXXXXX XX XXX XXXX XXXX XXX XXXXX XX", + "XX XXXXXX XXX XXX XXXXXX XXX XXXX XXXXX XXXXX XXXX XXX" + }; + m_pNums = new QPixmap(nums); +} + +QSRuler::~QSRuler() +{ + if (buffer) + delete buffer; + + delete marker; + delete m_pNums; +} + +void QSRuler::initMarker(int w, int h) +{ + QPainter p; + marker = new QPixmap(w,h); + p.begin(marker); + p.setPen(blue); + p.eraseRect(0, 0, w, h); + p.drawLine(0,0,w-1,h-1); + p.end(); +} + +void QSRuler::recalculateSize(QResizeEvent*) +{ + if (buffer) { + delete buffer; + buffer = 0L; + } + + int w, h; + + if (orientation == Horizontal) { + w = width(); + h = RULER_SIZE; + } else { + w = RULER_SIZE; + h = height(); + } + buffer = new QPixmap(w, h); + drawQSRuler(); + updatePointer(currentPosition,currentPosition); +} + +int QSRuler::unit() +{ + return munit; +} + +void QSRuler::setUnit(int u) +{ + munit = u; + drawQSRuler(); + updatePointer(currentPosition,currentPosition); + repaint(); +} + +void QSRuler::setZoom(float zoom) +{ + if ( m_pZoom != zoom ) { + m_pZoom = zoom; + recalculateSize(0L); + //drawQSRuler(); + update(); + //updatePointer(currentPosition, currentPosition); + //repaint(); + } +} + +void QSRuler::updatePointer(int x, int y ) +{ + if (! buffer) + return; + + if (orientation == Horizontal) { + if (currentPosition != -1) { + repaint(QRect(currentPosition, 1, MARKER_WIDTH, MARKER_HEIGHT)); + } + if (x != -1) { + bitBlt(this, x, 1, marker, 0, 0, MARKER_WIDTH, MARKER_HEIGHT); + currentPosition = x; + } + } else { + if (currentPosition != -1) { + repaint(QRect (1, currentPosition, MARKER_HEIGHT, MARKER_WIDTH)); + } + if (y != -1) { + bitBlt(this, 1, y, marker, 0, 0, MARKER_HEIGHT, MARKER_WIDTH); + currentPosition = y; + } + } +} + +void QSRuler::updateVisibleArea( int xpos, int ypos ) +{ + if (orientation == Horizontal && firstVisible != xpos ) { + firstVisible = xpos; + drawQSRuler(); + //repaint(); + update(); + } + else + if (orientation == Vertical && firstVisible != ypos ) { + firstVisible = ypos; + drawQSRuler(); + update(); //repaint(); + } +} + +void QSRuler::paintEvent( QPaintEvent* e ) +{ + if (!buffer) + return; + + const QRect& rect = e->rect(); + + if (orientation == Horizontal) { + bitBlt(this, rect.topLeft(), buffer, rect); + } else { + bitBlt(this, rect.topLeft(), buffer, rect); + } + + QFrame::paintEvent(e); +} + +void QSRuler::drawQSRuler() +{ + QPainter p; + QString buf; + + int st1 = 0; + int st2 = 0; + int st3 = 0; + int st4 = 0; + int stt = 0; + + if (!buffer) + return; + + p.begin(buffer); + p.setPen(QColor(0x70,0x70,0x70)); + p.setBackgroundColor(colorGroup().background()); + p.eraseRect(0, 0, buffer->width(), buffer->height()); + + switch (munit) { + case UnitPoint: + case UnitMillimeter: + case UnitDidot: + case UnitCicero: + st1 = 1; + st2 = 5; + st3 = 10; + st4 = 25; + stt = 5; + break; + case UnitCentimeter: + case UnitPica: + case UnitInch: + st1 = 1; + st2 = 2; + st3 = 5; + st4 = 10; + stt = 1; + break; + default: + break; + } + + if (orientation == Horizontal) { + int pos = 0; + bool s1 = cvtUnitToPt(munit,st1)*m_pZoom > 3.0; + bool s2 = cvtUnitToPt(munit,st2)*m_pZoom > 3.0; + bool s3 = cvtUnitToPt(munit,st3)*m_pZoom > 3.0; + bool s4 = cvtUnitToPt(munit,st4)*m_pZoom > 3.0; + + float cx = cvtPtToUnit(munit,7*4)/m_pZoom; + int step = ((int)(cx/(float)stt)+1)*stt; + int start = (int)(cvtPtToUnit(munit,firstVisible)/m_pZoom); + + do { + pos = (int)(cvtUnitToPt(munit,start)*m_pZoom - firstVisible); + + if ( !s3 && s4 && start % st4 == 0 ) + p.drawLine(pos,RULER_SIZE-9,pos,RULER_SIZE); + + if ( s3 && start % st3 == 0 ) + p.drawLine(pos,RULER_SIZE-9,pos,RULER_SIZE); + + if ( s2 && start % st2 == 0 ) + p.drawLine(pos,RULER_SIZE-7,pos,RULER_SIZE); + + if ( s1 && start % st1 == 0 ) + p.drawLine(pos,RULER_SIZE-5,pos,RULER_SIZE); + + if ( start % step == 0 ) { + buf.setNum(abs(start)); + drawNums(&p,pos,4,buf,true); + } + + start++; + } while (pos < buffer->width()); + + } else { + int pos = 0; + bool s1 = cvtUnitToPt(munit,st1)*m_pZoom > 3.0; + bool s2 = cvtUnitToPt(munit,st2)*m_pZoom > 3.0; + bool s3 = cvtUnitToPt(munit,st3)*m_pZoom > 3.0; + bool s4 = cvtUnitToPt(munit,st4)*m_pZoom > 3.0; + + float cx = cvtPtToUnit(munit,8*4)/m_pZoom; + int step = ((int)(cx/(float)stt)+1)*stt; + int start = (int)(cvtPtToUnit(munit,firstVisible)/m_pZoom); + + do { + pos = (int)(cvtUnitToPt(munit,start)*m_pZoom - firstVisible); + + if ( !s3 && s4 && start % st4 == 0 ) + p.drawLine(RULER_SIZE-9,pos,RULER_SIZE,pos); + + if ( s3 && start % st3 == 0 ) + p.drawLine(RULER_SIZE-9,pos,RULER_SIZE,pos); + + if ( s2 && start % st2 == 0 ) + p.drawLine(RULER_SIZE-7,pos,RULER_SIZE,pos); + + if ( s1 && start % st1 == 0 ) + p.drawLine(RULER_SIZE-5,pos,RULER_SIZE,pos); + + if ( start % step == 0 ) { + buf.setNum(abs(start)); + drawNums(&p,4,pos,buf,false); + } + + start++; + } while (pos < buffer->height()); + } + p.end(); +} + +void QSRuler::resizeEvent(QResizeEvent* e) +{ + recalculateSize(e); +} + +void QSRuler::show() +{ + if (orientation == Horizontal) { + setFixedHeight(RULER_SIZE); + initMarker(MARKER_WIDTH,MARKER_HEIGHT); + } else { + setFixedWidth(RULER_SIZE); + initMarker(MARKER_HEIGHT,MARKER_WIDTH); + } + QWidget::show(); +} + +void QSRuler::hide() +{ + if (orientation == Horizontal) + setFixedHeight(1); + else + setFixedWidth(1); +} + +void QSRuler::drawNums(QPainter* p, int x, int y, QString& num, bool orientationHoriz) +{ + if (orientationHoriz) + x -= 7; + else + y -= 8; + + for ( uint k = 0; k < num.length(); k++ ) { + int st = num.at(k).digitValue()*7; + p->drawPixmap(x,y,*m_pNums,st,0,7,7); + if (orientationHoriz) + x += 7; + else + y += 8; + } +} diff --git a/kmatplot/widgets/qsruler.h b/kmatplot/widgets/qsruler.h new file mode 100644 index 0000000..f2237a8 --- /dev/null +++ b/kmatplot/widgets/qsruler.h @@ -0,0 +1,72 @@ +/* + * Copyright (C) 2000-2001 theKompany.com & Dave Marotti + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ +#ifndef QSRULER_H +#define QSRULER_H + +#include <qframe.h> +#include <qpainter.h> +#include <qpixmap.h> + +enum MeasurementUnit { + UnitPoint, UnitMillimeter, UnitInch, UnitPica, UnitCentimeter, + UnitDidot, UnitCicero +}; + +class QSRuler : public QFrame +{ + Q_OBJECT +public: + enum Orientation { Horizontal, Vertical }; + + QSRuler(Orientation, QWidget* parent=0, const char* name=0); + ~QSRuler(); + + int unit(); + +public slots: + void setZoom(float); + void updatePointer(int x, int y); + void updateVisibleArea(int xpos, int ypos); + + void setUnit(int); + + void hide(); + void show(); + +protected: + void paintEvent(QPaintEvent*); + void resizeEvent(QResizeEvent*); + + void recalculateSize(QResizeEvent*); + void drawQSRuler(); + + void initMarker(int w, int h); + void drawNums(QPainter*, int x, int y, QString& num, bool orientationHoriz); + +private: + float m_pZoom; + int munit; + Orientation orientation; + QPixmap *buffer; + int firstVisible; + int currentPosition; + QPixmap* marker; + QPixmap* m_pNums; +}; + +#endif diff --git a/kmatplot/widgets/qssegment.cpp b/kmatplot/widgets/qssegment.cpp new file mode 100644 index 0000000..eed195e --- /dev/null +++ b/kmatplot/widgets/qssegment.cpp @@ -0,0 +1,432 @@ +/*************************************************************************** + QSSegment.cpp + ------------------- + begin : 01-January-2000 + copyright : (C) 2000 by Kamil Dobkowski + email : kamildobk@poczta.onet.pl + ***************************************************************************/ + +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + + +#include "qssegment.h" +#include "qsdrv.h" +#include "qscurve.h" +#include "qsaxes.h" +#include <assert.h> + +QSSegment::QSSegment() + { + } + +//------------------------------------------------------------// + +QSSegment::~QSSegment() + { + } + +//------------------------------------------------------------// + +int QSSegment::startDraw( const QSCurve *parent ) + { + m_parent = parent; + m_drv = m_parent->parentAxes()->run_gDriver(); + return 0; + } + +//------------------------------------------------------------// + +void QSSegment::initPass( int ) + { + } + + + + +//------------------------------------------------------------// +//------------------------------------------------------------// +// LINES +//------------------------------------------------------------// + +QSSLines::QSSLines() + { + } + +//------------------------------------------------------------// + +QSSLines::~QSSLines() + { + } + +//------------------------------------------------------------// + +int QSSLines::startDraw( const QSCurve *parent ) + { + QSSegment::startDraw( parent ); + return 1; + } + +//------------------------------------------------------------// + +void QSSLines::initPass( int ) + { + } + +//------------------------------------------------------------// + +void QSSLines::drawSegment( int nr, const QSPt2f& pos, const QSPt2f&, const QSGLine& l, const QSGFill&, const QSGArrow&, const QSGArrow& ) +// dorobic strzalki i xmin i xmax + { + QSPt2f curr = m_parent->dataToWorld( pos ); + m_drv->setLine( m_curr_line ); m_curr_line = l; + if ( nr == 0 ) m_drv->beginPolyline2(curr); + else m_drv->drawPolylineTo2(curr); + } + +//------------------------------------------------------------// + +void QSSLines::endPass() + { + m_drv->endPolyline2(); + } + +//------------------------------------------------------------// + +void QSSLines::stopDraw() + { + } + + +//------------------------------------------------------------// +// BARS +//------------------------------------------------------------// + +QSSBars::QSSBars() + { + } + +//------------------------------------------------------------// + +QSSBars::~QSSBars() + { + } + +//------------------------------------------------------------// + +int QSSBars::startDraw( const QSCurve *parent ) + { + assert( parent ); + QSSegment::startDraw( parent ); + m_zero_level = m_parent->dataToWorld( m_parent->zeroPoint() ).y; + return 1; + } + +//------------------------------------------------------------// + +void QSSBars::initPass( int ) + { + } + +//------------------------------------------------------------// + +void QSSBars::drawSegment( int nr, const QSPt2f& pos, const QSPt2f&, const QSGLine& l, const QSGFill& f, const QSGArrow&, const QSGArrow& ) + { + m_drv->setLine( m_curr_line ); + m_drv->setFill( m_curr_fill ); + m_curr_line = l; + m_curr_fill = f; + draw_bar( nr, m_parent->dataToWorld(pos) ); + } + +//------------------------------------------------------------// + +void QSSBars::endPass() + { + draw_bar( 2, QSPt2f(m_prev.x+2.0*(m_prev.x-m_prevx),0.0) ); + } + +//------------------------------------------------------------// + +void QSSBars::draw_bar( int nr, const QSPt2f& pos ) + { + double currx = 0.0; + if ( nr ) { + currx = (pos.x-m_prev.x)/2.0 + m_prev.x; + if ( nr == 1 ) m_prevx = m_prev.x - (pos.x-m_prev.x)/2.0; + QSPt2f inpts[4]; + inpts[0].set( m_prevx, m_zero_level ); + inpts[1].set( currx, m_zero_level ); + inpts[2].set( currx, m_prev.y ); + inpts[3].set( m_prevx, m_prev.y ); + m_drv->drawPoly2( inpts, 4 ); + } + + m_prevx = currx; + m_prev = pos; + } + +//------------------------------------------------------------// + +void QSSBars::stopDraw() + { + } + +//------------------------------------------------------------// +// VECTORS +//------------------------------------------------------------// + +QSSFigures::QSSFigures( Style style ) + { + m_style = style; + } + +//------------------------------------------------------------// + +QSSFigures::~QSSFigures() + { + } + +//------------------------------------------------------------// + +int QSSFigures::startDraw( const QSCurve *parent ) + { + assert( parent ); + QSSegment::startDraw( parent ); + return 1; + } + +//------------------------------------------------------------// + +void QSSFigures::initPass( int ) + { + } + +//------------------------------------------------------------// + +void QSSFigures::drawSegment( int, const QSPt2f& pos, const QSPt2f& delta, const QSGLine& l, const QSGFill& f, const QSGArrow& a1, const QSGArrow& a2 ) + { + QSPt2f p1; + QSPt2f p2; + if ( m_style == Flux ) { + QSPt2f delta2 = QSPt2f( delta.x/2.0, delta.y/2.0 ); + p1 = m_parent->dataToWorld( pos-delta2 ); + p2 = m_parent->dataToWorld( pos+delta2 ); + } else { + p1 = m_parent->dataToWorld( pos ); + p2 = m_parent->dataToWorld( pos+delta ); + } + + m_drv->setLine( l ); + if ( m_style == Vectors || m_style == Flux ) { + m_drv->drawArrow2( p1, p2, a1, a2 ); + } + else if ( m_style == Ellipses ) { + m_drv->setFill( f ); + m_drv->drawEllipse2( p1, p2 ); + } + else if ( m_style == Rectangles ) { + m_drv->setFill( f ); + m_drv->drawRect2( p1, p2 ); + } + + } + +//------------------------------------------------------------// + +void QSSFigures::endPass() + { + } + +//------------------------------------------------------------// + +void QSSFigures::stopDraw() + { + } + + +//------------------------------------------------------------// +// Polys +//------------------------------------------------------------// + +QSSPolys::QSSPolys( Style style ) + { + m_style = style; + } + +//------------------------------------------------------------// + +QSSPolys::~QSSPolys() + { + } + +//------------------------------------------------------------// + +int QSSPolys::startDraw( const QSCurve *parent ) + { + assert( parent ); + QSSegment::startDraw( parent ); + m_zero_level = m_parent->dataToWorld( m_parent->zeroPoint() ).y; + return ( m_style == Ribbon ? 3 : 2 ); + } + +//------------------------------------------------------------// + +void QSSPolys::initPass( int init_pass ) + { + m_pass = init_pass; + } + +//------------------------------------------------------------// + +void QSSPolys::drawSegment( int nr, const QSPt2f& pos, const QSPt2f& delta, const QSGLine& l, const QSGFill& f, const QSGArrow&, const QSGArrow& ) + { + QSPt2f p1; + QSPt2f p2; + if ( m_style == Ribbon ) { + p1 = m_parent->dataToWorld( pos-delta ); + p2 = m_parent->dataToWorld( pos+delta ); + } else { + p1 = m_parent->dataToWorld( pos ); + p2 = QSPt2f( p1.x, m_zero_level ); + } + + // first draw filled area + if ( m_pass==0 && nr ) { + QSPt2f inpts[4]; + inpts[0] = m_prev1; + inpts[1] = m_prev2; + inpts[2] = p2; + inpts[3] = p1; + m_drv->setLine(QSGLine::invisibleLine); + m_drv->setFill( m_curr_fill ); + m_drv->drawPoly2( inpts, 4 ); + } + // draw upper or lower line + else if ( m_pass != 0 ) { + QSPt2f pos1; + QSPt2f pos2; + if ( m_pass == 1 ) { pos1 = m_prev1; pos2 = p1; } + if ( m_pass == 2 ) { pos1 = m_prev2; pos2 = p2; } + m_drv->setLine( m_curr_line ); + if ( nr == 0 ) m_drv->beginPolyline2( pos2 ); + else m_drv->drawPolylineTo2( pos2 ); + } + m_curr_fill = f; + m_curr_line = l; + m_prev1 = p1; + m_prev2 = p2; + } + +//------------------------------------------------------------// + +void QSSPolys::endPass() + { + if ( m_pass == 1 || m_pass == 2 ) m_drv->endPolyline2(); + } + +//------------------------------------------------------------// + +void QSSPolys::stopDraw() + { + } + +//------------------------------------------------------------// +//------------------------------------------------------------// +// STAIRS +//------------------------------------------------------------// + +QSSStairs::QSSStairs( Style style ) + { + m_style = style; + } + +//------------------------------------------------------------// + +QSSStairs::~QSSStairs() + { + } + +//------------------------------------------------------------// + +int QSSStairs::startDraw( const QSCurve *parent ) + { + assert( parent ); + QSSegment::startDraw( parent ); + return 1; + } + +//------------------------------------------------------------// + +void QSSStairs::initPass( int ) + { + } + +//------------------------------------------------------------// + +void QSSStairs::drawSegment( int nr, const QSPt2f& pos, const QSPt2f&, const QSGLine& l, const QSGFill&, const QSGArrow&, const QSGArrow& ) + { + QSPt2f pts[3]; + QSPt2f curr = m_parent->dataToWorld( pos ); + if ( nr == 0 ) { + m_prev_prev = m_prev = curr; + m_drv->beginPolyline2( curr ); + } else { + get_stair( curr, pts ); + m_drv->setLine( curr_line ); + m_drv->drawPolylineTo2( pts[1] ); + m_drv->drawPolylineTo2( pts[2] ); + } + + curr_line = l; + m_prev_prev = m_prev; + m_prev = curr; + } + +//------------------------------------------------------------// + +void QSSStairs::endPass() + { + QSPt2f pts[3]; + m_drv->setLine( curr_line ); + get_stair( m_prev, pts ); + m_drv->drawPolylineTo2( pts[1] ); + m_drv->endPolyline2(); + } + +//------------------------------------------------------------// + +void QSSStairs::get_stair( const QSPt2f& pos, QSPt2f pts[3] ) + { + switch( m_style ) { + case Left: + pts[0] = m_prev; + pts[1] = QSPt2f( m_prev.x, pos.y ); + pts[2] = pos; + break; + case Middle: + pts[0] = QSPt2f( m_prev_prev.x + (m_prev.x-m_prev_prev.x)/2.0, m_prev.y ); + pts[1] = QSPt2f( m_prev.x + (pos.x-m_prev.x)/2.0, m_prev.y ); + pts[2] = QSPt2f( m_prev.x + (pos.x-m_prev.x)/2.0, pos.y ); + break; + case Right: + pts[0] = m_prev; + pts[1] = QSPt2f( pos.x, m_prev.y ); + pts[2] = pos; + break; + } + } + +//------------------------------------------------------------// + +void QSSStairs::stopDraw() + { + } + + diff --git a/kmatplot/widgets/qssegment.h b/kmatplot/widgets/qssegment.h new file mode 100644 index 0000000..c7b63d7 --- /dev/null +++ b/kmatplot/widgets/qssegment.h @@ -0,0 +1,219 @@ +/*************************************************************************** + QSSegment.h + ------------------- + begin : 01-January-2000 + copyright : (C) 2000 by Kamil Dobkowski + email : kamildobk@poczta.onet.pl + ***************************************************************************/ + +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + + +#ifndef QSSEGMENT_H +#define QSSEGMENT_H + +#include"qscoord.h" +#include"qsgattr.h" +#include"qsmatrix.h" + +class QSDrv; +class QSCurve; +class QSAxes; + +/** + * \brief Defines an appearance of QSCurve Base class + * + * Draws a single element of QSCurve. It can be reimplemented to draw Bars, Vectors, etc, see QSCurve::setPObject. + * startDrawing() is always called before the drawing begins, endDrawing() is called after drawing is finished. + * When drawing initPass() is called and next drawSegment() method is called for each datapoint, finally + * endPass() in invoked and this operation is repeated a few times ( as requested by startDraw() return value ).. + * @author Kamil Dobkowski + */ +class QSSegment { + + public: + /** + * Constructor. + */ + QSSegment(); + /** + * Destructor + */ + virtual ~QSSegment(); + /** + * Returns the requested number of passes. + */ + virtual int startDraw( const QSCurve * ); + /** + * Inits pass + */ + virtual void initPass( int pass ); + /** + * Draws a single point of the data + */ + virtual void drawSegment( int nr, const QSPt2f& point, const QSPt2f& delta, const QSGLine& l, const QSGFill& f, const QSGArrow& a1, const QSGArrow& a2 ) = 0; + /** + * Ends pass + */ + virtual void endPass() {} + /** + * Ends drawing + */ + virtual void stopDraw() {} + + protected: + QSDrv *m_drv; + const QSCurve *m_parent; + }; + +//-------------------------------------------------------------// + +/** + * \brief Defines an appearance of QSCurve. Draws an ordinary curve + * + * @author Kamil Dobkowski + */ +class QSSLines : public QSSegment { + + public: + + QSSLines(); + virtual ~QSSLines(); + virtual int startDraw( const QSCurve *parent ); + virtual void initPass( int pass ); + virtual void drawSegment( int nr, const QSPt2f& point, const QSPt2f& delta, const QSGLine& l, const QSGFill& f, const QSGArrow& a1, const QSGArrow& a2 ); + virtual void endPass(); + virtual void stopDraw(); + + private: + + QSGLine m_curr_line; +}; + +//-------------------------------------------------------------// + +/** + * \brief Defines an appearance of QSCurve. Draws area plots and ribbons + * @author Kamil Dobkowski + */ +class QSSPolys : public QSSegment { + + public: + + enum Style { Area = 0, Ribbon = 1 }; + + QSSPolys( Style style ); + virtual ~QSSPolys(); + virtual int startDraw( const QSCurve *parent ); + virtual void initPass( int pass ); + virtual void drawSegment( int nr, const QSPt2f& point, const QSPt2f& delta, const QSGLine& l, const QSGFill& f, const QSGArrow& a1, const QSGArrow& a2 ); + virtual void endPass(); + virtual void stopDraw(); + + private: + + Style m_style; + double m_zero_level; + QSPt2f m_prev1; + QSPt2f m_prev2; + int m_pass; + QSGLine m_curr_line; + QSGFill m_curr_fill; +}; + +//-------------------------------------------------------------// + +/** + * \brief Defines an appearance of QSCurve. Draws simpl bars. + * @author Kamil Dobkowski + */ +class QSSBars : public QSSegment { + + public: + + QSSBars(); + virtual ~QSSBars(); + virtual int startDraw( const QSCurve *parent ); + virtual void initPass( int pass ); + virtual void drawSegment( int nr, const QSPt2f& point, const QSPt2f& delta, const QSGLine& l, const QSGFill& f, const QSGArrow& a1, const QSGArrow& a2 ); + virtual void endPass(); + virtual void stopDraw(); + + private: + + double m_zero_level; + double m_prevx; + QSPt2f m_prev; + QSGLine m_curr_line; + QSGFill m_curr_fill; + void draw_bar( int nr, const QSPt2f& pos ); +}; + +//-------------------------------------------------------------// + +/** + * \brief Defines an appearance of QSCurve. Draws vectors, ellipses, rectangles, flux. + * @author Kamil Dobkowski + */ +class QSSFigures: public QSSegment { + + public: + + enum Style { Vectors = 0, Rectangles = 1, Ellipses = 2, Flux = 3 }; + + QSSFigures( Style style ); + virtual ~QSSFigures(); + virtual int startDraw( const QSCurve *parent ); + virtual void initPass( int pass ); + virtual void drawSegment( int nr, const QSPt2f& point, const QSPt2f& delta, const QSGLine& l, const QSGFill& f, const QSGArrow& a1, const QSGArrow& a2 ); + virtual void endPass(); + virtual void stopDraw(); + + private: + int m_style; + }; + +//-------------------------------------------------------------// + +/** + * \brief Defines an appearance of QSCurve. Draws stairs plots. + * @author Kamil Dobkowski + */ +class QSSStairs : public QSSegment { + + public: + + enum Style { Left, Middle, Right }; + + QSSStairs( Style style ); + virtual ~QSSStairs(); + virtual int startDraw( const QSCurve *parent ); + virtual void initPass( int pass ); + virtual void drawSegment( int nr, const QSPt2f& point, const QSPt2f& delta, const QSGLine& l, const QSGFill& f, const QSGArrow& a1, const QSGArrow& a2 ); + virtual void endPass(); + virtual void stopDraw(); + + private: + Style m_style; + QSPt2f m_prev; + QSPt2f m_prev_prev; + QSGLine curr_line; + void get_stair( const QSPt2f& pos, QSPt2f pos[3] ); +}; + +#endif + + + + + + + + diff --git a/kmatplot/widgets/qsserializable.cpp b/kmatplot/widgets/qsserializable.cpp new file mode 100644 index 0000000..0e92ff0 --- /dev/null +++ b/kmatplot/widgets/qsserializable.cpp @@ -0,0 +1,61 @@ +/*************************************************************************** + qsserializable.cpp - description + ------------------- + begin : Mon Oct 15 2001 + copyright : (C) 2001 by kamil + email : kamil@localhost.localdomain + ***************************************************************************/ + +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + +#include "qsserializable.h" + +//---------------------------------------------------------------------------------------------------// + +QSObjectFactory::QSObjectFactory() + { + m_flags = 0; + } + +//---------------------------------------------------------------------------------------------------// + +QSObjectFactory::~QSObjectFactory() + { + } + +//---------------------------------------------------------------------------------------------------// + +void QSObjectFactory::setFlags( int flags ) + { + m_flags = flags; + } + +//---------------------------------------------------------------------------------------------------// + +QSSerializable::QSSerializable() + { + } + +//---------------------------------------------------------------------------------------------------// + +QSSerializable::~QSSerializable() + { + } +//---------------------------------------------------------------------------------------------------// + +void QSSerializable::loadStateFromStream( QDataStream&, QSObjectFactory * ) + { + } + +//---------------------------------------------------------------------------------------------------// + +void QSSerializable::saveStateToStream( QDataStream&, QSObjectFactory * ) + { + } \ No newline at end of file diff --git a/kmatplot/widgets/qsserializable.h b/kmatplot/widgets/qsserializable.h new file mode 100644 index 0000000..3caba15 --- /dev/null +++ b/kmatplot/widgets/qsserializable.h @@ -0,0 +1,93 @@ +/*************************************************************************** + qsserializable.h + ------------------- + begin : Mon Oct 15 2001 + copyright : (C) 2001 by kamil + email : kamil@localhost.localdomain + ***************************************************************************/ + +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + +#ifndef QSSERIALIZABLE_H +#define QSSERIALIZABLE_H + +#include<qdatastream.h> + +class QObject; +class QSSerializable; +/** + * \brief Object that creates and saves serializable objects. + * @author Kamil Dobkowski + */ +class QSObjectFactory + { + public: + enum Flags { + CopyAllData = 1<<0 + }; + /** + * Constructor + */ + QSObjectFactory(); + /** + * Destructor + */ + virtual ~QSObjectFactory(); + /** + * Loads objects from a stream. It loads a type of object ( eg. class name ), creates it, and + * calls QSSerializable::loadStateFromStream() + */ + virtual QSSerializable *loadObjectFromStream( QDataStream& stream, QObject *parent=NULL ) = 0; + /** + * Save object to stream. It save a type of object ( eg. class name ) to the stream and calls + * QSSerializable::saveStateToStream(). + */ + virtual void saveObjectToStream( QSSerializable *object, QDataStream& stream ) = 0; + /** + * Sets flags + */ + void setFlags( int flags ); + /** + * Returns flags. + */ + int flags() const { return m_flags; } + + protected: + int m_flags; + }; + +//---------------------------------------------------------------------------------------------------// + +/** + *\brief Object which can load or save its state into a stream. + *@author Kamil Dobkowski + */ +class QSSerializable + { + public: + /** + * Constructor + */ + QSSerializable(); + /** + * Destructor + */ + virtual ~QSSerializable(); + /** + * Loads state from a stream. You can load child objects from the stream using QSObjectFactory::loadObjectFromStream() + */ + virtual void loadStateFromStream( QDataStream& stream, QSObjectFactory *factory ); + /** + * Saves state to a stream. You can save child objects to the stream using QSObjectFactory::saveObjectToStream() + */ + virtual void saveStateToStream( QDataStream& stream, QSObjectFactory *factory ); + }; + +#endif diff --git a/kmatplot/widgets/qssurface.cpp b/kmatplot/widgets/qssurface.cpp new file mode 100644 index 0000000..2898dde --- /dev/null +++ b/kmatplot/widgets/qssurface.cpp @@ -0,0 +1,834 @@ +/*************************************************************************** + qssurface.cpp + ------------------- + begin : 01-January-2000 + + copyright : (C) 2000 by Kamil Dobkowski + email : kamildobk@poczta.onet.pl + ***************************************************************************/ + +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + +#include<stdio.h> +#include<math.h> +#include<assert.h> +#include<qapplication.h> +#include"qssurface.h" +#include"qsdrv.h" + +/* + We don't use sorting do use painter algorithm to hide invisible surfaces but rather + divide surface into four quarters. Let's look at our surface from the top: + + X or i or cols + --> <-- + +------+------+ | + | | | | + | | 0 1 | \/ + \/ | M | + + + + Y or j or rows + ^ | | ^ + | | 2 3 | | + | | | | + +------+------+ + --> <-- + + 0,1,2,3 - d->quarter.number + --> ... d->quatrer.di, quarter.dj ( drawing direction ) + M - quarter.middle + + Notice that all four quarters are nessesary only when perspective is on. In other + cases only quarter 0 is drawn ( it covers the whole surface ). +*/ + +struct QSSurface::surface_runtime_data { + QSPt2 middle; + QSPt2 min; + QSPt2 max; + QSPt2 delta; + + struct quarter_t { + bool empty; + int number; + int iMin, iMax; + int jMin, jMax; + int di, dj; + int ci, cj; + struct t_t { int p0, p1, p2; } t[2]; // standard way of dividing mesh into two triangles + } quarter; + + int w; + int h; + int pi; + int pj; + QSAxis *xaxis; + QSAxis *yaxis; + QSAxis *zaxis; + QSAxis *vaxis; + + bool vnormals; + bool is_x_index; + bool is_y_index; + bool is_4d_data; + QSMatrix *x_vector; + QSMatrix *y_vector; + QSMatrix *z_data; + QSMatrix *v_data; + bool x_reversed; + bool y_reversed; + int x_grid_step; + int y_grid_step; + QSGPoint point_mark; + + /* increased col should have increased value in world coordinates. + It is important when you want to preserve clockwise direction + of all polygons */ + inline int col_norm( int col ) { return x_reversed ? w-1-col : col; } + inline int row_norm( int row ) { return y_reversed ? h-1-row : row; } + + double xworld( int col ) { return xaxis->dataToWorld( xvector(col_norm(col)) ); } + double yworld( int row ) { return yaxis->dataToWorld( yvector(row_norm(row)) ); } + inline double zworld( int row, int col ) { return zaxis->dataToWorld( zdata(col_norm(col),row_norm(row)) ); } + inline double vworld( int row, int col ) { return vaxis->dataToWorld( vdata(col_norm(col),row_norm(row)) ); } + + double xvector( int col ) { return is_x_index ? x_vector->value(0,col) : col; } + double yvector( int row ) { return is_y_index ? y_vector->value(row,0) : row; } + inline double zdata( int row, int col ) { return z_data->value(row,col); } + inline double vdata( int row, int col ) { return v_data->value(row,col); } + + QSPt3f mesh_pts[4]; + QSPt3f mesh_norms[5]; + double mesh_values[4]; + bool mesh_edges[4]; + QSPt3f canvas_pts[4]; + + QSPt3f triangle_pts[3]; + QSPt3f triangle_norms[4]; + double triangle_values[3]; + bool triangle_edges[3]; +// QSPt3f *point_mark; + + int curr_row; + int curr_col_first; + int curr_col_last; + double *x_coords; + struct row_z_t { double *ptr; double y; int row; } row_z_buff[4]; + row_z_t *row_z[4]; + struct row_mn_t { QSPt3f *ptr; int row; } row_mn_buff[3]; + row_mn_t *row_mn[3]; + struct row_vn_t { QSPt3f *ptr; int row; } row_vn_buff[2]; + row_vn_t *row_vn[3]; + struct row_v_t { double *ptr; int row; } row_v_buff[2]; + row_v_t *row_v[3]; + + row_z_t *get_row_z( int row ); + row_v_t *get_row_v( int row ); + row_mn_t *get_row_mn( int row ); + row_vn_t *get_row_vn( int row ); + void invalidate_row_buffers(); + void set_current_row( int row, int first_col, int last_col ); + bool get_polygon( int row, int col, QSPt3f pts[4] ); + bool get_mesh( int col, QSPt3f pts[4], QSPt3f norms[5], double v[4] ); + }; + +//-------------------------------------------------------------// + +QSSurface::QSSurface(QSAxes* parent, const char * name) +:QSPlot3D(parent,name) + { + assert( parent ); + + m_minmax_z_valid = false; + m_minmax_v_valid = false; + m_min_z = 0.0; + m_max_z = 0.0; + m_min_v = 0.0; + m_max_v = 0.0; + m_x_grid_step = 1; + m_y_grid_step = 1; + m_title_str = tr("Untitled surface"); + + #define CHANNELS_NUM 4 + initChannelTable( CHANNELS_NUM ); + } + +//-------------------------------------------------------------// + +QSSurface::~QSSurface() + { + } + +//-------------------------------------------------------------// + +void QSSurface::setXGridStep( int step ) + { + SET_PROPERTY( m_x_grid_step, QMAX(1,step) ); + } + +//-------------------------------------------------------------// + +void QSSurface::setYGridStep( int step ) + { + SET_PROPERTY( m_y_grid_step, QMAX(1,step) ); + } + +//-------------------------------------------------------------// + +void QSSurface::dataChanged( int channel ) +// Ouu. We need to calculate new extremes in data +// Refresh data on screen also. + { + if ( channel == ZData || channel == -1 ) m_minmax_z_valid = false; + if ( channel == VData || channel == -1 ) m_minmax_v_valid = false; + QSPlot3D::dataChanged( channel ); + } + +//-------------------------------------------------------------// + +void QSSurface::allocRuntimeData() + { + QSPlot3D::allocRuntimeData(); + d = new surface_runtime_data(); + d->x_vector = matrix(XVector); + d->y_vector = matrix(YVector); + d->z_data = matrix(ZData); + d->v_data = matrix(VData); + d->xaxis = defaultAxis(QSAxis::XAxisType); + d->yaxis = defaultAxis(QSAxis::YAxisType); + d->zaxis = defaultAxis(QSAxis::ZAxisType); + d->vaxis = defaultAxis(QSAxis::VAxisType); + d->w = matrixCols( ZData ); + d->h = matrixRows( ZData ); + d->is_x_index = false; + d->is_y_index = false; + d->is_4d_data = false; + d->x_grid_step = xGridStep(); + d->y_grid_step = yGridStep(); + d->vnormals = ( m_cnormals == QSDrv::VertexNormals ); + if ( matrixCols(XVector) == d->w ) d->is_x_index = true; + if ( matrixRows(YVector) == d->h ) d->is_y_index = true; + if ( matrixRows(VData) == d->h && + matrixCols(VData) == d->w ) d->is_4d_data = true; + d->point_mark = m_settings.points[PointMark]; + + // zero in world coordinates not nessesary means zero index to data matrix... + // dataToWorld(xvector(0)) is 0 or 1 ? + d->x_reversed = false; + d->y_reversed = false; + if ( d->xaxis->reversed() ) d->x_reversed = !d->x_reversed; + if ( d->yaxis->reversed() ) d->y_reversed = !d->y_reversed; + if ( d->xvector(0) > d->xvector(d->w-1) ) d->x_reversed = !d->x_reversed; + if ( d->yvector(0) > d->yvector(d->h-1) ) d->y_reversed = !d->y_reversed; + + // x buffer + d->x_coords = new double[d->w]; + for( int i=0;i<d->w;i++) d->x_coords[i] = d->xworld(i); + + // row buffers + for ( int i=0; i<4; i++ ) { + d->row_z_buff[i].ptr = new double[d->w]; + d->row_z_buff[i].row = -1; + } + + for ( int i=0; i<3; i++ ) { + d->row_mn_buff[i].ptr = new QSPt3f[d->w]; + d->row_mn_buff[i].row = -1; + } + + for ( int i=0; i<2; i++ ) { + d->row_vn_buff[i].ptr = new QSPt3f[d->w]; + d->row_vn_buff[i].row = -1; + } + + for ( int i=0; i<2; i++ ) { + d->row_v_buff[i].ptr = new double[d->w]; + d->row_v_buff[i].row = -1; + } + } + +//-------------------------------------------------------------// + +void QSSurface::freeRuntimeData() + { + delete[] d->x_coords; + for( int i=0; i<4; i++ ) delete[] d->row_z_buff[i].ptr; + for( int i=0; i<3; i++ ) delete[] d->row_mn_buff[i].ptr; + for( int i=0; i<2; i++ ) delete[] d->row_vn_buff[i].ptr; + for( int i=0; i<2; i++ ) delete[] d->row_v_buff[i].ptr; + delete d; d=NULL; + QSPlot3D::freeRuntimeData(); + } + + //-------------------------------------------------------------// + //-------------------------------------------------------------// + //-------------------------------------------------------------// + +bool QSSurface::getAxisRange( QSAxis *axis, double& min, double& max ) + { + allocRuntimeData(); + if ( d->h == 0 || d->w == 0 ) { freeRuntimeData(); return false; } + + if ( !m_minmax_z_valid ) { + for ( int j=0;j<d->h;j++ ) { + for ( int i=0;i<d->w;i++ ) { + double z = d->zdata(j,i); + if ( i == 0 && j == 0 ) { + m_max_z = z; + m_min_z = z; + } else { + m_min_z = QMIN( m_min_z, z ); + m_max_z = QMAX( m_max_z, z ); + } + } + } + m_minmax_z_valid = true; + } + + if ( !m_minmax_v_valid && d->is_4d_data ) { + for ( int j=0;j<d->h;j++ ) { + for ( int i=0;i<d->w;i++ ) { + double v = d->vdata(j,i); + if ( i == 0 && j == 0 ) { + m_max_v = v; + m_min_v = v; + } else { + m_min_v = QMIN( m_min_v, v ); + m_max_v = QMAX( m_max_v, v ); + } + } + } + m_minmax_v_valid = true; + } + + double xmin = d->xvector(0); + double xmax = d->xvector(d->w-1); + double ymin = d->yvector(0); + double ymax = d->yvector(d->h-1); + if ( xmin > xmax ) { double xtemp = xmin; xmin = xmax; xmax = xtemp; } + if ( ymin > ymax ) { double ytemp = ymin; ymin = ymax; ymax = ytemp; } + + if ( axis == d->xaxis ) { min = xmin; max = xmax; } + else if ( axis == d->yaxis ) { min = ymin; max = ymax; } + else if ( axis == d->zaxis ) { min = m_min_z; max = m_max_z; } + else if ( axis == d->vaxis && !d->is_4d_data ) { min = m_min_z; max = m_max_z; } + else if ( axis == d->vaxis && d->is_4d_data ) { min = m_min_v; max = m_max_v; } + else { freeRuntimeData(); return false; } + + freeRuntimeData(); + return true; + } + + +//-------------------------------------------------------------// +//-------------------------------------------------------------// +//-------------------------------------------------------------// +//-------------------------------------------------------------// + +//-------------------------------------------------------------// + +bool QSSurface::start() + { + QSPlot3D::start(); + if ( d->w == 0 || d->h == 0 ) return false; + init_loops(); + d->quarter.number = 0; + prepare_quarter(); + m_drv->setLine( line(MeshLine) ); + m_drv->setFill( fill(TMeshFill) ); + + return true; + } + + +//-------------------------------------------------------------// + +void QSSurface::init_loops() + { + // visible range in index to ZData + // no need to draw grid outside (min.x, max.x), (min.y, max.y ) + // because it is outside the view area. + d->min.x = d->w; // empty area + d->max.x = -1; + for( int i=0;i<d->w;i++ ) { + if ( d->xworld(i)>=0.0 && d->xworld(i)<=1.0 ) { + d->min.x = QMIN(d->min.x,QMAX( 0,i-1)); + d->max.x = QMAX(d->max.x,QMIN(d->w-1,i+1)); + } + } + d->min.y = d->h; // empty area + d->max.y = -1; + for( int i=0;i<d->h;i++ ) { + if ( d->yworld(i)>=0.0 && d->yworld(i)<=1.0 ) { + d->min.y = QMIN(d->min.y,QMAX( 0,i-1)); + d->max.y = QMAX(d->max.y,QMIN(d->h-1,i+1)); + } + } + + // delta must be set as in the first quarter + d->delta.x = 1; + d->delta.y = 1; + + // middle point - middle x and y must be a valid index + QSPt2f middle = m_axes->proj()->middle(); // in world coordinates + + d->middle.x = d->w-1; for( int i=1;i<d->w;i++) if ( d->xworld(i) > middle.x ) { d->middle.x=QMAX(0,i-1); break; } + d->middle.y = d->h-1; for( int i=1;i<d->h;i++) if ( d->yworld(i) > middle.y ) { d->middle.y=QMAX(0,i-1); break; } + } + + + +//-------------------------------------------------------------// +// +// 0 3 +// +// 1 2 +// +void QSSurface::prepare_quarter() +// divide graph into four parts with different drawing directions +// to be sure that invisible areas are hidden ( further objects are +// drawn first ). + { + // empty quarter + d->quarter.empty = true; + ///if ( !m_axes->perspective() && d->quarter.number > 0 ) return; + d->quarter.iMin = d->min.x; + d->quarter.iMax = d->max.x; + d->quarter.jMin = d->min.y; + d->quarter.jMax = d->max.y; + d->quarter.di = d->delta.x; + d->quarter.dj = d->delta.y; + switch( d->quarter.number ) { + case 0: break; + case 1: d->quarter.di = -d->quarter.di; break; + case 2: d->quarter.di = -d->quarter.di; + d->quarter.dj = -d->quarter.dj; break; + case 3: d->quarter.dj = -d->quarter.dj; break; + default: break; + } + // divide intor triangles + switch( d->quarter.number ) { + case 0: d->quarter.t[0].p0 = 3; d->quarter.t[0].p1 = 0; d->quarter.t[0].p2 = 1; + d->quarter.t[1].p0 = 1; d->quarter.t[1].p1 = 2; d->quarter.t[1].p2 = 3; break; + + case 1: d->quarter.t[0].p0 = 2; d->quarter.t[0].p1 = 3; d->quarter.t[0].p2 = 0; + d->quarter.t[1].p0 = 0; d->quarter.t[1].p1 = 1; d->quarter.t[1].p2 = 2; break; + + case 2: d->quarter.t[0].p0 = 1; d->quarter.t[0].p1 = 2; d->quarter.t[0].p2 = 3; + d->quarter.t[1].p0 = 3; d->quarter.t[1].p1 = 0; d->quarter.t[1].p2 = 1; break; + + case 3: d->quarter.t[0].p0 = 0; d->quarter.t[0].p1 = 1; d->quarter.t[0].p2 = 2; + d->quarter.t[1].p0 = 2; d->quarter.t[1].p1 = 3; d->quarter.t[1].p2 = 0; break; + } + if ( d->quarter.di > 0 ) d->quarter.iMax = d->middle.x; else d->quarter.iMin = d->middle.x+1; + if ( d->quarter.dj > 0 ) d->quarter.jMax = d->middle.y; else d->quarter.jMin = d->middle.y+1; + + // reverse the scan direction for OpenGL ( more effective ) + if ( m_corder == QSDrv::NearerFirst ) { + d->quarter.di = -d->quarter.di; + d->quarter.dj = -d->quarter.dj; + } + + // empty quarter + if ( (d->quarter.iMax-d->quarter.iMin) < 1 || (d->quarter.jMax-d->quarter.jMin) < 1 ) return; + + // start positions + if ( d->quarter.di > 0 ) d->quarter.ci = d->quarter.iMin; else d->quarter.ci = d->quarter.iMax; + if ( d->quarter.dj > 0 ) d->quarter.cj = d->quarter.jMin; else d->quarter.cj = d->quarter.jMax; + + d->invalidate_row_buffers(); + d->set_current_row( d->quarter.cj, d->quarter.iMin, d->quarter.iMax ); + d->quarter.empty = false; + } + + +//-------------------------------------------------------------// + +void QSSurface::end() + { + QSPlot3D::end(); + } + +//-------------------------------------------------------------// +//-------------------------------------------------------------// +//-------------------------------------------------------------// + +void QSSurface::surface_runtime_data::invalidate_row_buffers() + { + for( int i=0; i<4; i++ ) row_z_buff[i].row = -1; + for( int i=0; i<2; i++ ) row_v_buff[i].row = -1; + for( int i=0; i<3; i++ ) row_mn_buff[i].row = -1; + for( int i=0; i<2; i++ ) row_vn_buff[i].row = -1; + } + +//-------------------------------------------------------------// + +void QSSurface::surface_runtime_data::set_current_row( int row, int first_col, int last_col ) +// fills rows buffers with values +// row_z [0-3] -> [curr_row-2, curr_row+1] - z values +// row_v [0-1] -> [curr_row-1, curr_row] - v values ( 4d data ) +// row_mn [0-2] -> [curr_row-1, curr_row+1] - normals to meshes +// row_vn [0-1] -> [curr_row-1, curr_row] - normal to vertices + { + curr_col_first = first_col; + curr_col_last = last_col; + curr_row = row; + int i; + + // we have four lines in buff ( from row-2, to row+1 ) + i=0; for( int curr_row=row-2; curr_row<=row+1; curr_row++ ) row_z[i++] = get_row_z( curr_row ); + // mesh normals + i=0; for( int curr_row=row-1; curr_row<=row+1; curr_row++ ) row_mn[i++] = get_row_mn( curr_row ); + // vertex normals ( curr_row-1, curr_row ) + i=0; + if ( vnormals ) + for( int curr_row=row-1; curr_row<=row; curr_row++ ) row_vn[i++] = get_row_vn( curr_row ); + // values ( 4d data ) - ( curr_row-1, curr_row ) + i=0; + if ( is_4d_data ) + for( int curr_row=row-1; curr_row<=row; curr_row++ ) row_v[i++] = get_row_v( curr_row ); + } + +//-------------------------------------------------------------// + +QSSurface::surface_runtime_data::row_z_t *QSSurface::surface_runtime_data::get_row_z( int row ) +// Notice the way a buffer for fill is searched for. - +// you should only request row inside range <curr_row-2,curr_row+1> + { + // row outside a valid range + if ( row<0 || row>h-1 ) return NULL; + // check if row is already in buffer + for( int i=0; i<4; i++ ) if ( row == row_z_buff[i].row ) return &row_z_buff[i]; + // fill a new row, notice that row request can be only in range <curr_row-2,curr_row+1> + // so we can free any buffer which doesn't hold a row from this range + for( int i=0; i<4; i++ ) + if ( row_z_buff[i].row < curr_row-2 || + row_z_buff[i].row > curr_row+1 || + row_z_buff[i].row == -1 ) { + int col_start = QMAX( curr_col_first-1, 0 ); + int col_stop = QMIN( curr_col_last +1, w-1 ); + for( int col=col_start; col<=col_stop; col++ ) + row_z_buff[i].ptr[col] = zworld(row,col); + row_z_buff[i].y = yworld(row); + row_z_buff[i].row = row; + return &row_z_buff[i]; + } + assert( false ); + return NULL; + } + +//-------------------------------------------------------------// + +QSSurface::surface_runtime_data::row_mn_t *QSSurface::surface_runtime_data::get_row_mn( int row ) +// you can request only rows in range <curr_row-1, curr_row+1> +// it assumes that z buffers are already filled with correct z-values + { + if ( row<1 || row>h-1 ) return NULL; + // check if row is already in buffer + for( int i=0; i<3; i++ ) if ( row == row_mn_buff[i].row ) return &row_mn_buff[i]; + // fill a new row + for( int i=0; i<3; i++ ) + if ( row_mn_buff[i].row < curr_row-1 || + row_mn_buff[i].row > curr_row+1 || + row_mn_buff[i].row == -1 ) { + QSPt3f mesh_buff[4]; + for( int col=curr_col_first; col<=QMIN(w-1,curr_col_last+1); col++ ) + if ( get_polygon( row, col, mesh_buff ) ) row_mn_buff[i].ptr[col] = QSProjection::normal( mesh_buff ); + row_mn_buff[i].row = row; + return &row_mn_buff[i]; + } + assert( false ); + return NULL; + } + +//-------------------------------------------------------------// + +QSSurface::surface_runtime_data::row_vn_t *QSSurface::surface_runtime_data::get_row_vn( int row ) +// you can request only rows in range <curr_row-1, curr_row> +// it assumes that mesh normal buffers are already filled. + { + if ( row<0 || row>h-1 ) return NULL; + // check if row is already in buffer + for( int i=0; i<2; i++ ) if ( row == row_vn_buff[i].row ) return &row_vn_buff[i]; + // fill a new row + for( int i=0; i<3; i++ ) + if ( row_vn_buff[i].row < curr_row-1 || + row_vn_buff[i].row > curr_row || + row_vn_buff[i].row == -1 ) { + for( int col=curr_col_first; col<=curr_col_last; col++ ) { + QSPt3f n; + row_mn_t *curr_row_buff = row_mn[curr_row-row+1]; + row_mn_t *next_row_buff = row_mn[curr_row-row+2]; + if ( curr_row_buff && col>0 ) n = n + curr_row_buff->ptr[col]; + if ( curr_row_buff && col<w-1 ) n = n + curr_row_buff->ptr[col+1]; + if ( next_row_buff && col>0 ) n = n + next_row_buff->ptr[col]; + if ( next_row_buff && col<w-1 ) n = n + next_row_buff->ptr[col+1]; + row_vn_buff[i].ptr[col] = QSProjection::normalize( n ); + } + row_vn_buff[i].row = row; + return &row_vn_buff[i]; + } + assert( false ); + return NULL; + } + +//-------------------------------------------------------------// + +QSSurface::surface_runtime_data::row_v_t *QSSurface::surface_runtime_data::get_row_v( int row ) +// you can request only rows in range <curr_row-1, curr_row> + { + if ( row<0 || row>h-1 ) return NULL; + // check if row is already in buffer + for( int i=0; i<2; i++ ) if ( row == row_v_buff[i].row ) return &row_v_buff[i]; + // fill a new row + for( int i=0; i<3; i++ ) + if ( row_v_buff[i].row < curr_row-1 || + row_v_buff[i].row > curr_row || + row_v_buff[i].row == -1 ) { + for( int col=curr_col_first; col<=curr_col_last; col++ ) + row_v_buff[i].ptr[col] = vworld(row,col); + row_v_buff[i].row = row; + return &row_v_buff[i]; + } + assert( false ); + return NULL; + } + + +//-------------------------------------------------------------// + +// e0 +// 0 ----- 1 +// | | ---> cols +// |e3 | e1 +// 3 ----- 2 \/ rows +// e2 +// vertex nr. 2 is at current (row,col) +// Buffers: +bool QSSurface::surface_runtime_data::get_mesh( int col, QSPt3f pts[4], QSPt3f norms[5], double v[4] ) + { + if ( col == 0 || curr_row == 0 ) return false; + get_polygon( curr_row, col, pts ); + norms[0] = row_mn[1]->ptr[col]; + int row = curr_row; + if ( vnormals ) { + norms[0] = row_vn[0]->ptr[col-1]; + norms[3] = row_vn[0]->ptr[col-0]; + norms[2] = row_vn[1]->ptr[col-0]; + norms[1] = row_vn[1]->ptr[col-1]; + } + if ( is_4d_data ) { + v[0] = row_v[0]->ptr[col-1]; + v[3] = row_v[0]->ptr[col-0]; + v[2] = row_v[1]->ptr[col-0]; + v[1] = row_v[1]->ptr[col-1]; + } + return true; + } + + +//-------------------------------------------------------------// + +bool QSSurface::surface_runtime_data::get_polygon( int row, int col, QSPt3f pts[4] ) +// returns mesh coordinates for the row 'row' and col 'col' +// row can be in the range <curr_row-1,curr_row+1>. See: set_current_row() + { + row_z_t *prev_row_buff = row_z[row-curr_row+1]; + row_z_t *curr_row_buff = row_z[row-curr_row+2]; + if ( prev_row_buff && curr_row_buff && col > 0 ) { + pts[0].set( x_coords[col-1], prev_row_buff->y, prev_row_buff->ptr[col-1] ); + pts[3].set( x_coords[col-0], prev_row_buff->y, prev_row_buff->ptr[col-0] ); + pts[2].set( x_coords[col-0], curr_row_buff->y, curr_row_buff->ptr[col-0] ); + pts[1].set( x_coords[col-1], curr_row_buff->y, curr_row_buff->ptr[col-1] ); + return true; + } + return false; + } + +//-------------------------------------------------------------// + +bool QSSurface::step() + { + int curr_step = 0; + if ( !d->quarter.empty ) + while ( d->quarter.cj >= d->quarter.jMin && d->quarter.cj <= d->quarter.jMax ) { + while ( d->quarter.ci >= d->quarter.iMin && d->quarter.ci <= d->quarter.iMax ) { + + if ( d->get_mesh( d->quarter.ci, d->mesh_pts, d->mesh_norms, d->mesh_values ) ) { + if ( m_x_grid_step > 1 || m_y_grid_step > 1 ) { + d->mesh_edges[1] = ((d->quarter.ci-1)%m_x_grid_step) == 0; + d->mesh_edges[0] = ((d->quarter.cj-1)%m_y_grid_step) == 0; + d->mesh_edges[3] = ((d->quarter.ci)%m_x_grid_step) == 0; + d->mesh_edges[2] = ((d->quarter.cj)%m_y_grid_step) == 0; + draw_polygon( d->mesh_pts, d->mesh_norms, (d->is_4d_data ? d->mesh_values : NULL), d->mesh_edges ); + } else { + draw_polygon( d->mesh_pts, d->mesh_norms, (d->is_4d_data ? d->mesh_values : NULL) ); + } + } + + d->quarter.ci += d->quarter.di; + // end with this little part ... + if ( curr_step++ > work_steps && m_bkg_handler ) return true; + } + + d->quarter.cj += d->quarter.dj; + d->quarter.ci = d->quarter.di>0 ? d->quarter.iMin : d->quarter.iMax; + d->set_current_row( d->quarter.cj, d->quarter.iMin, d->quarter.iMax ); + } + + if ( d->quarter.number < 3 ) { + d->quarter.number += 1; + prepare_quarter(); + return true; + } + + return false; + } + +//-------------------------------------------------------------// + +void QSSurface::draw_polygon( const QSPt3f pts[4], QSPt3f *norms, const double *values, const bool *edges ) + { + for( int i=0; i<4; i++ ) d->canvas_pts[i] = m_proj->world3DToCanvas3( pts[i] ); + if ( !QSProjection::isCorrect(pts) || + !QSProjection::isFlat(d->canvas_pts,4) || + ( values && !QSProjection::isCorrect(values) ) ) { + for( int i=0; i<2; i++ ) { + d->triangle_pts[0] = pts[d->quarter.t[i].p0]; + d->triangle_pts[1] = pts[d->quarter.t[i].p1]; + d->triangle_pts[2] = pts[d->quarter.t[i].p2]; + d->triangle_norms[0] = QSProjection::normal( d->triangle_pts, 3 ); //norms[0]; + if ( d->vnormals ) { + d->triangle_norms[1] = norms[d->quarter.t[i].p0+1]; + d->triangle_norms[2] = norms[d->quarter.t[i].p1+1]; + d->triangle_norms[3] = norms[d->quarter.t[i].p2+1]; + } + if ( values ) { + d->triangle_values[0] = values[d->quarter.t[i].p0]; + d->triangle_values[1] = values[d->quarter.t[i].p1]; + d->triangle_values[2] = values[d->quarter.t[i].p2]; + } + + d->triangle_edges[0] = false; + d->triangle_edges[1] = edges ? edges[d->quarter.t[i].p1] : true; + d->triangle_edges[2] = edges ? edges[d->quarter.t[i].p2] : true; + + drawPolygon( d->triangle_pts, 3, d->triangle_norms, (values?d->triangle_values:NULL), d->triangle_edges ); + } + } else { + drawPolygon( pts, 4, norms, values, edges ); + } + } + +//-------------------------------------------------------------// + +QString QSSurface::posInfo( QSPt2f& pos ) + { + if ( m_busy ) return QString::null; + allocRuntimeData(); + if ( d->w == 0 || d->h == 0 ) return QString::null; + init_loops(); + + QSPt2f p; + double dz = 0.0; + bool init = false; + double pdistance = 10.0*10.0; + QString result = QString::null; + for ( int row=d->min.y; row<=d->max.y; row++ ) { + for ( int col=d->min.x; col<=d->max.x; col++ ) { + QSPt3f dpos(d->xvector(col),d->yvector(row),d->zdata(row,col)); + QSPt3f wpos = dataToWorld(dpos); + QSPt3f cpos = m_proj->world3DToCanvas3(wpos); + double distance = (pos.x-cpos.x)*(pos.x-cpos.x)+(pos.y-cpos.y)*(pos.y-cpos.y); + if ( distance < 5.0*5.0 && distance < pdistance && (cpos.z<dz||!init) ) { + pdistance = distance; + init = true; dz = cpos.z; p.set(cpos.x,cpos.y); + result = QString(tr("row = "))+QString::number(row)+"\n"; + result += QString(tr("col = "))+QString::number(col)+"\n"; + result += QString(tr("X = "))+QString::number(dpos.x)+"\n"; + result += QString(tr("Y = "))+QString::number(dpos.y)+"\n"; + result += QString(tr("Z = "))+QString::number(dpos.z)+"\n"; + if ( d->is_4d_data ) + result += QString(tr("V = "))+QString::number(d->vdata(row,col))+"\n"; + } + } + } + + if ( result != QString::null ) pos = p; + freeRuntimeData(); + return result; + } + +//-------------------------------------------------------------// + +QSPt2f QSSurface::legendItemSize( QSDrv *drv ) + { + return standardLegendItemSize( drv, defaultAxis(QSAxis::ZAxisType), title() ); + } + +//-------------------------------------------------------------// + +void QSSurface::drawLegendItem( const QSPt2f& pos, QSDrv *drv ) + { + drawStandardLegendItem( pos, drv, defaultAxis(QSAxis::ZAxisType), title(), &m_gradient ); + } + +//-------------------------------------------------------------// + +void QSSurface::loadStateFromStream( QDataStream& stream, QSObjectFactory *factory ) + { + QSPlot3D::loadStateFromStream( stream, factory ); + } + +//-------------------------------------------------------------// + +void QSSurface::saveStateToStream( QDataStream& stream, QSObjectFactory *factory ) + { + QSPlot3D::saveStateToStream( stream, factory ); + } + +//-------------------------------------------------------------// + +QString QSSurface::channelVariable( int channel ) const + { + switch( channel ) { + case ZData: return "z"; + case XVector: return "x"; + case YVector: return "y"; + case VData: return "v"; + } + return QString::null; + } + +//-------------------------------------------------------------// + +QSSurface::ColumnType QSSurface::columnType( int channel, int column ) const + { + } + +//-------------------------------------------------------------// + +/* + if ( d->quarter.number == 0 ) { + d->mesh_edges[1] = ((d->quarter.ci-1)%m_x_grid_step) == 0; + d->mesh_edges[0] = ((d->quarter.cj-1)%m_y_grid_step) == 0; + } + if ( d->quarter.number == 1 ) { + d->mesh_edges[3] = ((d->quarter.ci)%m_x_grid_step) == 0; + d->mesh_edges[0] = ((d->quarter.cj-1)%m_y_grid_step) == 0; + } + if ( d->quarter.number == 3 ) { + d->mesh_edges[3] = ((d->quarter.ci)%m_x_grid_step) == 0; + d->mesh_edges[2] = ((d->quarter.cj)%m_y_grid_step) == 0; + } + if ( d->quarter.number == 2 ) { + d->mesh_edges[1] = ((d->quarter.ci-1)%m_x_grid_step) == 0; + d->mesh_edges[2] = ((d->quarter.cj)%m_y_grid_step) == 0; + } + */ diff --git a/kmatplot/widgets/qssurface.h b/kmatplot/widgets/qssurface.h new file mode 100644 index 0000000..7287f56 --- /dev/null +++ b/kmatplot/widgets/qssurface.h @@ -0,0 +1,149 @@ +/*************************************************************************** + qssurface.h + ------------------- + begin : 01-January-2000 + + copyright : (C) 2000 by Kamil Dobkowski + email : kamildobk@poczta.onet.pl + ***************************************************************************/ + +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + +#ifndef __QSSURFACE_H +#define __QSSURFACE_H + +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + +#include"qsplot.h" +#include"qsaxes.h" + + + +/** + * \brief Dataset: Draws 3d carpet plots + * + * Data format is described in QSSurface::Channels . See also QSAxes::plotAdd() . + */ +class QSSurface : public QSPlot3D + { + Q_OBJECT + Q_PROPERTY( int xGridStep READ xGridStep WRITE setXGridStep ) + Q_PROPERTY( int yGridStep READ yGridStep WRITE setYGridStep ) + + public: + /** + * Descriptive names of data channels. See QSData::setMatrix(). + * XVector ( optional ) contains x coordinates of a grid, YVector ( optional ) contains y coordinates of a grid. + * cols(XVector) == cols(ZData) and rows(YVector) == rows(ZData), both vectors must be monotone. + */ + enum Channels { + XVector=0, + YVector=1, + ZData = 2, + VData =3 }; + /** + * Constructor. + */ + QSSurface(QSAxes* parent, const char * name=0); + /** + * Destructor. + */ + virtual ~QSSurface(); + void setXGridStep( int step ); + void setYGridStep( int step ); + int xGridStep() const { return m_x_grid_step; } + int yGridStep() const { return m_y_grid_step; } + virtual QString posInfo( QSPt2f& pos ); + virtual QSPt2f legendItemSize( QSDrv *drv ); + virtual void drawLegendItem( const QSPt2f& pos, QSDrv *drv ); + virtual void loadStateFromStream( QDataStream& stream, QSObjectFactory *factory ); + virtual void saveStateToStream( QDataStream& stream, QSObjectFactory *factory ); + virtual ColumnType columnType( int channel, int column ) const; + virtual QString channelVariable( int channel ) const; + + protected: + virtual void dataChanged( int channel = -1 ); + virtual void allocRuntimeData(); + virtual void freeRuntimeData(); + virtual bool getAxisRange( QSAxis *axis, double& min, double& max ); + virtual bool start(); + virtual bool step(); + virtual void end(); + + private: + struct surface_runtime_data; + struct surface_runtime_data *d; + bool m_minmax_z_valid; + bool m_minmax_v_valid; + double m_max_z; + double m_min_z; + double m_min_v; + double m_max_v; + int m_x_grid_step; + int m_y_grid_step; + + void init_loops(); + void prepare_quarter(); + void draw_polygon( const QSPt3f pts[], QSPt3f *norm, const double *values=NULL, const bool *edges=NULL ); + }; + +#endif + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/kmatplot/widgets/qsworkbook.cpp b/kmatplot/widgets/qsworkbook.cpp new file mode 100644 index 0000000..be80bef --- /dev/null +++ b/kmatplot/widgets/qsworkbook.cpp @@ -0,0 +1,328 @@ +/*************************************************************************** + qsworkbook.cpp + ------------------- + begin : + copyright : (C) 2001 by Kamil Dobkowski + email : kamildobk@poczta.onet.pl + ***************************************************************************/ + +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + + +#include"qsworkbook.h" +#include"qsdrvqt.h" +#include"qsaxes.h" +#include<qpaintdevicemetrics.h> +#include<qprinter.h> +#include<qwidget.h> +#include"qschildlist.h" +#include"qsconsole.h" + + +//---------------------------------------------------------------------------------------------------// + +QSPage::QSPage( QObject *parent ) +: QObject( parent ) + { + m_title = QString::null; + m_objects = new QSCObjectCollection( this ); + connect( m_objects, SIGNAL(sigChanged()), this, SLOT(slot_collection_changed()) ); + } + +//---------------------------------------------------------------------------------------------------// + +QSPage::~QSPage() + { + m_objects->stop(); + } + +//---------------------------------------------------------------------------------------------------// + +void QSPage::setTitle( const QString& title ) + { + if ( m_title != title ) { + m_title = title; + emit sigTitleChanged( m_title ); + } + } + + //---------------------------------------------------------------------------------------------------// + +void QSPage::paint( QPainter *p, double dpi, bool blocking ) + { + m_objects->stop(); + m_objects->paint( p, dpi, blocking, true ); + } + +//---------------------------------------------------------------------------------------------------// + +void QSPage::slot_collection_changed() + { + emit sigPageChanged(); + } + + + +//---------------------------------------------------------------------------------------------------// +//---------------------------------------------------------------------------------------------------// +//---------------------------------------------------------------------------------------------------// +//---------------------------------------------------------------------------------------------------// +//---------------------------------------------------------------------------------------------------// +//---------------------------------------------------------------------------------------------------// + + + + + +QSWorkbook::QSWorkbook( QObject *parent ) +:QObject( parent ) + { + m_printer = NULL; + m_page_list = new QSChildList<QSPage>(); + } + +//-------------------------------------------------------------// + +QSWorkbook::~QSWorkbook() + { + delete m_page_list; + } + +//-------------------------------------------------------------// + +int QSWorkbook::pageCount() const + { + return m_page_list->count(); + } + +//-------------------------------------------------------------// + +void QSWorkbook::clear() + { + QSPage *curr_page = page(0); + while( curr_page ) { + pageDelete(0); + curr_page = page(0); + } + } + +//-------------------------------------------------------------// + +void QSWorkbook::print( QPainter *painter, QPrinter *printer, double dpi ) + { + int page_nr; + int page_step; + + printer->setFullPage( TRUE ); + int page_min = QMAX( QMIN( printer->fromPage(), printer->toPage() ), 1 ); + int page_max = QMIN( QMAX( printer->fromPage(), printer->toPage() ), pageCount() ); + if ( printer->pageOrder() == QPrinter::FirstPageFirst ) { + page_step = 1; + page_nr = page_min; + } else { + page_step = -1; + page_nr = page_max; + } + + while( page_nr >= page_min && page_nr <= page_max ) { + QSConsole::write( tr("Printing page %1 ...").arg(page_nr) ); + QSPage *curr_page = page(page_nr-1); + curr_page->paint( painter, dpi, true ); + page_nr += page_step; + if ( page_nr >= page_min && page_nr <= page_max ) printer->newPage(); + } + } + +//-------------------------------------------------------------// + +void QSWorkbook::pageAdd( QSPage *page ) + { + if ( page ) { + static int page_nr = 1; + if ( page->title().isNull() ) page->setTitle( tr("Page %1").arg(page_nr++) ); + m_page_list->add( page ); + connect( page->objects(), SIGNAL(sigAdded(QSCObject*)), this, SLOT(slot_object_added(QSCObject*)) ); + connect( page->objects(), SIGNAL(sigRemoved(QSCObject*)), this, SLOT(slot_object_removed(QSCObject*)) ); + connect( page->objects(), SIGNAL(sigOrderChanged()), this, SLOT(slot_object_order()) ); + connect( page, SIGNAL(sigTitleChanged(const QString&)), this, SLOT(slot_page_title_changed(const QString&)) ); + connect( page, SIGNAL(sigPageChanged()), this, SLOT(slot_page_changed()) ); + emit sigPageAdded( page ); + emit sigPageListChanged(); + emit sigWorkbookChanged(); + } + } + +//-------------------------------------------------------------// + +void QSWorkbook::pageInsert( int position, QSPage *page ) + { + if ( page ) { + if ( page->title().isNull() ) page->setTitle( tr("Page %1").arg(pageCount()+1) ); + m_page_list->insert( position, page ); + connect( page->objects(), SIGNAL(sigAdded(QSCObject*)), this, SLOT(slot_object_added(QSCObject*)) ); + connect( page->objects(), SIGNAL(sigRemoved(QSCObject*)), this, SLOT(slot_object_removed(QSCObject*)) ); + connect( page->objects(), SIGNAL(sigOrderChanged()), this, SLOT(slot_object_order()) ); + connect( page, SIGNAL(sigTitleChanged( const QString& )), this, SLOT(slot_page_title_changed( const QString& )) ); + connect( page, SIGNAL(sigPageChanged()), this, SLOT(slot_page_changed()) ); + emit sigPageAdded( page ); + emit sigPageListChanged(); + emit sigWorkbookChanged(); + } + } + +//-------------------------------------------------------------// + +void QSWorkbook::pageRemove( int index ) + { + QSPage *removed_page = page( index ); + if ( removed_page ) { + disconnect( removed_page->objects(), SIGNAL(sigAdded(QSCObject*)), this, SLOT(slot_object_added(QSCObject*)) ); + disconnect( removed_page->objects(), SIGNAL(sigRemoved(QSCObject*)), this, SLOT(slot_object_removed(QSCObject*)) ); + disconnect( removed_page->objects(), SIGNAL(sigOrderChanged()), this, SLOT(slot_object_order()) ); + disconnect( removed_page, SIGNAL(sigTitleChanged( const QString& )), this, SLOT(slot_page_title_changed( const QString& )) ); + disconnect( removed_page, SIGNAL(sigPageChanged()), this, SLOT(slot_page_changed()) ); + m_page_list->remove( index ); + emit sigPageRemoved( removed_page ); + emit sigPageListChanged(); + emit sigWorkbookChanged(); + } + } + +//-------------------------------------------------------------// + +void QSWorkbook::pageDelete( int index ) + { + QSPage *curr_page = page( index ); + if ( curr_page ) { + pageRemove( index ); + delete curr_page; + } + } + +//-------------------------------------------------------------// + +void QSWorkbook::pageRaise( int index ) + { + m_page_list->raise( index ); + emit sigPageOrder(); + emit sigPageListChanged(); + emit sigWorkbookChanged(); + } + +//-------------------------------------------------------------// + +void QSWorkbook::pageLower( int index ) + { + m_page_list->lower( index ); + emit sigPageOrder(); + emit sigPageListChanged(); + emit sigWorkbookChanged(); + } + +//-------------------------------------------------------------// + +void QSWorkbook::pageReorder( int position, int index ) + { + m_page_list->reorder( position, index ); + emit sigPageOrder(); + emit sigPageListChanged(); + emit sigWorkbookChanged(); + } + +//-------------------------------------------------------------// + +void QSWorkbook::pageToFront( int index ) + { + m_page_list->toFront( index ); + emit sigPageOrder(); + emit sigPageListChanged(); + emit sigWorkbookChanged(); + } + +//-------------------------------------------------------------// + +void QSWorkbook::pageToBack( int index ) + { + m_page_list->toBack( index ); + emit sigPageOrder(); + emit sigPageListChanged(); + emit sigWorkbookChanged(); + } + +//-------------------------------------------------------------// + +int QSWorkbook::pageFind( QSPage *page ) const + { + return m_page_list->find(page); + } + +//-------------------------------------------------------------// + +QSPage *QSWorkbook::pageFind( QSCObject *object ) const + { + for( int page_nr=0; page_nr<pageCount(); page_nr++ ) { + QSPage *curr_page = page(page_nr); + if ( curr_page->objects()->find(object) >= 0 ) return curr_page; + } + return NULL; + } + +//-------------------------------------------------------------// + +QSPage *QSWorkbook::page( int index ) const + { + return (*m_page_list)[index]; + } + +//-------------------------------------------------------------// + +void QSWorkbook::setPrinter( QPrinter *printer ) + { + m_printer = printer; + emit sigPrinterChanged(); + emit sigWorkbookChanged(); + } + +//-------------------------------------------------------------// + +void QSWorkbook::slot_object_added(QSCObject *object) + { + emit sigObjectAdded(object); + } + +//-------------------------------------------------------------// + +void QSWorkbook::slot_object_removed(QSCObject *object) + { + emit sigObjectRemoved(object); + } + +//-------------------------------------------------------------// + +void QSWorkbook::slot_object_order() + { + emit sigObjectOrder(); + } + +//-------------------------------------------------------------// + +void QSWorkbook::slot_page_changed() + { + emit sigWorkbookChanged(); + } + +//-------------------------------------------------------------// + +void QSWorkbook::slot_page_title_changed( const QString& ) + { + emit sigPageListChanged(); + emit sigWorkbookChanged(); + } + diff --git a/kmatplot/widgets/qsworkbook.h b/kmatplot/widgets/qsworkbook.h new file mode 100644 index 0000000..7426382 --- /dev/null +++ b/kmatplot/widgets/qsworkbook.h @@ -0,0 +1,262 @@ +/*************************************************************************** + qsworkbook.h + ------------------- + begin : + copyright : (C) 2001 by Kamil Dobkowski + email : kamildobk@poczta.onet.pl + ***************************************************************************/ + +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + + +#ifndef QSWORKBOOK_H +#define QSWORKBOOK_H + +#include <qobject.h> +#include <qstring.h> +#include "qscobject.h" + +//---------------------------------------------------------------------------------------------------// + +template<class CHILD_OBJECT> class QSChildList; + +class QSDrv; +class QPainter; +class QWidget; +/** + * \brief Single page of QSWorkbook. + * + * Contains a list of QSCObjects. + * Most of its functionality is available through objects() collection. See also QSWorkbook. + * @author Kamil Dobkowski + */ +class QSPage : public QObject + { + Q_OBJECT + public: + /** + * Constructor. + */ + QSPage( QObject *parent=NULL ); + /** + * Destructor. Deletes all objects on the page. + */ + virtual ~QSPage(); + /** + * Sets a title of this page. It appears on a tab. + * Does not emit sigPageChanged - emits sigTitleChanged instead. + */ + void setTitle( const QString& title ); + /** + * Returns a title of this page. + */ + QString title() const { return m_title; } + /** + * Collection of objcects on this page. + */ + QSCObjectCollection *objects() const { return m_objects; } + /** + * Prints the page on the painter. If drawing in background it duplicates painter for each object + * using QSDrvQt::copyPainter and each object is drawing itself in the background. + */ + void paint( QPainter *p, double dpi, bool blocking=false ); + + signals: + /** + * Page title has changed + */ + void sigTitleChanged( const QString& newTitle ); + /** + * Page has changed ( the same as collection()::sigChanged ). Does not include sigTitleChanged() + * It informs when page needs redrawnig. + */ + void sigPageChanged(); + + private: + QSCObjectCollection *m_objects; + QString m_title; + + private slots: + void slot_collection_changed(); + + }; + +//---------------------------------------------------------------------------------------------------// + +class QPrinter; + +/** + * \brief Main document class + * + * Workbook holds a list of pages. Use QSPlotView to display documents on the screen. + * @author Kamil Dobkowski + */ +class QSWorkbook : public QObject + { + Q_OBJECT + public: + /** + * Constructor. + */ + QSWorkbook( QObject *parent ); + /** + * Destructor. Deletes all pages. Doesn't delete printer() + */ + virtual ~QSWorkbook(); + /** + * Returns console for messages, errors, etc. + */ + //QSConsole *console(); + /** + * Returns a number of pages in this workbook + */ + int pageCount() const; + /** + * Clears a workbook to the initial state + */ + virtual void clear(); + /** + * Print the whole workbook on the given printer.QPrinter - QPainter + */ + void print( QPainter *painter, QPrinter *printer, double dpi ); + /** + * Adds a new page. + */ + void pageAdd( QSPage *object ); + /** + * Insert page at position 'beforePos'. + */ + void pageInsert( int position, QSPage *page ); + /** + * Removes a page but doesn't delete it. + */ + void pageRemove( int index ); + /** + * Removes a page ad deletes it + */ + void pageDelete( int index ); + /** + * Raises a page. + */ + void pageRaise( int index ); + /** + * Lowers a page + */ + void pageLower( int index ); + /** + * Brings a page to the front. + */ + void pageToFront( int index ); + /** + * Sends a page to the back + */ + void pageToBack( int index ); + /** + * Move page 'index' to position 'position'. + */ + void pageReorder( int position, int index ); + /** + * Returns an index of a page or -1 if it wasn't found. + */ + int pageFind( QSPage *page ) const; + /** + * Find page + */ + QSPage *pageFind( QSCObject *object ) const; + /** + * Returns a page. + */ + QSPage *page( int index ) const; + /** + * Set a printer. Page size and margins are used to + * display full page preview. The printer must be + * set each time its settings changes. Emits sigWorkbookChanged. + * printer is not deleted - the pointer still belongs to caller. + */ + void setPrinter( QPrinter *printer ); + /** + * Returns a current printer + */ + QPrinter *printer() const { return m_printer; } + + signals: + /** + * Page added + */ + void sigPageAdded( QSPage *o ); + /** + * Page removed + */ + void sigPageRemoved( QSPage *o ); + /** + * Order of pages changed. + */ + void sigPageOrder(); + /** + * Object added ( to any page ) + */ + void sigObjectAdded( QSCObject *o ); + /** + * Object removed ( from any page ) + */ + void sigObjectRemoved( QSCObject *o ); + /** + * Order of objects changed. ( on any page ) + */ + void sigObjectOrder(); + /** + * Page added/removed/reordered, page title has changed. + * Page tab bar needs refreshing. + */ + void sigPageListChanged(); + /** + * Printer has changed. + */ + void sigPrinterChanged(); + /** + * Page added/removed/reordered, page changed, page title changed, a new printer is set. + * Workbook is 'dirty' and needs to be saved when exiting. + */ + void sigWorkbookChanged(); + + private slots: + void slot_object_added(QSCObject*); + void slot_object_removed(QSCObject*); + void slot_object_order(); + void slot_page_changed(); + void slot_page_title_changed( const QString& ); + + private: + QPrinter *m_printer; + QSChildList<QSPage> *m_page_list; + }; + +/** + * \mainpage + * + * \section intro Introduction + * + * The main object in this library is QSWorkbook, which represents the document. Workbook can be displayed + * on the screen using a provided view named QSPlotView. Workbook holds a list of QSPage's and each page contains a list + * of QSCObject's which are placed on it, QSCGroup is an object which can contain other objects, but behaves as a single + * one. You can display graphs using QSCAxesShadow object. It is a simple wrapper around QSAxes2D and QSAxes3D - they don't + * inherit QSCObject directly because of problems with multiple inheritance. These objects don't draw much by themselves. + * They serve as containers for datasets and axes. Datasets inherit QSPlot class. These are QSCurve, QSImage, QSContour, QSSurface, QSFigure. + * QSAxis class represents the single X, Y, V or Z axis. Axes and datasets inherit QSData interface. This means that they contain + * data organised as a list of matrices. For example QSCurve accepts four matrices: XVector, YVector, DXVector, DYVector and + * draws successive points ( x, y, dx, dy ) as a curve with dx and dy used for error bars. Your data is not assumed to be in some + * peculiar format - you will only have to implement an abstract QSMatrix interface. It is very simple, you may look at providen examples. + * You can repaint objects not only using a Qt's painter but also using a driver of your own, see QSDrv. This library uses its + * own graphic attributes such as QSGFill, QSGFont, QSGLine, QSGPoint, QSGArrow, QSGGradient, but you can easily convert them to/from + * coresponding Qt attributes using funtions from QSDrvQt class. See the inheritace tree under QSSerializable, it is a good point to + * start. + */ +#endif + diff --git a/stamp-h.in b/stamp-h.in new file mode 100644 index 0000000..9788f70 --- /dev/null +++ b/stamp-h.in @@ -0,0 +1 @@ +timestamp diff --git a/subdirs b/subdirs new file mode 100644 index 0000000..8e59ed0 --- /dev/null +++ b/subdirs @@ -0,0 +1 @@ +kmatplot