Main Page | Namespace List | Class Hierarchy | Class List | File List | Class Members | File Members

MainWin.h

Go to the documentation of this file.
00001 //LabPlot : MainWin.h
00002 
00003 #ifndef MAINWIN_H
00004 #define MAINWIN_H
00005 
00006 #include <qstring.h>
00007 #include <qfont.h>
00008 #include <qlistbox.h>
00009 #include <qworkspace.h>
00010 #include <qtoolbutton.h>
00011 #include <qsignalmapper.h>
00012 #include <qdragobject.h>
00013 #include <qtimer.h>
00014 #include <kapp.h>
00015 #include <kmainwindow.h>
00016 #include <kparts/mainwindow.h>
00017 #include <kaction.h>
00018 #include <kkeydialog.h>
00019 #include <kstatusbar.h>
00020 #include <kstandarddirs.h>
00021 #include <kmenubar.h>
00022 #include "GraphList.h"
00023 #include "Spreadsheet.h"
00024 #include "Worksheet.h"
00025 #include "Project.h"
00026 
00027 #ifdef HAVE_QSA
00028 #include <qsproject.h>
00029 #include <qsinterpreter.h>
00030 #ifdef HAVE_QSA_IDE
00031 #include <qsworkbench.h>
00032 #endif
00033 #endif
00034 
00035 #define PROJECT_VERSION 20
00036 
00037 extern "C" double parse(char[]);
00038 extern "C" int parse_errors();
00039 
00040 class MainWin
00041         : public KParts::MainWindow
00042 {
00043         Q_OBJECT
00044 //      Q_PROPERTY(Worksheet worksheet READ getWorksheet WRITE setWorksheet);
00045 private:
00046         void readConfig();
00047         void enableAutosave(bool as);
00048         void newDialog(bool d, PType type);     // interface to all data and function dialogs
00049         void newPlot(PType type);                       // interface to all new plot functions
00050         QWorkspace* ws; 
00051         QString filename;
00052         KParts::ReadOnlyPart* gvpart;
00053         QSignalMapper *sm;
00054         KConfig *config;
00055         KRecentFilesAction* recent;
00056         KAction *configureAction, *project_action, *explorer_action;
00057         KAction *import_action, *export_image, *export_svg, *export_pic, *export_ps, *export_eps, *export_pdf;
00058         KAction *export_pstoedit, *export_ImageMagick, *print_action, *save_action, *save_as;
00059         KAction *graph_list, *plot_list, *clear_action, *close_action, *worksheet_action, *plot, *arrange, *overlay;
00060         KAction *deleteplot, *newgrassplot, *grassdata, *newvtkplot, *vtkdata, *qwt3d_plot, *qwt3d_func, *qwt3d_data;
00061         KAction *operations, *imagepro;
00062         KAction *smooth, *prune, *average, *compress, *periodic, *seasonal, *hist, *peak;
00063         KAction *interpolation, *differences, *integration, *regression, *fft, *convolution, *fit;
00064         KAction *axes, *title, *legend, *objects;
00065         KAction *asx, *asy, *asz, *asall, *maglens, *panzoom, *sl, *sr, *su, *sd, *sxu, *sxd, *syu, *syd, *szu, *szd;
00066         KAction *zoomin, *zoomout, *maskplot;
00067         KAction *baseline, *region, *label, *line, *rect, *ellipse, *image;
00068         KAction *ideAction, *scriptAction;
00069         KToggleAction *menubar, *toolbar, *sidetoolbar, *analysistoolbar, *drawingtoolbar, *statusbar;
00070         KToggleAction *printpreview, *togglespeedmode, *toggledatamode;
00071         bool printpreviewchecked;       // needed for print preview
00072         Project *project;
00073         QTimer *autosaveTimer;
00074         bool autosave;
00075         long autosaveinterval;
00076         bool modified;
00077         bool speedmode, datamode;
00078         int speedmodevalue;
00079         int nr_w, nr_s;
00080 #ifdef HAVE_QSA
00081         QSProject *qsproject;
00082 #ifdef HAVE_QSA_IDE
00083         QSWorkbench *ide;
00084 #endif
00085 #endif
00086 private slots:
00087         void closeWin();
00088         void setWinFocus(int i) { (ws->windowList()).at(i)->setFocus(); }
00089 
00090         void configure();
00091         void configureKeys() { KKeyDialog::configure(actionCollection(), this, true); }
00092         void configureToolbars();
00093         void saveSettings();
00094         void setAutosaveInterval(long interval) { autosaveinterval=interval;}
00095 
00096         void new2DPlot() { newPlot(P2D); }
00097         void newSurfacePlot() { newPlot(PSURFACE); }
00098         void new3DPlot() { newPlot(P3D); }
00099         void newPiePlot() { newPlot(PPIE); }
00100         void newPolarPlot() { newPlot(PPOLAR); }
00101         void newTernaryPlot() { newPlot(PTERNARY); }
00102         void newGRASSPlot() { newPlot(PGRASS); }
00103         void newVTKPlot() { newPlot(PVTK); }
00104         void newQWT3DPlot() { newPlot(PQWT3D); }
00105         void newGLPlot() { newPlot(PGL); }
00106         void openIDE();
00107         void reportBug();
00108         void exampleAxesLabel() { openfile(locate("data", QString("LabPlot/axeslabel.lpl.gz"))); }
00109         void exampleAnalysis() { openfile(locate("data", QString("LabPlot/analysis.lpl.gz"))); }
00110         void exampleSurface() { openfile(locate("data", QString("LabPlot/surface.lpl.gz"))); }
00111         void example3d() { openfile(locate("data", QString("LabPlot/3d.lpl.gz"))); }
00112         void exampleRydberg() { openfile(locate("data", QString("LabPlot/rydberg.lpl.gz"))); }
00113         void exampleLog() { openfile(locate("data", QString("LabPlot/log.lpl.gz"))); }
00114         void exampleFFT() { openfile(locate("data", QString("LabPlot/fft.lpl.gz"))); }
00115         void exampleObjects() { openfile(locate("data", QString("LabPlot/objects.lpl.gz"))); }
00116         void exampleHist() { openfile(locate("data", QString("LabPlot/hist.lpl.gz"))); }
00117         void exampleFit() { openfile(locate("data", QString("LabPlot/fit.lpl.gz"))); }
00118         void exampleImage() { openfile(locate("data", QString("LabPlot/image.lpl.gz"))); }
00119         void examplePie() { openfile(locate("data", QString("LabPlot/pie.lpl.gz"))); }
00120         void exampleExponentialFit() { openfile(locate("data", QString("LabPlot/exponential_fit.lpl.gz"))); }
00121         void exampleMultiplot() { openfile(locate("data", QString("LabPlot/multiplot.lpl.gz"))); }
00122         void exampleGrass() { openfile(locate("data", QString("LabPlot/grass.lpl.gz"))); }
00123         void exampleSurface2() { openfile(locate("data", QString("LabPlot/surface2.lpl.gz"))); }
00124         void examplePolar() { openfile(locate("data", QString("LabPlot/polar.lpl.gz"))); }
00125         void exampleTernary() { openfile(locate("data", QString("LabPlot/ternary.lpl.gz"))); }
00126         void exampleAudio() { openfile(locate("data", QString("LabPlot/audio.lpl.gz"))); }
00127         void exampleQWT() { openfile(locate("data", QString("LabPlot/qwt.lpl.gz"))); }
00128         void exampleBar() { openfile(locate("data", QString("LabPlot/bar.lpl.gz"))); }
00129         void exampleLogfit() { openfile(locate("data", QString("LabPlot/logfit.lpl.gz"))); }
00130         void exampleMarker() { openfile(locate("data", QString("LabPlot/marker.lpl.gz"))); }
00131 public slots:
00132         void open(QString fn=0);                                                        
00133         void New();                                                                     
00134         void save(QString fn=0);                                                        
00135         void saveAs(QString fn=0);                                              
00136         void projectInfo();                                                             // TODO : project info dialog
00137         void projectExplorer();                                                 // TODO : project explorer
00138         void importData(QString fn);                                            
00139         void importDialog();                                                            
00140         void exportPlot(QString fn=0, QString f=0);                     
00141         void exportPS(QString fn=0);                                    
00142         void exportEPS(QString fn=0);                                   
00143         void exportPDF(QString fn=0);                                   
00144         void exportSVG(QString fn=0);                                   
00145         void exportPIC(QString fn=0);                                           
00146         void exportPstoEdit(QString fn="out.pdf",int f=4, int s=5, double sc=1.0, double r=0.0);
00149         void exportPstoEditDialog();                                            
00150         void exportImageMagick(QString fn="out.8bim", int f=0, int sx=800, int sy=600, double r=0.0);
00153         void exportImageMagickDialog();                                 
00154         void print();                                                                   // TODO : print dialog
00155         void printPreview();                                                            
00156         void graphDialog();                                                             
00157         void plotDialog();                                                              
00158 
00159         void clear();                                                                   
00160         void deletePlot();                                                              
00161         void loadScript(QString fn=0);                                          
00162         void Environment();                                                             
00163         void aboutKDE();                                                                
00164         void exit() {modified=FALSE; close(); }                         
00165         void toggleFullScreen();                                                        
00166         void toggleMenuBar();                                                   
00167         void toggleToolBar();                                                   
00168         void toggleSideToolBar();                                               
00169         void toggleAnalysisToolBar();                                           
00170         void toggleDrawingToolBar();                                            
00171         void toggleStatusBar();                                                 
00172         bool speedMode() { return speedmode; }                                  
00173         void setSpeedMode(bool s) { speedmode = s; }                            
00174         void toggleSpeedMode();                                                 
00175         int speedModeValue() { return speedmodevalue; }                         
00176         void setSpeedModeValue(int s) { speedmodevalue=s; }                     
00177         bool dataMode() { return datamode; }                                    
00178         void setDataMode(bool d) { datamode = d; }                              
00179         
00180         void new2DData() { newDialog(0,P2D); }                  
00181         void newSData() { newDialog(0,PSURFACE); }              
00182         void new3DData() { newDialog(0,P3D); }                  
00183         void newPieData() { newDialog(0,PPIE); }                        
00184         void newPolarData() { newDialog(0,PPOLAR); }            
00185         void newTernaryData() { newDialog(0,PTERNARY); }        
00186         void newGRASSData() { newDialog(0,PGRASS); }            
00187         void newVTKData() { newDialog(0,PVTK); }                        
00188         void newQWT3DData() { newDialog(0,PQWT3D); }            
00189         void new2DFunction() { newDialog(1,P2D);  }             
00190         void new3DFunction() {newDialog(1,P3D); }                       
00191         void newQWT3DFunction() {newDialog(1,PQWT3D); }         
00192         void newSFunction() { newDialog(1,PSURFACE); }  
00193         void newPolarFunction() {newDialog(1,PPOLAR); } 
00194         
00195         void operationsDialog();                                                        // TODO 
00196         void smoothDialog();
00197         void averageDialog();
00198         void compressDialog();
00199         void pruneDialog();
00200         void periodicDialog();
00201         void seasonalDialog();
00202         void histDialog();
00203         void peakDialog();
00204         void interpolationDialog();
00205         void differencesDialog();
00206         void integrationDialog();
00207         void regressionDialog();
00208         void fftDialog();
00209         void convolutionDialog();
00210         void fitDialog();
00211         void imageDialog();
00212 
00213         void arrangeDialog();                                                   // TODO
00214         void overlayDialog();
00215         void worksheetDialog();
00216         void plotSettingsDialog();
00217         void axesDialog();
00218         void titleDialog();                                                     // TODO
00219         void legendDialog();
00220         void objectDialog();
00221 
00222         void autoScaleX();                                      
00223         void autoScaleY();                                      
00224         void autoScaleZ();                                      
00225         void autoScaleAll();                                    
00226         void shiftLeft();                                       
00227         void shiftRight();                                      
00228         void shiftUp();                                         
00229         void shiftDown();                                       
00230         void scaleXUp();                                        
00231         void scaleXDown();                                      
00232         void scaleYUp();                                        
00233         void scaleYDown();                                      
00234         void scaleZUp();                                        
00235         void scaleZDown();                                      
00236         void zoomIn();
00237         void zoomOut();
00238         void toggleDataMode();
00239 
00240 // not script functions
00241         void open(const KURL& url);
00242 
00243         void magLens();
00244         void panZoom();
00245         void maskPlot();
00246 
00247         void defineRegion();
00248         void defineBaseline();
00249         void defineLine();
00250         void defineLabel();
00251         void defineRect();
00252         void defineEllipse();
00253         void defineImage();
00254         
00255         void setActiveSheet(int i);     // called from signal mapper (sheet list)
00256         class Spreadsheet* newSpreadsheet();
00257         class Worksheet* newWorksheet();
00258         class Worksheet* activeWorksheet();
00259         class Spreadsheet* activeSpreadsheet();
00260         void updateSheetList();
00261 public:
00262         MainWin(const char *name,const char *filen);
00263         void replot();
00264         void openfile(QString file);
00265         void message(QString msg) {statusBar()->message(msg); }
00266         KConfig* Config() { return config; }
00267         int defining_region, defining_line, defining_rect, defining_ellipse;    // value = 0-not,1-left,2-right line
00268         int defining_maglens,defining_panzoom, defining_mask;                   // dto.
00269         bool defining_baseline,defining_label,defining_image;
00270         QString last_2dfunction, last_3dfunction, last_filename;                // function, filename of last input
00271         Project *getProject() { return project; }
00272         void setProject(Project *p) { project=p; }
00273 #ifdef HAVE_QSA
00274         QSProject *getQSProject() { return qsproject; }
00275 #endif
00276         void readScript(QString name);
00277         QWorkspace *getWorkspace() { return ws; }
00278         void deleteActiveSheet();
00279         void setModified() {modified = true;}
00280         int NrSpreadsheets() { return nr_s; }
00281         int NrWorksheets() { return nr_w; }
00282         void addGraph2D(Graph2D *g, unsigned int item, PType type=P2D);         // add Graph2D to widget item in workspace
00283         void addGraph3D(Graph3D *g, unsigned int item, PType type=P3D);         // add Graph3D to widget item in workspace
00284         void addGraph4D(Graph4D *g, unsigned int item);                                         // add Graph4D to widget item in workspace
00285         void addGraphM(GraphM *g, unsigned int item, PType type=PSURFACE);      // add GraphM to widget item in workspace
00286         void addGraphIMAGE(GraphIMAGE *g, unsigned int item);                           // add GraphIMAGE to widget item in workspace
00287         QString parseExpression(QString tmp, double value, int j);      // parse expression
00288         double formatLabel(QString value,int item);
00289 protected:
00290         void resizeEvent(QResizeEvent *e) { this->resize(e->size()); }
00291         void dragEnterEvent(QDragEnterEvent *e) { e->accept(QTextDrag::canDecode(e)); }
00292         void dropEvent(QDropEvent *e);
00293         void closeEvent(QCloseEvent *e);
00294         void mouseDoubleClickEvent(QMouseEvent *e) { if(!menuBar()->isVisible()) menuBar()->show(); }
00295 
00296 };
00297 
00298 #endif //MAINWIN_H

Generated on Fri Mar 25 19:47:03 2005 for LabPlot by doxygen 1.3.6