31#include <wx/settings.h>
35 const wxString& aPath ) :
47 int height = aTemplateWidget->GetBestSize().GetHeight();
77 SetBackgroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_BTNHIGHLIGHT ) );
85 SetBackgroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_BTNFACE ) );
112 for(
size_t i = 0; i <
m_notebook->GetPageCount(); i++ )
117 const int h_margin = 10;
118 const int v_margin = 22;
120 int max_width =
m_notebook->GetClientSize().GetWidth() - h_margin;
121 int min_height =
m_panels[i]->GetMinHeight() + v_margin;
122 m_panels[i]->SetSize( max_width, std::max(
m_panels[i]->GetSize().GetY(), min_height ) );
123 m_panels[i]->SetMinSize( wxSize( -1, min_height ) );
134 int page =
event.GetSelection();
136 if( page != wxNOT_FOUND && (
unsigned)page <
m_panels.size() )
171 m_panels[aPage]->AddTemplateWidget( w );
185 wxNotebookPage* newPage =
new wxNotebookPage(
m_notebook, wxID_ANY );
188 wxString
path = aPath.GetFullPath();
204 const int margin = 50;
207 if(
m_notebook->GetMinClientSize().GetHeight() < min_height )
208 m_notebook->SetMinClientSize( wxSize( -1, min_height ) );
217 if( dir.Open( aPath ) )
219 if( dir.HasSubDirs(
"meta" ) )
228 bool cont = dir.GetFirst( &sub_name, wxEmptyString, wxDIR_DIRS );
232 wxString sub_full = aPath + sub_name;
234 if( sub_dir.Open( sub_full ) )
237 cont = dir.GetNext( &sub_name );
252 wxString currPath = fn.GetFullPath();
254 wxDirDialog dirDialog(
this,
_(
"Select Templates Directory" ), currPath,
255 wxDD_DEFAULT_STYLE | wxDD_DIR_MUST_EXIST );
257 if( dirDialog.ShowModal() != wxID_OK )
260 wxFileName dirName = wxFileName::DirName( dirDialog.GetPath() );
281 currPath = fn.GetFullPath();
296 wxString title =
m_notebook->GetPageText( page );
301 wxNotebookPage* newPage =
new wxNotebookPage(
m_notebook, wxID_ANY );
304 m_notebook->InsertPage( page, newPage, title,
true );
315 wxString url =
event.GetLinkInfo().GetHref();
316 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()
PROJECT_TEMPLATE * GetSelectedTemplate()
void SetWidget(TEMPLATE_WIDGET *aWidget)
void buildPageContent(const wxString &aPath, int aPage)
DIALOG_TEMPLATE_SELECTOR(wxWindow *aParent)
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.
wxGridSizer * 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)
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
#define FN_NORMALIZE_FLAGS
Default flags to pass to wxFileName::Normalize().