TinkerCell Core 1.0
TinkerCell's Core library providing all basic functionalities
Public Types | Public Member Functions | Public Attributes | Static Public Attributes | Friends
Tinkercell::MainWindow Class Reference

MainWindow is the parent container for all the other widgets in TinkerCell The central widget in MainWindow is a tab widget. Each tab widget can hold a GraphicsView or a TextEditor. One of the main roles of MainWindow is to serve as a signal/slot hub for Tools. More...

#include <MainWindow.h>

Collaboration diagram for Tinkercell::MainWindow:
Collaboration graph
[legend]

List of all members.

Public Types

enum  TOOL_WINDOW_OPTION { DockWidget, TabWidget }
 this enum is used to determine how to place a widget when used in addToolWindow. DockWidget = tool window is placed into a dockable widget TabWidget = tool window is placed in an existing tool widget, if one exists More...

Public Member Functions

 MainWindow (bool enableScene=true, bool enableText=true, bool views=true)
 5-arg (optional) constructor allows disabling of text/graphics modes
virtual void allowMultipleViewModes (bool)
 allow or disallow changing between different views
virtual ~MainWindow ()
 Destructor: delete all the graphics scenes.
QDockWidget * addToolWindow (QWidget *tool, TOOL_WINDOW_OPTION option=DockWidget, Qt::DockWidgetArea initArea=Qt::RightDockWidgetArea, Qt::DockWidgetAreas allowedAreas=Qt::AllDockWidgetAreas, bool inMenu=true)
 Add a new docking window to the main window. The name and icon are obtained using the widget's windowTitle and windowIcon, so be sure to set those before calling this function.
void addToViewMenu (QWidget *tool)
 place a show/hide action in the view menu for the given widget
void setCursor (QCursor cursor)
 set the cursor for all windows
void addTool (Tool *tool)
 add a new tool to the list of tools stored in the main window
void initializeMenus (bool enableScene=true, bool enableText=true)
 Initialize the basic menu (save, open, close, exit, etc.).
void setupNewThread (QSemaphore *, QLibrary *)
 This function is usually called from a new thread. This function allows all the plugins to add their functionalities to the C function pointer of the new thread.
void loadDynamicLibrary (const QString &)
 Load a new plugin (dll)
QPair< QList< ItemHandle * >
, QList< QGraphicsItem * > > 
getItemsFromFile (const QString &filename, ItemHandle *root=0)
 get the items inside a file. Some tool must implement this function and connect to the getItemsFromFile signal. The Core library does not implement a read file function.
GraphicsScenecurrentScene () const
 gets the current scene that is active
TextEditorcurrentTextEditor () const
 gets the text editor that is active
NetworkWindowcurrentWindow () const
 gets the current window that is active (each window contains either a scene or editor)
NetworkHandlecurrentNetwork () const
 gets the current window that is active
QList< NetworkHandle * > networks () const
 gets all the windows in the main window
QUndoStack * historyStack () const
 the history stack of the current network.
QUndoView * historyWidget ()
 the history stack widget of the current window.
virtual Tooltool (const QString &) const
 get a tool
virtual QList< Tool * > tools (const QString &category=QString()) const
 get all tools

Public Attributes

QList< QWidget * > toolWindows
 the set of all windows inseted in the main window using addToolWindow
QMenu contextItemsMenu
 the context menu that is shown during right-click event on selected graphical items. Plugins can add new actions to this menu.
QMenu contextScreenMenu
 the context menu that is shown during right-click event on the scene. Plugins can add new actions to this menu.
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.
QMenu * fileMenu
 The file menu. Plugins can add new actions to this menu.
QMenu * editMenu
 The edit menu. Plugins can add new actions to this menu.
QMenu * viewMenu
 The view menu. New docking windows are automatically added here.
QMenu * helpMenu
 The help menu.
QMenu * settingsMenu
 the menu for settings such as default plugins, Tinkercell home directory, etc.
QMenu * parsersMenu
 the menu for choosing one of the available parsers (will be 0 if there are no parsers)
QToolBar * toolBarBasic
 The tool bar that contains new, open, close, etc. actions.
QToolBar * toolBarEdits
 The tool bar that contains copy, paste, undo, etc.
QToolBar * toolBarForTools
 One of the initial tool bars which designated for tools that do not want to create a new toolbar.

Static Public Attributes

static TOOL_WINDOW_OPTION defaultToolWindowOption
 the default option to use for tools (optional)
static TOOL_WINDOW_OPTION defaultHistoryWindowOption
 the default option to use for history window
static TOOL_WINDOW_OPTION defaultConsoleWindowOption
 the default option to use for console window

Friends

class NetworkWindow
class NetworkHandle
class GraphicsScene
class TextEditor
class GraphicsView
class DroppableTabWidget

slots

void setUserHome ()
 asks user for a new directory to be used as the user home directory (must be writtable)
GraphicsScenenewScene ()
 create new scene
TextEditornewTextEditor ()
 create new text editor
void closeWindow ()
 triggered when the close button is clicked. Closes the current window
void saveWindow ()
 triggered when the save button is clicked. Opens a file dialog and emits the save signal. The main window itself does not implement the save.
void saveWindowAs ()
 triggered when the save-as button is clicked. Opens a file dialog and emits the save signal. The main window itself does not implement the save.
void open ()
 triggered when the open button is clicked. Opens a file dialog. Note: the core library just emits a signal, and other tools are responsible for actually opening a file
void open (const QString &)
 open a file. Note: the core library just emits a signal, and other tools are responsible for actually opening a file The main window does not implement an function for opening a new file
void undo ()
 calls current scene or text editor's undo
void redo ()
 calls current scene or text editor's redo
void copy ()
 calls current scene or text editor's copy
void cut ()
 calls current scene or text editor's cut
void paste ()
 calls current scene or text editor's paste
void selectAll ()
 calls current scene or text editor's selectAll
void remove ()
 calls current scene or text editor's find
void print ()
 triggered when the print button is clicked. Calls current scene's print
void printToFile (const QString &filename=QString(), int w=0, int h=0)
 triggered when the print-to-file button is clicked. Calls current scene's print on a pdf file
void sendEscapeSignal (const QWidget *w=0)
 sends a signal to all plugins telling them to exit their current processes.
void addParser (TextParser *)
 add a new text parser to the list of available parsers. The current text parser can be obtained using TextParser::currentParser();
void gridOn ()
 change grid mode for current scene to on (>0)
void gridOff ()
 change grid mode for current scene to off (=0)
void setGridSize ()
 set grid size for current scene
void popOut ()
 pop-out the current window
ConsoleWindowconsole () const
 get the console window
void readSettings ()
 read initial settings from settingsFileName
static MainWindowinstance ()
 gets the global main window
void popOut (NetworkWindow *)
 pop-out the given window
void popIn (NetworkWindow *)
 pop-in the given window
void setCurrentWindow (NetworkWindow *)
 sets the active window
void loadFiles (const QList< QFileInfo > &files)
 loads files (library files or Network files)
void changeConsoleBgColor ()
 change console background color
void changeConsoleTextColor ()
 change console text color
void changeConsoleMsgColor ()
 change console message text color
void changeConsoleErrorMsgColor ()
 change console error text color
virtual void tabIndexChanged (int)
 tab changed
void itemsRemovedSlot (GraphicsScene *scene, const QList< QGraphicsItem * > &item, const QList< ItemHandle * > &handles)
 signals whenever items are deleted
void itemsInsertedSlot (GraphicsScene *scene, const QList< QGraphicsItem * > &item, const QList< ItemHandle * > &handles, GraphicsScene::InsertType)
 signals whenever items are added
void setupFunctionPointersSlot (QSemaphore *, QLibrary *)
 send signal to other tools so that they can connect functions to signals

signals

class GlobalSettings
static QString previousFileName
 stores the last opened directory
static QHash< void *, bool > invalidPointers
 stores list of all pointers that have been deleted (to prevent double-deletions)
bool allowViewModeToChange
 allowed views
QHash< QString, QLibrary * > dynamicallyLoadedLibraries
 the loaded dynamic libraries indexed by file name
ConsoleWindowconsoleWindow
 the general window for command, errors, and messages
DroppableTabWidgettabWidget
 the central multi-document interface widget
QList< NetworkHandle * > allNetworks
 the list of all network windows
QToolBox * toolsWidget
 the optional tool box that will only appear if one of the plug-ins uses the tab widget argument in the addToolWindow call
HistoryWindow historyWindow
 history view, not the stack itself. The stack is stored within each NetworkHandle
NetworkWindowcurrentNetworkWindow
 keep pointer to last selected window. Used by windowChanged signal
QHash< QString, Tool * > toolsHash
 all the tools (plug-ins) are stored here, indexed by their names
QHash< QString, Tool * > toolsHashByCategory
 this is a multiple hash. All the tool are stored here indexed by their category names (if they have a category)
bool isValidHandlePointer (void *p)
 checks if the given address belongs to a handle
void toolAboutToBeLoaded (Tool *tool, bool *shouldLoad)
 a new tool is about to be added. This signal can be used to prevent the tool from being added
void historyChanged (int i=0)
 one of more changed have occurred in the history window of the current scene
void funtionPointersToMainThread (QSemaphore *, QLibrary *)
 used internally by MainWindow in order to move from a thread to the main thread
void toolLoaded (Tool *tool)
 signals when a new tool (plugin) is loaded
void setupFunctionPointers (QLibrary *)
 signals when a new FuntionToSignal is constructed
void networkClosing (NetworkHandle *, bool *)
 signals when a network is going to close
void networkClosed (NetworkHandle *)
 signals after a window is closed
void prepareNetworkForSaving (NetworkHandle *, bool *)
 signals when a tool is about to save a network
void networkSaved (NetworkHandle *)
 signals when a tool has saved the network in a file
void saveNetwork (const QString &filename)
 signals when user selects a file to save the current network to
void loadNetwork (const QString &filename, bool *alreadyLoaded=0)
 signals when user selects a file to open in the current network
void getItemsFromFile (QList< ItemHandle * > &, QList< QGraphicsItem * > &, const QString &filename, ItemHandle *root)
 signal sent to a tool so that the tool can get the items inside a file
void networkLoaded (NetworkHandle *)
 signals informs that the current network has just loaded a new Network
void networkOpened (NetworkHandle *)
 signals whenever the new network is opened
void windowChanged (NetworkWindow *, NetworkWindow *)
 signals whenever the current window changes
void itemsSelected (GraphicsScene *scene, const QList< QGraphicsItem * > &items, QPointF point, Qt::KeyboardModifiers modifiers)
 signals whenever a new item is selected (item can be sub-item, not top-level)
void mousePressed (GraphicsScene *scene, QPointF point, Qt::MouseButton, Qt::KeyboardModifiers modifiers)
 signals whenever an empty node of the screen is clicked
void mouseReleased (GraphicsScene *scene, QPointF point, Qt::MouseButton, Qt::KeyboardModifiers modifiers)
 signals whenever an empty node of the screen is clicked
void mouseDoubleClicked (GraphicsScene *scene, QPointF point, QGraphicsItem *, Qt::MouseButton, Qt::KeyboardModifiers modifiers)
 emits event when mouse is double clicked
void mouseDragged (GraphicsScene *scene, QPointF from, QPointF to, Qt::MouseButton, Qt::KeyboardModifiers modifiers)
 signals whenever mouse is dragged from one point to another
void itemsAboutToBeMoved (GraphicsScene *scene, QList< QGraphicsItem * > &item, QList< QPointF > &distance, QList< QUndoCommand * > &)
 signals whenever items are going to be moved (each item is the top-most item)
void itemsMoved (GraphicsScene *scene, const QList< QGraphicsItem * > &item, const QList< QPointF > &distance)
 signals whenever items are being moved (each item is the top-most item)
void itemsAboutToBeRemoved (GraphicsScene *scene, QList< QGraphicsItem * > &item, QList< ItemHandle * > &handles, QList< QUndoCommand * > &)
 signals just before items are deleted
void itemsRemoved (GraphicsScene *scene, const QList< QGraphicsItem * > &item, const QList< ItemHandle * > &handles)
 signals whenever items are deleted
void itemsAboutToBeInserted (GraphicsScene *scene, QList< QGraphicsItem * > &, QList< ItemHandle * > &, QList< QUndoCommand * > &, GraphicsScene::InsertType type=GraphicsScene::NEW)
 signals whenever items are going to be added
void itemsInserted (GraphicsScene *scene, const QList< QGraphicsItem * > &item, const QList< ItemHandle * > &handles, GraphicsScene::InsertType type=GraphicsScene::NEW)
 signals whenever items are added
void itemsInserted (NetworkHandle *win, const QList< ItemHandle * > &)
 A convenient signal that is emitted when items are inserted from a GraphicsScene or TextEditor. Warning: listening to the other itemsInserted signals may cause redundancy.
void itemsRemoved (NetworkHandle *win, const QList< ItemHandle * > &)
 A convenient signal that is emitted when items are removed from a GraphicsScene or TextEditor. Warning: listening to the other itemsRemoved signals may cause redundancy.
void copyItems (GraphicsScene *scene, QList< QGraphicsItem * > &, QList< ItemHandle * > &)
 signals just before items are copied
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 parse (TextEditor *)
 request to parse the text in the current text editor
void mouseMoved (GraphicsScene *scene, QGraphicsItem *item, QPointF point, Qt::MouseButton, Qt::KeyboardModifiers modifiers, QList< QGraphicsItem * > &)
 signals whenever mouse moves, and indicates whether it is on top of an item
void mouseOnTopOf (GraphicsScene *scene, QGraphicsItem *item, QPointF point, Qt::KeyboardModifiers modifiers, QList< QGraphicsItem * > &)
 signals whenever mouse is on top of an item
void sceneRightClick (GraphicsScene *scene, QGraphicsItem *item, QPointF point, Qt::KeyboardModifiers modifiers)
 signals whenever right click is made on an item or sceen
void keyPressed (GraphicsScene *scene, QKeyEvent *)
 signals whenever a key is pressed
void keyReleased (GraphicsScene *scene, QKeyEvent *)
 signals whenever a key is released
void colorChanged (GraphicsScene *scene, const QList< QGraphicsItem * > &items)
 signals whenever color of items are changed
void parentItemChanged (GraphicsScene *scene, const QList< QGraphicsItem * > &items, const QList< QGraphicsItem * > &parents)
 signals whenever item parents are changed
void itemsRenamed (NetworkHandle *window, const QList< ItemHandle * > &items, const QList< QString > &oldnames, const QList< QString > &newnames)
 signals whenever an item is renamed
void handlesChanged (NetworkHandle *scene, const QList< QGraphicsItem * > &items, const QList< ItemHandle * > &old)
 signals whenever the handles for graphics items have changed
void parentHandleChanged (NetworkHandle *scene, const QList< ItemHandle * > &, const QList< ItemHandle * > &)
 signals whenever item parent handle is changed
void handleFamilyChanged (NetworkHandle *network, const QList< ItemHandle * > &, const QList< ItemFamily * > &)
 signals whenever item handles' families are changed
void dataChanged (const QList< ItemHandle * > &items)
 signals whenever some data is changed
void escapeSignal (const QWidget *sender)
 signals whenever the current activities need to be stopped
void filesLoaded (const QList< QFileInfo > &files)
 signals whenever file(s) are loaded. Each file can be a model or a plugin
void itemsDropped (GraphicsScene *, const QString &, QPointF)
 signal is emitted when some object OTHER than files are dropped on the canvas
void saveSettings ()
 save initial settings to settingsFileName
void loadDefaultPlugins ()
 load default plugins
void closeEvent (QCloseEvent *event)
 close window event -- asks whether to save file
virtual void dropEvent (QDropEvent *)
 drag and drop
virtual void dragEnterEvent (QDragEnterEvent *event)
 drag and drop

Detailed Description

MainWindow is the parent container for all the other widgets in TinkerCell The central widget in MainWindow is a tab widget. Each tab widget can hold a GraphicsView or a TextEditor. One of the main roles of MainWindow is to serve as a signal/slot hub for Tools.

See also:
GlobalSettings

Definition at line 89 of file MainWindow.h.


Member Enumeration Documentation

this enum is used to determine how to place a widget when used in addToolWindow. DockWidget = tool window is placed into a dockable widget TabWidget = tool window is placed in an existing tool widget, if one exists

Enumerator:
DockWidget 
TabWidget 

Definition at line 106 of file MainWindow.h.


Constructor & Destructor Documentation

Tinkercell::MainWindow::MainWindow ( bool  enableScene = true,
bool  enableText = true,
bool  views = true 
)

5-arg (optional) constructor allows disabling of text/graphics modes

Parameters:
boolenable text-based network construction (default = true)
boolenable graphics-based network construction (default = true)
boolallow tabbed and windowed view modes (default = true)
virtual Tinkercell::MainWindow::~MainWindow ( ) [virtual]

Destructor: delete all the graphics scenes.


Member Function Documentation

void Tinkercell::MainWindow::addParser ( TextParser *  ) [slot]

add a new text parser to the list of available parsers. The current text parser can be obtained using TextParser::currentParser();

void Tinkercell::MainWindow::addTool ( Tool tool)

add a new tool to the list of tools stored in the main window

Parameters:
thename of the new tool
thenew tool
Returns:
void

Here is the caller graph for this function:

QDockWidget* Tinkercell::MainWindow::addToolWindow ( QWidget *  tool,
TOOL_WINDOW_OPTION  option = DockWidget,
Qt::DockWidgetArea  initArea = Qt::RightDockWidgetArea,
Qt::DockWidgetAreas  allowedAreas = Qt::AllDockWidgetAreas,
bool  inMenu = true 
)

Add a new docking window to the main window. The name and icon are obtained using the widget's windowTitle and windowIcon, so be sure to set those before calling this function.

Parameters:
Tool*the new tool
Qt::DockWidgetAreathe initial docking area
Qt::DockWidgetAreasthe allowed docking areas
boolwhether or not to place the docking window in the view menu
booluse a tab widget instead of a dock widget. The widget will not be dockable, but the entire tab widget will be dockable.
Returns:
QDockWidget* the new docking widget. TabWidget option is used, the docking widget may be an existing docking widget.

Here is the caller graph for this function:

void Tinkercell::MainWindow::addToViewMenu ( QWidget *  tool)

place a show/hide action in the view menu for the given widget

Parameters:
QWidget*the new widget
virtual void Tinkercell::MainWindow::allowMultipleViewModes ( bool  ) [virtual]

allow or disallow changing between different views

Parameters:
bool
void Tinkercell::MainWindow::changeConsoleBgColor ( ) [protected, slot]

change console background color

Returns:
void
void Tinkercell::MainWindow::changeConsoleErrorMsgColor ( ) [protected, slot]

change console error text color

Returns:
void
void Tinkercell::MainWindow::changeConsoleMsgColor ( ) [protected, slot]

change console message text color

Returns:
void
void Tinkercell::MainWindow::changeConsoleTextColor ( ) [protected, slot]

change console text color

Returns:
void
void Tinkercell::MainWindow::closeEvent ( QCloseEvent *  event) [protected]

close window event -- asks whether to save file

Parameters:
QCloseEvent* event
Returns:
void
void Tinkercell::MainWindow::closeWindow ( ) [slot]

triggered when the close button is clicked. Closes the current window

void Tinkercell::MainWindow::colorChanged ( GraphicsScene scene,
const QList< QGraphicsItem * > &  items 
) [signal]

signals whenever color of items are changed

Parameters:
GraphicsScene* scene where the event took place
QList<QGraphicsItem*>&items that changed color
Returns:
void
ConsoleWindow* Tinkercell::MainWindow::console ( ) const [slot]

get the console window

Here is the caller graph for this function:

void Tinkercell::MainWindow::copy ( ) [slot]

calls current scene or text editor's copy

void Tinkercell::MainWindow::copyItems ( GraphicsScene scene,
QList< QGraphicsItem * > &  ,
QList< ItemHandle * > &   
) [signal]

signals just before items are copied

Parameters:
GraphicsScene* scene where the items are going to be copied
QList<QGraphicsItem*>&list of graphics items going to be copied
QList<ItemHandle*>&list of handles going to be copied (does NOT have to be the same number as items removed)
Returns:
void
NetworkHandle* Tinkercell::MainWindow::currentNetwork ( ) const

gets the current window that is active

Returns:
NetworkHandle* current network

Here is the caller graph for this function:

GraphicsScene* Tinkercell::MainWindow::currentScene ( ) const

gets the current scene that is active

Returns:
GraphicsScene* current scene

Here is the caller graph for this function:

TextEditor* Tinkercell::MainWindow::currentTextEditor ( ) const

gets the text editor that is active

Returns:
TextEditor* current editor

Here is the caller graph for this function:

NetworkWindow* Tinkercell::MainWindow::currentWindow ( ) const

gets the current window that is active (each window contains either a scene or editor)

Returns:
NetworkWindow* current network window

Here is the caller graph for this function:

void Tinkercell::MainWindow::cut ( ) [slot]

calls current scene or text editor's cut

void Tinkercell::MainWindow::dataChanged ( const QList< ItemHandle * > &  items) [signal]

signals whenever some data is changed

Parameters:
QList<ItemHandle*>&items handles
Returns:
void
virtual void Tinkercell::MainWindow::dragEnterEvent ( QDragEnterEvent *  event) [protected, virtual]

drag and drop

virtual void Tinkercell::MainWindow::dropEvent ( QDropEvent *  ) [protected, virtual]

drag and drop

void Tinkercell::MainWindow::escapeSignal ( const QWidget *  sender) [signal]

signals whenever the current activities need to be stopped

Parameters:
QWidget* the widget that send the signal
Returns:
void
void Tinkercell::MainWindow::filesLoaded ( const QList< QFileInfo > &  files) [signal]

signals whenever file(s) are loaded. Each file can be a model or a plugin

Parameters:
QList<QFileInfo>&the name(s) of the file(s)
Returns:
void
void Tinkercell::MainWindow::funtionPointersToMainThread ( QSemaphore *  ,
QLibrary *   
) [signal]

used internally by MainWindow in order to move from a thread to the main thread

Parameters:
QSemaphore*Sempahore that lets the thread run once C API is initialized
QLibrary* the new FuntionToSignal instance
Returns:
void
void Tinkercell::MainWindow::getItemsFromFile ( QList< ItemHandle * > &  ,
QList< QGraphicsItem * > &  ,
const QString &  filename,
ItemHandle root 
) [signal]

signal sent to a tool so that the tool can get the items inside a file

Parameters:
QList<ItemHandle*>&list of items inside the file
QList<QGraphicsItem*>&list of graphics items in the file
QString&file that is selected by user
ItemHandle* optional root parent handle for all the loaded items
Returns:
void
QPair< QList<ItemHandle*>, QList<QGraphicsItem*> > Tinkercell::MainWindow::getItemsFromFile ( const QString &  filename,
ItemHandle root = 0 
)

get the items inside a file. Some tool must implement this function and connect to the getItemsFromFile signal. The Core library does not implement a read file function.

Parameters:
QString&file that is selected by user
ItemHandle*optional parent handle to all the items that will be loaded form file
Returns:
QList<ItemHandle*> list of items inside the file
void

Here is the caller graph for this function:

void Tinkercell::MainWindow::gridOff ( ) [slot]

change grid mode for current scene to off (=0)

void Tinkercell::MainWindow::gridOn ( ) [slot]

change grid mode for current scene to on (>0)

void Tinkercell::MainWindow::handleFamilyChanged ( NetworkHandle network,
const QList< ItemHandle * > &  ,
const QList< ItemFamily * > &   
) [signal]

signals whenever item handles' families are changed

Parameters:
NetworkHandle*network where the event took place
QList<ItemHandle*>&child items
QList<ItemFamily*>&old families
Returns:
void
void Tinkercell::MainWindow::handlesChanged ( NetworkHandle scene,
const QList< QGraphicsItem * > &  items,
const QList< ItemHandle * > &  old 
) [signal]

signals whenever the handles for graphics items have changed

Parameters:
GraphicsScene*scene where the event took place
QList<GraphicsItem*>&items that are affected
QList<ItemHandle*>&old handle for each items
Returns:
void
void Tinkercell::MainWindow::historyChanged ( int  i = 0) [signal]

one of more changed have occurred in the history window of the current scene

Parameters:
intnumber of changes (negative = undos, positive = redos)
Returns:
void
QUndoStack* Tinkercell::MainWindow::historyStack ( ) const

the history stack of the current network.

Returns:
QUndoStack* current scene's history stack or null if current network is null
QUndoView* Tinkercell::MainWindow::historyWidget ( )

the history stack widget of the current window.

Returns:
QUndoView* current scene's history stack or null if current network is null
void Tinkercell::MainWindow::initializeMenus ( bool  enableScene = true,
bool  enableText = true 
)

Initialize the basic menu (save, open, close, exit, etc.).

Returns:
void
static MainWindow* Tinkercell::MainWindow::instance ( ) [static, slot]

gets the global main window

Here is the caller graph for this function:

bool Tinkercell::MainWindow::isValidHandlePointer ( void *  p)

checks if the given address belongs to a handle

Here is the caller graph for this function:

void Tinkercell::MainWindow::itemsAboutToBeInserted ( GraphicsScene scene,
QList< QGraphicsItem * > &  ,
QList< ItemHandle * > &  ,
QList< QUndoCommand * > &  ,
GraphicsScene::InsertType  type = GraphicsScene::NEW 
) [signal]

signals whenever items are going to be added

Parameters:
GraphicsScene*scene where the items are added
QList<QGraphicsItem*>&list of new graphics items
QList<ItemHandle*>&list of new handles (does NOT have to be the same number as items)
QList<QUndoCommand*>&list of commands that will be executed right before items are inserted
InsertType(optional) indicated how the items were inserted, e.g. copy/pasted or loaded from a file
Returns:
void
void Tinkercell::MainWindow::itemsAboutToBeMoved ( GraphicsScene scene,
QList< QGraphicsItem * > &  item,
QList< QPointF > &  distance,
QList< QUndoCommand * > &   
) [signal]

signals whenever items are going to be moved (each item is the top-most item)

Parameters:
GraphicsScene*scene where the items were moved
QList<QGraphicsItem*>&list of pointers to all moving items
QPointFdistance by which items moved
Qt::KeyboardModifiersmodifier keys being used when mouse clicked
QList<QUndoCommand*>&list of commands that will be executed right before items are inserted
Returns:
void
void Tinkercell::MainWindow::itemsAboutToBeRemoved ( GraphicsScene scene,
QList< QGraphicsItem * > &  item,
QList< ItemHandle * > &  handles,
QList< QUndoCommand * > &   
) [signal]

signals just before items are deleted

Parameters:
GraphicsScene*scene where the items are going to be removed
QList<QGraphicsItem*>&list of items going to be removed
QList<ItemHandle*>&list of handles going to be removed (does NOT have to be the same number as items removed)
QList<QUndoCommand*>&list of commands that will be executed right before items are inserted
Returns:
void
void Tinkercell::MainWindow::itemsDropped ( GraphicsScene ,
const QString &  ,
QPointF   
) [signal]

signal is emitted when some object OTHER than files are dropped on the canvas

Parameters:
GraphicsScene*the scene where objects were dropped
QStringthe string describing the object that was dropped
QPointFthe Scene position where it was dropped
Returns:
void
void Tinkercell::MainWindow::itemsInserted ( GraphicsScene scene,
const QList< QGraphicsItem * > &  item,
const QList< ItemHandle * > &  handles,
GraphicsScene::InsertType  type = GraphicsScene::NEW 
) [signal]

signals whenever items are added

Parameters:
GraphicsScene* scene where the items were added
QList<QGraphicsItem*>&list of new items
QList<ItemHandle*>&list of new handles (does NOT have to be the same number as items)
InsertType(optional) indicated how the items were inserted, e.g. copy/pasted or loaded from a file
Returns:
void
void Tinkercell::MainWindow::itemsInserted ( NetworkHandle win,
const QList< ItemHandle * > &   
) [signal]

A convenient signal that is emitted when items are inserted from a GraphicsScene or TextEditor. Warning: listening to the other itemsInserted signals may cause redundancy.

Parameters:
NetworkHandle*where the editting happened
QList<TextItem*>new items
void Tinkercell::MainWindow::itemsInsertedSlot ( GraphicsScene scene,
const QList< QGraphicsItem * > &  item,
const QList< ItemHandle * > &  handles,
GraphicsScene::InsertType   
) [protected, slot]

signals whenever items are added

Parameters:
GraphicsScene* scene where the items were added
QList<QGraphicsItem*>&list of new items
QList<ItemHandle*>&list of new handles (does NOT have to be the same number as items)
Returns:
void
void Tinkercell::MainWindow::itemsMoved ( GraphicsScene scene,
const QList< QGraphicsItem * > &  item,
const QList< QPointF > &  distance 
) [signal]

signals whenever items are being moved (each item is the top-most item)

Parameters:
GraphicsScene* scene where the items were moved
QList<QGraphicsItem*>&list of pointes to all moving items
QPointFdistance by which items moved
Qt::KeyboardModifiersmodifier keys being used when mouse clicked
Returns:
void
void Tinkercell::MainWindow::itemsRemoved ( GraphicsScene scene,
const QList< QGraphicsItem * > &  item,
const QList< ItemHandle * > &  handles 
) [signal]

signals whenever items are deleted

Parameters:
GraphicsScene* scene where the items were removed
QList<QGraphicsItem*>&list of items removed
QList<ItemHandle*>&list of handles removed (does NOT have to be the same number as items removed)
Returns:
void
void Tinkercell::MainWindow::itemsRemoved ( NetworkHandle win,
const QList< ItemHandle * > &   
) [signal]

A convenient signal that is emitted when items are removed from a GraphicsScene or TextEditor. Warning: listening to the other itemsRemoved signals may cause redundancy.

Parameters:
NetworkHandle*where the editting happened
ItemHandle*removed items
void Tinkercell::MainWindow::itemsRemovedSlot ( GraphicsScene scene,
const QList< QGraphicsItem * > &  item,
const QList< ItemHandle * > &  handles 
) [protected, slot]

signals whenever items are deleted

Parameters:
GraphicsScene* scene where the items were removed
QList<QGraphicsItem*>&list of items removed
QList<ItemHandle*>&list of handles removed (does NOT have to be the same number as items removed)
Returns:
void
void Tinkercell::MainWindow::itemsRenamed ( NetworkHandle window,
const QList< ItemHandle * > &  items,
const QList< QString > &  oldnames,
const QList< QString > &  newnames 
) [signal]

signals whenever an item is renamed

Parameters:
NetworkHandle* window where the event took place
QList<ItemHandle*>&items
QList<QString>&old names
QList<QString>&new names
Returns:
void
void Tinkercell::MainWindow::itemsSelected ( GraphicsScene scene,
const QList< QGraphicsItem * > &  items,
QPointF  point,
Qt::KeyboardModifiers  modifiers 
) [signal]

signals whenever a new item is selected (item can be sub-item, not top-level)

Parameters:
GraphicsScene* scene where items are selected
QList<QGraphicsItem*>&list of all selected item pointers
QPointFpoint where mouse is clicked
Qt::KeyboardModifiersmodifier keys being used when mouse clicked
Returns:
void
void Tinkercell::MainWindow::keyPressed ( GraphicsScene scene,
QKeyEvent *   
) [signal]

signals whenever a key is pressed

Parameters:
GraphicsScene* scene where the event took place
QKeyEvent* key that is pressed
Returns:
void
void Tinkercell::MainWindow::keyReleased ( GraphicsScene scene,
QKeyEvent *   
) [signal]

signals whenever a key is released

Parameters:
GraphicsScene* scene where the event took place
QKeyEvent* key that is released
Returns:
void
void Tinkercell::MainWindow::lineChanged ( TextEditor ,
int  ,
const QString &   
) [signal]

the cursor has moved to a different line

Parameters:
TextEditor*editor
intindex of the current line
QStringcurrent line text
void Tinkercell::MainWindow::loadDefaultPlugins ( ) [protected]

load default plugins

Returns:
void
void Tinkercell::MainWindow::loadDynamicLibrary ( const QString &  )

Load a new plugin (dll)

Parameters:
thecomplete path of the dll file
Returns:
void
void Tinkercell::MainWindow::loadFiles ( const QList< QFileInfo > &  files) [protected, slot]

loads files (library files or Network files)

Parameters:
QList<QFileInfo>&the name(s) of the file(s)
Returns:
void

Here is the caller graph for this function:

void Tinkercell::MainWindow::loadNetwork ( const QString &  filename,
bool *  alreadyLoaded = 0 
) [signal]

signals when user selects a file to open in the current network

Parameters:
QString&file that is selected by user
bool*file already loaded by another plugin
Returns:
void
void Tinkercell::MainWindow::mouseDoubleClicked ( GraphicsScene scene,
QPointF  point,
QGraphicsItem *  ,
Qt::MouseButton  ,
Qt::KeyboardModifiers  modifiers 
) [signal]

emits event when mouse is double clicked

Parameters:
GraphicsScene* scene where the event took place
pointwhere mouse is clicked
modifierkeys being used when mouse clicked
Returns:
void
void Tinkercell::MainWindow::mouseDragged ( GraphicsScene scene,
QPointF  from,
QPointF  to,
Qt::MouseButton  ,
Qt::KeyboardModifiers  modifiers 
) [signal]

signals whenever mouse is dragged from one point to another

Parameters:
GraphicsScene* scene where the event took place
QPointFpoint where mouse is clicked first
QPointFpoint where mouse is released
Qt::MouseButtonbutton being pressed
Qt::KeyboardModifiersmodifier keys being used when mouse clicked
Returns:
void
void Tinkercell::MainWindow::mouseMoved ( GraphicsScene scene,
QGraphicsItem *  item,
QPointF  point,
Qt::MouseButton  ,
Qt::KeyboardModifiers  modifiers,
QList< QGraphicsItem * > &   
) [signal]

signals whenever mouse moves, and indicates whether it is on top of an item

Parameters:
GraphicsScene* scene where the event took place
QGraphicsItem*pointer to item that mouse is on top of
QPointFpoint where mouse is clicked
Qt::MouseButtonbutton being pressed
Qt::KeyboardModifiersmodifier keys being used when mouse clicked
QList<QGraphicsItem*>&list of items that are being moved with the mouse
Returns:
void
void Tinkercell::MainWindow::mouseOnTopOf ( GraphicsScene scene,
QGraphicsItem *  item,
QPointF  point,
Qt::KeyboardModifiers  modifiers,
QList< QGraphicsItem * > &   
) [signal]

signals whenever mouse is on top of an item

Parameters:
GraphicsScene* scene where the event took place
QGraphicsItem*pointer to item that mouse is on top of
QPointFpoint where mouse is clicked
Qt::KeyboardModifiersmodifier keys being used when mouse clicked
QList<QGraphicsItem*>&list of items that are being moved with the mouse
Returns:
void
void Tinkercell::MainWindow::mousePressed ( GraphicsScene scene,
QPointF  point,
Qt::MouseButton  ,
Qt::KeyboardModifiers  modifiers 
) [signal]

signals whenever an empty node of the screen is clicked

Parameters:
GraphicsScene* scene where the event took place
QPointFpoint where mouse is clicked
Qt::MouseButtonwhich button was pressed
Qt::KeyboardModifiersmodifier keys being used when mouse clicked
Returns:
void
void Tinkercell::MainWindow::mouseReleased ( GraphicsScene scene,
QPointF  point,
Qt::MouseButton  ,
Qt::KeyboardModifiers  modifiers 
) [signal]

signals whenever an empty node of the screen is clicked

Parameters:
GraphicsScene* scene where the event took place
QPointFpoint where mouse is clicked
Qt::MouseButtonwhich button was pressed
Qt::KeyboardModifiersmodifier keys being used when mouse clicked
Returns:
void
void Tinkercell::MainWindow::networkClosed ( NetworkHandle ) [signal]

signals after a window is closed

Parameters:
NetworkHandle* the window that was closed
Returns:
void
void Tinkercell::MainWindow::networkClosing ( NetworkHandle ,
bool *   
) [signal]

signals when a network is going to close

Parameters:
NetworkHandle* the network that is closing
Booleansetting to false will prevent this window from closing
Returns:
void
void Tinkercell::MainWindow::networkLoaded ( NetworkHandle ) [signal]

signals informs that the current network has just loaded a new Network

Parameters:
NetworkHandle* the window where network was loaded (usually current scene)
Returns:
void
void Tinkercell::MainWindow::networkOpened ( NetworkHandle ) [signal]

signals whenever the new network is opened

Parameters:
NetworkHandle*the current new window
Returns:
void
QList<NetworkHandle*> Tinkercell::MainWindow::networks ( ) const

gets all the windows in the main window

Returns:
QList<NetworkHandle*> list of windows
void Tinkercell::MainWindow::networkSaved ( NetworkHandle ) [signal]

signals when a tool has saved the network in a file

Parameters:
NetworkHandle* the window where network was loaded (usually current scene)
Returns:
void
GraphicsScene* Tinkercell::MainWindow::newScene ( ) [slot]

create new scene

TextEditor* Tinkercell::MainWindow::newTextEditor ( ) [slot]

create new text editor

void Tinkercell::MainWindow::open ( ) [slot]

triggered when the open button is clicked. Opens a file dialog. Note: the core library just emits a signal, and other tools are responsible for actually opening a file

Here is the caller graph for this function:

void Tinkercell::MainWindow::open ( const QString &  ) [slot]

open a file. Note: the core library just emits a signal, and other tools are responsible for actually opening a file The main window does not implement an function for opening a new file

void Tinkercell::MainWindow::parentHandleChanged ( NetworkHandle scene,
const QList< ItemHandle * > &  ,
const QList< ItemHandle * > &   
) [signal]

signals whenever item parent handle is changed

Parameters:
NetworkHandle* window where the event took place
QList<ItemHandle*>&child items
QList<ItemHandle*>&old parents
Returns:
void
void Tinkercell::MainWindow::parentItemChanged ( GraphicsScene scene,
const QList< QGraphicsItem * > &  items,
const QList< QGraphicsItem * > &  parents 
) [signal]

signals whenever item parents are changed

Parameters:
GraphicsScene* scene where the event took place
QList<QGraphicsItem*>&items
QList<QGraphicsItem*>&new parents
Returns:
void
void Tinkercell::MainWindow::parse ( TextEditor ) [signal]

request to parse the text in the current text editor

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

calls current scene or text editor's paste

void Tinkercell::MainWindow::popIn ( NetworkWindow ) [protected, slot]

pop-in the given window

Here is the caller graph for this function:

void Tinkercell::MainWindow::popOut ( ) [slot]

pop-out the current window

Here is the caller graph for this function:

void Tinkercell::MainWindow::popOut ( NetworkWindow ) [protected, slot]

pop-out the given window

void Tinkercell::MainWindow::prepareNetworkForSaving ( NetworkHandle ,
bool *   
) [signal]

signals when a tool is about to save a network

Parameters:
NetworkHandle* the window where Network was loaded (usually current scene)
Returns:
void
void Tinkercell::MainWindow::print ( ) [slot]

triggered when the print button is clicked. Calls current scene's print

void Tinkercell::MainWindow::printToFile ( const QString &  filename = QString(),
int  w = 0,
int  h = 0 
) [slot]

triggered when the print-to-file button is clicked. Calls current scene's print on a pdf file

void Tinkercell::MainWindow::readSettings ( ) [slot]

read initial settings from settingsFileName

Returns:
void
void Tinkercell::MainWindow::redo ( ) [slot]

calls current scene or text editor's redo

void Tinkercell::MainWindow::remove ( ) [slot]

calls current scene or text editor's find

void Tinkercell::MainWindow::saveNetwork ( const QString &  filename) [signal]

signals when user selects a file to save the current network to

Parameters:
QString&file that is selected by user
Returns:
void
void Tinkercell::MainWindow::saveSettings ( ) [protected]

save initial settings to settingsFileName

Returns:
void
void Tinkercell::MainWindow::saveWindow ( ) [slot]

triggered when the save button is clicked. Opens a file dialog and emits the save signal. The main window itself does not implement the save.

void Tinkercell::MainWindow::saveWindowAs ( ) [slot]

triggered when the save-as button is clicked. Opens a file dialog and emits the save signal. The main window itself does not implement the save.

void Tinkercell::MainWindow::sceneRightClick ( GraphicsScene scene,
QGraphicsItem *  item,
QPointF  point,
Qt::KeyboardModifiers  modifiers 
) [signal]

signals whenever right click is made on an item or sceen

Parameters:
GraphicsScene* scene where the event took place
QGraphicsItem*pointer to item that mouse is clicked on
QPointFpoint where mouse is clicked
Qt::KeyboardModifiersmodifier keys being used when mouse clicked
Returns:
void
void Tinkercell::MainWindow::selectAll ( ) [slot]

calls current scene or text editor's selectAll

void Tinkercell::MainWindow::sendEscapeSignal ( const QWidget *  w = 0) [slot]

sends a signal to all plugins telling them to exit their current processes.

void Tinkercell::MainWindow::setCurrentWindow ( NetworkWindow ) [protected, slot]

sets the active window

Here is the caller graph for this function:

void Tinkercell::MainWindow::setCursor ( QCursor  cursor)

set the cursor for all windows

Parameters:
QCursorcursor
Returns:
void
void Tinkercell::MainWindow::setGridSize ( ) [slot]

set grid size for current scene

void Tinkercell::MainWindow::setupFunctionPointers ( QLibrary *  ) [signal]

signals when a new FuntionToSignal is constructed

Parameters:
QLibrary* the new FuntionToSignal instance
Returns:
void
void Tinkercell::MainWindow::setupFunctionPointersSlot ( QSemaphore *  ,
QLibrary *   
) [protected, slot]

send signal to other tools so that they can connect functions to signals

Parameters:
QSemaphore*semaphore
QLibrary* the dynamic library instance
Returns:
void
void Tinkercell::MainWindow::setupNewThread ( QSemaphore *  ,
QLibrary *   
)

This function is usually called from a new thread. This function allows all the plugins to add their functionalities to the C function pointer of the new thread.

Parameters:
QSemaphore*used to wait for all the plugins to initialize the thread
QLibrary*the library to load
Returns:
void

Here is the caller graph for this function:

void Tinkercell::MainWindow::setUserHome ( ) [slot]

asks user for a new directory to be used as the user home directory (must be writtable)

virtual void Tinkercell::MainWindow::tabIndexChanged ( int  ) [protected, virtual, slot]

tab changed

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

some text inside this editor has been changed

Parameters:
TextEditor*editor
QStringold text (usually a line)
QStringnew text (usually a line)
virtual Tool* Tinkercell::MainWindow::tool ( const QString &  ) const [virtual]

get a tool

Parameters:
QStringname of the tool
Returns:
Tool*

Here is the caller graph for this function:

void Tinkercell::MainWindow::toolAboutToBeLoaded ( Tool tool,
bool *  shouldLoad 
) [signal]

a new tool is about to be added. This signal can be used to prevent the tool from being added

Parameters:
Toolthe tool itself
bool&set this bool to false to prevent the tool from loading
Returns:
void
void Tinkercell::MainWindow::toolLoaded ( Tool tool) [signal]

signals when a new tool (plugin) is loaded

Parameters:
Tool*the new tool
Returns:
void
virtual QList<Tool*> Tinkercell::MainWindow::tools ( const QString &  category = QString()) const [virtual]

get all tools

Parameters:
QString(optional) return only tools in this category, e.g. "plot"
Returns:
QList<Tool*>
void Tinkercell::MainWindow::undo ( ) [slot]

calls current scene or text editor's undo

void Tinkercell::MainWindow::windowChanged ( NetworkWindow ,
NetworkWindow  
) [signal]

signals whenever the current window changes

Parameters:
NetworkWindow*the previous windpw
NetworkWindow*the current new window
Returns:
void

Friends And Related Function Documentation

friend class DroppableTabWidget [friend]

Definition at line 100 of file MainWindow.h.

friend class GlobalSettings [friend]

Definition at line 853 of file MainWindow.h.

friend class GraphicsScene [friend]

Definition at line 97 of file MainWindow.h.

friend class GraphicsView [friend]

Definition at line 99 of file MainWindow.h.

friend class NetworkHandle [friend]

Definition at line 96 of file MainWindow.h.

friend class NetworkWindow [friend]

Definition at line 95 of file MainWindow.h.

friend class TextEditor [friend]

Definition at line 98 of file MainWindow.h.


Member Data Documentation

the list of all network windows

Definition at line 815 of file MainWindow.h.

allowed views

Definition at line 796 of file MainWindow.h.

the general window for command, errors, and messages

Definition at line 800 of file MainWindow.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 263 of file MainWindow.h.

the context menu that is shown during right-click event on selected graphical items. Plugins can add new actions to this menu.

Definition at line 248 of file MainWindow.h.

the context menu that is shown during right-click event on the scene. Plugins can add new actions to this menu.

Definition at line 253 of file MainWindow.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 258 of file MainWindow.h.

keep pointer to last selected window. Used by windowChanged signal

Definition at line 821 of file MainWindow.h.

the default option to use for console window

Definition at line 115 of file MainWindow.h.

the default option to use for history window

Definition at line 112 of file MainWindow.h.

the default option to use for tools (optional)

Definition at line 109 of file MainWindow.h.

QHash<QString,QLibrary*> Tinkercell::MainWindow::dynamicallyLoadedLibraries [protected]

the loaded dynamic libraries indexed by file name

Definition at line 798 of file MainWindow.h.

The edit menu. Plugins can add new actions to this menu.

Definition at line 271 of file MainWindow.h.

The file menu. Plugins can add new actions to this menu.

Definition at line 267 of file MainWindow.h.

The help menu.

Definition at line 279 of file MainWindow.h.

history view, not the stack itself. The stack is stored within each NetworkHandle

Definition at line 819 of file MainWindow.h.

QHash<void*,bool> Tinkercell::MainWindow::invalidPointers [static]

stores list of all pointers that have been deleted (to prevent double-deletions)

Definition at line 848 of file MainWindow.h.

the menu for choosing one of the available parsers (will be 0 if there are no parsers)

Definition at line 287 of file MainWindow.h.

stores the last opened directory

Definition at line 845 of file MainWindow.h.

the menu for settings such as default plugins, Tinkercell home directory, etc.

Definition at line 283 of file MainWindow.h.

the central multi-document interface widget

Definition at line 813 of file MainWindow.h.

The tool bar that contains new, open, close, etc. actions.

Definition at line 291 of file MainWindow.h.

The tool bar that contains copy, paste, undo, etc.

Definition at line 295 of file MainWindow.h.

One of the initial tool bars which designated for tools that do not want to create a new toolbar.

Definition at line 300 of file MainWindow.h.

QHash<QString,Tool*> Tinkercell::MainWindow::toolsHash [protected]

all the tools (plug-ins) are stored here, indexed by their names

Definition at line 823 of file MainWindow.h.

this is a multiple hash. All the tool are stored here indexed by their category names (if they have a category)

Definition at line 825 of file MainWindow.h.

QToolBox* Tinkercell::MainWindow::toolsWidget [protected]

the optional tool box that will only appear if one of the plug-ins uses the tab widget argument in the addToolWindow call

Definition at line 817 of file MainWindow.h.

the set of all windows inseted in the main window using addToolWindow

Definition at line 243 of file MainWindow.h.

The view menu. New docking windows are automatically added here.

Definition at line 275 of file MainWindow.h.


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