Hugin trunk 0.1
Loading...
Searching...
No Matches
ToolboxFrame.cpp
Go to the documentation of this file.
1// -*- c-basic-offset: 4 -*-
10/*
11 * This program is free software; you can redistribute it and/or
12 * modify it under the terms of the GNU General Public
13 * License as published by the Free Software Foundation; either
14 * version 2 of the License, or (at your option) any later version.
15 *
16 * This software is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 * General Public License for more details.
20 *
21 * You should have received a copy of the GNU General Public
22 * License along with this software. If not, see
23 * <http://www.gnu.org/licenses/>.
24 *
25 */
26
27#include "base_wx/platform.h"
28#include "base_wx/wxutils.h"
29#include "ToolboxFrame.h"
30#include "ToolboxApp.h"
31#include "EnfusePanel.h"
32#include "StackerPanel.h"
33#include "PerspectivePanel.h"
34#include "huginapp/ImageCache.h"
36#include "CreateBrightImgDlg.h"
37
39{
40 // load from XRC
41 wxXmlResource::Get()->LoadFrame(this, parent, "toolbox_frame");
42 SetMinSize(wxSize(500, 400));
43 SetMenuBar(wxXmlResource::Get()->LoadMenuBar(this, "toolbox_menubar"));
44
45 // set the minimize icon
46#ifdef __WXMSW__
47 wxIconBundle myIcons(GetXRCPath() + "data/hugin.ico", wxBITMAP_TYPE_ICO);
49#else
50 wxIcon myIcon(GetXRCPath() + "data/hugin.png",wxBITMAP_TYPE_PNG);
52#endif
53 SetTitle(_("Hugin toolbox GUI"));
54 // create a status bar
55 const int fields(2);
57 int widths[fields] = { -1, 85 };
59 // load monitor profile
63
64 // initialize image cache
65 ImageCache::getInstance().setProgressDisplay(this);
66 wxConfigBase* config = wxConfigBase::Get();
67
68 // create splitter window
69 m_mainSplitter = XRCCTRL(*this, "toolbox_splitter", wxSplitterWindow);
70 // create log window
71 m_logPanel = new MyExecPanel(this);
72 wxXmlResource::Get()->AttachUnknownControl("toolbox_logpanel", m_logPanel, this);
73 // create main notebook
74 m_mainNotebook = XRCCTRL(*this, "toolbox_notebook", wxNotebook);
81 m_mainNotebook->AddPage(m_enfusePanel, _("Enfuse"));
82 m_mainNotebook->AddPage(m_stackerPanel, _("Stacker"));
83 m_mainNotebook->AddPage(m_perspectivePanel, _("Perspective"));
84 m_mainNotebook->SetSelection(config->ReadLong("/ToolboxFrame/ActiveTab", 0l));
85 // load frame size and position
86 hugin_utils::RestoreFramePosition(this, "ToolboxFrame/MainWindow");
87 Layout();
88 if (config->HasEntry("/ToolboxFrame/Main_Splitter"))
89 {
90 m_mainSplitter->SetSashPosition(config->ReadLong("/ToolboxFrame/Main_Splitter", 500));
91 };
92 // bind event handler
93 Bind(wxEVT_MENU, &ToolboxFrame::OnExit, this, XRCID("toolbox_close"));
95}
96
98{
99 // store positions/size/settings
100 hugin_utils::StoreFramePosition(this, "ToolboxFrame/MainWindow");
101 wxConfigBase* config = wxConfigBase::Get();
102 config->Write("/ToolboxFrame/Main_Splitter", m_mainSplitter->GetSashPosition());
103 config->Write("/ToolboxFrame/ActiveTab", m_mainNotebook->GetSelection());
104}
105
107{
108 return wxGetApp().GetXRCPath();
109}
110
112{
113 return m_hasMonitorProfile;
114}
115
120
121void ToolboxFrame::OnExit(wxCommandEvent &e)
122{
123 Close();
124}
125
127{
128 // update progress messages in status bar
130 if (!m_message.empty())
131 {
133 if (!m_filename.empty())
134 {
135 msg.Append(" ");
136 msg.Append(wxString(ProgressDisplay::m_filename.c_str(), HUGIN_CONV_FILENAME));
137 };
138 };
139 GetStatusBar()->SetStatusText(msg, 0);
140}
141
142void ToolboxFrame::OnQueueProgress(wxCommandEvent& e)
143{
144 if (e.GetInt() == -1)
145 {
146 // notify children about finished process to update their controls
147 if (m_mainNotebook->GetSelection() == 0)
148 {
150 }
151 else
152 {
153 if (m_mainNotebook->GetSelection() == 1)
154 {
156 }
157 else
158 {
159 if (m_mainNotebook->GetSelection() == 2)
160 {
162 };
163 };
164 };
165 };
166}
Definition of dialog class to create brighter/darker versions of the image.
declaration of panel for enfuse GUI
declaration of panel for perspective correction GUI
declaration of panel for stacker GUI
declaration of main frame class for toolbox GUI
panel for enfuse GUI
Definition EnfusePanel.h:39
bool Create(wxWindow *parent, MyExecPanel *logPanel)
creates the control and populates all controls with their settings
void OnProcessFinished(wxCommandEvent &e)
call at the end of the enfuse command, to load result back and enable buttons again
panel for enfuse GUI
bool Create(wxWindow *parent, MyExecPanel *logWindow)
create the panel and populate all controls
void OnProcessFinished(wxCommandEvent &e)
clean up temporary files at end
panel for stacker GUI
void OnProcessFinished(wxCommandEvent &e)
call at the end of the enfuse command, to load result back and enable buttons again
bool Create(wxWindow *parent, MyExecPanel *logPanel)
creates the control and populates all controls with their settings
void OnExit(wxCommandEvent &e)
ToolboxFrame(wxWindow *parent)
constructor
wxNotebook * m_mainNotebook
PerspectivePanel * m_perspectivePanel
wxSplitterWindow * m_mainSplitter
const wxString & GetXRCPath() const
get the path to the xrc directory
void OnQueueProgress(wxCommandEvent &e)
StackerPanel * m_stackerPanel
cmsHPROFILE m_monitorProfile
monitor profile
virtual ~ToolboxFrame()
destructor
cmsHPROFILE GetMonitorProfile() const
EnfusePanel * m_enfusePanel
bool m_hasMonitorProfile
true, if we found a real monitor profile
void updateProgressDisplay()
called when a progress message should be displayed
bool HasMonitorProfile() const
MyExecPanel * m_logPanel
implementation of huginApp Class
#define HUGIN_CONV_FILENAME
Definition platform.h:40
void GetMonitorProfile(wxString &profileName, cmsHPROFILE &profile)
retrieve monitor profile from system
Definition wxcms.cpp:201
void StoreFramePosition(wxTopLevelWindow *frame, const wxString &basename, const bool ignoreMaximize)
Definition wxutils.cpp:106
void RestoreFramePosition(wxTopLevelWindow *frame, const wxString &basename, const bool ignoreMaximize)
Definition wxutils.cpp:67
std::vector< deghosting::BImagePtr > threshold(const std::vector< deghosting::FImagePtr > &inputImages, const double threshold, const uint16_t flags)
Threshold function used for creating alpha masks for images.
Definition threshold.h:41