32#include <wx/settings.h>
36 const wxString& aPath ) :
76 SetBackgroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_BTNHIGHLIGHT ) );
84 SetBackgroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_BTNFACE ) );
110 int page =
event.GetSelection();
112 if( page != wxNOT_FOUND && (
unsigned)page <
m_panels.size() )
121 std::map<wxString, wxFileName> aTitleDirMap ) :
131 for(
auto& [title, pathFname] : aTitleDirMap )
134 wxString
path = pathFname.GetFullPath();
166 m_panels[aPage]->AddTemplateWidget( w );
181 if( dir.Open( aPath ) )
183 if( dir.HasSubDirs(
"meta" ) )
190 wxArrayString subdirs;
192 bool cont = dir.GetFirst( &sub_name, wxEmptyString, wxDIR_DIRS );
196 subdirs.Add( wxString( sub_name ) );
197 cont = dir.GetNext( &sub_name );
200 if( !subdirs.IsEmpty() )
203 for(
const wxString& dir_name : subdirs )
206 wxString sub_full = aPath + dir_name;
208 if( sub_dir.Open( sub_full ) )
223 wxString currPath = fn.GetFullPath();
225 wxDirDialog dirDialog(
this,
_(
"Select Templates Directory" ), currPath,
226 wxDD_DEFAULT_STYLE | wxDD_DIR_MUST_EXIST );
228 if( dirDialog.ShowModal() != wxID_OK )
231 wxFileName dirName = wxFileName::DirName( dirDialog.GetPath() );
252 currPath = fn.GetFullPath();
267 wxString title =
m_notebook->GetPageText( page );
274 m_notebook->InsertPage( page, tpanel, title,
true );
286 wxString url =
event.GetLinkInfo().GetHref();
287 wxLaunchDefaultBrowser( url );
wxBitmapBundle KiBitmapBundle(BITMAPS aBitmap)
void finishDialogSettings()
In all dialogs, we must call the same functions to fix minimal dlg size, the default position and per...
Class DIALOG_TEMPLATE_SELECTOR_BASE.
STD_BITMAP_BUTTON * m_browseButton
wxTextCtrl * m_tcTemplatePath
STD_BITMAP_BUTTON * m_reloadButton
void AddTemplate(int aPage, PROJECT_TEMPLATE *aTemplate)
DIALOG_TEMPLATE_SELECTOR(wxWindow *aParent, const wxPoint &aPos, const wxSize &aSize, std::map< wxString, wxFileName > aTitleDirMap)
void OnPageChange(wxNotebookEvent &event) override
void onReload(wxCommandEvent &event) override
void SetHtml(const wxFileName &aFilename)
TEMPLATE_WIDGET * m_selectedWidget
void onDirectoryBrowseClicked(wxCommandEvent &event) override
void replaceCurrentPage()
PROJECT_TEMPLATE * GetSelectedTemplate()
void SetWidget(TEMPLATE_WIDGET *aWidget)
void buildPageContent(const wxString &aPath, int aPage)
void OnHtmlLinkActivated(wxHtmlLinkEvent &event) override
std::vector< TEMPLATE_SELECTION_PANEL * > m_panels
bool SetPage(const wxString &aSource) override
A class which provides project template functionality.
wxBitmap * GetIcon()
Get the 64px^2 icon for the project template.
wxFileName GetHtmlFile()
Get the full Html filename for the project template.
wxString * GetTitle()
Get the title of the project (extracted from the html title tag)
Class TEMPLATE_SELECTION_PANEL_BASE.
wxBoxSizer * m_SizerChoice
TEMPLATE_SELECTION_PANEL(wxNotebookPage *aParent, const wxString &aPath)
wxString m_templatesPath
the path to access to the folder containing the templates (which are also folders)
void AddTemplateWidget(TEMPLATE_WIDGET *aTemplateWidget)
wxNotebookPage * m_parent
KICOMMON_API wxFont GetInfoFont(wxWindow *aWindow)
void Refresh()
Update the board display after modifying it by a python script (note: it is automatically called by a...
Functions to provide common constants and other functions to assist in making a consistent UI.
#define FN_NORMALIZE_FLAGS
Default flags to pass to wxFileName::Normalize().