Commit 9823666c authored by Brian Sidebotham's avatar Brian Sidebotham Committed by jean-pierre charras

Commit patch from Brian Sidebotham: Project template in Kicad manager

parent 621a43c4
......@@ -108,10 +108,16 @@ if(CMAKE_COMPILER_IS_GNUCXX)
# conversion in the Boost polygon library. At some point in the future when
# Boost is updated to the next version, -Wno-narrowing should be removed to
# see if the problem has been resolved. Wayne.
#
# Also note the optimization level is -O1 instead of the usual -O2 level
# because boost::polygon has a function (inflate polygon) broken by
# the -O2 level with GCC 4.7 (works fine with with GCC 4.6).
# This lower optimization level does not have a significant change on the speed.
#
if(WIN32) # under Windows/mingw, -fPIC option is enabled by default
# Set default flags for Release build.
set(CMAKE_C_FLAGS_RELEASE "-Wall -Wno-narrowing -O2 -DNDEBUG")
set(CMAKE_CXX_FLAGS_RELEASE "-Wall -Wno-narrowing -O2 -DNDEBUG")
set(CMAKE_C_FLAGS_RELEASE "-Wall -Wno-narrowing -O1 -DNDEBUG")
set(CMAKE_CXX_FLAGS_RELEASE "-Wall -Wno-narrowing -O1 -DNDEBUG")
set(CMAKE_EXE_LINKER_FLAGS_RELEASE "-s")
# Set default flags for Debug build.
......@@ -119,8 +125,8 @@ if(CMAKE_COMPILER_IS_GNUCXX)
set(CMAKE_CXX_FLAGS_DEBUG "-Wall -Wno-narrowing -g3 -ggdb3 -DDEBUG")
else(WIN32)
# Set default flags for Release build.
set(CMAKE_C_FLAGS_RELEASE "-Wall -O2 -DNDEBUG -fPIC")
set(CMAKE_CXX_FLAGS_RELEASE "-Wall -O2 -DNDEBUG -fPIC")
set(CMAKE_C_FLAGS_RELEASE "-Wall -O1 -DNDEBUG -fPIC")
set(CMAKE_CXX_FLAGS_RELEASE "-Wall -O1 -DNDEBUG -fPIC")
set(CMAKE_EXE_LINKER_FLAGS_RELEASE "-s")
# Set default flags for Debug build.
......
......@@ -395,6 +395,7 @@ set( BMAPS_MID
new_library
new_pcb
new_project
new_project_with_template
new_sch
new_txt
new
......
......@@ -13,7 +13,7 @@
version="1.1"
viewBox="0 0 48 48"
id="svg2"
inkscape:version="0.47 r22583"
inkscape:version="0.48.1 "
sodipodi:docname="new_project.svg">
<metadata
id="metadata153">
......@@ -36,14 +36,14 @@
inkscape:pageopacity="0"
inkscape:pageshadow="2"
inkscape:window-width="1280"
inkscape:window-height="949"
inkscape:window-height="968"
id="namedview151"
showgrid="false"
inkscape:zoom="4.9166667"
inkscape:zoom="12.783333"
inkscape:cx="24"
inkscape:cy="23.59322"
inkscape:window-x="0"
inkscape:window-y="25"
inkscape:window-x="-4"
inkscape:window-y="-4"
inkscape:window-maximized="1"
inkscape:current-layer="svg2" />
<defs
......@@ -545,22 +545,25 @@
</g>
</g>
<g
transform="matrix(4.1228166,0,0,4.0916513,-12.598545,25.226531)"
transform="matrix(4.1228166,0,0,4.0916513,-14.945351,27.182202)"
id="g78">
<path
style="fill:#afaf00"
d="M 12,5.5 9.4826,4.1505 6.9438,5.4592 7.4494,2.648 5.4202,0.6379 8.25,0.25 9.5347,-2.301 10.778,0.2704 13.601,0.70392 11.54,2.68102 z"
transform="matrix(0.86499,0,0,0.86499,3.3638,-4.5167)"
id="path80" />
id="path80"
inkscape:connector-curvature="0" />
<path
style="fill:#ebeb00"
d="M 12,5.5 9.4826,4.1505 6.9438,5.4592 7.4494,2.648 5.4202,0.6379 8.25,0.25 9.5347,-2.301 10.778,0.2704 13.601,0.70392 11.54,2.68102 z"
transform="matrix(0.61624,0,0,0.61624,5.7296,-4.1188)"
id="path82" />
id="path82"
inkscape:connector-curvature="0" />
<path
style="fill:#ffff00"
d="M 12,5.5 9.4826,4.1505 6.9438,5.4592 7.4494,2.648 5.4202,0.6379 8.25,0.25 9.5347,-2.301 10.778,0.2704 13.601,0.70392 11.54,2.68102 z"
transform="matrix(0.3815,0,0,0.3815,7.9622,-3.7434)"
id="path84" />
id="path84"
inkscape:connector-curvature="0" />
</g>
</svg>
This diff is collapsed.
......@@ -53,7 +53,6 @@ enum id_eeschema_frm
{
ID_UPDATE_ONE_SHEET = ID_END_LIST,
ID_SAVE_ONE_SHEET_UNDER_NEW_NAME,
ID_LOAD_ONE_SHEET,
/* Schematic editor horizontal toolbar IDs */
ID_HIERARCHY,
......
......@@ -319,6 +319,7 @@ EXTERN_BITMAP( new_gerb_xpm )
EXTERN_BITMAP( new_library_xpm )
EXTERN_BITMAP( new_pcb_xpm )
EXTERN_BITMAP( new_project_xpm )
EXTERN_BITMAP( new_project_with_template_xpm )
EXTERN_BITMAP( new_python_xpm )
EXTERN_BITMAP( new_sch_xpm )
EXTERN_BITMAP( new_txt_xpm )
......
......@@ -48,6 +48,7 @@ enum main_id
ID_TO_CVPCB,
ID_LOAD_PROJECT,
ID_NEW_PROJECT,
ID_NEW_PROJECT_FROM_TEMPLATE,
ID_SAVE_PROJECT,
ID_SAVE_PROJECT_AS,
ID_LOAD_FILE,
......
......@@ -11,12 +11,15 @@ set(KICAD_SRCS
class_treeprojectfiles.cpp
class_treeproject_item.cpp
commandframe.cpp
dialogs/dialog_template_selector_base.cpp
dialogs/dialog_template_selector.cpp
files-io.cpp
kicad.cpp
mainframe.cpp
menubar.cpp
preferences.cpp
prjconfig.cpp
project_template.cpp
tree_project_frame.cpp)
if(WIN32)
......
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2012 Brian Sidebotham <brian.sidebotham@gmail.com>
* Copyright (C) 1992-2012 KiCad Developers, see AUTHORS.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, you may find one here:
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
* or you may search the http://www.gnu.org website for the version 2 license,
* or you may write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include "dialog_template_selector.h"
#include <wx/dir.h>
#include <wx/settings.h>
TEMPLATE_SELECTION_PANEL::TEMPLATE_SELECTION_PANEL( wxWindow* aParent ) :
TEMPLATE_SELECTION_PANEL_BASE( aParent )
{
parent = aParent;
}
TEMPLATE_SELECTION_PANEL::~TEMPLATE_SELECTION_PANEL()
{
}
TEMPLATE_WIDGET::TEMPLATE_WIDGET( wxWindow* aParent, wxDialog* aDialog ) :
TEMPLATE_WIDGET_BASE( aParent )
{
parent = aParent;
dialog = aDialog;
// wxWidgets 2.9.x way of doing the same...
// Bind(wxEVT_LEFT_DOWN, &TEMPLATE_WIDGET::OnMouse, this );
m_bitmapIcon->Connect( wxEVT_LEFT_DOWN, wxMouseEventHandler( TEMPLATE_WIDGET::OnMouse ), NULL, this );
m_staticTitle->Connect( wxEVT_LEFT_DOWN, wxMouseEventHandler( TEMPLATE_WIDGET::OnMouse ), NULL, this );
// We're not selected until we're clicked
Unselect();
// Start with template being NULL
templ = NULL;
}
TEMPLATE_WIDGET::~TEMPLATE_WIDGET()
{
}
void TEMPLATE_WIDGET::Select()
{
DIALOG_TEMPLATE_SELECTOR* d = (DIALOG_TEMPLATE_SELECTOR*)dialog;
d->SetWidget( this );
SetBackgroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_BTNHIGHLIGHT ) );
selected = true;
Refresh();
}
void TEMPLATE_WIDGET::Unselect()
{
SetBackgroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_BTNFACE ) );
selected = false;
Refresh();
}
bool TEMPLATE_WIDGET::IsSelected()
{
return selected;
}
PROJECT_TEMPLATE* TEMPLATE_WIDGET::GetTemplate()
{
return templ;
}
void TEMPLATE_WIDGET::SetTemplate(PROJECT_TEMPLATE* aTemplate)
{
templ = aTemplate;
m_staticTitle->SetLabel( *(aTemplate->GetTitle()) );
m_bitmapIcon->SetBitmap( *(aTemplate->GetIcon()) );
}
void TEMPLATE_WIDGET::OnMouse( wxMouseEvent& event )
{
/* Toggle selection here */
Select();
event.Skip();
}
void DIALOG_TEMPLATE_SELECTOR::onNotebookResize(wxSizeEvent& event)
{
for ( size_t i=0; i < m_notebook->GetPageCount(); i++ )
{
m_panels[i]->SetSize( m_notebook->GetSize().GetWidth() - 6, 140 );
m_panels[i]->m_SizerBase->FitInside( m_panels[i] );
m_panels[i]->m_scrolledWindow1->SetSize( m_panels[i]->GetSize().GetWidth() - 6,
m_panels[i]->GetSize().GetHeight() - 6 );
m_panels[i]->m_SizerChoice->FitInside( m_panels[i]->m_scrolledWindow1 );
}
m_notebook->Refresh();
event.Skip();
}
DIALOG_TEMPLATE_SELECTOR::DIALOG_TEMPLATE_SELECTOR( wxWindow* aParent ) :
DIALOG_TEMPLATE_SELECTOR_BASE( aParent )
{
m_htmlWin->SetPage( _( "<html><h1>Template Selector</h1></html>" ) );
m_notebook->Connect( wxEVT_SIZE, wxSizeEventHandler( DIALOG_TEMPLATE_SELECTOR::onNotebookResize ), NULL, this );
m_selectedWidget = NULL;
}
void DIALOG_TEMPLATE_SELECTOR::SetHtml( wxFileName aFilename )
{
m_htmlWin->LoadPage( aFilename.GetFullPath() );
}
DIALOG_TEMPLATE_SELECTOR::~DIALOG_TEMPLATE_SELECTOR()
{
}
TEMPLATE_WIDGET* DIALOG_TEMPLATE_SELECTOR::GetWidget()
{
return m_selectedWidget;
}
void DIALOG_TEMPLATE_SELECTOR::SetWidget( TEMPLATE_WIDGET* aWidget )
{
if( m_selectedWidget != NULL )
m_selectedWidget->Unselect();
m_selectedWidget = aWidget;
SetHtml( m_selectedWidget->GetTemplate()->GetHtmlFile() );
}
void DIALOG_TEMPLATE_SELECTOR::AddTemplate( int aPage, PROJECT_TEMPLATE* aTemplate )
{
TEMPLATE_WIDGET* w = new TEMPLATE_WIDGET( m_panels[aPage]->m_scrolledWindow1, this );
w->SetTemplate( aTemplate );
m_panels[aPage]->m_SizerChoice->Add( w );
m_panels[aPage]->m_SizerChoice->Layout();
m_panels[aPage]->SetSize( m_notebook->GetSize().GetWidth() - 6, 140 );
m_panels[aPage]->m_SizerBase->FitInside( m_panels[aPage] );
m_panels[aPage]->m_scrolledWindow1->SetSize( m_panels[aPage]->GetSize().GetWidth() - 6,
m_panels[aPage]->GetSize().GetHeight() - 6 );
m_panels[aPage]->m_SizerChoice->FitInside( m_panels[aPage]->m_scrolledWindow1 );
m_notebook->Refresh();
}
void DIALOG_TEMPLATE_SELECTOR::AddPage( const wxString& aTitle, wxFileName& aPath )
{
wxNotebookPage* newPage = new wxNotebookPage( m_notebook, wxID_ANY );
m_notebook->AddPage( newPage, aTitle );
TEMPLATE_SELECTION_PANEL* p = new TEMPLATE_SELECTION_PANEL( newPage );
m_panels.push_back( p );
// Get a list of files under the template path to include as choices...
wxArrayString files;
wxDir dir, sub;
if ( dir.Open( aPath.GetPath() ) )
{
wxString filename;
bool cont = dir.GetFirst( &filename, wxEmptyString, wxDIR_FILES | wxDIR_DIRS );
while( cont )
{
if( sub.Open( aPath.GetPathWithSep() + filename ) )
{
files.Add( filename );
PROJECT_TEMPLATE* pt = new PROJECT_TEMPLATE( aPath.GetPathWithSep() + filename );
AddTemplate( m_notebook->GetPageCount() - 1, pt );
}
cont = dir.GetNext( &filename );
}
}
}
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2012 Brian Sidebotham <brian.sidebotham@gmail.com>
* Copyright (C) 1992-2012 KiCad Developers, see AUTHORS.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, you may find one here:
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
* or you may search the http://www.gnu.org website for the version 2 license,
* or you may write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
#ifndef PROJECT_TEMPLATE_SELECTOR_H
#define PROJECT_TEMPLATE_SELECTOR_H
#include "dialogs/dialog_template_selector_base.h"
#include "project_template.h"
class TEMPLATE_WIDGET : public TEMPLATE_WIDGET_BASE
{
protected:
wxDialog* dialog;
wxWindow* parent;
wxPanel* panel;
bool selected;
PROJECT_TEMPLATE* templ;
void OnKillFocus( wxFocusEvent& event );
void OnMouse( wxMouseEvent& event );
public:
TEMPLATE_WIDGET( wxWindow* aParent, wxDialog* aDialog );
~TEMPLATE_WIDGET();
/**
* Set the project template for this widget, which will determine the icon and title
* associated with this project template widget
*/
void SetTemplate(PROJECT_TEMPLATE* aTemplate);
PROJECT_TEMPLATE* GetTemplate();
void Select();
void Unselect();
bool IsSelected();
};
class TEMPLATE_SELECTION_PANEL : public TEMPLATE_SELECTION_PANEL_BASE
{
protected:
wxWindow* parent;
public:
/**
* @param aParent The window creating the dialog
* @param aDialogParent
*/
TEMPLATE_SELECTION_PANEL( wxWindow* aParent );
~TEMPLATE_SELECTION_PANEL();
};
class DIALOG_TEMPLATE_SELECTOR : public DIALOG_TEMPLATE_SELECTOR_BASE
{
protected:
vector<TEMPLATE_SELECTION_PANEL*> m_panels;
void AddTemplate( int aPage, PROJECT_TEMPLATE* aTemplate );
TEMPLATE_WIDGET* m_selectedWidget;
public:
DIALOG_TEMPLATE_SELECTOR( wxWindow* aParent );
~DIALOG_TEMPLATE_SELECTOR();
/**
* Add a new page with \a aTitle, populated with templates from \a aPath - All directories
* directories under the path are treated as templates
*/
void AddPage( const wxString& aTitle, wxFileName& aPath );
void SetHtml( wxFileName aFilename );
TEMPLATE_WIDGET* GetWidget();
void SetWidget( TEMPLATE_WIDGET* aWidget );
void onNotebookResize(wxSizeEvent& event);
};
#endif
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Apr 10 2012)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!
///////////////////////////////////////////////////////////////////////////
#include "dialog_template_selector_base.h"
///////////////////////////////////////////////////////////////////////////
DIALOG_TEMPLATE_SELECTOR_BASE::DIALOG_TEMPLATE_SELECTOR_BASE( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : DIALOG_SHIM( parent, id, title, pos, size, style )
{
this->SetSizeHints( wxSize( 640,480 ), wxDefaultSize );
wxBoxSizer* bSizer1;
bSizer1 = new wxBoxSizer( wxVERTICAL );
m_notebook = new wxNotebook( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0 );
bSizer1->Add( m_notebook, 0, wxEXPAND | wxALL, 3 );
m_htmlWin = new wxHtmlWindow( this, wxID_ANY, wxDefaultPosition, wxSize( -1,-1 ), wxHW_SCROLLBAR_AUTO );
bSizer1->Add( m_htmlWin, 1, wxALL|wxEXPAND, 3 );
m_sdbSizer1 = new wxStdDialogButtonSizer();
m_sdbSizer1OK = new wxButton( this, wxID_OK );
m_sdbSizer1->AddButton( m_sdbSizer1OK );
m_sdbSizer1Cancel = new wxButton( this, wxID_CANCEL );
m_sdbSizer1->AddButton( m_sdbSizer1Cancel );
m_sdbSizer1->Realize();
bSizer1->Add( m_sdbSizer1, 0, wxALL|wxEXPAND, 3 );
this->SetSizer( bSizer1 );
this->Layout();
this->Centre( wxBOTH );
}
DIALOG_TEMPLATE_SELECTOR_BASE::~DIALOG_TEMPLATE_SELECTOR_BASE()
{
}
TEMPLATE_SELECTION_PANEL_BASE::TEMPLATE_SELECTION_PANEL_BASE( wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style ) : wxPanel( parent, id, pos, size, style )
{
m_SizerBase = new wxBoxSizer( wxHORIZONTAL );
m_scrolledWindow1 = new wxScrolledWindow( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxHSCROLL );
m_scrolledWindow1->SetScrollRate( 5, 5 );
m_SizerChoice = new wxBoxSizer( wxHORIZONTAL );
m_scrolledWindow1->SetSizer( m_SizerChoice );
m_scrolledWindow1->Layout();
m_SizerChoice->Fit( m_scrolledWindow1 );
m_SizerBase->Add( m_scrolledWindow1, 0, wxEXPAND | wxALL, 3 );
this->SetSizer( m_SizerBase );
this->Layout();
}
TEMPLATE_SELECTION_PANEL_BASE::~TEMPLATE_SELECTION_PANEL_BASE()
{
}
TEMPLATE_WIDGET_BASE::TEMPLATE_WIDGET_BASE( wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style ) : wxPanel( parent, id, pos, size, style )
{
this->SetMinSize( wxSize( 74,-1 ) );
this->SetMaxSize( wxSize( 74,-1 ) );
wxBoxSizer* bSizer4;
bSizer4 = new wxBoxSizer( wxVERTICAL );
m_bitmapIcon = new wxStaticBitmap( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 64,64 ), 0 );
bSizer4->Add( m_bitmapIcon, 0, wxALIGN_CENTER_HORIZONTAL|wxALL|wxEXPAND, 3 );
m_staticTitle = new wxStaticText( this, wxID_ANY, wxT("Project Template Title"), wxDefaultPosition, wxDefaultSize, wxALIGN_CENTRE );
m_staticTitle->Wrap( 150 );
bSizer4->Add( m_staticTitle, 1, wxALIGN_CENTER_HORIZONTAL|wxALL|wxEXPAND, 3 );
this->SetSizer( bSizer4 );
this->Layout();
}
TEMPLATE_WIDGET_BASE::~TEMPLATE_WIDGET_BASE()
{
}
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Apr 10 2012)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!
///////////////////////////////////////////////////////////////////////////
#ifndef __DIALOG_TEMPLATE_SELECTOR_BASE_H__
#define __DIALOG_TEMPLATE_SELECTOR_BASE_H__
#include <wx/artprov.h>
#include <wx/xrc/xmlres.h>
#include "dialog_shim.h"
#include <wx/gdicmn.h>
#include <wx/notebook.h>
#include <wx/font.h>
#include <wx/colour.h>
#include <wx/settings.h>
#include <wx/string.h>
#include <wx/html/htmlwin.h>
#include <wx/sizer.h>
#include <wx/button.h>
#include <wx/dialog.h>
#include <wx/scrolwin.h>
#include <wx/panel.h>
#include <wx/bitmap.h>
#include <wx/image.h>
#include <wx/icon.h>
#include <wx/statbmp.h>
#include <wx/stattext.h>
///////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
/// Class DIALOG_TEMPLATE_SELECTOR_BASE
///////////////////////////////////////////////////////////////////////////////
class DIALOG_TEMPLATE_SELECTOR_BASE : public DIALOG_SHIM
{
private:
protected:
wxNotebook* m_notebook;
wxHtmlWindow* m_htmlWin;
wxStdDialogButtonSizer* m_sdbSizer1;
wxButton* m_sdbSizer1OK;
wxButton* m_sdbSizer1Cancel;
public:
DIALOG_TEMPLATE_SELECTOR_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = wxT("Project Template Selector"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 640,480 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
~DIALOG_TEMPLATE_SELECTOR_BASE();
};
///////////////////////////////////////////////////////////////////////////////
/// Class TEMPLATE_SELECTION_PANEL_BASE
///////////////////////////////////////////////////////////////////////////////
class TEMPLATE_SELECTION_PANEL_BASE : public wxPanel
{
private:
protected:
public:
wxBoxSizer* m_SizerBase;
wxScrolledWindow* m_scrolledWindow1;
wxBoxSizer* m_SizerChoice;
TEMPLATE_SELECTION_PANEL_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,140 ), long style = wxNO_BORDER|wxTAB_TRAVERSAL );
~TEMPLATE_SELECTION_PANEL_BASE();
};
///////////////////////////////////////////////////////////////////////////////
/// Class TEMPLATE_WIDGET_BASE
///////////////////////////////////////////////////////////////////////////////
class TEMPLATE_WIDGET_BASE : public wxPanel
{
private:
protected:
wxStaticBitmap* m_bitmapIcon;
wxStaticText* m_staticTitle;
public:
TEMPLATE_WIDGET_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 74,-1 ), long style = wxTAB_TRAVERSAL );
~TEMPLATE_WIDGET_BASE();
};
#endif //__DIALOG_TEMPLATE_SELECTOR_BASE_H__
......@@ -155,7 +155,7 @@ public: KICAD_MANAGER_FRAME( wxWindow* parent, const wxString& title,
void OnUpdateDefaultPdfBrowser( wxUpdateUIEvent& event );
void OnUpdatePreferredPdfBrowser( wxUpdateUIEvent& event );
void CreateNewProject( const wxString PrjFullFileName );
void CreateNewProject( const wxString aPrjFullFileName, bool aTemplateSelector );
/**
* Function LoadSettings
......
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2007 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com
* Copyright (C) 2009-2011 Wayne Stambaugh <stambaughw@verizon.net>
* Copyright (C) 1992-2011 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 2012 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 2009-2012 Wayne Stambaugh <stambaughw@verizon.net>
* Copyright (C) 1992-2012 KiCad Developers, see AUTHORS.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
......@@ -44,6 +44,7 @@ BEGIN_EVENT_TABLE( KICAD_MANAGER_FRAME, EDA_BASE_FRAME )
/* Toolbar events */
EVT_TOOL( ID_NEW_PROJECT, KICAD_MANAGER_FRAME::OnLoadProject )
EVT_TOOL( ID_NEW_PROJECT_FROM_TEMPLATE, KICAD_MANAGER_FRAME::OnLoadProject )
EVT_TOOL( ID_LOAD_PROJECT, KICAD_MANAGER_FRAME::OnLoadProject )
EVT_TOOL( ID_SAVE_PROJECT, KICAD_MANAGER_FRAME::OnSaveProject )
EVT_TOOL( ID_SAVE_AND_ZIP_FILES, KICAD_MANAGER_FRAME::OnArchiveFiles )
......@@ -134,8 +135,20 @@ void KICAD_MANAGER_FRAME::ReCreateMenuBar()
KiBitmap( open_project_xpm ) );
// New
AddMenuItem( fileMenu, ID_NEW_PROJECT,
_( "&New\tCtrl+N" ),
static wxMenu* newMenu = new wxMenu();
AddMenuItem( newMenu, ID_NEW_PROJECT,
_( "&Blank\tCtrl+N" ),
_( "Start a blank project" ),
KiBitmap( new_project_xpm ) );
AddMenuItem( newMenu, ID_NEW_PROJECT_FROM_TEMPLATE,
_( "New from &Template\tCtrl+T" ),
_( "Start a new project from a template" ),
KiBitmap( new_project_with_template_xpm ) );
AddMenuItem( fileMenu, newMenu,
wxID_ANY,
_( "New" ),
_( "Start a new project" ),
KiBitmap( new_project_xpm ) );
......@@ -309,6 +322,10 @@ void KICAD_MANAGER_FRAME::RecreateBaseHToolbar()
KiBitmap( new_project_xpm ),
_( "Start a new project" ) );
m_mainToolBar->AddTool( ID_NEW_PROJECT_FROM_TEMPLATE, wxEmptyString,
KiBitmap( new_project_with_template_xpm ),
_( "Start a new project from a template" ) );
// Load
m_mainToolBar->AddTool( ID_LOAD_PROJECT, wxEmptyString,
KiBitmap( open_project_xpm ),
......
......@@ -31,13 +31,21 @@
#include <appl_wxstruct.h>
#include <confirm.h>
#include <gestfich.h>
#include <prjconfig.h>
#include <kicad.h>
#include <prjconfig.h>
#include <project_template.h>
#include <tree_project_frame.h>
#include <wildcards_and_files_ext.h>
#include <vector>
#include <build_version.h>
#include <wx/filename.h>
#include <wx/stdpaths.h>
#include "dialogs/dialog_template_selector.h"
#define SEP() wxFileName::GetPathSeparator()
static const wxString GeneralGroupName( wxT( "/general" ) );
/* KiCad project file entry names. */
......@@ -45,39 +53,94 @@ static const wxString SchematicRootNameEntry( wxT( "RootSch" ) );
static const wxString BoardFileNameEntry( wxT( "BoardNm" ) );
void KICAD_MANAGER_FRAME::CreateNewProject( const wxString PrjFullFileName )
void KICAD_MANAGER_FRAME::CreateNewProject( const wxString aPrjFullFileName, bool aTemplateSelector = false )
{
wxString filename;
wxFileName newProjectName = PrjFullFileName;
wxFileName newProjectName = aPrjFullFileName;
ClearMsg();
/* Init default config filename */
// Init default config filename
filename = wxGetApp().FindLibraryPath( wxT( "kicad" ) + g_KicadPrjFilenameExtension );
/* Check if file kicad.pro exist in template directory */
// If we are creating a project from a template, make sure the template directory is sane
if( aTemplateSelector )
{
DIALOG_TEMPLATE_SELECTOR* ps = new DIALOG_TEMPLATE_SELECTOR( this );
// Add a new tab for system templates
wxFileName templatePath = wxPathOnly(wxStandardPaths::Get().GetExecutablePath()) +
SEP() + wxT( ".." ) + SEP() + wxT( "share" ) + SEP() + wxT( "template" ) + SEP();
ps->AddPage( _( "System Templates" ), templatePath );
// Add a new tab for user templates
wxFileName userPath = wxStandardPaths::Get().GetDocumentsDir() +
SEP() + wxT( "kicad" ) + SEP() + wxT( "template" ) + SEP();
ps->AddPage( _( "User Templates" ), userPath );
// Check to see if a custom template location is available and setup a new selection tab
// if there is
wxString envStr;
wxGetEnv( wxT("KICAD_PTEMPLATES"), &envStr );
wxFileName envPath = envStr;
if( envStr != wxEmptyString )
{
wxFileName envPath = envStr;
ps->AddPage( _("Portable Templates"), envPath );
}
// Show the project template selector dialog
int result = ps->ShowModal();
if( result != wxID_OK )
{
wxMessageBox( _( "Did not generate new project from template" ),
_( "Cancelled new project from template" ),
wxOK | wxICON_EXCLAMATION,
this );
}
else
{
// The selected template widget contains the template we're attempting to use to
// create a project
if( !ps->GetWidget()->GetTemplate()->CreateProject( newProjectName ) )
{
wxMessageBox( _( "Problem whilst creating new project from template!" ),
_( "Could not generate new project" ),
wxOK | wxICON_ERROR,
this );
}
}
}
else
{
// Check if file kicad.pro exist in template directory
if( wxFileName::FileExists( filename ) )
{
wxCopyFile( filename, PrjFullFileName );
wxCopyFile( filename, aPrjFullFileName );
}
else
{
DisplayInfoMessage( NULL, _( "Project template file <kicad.pro> not found. " ) );
return;
}
}
/* Init schematic filename */
// Init schematic filename
m_SchematicRootFileName = wxFileName( newProjectName.GetName(),
SchematicFileExtension ).GetFullName();
/* Init pcb board filename */
// Init pcb board filename
m_BoardFileName = wxFileName( newProjectName.GetName(), PcbFileExtension ).GetFullName();
/* Init project filename */
// Init project filename
m_ProjectFileName = newProjectName;
/* Write settings to project file */
wxGetApp().WriteProjectConfig( PrjFullFileName, GeneralGroupName, NULL );
// Write settings to project file
wxGetApp().WriteProjectConfig( aPrjFullFileName, GeneralGroupName, NULL );
}
......@@ -90,7 +153,8 @@ void KICAD_MANAGER_FRAME::OnLoadProject( wxCommandEvent& event )
if( event.GetId() != wxID_ANY )
{
if( event.GetId() == ID_NEW_PROJECT )
if( ( event.GetId() == ID_NEW_PROJECT ) ||
( event.GetId() == ID_NEW_PROJECT_FROM_TEMPLATE ) )
{
title = _( "Create New Project" );
style = wxFD_SAVE | wxFD_OVERWRITE_PROMPT;
......@@ -108,19 +172,25 @@ void KICAD_MANAGER_FRAME::OnLoadProject( wxCommandEvent& event )
m_ProjectFileName = dlg.GetPath();
if( event.GetId() == ID_NEW_PROJECT )
if( ( event.GetId() == ID_NEW_PROJECT ) ||
( event.GetId() == ID_NEW_PROJECT_FROM_TEMPLATE ) )
{
// Ensure project filename extension is .pro
wxString fullname = m_ProjectFileName.GetFullPath();
if ( !fullname.EndsWith( g_KicadPrjFilenameExtension ) )
if ( !m_ProjectFileName.GetFullPath().EndsWith( g_KicadPrjFilenameExtension ) )
{
fullname += g_KicadPrjFilenameExtension;
m_ProjectFileName.SetFullName( fullname );
m_ProjectFileName.SetFullName( m_ProjectFileName.GetFullPath() +
g_KicadPrjFilenameExtension );
}
if( event.GetId() == ID_NEW_PROJECT )
{
CreateNewProject( m_ProjectFileName.GetFullPath() );
}
else if( event.GetId() == ID_NEW_PROJECT_FROM_TEMPLATE )
{
// Launch the template selector dialog
CreateNewProject( m_ProjectFileName.GetFullPath(), true );
}
}
}
wxLogDebug( wxT( "Loading KiCad project file: " ) + m_ProjectFileName.GetFullPath() );
......
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2012 Brian Sidebotham <brian.sidebotham@gmail.com>
* Copyright (C) 1992-2012 KiCad Developers, see AUTHORS.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, you may find one here:
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
* or you may search the http://www.gnu.org website for the version 2 license,
* or you may write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include "project_template.h"
#include <vector>
#include <wx/wx.h>
#include <wx/arrstr.h>
#include <wx/dir.h>
#include <wx/filename.h>
#include <wx/txtstrm.h>
#include <wx/wfstream.h>
using namespace std;
#define SEP() wxFileName::GetPathSeparator()
PROJECT_TEMPLATE::PROJECT_TEMPLATE( const wxString& aPath )
{
templateBasePath = wxFileName::DirName( aPath );
templateMetaPath = wxFileName::DirName( aPath + SEP() + METADIR );
templateMetaHtmlFile = wxFileName::FileName( aPath + SEP() + METADIR + SEP() +
METAFILE_INFO_HTML );
templateMetaIconFile = wxFileName::FileName( aPath + SEP() + METADIR + SEP() + METAFILE_ICON );
title = wxEmptyString;
// Test the project template requirements to make sure aPath is a valid
// template structure
if( !wxFileName::DirExists( templateBasePath.GetPath() ) )
{
// Error, the path doesn't exist!
title = wxT( "Could open the template path! " + aPath );
}
else if( !wxFileName::DirExists( templateMetaPath.GetPath() ) )
{
// Error, the meta information directory doesn't exist!
title = wxT( "Couldn't open the meta information directory for this template! " +
templateMetaPath.GetPath() );
}
else if( !wxFileName::FileExists( templateMetaHtmlFile.GetFullPath() ) )
{
// Error, the meta information directory doesn't contain the informational html file!
title = wxT( "Cound't find the meta html information file for this template!" );
}
// Try to load an icon
metaIcon = new wxBitmap( templateMetaIconFile.GetFullPath(), wxBITMAP_TYPE_PNG );
}
vector<wxFileName> PROJECT_TEMPLATE::GetFileList()
{
vector<wxFileName> files;
wxString f = templateBasePath.GetPath();
wxArrayString allfiles;
wxFileName p;
wxDir::GetAllFiles( f, &allfiles );
// Create the vector and ignore all of the meta data files!
for( size_t i=0; i < allfiles.size(); i++ )
{
p = allfiles[i];
// Files that are in the meta directory must not be included
if( !p.GetPath().StartsWith( templateMetaPath.GetPath() ) )
files.push_back(allfiles[i]);
}
return files;
}
wxString PROJECT_TEMPLATE::GetName()
{
return templateBasePath.GetDirs()[ templateBasePath.GetDirCount()-1 ];
}
PROJECT_TEMPLATE::~PROJECT_TEMPLATE()
{
}
wxFileName PROJECT_TEMPLATE::GetHtmlFile()
{
return templateMetaHtmlFile;
}
wxBitmap* PROJECT_TEMPLATE::GetIcon()
{
return metaIcon;
}
bool PROJECT_TEMPLATE::CreateProject( wxFileName& aNewProjectPath )
{
bool result = true;
vector<wxFileName> srcFiles = GetFileList();
vector<wxFileName> dstFiles;
for( size_t i=0; i < srcFiles.size(); i++ )
{
// Replace the template path
wxFileName destination = srcFiles[i];
wxString destname = destination.GetName();
// Replace the template name with the project name for the new project creation
destname.Replace( GetName(), aNewProjectPath.GetName() );
// Add the file extension (if there was one!)
if( destination.GetExt() != wxEmptyString )
destname += wxT(".") + destination.GetExt();
wxString destpath = destination.GetPathWithSep();
destpath.Replace( destination.GetPathWithSep(), aNewProjectPath.GetPathWithSep() );
destination = destpath + destname;
dstFiles.push_back( destination );
wxString srcFile = srcFiles[i].GetFullPath();
wxString dstFile = dstFiles[i].GetFullPath();
if( !wxCopyFile( srcFile, dstFile ) )
{
result = false;
break;
}
}
return result;
}
wxString* PROJECT_TEMPLATE::GetTitle(void)
{
wxFileInputStream input( GetHtmlFile().GetFullPath() );
wxTextInputStream text( input, wxT( "\x9" ), wxConvUTF8 );
/* Open HTML file and get the text between the title tags */
if( title == wxEmptyString )
{
int start = 0;
int finish = 0;
bool done = false;
while( input.IsOk() && !input.Eof() && !done )
{
wxString line = text.ReadLine();
start = line.Find( wxT( "<title>" ) );
finish = line.Find( wxT( "</title>" ) );
// find the opening tag
if( start != wxNOT_FOUND )
{
if( finish != wxNOT_FOUND )
{
title = line.SubString( start + 7, finish );
}
else
{
title = line.SubString( start + 7, line.Len() - 1 );
done = true;
}
}
else
{
if( finish != wxNOT_FOUND )
{
title += line.SubString( 0, finish );
done = true;
}
else
{
title += line;
}
}
// Remove line endings
title.Replace( wxT( "\r" ), wxT( "" ) );
title.Replace( wxT( "\n" ), wxT( "" ) );
}
}
return &title;
}
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2012 Brian Sidebotham <brian.sidebotham@gmail.com>
* Copyright (C) 1992-2012 KiCad Developers, see AUTHORS.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, you may find one here:
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
* or you may search the http://www.gnu.org website for the version 2 license,
* or you may write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
/**
@page prj_tmp Project Templates
Author: Brian Sidebotham
Proposal
--------
To add new project template functionality to KiCad to facilitate the easy setup of projects
which have common attributes such as pre-defined board outlines, connector positions,
schematic elements, design rules, etc.
Definitions
-----------
A template is a directory of files, which includes a directory of metadata. The template system
name (SYSNAME) is the directory name under which the template files are stored. The metadata
directory (METADIR) contains pre-defined files which provide information about the template.
All files and directories in a template are copied to the new project path when a project is
created using a template, except METADIR.
All files and directories which start with SYSNAME will have SYSNAME replaced by the new
project file name, excluding the file extension.
Metadata
--------
A template's METADIR must contain the required files, and might optionally contain any of the
optional files
Required Files
~~~~~~~~~~~~~~
/info.html - Contains html formatted information about the template which is used by the
user to determine if the template is what they are after. The <title> tag
determines the actual name of the template that is exposed to the user for
template selection. Using html to format this document means that images can
be in-lined without having to invent a new scheme. Only HTML supported by
wxHTML can be used to format this document.
Optional Files
~~~~~~~~~~~~~~
/icon.png - A 64 x 64px PNG icon file which is used as a clickable icon in the template
selection dialog.
Operation
---------
The KiCad File menu will be modified to change New from a menu item to a pop-out menu item, in
the same manor as Open Recent. There will be two options on the pop-out menu:
Blank -> Will act exactly the same as the current new menu item so that anyone who wishes to
create a blank project won't have their settings lost or feel alienated.
From Template -> Will open the template selection dialog.
The template selection dialog will have a list of icons on the left, and a wxHTML window to the
right. A single click on a template's icon on the left will load that templates info.html
metadata file and display it in the wxHTML window.
A double click on a template's icon will start the new project creation and will open a new
file dialog. If the user selects a valid location for the new project, the template will be
copied to the new project location ( excluding METADIR as mentioned earlier ) and any files
that match the string replacement rules will be renamed to reflect the new project's name.
The list of available templates will be gathered from the following sources:
wxStandardPaths::GetExecutableDir()/../share/template/
wxStandardPaths::GetUserDataDir()/templates/
wxGetEnv(wxT("KICAD_TEMPLATES"))
*/
#ifndef PROJECT_TEMPLATE_H
#define PROJECT_TEMPLATE_H
#include <vector>
#include <wx/wx.h>
#include <wx/image.h>
#include <wx/filename.h>
using namespace std;
/**
* @brief A directory which contains information about the project template and does not get
* copied. This define is the default filename for this directory
*
*/
#define METADIR wxT("meta")
/**
* @brief A required html formatted file which contains information about the project template.
* This define is the default filename for this file
*
*/
#define METAFILE_INFO_HTML wxT("info.html")
/**
* @brief An optional png icon, exactly 64px x 64px which is used in the template selector if
* present. This define is the default filename for this file
*
*/
#define METAFILE_ICON wxT("icon.png")
/**
* @brief A class which provides project template functionality.
*
*
*
*/
class PROJECT_TEMPLATE {
private:
protected:
wxFileName templateBasePath;
wxFileName templateMetaPath;
wxFileName templateMetaHtmlFile;
wxFileName templateMetaIconFile;
wxBitmap* metaIcon;
wxString title;
public:
/**
* @brief Create a new project instance from \a aPath. \a aPath should be a directory that
* conforms to the project template requirements
*
* @param aPath Should be a directory containing the template
*/
PROJECT_TEMPLATE( const wxString& aPath );
/**
* @brief Non-virtual destructor (so no dervied classes)
*/
~PROJECT_TEMPLATE();
/**
* @brief Get the system name of the project template
* @return the system name of the template
*/
wxString GetName();
/**
* @brief Get the full Html filename for the project template
* @return the html meta information file for this template
*/
wxFileName GetHtmlFile();
/**
* @brief Copies and renames all template files to create a new project.
* @param aNewProjectPath The full path of the new project file to create
*/
bool CreateProject( wxFileName& aNewProjectPath );
/**
* @brief Get the 64px^2 icon for the project template
* @return an image file of 64px x 64px which is the templates icon
*/
wxBitmap* GetIcon();
/**
* @brief Get the title of the project (extracted from the html title tag)
*/
wxString* GetTitle();
/**
* @brief Get a vector list of filenames for the template. The files are the source files,
* and have not yet been through any renaming
*/
vector<wxFileName> GetFileList();
};
#endif
<html>
<head>
<title>Raspberry Pi - Expansion Board</title>
</head>
<body>
<h1>Raspberry Pi</h1>
<h2>Expansion Board</h2>
This project template is the basis of an expansion board for the
<a href="http://www.raspberrypi.org/" target="blank">Raspberry Pi $25 ARM
board.</a>
<br><br>
This base project includes a PCB edge defined as the same size as the
Raspberry-Pi PCB with the connectors placed correctly to align the two boards.
All IO present on the Raspberry-Pi board is connected to the project through the
0.1" expansion headers.
<br><br>
The board outline looks like the following:
<br><br>
(c)2012 Brian Sidebotham<br>
(c)2012 Kicad Developers<br>
</body>
</html>
EESchema-LIBRARY Version 2.3 Date: 03/08/2012 23:04:32
#encoding utf-8
#
# +3.3V
#
DEF +3.3V #PWR 0 0 Y Y 1 F P
F0 "#PWR" 0 -40 30 H I C CNN
F1 "+3.3V" 0 110 30 H V C CNN
ALIAS +3,3V
DRAW
X +3.3V 1 0 0 0 U 30 30 0 0 W N
C 0 60 20 0 1 0 N
P 3 0 1 0 0 0 0 40 0 40 N
ENDDRAW
ENDDEF
#
# +5V
#
DEF +5V #PWR 0 40 Y Y 1 F P
F0 "#PWR" 0 90 20 H I C CNN
F1 "+5V" 0 90 30 H V C CNN
DRAW
X +5V 1 0 0 0 U 20 20 0 0 W N
C 0 50 20 0 1 0 N
P 4 0 1 0 0 0 0 30 0 30 0 30 N
ENDDRAW
ENDDEF
#
# CONN_13X2
#
DEF CONN_13X2 P 0 10 Y N 1 F N
F0 "P" 0 700 60 H V C CNN
F1 "CONN_13X2" 0 0 50 V V C CNN
DRAW
S -100 650 100 -650 0 1 0 N
X P1 1 -400 600 300 R 40 30 1 1 P I
X P2 2 400 600 300 L 40 30 1 1 P I
X P3 3 -400 500 300 R 40 30 1 1 P I
X P4 4 400 500 300 L 40 30 1 1 P I
X P5 5 -400 400 300 R 40 30 1 1 P I
X P6 6 400 400 300 L 40 30 1 1 P I
X P7 7 -400 300 300 R 40 30 1 1 P I
X P8 8 400 300 300 L 40 30 1 1 P I
X P9 9 -400 200 300 R 40 30 1 1 P I
X P10 10 400 200 300 L 40 30 1 1 P I
X P20 20 400 -300 300 L 40 30 1 1 P I
X P11 11 -400 100 300 R 40 30 1 1 P I
X P21 21 -400 -400 300 R 40 30 1 1 P I
X P12 12 400 100 300 L 40 30 1 1 P I
X P22 22 400 -400 300 L 40 30 1 1 P I
X P13 13 -400 0 300 R 40 30 1 1 P I
X P23 23 -400 -500 300 R 40 30 1 1 P I
X P14 14 400 0 300 L 40 30 1 1 P I
X P20 24 400 -500 300 L 40 30 1 1 P I
X P15 15 -400 -100 300 R 40 30 1 1 P I
X P24 25 -400 -600 300 R 40 30 1 1 P I
X P16 16 400 -100 300 L 40 30 1 1 P I
X P22 26 400 -600 300 L 40 30 1 1 P I
X P17 17 -400 -200 300 R 40 30 1 1 P I
X P18 18 400 -200 300 L 40 30 1 1 P I
X P19 19 -400 -300 300 R 40 30 1 1 P I
ENDDRAW
ENDDEF
#
# GND
#
DEF ~GND #PWR 0 0 Y Y 1 F P
F0 "#PWR" 0 0 30 H I C CNN
F1 "GND" 0 -70 30 H I C CNN
DRAW
P 4 0 1 0 -50 0 0 -50 50 0 -50 0 N
X GND 1 0 0 0 U 30 30 1 1 W N
ENDDRAW
ENDDEF
#
#End Library
PCBNEW-BOARD Version 1 date 03/08/2012 23:04:25
# Created by Pcbnew(2012-08-03 BZR 3666)-testing
$GENERAL
encoding utf-8
Units deci-mils
LayerCount 2
EnabledLayers 1FFF8001
VisibleLayers 1FFFFFFF
Links 0
NoConn 0
Di 64424 41924 100576 63576
Ndraw 4
Ntrack 0
Nzone 0
BoardThickness 620
Nmodule 1
Nnets 4
$EndGENERAL
$SHEETDESCR
Sheet A3 16535 11693
Title ""
Date "3 aug 2012"
Rev ""
Comp ""
Comment1 ""
Comment2 ""
Comment3 ""
Comment4 ""
$EndSHEETDESCR
$SETUP
Layers 2
Layer[0] Back signal
Layer[15] Front signal
TrackWidth 100
TrackClearence 100
ZoneClearence 200
Zone_45_Only 0
TrackMinWidth 100
DrawSegmWidth 150
EdgeSegmWidth 150
ViaSize 350
ViaDrill 250
ViaMinSize 350
ViaMinDrill 200
MicroViaSize 200
MicroViaDrill 50
MicroViasAllowed 0
MicroViaMinSize 200
MicroViaMinDrill 50
TextPcbWidth 120
TextPcbSize 600 800
EdgeModWidth 150
TextModSize 600 600
TextModWidth 120
PadSize 600 600
PadDrill 320
Pad2MaskClearance 100
AuxiliaryAxisOrg 0 0
VisibleElements FFFFFFBF
PcbPlotParams (pcbplotparams (layerselection 3178497) (usegerberextensions true) (excludeedgelayer true) (linewidth 60) (plotframeref false) (viasonmask false) (mode 1) (useauxorigin false) (hpglpennumber 1) (hpglpenspeed 20) (hpglpendiameter 15) (hpglpenoverlay 2) (pscolor true) (psnegative false) (psa4output false) (plotreference true) (plotvalue true) (plotothertext true) (plotinvisibletext false) (padsonsilk false) (subtractmaskfromsilk false) (outputformat 1) (mirror false) (drillshape 1) (scaleselection 1) (outputdirectory ""))
$EndSETUP
$EQUIPOT
Na 0 ""
St ~
$EndEQUIPOT
$EQUIPOT
Na 1 "+3.3V"
St ~
$EndEQUIPOT
$EQUIPOT
Na 2 "+5V"
St ~
$EndEQUIPOT
$EQUIPOT
Na 3 "GND"
St ~
$EndEQUIPOT
$NCLASS
Name "Default"
Desc "This is the default net class."
Clearance 100
TrackWidth 100
ViaDia 350
ViaDrill 250
uViaDia 200
uViaDrill 50
AddNet ""
AddNet "+3.3V"
AddNet "+5V"
AddNet "GND"
$EndNCLASS
$MODULE pin_array_13x2
Po 71500 43500 0 15 501C4AA3 501C493E ~~
Li pin_array_13x2
Cd Double rangee de contacts 2 x 12 pins
Kw CONN
Sc 501C493E
AR /501C45CC
Op 0 0 0
T0 -6000 1500 400 400 0 80 N V 21 N "P1"
T1 4500 1500 400 400 0 80 N V 21 N "CONN_13X2"
DS -6500 1000 6500 1000 80 21
DS 6500 -1000 -6500 -1000 80 21
DS -6500 -1000 -6500 1000 80 21
DS 6500 1000 6500 -1000 80 21
$PAD
Sh "1" R 600 600 0 0 0
Dr 320 0 0
At STD N 00E0FFFF
Ne 1 "+3.3V"
Po -6000 500
$EndPAD
$PAD
Sh "2" C 600 600 0 0 0
Dr 400 0 0
At STD N 00E0FFFF
Ne 2 "+5V"
Po -6000 -500
$EndPAD
$PAD
Sh "3" C 600 600 0 0 0
Dr 400 0 0
At STD N 00E0FFFF
Ne 0 ""
Po -5000 500
$EndPAD
$PAD
Sh "4" C 600 600 0 0 0
Dr 400 0 0
At STD N 00E0FFFF
Ne 0 ""
Po -5000 -500
$EndPAD
$PAD
Sh "5" C 600 600 0 0 0
Dr 400 0 0
At STD N 00E0FFFF
Ne 0 ""
Po -4000 500
$EndPAD
$PAD
Sh "6" C 600 600 0 0 0
Dr 400 0 0
At STD N 00E0FFFF
Ne 3 "GND"
Po -4000 -500
$EndPAD
$PAD
Sh "7" C 600 600 0 0 0
Dr 400 0 0
At STD N 00E0FFFF
Ne 0 ""
Po -3000 500
$EndPAD
$PAD
Sh "8" C 600 600 0 0 0
Dr 400 0 0
At STD N 00E0FFFF
Ne 0 ""
Po -3000 -500
$EndPAD
$PAD
Sh "9" C 600 600 0 0 0
Dr 400 0 0
At STD N 00E0FFFF
Ne 0 ""
Po -2000 500
$EndPAD
$PAD
Sh "10" C 600 600 0 0 0
Dr 400 0 0
At STD N 00E0FFFF
Ne 0 ""
Po -2000 -500
$EndPAD
$PAD
Sh "11" C 600 600 0 0 0
Dr 400 0 0
At STD N 00E0FFFF
Ne 0 ""
Po -1000 500
$EndPAD
$PAD
Sh "12" C 600 600 0 0 0
Dr 400 0 0
At STD N 00E0FFFF
Ne 0 ""
Po -1000 -500
$EndPAD
$PAD
Sh "13" C 600 600 0 0 0
Dr 400 0 0
At STD N 00E0FFFF
Ne 0 ""
Po 0 500
$EndPAD
$PAD
Sh "14" C 600 600 0 0 0
Dr 400 0 0
At STD N 00E0FFFF
Ne 0 ""
Po 0 -500
$EndPAD
$PAD
Sh "15" C 600 600 0 0 0
Dr 400 0 0
At STD N 00E0FFFF
Ne 0 ""
Po 1000 500
$EndPAD
$PAD
Sh "16" C 600 600 0 0 0
Dr 400 0 0
At STD N 00E0FFFF
Ne 0 ""
Po 1000 -500
$EndPAD
$PAD
Sh "17" C 600 600 0 0 0
Dr 400 0 0
At STD N 00E0FFFF
Ne 0 ""
Po 2000 500
$EndPAD
$PAD
Sh "18" C 600 600 0 0 0
Dr 400 0 0
At STD N 00E0FFFF
Ne 0 ""
Po 2000 -500
$EndPAD
$PAD
Sh "19" C 600 600 0 0 0
Dr 400 0 0
At STD N 00E0FFFF
Ne 0 ""
Po 3000 500
$EndPAD
$PAD
Sh "20" C 600 600 0 0 0
Dr 400 0 0
At STD N 00E0FFFF
Ne 0 ""
Po 3000 -500
$EndPAD
$PAD
Sh "21" C 600 600 0 0 0
Dr 400 0 0
At STD N 00E0FFFF
Ne 0 ""
Po 4000 500
$EndPAD
$PAD
Sh "22" C 600 600 0 0 0
Dr 400 0 0
At STD N 00E0FFFF
Ne 0 ""
Po 4000 -500
$EndPAD
$PAD
Sh "23" C 600 600 0 0 0
Dr 400 0 0
At STD N 00E0FFFF
Ne 0 ""
Po 5000 500
$EndPAD
$PAD
Sh "24" C 600 600 0 0 0
Dr 400 0 0
At STD N 00E0FFFF
Ne 0 ""
Po 5000 -500
$EndPAD
$PAD
Sh "25" C 600 600 0 0 0
Dr 400 0 0
At STD N 00E0FFFF
Ne 0 ""
Po 6000 500
$EndPAD
$PAD
Sh "26" C 600 600 0 0 0
Dr 400 0 0
At STD N 00E0FFFF
Ne 0 ""
Po 6000 -500
$EndPAD
$SHAPE3D
Na "pin_array/pins_array_13x2.wrl"
Sc 1 1 1
Of 0 0 0
Ro 0 0 0
$EndSHAPE3D
$EndMODULE pin_array_13x2
$DRAWSEGMENT
Po 0 100500 63500 64500 63500 150
De 28 0 900 0 0
$EndDRAWSEGMENT
$DRAWSEGMENT
Po 0 64500 42000 64500 63500 150
De 28 0 900 0 0
$EndDRAWSEGMENT
$DRAWSEGMENT
Po 0 100500 42000 100500 63500 150
De 28 0 900 0 0
$EndDRAWSEGMENT
$DRAWSEGMENT
Po 0 64500 42000 100500 42000 150
De 28 0 900 0 0
$EndDRAWSEGMENT
$TRACK
$EndTRACK
$ZONE
$EndZONE
$EndBOARD
Cmp-Mod V01 Created by CvPcb (2012-08-03 BZR 3666)-testing date = 03/08/2012 22:59:51
BeginCmp
TimeStamp = /501C45CC;
Reference = P1;
ValeurCmp = CONN_13X2;
IdModule = pin_array_13x2;
EndCmp
EndListe
# EESchema Netlist Version 1.1 created 03/08/2012 22:54:12
(
( /501C45CC $noname P1 CONN_13X2 {Lib=CONN_13X2}
( 1 +3.3V )
( 2 +5V )
( 3 ? )
( 4 ? )
( 5 ? )
( 6 GND )
( 7 ? )
( 8 ? )
( 9 ? )
( 10 ? )
( 11 ? )
( 12 ? )
( 13 ? )
( 14 ? )
( 15 ? )
( 16 ? )
( 17 ? )
( 18 ? )
( 19 ? )
( 20 ? )
( 21 ? )
( 22 ? )
( 23 ? )
( 24 ? )
( 25 ? )
( 26 ? )
)
)
*
{ Pin List by Nets
}
#End
update=03/08/2012 22:36:35
version=1
last_client=kicad
[cvpcb]
version=1
NetITyp=0
NetIExt=.net
PkgIExt=.pkg
NetDir=
LibDir=
NetType=0
[cvpcb/libraries]
EquName1=devcms
[pcbnew]
version=1
PadDrlX=320
PadDimH=600
PadDimV=600
PadForm=1
PadMask=14745599
ViaDiam=450
ViaDril=250
Isol=60
Countlayer=2
Lpiste=170
RouteTo=15
RouteBo=0
TypeVia=3
Segm45=1
Racc45=1
Unite=0
SegFill=1
SegAffG=0
NewAffG=1
PadFill=1
PadAffG=1
PadSNum=1
ModAffC=0
ModAffT=0
PcbAffT=0
SgPcb45=1
TxtPcbV=800
TxtPcbH=600
TxtModV=600
TxtModH=600
TxtModW=120
HPGLnum=1
HPGdiam=15
HPGLSpd=20
HPGLrec=2
HPGLorg=0
GERBmin=15
VEgarde=100
DrawLar=150
EdgeLar=150
TxtLar=120
MSegLar=150
ForPlot=1
WpenSer=10
UserGrX=0,01
UserGrY=0,01
UserGrU=1
DivGrPc=1
TimeOut=600
MaxLnkS=3
ShowRat=0
ShowMRa=1
[pcbnew/libraries]
LibDir=
LibName1=sockets
LibName2=connect
LibName3=discret
LibName4=pin_array
LibName5=divers
LibName6=libcms
LibName7=display
LibName8=valves
LibName9=led
LibName10=dip_sockets
[eeschema]
version=1
LibDir=
NetFmt=1
HPGLSpd=20
HPGLDm=15
HPGLNum=1
offX_A4=0
offY_A4=0
offX_A3=0
offY_A3=0
offX_A2=0
offY_A2=0
offX_A1=0
offY_A1=0
offX_A0=0
offY_A0=0
offX_A=0
offY_A=0
offX_B=0
offY_B=0
offX_C=0
offY_C=0
offX_D=0
offY_D=0
offX_E=0
offY_E=0
RptD_X=0
RptD_Y=100
RptLab=1
SimCmd=
UseNetN=0
LabSize=60
[eeschema/libraries]
LibName1=power
LibName2=device
LibName3=transistors
LibName4=conn
LibName5=linear
LibName6=regul
LibName7=74xx
LibName8=cmos4000
LibName9=adc-dac
LibName10=memory
LibName11=xilinx
LibName12=special
LibName13=microcontrollers
LibName14=dsp
LibName15=microchip
LibName16=analog_switches
LibName17=motorola
LibName18=texas
LibName19=intel
LibName20=audio
LibName21=interface
LibName22=digital-audio
LibName23=philips
LibName24=display
LibName25=cypress
LibName26=siliconi
LibName27=opto
LibName28=atmel
LibName29=contrib
LibName30=valves
[general]
version=1
EESchema Schematic File Version 2 date 03/08/2012 23:04:32
LIBS:power
LIBS:device
LIBS:transistors
LIBS:conn
LIBS:linear
LIBS:regul
LIBS:74xx
LIBS:cmos4000
LIBS:adc-dac
LIBS:memory
LIBS:xilinx
LIBS:special
LIBS:microcontrollers
LIBS:dsp
LIBS:microchip
LIBS:analog_switches
LIBS:motorola
LIBS:texas
LIBS:intel
LIBS:audio
LIBS:interface
LIBS:digital-audio
LIBS:philips
LIBS:display
LIBS:cypress
LIBS:siliconi
LIBS:opto
LIBS:atmel
LIBS:contrib
LIBS:valves
EELAYER 43 0
EELAYER END
$Descr A4 11693 8268
encoding utf-8
Sheet 1 1
Title ""
Date "3 aug 2012"
Rev ""
Comp ""
Comment1 ""
Comment2 ""
Comment3 ""
Comment4 ""
$EndDescr
$Comp
L CONN_13X2 P1
U 1 1 501C45CC
P 9600 1500
F 0 "P1" H 9600 2200 60 0000 C CNN
F 1 "CONN_13X2" V 9600 1500 50 0000 C CNN
1 9600 1500
1 0 0 -1
$EndComp
$Comp
L +5V #PWR01
U 1 1 501C4637
P 10100 800
F 0 "#PWR01" H 10100 890 20 0001 C CNN
F 1 "+5V" H 10100 890 30 0000 C CNN
1 10100 800
1 0 0 -1
$EndComp
$Comp
L +3.3V #PWR02
U 1 1 501C4646
P 9100 800
F 0 "#PWR02" H 9100 760 30 0001 C CNN
F 1 "+3.3V" H 9100 910 30 0000 C CNN
1 9100 800
1 0 0 -1
$EndComp
$Comp
L GND #PWR03
U 1 1 501C4659
P 10100 2200
F 0 "#PWR03" H 10100 2200 30 0001 C CNN
F 1 "GND" H 10100 2130 30 0001 C CNN
1 10100 2200
1 0 0 -1
$EndComp
Wire Wire Line
10000 1100 10100 1100
Wire Wire Line
10100 1100 10100 2200
Wire Wire Line
10000 900 10100 900
Wire Wire Line
10100 900 10100 800
Wire Wire Line
9200 900 9100 900
Wire Wire Line
9100 900 9100 800
Wire Wire Line
10000 1200 11000 1200
Wire Wire Line
10000 1300 11000 1300
Text Label 11000 1200 2 60 ~ 0
GPIO14_(TxD)
Text Label 11000 1300 2 60 ~ 0
GPIO15_(RxD)
Wire Wire Line
10000 1400 11000 1400
Text Label 11000 1400 2 60 ~ 0
GPIO18_(PCM_CLK)
Wire Wire Line
10000 1600 11000 1600
Wire Wire Line
10000 1700 11000 1700
Text Label 11000 1600 2 60 ~ 0
GPIO23
Text Label 11000 1700 2 60 ~ 0
GPIO24
Wire Wire Line
10000 1900 11000 1900
Wire Wire Line
10000 2000 11000 2000
Wire Wire Line
10000 2100 11000 2100
Text Label 11000 1900 2 60 ~ 0
GPIO25
Text Label 11000 2000 2 60 ~ 0
GPIO8_(CE0)
Text Label 11000 2100 2 60 ~ 0
CPIO7_(CE1)
NoConn ~ 10000 1800
NoConn ~ 10000 1500
NoConn ~ 10000 1000
Wire Wire Line
9200 1000 8200 1000
Wire Wire Line
9200 1100 8200 1100
Wire Wire Line
9200 1200 8200 1200
Wire Wire Line
9200 1400 8200 1400
Wire Wire Line
9200 1500 8200 1500
Wire Wire Line
9200 1600 8200 1600
Wire Wire Line
9200 1800 8200 1800
Wire Wire Line
9200 1900 8200 1900
Wire Wire Line
9200 2000 8200 2000
NoConn ~ 9200 2100
NoConn ~ 9200 1700
NoConn ~ 9200 1300
Text Label 8200 1000 0 60 ~ 0
GPIO0_(SDA)
Text Label 8200 1100 0 60 ~ 0
GPIO1_(SCL)
Text Label 8200 1200 0 60 ~ 0
GPIO4_(GPCLK0)
Text Label 8200 1400 0 60 ~ 0
GPIO17
Text Label 8200 1500 0 60 ~ 0
GPIO21_(PCM_DOUT)
Text Label 8200 1600 0 60 ~ 0
GPIO22
Text Label 8200 1800 0 60 ~ 0
GPIO10_(MOSI)
Text Label 8200 1900 0 60 ~ 0
GPIO9_(MISO)
Text Label 8200 2000 0 60 ~ 0
GPIO11_(SCKL)
$EndSCHEMATC
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment