32#include <wx/settings.h>
36 const wxString& aPath ) :
48 int height = aTemplateWidget->GetBestSize().GetHeight();
78 SetBackgroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_BTNHIGHLIGHT ) );
86 SetBackgroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_BTNFACE ) );
113 for(
size_t i = 0; i <
m_notebook->GetPageCount(); i++ )
118 const int h_margin = 10;
119 const int v_margin = 22;
121 int max_width =
m_notebook->GetClientSize().GetWidth() - h_margin;
122 int min_height =
m_panels[i]->GetMinHeight() + v_margin;
123 m_panels[i]->SetSize( max_width, std::max(
m_panels[i]->GetSize().GetY(), min_height ) );
124 m_panels[i]->SetMinSize( wxSize( -1, min_height ) );
135 int page =
event.GetSelection();
137 if( page != wxNOT_FOUND && (
unsigned)page <
m_panels.size() )
172 m_panels[aPage]->AddTemplateWidget( w );
186 wxNotebookPage* newPage =
new wxNotebookPage(
m_notebook, wxID_ANY );
189 wxString
path = aPath.GetFullPath();
205 const int margin = 50;
208 if(
m_notebook->GetMinClientSize().GetHeight() < min_height )
209 m_notebook->SetMinClientSize( wxSize( -1, min_height ) );
218 if( dir.Open( aPath ) )
220 if( dir.HasSubDirs(
"meta" ) )
229 bool cont = dir.GetFirst( &sub_name, wxEmptyString, wxDIR_DIRS );
233 wxString sub_full = aPath + sub_name;
235 if( sub_dir.Open( sub_full ) )
238 cont = dir.GetNext( &sub_name );
253 wxString currPath = fn.GetFullPath();
255 wxDirDialog dirDialog(
this,
_(
"Select Templates Directory" ), currPath,
256 wxDD_DEFAULT_STYLE | wxDD_DIR_MUST_EXIST );
258 if( dirDialog.ShowModal() != wxID_OK )
261 wxFileName dirName = wxFileName::DirName( dirDialog.GetPath() );
282 currPath = fn.GetFullPath();
297 wxString title =
m_notebook->GetPageText( page );
302 wxNotebookPage* newPage =
new wxNotebookPage(
m_notebook, wxID_ANY );
305 m_notebook->InsertPage( page, newPage, title,
true );
316 wxString url =
event.GetLinkInfo().GetHref();
317 wxLaunchDefaultBrowser( url );
wxBitmapBundle KiBitmapBundle(BITMAPS aBitmap)
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)
void OnPageChange(wxNotebookEvent &event) override
void AddTemplatesPage(const wxString &aTitle, wxFileName &aPath)
Add a new page with aTitle, populated with templates from aPath.
void onReload(wxCommandEvent &event) override
void SetHtml(const wxFileName &aFilename)
TEMPLATE_WIDGET * m_selectedWidget
void onDirectoryBrowseClicked(wxCommandEvent &event) override
void onNotebookResize(wxSizeEvent &event)
void replaceCurrentPage()
DIALOG_TEMPLATE_SELECTOR(wxWindow *aParent, const wxPoint &aPos, const wxSize &aSize)
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
int m_minHeight
minimal height to show templates (this is the height of the biggest template widget)
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...
std::vector< FAB_LAYER_COLOR > dummy
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().