29 #include <wx/stdpaths.h>
30 #include <wx/wfstream.h>
33 #if defined __WXMAC__ && defined MAC_SELF_CONTAINED_BUNDLE
41 wxXmlResource::Get()->LoadDialog(
this, parent,
"change_user_defined_dialog");
43 m_radio_default = XRCCTRL(*
this,
"radio_default_sequence", wxRadioButton);
67 if (userDefinedSequence.IsEmpty())
74 if (index == wxNOT_FOUND)
92 wxConfigBase* config = wxConfigBase::Get();
95 wxDisplaySize(&dx,&dy);
97 int w = config->Read(
"/UserDefinedSequenceDialog/width", -1l);
98 int h = config->Read(
"/UserDefinedSequenceDialog/height", -1l);
101 this->SetClientSize(w,h);
108 int x = config->Read(
"/UserDefinedSequenceDialog/positionX", -1l);
109 int y = config->Read(
"/UserDefinedSequenceDialog/positionY", -1l);
110 if ( y >= 0 && x >= 0 && x < dx && y < dy)
123 wxConfigBase* config=wxConfigBase::Get();
124 wxSize sz = this->GetClientSize();
125 config->Write(
"/UserDefinedSequenceDialog/width", sz.GetWidth());
126 config->Write(
"/UserDefinedSequenceDialog/height", sz.GetHeight());
127 wxPoint ps = this->GetPosition();
128 config->Write(
"/UserDefinedSequenceDialog/positionX", ps.x);
129 config->Write(
"/UserDefinedSequenceDialog/positionY", ps.y);
144 const long id = e.GetSelection();
154 wxFileDialog userOutputDlg(
this, (
m_isAssistantUserDefined ? _(
"Select user defined assistant") : _(
"Select user defined output")),
156 wxFD_OPEN | wxFD_FILE_MUST_EXIST, wxDefaultPosition);
157 if (userOutputDlg.ShowModal() == wxID_OK)
169 if (filename.IsEmpty())
171 hugin_utils::HuginMessageBox(_(
"Please provide a filename to the user defined sequence."), _(
"PTBatcherGUI"), wxOK | wxOK_DEFAULT | wxICON_WARNING,
this);
176 hugin_utils::HuginMessageBox(wxString::Format(_(
"The file \"%s\" does not exists.\nPlease provide an existing file to the user defined sequence."), filename),
177 _(
"PTBatcherGUI"), wxOK | wxOK_DEFAULT | wxICON_WARNING,
this);
188 return wxEmptyString;
198 return wxEmptyString;
207 #if defined __WXMSW__
208 wxFileName exePath(wxStandardPaths::Get().GetExecutablePath());
209 exePath.RemoveLastDir();
210 const wxString huginRoot = exePath.GetPath(wxPATH_GET_VOLUME | wxPATH_GET_SEPARATOR);
211 return huginRoot +
"share\\hugin\\data\\";
212 #elif defined __WXMAC__ && defined MAC_SELF_CONTAINED_BUNDLE
215 wxString thePath = MacGetPathToBundledResourceFile(CFSTR(
"xrc"));
216 if (thePath.IsEmpty())
219 return wxEmptyString;
221 return thePath +
"/";
223 #elif defined UNIX_SELF_CONTAINED_BUNDLE
226 wxFileName exePath(wxStandardPaths::Get().GetExecutablePath());
227 exePath.RemoveLastDir();
228 const wxString huginRoot = exePath.GetPath(wxPATH_GET_VOLUME | wxPATH_GET_SEPARATOR);
229 return huginRoot +
"share/hugin/data/";
233 return INSTALL_DATA_DIR;
241 wxDir::GetAllFiles(
GetDataPath() +
"assistant", &files,
"*.assistant", wxDIR_FILES | wxDIR_HIDDEN | wxDIR_NO_FOLLOW);
250 wxDir::GetAllFiles(
GetDataPath() +
"output", &files,
"*.executor", wxDIR_FILES | wxDIR_HIDDEN | wxDIR_NO_FOLLOW);
257 if (!files.IsEmpty())
259 for (
auto file : files)
262 wxFileInputStream inputStream(file);
263 if (inputStream.IsOk())
266 wxFileConfig executorFile(inputStream);
275 help = wxString::Format(_(
"User defined sequence: %s"), file);
286 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
int HuginMessageBox(const wxString &message, const wxString &caption, int style, wxWindow *parent)
wxRadioButton * m_radio_external
void OnOk(wxCommandEvent &e)