Hugintrunk  0.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
StackerPanel.h
Go to the documentation of this file.
1 // -*- c-basic-offset: 4 -*-
10 /* This is free software; you can redistribute it and/or
11  * modify it under the terms of the GNU General Public
12  * License as published by the Free Software Foundation; either
13  * version 2 of the License, or (at your option) any later version.
14  *
15  * This software is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18  * Lesser General Public License for more details.
19  *
20  * You should have received a copy of the GNU General Public
21  * License along with this software. If not, see
22  * <http://www.gnu.org/licenses/>.
23  *
24  */
25 
26 #ifndef STACKERANEL_H
27 #define STACKERANEL_H
28 
29 #include "panoinc_WX.h"
30 #include "PreviewWindow.h"
31 #include <vector>
33 
37 class StackerPanel : public wxPanel
38 {
39 public:
40  struct FileInfo
41  {
42  public:
43  FileInfo(const wxString& file, const wxString& new_name, const wxString& new_path, const size_t& new_width, const size_t& new_height)
44  {
45  fullFilename = file;
46  name = new_name;
47  path = new_path;
48  width = new_width;
49  height = new_height;
50  isChecked = true;
51  };
52  wxString fullFilename, name, path;
53  size_t width, height;
54  bool isChecked;
55  };
56  typedef std::vector<FileInfo> FileInfoVector;
58  ~StackerPanel();
60  bool Create(wxWindow* parent, MyExecPanel* logPanel);
62  void AddFile(const wxString& filename);
64  void OnProcessFinished(wxCommandEvent& e);
65 
66 protected:
68  void OnAddFiles(wxCommandEvent& e);
69  void OnAddDirectory(wxCommandEvent& e);
70  void OnRemoveFile(wxCommandEvent& e);
71  void OnFileListChar(wxKeyEvent& e);
72  void OnFileSelectionChanged(wxCommandEvent& e);
73  void OnFileCheckStateChanged(wxListEvent& e);
74  void OnFileColumnHeaderClick(wxListEvent& e);
75  void OnModeChanged(wxCommandEvent& e);
76  void OnGeneratePreview(wxCommandEvent& e);
77  void OnGenerateOutput(wxCommandEvent& e);
78  void OnZoom(wxCommandEvent& e);
79 
80 private:
82  void ExecuteStacker();
88  wxString GetStackerOptions();
90  wxString GetStackerCommandLine();
92  void EnableFileButtons();
94  long GetCheckedItemCount() const;
96  void EnableOutputButtons(bool enable);
98  void CleanUpTempFiles();
100  void SortList();
102  void FillFileList();
103  void AddFileInfo(const FileInfo& info);
104  // member variables
105  wxListCtrl* m_fileListCtrl{ nullptr };
106  wxChoice* m_modeChoice{ nullptr };
107  wxSpinCtrlDouble* m_winsorTrim{ nullptr };
108  wxSpinCtrlDouble* m_sigma{ nullptr };
109  wxSpinCtrl* m_sigmaMaxIter{ nullptr };
113  wxArrayString m_outputFilenames;
114  wxArrayString m_tempFiles;
115  bool m_cleanupOutput = false;
116  // store current sorting column
117  long m_sortCol{ -1 };
118  bool m_sortAscending{ true };
119 
120  DECLARE_DYNAMIC_CLASS(StackerPanel)
121 };
122 
123 #endif // STACKERPANEL_H
void OnModeChanged(wxCommandEvent &e)
void OnFileSelectionChanged(wxCommandEvent &e)
void OnProcessFinished(wxCommandEvent &e)
call at the end of the enfuse command, to load result back and enable buttons again ...
void AddFile(const wxString &filename)
adds the given file to the list
void OnGeneratePreview(wxCommandEvent &e)
void EnableOutputButtons(bool enable)
enable/disable output buttons
wxSpinCtrlDouble * m_sigma
Definition: StackerPanel.h:108
void OnFileListChar(wxKeyEvent &e)
void ExecuteStacker()
build the command line and execute enfuse command
bool m_cleanupOutput
Definition: StackerPanel.h:115
void OnAddFiles(wxCommandEvent &e)
event handler
PreviewWindow * m_preview
Definition: StackerPanel.h:111
void EnableFileButtons()
enable/disable the file(s) remove and create buttons depending on selection of wxListCtrl ...
wxString GetStackerCommandLine()
get the full commandline for enfuse without program, but with files and output options, the output filename is read from m_outputFilename
wxString GetStackerOptions()
build string with all stacker options from values in wxPropertyGrid this are the mainly the fusion op...
bool Create(wxWindow *parent, MyExecPanel *logPanel)
creates the control and populates all controls with their settings
wxListCtrl * m_fileListCtrl
Definition: StackerPanel.h:105
std::vector< FileInfo > FileInfoVector
Definition: StackerPanel.h:56
~StackerPanel()
destructor, save state and settings
void OnGenerateOutput(wxCommandEvent &e)
wxSpinCtrlDouble * m_winsorTrim
Definition: StackerPanel.h:107
long GetCheckedItemCount() const
return the number of check images
wxArrayString m_tempFiles
Definition: StackerPanel.h:114
FileInfo(const wxString &file, const wxString &new_name, const wxString &new_path, const size_t &new_width, const size_t &new_height)
Definition: StackerPanel.h:43
FileInfoVector m_files
Definition: StackerPanel.h:110
void OnFileCheckStateChanged(wxListEvent &e)
void FillFileList()
fill the list from internal file list
wxChoice * m_modeChoice
Definition: StackerPanel.h:106
include file for the hugin project
void OnRemoveFile(wxCommandEvent &e)
MyExecPanel * m_logWindow
Definition: StackerPanel.h:112
preview window
Definition: PreviewWindow.h:38
static void info(const char *fmt,...)
Definition: svm.cpp:95
void SortList()
sort filename list
wxSpinCtrl * m_sigmaMaxIter
Definition: StackerPanel.h:109
void OnFileColumnHeaderClick(wxListEvent &e)
void OnAddDirectory(wxCommandEvent &e)
panel for stacker GUI
Definition: StackerPanel.h:37
void OnZoom(wxCommandEvent &e)
declaration of PreviewWindow class
void AddFileInfo(const FileInfo &info)
void ExecuteStackerExiftool()
build the command line and execute enfuse and exiftool afterwards
bool m_sortAscending
Definition: StackerPanel.h:118
wxArrayString m_outputFilenames
Definition: StackerPanel.h:113
void CleanUpTempFiles()
delete all temporary files, to be called mainly at end