00001 /*************************************************************************** 00002 File : Note.h 00003 Project : QtiPlot 00004 -------------------------------------------------------------------- 00005 Copyright : (C) 2006 by Ion Vasilief, Tilman Hoener zu Siederdissen 00006 Email (use @ for *) : ion_vasilief*yahoo.fr, thzs*gmx.net 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 00037 class ScriptingEnv; 00038 00044 class Note: public MdiSubWindow 00045 { 00046 Q_OBJECT 00047 00048 public: 00049 00050 Note(ScriptingEnv *env, const QString& label, ApplicationWindow* parent, const QString& name = QString(), Qt::WFlags f=0); 00051 ~Note(){}; 00052 00053 void init(ScriptingEnv *env); 00054 void setName(const QString& name); 00055 00056 public slots: 00057 QString saveToString(const QString &info, bool = false); 00058 void restore(const QStringList&); 00059 00060 ScriptEdit* editor(){return te;}; 00061 bool autoexec() const { return autoExec; } 00062 void setAutoexec(bool); 00063 void modifiedNote(); 00064 00065 // ScriptEdit methods 00066 QString text() { return te->text(); }; 00067 void setText(const QString &s) { te->setText(s); }; 00068 void print() { te->print(); }; 00069 void exportPDF(const QString& fileName){te->exportPDF(fileName);}; 00070 QString exportASCII(const QString &file=QString::null) { return te->exportASCII(file); }; 00071 QString importASCII(const QString &file=QString::null) { return te->importASCII(file); }; 00072 void execute() { te->execute(); }; 00073 void executeAll() { te->executeAll(); }; 00074 void evaluate() { te->evaluate(); }; 00075 void setDirPath(const QString& path){te->setDirPath(path);}; 00076 00078 void showLineNumbers(bool show = true){d_line_number->setVisible(show);}; 00079 bool hasLineNumbers(){return d_line_number->isVisible();}; 00080 00081 signals: 00082 void dirPathChanged(const QString& path); 00083 00084 private: 00085 ScriptEdit *te; 00086 LineNumberDisplay *d_line_number; 00087 QWidget *d_frame; 00088 bool autoExec; 00089 }; 00090 00091 #endif