47 wxXmlResource::Get()->LoadDialog(
this, parent, wxT(
"image_variables_change_dialog"));
50 wxIconBundle myIcons(
huginApp::Get()->GetXRCPath() + wxT(
"data/hugin.ico"),wxBITMAP_TYPE_ICO);
53 wxIcon myIcon(
huginApp::Get()->GetXRCPath() + wxT(
"data/hugin.png"),wxBITMAP_TYPE_PNG);
56 m_textInput = XRCCTRL(*
this,
"change_variable_text", wxTextCtrl);
57 m_presetsList = XRCCTRL(*
this,
"change_variable_choice", wxChoice);
58 m_textAttrInactive = wxTextAttr(wxSystemSettings::GetColour(wxSYS_COLOUR_GRAYTEXT));
59 m_textAttrDefault = wxTextAttr(wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOWTEXT));
61 SetExpression(wxConfig::Get()->Read(
"/ChangeImageVariablesDialog/LastExpression", wxEmptyString));
65 if (!filename.FileExists())
68 if (globalFilename.FileExists())
70 wxCopyFile(globalFilename.GetFullPath(), filename.GetFullPath());
73 m_presets =
new wxFileConfig(wxEmptyString, wxEmptyString, filename.GetFullPath());
76 if (m_presets->GetFirstGroup(name, index))
78 m_presetsList->AppendString(name);
79 while (m_presets->GetNextGroup(name, index))
81 m_presetsList->AppendString(name);
104 wxCommandEvent dummy;
110 return std::string(
m_textInput->GetValue().mb_str(wxConvLocal));
115 wxConfigBase* config = wxConfig::Get();
116 config->Write(
"/ChangeImageVariablesDialog/LastExpression",
m_textInput->GetValue());
144 wxTextEntryDialog dlg(
this, _(
"Input name for new preset"), _(
"Save preset"));
145 if (dlg.ShowModal() == wxID_OK)
147 wxString s = dlg.GetValue();
149 s.Replace(
"/",
"_",
true);
150 s = s.Trim(
true).Trim(
false);
156 bool newPreset =
true;
159 if (wxMessageBox(wxString::Format(_(
"Preset with name \"%s\" already exists.\nShould this preset be overwritten?"), s),
165 wxYES_NO | wxYES_DEFAULT | wxICON_WARNING) == wxNO)
203 std::ostringstream status, error;
206 if (wxXmlResource::Get()->LoadDialog(&dlg,
this,
"log_dialog"))
209 if (error.str().empty())
212 XRCCTRL(dlg,
"log_dialog_text", wxTextCtrl)->SetValue(wxString(status.str().c_str(), wxConvLocal));
213 dlg.SetTitle(_(
"Result of expression parsing"));
218 XRCCTRL(dlg,
"log_dialog_text", wxTextCtrl)->SetValue(wxString(error.str().c_str(), wxConvLocal));
219 dlg.SetTitle(_(
"Errors during expression parsing"));
233 size_t commentStart=-1;
236 for (
size_t i = 0; i <
m_textInput->GetLastPosition(); ++i)
238 const wxString s =
m_textInput->GetRange(i, i + 1);
243 if (newLine && s ==
"#" && commentStart == -1)
251 if (commentStart != -1)
260 if (commentStart != -1)
void OnOk(wxCommandEvent &e)
Saves current expression when closing dialog with Ok.
void OnLoad(wxCommandEvent &e)
loads the selected preset into control
include file for the hugin project
static huginApp * Get()
hack.. kind of a pseudo singleton...
Panorama duplicate() const
duplicate the panorama
IMPEX void PanoParseExpression(HuginBase::Panorama &pano, const std::string &expression, std::ostream &statusStream=std::cout, std::ostream &errorStream=std::cerr)
parses the given expression and apply the changes to the Panorama
std::string GetDataDir()
returns the full path to the data directory
void OnTextChange(wxCommandEvent &e)
text change event, used to format text
~ImageVariablesExpressionDialog()
destructor, saves position
std::string GetExpression()
void StoreFramePosition(wxTopLevelWindow *frame, const wxString &basename)
Store window size and position in configfile/registry.
void SetExpression(const wxString &s)
Definition of dialog to edit image variables by parsing an expression.
void RestoreFramePosition(wxTopLevelWindow *frame, const wxString &basename)
Restore window size and position from configfile/registry.
Dialog for editing expression to change image variables.
void OnDelete(wxCommandEvent &e)
deletes the seletected preset
void OnSave(wxCommandEvent &e)
saves the current expression as preset
std::string GetUserAppDataDir()
returns the directory for user specific Hugin settings, e.g.
wxTextAttr m_textAttrInactive
HuginBase::Panorama * m_pano
void OnTest(wxCommandEvent &e)
tests the current expression
wxTextAttr m_textAttrDefault
function to parse expressions from strings