Hugintrunk  0.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
ImagesTree.h
Go to the documentation of this file.
1 // -*- c-basic-offset: 4 -*-
9 /* This is free software; you can redistribute it and/or
10  * modify it under the terms of the GNU General Public
11  * License as published by the Free Software Foundation; either
12  * version 2 of the License, or (at your option) any later version.
13  *
14  * This software is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17  * Lesser General Public License for more details.
18  *
19  * You should have received a copy of the GNU General Public
20  * License along with this software. If not, see
21  * <http://www.gnu.org/licenses/>.
22  *
23  */
24 
25 #ifndef _IMAGESTREE_H
26 #define _IMAGESTREE_H
27 
28 #include <map>
29 #include "panodata/Panorama.h"
31 #include "treelistctrl.h"
32 #include "GuiLevel.h"
33 #include "hugin/PanoOperation.h"
34 
37 {
38 public:
40  enum GroupMode
41  {
47  };
50  {
58  };
61 
63  bool Create(wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxTAB_TRAVERSAL, const wxString& name = wxT("panel"));
64 
66  void Init(HuginBase::Panorama * pano);
67 
69  virtual ~ImagesTreeCtrl(void) ;
70 
72  void SetGroupMode(GroupMode newMode);
74  void SetDisplayMode(DisplayMode newMode);
75 
77  void SetGuiLevel(GuiLevel newSetting);
82  void SetOptimizerMode();
84  virtual void panoramaChanged(HuginBase::Panorama & pano);
93  void MarkActiveImages(const bool markActive);
94 
95 protected:
97  void UpdateImageText(wxTreeItemId item);
99  void UpdateGroupText(wxTreeItemId item);
101  void UpdateGroup(wxTreeItemId parent, const HuginBase::UIntSet imgs, HuginBase::UIntSet& changed);
103  void OnColumnWidthChange(wxListEvent & e );
105  void OnLinkImageVariables(wxCommandEvent &e);
107  void OnUnlinkImageVariables(wxCommandEvent &e);
109  void OnEditImageVariables(wxCommandEvent &e);
111  void OnBeginDrag(wxTreeEvent &e);
113  void OnLeftUp(wxMouseEvent &e);
115  void OnLeftDown(wxMouseEvent &e);
117  void OnMouseMove(wxMouseEvent &e);
119  void OnLeftDblClick(wxMouseEvent &e);
121  void OnSelectAll(wxCommandEvent &e);
123  void OnUnselectAll(wxCommandEvent &e);
125  void OnSelectLensStack(wxCommandEvent &e);
127  void OnUnselectLensStack(wxCommandEvent &e);
129  void OnChar(wxTreeEvent &e);
131  void OnBeginEdit(wxTreeEvent &e);
133  void OnEndEdit(wxTreeEvent &e);
135  void OnExecuteOperation(wxCommandEvent & e);
137  void OnContextMenu(wxTreeEvent & e);
139  void OnHeaderContextMenu(wxListEvent & e);
141  void OnActivateImage(wxCommandEvent& e);
143  void OnDeactivateImage(wxCommandEvent& e);
144 #if wxCHECK_VERSION(3,1,3)
145 
146  void OnDpiChanged(wxDPIChangedEvent& e);
147 #endif
148 
149 private:
151  void CreateColumns();
153  void UnLinkImageVariables(bool linked);
158  void SelectAllParameters(bool select, bool allImages);
162  void GenerateSubMenu(wxMenu* menu, PanoOperation::PanoOperationVector* operations, int& id);
164  void UpdateItemFont();
166  void CreateCheckboxImages();
167 
168 
169  // the model
173 
174  // image variable group information
176 
177  // number of digits for display
190  std::map<std::string,size_t> m_columnMap;
192  std::vector<std::string> m_columnVector;
196  std::vector<HuginBase::ImageVariableGroup::ImageVariableEnum> m_variableVector;
198  std::map<int,PanoOperation::PanoOperation*> m_menuOperation;
206  double m_editVal;
208  wxString m_editOldString;
211 
213  wxTreeItemId m_root;
214 
216  wxTreeItemId m_lastCurrentItem;
219  wxTreeItemId m_leftDownItem;
221 
222  //for saving column width
224  DECLARE_EVENT_TABLE()
225  DECLARE_DYNAMIC_CLASS(ImagesTreeCtrl)
226 };
227 
228 
230 class ImagesTreeCtrlXmlHandler : public wxcode::wxTreeListCtrlXmlHandler
231 {
232  DECLARE_DYNAMIC_CLASS(ImagesTreeCtrlXmlHandler)
233 
234  public:
236  virtual wxObject *DoCreateResource();
237  virtual bool CanHandle(wxXmlNode *node);
238 };
239 
240 #endif // _IMAGESTREE_H
ImagesTreeCtrl()
general constructor
Definition: ImagesTree.cpp:100
std::map< std::string, size_t > m_columnMap
map for easier access to column information
Definition: ImagesTree.h:190
void OnChar(wxTreeEvent &e)
event handler for key events
GroupMode m_groupMode
the active group mode
Definition: ImagesTree.h:172
declaration of helper for work with different GuiLevels
void SetGroupMode(GroupMode newMode)
sets the group mode to given mode
void OnHeaderContextMenu(wxListEvent &e)
event handler for context menu on header
void OnEndEdit(wxTreeEvent &e)
event handler for ending editing, updates the Panorama with modified value
void OnLeftDown(wxMouseEvent &e)
event handler for left mouse down, handles toggle of optimizer variables
void OnExecuteOperation(wxCommandEvent &e)
menu event handler for PanoOperation (context menu items)
void OnLeftUp(wxMouseEvent &e)
event handler for left up, handles end of dragging and updates of optimizer variables states ...
DisplayMode m_displayMode
the active display mode
Definition: ImagesTree.h:188
bool m_dragging
true, if dragging
Definition: ImagesTree.h:204
void UpdateGroup(wxTreeItemId parent, const HuginBase::UIntSet imgs, HuginBase::UIntSet &changed)
updates the given group, updates number of images and the images itself
Definition: ImagesTree.cpp:789
std::vector< HuginBase::ImageVariableGroup::ImageVariableEnum > m_variableVector
vector for easier access to linking information
Definition: ImagesTree.h:196
Somewhere to specify what variables belong to what.
void OnUnlinkImageVariables(wxCommandEvent &e)
event handler for unlinking image variables
wxTreeItemId m_root
pointer to root item, not shown
Definition: ImagesTree.h:213
virtual void panoramaChanged(HuginBase::Panorama &pano)
receives notification about panorama changes
Definition: ImagesTree.cpp:236
long m_leftDownColumn
Definition: ImagesTree.h:220
bool m_markDisabledImages
true, if disabled images should be marked with other font color
Definition: ImagesTree.h:186
void OnDeactivateImage(wxCommandEvent &e)
event handler for deactivate image
void OnLeftDblClick(wxMouseEvent &e)
event handler for left double click
Definition of PanoOperation class.
void Init(HuginBase::Panorama *pano)
initialization, connects all control with Panorama, register observer
Definition: ImagesTree.cpp:215
wxTreeItemId m_leftDownItem
stores where left mouse click happend
Definition: ImagesTree.h:219
long m_lastCurrentCol
Definition: ImagesTree.h:217
std::set< unsigned int > UIntSet
Definition: PanoramaData.h:51
void OnContextMenu(wxTreeEvent &e)
event handler to display context menu
DisplayMode
enumeration for display mode, limits the displayed columns
Definition: ImagesTree.h:49
void OnLinkImageVariables(wxCommandEvent &e)
event handler for linking image variables
bool m_needsUpdate
helper variable for update of output stacks/layers
Definition: ImagesTree.h:210
Model for a panorama.
Definition: Panorama.h:152
void MarkActiveImages(const bool markActive)
sets the flag, if active/disabled image should be marked with different colour
Definition: ImagesTree.cpp:939
void OnBeginEdit(wxTreeEvent &e)
event handler for beginning editing
void UpdateImageText(wxTreeItemId item)
updates the information for the given image in tree
Definition: ImagesTree.cpp:370
wxString m_configClassName
Definition: ImagesTree.h:223
void SetDisplayMode(DisplayMode newMode)
sets the display mode to given mode
void UnLinkImageVariables(bool linked)
helper procedure for link/unlink image variables
GroupMode
enumeration for grouping mode
Definition: ImagesTree.h:40
double m_editVal
value, which is currently edited
Definition: ImagesTree.h:206
std::vector< std::string > m_columnVector
vector for easier access to column information
Definition: ImagesTree.h:192
bool Create(wxWindow *parent, wxWindowID id=wxID_ANY, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, long style=wxTAB_TRAVERSAL, const wxString &name=wxT("panel"))
creates the control
Definition: ImagesTree.cpp:112
void OnColumnWidthChange(wxListEvent &e)
event handler, when column width was changed, save into wxConfig
Definition: ImagesTree.cpp:945
HuginBase::Panorama * m_pano
Definition: ImagesTree.h:170
bool m_optimizerMode
true, if in optimizer mode
Definition: ImagesTree.h:184
wxTreeItemId m_lastCurrentItem
stores last item on which the mouse was hovering
Definition: ImagesTree.h:216
void SetGuiLevel(GuiLevel newSetting)
sets the GuiLevel of the control
Definition: ImagesTree.cpp:954
HuginBase::UIntSet GetSelectedImages()
returns the selected images
Definition: ImagesTree.cpp:910
void OnEditImageVariables(wxCommandEvent &e)
event handler for showing image variables editing dialog
void OnSelectAll(wxCommandEvent &e)
event handler for select all optimizer variables
void OnSelectLensStack(wxCommandEvent &e)
event handler for select all optimizer variables for selected lens/stack
size_t m_selectedColumn
selected column
Definition: ImagesTree.h:200
std::map< int, PanoOperation::PanoOperation * > m_menuOperation
map with current active context menu PanoOperation
Definition: ImagesTree.h:198
void OnBeginDrag(wxTreeEvent &e)
event handler when dragging begins, veto if dragging is not possible
this handler class will receive change events from the Panorama.
Definition: PanoramaData.h:401
the main images tree control, used on images and optimizer tabs
Definition: ImagesTree.h:36
void OnActivateImage(wxCommandEvent &e)
event handler for activate image
void OnMouseMove(wxMouseEvent &e)
event handler for mouse motion, handles focussing of check boxes
void GenerateSubMenu(wxMenu *menu, PanoOperation::PanoOperationVector *operations, int &id)
generates submenu for given PanoOperationVector
GuiLevel m_guiLevel
stores the active GuiLevel
Definition: ImagesTree.h:182
wxString m_editOldString
wxString, as shown before editing started
Definition: ImagesTree.h:208
void SelectAllParameters(bool select, bool allImages)
select/unselect all variables in the active column true selects all, false unselect all true works ...
std::vector< PanoOperation * > PanoOperationVector
HuginBase::StandardImageVariableGroups * m_variable_groups
Definition: ImagesTree.h:175
HuginBase::UIntSet m_draggingImages
UIntSet of dragging images.
Definition: ImagesTree.h:202
GuiLevel
Definition: GuiLevel.h:31
void UpdateGroupText(wxTreeItemId item)
updates the information fot the given lens/stack in the tree
Definition: ImagesTree.cpp:594
void UpdateItemFont()
update the font colour for all items
void OnUnselectLensStack(wxCommandEvent &e)
event handler for unselect all optimizer variables for selected lens/stack
HuginBase::UIntSet m_editableColumns
set, which contains editable columns (all column which contains numeric image variables ...
Definition: ImagesTree.h:194
void CreateColumns()
creates all columns and stores information in m_columnMap, m_columnVector, m_editableColumns and m_va...
Definition: ImagesTree.cpp:136
void panoramaImagesChanged(HuginBase::Panorama &pano, const HuginBase::UIntSet &imgNr)
receive the update signal and update display accordingly
Definition: ImagesTree.cpp:256
void OnUnselectAll(wxCommandEvent &e)
event handler for unselect all optimizer variables
void UpdateOptimizerVariables()
updates the display of the optimizer variables (set font)
Definition: ImagesTree.cpp:847
void CreateCheckboxImages()
create image list with necessary images of checkboxes
Definition: ImagesTree.cpp:961
void SetOptimizerMode()
sets to control into optimizer mode
Definition: ImagesTree.cpp:996
virtual ~ImagesTreeCtrl(void)
destructor
Definition: ImagesTree.cpp:229