38 wxXmlResource::Get()->LoadDialog(
this, parent, wxT(
"image_variables_change_dialog"));
41 wxIconBundle myIcons(
huginApp::Get()->GetXRCPath() + wxT(
"data/hugin.ico"),wxBITMAP_TYPE_ICO);
44 wxIcon myIcon(
huginApp::Get()->GetXRCPath() + wxT(
"data/hugin.png"),wxBITMAP_TYPE_PNG);
47 m_textInput = XRCCTRL(*
this,
"change_variable_text", wxTextCtrl);
48 m_presetsList = XRCCTRL(*
this,
"change_variable_choice", wxChoice);
50 m_textAttrDefault = wxTextAttr(wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOWTEXT));
52 SetExpression(wxConfig::Get()->Read(
"/ChangeImageVariablesDialog/LastExpression", wxEmptyString));
56 if (!filename.FileExists())
59 if (globalFilename.FileExists())
61 wxCopyFile(globalFilename.GetFullPath(), filename.GetFullPath());
64 m_presets =
new wxFileConfig(wxEmptyString, wxEmptyString, filename.GetFullPath());
67 if (
m_presets->GetFirstGroup(name, index))
70 while (
m_presets->GetNextGroup(name, index))
101 wxCommandEvent dummy;
107 return std::string(
m_textInput->GetValue().mb_str(wxConvLocal));
112 wxConfigBase* config = wxConfig::Get();
113 config->Write(
"/ChangeImageVariablesDialog/LastExpression",
m_textInput->GetValue());
141 wxTextEntryDialog dlg(
this, _(
"Input name for new preset"), _(
"Save preset"));
142 if (dlg.ShowModal() == wxID_OK)
144 wxString s = dlg.GetValue();
146 s.Replace(
"/",
"_",
true);
147 s = s.Trim(
true).Trim(
false);
153 bool newPreset =
true;
156 if (wxMessageBox(wxString::Format(_(
"Preset with name \"%s\" already exists.\nShould this preset be overwritten?"), s),
162 wxYES_NO | wxYES_DEFAULT | wxICON_WARNING) == wxNO)
201 std::ostringstream status, error;
204 if (wxXmlResource::Get()->LoadDialog(&dlg,
this,
"log_dialog"))
207 if (error.str().empty())
210 XRCCTRL(dlg,
"log_dialog_text", wxTextCtrl)->SetValue(wxString(status.str().c_str(), wxConvLocal));
211 dlg.SetTitle(_(
"Result of expression parsing"));
216 XRCCTRL(dlg,
"log_dialog_text", wxTextCtrl)->SetValue(wxString(error.str().c_str(), wxConvLocal));
217 dlg.SetTitle(_(
"Errors during expression parsing"));
231 size_t commentStart=-1;
234 for (
size_t i = 0; i <
m_textInput->GetLastPosition(); ++i)
236 const wxString s =
m_textInput->GetRange(i, i + 1);
241 if (newLine && s ==
"#" && commentStart == -1)
249 if (commentStart != -1)
258 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
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