TinkerCell Core 1.0
TinkerCell's Core library providing all basic functionalities
Public Slots | Signals | Public Member Functions | Public Attributes | Static Public Attributes | Protected Member Functions | Protected Attributes | Friends
Tinkercell::TextEditor Class Reference

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>

Inheritance diagram for Tinkercell::TextEditor:
Inheritance graph
[legend]
Collaboration diagram for Tinkercell::TextEditor:
Collaboration graph
[legend]

List of all members.

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
MainWindowmainWindow () const
 the main window containing this network
ConsoleWindowconsole () const
 same as network->mainWindow->console()
ItemHandlelocalHandle () const
 same as networkWindow->handle
ItemHandleglobalHandle () 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.
NetworkHandlenetwork
 the network handle represented in this text editor
NetworkWindownetworkWindow
 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

Detailed Description

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.


Constructor & Destructor Documentation

Tinkercell::TextEditor::TextEditor ( NetworkHandle network,
QWidget *  parent = 0 
)

default constructor

Definition at line 104 of file TextEditor.cpp.

Here is the call graph for this function:

Tinkercell::TextEditor::~TextEditor ( )

destructor -- removes all the text items

Definition at line 115 of file TextEditor.cpp.


Member Function Documentation

ConsoleWindow * Tinkercell::TextEditor::console ( ) const

same as network->mainWindow->console()

Definition at line 383 of file TextEditor.cpp.

Here is the call graph for this function:

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.

Here is the call graph for this function:

void Tinkercell::TextEditor::copy ( ) [virtual, slot]

copy selected text

Definition at line 65 of file TextEditor.cpp.

Here is the caller graph for this function:

void Tinkercell::TextEditor::cut ( ) [virtual, slot]

cut selected text

Definition at line 70 of file TextEditor.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

ItemHandle * Tinkercell::TextEditor::globalHandle ( ) const

same as network->globalHandle()

Definition at line 397 of file TextEditor.cpp.

Here is the call graph for this function:

void Tinkercell::TextEditor::insert ( ItemHandle item)

insert a text item

Parameters:
ItemHandle*the item

Definition at line 183 of file TextEditor.cpp.

Here is the call graph for this function:

void Tinkercell::TextEditor::insert ( const QList< ItemHandle * > &  newItems)

insert text items

Parameters:
QList<ItemHandle*>the items

Definition at line 206 of file TextEditor.cpp.

Here is the call graph for this function:

QList< ItemHandle * > & Tinkercell::TextEditor::items ( )

all the items represented by the text in this TextEditor

Definition at line 146 of file TextEditor.cpp.

Here is the caller graph for this function:

void Tinkercell::TextEditor::itemsInserted ( NetworkHandle ,
const QList< ItemHandle * > &   
) [signal]

signal that is emitted when items are inserted in this TextEditor.

Parameters:
NetworkHandle*
QList<ItemHandle*>new item handles

Here is the caller graph for this function:

void Tinkercell::TextEditor::itemsRemoved ( NetworkHandle ,
const QList< ItemHandle * > &   
) [signal]

signal that is emitted when items are removed from this TextEditor.

Parameters:
NetworkHandle*
QList<ItemHandle*>removed item handles

Here is the caller graph for this function:

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.

Here is the call graph for this function:

void Tinkercell::TextEditor::lineChanged ( TextEditor ,
int  ,
const QString &   
) [signal]

the cursor has moved to a different line

Parameters:
intindex of the current line
QStringcurrent line text

Here is the caller graph for this function:

ItemHandle * Tinkercell::TextEditor::localHandle ( ) const

same as networkWindow->handle

Definition at line 390 of file TextEditor.cpp.

Here is the caller graph for this function:

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.

Here is the call graph for this function:

void Tinkercell::TextEditor::mouseReleaseEvent ( QMouseEvent *  event) [protected, virtual]

emits line changed and text changed if needed

Definition at line 326 of file TextEditor.cpp.

Here is the call graph for this function:

void Tinkercell::TextEditor::parse ( TextEditor ) [signal]

request to parse the text in the current text editor

Parameters:
TextEditor*editor
void Tinkercell::TextEditor::paste ( ) [virtual, slot]

paste text from clipboard

Definition at line 82 of file TextEditor.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

void Tinkercell::TextEditor::popIn ( ) [virtual, slot]

calls main window's popIn

Returns:
void

Definition at line 410 of file TextEditor.cpp.

Here is the call graph for this function:

void Tinkercell::TextEditor::popOut ( ) [virtual, slot]

calls main window's popOut

Returns:
void

Definition at line 404 of file TextEditor.cpp.

Here is the call graph for this function:

void Tinkercell::TextEditor::print ( QPrinter *  printer) [virtual, slot]

print text

Parameters:
QPrinter

Definition at line 99 of file TextEditor.cpp.

void Tinkercell::TextEditor::push ( QUndoCommand c)

push a command to the undo/redo stack

Parameters:
QUndoCommand*

Definition at line 37 of file TextEditor.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

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

Parameters:
QList<ItemHandle*>the items

Definition at line 241 of file TextEditor.cpp.

Here is the call graph for this function:

void Tinkercell::TextEditor::remove ( ItemHandle item)

remove an item

Parameters:
ItemHandle*the item

Definition at line 228 of file TextEditor.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

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.

Here is the caller graph for this function:

void Tinkercell::TextEditor::setItems ( const QList< ItemHandle * > &  newItems)

clear existing items and insert new items

Parameters:
QList<ItemHandle*>the new items

Definition at line 151 of file TextEditor.cpp.

Here is the call graph for this function:

void Tinkercell::TextEditor::textChanged ( TextEditor ,
const QString &  ,
const QString &  ,
const QString &   
) [signal]

some text inside this editor has been changed

Parameters:
QStringold text
QStringnew text

Here is the caller graph for this function:

void Tinkercell::TextEditor::undo ( ) [virtual, slot]

undo last edit

Definition at line 53 of file TextEditor.cpp.


Friends And Related Function Documentation

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.


Member Data Documentation

all the items represented by the text in this TextEditor

Definition at line 193 of file TextEditor.h.

current line number. This is to keep track of when a line is modified

Definition at line 180 of file TextEditor.h.

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.

previously accessed line number. This is to keep track of when a line is modified

Definition at line 178 of file TextEditor.h.

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.

Definition at line 73 of file TextEditor.h.


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines