VPTissue Reference Manual
TissueEditor.h
Go to the documentation of this file.
1 #ifndef SIMPT_EDITOR_SIMPT_TISSUE_EDITOR_H_INCLUDED
2 #define SIMPT_EDITOR_SIMPT_TISSUE_EDITOR_H_INCLUDED
3 /*
4  * Copyright 2011-2016 Universiteit Antwerpen
5  *
6  * Licensed under the EUPL, Version 1.1 or as soon they will be approved by
7  * the European Commission - subsequent versions of the EUPL (the "Licence");
8  * You may not use this work except in compliance with the Licence.
9  * You may obtain a copy of the Licence at: http://ec.europa.eu/idabc/eupl5
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the Licence is distributed on an "AS IS" basis,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the Licence for the specific language governing
15  * permissions and limitations under the Licence.
16  */
23 
24 #include <boost/property_tree/ptree.hpp>
25 #include <memory>
26 #include <QAction>
27 #include <QLabel>
28 #include <QMainWindow>
29 #include <string>
30 
31 namespace SimPT_Editor {
32 
33 class EditControlLogic;
34 class EditorActions;
35 class PTreePanels;
36 class TissueGraphicsView;
37 class UndoStack;
38 
43 {
44  Q_OBJECT
45 public:
47  TissueEditor(QWidget* parent = nullptr);
48 
50  virtual ~TissueEditor();
51 
53  virtual bool IsOpened() const;
54 
56  bool OpenPath(const std::string& path);
57 
59  void dragEnterEvent(QDragEnterEvent *e);
60 
62  void dropEvent(QDropEvent *e);
63 
64 
65 private slots:
67  virtual void closeEvent(QCloseEvent* event);
68 
70  bool CloseLeaf();
71 
73  void GenerateRegularPattern();
74 
76  void GenerateVoronoiPattern();
77 
85  void NewLeaf();
86 
88  void OpenLeaf();
89 
91  void Redo();
92 
94  void SaveLeaf();
95 
97  void SetCellMode();
98 
100  void SetEdgeMode();
101 
104  void SetModified();
105 
108  void SetModifiedWithoutUndo();
109 
111  void SetNodeMode();
112 
114  void SetStatusBar(const std::string& info);
115 
117  void Undo();
118 
119 private:
121  void CreateActions();
122 
124  void CreateLayout();
125 
127  void UpdateViews();
128 
129 private:
131  virtual void InternalForceClose();
132 
134  virtual bool InternalIsClean() const;
135 
137  virtual bool InternalSave();
138 
139 private:
140  std::shared_ptr<EditControlLogic> m_tissue;
141  boost::property_tree::ptree m_ptree;
142  UndoStack* m_undo_stack;
143  TissueGraphicsView* m_graphics_view;
144  PTreePanels* m_ptree_panels;
145  std::string m_current_path;
146  EditorActions* m_actions;
147  QLabel* m_status_info;
148  bool m_modified;
149 };
150 
151 } // namespace
152 
153 #endif // end_of_include_guard
void dragEnterEvent(QDragEnterEvent *e)
Receive a message when something is dragged over the window.
Namespace for SimPT tissue editor package.
Definition: Cell.h:32
The graphical view on the tissue.
HasUnsavedChanges with the ability of displaying a "save-discard-cancel" dialog to the user before cl...
virtual ~TissueEditor()
Destructor.
virtual bool IsOpened() const
True if tissue has been opened, false otherwise.
Main GUI class for cell editor.
Definition: TissueEditor.h:42
bool OpenPath(const std::string &path)
True iff file has been successfully opened (if another file is open, it is closed first)...
Undo Stack for actions performed on a tissue.
Definition: UndoStack.h:31
Manages the attribute and geometric ptree panel for a given tissue.
Definition: PTreePanels.h:35
TissueEditor(QWidget *parent=nullptr)
Constructor with the parent of the window.
see the online Qt documentation
see the online Qt documentation
The actions in the menu bar of the workspace.
Definition: EditorActions.h:35
void dropEvent(QDropEvent *e)
Recive a message when a file is dropped on the window.
HasUnsavedChangesPrompt interface.