Note.h
Go to the documentation of this file.
/***************************************************************************
File : Note.h
Project : QtiPlot
--------------------------------------------------------------------
Copyright : (C) 2006 - 2009 by Ion Vasilief
Email (use @ for *) : ion_vasilief*yahoo.fr
Description : Notes window class
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the Free Software *
* Foundation, Inc., 51 Franklin Street, Fifth Floor, *
* Boston, MA 02110-1301 USA *
* *
***************************************************************************/
#ifndef NOTE_H
#define NOTE_H
#include <MdiSubWindow.h>
#include <ScriptEdit.h>
#include <LineNumberDisplay.h>
#include <QTextEdit>
#include <QTabWidget>
class ScriptingEnv;
class Note: public MdiSubWindow
{
Q_OBJECT
public:
Note(ScriptingEnv *env, const QString& label, ApplicationWindow* parent, const QString& name = QString(), Qt::WFlags f=0);
~Note(){};
void init(ScriptingEnv *env);
void setName(const QString& name);
void setTabStopWidth(int length);
int indexOf(ScriptEdit* editor);
ScriptEdit* editor(int index);
ScriptEdit* currentEditor();
int tabs(){return d_tab_widget->count();};
void renameTab(int, const QString&);
void save(const QString& fn, const QString &info, bool = false);
void restore(const QStringList&);
public slots:
bool autoexec() const { return autoExec; }
void setAutoexec(bool);
void modifiedNote();
// ScriptEdit methods
QString text() { if(currentEditor()) return currentEditor()->text(); return QString::null;};
void setText(const QString &s) { if(currentEditor()) currentEditor()->setText(s); };
void print() { if(currentEditor()) currentEditor()->print(); };
void print(QPrinter *printer) { if(currentEditor()) currentEditor()->print(printer); };
void exportPDF(const QString& fileName){if(currentEditor()) currentEditor()->exportPDF(fileName);};
QString exportASCII(const QString &file=QString::null) { if(currentEditor()) return currentEditor()->exportASCII(file); return QString::null;};
QString importASCII(const QString &file=QString::null){ if(currentEditor()) return currentEditor()->importASCII(file); return QString::null;};
void execute() { if(currentEditor()) currentEditor()->execute(); };
void executeAll() { if(currentEditor()) currentEditor()->executeAll(); };
void evaluate() { if(currentEditor()) currentEditor()->evaluate(); };
void setDirPath(const QString& path){if(currentEditor()) currentEditor()->setDirPath(path);};
void showLineNumbers(bool show = true);
bool hasLineNumbers(){return d_line_number_enabled;};
void setFont(const QFont& f);
void addTab();
void removeTab(int = -1);
void renameCurrentTab();
signals:
void dirPathChanged(const QString& path);
void currentEditorChanged();
private:
void saveTab(int index, const QString &fn);
ScriptingEnv *d_env;
QWidget *d_frame;
QTabWidget *d_tab_widget;
bool d_line_number_enabled;
bool autoExec;
};
#endif
Note::setName
void setName(const QString &name)
Definition: Note.cpp:248
ScriptEdit::executeAll
void executeAll()
Definition: ScriptEdit.cpp:431
Note::executeAll
void executeAll()
Definition: Note.h:78
Note::saveTab
void saveTab(int index, const QString &fn)
Definition: Note.cpp:285
LineNumberDisplay.h
ScriptEdit::exportASCII
QString exportASCII(const QString &file=QString::null)
Definition: ScriptEdit.cpp:560
Note::currentEditorChanged
void currentEditorChanged()
Note::print
void print()
Definition: Note.h:72
Note::evaluate
void evaluate()
Definition: Note.h:79
Note::renameTab
void renameTab(int, const QString &)
Definition: Note.cpp:114
Note
Notes window class.
Definition: Note.h:43
Note::exportPDF
void exportPDF(const QString &fileName)
Definition: Note.h:74
ScriptEdit::print
void print()
Definition: ScriptEdit.cpp:493
Note::modifiedNote
void modifiedNote()
Definition: Note.cpp:254
Note::d_tab_widget
QTabWidget * d_tab_widget
Definition: Note.h:100
ScriptingEnv
An interpreter for evaluating scripting code. Abstract.
Definition: ScriptingEnv.h:50
ScriptEdit::exportPDF
void exportPDF(const QString &fileName)
Definition: ScriptEdit.cpp:483
Note::indexOf
int indexOf(ScriptEdit *editor)
Definition: Note.cpp:175
Note::d_line_number_enabled
bool d_line_number_enabled
Definition: Note.h:101
Note::d_env
ScriptingEnv * d_env
Definition: Note.h:98
Note::importASCII
QString importASCII(const QString &file=QString::null)
Definition: Note.h:76
Note::addTab
void addTab()
Definition: Note.cpp:133
Note::editor
ScriptEdit * editor(int index)
Definition: Note.cpp:197
Note::save
void save(const QString &fn, const QString &info, bool=false)
Definition: Note.cpp:259
ScriptEdit::setDirPath
void setDirPath(const QString &path)
Definition: ScriptEdit.cpp:622
Note::hasLineNumbers
bool hasLineNumbers()
Definition: Note.h:84
ApplicationWindow
QtiPlot&#39;s main window.
Definition: ApplicationWindow.h:133
Note::exportASCII
QString exportASCII(const QString &file=QString::null)
Definition: Note.h:75
ScriptEdit
Editor widget with support for evaluating expressions and executing code.
Definition: ScriptEdit.h:50
Note::showLineNumbers
void showLineNumbers(bool show=true)
Enables/Disables the line number display.
Definition: Note.cpp:81
Note::autoExec
bool autoExec
Definition: Note.h:102
Note::Note
Note(ScriptingEnv *env, const QString &label, ApplicationWindow *parent, const QString &name=QString(), Qt::WFlags f=0)
Definition: Note.cpp:39
Note::init
void init(ScriptingEnv *env)
Definition: Note.cpp:46
Note::~Note
~Note()
Definition: Note.h:50
Note::d_frame
QWidget * d_frame
Definition: Note.h:99
ScriptEdit::execute
void execute()
Definition: ScriptEdit.cpp:407
Note::tabs
int tabs()
Definition: Note.h:58
ScriptEdit::importASCII
QString importASCII(const QString &file=QString::null)
Definition: ScriptEdit.cpp:511
Note::restore
void restore(const QStringList &)
Not implemented yet.
Definition: Note.cpp:304
Note::currentEditor
ScriptEdit * currentEditor()
Definition: Note.cpp:215
Note::setText
void setText(const QString &s)
Definition: Note.h:71
Note::dirPathChanged
void dirPathChanged(const QString &path)
Note::setDirPath
void setDirPath(const QString &path)
Definition: Note.h:80
Note::execute
void execute()
Definition: Note.h:77
Note::autoexec
bool autoexec() const
Definition: Note.h:65
MdiSubWindow
Base class of all MDI client windows.
Definition: MdiSubWindow.h:51
Note::setFont
void setFont(const QFont &f)
Definition: Note.cpp:388
MdiSubWindow.h
Note::removeTab
void removeTab(int=-1)
Definition: Note.cpp:119
Note::print
void print(QPrinter *printer)
Definition: Note.h:73
Note::setAutoexec
void setAutoexec(bool)
Definition: Note.cpp:379
Note::setTabStopWidth
void setTabStopWidth(int length)
Definition: Note.cpp:230
ScriptEdit.h
MdiSubWindow::name
QString name()
Return the window name.
Definition: MdiSubWindow.h:84
Note::renameCurrentTab
void renameCurrentTab()
Definition: Note.cpp:104
ScriptEdit::evaluate
void evaluate()
Definition: ScriptEdit.cpp:445
Note::text
QString text()
Definition: Note.h:70