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#if defined __WXMSW__
68 unsigned long long mem = HUGIN_IMGCACHE_UPPERBOUND;
69 unsigned long mem_low = config->Read("/ImageCache/UpperBound", HUGIN_IMGCACHE_UPPERBOUND);
70 unsigned long mem_high = config->Read("/ImageCache/UpperBoundHigh", (long)0);
71 if (mem_high > 0)
72 {
73 mem = ((unsigned long long) mem_high << 32) + mem_low;
74 }
75 else
76 {
77 mem = mem_low;
78 }
79 ImageCache::getInstance().SetUpperLimit(mem);
80#else
81 ImageCache::getInstance().SetUpperLimit(config->Read("/ImageCache/UpperBound", HUGIN_IMGCACHE_UPPERBOUND));
82#endif
83
84 // create splitter window
85 m_mainSplitter = XRCCTRL(*this, "toolbox_splitter", wxSplitterWindow);
86 // create log window
87 m_logPanel = new MyExecPanel(this);
88 wxXmlResource::Get()->AttachUnknownControl("toolbox_logpanel", m_logPanel, this);
89 // create main notebook
90 m_mainNotebook = XRCCTRL(*this, "toolbox_notebook", wxNotebook);
97 m_mainNotebook->AddPage(m_enfusePanel, _("Enfuse"));
98 m_mainNotebook->AddPage(m_stackerPanel, _("Stacker"));
99 m_mainNotebook->AddPage(m_perspectivePanel, _("Perspective"));
100 m_mainNotebook->SetSelection(config->ReadLong("/ToolboxFrame/ActiveTab", 0l));
101 // load frame size and position
102 hugin_utils::RestoreFramePosition(this, "ToolboxFrame/MainWindow");
103 Layout();
104 if (config->HasEntry("/ToolboxFrame/Main_Splitter"))
105 {
106 m_mainSplitter->SetSashPosition(config->ReadLong("/ToolboxFrame/Main_Splitter", 500));
107 };
108 // bind event handler
109 Bind(wxEVT_MENU, &ToolboxFrame::OnExit, this, XRCID("toolbox_close"));
111}
112
114{
115 // store positions/size/settings
116 hugin_utils::StoreFramePosition(this, "ToolboxFrame/MainWindow");
117 wxConfigBase* config = wxConfigBase::Get();
118 config->Write("/ToolboxFrame/Main_Splitter", m_mainSplitter->GetSashPosition());
119 config->Write("/ToolboxFrame/ActiveTab", m_mainNotebook->GetSelection());
120}
121
123{
124 return wxGetApp().GetXRCPath();
125}
126
128{
129 return m_hasMonitorProfile;
130}
131
136
137void ToolboxFrame::OnExit(wxCommandEvent &e)
138{
139 Close();
140}
141
143{
144 // update progress messages in status bar
146 if (!m_message.empty())
147 {
149 if (!m_filename.empty())
150 {
151 msg.Append(" ");
152 msg.Append(wxString(ProgressDisplay::m_filename.c_str(), HUGIN_CONV_FILENAME));
153 };
154 };
155 GetStatusBar()->SetStatusText(msg, 0);
156}
157
158void ToolboxFrame::OnQueueProgress(wxCommandEvent& e)
159{
160 if (e.GetInt() == -1)
161 {
162 // notify children about finished process to update their controls
163 if (m_mainNotebook->GetSelection() == 0)
164 {
166 }
167 else
168 {
169 if (m_mainNotebook->GetSelection() == 1)
170 {
172 }
173 else
174 {
175 if (m_mainNotebook->GetSelection() == 2)
176 {
178 };
179 };
180 };
181 };
182}
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:38
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
#define HUGIN_IMGCACHE_UPPERBOUND
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