BALL  1.4.79
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
molecularControl.h
Go to the documentation of this file.
1 // -*- Mode: C++; tab-width: 2; -*-
2 // vi: set ts=2:
3 //
4 
5 #ifndef BALL_VIEW_WIDGETS_MOLECULARCONTROL_H
6 #define BALL_VIEW_WIDGETS_MOLECULARCONTROL_H
7 
8 #ifndef BALL_VIEW_WIDGETS_GENERICCONTROL_H
10 #endif
11 
12 #ifndef BALL_CONCEPT_MOLECULARINFORMATION_H
14 #endif
15 
16 #ifndef BALL_SYSTEM_MUTEX_H
17 # include <BALL/SYSTEM/mutex.h>
18 #endif
19 
20 #ifndef BALL_VIEW_KERNEL_COMMON_H
21 # include <BALL/VIEW/KERNEL/common.h>
22 #endif
23 
24 #include <QtGui/QMenu>
25 #include <QtGui/QTreeView>
26 
27 class QComboBox;
28 class QPoint;
29 class QSignalMapper;
30 class QThread;
31 
32 namespace BALL
33 {
34  class Residue;
35  class RotamerLibrary;
36 
37  namespace VIEW
38  {
39  class BondProperties;
40 
50  : public GenericControl
51 {
52  // for internal usage only:
53  class MyTreeWidgetItem
54  : public QTreeWidgetItem
55  {
56  public:
57 
58  MyTreeWidgetItem(QTreeWidget* parent, QStringList& sl, Composite* composite);
59 
60  MyTreeWidgetItem(QTreeWidgetItem* parent, QStringList& sl, Composite* composite);
61 
62  void init_();
63 
64  Composite* composite;
65  };
66 
68  enum MolecularMenuEntries
69  {
71  CREATE_REPRESENTATION,
72  OBJECT__MOVE,
73  SELECT,
74  DESELECT,
75  EDIT_MENU,
76  CUT,
77  COPY,
78  DELETE_ENTRY,
79  PASTE,
80 
81 
83  CAMERA__CENTER,
85  COMPOSITE__PROPERTIES,
87  COUNT__ITEMS,
89  BOND__PROPERTIES,
91  COLLAPSE_ALL,
93  EXPAND_ALL
94  };
95 
96  Q_OBJECT
97 
98  public:
99 
101 
102  friend class BondProperties;
103 
107 
112  MolecularControl(QWidget* parent = 0, const char* name = 0);
113 
116  virtual ~MolecularControl();
117 
119 
122 
129  virtual void checkMenu(VIEW::MainControl& main_control);
130 
137  void addComposite(Composite& composite, String given_name = "");
138 
141  Size removeComposite(Composite& composite);
142 
145  const std::list<Composite*>& getSelection() const;
146 
149  Composite* getContextComposite();
150 
156  virtual void onNotify(Message *message);
157 
167  virtual void updateContextMenu(Composite& composite);
168 
180  virtual void initializeWidget(MainControl& main_control);
181 
185  Size applySelector(const String& expression);
186 
188  void writePreferences(INIFile& inifile);
189 
191  void fetchPreferences(INIFile& inifile);
192 
194  void showDistance(Atom* a1, Atom* a2);
195 
197  void showAngle(Atom* a1, Atom* a2, Atom* a3, Atom* a4 = 0);
198 
201  QMenu& getContextMenu();
202 
203  public slots:
204 
206 
209 
211  void createRepresentation();
212 
214  void compositeProperties();
215 
217  void toggleDisulfidBond();
218 
220  void bondProperties();
221 
224  void checkResidue();
225 
228  void buildBonds();
229 
232  void centerCamera();
233 
235  void countItems();
236 
238  void showFilename();
239 
243  virtual void updateSelection();
244 
246  void highlightSelection();
247 
249  void highlight(const std::list<Composite*>& composite);
250 
260  void cut();
261 
266  void copy();
267 
272  void paste();
273 
276  void clearClipboard();
277 
280  void select();
281 
284  void deselect();
285 
287  void moveItems();
288 
290  void collapseAll();
291 
293  void expandAll();
294 
298  Size applySelector();
299 
301  void showSelectorHelp();
302 
304  virtual void deleteCurrentItems();
305 
307  virtual void clearSelector();
308 
309  void switchShowSecondaryStructure();
310 
312  void showAtomOverview();
313 
315  void showAtomOverviewForSelection();
316 
318  void showDistance();
319 
321  void showAngle();
322 
324 
327  protected slots:
328 
329  /*_ Controlling method for context menus.
330  Clear the previously created context menu.
331  Calls buildContextMenu for the Composite object belonging
332  to the <tt>item</tt> and executes the context menu if menu entries are available.
333  \param point the position to which the context menu should be drawn
334  \param column not used at the moment
335  \see buildContextMenu
336  */
337  void showGuestContextMenu(const QPoint& pos);
338 
339  //_ called when a model is selected in the context menu
340  void activatedItem_(QAction* action);
341 
342  //_
343  void createRepresentation_();
344 
345  //
346  void onItemClicked(QTreeWidgetItem* item, int);
347 
348  void changeRotamer_(int i);
349 
350  protected:
351 
353  void buildContextMenu_();
354 
356  void buildRotamerMenu_();
357 
364  void setSelection_(bool open, bool force = false);
365 
373  virtual MolecularInformation& getInformationVisitor_();
374 
381  virtual void recurseGeneration_(QTreeWidgetItem* item, Composite& composite);
382 
397  virtual bool reactToMessages_(Message* message);
398 
412  QTreeWidgetItem* generateListViewItem_(QTreeWidgetItem* parent,
413  Composite& composite, QString* default_name = 0);
414 
415  //_ Test, if its allowed to paste the copy liste into the current selected context item.
416  bool pasteAllowedFor_(Composite& composite);
417 
418  //
419  inline void removeRecursive_(QTreeWidgetItem* item);
420 
421  // only for Python Interface
422  MolecularControl(const MolecularControl& mc);
423 
424  //
425  std::list<QTreeWidgetItem*> getAllItems_();
426 
427  void enableUpdates_(bool state);
428  void newSelection_(std::list<Composite*>& sel, bool selected);
429 
430  bool allowPaste_();
431 
433 
436 
437  //_
438  QAction* cut_id_, *copy_id_, *paste_id_, *delete_id_, *clipboard_id_, *select_id_, *deselect_id_,
439  *show_ss_id_;
440 
442 
443  std::list<Composite*> selected_;
444  std::list<Composite*> copy_list_;
445 
446  MolecularInformation information_;
447 
448  QComboBox* selector_edit_;
449  QComboBox* smarts_edit_;
450 
451  // the context menus
452  QMenu context_menu_,
453  model_menu_,
454  edit_menu_,
455  color_menu_[MODEL_LABEL - MODEL_LINES];
456 
457  QMenu* rotamer_menu_;
458 
459  Composite* context_composite_;
460 
461  QTreeWidgetItem* context_item_;
462 
463  ModelType selected_model_;
464  ColoringMethod selected_coloring_method_;
465  std::map<Composite*, MyTreeWidgetItem*> composite_to_item_;
466 
467  // let cut know to delete the entries, set by deleteCurrentItems()
468  bool was_delete_;
469 
470  Size nr_items_removed_;
471 
472  bool show_ss_;
473  QAction* center_camera_action_, *composite_properties_action_, *bond_propertes_action_, *disulfidbond_action_,
474  *select_action_, *deselect_action_, *count_items_action_, *atom_overview_, *atom_overview_selection_,
475  *angle_action_, *distance_action_, *paste_action_;
476 
477  bool ignore_messages_;
478 
479  QSignalMapper* rotamer_mapper_;
480  Residue* current_residue_;
481  RotamerLibrary* rotamer_library_;
482  ReadWriteLock rotamer_library_mutex_;
483  QThread* rl_thread_;
484 };
485 
486 }} // namespaces
487 
488 #endif // BALL_VIEW_WIDGETS_MOLECULARCONTROL_H
defines the property for the model: Label
Rotamer Library Class.
#define BALL_VIEW_EXPORT
Definition: COMMON/global.h:52
defines the property for the model: Lines
#define BALL_EMBEDDABLE(TYPE, BASE)
Definition: embeddable.h:31