BALL 1.5.0
Loading...
Searching...
No Matches
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
22#endif
23
24#include <QtWidgets/QMenu>
25#include <QtWidgets/QTreeView>
26
27class QComboBox;
28class QPoint;
29class QSignalMapper;
30class QThread;
31
32namespace 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
67 enum MolecularMenuEntries
68 {
70 CREATE_REPRESENTATION,
71 OBJECT__MOVE,
72 SELECT,
73 DESELECT,
74 EDIT_MENU,
75 CUT,
76 COPY,
77 DELETE_ENTRY,
78 PASTE,
79
80
82 CAMERA__CENTER,
84 COMPOSITE__PROPERTIES,
86 COUNT__ITEMS,
88 BOND__PROPERTIES,
90 COLLAPSE_ALL,
92 EXPAND_ALL
93 };
94
95 Q_OBJECT
96
97 public:
98
100
101 friend class BondProperties;
102
106
111 MolecularControl(QWidget* parent = 0, const char* name = 0);
112
116
118
121
128 virtual void checkMenu(VIEW::MainControl& main_control);
129
136 void addComposite(Composite& composite, String given_name = "");
137
140 Size removeComposite(Composite& composite);
141
144 const std::list<Composite*>& getSelection() const;
145
148 Composite* getContextComposite();
149
155 virtual void onNotify(Message *message);
156
166 virtual void updateContextMenu(Composite& composite);
167
179 virtual void initializeWidget(MainControl& main_control);
180
184 Size applySelector(const String& expression);
185
187 void writePreferences(INIFile& inifile);
188
190 void fetchPreferences(INIFile& inifile);
191
193 void showDistance(Atom* a1, Atom* a2);
194
196 void showAngle(Atom* a1, Atom* a2, Atom* a3, Atom* a4 = 0);
197
200 QMenu& getContextMenu();
201
202 public Q_SLOTS:
203
205
208
210 void createRepresentation();
211
213 void compositeProperties();
214
216 void toggleDisulfidBond();
217
219 void bondProperties();
220
223 void checkResidue();
224
227 void buildBonds();
228
231 void centerCamera();
232
234 void countItems();
235
237 void showFilename();
238
242 virtual void updateSelection();
243
245 void highlightSelection();
246
248 void highlight(const std::list<Composite*>& composite);
249
259 void cut();
260
265 void copy();
266
271 void paste();
272
275 void clearClipboard();
276
279 void select();
280
283 void deselect();
284
286 void moveItems();
287
289 void collapseAll();
290
292 void expandAll();
293
297 Size applySelector();
298
303 BALL_DEPRECATED void showSelectorHelp();
304
306 virtual void deleteCurrentItems();
307
309 virtual void clearSelector();
310
311 void switchShowSecondaryStructure();
312
314 void showAtomOverview();
315
317 void showAtomOverviewForSelection();
318
320 void showDistance();
321
323 void showAngle();
324
326
329 protected Q_SLOTS:
330
331 /*_ Controlling method for context menus.
332 Clear the previously created context menu.
333 Calls buildContextMenu for the Composite object belonging
334 to the <tt>item</tt> and executes the context menu if menu entries are available.
335 \param point the position to which the context menu should be drawn
336 \param column not used at the moment
337 \see buildContextMenu
338 */
339 void showGuestContextMenu(const QPoint& pos);
340
341 //_ called when a model is selected in the context menu
342 void activatedItem_(QAction* action);
343
344 //_
345 void createRepresentation_();
346
347 //
348 void onItemClicked(QTreeWidgetItem* item, int);
349
350 void changeRotamer_(int i);
351
352 protected:
353
355 void buildContextMenu_();
356
358 void buildRotamerMenu_();
359
366 void setSelection_(bool open, bool force = false);
367
375 virtual MolecularInformation& getInformationVisitor_();
376
383 virtual void recurseGeneration_(QTreeWidgetItem* item, Composite& composite);
384
399 virtual bool reactToMessages_(Message* message);
400
414 QTreeWidgetItem* generateListViewItem_(QTreeWidgetItem* parent,
415 Composite& composite, QString* default_name = 0);
416
417 //_ Test, if its allowed to paste the copy liste into the current selected context item.
418 bool pasteAllowedFor_(Composite& composite);
419
420 //
421 inline void removeRecursive_(QTreeWidgetItem* item);
422
423 // only for Python Interface
425
426 //
427 std::list<QTreeWidgetItem*> getAllItems_();
428
429 void enableUpdates_(bool state);
430 void newSelection_(std::list<Composite*>& sel, bool selected);
431
432 bool allowPaste_();
433
435
438
439 //_
440 QAction* cut_id_, *copy_id_, *paste_id_, *delete_id_, *clipboard_id_, *select_id_, *deselect_id_,
441 *show_ss_id_;
442
444
445 std::list<Composite*> selected_;
446 std::list<Composite*> copy_list_;
447
449
450 QComboBox* selector_edit_;
451 QComboBox* smarts_edit_;
452
453 // the context menus
454 QMenu context_menu_,
455 model_menu_,
456 edit_menu_,
457 color_menu_[MODEL_LABEL - MODEL_LINES];
458
459 QMenu* rotamer_menu_;
460
461 Composite* context_composite_;
462
463 QTreeWidgetItem* context_item_;
464
465 ModelType selected_model_;
466 ColoringMethod selected_coloring_method_;
467 std::map<Composite*, MyTreeWidgetItem*> composite_to_item_;
468
469 // let cut know to delete the entries, set by deleteCurrentItems()
470 bool was_delete_;
471
472 Size nr_items_removed_;
473
474 bool show_ss_;
475 QAction* center_camera_action_, *composite_properties_action_, *bond_propertes_action_, *disulfidbond_action_,
476 *select_action_, *deselect_action_, *count_items_action_, *atom_overview_, *atom_overview_selection_,
477 *angle_action_, *distance_action_, *paste_action_;
478
479 bool ignore_messages_;
480
481 QSignalMapper* rotamer_mapper_;
482 Residue* current_residue_;
483 RotamerLibrary* rotamer_library_;
484 ReadWriteLock rotamer_library_mutex_;
485 QThread* rl_thread_;
486};
487
488}} // namespaces
489
490#endif // BALL_VIEW_WIDGETS_MOLECULARCONTROL_H
#define BALL_EMBEDDABLE(TYPE, BASE)
Definition embeddable.h:31
STL namespace.
Rotamer Library Class.
#define BALL_DEPRECATED
#define BALL_VIEW_EXPORT