![]() |
TinkerCell Core 1.0
TinkerCell's Core library providing all basic functionalities
|
This is the window that allows used to construct networks using text, as opposed to graphics, which is done by GraphicsScene. The TextEditor requires a supporting tool that parses the text and calls the itemsInserted or itemsRemoved methods. Without a supporting parser tool, the TextEditor will not do anything. More...
#include <TextEditor.h>
Public Slots | |
virtual void | popOut () |
calls main window's popOut | |
virtual void | popIn () |
calls main window's popIn | |
virtual void | undo () |
undo last edit | |
virtual void | redo () |
redo last undo | |
virtual void | selectAll () |
select all text | |
virtual void | copy () |
copy selected text | |
virtual void | cut () |
cut selected text | |
virtual void | paste () |
paste text from clipboard | |
virtual void | print (QPrinter *printer) |
print text | |
Signals | |
void | textChanged (TextEditor *, const QString &, const QString &, const QString &) |
some text inside this editor has been changed | |
void | lineChanged (TextEditor *, int, const QString &) |
the cursor has moved to a different line | |
void | itemsInserted (NetworkHandle *, const QList< ItemHandle * > &) |
signal that is emitted when items are inserted in this TextEditor. | |
void | itemsRemoved (NetworkHandle *, const QList< ItemHandle * > &) |
signal that is emitted when items are removed from this TextEditor. | |
void | parse (TextEditor *) |
request to parse the text in the current text editor | |
Public Member Functions | |
TextEditor (NetworkHandle *, QWidget *parent=0) | |
default constructor | |
~TextEditor () | |
destructor -- removes all the text items | |
void | insert (ItemHandle *) |
insert a text item | |
void | insert (const QList< ItemHandle * > &) |
insert text items | |
void | remove (ItemHandle *) |
remove an item | |
void | remove (const QList< ItemHandle * > &) |
remove text items | |
void | setItems (const QList< ItemHandle * > &) |
clear existing items and insert new items | |
QList< ItemHandle * > & | items () |
all the items represented by the text in this TextEditor | |
void | push (QUndoCommand *) |
push a command to the undo/redo stack | |
QString | selectedText () const |
gets the selected text | |
MainWindow * | mainWindow () const |
the main window containing this network | |
ConsoleWindow * | console () const |
same as network->mainWindow->console() | |
ItemHandle * | localHandle () const |
same as networkWindow->handle | |
ItemHandle * | globalHandle () const |
same as network->globalHandle() | |
Public Attributes | |
QMenu * | contextSelectionMenu |
the context menu that is shown during right-click event on a text editor with text selected. Plugins can add new actions to this menu. | |
QMenu * | contextEditorMenu |
the context menu that is shown during right-click event on a text editor with no text selected. Plugins can add new actions to this menu. | |
NetworkHandle * | network |
the network handle represented in this text editor | |
NetworkWindow * | networkWindow |
the network window containing this text editor | |
Static Public Attributes | |
static bool | SideBarEnabled = true |
Protected Member Functions | |
virtual void | keyPressEvent (QKeyEvent *event) |
listens to keyboard events in order to determine when the current line has changed | |
virtual void | mousePressEvent (QMouseEvent *event) |
listens to mouse events just to activate this window | |
virtual void | contextMenuEvent (QContextMenuEvent *event) |
creates context menu with actions in the contextMenu member | |
virtual void | mouseReleaseEvent (QMouseEvent *event) |
emits line changed and text changed if needed | |
Protected Attributes | |
int | prevBlockNumber |
previously accessed line number. This is to keep track of when a line is modified | |
int | changedBlockNumber |
current line number. This is to keep track of when a line is modified | |
QString | prevBlockText |
previously accessed line. This is to keep track of when a line is modified | |
QString | changedBlockText |
current line. This is to keep track of when a line is modified | |
QString | prevText |
current text. This is to keep track of when the text is modified | |
QList< ItemHandle * > | allItems |
all the items represented by the text in this TextEditor | |
Friends | |
class | TextUndoCommand |
class | NetworkWindow |
class | NetworkHandle |
class | SymbolsTable |
class | MainWindow |
This is the window that allows used to construct networks using text, as opposed to graphics, which is done by GraphicsScene. The TextEditor requires a supporting tool that parses the text and calls the itemsInserted or itemsRemoved methods. Without a supporting parser tool, the TextEditor will not do anything.
Definition at line 61 of file TextEditor.h.
Tinkercell::TextEditor::TextEditor | ( | NetworkHandle * | network, |
QWidget * | parent = 0 |
||
) |
default constructor
Definition at line 104 of file TextEditor.cpp.
Tinkercell::TextEditor::~TextEditor | ( | ) |
destructor -- removes all the text items
Definition at line 115 of file TextEditor.cpp.
ConsoleWindow * Tinkercell::TextEditor::console | ( | ) | const |
same as network->mainWindow->console()
Definition at line 383 of file TextEditor.cpp.
void Tinkercell::TextEditor::contextMenuEvent | ( | QContextMenuEvent * | event | ) | [protected, virtual] |
creates context menu with actions in the contextMenu member
Definition at line 136 of file TextEditor.cpp.
void Tinkercell::TextEditor::copy | ( | ) | [virtual, slot] |
copy selected text
Definition at line 65 of file TextEditor.cpp.
void Tinkercell::TextEditor::cut | ( | ) | [virtual, slot] |
cut selected text
Definition at line 70 of file TextEditor.cpp.
ItemHandle * Tinkercell::TextEditor::globalHandle | ( | ) | const |
same as network->globalHandle()
Definition at line 397 of file TextEditor.cpp.
void Tinkercell::TextEditor::insert | ( | ItemHandle * | item | ) |
insert a text item
ItemHandle* | the item |
Definition at line 183 of file TextEditor.cpp.
void Tinkercell::TextEditor::insert | ( | const QList< ItemHandle * > & | newItems | ) |
insert text items
QList<ItemHandle*> | the items |
Definition at line 206 of file TextEditor.cpp.
QList< ItemHandle * > & Tinkercell::TextEditor::items | ( | ) |
all the items represented by the text in this TextEditor
Definition at line 146 of file TextEditor.cpp.
void Tinkercell::TextEditor::itemsInserted | ( | NetworkHandle * | , |
const QList< ItemHandle * > & | |||
) | [signal] |
signal that is emitted when items are inserted in this TextEditor.
NetworkHandle* | |
QList<ItemHandle*> | new item handles |
void Tinkercell::TextEditor::itemsRemoved | ( | NetworkHandle * | , |
const QList< ItemHandle * > & | |||
) | [signal] |
signal that is emitted when items are removed from this TextEditor.
NetworkHandle* | |
QList<ItemHandle*> | removed item handles |
void Tinkercell::TextEditor::keyPressEvent | ( | QKeyEvent * | event | ) | [protected, virtual] |
listens to keyboard events in order to determine when the current line has changed
Reimplemented from Tinkercell::CodeEditor.
Definition at line 263 of file TextEditor.cpp.
void Tinkercell::TextEditor::lineChanged | ( | TextEditor * | , |
int | , | ||
const QString & | |||
) | [signal] |
the cursor has moved to a different line
int | index of the current line |
QString | current line text |
ItemHandle * Tinkercell::TextEditor::localHandle | ( | ) | const |
same as networkWindow->handle
Definition at line 390 of file TextEditor.cpp.
MainWindow * Tinkercell::TextEditor::mainWindow | ( | ) | const |
the main window containing this network
Definition at line 376 of file TextEditor.cpp.
void Tinkercell::TextEditor::mousePressEvent | ( | QMouseEvent * | event | ) | [protected, virtual] |
listens to mouse events just to activate this window
Definition at line 255 of file TextEditor.cpp.
void Tinkercell::TextEditor::mouseReleaseEvent | ( | QMouseEvent * | event | ) | [protected, virtual] |
emits line changed and text changed if needed
Definition at line 326 of file TextEditor.cpp.
void Tinkercell::TextEditor::parse | ( | TextEditor * | ) | [signal] |
request to parse the text in the current text editor
TextEditor* | editor |
void Tinkercell::TextEditor::paste | ( | ) | [virtual, slot] |
paste text from clipboard
Definition at line 82 of file TextEditor.cpp.
void Tinkercell::TextEditor::popIn | ( | ) | [virtual, slot] |
calls main window's popIn
Definition at line 410 of file TextEditor.cpp.
void Tinkercell::TextEditor::popOut | ( | ) | [virtual, slot] |
calls main window's popOut
Definition at line 404 of file TextEditor.cpp.
void Tinkercell::TextEditor::print | ( | QPrinter * | printer | ) | [virtual, slot] |
void Tinkercell::TextEditor::push | ( | QUndoCommand * | c | ) |
push a command to the undo/redo stack
QUndoCommand* |
Definition at line 37 of file TextEditor.cpp.
void Tinkercell::TextEditor::redo | ( | ) | [virtual, slot] |
redo last undo
Definition at line 59 of file TextEditor.cpp.
void Tinkercell::TextEditor::remove | ( | const QList< ItemHandle * > & | handles | ) |
remove text items
QList<ItemHandle*> | the items |
Definition at line 241 of file TextEditor.cpp.
void Tinkercell::TextEditor::remove | ( | ItemHandle * | item | ) |
remove an item
ItemHandle* | the item |
Definition at line 228 of file TextEditor.cpp.
void Tinkercell::TextEditor::selectAll | ( | ) | [virtual, slot] |
select all text
Definition at line 94 of file TextEditor.cpp.
QString Tinkercell::TextEditor::selectedText | ( | ) | const |
gets the selected text
Definition at line 131 of file TextEditor.cpp.
void Tinkercell::TextEditor::setItems | ( | const QList< ItemHandle * > & | newItems | ) |
clear existing items and insert new items
QList<ItemHandle*> | the new items |
Definition at line 151 of file TextEditor.cpp.
void Tinkercell::TextEditor::textChanged | ( | TextEditor * | , |
const QString & | , | ||
const QString & | , | ||
const QString & | |||
) | [signal] |
some text inside this editor has been changed
QString | old text |
QString | new text |
void Tinkercell::TextEditor::undo | ( | ) | [virtual, slot] |
undo last edit
Definition at line 53 of file TextEditor.cpp.
friend class MainWindow [friend] |
Definition at line 69 of file TextEditor.h.
friend class NetworkHandle [friend] |
Definition at line 67 of file TextEditor.h.
friend class NetworkWindow [friend] |
Definition at line 66 of file TextEditor.h.
friend class SymbolsTable [friend] |
Definition at line 68 of file TextEditor.h.
friend class TextUndoCommand [friend] |
Definition at line 65 of file TextEditor.h.
QList<ItemHandle*> Tinkercell::TextEditor::allItems [protected] |
all the items represented by the text in this TextEditor
Definition at line 193 of file TextEditor.h.
int Tinkercell::TextEditor::changedBlockNumber [protected] |
current line number. This is to keep track of when a line is modified
Definition at line 180 of file TextEditor.h.
QString Tinkercell::TextEditor::changedBlockText [protected] |
current line. This is to keep track of when a line is modified
Definition at line 184 of file TextEditor.h.
the context menu that is shown during right-click event on a text editor with no text selected. Plugins can add new actions to this menu.
Definition at line 110 of file TextEditor.h.
the context menu that is shown during right-click event on a text editor with text selected. Plugins can add new actions to this menu.
Definition at line 105 of file TextEditor.h.
the network handle represented in this text editor
Definition at line 112 of file TextEditor.h.
the network window containing this text editor
Definition at line 114 of file TextEditor.h.
int Tinkercell::TextEditor::prevBlockNumber [protected] |
previously accessed line number. This is to keep track of when a line is modified
Definition at line 178 of file TextEditor.h.
QString Tinkercell::TextEditor::prevBlockText [protected] |
previously accessed line. This is to keep track of when a line is modified
Definition at line 182 of file TextEditor.h.
QString Tinkercell::TextEditor::prevText [protected] |
current text. This is to keep track of when the text is modified
Definition at line 186 of file TextEditor.h.
bool Tinkercell::TextEditor::SideBarEnabled = true [static] |
Definition at line 73 of file TextEditor.h.