23#include <wx/aui/auibook.h>
26#include <wx/checkbox.h>
34#include <wx/filedlg.h>
60 SetTitle( wxString::Format(
_(
"%s Destination" ),
85 bool isFolder =
false;
86 wxString fileWildcard =
"";
100 fn.AssignDir( current );
102 wxString currPath = fn.GetFullPath();
104 wxDirDialog dirDialog(
this,
_(
"Select output directory" ), currPath,
105 wxDD_DEFAULT_STYLE );
107 if( dirDialog.ShowModal() != wxID_OK )
110 wxString
path = wxFileName::DirName( dirDialog.GetPath() ).GetFullPath();
115 if( shortPath ==
path && parentPath !=
path
116 &&
IsOK(
this, wxString::Format(
_(
"Do you want to use a path relative to\n'%s'?" ), projectPath ) ) )
118 shortPath = parentPath;
125 wxFileName fname( current );
126 fname.MakeAbsolute( projectPath );
129 wxFileDialog dlg(
this,
_(
"Select output path" ), fname.GetPath(), fname.GetFullName(),
131 wxFD_OVERWRITE_PROMPT | wxFD_SAVE );
133 if( !projectPath.IsEmpty() )
134 dlg.SetCustomizeHook( customize );
138 if( dlg.ShowModal() != wxID_OK )
141 wxString
path = dlg.GetPath();
145 wxFileName fn(
path );
147 if( fn.GetExt().IsEmpty() )
150 path = fn.GetFullPath();
164 for(
size_t idx = 0; idx <
m_includeJobs->GetCount(); ++idx )
175 int clickedIndex =
event.GetInt();
177 bool newCheckedState =
m_includeJobs->IsChecked( clickedIndex );
179 wxArrayInt currentSelections;
182 for(
size_t i = 0; i < currentSelections.GetCount(); i++ )
184 m_includeJobs->Check( currentSelections[i], newCheckedState );
195 if( outputPath.IsEmpty() )
201 wxArrayInt selectedItems;
209 for(
int i : selectedItems )
237 wxArrayString arrayStr;
238 std::vector<int> selectedList;
242 arrayStr.Add( wxString::Format( wxT(
"%d. %s" ),
243 (
int) arrayStr.size() + 1,
244 job.GetDescription() ) );
247 [&](
const wxString& only )
249 if( only == job.m_id )
256 selectedList.emplace_back( arrayStr.size() - 1 );
258 m_onlyMap.emplace( arrayStr.size() - 1, job.m_id );
261 if( arrayStr.size() != 0 )
265 if( selectedList.size() )
267 for(
int idx : selectedList )
272 for(
size_t idx = 0; idx <
m_includeJobs->GetCount(); ++idx )
wxBitmapBundle KiBitmapBundle(BITMAPS aBitmap, int aMinHeight)
wxButton * m_buttonDeselectAll
wxStaticText * m_textArchiveFormat
wxCheckListBox * m_includeJobs
wxChoice * m_choiceArchiveformat
STD_BITMAP_BUTTON * m_buttonOutputPath
wxTextCtrl * m_textCtrlOutputPath
wxTextCtrl * m_textCtrlDescription
DIALOG_DESTINATION_BASE(wxWindow *parent, wxWindowID id=wxID_ANY, const wxString &title=_("%s Destination"), const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxSize(-1,-1), long style=wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER)
DIALOG_DESTINATION(wxWindow *aParent, JOBSET *aJobsFile, JOBSET_DESTINATION *aDestination)
std::map< int, wxString > m_onlyMap
bool TransferDataToWindow() override
void onIncludeJobsCheck(wxCommandEvent &event)
bool TransferDataFromWindow() override
virtual void onOutputPathBrowseClicked(wxCommandEvent &event) override
void onDeselectAllClicked(wxCommandEvent &event)
JOBSET_DESTINATION * m_destination
void SetupStandardButtons(std::map< int, wxString > aLabels={})
Add a sticky "Use relative path" checkbox to a file dialog.
bool GetUseRelativePath() const
void SetFormat(FORMAT format)
PROJECT & Prj() const
Return a reference to the PROJECT associated with this KIWAY.
virtual const wxString GetProjectPath() const
Return the full path of the project.
const wxString ExpandEnvVarSubstitutions(const wxString &aString, const PROJECT *aProject, bool aAllowEscapes)
Replace any environment variable & text variable references with their values.
wxString ExpandTextVars(const wxString &aSource, const PROJECT *aProject, RESOLUTION_CONTEXT aContext)
bool IsOK(wxWindow *aParent, const wxString &aMessage)
Display a yes/no dialog with aMessage and returns the user response.
void DisplayErrorMessage(wxWindow *aParent, const wxString &aText, const wxString &aExtraInfo)
Display an error message with aMessage.
This file is part of the common library.
wxString MakeRelativePath(const wxString &aPath, const wxString &aBaseDir)
Express an absolute path relative to a base directory, stepping out with ".." when needed.
wxString NormalizePathForProject(const wxString &aPath, const ENV_VAR_MAP *aEnvVars, const wxString &aProjectPath, bool aAllowParentDirs)
Choose how to store a path the user picked for a project.
Helper functions to substitute paths with environmental variables.
static const std::string ArchiveFileExtension
KICOMMON_API std::map< JOBSET_DESTINATION_T, JOBSET_DESTINATION_T_INFO > JobsetDestinationTypeInfos
PGM_BASE & Pgm()
The global program "get" accessor.
Definition of file extensions used in Kicad.
#define FN_NORMALIZE_FLAGS
Default flags to pass to wxFileName::Normalize().