QtiPlot 0.9.7.3
|
00001 /*************************************************************************** 00002 File : Note.h 00003 Project : QtiPlot 00004 -------------------------------------------------------------------- 00005 Copyright : (C) 2006 - 2009 by Ion Vasilief 00006 Email (use @ for *) : ion_vasilief*yahoo.fr 00007 Description : Notes window class 00008 00009 ***************************************************************************/ 00010 00011 /*************************************************************************** 00012 * * 00013 * This program is free software; you can redistribute it and/or modify * 00014 * it under the terms of the GNU General Public License as published by * 00015 * the Free Software Foundation; either version 2 of the License, or * 00016 * (at your option) any later version. * 00017 * * 00018 * This program is distributed in the hope that it will be useful, * 00019 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 00020 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 00021 * GNU General Public License for more details. * 00022 * * 00023 * You should have received a copy of the GNU General Public License * 00024 * along with this program; if not, write to the Free Software * 00025 * Foundation, Inc., 51 Franklin Street, Fifth Floor, * 00026 * Boston, MA 02110-1301 USA * 00027 * * 00028 ***************************************************************************/ 00029 #ifndef NOTE_H 00030 #define NOTE_H 00031 00032 #include <MdiSubWindow.h> 00033 #include <ScriptEdit.h> 00034 #include <LineNumberDisplay.h> 00035 #include <QTextEdit> 00036 #include <QTabWidget> 00037 00038 class ScriptingEnv; 00039 00043 class Note: public MdiSubWindow 00044 { 00045 Q_OBJECT 00046 00047 public: 00048 00049 Note(ScriptingEnv *env, const QString& label, ApplicationWindow* parent, const QString& name = QString(), Qt::WFlags f=0); 00050 ~Note(){}; 00051 00052 void init(ScriptingEnv *env); 00053 void setName(const QString& name); 00054 void setTabStopWidth(int length); 00055 int indexOf(ScriptEdit* editor); 00056 ScriptEdit* editor(int index); 00057 ScriptEdit* currentEditor(); 00058 int tabs(){return d_tab_widget->count();}; 00059 void renameTab(int, const QString&); 00060 00061 void save(const QString& fn, const QString &info, bool = false); 00062 void restore(const QStringList&); 00063 00064 public slots: 00065 bool autoexec() const { return autoExec; } 00066 void setAutoexec(bool); 00067 void modifiedNote(); 00068 00069 // ScriptEdit methods 00070 QString text() { if(currentEditor()) return currentEditor()->text(); return QString::null;}; 00071 void setText(const QString &s) { if(currentEditor()) currentEditor()->setText(s); }; 00072 void print() { if(currentEditor()) currentEditor()->print(); }; 00073 void print(QPrinter *printer) { if(currentEditor()) currentEditor()->print(printer); }; 00074 void exportPDF(const QString& fileName){if(currentEditor()) currentEditor()->exportPDF(fileName);}; 00075 QString exportASCII(const QString &file=QString::null) { if(currentEditor()) return currentEditor()->exportASCII(file); return QString::null;}; 00076 QString importASCII(const QString &file=QString::null){ if(currentEditor()) return currentEditor()->importASCII(file); return QString::null;}; 00077 void execute() { if(currentEditor()) currentEditor()->execute(); }; 00078 void executeAll() { if(currentEditor()) currentEditor()->executeAll(); }; 00079 void evaluate() { if(currentEditor()) currentEditor()->evaluate(); }; 00080 void setDirPath(const QString& path){if(currentEditor()) currentEditor()->setDirPath(path);}; 00081 00083 void showLineNumbers(bool show = true); 00084 bool hasLineNumbers(){return d_line_number_enabled;}; 00085 00086 void setFont(const QFont& f); 00087 void addTab(); 00088 void removeTab(int = -1); 00089 void renameCurrentTab(); 00090 00091 signals: 00092 void dirPathChanged(const QString& path); 00093 void currentEditorChanged(); 00094 00095 private: 00096 void saveTab(int index, const QString &fn); 00097 00098 ScriptingEnv *d_env; 00099 QWidget *d_frame; 00100 QTabWidget *d_tab_widget; 00101 bool d_line_number_enabled; 00102 bool autoExec; 00103 }; 00104 00105 #endif