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 18
00036 
00037 extern "C" double parse(char[]);
00038 
00039 class MainWin
00040         : public KParts::MainWindow
00041 {
00042         Q_OBJECT
00043 //      Q_PROPERTY(Worksheet worksheet READ getWorksheet WRITE setWorksheet);
00044 private:
00045         void New();
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, *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, *hist, *interpolation, *differences, *integration, *regression, *fft, *convolution, *fit;
00063         KAction *axes, *title, *legend, *objects;
00064         KAction *asx, *asy, *asz, *asall, *maglens, *panzoom, *sl, *sr, *su, *sd, *sxu, *sxd, *syu, *syd, *szu, *szd;
00065         KAction *baseline, *region, *label, *line, *rect, *ellipse, *image;
00066         KAction *ideAction, *scriptAction;
00067         KToggleAction *menubar, *toolbar, *sidetoolbar, *analysistoolbar, *drawingtoolbar, *statusbar;
00068         KToggleAction *printpreview;
00069         bool printpreviewchecked;       // needed for print preview
00070         Project *project;
00071         QTimer *autosaveTimer;
00072         bool autosave;
00073         long autosaveinterval;
00074         bool modified;
00075         int nr_w, nr_s;
00076 #ifdef HAVE_QSA
00077         QSProject *qsproject;
00078 #ifdef HAVE_QSA_IDE
00079         QSWorkbench *ide;
00080 #endif
00081 #endif
00082         private slots:
00083         void closeWin();
00084         void setWinFocus(int i) { (ws->windowList()).at(i)->setFocus(); }
00085 
00086         void configure();
00087         void configureKeys() { KKeyDialog::configure(actionCollection(), this, true); }
00088         void configureToolbars();
00089         void saveSettings();
00090         void setAutosaveInterval(long interval) { autosaveinterval=interval;}
00091 
00092         void new2DPlot() { newPlot(P2D); }
00093         void newSurfacePlot() { newPlot(PSURFACE); }
00094         void new3DPlot() { newPlot(P3D); }
00095         void newPiePlot() { newPlot(PPIE); }
00096         void newPolarPlot() { newPlot(PPOLAR); }
00097         void newTernaryPlot() { newPlot(PTERNARY); }
00098         void newGRASSPlot() { newPlot(PGRASS); }
00099         void newVTKPlot() { newPlot(PVTK); }
00100         void newQWT3DPlot() { newPlot(PQWT3D); }
00101         void newGLPlot() { newPlot(PGL); }
00102         void openIDE();
00103         void reportBug();
00104         void exampleAxesLabel() { openfile(locate("data", QString("LabPlot/axeslabel.lpl.gz"))); }
00105         void exampleAnalysis() { openfile(locate("data", QString("LabPlot/analysis.lpl.gz"))); }
00106         void exampleSurface() { openfile(locate("data", QString("LabPlot/surface.lpl.gz"))); }
00107         void example3d() { openfile(locate("data", QString("LabPlot/3d.lpl.gz"))); }
00108         void exampleRydberg() { openfile(locate("data", QString("LabPlot/rydberg.lpl.gz"))); }
00109         void exampleLog() { openfile(locate("data", QString("LabPlot/log.lpl.gz"))); }
00110         void exampleFFT() { openfile(locate("data", QString("LabPlot/fft.lpl.gz"))); }
00111         void exampleObjects() { openfile(locate("data", QString("LabPlot/objects.lpl.gz"))); }
00112         void exampleHist() { openfile(locate("data", QString("LabPlot/hist.lpl.gz"))); }
00113         void exampleFit() { openfile(locate("data", QString("LabPlot/fit.lpl.gz"))); }
00114         void exampleImage() { openfile(locate("data", QString("LabPlot/image.lpl.gz"))); }
00115         void examplePie() { openfile(locate("data", QString("LabPlot/pie.lpl.gz"))); }
00116         void exampleExponentialFit() { openfile(locate("data", QString("LabPlot/exponential_fit.lpl.gz"))); }
00117         void exampleMultiplot() { openfile(locate("data", QString("LabPlot/multiplot.lpl.gz"))); }
00118         void exampleGrass() { openfile(locate("data", QString("LabPlot/grass.lpl.gz"))); }
00119         void exampleSurface2() { openfile(locate("data", QString("LabPlot/surface2.lpl.gz"))); }
00120         void examplePolar() { openfile(locate("data", QString("LabPlot/polar.lpl.gz"))); }
00121         void exampleTernary() { openfile(locate("data", QString("LabPlot/ternary.lpl.gz"))); }
00122         void exampleAudio() { openfile(locate("data", QString("LabPlot/audio.lpl.gz"))); }
00123         void exampleQWT() { openfile(locate("data", QString("LabPlot/qwt.lpl.gz"))); }
00124 public slots:
00125         void open(QString fn=0);                                                        
00126         void save(QString fn=0);                                                        
00127         void saveAs(QString fn=0);                                              
00128         void projectInfo();                                                             // TODO : project info dialog
00129         void projectExplorer();                                                 // TODO : project explorer
00130         void importData(QString fn);                                            
00131         void importDialog();                                                            
00132         void exportPlot(QString fn=0, QString f=0);                     
00133         void exportPS(QString fn=0);                                    
00134         void exportEPS(QString fn=0);                                   
00135         void exportPDF(QString fn=0);                                   
00136         void exportSVG(QString fn=0);                                   
00137         void exportPIC(QString fn=0);                                           
00138         void exportPstoEdit(QString fn="out.pdf",int f=4, int s=5, double sc=1.0, double r=0.0);
00141         void exportPstoEditDialog();                                            
00142         void exportImageMagick(QString fn="out.8bim", int f=0, int sx=800, int sy=600, double r=0.0);
00145         void exportImageMagickDialog();                                 
00146         void print();                                                                   // TODO : print dialog
00147         void printPreview();                                                            
00148         void graphDialog();                                                             
00149 
00150         void clear();                                                                   
00151         void deletePlot();                                                              
00152         void loadScript(QString fn=0);                                          
00153         void Environment();                                                             
00154         void aboutKDE();                                                                
00155         void exit() {modified=FALSE; close(); }                         
00156         void toggleFullScreen();                                                        
00157         void toggleMenuBar();                                                   
00158         void toggleToolBar();                                                   
00159         void toggleSideToolBar();                                               
00160         void toggleAnalysisToolBar();                                           
00161         void toggleDrawingToolBar();                                            
00162         void toggleStatusBar();                                                 
00163         
00164         void new2DData() { newDialog(0,P2D); }                  
00165         void newSData() { newDialog(0,PSURFACE); }              
00166         void new3DData() { newDialog(0,P3D); }                  
00167         void newPieData() { newDialog(0,PPIE); }                        
00168         void newPolarData() { newDialog(0,PPOLAR); }            
00169         void newTernaryData() { newDialog(0,PTERNARY); }        
00170         void newGRASSData() { newDialog(0,PGRASS); }            
00171         void newVTKData() { newDialog(0,PVTK); }                        
00172         void newQWT3DData() { newDialog(0,PQWT3D); }            
00173         void new2DFunction() { newDialog(1,P2D);  }             
00174         void new3DFunction() {newDialog(1,P3D); }                       
00175         void newQWT3DFunction() {newDialog(1,PQWT3D); }         
00176         void newSFunction() { newDialog(1,PSURFACE); }  
00177         void newPolarFunction() {newDialog(1,PPOLAR); } 
00178         
00179         void operationsDialog();                                                        // TODO 
00180         void smoothDialog();
00181         void averageDialog();
00182         void pruneDialog();
00183         void histDialog();
00184         void interpolationDialog();
00185         void differencesDialog();
00186         void integrationDialog();
00187         void regressionDialog();
00188         void fftDialog();
00189         void convolutionDialog();
00190         void fitDialog();
00191         void imageDialog();
00192 
00193         void arrangeDialog();                                                   // TODO
00194         void overlayDialog();
00195         void worksheetDialog();
00196         void plotSettingsDialog();
00197         void axesDialog();
00198         void titleDialog();                                                     // TODO
00199         void legendDialog();
00200         void objectDialog();
00201 
00202         
00203         void autoScaleX();                                      
00204         void autoScaleY();                                      
00205         void autoScaleZ();                                      
00206         void autoScaleAll();                                    
00207         void shiftLeft();                                       
00208         void shiftRight();                                      
00209         void shiftUp();                                         
00210         void shiftDown();                                       
00211         void scaleXUp();                                        
00212         void scaleXDown();                                      
00213         void scaleYUp();                                        
00214         void scaleYDown();                                      
00215         void scaleZUp();                                        
00216         void scaleZDown();                                      
00217 
00218 // not script functions
00219         void open(const KURL& url);
00220 
00221         void magLens();
00222         void panZoom();
00223 
00224         void defineRegion();
00225         void defineBaseline();
00226         void defineLine();
00227         void defineLabel();
00228         void defineRect();
00229         void defineEllipse();
00230         void defineImage();
00231         
00232         void setActiveSheet(int i);     // called from signal mapper (sheet list)
00233         class Spreadsheet* newSpreadsheet();
00234         class Worksheet* newWorksheet();
00235         class Worksheet* activeWorksheet();
00236         class Spreadsheet* activeSpreadsheet();
00237         void updateSheetList();
00238 public:
00239         MainWin(const char *name,const char *filen);
00240         void replot();
00241         void openfile(QString file);
00242         void message(QString msg) {statusBar()->message(msg); }
00243         KConfig* Config() { return config; }
00244         int defining_region, defining_line, defining_rect, defining_ellipse;    // value = 0-not,1-left,2-right line
00245         int defining_maglens,defining_panzoom;                                          // dto.
00246         bool defining_baseline,defining_label,defining_image;
00247         Project *getProject() { return project; }
00248         void setProject(Project *p) { project=p; }
00249 #ifdef HAVE_QSA
00250         QSProject *getQSProject() { return qsproject; }
00251 #endif
00252         void readScript(QString name);
00253         QWorkspace *getWorkspace() { return ws; }
00254         void deleteActiveSheet();
00255         void setModified() {modified = true;}
00256         int NrSpreadsheets() { return nr_s; }
00257         int NrWorksheets() { return nr_w; }
00258         QString parseExpression(QString tmp, double value, int j);
00259         double formatLabel(QString value,int item);
00260 protected:
00261         void resizeEvent(QResizeEvent *e) { this->resize(e->size()); }
00262         void dragEnterEvent(QDragEnterEvent *e) { e->accept(QTextDrag::canDecode(e)); }
00263         void dropEvent(QDropEvent *e);
00264         void closeEvent(QCloseEvent *e);
00265         void mouseDoubleClickEvent(QMouseEvent *e) { if(!menuBar()->isVisible()) menuBar()->show(); }
00266 
00267 };
00268 
00269 #endif //MAINWIN_H

Generated on Sun Nov 28 22:31:17 2004 for LabPlot by doxygen 1.3.6