29 #include <wx/stdpaths.h>
30 #include <wx/wfstream.h>
32 #if defined __WXMAC__ && defined MAC_SELF_CONTAINED_BUNDLE
40 wxXmlResource::Get()->LoadDialog(
this, parent,
"change_user_defined_dialog");
42 m_radio_default = XRCCTRL(*
this,
"radio_default_sequence", wxRadioButton);
66 if (userDefinedSequence.IsEmpty())
73 if (index == wxNOT_FOUND)
91 wxConfigBase* config = wxConfigBase::Get();
94 wxDisplaySize(&dx,&dy);
96 int w = config->Read(
"/UserDefinedSequenceDialog/width", -1l);
97 int h = config->Read(
"/UserDefinedSequenceDialog/height", -1l);
100 this->SetClientSize(w,h);
107 int x = config->Read(
"/UserDefinedSequenceDialog/positionX", -1l);
108 int y = config->Read(
"/UserDefinedSequenceDialog/positionY", -1l);
109 if ( y >= 0 && x >= 0 && x < dx && y < dy)
122 wxConfigBase* config=wxConfigBase::Get();
123 wxSize sz = this->GetClientSize();
124 config->Write(
"/UserDefinedSequenceDialog/width", sz.GetWidth());
125 config->Write(
"/UserDefinedSequenceDialog/height", sz.GetHeight());
126 wxPoint ps = this->GetPosition();
127 config->Write(
"/UserDefinedSequenceDialog/positionX", ps.x);
128 config->Write(
"/UserDefinedSequenceDialog/positionY", ps.y);
143 const long id = e.GetSelection();
153 wxFileDialog userOutputDlg(
this, (
m_isAssistantUserDefined ? _(
"Select user defined assistant") : _(
"Select user defined output")),
155 wxFD_OPEN | wxFD_FILE_MUST_EXIST, wxDefaultPosition);
156 if (userOutputDlg.ShowModal() == wxID_OK)
168 if (filename.IsEmpty())
170 wxMessageBox(_(
"Please provide a filename to the user defined sequence."),
176 wxOK | wxOK_DEFAULT | wxICON_WARNING);
181 wxMessageBox(wxString::Format(_(
"The file \"%s\" does not exists.\nPlease provide an existing file to the user defined sequence."), filename.c_str()),
187 wxOK | wxOK_DEFAULT | wxICON_WARNING);
198 return wxEmptyString;
208 return wxEmptyString;
217 #if defined __WXMSW__
218 wxFileName exePath(wxStandardPaths::Get().GetExecutablePath());
219 exePath.RemoveLastDir();
220 const wxString huginRoot = exePath.GetPath(wxPATH_GET_VOLUME | wxPATH_GET_SEPARATOR);
221 return huginRoot +
"share\\hugin\\data\\";
222 #elif defined __WXMAC__ && defined MAC_SELF_CONTAINED_BUNDLE
225 wxString thePath = MacGetPathToBundledResourceFile(CFSTR(
"xrc"));
226 if (thePath.IsEmpty())
228 wxMessageBox(_(
"xrc directory not found in bundle"), _(
"Fatal Error"));
229 return wxEmptyString;
231 return thePath +
"/";
233 #elif defined UNIX_SELF_CONTAINED_BUNDLE
236 wxFileName exePath(wxStandardPaths::Get().GetExecutablePath());
237 exePath.RemoveLastDir();
238 const wxString huginRoot = exePath.GetPath(wxPATH_GET_VOLUME | wxPATH_GET_SEPARATOR);
239 return huginRoot +
"share/hugin/data/";
243 return INSTALL_DATA_DIR;
251 wxDir::GetAllFiles(
GetDataPath() +
"assistant", &files,
"*.assistant", wxDIR_FILES | wxDIR_HIDDEN | wxDIR_NO_FOLLOW);
260 wxDir::GetAllFiles(
GetDataPath() +
"output", &files,
"*.executor", wxDIR_FILES | wxDIR_HIDDEN | wxDIR_NO_FOLLOW);
267 if (!files.IsEmpty())
269 for (
auto file : files)
272 wxFileInputStream inputStream(file);
273 if (inputStream.IsOk())
276 wxFileConfig executorFile(inputStream);
285 help = wxString::Format(_(
"User defined sequence: %s"), file);
296 wxCommandEvent dummy;
bool FileExists(const std::string &filename)
checks if file exists
wxRadioButton * m_radio_user_sequence
wxString GetDataPath()
return path to data directory, it depends on operating system
wxArrayString m_userHelpTexts
wxTextCtrl * m_text_external_file
void OnChangeUserDefinedChoice(wxCommandEvent &e)
wxString GetNewSequence()
returns the newly selected sequence
bool m_isAssistantUserDefined
~ChangeUserDefinedSequenceDialog()
destructor, saves size and position
basic classes and function for queuing commands in wxWidgets
void FillUserDefinedChoice(const wxArrayString &files)
void UpdateStatus(wxCommandEvent &e)
void FillStitcherUserDefined()
wxRadioButton * m_radio_default
ChangeUserDefinedSequenceDialog(wxWindow *parent, wxString xrcPrefix, wxString userDefinedSequence, bool assistantUserDefined)
Constructor, read from xrc ressource; restore last uses size and position.
wxStaticText * m_label_user_define
wxArrayString m_userFileNames
const wxString GetSettingStringTranslated(wxConfigBase *setting, const wxString &name, const wxString defaultValue)
read a translated string from settings and remove all whitespaces
wxButton * m_button_external_file
std::string GetUserAppDataDir()
returns the directory for user specific Hugin settings, e.g.
void OnChooseFilename(wxCommandEvent &e)
void FillAssistantUserDefined()
wxStaticText * m_label_user_define_filename
wxChoice * m_choice_user_define
wxRadioButton * m_radio_external
void OnOk(wxCommandEvent &e)