38 wxXmlResource::Get()->LoadDialog(
this, parent, wxT(
"image_variables_change_dialog"));
40 m_textInput = XRCCTRL(*
this,
"change_variable_text", wxTextCtrl);
41 m_presetsList = XRCCTRL(*
this,
"change_variable_choice", wxChoice);
43 m_textAttrDefault = wxTextAttr(wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOWTEXT));
45 SetExpression(wxConfig::Get()->Read(
"/ChangeImageVariablesDialog/LastExpression", wxEmptyString));
49 if (!filename.FileExists())
52 if (globalFilename.FileExists())
54 wxCopyFile(globalFilename.GetFullPath(), filename.GetFullPath());
57 m_presets =
new wxFileConfig(wxEmptyString, wxEmptyString, filename.GetFullPath());
60 if (
m_presets->GetFirstGroup(name, index))
63 while (
m_presets->GetNextGroup(name, index))
100 return std::string(
m_textInput->GetValue().mb_str(wxConvLocal));
105 wxConfigBase* config = wxConfig::Get();
106 config->Write(
"/ChangeImageVariablesDialog/LastExpression",
m_textInput->GetValue());
134 wxTextEntryDialog dlg(
this, _(
"Input name for new preset"), _(
"Save preset"));
135 if (dlg.ShowModal() == wxID_OK)
137 wxString s = dlg.GetValue();
139 s.Replace(
"/",
"_",
true);
140 s = s.Trim(
true).Trim(
false);
146 bool newPreset =
true;
149 if (wxMessageBox(wxString::Format(_(
"Preset with name \"%s\" already exists.\nShould this preset be overwritten?"), s),
155 wxYES_NO | wxYES_DEFAULT | wxICON_WARNING) == wxNO)
194 std::ostringstream status, error;
197 if (wxXmlResource::Get()->LoadDialog(&dlg,
this,
"log_dialog"))
200 if (error.str().empty())
203 XRCCTRL(dlg,
"log_dialog_text", wxTextCtrl)->SetValue(wxString(status.str().c_str(), wxConvLocal));
204 dlg.SetTitle(_(
"Result of expression parsing"));
209 XRCCTRL(dlg,
"log_dialog_text", wxTextCtrl)->SetValue(wxString(error.str().c_str(), wxConvLocal));
210 dlg.SetTitle(_(
"Errors during expression parsing"));
224 size_t commentStart=-1;
227 for (
size_t i = 0; i <
m_textInput->GetLastPosition(); ++i)
229 const wxString s =
m_textInput->GetRange(i, i + 1);
234 if (newLine && s ==
"#" && commentStart == -1)
242 if (commentStart != -1)
251 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
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
ImageVariablesExpressionDialog(wxWindow *parent, HuginBase::Panorama *pano)
Constructor, read from xrc ressource; restore last uses settings and position.
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.
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