Commit 7f1ea9e5 authored by Maciej Suminski's avatar Maciej Suminski

New Footprint Library Wizard.

parent ec1d2128
......@@ -36,26 +36,6 @@ option( KICAD_KEEPCASE
ON
)
# The footprint library wizard uses wxWebview, which needs a system webkit to be built
# The default build option in wxWidgets is to build wxWebview, but it could be not built
# if web kit devel tools are missing
# So this option disable use of wxWebview, if building wxWebview creates issues
# see:
# http://docs.wxwidgets.org/3.0/classwx_web_view.html
# * No issues on Windows.
# * needs webkitgtk-devel package installed on Linux, and wxWidgets rebuilt with this package.
# * Seems also OK on OSX.
# This option has effect only if BUILD_GITHUB_PLUGIN is ON
#
# This option is set to OFF because Kicad developers cannot be sure the use of Webkit does no open
# a security issue when runnig Kicad.
# the probability is low, but not zero.
option( KICAD_USE_WEBKIT
"Use system web kit to build a web viewer in footprint library wizard to easily select github libraries (default ON)."
OFF
)
option( USE_WX_GRAPHICS_CONTEXT
"Use wxGraphicsContext for rendering (default OFF). Warning, this is experimental" )
......@@ -102,17 +82,6 @@ mark_as_advanced( KICAD_SKIP_BOOST ) # Normal builders should build Boost.
option( BUILD_GITHUB_PLUGIN "Build the GITHUB_PLUGIN for pcbnew." ON )
# When KICAD_USE_WEBKIT in on, the Kicad web viewer has access to the www.
# Kicad developers cannot be sure the use of Web viewer does no open a security issue when runnig Kicad.
# the probability is low, but not zero.
#so warn the user:
if( KICAD_USE_WEBKIT )
message( STATUS "by setting KICAD_USE_WEBKIT ON, you are building a web viewer inside Kicad.
Kicad developers cannot be sure the Web access does no open a security issue,
when running a Web Viewer inside Kicad. The probability is low, but not zero.
You are warned" )
endif()
# This can be set to a custom name to brag about a particular branch in the "About" dialog:
set( KICAD_REPO_NAME "product" CACHE STRING "Name of the tree from which this build came." )
......@@ -439,14 +408,7 @@ add_definitions( -DWX_COMPATIBILITY )
# See line 41 of CMakeModules/FindwxWidgets.cmake
set( wxWidgets_CONFIG_OPTIONS --static=no )
if( KICAD_USE_WEBKIT AND BUILD_GITHUB_PLUGIN )
set( webkitlib "webview" )
add_definitions( -DKICAD_USE_WEBKIT )
else()
set( webkitlib "" )
endif()
find_package( wxWidgets 3.0.0 COMPONENTS gl aui adv html core net base xml ${webkitlib} stc REQUIRED )
find_package( wxWidgets 3.0.0 COMPONENTS gl aui adv html core net base xml stc REQUIRED )
# Include wxWidgets macros.
include( ${wxWidgets_USE_FILE} )
......@@ -761,9 +723,6 @@ add_subdirectory( cvpcb )
add_subdirectory( eeschema )
add_subdirectory( gerbview )
add_subdirectory( lib_dxf )
if( KICAD_USE_WEBKIT )
add_subdirectory( webviewer )
endif()
add_subdirectory( pcbnew )
add_subdirectory( polygon )
add_subdirectory( pagelayout_editor )
......
......@@ -543,6 +543,7 @@ set( BMAPS_MID
width_track
width_vias
window_close
wizard_add_fplib_small
zip_tool
zip
zone_duplicate
......
This diff is collapsed.
This diff is collapsed.
......@@ -38,7 +38,6 @@ set( CVPCB_DIALOGS
../pcbnew/dialogs/dialog_fp_plugin_options_base.cpp
../pcbnew/dialogs/wizard_add_fplib_base.cpp
../pcbnew/dialogs/wizard_add_fplib.cpp
../pcbnew/dialogs/dialog_select_dirlist_base.cpp
)
set( CVPCB_SRCS
......
......@@ -540,6 +540,7 @@ EXTERN_BITMAP( width_track_xpm )
EXTERN_BITMAP( width_vias_xpm )
EXTERN_BITMAP( window_close_xpm )
EXTERN_BITMAP( wizard_add_fplib_icon_xpm )
EXTERN_BITMAP( wizard_add_fplib_small_xpm )
EXTERN_BITMAP( zip_tool_xpm )
EXTERN_BITMAP( zip_xpm )
EXTERN_BITMAP( zone_duplicate_xpm )
......
......@@ -130,7 +130,6 @@ set( PCBNEW_DIALOGS
dialogs/dialog_SVG_print_base.cpp
dialogs/dialog_select_pretty_lib.cpp
dialogs/dialog_select_pretty_lib_base.cpp
dialogs/dialog_select_dirlist_base.cpp
dialogs/dialog_set_grid.cpp
dialogs/dialog_set_grid_base.cpp
dialogs/dialog_target_properties_base.cpp
......
......@@ -802,44 +802,46 @@ int DIALOG_FP_LIB_TABLE::m_pageNdx = 0;
void DIALOG_FP_LIB_TABLE::OnClickLibraryWizard( wxCommandEvent& event )
{
wxArrayString envVariableList;
WIZARD_FPLIB_TABLE dlg( this );
// Build the environment variables in use:
for( int ii = 0; ii < m_path_subs_grid->GetTable()->GetRowsCount(); ii ++ )
envVariableList.Add( m_path_subs_grid->GetCellValue( wxGridCellCoords( ii, 0 ) ) );
WIZARD_FPLIB_TABLE dlg( this, envVariableList );
if( ! dlg.RunWizard( dlg.GetFirstPage() ) )
if( !dlg.RunWizard( dlg.GetFirstPage() ) )
return; // Aborted by user
wxGrid* libgrid = m_cur_grid;
const std::vector<WIZARD_FPLIB_TABLE::LIBRARY>& libs = dlg.GetLibraries();
bool global_scope = dlg.GetLibScope() == WIZARD_FPLIB_TABLE::GLOBAL;
wxGrid* libgrid = global_scope ? m_global_grid : m_project_grid;
FP_TBL_MODEL* tbl = (FP_TBL_MODEL*) libgrid->GetTable();
// Import fp library list
int idx = 0;
wxArrayString libDescr; // Will contain nickname, URI, plugin
while( dlg.GetLibDescr( idx++, libDescr ) )
for( std::vector<WIZARD_FPLIB_TABLE::LIBRARY>::const_iterator it = libs.begin();
it != libs.end(); ++it )
{
if( ! libDescr[0].IsEmpty() && m_cur_grid->AppendRows( 1 ) )
if( it->GetStatus() == WIZARD_FPLIB_TABLE::LIBRARY::INVALID )
continue;
if( libgrid->AppendRows( 1 ) )
{
int last_row = libgrid->GetNumberRows() - 1;
// Add the nickname: currently make it from filename
tbl->SetValue( last_row, COL_NICKNAME, libDescr[0] );
// Add the full path:
tbl->SetValue( last_row, COL_URI, libDescr[1] );
tbl->SetValue( last_row, COL_NICKNAME, it->GetDescription() );
// Add the path:
tbl->SetValue( last_row, COL_URI, it->GetAutoPath( dlg.GetLibScope() ) );
// Add the plugin name:
tbl->SetValue( last_row, COL_TYPE, libDescr[2] );
tbl->SetValue( last_row, COL_TYPE, it->GetPluginName() );
libgrid->MakeCellVisible( last_row, 0 );
libgrid->SetGridCursor( last_row, 0 );
}
libDescr.Clear();
}
// Switch to the current scope tab
if( global_scope )
m_auinotebook->SetSelection( 0 );
else
m_auinotebook->SetSelection( 1 );
libgrid->SelectRow( libgrid->GetGridCursorRow() );
}
......@@ -852,3 +854,34 @@ int InvokePcbLibTableEditor( wxTopLevelWindow* aParent, FP_LIB_TABLE* aGlobal, F
return dialogRet;
}
int InvokeFootprintWizard( wxTopLevelWindow* aParent, FP_LIB_TABLE* aGlobal, FP_LIB_TABLE* aProject )
{
WIZARD_FPLIB_TABLE dlg( aParent );
if( !dlg.RunWizard( dlg.GetFirstPage() ) )
return 0; // Aborted by user
const std::vector<WIZARD_FPLIB_TABLE::LIBRARY>& libs = dlg.GetLibraries();
WIZARD_FPLIB_TABLE::LIB_SCOPE scope = dlg.GetLibScope();
FP_LIB_TABLE* fp_tbl = ( scope == WIZARD_FPLIB_TABLE::GLOBAL ? aGlobal : aProject );
if( fp_tbl )
{
for( std::vector<WIZARD_FPLIB_TABLE::LIBRARY>::const_iterator it = libs.begin();
it != libs.end(); ++it )
{
if( it->GetStatus() == WIZARD_FPLIB_TABLE::LIBRARY::INVALID )
continue;
FP_LIB_TABLE::ROW row( it->GetDescription(),
it->GetAutoPath( scope ),
it->GetPluginName(),
wxEmptyString ); // options
fp_tbl->InsertRow( row );
}
}
return scope;
}
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Jun 5 2014)
// C++ code generated with wxFormBuilder (version Mar 9 2015)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!
......@@ -130,14 +130,14 @@ DIALOG_FP_LIB_TABLE_BASE::DIALOG_FP_LIB_TABLE_BASE( wxWindow* parent, wxWindowID
wxBoxSizer* bSizer51;
bSizer51 = new wxBoxSizer( wxHORIZONTAL );
m_buttonWizard = new wxButton( this, wxID_ANY, _("Append with Wizard"), wxDefaultPosition, wxDefaultSize, 0 );
bSizer51->Add( m_buttonWizard, 0, wxALL, 5 );
m_append_button = new wxButton( this, wxID_ANY, _("Append Library"), wxDefaultPosition, wxDefaultSize, 0 );
m_append_button->SetToolTip( _("Add a PCB library row to this table") );
bSizer51->Add( m_append_button, 0, wxALL, 5 );
m_buttonWizard = new wxButton( this, wxID_ANY, _("Append with Wizard"), wxDefaultPosition, wxDefaultSize, 0 );
bSizer51->Add( m_buttonWizard, 0, wxALL, 5 );
m_delete_button = new wxButton( this, wxID_ANY, _("Remove Library"), wxDefaultPosition, wxDefaultSize, 0 );
m_delete_button->SetToolTip( _("Remove a PCB library from this library table") );
......@@ -228,8 +228,8 @@ DIALOG_FP_LIB_TABLE_BASE::DIALOG_FP_LIB_TABLE_BASE( wxWindow* parent, wxWindowID
this->Connect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( DIALOG_FP_LIB_TABLE_BASE::onCancelCaptionButtonClick ) );
this->Connect( wxEVT_KEY_DOWN, wxKeyEventHandler( DIALOG_FP_LIB_TABLE_BASE::onKeyDown ) );
m_auinotebook->Connect( wxEVT_COMMAND_AUINOTEBOOK_PAGE_CHANGED, wxAuiNotebookEventHandler( DIALOG_FP_LIB_TABLE_BASE::pageChangedHandler ), NULL, this );
m_append_button->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_FP_LIB_TABLE_BASE::appendRowHandler ), NULL, this );
m_buttonWizard->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_FP_LIB_TABLE_BASE::OnClickLibraryWizard ), NULL, this );
m_append_button->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_FP_LIB_TABLE_BASE::appendRowHandler ), NULL, this );
m_delete_button->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_FP_LIB_TABLE_BASE::deleteRowHandler ), NULL, this );
m_move_up_button->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_FP_LIB_TABLE_BASE::moveUpHandler ), NULL, this );
m_move_down_button->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_FP_LIB_TABLE_BASE::moveDownHandler ), NULL, this );
......@@ -244,8 +244,8 @@ DIALOG_FP_LIB_TABLE_BASE::~DIALOG_FP_LIB_TABLE_BASE()
this->Disconnect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( DIALOG_FP_LIB_TABLE_BASE::onCancelCaptionButtonClick ) );
this->Disconnect( wxEVT_KEY_DOWN, wxKeyEventHandler( DIALOG_FP_LIB_TABLE_BASE::onKeyDown ) );
m_auinotebook->Disconnect( wxEVT_COMMAND_AUINOTEBOOK_PAGE_CHANGED, wxAuiNotebookEventHandler( DIALOG_FP_LIB_TABLE_BASE::pageChangedHandler ), NULL, this );
m_append_button->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_FP_LIB_TABLE_BASE::appendRowHandler ), NULL, this );
m_buttonWizard->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_FP_LIB_TABLE_BASE::OnClickLibraryWizard ), NULL, this );
m_append_button->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_FP_LIB_TABLE_BASE::appendRowHandler ), NULL, this );
m_delete_button->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_FP_LIB_TABLE_BASE::deleteRowHandler ), NULL, this );
m_move_up_button->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_FP_LIB_TABLE_BASE::moveUpHandler ), NULL, this );
m_move_down_button->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_FP_LIB_TABLE_BASE::moveDownHandler ), NULL, this );
......
......@@ -1031,11 +1031,11 @@
<property name="name">bSizer51</property>
<property name="orient">wxHORIZONTAL</property>
<property name="permission">none</property>
<object class="sizeritem" expanded="0">
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxALL</property>
<property name="proportion">0</property>
<object class="wxButton" expanded="0">
<object class="wxButton" expanded="1">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
......@@ -1064,7 +1064,7 @@
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">Append Library</property>
<property name="label">Append with Wizard</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
......@@ -1072,7 +1072,7 @@
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_append_button</property>
<property name="name">m_buttonWizard</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
......@@ -1085,7 +1085,7 @@
<property name="style"></property>
<property name="subclass"></property>
<property name="toolbar_pane">0</property>
<property name="tooltip">Add a PCB library row to this table</property>
<property name="tooltip"></property>
<property name="validator_data_type"></property>
<property name="validator_style">wxFILTER_NONE</property>
<property name="validator_type">wxDefaultValidator</property>
......@@ -1093,7 +1093,7 @@
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnButtonClick">appendRowHandler</event>
<event name="OnButtonClick">OnClickLibraryWizard</event>
<event name="OnChar"></event>
<event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event>
......@@ -1119,11 +1119,11 @@
<event name="OnUpdateUI"></event>
</object>
</object>
<object class="sizeritem" expanded="1">
<object class="sizeritem" expanded="0">
<property name="border">5</property>
<property name="flag">wxALL</property>
<property name="proportion">0</property>
<object class="wxButton" expanded="1">
<object class="wxButton" expanded="0">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
......@@ -1152,7 +1152,7 @@
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">Append with Wizard</property>
<property name="label">Append Library</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
......@@ -1160,7 +1160,7 @@
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_buttonWizard</property>
<property name="name">m_append_button</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
......@@ -1173,7 +1173,7 @@
<property name="style"></property>
<property name="subclass"></property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="tooltip">Add a PCB library row to this table</property>
<property name="validator_data_type"></property>
<property name="validator_style">wxFILTER_NONE</property>
<property name="validator_type">wxDefaultValidator</property>
......@@ -1181,7 +1181,7 @@
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnButtonClick">OnClickLibraryWizard</event>
<event name="OnButtonClick">appendRowHandler</event>
<event name="OnChar"></event>
<event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event>
......
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Jun 5 2014)
// C++ code generated with wxFormBuilder (version Mar 9 2015)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!
......@@ -51,8 +51,8 @@ class DIALOG_FP_LIB_TABLE_BASE : public DIALOG_SHIM
wxStaticText* m_staticText4;
wxStaticText* m_PrjTableFilename;
wxGrid* m_project_grid;
wxButton* m_append_button;
wxButton* m_buttonWizard;
wxButton* m_append_button;
wxButton* m_delete_button;
wxButton* m_move_up_button;
wxButton* m_move_down_button;
......@@ -66,8 +66,8 @@ class DIALOG_FP_LIB_TABLE_BASE : public DIALOG_SHIM
virtual void onCancelCaptionButtonClick( wxCloseEvent& event ) = 0;
virtual void onKeyDown( wxKeyEvent& event ) = 0;
virtual void pageChangedHandler( wxAuiNotebookEvent& event ) = 0;
virtual void appendRowHandler( wxCommandEvent& event ) = 0;
virtual void OnClickLibraryWizard( wxCommandEvent& event ) = 0;
virtual void appendRowHandler( wxCommandEvent& event ) = 0;
virtual void deleteRowHandler( wxCommandEvent& event ) = 0;
virtual void moveUpHandler( wxCommandEvent& event ) = 0;
virtual void moveDownHandler( wxCommandEvent& event ) = 0;
......
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Jun 5 2014)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!
///////////////////////////////////////////////////////////////////////////
#include "dialog_select_dirlist_base.h"
///////////////////////////////////////////////////////////////////////////
DIALOG_SELECT_DIRLIST_BASE::DIALOG_SELECT_DIRLIST_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( 400,300 ), wxDefaultSize );
wxBoxSizer* bSizerMain;
bSizerMain = new wxBoxSizer( wxVERTICAL );
m_staticText = new wxStaticText( this, wxID_ANY, _("The footprint library is a folder.\nFootprints are files inside this folder."), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText->Wrap( -1 );
m_staticText->SetFont( wxFont( wxNORMAL_FONT->GetPointSize(), 70, 90, 92, false, wxEmptyString ) );
bSizerMain->Add( m_staticText, 0, wxALL|wxALIGN_CENTER_HORIZONTAL, 5 );
m_dirCtrl = new wxGenericDirCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxDIRCTRL_3D_INTERNAL|wxDIRCTRL_DIR_ONLY|wxDIRCTRL_MULTIPLE|wxDIRCTRL_SHOW_FILTERS|wxSUNKEN_BORDER, _("*.pretty|*"), 0 );
m_dirCtrl->ShowHidden( false );
m_dirCtrl->SetMinSize( wxSize( 400,350 ) );
bSizerMain->Add( m_dirCtrl, 1, wxEXPAND | wxALL, 5 );
m_staticline = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL );
bSizerMain->Add( m_staticline, 0, wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 5 );
m_sdbSizer = new wxStdDialogButtonSizer();
m_sdbSizerOK = new wxButton( this, wxID_OK );
m_sdbSizer->AddButton( m_sdbSizerOK );
m_sdbSizerCancel = new wxButton( this, wxID_CANCEL );
m_sdbSizer->AddButton( m_sdbSizerCancel );
m_sdbSizer->Realize();
bSizerMain->Add( m_sdbSizer, 0, wxALIGN_RIGHT|wxALL, 5 );
this->SetSizer( bSizerMain );
this->Layout();
this->Centre( wxBOTH );
// Connect Events
m_dirCtrl->Connect( wxEVT_COMMAND_TREE_ITEM_ACTIVATED, wxTreeEventHandler( DIALOG_SELECT_DIRLIST_BASE::OnSelectFolder ), NULL, this );
m_dirCtrl->Connect( wxEVT_COMMAND_TREE_SEL_CHANGED, wxTreeEventHandler( DIALOG_SELECT_DIRLIST_BASE::OnSelectFolder ), NULL, this );
m_sdbSizerCancel->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_SELECT_DIRLIST_BASE::OnCancelClick ), NULL, this );
m_sdbSizerOK->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_SELECT_DIRLIST_BASE::OnOKClick ), NULL, this );
}
DIALOG_SELECT_DIRLIST_BASE::~DIALOG_SELECT_DIRLIST_BASE()
{
// Disconnect Events
m_dirCtrl->Disconnect( wxEVT_COMMAND_TREE_ITEM_ACTIVATED, wxTreeEventHandler( DIALOG_SELECT_DIRLIST_BASE::OnSelectFolder ), NULL, this );
m_dirCtrl->Disconnect( wxEVT_COMMAND_TREE_SEL_CHANGED, wxTreeEventHandler( DIALOG_SELECT_DIRLIST_BASE::OnSelectFolder ), NULL, this );
m_sdbSizerCancel->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_SELECT_DIRLIST_BASE::OnCancelClick ), NULL, this );
m_sdbSizerOK->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_SELECT_DIRLIST_BASE::OnOKClick ), NULL, this );
}
This diff is collapsed.
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Jun 5 2014)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!
///////////////////////////////////////////////////////////////////////////
#ifndef __DIALOG_SELECT_DIRLIST_BASE_H__
#define __DIALOG_SELECT_DIRLIST_BASE_H__
#include <wx/artprov.h>
#include <wx/xrc/xmlres.h>
#include <wx/intl.h>
class DIALOG_SHIM;
#include "dialog_shim.h"
#include <wx/string.h>
#include <wx/stattext.h>
#include <wx/gdicmn.h>
#include <wx/font.h>
#include <wx/colour.h>
#include <wx/settings.h>
#include <wx/dirctrl.h>
#include <wx/statline.h>
#include <wx/sizer.h>
#include <wx/button.h>
#include <wx/dialog.h>
///////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
/// Class DIALOG_SELECT_DIRLIST_BASE
///////////////////////////////////////////////////////////////////////////////
class DIALOG_SELECT_DIRLIST_BASE : public DIALOG_SHIM
{
private:
protected:
wxStaticText* m_staticText;
wxGenericDirCtrl* m_dirCtrl;
wxStaticLine* m_staticline;
wxStdDialogButtonSizer* m_sdbSizer;
wxButton* m_sdbSizerOK;
wxButton* m_sdbSizerCancel;
// Virtual event handlers, overide them in your derived class
virtual void OnSelectFolder( wxTreeEvent& event ) { event.Skip(); }
virtual void OnCancelClick( wxCommandEvent& event ) { event.Skip(); }
virtual void OnOKClick( wxCommandEvent& event ) { event.Skip(); }
public:
DIALOG_SELECT_DIRLIST_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Select Footprint Library Folder"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 400,321 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
~DIALOG_SELECT_DIRLIST_BASE();
};
#endif //__DIALOG_SELECT_DIRLIST_BASE_H__
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Jun 5 2014)
// C++ code generated with wxFormBuilder (version Mar 9 2015)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!
......@@ -10,24 +10,25 @@
#include <wx/artprov.h>
#include <wx/xrc/xmlres.h>
#include <wx/intl.h>
#include <wx/string.h>
#include <wx/radiobox.h>
#include <wx/stattext.h>
#include <wx/gdicmn.h>
#include <wx/font.h>
#include <wx/colour.h>
#include <wx/settings.h>
#include <wx/statline.h>
#include <wx/radiobut.h>
#include <wx/sizer.h>
#include <wx/textctrl.h>
#include <wx/checkbox.h>
#include <wx/button.h>
#include <wx/hyperlink.h>
#include <wx/bitmap.h>
#include <wx/image.h>
#include <wx/icon.h>
#include <wx/statbmp.h>
#include <wx/stattext.h>
#include <wx/textctrl.h>
#include <wx/sizer.h>
#include <wx/grid.h>
#include <wx/button.h>
#include <wx/statbox.h>
#include <wx/dirctrl.h>
#include <wx/checklst.h>
#include <wx/srchctrl.h>
#include <wx/dataview.h>
#include <wx/wizard.h>
#include <wx/dynarray.h>
WX_DEFINE_ARRAY_PTR( wxWizardPageSimple*, WizardPages );
......@@ -43,45 +44,47 @@ class WIZARD_FPLIB_TABLE_BASE : public wxWizard
private:
protected:
wxRadioBox* m_rbFpLibFormat;
wxStaticLine* m_staticline2;
wxStaticBitmap* m_bitmapGithubURL;
wxStaticText* m_staticText10;
wxTextCtrl* m_textCtrlGithubURL;
wxRadioBox* m_rbPathManagement;
wxStaticText* m_staticText1;
wxGrid* m_gridEnvironmentVariablesList;
wxButton* m_buttonAddEV;
wxButton* m_buttonRemoveEV;
wxStaticText* m_textPluginTitle;
wxStaticText* m_textPluginType;
wxStaticText* m_textOptionTitle;
wxStaticText* m_textOption;
wxStaticText* m_stPathTitle;
wxStaticText* m_textPath;
wxStaticText* m_staticText2;
wxGrid* m_gridFpListLibs;
wxButton* m_buttonGithubLibList;
wxButton* m_buttonAddLib;
wxButton* m_buttonRemoveLib;
wxRadioButton* m_radioAddLocal;
wxRadioButton* m_radioAddGithub;
wxTextCtrl* m_textCtrlGithubURL;
wxCheckBox* m_downloadGithub;
wxStaticText* m_downloadDir;
wxButton* m_btnBrowse;
wxStaticText* m_invalidDir;
wxStaticText* m_staticText8;
wxHyperlinkCtrl* m_hyperlink1;
wxStaticText* m_staticText9;
wxStaticText* m_staticText7;
wxGenericDirCtrl* m_filePicker;
wxStaticText* m_staticText112;
wxCheckListBox* m_checkListGH;
wxButton* m_btnSelectAllGH;
wxButton* m_btnUnselectAllGH;
wxSearchCtrl* m_searchCtrlGH;
wxStaticText* m_staticText1121;
wxDataViewListCtrl* m_listCtrlReview;
wxDataViewColumn* m_dvLibName;
wxDataViewColumn* m_dvLibStatus;
wxDataViewColumn* m_dvLibFormat;
wxStaticText* m_staticText12;
wxRadioButton* m_radioGlobal;
wxRadioButton* m_radioProject;
// Virtual event handlers, overide them in your derived class
virtual void OnFinish( wxWizardEvent& event ) { event.Skip(); }
virtual void OnWizardFinished( wxWizardEvent& event ) { event.Skip(); }
virtual void OnPageChanged( wxWizardEvent& event ) { event.Skip(); }
virtual void OnPageChanging( wxWizardEvent& event ) { event.Skip(); }
virtual void OnPluginSelection( wxCommandEvent& event ) { event.Skip(); }
virtual void OnPathManagementSelection( wxCommandEvent& event ) { event.Skip(); }
virtual void OnSelectEnvVarCell( wxGridEvent& event ) { event.Skip(); }
virtual void OnAddEVariable( wxCommandEvent& event ) { event.Skip(); }
virtual void OnRemoveEVariable( wxCommandEvent& event ) { event.Skip(); }
virtual void OnGithubLibsList( wxCommandEvent& event ) { event.Skip(); }
virtual void OnAddFpLibs( wxCommandEvent& event ) { event.Skip(); }
virtual void OnRemoveFpLibs( wxCommandEvent& event ) { event.Skip(); }
virtual void OnCheckSaveCopy( wxCommandEvent& event ) { event.Skip(); }
virtual void OnBrowseButtonClick( wxCommandEvent& event ) { event.Skip(); }
virtual void OnSelectAllGH( wxCommandEvent& event ) { event.Skip(); }
virtual void OnUnselectAllGH( wxCommandEvent& event ) { event.Skip(); }
virtual void OnChangeSearch( wxCommandEvent& event ) { event.Skip(); }
public:
WIZARD_FPLIB_TABLE_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Footprint Library Wizard"), const wxBitmap& bitmap = wxArtProvider::GetBitmap( wxART_HELP_BOOK, wxART_FRAME_ICON ), const wxPoint& pos = wxDefaultPosition, long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
WIZARD_FPLIB_TABLE_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = wxT("Add Footprint Libraries Wizard"), const wxBitmap& bitmap = wxArtProvider::GetBitmap( wxART_HELP_BOOK, wxART_FRAME_ICON ), const wxPoint& pos = wxDefaultPosition, long style = wxCAPTION|wxCLOSE_BOX|wxDEFAULT_DIALOG_STYLE|wxMAXIMIZE_BOX|wxRESIZE_BORDER );
WizardPages m_pages;
~WIZARD_FPLIB_TABLE_BASE();
......
......@@ -73,6 +73,23 @@ class PCB_PLOT_PARAMS;
*/
int InvokePcbLibTableEditor( wxTopLevelWindow* aCaller, FP_LIB_TABLE* aGlobal, FP_LIB_TABLE* aProject );
/**
* Function InvokeFootprintWizard
* Runs the footprint library wizard for easy library addition.
*
* @param aCaller is the wxTopLevelWindow which is invoking the dialog.
* @param aGlobal is the common footprint library table file being edited. If aGlobal is NULL, then
* it will not be updated.
* @param aProject is the project specific footprint library table file being edited. if aProject
* is NULL, then it will not be updated.
*
* @return int 0 - no changes
* 1 - changes in the global table
* 2 - changes in the project table
* 3 - changes in both tables
*/
int InvokeFootprintWizard( wxTopLevelWindow* aParent, FP_LIB_TABLE* aGlobal, FP_LIB_TABLE* aProject );
/**
* Function InvokePluginOptionsEditor
* calls DIALOG_FP_PLUGIN_OPTIONS dialog so that plugin options set can be edited.
......
......@@ -280,8 +280,12 @@ void FOOTPRINT_EDIT_FRAME::ReCreateMenuBar()
//----- Preferences menu -----------------
wxMenu* prefs_menu = new wxMenu;
AddMenuItem( prefs_menu, ID_PCB_LIB_WIZARD,
_( "&Footprint Libraries Wizard" ), _( "Add footprint libraries with wizard" ),
KiBitmap( wizard_add_fplib_small_xpm ) );
AddMenuItem( prefs_menu, ID_PCB_LIB_TABLE_EDIT,
_( "Footprint Li&braries" ), _( "Configure footprint libraries" ),
_( "Footprint Li&braries Manager" ), _( "Configure footprint libraries" ),
KiBitmap( library_table_xpm ) );
// Path configuration edit dialog.
......
......@@ -480,8 +480,12 @@ void PCB_EDIT_FRAME::ReCreateMenuBar()
//----- Preferences and configuration menu------------------------------------
wxMenu* configmenu = new wxMenu;
AddMenuItem( configmenu, ID_PCB_LIB_WIZARD,
_( "&Footprint Libraries Wizard" ), _( "Add footprint libraries with wizard" ),
KiBitmap( wizard_add_fplib_small_xpm ) );
AddMenuItem( configmenu, ID_PCB_LIB_TABLE_EDIT,
_( "Footprint Li&braries" ), _( "Configure footprint libraries" ),
_( "Footprint Li&braries Manager" ), _( "Configure footprint libraries" ),
KiBitmap( library_table_xpm ) );
// Path configuration edit dialog.
......
......@@ -116,7 +116,7 @@ BEGIN_EVENT_TABLE( FOOTPRINT_EDIT_FRAME, PCB_BASE_FRAME )
EVT_TOOL( ID_TB_OPTIONS_SHOW_MODULE_EDGE_SKETCH, FOOTPRINT_EDIT_FRAME::OnSelectOptionToolbar )
EVT_TOOL( ID_TB_OPTIONS_SHOW_HIGH_CONTRAST_MODE, FOOTPRINT_EDIT_FRAME::OnSelectOptionToolbar )
// Preferences et option menus
// Preferences and option menus
EVT_MENU( ID_PREFERENCES_HOTKEY_EXPORT_CONFIG,
FOOTPRINT_EDIT_FRAME::ProcessPreferences )
EVT_MENU( ID_PREFERENCES_HOTKEY_IMPORT_CONFIG,
......@@ -125,6 +125,8 @@ BEGIN_EVENT_TABLE( FOOTPRINT_EDIT_FRAME, PCB_BASE_FRAME )
FOOTPRINT_EDIT_FRAME::ProcessPreferences )
EVT_MENU( ID_PREFERENCES_HOTKEY_SHOW_CURRENT_LIST,
FOOTPRINT_EDIT_FRAME::ProcessPreferences )
EVT_MENU( ID_PCB_LIB_WIZARD,
FOOTPRINT_EDIT_FRAME::ProcessPreferences )
EVT_MENU( ID_PCB_LIB_TABLE_EDIT,
FOOTPRINT_EDIT_FRAME::ProcessPreferences )
EVT_MENU( wxID_PREFERENCES,
......@@ -851,10 +853,16 @@ void FOOTPRINT_EDIT_FRAME::ProcessPreferences( wxCommandEvent& event )
DisplayHotkeyList( this, g_Module_Editor_Hokeys_Descr );
break;
case ID_PCB_LIB_WIZARD:
case ID_PCB_LIB_TABLE_EDIT:
{
bool tableChanged = false;
int r = InvokePcbLibTableEditor( this, &GFootprintTable, Prj().PcbFootprintLibs() );
int r = 0;
if( id == ID_PCB_LIB_TABLE_EDIT )
r = InvokePcbLibTableEditor( this, &GFootprintTable, Prj().PcbFootprintLibs() );
else
r = InvokeFootprintWizard( this, &GFootprintTable, Prj().PcbFootprintLibs() );
if( r & 1 )
{
......
......@@ -134,6 +134,7 @@ BEGIN_EVENT_TABLE( PCB_EDIT_FRAME, PCB_BASE_FRAME )
// menu Config
EVT_MENU( ID_PCB_DRAWINGS_WIDTHS_SETUP, PCB_EDIT_FRAME::OnConfigurePcbOptions )
EVT_MENU( ID_PCB_LIB_TABLE_EDIT, PCB_EDIT_FRAME::Process_Config )
EVT_MENU( ID_PCB_LIB_WIZARD, PCB_EDIT_FRAME::Process_Config )
EVT_MENU( ID_PREFERENCES_CONFIGURE_PATHS, PCB_EDIT_FRAME::OnConfigurePaths )
EVT_MENU( ID_CONFIG_SAVE, PCB_EDIT_FRAME::Process_Config )
EVT_MENU( ID_CONFIG_READ, PCB_EDIT_FRAME::Process_Config )
......
......@@ -112,10 +112,16 @@ void PCB_EDIT_FRAME::Process_Config( wxCommandEvent& event )
}
break;
case ID_PCB_LIB_WIZARD:
case ID_PCB_LIB_TABLE_EDIT:
{
bool tableChanged = false;
int r = InvokePcbLibTableEditor( this, &GFootprintTable, Prj().PcbFootprintLibs() );
int r = 0;
if( id == ID_PCB_LIB_TABLE_EDIT )
r = InvokePcbLibTableEditor( this, &GFootprintTable, Prj().PcbFootprintLibs() );
else
r = InvokeFootprintWizard( this, &GFootprintTable, Prj().PcbFootprintLibs() );
if( r & 1 )
{
......
......@@ -294,6 +294,7 @@ enum pcbnew_ids
ID_MENU_CANVAS_CAIRO,
ID_PCB_USER_GRID_SETUP,
ID_PCB_GEN_BOM_FILE_FROM_BOARD,
ID_PCB_LIB_WIZARD,
ID_PCB_LIB_TABLE_EDIT,
ID_MENU_PCB_SHOW_DESIGN_RULES_DIALOG,
ID_MENU_PCB_SHOW_HIDE_LAYERS_MANAGER_DIALOG,
......
include_directories(BEFORE ${INC_BEFORE})
include_directories(
${INC_AFTER}
)
set( WEBVIEW_SRCS
html_link_parser.cpp
webviewer.cpp
)
add_library( webviewer STATIC ${WEBVIEW_SRCS})
add_dependencies( webviewer lib-dependencies )
/**
* @file html_link_parse.cpp
*/
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 1992-2014 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
*/
/*
* wxWidgets gives very few info about wxwebkit. For more info and more comments:
* see https://forums.wxwidgets.org/viewtopic.php?f=1&t=1119#
*/
#include <wx/wx.h>
#include <wx/html/htmlpars.h>
#include "html_link_parser.h"
bool LINK_TAGHANDLER::HandleTag(const wxHtmlTag& tag)
{
if( tag.HasParam( wxT("HREF") ) )
{
wxString href( tag.GetParam( wxT("HREF") ) );
// Add the first parameter (the link)
m_Parser->AddString( href );
// Parse other params, but do nothing, becuse the AddText() callback
// do nothing
ParseInner(tag);
return true;
}
else
return false;
}
HTML_LINK_PARSER::HTML_LINK_PARSER( const wxString& aSrc, wxArrayString& aUrls )
: m_src( aSrc ), stringUrls( aUrls )
{
AddTagHandler( new LINK_TAGHANDLER(this) );
}
void HTML_LINK_PARSER::AddString( const wxString& aText )
{
wxString text = aText;
text.Trim( true );
text.Trim( false );
if( ! m_filter || m_filter( text ) )
{
stringUrls.Add( text );
}
}
/**
* @file html_link_parse.h
*/
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 1992-2014 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
*/
/*
* wxWidgets gives very few info about wxwebkit. For more info and more comments:
* see https://forums.wxwidgets.org/viewtopic.php?f=1&t=1119#
*/
#ifndef HTML_LINK_PARSE_H
#define HTML_LINK_PARSE_H
#include <wx/wx.h>
#include <wx/html/htmlpars.h>
class HTML_LINK_PARSER ;
/**
* a Tag parser, to extract tagged data in html text.
* this tag handler extract a url link, givent by tag "A"
* like:
* "<a href="/KiCad/Valves.pretty" itemprop="name codeRepository"> Valves.pretty</a>"
* the tag is "a"
* and the link is the parameter given by "href"
*/
class LINK_TAGHANDLER : public wxHtmlTagHandler
{
HTML_LINK_PARSER* m_Parser;
public:
LINK_TAGHANDLER() : m_Parser( NULL )
{
}
LINK_TAGHANDLER( HTML_LINK_PARSER* aParser ) : m_Parser( aParser )
{
}
wxString GetSupportedTags()
{
return "A";
}
bool HandleTag(const wxHtmlTag& tag);
};
/**
* The engine to parse a html text and extract useful data
* Here, the useful data are url links
*/
class HTML_LINK_PARSER : public wxHtmlParser
{
const wxString& m_src; // the html text to parse
wxArrayString& stringUrls; // the strings extracted from html text
bool (*m_filter)( const wxString& aData ); // a callback function to filter strings
public:
HTML_LINK_PARSER( const wxString& aSrc, wxArrayString& aUrls );
/**
* Parse the html text and store links in stringUrls
* Stored links can be filtered if aFilter is non NULL
* @param aFilter a filtering function ( bool aFilter( const wxString& aData ) )
* which return true if the tex(t aData must be stored.
*/
void ParseLinks( bool (*aFilter)( const wxString& aData ) )
{
m_filter = aFilter;
Parse(m_src);
}
// virtual pure from wxHtmlParser, do nothing here, but needed.
void AddText( const wxString& aText ){}
// Our "AddText" used to store selected text (the url link)
void AddString( const wxString& aText );
wxObject* GetProduct()
{
return NULL;
}
};
#endif // ifndef HTML_LINK_PARSE_H
This diff is collapsed.
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