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);
145  void OnDpiChanged(wxDPIChangedEvent& e);
146 
147 private:
149  void CreateColumns();
151  void UnLinkImageVariables(bool linked);
156  void SelectAllParameters(bool select, bool allImages);
160  void GenerateSubMenu(wxMenu* menu, PanoOperation::PanoOperationVector* operations, int& id);
162  void UpdateItemFont();
164  void CreateCheckboxImages();
165 
166 
167  // the model
171 
172  // image variable group information
174 
175  // number of digits for display
188  std::map<std::string,size_t> m_columnMap;
190  std::vector<std::string> m_columnVector;
194  std::vector<HuginBase::ImageVariableGroup::ImageVariableEnum> m_variableVector;
196  std::map<int,PanoOperation::PanoOperation*> m_menuOperation;
204  double m_editVal;
206  wxString m_editOldString;
209 
211  wxTreeItemId m_root;
212 
214  wxTreeItemId m_lastCurrentItem;
217  wxTreeItemId m_leftDownItem;
219 
220  //for saving column width
222  DECLARE_EVENT_TABLE()
223  DECLARE_DYNAMIC_CLASS(ImagesTreeCtrl)
224 };
225 
226 
228 class ImagesTreeCtrlXmlHandler : public wxcode::wxTreeListCtrlXmlHandler
229 {
230  DECLARE_DYNAMIC_CLASS(ImagesTreeCtrlXmlHandler)
231 
232  public:
234  virtual wxObject *DoCreateResource();
235  virtual bool CanHandle(wxXmlNode *node);
236 };
237 
238 #endif // _IMAGESTREE_H
ImagesTreeCtrl()
general constructor
Definition: ImagesTree.cpp:98
std::map< std::string, size_t > m_columnMap
map for easier access to column information
Definition: ImagesTree.h:188
void OnChar(wxTreeEvent &e)
event handler for key events
GroupMode m_groupMode
the active group mode
Definition: ImagesTree.h:170
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:186
bool m_dragging
true, if dragging
Definition: ImagesTree.h:202
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:787
std::vector< HuginBase::ImageVariableGroup::ImageVariableEnum > m_variableVector
vector for easier access to linking information
Definition: ImagesTree.h:194
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:211
virtual void panoramaChanged(HuginBase::Panorama &pano)
receives notification about panorama changes
Definition: ImagesTree.cpp:234
long m_leftDownColumn
Definition: ImagesTree.h:218
bool m_markDisabledImages
true, if disabled images should be marked with other font color
Definition: ImagesTree.h:184
void OnDeactivateImage(wxCommandEvent &e)
event handler for deactivate image
void OnLeftDblClick(wxMouseEvent &e)
event handler for left double click
Definition of PanoOperation class.
void OnDpiChanged(wxDPIChangedEvent &e)
event handler for updating dpi
void Init(HuginBase::Panorama *pano)
initialization, connects all control with Panorama, register observer
Definition: ImagesTree.cpp:213
wxTreeItemId m_leftDownItem
stores where left mouse click happend
Definition: ImagesTree.h:217
long m_lastCurrentCol
Definition: ImagesTree.h:215
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:208
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:937
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:368
wxString m_configClassName
Definition: ImagesTree.h:221
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:204
std::vector< std::string > m_columnVector
vector for easier access to column information
Definition: ImagesTree.h:190
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:110
void OnColumnWidthChange(wxListEvent &e)
event handler, when column width was changed, save into wxConfig
Definition: ImagesTree.cpp:943
HuginBase::Panorama * m_pano
Definition: ImagesTree.h:168
bool m_optimizerMode
true, if in optimizer mode
Definition: ImagesTree.h:182
wxTreeItemId m_lastCurrentItem
stores last item on which the mouse was hovering
Definition: ImagesTree.h:214
void SetGuiLevel(GuiLevel newSetting)
sets the GuiLevel of the control
Definition: ImagesTree.cpp:952
HuginBase::UIntSet GetSelectedImages()
returns the selected images
Definition: ImagesTree.cpp:908
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:198
std::map< int, PanoOperation::PanoOperation * > m_menuOperation
map with current active context menu PanoOperation
Definition: ImagesTree.h:196
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:180
wxString m_editOldString
wxString, as shown before editing started
Definition: ImagesTree.h:206
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:173
HuginBase::UIntSet m_draggingImages
UIntSet of dragging images.
Definition: ImagesTree.h:200
GuiLevel
Definition: GuiLevel.h:31
void UpdateGroupText(wxTreeItemId item)
updates the information fot the given lens/stack in the tree
Definition: ImagesTree.cpp:592
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:192
void CreateColumns()
creates all columns and stores information in m_columnMap, m_columnVector, m_editableColumns and m_va...
Definition: ImagesTree.cpp:134
void panoramaImagesChanged(HuginBase::Panorama &pano, const HuginBase::UIntSet &imgNr)
receive the update signal and update display accordingly
Definition: ImagesTree.cpp:254
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:845
void CreateCheckboxImages()
create image list with necessary images of checkboxes
Definition: ImagesTree.cpp:959
void SetOptimizerMode()
sets to control into optimizer mode
Definition: ImagesTree.cpp:994
virtual ~ImagesTreeCtrl(void)
destructor
Definition: ImagesTree.cpp:227