Merge lp:~valavanisalex/ubuntu/maverick/qtiplot/qtiplot-fix-605027-merge0.9.8-1 into lp:ubuntu/maverick/qtiplot

Proposed by Alex Valavanis
Status: Work in progress
Proposed branch: lp:~valavanisalex/ubuntu/maverick/qtiplot/qtiplot-fix-605027-merge0.9.8-1
Merge into: lp:ubuntu/maverick/qtiplot
Diff against target: 453941 lines (+62608/-191682)
382 files modified
.pc/.version (+1/-0)
.pc/01_build_system.diff/qtiplot.pro (+7/-0)
.pc/01_build_system.diff/qtiplot/qtiplot.pro (+248/-0)
.pc/01_build_system.diff/qtiplot/src/origin/origin.pri (+27/-0)
.pc/02_fix_paths.diff/qtiplot/src/core/ApplicationWindow.cpp (+18713/-0)
.pc/applied-patches (+2/-0)
3rdparty/liborigin/FORMAT (+0/-77)
3rdparty/liborigin/Origin750Parser.cpp (+0/-2413)
3rdparty/liborigin/Origin750Parser.h (+0/-65)
3rdparty/liborigin/OriginDefaultParser.cpp (+0/-481)
3rdparty/liborigin/OriginDefaultParser.h (+0/-47)
3rdparty/liborigin/OriginFile.cpp (+0/-175)
3rdparty/liborigin/OriginFile.h (+0/-75)
3rdparty/liborigin/OriginObj.h (+0/-703)
3rdparty/liborigin/OriginParser.cpp (+0/-189)
3rdparty/liborigin/OriginParser.h (+0/-67)
3rdparty/liborigin/copying (+0/-674)
3rdparty/liborigin/doc/Doxyfile (+0/-236)
3rdparty/liborigin/doc/liborigin2.dox (+0/-66)
3rdparty/liborigin/endianfstream.hh (+0/-225)
3rdparty/liborigin/liborigin.pro (+0/-26)
3rdparty/liborigin/logging.hpp (+0/-619)
3rdparty/liborigin/readme (+0/-27)
3rdparty/liborigin/tree.hh (+0/-2663)
3rdparty/qwtplot3d/3rdparty/gl2ps/COPYING.GL2PS (+0/-25)
3rdparty/qwtplot3d/3rdparty/gl2ps/COPYING.LGPL (+0/-482)
3rdparty/qwtplot3d/3rdparty/gl2ps/gl2ps.c (+0/-6061)
3rdparty/qwtplot3d/3rdparty/gl2ps/gl2ps.h (+0/-199)
3rdparty/qwtplot3d/include/qwt3d_autoptr.h (+0/-75)
3rdparty/qwtplot3d/include/qwt3d_autoscaler.h (+0/-51)
3rdparty/qwtplot3d/include/qwt3d_axis.h (+0/-127)
3rdparty/qwtplot3d/include/qwt3d_color.h (+0/-63)
3rdparty/qwtplot3d/include/qwt3d_colorlegend.h (+0/-80)
3rdparty/qwtplot3d/include/qwt3d_coordsys.h (+0/-125)
3rdparty/qwtplot3d/include/qwt3d_curve.h (+258/-0)
3rdparty/qwtplot3d/include/qwt3d_drawable.h (+0/-70)
3rdparty/qwtplot3d/include/qwt3d_enrichment.h (+0/-62)
3rdparty/qwtplot3d/include/qwt3d_enrichment_std.h (+0/-116)
3rdparty/qwtplot3d/include/qwt3d_extglwidget.h (+203/-0)
3rdparty/qwtplot3d/include/qwt3d_function.h (+0/-41)
3rdparty/qwtplot3d/include/qwt3d_global.h (+0/-58)
3rdparty/qwtplot3d/include/qwt3d_graphplot.h (+0/-24)
3rdparty/qwtplot3d/include/qwt3d_gridmapping.h (+0/-34)
3rdparty/qwtplot3d/include/qwt3d_helper.h (+0/-36)
3rdparty/qwtplot3d/include/qwt3d_io.h (+0/-141)
3rdparty/qwtplot3d/include/qwt3d_io_gl2ps.h (+0/-94)
3rdparty/qwtplot3d/include/qwt3d_io_reader.h (+0/-35)
3rdparty/qwtplot3d/include/qwt3d_label.h (+0/-78)
3rdparty/qwtplot3d/include/qwt3d_mapping.h (+0/-27)
3rdparty/qwtplot3d/include/qwt3d_multiplot.h (+0/-24)
3rdparty/qwtplot3d/include/qwt3d_openglhelper.h (+0/-130)
3rdparty/qwtplot3d/include/qwt3d_parametricsurface.h (+0/-44)
3rdparty/qwtplot3d/include/qwt3d_plot.h (+0/-320)
3rdparty/qwtplot3d/include/qwt3d_portability.h (+0/-91)
3rdparty/qwtplot3d/include/qwt3d_scale.h (+0/-89)
3rdparty/qwtplot3d/include/qwt3d_surfaceplot.h (+0/-130)
3rdparty/qwtplot3d/include/qwt3d_types.h (+0/-455)
3rdparty/qwtplot3d/include/qwt3d_volumeplot.h (+0/-24)
3rdparty/qwtplot3d/qwtplot3d.pri (+0/-71)
3rdparty/qwtplot3d/qwtplot3d.pro (+0/-96)
3rdparty/qwtplot3d/src/qwt3d_autoscaler.cpp (+0/-253)
3rdparty/qwtplot3d/src/qwt3d_axis.cpp (+0/-359)
3rdparty/qwtplot3d/src/qwt3d_color.cpp (+0/-63)
3rdparty/qwtplot3d/src/qwt3d_colorlegend.cpp (+0/-229)
3rdparty/qwtplot3d/src/qwt3d_coordsys.cpp (+0/-725)
3rdparty/qwtplot3d/src/qwt3d_curve.cpp (+741/-0)
3rdparty/qwtplot3d/src/qwt3d_dataviews.cpp (+0/-10)
3rdparty/qwtplot3d/src/qwt3d_drawable.cpp (+0/-140)
3rdparty/qwtplot3d/src/qwt3d_enrichment_std.cpp (+0/-347)
3rdparty/qwtplot3d/src/qwt3d_extglwidget.cpp (+136/-0)
3rdparty/qwtplot3d/src/qwt3d_function.cpp (+0/-102)
3rdparty/qwtplot3d/src/qwt3d_gridmapping.cpp (+0/-32)
3rdparty/qwtplot3d/src/qwt3d_gridplot.cpp (+0/-595)
3rdparty/qwtplot3d/src/qwt3d_io.cpp (+0/-365)
3rdparty/qwtplot3d/src/qwt3d_io_gl2ps.cpp (+0/-417)
3rdparty/qwtplot3d/src/qwt3d_io_reader.cpp (+0/-225)
3rdparty/qwtplot3d/src/qwt3d_label.cpp (+0/-304)
3rdparty/qwtplot3d/src/qwt3d_lighting.cpp (+0/-192)
3rdparty/qwtplot3d/src/qwt3d_meshplot.cpp (+0/-318)
3rdparty/qwtplot3d/src/qwt3d_mousekeyboard.cpp (+0/-387)
3rdparty/qwtplot3d/src/qwt3d_movements.cpp (+0/-106)
3rdparty/qwtplot3d/src/qwt3d_parametricsurface.cpp (+0/-104)
3rdparty/qwtplot3d/src/qwt3d_plot.cpp (+0/-500)
3rdparty/qwtplot3d/src/qwt3d_scale.cpp (+0/-312)
3rdparty/qwtplot3d/src/qwt3d_surfaceplot.cpp (+0/-183)
3rdparty/qwtplot3d/src/qwt3d_types.cpp (+0/-222)
3rdparty/zlib/README.txt (+0/-29)
3rdparty/zlib/minigzip.c (+0/-258)
3rdparty/zlib/zconf.h (+0/-332)
3rdparty/zlib/zlib.h (+0/-1357)
README.html (+5/-1)
build.conf.example (+38/-7)
debian/build.conf (+12/-1)
debian/changelog (+43/-0)
debian/control (+8/-5)
debian/patches/01_build_system.diff (+47/-46)
debian/patches/02_docbook_stylesheet.diff (+0/-11)
debian/patches/02_fix_paths.diff (+11/-0)
debian/patches/03_fix_qti_wordlist.txt_path.diff (+0/-13)
debian/patches/04_add_includes.diff (+0/-10)
debian/patches/series (+1/-2)
debian/rules (+6/-8)
debian/source/format (+1/-0)
fitPlugins/exp_saturation/exp_saturation.c (+0/-70)
fitPlugins/exp_saturation/exp_saturation.pro (+0/-29)
fitPlugins/explin/explin.c (+0/-76)
fitPlugins/explin/explin.pro (+0/-29)
fitPlugins/fitPlugins.pro (+0/-7)
fitPlugins/fitRational0/fitRational0.cpp (+32/-0)
fitPlugins/fitRational1/fitRational1.cpp (+32/-0)
fitPlugins/planck_wavelength/planck_wavelength.c (+0/-70)
fitPlugins/planck_wavelength/planck_wavelength.pro (+0/-27)
manual/docbook-en/appendix.docbook (+14/-2)
manual/docbook-en/dialogs.docbook (+87/-62)
manual/docbook-en/index.docbook (+7/-7)
manual/docbook-en/scripting.docbook (+303/-22)
manual/html/icons/icons.qrc (+227/-0)
manual/html/qtiplot.adp (+381/-367)
qtiplot.pro (+3/-4)
qtiplot/examples/python/filter_table.py (+0/-50)
qtiplot/examples/python/strd_nist_fit.py (+0/-163)
qtiplot/icons/axes_icons.h (+0/-1275)
qtiplot/icons/pixmaps.h (+0/-12630)
qtiplot/python-includepath.py (+28/-0)
qtiplot/python-libs-win.py (+28/-0)
qtiplot/python-sipcmd.py (+28/-0)
qtiplot/qtiUtil.py (+29/-0)
qtiplot/qti_wordlist.txt (+44/-0)
qtiplot/qtiplot.pro (+74/-32)
qtiplot/qtiplot.rc (+40/-0)
qtiplot/qtiplotrc.py (+37/-17)
qtiplot/src/analysis/Convolution.cpp (+1/-1)
qtiplot/src/analysis/Correlation.cpp (+1/-1)
qtiplot/src/analysis/FFT.cpp (+53/-12)
qtiplot/src/analysis/Filter.cpp (+106/-58)
qtiplot/src/analysis/Filter.h (+4/-3)
qtiplot/src/analysis/Fit.cpp (+40/-30)
qtiplot/src/analysis/Fit.h (+2/-2)
qtiplot/src/analysis/Integration.cpp (+21/-13)
qtiplot/src/analysis/Interpolation.cpp (+81/-74)
qtiplot/src/analysis/MultiPeakFit.cpp (+48/-20)
qtiplot/src/analysis/MultiPeakFit.h (+4/-3)
qtiplot/src/analysis/NonLinearFit.cpp (+47/-14)
qtiplot/src/analysis/NonLinearFit.h (+2/-2)
qtiplot/src/analysis/SmoothFilter.cpp (+1/-1)
qtiplot/src/analysis/analysis.pri (+0/-70)
qtiplot/src/analysis/dialogs/BaselineDialog.cpp (+419/-0)
qtiplot/src/analysis/dialogs/BaselineDialog.h (+92/-0)
qtiplot/src/analysis/dialogs/ExpDecayDialog.cpp (+17/-16)
qtiplot/src/analysis/dialogs/ExpDecayDialog.h (+2/-2)
qtiplot/src/analysis/dialogs/FFTDialog.cpp (+11/-3)
qtiplot/src/analysis/dialogs/FilterDialog.cpp (+10/-7)
qtiplot/src/analysis/dialogs/FilterDialog.h (+2/-2)
qtiplot/src/analysis/dialogs/FitDialog.cpp (+182/-186)
qtiplot/src/analysis/dialogs/FitDialog.h (+10/-6)
qtiplot/src/analysis/dialogs/FrequencyCountDialog.cpp (+1/-1)
qtiplot/src/analysis/dialogs/IntDialog.cpp (+26/-26)
qtiplot/src/analysis/dialogs/IntDialog.h (+2/-2)
qtiplot/src/analysis/dialogs/InterpolationDialog.cpp (+19/-20)
qtiplot/src/analysis/dialogs/InterpolationDialog.h (+2/-2)
qtiplot/src/analysis/dialogs/PolynomFitDialog.cpp (+14/-12)
qtiplot/src/analysis/dialogs/PolynomFitDialog.h (+2/-2)
qtiplot/src/analysis/dialogs/SmoothCurveDialog.cpp (+22/-19)
qtiplot/src/analysis/dialogs/SmoothCurveDialog.h (+5/-5)
qtiplot/src/analysis/dialogs/SubtractDataDialog.cpp (+335/-0)
qtiplot/src/analysis/dialogs/SubtractDataDialog.h (+71/-0)
qtiplot/src/analysis/fit_gsl.cpp (+32/-0)
qtiplot/src/analysis/fit_gsl.h (+32/-0)
qtiplot/src/analysis/nrutil.cpp (+0/-14)
qtiplot/src/analysis/nrutil.h (+0/-2)
qtiplot/src/core/ApplicationWindow.cpp (+0/-17557)
qtiplot/src/core/ApplicationWindow.h (+0/-1411)
qtiplot/src/core/ConfigDialog.cpp (+0/-2736)
qtiplot/src/core/ConfigDialog.h (+0/-232)
qtiplot/src/core/CustomActionDialog.cpp (+0/-787)
qtiplot/src/core/CustomActionDialog.h (+0/-135)
qtiplot/src/core/ExcelImport.cpp (+977/-0)
qtiplot/src/core/FindDialog.cpp (+0/-144)
qtiplot/src/core/FindDialog.h (+0/-75)
qtiplot/src/core/Folder.cpp (+0/-495)
qtiplot/src/core/Folder.h (+0/-226)
qtiplot/src/core/ImportASCIIDialog.cpp (+0/-811)
qtiplot/src/core/ImportASCIIDialog.h (+0/-189)
qtiplot/src/core/MdiSubWindow.cpp (+0/-344)
qtiplot/src/core/MdiSubWindow.h (+0/-205)
qtiplot/src/core/MultiPeakFitTool.cpp (+0/-150)
qtiplot/src/core/MultiPeakFitTool.h (+0/-74)
qtiplot/src/core/OdsFileHandler.cpp (+173/-0)
qtiplot/src/core/OdsFileHandler.h (+82/-0)
qtiplot/src/core/OpenProjectDialog.cpp (+0/-98)
qtiplot/src/core/OpenProjectDialog.h (+0/-53)
qtiplot/src/core/PlotWizard.cpp (+0/-400)
qtiplot/src/core/PlotWizard.h (+0/-126)
qtiplot/src/core/QtiPlotApplication.cpp (+124/-0)
qtiplot/src/core/QtiPlotApplication.h (+57/-0)
qtiplot/src/core/RenameWindowDialog.cpp (+0/-154)
qtiplot/src/core/RenameWindowDialog.h (+0/-75)
qtiplot/src/core/core.pri (+0/-31)
qtiplot/src/core/globals.h (+0/-41)
qtiplot/src/core/main.cpp (+0/-151)
qtiplot/src/lib/3rdparty/qtcolorpicker/LGPL_EXCEPTION.txt (+0/-10)
qtiplot/src/lib/3rdparty/qtcolorpicker/LICENSE.GPL3 (+0/-674)
qtiplot/src/lib/3rdparty/qtcolorpicker/LICENSE.LGPL (+0/-504)
qtiplot/src/lib/3rdparty/qtcolorpicker/README.TXT (+0/-7)
qtiplot/src/lib/3rdparty/qtcolorpicker/src/qtcolorpicker.cpp (+0/-1144)
qtiplot/src/lib/3rdparty/qtcolorpicker/src/qtcolorpicker.h (+0/-121)
qtiplot/src/lib/CHANGES.txt (+0/-14)
qtiplot/src/lib/INSTALL (+0/-37)
qtiplot/src/lib/README (+0/-25)
qtiplot/src/lib/doc/Doxyfile (+0/-236)
qtiplot/src/lib/doc/qti.dox (+0/-60)
qtiplot/src/lib/gpl-3.0.txt (+0/-674)
qtiplot/src/lib/include/ColorBox.h (+0/-73)
qtiplot/src/lib/include/ColorButton.h (+0/-58)
qtiplot/src/lib/include/ColorMapEditor.h (+0/-96)
qtiplot/src/lib/include/DoubleSpinBox.h (+0/-105)
qtiplot/src/lib/include/ExtensibleFileDialog.h (+0/-78)
qtiplot/src/lib/include/LineNumberDisplay.h (+0/-61)
qtiplot/src/lib/include/PatternBox.h (+0/-61)
qtiplot/src/lib/include/PenStyleBox.h (+0/-58)
qtiplot/src/lib/include/SymbolBox.h (+0/-63)
qtiplot/src/lib/include/SymbolDialog.h (+0/-106)
qtiplot/src/lib/include/TextFormatButtons.h (+0/-90)
qtiplot/src/lib/libqti.pri (+0/-37)
qtiplot/src/lib/qti.pro (+0/-50)
qtiplot/src/lib/src/ColorBox.cpp (+0/-160)
qtiplot/src/lib/src/ColorButton.cpp (+0/-43)
qtiplot/src/lib/src/ColorMapEditor.cpp (+0/-308)
qtiplot/src/lib/src/DoubleSpinBox.cpp (+0/-207)
qtiplot/src/lib/src/ExtensibleFileDialog.cpp (+0/-85)
qtiplot/src/lib/src/LineNumberDisplay.cpp (+0/-118)
qtiplot/src/lib/src/PatternBox.cpp (+0/-187)
qtiplot/src/lib/src/PenStyleBox.cpp (+0/-84)
qtiplot/src/lib/src/SymbolBox.cpp (+0/-182)
qtiplot/src/lib/src/SymbolDialog.cpp (+0/-678)
qtiplot/src/lib/src/TextFormatButtons.cpp (+0/-639)
qtiplot/src/matrix/ColorMapDialog.cpp (+0/-89)
qtiplot/src/matrix/ColorMapDialog.h (+0/-54)
qtiplot/src/matrix/Matrix.cpp (+129/-38)
qtiplot/src/matrix/Matrix.h (+5/-0)
qtiplot/src/matrix/MatrixModel.cpp (+3/-3)
qtiplot/src/matrix/MatrixValuesDialog.cpp (+38/-2)
qtiplot/src/matrix/MatrixValuesDialog.h (+7/-3)
qtiplot/src/matrix/matrix.pri (+0/-21)
qtiplot/src/origin/importOPJ.cpp (+0/-1873)
qtiplot/src/origin/importOPJ.h (+0/-69)
qtiplot/src/origin/origin.pri (+0/-17)
qtiplot/src/plot2D/ArrowMarker.cpp (+10/-7)
qtiplot/src/plot2D/BoxCurve.cpp (+3/-3)
qtiplot/src/plot2D/BoxCurve.h (+1/-1)
qtiplot/src/plot2D/CanvasPicker.cpp (+31/-18)
qtiplot/src/plot2D/DataPickerTool.cpp (+72/-42)
qtiplot/src/plot2D/DataPickerTool.h (+22/-3)
qtiplot/src/plot2D/EllipseWidget.cpp (+0/-140)
qtiplot/src/plot2D/EllipseWidget.h (+0/-50)
qtiplot/src/plot2D/FrameWidget.cpp (+17/-1)
qtiplot/src/plot2D/FrameWidget.h (+6/-1)
qtiplot/src/plot2D/FunctionCurve.cpp (+85/-37)
qtiplot/src/plot2D/FunctionCurve.h (+1/-1)
qtiplot/src/plot2D/Graph.cpp (+871/-578)
qtiplot/src/plot2D/Graph.h (+62/-32)
qtiplot/src/plot2D/Grid.cpp (+2/-2)
qtiplot/src/plot2D/ImageWidget.cpp (+43/-5)
qtiplot/src/plot2D/ImageWidget.h (+11/-1)
qtiplot/src/plot2D/LegendWidget.cpp (+79/-65)
qtiplot/src/plot2D/LineProfileTool.cpp (+41/-28)
qtiplot/src/plot2D/LineProfileTool.h (+1/-1)
qtiplot/src/plot2D/LnScaleEngine.cpp (+1/-1)
qtiplot/src/plot2D/LogitScaleEngine.cpp (+1/-1)
qtiplot/src/plot2D/MultiLayer.cpp (+434/-186)
qtiplot/src/plot2D/MultiLayer.h (+29/-11)
qtiplot/src/plot2D/MultiPeakFitTool.cpp (+29/-14)
qtiplot/src/plot2D/PlotCurve.cpp (+104/-40)
qtiplot/src/plot2D/PlotCurve.h (+11/-0)
qtiplot/src/plot2D/PlotToolInterface.h (+5/-2)
qtiplot/src/plot2D/ProbabilityScaleEngine.cpp (+1/-1)
qtiplot/src/plot2D/QwtBarCurve.cpp (+8/-7)
qtiplot/src/plot2D/QwtErrorPlotCurve.cpp (+15/-9)
qtiplot/src/plot2D/QwtHistogram.cpp (+4/-1)
qtiplot/src/plot2D/QwtPieCurve.cpp (+17/-8)
qtiplot/src/plot2D/QwtPieCurve.h (+1/-0)
qtiplot/src/plot2D/RangeSelectorTool.cpp (+3/-4)
qtiplot/src/plot2D/RangeSelectorTool.h (+2/-0)
qtiplot/src/plot2D/RectangleWidget.cpp (+2/-0)
qtiplot/src/plot2D/ScaleDraw.cpp (+203/-169)
qtiplot/src/plot2D/ScaleDraw.h (+18/-4)
qtiplot/src/plot2D/ScaleEngine.cpp (+15/-7)
qtiplot/src/plot2D/ScalePicker.cpp (+13/-13)
qtiplot/src/plot2D/ScreenPickerTool.cpp (+216/-5)
qtiplot/src/plot2D/ScreenPickerTool.h (+42/-1)
qtiplot/src/plot2D/SelectionMoveResizer.cpp (+29/-6)
qtiplot/src/plot2D/SelectionMoveResizer.h (+1/-0)
qtiplot/src/plot2D/Spectrogram.cpp (+75/-45)
qtiplot/src/plot2D/Spectrogram.h (+5/-0)
qtiplot/src/plot2D/SubtractLineTool.cpp (+122/-0)
qtiplot/src/plot2D/SubtractLineTool.h (+69/-0)
qtiplot/src/plot2D/TexWidget.cpp (+4/-0)
qtiplot/src/plot2D/TranslateCurveTool.cpp (+0/-1)
qtiplot/src/plot2D/VectorCurve.cpp (+1/-1)
qtiplot/src/plot2D/cursors.h (+0/-142)
qtiplot/src/plot2D/dialogs/AxesDialog.cpp (+167/-89)
qtiplot/src/plot2D/dialogs/AxesDialog.h (+11/-6)
qtiplot/src/plot2D/dialogs/ContourLinesEditor.cpp (+0/-412)
qtiplot/src/plot2D/dialogs/ContourLinesEditor.h (+0/-102)
qtiplot/src/plot2D/dialogs/CurvesDialog.cpp (+55/-47)
qtiplot/src/plot2D/dialogs/EnrichmentDialog.cpp (+22/-41)
qtiplot/src/plot2D/dialogs/ErrDialog.cpp (+1/-2)
qtiplot/src/plot2D/dialogs/FunctionDialog.cpp (+494/-271)
qtiplot/src/plot2D/dialogs/FunctionDialog.h (+33/-21)
qtiplot/src/plot2D/dialogs/ImageExportDialog.cpp (+38/-4)
qtiplot/src/plot2D/dialogs/ImageExportDialog.h (+3/-0)
qtiplot/src/plot2D/dialogs/LayerDialog.cpp (+374/-108)
qtiplot/src/plot2D/dialogs/LayerDialog.h (+27/-3)
qtiplot/src/plot2D/dialogs/PlotDialog.cpp (+478/-124)
qtiplot/src/plot2D/dialogs/PlotDialog.h (+28/-118)
qtiplot/src/plot2D/dialogs/TextDialog.cpp (+29/-6)
qtiplot/src/plot2D/dialogs/TextEditor.cpp (+36/-5)
qtiplot/src/plot2D/plot2D.pri (+0/-114)
qtiplot/src/plot3D/Bar.cpp (+52/-46)
qtiplot/src/plot3D/ColorMapPreviewDialog.cpp (+0/-95)
qtiplot/src/plot3D/ColorMapPreviewDialog.h (+0/-49)
qtiplot/src/plot3D/Cone3D.cpp (+1/-0)
qtiplot/src/plot3D/Graph3D.cpp (+536/-324)
qtiplot/src/plot3D/Graph3D.h (+27/-9)
qtiplot/src/plot3D/Plot3DDialog.cpp (+87/-60)
qtiplot/src/plot3D/Plot3DDialog.h (+5/-4)
qtiplot/src/plot3D/SurfaceDialog.cpp (+174/-96)
qtiplot/src/plot3D/SurfaceDialog.h (+15/-9)
qtiplot/src/plot3D/plot3D.pri (+0/-19)
qtiplot/src/scripting/FindReplaceDialog.cpp (+0/-215)
qtiplot/src/scripting/FindReplaceDialog.h (+0/-73)
qtiplot/src/scripting/MyParser.cpp (+0/-143)
qtiplot/src/scripting/MyParser.h (+0/-61)
qtiplot/src/scripting/Note.cpp (+0/-415)
qtiplot/src/scripting/Note.h (+0/-105)
qtiplot/src/scripting/PythonScript.cpp (+0/-300)
qtiplot/src/scripting/PythonScript.h (+0/-70)
qtiplot/src/scripting/PythonScripting.cpp (+0/-409)
qtiplot/src/scripting/PythonScripting.h (+0/-103)
qtiplot/src/scripting/PythonSyntaxHighlighter.cpp (+0/-189)
qtiplot/src/scripting/PythonSyntaxHighlighter.h (+0/-89)
qtiplot/src/scripting/Script.cpp (+0/-113)
qtiplot/src/scripting/Script.h (+0/-163)
qtiplot/src/scripting/ScriptEdit.cpp (+0/-819)
qtiplot/src/scripting/ScriptEdit.h (+0/-171)
qtiplot/src/scripting/ScriptWindow.cpp (+0/-482)
qtiplot/src/scripting/ScriptWindow.h (+0/-107)
qtiplot/src/scripting/ScriptingEnv.cpp (+0/-70)
qtiplot/src/scripting/ScriptingEnv.h (+0/-115)
qtiplot/src/scripting/ScriptingLangDialog.cpp (+0/-81)
qtiplot/src/scripting/ScriptingLangDialog.h (+0/-59)
qtiplot/src/scripting/customevents.h (+0/-40)
qtiplot/src/scripting/muParserScript.cpp (+0/-478)
qtiplot/src/scripting/muParserScript.h (+0/-85)
qtiplot/src/scripting/muParserScripting.cpp (+0/-108)
qtiplot/src/scripting/muParserScripting.h (+0/-134)
qtiplot/src/scripting/qti.sip (+0/-2824)
qtiplot/src/scripting/scripting.pri (+0/-117)
qtiplot/src/table/ExportDialog.cpp (+0/-296)
qtiplot/src/table/ExportDialog.h (+0/-100)
qtiplot/src/table/ExtractDataDialog.cpp (+229/-0)
qtiplot/src/table/ExtractDataDialog.h (+88/-0)
qtiplot/src/table/SetColValuesDialog.cpp (+0/-292)
qtiplot/src/table/SetColValuesDialog.h (+0/-96)
qtiplot/src/table/SortDialog.cpp (+0/-102)
qtiplot/src/table/SortDialog.h (+0/-62)
qtiplot/src/table/Table.cpp (+0/-3412)
qtiplot/src/table/Table.h (+0/-365)
qtiplot/src/table/TableDialog.cpp (+0/-576)
qtiplot/src/table/TableDialog.h (+0/-96)
qtiplot/src/table/TableStatistics.cpp (+0/-344)
qtiplot/src/table/TableStatistics.h (+0/-74)
qtiplot/src/table/table.pri (+0/-19)
qtiplot/translations/qtiplot_cn.ts (+0/-18144)
qtiplot/translations/qtiplot_cz.ts (+11250/-15644)
qtiplot/translations/qtiplot_de.ts (+4481/-5306)
qtiplot/translations/qtiplot_es.ts (+4281/-6212)
qtiplot/translations/qtiplot_fr.ts (+2405/-14681)
qtiplot/translations/qtiplot_ja.ts (+3281/-6806)
qtiplot/translations/qtiplot_ro.ts (+0/-18434)
qtiplot/translations/qtiplot_ru.ts (+1340/-4748)
qtiplot/translations/qtiplot_sv.ts (+4506/-5308)
To merge this branch: bzr merge lp:~valavanisalex/ubuntu/maverick/qtiplot/qtiplot-fix-605027-merge0.9.8-1
Reviewer Review Type Date Requested Status
Ubuntu Sponsors Pending
Review via email: mp+31287@code.launchpad.net
To post a comment you must log in.

Unmerged revisions

18. By Alex Valavanis

Removed debian-changes-0.9.8-1: Unnecessary

17. By Alex Valavanis

* Merge with Debian unstable (LP: #605027)
* debian/control: Fix Qt 4.7 compatibility (LP: #598826)
  + Build-Depends: libqtassistantclient-dev
  + Recommends: qt-assistant-compat
* Rm debian/patches/debian-changes-0.9.8-1: Maverick has Python 2.6
* New upstream release
* Bump standards version to 3.9.0
* Change python version to 2.6
* New upstream release
* Build QTeXEngine into program
* Bump liborigin2 dependency to >=1:06042009+svn1724
* Bump muparser dependency to 1.32
* New upstream release
* Switch to dpkg-source 3.0 (quilt) format
* Minor fix to patch 01_build_system.diff
* Add qwtplot3d to build.conf
* Bump standards version to 3.8.4
* Fix spelling errors in description
* Add misc depends in qtiplot-doc
* Remove patch 02_docbook_stylesheet and
  04_add_includes.diff
* Rename 03_fix_qti_wordlist.txt_path to
  02_fix_paths.diff

16. By Alex Valavanis

Merging shared upstream rev into target branch.

15. By Alex Valavanis

Merging shared upstream rev into target branch.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== added directory '.pc'
2=== added file '.pc/.version'
3--- .pc/.version 1970-01-01 00:00:00 +0000
4+++ .pc/.version 2010-07-29 13:54:48 +0000
5@@ -0,0 +1,1 @@
6+2
7
8=== added directory '.pc/01_build_system.diff'
9=== added directory '.pc/01_build_system.diff/qtiplot'
10=== added file '.pc/01_build_system.diff/qtiplot.pro'
11--- .pc/01_build_system.diff/qtiplot.pro 1970-01-01 00:00:00 +0000
12+++ .pc/01_build_system.diff/qtiplot.pro 2010-07-29 13:54:48 +0000
13@@ -0,0 +1,7 @@
14+TEMPLATE = subdirs
15+
16+SUBDIRS = fitPlugins \
17+ manual \
18+ 3rdparty/qwt \
19+ 3rdparty/qwtplot3d \
20+ qtiplot
21
22=== added file '.pc/01_build_system.diff/qtiplot/qtiplot.pro'
23--- .pc/01_build_system.diff/qtiplot/qtiplot.pro 1970-01-01 00:00:00 +0000
24+++ .pc/01_build_system.diff/qtiplot/qtiplot.pro 2010-07-29 13:54:48 +0000
25@@ -0,0 +1,248 @@
26+TARGET = qtiplot
27+QTI_ROOT = ..
28+!include( $$QTI_ROOT/build.conf ) {
29+ message( "You need a build.conf file with local settings!" )
30+}
31+
32+##################### 3rd PARTY HEADER FILES SECTION ########################
33+#!!! Warning: You must set this up in $$QTIROOT/build.conf
34+#############################################################################
35+
36+# local copy included
37+INCLUDEPATH += ../3rdparty/zlib
38+INCLUDEPATH += ../3rdparty/QTeXEngine/src
39+
40+# configurable
41+INCLUDEPATH += $$MUPARSER_INCLUDEPATH
42+INCLUDEPATH += $$QWT_INCLUDEPATH
43+INCLUDEPATH += $$QWT3D_INCLUDEPATH
44+INCLUDEPATH += $$GSL_INCLUDEPATH
45+
46+# configurable libs
47+LIBS += $$MUPARSER_LIBS
48+LIBS += $$QWT_LIBS
49+LIBS += $$QWT3D_LIBS
50+LIBS += $$GSL_LIBS
51+
52+#############################################################################
53+###################### BASIC PROJECT PROPERTIES #############################
54+#############################################################################
55+
56+QMAKE_PROJECT_DEPTH = 0
57+
58+!contains(CONFIG, BrowserPlugin){
59+ TEMPLATE = app
60+}
61+
62+CONFIG += qt warn_on exceptions opengl thread
63+CONFIG += assistant
64+
65+DEFINES += QT_PLUGIN
66+contains(CONFIG, CustomInstall){
67+ INSTALLS += target
68+ INSTALLS += translations
69+ INSTALLS += manual
70+ INSTALLS += documentation
71+ unix:INSTALLS += man
72+
73+ unix: INSTALLBASE = /usr
74+ win32: INSTALLBASE = C:/QtiPlot
75+
76+ unix: target.path = $$INSTALLBASE/bin
77+ unix: translations.path = $$INSTALLBASE/share/qtiplot/translations
78+ unix: manual.path = $$INSTALLBASE/share/doc/qtiplot/manual
79+ unix: documentation.path = $$INSTALLBASE/share/doc/qtiplot
80+ unix: man.path = $$INSTALLBASE/share/man/man1/
81+
82+ win32: target.path = $$INSTALLBASE
83+ win32: translations.path = $$INSTALLBASE/translations
84+ win32: manual.path = $$INSTALLBASE/manual
85+ win32: documentation.path = $$INSTALLBASE/doc
86+
87+ DEFINES += TRANSLATIONS_PATH="\\\"$$replace(translations.path," ","\ ")\\\"
88+ DEFINES += MANUAL_PATH="\\\"$$replace(manual.path," ","\ ")\\\"
89+ }
90+
91+win32:DEFINES += QT_DLL QT_THREAD_SUPPORT
92+QT += opengl qt3support network svg xml
93+
94+MOC_DIR = ../tmp/qtiplot
95+OBJECTS_DIR = ../tmp/qtiplot
96+SIP_DIR = ../tmp/qtiplot
97+DESTDIR = ./
98+
99+#############################################################################
100+###################### PROJECT FILES SECTION ################################
101+#############################################################################
102+
103+###################### ICONS ################################################
104+INCLUDEPATH += icons/
105+win32:RC_FILE = icons/qtiplot.rc
106+mac:RC_FILE = icons/qtiplot.icns
107+RESOURCES = ../manual/html/icons/icons.qrc
108+
109+###################### TRANSLATIONS #########################################
110+
111+TRANSLATIONS = translations/qtiplot_cn.ts \
112+ translations/qtiplot_cz.ts \
113+ translations/qtiplot_de.ts \
114+ translations/qtiplot_es.ts \
115+ translations/qtiplot_fr.ts \
116+ #translations/qtiplot_pt.ts \
117+ translations/qtiplot_ro.ts \
118+ translations/qtiplot_ru.ts \
119+ translations/qtiplot_ja.ts \
120+ translations/qtiplot_sv.ts
121+
122+translations.files += translations/qtiplot_cn.qm \
123+ translations/qtiplot_cz.qm \
124+ translations/qtiplot_de.qm \
125+ translations/qtiplot_es.qm \
126+ translations/qtiplot_fr.qm \
127+ #translations/qtiplot_pt.qm \
128+ translations/qtiplot_ro.qm \
129+ translations/qtiplot_ru.qm \
130+ translations/qtiplot_ja.qm \
131+ translations/qtiplot_sv.qm
132+
133+isEmpty(LUPDATE): LUPDATE = lupdate
134+#system($$LUPDATE -verbose qtiplot.pro)
135+isEmpty(LRELEASE): LRELEASE = lrelease
136+#system($$LRELEASE -verbose qtiplot.pro)
137+
138+###################### DOCUMENTATION ########################################
139+
140+manual.files += ../manual/html \
141+ ../manual/qtiplot-manual-en.pdf
142+
143+documentation.files += ../README.html \
144+ ../gpl_licence.txt
145+
146+unix: man.files += ../qtiplot.1
147+
148+###############################################################
149+##################### Compression (zlib-1.2.3) ################
150+###############################################################
151+
152+SOURCES += ../3rdparty/zlib/minigzip.c
153+
154+###############################################################
155+################# Default Modules #############################
156+###############################################################
157+
158+include(src/analysis/analysis.pri)
159+include(src/core/core.pri)
160+include(src/lib/libqti.pri)
161+include(src/plot2D/plot2D.pri)
162+include(src/plot3D/plot3D.pri)
163+include(src/matrix/matrix.pri)
164+include(src/table/table.pri)
165+include(src/scripting/scripting.pri)
166+
167+###############################################################
168+##################### TeX export: QTeXEngine ##################
169+###############################################################
170+
171+INCLUDEPATH += ../3rdparty/QTeXEngine/src
172+HEADERS += ../3rdparty/QTeXEngine/src/QTeXEngine.h
173+SOURCES += ../3rdparty/QTeXEngine/src/QTeXPaintEngine.cpp
174+SOURCES += ../3rdparty/QTeXEngine/src/QTeXPaintDevice.cpp
175+
176+###############################################################
177+##################### Scripting: PYTHON + SIP + PyQT ##########
178+###############################################################
179+
180+contains(SCRIPTING_LANGS, Python) {
181+ contains(CONFIG, CustomInstall){
182+ INSTALLS += pythonconfig
183+ pythonconfig.files += qtiplotrc.py \
184+ qtiUtil.py \
185+ qti_wordlist.txt \
186+
187+ unix: pythonconfig.path = /usr/local/qtiplot
188+ win32: pythonconfig.path = $$INSTALLBASE
189+ DEFINES += PYTHON_CONFIG_PATH="\\\"$$replace(pythonconfig.path," ","\ ")\\\"
190+ }
191+
192+ unix {
193+ isEmpty(PYTHON): PYTHON = python
194+ INCLUDEPATH += $$system($$PYTHON python-includepath.py)
195+ LIBS += $$system($$PYTHON -c "\"from distutils import sysconfig; print '-lpython'+sysconfig.get_config_var('VERSION')\"")
196+ LIBS += -lm
197+ system(mkdir -p $${SIP_DIR})
198+ system($$system($$PYTHON python-sipcmd.py) -c $${SIP_DIR} src/scripting/qti.sip)
199+ }
200+
201+ win32 {
202+ INCLUDEPATH += $$system(call python-includepath.py)
203+ LIBS += $$system(call python-libs-win.py)
204+ system($$system(call python-sipcmd.py) -c $${SIP_DIR} src/scripting/qti.sip)
205+ }
206+}
207+
208+###############################################################
209+
210+# check if we have libpng
211+!isEmpty(LIBPNG_LIBS) {
212+ DEFINES += GL2PS_HAVE_LIBPNG
213+ INCLUDEPATH += $$LIBPNG_INCLUDEPATH
214+ LIBS += $$LIBPNG_LIBS
215+}
216+
217+###############################################################
218+
219+# check if we have EmfEnginge
220+!isEmpty(EMF_ENGINE_LIBS) {
221+ DEFINES += EMF_OUTPUT
222+ INCLUDEPATH += $$EMF_ENGINE_INCLUDEPATH
223+ LIBS += $$EMF_ENGINE_LIBS
224+ win32:LIBS += -lgdiplus
225+ unix:LIBS += -lEMF
226+}
227+
228+# check if we have libxls
229+!isEmpty(XLS_LIBS) {
230+ DEFINES += XLS_IMPORT
231+ INCLUDEPATH += $$XLS_INCLUDEPATH
232+ LIBS += $$XLS_LIBS
233+}
234+
235+# check if we have QuaZIP
236+!isEmpty(QUAZIP_LIBS) {
237+ DEFINES += ODS_IMPORT
238+ INCLUDEPATH += $$QUAZIP_INCLUDEPATH
239+ LIBS += $$QUAZIP_LIBS
240+}
241+
242+# check if we have liborigin2
243+!isEmpty(BOOST_LIBS) {
244+ DEFINES += OPJ_IMPORT
245+ INCLUDEPATH += $$BOOST_INCLUDEPATH
246+ INCLUDEPATH += ../3rdparty/liborigin
247+ LIBS += $$BOOST_LIBS
248+ include(src/origin/origin.pri)
249+}
250+
251+# check if support for Microsoft Excel should be enabled
252+win32: contains(CONFIG, Excel) {
253+ CONFIG += qaxcontainer
254+ DEFINES += HAS_EXCEL
255+ SOURCES += src/core/ExcelImport.cpp
256+}
257+
258+###############################################################
259+
260+# At the very end: add global include- and lib path
261+unix:INCLUDEPATH += $$SYS_INCLUDEPATH
262+unix:LIBS += $$SYS_LIBS
263+
264+###############################################################
265+############### Building QtiPlot as a browser plugin ##########
266+###############################################################
267+
268+contains(CONFIG, BrowserPlugin){
269+ DEFINES += BROWSER_PLUGIN
270+ win32: CONFIG += qaxserver
271+ RC_FILE = qtiplot.rc
272+ include(../3rdparty/QtSolutions/qtbrowserplugin/src/qtbrowserplugin.pri)
273+}
274
275=== added directory '.pc/01_build_system.diff/qtiplot/src'
276=== added directory '.pc/01_build_system.diff/qtiplot/src/origin'
277=== added file '.pc/01_build_system.diff/qtiplot/src/origin/origin.pri'
278--- .pc/01_build_system.diff/qtiplot/src/origin/origin.pri 1970-01-01 00:00:00 +0000
279+++ .pc/01_build_system.diff/qtiplot/src/origin/origin.pri 2010-07-29 13:54:48 +0000
280@@ -0,0 +1,27 @@
281+###############################################################
282+################# Origin Import (liborigin) ###################
283+###############################################################
284+INCLUDEPATH += src/origin/
285+
286+HEADERS += src/origin/importOPJ.h
287+HEADERS += ../3rdparty/liborigin/OriginObj.h
288+HEADERS += ../3rdparty/liborigin/OriginFile.h
289+HEADERS += ../3rdparty/liborigin/OriginParser.h
290+HEADERS += ../3rdparty/liborigin/OriginDefaultParser.h
291+HEADERS += ../3rdparty/liborigin/Origin600Parser.h
292+HEADERS += ../3rdparty/liborigin/Origin610Parser.h
293+HEADERS += ../3rdparty/liborigin/Origin700Parser.h
294+HEADERS += ../3rdparty/liborigin/Origin750Parser.h
295+HEADERS += ../3rdparty/liborigin/Origin800Parser.h
296+HEADERS += ../3rdparty/liborigin/Origin810Parser.h
297+
298+SOURCES += src/origin/importOPJ.cpp
299+SOURCES += ../3rdparty/liborigin/OriginFile.cpp
300+SOURCES += ../3rdparty/liborigin/OriginParser.cpp
301+SOURCES += ../3rdparty/liborigin/OriginDefaultParser.cpp
302+SOURCES += ../3rdparty/liborigin/Origin600Parser.cpp
303+SOURCES += ../3rdparty/liborigin/Origin610Parser.cpp
304+SOURCES += ../3rdparty/liborigin/Origin700Parser.cpp
305+SOURCES += ../3rdparty/liborigin/Origin750Parser.cpp
306+SOURCES += ../3rdparty/liborigin/Origin800Parser.cpp
307+SOURCES += ../3rdparty/liborigin/Origin810Parser.cpp
308
309=== added directory '.pc/02_fix_paths.diff'
310=== added directory '.pc/02_fix_paths.diff/qtiplot'
311=== added directory '.pc/02_fix_paths.diff/qtiplot/src'
312=== added directory '.pc/02_fix_paths.diff/qtiplot/src/core'
313=== added file '.pc/02_fix_paths.diff/qtiplot/src/core/ApplicationWindow.cpp'
314--- .pc/02_fix_paths.diff/qtiplot/src/core/ApplicationWindow.cpp 1970-01-01 00:00:00 +0000
315+++ .pc/02_fix_paths.diff/qtiplot/src/core/ApplicationWindow.cpp 2010-07-29 13:54:48 +0000
316@@ -0,0 +1,18713 @@
317+/***************************************************************************
318+ File : ApplicationWindow.cpp
319+ Project : QtiPlot
320+--------------------------------------------------------------------
321+ Copyright : (C) 2004 - 2010 by Ion Vasilief,
322+ (C) 2006 - June 2007 Tilman Hoener zu Siederdissen, Knut Franke
323+ Email (use @ for *) : ion_vasilief*yahoo.fr
324+ Description : QtiPlot's main window
325+
326+ ***************************************************************************/
327+
328+/***************************************************************************
329+ * *
330+ * This program is free software; you can redistribute it and/or modify *
331+ * it under the terms of the GNU General Public License as published by *
332+ * the Free Software Foundation; either version 2 of the License, or *
333+ * (at your option) any later version. *
334+ * *
335+ * This program is distributed in the hope that it will be useful, *
336+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
337+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
338+ * GNU General Public License for more details. *
339+ * *
340+ * You should have received a copy of the GNU General Public License *
341+ * along with this program; if not, write to the Free Software *
342+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, *
343+ * Boston, MA 02110-1301 USA *
344+ * *
345+ ***************************************************************************/
346+#include "globals.h"
347+#include "ApplicationWindow.h"
348+#include <QtiPlotApplication.h>
349+
350+#include "PlotWizard.h"
351+#include "ConfigDialog.h"
352+#include "RenameWindowDialog.h"
353+#include "ImportASCIIDialog.h"
354+#include "Folder.h"
355+#include "FindDialog.h"
356+#include "OpenProjectDialog.h"
357+#include "CustomActionDialog.h"
358+#include "MdiSubWindow.h"
359+
360+#include <SelectionMoveResizer.h>
361+#include <SymbolBox.h>
362+#include <ColorBox.h>
363+#include <PenStyleBox.h>
364+#include <PatternBox.h>
365+#include <SymbolDialog.h>
366+#include <ExportDialog.h>
367+#include <SetColValuesDialog.h>
368+#include <ExtractDataDialog.h>
369+#include <TableDialog.h>
370+#include <TableStatistics.h>
371+#include <Fit.h>
372+#include <MultiPeakFit.h>
373+#include <PolynomialFit.h>
374+#include <SigmoidalFit.h>
375+#include <LogisticFit.h>
376+#include <NonLinearFit.h>
377+#include <Integration.h>
378+#include <Differentiation.h>
379+#include <SmoothFilter.h>
380+#include <FFTFilter.h>
381+#include <Convolution.h>
382+#include <Correlation.h>
383+#include <ExpDecayDialog.h>
384+#include <PolynomFitDialog.h>
385+#include <FitDialog.h>
386+#include <IntDialog.h>
387+#include <InterpolationDialog.h>
388+#include <SmoothCurveDialog.h>
389+#include <FilterDialog.h>
390+#include <FFTDialog.h>
391+#include <FrequencyCountDialog.h>
392+#include <SubtractDataDialog.h>
393+#include <BaselineDialog.h>
394+#include <QwtErrorPlotCurve.h>
395+#include <LegendWidget.h>
396+#include <TexWidget.h>
397+#include <ArrowMarker.h>
398+#include <ImageWidget.h>
399+#include <Grid.h>
400+#include <ScaleDraw.h>
401+#include <ScaleEngine.h>
402+#include <QwtHistogram.h>
403+#include <FunctionCurve.h>
404+#include <QwtPieCurve.h>
405+#include <EllipseWidget.h>
406+#include <RectangleWidget.h>
407+#include <Spectrogram.h>
408+#include <EnrichmentDialog.h>
409+#include <TextEditor.h>
410+#include <CurvesDialog.h>
411+#include <PlotDialog.h>
412+#include <AxesDialog.h>
413+#include <LineDialog.h>
414+#include <ErrDialog.h>
415+#include <FunctionDialog.h>
416+#include <AssociationsDialog.h>
417+#include <ImageExportDialog.h>
418+#include <CurveRangeDialog.h>
419+#include <LayerDialog.h>
420+#include <TextDialog.h>
421+// TODO: move tool-specific code to an extension manager
422+#include <ScreenPickerTool.h>
423+#include <DataPickerTool.h>
424+#include <MultiPeakFitTool.h>
425+#include <LineProfileTool.h>
426+#include <RangeSelectorTool.h>
427+#include <PlotToolInterface.h>
428+#include <SubtractLineTool.h>
429+#include <AddWidgetTool.h>
430+#include <SurfaceDialog.h>
431+#include <Graph3D.h>
432+#include <Plot3DDialog.h>
433+#include <ColorMapDialog.h>
434+#include <MatrixDialog.h>
435+#include <MatrixSizeDialog.h>
436+#include <MatrixValuesDialog.h>
437+#include <MatrixModel.h>
438+#include <MatrixCommand.h>
439+#include <Note.h>
440+#include <ScriptingLangDialog.h>
441+#include <ScriptWindow.h>
442+#include <PythonSyntaxHighlighter.h>
443+#include <CreateBinMatrixDialog.h>
444+#include <QTextDocumentWriter>
445+#include <QToolButton>
446+
447+#include <stdio.h>
448+#include <stdlib.h>
449+#include <math.h>
450+
451+#include <fstream>
452+#include <iostream>
453+#include <string>
454+using namespace std;
455+
456+#include <qwt_scale_engine.h>
457+#include <qwt_scale_widget.h>
458+#include <qwt_plot_magnifier.h>
459+#include <qwt_symbol.h>
460+
461+#include <QFileDialog>
462+#include <QInputDialog>
463+#include <QProgressDialog>
464+#include <QPrintDialog>
465+#include <QPrintPreviewDialog>
466+#include <QPixmapCache>
467+#include <QMenuBar>
468+#include <QClipboard>
469+#include <QTranslator>
470+#include <QSplitter>
471+#include <QSettings>
472+#include <QApplication>
473+#include <QMessageBox>
474+#include <QPrinter>
475+#include <QActionGroup>
476+#include <QAction>
477+#include <QToolBar>
478+#include <QKeySequence>
479+#include <QImageReader>
480+#include <QImageWriter>
481+#include <QDateTime>
482+#include <QShortcut>
483+#include <QDockWidget>
484+#include <QTextStream>
485+#include <QVarLengthArray>
486+#include <QList>
487+#include <QUrl>
488+#include <QAssistantClient>
489+#include <QFontComboBox>
490+#include <QSpinBox>
491+#include <QMdiArea>
492+#include <QMdiSubWindow>
493+#include <QUndoStack>
494+#include <QUndoView>
495+#include <QCompleter>
496+#include <QStringListModel>
497+#include <QNetworkProxy>
498+
499+#include <zlib.h>
500+#include <iostream>
501+
502+#include <gsl/gsl_statistics.h>
503+#include <gsl/gsl_sort.h>
504+
505+#ifdef XLS_IMPORT
506+ #include <ExcelFormat.h>
507+ #include <BasicExcel.hpp>
508+ using namespace ExcelFormat;
509+#endif
510+
511+#ifdef ODS_IMPORT
512+ #include <QTemporaryFile>
513+ #include <OdsFileHandler.h>
514+ #include <quazip.h>
515+ #include <quazipfile.h>
516+#endif
517+
518+#ifdef OPJ_IMPORT
519+ #include "importOPJ.h"
520+#endif
521+
522+using namespace Qwt3D;
523+
524+extern "C"
525+{
526+void file_compress(char *file, char *mode);
527+void file_uncompress(char *file);
528+}
529+
530+ApplicationWindow::ApplicationWindow(bool factorySettings)
531+: QMainWindow(), scripted(ScriptingLangManager::newEnv(this))
532+{
533+ setAttribute(Qt::WA_DeleteOnClose);
534+ init(factorySettings);
535+ ((QtiPlotApplication *)QCoreApplication::instance ())->append(this);
536+}
537+
538+void ApplicationWindow::init(bool factorySettings)
539+{
540+ setWindowTitle(tr("QtiPlot - untitled"));
541+ setObjectName(tr("QtiPlot"));
542+ initGlobalConstants();
543+ QPixmapCache::setCacheLimit(20*QPixmapCache::cacheLimit ());
544+
545+ tablesDepend = new QMenu(this);
546+
547+ explorerWindow = new QDockWidget( this );
548+ explorerWindow->setWindowTitle(tr("Project Explorer"));
549+ explorerWindow->setObjectName("explorerWindow"); // this is needed for QMainWindow::restoreState()
550+ explorerWindow->setMinimumHeight(150);
551+ addDockWidget( Qt::BottomDockWidgetArea, explorerWindow );
552+
553+ actionSaveProject = NULL;
554+ folders = new FolderListView(this);
555+ folders->header()->setClickEnabled( false );
556+ folders->addColumn( tr("Folder") );
557+ folders->setRootIsDecorated( true );
558+ folders->setResizeMode(Q3ListView::LastColumn);
559+ folders->header()->hide();
560+ folders->setSelectionMode(Q3ListView::Single);
561+
562+ connect(folders, SIGNAL(currentChanged(Q3ListViewItem *)),
563+ this, SLOT(folderItemChanged(Q3ListViewItem *)));
564+ connect(folders, SIGNAL(itemRenamed(Q3ListViewItem *, int, const QString &)),
565+ this, SLOT(renameFolder(Q3ListViewItem *, int, const QString &)));
566+ connect(folders, SIGNAL(contextMenuRequested(Q3ListViewItem *, const QPoint &, int)),
567+ this, SLOT(showFolderPopupMenu(Q3ListViewItem *, const QPoint &, int)));
568+ connect(folders, SIGNAL(dragItems(QList<Q3ListViewItem *>)),
569+ this, SLOT(dragFolderItems(QList<Q3ListViewItem *>)));
570+ connect(folders, SIGNAL(dropItems(Q3ListViewItem *)),
571+ this, SLOT(dropFolderItems(Q3ListViewItem *)));
572+ connect(folders, SIGNAL(renameItem(Q3ListViewItem *)),
573+ this, SLOT(startRenameFolder(Q3ListViewItem *)));
574+ connect(folders, SIGNAL(addFolderItem()), this, SLOT(addFolder()));
575+ connect(folders, SIGNAL(deleteSelection()), this, SLOT(deleteSelectedItems()));
576+
577+ current_folder = new Folder( 0, tr("UNTITLED"));
578+ FolderListItem *fli = new FolderListItem(folders, current_folder);
579+ current_folder->setFolderListItem(fli);
580+ fli->setOpen( true );
581+
582+ lv = new FolderListView();
583+ lv->addColumn (tr("Name"),-1 );
584+ lv->addColumn (tr("Type"),-1 );
585+ lv->addColumn (tr("View"),-1 );
586+ lv->addColumn (tr("Size"),-1 );
587+ lv->addColumn (tr("Created"),-1);
588+ lv->addColumn (tr("Label"),-1);
589+ lv->setResizeMode(Q3ListView::LastColumn);
590+ lv->setMinimumHeight(80);
591+ lv->setSelectionMode(Q3ListView::Extended);
592+ lv->setDefaultRenameAction (Q3ListView::Accept);
593+
594+ explorerSplitter = new QSplitter(Qt::Horizontal, explorerWindow);
595+ explorerSplitter->addWidget(folders);
596+ explorerSplitter->addWidget(lv);
597+ explorerWindow->setWidget(explorerSplitter);
598+
599+ QList<int> splitterSizes;
600+ explorerSplitter->setSizes( splitterSizes << 45 << 45);
601+ explorerWindow->hide();
602+
603+ logWindow = new QDockWidget(this);
604+ logWindow->setObjectName("logWindow"); // this is needed for QMainWindow::restoreState()
605+ logWindow->setWindowTitle(tr("Results Log"));
606+ addDockWidget( Qt::TopDockWidgetArea, logWindow );
607+
608+ results=new QTextEdit(logWindow);
609+ results->setReadOnly (true);
610+
611+ logWindow->setWidget(results);
612+ logWindow->hide();
613+
614+#ifdef SCRIPTING_CONSOLE
615+ consoleWindow = new QDockWidget(this);
616+ consoleWindow->setObjectName("consoleWindow"); // this is needed for QMainWindow::restoreState()
617+ consoleWindow->setWindowTitle(tr("Scripting Console"));
618+ addDockWidget( Qt::TopDockWidgetArea, consoleWindow );
619+ console = new QTextEdit(consoleWindow);
620+ console->setReadOnly(true);
621+ consoleWindow->setWidget(console);
622+ consoleWindow->hide();
623+#endif
624+
625+ undoStackWindow = new QDockWidget(this);
626+ undoStackWindow->setObjectName("undoStackWindow"); // this is needed for QMainWindow::restoreState()
627+ undoStackWindow->setWindowTitle(tr("Undo Stack"));
628+ addDockWidget(Qt::RightDockWidgetArea, undoStackWindow);
629+
630+ d_undo_view = new QUndoView(undoStackWindow);
631+ d_undo_view->setCleanIcon(QIcon(":/filesave.png"));
632+ undoStackWindow->setWidget(d_undo_view);
633+ undoStackWindow->hide();
634+
635+ // Needs to be done after initialization of dock windows,
636+ // because we now use QDockWidget::toggleViewAction()
637+ createActions();
638+ initToolBars();
639+ initMainMenu();
640+
641+ d_workspace = new QMdiArea();
642+ d_workspace->setOption(QMdiArea::DontMaximizeSubWindowOnActivation);
643+ d_workspace->setHorizontalScrollBarPolicy(Qt::ScrollBarAsNeeded);
644+ d_workspace->setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded);
645+ d_workspace->setActivationOrder(QMdiArea::ActivationHistoryOrder);
646+ setCentralWidget(d_workspace);
647+
648+ setAcceptDrops(true);
649+
650+ hiddenWindows = new QList<QWidget*>();
651+
652+ scriptWindow = 0;
653+ d_text_editor = NULL;
654+
655+ renamedTables = QStringList();
656+ if (!factorySettings)
657+ readSettings();
658+ createLanguagesList();
659+ insertTranslatedStrings();
660+ disableToolbars();
661+
662+ assistant = new QAssistantClient( QString(), this );
663+
664+ actionNextWindow = new QAction(QIcon(":/next.png"), tr("&Next","next window"), this);
665+ actionNextWindow->setShortcut( tr("F5","next window shortcut") );
666+ connect(actionNextWindow, SIGNAL(activated()), d_workspace, SLOT(activateNextSubWindow()));
667+
668+ actionPrevWindow = new QAction(QIcon(":/prev.png"), tr("&Previous","previous window"), this);
669+ actionPrevWindow->setShortcut( tr("F6","previous window shortcut") );
670+ connect(actionPrevWindow, SIGNAL(activated()), d_workspace, SLOT(activatePreviousSubWindow()));
671+
672+ connect(tablesDepend, SIGNAL(activated(int)), this, SLOT(showTable(int)));
673+
674+ connect(this, SIGNAL(modified()),this, SLOT(modifiedProject()));
675+ connect(d_workspace, SIGNAL(subWindowActivated(QMdiSubWindow *)),
676+ this, SLOT(windowActivated(QMdiSubWindow*)));
677+ connect(lv, SIGNAL(doubleClicked(Q3ListViewItem *)),
678+ this, SLOT(maximizeWindow(Q3ListViewItem *)));
679+ connect(lv, SIGNAL(doubleClicked(Q3ListViewItem *)),
680+ this, SLOT(folderItemDoubleClicked(Q3ListViewItem *)));
681+ connect(lv, SIGNAL(contextMenuRequested(Q3ListViewItem *, const QPoint &, int)),
682+ this, SLOT(showWindowPopupMenu(Q3ListViewItem *, const QPoint &, int)));
683+ connect(lv, SIGNAL(dragItems(QList<Q3ListViewItem *>)),
684+ this, SLOT(dragFolderItems(QList<Q3ListViewItem *>)));
685+ connect(lv, SIGNAL(dropItems(Q3ListViewItem *)),
686+ this, SLOT(dropFolderItems(Q3ListViewItem *)));
687+ connect(lv, SIGNAL(renameItem(Q3ListViewItem *)),
688+ this, SLOT(startRenameFolder(Q3ListViewItem *)));
689+ connect(lv, SIGNAL(addFolderItem()), this, SLOT(addFolder()));
690+ connect(lv, SIGNAL(deleteSelection()), this, SLOT(deleteSelectedItems()));
691+ connect(lv, SIGNAL(itemRenamed(Q3ListViewItem *, int, const QString &)),
692+ this, SLOT(renameWindow(Q3ListViewItem *, int, const QString &)));
693+
694+ connect(scriptEnv, SIGNAL(error(const QString&,const QString&,int)),
695+ this, SLOT(scriptError(const QString&,const QString&,int)));
696+ connect(scriptEnv, SIGNAL(print(const QString&)), this, SLOT(scriptPrint(const QString&)));
697+
698+ connect(recent, SIGNAL(activated(int)), this, SLOT(openRecentProject(int)));
699+ connect(explorerWindow, SIGNAL(dockLocationChanged (Qt::DockWidgetArea)), this, SLOT(updateExplorerWindowLayout(Qt::DockWidgetArea)));
700+
701+ // this has to be done after connecting scriptEnv
702+ scriptEnv->initialize();
703+
704+ //apply user settings
705+ updateAppFonts();
706+ setScriptingLanguage(defaultScriptingLang);
707+ setAppColors(workspaceColor, panelsColor, panelsTextColor, true);
708+
709+ loadCustomActions();
710+ initCompleter();
711+}
712+
713+void ApplicationWindow::updateExplorerWindowLayout(Qt::DockWidgetArea area)
714+{
715+ switch(area){
716+ case Qt::LeftDockWidgetArea:
717+ case Qt::RightDockWidgetArea:
718+ explorerSplitter->setOrientation(Qt::Vertical);
719+ break;
720+
721+ case Qt::TopDockWidgetArea:
722+ case Qt::BottomDockWidgetArea:
723+ case Qt::NoDockWidgetArea:
724+ explorerSplitter->setOrientation(Qt::Horizontal);
725+ break;
726+
727+ default:
728+ break;
729+ }
730+}
731+
732+void ApplicationWindow::initWindow()
733+{
734+ switch(d_init_window_type){
735+ case TableWindow:
736+ newTable();
737+ break;
738+ case MatrixWindow:
739+ newMatrix();
740+ break;
741+ case MultiLayerWindow:
742+ newGraph();
743+ break;
744+ case NoteWindow:
745+ newNote();
746+ break;
747+ default:
748+ break;
749+ }
750+ savedProject();
751+}
752+
753+void ApplicationWindow::initGlobalConstants()
754+{
755+ d_force_muParser = true;
756+ d_indexed_colors = ColorBox::defaultColors();
757+ d_indexed_color_names = ColorBox::defaultColorNames();
758+
759+ d_symbols_list = SymbolBox::defaultSymbols();
760+
761+ d_latex_compiler = MathTran;
762+ d_latex_compiler_path = QString::null;
763+ d_mdi_windows_area = true;
764+ d_open_project_filter = QString::null;//tr("QtiPlot project") + " (*.qti)";
765+
766+ d_comment_highlight_color = Qt::red;
767+ d_class_highlight_color = Qt::darkMagenta;
768+ d_numeric_highlight_color = Qt::darkGreen;
769+ d_keyword_highlight_color = Qt::darkBlue;
770+ d_function_highlight_color = Qt::blue;
771+ d_quotation_highlight_color = Qt::darkYellow;
772+
773+ d_notes_tab_length = 20;
774+ d_completer = NULL;
775+ d_completion = true;
776+ d_note_line_numbers = true;
777+
778+ d_auto_update_table_values = true;
779+ d_active_window = NULL;
780+ d_matrix_undo_stack_size = 10;
781+
782+ d_opening_file = false;
783+ d_is_appending_file = false;
784+ d_in_place_editing = true;
785+
786+ d_matrix_tool_bar = true;
787+ d_file_tool_bar = true;
788+ d_table_tool_bar = true;
789+ d_column_tool_bar = true;
790+ d_edit_tool_bar = true;
791+ d_notes_tool_bar = true;
792+ d_plot_tool_bar = true;
793+ d_plot3D_tool_bar = true;
794+ d_display_tool_bar = false;
795+ d_format_tool_bar = true;
796+
797+ appStyle = qApp->style()->objectName();
798+ d_app_rect = QRect();
799+ projectname = "untitled";
800+ lastCopiedLayer = 0;
801+ d_enrichement_copy = NULL;
802+ d_arrow_copy = NULL;
803+
804+ savingTimerId = 0;
805+
806+ autoSearchUpdatesRequest = false;
807+
808+ show_windows_policy = ActiveFolder;
809+ d_script_win_on_top = false;
810+ d_script_win_rect = QRect(0, 0, 500, 300);
811+ d_init_window_type = TableWindow;
812+
813+ QString aux = qApp->applicationDirPath();
814+ workingDir = aux;
815+
816+#ifdef TRANSLATIONS_PATH
817+ d_translations_folder = TRANSLATIONS_PATH;
818+#else
819+ d_translations_folder = aux + "/translations";
820+#endif
821+
822+#ifdef MANUAL_PATH
823+ helpFilePath = MANUAL_PATH;
824+ helpFilePath += "/index.html";
825+#else
826+ helpFilePath = aux + "/manual/index.html";
827+#endif
828+
829+#ifdef PYTHON_CONFIG_PATH
830+ d_python_config_folder = PYTHON_CONFIG_PATH;
831+#else
832+ d_python_config_folder = aux;
833+#endif
834+
835+ fitPluginsPath = aux + "fitPlugins";
836+ fitModelsPath = QString::null;
837+ templatesDir = aux;
838+ asciiDirPath = aux;
839+ imagesDirPath = aux;
840+ scriptsDirPath = aux;
841+ customActionsDirPath = QString::null;
842+
843+ appFont = QFont();
844+ d_notes_font = appFont;
845+
846+ QString family = appFont.family();
847+ int pointSize = appFont.pointSize();
848+ tableTextFont = appFont;
849+ tableHeaderFont = appFont;
850+ plotAxesFont = QFont(family, pointSize, QFont::Bold, false);
851+ plotNumbersFont = QFont(family, pointSize );
852+ plotLegendFont = appFont;
853+ plotTitleFont = QFont(family, pointSize + 2, QFont::Bold,false);
854+
855+ autoSearchUpdates = false;
856+ appLanguage = QLocale::system().name().section('_',0,0);
857+ show_windows_policy = ApplicationWindow::ActiveFolder;
858+
859+ workspaceColor = QColor("darkGray");
860+ panelsColor = QColor("#ffffff");
861+ panelsTextColor = QColor("#000000");
862+ tableBkgdColor = QColor("#ffffff");
863+ tableTextColor = QColor("#000000");
864+ tableHeaderColor = QColor("#000000");
865+
866+ d_graph_background_color = Qt::white;
867+ d_graph_canvas_color = Qt::white;
868+ d_graph_border_color = Qt::black;
869+ d_graph_background_opacity = 255;
870+ d_graph_canvas_opacity = 255;
871+ d_graph_border_width = 0;
872+ d_graph_tick_labels_dist = 4;
873+ d_graph_axes_labels_dist = 2;
874+
875+ autoSave = true;
876+ autoSaveTime = 15;
877+ d_backup_files = true;
878+
879+ defaultScriptingLang = "muParser";
880+/*#ifdef SCRIPTING_PYTHON
881+ defaultScriptingLang = "Python";
882+#endif*/
883+
884+ d_decimal_digits = 13;
885+ d_muparser_c_locale = true;
886+
887+ d_extended_open_dialog = true;
888+ d_extended_export_dialog = true;
889+ d_extended_import_ASCII_dialog = true;
890+ d_extended_plot_dialog = true;
891+
892+ d_add_curves_dialog_size = QSize(700, 400);
893+ d_show_current_folder = false;
894+
895+ d_confirm_overwrite = true;
896+ confirmCloseFolder = true;
897+ confirmCloseTable = true;
898+ confirmCloseMatrix = true;
899+ confirmClosePlot2D = true;
900+ confirmClosePlot3D = true;
901+ confirmCloseNotes = true;
902+ d_inform_rename_table = true;
903+
904+ d_show_table_comments = false;
905+
906+ titleOn = true;
907+ d_show_axes = QVector<bool> (QwtPlot::axisCnt, true);
908+ d_show_axes_labels = QVector<bool> (QwtPlot::axisCnt, true);
909+ canvasFrameWidth = 0;
910+ d_canvas_frame_color = Qt::black;
911+ defaultPlotMargin = 0;
912+ drawBackbones = true;
913+ axesLineWidth = 1;
914+ autoscale2DPlots = true;
915+ autoScaleFonts = true;
916+ autoResizeLayers = true;
917+ antialiasing2DPlots = false;
918+ d_scale_plots_on_print = false;
919+ d_print_cropmarks = false;
920+ d_graph_legend_display = Graph::ColumnName;
921+ d_graph_axis_labeling = Graph::Default;
922+ d_synchronize_graph_scales = true;
923+ d_print_paper_size = QPrinter::A4;
924+ d_printer_orientation = QPrinter::Landscape;
925+ defaultCurveStyle = int(Graph::LineSymbols);
926+ defaultCurveLineWidth = 1;
927+ d_curve_line_style = 0;//Qt::SolidLine;
928+ defaultCurveBrush = 0;
929+ defaultCurveAlpha = 255;
930+ defaultSymbolSize = 7;
931+ defaultSymbolEdge = 1.0;
932+ d_fill_symbols = true;
933+ d_symbol_style = 0;
934+ d_indexed_symbols = true;
935+ d_keep_aspect_ration = true;
936+
937+ majTicksStyle = int(ScaleDraw::Out);
938+ minTicksStyle = int(ScaleDraw::Out);
939+ minTicksLength = 5;
940+ majTicksLength = 9;
941+
942+ legendFrameStyle = int(LegendWidget::Line);
943+ d_frame_widget_pen = QPen(Qt::black, 1, Qt::SolidLine);
944+ legendTextColor = Qt::black;
945+ legendBackground = Qt::white;
946+ legendBackground.setAlpha(0); // transparent by default;
947+ d_legend_default_angle = 0;
948+ d_frame_geometry_unit = (int)FrameWidget::Scale;
949+ d_layer_geometry_unit = (int)FrameWidget::Pixel;
950+ d_layer_canvas_width = 400;
951+ d_layer_canvas_height = 300;
952+
953+ d_rect_default_background = Qt::white;
954+ d_rect_default_brush = QBrush(Qt::white);
955+
956+ defaultArrowLineWidth = 1;
957+ defaultArrowColor = Qt::black;
958+ defaultArrowHeadLength = 4;
959+ defaultArrowHeadAngle = 45;
960+ defaultArrowHeadFill = true;
961+ defaultArrowLineStyle = Graph::getPenStyle("SolidLine");
962+
963+ d_3D_legend = true;
964+ d_3D_projection = NOFLOOR;
965+ d_3D_smooth_mesh = true;
966+ d_3D_resolution = 1;
967+ d_3D_orthogonal = false;
968+ d_3D_autoscale = true;
969+ d_3D_axes_font = QFont(family, pointSize, QFont::Normal, false);
970+ d_3D_numbers_font = QFont(family, pointSize);
971+ d_3D_title_font = QFont(family, pointSize + 2, QFont::Normal, false);
972+ d_3D_color_map = QwtLinearColorMap(Qt::blue, Qt::red);
973+ d_3D_mesh_color = Qt::black;
974+ d_3D_axes_color = Qt::black;
975+ d_3D_numbers_color = Qt::black;
976+ d_3D_labels_color = Qt::black;
977+ d_3D_background_color = Qt::white;
978+ d_3D_grid_color = Qt::blue;
979+ d_3D_minor_grid_color = Qt::lightGray;
980+ d_3D_minor_grids = true;
981+ d_3D_major_grids = true;
982+ d_3D_major_style = Qwt3D::SOLID;
983+ d_3D_minor_style = Qwt3D::DASH;
984+ d_3D_major_width = 1.0;
985+ d_3D_minor_width = 0.8;
986+
987+ fit_output_precision = 13;
988+ pasteFitResultsToPlot = false;
989+ writeFitResultsToLog = true;
990+ generateUniformFitPoints = true;
991+ fitPoints = 100;
992+ generatePeakCurves = true;
993+ peakCurvesColor = Qt::green;
994+ fit_scale_errors = true;
995+ d_2_linear_fit_points = true;
996+ d_multi_peak_messages = true;
997+
998+ columnSeparator = "\t";
999+ ignoredLines = 0;
1000+ renameColumns = true;
1001+ strip_spaces = false;
1002+ simplify_spaces = false;
1003+ d_ASCII_file_filter = "*";
1004+ d_ASCII_import_locale = QLocale::system().name();
1005+ d_ASCII_import_mode = int(ImportASCIIDialog::NewTables);
1006+ d_ASCII_import_first_row_role = 0;//column names
1007+ d_ASCII_comment_string = "#";
1008+ d_ASCII_import_comments = false;
1009+ d_ASCII_import_read_only = false;
1010+ d_ASCII_import_preview = true;
1011+ d_preview_lines = 100;
1012+ d_import_ASCII_dialog_size = QSize();
1013+ d_ASCII_end_line = LF;
1014+ d_eol = LF;
1015+#ifdef Q_OS_MAC
1016+ d_ASCII_end_line = CR;
1017+ d_eol = CR;
1018+#endif
1019+
1020+ d_export_col_separator = "\t";
1021+ d_export_col_names = false;
1022+ d_export_col_comment = false;
1023+ d_export_table_selection = false;
1024+ d_export_ASCII_file_filter = ".dat";
1025+
1026+ d_scale_fonts_factor = 0.0;
1027+ d_image_export_filter = ".png";
1028+ d_export_transparency = false;
1029+ d_export_quality = 100;
1030+ d_export_raster_size = QSizeF();
1031+ d_export_size_unit = FrameWidget::Pixel;
1032+ d_export_vector_resolution = QWidget().logicalDpiX();
1033+ d_export_bitmap_resolution = d_export_vector_resolution;
1034+ d_export_color = true;
1035+ d_export_escape_tex_strings = true;
1036+ d_export_tex_font_sizes = true;
1037+ d_3D_export_text_mode = 0; //VectorWriter::PIXEL
1038+ d_3D_export_sort = 1; //VectorWriter::SIMPLESORT
1039+}
1040+
1041+void ApplicationWindow::initToolBars()
1042+{
1043+ initPlot3DToolBar();
1044+
1045+ setWindowIcon(QIcon(":/logo.png"));
1046+ QPixmap openIcon, saveIcon;
1047+
1048+ fileTools = new QToolBar(tr( "File" ), this);
1049+ fileTools->setObjectName("fileTools"); // this is needed for QMainWindow::restoreState()
1050+ fileTools->setIconSize( QSize(18,20) );
1051+ addToolBar( Qt::TopToolBarArea, fileTools );
1052+
1053+ fileTools->addAction(actionNewProject);
1054+ fileTools->addAction(actionNewFolder);
1055+ fileTools->addAction(actionNewTable);
1056+ fileTools->addAction(actionNewMatrix);
1057+ fileTools->addAction(actionNewNote);
1058+ fileTools->addAction(actionNewGraph);
1059+ fileTools->addAction(actionNewFunctionPlot);
1060+ fileTools->addAction(actionNewSurfacePlot);
1061+ fileTools->addSeparator ();
1062+ fileTools->addAction(actionOpen);
1063+ fileTools->addAction(actionOpenTemplate);
1064+#ifdef XLS_IMPORT
1065+ fileTools->addAction(actionOpenExcel);
1066+#endif
1067+#ifdef ODS_IMPORT
1068+ fileTools->addAction(actionOpenOds);
1069+#endif
1070+ fileTools->addAction(actionAppendProject);
1071+ fileTools->addAction(actionSaveProject);
1072+ fileTools->addAction(actionSaveTemplate);
1073+ fileTools->addSeparator ();
1074+ fileTools->addAction(actionLoad);
1075+ fileTools->addSeparator ();
1076+ fileTools->addAction(actionCopyWindow);
1077+ fileTools->addAction(actionPrint);
1078+ fileTools->addAction(actionPrintPreview);
1079+ fileTools->addAction(actionExportPDF);
1080+ fileTools->addSeparator();
1081+ fileTools->addAction(actionShowExplorer);
1082+ fileTools->addAction(actionShowLog);
1083+#ifdef SCRIPTING_PYTHON
1084+ fileTools->addAction(actionShowScriptWindow);
1085+#endif
1086+
1087+ editTools = new QToolBar(tr("Edit"), this);
1088+ editTools->setObjectName("editTools"); // this is needed for QMainWindow::restoreState()
1089+ editTools->setIconSize( QSize(18,20) );
1090+ addToolBar( editTools );
1091+
1092+ editTools->addAction(actionUndo);
1093+ editTools->addAction(actionRedo);
1094+ editTools->addAction(actionCutSelection);
1095+ editTools->addAction(actionCopySelection);
1096+ editTools->addAction(actionPasteSelection);
1097+ editTools->addAction(actionClearSelection);
1098+
1099+ noteTools = new QToolBar(tr("Notes"), this);
1100+ noteTools->setObjectName("noteTools"); // this is needed for QMainWindow::restoreState()
1101+ noteTools->setIconSize( QSize(18,20) );
1102+#ifdef SCRIPTING_PYTHON
1103+ noteTools->addAction(actionNoteExecuteAll);
1104+ noteTools->addAction(actionNoteExecute);
1105+ noteTools->addAction(actionCommentSelection);
1106+ noteTools->addAction(actionUncommentSelection);
1107+#endif
1108+ noteTools->addAction(actionDecreaseIndent);
1109+ noteTools->addAction(actionIncreaseIndent);
1110+ noteTools->addAction(actionFind);
1111+ noteTools->addAction(actionFindPrev);
1112+ noteTools->addAction(actionFindNext);
1113+ noteTools->addAction(actionReplace);
1114+ addToolBar( noteTools );
1115+
1116+ plotTools = new QToolBar(tr("Plot"), this);
1117+ plotTools->setObjectName("plotTools"); // this is needed for QMainWindow::restoreState()
1118+ plotTools->setIconSize( QSize(16,20) );
1119+ addToolBar( plotTools );
1120+
1121+ plotTools->addAction(actionAddLayer);
1122+ plotTools->addAction(actionAddInsetLayer);
1123+ plotTools->addAction(actionAddInsetCurveLayer);
1124+ plotTools->addSeparator();
1125+ plotTools->addAction(actionShowLayerDialog);
1126+ plotTools->addAction(actionAutomaticLayout);
1127+ plotTools->addSeparator();
1128+ plotTools->addAction(actionExtractLayers);
1129+ plotTools->addAction(actionExtractGraphs);
1130+ plotTools->addSeparator();
1131+ plotTools->addAction(actionAddErrorBars);
1132+ plotTools->addAction(actionShowCurvesDialog);
1133+ plotTools->addAction(actionAddFunctionCurve);
1134+ plotTools->addAction(actionNewLegend);
1135+ plotTools->addSeparator ();
1136+ plotTools->addAction(actionUnzoom);
1137+
1138+ dataTools = new QActionGroup( this );
1139+ dataTools->setExclusive( true );
1140+
1141+ btnPointer = new QAction(tr("Disable &Tools"), this);
1142+ btnPointer->setActionGroup(dataTools);
1143+ btnPointer->setCheckable( true );
1144+ btnPointer->setIcon(QIcon(":/pointer.png"));
1145+ btnPointer->setChecked(true);
1146+ plotTools->addAction(btnPointer);
1147+
1148+ actionMagnify->setActionGroup(dataTools);
1149+ actionMagnify->setCheckable( true );
1150+
1151+ actionMagnifyHor->setActionGroup(dataTools);
1152+ actionMagnifyHor->setCheckable( true );
1153+
1154+ actionMagnifyVert->setActionGroup(dataTools);
1155+ actionMagnifyVert->setCheckable( true );
1156+
1157+ btnZoomIn = new QAction(tr("&Zoom In"), this);
1158+ btnZoomIn->setShortcut( tr("Ctrl++") );
1159+ btnZoomIn->setActionGroup(dataTools);
1160+ btnZoomIn->setCheckable( true );
1161+ btnZoomIn->setIcon(QIcon(":/zoom.png"));
1162+
1163+ btnZoomOut = new QAction(tr("&Zoom Out"), this);
1164+ btnZoomOut->setShortcut( tr("Ctrl+-") );
1165+ btnZoomOut->setActionGroup(dataTools);
1166+ btnZoomOut->setCheckable( true );
1167+ btnZoomOut->setIcon(QIcon(":/zoomOut.png"));
1168+
1169+ QMenu *menu_zoom = new QMenu(this);
1170+ menu_zoom->addAction(actionMagnify);
1171+ menu_zoom->addAction(actionMagnifyHor);
1172+ menu_zoom->addAction(actionMagnifyVert);
1173+ menu_zoom->addAction(btnZoomIn);
1174+ menu_zoom->addAction(btnZoomOut);
1175+
1176+ QToolButton *btn_zoom = new QToolButton(this);
1177+ btn_zoom->setMenu(menu_zoom);
1178+ btn_zoom->setPopupMode(QToolButton::MenuButtonPopup);
1179+ btn_zoom->setDefaultAction(actionMagnify);
1180+ connect(menu_zoom, SIGNAL(triggered(QAction *)), btn_zoom, SLOT(setDefaultAction(QAction *)));
1181+
1182+ plotTools->addWidget(btn_zoom);
1183+
1184+ btnCursor = new QAction(tr("&Data Reader"), this);
1185+ btnCursor->setShortcut( tr("CTRL+D") );
1186+ btnCursor->setActionGroup(dataTools);
1187+ btnCursor->setCheckable( true );
1188+ btnCursor->setIcon(QIcon(":/select.png"));
1189+ plotTools->addAction(btnCursor);
1190+
1191+ btnSelect = new QAction(tr("&Select Data Range"), this);
1192+ btnSelect->setShortcut( tr("ALT+S") );
1193+ btnSelect->setActionGroup(dataTools);
1194+ btnSelect->setCheckable( true );
1195+ btnSelect->setIcon(QIcon(":/cursors.png"));
1196+ plotTools->addAction(btnSelect);
1197+
1198+ btnPicker = new QAction(tr("S&creen Reader"), this);
1199+ btnPicker->setActionGroup(dataTools);
1200+ btnPicker->setCheckable( true );
1201+ btnPicker->setIcon(QIcon(":/cursor_16.png"));
1202+ plotTools->addAction(btnPicker);
1203+
1204+ actionDrawPoints = new QAction(tr("&Draw Data Points"), this);
1205+ actionDrawPoints->setActionGroup(dataTools);
1206+ actionDrawPoints->setCheckable( true );
1207+ actionDrawPoints->setIcon(QIcon(":/draw_points.png"));
1208+ plotTools->addAction(actionDrawPoints);
1209+
1210+ btnMovePoints = new QAction(tr("&Move Data Points..."), this);
1211+ btnMovePoints->setShortcut( tr("Ctrl+ALT+M") );
1212+ btnMovePoints->setActionGroup(dataTools);
1213+ btnMovePoints->setCheckable( true );
1214+ btnMovePoints->setIcon(QIcon(":/hand.png"));
1215+ plotTools->addAction(btnMovePoints);
1216+
1217+ btnRemovePoints = new QAction(tr("Remove &Bad Data Points..."), this);
1218+ btnRemovePoints->setShortcut( tr("Alt+B") );
1219+ btnRemovePoints->setActionGroup(dataTools);
1220+ btnRemovePoints->setCheckable( true );
1221+ btnRemovePoints->setIcon(QIcon(":/delete.png"));
1222+ plotTools->addAction(btnRemovePoints);
1223+
1224+ actionDragCurve = new QAction(tr("Dra&g Curve"), this);
1225+ actionDragCurve->setActionGroup(dataTools);
1226+ actionDragCurve->setCheckable( true );
1227+ actionDragCurve->setIcon(QIcon(":/drag_curve.png"));
1228+ plotTools->addAction(actionDragCurve);
1229+
1230+ connect( dataTools, SIGNAL( triggered( QAction* ) ), this, SLOT( pickDataTool( QAction* ) ) );
1231+ plotTools->addSeparator ();
1232+
1233+ actionAddFormula = new QAction(tr("Add E&quation"), this);
1234+ actionAddFormula->setShortcut( tr("ALT+Q") );
1235+ actionAddFormula->setCheckable(true);
1236+ actionAddFormula->setIcon(QIcon(":/equation.png"));
1237+ connect(actionAddFormula, SIGNAL(triggered()), this, SLOT(addTexFormula()));
1238+ plotTools->addAction(actionAddFormula);
1239+
1240+ actionAddText = new QAction(tr("Add &Text"), this);
1241+ actionAddText->setShortcut(QKeySequence(tr("Shift+T")));
1242+ actionAddText->setIcon(QIcon(":/text.png"));
1243+ actionAddText->setCheckable(true);
1244+ connect(actionAddText, SIGNAL(triggered()), this, SLOT(addText()));
1245+ plotTools->addAction(actionAddText);
1246+
1247+ btnArrow = new QAction(tr("Draw &Arrow"), this);
1248+ btnArrow->setShortcut( tr("CTRL+ALT+A") );
1249+ btnArrow->setActionGroup(dataTools);
1250+ btnArrow->setCheckable( true );
1251+ btnArrow->setIcon(QIcon(":/arrow.png"));
1252+ plotTools->addAction(btnArrow);
1253+
1254+ btnLine = new QAction(tr("Draw &Line"), this);
1255+ btnLine->setShortcut( tr("CTRL+ALT+L") );
1256+ btnLine->setActionGroup(dataTools);
1257+ btnLine->setCheckable( true );
1258+ btnLine->setIcon(QIcon(":/lPlot.png"));
1259+ plotTools->addAction(btnLine);
1260+
1261+ QPixmap pix = QPixmap(16, 16);
1262+ pix.fill(Qt::transparent);
1263+ QPainter p;
1264+ p.begin(&pix);
1265+ p.setBrush(Qt::lightGray);
1266+ p.drawRect(QRect(1, 2, 12, 10));
1267+
1268+ actionAddRectangle = new QAction(tr("Add &Rectangle"), this);
1269+ actionAddRectangle->setShortcut( tr("CTRL+ALT+R") );
1270+ actionAddRectangle->setCheckable(true);
1271+ actionAddRectangle->setIcon(QIcon(pix));
1272+ connect(actionAddRectangle, SIGNAL(triggered()), this, SLOT(addRectangle()));
1273+ plotTools->addAction(actionAddRectangle);
1274+
1275+ pix.fill(Qt::transparent);
1276+ p.drawEllipse(QRect(0, 2, 15, 12));
1277+ p.end();
1278+
1279+ actionAddEllipse = new QAction(tr("Add &Ellipse"), this);
1280+ actionAddEllipse->setShortcut( tr("CTRL+ALT+E") );
1281+ actionAddEllipse->setCheckable(true);
1282+ actionAddEllipse->setIcon(QIcon(pix));
1283+ connect(actionAddEllipse, SIGNAL(triggered()), this, SLOT(addEllipse()));
1284+ plotTools->addAction(actionAddEllipse);
1285+
1286+ plotTools->addAction(actionTimeStamp);
1287+ plotTools->addAction(actionAddImage);
1288+
1289+ plotTools->addSeparator();
1290+ plotTools->addAction(actionRaiseEnrichment);
1291+ plotTools->addAction(actionLowerEnrichment);
1292+
1293+ plotTools->hide();
1294+
1295+ tableTools = new QToolBar(tr("Table"), this);
1296+ tableTools->setObjectName("tableTools"); // this is needed for QMainWindow::restoreState()
1297+ tableTools->setIconSize( QSize(16, 20));
1298+ addToolBar(Qt::TopToolBarArea, tableTools);
1299+
1300+ QMenu *menuPlotLine = new QMenu(this);
1301+ menuPlotLine->addAction(actionPlotL);
1302+ menuPlotLine->addAction(actionPlotHorSteps);
1303+ menuPlotLine->addAction(actionPlotVertSteps);
1304+
1305+ QToolButton *btnPlotLine = new QToolButton(this);
1306+ btnPlotLine->setMenu(menuPlotLine);
1307+ btnPlotLine->setPopupMode(QToolButton::MenuButtonPopup);
1308+ btnPlotLine->setDefaultAction(actionPlotL);
1309+ connect(menuPlotLine, SIGNAL(triggered(QAction *)), btnPlotLine, SLOT(setDefaultAction(QAction *)));
1310+ tableTools->addWidget(btnPlotLine);
1311+
1312+ QMenu *menuPlotScatter = new QMenu(this);
1313+ menuPlotScatter->addAction(actionPlotP);
1314+ menuPlotScatter->addAction(actionPlotVerticalDropLines);
1315+
1316+ QToolButton *btnPlotScatter = new QToolButton(this);
1317+ btnPlotScatter->setMenu(menuPlotScatter);
1318+ btnPlotScatter->setPopupMode(QToolButton::MenuButtonPopup);
1319+ btnPlotScatter->setDefaultAction(actionPlotP);
1320+ connect(menuPlotScatter, SIGNAL(triggered(QAction *)), btnPlotScatter, SLOT(setDefaultAction(QAction *)));
1321+ tableTools->addWidget(btnPlotScatter);
1322+
1323+ QMenu *menuPlotLineSymbol = new QMenu(this);
1324+ menuPlotLineSymbol->addAction(actionPlotLP);
1325+ menuPlotLineSymbol->addAction(actionPlotSpline);
1326+
1327+ QToolButton *btnPlotLineSymbol = new QToolButton(this);
1328+ btnPlotLineSymbol->setMenu(menuPlotLineSymbol);
1329+ btnPlotLineSymbol->setPopupMode(QToolButton::MenuButtonPopup);
1330+ btnPlotLineSymbol->setDefaultAction(actionPlotLP);
1331+ connect(menuPlotLineSymbol, SIGNAL(triggered(QAction *)), btnPlotLineSymbol, SLOT(setDefaultAction(QAction *)));
1332+ tableTools->addWidget(btnPlotLineSymbol);
1333+
1334+ QMenu *menuPlotBars = new QMenu(this);
1335+ menuPlotBars->addAction(actionPlotVerticalBars);
1336+ menuPlotBars->addAction(actionPlotHorizontalBars);
1337+ menuPlotBars->addAction(actionStackColumns);
1338+ menuPlotBars->addAction(actionStackBars);
1339+
1340+ QToolButton *btnPlotBars = new QToolButton(this);
1341+ btnPlotBars->setMenu(menuPlotBars);
1342+ btnPlotBars->setPopupMode(QToolButton::MenuButtonPopup);
1343+ btnPlotBars->setDefaultAction(actionPlotVerticalBars);
1344+ connect(menuPlotBars, SIGNAL(triggered(QAction *)), btnPlotBars, SLOT(setDefaultAction(QAction *)));
1345+ tableTools->addWidget(btnPlotBars);
1346+
1347+ tableTools->addAction(actionPlotArea);
1348+ tableTools->addAction(actionPlotPie);
1349+
1350+ QMenu *menuStatisticPlots = new QMenu(this);
1351+ menuStatisticPlots->addAction(actionBoxPlot);
1352+ menuStatisticPlots->addAction(actionPlotHistogram);
1353+ menuStatisticPlots->addAction(actionPlotStackedHistograms);
1354+ menuStatisticPlots->addAction(actionStemPlot);
1355+
1356+ QToolButton *btnStatisticPlots = new QToolButton(this);
1357+ btnStatisticPlots->setMenu(menuStatisticPlots);
1358+ btnStatisticPlots->setPopupMode(QToolButton::MenuButtonPopup);
1359+ btnStatisticPlots->setDefaultAction(actionBoxPlot);
1360+ connect(menuStatisticPlots, SIGNAL(triggered(QAction *)), btnStatisticPlots, SLOT(setDefaultAction(QAction *)));
1361+ tableTools->addWidget(btnStatisticPlots);
1362+
1363+ QMenu *menuVectorPlots = new QMenu(this);
1364+ menuVectorPlots->addAction(actionPlotVectXYXY);
1365+ menuVectorPlots->addAction(actionPlotVectXYAM);
1366+
1367+ QToolButton *btnVectorPlots = new QToolButton(this);
1368+ btnVectorPlots->setMenu(menuVectorPlots);
1369+ btnVectorPlots->setPopupMode(QToolButton::MenuButtonPopup);
1370+ btnVectorPlots->setDefaultAction(actionPlotVectXYXY);
1371+ connect(menuVectorPlots, SIGNAL(triggered(QAction *)), btnVectorPlots, SLOT(setDefaultAction(QAction *)));
1372+ tableTools->addWidget(btnVectorPlots);
1373+
1374+ QMenu *menuPlotSpecial = new QMenu(this);
1375+ menuPlotSpecial->addAction(actionPlotDoubleYAxis);
1376+ menuPlotSpecial->addAction(actionWaterfallPlot);
1377+ menuPlotSpecial->addAction(actionAddZoomPlot);
1378+ menuPlotSpecial->addAction(actionPlot2VerticalLayers);
1379+ menuPlotSpecial->addAction(actionPlot2HorizontalLayers);
1380+ menuPlotSpecial->addAction(actionPlot4Layers);
1381+ menuPlotSpecial->addAction(actionPlotStackedLayers);
1382+ menuPlotSpecial->addAction(actionCustomSharedAxisLayers);
1383+
1384+ QToolButton *btnPlotSpecial = new QToolButton(this);
1385+ btnPlotSpecial->setMenu(menuPlotSpecial);
1386+ btnPlotSpecial->setPopupMode(QToolButton::MenuButtonPopup);
1387+ btnPlotSpecial->setDefaultAction(actionPlotDoubleYAxis);
1388+ connect(menuPlotSpecial, SIGNAL(triggered(QAction *)), btnPlotSpecial, SLOT(setDefaultAction(QAction *)));
1389+ tableTools->addWidget(btnPlotSpecial);
1390+
1391+ tableTools->addSeparator ();
1392+
1393+ QMenu *menu3DPlots = new QMenu(this);
1394+ menu3DPlots->addAction(actionPlot3DBars);
1395+ menu3DPlots->addAction(actionPlot3DRibbon);
1396+ menu3DPlots->addAction(actionPlot3DScatter);
1397+ menu3DPlots->addAction(actionPlot3DTrajectory);
1398+
1399+ QToolButton *btn3DPlots = new QToolButton(this);
1400+ btn3DPlots->setMenu(menu3DPlots);
1401+ btn3DPlots->setPopupMode(QToolButton::MenuButtonPopup);
1402+ btn3DPlots->setDefaultAction(actionPlot3DBars);
1403+ connect(menu3DPlots, SIGNAL(triggered(QAction *)), btn3DPlots, SLOT(setDefaultAction(QAction *)));
1404+ tableTools->addWidget(btn3DPlots);
1405+
1406+ tableTools->setEnabled(false);
1407+ tableTools->hide();
1408+
1409+ columnTools = new QToolBar(tr( "Column"), this);
1410+ columnTools->setObjectName("columnTools"); // this is needed for QMainWindow::restoreState()
1411+ columnTools->setIconSize(QSize(16, 20));
1412+ addToolBar(Qt::TopToolBarArea, columnTools);
1413+
1414+ columnTools->addAction(actionShowColumnValuesDialog);
1415+ columnTools->addAction(actionSetAscValues);
1416+ columnTools->addAction(actionSetRandomValues);
1417+ columnTools->addSeparator();
1418+ columnTools->addAction(actionSortTable);
1419+ columnTools->addAction(actionShowColStatistics);
1420+ columnTools->addAction(actionShowRowStatistics);
1421+ columnTools->addSeparator();
1422+ columnTools->addAction(actionSetXCol);
1423+ columnTools->addAction(actionSetYCol);
1424+ columnTools->addAction(actionSetZCol);
1425+ columnTools->addAction(actionSetYErrCol);
1426+ columnTools->addAction(actionSetLabelCol);
1427+ columnTools->addAction(actionDisregardCol);
1428+ columnTools->addSeparator();
1429+ columnTools->addAction(actionMoveColFirst);
1430+ columnTools->addAction(actionMoveColLeft);
1431+ columnTools->addAction(actionMoveColRight);
1432+ columnTools->addAction(actionMoveColLast);
1433+ columnTools->addAction(actionSwapColumns);
1434+ columnTools->addSeparator();
1435+ columnTools->addAction(actionAdjustColumnWidth);
1436+ columnTools->addAction(actionMoveRowUp);
1437+ columnTools->addAction(actionMoveRowDown);
1438+ columnTools->addSeparator();
1439+ columnTools->addAction(actionAddColToTable);
1440+ columnTools->setEnabled(false);
1441+ columnTools->hide();
1442+
1443+ displayBar = new QToolBar( tr( "Data Display" ), this );
1444+ displayBar->setAllowedAreas( Qt::TopToolBarArea | Qt::BottomToolBarArea );
1445+ displayBar->setObjectName("displayBar"); // this is needed for QMainWindow::restoreState()
1446+ info = new QLineEdit( this );
1447+ displayBar->addWidget( info );
1448+ info->setReadOnly(true);
1449+ QPalette palette;
1450+ palette.setColor(QPalette::Text, QColor(Qt::green));
1451+ palette.setColor(QPalette::HighlightedText, QColor(Qt::darkGreen));
1452+ palette.setColor(QPalette::Base, QColor(Qt::black));
1453+ info->setPalette(palette);
1454+
1455+ addToolBar( Qt::TopToolBarArea, displayBar );
1456+ displayBar->hide();
1457+
1458+ insertToolBarBreak (displayBar);
1459+
1460+ plotMatrixBar = new QToolBar( tr( "Matrix Plot" ), this);
1461+ plotMatrixBar->setObjectName("plotMatrixBar");
1462+ addToolBar(Qt::BottomToolBarArea, plotMatrixBar);
1463+
1464+ QMenu *menu3DMatrix = new QMenu(this);
1465+ menu3DMatrix->addAction(actionPlot3DWireFrame);
1466+ menu3DMatrix->addAction(actionPlot3DHiddenLine);
1467+ menu3DMatrix->addAction(actionPlot3DWireSurface);
1468+ menu3DMatrix->addAction(actionPlot3DPolygons);
1469+
1470+ QToolButton *btn3DMatrix = new QToolButton(this);
1471+ btn3DMatrix->setMenu(menu3DMatrix);
1472+ btn3DMatrix->setPopupMode(QToolButton::MenuButtonPopup);
1473+ btn3DMatrix->setDefaultAction(actionPlot3DWireSurface);
1474+ connect(menu3DMatrix, SIGNAL(triggered(QAction *)), btn3DMatrix, SLOT(setDefaultAction(QAction *)));
1475+ plotMatrixBar->addWidget(btn3DMatrix);
1476+
1477+ actionPlot3DBars->addTo(plotMatrixBar);
1478+ actionPlot3DScatter->addTo(plotMatrixBar);
1479+
1480+ plotMatrixBar->addSeparator();
1481+
1482+ QMenu *menuContourPlot = new QMenu(this);
1483+ menuContourPlot->addAction(actionColorMap);
1484+ menuContourPlot->addAction(actionContourMap);
1485+ menuContourPlot->addAction(actionGrayMap);
1486+
1487+ QToolButton *btnContourPlot = new QToolButton(this);
1488+ btnContourPlot->setMenu(menuContourPlot);
1489+ btnContourPlot->setPopupMode(QToolButton::MenuButtonPopup);
1490+ btnContourPlot->setDefaultAction(actionColorMap);
1491+ connect(menuContourPlot, SIGNAL(triggered(QAction *)), btnContourPlot, SLOT(setDefaultAction(QAction *)));
1492+ plotMatrixBar->addWidget(btnContourPlot);
1493+
1494+ actionImagePlot->addTo(plotMatrixBar);
1495+ actionImageProfilesPlot->addTo(plotMatrixBar);
1496+ actionPlotHistogram->addTo(plotMatrixBar);
1497+ plotMatrixBar->addSeparator();
1498+ actionSetMatrixValues->addTo(plotMatrixBar);
1499+ actionFlipMatrixHorizontally->addTo(plotMatrixBar);
1500+ actionFlipMatrixVertically->addTo(plotMatrixBar);
1501+ actionRotateMatrix->addTo(plotMatrixBar);
1502+ actionRotateMatrixMinus->addTo(plotMatrixBar);
1503+ plotMatrixBar->addSeparator();
1504+ plotMatrixBar->addAction(actionIncreasePrecision);
1505+ plotMatrixBar->addAction(actionDecreasePrecision);
1506+ plotMatrixBar->hide();
1507+
1508+ formatToolBar = new QToolBar(tr( "Format" ), this);
1509+ formatToolBar->setObjectName("formatToolBar");
1510+ addToolBar(Qt::TopToolBarArea, formatToolBar);
1511+
1512+ QFontComboBox *fb = new QFontComboBox();
1513+ connect(fb, SIGNAL(currentFontChanged(const QFont &)), this, SLOT(setFontFamily(const QFont &)));
1514+ actionFontBox = formatToolBar->addWidget(fb);
1515+
1516+ QSpinBox *sb = new QSpinBox();
1517+ connect(sb, SIGNAL(valueChanged(int)), this, SLOT(setFontSize(int)));
1518+ actionFontSize = formatToolBar->addWidget(sb);
1519+
1520+ actionFontBold->addTo(formatToolBar);
1521+ actionFontItalic->addTo(formatToolBar);
1522+
1523+ actionUnderline->addTo(formatToolBar);
1524+ actionSuperscript->addTo(formatToolBar);
1525+ actionSubscript->addTo(formatToolBar);
1526+ actionGreekSymbol->addTo(formatToolBar);
1527+ actionGreekMajSymbol->addTo(formatToolBar);
1528+ actionMathSymbol->addTo(formatToolBar);
1529+
1530+ formatToolBar->setEnabled(false);
1531+ formatToolBar->hide();
1532+
1533+ QList<QToolBar *> toolBars = toolBarsList();
1534+ foreach (QToolBar *t, toolBars)
1535+ connect(t, SIGNAL(actionTriggered(QAction *)), this, SLOT(performCustomAction(QAction *)));
1536+}
1537+
1538+void ApplicationWindow::insertTranslatedStrings()
1539+{
1540+ if (projectname == "untitled")
1541+ setWindowTitle(tr("QtiPlot - untitled"));
1542+
1543+ lv->setColumnText (0, tr("Name"));
1544+ lv->setColumnText (1, tr("Type"));
1545+ lv->setColumnText (2, tr("View"));
1546+ lv->setColumnText (3, tr("Size"));
1547+ lv->setColumnText (4, tr("Created"));
1548+ lv->setColumnText (5, tr("Label"));
1549+
1550+ if (scriptWindow)
1551+ scriptWindow->setWindowTitle(tr("QtiPlot - Script Window"));
1552+ explorerWindow->setWindowTitle(tr("Project Explorer"));
1553+ logWindow->setWindowTitle(tr("Results Log"));
1554+ undoStackWindow->setWindowTitle(tr("Undo Stack"));
1555+#ifdef SCRIPTING_CONSOLE
1556+ consoleWindow->setWindowTitle(tr("Scripting Console"));
1557+#endif
1558+ displayBar->setWindowTitle(tr("Data Display"));
1559+ tableTools->setWindowTitle(tr("Table"));
1560+ columnTools->setWindowTitle(tr("Column"));
1561+ plotTools->setWindowTitle(tr("Plot"));
1562+ fileTools->setWindowTitle(tr("File"));
1563+ editTools->setWindowTitle(tr("Edit"));
1564+ noteTools->setWindowTitle(tr("Notes"));
1565+ plotMatrixBar->setWindowTitle(tr("Matrix Plot"));
1566+ plot3DTools->setWindowTitle(tr("3D Surface"));
1567+ formatToolBar->setWindowTitle(tr("Format"));
1568+
1569+ fileMenu->changeItem(recentMenuID, tr("&Recent Projects"));
1570+ fileMenu->setTitle(tr("&File"));
1571+ newMenu->setTitle(tr("&New"));
1572+ exportPlotMenu->setTitle(tr("&Export Graph"));
1573+ importMenu->setTitle(tr("&Import"));
1574+ edit->setTitle(tr("&Edit"));
1575+ view->setTitle(tr("&View"));
1576+ graphMenu->setTitle(tr("&Graph"));
1577+ plot3DMenu->setTitle(tr("3D &Plot"));
1578+ matrixMenu->setTitle(tr("&Matrix"));
1579+ plot2DMenu->setTitle(tr("&Plot"));
1580+ plotDataMenu->setTitle(tr("&Data"));
1581+ normMenu->setTitle(tr("&Normalize"));
1582+ fillMenu->setTitle(tr("&Fill Columns With"));
1583+ tableMenu->setTitle(tr("&Table"));
1584+ smoothMenu->setTitle(tr("&Smooth"));
1585+ filterMenu->setTitle(tr("&FFT filter"));
1586+ decayMenu->setTitle(tr("Fit E&xponential Decay"));
1587+ multiPeakMenu->setTitle(tr("Fit &Multi-peak"));
1588+ analysisMenu->setTitle(tr("&Analysis"));
1589+ format->setTitle(tr("F&ormat"));
1590+ scriptingMenu->setTitle(tr("&Scripting"));
1591+ windowsMenu->setTitle(tr("&Windows"));
1592+ help->setTitle(tr("&Help"));
1593+
1594+ translateActionsStrings();
1595+ customMenu(activeWindow());
1596+}
1597+
1598+void ApplicationWindow::initMainMenu()
1599+{
1600+ menuBar()->setObjectName("menuBar");
1601+
1602+ fileMenu = new QMenu(this);
1603+ fileMenu->setObjectName("fileMenu");
1604+ connect(fileMenu, SIGNAL(aboutToShow()), this, SLOT(fileMenuAboutToShow()));
1605+ menuBar()->addMenu(fileMenu);
1606+
1607+ recent = new QMenu(this);
1608+ newMenu = new QMenu(this);
1609+ newMenu->setObjectName("newMenu");
1610+ exportPlotMenu = new QMenu(this);
1611+ exportPlotMenu->setObjectName("exportPlotMenu");
1612+ importMenu = new QMenu(this);
1613+ importMenu->setObjectName("importMenu");
1614+
1615+ edit = new QMenu(this);
1616+ edit->setObjectName("editMenu");
1617+ menuBar()->addMenu(edit);
1618+
1619+ edit->addAction(actionUndo);
1620+ edit->addAction(actionRedo);
1621+ edit->insertSeparator();
1622+ edit->addAction(actionCopySelection);
1623+ edit->addAction(actionPasteSelection);
1624+ edit->addAction(actionClearSelection);
1625+ edit->insertSeparator();
1626+ edit->addAction(actionDeleteFitTables);
1627+ edit->addAction(actionClearLogInfo);
1628+ edit->insertSeparator();
1629+ edit->addAction(actionShowConfigureDialog);
1630+
1631+ connect(edit, SIGNAL(aboutToShow()), this, SLOT(editMenuAboutToShow()));
1632+
1633+ view = new QMenu(this);
1634+ view->setObjectName("viewMenu");
1635+ menuBar()->addMenu(view);
1636+
1637+ view->setCheckable(true);
1638+ view->addAction(actionToolBars);
1639+ view->addAction(actionShowPlotWizard);
1640+ view->addAction(actionShowExplorer);
1641+ view->addAction(actionShowLog);
1642+ view->addAction(actionShowUndoStack);
1643+#ifdef SCRIPTING_CONSOLE
1644+ view->addAction(actionShowConsole);
1645+#endif
1646+
1647+ scriptingMenu = new QMenu(this);
1648+ scriptingMenu->setObjectName("scriptingMenu");
1649+ connect(scriptingMenu, SIGNAL(aboutToShow()), this, SLOT(scriptingMenuAboutToShow()));
1650+ menuBar()->addMenu(scriptingMenu);
1651+
1652+ graphMenu = new QMenu(this);
1653+ graphMenu->setObjectName("graphMenu");
1654+ graphMenu->setCheckable(true);
1655+ menuBar()->addMenu(graphMenu);
1656+
1657+ graphMenu->addAction(actionShowCurvesDialog);
1658+ graphMenu->addAction(actionAddFunctionCurve);
1659+ graphMenu->addAction(actionAddErrorBars);
1660+ graphMenu->addAction(actionNewLegend);
1661+ graphMenu->addSeparator();
1662+ graphMenu->addAction(actionAddFormula);
1663+ graphMenu->addAction(actionAddText);
1664+ graphMenu->addAction(btnArrow);
1665+ graphMenu->addAction(btnLine);
1666+ graphMenu->addAction(actionAddRectangle);
1667+ graphMenu->addAction(actionAddEllipse);
1668+ graphMenu->addAction(actionTimeStamp);
1669+ graphMenu->addAction(actionAddImage);
1670+ graphMenu->addSeparator();//layers section
1671+ graphMenu->addAction(actionAddLayer);
1672+ graphMenu->addAction(actionAddInsetLayer);
1673+ graphMenu->addAction(actionAddInsetCurveLayer);
1674+ graphMenu->addAction(actionShowLayerDialog);
1675+ graphMenu->addAction(actionAutomaticLayout);
1676+ graphMenu->addSeparator();
1677+ graphMenu->addAction(actionExtractLayers);
1678+ graphMenu->addAction(actionExtractGraphs);
1679+ graphMenu->addSeparator();
1680+ graphMenu->addAction(actionDeleteLayer);
1681+
1682+ plot3DMenu = new QMenu(this);
1683+ plot3DMenu->setObjectName("plot3DMenu");
1684+ plot3DMenu->addAction(actionPlot3DWireFrame);
1685+ plot3DMenu->addAction(actionPlot3DHiddenLine);
1686+ plot3DMenu->addAction(actionPlot3DPolygons);
1687+ plot3DMenu->addAction(actionPlot3DWireSurface);
1688+ plot3DMenu->insertSeparator();
1689+ plot3DMenu->addAction(actionPlot3DBars);
1690+ plot3DMenu->addAction(actionPlot3DScatter);
1691+ plot3DMenu->insertSeparator();
1692+ plot3DMenu->addAction(actionColorMap);
1693+ plot3DMenu->addAction(actionContourMap);
1694+ plot3DMenu->addAction(actionGrayMap);
1695+ plot3DMenu->insertSeparator();
1696+ plot3DMenu->addAction(actionImagePlot);
1697+ plot3DMenu->addAction(actionImageProfilesPlot);
1698+ plot3DMenu->insertSeparator();
1699+ plot3DMenu->addAction(actionPlotHistogram);
1700+ menuBar()->addMenu(plot3DMenu);
1701+
1702+ matrixMenu = new QMenu(this);
1703+ matrixMenu->setObjectName("matrixMenu");
1704+ connect(matrixMenu, SIGNAL(aboutToShow()), this, SLOT(matrixMenuAboutToShow()));
1705+ menuBar()->addMenu(matrixMenu);
1706+
1707+ plot2DMenu = new QMenu(this);
1708+ plot2DMenu->setObjectName("plot2DMenu");
1709+ connect(plot2DMenu, SIGNAL(aboutToShow()), this, SLOT(plotMenuAboutToShow()));
1710+ menuBar()->addMenu(plot2DMenu);
1711+
1712+ plotDataMenu = new QMenu(this);
1713+ plotDataMenu->setObjectName("plotDataMenu");
1714+ plotDataMenu->setCheckable(true);
1715+ connect(plotDataMenu, SIGNAL(aboutToShow()), this, SLOT(plotDataMenuAboutToShow()));
1716+ menuBar()->addMenu(plotDataMenu);
1717+
1718+ normMenu = new QMenu(this);
1719+ normMenu->setObjectName("normMenu");
1720+
1721+ fillMenu = new QMenu();
1722+ fillMenu->setObjectName("fillMenu");
1723+
1724+ analysisMenu = new QMenu(this);
1725+ analysisMenu->setObjectName("analysisMenu");
1726+ connect(analysisMenu, SIGNAL(aboutToShow()), this, SLOT(analysisMenuAboutToShow()));
1727+ menuBar()->addMenu(analysisMenu);
1728+
1729+ tableMenu = new QMenu(this);
1730+ tableMenu->setObjectName("tableMenu");
1731+ connect(tableMenu, SIGNAL(aboutToShow()), this, SLOT(tableMenuAboutToShow()));
1732+ menuBar()->addMenu(tableMenu);
1733+
1734+ smoothMenu = new QMenu(this);
1735+ smoothMenu->setObjectName("smoothMenu");
1736+
1737+ filterMenu = new QMenu(this);
1738+ filterMenu->setObjectName("filterMenu");
1739+
1740+ decayMenu = new QMenu(this);
1741+ decayMenu->setObjectName("decayMenu");
1742+
1743+ multiPeakMenu = new QMenu(this);
1744+ multiPeakMenu->setObjectName("multiPeakMenu");
1745+
1746+ format = new QMenu(this);
1747+ format->setObjectName("formatMenu");
1748+ menuBar()->addMenu(format);
1749+
1750+ windowsMenu = new QMenu(this);
1751+ windowsMenu->setObjectName("windowsMenu");
1752+ windowsMenu->setCheckable(true);
1753+ connect(windowsMenu, SIGNAL(aboutToShow()), this, SLOT(windowsMenuAboutToShow()));
1754+ menuBar()->addMenu(windowsMenu);
1755+
1756+ foldersMenu = new QMenu(this);
1757+ foldersMenu->setCheckable(true);
1758+
1759+ help = new QMenu(this);
1760+ help->setObjectName("helpMenu");
1761+ menuBar()->addMenu(help);
1762+
1763+ help->addAction(actionShowHelp);
1764+ help->addAction(actionChooseHelpFolder);
1765+ help->insertSeparator();
1766+ help->addAction(actionHomePage);
1767+ help->addAction(actionCheckUpdates);
1768+ help->addAction(actionDownloadManual);
1769+ help->addAction(actionTranslations);
1770+ help->insertSeparator();
1771+ help->addAction(actionTechnicalSupport);
1772+ help->addAction(actionDonate);
1773+ help->addAction(actionHelpForums);
1774+ help->addAction(actionHelpBugReports);
1775+ help->insertSeparator();
1776+ help->addAction(actionAbout);
1777+
1778+ QList<QMenu *> menus;
1779+ menus << windowsMenu << view << graphMenu << fileMenu << format << edit;
1780+ menus << help << plot2DMenu << analysisMenu;
1781+ menus << matrixMenu << plot3DMenu << plotDataMenu << scriptingMenu;
1782+ menus << tableMenu << newMenu << exportPlotMenu << importMenu;
1783+
1784+ foreach (QMenu *m, menus)
1785+ connect(m, SIGNAL(triggered(QAction *)), this, SLOT(performCustomAction(QAction *)));
1786+
1787+ disableActions();
1788+}
1789+
1790+void ApplicationWindow::tableMenuAboutToShow()
1791+{
1792+ tableMenu->clear();
1793+ fillMenu->clear();
1794+
1795+ QMenu *setAsMenu = tableMenu->addMenu(tr("Set Columns &As"));
1796+ setAsMenu->addAction(actionSetXCol);
1797+ setAsMenu->addAction(actionSetYCol);
1798+ setAsMenu->addAction(actionSetZCol);
1799+ setAsMenu->insertSeparator();
1800+ setAsMenu->addAction(actionSetLabelCol);
1801+ setAsMenu->addAction(actionDisregardCol);
1802+ setAsMenu->insertSeparator();
1803+ setAsMenu->addAction(actionSetXErrCol);
1804+ setAsMenu->addAction(actionSetYErrCol);
1805+ setAsMenu->insertSeparator();
1806+ setAsMenu->addAction(tr("&Read-only"), this, SLOT(setReadOnlyColumns()));
1807+ setAsMenu->addAction(tr("Read/&Write"), this, SLOT(setReadWriteColumns()));
1808+
1809+ tableMenu->addAction(actionShowColumnOptionsDialog);
1810+ tableMenu->insertSeparator();
1811+
1812+ tableMenu->addAction(actionShowColumnValuesDialog);
1813+ tableMenu->addAction(actionTableRecalculate);
1814+
1815+ fillMenu->addAction(actionSetAscValues);
1816+ fillMenu->addAction(actionSetRandomValues);
1817+ tableMenu->addMenu (fillMenu);
1818+
1819+ tableMenu->addAction(actionClearTable);
1820+ tableMenu->insertSeparator();
1821+ tableMenu->addAction(actionAddColToTable);
1822+ tableMenu->addAction(actionShowColsDialog);
1823+ tableMenu->insertSeparator();
1824+ tableMenu->addAction(actionHideSelectedColumns);
1825+ tableMenu->addAction(actionShowAllColumns);
1826+ tableMenu->addAction(actionAdjustColumnWidth);
1827+ tableMenu->insertSeparator();
1828+ tableMenu->addAction(actionMoveColFirst);
1829+ tableMenu->addAction(actionMoveColLeft);
1830+ tableMenu->addAction(actionMoveColRight);
1831+ tableMenu->addAction(actionMoveColLast);
1832+ tableMenu->addAction(actionSwapColumns);
1833+ tableMenu->insertSeparator();
1834+ tableMenu->addAction(actionShowRowsDialog);
1835+ tableMenu->addAction(actionDeleteRows);
1836+
1837+ QMenu *moveRowMenu = tableMenu->addMenu(tr("Move Row"));
1838+ moveRowMenu->addAction(actionMoveRowUp);
1839+ moveRowMenu->addAction(actionMoveRowDown);
1840+
1841+ tableMenu->insertSeparator();
1842+ tableMenu->addAction(actionGoToRow);
1843+ tableMenu->addAction(actionGoToColumn);
1844+ tableMenu->addAction(actionExtractTableData);
1845+ tableMenu->insertSeparator();
1846+
1847+ QMenu *convertToMatrixMenu = tableMenu->addMenu(tr("Convert to &Matrix"));
1848+ convertToMatrixMenu->addAction(actionConvertTableDirect);
1849+ convertToMatrixMenu->addAction(actionConvertTableBinning);
1850+ convertToMatrixMenu->addAction(actionConvertTableRegularXYZ);
1851+
1852+ reloadCustomActions();
1853+}
1854+
1855+void ApplicationWindow::plotDataMenuAboutToShow()
1856+{
1857+ plotDataMenu->clear();
1858+ plotDataMenu->addAction(btnPointer);
1859+ plotDataMenu->insertSeparator();
1860+ plotDataMenu->addAction(actionMagnify);
1861+ plotDataMenu->addAction(actionMagnifyHor);
1862+ plotDataMenu->addAction(actionMagnifyVert);
1863+ plotDataMenu->addAction(btnZoomIn);
1864+ plotDataMenu->addAction(btnZoomOut);
1865+ plotDataMenu->addAction(actionUnzoom);
1866+ plotDataMenu->insertSeparator();
1867+ plotDataMenu->addAction(btnCursor);
1868+ plotDataMenu->addAction(btnSelect);
1869+ plotDataMenu->addAction(btnPicker);
1870+ plotDataMenu->insertSeparator();
1871+ plotDataMenu->addAction(actionDrawPoints);
1872+ plotDataMenu->addAction(btnMovePoints);
1873+ plotDataMenu->addAction(btnRemovePoints);
1874+ plotDataMenu->addAction(actionDragCurve);
1875+
1876+ reloadCustomActions();
1877+}
1878+
1879+void ApplicationWindow::plotMenuAboutToShow()
1880+{
1881+ plot2DMenu->clear();
1882+
1883+ plot2DMenu->addAction(actionPlotL);
1884+ plot2DMenu->addAction(actionPlotP);
1885+ plot2DMenu->addAction(actionPlotLP);
1886+
1887+ QMenu *specialPlotMenu = plot2DMenu->addMenu (tr("Special Line/Symb&ol"));
1888+ specialPlotMenu->addAction(actionPlotVerticalDropLines);
1889+ specialPlotMenu->addAction(actionPlotSpline);
1890+ specialPlotMenu->addAction(actionPlotVertSteps);
1891+ specialPlotMenu->addAction(actionPlotHorSteps);
1892+ specialPlotMenu->insertSeparator();
1893+ specialPlotMenu->addAction(actionPlotDoubleYAxis);
1894+ specialPlotMenu->addAction(actionWaterfallPlot);
1895+ specialPlotMenu->addAction(actionAddZoomPlot);
1896+
1897+ plot2DMenu->insertSeparator();
1898+ plot2DMenu->addAction(actionPlotVerticalBars);
1899+ plot2DMenu->addAction(actionPlotHorizontalBars);
1900+ QMenu *specialBarMenu = plot2DMenu->addMenu (tr("Spec&ial Bar/Column"));
1901+ specialBarMenu->addAction(actionStackBars);
1902+ specialBarMenu->addAction(actionStackColumns);
1903+
1904+ plot2DMenu->addAction(actionPlotArea);
1905+ plot2DMenu->addAction(actionPlotPie);
1906+ plot2DMenu->addAction(actionPlotVectXYXY);
1907+ plot2DMenu->addAction(actionPlotVectXYAM);
1908+ plot2DMenu->insertSeparator();
1909+
1910+ QMenu *statMenu = plot2DMenu->addMenu (tr("Statistical &Graphs"));
1911+ statMenu->addAction(actionBoxPlot);
1912+ statMenu->addAction(actionPlotHistogram);
1913+ statMenu->addAction(actionPlotStackedHistograms);
1914+ statMenu->insertSeparator();
1915+ statMenu->addAction(actionStemPlot);
1916+
1917+ QMenu *panelsMenu = plot2DMenu->addMenu (tr("Pa&nel"));
1918+ panelsMenu->addAction(actionPlot2VerticalLayers);
1919+ panelsMenu->addAction(actionPlot2HorizontalLayers);
1920+ panelsMenu->addAction(actionPlot4Layers);
1921+ panelsMenu->addAction(actionPlotStackedLayers);
1922+ panelsMenu->addAction(actionCustomLayout);
1923+
1924+ QMenu *gridMenu = plot2DMenu->addMenu (tr("Shared A&xes Panel"));
1925+ gridMenu->addAction(actionVertSharedAxisLayers);
1926+ gridMenu->addAction(actionHorSharedAxisLayers);
1927+ gridMenu->addAction(actionSharedAxesLayers);
1928+ gridMenu->addAction(actionStackSharedAxisLayers);
1929+ gridMenu->addAction(actionCustomSharedAxisLayers);
1930+
1931+ QMenu *plot3D = plot2DMenu->addMenu (tr("3&D Plot"));
1932+ plot3D->addAction(actionPlot3DRibbon);
1933+ plot3D->addAction(actionPlot3DBars);
1934+ plot3D->addAction(actionPlot3DScatter);
1935+ plot3D->addAction(actionPlot3DTrajectory);
1936+
1937+ reloadCustomActions();
1938+}
1939+
1940+void ApplicationWindow::customMenu(QMdiSubWindow* w)
1941+{
1942+ analysisMenu->menuAction()->setVisible(false);
1943+ tableMenu->menuAction()->setVisible(false);
1944+ plotDataMenu->menuAction()->setVisible(false);
1945+ graphMenu->menuAction()->setVisible(false);
1946+ matrixMenu->menuAction()->setVisible(false);
1947+ format->menuAction()->setVisible(false);
1948+ plot2DMenu->menuAction()->setVisible(false);
1949+ plot3DMenu->menuAction()->setVisible(false);
1950+#ifndef SCRIPTING_PYTHON
1951+ scriptingMenu->menuAction()->setVisible(false);
1952+#endif
1953+
1954+ fileMenuAboutToShow();
1955+ windowsMenuAboutToShow();
1956+
1957+ // these use the same keyboard shortcut (Ctrl+Return) and should not be enabled at the same time
1958+ actionNoteEvaluate->setEnabled(false);
1959+ actionTableRecalculate->setEnabled(false);
1960+ // these use the same keyboard shortcut (Alt+C) and should not be enabled at the same time
1961+ actionShowCurvesDialog->setEnabled(false);
1962+ actionAddColToTable->setEnabled(false);
1963+ // these use the same keyboard shortcut (Alt+Q) and should not be enabled at the same time
1964+ actionAddFormula->setEnabled(false);
1965+ actionShowColumnValuesDialog->setEnabled(false);
1966+ actionSetMatrixValues->setEnabled(false);
1967+ // these use the same keyboard shortcut (Ctrl+Alt+F) and should not be enabled at the same time
1968+ actionAddFunctionCurve->setEnabled(false);
1969+ actionFind->setEnabled(false);
1970+ // these use the same keyboard shortcut (Ctrl+Alt+G) and should not be enabled at the same time
1971+ actionExportGraph->setEnabled(false);
1972+ actionGoToRow->setEnabled(false);
1973+
1974+ // clear undo stack view (in case window is not a matrix)
1975+ d_undo_view->setStack(0);
1976+ actionUndo->setEnabled(false);
1977+ actionRedo->setEnabled(false);
1978+
1979+ actionCopyWindow->setEnabled(w);
1980+ actionPrint->setEnabled(w);
1981+ actionPrintPreview->setEnabled(w);
1982+ actionExportPDF->setEnabled(w);
1983+
1984+ if(w){
1985+ analysisMenuAboutToShow();
1986+
1987+ actionPrintAllPlots->setEnabled(projectHas2DPlots());
1988+ actionPrint->setEnabled(true);
1989+ actionCutSelection->setEnabled(true);
1990+ actionCopySelection->setEnabled(true);
1991+ actionPasteSelection->setEnabled(true);
1992+ actionClearSelection->setEnabled(true);
1993+ actionSaveTemplate->setEnabled(true);
1994+ actionSaveWindow->setEnabled(true);
1995+ QStringList tables = tableNames() + matrixNames();
1996+ if (!tables.isEmpty())
1997+ actionShowExportASCIIDialog->setEnabled(true);
1998+ else
1999+ actionShowExportASCIIDialog->setEnabled(false);
2000+
2001+ if (w->isA("MultiLayer")) {
2002+ actionAddFunctionCurve->setEnabled(true);
2003+ actionShowCurvesDialog->setEnabled(true);
2004+ actionAddFormula->setEnabled(true);
2005+ actionExportGraph->setEnabled(true);
2006+
2007+ graphMenu->menuAction()->setVisible(true);
2008+ plotDataMenu->menuAction()->setVisible(true);
2009+ analysisMenu->menuAction()->setVisible(true);
2010+ format->menuAction()->setVisible(true);
2011+ format->clear();
2012+ format->addAction(actionShowPlotDialog);
2013+ format->insertSeparator();
2014+ format->addAction(actionShowScaleDialog);
2015+ format->addAction(actionShowAxisDialog);
2016+ actionShowAxisDialog->setEnabled(true);
2017+ format->insertSeparator();
2018+ format->addAction(actionShowGridDialog);
2019+ format->addAction(actionShowTitleDialog);
2020+ } else if (w->isA("Graph3D")) {
2021+ disableActions();
2022+
2023+ actionPrint->setEnabled(true);
2024+ actionSaveTemplate->setEnabled(true);
2025+ actionSaveWindow->setEnabled(true);
2026+ actionExportGraph->setEnabled(true);
2027+
2028+ format->menuAction()->setVisible(true);
2029+ format->clear();
2030+ format->addAction(actionShowPlotDialog);
2031+ format->addAction(actionShowScaleDialog);
2032+ format->addAction(actionShowAxisDialog);
2033+ format->addAction(actionShowTitleDialog);
2034+ if (((Graph3D*)w)->coordStyle() == Qwt3D::NOCOORD)
2035+ actionShowAxisDialog->setEnabled(false);
2036+ } else if (w->inherits("Table")) {
2037+ tableMenuAboutToShow();
2038+
2039+ plot2DMenu->menuAction()->setVisible(true);
2040+ analysisMenu->menuAction()->setVisible(true);
2041+ tableMenu->menuAction()->setVisible(true);
2042+
2043+ actionTableRecalculate->setEnabled(true);
2044+ actionAddColToTable->setEnabled(true);
2045+ actionShowColumnValuesDialog->setEnabled(true);
2046+ actionGoToRow->setEnabled(true);
2047+ } else if (qobject_cast<Matrix*>(w)){
2048+ matrixMenuAboutToShow();
2049+
2050+ actionTableRecalculate->setEnabled(true);
2051+ actionSetMatrixValues->setEnabled(true);
2052+ actionGoToRow->setEnabled(true);
2053+
2054+ plot3DMenu->menuAction()->setVisible(true);
2055+ analysisMenu->menuAction()->setVisible(true);
2056+ matrixMenu->menuAction()->setVisible(true);
2057+
2058+ d_undo_view->setEmptyLabel(w->objectName() + ": " + tr("Empty Stack"));
2059+ QUndoStack *stack = ((Matrix *)w)->undoStack();
2060+ d_undo_view->setStack(stack);
2061+ } else if (qobject_cast<Note*>(w)){
2062+ #ifndef SCRIPTING_PYTHON
2063+ scriptingMenu->menuAction()->setVisible(true);
2064+ #endif
2065+ actionSaveTemplate->setEnabled(false);
2066+ actionNoteEvaluate->setEnabled(true);
2067+ actionFind->setEnabled(true);
2068+ } else
2069+ disableActions();
2070+ } else
2071+ disableActions();
2072+
2073+ reloadCustomActions();
2074+}
2075+
2076+void ApplicationWindow::disableActions()
2077+{
2078+ actionSaveTemplate->setEnabled(false);
2079+ actionSaveWindow->setEnabled(false);
2080+ actionPrintAllPlots->setEnabled(false);
2081+ actionPrint->setEnabled(false);
2082+
2083+ actionCutSelection->setEnabled(false);
2084+ actionCopySelection->setEnabled(false);
2085+ actionPasteSelection->setEnabled(false);
2086+ actionClearSelection->setEnabled(false);
2087+}
2088+
2089+void ApplicationWindow::customColumnActions()
2090+{
2091+ actionAdjustColumnWidth->setEnabled(false);
2092+ actionMoveColFirst->setEnabled(false);
2093+ actionMoveColLeft->setEnabled(false);
2094+ actionMoveColRight->setEnabled(false);
2095+ actionMoveColLast->setEnabled(false);
2096+ actionSetXCol->setEnabled(false);
2097+ actionSetYCol->setEnabled(false);
2098+ actionSetZCol->setEnabled(false);
2099+ actionSetLabelCol->setEnabled(false);
2100+ actionSetYErrCol->setEnabled(false);
2101+ actionDisregardCol->setEnabled(false);
2102+ actionSwapColumns->setEnabled(false);
2103+ actionSetAscValues->setEnabled(false);
2104+ actionSetRandomValues->setEnabled(false);
2105+
2106+ Table *t = (Table*)activeWindow(TableWindow);
2107+ if (!t)
2108+ return;
2109+
2110+ int selectedCols = t->selectedColsNumber();
2111+ if (selectedCols == 1){
2112+ int col = t->selectedColumn();
2113+ if (col > 0){
2114+ actionMoveColFirst->setEnabled(true);
2115+ actionMoveColLeft->setEnabled(true);
2116+ }
2117+
2118+ if (col < t->numCols() - 1){
2119+ actionMoveColRight->setEnabled(true);
2120+ actionMoveColLast->setEnabled(true);
2121+ }
2122+ }
2123+
2124+ if (selectedCols >= 1){
2125+ actionSetAscValues->setEnabled(true);
2126+ actionSetRandomValues->setEnabled(true);
2127+ actionSetXCol->setEnabled(true);
2128+ actionSetYCol->setEnabled(true);
2129+ actionSetZCol->setEnabled(true);
2130+ actionSetYErrCol->setEnabled(true);
2131+ actionSetLabelCol->setEnabled(true);
2132+ actionDisregardCol->setEnabled(true);
2133+ actionAdjustColumnWidth->setEnabled(true);
2134+ }
2135+
2136+ if (selectedCols == 2)
2137+ actionSwapColumns->setEnabled(true);
2138+}
2139+
2140+void ApplicationWindow::customToolBars(QMdiSubWindow* w)
2141+{
2142+ disableToolbars();
2143+ if (!w)
2144+ return;
2145+
2146+ if (w->isA("MultiLayer") && d_plot_tool_bar){
2147+ if(!plotTools->isVisible())
2148+ plotTools->show();
2149+ plotTools->setEnabled (true);
2150+ custom2DPlotTools((MultiLayer *)w);
2151+ if(d_format_tool_bar && !formatToolBar->isVisible()){
2152+ formatToolBar->setEnabled (true);
2153+ formatToolBar->show();
2154+ }
2155+ } else if (w->inherits("Table")){
2156+ if(d_table_tool_bar){
2157+ if(!tableTools->isVisible())
2158+ tableTools->show();
2159+ tableTools->setEnabled (true);
2160+ }
2161+ if (d_column_tool_bar){
2162+ if(!columnTools->isVisible())
2163+ columnTools->show();
2164+ columnTools->setEnabled (true);
2165+ customColumnActions();
2166+ }
2167+ } else if (w->isA("Matrix") && d_matrix_tool_bar){
2168+ if(!plotMatrixBar->isVisible())
2169+ plotMatrixBar->show();
2170+ plotMatrixBar->setEnabled (true);
2171+ } else if (w->isA("Graph3D") && d_plot3D_tool_bar){
2172+ if(!plot3DTools->isVisible())
2173+ plot3DTools->show();
2174+
2175+ plot3DTools->setEnabled(((Graph3D*)w)->plotStyle() != Qwt3D::NOPLOT);
2176+ custom3DActions(w);
2177+ } else if (w->isA("Note")){
2178+ if(d_format_tool_bar && !formatToolBar->isVisible())
2179+ formatToolBar->show();
2180+ if(d_notes_tool_bar && !noteTools->isVisible())
2181+ noteTools->show();
2182+
2183+ formatToolBar->setEnabled (true);
2184+ noteTools->setEnabled (true);
2185+ setFormatBarFont(((Note*)w)->currentEditor()->currentFont());
2186+ }
2187+}
2188+
2189+void ApplicationWindow::disableToolbars()
2190+{
2191+ plotTools->setEnabled(false);
2192+ tableTools->setEnabled(false);
2193+ columnTools->setEnabled(false);
2194+ plot3DTools->setEnabled(false);
2195+ plotMatrixBar->setEnabled(false);
2196+ noteTools->setEnabled(false);
2197+}
2198+
2199+void ApplicationWindow::plot3DRibbon()
2200+{
2201+ MdiSubWindow *w = activeWindow(TableWindow);
2202+ if (!w)
2203+ return;
2204+
2205+ Table *table = static_cast<Table*>(w);
2206+ if(table->selectedColumns().count() == 1){
2207+ if (!validFor3DPlot(table))
2208+ return;
2209+ plotXYZ(table, table->colName(table->selectedColumn()), Graph3D::Ribbon);
2210+ } else
2211+ QMessageBox::warning(this, tr("QtiPlot - Plot error"), tr("You must select exactly one column for plotting!"));
2212+}
2213+
2214+void ApplicationWindow::plot3DWireframe()
2215+{
2216+ plot3DMatrix (0, Qwt3D::WIREFRAME);
2217+}
2218+
2219+void ApplicationWindow::plot3DHiddenLine()
2220+{
2221+ plot3DMatrix (0, Qwt3D::HIDDENLINE);
2222+}
2223+
2224+void ApplicationWindow::plot3DPolygons()
2225+{
2226+ plot3DMatrix (0, Qwt3D::FILLED);
2227+}
2228+
2229+void ApplicationWindow::plot3DWireSurface()
2230+{
2231+ plot3DMatrix (0, Qwt3D::FILLEDMESH);
2232+}
2233+
2234+void ApplicationWindow::plot3DBars()
2235+{
2236+ MdiSubWindow *w = activeWindow();
2237+ if (!w)
2238+ return;
2239+
2240+ if (w->inherits("Table")){
2241+ Table *table = static_cast<Table *>(w);
2242+ if (!validFor3DPlot(table))
2243+ return;
2244+
2245+ if(table->selectedColumns().count() == 1)
2246+ plotXYZ(table, table->colName(table->selectedColumn()), Graph3D::Bars);
2247+ else
2248+ QMessageBox::warning(this, tr("QtiPlot - Plot error"),tr("You must select exactly one column for plotting!"));
2249+ }
2250+ else if(w->inherits("Matrix"))
2251+ plot3DMatrix(0, Qwt3D::USER);
2252+}
2253+
2254+void ApplicationWindow::plot3DScatter()
2255+{
2256+ MdiSubWindow *w = activeWindow();
2257+ if (!w)
2258+ return;
2259+
2260+ if (w->inherits("Table"))
2261+ {
2262+ Table *table = static_cast<Table *>(w);
2263+ if (!validFor3DPlot(table))
2264+ return;
2265+
2266+ if(table->selectedColumns().count() == 1)
2267+ plotXYZ(table, table->colName(table->selectedColumn()), Graph3D::Scatter);
2268+ else
2269+ QMessageBox::warning(this, tr("QtiPlot - Plot error"),tr("You must select exactly one column for plotting!"));
2270+ }
2271+ else if(w->inherits("Matrix"))
2272+ plot3DMatrix (0, Qwt3D::POINTS);
2273+}
2274+
2275+void ApplicationWindow::plot3DTrajectory()
2276+{
2277+ Table *table = (Table *)activeWindow(TableWindow);
2278+ if (!table)
2279+ return;
2280+ if (!validFor3DPlot(table))
2281+ return;
2282+
2283+ if(table->selectedColumns().count() == 1)
2284+ plotXYZ(table, table->colName(table->selectedColumn()), Graph3D::Trajectory);
2285+ else
2286+ QMessageBox::warning(this, tr("QtiPlot - Plot error"), tr("You must select exactly one column for plotting!"));
2287+}
2288+
2289+void ApplicationWindow::plotBoxDiagram()
2290+{
2291+ generate2DGraph(Graph::Box);
2292+}
2293+
2294+void ApplicationWindow::plotVerticalBars()
2295+{
2296+ generate2DGraph(Graph::VerticalBars);
2297+}
2298+
2299+void ApplicationWindow::plotHorizontalBars()
2300+{
2301+ generate2DGraph(Graph::HorizontalBars);
2302+}
2303+
2304+void ApplicationWindow::plotStackBar()
2305+{
2306+ generate2DGraph(Graph::StackBar);
2307+}
2308+
2309+void ApplicationWindow::plotStackColumn()
2310+{
2311+ generate2DGraph(Graph::StackColumn);
2312+}
2313+
2314+MultiLayer* ApplicationWindow::plotHistogram()
2315+{
2316+ return generate2DGraph(Graph::Histogram);
2317+}
2318+
2319+MultiLayer* ApplicationWindow::plotHistogram(Matrix *m)
2320+{
2321+ if (!m){
2322+ m = (Matrix*)activeWindow(MatrixWindow);
2323+ if (!m)
2324+ return 0;
2325+ }
2326+
2327+ QApplication::setOverrideCursor(QCursor(Qt::WaitCursor));
2328+ MultiLayer* g = newGraph();
2329+ if (g)
2330+ g->activeLayer()->addHistogram(m);
2331+ QApplication::restoreOverrideCursor();
2332+ return g;
2333+}
2334+
2335+void ApplicationWindow::plotArea()
2336+{
2337+ generate2DGraph(Graph::Area);
2338+}
2339+
2340+void ApplicationWindow::plotPie()
2341+{
2342+ Table *table = (Table *)activeWindow(TableWindow);
2343+ if (!table)
2344+ return;
2345+
2346+ if(table->selectedColumns().count() != 1){
2347+ QMessageBox::warning(this, tr("QtiPlot - Plot error"),
2348+ tr("You must select exactly one column for plotting!"));
2349+ return;
2350+ }
2351+
2352+ QStringList s = table->selectedColumns();
2353+ if (s.count()>0){
2354+ Q3TableSelection sel = table->getSelection();
2355+ multilayerPlot(table, s, Graph::Pie, sel.topRow(), sel.bottomRow());
2356+ } else
2357+ QMessageBox::warning(this, tr("QtiPlot - Error"), tr("Please select a column to plot!"));
2358+}
2359+
2360+void ApplicationWindow::plotL()
2361+{
2362+ generate2DGraph(Graph::Line);
2363+}
2364+
2365+void ApplicationWindow::plotP()
2366+{
2367+ generate2DGraph(Graph::Scatter);
2368+}
2369+
2370+void ApplicationWindow::plotLP()
2371+{
2372+ generate2DGraph(Graph::LineSymbols);
2373+}
2374+
2375+void ApplicationWindow::plotVerticalDropLines()
2376+{
2377+ generate2DGraph(Graph::VerticalDropLines);
2378+}
2379+
2380+void ApplicationWindow::plotSpline()
2381+{
2382+ generate2DGraph(Graph::Spline);
2383+}
2384+
2385+void ApplicationWindow::plotVertSteps()
2386+{
2387+ generate2DGraph(Graph::VerticalSteps);
2388+}
2389+
2390+void ApplicationWindow::plotHorSteps()
2391+{
2392+ generate2DGraph(Graph::HorizontalSteps);
2393+}
2394+
2395+void ApplicationWindow::plotVectXYXY()
2396+{
2397+ Table *table = (Table *)activeWindow(TableWindow);
2398+ if (!table)
2399+ return;
2400+ if (!validFor2DPlot(table, Graph::VectXYXY))
2401+ return;
2402+
2403+ QStringList s = table->selectedColumns();
2404+ if (s.count() == 4) {
2405+ Q3TableSelection sel = table->getSelection();
2406+ multilayerPlot(table, s, Graph::VectXYXY, sel.topRow(), sel.bottomRow());
2407+ } else
2408+ QMessageBox::warning(this, tr("QtiPlot - Error"), tr("Please select four columns for this operation!"));
2409+}
2410+
2411+void ApplicationWindow::plotVectXYAM()
2412+{
2413+ Table *table = (Table *)activeWindow(TableWindow);
2414+ if (!table)
2415+ return;
2416+ if (!validFor2DPlot(table, Graph::VectXYAM))
2417+ return;
2418+
2419+ QStringList s = table->selectedColumns();
2420+ if (s.count() == 4){
2421+ Q3TableSelection sel = table->getSelection();
2422+ multilayerPlot(table, s, Graph::VectXYAM, sel.topRow(), sel.bottomRow());
2423+ } else
2424+ QMessageBox::warning(this, tr("QtiPlot - Error"), tr("Please select four columns for this operation!"));
2425+}
2426+
2427+void ApplicationWindow::renameListViewItem(const QString& oldName,const QString& newName)
2428+{
2429+ Q3ListViewItem *it=lv->findItem (oldName,0, Q3ListView::ExactMatch | Qt::CaseSensitive );
2430+ if (it)
2431+ it->setText(0,newName);
2432+}
2433+
2434+void ApplicationWindow::setListViewLabel(const QString& caption,const QString& label)
2435+{
2436+ Q3ListViewItem *it = lv->findItem ( caption, 0, Q3ListView::ExactMatch | Qt::CaseSensitive );
2437+ if (it){
2438+ QString s = label;
2439+ it->setText(5, s.replace("\n", " "));
2440+ }
2441+}
2442+
2443+void ApplicationWindow::setListViewDate(const QString& caption,const QString& date)
2444+{
2445+ Q3ListViewItem *it=lv->findItem ( caption, 0, Q3ListView::ExactMatch | Qt::CaseSensitive );
2446+ if (it)
2447+ it->setText(4,date);
2448+}
2449+
2450+void ApplicationWindow::setListView(const QString& caption,const QString& view)
2451+{
2452+ Q3ListViewItem *it=lv->findItem ( caption,0, Q3ListView::ExactMatch | Qt::CaseSensitive );
2453+ if (it)
2454+ it->setText(2,view);
2455+}
2456+
2457+void ApplicationWindow::setListViewSize(const QString& caption,const QString& size)
2458+{
2459+ Q3ListViewItem *it=lv->findItem ( caption,0, Q3ListView::ExactMatch | Qt::CaseSensitive );
2460+ if (it)
2461+ it->setText(3,size);
2462+}
2463+
2464+QString ApplicationWindow::listViewDate(const QString& caption)
2465+{
2466+ Q3ListViewItem *it=lv->findItem (caption,0, Q3ListView::ExactMatch | Qt::CaseSensitive );
2467+ if (it)
2468+ return it->text(4);
2469+ else
2470+ return "";
2471+}
2472+
2473+void ApplicationWindow::updateTableNames(const QString& oldName, const QString& newName)
2474+{
2475+ QList<MdiSubWindow *> windows = windowsList();
2476+ foreach (MdiSubWindow *w, windows) {
2477+ if (w->isA("MultiLayer")) {
2478+ QList<Graph *> layers = ((MultiLayer*)w)->layersList();
2479+ foreach(Graph *g, layers)
2480+ g->updateCurveNames(oldName, newName);
2481+ } else if (w->isA("Graph3D")) {
2482+ QString name = ((Graph3D*)w)->formula();
2483+ if (name.contains(oldName, true)) {
2484+ name.replace(oldName,newName);
2485+ ((Graph3D*)w)->setPlotAssociation(name);
2486+ }
2487+ }
2488+ }
2489+}
2490+
2491+void ApplicationWindow::updateColNames(const QString& oldName, const QString& newName)
2492+{
2493+ QList<MdiSubWindow *> windows = windowsList();
2494+ foreach (MdiSubWindow *w, windows){
2495+ if (w->isA("MultiLayer")){
2496+ QList<Graph *> layers = ((MultiLayer*)w)->layersList();
2497+ foreach(Graph *g, layers)
2498+ g->updateCurveNames(oldName, newName, false);
2499+ }
2500+ else if (w->isA("Graph3D")){
2501+ QString name = ((Graph3D*)w)->formula();
2502+ if (name.contains(oldName)){
2503+ name.replace(oldName,newName);
2504+ ((Graph3D*)w)->setPlotAssociation(name);
2505+ }
2506+ }
2507+ }
2508+}
2509+
2510+void ApplicationWindow::changeMatrixName(const QString& oldName, const QString& newName)
2511+{
2512+ QList<MdiSubWindow *> windows = windowsList();
2513+ foreach(MdiSubWindow *w, windows){
2514+ if (w->isA("Graph3D"))
2515+ {
2516+ QString s = ((Graph3D*)w)->formula();
2517+ if (s.contains(oldName))
2518+ {
2519+ s.replace(oldName, newName);
2520+ ((Graph3D*)w)->setPlotAssociation(s);
2521+ }
2522+ }
2523+ else if (w->isA("MultiLayer"))
2524+ {
2525+ QList<Graph *> layers = ((MultiLayer*)w)->layersList();
2526+ foreach(Graph *g, layers){
2527+ for (int i=0; i<g->curveCount(); i++){
2528+ QwtPlotItem *sp = (QwtPlotItem *)g->plotItem(i);
2529+ if (sp && sp->rtti() == QwtPlotItem::Rtti_PlotSpectrogram && sp->title().text() == oldName)
2530+ sp->setTitle(newName);
2531+ }
2532+ }
2533+ }
2534+ }
2535+}
2536+
2537+void ApplicationWindow::remove3DMatrixPlots(Matrix *m)
2538+{
2539+ if (!m)
2540+ return;
2541+
2542+ QApplication::setOverrideCursor(QCursor(Qt::WaitCursor));
2543+
2544+ QList<MdiSubWindow *> windows = windowsList();
2545+ foreach(MdiSubWindow *w, windows){
2546+ if (w->isA("Graph3D") && ((Graph3D*)w)->matrix() == m)
2547+ ((Graph3D*)w)->clearData();
2548+ else if (w->isA("MultiLayer")){
2549+ QList<Graph *> layers = ((MultiLayer*)w)->layersList();
2550+ foreach(Graph *g, layers){
2551+ QList<QwtPlotItem *> curvesList = g->curvesList();
2552+ foreach (QwtPlotItem *it, curvesList){
2553+ if (it->rtti() == QwtPlotItem::Rtti_PlotSpectrogram){
2554+ if (((Spectrogram *)it)->matrix() == m)
2555+ g->removeCurve(it);
2556+ } else if (((PlotCurve *)it)->type() == Graph::Histogram){
2557+ if (((QwtHistogram *)it)->matrix() == m)
2558+ g->removeCurve(it);
2559+ }
2560+ }
2561+ g->updatePlot();
2562+ }
2563+ }
2564+ }
2565+ QApplication::restoreOverrideCursor();
2566+}
2567+
2568+void ApplicationWindow::updateMatrixPlots(Matrix *m)
2569+{
2570+ if (!m)
2571+ return;
2572+
2573+ QApplication::setOverrideCursor(QCursor(Qt::WaitCursor));
2574+
2575+ QList<MdiSubWindow *> windows = windowsList();
2576+ foreach(MdiSubWindow *w, windows){
2577+ if (w->isA("Graph3D") && ((Graph3D*)w)->matrix() == m)
2578+ ((Graph3D*)w)->updateMatrixData(m);
2579+ else if (w->isA("MultiLayer")){
2580+ QList<Graph *> layers = ((MultiLayer*)w)->layersList();
2581+ foreach(Graph *g, layers){
2582+ QList<QwtPlotItem *> curvesList = g->curvesList();
2583+ foreach (QwtPlotItem *it, curvesList){
2584+ if (it->rtti() == QwtPlotItem::Rtti_PlotSpectrogram){
2585+ Spectrogram *sp = (Spectrogram *)it;
2586+ if (sp->matrix() == m){
2587+ sp->updateData();
2588+ g->updatePlot();
2589+ }
2590+ } else if (((PlotCurve *)it)->type() == Graph::Histogram){
2591+ QwtHistogram *h = (QwtHistogram *)it;
2592+ if (h->matrix() == m){
2593+ h->loadData();
2594+ g->updatePlot();
2595+ }
2596+ }
2597+ }
2598+ }
2599+ }
2600+ }
2601+ QApplication::restoreOverrideCursor();
2602+}
2603+
2604+void ApplicationWindow::add3DData()
2605+{
2606+ if (!hasTable()){
2607+ QMessageBox::warning(this,tr("QtiPlot - Warning"),
2608+ tr("<h4>There are no tables available in this project.</h4>"
2609+ "<p><h4>Please create a table and try again!</h4>"));
2610+ return;
2611+ }
2612+
2613+ QStringList zColumns = columnsList(Table::Z);
2614+ if ((int)zColumns.count() <= 0){
2615+ QMessageBox::critical(this,tr("QtiPlot - Warning"),
2616+ tr("There are no available columns with plot designation set to Z!"));
2617+ return;
2618+ }
2619+
2620+ bool ok;
2621+ QString column = QInputDialog::getItem(this, tr("QtiPlot - Choose data set"),
2622+ tr("Column") + ": ", zColumns, 0, false, &ok);
2623+ if (ok && !column.isEmpty())
2624+ insertNew3DData(column);
2625+}
2626+
2627+void ApplicationWindow::change3DData()
2628+{
2629+ bool ok;
2630+ QString column = QInputDialog::getItem(this, tr("QtiPlot - Choose data set"),
2631+ tr("Column") + ": ", columnsList(Table::Z), 0, false, &ok);
2632+ if (ok && !column.isEmpty())
2633+ change3DData(column);
2634+}
2635+
2636+void ApplicationWindow::change3DMatrix()
2637+{
2638+ QStringList matrices = matrixNames();
2639+ int currentIndex = 0;
2640+ Graph3D* g = (Graph3D*)activeWindow(Plot3DWindow);
2641+ if (g && g->matrix())
2642+ currentIndex = matrices.indexOf(g->matrix()->objectName());
2643+
2644+ bool ok;
2645+ QString matrixName = QInputDialog::getItem(this, tr("QtiPlot - Choose matrix to plot"),
2646+ tr("Matrix") + ": ", matrices, currentIndex, false, &ok);
2647+ if (ok && !matrixName.isEmpty())
2648+ change3DMatrix(matrixName);
2649+}
2650+
2651+void ApplicationWindow::change3DMatrix(const QString& matrix_name)
2652+{
2653+ Graph3D *g = (Graph3D*)activeWindow(Plot3DWindow);
2654+ if (!g)
2655+ return;
2656+
2657+ Matrix *m = matrix(matrix_name);
2658+ if (!m)
2659+ return;
2660+
2661+ if (d_3D_autoscale)
2662+ g->addMatrixData(m);
2663+ else
2664+ g->addMatrixData(m, g->xStart(), g->xStop(), g->yStart(), g->yStop(), g->zStart(), g->zStop());
2665+
2666+ emit modified();
2667+}
2668+
2669+void ApplicationWindow::add3DMatrixPlot()
2670+{
2671+ QStringList matrices = matrixNames();
2672+ if ((int)matrices.count() <= 0){
2673+ QMessageBox::warning(this, tr("QtiPlot - Warning"),
2674+ tr("<h4>There are no matrices available in this project.</h4>"
2675+ "<p><h4>Please create a matrix and try again!</h4>"));
2676+ return;
2677+ }
2678+
2679+ bool ok;
2680+ QString matrixName = QInputDialog::getItem(this, tr("QtiPlot - Choose matrix to plot"),
2681+ tr("Matrix") + ": ", matrices, 0, false, &ok);
2682+ if (ok && !matrixName.isEmpty())
2683+ insert3DMatrixPlot(matrixName);
2684+}
2685+
2686+void ApplicationWindow::insert3DMatrixPlot(const QString& matrix_name)
2687+{
2688+ Graph3D *g = (Graph3D*)activeWindow(Plot3DWindow);
2689+ if (!g)
2690+ return;
2691+
2692+ g->addMatrixData(matrix(matrix_name));
2693+ emit modified();
2694+}
2695+
2696+void ApplicationWindow::insertNew3DData(const QString& colName)
2697+{
2698+ Graph3D *g = (Graph3D*)activeWindow(Plot3DWindow);
2699+ if (!g)
2700+ return;
2701+
2702+ g->insertNewData(table(colName),colName);
2703+ emit modified();
2704+}
2705+
2706+void ApplicationWindow::change3DData(const QString& colName)
2707+{
2708+ Graph3D *g = (Graph3D*)activeWindow(Plot3DWindow);
2709+ if (!g)
2710+ return;
2711+
2712+ g->changeDataColumn(table(colName), colName, g->tablePlotType());
2713+ emit modified();
2714+}
2715+
2716+void ApplicationWindow::editSurfacePlot()
2717+{
2718+ Graph3D *g = (Graph3D*)activeWindow(Plot3DWindow);
2719+ if (!g)
2720+ return;
2721+
2722+ SurfaceDialog* sd = new SurfaceDialog(this);
2723+ sd->setAttribute(Qt::WA_DeleteOnClose);
2724+
2725+ if (g->hasData() && g->userFunction())
2726+ sd->setFunction(g);
2727+ else if (g->hasData() && g->parametricSurface())
2728+ sd->setParametricSurface(g);
2729+ else
2730+ sd->setGraph(g);
2731+ sd->exec();
2732+}
2733+
2734+void ApplicationWindow::newSurfacePlot()
2735+{
2736+ SurfaceDialog* sd = new SurfaceDialog(this);
2737+ sd->setAttribute(Qt::WA_DeleteOnClose);
2738+ sd->exec();
2739+}
2740+
2741+Graph3D* ApplicationWindow::plotSurface(const QString& formula, double xl, double xr,
2742+ double yl, double yr, double zl, double zr, int columns, int rows)
2743+{
2744+ Graph3D *plot = newPlot3D();
2745+ if(!plot)
2746+ return 0;
2747+
2748+ plot->addFunction(formula, xl, xr, yl, yr, zl, zr, columns, rows);
2749+ plot->setDataColorMap(d_3D_color_map);
2750+ plot->update();
2751+
2752+ emit modified();
2753+ return plot;
2754+}
2755+
2756+Graph3D* ApplicationWindow::plotParametricSurface(const QString& xFormula, const QString& yFormula,
2757+ const QString& zFormula, double ul, double ur, double vl, double vr,
2758+ int columns, int rows, bool uPeriodic, bool vPeriodic)
2759+{
2760+ Graph3D *plot = newPlot3D();
2761+ if(!plot)
2762+ return 0;
2763+ plot->addParametricSurface(xFormula, yFormula, zFormula, ul, ur, vl, vr,
2764+ columns, rows, uPeriodic, vPeriodic);
2765+ plot->setDataColorMap(d_3D_color_map);
2766+ plot->update();
2767+
2768+ emit modified();
2769+ return plot;
2770+}
2771+
2772+void ApplicationWindow::updateSurfaceFuncList(const QString& s)
2773+{
2774+ surfaceFunc.remove(s);
2775+ surfaceFunc.push_front(s);
2776+ while ((int)surfaceFunc.size() > 10)
2777+ surfaceFunc.pop_back();
2778+}
2779+
2780+Graph3D* ApplicationWindow::addRibbon(const QString& caption, const QString& formula,
2781+ double xl, double xr, double yl, double yr, double zl, double zr)
2782+{
2783+ Table* t = table(formula.left(formula.find("_", 0)));
2784+ if (!t)
2785+ return 0;
2786+
2787+ QString s = formula;
2788+ s.remove("(X)").remove("(Y)");
2789+ QStringList l = s.split(",");
2790+ if (l.size() != 2)
2791+ return 0;
2792+
2793+ Graph3D *plot = newPlot3D(caption);
2794+ if(!plot)
2795+ return 0;
2796+
2797+ plot->addRibbon(t, l[0], l[1], xl, xr, yl, yr, zl, zr);
2798+ plot->setDataColorMap(d_3D_color_map);
2799+ plot->update();
2800+
2801+ return plot;
2802+}
2803+
2804+Graph3D* ApplicationWindow::newPlot3D(const QString& title)
2805+{
2806+ QApplication::setOverrideCursor(QCursor(Qt::WaitCursor));
2807+
2808+ QString label = title;
2809+ if (label.isEmpty() || alreadyUsedName(label))
2810+ label = generateUniqueName(tr("Graph"));
2811+
2812+ Graph3D *plot = new Graph3D("", this, 0);
2813+ plot->setWindowTitle(label);
2814+ plot->setName(label);
2815+
2816+ initPlot3D(plot);
2817+
2818+ emit modified();
2819+ QApplication::restoreOverrideCursor();
2820+ return plot;
2821+}
2822+
2823+Graph3D* ApplicationWindow::plotXYZ(Table* table, const QString& zColName, int type)
2824+{
2825+ int zCol = table->colIndex(zColName);
2826+ if (zCol < 0)
2827+ return 0;
2828+
2829+ QApplication::setOverrideCursor(QCursor(Qt::WaitCursor));
2830+
2831+ Graph3D *plot = newPlot3D();
2832+ if(!plot)
2833+ return 0;
2834+
2835+ if (type == Graph3D::Ribbon) {
2836+ int ycol = table->colIndex(zColName);
2837+ plot->addRibbon(table, table->colName(table->colX(ycol)), zColName);
2838+ } else
2839+ plot->addData(table, table->colX(zCol), table->colY(zCol), zCol, type);
2840+
2841+ plot->setDataColorMap(d_3D_color_map);
2842+ plot->update();
2843+
2844+ emit modified();
2845+ QApplication::restoreOverrideCursor();
2846+ return plot;
2847+}
2848+
2849+void ApplicationWindow::initPlot3D(Graph3D *plot)
2850+{
2851+ if (d_mdi_windows_area)
2852+ d_workspace->addSubWindow(plot);
2853+ else
2854+ plot->setParent(0);
2855+
2856+ connectSurfacePlot(plot);
2857+
2858+ plot->setIcon(QPixmap(":/trajectory.png"));
2859+ plot->show();
2860+ //plot->setFocus();
2861+
2862+ addListViewItem(plot);
2863+
2864+ if (!plot3DTools->isVisible())
2865+ plot3DTools->show();
2866+
2867+ if (!plot3DTools->isEnabled())
2868+ plot3DTools->setEnabled(true);
2869+
2870+ customMenu(plot);
2871+ customToolBars(plot);
2872+}
2873+
2874+void ApplicationWindow::exportMatrix(const QString& exportFilter)
2875+{
2876+ Matrix* m = (Matrix*)activeWindow(MatrixWindow);
2877+ if (!m)
2878+ return;
2879+
2880+ ImageExportDialog *ied = new ImageExportDialog(m, this, d_extended_export_dialog);
2881+ ied->setDir(imagesDirPath);
2882+ ied->selectFile(m->objectName());
2883+ if (exportFilter.isEmpty())
2884+ ied->selectFilter(d_image_export_filter);
2885+ else
2886+ ied->selectFilter(exportFilter);
2887+
2888+ if ( ied->exec() != QDialog::Accepted )
2889+ return;
2890+ imagesDirPath = ied->directory().path();
2891+
2892+ QString selected_filter = ied->selectedFilter().remove("*");
2893+ QString file_name = ied->selectedFiles()[0];
2894+ if(!file_name.endsWith(selected_filter, Qt::CaseInsensitive))
2895+ file_name.append(selected_filter);
2896+
2897+ if (selected_filter.contains(".eps") || selected_filter.contains(".pdf") || selected_filter.contains(".ps"))
2898+ m->exportVector(file_name, ied->vectorResolution(), ied->color());
2899+ else if (selected_filter.contains(".svg"))
2900+ m->exportSVG(file_name);
2901+#ifdef EMF_OUTPUT
2902+ else if (selected_filter.contains(".emf"))
2903+ m->exportEMF(file_name);
2904+#endif
2905+ else if (selected_filter.contains(".odf"))
2906+ m->exportRasterImage(file_name, ied->quality(), ied->bitmapResolution());
2907+ else {
2908+ QList<QByteArray> list = QImageWriter::supportedImageFormats();
2909+ for (int i=0; i<(int)list.count(); i++){
2910+ if (selected_filter.contains("." + (list[i]).lower()))
2911+ m->exportRasterImage(file_name, ied->quality(), ied->bitmapResolution());
2912+ }
2913+ }
2914+}
2915+
2916+Matrix* ApplicationWindow::importImage(const QString& fileName, bool newWindow)
2917+{
2918+ QString fn = fileName;
2919+ if (fn.isEmpty()){
2920+ fn = getFileName(this, tr("QtiPlot - Import image from file"), imagesDirPath, imageFilter(), 0, false);
2921+ if ( !fn.isEmpty() ){
2922+ QFileInfo fi(fn);
2923+ imagesDirPath = fi.dirPath(true);
2924+ }
2925+ }
2926+
2927+ QImage image(fn);
2928+ if (image.isNull())
2929+ return 0;
2930+
2931+ QApplication::setOverrideCursor(QCursor(Qt::WaitCursor));
2932+
2933+ MdiSubWindow *w = activeWindow(MatrixWindow);
2934+ Matrix* m = NULL;
2935+ if (w && !newWindow){
2936+ m = (Matrix *)w;
2937+ m->importImage(fn);
2938+ } else {
2939+ m = new Matrix(scriptEnv, image, "", this);
2940+ initMatrix(m, generateUniqueName(tr("Matrix")));
2941+ m->show();
2942+ m->setWindowLabel(fn);
2943+ m->setCaptionPolicy(MdiSubWindow::Both);
2944+ }
2945+
2946+ QApplication::restoreOverrideCursor();
2947+ return m;
2948+}
2949+
2950+QString ApplicationWindow::imageFilter()
2951+{
2952+ QList<QByteArray> list = QImageReader::supportedImageFormats();
2953+ QString filter = tr("Images") + " (", aux1, aux2;
2954+ for (int i = 0; i < (int)list.count(); i++){
2955+ aux1 = " *." + list[i] + " ";
2956+ aux2 += " *." + list[i] + ";;";
2957+ filter += aux1;
2958+ }
2959+ filter += ");;" + aux2;
2960+ return filter;
2961+}
2962+
2963+void ApplicationWindow::loadImage()
2964+{
2965+ QString fn = getFileName(this, tr("QtiPlot - Load image from file"), imagesDirPath, imageFilter(), 0, false);
2966+ if ( !fn.isEmpty() ){
2967+ loadImage(fn);
2968+ QFileInfo fi(fn);
2969+ imagesDirPath = fi.dirPath(true);
2970+ }
2971+}
2972+
2973+void ApplicationWindow::loadImage(const QString& fn)
2974+{
2975+ QApplication::setOverrideCursor(QCursor(Qt::WaitCursor));
2976+
2977+ MultiLayer *plot = multilayerPlot(generateUniqueName(tr("Graph")));
2978+ plot->setWindowLabel(fn);
2979+ plot->setCaptionPolicy(MdiSubWindow::Both);
2980+
2981+ Graph *g = plot->activeLayer();
2982+ g->setTitle("");
2983+ for (int i=0; i<4; i++)
2984+ g->enableAxis(i, false);
2985+ g->addImage(fn);
2986+ QApplication::restoreOverrideCursor();
2987+}
2988+
2989+MultiLayer* ApplicationWindow::multilayerPlot(const QString& caption, int layers, int rows, int cols)
2990+{
2991+ MultiLayer* ml = new MultiLayer(this, layers, rows, cols);
2992+ initMultilayerPlot(ml, caption);
2993+ return ml;
2994+}
2995+
2996+MultiLayer* ApplicationWindow::newGraph(const QString& caption)
2997+{
2998+ MultiLayer *ml = multilayerPlot(generateUniqueName(caption));
2999+ if (ml){
3000+ Graph *g = ml->activeLayer();
3001+ if (g){
3002+ setPreferences(g);
3003+ g->newLegend();
3004+ }
3005+ ml->arrangeLayers(false, true);
3006+ }
3007+
3008+ return ml;
3009+}
3010+
3011+MultiLayer* ApplicationWindow::multilayerPlot(Table* w, const QStringList& colList, int style, int startRow, int endRow)
3012+{//used when plotting selected columns
3013+ if (!w)
3014+ return 0;
3015+
3016+ QApplication::setOverrideCursor(QCursor(Qt::WaitCursor));
3017+
3018+ MultiLayer* g = multilayerPlot(generateUniqueName(tr("Graph")));
3019+ Graph *ag = g->activeLayer();
3020+ if (!ag)
3021+ return 0;
3022+
3023+ setPreferences(ag);
3024+ ag->addCurves(w, colList, style, defaultCurveLineWidth, defaultSymbolSize, startRow, endRow);
3025+ ag->newLegend();
3026+
3027+ g->arrangeLayers(false, true);
3028+ QApplication::restoreOverrideCursor();
3029+ return g;
3030+}
3031+
3032+MultiLayer* ApplicationWindow::multilayerPlot(int c, int r, int style, const MultiLayer::AlignPolicy& align)
3033+{//used when plotting from the panel menu
3034+ Table *t = (Table *)activeWindow(TableWindow);
3035+ if (!t)
3036+ return 0;
3037+
3038+ if (!validFor2DPlot(t, (Graph::CurveType)style))
3039+ return 0;
3040+
3041+ QStringList list = t->drawableColumnSelection();
3042+ if((int)list.count() < 1) {
3043+ QMessageBox::warning(this, tr("QtiPlot - Plot error"), tr("Please select a Y column to plot!"));
3044+ return 0;
3045+ }
3046+
3047+ int curves = list.count();
3048+ if (r < 0)
3049+ r = curves;
3050+
3051+ int layers = c*r;
3052+ MultiLayer* g = multilayerPlot(generateUniqueName(tr("Graph")), layers, r, c);
3053+ QList<Graph *> layersList = g->layersList();
3054+ int i = 0;
3055+ foreach(Graph *ag, layersList){
3056+ setPreferences(ag);
3057+ if (i < curves){
3058+ QStringList lst = QStringList() << list[i];
3059+ for (int j = 0; j < curves; j++){
3060+ int col = t->colIndex(list[j]);
3061+ if (t->colPlotDesignation(col) == Table::xErr ||
3062+ t->colPlotDesignation(col) == Table::yErr ||
3063+ t->colPlotDesignation(col) == Table::Label){
3064+ lst << list[j];
3065+ }
3066+ }
3067+ ag->addCurves(t, lst, style, defaultCurveLineWidth, defaultSymbolSize);
3068+ }
3069+ i++;
3070+ }
3071+
3072+ if (align == MultiLayer::AlignCanvases){
3073+ g->setAlignPolicy(align);
3074+ g->setSpacing(0, 0);
3075+ g->setCommonLayerAxes();
3076+ connect(layersList.last(), SIGNAL(updatedLayout(Graph *)), g, SLOT(updateLayersLayout(Graph *)));
3077+ } else {
3078+ g->arrangeLayers(false, true);
3079+ foreach(Graph *ag, layersList){
3080+ if (ag->curveCount())
3081+ ag->newLegend();
3082+ }
3083+ }
3084+ return g;
3085+}
3086+
3087+MultiLayer* ApplicationWindow::waterfallPlot()
3088+{
3089+ Table *t = (Table *)activeWindow(TableWindow);
3090+ if (!t)
3091+ return 0;
3092+
3093+ return waterfallPlot(t, t->selectedYColumns());
3094+}
3095+
3096+MultiLayer* ApplicationWindow::waterfallPlot(Table *t, const QStringList& list)
3097+{
3098+ if (!t)
3099+ return 0;
3100+
3101+ int curves = list.count();
3102+ if(curves < 1){
3103+ QMessageBox::warning(this, tr("QtiPlot - Plot error"),
3104+ tr("Please select a Y column to plot!"));
3105+ return 0;
3106+ }
3107+
3108+ MultiLayer* ml = new MultiLayer(this, curves, 1, 1);
3109+ QList<Graph *> layersList = ml->layersList();
3110+ int i = 0;
3111+ foreach(Graph *g, layersList){
3112+ DataCurve *cv = g->insertCurve(t, list[i], Graph::Line);
3113+ if (cv)
3114+ cv->setPen(QPen(d_indexed_colors[i], defaultCurveLineWidth));
3115+ i++;
3116+ }
3117+ QString legend = QString();
3118+ initMultilayerPlot(ml, QString());
3119+ foreach(Graph *g, layersList){
3120+ g->hide();
3121+ legend += g->legendText(true) + "\n";
3122+ setPreferences(g);
3123+ g->setCanvasFrame(0);
3124+ g->setTitle(QString::null);
3125+ g->setMargin(0);
3126+ g->setFrame(0);
3127+ g->raise();
3128+ }
3129+
3130+ ml->setWaterfallLayout();
3131+ Graph *g = layersList.last();
3132+ if (g)
3133+ g->newLegend(legend.trimmed())->move(QPoint(5, 5));
3134+ return ml;
3135+}
3136+
3137+void ApplicationWindow::initMultilayerPlot(MultiLayer* g, const QString& name)
3138+{
3139+ QString label = name;
3140+ while(alreadyUsedName(label))
3141+ label = generateUniqueName(tr("Graph"));
3142+
3143+ g->setWindowTitle(label);
3144+ g->setName(label);
3145+ g->setIcon(QPixmap(":/graph.png"));
3146+ g->setScaleLayersOnPrint(d_scale_plots_on_print);
3147+ g->printCropmarks(d_print_cropmarks);
3148+
3149+ if (d_mdi_windows_area)
3150+ d_workspace->addSubWindow(g);
3151+ else
3152+ g->setParent(0);
3153+
3154+ connectMultilayerPlot(g);
3155+ g->showNormal();
3156+
3157+ addListViewItem(g);
3158+}
3159+
3160+void ApplicationWindow::setAutoUpdateTableValues(bool on)
3161+{
3162+ if (d_auto_update_table_values == on)
3163+ return;
3164+
3165+ d_auto_update_table_values = on;
3166+
3167+ Folder *f = projectFolder();
3168+ while (f){
3169+ QList<MdiSubWindow *> folderWindows = f->windowsList();
3170+ foreach(MdiSubWindow *w, folderWindows){
3171+ if (w->inherits("Table"))
3172+ ((Table *)w)->setAutoUpdateValues(d_auto_update_table_values);
3173+ }
3174+ f = f->folderBelow();
3175+ }
3176+}
3177+
3178+void ApplicationWindow::customTable(Table* w)
3179+{
3180+ QColorGroup cg;
3181+ cg.setColor(QColorGroup::Base, tableBkgdColor);
3182+ cg.setColor(QColorGroup::Text, tableTextColor);
3183+ w->setPalette(QPalette(cg, cg, cg));
3184+
3185+ w->setHeaderColor(tableHeaderColor);
3186+ w->setTextFont(tableTextFont);
3187+ w->setHeaderFont(tableHeaderFont);
3188+ w->showComments(d_show_table_comments);
3189+ w->setNumericPrecision(d_decimal_digits);
3190+}
3191+
3192+void ApplicationWindow::setPreferences(Graph* g)
3193+{
3194+ if (!g)
3195+ return;
3196+
3197+ if (!g->isPiePlot()){
3198+ for (int i = 0; i < QwtPlot::axisCnt; i++){
3199+ bool show = d_show_axes[i];
3200+ g->enableAxis(i, show);
3201+ if(show){
3202+ ScaleDraw *sd = (ScaleDraw *)g->axisScaleDraw (i);
3203+ sd->enableComponent(QwtAbstractScaleDraw::Labels, d_show_axes_labels[i]);
3204+ sd->setSpacing(d_graph_tick_labels_dist);
3205+ if (i == QwtPlot::yRight && !d_show_axes_labels[i])
3206+ g->setAxisTitle(i, tr(" "));
3207+ }
3208+ }
3209+
3210+ g->updateSecondaryAxis(QwtPlot::xTop);
3211+ g->updateSecondaryAxis(QwtPlot::yRight);
3212+
3213+ QList<int> ticksList;
3214+ ticksList<<majTicksStyle<<majTicksStyle<<majTicksStyle<<majTicksStyle;
3215+ g->setMajorTicksType(ticksList);
3216+ ticksList.clear();
3217+ ticksList<<minTicksStyle<<minTicksStyle<<minTicksStyle<<minTicksStyle;
3218+ g->setMinorTicksType(ticksList);
3219+
3220+ g->setTicksLength (minTicksLength, majTicksLength);
3221+ g->setAxesLinewidth(axesLineWidth);
3222+ g->drawAxesBackbones(drawBackbones);
3223+ g->setCanvasFrame(canvasFrameWidth, d_canvas_frame_color);
3224+ for (int i = 0; i < QwtPlot::axisCnt; i++)
3225+ g->setAxisTitleDistance(i, d_graph_axes_labels_dist);
3226+ }
3227+
3228+ g->setAxisTitlePolicy(d_graph_axis_labeling);
3229+ g->setSynchronizedScaleDivisions(d_synchronize_graph_scales);
3230+ g->initFonts(plotAxesFont, plotNumbersFont);
3231+ g->initTitle(titleOn, plotTitleFont);
3232+
3233+ g->setMargin(defaultPlotMargin);
3234+ g->enableAutoscaling(autoscale2DPlots);
3235+ g->setAutoscaleFonts(autoScaleFonts);
3236+ g->setAntialiasing(antialiasing2DPlots);
3237+ g->setFrame(d_graph_border_width, d_graph_border_color);
3238+
3239+ QColor c = d_graph_background_color;
3240+ c.setAlpha(d_graph_background_opacity);
3241+ g->setBackgroundColor(c);
3242+
3243+ c = d_graph_canvas_color;
3244+ c.setAlpha(d_graph_canvas_opacity);
3245+ g->setCanvasBackground(c);
3246+}
3247+
3248+/*
3249+ * return the current Plot (used for the Python interface)
3250+ */
3251+MultiLayer* ApplicationWindow::currentPlot()
3252+{
3253+ MultiLayer* p = (MultiLayer*)activeWindow(MultiLayerWindow);
3254+ return p;
3255+}
3256+
3257+/*
3258+ * return the current Table (used for the Python interface)
3259+ */
3260+Table* ApplicationWindow::currentTable()
3261+{
3262+ Table* w = (Table*)activeWindow(TableWindow);
3263+ return w;
3264+}
3265+
3266+/*
3267+ *creates a new empty table
3268+ */
3269+Table* ApplicationWindow::newTable()
3270+{
3271+ Table* w = new Table(scriptEnv, 30, 2, "", this, 0);
3272+ initTable(w, generateUniqueName(tr("Table")));
3273+ w->showNormal();
3274+ return w;
3275+}
3276+
3277+/*
3278+ *used when opening a project file
3279+ */
3280+Table* ApplicationWindow::newTable(const QString& caption, int r, int c)
3281+{
3282+ Table* w = new Table(scriptEnv, r, c, "", this, 0);
3283+ initTable(w, caption);
3284+ if (d_is_appending_file && w->objectName() != caption){//the table was renamed
3285+ renamedTables << caption << w->objectName();
3286+ if (d_inform_rename_table){
3287+ QApplication::restoreOverrideCursor();
3288+ QMessageBox:: warning(this, tr("QtiPlot - Renamed Window"),
3289+ tr("The table '%1' already exists. It has been renamed '%2'.").arg(caption).arg(w->objectName()));
3290+ QApplication::setOverrideCursor(QCursor(Qt::WaitCursor));
3291+ }
3292+ }
3293+ w->showNormal();
3294+ return w;
3295+}
3296+
3297+Table* ApplicationWindow::newTable(int r, int c, const QString& name, const QString& legend)
3298+{
3299+ Table* w = new Table(scriptEnv, r, c, legend, this, 0);
3300+ initTable(w, name);
3301+ return w;
3302+}
3303+
3304+Table* ApplicationWindow::newHiddenTable(const QString& name, const QString& label, int r, int c, const QString& text)
3305+{
3306+ Table* w = new Table(scriptEnv, r, c, label, this, 0);
3307+
3308+ if (!text.isEmpty()) {
3309+ QStringList rows = text.split("\n", QString::SkipEmptyParts);
3310+ QStringList list = rows[0].split("\t");
3311+ w->setHeader(list);
3312+
3313+ QString rlist;
3314+ for (int i=0; i<r; i++){
3315+ rlist=rows[i+1];
3316+ list = rlist.split("\t");
3317+ for (int j=0; j<c; j++)
3318+ w->setText(i, j, list[j]);
3319+ }
3320+ }
3321+
3322+ initTable(w, name);
3323+ hideWindow(w);
3324+ return w;
3325+}
3326+
3327+void ApplicationWindow::initTable(Table* w, const QString& caption)
3328+{
3329+ QString name = caption;
3330+ name = name.replace ("_","-");
3331+
3332+ while(name.isEmpty() || alreadyUsedName(name))
3333+ name = generateUniqueName(tr("Table"));
3334+
3335+ if (d_mdi_windows_area)
3336+ d_workspace->addSubWindow(w);
3337+ else
3338+ w->setParent(0);
3339+
3340+ connectTable(w);
3341+ customTable(w);
3342+
3343+ w->setName(name);
3344+ w->setIcon(QPixmap(":/worksheet.png") );
3345+ addListViewItem(w);
3346+}
3347+
3348+/*
3349+ * !creates a new table with type statistics on target columns/rows of table base
3350+ */
3351+TableStatistics *ApplicationWindow::newTableStatistics(Table *base, int type, QList<int> target, const QString &caption)
3352+{
3353+ TableStatistics* s = new TableStatistics(scriptEnv, this, base, (TableStatistics::Type) type, target);
3354+ if (caption.isEmpty())
3355+ initTable(s, s->objectName());
3356+ else
3357+ initTable(s, caption);
3358+ s->showNormal();
3359+ return s;
3360+}
3361+
3362+/*
3363+ * return the current note (used for the Python interface)
3364+ */
3365+Note* ApplicationWindow::currentNote()
3366+{
3367+ Note* m = (Note*)activeWindow(NoteWindow);
3368+ return m;
3369+}
3370+
3371+/*
3372+ *creates a new empty note window
3373+ */
3374+Note* ApplicationWindow::newNote(const QString& caption)
3375+{
3376+ Note* m = new Note(scriptEnv, "", this);
3377+
3378+ QString name = caption;
3379+ while(name.isEmpty() || alreadyUsedName(name))
3380+ name = generateUniqueName(tr("Notes"));
3381+
3382+ m->setName(name);
3383+ m->setIcon(QPixmap(":/note.png"));
3384+ m->askOnCloseEvent(confirmCloseNotes);
3385+
3386+ if (d_mdi_windows_area)
3387+ d_workspace->addSubWindow(m);
3388+ else
3389+ m->setParent(0);
3390+
3391+ addListViewItem(m);
3392+
3393+ connect(m, SIGNAL(modifiedWindow(MdiSubWindow*)), this, SLOT(modifiedProject(MdiSubWindow*)));
3394+ connect(m, SIGNAL(resizedWindow(MdiSubWindow*)),this,SLOT(modifiedProject(MdiSubWindow*)));
3395+ connect(m, SIGNAL(closedWindow(MdiSubWindow*)), this, SLOT(closeWindow(MdiSubWindow*)));
3396+ connect(m, SIGNAL(hiddenWindow(MdiSubWindow*)), this, SLOT(hideWindow(MdiSubWindow*)));
3397+ connect(m, SIGNAL(statusChanged(MdiSubWindow*)), this, SLOT(updateWindowStatus(MdiSubWindow*)));
3398+ connect(m, SIGNAL(dirPathChanged(const QString&)), this, SLOT(scriptsDirPathChanged(const QString&)));
3399+ connect(m, SIGNAL(currentEditorChanged()), this, SLOT(scriptingMenuAboutToShow()));
3400+
3401+ m->showNormal();
3402+ return m;
3403+}
3404+
3405+void ApplicationWindow::connectScriptEditor(ScriptEdit *editor)
3406+{
3407+ if (!editor)
3408+ return;
3409+
3410+ QTextDocument *doc = editor->document();
3411+ actionUndo->setEnabled(doc->isUndoAvailable());
3412+ actionRedo->setEnabled(doc->isRedoAvailable());
3413+
3414+ connect(editor, SIGNAL(undoAvailable(bool)), actionUndo, SLOT(setEnabled(bool)));
3415+ connect(editor, SIGNAL(redoAvailable(bool)), actionRedo, SLOT(setEnabled(bool)));
3416+}
3417+
3418+/*
3419+ * return the current Matrix (used for the Python interface)
3420+ */
3421+Matrix* ApplicationWindow::currentMatrix()
3422+{
3423+ Matrix* m = (Matrix*)activeWindow(MatrixWindow);
3424+ return m;
3425+}
3426+
3427+Matrix* ApplicationWindow::newMatrix(int rows, int columns)
3428+{
3429+ Matrix* m = new Matrix(scriptEnv, rows, columns, "", this, 0);
3430+ initMatrix(m, generateUniqueName(tr("Matrix")));
3431+ m->showNormal();
3432+ return m;
3433+}
3434+
3435+Matrix* ApplicationWindow::newMatrix(const QString& caption, int r, int c)
3436+{
3437+ Matrix* w = new Matrix(scriptEnv, r, c, "", this, 0);
3438+ initMatrix(w, caption);
3439+ if (d_is_appending_file && w->objectName() != caption){//the matrix was renamed
3440+ renamedTables << caption << w->objectName();
3441+ if (d_inform_rename_table){
3442+ QApplication::restoreOverrideCursor();
3443+ QMessageBox:: warning(this, tr("QtiPlot - Renamed Window"),
3444+ tr("The table '%1' already exists. It has been renamed '%2'.").arg(caption).arg(w->objectName()));
3445+ QApplication::setOverrideCursor(QCursor(Qt::WaitCursor));
3446+ }
3447+ }
3448+
3449+ w->showNormal();
3450+ return w;
3451+}
3452+
3453+void ApplicationWindow::viewMatrixImage()
3454+{
3455+ Matrix* m = (Matrix*)activeWindow(MatrixWindow);
3456+ if (!m)
3457+ return;
3458+
3459+ QApplication::setOverrideCursor(QCursor(Qt::WaitCursor));
3460+ m->undoStack()->push(new MatrixSetViewCommand(m, m->viewType(), Matrix::ImageView, tr("Set Image Mode")));
3461+ m->setViewType(Matrix::ImageView);
3462+ QApplication::restoreOverrideCursor();
3463+}
3464+
3465+void ApplicationWindow::viewMatrixTable()
3466+{
3467+ Matrix* m = static_cast<Matrix*>(activeWindow(MatrixWindow));
3468+ if (!m)
3469+ return;
3470+
3471+ QApplication::setOverrideCursor(QCursor(Qt::WaitCursor));
3472+ m->undoStack()->push(new MatrixSetViewCommand(m, m->viewType(), Matrix::TableView, tr("Set Data Mode")));
3473+ m->setViewType(Matrix::TableView);
3474+ QApplication::restoreOverrideCursor();
3475+}
3476+
3477+void ApplicationWindow::viewMatrixXY()
3478+{
3479+ Matrix* m = static_cast<Matrix*>(activeWindow(MatrixWindow));
3480+ if (!m)
3481+ return;
3482+
3483+ QApplication::setOverrideCursor(QCursor(Qt::WaitCursor));
3484+ m->undoStack()->push(new MatrixSetHeaderViewCommand(m, m->headerViewType(), Matrix::XY, tr("Show X/Y")));
3485+ m->setHeaderViewType(Matrix::XY);
3486+ QApplication::restoreOverrideCursor();
3487+}
3488+
3489+void ApplicationWindow::viewMatrixColumnRow()
3490+{
3491+ Matrix* m = static_cast<Matrix*>(activeWindow(MatrixWindow));
3492+ if (!m)
3493+ return;
3494+
3495+ QApplication::setOverrideCursor(QCursor(Qt::WaitCursor));
3496+ m->undoStack()->push(new MatrixSetHeaderViewCommand(m, m->headerViewType(), Matrix::ColumnRow, tr("Show Column/Row")));
3497+ m->setHeaderViewType(Matrix::ColumnRow);
3498+ QApplication::restoreOverrideCursor();
3499+}
3500+
3501+void ApplicationWindow::setMatrixDefaultScale()
3502+{
3503+ Matrix* m = static_cast<Matrix*>(activeWindow(MatrixWindow));
3504+ if (!m)
3505+ return;
3506+
3507+ QApplication::setOverrideCursor(QCursor(Qt::WaitCursor));
3508+ m->undoStack()->push(new MatrixSetColorMapCommand(m, m->colorMapType(), m->colorMap(),
3509+ Matrix::Default, QwtLinearColorMap(), tr("Set Default Palette")));
3510+ m->setDefaultColorMap();
3511+ QApplication::restoreOverrideCursor();
3512+}
3513+
3514+void ApplicationWindow::setMatrixGrayScale()
3515+{
3516+ Matrix* m = static_cast<Matrix*>(activeWindow(MatrixWindow));
3517+ if (!m)
3518+ return;
3519+
3520+ QApplication::setOverrideCursor(QCursor(Qt::WaitCursor));
3521+ m->undoStack()->push(new MatrixSetColorMapCommand(m, m->colorMapType(), m->colorMap(),
3522+ Matrix::GrayScale, QwtLinearColorMap(), tr("Set Gray Scale Palette")));
3523+ m->setGrayScale();
3524+ QApplication::restoreOverrideCursor();
3525+}
3526+
3527+void ApplicationWindow::setMatrixRainbowScale()
3528+{
3529+ Matrix* m = static_cast<Matrix*>(activeWindow(MatrixWindow));
3530+ if (!m)
3531+ return;
3532+
3533+ QApplication::setOverrideCursor(QCursor(Qt::WaitCursor));
3534+ m->undoStack()->push(new MatrixSetColorMapCommand(m, m->colorMapType(), m->colorMap(),
3535+ Matrix::Rainbow, QwtLinearColorMap(), tr("Set Rainbow Palette")));
3536+ m->setRainbowColorMap();
3537+ QApplication::restoreOverrideCursor();
3538+}
3539+
3540+void ApplicationWindow::showColorMapDialog()
3541+{
3542+ Matrix* m = static_cast<Matrix*>(activeWindow(MatrixWindow));
3543+ if (!m)
3544+ return;
3545+
3546+ ColorMapDialog *cmd = new ColorMapDialog(this);
3547+ cmd->setAttribute(Qt::WA_DeleteOnClose);
3548+ cmd->setMatrix(m);
3549+ cmd->exec();
3550+}
3551+
3552+void ApplicationWindow::transposeMatrix()
3553+{
3554+ Matrix* m = (Matrix*)activeWindow(MatrixWindow);
3555+ if (!m)
3556+ return;
3557+
3558+ m->transpose();
3559+}
3560+
3561+void ApplicationWindow::flipMatrixVertically()
3562+{
3563+ Matrix* m = (Matrix*)activeWindow(MatrixWindow);
3564+ if (!m)
3565+ return;
3566+
3567+ m->flipVertically();
3568+}
3569+
3570+void ApplicationWindow::flipMatrixHorizontally()
3571+{
3572+ Matrix* m = (Matrix*)activeWindow(MatrixWindow);
3573+ if (!m)
3574+ return;
3575+
3576+ m->flipHorizontally();
3577+}
3578+
3579+void ApplicationWindow::rotateMatrix90()
3580+{
3581+ Matrix* m = (Matrix*)activeWindow(MatrixWindow);
3582+ if (!m)
3583+ return;
3584+
3585+ m->rotate90();
3586+}
3587+
3588+void ApplicationWindow::rotateMatrixMinus90()
3589+{
3590+ Matrix* m = (Matrix*)activeWindow(MatrixWindow);
3591+ if (!m)
3592+ return;
3593+
3594+ m->rotate90(false);
3595+}
3596+
3597+void ApplicationWindow::matrixDeterminant()
3598+{
3599+ Matrix* m = (Matrix*)activeWindow(MatrixWindow);
3600+ if (!m)
3601+ return;
3602+
3603+ QDateTime dt = QDateTime::currentDateTime ();
3604+ QString info=dt.toString(Qt::LocalDate);
3605+ info+= "\n" + tr("Determinant of ") + QString(m->objectName()) + ":\t";
3606+ info+= "det = " + QString::number(m->determinant()) + "\n";
3607+ info+="-------------------------------------------------------------\n";
3608+
3609+ current_folder->appendLogInfo(info);
3610+
3611+ showResults(true);
3612+}
3613+
3614+void ApplicationWindow::invertMatrix()
3615+{
3616+ Matrix* m = (Matrix*)activeWindow(MatrixWindow);
3617+ if (!m)
3618+ return;
3619+
3620+ m->invert();
3621+}
3622+
3623+Table* ApplicationWindow::convertMatrixToTableDirect()
3624+{
3625+ Matrix* m = (Matrix*)activeWindow(MatrixWindow);
3626+ if (!m)
3627+ return 0;
3628+
3629+ return matrixToTable(m, Direct);
3630+}
3631+
3632+Table* ApplicationWindow::convertMatrixToTableXYZ()
3633+{
3634+ Matrix* m = (Matrix*)activeWindow(MatrixWindow);
3635+ if (!m)
3636+ return 0;
3637+
3638+ return matrixToTable(m, XYZ);
3639+}
3640+
3641+Table* ApplicationWindow::convertMatrixToTableYXZ()
3642+{
3643+ Matrix* m = (Matrix*)activeWindow(MatrixWindow);
3644+ if (!m)
3645+ return 0;
3646+
3647+ return matrixToTable(m, YXZ);
3648+}
3649+
3650+Table* ApplicationWindow::matrixToTable(Matrix* m, MatrixToTableConversion conversionType)
3651+{
3652+ if (!m)
3653+ return 0;
3654+
3655+ QApplication::setOverrideCursor(QCursor(Qt::WaitCursor));
3656+
3657+ int rows = m->numRows();
3658+ int cols = m->numCols();
3659+ MatrixModel *mModel = m->matrixModel();
3660+
3661+ Table* w = NULL;
3662+ if (conversionType == Direct){
3663+ w = new Table(scriptEnv, rows, cols, "", this, 0);
3664+ for (int i = 0; i<rows; i++){
3665+ for (int j = 0; j<cols; j++)
3666+ w->setCell(i, j, m->cell(i,j));
3667+ }
3668+ } else if (conversionType == XYZ){
3669+ int tableRows = rows*cols;
3670+ w = new Table(scriptEnv, tableRows, 3, "", this, 0);
3671+ for (int i = 0; i<rows; i++){
3672+ for (int j = 0; j<cols; j++){
3673+ int cell = i*cols + j;
3674+ w->setCell(cell, 0, mModel->x(j));
3675+ w->setCell(cell, 1, mModel->y(i));
3676+ w->setCell(cell, 2, mModel->cell(i, j));
3677+ }
3678+ }
3679+ } else if (conversionType == YXZ){
3680+ int tableRows = rows*cols;
3681+ w = new Table(scriptEnv, tableRows, 3, "", this, 0);
3682+ for (int i = 0; i<cols; i++){
3683+ for (int j = 0; j<rows; j++){
3684+ int cell = i*rows + j;
3685+ w->setCell(cell, 0, mModel->x(i));
3686+ w->setCell(cell, 1, mModel->y(j));
3687+ w->setCell(cell, 2, mModel->cell(i, j));
3688+ }
3689+ }
3690+ }
3691+
3692+
3693+ initTable(w, generateUniqueName(tr("Table")));
3694+ w->setWindowLabel(m->windowLabel());
3695+ w->setCaptionPolicy(m->captionPolicy());
3696+ w->resize(m->size());
3697+ w->showNormal();
3698+
3699+ QApplication::restoreOverrideCursor();
3700+ return w;
3701+}
3702+
3703+void ApplicationWindow::initMatrix(Matrix* m, const QString& caption)
3704+{
3705+ QString name = caption;
3706+ while(alreadyUsedName(name)){name = generateUniqueName(tr("Matrix"));}
3707+
3708+ m->setWindowTitle(name);
3709+ m->setName(name);
3710+ m->setIcon( QPixmap(":/matrix.png") );
3711+ m->askOnCloseEvent(confirmCloseMatrix);
3712+ m->setNumericPrecision(d_decimal_digits);
3713+
3714+ if (d_mdi_windows_area)
3715+ d_workspace->addSubWindow(m);
3716+ else
3717+ m->setParent(0);
3718+
3719+ addListViewItem(m);
3720+
3721+ QUndoStack *stack = m->undoStack();
3722+ connect(stack, SIGNAL(canUndoChanged(bool)), actionUndo, SLOT(setEnabled(bool)));
3723+ connect(stack, SIGNAL(canRedoChanged(bool)), actionRedo, SLOT(setEnabled(bool)));
3724+ connect(m, SIGNAL(modifiedWindow(MdiSubWindow*)), this, SLOT(modifiedProject(MdiSubWindow*)));
3725+ connect(m, SIGNAL(modifiedData(Matrix*)), this, SLOT(updateMatrixPlots(Matrix *)));
3726+ connect(m, SIGNAL(resizedWindow(MdiSubWindow*)),this,SLOT(modifiedProject(MdiSubWindow*)));
3727+ connect(m, SIGNAL(closedWindow(MdiSubWindow*)), this, SLOT(closeWindow(MdiSubWindow*)));
3728+ connect(m, SIGNAL(hiddenWindow(MdiSubWindow*)), this, SLOT(hideWindow(MdiSubWindow*)));
3729+ connect(m, SIGNAL(statusChanged(MdiSubWindow*)),this, SLOT(updateWindowStatus(MdiSubWindow*)));
3730+ connect(m, SIGNAL(showContextMenu()), this, SLOT(showWindowContextMenu()));
3731+
3732+ emit modified();
3733+}
3734+
3735+void ApplicationWindow::showBinMatrixDialog()
3736+{
3737+ Table* t = (Table*)activeWindow(TableWindow);
3738+ if (!t)
3739+ return;
3740+
3741+ Q3TableSelection sel = t->getSelection();
3742+ if (t->selectedYColumns().size() != 1 || fabs(sel.topRow() - sel.bottomRow()) < 2){
3743+ QMessageBox::warning(this, tr("QtiPlot - Column selection error"),
3744+ tr("You must select a single Y column that has an associated X column!"));
3745+ return;
3746+ }
3747+
3748+ int ycol = t->colIndex(t->selectedYColumns()[0]);
3749+ if (t->isEmptyColumn(ycol)){
3750+ QMessageBox::critical(this, tr("QtiPlot - Error"), tr("The selected Y column is empty, operation aborted!"));
3751+ return;
3752+ } else if (t->isEmptyColumn(t->colX(ycol))){
3753+ QMessageBox::critical(this, tr("QtiPlot - Error"), tr("The associated X column is empty, operation aborted!"));
3754+ return;
3755+ }
3756+
3757+ CreateBinMatrixDialog *cbmd = new CreateBinMatrixDialog(t, sel.topRow(), sel.bottomRow(), this);
3758+ cbmd->exec();
3759+}
3760+
3761+Matrix* ApplicationWindow::convertTableToMatrixRegularXYZ()
3762+{
3763+ Table* t = (Table*)activeWindow(TableWindow);
3764+ if (!t)
3765+ return 0;
3766+
3767+ Q3TableSelection sel = t->getSelection();
3768+ if (t->selectedColumns().size() != 1 ||
3769+ t->colPlotDesignation(t->colIndex(t->selectedColumns()[0])) != Table::Z ||
3770+ fabs(sel.topRow() - sel.bottomRow()) < 2){
3771+ QMessageBox::warning(this, tr("QtiPlot - Column selection error"),
3772+ tr("You must select exactly one Z column!"));
3773+ return 0;
3774+ }
3775+
3776+ int zcol = t->colIndex(t->selectedColumns()[0]);
3777+ int ycol = t->colY(zcol);
3778+ int xcol = t->colX(ycol);
3779+
3780+ int cells = 0;
3781+ int startRow = sel.topRow();
3782+ int endRow = sel.bottomRow();
3783+ for (int i = startRow; i <= endRow; i++){
3784+ QString xs = t->text(i, xcol);
3785+ QString ys = t->text(i, ycol);
3786+ QString zs = t->text(i, zcol);
3787+ if (!xs.isEmpty() && !ys.isEmpty() && !zs.isEmpty())
3788+ cells++;
3789+ }
3790+
3791+ if (!cells)
3792+ return 0;
3793+
3794+ QApplication::setOverrideCursor(QCursor(Qt::WaitCursor));
3795+
3796+ QLocale locale = this->locale();
3797+ bool xVariesFirst = false;
3798+ int firstValidRow = sel.topRow();
3799+ double x0 = 0.0, y0 = 0.0, xstart = 0.0, ystart = 0.0;
3800+ double tolerance = 0.15;
3801+ for (int i = startRow; i <= endRow; i++){
3802+ QString xs = t->text(i, xcol);
3803+ QString ys = t->text(i, ycol);
3804+ QString zs = t->text(i, zcol);
3805+ if (!xs.isEmpty() && !ys.isEmpty() && !zs.isEmpty()){
3806+ x0 = locale.toDouble(xs);
3807+ y0 = locale.toDouble(ys);
3808+ xstart = x0;
3809+ ystart = y0;
3810+ firstValidRow = i;
3811+
3812+ for (int j = i + 1; j <= endRow; j++){
3813+ xs = t->text(j, xcol);
3814+ ys = t->text(j, ycol);
3815+ zs = t->text(j, zcol);
3816+ if (!xs.isEmpty() && !ys.isEmpty() && !zs.isEmpty()){
3817+ double x = locale.toDouble(xs);
3818+ double y = locale.toDouble(ys);
3819+ if (fabs(x - x0) > tolerance*x0 && fabs(y - y0) <= tolerance*y0)
3820+ xVariesFirst = true;
3821+ break;
3822+ }
3823+ }
3824+ break;
3825+ }
3826+ }
3827+
3828+ int rows = 0;
3829+ int cols = 0;
3830+ for (int i = firstValidRow; i <= endRow; i++){
3831+ QString xs = t->text(i, xcol);
3832+ QString ys = t->text(i, ycol);
3833+ QString zs = t->text(i, zcol);
3834+ if (!xs.isEmpty() && !ys.isEmpty() && !zs.isEmpty()){
3835+ double x = locale.toDouble(xs);
3836+ double y = locale.toDouble(ys);
3837+ if (xVariesFirst){
3838+ if (fabs(y - y0) <= tolerance*y0){
3839+ cols++;
3840+ y0 = y;
3841+ } else
3842+ break;
3843+ } else {
3844+ if (fabs(x - x0) <= tolerance*x0){
3845+ rows++;
3846+ x0 = x;
3847+ } else
3848+ break;
3849+ }
3850+ }
3851+ }
3852+
3853+ if (rows)
3854+ cols = cells/rows;
3855+ else
3856+ rows = cells/cols;
3857+
3858+ double xend = xstart, yend = ystart;
3859+ Matrix* m = newMatrix(rows, cols);
3860+ for (int i = startRow; i <= endRow; i++){
3861+ QString xs = t->text(i, xcol);
3862+ QString ys = t->text(i, ycol);
3863+ QString zs = t->text(i, zcol);
3864+ if (!xs.isEmpty() && !ys.isEmpty() && !zs.isEmpty()){
3865+ int row = 0, col = 0;
3866+ if (xVariesFirst){
3867+ col = i%cols;
3868+ row = i/cols;
3869+ } else {
3870+ row = i%rows;
3871+ col = i/rows;
3872+ }
3873+
3874+ double x = locale.toDouble(xs);
3875+ double y = locale.toDouble(ys);
3876+ if (x > xend)
3877+ xend = x;
3878+ if (y > yend)
3879+ yend = y;
3880+
3881+ m->setCell(row, col, locale.toDouble(zs));
3882+ }
3883+ }
3884+
3885+ m->setCoordinates(QMIN(xstart, xend), QMAX(xstart, xend), QMIN(ystart, yend), QMAX(ystart, yend));
3886+
3887+ QApplication::restoreOverrideCursor();
3888+ return m;
3889+}
3890+
3891+Matrix* ApplicationWindow::convertTableToMatrix()
3892+{
3893+ Table* t = (Table*)activeWindow(TableWindow);
3894+ if (!t)
3895+ return 0;
3896+
3897+ return tableToMatrix (t);
3898+}
3899+
3900+Matrix* ApplicationWindow::tableToMatrix(Table* t)
3901+{
3902+ if (!t)
3903+ return 0;
3904+
3905+ QApplication::setOverrideCursor(QCursor(Qt::WaitCursor));
3906+
3907+ int rows = t->numRows();
3908+ int cols = t->numCols();
3909+ for (int i = cols - 1; i >= 0; i--){
3910+ if (t->isEmptyColumn(i))
3911+ cols--;
3912+ }
3913+
3914+ if (!cols){
3915+ QApplication::restoreOverrideCursor();
3916+ QMessageBox::critical(this, tr("QtiPlot - Error"), tr("The selected table is empty, operation aborted!"));
3917+ return 0;
3918+ }
3919+
3920+ Matrix* m = newMatrix(rows, cols);
3921+ for (int i = 0; i<rows; i++){
3922+ for (int j = 0; j<cols; j++)
3923+ m->setCell(i, j, t->cell(i, j));
3924+ }
3925+
3926+ m->showNormal();
3927+
3928+ QApplication::restoreOverrideCursor();
3929+ return m;
3930+}
3931+
3932+MdiSubWindow* ApplicationWindow::window(const QString& name)
3933+{
3934+ QList<MdiSubWindow *> windows = windowsList();
3935+ foreach(MdiSubWindow *w, windows){
3936+ if (w->objectName() == name)
3937+ return w;
3938+ }
3939+ return NULL;
3940+}
3941+
3942+Table* ApplicationWindow::table(const QString& name)
3943+{
3944+ int pos = name.find("_", 0);
3945+ QString caption = name.left(pos);
3946+
3947+ Folder *f = projectFolder();
3948+ while (f){
3949+ QList<MdiSubWindow *> folderWindows = f->windowsList();
3950+ foreach(MdiSubWindow *w, folderWindows){
3951+ if (w->inherits("Table") && w->objectName() == caption)
3952+ return (Table*)w;
3953+ }
3954+ f = f->folderBelow();
3955+ }
3956+
3957+ return 0;
3958+}
3959+
3960+Matrix* ApplicationWindow::matrix(const QString& name)
3961+{
3962+ QString caption = name;
3963+ if (d_is_appending_file && !renamedTables.isEmpty() && renamedTables.contains(caption)){
3964+ int index = renamedTables.findIndex(caption);
3965+ caption = renamedTables[index + 1];
3966+ }
3967+
3968+ Folder *f = projectFolder();
3969+ while (f){
3970+ QList<MdiSubWindow *> folderWindows = f->windowsList();
3971+ foreach(MdiSubWindow *w, folderWindows){
3972+ if (w->isA("Matrix") && w->objectName() == caption)
3973+ return (Matrix*)w;
3974+ }
3975+ f = f->folderBelow();
3976+ }
3977+ return 0;
3978+}
3979+
3980+MdiSubWindow *ApplicationWindow::activeWindow(WindowType type)
3981+{
3982+ if (!d_active_window){
3983+ QList<MdiSubWindow *> windows = current_folder->windowsList();
3984+ if (!current_folder->activeWindow() && windows.size() > 0){
3985+ d_active_window = windows[0];
3986+ } else
3987+ return NULL;
3988+ }
3989+
3990+ switch(type){
3991+ case NoWindow:
3992+ break;
3993+
3994+ case TableWindow:
3995+ if (d_active_window->inherits("Table"))
3996+ return d_active_window;
3997+ else
3998+ return NULL;
3999+ break;
4000+
4001+ case MatrixWindow:
4002+ return qobject_cast<Matrix *>(d_active_window);
4003+ break;
4004+
4005+ case MultiLayerWindow:
4006+ return qobject_cast<MultiLayer *>(d_active_window);
4007+ break;
4008+
4009+ case NoteWindow:
4010+ return qobject_cast<Note *>(d_active_window);
4011+ break;
4012+
4013+ case Plot3DWindow:
4014+ return qobject_cast<Graph3D *>(d_active_window);
4015+ break;
4016+ }
4017+ return d_active_window;
4018+}
4019+
4020+void ApplicationWindow::windowActivated(QMdiSubWindow *w)
4021+{
4022+ MdiSubWindow *window = qobject_cast<MdiSubWindow *>(w);
4023+ if (!window)
4024+ return;
4025+
4026+ if (d_active_window && d_active_window == window)
4027+ return;
4028+
4029+ d_active_window = window;
4030+
4031+ customToolBars(window);
4032+ customMenu(window);
4033+
4034+ if (d_opening_file)
4035+ return;
4036+
4037+ QList<MdiSubWindow *> windows = current_folder->windowsList();
4038+ foreach(MdiSubWindow *ow, windows){
4039+ if (ow != window && ow->status() == MdiSubWindow::Maximized){
4040+ ow->setNormal();
4041+ break;
4042+ }
4043+ }
4044+
4045+ Folder *f = window->folder();
4046+ if (f)
4047+ f->setActiveWindow(window);
4048+
4049+ emit modified();
4050+}
4051+
4052+void ApplicationWindow::addErrorBars()
4053+{
4054+ MdiSubWindow *w = activeWindow(MultiLayerWindow);
4055+ if (!w)
4056+ return;
4057+
4058+ MultiLayer* plot = (MultiLayer*)w;
4059+ if (plot->isEmpty()){
4060+ QMessageBox::warning(this,tr("QtiPlot - Warning"),
4061+ tr("<h4>There are no plot layers available in this window.</h4>"
4062+ "<p><h4>Please add a layer and try again!</h4>"));
4063+ return;
4064+ }
4065+
4066+ Graph* g = (Graph*)plot->activeLayer();
4067+ if (!g)
4068+ return;
4069+
4070+ if (!g->curveCount()){
4071+ QMessageBox::warning(this, tr("QtiPlot - Warning"), tr("There are no curves available on this plot!"));
4072+ return;
4073+ }
4074+
4075+ if (g->isPiePlot()){
4076+ QMessageBox::warning(this, tr("QtiPlot - Warning"), tr("This functionality is not available for pie plots!"));
4077+ return;
4078+ }
4079+
4080+ ErrDialog* ed = new ErrDialog(this);
4081+ connect (ed, SIGNAL(options(const QString&, int, double, int)), this, SLOT(defineErrorBars(const QString&, int, double, int)));
4082+ connect (ed, SIGNAL(options(const QString&, const QString&, int)), this, SLOT(defineErrorBars(const QString&, const QString&, int)));
4083+
4084+ ed->setCurveNames(g->analysableCurvesList());
4085+ ed->setSrcTables(tableList());
4086+ ed->exec();
4087+}
4088+
4089+void ApplicationWindow::defineErrorBars(const QString& name, int type, double percent, int direction)
4090+{
4091+ MdiSubWindow *w = activeWindow(MultiLayerWindow);
4092+ if (!w)
4093+ return;
4094+
4095+ Graph* g = ((MultiLayer*)w)->activeLayer();
4096+ if (!g)
4097+ return;
4098+
4099+ Table *t = table(name);
4100+ if (!t){//user defined function
4101+ QMessageBox::critical(this, tr("QtiPlot - Error bars error"),
4102+ tr("This feature is not available for user defined function curves!"));
4103+ return;
4104+ }
4105+
4106+ DataCurve *master_curve = (DataCurve *)g->curve(name);
4107+ QString xColName = master_curve->xColumnName();
4108+ if (xColName.isEmpty())
4109+ return;
4110+
4111+ if (direction == QwtErrorPlotCurve::Horizontal)
4112+ t->addCol(Table::xErr);
4113+ else
4114+ t->addCol(Table::yErr);
4115+
4116+ int r = master_curve->dataSize();
4117+ int rows = t->numRows();
4118+ int c = t->numCols() - 1;
4119+ int ycol = t->colIndex(name);
4120+ if (!direction)
4121+ ycol = t->colIndex(xColName);
4122+
4123+ QVarLengthArray<double> Y(r);
4124+ if (direction == QwtErrorPlotCurve::Horizontal){
4125+ for (int i = 0; i < r; i++)
4126+ Y[i] = master_curve->x(i);
4127+ } else {
4128+ for (int i = 0; i < r; i++)
4129+ Y[i] = master_curve->y(i);
4130+ }
4131+
4132+ QString errColName = t->colName(c);
4133+
4134+ if (type == 0){
4135+ double prc = 0.01*percent;
4136+ int aux = 0;
4137+ for (int i = 0; i < rows; i++){
4138+ if (!t->text(i, ycol).isEmpty() && aux < r){
4139+ t->setCell(i, c, Y[aux]*prc);
4140+ aux++;
4141+ }
4142+ }
4143+ } else if (type == 1) {
4144+ double sd = gsl_stats_sd(Y.data(), 1, r);
4145+ for (int i = 0; i < rows; i++){
4146+ if (!t->text(i, ycol).isEmpty())
4147+ t->setCell(i, c, sd);
4148+ }
4149+ }
4150+ QwtErrorPlotCurve *er = g->addErrorBars(xColName, name, t, errColName, direction);
4151+ if (er){
4152+ er->setColor(master_curve->pen().color());
4153+ g->replot();
4154+ emit modified();
4155+ }
4156+}
4157+
4158+void ApplicationWindow::defineErrorBars(const QString& curveName, const QString& errColumnName, int direction)
4159+{
4160+ Table *w = table(curveName);
4161+ if (!w){//user defined function --> no worksheet available
4162+ QMessageBox::critical(this,tr("QtiPlot - Error"),
4163+ tr("This feature is not available for user defined function curves!"));
4164+ return;
4165+ }
4166+
4167+ Table *errTable = table(errColumnName);
4168+ if (w->numRows() != errTable->numRows()){
4169+ QMessageBox::critical(this,tr("QtiPlot - Error"), tr("The selected columns have different numbers of rows!"));
4170+ addErrorBars();
4171+ return;
4172+ }
4173+
4174+ int errCol = errTable->colIndex(errColumnName);
4175+ if (errTable->isEmptyColumn(errCol)){
4176+ QMessageBox::critical(this, tr("QtiPlot - Error"), tr("The selected error column is empty!"));
4177+ addErrorBars();
4178+ return;
4179+ }
4180+
4181+ MultiLayer *plot = (MultiLayer *)activeWindow(MultiLayerWindow);
4182+ if (!plot)
4183+ return;
4184+
4185+ Graph* g = plot->activeLayer();
4186+ if (!g)
4187+ return;
4188+
4189+ QwtErrorPlotCurve *er = g->addErrorBars(curveName, errTable, errColumnName, direction);
4190+ if (er){
4191+ DataCurve *mc = er->masterCurve();
4192+ if (mc){
4193+ er->setColor(mc->pen().color());
4194+ g->replot();
4195+ }
4196+ emit modified();
4197+ }
4198+}
4199+
4200+void ApplicationWindow::removeCurves(const QString& name)
4201+{
4202+ QApplication::setOverrideCursor(QCursor(Qt::WaitCursor));
4203+
4204+ QList<MdiSubWindow *> windows = windowsList();
4205+ foreach(MdiSubWindow *w, windows){
4206+ if (w->isA("MultiLayer")){
4207+ QList<Graph *> layers = ((MultiLayer*)w)->layersList();
4208+ foreach(Graph *g, layers)
4209+ g->removeCurves(name);
4210+ } else if (w->isA("Graph3D")){
4211+ if ( (((Graph3D*)w)->formula()).contains(name) )
4212+ ((Graph3D*)w)->clearData();
4213+ }
4214+ }
4215+ QApplication::restoreOverrideCursor();
4216+}
4217+
4218+void ApplicationWindow::updateCurves(Table *t, const QString& name)
4219+{
4220+ QList<MdiSubWindow *> windows = windowsList();
4221+ foreach(MdiSubWindow *w, windows){
4222+ if (w->isA("MultiLayer")){
4223+ QList<Graph *> layers = ((MultiLayer*)w)->layersList();
4224+ foreach(Graph *g, layers)
4225+ g->updateCurvesData(t, name);
4226+ } else if (w->isA("Graph3D")){
4227+ Graph3D* g = (Graph3D*)w;
4228+ if ((g->formula()).contains(name))
4229+ g->updateData(t);
4230+ }
4231+ }
4232+}
4233+
4234+void ApplicationWindow::showPreferencesDialog()
4235+{
4236+ ConfigDialog* cd = new ConfigDialog(this);
4237+ cd->setColumnSeparator(columnSeparator);
4238+ cd->exec();
4239+}
4240+
4241+void ApplicationWindow::setSaveSettings(bool autoSaving, int min)
4242+{
4243+ if (autoSave==autoSaving && autoSaveTime==min)
4244+ return;
4245+
4246+ autoSave=autoSaving;
4247+ autoSaveTime=min;
4248+
4249+ killTimer(savingTimerId);
4250+
4251+ if (autoSave)
4252+ savingTimerId=startTimer(autoSaveTime*60000);
4253+ else
4254+ savingTimerId=0;
4255+}
4256+
4257+void ApplicationWindow::changeAppStyle(const QString& s)
4258+{
4259+ // style keys are case insensitive
4260+ if (appStyle.toLower() == s.toLower())
4261+ return;
4262+
4263+ qApp->setStyle(s);
4264+ appStyle = qApp->style()->objectName();
4265+
4266+ QPalette pal = qApp->palette();
4267+ pal.setColor (QPalette::Active, QPalette::Base, QColor(panelsColor));
4268+ qApp->setPalette(pal);
4269+
4270+}
4271+
4272+void ApplicationWindow::changeAppFont(const QFont& f)
4273+{
4274+ if (appFont == f)
4275+ return;
4276+
4277+ appFont = f;
4278+ updateAppFonts();
4279+}
4280+
4281+void ApplicationWindow::updateAppFonts()
4282+{
4283+ qApp->setFont(appFont);
4284+ this->setFont(appFont);
4285+ info->setFont(QFont(appFont.family(), 2 + appFont.pointSize(), QFont::Bold,false));
4286+}
4287+
4288+void ApplicationWindow::updateConfirmOptions(bool askTables, bool askMatrices, bool askPlots2D,
4289+ bool askPlots3D, bool askNotes)
4290+{
4291+ QList<MdiSubWindow *> windows = windowsList();
4292+
4293+
4294+ if (confirmCloseTable != askTables){
4295+ confirmCloseTable=askTables;
4296+ foreach(MdiSubWindow *w, windows){
4297+ if (w->inherits("Table"))
4298+ w->askOnCloseEvent(confirmCloseTable);
4299+ }
4300+ }
4301+
4302+ if (confirmCloseMatrix != askMatrices){
4303+ confirmCloseMatrix = askMatrices;
4304+ foreach(MdiSubWindow *w, windows){
4305+ if (w->isA("Matrix"))
4306+ w->askOnCloseEvent(confirmCloseMatrix);
4307+ }
4308+ }
4309+
4310+ if (confirmClosePlot2D != askPlots2D){
4311+ confirmClosePlot2D=askPlots2D;
4312+ foreach(MdiSubWindow *w, windows){
4313+ if (w->isA("MultiLayer"))
4314+ w->askOnCloseEvent(confirmClosePlot2D);
4315+ }
4316+ }
4317+
4318+ if (confirmClosePlot3D != askPlots3D){
4319+ confirmClosePlot3D=askPlots3D;
4320+ foreach(MdiSubWindow *w, windows){
4321+ if (w->isA("Graph3D"))
4322+ w->askOnCloseEvent(confirmClosePlot3D);
4323+ }
4324+ }
4325+
4326+ if (confirmCloseNotes != askNotes){
4327+ confirmCloseNotes = askNotes;
4328+ foreach(MdiSubWindow *w, windows){
4329+ if (w->isA("Note"))
4330+ w->askOnCloseEvent(confirmCloseNotes);
4331+ }
4332+ }
4333+}
4334+
4335+void ApplicationWindow::setGraphDefaultSettings(bool autoscale, bool scaleFonts,
4336+ bool resizeLayers, bool antialiasing)
4337+{
4338+ if (autoscale2DPlots == autoscale &&
4339+ autoScaleFonts == scaleFonts &&
4340+ autoResizeLayers != resizeLayers &&
4341+ antialiasing2DPlots == antialiasing)
4342+ return;
4343+
4344+ autoscale2DPlots = autoscale;
4345+ autoScaleFonts = scaleFonts;
4346+ autoResizeLayers = !resizeLayers;
4347+ antialiasing2DPlots = antialiasing;
4348+
4349+ QList<MdiSubWindow *> windows = windowsList();
4350+ foreach(MdiSubWindow *w, windows){
4351+ if (w->isA("MultiLayer")){
4352+ ((MultiLayer*)w)->setScaleLayersOnResize(autoResizeLayers);
4353+ QList<Graph *> layers = ((MultiLayer*)w)->layersList();
4354+ foreach(Graph *g, layers){
4355+ g->enableAutoscaling(autoscale2DPlots);
4356+ g->updateScale();
4357+ g->setAutoscaleFonts(autoScaleFonts);
4358+ g->setAntialiasing(antialiasing2DPlots);
4359+ }
4360+ }
4361+ }
4362+}
4363+
4364+void ApplicationWindow::setArrowDefaultSettings(double lineWidth, const QColor& c, Qt::PenStyle style,
4365+ int headLength, int headAngle, bool fillHead)
4366+{
4367+ if (defaultArrowLineWidth == lineWidth &&
4368+ defaultArrowColor == c &&
4369+ defaultArrowLineStyle == style &&
4370+ defaultArrowHeadLength == headLength &&
4371+ defaultArrowHeadAngle == headAngle &&
4372+ defaultArrowHeadFill == fillHead)
4373+ return;
4374+
4375+ defaultArrowLineWidth = lineWidth;
4376+ defaultArrowColor = c;
4377+ defaultArrowLineStyle = style;
4378+ defaultArrowHeadLength = headLength;
4379+ defaultArrowHeadAngle = headAngle;
4380+ defaultArrowHeadFill = fillHead;
4381+ saveSettings();
4382+}
4383+
4384+ApplicationWindow * ApplicationWindow::plotFile(const QString& fn)
4385+{
4386+ QApplication::setOverrideCursor(QCursor(Qt::WaitCursor));
4387+ ApplicationWindow *app = new ApplicationWindow();
4388+ app->restoreApplicationGeometry();
4389+
4390+ QList<QByteArray> lst = QImageReader::supportedImageFormats() << "JPG";
4391+ QStringList tempList;
4392+ foreach(QByteArray temp,lst)// convert QList<QByteArray> to QStringList to be able to 'filter'
4393+ tempList.append(QString(temp));
4394+
4395+ QFileInfo fi(fn);
4396+ QStringList l = tempList.filter(fi.suffix(), Qt::CaseInsensitive);
4397+ if (l.count() > 0)
4398+ app->importImage(fn);
4399+ else {
4400+ Table* t = app->newTable();
4401+ if (!t) {
4402+ QApplication::restoreOverrideCursor();
4403+ return NULL;
4404+ }
4405+ t->importASCII(fn, app->columnSeparator, 0, app->renameColumns, app->strip_spaces, app->simplify_spaces,
4406+ app->d_ASCII_import_comments, app->d_ASCII_comment_string,
4407+ app->d_ASCII_import_read_only, Table::Overwrite, app->d_ASCII_import_locale, app->d_ASCII_end_line);
4408+ t->setCaptionPolicy(MdiSubWindow::Both);
4409+ app->multilayerPlot(t, t->YColumns(), defaultCurveStyle);
4410+ }
4411+
4412+ QApplication::restoreOverrideCursor();
4413+ savedProject();//force saved state
4414+ close();
4415+ return app;
4416+}
4417+
4418+Table * ApplicationWindow::importOdfSpreadsheet(const QString& fileName, int sheet)
4419+{
4420+#ifdef ODS_IMPORT
4421+ QString fn = fileName;
4422+ if (fn.isEmpty()){
4423+ fn = getFileName(this, tr("Open ODF Spreadsheet File"), QString::null, "*.ods", 0, false);
4424+ if (fn.isEmpty())
4425+ return NULL;
4426+ }
4427+
4428+ QuaZipFile file(fn, "content.xml");
4429+ if(!file.open(QIODevice::ReadOnly)){
4430+ QMessageBox::critical(this, tr("QtiPlot"), tr("Couldn't open file %1").arg(fn));
4431+ return NULL;
4432+ }
4433+ QTemporaryFile out;
4434+ if (out.open()){
4435+ char c;
4436+ while(file.getChar(&c))
4437+ out.putChar(c);
4438+ out.close();
4439+ }
4440+ file.close();
4441+
4442+ OdsFileHandler handler(this, fn);
4443+ QXmlSimpleReader reader;
4444+ reader.setContentHandler(&handler);
4445+ reader.setErrorHandler(&handler);
4446+
4447+ QXmlInputSource xmlInputSource(&out);
4448+ if (reader.parse(xmlInputSource)){
4449+ updateRecentProjectsList(fn);
4450+ int sheets = handler.sheetsCount();
4451+ if (sheet > sheets){
4452+ QMessageBox::critical(this, tr("QtiPlot"), tr("File %1 contains only %2 sheets!").arg(fn).arg(sheets));
4453+ } else if (sheet > 0){
4454+ Table *aux = NULL;
4455+ for (int i = 0; i < sheets; i++){
4456+ Table *t = handler.sheet(i);
4457+ if (i == sheet - 1)
4458+ aux = t;
4459+ else {
4460+ t->askOnCloseEvent(false);
4461+ t->close();
4462+ }
4463+ }
4464+ return aux;
4465+ }
4466+ return handler.sheet(sheets - 1);
4467+ }
4468+ return NULL;
4469+#else
4470+ QMessageBox::critical(this, tr("QtiPlot"), tr("QtiPlot was built without ODF spreadsheet support!"));
4471+ return NULL;
4472+#endif
4473+}
4474+
4475+#ifdef XLS_IMPORT
4476+void ApplicationWindow::exportExcel()
4477+{
4478+ ExportDialog *ed = showExportASCIIDialog();
4479+ if (ed){
4480+ ed->setNameFilters(QStringList() << "*.xls");
4481+ ed->updateAdvancedOptions(".xls");
4482+ }
4483+}
4484+#endif
4485+
4486+Table * ApplicationWindow::importExcel(const QString& fileName, int sheet)
4487+{
4488+ QString fn = fileName;
4489+ if (fn.isEmpty()){
4490+ QString filter = "*.xls";
4491+ #ifdef HAS_EXCEL
4492+ filter = tr("Excel files") + " (*.xl *.xlsx *.xlsm *.xlsb *.xlam *.xltx *.xltm *.xls *.xla *.xlt *.xlm *.xlw)";
4493+ #endif
4494+ fn = getFileName(this, tr("Open Excel File"), QString::null, filter, 0, false);
4495+ if (fn.isEmpty())
4496+ return NULL;
4497+ }
4498+
4499+#ifdef HAS_EXCEL
4500+ Table *t = importUsingExcel(fn, sheet);
4501+ if (t)
4502+ return t;
4503+#endif
4504+
4505+#ifdef XLS_IMPORT
4506+ return importExcelCrossplatform(fn, sheet);
4507+#endif
4508+
4509+ return NULL;
4510+}
4511+
4512+#ifdef XLS_IMPORT
4513+Table * ApplicationWindow::importExcelCrossplatform(const QString& fn, int sheet)
4514+{
4515+ BasicExcel xls;
4516+ if (!xls.Load(fn)){
4517+ QMessageBox::critical(this, tr("QtiPlot"), tr("Couldn't open file %1").arg(fn));
4518+ return 0;
4519+ }
4520+
4521+ QApplication::setOverrideCursor(QCursor(Qt::WaitCursor));
4522+
4523+ XLSFormatManager fmt_mgr(xls);
4524+
4525+ Table *table = NULL;
4526+ for (size_t s = 0; s < xls.GetTotalWorkSheets(); s++){// process all sheets
4527+ int currentSheet = s + 1;
4528+ if (sheet > 0 && sheet != currentSheet)
4529+ continue;
4530+
4531+ BasicExcelWorksheet* sh = xls.GetWorksheet(s);
4532+ if (!sh)
4533+ continue;
4534+
4535+ int rows = sh->GetTotalRows();
4536+ int cols = sh->GetTotalCols();
4537+ if (rows == 1 && !cols){
4538+ if (sheet > 0 && sheet == currentSheet){
4539+ QMessageBox::critical(this, tr("QtiPlot"), tr("Sheet %1 is empty, operation aborted!").arg(sheet));
4540+ return NULL;
4541+ } else
4542+ continue;
4543+ }
4544+
4545+ table = newTable(rows, cols, QString::null, fn + ", " + tr("sheet") + ": " + QString(sh->GetAnsiSheetName()));
4546+ QTime t1(0, 0);
4547+ QDate d1(1899, 12, 30);//start date in Excel files see(http://sc.openoffice.org/excelfileformat.pdf)
4548+ double daySeconds = 24*60*60;
4549+ for(size_t i = 0; i < rows; i++){
4550+ for(size_t j = 0; j < cols; j++){
4551+ BasicExcelCell* cell = sh->Cell(i, j);
4552+ if (!cell)
4553+ continue;
4554+
4555+ CellFormat fmt(fmt_mgr, cell);
4556+ const wstring& fmt_string = fmt.get_format_string();
4557+ QString fmtString = QString::fromStdWString(fmt_string);
4558+
4559+ switch(cell->Type()){
4560+ case BasicExcelCell::UNDEFINED:
4561+ continue;
4562+ break;
4563+ case BasicExcelCell::STRING:
4564+ table->setText(i, j, cell->GetString());
4565+ break;
4566+ case BasicExcelCell::INT:
4567+ case BasicExcelCell::DOUBLE:
4568+ case BasicExcelCell::FORMULA:
4569+ if (fmt_string == XLS_FORMAT_DATE || fmt_string == XLS_FORMAT_DATETIME ||
4570+ fmt_string == L"D-MMM-YY" || fmt_string == L"D-MMM" || fmt_string == L"MMM-YY"){// date
4571+
4572+ if (fmt_string == XLS_FORMAT_DATE || fmt_string == XLS_FORMAT_DATETIME)
4573+ fmtString = "dd.MM.yyyy";
4574+ else
4575+ fmtString = fmtString.replace("D", "d").replace("Y", "y");
4576+
4577+ if (table->columnType(j) != Table::Date)
4578+ table->setDateFormat(fmtString, j, false);
4579+
4580+ QDate d2 = d1.addDays(cell->GetDouble());
4581+ table->setText(i, j, d2.toString(fmtString));
4582+ } else if (fmt_string == XLS_FORMAT_TIME || fmt_string == L"h:mm AM/PM" ||
4583+ fmt_string == L"h:mm:ss AM/PM" || fmt_string == L"h:mm" ||
4584+ fmt_string == L"mm:ss" || fmt_string == L"[h]:mm:ss" || fmt_string == L"mm:ss.0"){
4585+ if (table->columnType(j) != Table::Time)
4586+ table->setTimeFormat(fmtString, j, false);
4587+
4588+ QTime t2 = t1.addSecs(qRound(cell->GetDouble()*daySeconds));
4589+ table->setText(i, j, t2.toString(fmtString));
4590+ } else
4591+ table->setCell(i, j, cell->GetDouble());
4592+ break;
4593+ }
4594+ }
4595+ }
4596+ table->showNormal();
4597+
4598+ if (sheet > 0 && sheet == currentSheet)
4599+ break;
4600+ }
4601+ xls.Close();
4602+ updateRecentProjectsList(fn);
4603+ QApplication::restoreOverrideCursor();
4604+ return table;
4605+}
4606+#endif
4607+
4608+Table * ApplicationWindow::importWaveFile()
4609+{
4610+ QString fn = getFileName(this, tr("Open File"), QString::null, "*.wav", 0, false);
4611+ if (fn.isEmpty())
4612+ return NULL;
4613+
4614+ QString log = QDateTime::currentDateTime ().toString(Qt::LocalDate) + " - ";
4615+ log += tr("Imported sound file") + ": " + fn + "\n";
4616+ ifstream file(fn, ios::in | ios::binary);
4617+
4618+ file.seekg(4, ios::beg);
4619+ int chunkSize;
4620+ file.read( (char*) &chunkSize, 4 ); // read the ChunkSize
4621+
4622+ file.seekg(16, ios::beg);
4623+ int subChunk1Size;
4624+ file.read( (char*) &subChunk1Size, 4 ); // read the SubChunk1Size
4625+
4626+ short format;
4627+ file.read( (char*) &format, sizeof(short) ); // read the file format. This should be 1 for PCM
4628+ log += tr("Format") + ": ";
4629+ if (format != 1){
4630+ QMessageBox::information(this, tr("QtiPlot"),
4631+ tr("This is not a PCM type WAV file, operation aborted!"));
4632+ log += QString::number(format) + "\n";
4633+ showResults(log, true);
4634+ return NULL;
4635+ } else
4636+ log += tr("PCM") + "\n";
4637+
4638+ short channels;
4639+ file.read( (char*) &channels, sizeof(short) ); // read the # of channels (1 or 2)
4640+ QStringList header;
4641+ if (channels == 2)
4642+ header << tr("Time") << tr("Left") << tr("Right");
4643+ else if (channels == 1)
4644+ header << tr("Time") << tr("Data");
4645+ log += tr("Channels") + ": " + QString::number(channels) + "\n";
4646+
4647+ int sampleRate;
4648+ file.read( (char*) &sampleRate, sizeof(int) );
4649+ log += tr("Sample Rate") + ": " + QString::number(sampleRate) + "\n";
4650+
4651+ int byteRate;
4652+ file.read( (char*) &byteRate, sizeof(int) );
4653+ log += tr("Byte Rate") + ": " + QString::number(byteRate) + "\n";
4654+
4655+ short blockAlign;
4656+ file.read( (char*) &blockAlign, sizeof(short) );
4657+ log += tr("Block Align") + ": " + QString::number(blockAlign) + "\n";
4658+
4659+ short bitsPerSample;
4660+ file.read( (char*) &bitsPerSample, sizeof(short) );
4661+ log += tr("Bits Per Sample") + ": " + QString::number(bitsPerSample) + "\n";
4662+ log += "__________________________________\n";
4663+ showResults(log, true);
4664+
4665+ int rows = (chunkSize - 36)/blockAlign;
4666+ Table *t = newTable(rows, int(channels + 1), QFileInfo(fn).baseName(), fn);
4667+ if (!t)
4668+ return NULL;
4669+
4670+ t->setHeader(header);
4671+
4672+ file.seekg(44, ios::beg);
4673+
4674+ double dt = 1.0/(double)sampleRate;
4675+ int aux = 1;
4676+ if (bitsPerSample == 8){
4677+ if (channels == 2)
4678+ file.seekg(46, ios::beg);//???Why???
4679+ int size = 1;
4680+ uchar ch;
4681+ while(!file.eof()){
4682+ int i = aux - 1;
4683+ t->setCell(i, 0, dt*aux);
4684+ for (int j = 1; j <= channels; j++){
4685+ file.read((char*) &ch, size);
4686+ t->setText(i, j, QString::number(ch));
4687+ }
4688+ aux++;
4689+ }
4690+ } else if (bitsPerSample == 16){
4691+ int size = sizeof(short);
4692+ short ch;
4693+ while(!file.eof()){
4694+ int i = aux - 1;
4695+ t->setCell(i, 0, dt*aux);
4696+ for (int j = 1; j <= channels; j++){
4697+ file.read((char*) &ch, size);
4698+ t->setText(i, j, QString::number(ch));
4699+ }
4700+ aux++;
4701+ }
4702+ }
4703+
4704+ file.close();
4705+ t->show();
4706+ return t;
4707+}
4708+
4709+void ApplicationWindow::importASCII()
4710+{
4711+ ImportASCIIDialog *import_dialog = new ImportASCIIDialog(!activeWindow(TableWindow) && !activeWindow(MatrixWindow), this, d_extended_import_ASCII_dialog);
4712+ import_dialog->setDirectory(asciiDirPath);
4713+ import_dialog->selectFilter(d_ASCII_file_filter);
4714+ if (d_import_ASCII_dialog_size.isValid())
4715+ import_dialog->resize(d_import_ASCII_dialog_size);
4716+ if (import_dialog->exec() != QDialog::Accepted)
4717+ return;
4718+
4719+ asciiDirPath = import_dialog->directory().path();
4720+ d_ASCII_import_mode = import_dialog->importMode();
4721+ columnSeparator = import_dialog->columnSeparator();
4722+ ignoredLines = import_dialog->ignoredLines();
4723+ renameColumns = import_dialog->useFirstRow();
4724+ strip_spaces = import_dialog->stripSpaces();
4725+ simplify_spaces = import_dialog->simplifySpaces();
4726+ d_ASCII_import_locale = import_dialog->decimalSeparators();
4727+ d_ASCII_comment_string = import_dialog->commentString();
4728+ d_ASCII_import_comments = import_dialog->useSecondRow();
4729+ d_ASCII_import_read_only = import_dialog->readOnly();
4730+ d_ASCII_end_line = (EndLineChar)import_dialog->endLineChar();
4731+ saveSettings();
4732+
4733+ importASCII(import_dialog->selectedFiles(),
4734+ import_dialog->importMode(),
4735+ import_dialog->columnSeparator(),
4736+ import_dialog->ignoredLines(),
4737+ import_dialog->renameColumns(),
4738+ import_dialog->stripSpaces(),
4739+ import_dialog->simplifySpaces(),
4740+ import_dialog->importComments(),
4741+ import_dialog->decimalSeparators(),
4742+ import_dialog->commentString(),
4743+ import_dialog->readOnly(),
4744+ import_dialog->endLineChar(),
4745+ import_dialog->columnTypes(),
4746+ import_dialog->columnFormats());
4747+}
4748+
4749+void ApplicationWindow::importASCII(const QStringList& files, int import_mode, const QString& local_column_separator,
4750+ int local_ignored_lines, bool local_rename_columns, bool local_strip_spaces, bool local_simplify_spaces,
4751+ bool local_import_comments, QLocale local_separators, const QString& local_comment_string,
4752+ bool import_read_only, int endLineChar, const QList<int>& colTypes, const QStringList& colFormats)
4753+{
4754+ if (files.isEmpty())
4755+ return;
4756+
4757+ switch(import_mode) {
4758+ case ImportASCIIDialog::NewTables:
4759+ {
4760+ int dx = 0, dy = 0;
4761+ QStringList sorted_files = files;
4762+ sorted_files.sort();
4763+ int filesCount = sorted_files.size();
4764+ for (int i=0; i<filesCount; i++){
4765+ Table *w = newTable();
4766+ if (!w)
4767+ continue;
4768+
4769+ w->importASCII(sorted_files[i], local_column_separator, local_ignored_lines,
4770+ local_rename_columns, local_strip_spaces, local_simplify_spaces,
4771+ local_import_comments, local_comment_string, import_read_only,
4772+ Table::Overwrite, local_separators, endLineChar, -1, colTypes, colFormats);
4773+ if (!w) continue;
4774+ w->setWindowLabel(sorted_files[i]);
4775+ w->setCaptionPolicy(MdiSubWindow::Both);
4776+
4777+ QString name = QFileInfo(sorted_files[i]).baseName();
4778+ if (!alreadyUsedName(name) && !name.contains(QRegExp("\\W")))
4779+ setWindowName(w, name);
4780+
4781+ if (i == 0){
4782+ dx = w->verticalHeaderWidth();
4783+ dy = w->frameGeometry().height() - w->widget()->height();
4784+ }
4785+ if (filesCount > 1)
4786+ w->move(QPoint(i*dx, i*dy));
4787+ }
4788+ modifiedProject();
4789+ break;
4790+ }
4791+ case ImportASCIIDialog::NewMatrices:
4792+ {
4793+ int dx = 0, dy = 0;
4794+ QStringList sorted_files = files;
4795+ sorted_files.sort();
4796+ int filesCount = sorted_files.size();
4797+ for (int i=0; i<filesCount; i++){
4798+ Matrix *w = newMatrix();
4799+ if (!w)
4800+ continue;
4801+ w->importASCII(sorted_files[i], local_column_separator, local_ignored_lines,
4802+ local_strip_spaces, local_simplify_spaces, local_comment_string,
4803+ Matrix::Overwrite, local_separators, endLineChar);
4804+ w->setWindowLabel(sorted_files[i]);
4805+ w->setCaptionPolicy(MdiSubWindow::Both);
4806+
4807+ QString name = QFileInfo(sorted_files[i]).baseName();
4808+ if (!alreadyUsedName(name) && !name.contains(QRegExp("\\W")))
4809+ setWindowName(w, name);
4810+
4811+ if (i == 0){
4812+ dx = w->verticalHeaderWidth();
4813+ dy = w->frameGeometry().height() - w->widget()->height();
4814+ }
4815+ if (filesCount > 1)
4816+ w->move(QPoint(i*dx,i*dy));
4817+ }
4818+ modifiedProject();
4819+ break;
4820+ }
4821+
4822+ case ImportASCIIDialog::NewColumns:
4823+ case ImportASCIIDialog::NewRows:
4824+ {
4825+ MdiSubWindow *w = activeWindow();
4826+ if (!w)
4827+ return;
4828+
4829+ if (w->inherits("Table")){
4830+ Table *t = (Table*)w;
4831+ for (int i = 0; i < files.size(); i++){
4832+ t->importASCII(files[i], local_column_separator, local_ignored_lines, local_rename_columns,
4833+ local_strip_spaces, local_simplify_spaces, local_import_comments,
4834+ local_comment_string, import_read_only, (Table::ImportMode)(import_mode - 2),
4835+ local_separators, endLineChar, -1, colTypes, colFormats);
4836+ }
4837+ t->notifyChanges();
4838+ emit modifiedProject(t);
4839+ } else if (w->isA("Matrix")){
4840+ Matrix *m = (Matrix *)w;
4841+ for (int i=0; i<files.size(); i++){
4842+ m->importASCII(files[i], local_column_separator, local_ignored_lines,
4843+ local_strip_spaces, local_simplify_spaces, local_comment_string,
4844+ (Matrix::ImportMode)(import_mode - 2), local_separators, endLineChar);
4845+ }
4846+ }
4847+ w->setWindowLabel(files.join("; "));
4848+ w->setCaptionPolicy(MdiSubWindow::Name);
4849+ break;
4850+ }
4851+ case ImportASCIIDialog::Overwrite:
4852+ {
4853+ MdiSubWindow *w = activeWindow();
4854+ if (!w)
4855+ return;
4856+
4857+ if (w->inherits("Table")){
4858+ Table *t = (Table *)w;
4859+ t->importASCII(files[0], local_column_separator, local_ignored_lines, local_rename_columns,
4860+ local_strip_spaces, local_simplify_spaces, local_import_comments,
4861+ local_comment_string, import_read_only, Table::Overwrite, local_separators, endLineChar, -1,
4862+ colTypes, colFormats);
4863+ t->notifyChanges();
4864+ } else if (w->isA("Matrix")){
4865+ Matrix *m = (Matrix *)w;
4866+ m->importASCII(files[0], local_column_separator, local_ignored_lines,
4867+ local_strip_spaces, local_simplify_spaces, local_comment_string,
4868+ Matrix::Overwrite, local_separators, endLineChar);
4869+ }
4870+
4871+ w->setWindowLabel(files[0]);
4872+ w->setCaptionPolicy(MdiSubWindow::Both);
4873+
4874+ QString name = QFileInfo(files[0]).baseName();
4875+ if (!alreadyUsedName(name) && !name.contains(QRegExp("\\W")))
4876+ setWindowName(w, name);
4877+
4878+ modifiedProject();
4879+ break;
4880+ }
4881+ }
4882+}
4883+
4884+void ApplicationWindow::open()
4885+{
4886+ if (showSaveProjectMessage() == QMessageBox::Cancel)
4887+ return;
4888+
4889+ OpenProjectDialog *open_dialog = new OpenProjectDialog(this, d_extended_open_dialog);
4890+ open_dialog->setDirectory(workingDir);
4891+
4892+ if (open_dialog->exec() != QDialog::Accepted || open_dialog->selectedFiles().isEmpty())
4893+ return;
4894+ workingDir = open_dialog->directory().path();
4895+
4896+ switch(open_dialog->openMode()) {
4897+ case OpenProjectDialog::NewProject:
4898+ {
4899+ QString fn = open_dialog->selectedFiles()[0];
4900+ QFileInfo fi(fn);
4901+
4902+ if (projectname != "untitled"){
4903+ QFileInfo fi(projectname);
4904+ QString pn = fi.absFilePath();
4905+ if (fn == pn){
4906+ QMessageBox::warning(this, tr("QtiPlot - File openning error"),
4907+ tr("The file: <b>%1</b> is the current file!").arg(fn));
4908+ return;
4909+ }
4910+ }
4911+
4912+ if (!fi.exists ()){
4913+ QMessageBox::critical(this, tr("QtiPlot - File openning error"),
4914+ tr("The file: <b>%1</b> doesn't exist!").arg(fn));
4915+ return;
4916+ }
4917+
4918+ saveSettings();//the recent projects must be saved
4919+
4920+ #ifdef BROWSER_PLUGIN
4921+ if (isProjectFile(fn))
4922+ closeProject();
4923+ open(fn, false, false);
4924+ #else
4925+ ApplicationWindow *a = open (fn);
4926+ if (a){
4927+ a->workingDir = workingDir;
4928+ if (isProjectFile(fn))
4929+ this->close();
4930+ }
4931+ #endif
4932+
4933+ break;
4934+ }
4935+ case OpenProjectDialog::NewFolder:
4936+ appendProject(open_dialog->selectedFiles()[0]);
4937+ break;
4938+ }
4939+}
4940+
4941+bool ApplicationWindow::isProjectFile(const QString& fn)
4942+{
4943+ if (fn.endsWith(".qti", Qt::CaseInsensitive) || fn.endsWith(".qti.gz", Qt::CaseInsensitive) ||
4944+ fn.endsWith(".qti~", Qt::CaseInsensitive) ||
4945+ fn.endsWith(".opj",Qt::CaseInsensitive) || fn.endsWith(".ogg",Qt::CaseInsensitive))
4946+ return true;
4947+ return false;
4948+}
4949+
4950+ApplicationWindow* ApplicationWindow::open(const QString& fn, bool factorySettings, bool newProject)
4951+{
4952+ QFileInfo fi(fn);
4953+ if (!fi.isReadable()){
4954+ QMessageBox::critical(this, tr("QtiPlot - File openning error"),
4955+ tr("You don't have the permission to open this file: <b>%1</b>").arg(fn));
4956+ return NULL;
4957+ }
4958+
4959+#ifdef OPJ_IMPORT
4960+ if (fn.endsWith(".opj", Qt::CaseInsensitive) || fn.endsWith(".ogm", Qt::CaseInsensitive) ||
4961+ fn.endsWith(".ogw", Qt::CaseInsensitive) || fn.endsWith(".ogg", Qt::CaseInsensitive))
4962+ return importOPJ(fn, factorySettings, newProject);
4963+ else
4964+#endif
4965+#ifdef HAS_EXCEL
4966+ if (isExcelInstalled()){
4967+ if (fn.endsWith(".xl", Qt::CaseInsensitive) || fn.endsWith(".xlsx", Qt::CaseInsensitive) ||
4968+ fn.endsWith(".xlsm", Qt::CaseInsensitive) || fn.endsWith(".xlsb", Qt::CaseInsensitive) ||
4969+ fn.endsWith(".xlam", Qt::CaseInsensitive) || fn.endsWith(".xltx", Qt::CaseInsensitive) ||
4970+ fn.endsWith(".xltm", Qt::CaseInsensitive) || fn.endsWith(".xls", Qt::CaseInsensitive) ||
4971+ fn.endsWith(".xla", Qt::CaseInsensitive) || fn.endsWith(".xlt", Qt::CaseInsensitive) ||
4972+ fn.endsWith(".xlm", Qt::CaseInsensitive) || fn.endsWith(".xlw", Qt::CaseInsensitive)){
4973+ importExcel(fn);
4974+ return this;
4975+ }
4976+ } else
4977+#endif
4978+#ifdef XLS_IMPORT
4979+ if (fn.endsWith(".xls", Qt::CaseInsensitive)){
4980+ importExcel(fn);
4981+ return this;
4982+ }
4983+ else
4984+#endif
4985+ if (fn.endsWith(".py", Qt::CaseInsensitive))
4986+ return loadScript(fn);
4987+ else if (fn.endsWith(".ods", Qt::CaseInsensitive)){
4988+ importOdfSpreadsheet(fn);
4989+ return this;
4990+ }
4991+
4992+ QString fname = fn;
4993+ if (fn.endsWith(".qti.gz", Qt::CaseInsensitive)){//decompress using zlib
4994+ file_uncompress((char *)fname.ascii());
4995+ fname = fname.left(fname.size() - 3);
4996+ }
4997+
4998+ QFile f(fname);
4999+ QTextStream t( &f );
5000+ f.open(QIODevice::ReadOnly);
The diff has been truncated for viewing.

Subscribers

People subscribed via source and target branches

to all changes: