Loading...
Searching...
No Matches
BALL::VIEW::MainControl Class Reference
Visualisation » Kernel » Widget connectivity and message queuing

`#include <BALL/VIEW/KERNEL/mainControl.h>`

Inheritance diagram for BALL::VIEW::MainControl:

## Public Types

Enumerations
enum | PopUpID { FILE = 10001 , FILE_OPEN , FILE_OPEN_GRID , FILE_IMPORT , FILE_EXPORT , FILE_MONITOR , EDIT = 10100 , BUILD = 10200 , DISPLAY = 10300 , DISPLAY_CREATE , DISPLAY_VIEWPOINT , DISPLAY_STEREO , DISPLAY_ANIMATION , MOLECULARMECHANICS = 10400 , CHOOSE_FF , TOOLS = 10500 , TOOLS_GRID , TOOLS_PYTHON , WINDOWS = 10600 , USER = 10700 , MACRO = 10750 , HELP = 10800 }
Public Types inherited from BALL::Embeddable
typedef std::vector< Embeddable * > | EmbeddableVector

## Public Member Functions

Constructors and Destructor
| MainControl (QWidget *parent=0, const char *name=0, String inifile=".BALL.preferences")
virtual | ~MainControl ()
| MainControl (const MainControl &main_control)
virtual void | clear ()
void | clearData ()
Methods to manage Representation(s)
RepresentationManager & | getRepresentationManager ()
bool | insert (Representation &rep)
bool | remove (Representation &rep)
bool | update (Representation &rep)
bool | updateRepresentationsOf (const Composite &composite, bool rebuild=true, bool force=false)
void | redrawAllRepresentations (bool rebuild_display_lists=false)
Methods to manage Shortcuts
ShortcutRegistry & | getShortcutRegistry ()
Methods to manage Composite(s)
CompositeManager & | getCompositeManager ()
bool | insert (Composite &composite, String name="", bool normalize=true)
bool | remove (Composite &composite, bool to_delete=true, bool update=true)
void | update (Composite &composite, bool changed_hierarchy=true)
const HashSet< Composite * > & | getSelection () const
| Get the HashSet with the selected (e.g. picked) Composite objects (const).
HashSet< Composite * > & | getSelection ()
| Get the HashSet with the selected (e.g. picked) Composite objects.
std::list< Composite * > & | getMolecularControlSelection ()
| Get the selection (highlighted items) of the MolecularControl (not the selection with checkboxes).
System * | getSelectedSystem ()
| If exactly one System is selected in the Control, return a pointer to this system, otherwise 0.
void | selectCompositeRecursive (Composite *composite, bool first_call=false)
| Select a Composite recursive and add all Atom and AtomContainer objects to the selection.
void | deselectCompositeRecursive (Composite *composite, bool first_call=false)
| Select a Composite recursive and add all Atom and AtomContainer objects to the selection.
void | printSelectionInfos ()
Preferences and Configuration files
void | saveBALLViewProjectFile (const String &filename, bool binary=true)
| Save the current configuration, structures and representations to a BALLView project file (*.bvp).
void | loadBALLViewProjectFile (const String &filename)
| Load a BALLView project file.
virtual void | fetchPreferences (INIFile &inifile)
virtual void | writePreferences (INIFile &inifile)
virtual void | restoreWindows ()
| Restore the positions the main window and of all DockWindow's from the INIFile assigned to this instance.
virtual void | restoreWindows (const INIFile &inifile)
| Restore the positions the main window and of all DockWindow's from a given inifile.
INIFile & | getINIFile ()
const INIFile & | getINIFile () const
Preferences * | getPreferences ()
virtual void | applyPreferences ()
Menu entries handling
QAction * | insertMenuEntry (Position parent_id, const String &name, const QObject *receiver=0, const char *slot=0, const String &description="", QKeySequence accel=QKeySequence(), UIOperationMode::OperationMode minimal_mode=UIOperationMode::MODE_ALL)
QAction * | insertMenuEntry (Position parent_id, const QString &name, const QObject *receiver=0, const char *slot=0, const QString &description="", QKeySequence accel=QKeySequence(), UIOperationMode::OperationMode minimal_mode=UIOperationMode::MODE_ALL)
virtual QMenu * | addMenu (const QString &title, UIOperationMode::OperationMode mode=UIOperationMode::MODE_ALL)
void | removeMenuEntry (Index parent_id, QAction *action)
virtual QMenu * | initPopupMenu (int ID, UIOperationMode::OperationMode mode=UIOperationMode::MODE_ALL)
void | insertPopupMenuSeparator (int ID, UIOperationMode::OperationMode mode=UIOperationMode::MODE_ALL)
void | setMenuHint (QAction *id, const String &hint)
| Set a hint for a menu entry.
String | getMenuHint (QAction *id) const
| Get the hint for a menu entry.
void | setDeleteEntryEnabled (bool state)
void | insertDeleteEntry ()
QAction * | getLastHighLightedMenuEntry ()
| Get the ID of the last highlighted menu entry.
Methods for multithreading
bool | compositesAreLocked () const
bool | lockCompositesFor (ModularWidget *widget)
bool | unlockCompositesFor (ModularWidget *widget)
| Lock the Composites for a given Modular Widget.
ModularWidget * | getLockingWidget ()
| Get the ModularWidget with excluse access to the Composites.
bool | updateOfRepresentationRunning ()
| Return true if Representations are (re)calculated.
bool | stopedSimulation ()
| Returns true, if the simulation was told to stop, but hasnt done this so far.
bool | setSimulationThread (SimulationThread *thread)
SimulationThread * | getSimulationThread ()
bool | useMultithreading ()
void | setMultithreading (bool state)
| See above.
bool | isBusy () const
void | wait ()
| Wait until the MainControl is not busy anymore.
void | processEvents (Size ms)
| Added overloaded method from QApplication for access in Python.
Accessors and Settings
void | setStatusbarText (const String &text, bool important=false, bool beep=false)
void | setStatusbarText (const QString &text, bool important=false, bool beep=false)
String | getStatusbarText () const
const FragmentDB & | getFragmentDB () const
| Get a const reference for the fragment database.
const ModelInformation & | getModelInformation () const
void | setModelInformation (ModelInformation *mi)
String | getWorkingDir () const
void | setWorkingDir (const String &dir)
| Set the working directory for the next file dialog and file operation to the given directory.
void | enableLoggingToFile ()
void | disableLoggingToFile ()
void | setLoggingFilename (const String &string)
const String & | getLoggingFilename () const
| See above.
bool | isAboutToQuit ()
Debugging and Diagnostics
virtual void | dump (std::ostream &s=std::cout, Size depth=0) const
virtual void | openFile (const String &file)
virtual QMenu * | createPopupMenu ()
Public Member Functions inherited from BALL::VIEW::ConnectionObject
| ConnectionObject ()
virtual | ~ConnectionObject ()
virtual void | destroy ()
void | registerConnectionObject (ConnectionObject &object)
void | unregisterConnectionObject (ConnectionObject &object)
bool | isConnectionObjectRegistered (const ConnectionObject &object)
ConnectionObject * | getParent () const
ConnectionObject * | getRoot ()
virtual bool | isValid () const
Public Member Functions inherited from BALL::Embeddable
| Embeddable (const String &identifier="<Embeddable>")
| Embeddable (const Embeddable &embeddable)
virtual | ~Embeddable ()
void | setIdentifier (const String &identifier)
const String & | getIdentifier () const
void | unregisterThis ()
virtual void | registerThis ()

## Friends

class | RepresentationManager
class | SimulationThread

## Public slots

bool | about_to_quit_
bool | multi_threading_mode_
FragmentDB | fragment_db_
ModelInformation * | model_information_
HashSet< Composite * > | selection_
std::list< Composite * > | control_selection_
QLabel * | message_label_
RepresentationManager | primitive_manager_
CompositeManager | composite_manager_
ShortcutRegistry | shortcut_registry_
MainControlPreferences * | main_control_preferences_
OpenSavePreferences * | open_save_preferences_
NetworkPreferences * | network_preferences_
Preferences * | preferences_dialog_
INIFile | preferences_file_
bool | composites_locked_
ModularWidget * | locking_widget_
bool | stop_simulation_
SimulationThread * | simulation_thread_
std::list< ModularWidget * > | modular_widgets_
QLabel * | simulation_icon_
QLabel * | rep_label_
Position | rep_label_nr_
String | working_dir_
String | logging_file_name_
bool | logging_to_file_
File | logging_file_
bool | important_text_in_statusbar_
bool | was_not_busy_
Index | rep_label_delta_
QTimer | timer_
QTimer | render_timer_
Mutex | composites_locked_mutex_
QAction * | stop_simulation_action_
QAction * | fullscreen_action_
QAction * | complement_selection_action_
QAction * | clear_selection_action_
QAction * | open_action_
QAction * | preferences_action_
QAction * | delete_action_
QAction * | last_highlighted_menu_entry_
HashMap< Position, QMenu * > | id_to_menu_
QPoint | last_point_
QSize | last_size_
QByteArray | last_state_
static const char * | simulation_running_xpm_ []
static const char * | simulation_stoped_xpm_ []
virtual void | show ()
virtual void | checkMenus ()
void | stopSimulation ()
| Stop a currently running calculation.
void | complementSelection ()
void | clearSelection ()
virtual void | aboutToExit ()
void | menuItemHighlighted (QAction *action)
virtual bool | event (QEvent *e)
| Interface to QT events, e.g. to communicate with other threads.
virtual void | quit (int return_value=0)
| Make the program exit.
virtual void | resize (int w, int h)
| overloaded from QT for Python Interface
void | setContentSize (int w, int h)
void | toggleFullScreen ()
void | quickSave ()
| Create a BALLView project file with the name quick.bvp in the users home dir.
void | quickLoad ()
| Quickload quick.bvp in the users home die (see above).
void | saveBALLViewProjectFile ()
void | loadBALLViewProjectFile ()
void | quickLoadConfirm ()
virtual void | applyPreferencesClicked_ ()
virtual void | okPreferencesClicked_ ()
void | clearStatusBarText_ ()
virtual void | deleteClicked ()
void | updateRepLabel_ ()
virtual void | initializePreferencesTab_ ()
void | stopedSimulation_ ()
void | lockComposites_ ()
bool | remove_ (Composite &composite, bool update_representations_of_parent=true, bool to_delete=true)
void | selectComposites_ (GeometricObjectSelectionMessage &message)
void | reduceSelection_ (Composite *const composite)
void | setup_ ()
void | complementSelectionHelper_ (Composite &c)
void | setBusyMode_ (bool state)
void | setPreferencesEnabled_ (bool state)
void | init_ ()
virtual void | closeEvent (QCloseEvent *evt)

## Management of ModularWidget(s) and Message(s)

void | addModularWidget (ModularWidget *widget)
void | removeModularWidget (ModularWidget *widget)
virtual void | onNotify (Message *message)
void | sendMessage (Message &message)
static MainControl * | getMainControl (const QObject *object)

## Additional Inherited Members

void | notify_ (Message *message)
void | notify_ (Message &message)
void | onNotify_ (Message *message)
static void | registerInstance_ (const std::type_info &type, const Embeddable *instance)
static void | unregisterInstance_ (const Embeddable *instance)
static Size | countInstances_ (const std::type_info &type)
static Embeddable * | getInstance_ (const std::type_info &type, Position index)
static Embeddable * | getInstance_ (const std::type_info &type, const String &identifier)

## Detailed Description

MainControl is the main administration unit for a program and must be used by all applications. MainControl is also derived from Qt::QMainWindow and therefore the main widget of an application must be derived from this class. Further it has the necessary interface methods to create and update the menus of the main application.
MainControl is also a storage facility for Composite objects, the graphical Representation and the inserted ModularWidget. The interface for the Composite administration is implemented in CompositeManager, and for the Representation 's in RepresentationManager. Specialized methods exists for the adding, updateing and removing of Composites as well as Representations. (see the update, insert and remove methods)
This class is also the root ConnectionObject and thus it is responsible for the handling of all messages. To add ModularWidgets all that is necessary are the creation of the derived modular widgets with the MainControl as their parents like e.g.
new DisplayProperties(this, "DisplayProperties");
For examples have a look at BALL/source/APPLICATIONS/mainframe.C
MainControl also handles the Preferences dialog (and it's tab entry for some general preferences) and notifies all registered ModularWidgets if the preferences have changed. The content of the Preferences dialog with all setup options is stored in an INIFile. The default name of this file is ".BALLView".

See also
  writePreferences
  fetchPreferences
  saveBALLViewProjectFile
  loadBALLViewProjectFile
  Caveat: Due to a peculiarity of the QT Meta Object Compiler (MOC) you have to specify the full namespace qualified name of this class when deriving from it.

  So don't use
  class foo : public MainControl ; but
  class foo : public BALL::VIEW::MainControl instead.

Definition at line 114 of file mainControl.h.

## Member Enumeration Documentation

## PopUpID

enum BALL::VIEW::MainControl::PopUpID

Standard Popup menu IDs. This enum defines symbolic names for the menu IDs of the most common popup menus. The popups are created, if a menu entry is requested for any of the popups.

See also
  insertMenuEntry

Enumerator
FILE | File menu.
FILE_OPEN | File menu sub menu open.
FILE_OPEN_GRID | File menu sub menu open grid.
FILE_IMPORT | File menu sub menu import [currently unused].
FILE_EXPORT | File menu sub menu export.
FILE_MONITOR |
EDIT | Edit menu.
BUILD | Build menu.
DISPLAY | Display menu.
DISPLAY_CREATE | Display Create submenu.
DISPLAY_VIEWPOINT | Display Viewpoint submenu.
DISPLAY_STEREO | Display Stereo submenu.
DISPLAY_ANIMATION | Display Animation submenu.
MOLECULARMECHANICS | Simulations menu.
CHOOSE_FF | Molmec submenu for force field selection.
TOOLS | Tools menu.
TOOLS_GRID | Grid submenu in Tools.
TOOLS_PYTHON | Python submenu in Tools.
WINDOWS | Windows menu.
USER | Userdefined menus.
MACRO | Macros e.g. for Testing.

HELP

Help menu

Deprecated
  Help system has been removed. This enumerator will also be removed in the next release.

Definition at line 136 of file mainControl.h.

## Constructor & Destructor Documentation

## MainControl() [1/2]

BALL::VIEW::MainControl::MainControl | ( | QWidget * | parent = 0,
|  | const char * | name = 0,
|  | String | inifile = ".BALL.preferences" )

Default Constructor. Reads the the INIFile inifile and connects the qt signal aboutToQuit with the slot aboutToExit(). The state of the MainControl is:

- no Composite objects stored
- no Representation objects stored
- no general Preferences dialog added
- no MainControlPreferences dialog added
  Parameters

    parent | the new parent widget
    name | the new name of the widget
    inifile | the new preferences filename

  See also
    INIFile
    Preferences

## ~MainControl()

virtual BALL::VIEW::MainControl::~MainControl | ( |  | ) |

virtual

Destructor. Calls clear

## MainControl() [2/2]

BALL::VIEW::MainControl::MainControl | ( | const MainControl & | main_control | ) |

## Member Function Documentation

## aboutToExit

virtual void BALL::VIEW::MainControl::aboutToExit | ( |  | ) |

virtual slot

Last second cleanup. This method will be called internally if the MainControl is about to be destroyed. This method stores the preferences and finalizes all ModularWidget objects and the MainControl. Must be called after your own cleanup routine if you override this method.

  Calls ModularWidget::finalizePreferencesTab

  Calls ModularWidget::finalizeWidget

  Calls writePreferences

  Calls finalizePreferencesTab

  Calls removeModularWidget

  Calls INIFile::write

## addMenu()

virtual QMenu * BALL::VIEW::MainControl::addMenu | ( | const QString & | title,
|  | UIOperationMode::OperationMode | mode = UIOperationMode::MODE_ALL )

virtual

## addModularWidget()

void BALL::VIEW::MainControl::addModularWidget | ( | ModularWidget * | widget | ) |

Add a new ModularWidget to this MainControl. This method will be called internally by the ModularWidget registration process. So, if you dont know exactly what this method does, you will not need it!

Parameters

  widget | the ModularWidget to be inserted into this mainControl

## applyPreferences()

virtual void BALL::VIEW::MainControl::applyPreferences | ( |  | ) |

virtual

Apply all preferences. This method is called automatically by applyPreferencesClicked() and calls applyPreferences() for all registered ModularWidgets. Note: If this method is overridden, call this method at the end of the overriden method to make sure that the general preferences are applied.

See also
  ModularWidget
  Preferences

## applyPreferencesClicked_

virtual void BALL::VIEW::MainControl::applyPreferencesClicked_ | ( |  | ) |

protected virtual slot

## checkMenus

virtual void BALL::VIEW::MainControl::checkMenus | ( |  | ) |

virtual slot

Menu checking method. This method checks, enables or disables all inserted menu entries of the registered ModularWidget objects. If this method is overridden make sure that it will be called at the end of the new checkMenus() method. See ModularWidget for further information concerning menu structure creation.

  Note: This method will be called internally whenever the menu structure needs an update. Calls ModularWidget::checkMenu

See also
  ModularWidget::checkMenu

## clear()

virtual void BALL::VIEW::MainControl::clear | ( |  | ) |

virtual

Clear all data fast, to be called at exit only!

Reimplemented from BALL::VIEW::ConnectionObject.

## clearData()

void BALL::VIEW::MainControl::clearData | ( |  | ) |

Clear all data, can be called at any time

## clearSelection

void BALL::VIEW::MainControl::clearSelection | ( |  | ) |

slot

Clear Selection Deselect all Composites and clear the selection list in the MainControl

## clearStatusBarText_

void BALL::VIEW::MainControl::clearStatusBarText_ | ( |  | ) |

protected slot

## closeEvent()

virtual void BALL::VIEW::MainControl::closeEvent | ( | QCloseEvent * | evt | ) |

protected virtual

## complementSelection

void BALL::VIEW::MainControl::complementSelection | ( |  | ) |

slot

## complementSelectionHelper_()

void BALL::VIEW::MainControl::complementSelectionHelper_ | ( | Composite & | c | ) |

protected

## compositesAreLocked()

bool BALL::VIEW::MainControl::compositesAreLocked | ( |  | ) | const

Check wheter the stored composites can be modified at the moment. This method returns true e.g. while a MD simulation is running.

## createPopupMenu()

virtual QMenu * BALL::VIEW::MainControl::createPopupMenu | ( |  | ) |

virtual

Create the standard popup menu.

## deleteClicked

virtual void BALL::VIEW::MainControl::deleteClicked | ( |  | ) |

protected virtual slot

## deselectCompositeRecursive()

void BALL::VIEW::MainControl::deselectCompositeRecursive | ( | Composite * | composite,
|  | bool | first_call = false )

Select a Composite recursive and add all Atom and AtomContainer objects to the selection.

## disableLoggingToFile()

void BALL::VIEW::MainControl::disableLoggingToFile | ( |  | ) |

This disables logging to an file for all messages send per LogStream .e.g. Log().error()

## dump()

virtual void BALL::VIEW::MainControl::dump | ( | std::ostream & | s = std::cout,
|  | Size | depth = 0 ) const

virtual

Internal state dump. Dump the current internal state of this mainControl to the output ostream s with dumping depth depth.

Parameters

  s | output stream where to output the internal state
  depth | the dumping depth

Reimplemented from BALL::VIEW::ConnectionObject.

## enableLoggingToFile()

void BALL::VIEW::MainControl::enableLoggingToFile | ( |  | ) |

This enables logging to an file for all messages send per LogStream .e.g. Log().error()

## event

virtual bool BALL::VIEW::MainControl::event | ( | QEvent * | e | ) |

virtual slot

Interface to QT events, e.g. to communicate with other threads.

## fetchPreferences()

virtual void BALL::VIEW::MainControl::fetchPreferences | ( | INIFile & | inifile | ) |

virtual

Fetch the preferences from the INIfile. Calls fetchPreferences() for all registered ModularWidgets. Note:If this method is overridden, call this method at the end of the overriden method to make sure that the general preferences are fetched.

Parameters

  inifile | the INIFile that contains the needed values

## getCompositeManager()

CompositeManager & BALL::VIEW::MainControl::getCompositeManager | ( |  | ) |

inline

Get the composite manager. The class CompositeManager is the owner of all Composite objects.

Definition at line 320 of file mainControl.h.

## getFragmentDB()

const FragmentDB & BALL::VIEW::MainControl::getFragmentDB | ( |  | ) | const

inline

Get a const reference for the fragment database.

Definition at line 658 of file mainControl.h.

## getINIFile() [1/2]

INIFile & BALL::VIEW::MainControl::getINIFile | ( |  | ) |

Mutable inspection of the INIFile.

## getINIFile() [2/2]

const INIFile & BALL::VIEW::MainControl::getINIFile | ( |  | ) | const

Non-mutable inspection of the INIFile.

## getLastHighLightedMenuEntry()

QAction * BALL::VIEW::MainControl::getLastHighLightedMenuEntry | ( |  | ) |

inline

Get the ID of the last highlighted menu entry.

Definition at line 566 of file mainControl.h.

## getLockingWidget()

ModularWidget * BALL::VIEW::MainControl::getLockingWidget | ( |  | ) |

Get the ModularWidget with excluse access to the Composites.

## getLoggingFilename()

const String & BALL::VIEW::MainControl::getLoggingFilename | ( |  | ) | const

See above.

## getMainControl()

MainControl * BALL::VIEW::MainControl::getMainControl | ( | const QObject * | object | ) |

static

Return the MainControl of an QObject. This method returns the MainControl that should be the root of the ConnectionObject tree from a given widget or dialog QObject. Because we use the qt library, every widget or dialog has QObject as a base class. MainControl is the main application and therefore all widgets and dialogs are its children. We use the qt QObject tree mechanism to return the MainControl for a given QObject.

  Note: This method is used internally from the ModularWidget registration process.

Returns
  MainControl* the root of the ConnectionObject tree

See also
  ConnectionObject
  ModularWidget

## getMenuHint()

String BALL::VIEW::MainControl::getMenuHint | ( | QAction * | id | ) | const

Get the hint for a menu entry.

## getModelInformation()

const ModelInformation & BALL::VIEW::MainControl::getModelInformation | ( |  | ) | const

## getMolecularControlSelection()

std::list< Composite * > & BALL::VIEW::MainControl::getMolecularControlSelection | ( |  | ) |

Get the selection (highlighted items) of the MolecularControl (not the selection with checkboxes).

## getPreferences()

Preferences * BALL::VIEW::MainControl::getPreferences | ( |  | ) |

Mutable inspection of the preferences dialog.

Returns
  Preferences* a pointer to the Preferences dialog, ( 0 if not present)

## getRepresentationManager()

RepresentationManager & BALL::VIEW::MainControl::getRepresentationManager | ( |  | ) |

inline

Get the primitive manager. The class RepresentationManager contains all Representation objects and GeometricObject.

Definition at line 256 of file mainControl.h.

## getSelectedSystem()

System * BALL::VIEW::MainControl::getSelectedSystem | ( |  | ) |

If exactly one System is selected in the Control, return a pointer to this system, otherwise 0.

## getSelection() [1/2]

HashSet< Composite * > & BALL::VIEW::MainControl::getSelection | ( |  | ) |

Get the HashSet with the selected (e.g. picked) Composite objects.

## getSelection() [2/2]

const HashSet< Composite * > & BALL::VIEW::MainControl::getSelection | ( |  | ) | const

Get the HashSet with the selected (e.g. picked) Composite objects (const).

## getShortcutRegistry()

ShortcutRegistry & BALL::VIEW::MainControl::getShortcutRegistry | ( |  | ) |

inline

Get the shortcut registry. The class ShortcutRegistry is the owner of all shortcuts.

Definition at line 308 of file mainControl.h.

## getSimulationThread()

SimulationThread * BALL::VIEW::MainControl::getSimulationThread | ( |  | ) |

Get the currently running SimulationThread or zero pointer if no simulation running.

## getStatusbarText()

String BALL::VIEW::MainControl::getStatusbarText | ( |  | ) | const

## getWorkingDir()

String BALL::VIEW::MainControl::getWorkingDir | ( |  | ) | const

inline

BALLView stores the directory of the last file operation, e.g. when a PDB file is opened or saved. This saves the user some time, since he doesnt have to change the folders in the file dialogs as often. This method returns the last directory.

Definition at line 671 of file mainControl.h.

## init_()

void BALL::VIEW::MainControl::init_ | ( |  | ) |

protected

## initializePreferencesTab_()

virtual void BALL::VIEW::MainControl::initializePreferencesTab_ | ( |  | ) |

protected virtual

## initPopupMenu()

virtual QMenu * BALL::VIEW::MainControl::initPopupMenu | ( | int | ID,
|  | UIOperationMode::OperationMode | mode = UIOperationMode::MODE_ALL )

virtual

Initialize a new popup menu ID. If the MainControl has already the popup menu ID that QPopupMenu is returned. See the documentation of the qt library for more information concerning the class QPopupMenu.

Parameters

  ID | the ID of the menu entry to be created.

Returns
  QPopupMenu* a pointer to the created QPopupMenu

See also
  PopUpID

## insert() [1/2]

bool BALL::VIEW::MainControl::insert | ( | Composite & | composite,
|  | String | name = "",
|  | bool | normalize = true )

Insert a Composite and notify all ModularWidget. The Composite has to be created on the heap!!! A CompositeMessage with type NEW_COMPOSITE is send and CompositeManager::insert called.

Returns
  false if the CompositeManager contains the Composite

## insert() [2/2]

bool BALL::VIEW::MainControl::insert | ( | Representation & | rep | ) |

Insert a Representation The Representation must be created on the heap!!! A RepresentationMessage with type NEW is send.

Returns
  false if the RepresentationManager contains the Representation

## insertDeleteEntry()

void BALL::VIEW::MainControl::insertDeleteEntry | ( |  | ) |

Insert the delete entry for GenericControls. Called by all GenericControls.

## insertMenuEntry() [1/2]

QAction * BALL::VIEW::MainControl::insertMenuEntry | ( | Position | parent_id,
|  | const QString & | name,
|  | const QObject * | receiver = 0,
|  | const char * | slot = 0,
|  | const QString & | description = "",
|  | QKeySequence | accel = QKeySequence(),
|  | UIOperationMode::OperationMode | minimal_mode = UIOperationMode::MODE_ALL )

Insert a new menu entry into menu ID (creates a new menu if ID not existent). See the documentation of the qt library for more information concerning menu creation.

Parameters

  ID | the menu ID to which the new menu entry should be inserted
  name | the name of the new menu entry
  receiver | the object to which the menu action will be connected
  slot | the function that will be called by activation of the menu entry
  description | a unique descriptive string for the action
  accel | the acceleration key
  minimal_mode | the least restrictive mode for which this entry should be added

Returns
  int the new entry_ID

## insertMenuEntry() [2/2]

QAction * BALL::VIEW::MainControl::insertMenuEntry | ( | Position | parent_id,
|  | const String & | name,
|  | const QObject * | receiver = 0,
|  | const char * | slot = 0,
|  | const String & | description = "",
|  | QKeySequence | accel = QKeySequence(),
|  | UIOperationMode::OperationMode | minimal_mode = UIOperationMode::MODE_ALL )

Insert a new menu entry into menu ID (creates a new menu if ID not existent). See the documentation of the qt library for more information concerning menu creation.

Parameters

  ID | the menu ID to which the new menu entry should be inserted
  name | the name of the new menu entry
  receiver | the object to which the menu action will be connected
  slot | the function that will be called by activation of the menu entry
  description | a unique descriptive string for the action
  accel | the acceleration key
  minimal_mode | the least restrictive mode for which this entry should be added

Returns
  int the new entry_ID

## insertPopupMenuSeparator()

void BALL::VIEW::MainControl::insertPopupMenuSeparator | ( | int | ID,
|  | UIOperationMode::OperationMode | mode = UIOperationMode::MODE_ALL )

Insert a separator into the popup menu ID. If the menu ID is not existent, it will be created first.

Parameters

  ID | the id of the menu to which a separator will be inserted

See also
  PopUpID

## isAboutToQuit()

bool BALL::VIEW::MainControl::isAboutToQuit | ( |  | ) |

inline

Definition at line 694 of file mainControl.h.

## isBusy()

bool BALL::VIEW::MainControl::isBusy | ( |  | ) | const

## loadBALLViewProjectFile [1/2]

void BALL::VIEW::MainControl::loadBALLViewProjectFile | ( |  | ) |

slot

## loadBALLViewProjectFile() [2/2]

void BALL::VIEW::MainControl::loadBALLViewProjectFile | ( | const String & | filename | ) |

Load a BALLView project file.

## lockComposites_()

void BALL::VIEW::MainControl::lockComposites_ | ( |  | ) |

protected

## lockCompositesFor()

bool BALL::VIEW::MainControl::lockCompositesFor | ( | ModularWidget * | widget | ) |

Lock the Composites for a given Modular Widget. This allows exclusive acces e.g. to delete or modify Composites and prevents those nasty segfaults if an other thread works on the Composites. @retrun true if the exclusive lock on the composites could be obtained

## menuItemHighlighted

void BALL::VIEW::MainControl::menuItemHighlighted | ( | QAction * | action | ) |

slot

Slot that is called when a menu item is highlighted. It is used to show a hint for every menu entry.

See also
  setMenuHint
  getMenuHint

## okPreferencesClicked_

virtual void BALL::VIEW::MainControl::okPreferencesClicked_ | ( |  | ) |

protected virtual slot

## onNotify()

virtual void BALL::VIEW::MainControl::onNotify | ( | Message * | message | ) |

virtual

Message handling method. Handles messages sent by other registered ModularWidget objects. Virtual function for overriden the message handling system. Take care to call this function in your own ModularWidget. There is no need to call this function, because it will be called from the message handling mechanism. Remember: A ModularWidget is not notified by the Messages it sends itself!

Parameters

  message | the pointer to the message that should be processed

See also
  ModularWidget
  Message

Reimplemented from BALL::VIEW::ConnectionObject.

## openFile()

virtual void BALL::VIEW::MainControl::openFile | ( | const String & | file | ) |

virtual

Open a file. This method is called to parse any command line arguments. It iterates over all ModularWidgets and calls ModularWidget::canHandle with the files extension (the suffix after the dot in the filename). If one ModularWidget can handle the format, ModularWidget::openFile is called.

## printSelectionInfos()

void BALL::VIEW::MainControl::printSelectionInfos | ( |  | ) |

Print some informations for the selection in the statusbar. Called by selectComposites_(). If one Atom is selected, its position is printed. If two Atom objects are selected, their distance, for three Atom 's their angle and for four Atom 's their torsion angle. Else the number of items is printed.

## processEvents()

void BALL::VIEW::MainControl::processEvents | ( | Size | ms | ) |

Added overloaded method from QApplication for access in Python.

## quickLoad

void BALL::VIEW::MainControl::quickLoad | ( |  | ) |

slot

Quickload quick.bvp in the users home die (see above).

## quickLoadConfirm

void BALL::VIEW::MainControl::quickLoadConfirm | ( |  | ) |

slot

## quickSave

void BALL::VIEW::MainControl::quickSave | ( |  | ) |

slot

Create a BALLView project file with the name quick.bvp in the users home dir.

## quit

virtual void BALL::VIEW::MainControl::quit | ( | int | return_value = 0 | ) |

virtual slot

Make the program exit.

## redrawAllRepresentations()

void BALL::VIEW::MainControl::redrawAllRepresentations | ( | bool | rebuild_display_lists = false | ) |

Redraws all inserted Representation, but doesnt change the Models.

Parameters

  rebuild_display_lists | set to true lets the Scene rebuild the GLDisplayList objects.

See also
  updateRepresentationsOf

## reduceSelection_()

void BALL::VIEW::MainControl::reduceSelection_ | ( | Composite *const | composite | ) |

protected

## remove() [1/2]

bool BALL::VIEW::MainControl::remove | ( | Composite & | composite,
|  | bool | to_delete = true,
|  | bool | update = true )

Remove a Composite and notify all ModularWidget. A CompositeMessage with type REMOVED_COMPOSITE is send and CompositeManager::remove called.

Parameters

  update | update Representations if needed

Returns
  false if the CompositeManager doesnt contain the Composite

## remove() [2/2]

bool BALL::VIEW::MainControl::remove | ( | Representation & | rep | ) |

Remove a Representation A RepresentationMessage with type REMOVE is send.

Returns
  false if the RepresentationManager doesnt contain the Representation

## remove_()

bool BALL::VIEW::MainControl::remove_ | ( | Composite & | composite,
|  | bool | update_representations_of_parent = true,
|  | bool | to_delete = true )

protected

## removeMenuEntry()

void BALL::VIEW::MainControl::removeMenuEntry | ( | Index | parent_id,
|  | QAction * | action )

## removeModularWidget()

void BALL::VIEW::MainControl::removeModularWidget | ( | ModularWidget * | widget | ) |

Remove a ModularWidget from the MainControl. This method will be called internally by the ModularWidget registration process. So, if you dont know exactly what this method does, you will not need it!

Parameters

  widget | the ModularWidget to be removed

## resize

virtual void BALL::VIEW::MainControl::resize | ( | int | w,
|  | int | h )

virtual slot

overloaded from QT for Python Interface

## restoreWindows() [1/2]

virtual void BALL::VIEW::MainControl::restoreWindows | ( |  | ) |

virtual

Restore the positions the main window and of all DockWindow's from the INIFile assigned to this instance.

## restoreWindows() [2/2]

virtual void BALL::VIEW::MainControl::restoreWindows | ( | const INIFile & | inifile | ) |

virtual

Restore the positions the main window and of all DockWindow's from a given inifile.

## saveBALLViewProjectFile [1/2]

void BALL::VIEW::MainControl::saveBALLViewProjectFile | ( |  | ) |

slot

## saveBALLViewProjectFile() [2/2]

void BALL::VIEW::MainControl::saveBALLViewProjectFile | ( | const String & | filename,
|  | bool | binary = true )

Save the current configuration, structures and representations to a BALLView project file (*.bvp).

## selectCompositeRecursive()

void BALL::VIEW::MainControl::selectCompositeRecursive | ( | Composite * | composite,
|  | bool | first_call = false )

Select a Composite recursive and add all Atom and AtomContainer objects to the selection.

## selectComposites_()

void BALL::VIEW::MainControl::selectComposites_ | ( | GeometricObjectSelectionMessage & | message | ) |

protected

## sendMessage()

void BALL::VIEW::MainControl::sendMessage | ( | Message & | message | ) |

Send a Message from Python. Otherwise, you should prefer to use ModularWidget::notify_. The MainControl itself also reacts to a Message, send with this method. The Message will be deleted, after it was send to all ModularWidget's.

## setBusyMode_()

void BALL::VIEW::MainControl::setBusyMode_ | ( | bool | state | ) |

protected

Show a busy cursor and a busy icon in the statusbar.

## setContentSize

void BALL::VIEW::MainControl::setContentSize | ( | int | w,
|  | int | h )

slot

## setDeleteEntryEnabled()

void BALL::VIEW::MainControl::setDeleteEntryEnabled | ( | bool | state | ) |

Enable the delete entry for GenericControls. Called by a GenericControl, if it has a selection, that can be deleted.

## setLoggingFilename()

void BALL::VIEW::MainControl::setLoggingFilename | ( | const String & | string | ) |

Set the name for the logging file (see above) to the given name. This file is stored in the users home dir.

## setMenuHint()

void BALL::VIEW::MainControl::setMenuHint | ( | QAction * | id,
|  | const String & | hint )

Set a hint for a menu entry.

## setModelInformation()

void BALL::VIEW::MainControl::setModelInformation | ( | ModelInformation * | mi | ) |

## setMultithreading()

void BALL::VIEW::MainControl::setMultithreading | ( | bool | state | ) |

inline

See above.

Definition at line 624 of file mainControl.h.

## setPreferencesEnabled_()

void BALL::VIEW::MainControl::setPreferencesEnabled_ | ( | bool | state | ) |

protected

## setSimulationThread()

bool BALL::VIEW::MainControl::setSimulationThread | ( | SimulationThread * | thread | ) |

Set the simulation thread. The instance of SimulationThread will be deleted after it has finished. If an other simulation is still running, this method returns false.

## setStatusbarText() [1/2]

void BALL::VIEW::MainControl::setStatusbarText | ( | const QString & | text,
|  | bool | important = false,
|  | bool | beep = false )

Sets the text in the statusbar. The statusbar has a label, whose text is set to the given argument. It is possible to notify the user with a beep sound.

Parameters

  important | If true, the message is also logged in the LogView, marked red in the statusbar and shown there for a longer time
  beep | if true a beep tone is played to inform the user about a critical event

## setStatusbarText() [2/2]

void BALL::VIEW::MainControl::setStatusbarText | ( | const String & | text,
|  | bool | important = false,
|  | bool | beep = false )

Sets the text in the statusbar. The statusbar has a label, whose text is set to the given argument. It is possible to notify the user with a beep sound.

Parameters

  important | If true, the message is also logged in the LogView, marked red in the statusbar and shown there for a longer time
  beep | if true a beep tone is played to inform the user about a critical event

## setup_()

void BALL::VIEW::MainControl::setup_ | ( |  | ) |

protected

## setWorkingDir()

void BALL::VIEW::MainControl::setWorkingDir | ( | const String & | dir | ) |

Set the working directory for the next file dialog and file operation to the given directory.

## show

virtual void BALL::VIEW::MainControl::show | ( |  | ) |

virtual slot

Initialize all registered ModularWidget objects. It initializes the menu structure, the preferences dialogs and connects every ModularWidget with the MainControl. This method also creates the first menu entry FILE with its subentry EXIT to exit the application. See ModularWidget for further information concerning menu structure creation and preferences handling.

  Calls registerConnectionObject()

  Calls fetchPreferences()

  Calls applyPreferences()

  Calls insertMenuEntry()

  Calls ModularWidget::initializeWidget()

  Calls QMainWindow::show()

  Note: Call this method to start the application.

## stopedSimulation()

bool BALL::VIEW::MainControl::stopedSimulation | ( |  | ) |

inline

Returns true, if the simulation was told to stop, but hasnt done this so far.

Definition at line 595 of file mainControl.h.

## stopedSimulation_()

void BALL::VIEW::MainControl::stopedSimulation_ | ( |  | ) |

protected

## stopSimulation

void BALL::VIEW::MainControl::stopSimulation | ( |  | ) |

slot

Stop a currently running calculation.

## toggleFullScreen

void BALL::VIEW::MainControl::toggleFullScreen | ( |  | ) |

slot

## unlockCompositesFor()

bool BALL::VIEW::MainControl::unlockCompositesFor | ( | ModularWidget * | widget | ) |

Lock the Composites for a given Modular Widget.

## update() [1/2]

void BALL::VIEW::MainControl::update | ( | Composite & | composite,
|  | bool | changed_hierarchy = true )

Update a Composite in all ModularWidget. This method differs wheter the composites hierarchy was changed or not. The update is faster if the hierarchy is unchanged, because e.g. the MolecularControl doesnt have to rebuild the ListViewItem tree. A CompositeMessage with type CHANGED_COMPOSITE or CHANGED_COMPOSITE_HIERARCHY is send and updateRepresentationsOf(composite) is called.

Returns
  false if the CompositeManager doesnt contain the Composite

## update() [2/2]

bool BALL::VIEW::MainControl::update | ( | Representation & | rep | ) |

Update a Representation A RepresentationMessage with type UPDATE and a SceneMessage is send.

Returns
  false if the RepresentationManager doesnt contain the Representation

## updateOfRepresentationRunning()

bool BALL::VIEW::MainControl::updateOfRepresentationRunning | ( |  | ) |

Return true if Representations are (re)calculated.

## updateRepLabel_

void BALL::VIEW::MainControl::updateRepLabel_ | ( |  | ) |

protected slot

## updateRepresentationsOf()

bool BALL::VIEW::MainControl::updateRepresentationsOf | ( | const Composite & | composite,
|  | bool | rebuild = true,
|  | bool | force = false )

Redraws all Representation objects for a Composite. If the Composite is not inserted into this MainControl false will be returned. updateRepresentationsOf() is called after receiving a CompositeMessage with type CHANGED_COMPOSITE in onNotify(). It sends a RepresentationMessage with type UPDATE for every Representation, which was build for the Composite. After this a SceneMessage is send to redraw the Scene.

  Notes: If you changed a Composite in MainControl or a derived class, the MainControl doesnt get notified, from the CompositeMessage it sends. So you have to call this function instead of sending the message.

Parameters

  composite | the Composite that should be updated
  rebuild | if set to true, the model is rebuilded, otherwise just the coloring is updated
  force | is set to true, also rebuild non surface models (only usefull with rebuild = true)

Returns
  true if an update was performed

## useMultithreading()

bool BALL::VIEW::MainControl::useMultithreading | ( |  | ) |

Method to query if multithreading is enabled. Multithreaded code is used for serveral functions:

- Update of Representations
- Simulations
- Download PDB files
  To debug such code it is often usefull to to be able to run it in a singlethreaded mode. Every piece of multithreaded code should therefore call this method and decide if it should run without multiple threads. Furthermore most of the time, valid benchmark results can only be achived with one single thread.

## wait()

void BALL::VIEW::MainControl::wait | ( |  | ) |

Wait until the MainControl is not busy anymore.

## writePreferences()

virtual void BALL::VIEW::MainControl::writePreferences | ( | INIFile & | inifile | ) |

virtual

Writes the widgets preferences to the INIFile. Calls writePreferences() for all registered ModularWidgets and Preferences::savePreferences(). Note: If this method is overridden, call this method at the end of the overriden method to make sure that the general preferences are written.

Parameters

  inifile | the INIFile that contains the needed values

## Friends And Related Symbol Documentation

## RepresentationManager

friend class RepresentationManager

friend

Definition at line 119 of file mainControl.h.

## SimulationThread

friend class SimulationThread

friend

Definition at line 120 of file mainControl.h.

## Member Data Documentation

## about_to_quit_

bool BALL::VIEW::MainControl::about_to_quit_

protected

Definition at line 888 of file mainControl.h.

## clear_selection_action_

QAction* BALL::VIEW::MainControl::clear_selection_action_

protected

Definition at line 954 of file mainControl.h.

## complement_selection_action_

QAction* BALL::VIEW::MainControl::complement_selection_action_

protected

Definition at line 953 of file mainControl.h.

## composite_manager_

CompositeManager BALL::VIEW::MainControl::composite_manager_

protected

Definition at line 911 of file mainControl.h.

## composites_locked_

bool BALL::VIEW::MainControl::composites_locked_

protected

Definition at line 920 of file mainControl.h.

## composites_locked_mutex_

Mutex BALL::VIEW::MainControl::composites_locked_mutex_

protected

Definition at line 949 of file mainControl.h.

## control_selection_

std::list<Composite*> BALL::VIEW::MainControl::control_selection_

protected

Definition at line 903 of file mainControl.h.

## delete_action_

QAction* BALL::VIEW::MainControl::delete_action_

protected

Definition at line 957 of file mainControl.h.

## fragment_db_

FragmentDB BALL::VIEW::MainControl::fragment_db_

protected

Definition at line 892 of file mainControl.h.

## fullscreen_action_

QAction* BALL::VIEW::MainControl::fullscreen_action_

protected

Definition at line 952 of file mainControl.h.

## id_to_menu_

HashMap<Position, QMenu*> BALL::VIEW::MainControl::id_to_menu_

protected

Definition at line 960 of file mainControl.h.

## important_text_in_statusbar_

bool BALL::VIEW::MainControl::important_text_in_statusbar_

protected

Definition at line 944 of file mainControl.h.

## last_highlighted_menu_entry_

QAction* BALL::VIEW::MainControl::last_highlighted_menu_entry_

protected

Definition at line 959 of file mainControl.h.

## last_point_

QPoint BALL::VIEW::MainControl::last_point_

protected

Definition at line 961 of file mainControl.h.

## last_size_

QSize BALL::VIEW::MainControl::last_size_

protected

Definition at line 962 of file mainControl.h.

## last_state_

QByteArray BALL::VIEW::MainControl::last_state_

protected

Definition at line 963 of file mainControl.h.

## locking_widget_

ModularWidget* BALL::VIEW::MainControl::locking_widget_

protected

Definition at line 921 of file mainControl.h.

## logging_file_

File BALL::VIEW::MainControl::logging_file_

protected

Definition at line 942 of file mainControl.h.

## logging_file_name_

String BALL::VIEW::MainControl::logging_file_name_

protected

Definition at line 940 of file mainControl.h.

## logging_to_file_

bool BALL::VIEW::MainControl::logging_to_file_

protected

Definition at line 941 of file mainControl.h.

## main_control_preferences_

MainControlPreferences* BALL::VIEW::MainControl::main_control_preferences_

protected

Definition at line 914 of file mainControl.h.

## message_label_

QLabel* BALL::VIEW::MainControl::message_label_

protected

Definition at line 908 of file mainControl.h.

## model_information_

ModelInformation* BALL::VIEW::MainControl::model_information_

protected

Definition at line 894 of file mainControl.h.

## modular_widgets_

std::list<ModularWidget*> BALL::VIEW::MainControl::modular_widgets_

protected

Definition at line 930 of file mainControl.h.

## multi_threading_mode_

bool BALL::VIEW::MainControl::multi_threading_mode_

protected

Definition at line 889 of file mainControl.h.

## network_preferences_

NetworkPreferences* BALL::VIEW::MainControl::network_preferences_

protected

Definition at line 916 of file mainControl.h.

## open_action_

QAction* BALL::VIEW::MainControl::open_action_

protected

Definition at line 955 of file mainControl.h.

## open_save_preferences_

OpenSavePreferences* BALL::VIEW::MainControl::open_save_preferences_

protected

Definition at line 915 of file mainControl.h.

## preferences_action_

QAction* BALL::VIEW::MainControl::preferences_action_

protected

Definition at line 956 of file mainControl.h.

## preferences_dialog_

Preferences* BALL::VIEW::MainControl::preferences_dialog_

protected

Definition at line 917 of file mainControl.h.

## preferences_file_

INIFile BALL::VIEW::MainControl::preferences_file_

protected

Definition at line 918 of file mainControl.h.

## primitive_manager_

RepresentationManager BALL::VIEW::MainControl::primitive_manager_

protected

Definition at line 910 of file mainControl.h.

## render_timer_

QTimer BALL::VIEW::MainControl::render_timer_

protected

Definition at line 948 of file mainControl.h.

## rep_label_

QLabel* BALL::VIEW::MainControl::rep_label_

protected

Definition at line 933 of file mainControl.h.

## rep_label_delta_

Index BALL::VIEW::MainControl::rep_label_delta_

protected

Definition at line 946 of file mainControl.h.

## rep_label_nr_

Position BALL::VIEW::MainControl::rep_label_nr_

protected

Definition at line 936 of file mainControl.h.

## selection_

HashSet<Composite*> BALL::VIEW::MainControl::selection_

protected

Definition at line 898 of file mainControl.h.

## shortcut_registry_

ShortcutRegistry BALL::VIEW::MainControl::shortcut_registry_

protected

Definition at line 912 of file mainControl.h.

## simulation_icon_

QLabel* BALL::VIEW::MainControl::simulation_icon_

protected

Definition at line 932 of file mainControl.h.

## simulation_running_xpm_

const char* BALL::VIEW::MainControl::simulation_running_xpm_[]

static protected

Definition at line 934 of file mainControl.h.

## simulation_stoped_xpm_

const char* BALL::VIEW::MainControl::simulation_stoped_xpm_[]

static protected

Definition at line 935 of file mainControl.h.

## simulation_thread_

SimulationThread* BALL::VIEW::MainControl::simulation_thread_

protected

Definition at line 924 of file mainControl.h.

## stop_simulation_

bool BALL::VIEW::MainControl::stop_simulation_

protected

Definition at line 922 of file mainControl.h.

## stop_simulation_action_

QAction* BALL::VIEW::MainControl::stop_simulation_action_

protected

Definition at line 951 of file mainControl.h.

## timer_

QTimer BALL::VIEW::MainControl::timer_

protected

Definition at line 947 of file mainControl.h.

## was_not_busy_

bool BALL::VIEW::MainControl::was_not_busy_

protected

Definition at line 945 of file mainControl.h.

## working_dir_

String BALL::VIEW::MainControl::working_dir_

protected

Definition at line 938 of file mainControl.h.