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
......
/* Do not modify this file, it was automatically generated by the
* PNG2cpp CMake script, using a *.png file as input.
*/
#include <bitmaps.h>
static const unsigned char png[] = {
0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a, 0x00, 0x00, 0x00, 0x0d, 0x49, 0x48, 0x44, 0x52,
0x00, 0x00, 0x00, 0x1a, 0x00, 0x00, 0x00, 0x1a, 0x08, 0x06, 0x00, 0x00, 0x00, 0xa9, 0x4a, 0x4c,
0xce, 0x00, 0x00, 0x07, 0x7e, 0x49, 0x44, 0x41, 0x54, 0x48, 0xc7, 0xa5, 0x56, 0x6b, 0x50, 0x93,
0xe9, 0x15, 0x4e, 0xb5, 0x56, 0x2b, 0x20, 0x38, 0x28, 0x63, 0x87, 0x76, 0xa6, 0x63, 0xfd, 0xb1,
0xe5, 0x47, 0xad, 0xda, 0xce, 0x56, 0x64, 0x67, 0x9d, 0x62, 0x71, 0x99, 0x56, 0x91, 0x9d, 0x81,
0x1d, 0xca, 0x02, 0xae, 0xcb, 0x52, 0x06, 0xb9, 0x2a, 0x14, 0x65, 0x16, 0x17, 0x51, 0x61, 0x01,
0x03, 0x04, 0x17, 0x08, 0x04, 0x02, 0x01, 0xc5, 0x22, 0x08, 0x04, 0x48, 0x02, 0x81, 0x90, 0x00,
0x49, 0xc0, 0x70, 0x47, 0x90, 0x90, 0x90, 0x40, 0xf8, 0xc2, 0x45, 0x44, 0xee, 0x21, 0x5c, 0x73,
0x7a, 0xde, 0x54, 0xb7, 0xb6, 0xd3, 0x0b, 0xdb, 0xbe, 0x33, 0x67, 0xbe, 0x6f, 0xbe, 0xf7, 0xf2,
0x9c, 0xf3, 0x9c, 0xe7, 0x9c, 0xf7, 0xa3, 0xd1, 0xfe, 0x3e, 0x4e, 0x1f, 0x3a, 0x74, 0x28, 0x69,
0xcf, 0x9e, 0x3d, 0xa7, 0xf0, 0xfd, 0x7b, 0xb4, 0xff, 0x6f, 0x7c, 0x1f, 0xc7, 0x07, 0x07, 0x0f,
0x1e, 0x4c, 0xc2, 0xf7, 0x33, 0xe6, 0x2f, 0xbb, 0x77, 0xef, 0xfe, 0x3d, 0x3e, 0x4e, 0xa0, 0x7d,
0xe4, 0xeb, 0xeb, 0xcb, 0x76, 0x77, 0x77, 0xcf, 0x46, 0x40, 0x3a, 0x02, 0x9e, 0xfc, 0x1f, 0x00,
0x2c, 0xac, 0xad, 0xad, 0x3f, 0x41, 0xcb, 0xf6, 0xf2, 0xf2, 0xca, 0xbd, 0x70, 0xe1, 0x42, 0x39,
0x02, 0xc6, 0x1f, 0x38, 0x70, 0x20, 0x88, 0x4c, 0x72, 0x9c, 0x9d, 0x9d, 0x99, 0x7b, 0xf7, 0xee,
0xad, 0xb9, 0x7c, 0xf9, 0x72, 0xbf, 0x52, 0xa9, 0x14, 0xf7, 0xf6, 0xf6, 0x96, 0x9e, 0x3f, 0x7f,
0x3e, 0xdb, 0xce, 0xce, 0xee, 0x36, 0xce, 0xff, 0x64, 0x27, 0x00, 0x96, 0x96, 0x96, 0x9e, 0x08,
0x90, 0x1b, 0x12, 0x12, 0x52, 0x25, 0x16, 0x8b, 0x3b, 0xd0, 0x54, 0x7e, 0x7e, 0x7e, 0x43, 0x78,
0x8e, 0x60, 0xff, 0xfe, 0xfd, 0x39, 0xb4, 0x5d, 0xbb, 0x76, 0x15, 0x6e, 0x6d, 0x6d, 0x71, 0x2a,
0x2a, 0x2a, 0xf8, 0x69, 0x69, 0x69, 0x2a, 0xa9, 0x54, 0xaa, 0xcd, 0xc9, 0xc9, 0xd1, 0xc9, 0x64,
0xb2, 0xe7, 0x8f, 0x1f, 0x3f, 0xae, 0x3f, 0x7a, 0xf4, 0x28, 0xd3, 0xc6, 0xc6, 0xc6, 0xed, 0xdf,
0xd1, 0x89, 0x1e, 0x9f, 0x46, 0x8f, 0x8b, 0xfc, 0xfd, 0xfd, 0xe5, 0x35, 0x35, 0x35, 0xaa, 0x96,
0x96, 0x16, 0x35, 0x97, 0xcb, 0xa5, 0x16, 0x16, 0x16, 0x34, 0x59, 0x59, 0x59, 0xaa, 0xcc, 0xcc,
0x4c, 0x01, 0xce, 0x67, 0x12, 0xea, 0xd8, 0xeb, 0xeb, 0xeb, 0x1c, 0x9c, 0xe4, 0xa7, 0xa7, 0xa7,
0x6b, 0x5e, 0xbd, 0x7a, 0x45, 0xcd, 0xcf, 0xcf, 0x8f, 0x09, 0x04, 0x02, 0x0a, 0xbf, 0x69, 0x1b,
0x1a, 0x1a, 0x94, 0x17, 0x2f, 0x5e, 0xe4, 0x63, 0x74, 0x5f, 0x11, 0xcf, 0xdf, 0xc1, 0xb0, 0xc2,
0x91, 0xe0, 0xe0, 0xe0, 0xd0, 0x56, 0x5a, 0x5a, 0x3a, 0x8c, 0x43, 0x23, 0x91, 0x48, 0xa8, 0xbe,
0xbe, 0xbe, 0xf1, 0xd5, 0xd5, 0xd5, 0xd1, 0xc5, 0xc5, 0x45, 0x5d, 0x6a, 0x6a, 0xaa, 0x3a, 0x23,
0x23, 0x83, 0x8f, 0x8e, 0xa6, 0xd3, 0x30, 0x17, 0xf9, 0x2b, 0x2b, 0x2b, 0x1c, 0x1e, 0x8f, 0x57,
0x8b, 0x1e, 0x0c, 0x03, 0xc0, 0x08, 0x59, 0x34, 0x33, 0x33, 0x43, 0x21, 0x8d, 0x54, 0x55, 0x55,
0xd5, 0x44, 0x57, 0x57, 0x97, 0xfa, 0xfa, 0xf5, 0xeb, 0x43, 0xe8, 0xd9, 0xc3, 0x37, 0x60, 0x3f,
0x45, 0x9a, 0x44, 0xa1, 0xa1, 0xa1, 0x4a, 0x8a, 0xa2, 0x46, 0x70, 0x7e, 0x1c, 0x99, 0xd0, 0xa3,
0x83, 0x3a, 0xb2, 0x77, 0x6d, 0x6d, 0x6d, 0x94, 0x9c, 0x83, 0x40, 0xc3, 0x68, 0x3c, 0x14, 0x45,
0x32, 0x0d, 0x73, 0x93, 0x87, 0x93, 0x9c, 0xba, 0xba, 0xba, 0x1a, 0xe2, 0x01, 0x89, 0x68, 0x63,
0x63, 0x43, 0x4b, 0x16, 0x1a, 0x0c, 0x86, 0xb1, 0x81, 0x81, 0x81, 0x49, 0x1f, 0x1f, 0x17, 0x43,
0x67, 0x67, 0xa7, 0xee, 0xd6, 0xad, 0x5b, 0x4a, 0xf4, 0x4e, 0x84, 0x20, 0xbd, 0x85, 0x85, 0x85,
0x2a, 0x8d, 0x46, 0x33, 0xe6, 0xef, 0xef, 0xb4, 0xea, 0xed, 0xfd, 0xa1, 0x71, 0x69, 0x69, 0x69,
0x8c, 0xec, 0x21, 0x46, 0x80, 0xc8, 0x39, 0x89, 0x89, 0x89, 0xaa, 0x94, 0x94, 0x94, 0x5a, 0x5b,
0x5b, 0xdb, 0x7b, 0xb4, 0x7d, 0xfb, 0xf6, 0xe5, 0xce, 0xce, 0xce, 0x72, 0x1a, 0x1b, 0x1b, 0xab,
0x31, 0x47, 0xc3, 0x98, 0x2f, 0x4d, 0x7b, 0x7b, 0xfb, 0x24, 0x59, 0x38, 0x37, 0x37, 0x37, 0xbe,
0xbd, 0xbd, 0x3d, 0x12, 0x1c, 0x7c, 0x74, 0x93, 0x4e, 0x3f, 0xb2, 0x1d, 0x10, 0xe0, 0xb4, 0x7a,
0xf2, 0xe4, 0x2f, 0x0c, 0x61, 0x61, 0x61, 0x53, 0x77, 0xee, 0x5c, 0x9d, 0xbf, 0x76, 0xed, 0xc7,
0x5b, 0x73, 0x73, 0x16, 0x70, 0xf3, 0xa6, 0xe7, 0x92, 0xd1, 0x68, 0x34, 0x1f, 0x3e, 0x35, 0x35,
0x45, 0x75, 0x77, 0x77, 0x4f, 0x10, 0xc0, 0x84, 0x84, 0x84, 0x61, 0x3a, 0x9d, 0x5e, 0x83, 0x40,
0x77, 0x69, 0xa8, 0x08, 0x26, 0x4e, 0x72, 0x90, 0x5f, 0x6e, 0x52, 0x52, 0xd2, 0x30, 0x82, 0x52,
0x48, 0xdb, 0x28, 0x8a, 0x81, 0xea, 0xe9, 0xe9, 0xa1, 0xc8, 0xe6, 0xc8, 0x48, 0x27, 0x23, 0x80,
0x25, 0x6c, 0x6c, 0x58, 0x02, 0x93, 0x69, 0x69, 0x0a, 0x08, 0x38, 0xb2, 0xa9, 0x54, 0x5a, 0x01,
0xf9, 0x36, 0x31, 0x61, 0x01, 0x89, 0x89, 0x11, 0x8b, 0x3a, 0x9d, 0x8e, 0x22, 0x7b, 0x14, 0x0a,
0xc5, 0x38, 0x32, 0x34, 0xfa, 0xfa, 0xf5, 0xeb, 0xf1, 0xf8, 0xf8, 0x78, 0x25, 0xe6, 0x9d, 0x8b,
0x40, 0x77, 0x68, 0x28, 0xcb, 0x6c, 0xbd, 0x5e, 0xcf, 0x69, 0x6e, 0x6e, 0xe6, 0x26, 0x27, 0x27,
0x2b, 0x31, 0x02, 0x0d, 0x89, 0x84, 0x00, 0x8c, 0x8c, 0x8c, 0xe8, 0xd1, 0x01, 0x7d, 0x74, 0xb4,
0xd7, 0xf2, 0xc2, 0x82, 0x85, 0xf9, 0x60, 0x62, 0x46, 0xe3, 0x41, 0x10, 0x4b, 0xdc, 0xa0, 0x45,
0xea, 0x02, 0x62, 0xb1, 0x0d, 0x24, 0x27, 0xdf, 0x9d, 0x45, 0x6a, 0xf5, 0x64, 0xcf, 0x1b, 0x31,
0x8d, 0x9b, 0x4c, 0x26, 0x4d, 0x5c, 0x5c, 0x9c, 0x32, 0x35, 0x2d, 0x9d, 0x8f, 0x75, 0x79, 0x9b,
0x86, 0x09, 0xce, 0x42, 0x6f, 0x38, 0xa8, 0xfb, 0x6a, 0xe4, 0xd3, 0x1c, 0xd1, 0xdb, 0x1c, 0x11,
0x1a, 0xc9, 0x46, 0x06, 0x23, 0x65, 0x4e, 0x28, 0x3c, 0x60, 0x7a, 0x0b, 0xd4, 0xf7, 0xfc, 0x14,
0x74, 0xf7, 0x48, 0x60, 0x74, 0x74, 0x14, 0x9e, 0x56, 0xe6, 0x40, 0x5e, 0x1e, 0x73, 0xe1, 0x9f,
0x73, 0x34, 0x33, 0xf3, 0x8a, 0xca, 0xc8, 0x2d, 0x5e, 0xce, 0x2f, 0xa9, 0x5e, 0xfa, 0xb5, 0xa3,
0x53, 0xa6, 0x99, 0xba, 0xc9, 0xc9, 0x49, 0x8e, 0x48, 0x24, 0xaa, 0x26, 0x2a, 0x21, 0x87, 0xa3,
0xa4, 0xa7, 0xc7, 0xc7, 0xc7, 0xcd, 0x1e, 0xa2, 0xf4, 0x35, 0x21, 0x21, 0xae, 0x06, 0xad, 0xd6,
0xea, 0xdb, 0x88, 0x88, 0xf5, 0xf4, 0x9e, 0x81, 0xae, 0xee, 0x26, 0x18, 0x1b, 0x1b, 0x83, 0x6c,
0x66, 0x8c, 0xa9, 0xb4, 0x94, 0x39, 0x4b, 0xd6, 0xbf, 0x78, 0xf1, 0x62, 0x42, 0xde, 0xd6, 0x3e,
0xc5, 0x6f, 0x6c, 0x33, 0x36, 0x77, 0xa9, 0xa1, 0xb5, 0x57, 0x03, 0x29, 0x19, 0x05, 0x93, 0x04,
0x28, 0x07, 0x73, 0xc2, 0xc1, 0xc3, 0x6b, 0x88, 0x18, 0xde, 0x88, 0x40, 0x87, 0x54, 0x98, 0x25,
0x1b, 0x16, 0x76, 0xd1, 0x30, 0x30, 0x60, 0x6d, 0x32, 0x1a, 0x6d, 0x40, 0xd1, 0xf1, 0xc1, 0x3f,
0x80, 0xb5, 0xca, 0x58, 0x80, 0xf2, 0x86, 0x96, 0xd6, 0x02, 0x8c, 0xca, 0x6e, 0x2b, 0x3a, 0xda,
0x77, 0x51, 0xad, 0x56, 0xeb, 0xea, 0x24, 0x6d, 0x06, 0x49, 0x97, 0x12, 0x1a, 0xdb, 0x07, 0xa0,
0xba, 0x41, 0xbe, 0xf9, 0xc9, 0xa7, 0x9f, 0x57, 0x13, 0x79, 0xb3, 0x90, 0x53, 0xb3, 0xbc, 0x1f,
0x3c, 0x78, 0x30, 0xfc, 0xae, 0x3c, 0x23, 0x22, 0xdc, 0x51, 0xd6, 0x7f, 0xa3, 0xac, 0x45, 0xea,
0x0a, 0x1a, 0xed, 0x10, 0x1e, 0xea, 0x05, 0x2b, 0x2b, 0xb6, 0x48, 0xdd, 0xef, 0x40, 0xa5, 0xea,
0x00, 0x4c, 0x3c, 0xc8, 0xe4, 0xb9, 0xd0, 0xdf, 0xbf, 0x1f, 0xfc, 0xfc, 0x6c, 0xb7, 0xe3, 0xe2,
0xae, 0x2d, 0xf2, 0x1a, 0xa5, 0x6b, 0xb5, 0x4d, 0xed, 0xc0, 0x15, 0xb6, 0xc2, 0x37, 0x39, 0x45,
0x7a, 0x14, 0xc3, 0xd7, 0xe6, 0x82, 0x45, 0x7e, 0xcd, 0x05, 0x8b, 0x0a, 0x51, 0x4f, 0x4c, 0x4c,
0xe8, 0x5f, 0xbe, 0x7c, 0x49, 0xf5, 0xf6, 0xf6, 0xe8, 0x3f, 0xfb, 0xcc, 0xd1, 0x18, 0x13, 0xf3,
0x9b, 0xb5, 0xa8, 0xa8, 0xf7, 0x36, 0xa2, 0xfe, 0x7c, 0x7a, 0x6b, 0x60, 0xb0, 0x1f, 0xd4, 0x6a,
0x25, 0xb4, 0x3d, 0xe3, 0xc3, 0xe0, 0x60, 0x27, 0x20, 0xbd, 0xa0, 0xd5, 0x6a, 0x11, 0x5c, 0x62,
0xca, 0xca, 0x4e, 0x5b, 0xc4, 0x02, 0xd7, 0xd5, 0x0a, 0x9b, 0x57, 0x05, 0x22, 0x19, 0x54, 0xd6,
0x36, 0xae, 0xd1, 0x33, 0x98, 0x73, 0xe9, 0xe9, 0x0c, 0x81, 0xb9, 0x60, 0x11, 0x88, 0x8d, 0x35,
0xc0, 0xa9, 0xad, 0xad, 0xe5, 0x61, 0x5f, 0x52, 0xe1, 0xbb, 0x56, 0x2e, 0x97, 0x53, 0xa8, 0xb6,
0x49, 0x52, 0x13, 0x44, 0x41, 0x24, 0x4a, 0x74, 0x80, 0x62, 0x73, 0xf2, 0x37, 0x91, 0x56, 0x58,
0x5e, 0x5e, 0x36, 0x1b, 0x3a, 0x08, 0x95, 0x95, 0x55, 0xc0, 0x17, 0x08, 0xa1, 0xa3, 0xb3, 0x73,
0xbb, 0xe4, 0x09, 0x77, 0x5d, 0xd4, 0xd2, 0x0e, 0x65, 0xdc, 0x3a, 0x23, 0xe6, 0x5a, 0x8b, 0x39,
0x57, 0x31, 0x18, 0x0c, 0x1e, 0x16, 0xf9, 0xfd, 0x6f, 0x9b, 0x2a, 0x36, 0x44, 0x5e, 0x78, 0x78,
0xb8, 0xba, 0xbe, 0xbe, 0x9e, 0x42, 0x71, 0x50, 0x24, 0x2a, 0x52, 0x17, 0xfd, 0xfd, 0xfd, 0xd4,
0xf4, 0xf4, 0xb4, 0x1e, 0xdb, 0xd4, 0x18, 0x11, 0x46, 0x78, 0x84, 0x9f, 0x49, 0x2a, 0x67, 0x40,
0x15, 0x37, 0xd1, 0xc4, 0x2e, 0x64, 0xaf, 0x0d, 0x0c, 0xbe, 0x30, 0x09, 0x85, 0xcd, 0x50, 0x52,
0xc6, 0x03, 0xb1, 0x4c, 0x01, 0xe5, 0x35, 0xc2, 0x0d, 0x54, 0xa3, 0x1e, 0x1d, 0xa7, 0x82, 0x83,
0x83, 0xd5, 0xc8, 0x12, 0xe9, 0x75, 0xa9, 0xa4, 0x39, 0x16, 0x12, 0xea, 0xd0, 0xc3, 0x87, 0x65,
0x65, 0x65, 0x02, 0x2c, 0x32, 0x85, 0xb7, 0xb7, 0xb7, 0x32, 0x37, 0x37, 0x57, 0x8d, 0xb4, 0x98,
0x55, 0x84, 0x8a, 0x9c, 0x20, 0x02, 0x21, 0x7d, 0xcc, 0xc9, 0xe9, 0xcc, 0x4a, 0x6c, 0xec, 0xa1,
0xad, 0xc0, 0xc0, 0x5f, 0xae, 0x0f, 0x8d, 0xe8, 0xa9, 0x9b, 0x49, 0x45, 0xeb, 0xe5, 0x55, 0x42,
0x90, 0x48, 0x15, 0x18, 0x89, 0x10, 0xa3, 0x13, 0x6c, 0xf8, 0xf8, 0xf8, 0x8c, 0xde, 0xb8, 0x71,
0x43, 0x11, 0x1b, 0x1b, 0xdb, 0x80, 0x51, 0x3d, 0x42, 0x20, 0x06, 0x0d, 0xf9, 0x8b, 0xc1, 0x36,
0xc4, 0xb2, 0xb7, 0xb7, 0x67, 0xe2, 0xa5, 0xc7, 0x64, 0xb1, 0x58, 0x1c, 0x54, 0x52, 0x71, 0x41,
0x41, 0x81, 0x08, 0x37, 0x28, 0x8b, 0x8b, 0x8b, 0x49, 0xde, 0x28, 0xa1, 0x50, 0x38, 0x8d, 0x54,
0x8e, 0x9e, 0x3b, 0x77, 0x6e, 0xd1, 0xdd, 0xfd, 0x57, 0xab, 0xd1, 0xf1, 0xf7, 0x16, 0x83, 0x52,
0xf8, 0x5b, 0x49, 0x25, 0x5d, 0xe0, 0xfb, 0xe5, 0x5f, 0x4c, 0x65, 0x08, 0x26, 0x12, 0x77, 0x80,
0x54, 0xf6, 0x1c, 0x8a, 0x1f, 0x3d, 0x9a, 0xff, 0x91, 0xbd, 0x7d, 0xf1, 0xe1, 0xc3, 0x87, 0xef,
0x62, 0xd7, 0x8f, 0xc2, 0x2e, 0xff, 0x87, 0xb7, 0x2d, 0x9f, 0xdc, 0x35, 0x76, 0x68, 0xef, 0xa3,
0x42, 0x82, 0x89, 0xe4, 0x8f, 0x1f, 0x3f, 0x9e, 0x8d, 0xde, 0x14, 0x61, 0x63, 0x6c, 0x0d, 0x0a,
0x0a, 0x52, 0x22, 0x1d, 0x5a, 0xbc, 0x0a, 0xf4, 0x78, 0x49, 0x2e, 0x46, 0x7e, 0x99, 0xf0, 0x3a,
0x30, 0x89, 0xbf, 0xe9, 0xfb, 0x75, 0x13, 0xb8, 0xc5, 0x54, 0xc1, 0xa5, 0x9b, 0x95, 0xe0, 0x19,
0x74, 0x6f, 0xe1, 0x99, 0xe2, 0xb9, 0xa9, 0xbe, 0xa1, 0x1b, 0x65, 0x3f, 0x08, 0x4f, 0xca, 0xca,
0xfa, 0x2e, 0x87, 0x87, 0xdb, 0xfc, 0xb7, 0x1b, 0x73, 0x17, 0xda, 0xcf, 0x31, 0xda, 0xab, 0x08,
0xca, 0x72, 0x75, 0x75, 0x2d, 0x73, 0x73, 0x73, 0x1b, 0x6a, 0x6d, 0x6d, 0x1d, 0x71, 0x74, 0xf1,
0x34, 0xf8, 0x7e, 0x55, 0xbe, 0xe9, 0x7f, 0xbf, 0x05, 0xbe, 0xb8, 0x57, 0x01, 0xbf, 0xbd, 0x5a,
0x08, 0x67, 0x03, 0xf2, 0x66, 0x8e, 0x9c, 0x70, 0x73, 0xc8, 0x2b, 0x28, 0xa8, 0x97, 0xca, 0x7b,
0x4d, 0xbc, 0xba, 0x6e, 0x68, 0x6a, 0x1e, 0x80, 0x87, 0x25, 0x25, 0x32, 0xbc, 0xb5, 0xf7, 0xed,
0xf8, 0x3f, 0x00, 0x6f, 0xd1, 0x8f, 0xac, 0xac, 0x6d, 0xf2, 0xde, 0x73, 0xfe, 0xd3, 0x4b, 0xef,
0xd8, 0xa7, 0xa6, 0xb4, 0xa7, 0xfd, 0x10, 0xc5, 0xe0, 0xc3, 0xd9, 0x40, 0x16, 0x9c, 0x0b, 0x2d,
0xd1, 0x1f, 0xbb, 0x94, 0xea, 0x42, 0x16, 0x7a, 0xc4, 0x79, 0xfc, 0x80, 0xc5, 0xce, 0x13, 0x8b,
0xc4, 0xdd, 0xc0, 0xad, 0xed, 0x01, 0x49, 0x4b, 0x1f, 0xb0, 0xd8, 0x6c, 0xb1, 0x87, 0x87, 0xc7,
0xee, 0x1d, 0xff, 0x75, 0x9c, 0xfc, 0x34, 0xeb, 0x49, 0x5c, 0x51, 0xb7, 0xa9, 0xbe, 0x83, 0x82,
0x6b, 0x0c, 0x21, 0x38, 0x5d, 0xc9, 0x84, 0xf3, 0x61, 0xa5, 0x53, 0xc7, 0x2e, 0x65, 0xb8, 0xbc,
0xbb, 0x2e, 0x22, 0x22, 0xe2, 0x87, 0x2c, 0x76, 0xbe, 0xac, 0xb1, 0xa9, 0x03, 0xeb, 0x4b, 0x0e,
0x78, 0xe5, 0x6c, 0xa7, 0xd0, 0xe9, 0x71, 0x3b, 0x06, 0xfa, 0xf8, 0x46, 0x85, 0xbc, 0xb0, 0x7e,
0x18, 0xbc, 0xe2, 0x05, 0xe0, 0xe8, 0xc7, 0x00, 0xd7, 0xeb, 0xe5, 0xeb, 0x0e, 0x9e, 0x0f, 0x22,
0xff, 0xd5, 0x5a, 0x9f, 0xc8, 0x48, 0x8b, 0xfc, 0x02, 0xb6, 0x02, 0xa9, 0x06, 0xac, 0x49, 0x40,
0xa0, 0xac, 0x1d, 0x03, 0x9d, 0xf2, 0xcb, 0x0e, 0xfd, 0x63, 0x5c, 0x8d, 0xe1, 0xc3, 0xc0, 0x3c,
0x70, 0x8e, 0x78, 0x0a, 0xef, 0x7f, 0x5e, 0xd8, 0xfc, 0x9f, 0xd6, 0x5f, 0xb9, 0x72, 0xc5, 0xea,
0x7e, 0x1a, 0xbd, 0x80, 0x9e, 0x96, 0x96, 0x4f, 0xde, 0xbf, 0xd3, 0x4f, 0xdb, 0x09, 0xaf, 0x6f,
0x6e, 0x9f, 0x0d, 0x2a, 0x56, 0x3a, 0x7e, 0xc1, 0x79, 0xf6, 0x33, 0x8f, 0xd4, 0x63, 0xdf, 0x65,
0xef, 0x5f, 0x01, 0x80, 0xfb, 0x59, 0x6e, 0xd0, 0xcc, 0xfa, 0x5c, 0x00, 0x00, 0x00, 0x00, 0x49,
0x45, 0x4e, 0x44, 0xae, 0x42, 0x60, 0x82,
};
const BITMAP_OPAQUE wizard_add_fplib_small_xpm[1] = {{ png, sizeof( png ), "wizard_add_fplib_small_xpm" }};
//EOF
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
version="1.0"
width="26"
height="26"
id="svg2"
inkscape:version="0.91 r13725"
sodipodi:docname="wizard_add_fplib_small.svg">
<metadata
id="metadata166">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title></dc:title>
</cc:Work>
</rdf:RDF>
</metadata>
<sodipodi:namedview
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1"
objecttolerance="10"
gridtolerance="10"
guidetolerance="10"
inkscape:pageopacity="0"
inkscape:pageshadow="2"
inkscape:window-width="1916"
inkscape:window-height="1176"
id="namedview164"
showgrid="true"
inkscape:zoom="16.9375"
inkscape:cx="24.383764"
inkscape:cy="21.423973"
inkscape:window-x="1920"
inkscape:window-y="20"
inkscape:window-maximized="1"
inkscape:current-layer="svg2"
inkscape:snap-to-guides="false"
inkscape:snap-grids="false"
showborder="true">
<inkscape:grid
type="xygrid"
id="grid3041"
empspacing="1"
visible="true"
enabled="true"
snapvisiblegridlinesonly="true" />
</sodipodi:namedview>
<defs
id="defs4">
<clipPath
id="ba">
<path
style="fill:#ffffff"
d="m 0,96 0,60 96,0 0,-60 -96,0 z m 68,20 c 9.9411,0 18,8.0589 18,18 0,9.9411 -8.0589,18 -18,18 -9.9411,0 -18,-8.0589 -18,-18 0,-9.9411 8.0589,-18 18,-18 z"
id="path125"
inkscape:connector-curvature="0" />
</clipPath>
<linearGradient
id="bl"
y2="5.9782"
gradientUnits="userSpaceOnUse"
x2="69"
gradientTransform="matrix(-0.2255,-0.071329,0.05452,-0.20327,7.6326,90.834)"
y1="122"
x1="69">
<stop
stop-color="#1e71ac"
offset="0"
id="stop128" />
<stop
stop-color="#81c1e9"
offset="1"
id="stop130" />
</linearGradient>
<linearGradient
id="bm"
y2="67.706001"
xlink:href="#a"
gradientUnits="userSpaceOnUse"
x2="118.33"
gradientTransform="matrix(0.39018,0.62586,-0.63862,0.30043,3.5817,-20.909)"
y1="87.488998"
x1="120.65" />
<linearGradient
id="a">
<stop
offset="0"
id="stop15" />
<stop
stop-opacity="0"
offset="1"
id="stop17" />
</linearGradient>
<linearGradient
id="bn"
y2="5.9782"
gradientUnits="userSpaceOnUse"
x2="69"
gradientTransform="matrix(-0.2255,-0.071329,0.05452,-0.20327,7.6018,90.825)"
y1="122"
x1="69">
<stop
stop-color="#cd2323"
offset="0"
id="stop134" />
<stop
stop-color="#ef7474"
offset="1"
id="stop136" />
</linearGradient>
<linearGradient
id="ao"
y2="67.706001"
xlink:href="#a"
gradientUnits="userSpaceOnUse"
x2="118.33"
y1="87.488998"
x1="120.65" />
<clipPath
id="aq">
<path
style="fill:url(#linearGradient4033)"
d="m 118,56 c -9.9411,0 -18,8.0589 -18,18 0,9.9411 8.0589,18 18,18 9.7305,0 17.637,-7.7253 17.969,-17.375 l 0,-1.25 C 135.639,63.725 127.729,56 117.999,56 Z m -6,10.75 c 5.9493,0.05747 10.832,4.9413 11.031,10.875 l 3.75,0.03125 -6,8.7188 -6.1562,-8.8125 3.9688,0.03125 c -0.25101,-4.9057 -4.4893,-9.9506 -11.719,-9.625 1.5223,-0.80073 3.2718,-1.2367 5.125,-1.2188 z"
id="path122"
inkscape:connector-curvature="0" />
</clipPath>
<linearGradient
id="bo"
y2="5.1837001"
xlink:href="#an"
gradientUnits="userSpaceOnUse"
x2="84.360001"
gradientTransform="matrix(0.21868,0.069171,-0.053262,0.19858,-13.124,56.327)"
y1="79.417"
x1="84.360001" />
<linearGradient
id="an">
<stop
stop-color="#fff"
offset="0"
id="stop65" />
<stop
stop-color="#fff"
stop-opacity=".49804"
offset=".43290"
id="stop67" />
<stop
stop-color="#fff"
stop-opacity="0"
offset="1"
id="stop69" />
</linearGradient>
<linearGradient
id="bp"
y2="67.706001"
xlink:href="#a"
gradientUnits="userSpaceOnUse"
x2="118.33"
gradientTransform="matrix(-0.39018,-0.62586,0.63862,-0.30043,-9.9736,166.82)"
y1="87.488998"
x1="120.65" />
<linearGradient
y2="67.706001"
x2="118.33"
y1="87.488998"
x1="120.65"
gradientUnits="userSpaceOnUse"
id="linearGradient3263"
xlink:href="#a"
inkscape:collect="always" />
<linearGradient
y2="5.1837001"
x2="84.360001"
y1="79.417"
x1="84.360001"
gradientTransform="matrix(-0.21868,-0.069171,0.053262,-0.19858,6.7324,89.587)"
gradientUnits="userSpaceOnUse"
id="linearGradient3265"
xlink:href="#an"
inkscape:collect="always" />
<linearGradient
inkscape:collect="always"
xlink:href="#i"
id="linearGradient4444"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(0.771702,0,0,0.7696371,58.469287,27.525353)"
x1="19.648001"
y1="42.254002"
x2="20.631001"
y2="6.7758002" />
<linearGradient
id="i"
y2="6.7758002"
gradientUnits="userSpaceOnUse"
x2="20.631001"
gradientTransform="matrix(0.87827,0,0,0.87827,56.157,5.6701)"
y1="42.254002"
x1="19.648001">
<stop
stop-color="#b6b6b6"
offset="0"
id="stop3120" />
<stop
stop-color="#f2f2f2"
offset=".5"
id="stop3122" />
<stop
stop-color="#fafafa"
offset=".67613"
id="stop3124" />
<stop
stop-color="#d8d8d8"
offset=".84052"
id="stop3126" />
<stop
stop-color="#f2f2f2"
offset=".875"
id="stop3128" />
<stop
stop-color="#dbdbdb"
offset="1"
id="stop3130" />
</linearGradient>
<linearGradient
inkscape:collect="always"
xlink:href="#j"
id="linearGradient4446"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(0.77064365,0,0,0.77069683,60.490409,-22.581269)"
x1="50.153"
y1="-3.6324"
x2="25.291"
y2="-4.3003001" />
<linearGradient
id="j"
y2="-4.3003001"
gradientUnits="userSpaceOnUse"
x2="25.291"
gradientTransform="matrix(0.87827,0,0,0.87827,43.255,-36.26)"
y1="-3.6324"
x1="50.153">
<stop
stop-color="#fff"
offset="0"
id="stop3133"
style="stop-color:#4754ba;stop-opacity:1;" />
<stop
offset="1"
id="stop3135" />
</linearGradient>
<linearGradient
inkscape:collect="always"
xlink:href="#k"
id="linearGradient4448"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(0.771702,0,0,0.7696371,58.741672,28.069542)"
x1="38.228001"
y1="13.603"
x2="37.535"
y2="6.6286001" />
<linearGradient
id="k"
y2="6.6286001"
gradientUnits="userSpaceOnUse"
x2="37.535"
gradientTransform="matrix(0.87827,0,0,0.87827,56.467,6.2911)"
y1="13.603"
x1="38.228001">
<stop
stop-color="#98a0a9"
offset="0"
id="stop3138" />
<stop
stop-color="#c3d0dd"
offset="1"
id="stop3140" />
</linearGradient>
<linearGradient
inkscape:collect="always"
xlink:href="#l"
id="linearGradient4450"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(0.87866146,0,0,0.87631036,56.240123,23.172115)"
x1="31.177"
y1="19.822001"
x2="40.859001"
y2="9.6569004" />
<linearGradient
id="l"
y2="9.6569004"
gradientUnits="userSpaceOnUse"
x2="40.859001"
gradientTransform="translate(53.62,0.70241)"
y1="19.822001"
x1="31.177">
<stop
stop-color="#fff"
offset="0"
id="stop3143" />
<stop
stop-color="#fff"
stop-opacity="0"
offset="1"
id="stop3145" />
</linearGradient>
<linearGradient
inkscape:collect="always"
xlink:href="#m"
id="linearGradient4452"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(0.771702,0,0,0.7696371,58.469287,27.525353)"
x1="9.7503004"
y1="32.284"
x2="16.915001"
y2="39.443001" />
<linearGradient
id="m"
y2="39.443001"
gradientUnits="userSpaceOnUse"
x2="16.915001"
gradientTransform="matrix(0.87827,0,0,0.87827,56.157,5.6701)"
y1="32.284"
x1="9.7503004">
<stop
stop-color="#3465a4"
offset="0"
id="stop3148" />
<stop
stop-color="#9fbce1"
offset="0"
id="stop3150" />
<stop
stop-color="#6b95ca"
offset="0"
id="stop3152" />
<stop
stop-color="#3d6aa5"
offset=".75"
id="stop3154" />
<stop
stop-color="#386eb4"
offset="1"
id="stop3156" />
</linearGradient>
<linearGradient
inkscape:collect="always"
xlink:href="#n"
id="linearGradient4454"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(0.88507569,-0.02310392,0.02316591,0.88270743,57.63983,23.24151)"
x1="12.005"
y1="35.688"
x2="10.651"
y2="33.195" />
<linearGradient
id="n"
y2="33.195"
gradientUnits="userSpaceOnUse"
x2="10.651"
gradientTransform="matrix(1.0073,-0.026365,0.026365,1.0073,55.213,0.7816)"
y1="35.688"
x1="12.005">
<stop
stop-color="#fff"
offset="0"
id="stop3159" />
<stop
stop-color="#fff"
stop-opacity="0"
offset="1"
id="stop3161" />
</linearGradient>
<linearGradient
inkscape:collect="always"
xlink:href="#o"
id="linearGradient4456"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(0.77155263,-0.0151812,0.01522193,0.76948813,58.140667,26.736849)"
x1="14.018"
y1="36.943001"
x2="15.416"
y2="38.268002" />
<linearGradient
id="o"
y2="38.268002"
gradientUnits="userSpaceOnUse"
x2="15.416"
gradientTransform="matrix(0.8781,-0.017324,0.017324,0.8781,55.783,4.7703)"
y1="36.943001"
x1="14.018">
<stop
offset="0"
id="stop3164" />
<stop
stop-opacity="0"
offset="1"
id="stop3166" />
</linearGradient>
<linearGradient
y2="38.268002"
x2="15.416"
y1="36.943001"
x1="14.018"
gradientTransform="matrix(0.77155263,-0.0151812,0.01522193,0.76948813,58.140667,26.736849)"
gradientUnits="userSpaceOnUse"
id="linearGradient3113"
xlink:href="#o"
inkscape:collect="always" />
<linearGradient
inkscape:collect="always"
xlink:href="#i"
id="linearGradient3123"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(0.771702,0,0,0.7696371,58.469287,27.525353)"
x1="19.648001"
y1="42.254002"
x2="20.631001"
y2="6.7758002" />
<linearGradient
inkscape:collect="always"
xlink:href="#j"
id="linearGradient3125"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(0.77064365,0,0,0.77069683,60.490409,-22.581269)"
x1="50.153"
y1="-3.6324"
x2="25.291"
y2="-4.3003001" />
<linearGradient
inkscape:collect="always"
xlink:href="#k"
id="linearGradient3127"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(0.771702,0,0,0.7696371,58.741672,28.069542)"
x1="38.228001"
y1="13.603"
x2="37.535"
y2="6.6286001" />
<linearGradient
inkscape:collect="always"
xlink:href="#l"
id="linearGradient3129"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(0.87866146,0,0,0.87631036,56.240123,23.172115)"
x1="31.177"
y1="19.822001"
x2="40.859001"
y2="9.6569004" />
<linearGradient
inkscape:collect="always"
xlink:href="#m"
id="linearGradient3131"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(0.771702,0,0,0.7696371,58.469287,27.525353)"
x1="9.7503004"
y1="32.284"
x2="16.915001"
y2="39.443001" />
<linearGradient
inkscape:collect="always"
xlink:href="#n"
id="linearGradient3133"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(0.88507569,-0.02310392,0.02316591,0.88270743,57.63983,23.24151)"
x1="12.005"
y1="35.688"
x2="10.651"
y2="33.195" />
<linearGradient
inkscape:collect="always"
xlink:href="#o"
id="linearGradient3135"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(0.77155263,-0.0151812,0.01522193,0.76948813,58.140667,26.736849)"
x1="14.018"
y1="36.943001"
x2="15.416"
y2="38.268002" />
</defs>
<g
id="g3081"
transform="matrix(0.99830098,0,0,1.0116601,-0.13462695,-22.374948)">
<g
transform="matrix(0.67065061,0,0,0.63959329,-0.72214704,21.74289)"
id="g2983">
<path
inkscape:connector-curvature="0"
id="path37"
d="M 20.333126,12.035343 C 18.444903,8.7606248 7.1884028,4.4572113 2.002648,3.5893247 2.2763155,13.787163 2.2815758,19.371068 1.9989109,28.797982 8.7625485,29.718551 15.3015,32.559393 20.481394,35.368247 c 0,1.371479 -0.147987,-22.510084 -0.147987,-23.332904 z"
style="opacity:0.62891002;fill:#ffffff;fill-rule:evenodd;stroke:#000000;stroke-width:1.49013674;stroke-linejoin:round" />
<path
inkscape:connector-curvature="0"
id="path39"
d="M 20.333126,11.970474 C 25.181266,7.2735751 31.736244,5.3619712 39.289996,3.2656597 38.720347,14.174674 39.085048,19.823107 39.145718,28.603715 c -6.837879,0.0801 -13.928975,3.438089 -18.664576,6.764191 0,-0.05087 -0.147988,-22.574613 -0.147988,-23.397432 z"
style="opacity:0.62891002;fill:#ffffff;fill-rule:evenodd;stroke:#000000;stroke-width:1.49013674;stroke-linejoin:round" />
<path
inkscape:connector-curvature="0"
id="path49"
d="m 36.25809,7.3432246 c 0,0 -7.632679,1.948204 -13.700376,6.5238304"
style="opacity:0.62891002;fill:none;stroke:#000000;stroke-width:0.29802737" />
<path
inkscape:connector-curvature="0"
id="path51"
d="m 35.804819,10.900809 c 0,0 -7.023496,1.140338 -13.24437,5.519376"
style="opacity:0.62891002;fill:none;stroke:#000000;stroke-width:0.45657057" />
<path
inkscape:connector-curvature="0"
id="path53"
d="m 35.56254,14.052787 c 0,0 -6.549106,1.123473 -13.002872,5.151669"
style="opacity:0.62891002;fill:none;stroke:#000000;stroke-width:0.45657057" />
<path
inkscape:connector-curvature="0"
id="path55"
d="m 35.566457,17.2611 c 0,0 -6.346312,0.591814 -13.006399,4.875119"
style="opacity:0.62891002;fill:none;stroke:#000000;stroke-width:0.45657057" />
<path
inkscape:connector-curvature="0"
id="path57"
d="m 35.480491,19.937482 c -0.07397,0.01638 -5.754704,1.122073 -12.920433,5.032513"
style="opacity:0.62891002;fill:none;stroke:#000000;stroke-width:0.45657057" />
<path
inkscape:connector-curvature="0"
id="path59"
d="m 35.800902,22.548312 c -0.07397,0.01638 -6.168897,1.212856 -13.241234,5.294723"
style="opacity:0.62891002;fill:none;stroke:#000000;stroke-width:0.45657057" />
<path
inkscape:connector-curvature="0"
id="path61"
d="m 35.898595,25.338215 c 0,0 -6.670244,1.368338 -13.339709,5.367787"
style="opacity:0.62891002;fill:none;stroke:#000000;stroke-width:0.45657057" />
<path
inkscape:connector-curvature="0"
id="path63"
d="M 20.385488,11.950671 C 24.65765,6.7675925 30.434622,4.1994401 37.091192,1.3458617 36.589184,12.311893 36.9106,17.923793 36.964002,26.698257 c -6.025886,0.765461 -12.274893,4.834149 -16.448193,8.634823 0,-0.05086 -0.130412,-22.559589 -0.130412,-23.38275 z"
style="opacity:0.62891002;fill:#ffffff;fill-rule:evenodd;stroke:#000000;stroke-width:1.39885914;stroke-linejoin:round" />
<path
inkscape:connector-curvature="0"
id="path65"
d="m 34.421527,5.7269479 c 0,0 -6.726511,2.7132211 -12.07326,7.8970171"
style="opacity:0.62891002;fill:none;stroke:#000000;stroke-width:0.45657057" />
<path
inkscape:connector-curvature="0"
id="path67"
d="m 33.808038,12.506501 c 0,0 -5.771109,1.779851 -11.458599,6.454864"
style="opacity:0.62891002;fill:none;stroke:#000000;stroke-width:0.45657057" />
<path
inkscape:connector-curvature="0"
id="path69"
d="m 33.733798,18.399732 c -0.06521,0.0238 -5.071265,1.698866 -11.385922,6.327515"
style="opacity:0.62891002;fill:none;stroke:#000000;stroke-width:0.45657057" />
<path
inkscape:connector-curvature="0"
id="path71"
d="m 34.105021,23.7583 c 0,0 -5.878183,2.03687 -11.755582,6.704783"
style="opacity:0.62891002;fill:none;stroke:#000000;stroke-width:0.45657057" />
<path
inkscape:connector-curvature="0"
id="path73"
d="m 6.5280219,7.278355 c 0,0 6.7331581,1.948204 12.0853761,6.523831"
style="opacity:0.62891002;fill:none;stroke:#000000;stroke-width:0.45657057" />
<path
inkscape:connector-curvature="0"
id="path75"
d="m 6.9301115,10.83628 c 0,0 6.1954755,1.140339 11.6828965,5.519377"
style="opacity:0.62891002;fill:none;stroke:#000000;stroke-width:0.45657057" />
<path
inkscape:connector-curvature="0"
id="path77"
d="m 7.1434661,13.988259 c 0,0 5.7769719,1.123473 11.4699319,5.151669"
style="opacity:0.62891002;fill:none;stroke:#000000;stroke-width:0.45657057" />
<path
inkscape:connector-curvature="0"
id="path79"
d="m 7.1399494,17.196572 c 0,0 5.5980056,0.591815 11.4730586,4.875118"
style="opacity:0.62891002;fill:none;stroke:#000000;stroke-width:0.45657057" />
<path
inkscape:connector-curvature="0"
id="path81"
d="m 7.2161475,19.872953 c 0.06527,0.01638 5.0763425,1.122074 11.3972505,5.032514"
style="opacity:0.62891002;fill:none;stroke:#000000;stroke-width:0.45657057" />
<path
inkscape:connector-curvature="0"
id="path83"
d="m 6.9328473,22.483442 c 0.06527,0.01638 5.4417017,1.212856 11.6805507,5.294723"
style="opacity:0.62891002;fill:none;stroke:#000000;stroke-width:0.45657057" />
<path
inkscape:connector-curvature="0"
id="path85"
d="m 6.846099,25.273585 c 0,0 5.88365,1.368339 11.767299,5.367786"
style="opacity:0.62891002;fill:none;stroke:#000000;stroke-width:0.45657057" />
<path
inkscape:connector-curvature="0"
id="path87"
d="M 20.53085,11.886143 C 16.762376,6.7030643 11.666495,4.134912 5.794568,1.2813335 6.2373751,12.247364 5.9538765,17.859266 5.9067195,26.633729 c 5.3154875,0.765427 10.8279155,4.834149 14.5092515,8.634824 0,-0.05087 0.115038,-22.55959 0.115038,-23.382751 z"
style="opacity:0.62891002;fill:#ffffff;fill-rule:evenodd;stroke:#000000;stroke-width:1.3138274;stroke-linejoin:round" />
<path
inkscape:connector-curvature="0"
id="path89"
d="m 8.1500592,5.6624197 c 0,0 5.9332768,2.7132213 10.6501218,7.8970173"
style="opacity:0.62891002;fill:none;stroke:#000000;stroke-width:0.45657057" />
<path
inkscape:connector-curvature="0"
id="path91"
d="m 8.6920411,12.441973 c 0,0 5.0908019,1.779851 10.1077489,6.454864"
style="opacity:0.62891002;fill:none;stroke:#000000;stroke-width:0.45657057" />
<path
inkscape:connector-curvature="0"
id="path93"
d="m 8.7565163,18.335203 c 0.057513,0.0238 4.4734027,1.698866 10.0436647,6.327515"
style="opacity:0.62891002;fill:none;stroke:#000000;stroke-width:0.45657057" />
<path
inkscape:connector-curvature="0"
id="path95"
d="m 8.4302331,23.693771 c 0,0 5.1849739,2.036871 10.3699479,6.704783"
style="opacity:0.62891002;fill:none;stroke:#000000;stroke-width:0.45657057" />
</g>
<path
transform="matrix(0.50801926,0,0,0.48580948,5.5625851,26.972236)"
inkscape:transform-center-y="0.54370049"
inkscape:transform-center-x="-0.11555406"
d="m 16.807071,28.248623 -4.548546,-8.111888 -9.26102,-0.851769 6.3092852,-6.832635 -2.0517319,-9.0709646 8.4478987,3.8890862 7.99298,-4.7543951 -1.088197,9.2362235 6.991665,6.132586 -9.120441,1.819214 z"
inkscape:randomized="0"
inkscape:rounded="0"
inkscape:flatsided="false"
sodipodi:arg2="2.1465318"
sodipodi:arg1="1.5182133"
sodipodi:r2="7.0024018"
sodipodi:r1="14.004804"
sodipodi:cy="14.263176"
sodipodi:cx="16.070995"
sodipodi:sides="5"
id="path3036"
style="fill:#ffff0c;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:round;stroke-opacity:1"
sodipodi:type="star" />
<g
transform="matrix(0.4598514,0,0,0.4598514,-17.558632,18.880619)"
id="g4431">
<path
id="path3174"
d="m 71.973435,41.763556 16.688417,17.028463 c 0.675242,0.769637 2.814792,1.364503 4.244374,0 1.380465,-1.31762 1.061072,-3.174784 -0.289387,-4.521586 L 76.604112,37.145576 c 1.976989,-5.47694 -2.024348,-10.077569 -7.186484,-9.09172 l -1.10931,1.010123 3.472646,3.270916 0.192928,2.886128 -2.592755,2.36043 -3.098511,-0.340131 -3.183303,-2.982347 -1.115988,1.099682 c -0.519078,4.943529 4.663672,9.361623 9.990381,6.404251 z"
style="color:#000000;fill:url(#linearGradient3123);stroke:#676b6a;stroke-width:0.8774851;stroke-opacity:1"
inkscape:connector-curvature="0" />
<path
sodipodi:nodetypes="cccccscccccccccc"
id="path3176"
d="m 72.158832,40.646261 16.872936,17.550744 c 0.522725,0.595794 2.178993,1.056304 3.285667,0 1.068716,-1.020026 0.821417,-2.4577 -0.224023,-3.500334 L 75.846082,37.501709 c 1.067774,-4.614639 -0.66655,-7.506665 -3.699649,-8.380002 -0.710766,-0.204655 -1.492852,-0.298456 -2.326914,-0.277594 l -0.237353,0.239566 3.16573,2.836003 0.114375,3.664554 -3.175395,2.89051 -3.727545,-0.401534 -2.791156,-2.621482 -0.309851,0.376866 c -0.274582,5.230521 5.704006,7.61058 9.300631,4.817341 z"
style="color:#000000;opacity:0.42613998;fill:none;stroke:#ffffff;stroke-width:0.8774851"
inkscape:connector-curvature="0" />
<rect
id="rect3178"
x="80.546432"
y="-26.326511"
width="20.416656"
height="1.8037362"
ry="0.77561975"
rx="0.77556622"
transform="matrix(0.69889898,0.7152204,-0.71708981,0.69698078,0,0)"
style="color:#000000;opacity:0.55416667;fill:none;stroke:url(#linearGradient3125);stroke-width:0.87700158;stroke-miterlimit:4;stroke-dasharray:none" />
<path
id="path3180"
d="M 76.008248,49.571482 C 76.741052,48.94492 87.680387,37.785984 87.680387,37.785984 l 2.700918,-0.192412 4.244374,-5.868475 -3.535998,-3.141748 -5.498399,4.714024 0,2.693691 -11.189754,11.592709 c -0.530545,0.529125 0.931557,2.564523 1.606808,1.987297 z"
style="color:#000000;fill:url(#linearGradient3127);stroke:#878f9d;stroke-width:0.8774851"
inkscape:connector-curvature="0" />
<path
id="path3182"
d="M 75.923897,48.660119 C 76.491512,48.173767 87.367584,37.066533 87.367584,37.066533 l 2.573248,-0.217325 3.702591,-4.961757 -2.539068,-2.233715 -4.812077,4.133994 0.136421,2.498361 -11.137913,11.647917 c -0.41167,0.410569 0.108919,1.173555 0.632865,0.725682 z"
style="color:#000000;opacity:0.53977003;fill:none;stroke:url(#linearGradient3129);stroke-width:0.8774851"
inkscape:connector-curvature="0" />
<path
id="path3184"
d="m 63.677992,61.389403 c 1.156846,1.28397 4.370198,1.864964 5.795124,-0.622101 0.62131,-1.084347 1.839829,-4.121113 7.276283,-9.000584 0.913017,-0.818623 1.880248,-2.691237 1.060281,-3.701447 l -2.122143,-2.116465 c -0.868162,-0.962014 -3.281274,-0.513299 -4.271349,0.833266 -2.951248,4.027698 -7.772727,7.233854 -8.860422,7.621096 -2.080583,0.741078 -1.84642,3.799769 -0.469926,5.254795 l 1.591607,1.731677 z"
style="color:#000000;fill:url(#linearGradient3131);stroke:#204a87;stroke-width:0.8774851"
inkscape:connector-curvature="0" />
<path
id="path3186"
d="m 91.748745,56.482963 a 1.0610902,1.058251 0 0 1 -2.12218,0 1.0610902,1.058251 0 1 1 2.12218,0 z"
style="color:#000000;fill:#ffffff;stroke:#a1a1a1;stroke-width:0.87748355"
inkscape:connector-curvature="0" />
<path
id="path3188"
d="m 74.702337,47.14006 a 0.8867466,0.88437388 0 1 1 -1.773444,0 0.8867466,0.88437388 0 1 1 1.773444,0 z"
style="color:#000000;opacity:0.60227003;fill:#ffffff"
inkscape:connector-curvature="0" />
<path
id="path3190"
d="m 72.65264,49.13245 c 0,0 -6.299915,6.396715 -9.251426,7.481062"
style="color:#000000;fill:none;stroke:url(#linearGradient3133);stroke-width:2.01338983;stroke-linecap:round;stroke-linejoin:round"
inkscape:connector-curvature="0" />
<path
id="path3192"
d="m 63.977616,60.403554 c 1.266414,1.529688 4.041403,1.893882 4.912771,-0.324752 0.598641,-1.524342 2.929106,-4.964999 7.202916,-8.800785 0.717787,-0.643544 1.478172,-2.115676 0.833559,-2.909788 l -1.668314,-1.663851 c -0.682492,-0.756299 -2.579574,-0.403523 -3.357805,0.65506 -2.320018,3.166284 -7.453949,7.308078 -8.69497,7.716438 -1.921457,0.632355 -1.561381,2.822859 -0.479257,3.966619 l 1.251214,1.361348 z"
style="color:#000000;opacity:0.19886002;fill:none;stroke:#ffffff;stroke-width:0.8774851"
inkscape:connector-curvature="0" />
<path
id="path3194"
d="m 74.537369,50.566094 c 0,0 -6.434262,5.798896 -7.832213,9.516731"
style="color:#000000;opacity:0.27841001;fill:none;stroke:url(#linearGradient3135);stroke-width:2.01338983;stroke-linecap:round;stroke-linejoin:round"
inkscape:connector-curvature="0" />
</g>
</g>
</svg>
......@@ -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;
FP_TBL_MODEL* tbl = (FP_TBL_MODEL*) libgrid->GetTable();
// Import fp library list
int idx = 0;
wxArrayString libDescr; // Will contain nickname, URI, plugin
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();
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 );
}
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<wxFormBuilder_Project>
<FileVersion major="1" minor="13" />
<object class="Project" expanded="1">
<property name="class_decoration"></property>
<property name="code_generation">C++</property>
<property name="disconnect_events">1</property>
<property name="disconnect_mode">source_name</property>
<property name="disconnect_php_events">0</property>
<property name="disconnect_python_events">0</property>
<property name="embedded_files_path">res</property>
<property name="encoding">UTF-8</property>
<property name="event_generation">connect</property>
<property name="file">dialog_select_dirlist_base</property>
<property name="first_id">1000</property>
<property name="help_provider">none</property>
<property name="internationalize">1</property>
<property name="name">dialog_select_dirlist_base</property>
<property name="namespace"></property>
<property name="path">.</property>
<property name="precompiled_header"></property>
<property name="relative_path">1</property>
<property name="skip_lua_events">1</property>
<property name="skip_php_events">1</property>
<property name="skip_python_events">1</property>
<property name="ui_table">UI</property>
<property name="use_enum">0</property>
<property name="use_microsoft_bom">0</property>
<object class="Dialog" expanded="1">
<property name="aui_managed">0</property>
<property name="aui_manager_style">wxAUI_MGR_DEFAULT</property>
<property name="bg"></property>
<property name="center">wxBOTH</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="enabled">1</property>
<property name="event_handler">impl_virtual</property>
<property name="extra_style"></property>
<property name="fg"></property>
<property name="font"></property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="maximum_size"></property>
<property name="minimum_size">400,300</property>
<property name="name">DIALOG_SELECT_DIRLIST_BASE</property>
<property name="pos"></property>
<property name="size">400,321</property>
<property name="style">wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER</property>
<property name="subclass">DIALOG_SHIM; dialog_shim.h</property>
<property name="title">Select Footprint Library Folder</property>
<property name="tooltip"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnActivate"></event>
<event name="OnActivateApp"></event>
<event name="OnAuiFindManager"></event>
<event name="OnAuiPaneButton"></event>
<event name="OnAuiPaneClose"></event>
<event name="OnAuiPaneMaximize"></event>
<event name="OnAuiPaneRestore"></event>
<event name="OnAuiRender"></event>
<event name="OnChar"></event>
<event name="OnClose"></event>
<event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event>
<event name="OnHibernate"></event>
<event name="OnIconize"></event>
<event name="OnIdle"></event>
<event name="OnInitDialog"></event>
<event name="OnKeyDown"></event>
<event name="OnKeyUp"></event>
<event name="OnKillFocus"></event>
<event name="OnLeaveWindow"></event>
<event name="OnLeftDClick"></event>
<event name="OnLeftDown"></event>
<event name="OnLeftUp"></event>
<event name="OnMiddleDClick"></event>
<event name="OnMiddleDown"></event>
<event name="OnMiddleUp"></event>
<event name="OnMotion"></event>
<event name="OnMouseEvents"></event>
<event name="OnMouseWheel"></event>
<event name="OnPaint"></event>
<event name="OnRightDClick"></event>
<event name="OnRightDown"></event>
<event name="OnRightUp"></event>
<event name="OnSetFocus"></event>
<event name="OnSize"></event>
<event name="OnUpdateUI"></event>
<object class="wxBoxSizer" expanded="1">
<property name="minimum_size"></property>
<property name="name">bSizerMain</property>
<property name="orient">wxVERTICAL</property>
<property name="permission">none</property>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxALL|wxALIGN_CENTER_HORIZONTAL</property>
<property name="proportion">0</property>
<object class="wxStaticText" expanded="1">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer"></property>
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="default_pane">0</property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="font">,90,92,-1,70,0</property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">The footprint library is a folder.&#x0A;Footprints are files inside this folder.</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_staticText</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
<property name="style"></property>
<property name="subclass"></property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<property name="wrap">-1</property>
<event name="OnChar"></event>
<event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event>
<event name="OnKeyDown"></event>
<event name="OnKeyUp"></event>
<event name="OnKillFocus"></event>
<event name="OnLeaveWindow"></event>
<event name="OnLeftDClick"></event>
<event name="OnLeftDown"></event>
<event name="OnLeftUp"></event>
<event name="OnMiddleDClick"></event>
<event name="OnMiddleDown"></event>
<event name="OnMiddleUp"></event>
<event name="OnMotion"></event>
<event name="OnMouseEvents"></event>
<event name="OnMouseWheel"></event>
<event name="OnPaint"></event>
<event name="OnRightDClick"></event>
<event name="OnRightDown"></event>
<event name="OnRightUp"></event>
<event name="OnSetFocus"></event>
<event name="OnSize"></event>
<event name="OnUpdateUI"></event>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxEXPAND | wxALL</property>
<property name="proportion">1</property>
<object class="wxGenericDirCtrl" expanded="1">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer"></property>
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="default_pane">0</property>
<property name="defaultfilter">0</property>
<property name="defaultfolder"></property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="filter">*.pretty|*</property>
<property name="floatable">1</property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size">400,350</property>
<property name="moveable">1</property>
<property name="name">m_dirCtrl</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="show_hidden">0</property>
<property name="size"></property>
<property name="style">wxDIRCTRL_3D_INTERNAL|wxDIRCTRL_DIR_ONLY|wxDIRCTRL_MULTIPLE|wxDIRCTRL_SHOW_FILTERS</property>
<property name="subclass"></property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style">wxSUNKEN_BORDER</property>
<event name="OnChar"></event>
<event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event>
<event name="OnKeyDown"></event>
<event name="OnKeyUp"></event>
<event name="OnKillFocus"></event>
<event name="OnLeaveWindow"></event>
<event name="OnLeftDClick"></event>
<event name="OnLeftDown"></event>
<event name="OnLeftUp"></event>
<event name="OnMiddleDClick"></event>
<event name="OnMiddleDown"></event>
<event name="OnMiddleUp"></event>
<event name="OnMotion"></event>
<event name="OnMouseEvents"></event>
<event name="OnMouseWheel"></event>
<event name="OnPaint"></event>
<event name="OnRightDClick"></event>
<event name="OnRightDown"></event>
<event name="OnRightUp"></event>
<event name="OnSetFocus"></event>
<event name="OnSize"></event>
<event name="OnTreeBeginDrag"></event>
<event name="OnTreeBeginLabelEdit"></event>
<event name="OnTreeBeginRDrag"></event>
<event name="OnTreeDeleteItem"></event>
<event name="OnTreeEndDrag"></event>
<event name="OnTreeEndLabelEdit"></event>
<event name="OnTreeItemActivated">OnSelectFolder</event>
<event name="OnTreeItemCollapsed"></event>
<event name="OnTreeItemCollapsing"></event>
<event name="OnTreeItemExpanded"></event>
<event name="OnTreeItemExpanding"></event>
<event name="OnTreeItemMenu"></event>
<event name="OnTreeItemMiddleClick"></event>
<event name="OnTreeItemRightClick"></event>
<event name="OnTreeKeyDown"></event>
<event name="OnTreeSelChanged">OnSelectFolder</event>
<event name="OnTreeSelChanging"></event>
<event name="OnUpdateUI"></event>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxEXPAND|wxTOP|wxRIGHT|wxLEFT</property>
<property name="proportion">0</property>
<object class="wxStaticLine" expanded="1">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer"></property>
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="default_pane">0</property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_staticline</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
<property name="style">wxLI_HORIZONTAL</property>
<property name="subclass"></property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnChar"></event>
<event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event>
<event name="OnKeyDown"></event>
<event name="OnKeyUp"></event>
<event name="OnKillFocus"></event>
<event name="OnLeaveWindow"></event>
<event name="OnLeftDClick"></event>
<event name="OnLeftDown"></event>
<event name="OnLeftUp"></event>
<event name="OnMiddleDClick"></event>
<event name="OnMiddleDown"></event>
<event name="OnMiddleUp"></event>
<event name="OnMotion"></event>
<event name="OnMouseEvents"></event>
<event name="OnMouseWheel"></event>
<event name="OnPaint"></event>
<event name="OnRightDClick"></event>
<event name="OnRightDown"></event>
<event name="OnRightUp"></event>
<event name="OnSetFocus"></event>
<event name="OnSize"></event>
<event name="OnUpdateUI"></event>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxALIGN_RIGHT|wxALL</property>
<property name="proportion">0</property>
<object class="wxStdDialogButtonSizer" expanded="1">
<property name="Apply">0</property>
<property name="Cancel">1</property>
<property name="ContextHelp">0</property>
<property name="Help">0</property>
<property name="No">0</property>
<property name="OK">1</property>
<property name="Save">0</property>
<property name="Yes">0</property>
<property name="minimum_size"></property>
<property name="name">m_sdbSizer</property>
<property name="permission">protected</property>
<event name="OnApplyButtonClick"></event>
<event name="OnCancelButtonClick">OnCancelClick</event>
<event name="OnContextHelpButtonClick"></event>
<event name="OnHelpButtonClick"></event>
<event name="OnNoButtonClick"></event>
<event name="OnOKButtonClick">OnOKClick</event>
<event name="OnSaveButtonClick"></event>
<event name="OnYesButtonClick"></event>
</object>
</object>
</object>
</object>
</object>
</wxFormBuilder_Project>
///////////////////////////////////////////////////////////////////////////
// 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__
/**
* @file wizard_add_fplib.cpp
*/
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2015 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 2015 CERN
* @author Maciej Suminski <maciej.suminski@cern.ch>
* Copyright (C) 2014-2015 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 1992-2015 KiCad Developers, see AUTHORS.txt for contributors.
*
* This program is free software; you can redistribute it and/or
......@@ -26,893 +24,575 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
/** @brief this code creates a wizard to add entries in the footprint library table.
* The wizard contains 3 pages:
* The first is the selection of the type of libraries (plugin type):
* * Kicad .pretty library (actually a folder containing .kicad_mod footprint files)
* * Gihtub .pretty on line library, accessible via a internet connection
* * Legacy library (old .mod format file containing footprints desc)
* * Eagle xml V6 library (.lbr files)
* * Geda-PCB library (actually a folder containing .fp footprint files
* The second is the selection of path management:
* use environment variable or absolute path.
* When using an environment variable, selec it
* The third is the library list selection
* It allows entering entries by running a tool to select a set of libraries
* The tool depend on the type of lib (files/folder/urls):
* * multi files selector
* * multi folder selector
* * multi URL selector (via a web viewer)
* The path and the plugin type comes from the selection, and a library nickname
* is built from the path.
/**
* @brief Wizard for selecting footprint libraries consisting of 4 steps:
* - select source (Github/local files)
* - pick libraries
* - present a review of libraries (including validation)
* - select scope (global/project)
*/
#include <wx/wx.h>
#include <wx/url.h>
#include <wx/uri.h>
#include <wx/progdlg.h>
#include <pgm_base.h>
#include <kiface_i.h>
#include <dialog_helpers.h>
#include <project.h> // For PROJECT_VAR_NAME definition
#include <fp_lib_table.h> // For KISYSMOD definition
#include <io_mgr.h>
#include <project.h>
#include <wizard_add_fplib.h>
#include <dialog_select_dirlist_base.h>
#include <fp_lib_table.h>
#include <confirm.h>
// a key to store the default Kicad Github libs URL
#define KICAD_FPLIBS_URL_KEY wxT( "kicad_fplib_url" )
#include <class_module.h>
// key to store last options of th wizard
#define WIZARD_LAST_PLUGIN_KEY wxT( "wizard_plugin" )
#define WIZARD_LAST_PATHOPTION_KEY wxT( "wizard_path_option" )
#ifdef BUILD_GITHUB_PLUGIN
#include <../github/github_getliblist.h>
#endif
// static members to store last choices during a session
int WIZARD_FPLIB_TABLE::m_last_plugin_choice = 0;
int WIZARD_FPLIB_TABLE::m_last_defaultpath_choice = 2;
// a key to store the default Kicad Github libs URL
#define KICAD_FPLIBS_URL_KEY wxT( "kicad_fplib_url" )
WIZARD_FPLIB_TABLE::WIZARD_FPLIB_TABLE( wxWindow* aParent, wxArrayString& aEnvVariableList )
: WIZARD_FPLIB_TABLE_BASE( aParent )
// Filters for the file picker
static const int FILTER_COUNT = 4;
static const struct
{
initDlg( aEnvVariableList );
// Allows github plugin selection only when the plugin is compiled:
#ifndef BUILD_GITHUB_PLUGIN
m_rbFpLibFormat->Enable( GITHUB_PLUGIN, false );
wxString m_Description;
wxString m_Extension;
bool m_IsFile;
IO_MGR::PCB_FILE_T m_Plugin;
} fileFilters[FILTER_COUNT] =
{
{ "KiCad (*.pretty folders)", ".pretty", false, IO_MGR::KICAD },
{ "Eagle 6.x (*.lbr)", ".lbr", true, IO_MGR::EAGLE },
{ "KiCad legacy (*.mod)", ".mod", true, IO_MGR::LEGACY },
{ "Geda (folder with *.fp files)", "", false, IO_MGR::GEDA_PCB },
};
if( m_rbFpLibFormat->GetSelection() == GITHUB_PLUGIN )
m_rbFpLibFormat->SetSelection( KICAD_PLUGIN );
#endif
// Currently, I (JPC) do not know the best way to add/store
// what is currently called env variables
// So do not show tools to change them,
// but do not remove the code, just in case
m_buttonAddEV->Show( false );
m_buttonRemoveEV->Show( false );
// Returns the filter string for the file picker
static wxString getFilterString()
{
wxString filterInit = _( "All supported library formats|" );
wxString filter;
#ifndef BUILD_GITHUB_PLUGIN
m_buttonGithubLibList->Show( false );
#endif
for( int i = 0; i < FILTER_COUNT; ++i )
{
// Init part
if( i != 0 )
filterInit += ";";
// Gives a minimal size to the dialog, which allows displaying any page
wxSize minsize;
filterInit += "*" + fileFilters[i].m_Extension;
for( unsigned ii = 0; ii < m_pages.size(); ii++ )
{
wxSize size = m_pages[ii]->GetSizer()->CalcMin();
minsize.x = std::max( minsize.x, size.x );
minsize.y = std::max( minsize.y, size.y );
// Rest of the filter string
filter += "|" + fileFilters[i].m_Description + "|*" + fileFilters[i].m_Extension;
}
SetMinSize( minsize );
SetPageSize( minsize );
GetSizer()->SetSizeHints( this );
Center();
return filterInit + filter;
}
WIZARD_FPLIB_TABLE::~WIZARD_FPLIB_TABLE()
// Tries to guess the plugin type basing on the path
static boost::optional<IO_MGR::PCB_FILE_T> getPluginType( const wxString& aPath )
{
// Use this if you want to store kicad lib URL in pcbnew/cvpcb section config:
// wxConfigBase* cfg = Kiface().KifaceSettings();
// Use this if you want to store kicad lib URL in common section config:
wxConfigBase* cfg = Pgm().CommonSettings();
cfg->Write( KICAD_FPLIBS_URL_KEY, m_textCtrlGithubURL->GetValue() );
if( ( aPath.StartsWith( "http://" ) || aPath.StartsWith( "https://" ) ) && aPath.EndsWith( ".pretty" ) )
return boost::optional<IO_MGR::PCB_FILE_T>( IO_MGR::GITHUB );
wxFileName file( aPath );
m_last_plugin_choice = m_rbFpLibFormat->GetSelection();
m_last_defaultpath_choice = m_rbPathManagement->GetSelection();
for( int i = 0; i < FILTER_COUNT; ++i )
{
if( aPath.EndsWith( fileFilters[i].m_Extension ) &&
file.FileExists() == fileFilters[i].m_IsFile )
return boost::optional<IO_MGR::PCB_FILE_T>( fileFilters[i].m_Plugin );
}
cfg->Write( WIZARD_LAST_PLUGIN_KEY, m_last_plugin_choice );
cfg->Write( WIZARD_LAST_PATHOPTION_KEY, m_last_defaultpath_choice );
return boost::optional<IO_MGR::PCB_FILE_T>();
}
void WIZARD_FPLIB_TABLE::initDlg( wxArrayString& aEnvVariableList )
// Checks if a filename fits specific filter
static bool passesFilter( const wxString& aFileName, int aFilterIndex )
{
m_currLibDescr = NULL;
wxASSERT( aFilterIndex <= FILTER_COUNT );
wxFileName file( aFileName );
SetBitmap( KiBitmap( wizard_add_fplib_icon_xpm ) );
wxString msg;
wxConfigBase* cfg = Pgm().CommonSettings();
cfg->Read( WIZARD_LAST_PLUGIN_KEY, &m_last_plugin_choice );
cfg->Read( WIZARD_LAST_PATHOPTION_KEY, &m_last_defaultpath_choice );
cfg->Read( KICAD_FPLIBS_URL_KEY, &msg );
if( msg.IsEmpty() ) // Give our current KiCad github URL
msg = wxT( "http://github.com/KiCad" );
// Be sure there is no trailing '/' at the end of the repo name
if( msg.EndsWith( wxT("/" ) ) )
msg.RemoveLast();
m_textCtrlGithubURL->SetValue( msg );
// KIGITHUB is frequently used (examples in docs, and other place)
// So add it if it not yet in list, but if it is defined as env var
// (note this env var is not hardcoded or existing in kicad sources)
if( aEnvVariableList.Index( wxT("KIGITHUB"), false ) == wxNOT_FOUND )
if( aFilterIndex == 0 ) // any supported library format
{
// Not yet in use in lib table, see in env. vars
wxString evValue;
wxGetEnv( wxT("KIGITHUB"), &evValue );
// Not yet in use in lib table, but it is defined in environment,
// so add it, just in case
if( ! evValue.IsEmpty() )
aEnvVariableList.Add( wxT("KIGITHUB") );
boost::optional<IO_MGR::PCB_FILE_T> result = getPluginType( aFileName );
return ( result ? true : false );
}
m_rowPrjEnvVarPosition = 0;
m_predefinedEnvVarCnt = aEnvVariableList.GetCount();
for( int row = 0; row < m_predefinedEnvVarCnt; row++ )
else
{
if( GetEnvVarCount() <= row )
m_gridEnvironmentVariablesList->AppendRows(1);
m_gridEnvironmentVariablesList->SetCellValue( row, 0, aEnvVariableList[row] );
if( aEnvVariableList[row] == PROJECT_VAR_NAME )
m_rowPrjEnvVarPosition = row;
wxString evValue;
if( wxGetEnv( aEnvVariableList[row], &evValue ) )
m_gridEnvironmentVariablesList->SetCellValue( row, 1, evValue );
// All these env var are defined outside the wizard,
// and cannot be modified in this dialog
m_gridEnvironmentVariablesList->SetReadOnly( row, 0, true );
m_gridEnvironmentVariablesList->SetReadOnly( row, 1, true );
if( aFileName.EndsWith( fileFilters[aFilterIndex - 1].m_Extension ) &&
file.FileExists() == fileFilters[aFilterIndex - 1].m_IsFile )
return true;
}
m_gridEnvironmentVariablesList->Fit();
m_buttonRemoveEV->Enable( GetEnvVarCount() > m_predefinedEnvVarCnt );
m_gridEnvironmentVariablesList->AutoSizeColumns();
return false;
}
m_rbFpLibFormat->SetSelection( m_last_plugin_choice );
m_rbPathManagement->SetSelection( m_last_defaultpath_choice );
wxCommandEvent event;
updateFromPlugingChoice();
OnPathManagementSelection( event );
WIZARD_FPLIB_TABLE::LIBRARY::LIBRARY( const wxString& aPath, const wxString& aDescription ) :
m_path( aPath ), m_description( aDescription ), m_status( NOT_CHECKED )
{
m_plugin = getPluginType( aPath );
}
int WIZARD_FPLIB_TABLE::HasGithubEnvVarCompatible()
bool WIZARD_FPLIB_TABLE::LIBRARY::Test()
{
// Return true if at least one env var defines a url relative to github
for( int row = 0; row < GetEnvVarCount(); row++ )
if( !m_plugin )
{
if( m_gridEnvironmentVariablesList->GetCellValue(
wxGridCellCoords( row, 1 ) ).Lower().StartsWith( "http" ) )
return row;
m_status = LIBRARY::INVALID;
return false;
}
return -1;
}
PLUGIN* p = IO_MGR::PluginFind( *m_plugin );
wxArrayString footprints;
bool WIZARD_FPLIB_TABLE::ValidateOptions()
{
// Some choices can be conficting or do not work.
// Warn the user when this is the case
wxString msg;
if( !p )
{
m_status = LIBRARY::INVALID;
return false;
}
if( getSelectedEnvVarValue().IsEmpty() )
try
{
// PROJECT_PATH option cannot be used with empty local path
if( m_rbPathManagement->GetSelection() == PROJECT_PATH )
{
msg = _("The project path is empty and this option is not valid.\n"
"Looks like you are running the wizard outside a project.");
wxMessageBox( msg );
return false;
}
else if( m_rbPathManagement->GetSelection() != ABSOLUTE_PATH )
{
wxMessageBox( wxString::Format(
_("The default path defined by env var \"%s\" is empty.\nCannot use it"),
GetChars( getSelectedEnvVar() ) ) );
return false;
}
footprints = p->FootprintEnumerate( m_path );
}
else
catch( IO_ERROR& e )
{
if( IsGithubPlugin() )
{
// Github plugin cannot be used with local path; Need absolute path or valid URL
if( !getSelectedEnvVarValue().Lower().StartsWith( "http" ) )
{
msg = _("Github Plugin uses a valid Internet URL starting by http.\n"
"Cannot be used as URL");
wxMessageBox( msg );
return false;
}
}
else
{
if( getSelectedEnvVarValue().Lower().StartsWith( "http" ) )
{
msg = _("This default path looks strange.\n"
"Cannot be used for a file path");
wxMessageBox( msg );
return false;
}
}
m_status = LIBRARY::INVALID;
return false;
}
// Other conficts: TODO
if( footprints.GetCount() == 0 )
{
m_status = LIBRARY::INVALID;
return false;
}
m_status = LIBRARY::OK;
return true;
}
void WIZARD_FPLIB_TABLE::OnPluginSelection( wxCommandEvent& event )
wxString WIZARD_FPLIB_TABLE::LIBRARY::GetPluginName() const
{
updateFromPlugingChoice();
}
if( !m_plugin )
return _( "UNKNOWN" );
void WIZARD_FPLIB_TABLE::updateFromPlugingChoice()
{
#ifdef BUILD_GITHUB_PLUGIN
m_buttonGithubLibList->Show( IsGithubPlugin() || IsKicadPlugin() );
#endif
switch( *m_plugin )
{
case IO_MGR::LEGACY:
return wxT( "Legacy" );
// update dialog options and widgets depending on a plugin choice
// Project path has no sense for GITHUB_PLUGIN
bool enablePrjPathOpt = not IsGithubPlugin();
case IO_MGR::KICAD:
return wxT( "KiCad" );
// Project path cannot be used if unknown
if( m_gridEnvironmentVariablesList->GetCellValue(
wxGridCellCoords( m_rowPrjEnvVarPosition, 1 ) ).IsEmpty() )
enablePrjPathOpt = false;
case IO_MGR::EAGLE:
return wxT( "Eagle" );
m_rbPathManagement->Enable( PROJECT_PATH, enablePrjPathOpt );
case IO_MGR::GEDA_PCB:
return wxT( "Geda-PCB" );
// Sometimes only the choice "absolute path" is allowed;
// Force this choice, at least make it the default choice
bool force_absolute_path = false;
case IO_MGR::GITHUB:
return wxT( "Github" );
// For github plugin, the project path is not allowed
if( ( m_rbPathManagement->GetSelection() == PROJECT_PATH ) && !enablePrjPathOpt )
force_absolute_path = true;
default:
return _( "UNKNOWN" );
}
// For github plugin, at least one github compatible path must exist
// If no github path, force absolute path
int first_github_envvar = HasGithubEnvVarCompatible();
if( IsGithubPlugin() )
{
if( first_github_envvar < 0 )
force_absolute_path = true;
else if( !getSelectedEnvVarValue().StartsWith( "http" ) )
m_gridEnvironmentVariablesList->SelectRow( first_github_envvar );
/*PLUGIN* p = IO_MGR::PluginFind( *m_plugin );
}
if( !p )
return _( "UNKNOWN" );
if( force_absolute_path )
m_rbPathManagement->SetSelection( ABSOLUTE_PATH );
return p->PluginName();*/
}
void WIZARD_FPLIB_TABLE::OnPathManagementSelection( wxCommandEvent& event )
wxString WIZARD_FPLIB_TABLE::LIBRARY::GetRelativePath( const wxString& aBase, const wxString& aSubstitution ) const
{
// Disable irrevant options, and enable others.
int row_count = GetEnvVarCount();
wxFileName libPath( m_path );
switch( m_rbPathManagement->GetSelection() )
// Check if the library path belongs to the project folder
if( libPath.MakeRelativeTo( aBase ) && !libPath.GetFullPath().StartsWith( ".." ) )
{
case PROJECT_PATH: // Choice = path relative to the project
m_gridEnvironmentVariablesList->Enable( true );
m_buttonAddEV->Enable( false );
m_gridEnvironmentVariablesList->ShowRow( PROJECT_PATH );
return wxString( aSubstitution + "/" + libPath.GetFullPath() );
}
for( int row = 0; row < row_count; row++ )
{
if( row == PROJECT_PATH )
continue;
// Probably on another drive, so the relative path will not work
return wxEmptyString;
}
m_gridEnvironmentVariablesList->HideRow( row );
}
break;
case ENV_VAR_PATH: // Choice = path relative to env var
m_gridEnvironmentVariablesList->Enable( true );
m_buttonAddEV->Enable( true );
wxString WIZARD_FPLIB_TABLE::LIBRARY::GetAutoPath( LIB_SCOPE aScope ) const
{
const wxString& global_env = FP_LIB_TABLE::GlobalPathEnvVariableName();
const wxString& project_env = PROJECT_VAR_NAME;
const wxString& github_env( "KIGITHUB" );
for( int row = 0; row < row_count; row++ )
m_gridEnvironmentVariablesList->ShowRow( row );
wxString rel_path;
break;
// KISYSMOD check
rel_path = replaceEnv( global_env );
case ABSOLUTE_PATH: // Choice = path relative to the project
m_gridEnvironmentVariablesList->Enable( false );
m_buttonAddEV->Enable( false );
break;
}
}
if( !rel_path.IsEmpty() )
return rel_path;
void WIZARD_FPLIB_TABLE::OnAddEVariable( wxCommandEvent& event )
{
m_gridEnvironmentVariablesList->AppendRows( 1 );
m_gridEnvironmentVariablesList->AutoSizeColumns();
m_buttonRemoveEV->Enable( GetEnvVarCount() > m_predefinedEnvVarCnt );
m_gridEnvironmentVariablesList->SetGridCursor( GetEnvVarCount()-1, 0 );
}
// KIGITHUB check
rel_path = replaceEnv( github_env, false );
void WIZARD_FPLIB_TABLE::OnRemoveEVariable( wxCommandEvent& event )
{
wxArrayInt selectedRows = m_gridEnvironmentVariablesList->GetSelectedRows();
int row_cursor = m_gridEnvironmentVariablesList->GetGridCursorRow();
if( !rel_path.IsEmpty() )
return rel_path;
if( selectedRows.size() == 0 && row_cursor >= 0 )
selectedRows.Add( row_cursor );
std::sort( selectedRows.begin(), selectedRows.end() );
for( int ii = selectedRows.GetCount()-1; ii >= 0; ii-- )
// KIPRJMOD check
if( aScope == PROJECT )
{
int row = selectedRows[ii];
rel_path = replaceEnv( project_env );
// don't remove them env var. which are already existing in lib table
if( row > m_predefinedEnvVarCnt-1 )
m_gridEnvironmentVariablesList->DeleteRows( row, 1 );
if( !rel_path.IsEmpty() )
return rel_path;
}
m_gridEnvironmentVariablesList->SelectRow( m_gridEnvironmentVariablesList->GetGridCursorRow() );
m_buttonRemoveEV->Enable( GetEnvVarCount() > m_predefinedEnvVarCnt );
// Return the full path
return m_path;
}
void WIZARD_FPLIB_TABLE::OnSelectEnvVarCell( wxGridEvent& event )
{
// Ensure the selected row is also the row which have the focus.
// useful when the user want to delete a row, and select it by the mouse
m_gridEnvironmentVariablesList->SelectRow( event.GetRow() );
}
wxString WIZARD_FPLIB_TABLE::getSelectedEnvVar()
wxString WIZARD_FPLIB_TABLE::LIBRARY::GetDescription() const
{
wxString envVar;
wxArrayInt selectedRows = m_gridEnvironmentVariablesList->GetSelectedRows();
int row = selectedRows.GetCount() ? selectedRows[0] :
m_gridEnvironmentVariablesList->GetGridCursorRow();
switch( m_rbPathManagement->GetSelection() )
{
case ENV_VAR_PATH: // Choice = path relative to env var
envVar = m_gridEnvironmentVariablesList->GetCellValue(
wxGridCellCoords( row, 0 ) );
break;
case PROJECT_PATH: // Choice = path relative to the project
envVar = PROJECT_VAR_NAME;
break;
case ABSOLUTE_PATH: // Choice = absolute path
default:
break;
}
if( !m_description.IsEmpty() )
return m_description;
return envVar;
wxFileName filename( m_path );
return filename.GetName();
}
wxString WIZARD_FPLIB_TABLE::getSelectedEnvVarValue()
wxString WIZARD_FPLIB_TABLE::LIBRARY::replaceEnv( const wxString& aEnvVar, bool aFilePath ) const
{
wxString envVarValue;
wxArrayInt selectedRows = m_gridEnvironmentVariablesList->GetSelectedRows();
int row = selectedRows.GetCount() ? selectedRows[0] :
m_gridEnvironmentVariablesList->GetGridCursorRow();
wxString env_path;
switch( m_rbPathManagement->GetSelection() )
{
case ENV_VAR_PATH: // Choice = path relative tp env var
envVarValue = m_gridEnvironmentVariablesList->GetCellValue(
wxGridCellCoords( row, 1 ) );
break;
if( !wxGetEnv( aEnvVar, &env_path ) )
return wxEmptyString;
case PROJECT_PATH: // Choice = path relative to the project
envVarValue = m_gridEnvironmentVariablesList->GetCellValue(
wxGridCellCoords( m_rowPrjEnvVarPosition, 1 ) );
break;
std::cout << "replacing (" << env_path << ") " << aEnvVar << " in " << m_path << std::endl;
case ABSOLUTE_PATH: // Choice = absolute path
default:
break;
}
//return GetRelativePath( m_path, wxString( "$(" + aEnvVar + ")" ) );
return envVarValue;
}
wxString result( m_path );
void WIZARD_FPLIB_TABLE::OnPageChanged( wxWizardEvent& event )
{
if( GetCurrentPage() == m_pages[2] )
setLastPage();
else if( GetCurrentPage() == m_pages[1] )
setSecondPage();
if( result.Replace( env_path, wxString( "$(" + aEnvVar + ")" ) ) )
return result;
return wxEmptyString;
}
void WIZARD_FPLIB_TABLE::OnPageChanging( wxWizardEvent& event )
{
if( !( GetCurrentPage() == m_pages[1] && event.GetDirection() ) )
return;
if( ! ValidateOptions() )
{
event.Veto();
return;
}
WIZARD_FPLIB_TABLE::WIZARD_FPLIB_TABLE( wxWindow* aParent ) :
WIZARD_FPLIB_TABLE_BASE( aParent ), m_welcomeDlg( m_pages[0] ),
m_fileSelectDlg( m_pages[1] ), m_githubListDlg( m_pages[2] ),
m_reviewDlg( m_pages[3] ), m_targetDlg( m_pages[4] ), m_selectedFilter( 0 )
{
m_filePicker->SetFilter( getFilterString() );
if( ( m_rbPathManagement->GetSelection() != ABSOLUTE_PATH ) &&
( IsGithubPlugin() ) )
{
wxURI uri( getSelectedEnvVarValue() );
// Initialize default download dir
wxString default_path;
wxGetEnv( FP_LIB_TABLE::GlobalPathEnvVariableName(), &default_path );
setDownloadDir( default_path );
m_filePicker->SetPath( default_path );
// We cannot use wxURL to test the validity of the url, because
// wxURL does not know https protocol we are using, and aways returns
// error for url starting by https
bool badurl = !uri.HasPath();
// Restore the Github url
wxString githubUrl;
wxConfigBase* cfg = Pgm().CommonSettings();
cfg->Read( KICAD_FPLIBS_URL_KEY, &githubUrl );
if( badurl )
{
wxMessageBox( wxString::Format(
_("The URL defined by env var \"%s\" is an incorrect URL.\nCannot use it"),
GetChars( getSelectedEnvVar() ) ) );
event.Veto();
}
}
}
if( githubUrl.IsEmpty() )
githubUrl = wxT( "https://github.com/KiCad" );
bool WIZARD_FPLIB_TABLE::setSecondPage()
{
// Init parameters for the second wizard page: this is only
// the current library description.
updateFromPlugingChoice();
SetGithubURL( githubUrl );
delete m_currLibDescr;
m_currLibDescr = NULL;
// Give the minimal size to the dialog, which allows displaying any page
wxSize minsize;
switch( m_rbFpLibFormat->GetSelection() )
for( unsigned ii = 0; ii < m_pages.size(); ii++ )
{
case 0: // Kicad lib type
m_currLibDescr = new LIB_DESCR_KICAD;
m_buttonGithubLibList->SetLabel( _("Download Github Libs") );
break;
case 1: // Github lib type
m_currLibDescr = new LIB_DESCR_GITHUB;
m_buttonGithubLibList->SetLabel( _("Github Libs List") );
break;
case 2: // Legacy lib type
m_currLibDescr = new LIB_DESCR_LEGACY;
break;
case 3: // Eagle V6 lib type
m_currLibDescr = new LIB_DESCR_EAGLE;
break;
case 4: // Geda lib type
m_currLibDescr = new LIB_DESCR_GEDA;
break;
wxSize size = m_pages[ii]->GetSizer()->CalcMin();
minsize.x = std::max( minsize.x, size.x );
minsize.y = std::max( minsize.y, size.y );
}
if( IsGithubPlugin() )
{
#ifdef KICAD_USE_WEBKIT
m_buttonAddLib->SetLabel( _("Add Libs with WebViewer") );
#else
m_buttonAddLib->SetLabel( _("Add FP Library entry") );
#endif
}
else
m_buttonAddLib->SetLabel( _("Add FP Libraries") );
SetMinSize( minsize );
SetPageSize( minsize );
GetSizer()->SetSizeHints( this );
Center();
return m_currLibDescr!= NULL;
}
if( !m_radioAddGithub->GetValue() && !m_radioAddLocal->GetValue() )
m_radioAddLocal->SetValue( true );
bool WIZARD_FPLIB_TABLE::setLastPage() // Init prms for the last wizard page
{
// Update texts in last wizard page
m_textPluginType->SetLabel( m_rbFpLibFormat->GetStringSelection() );
setupDialogOrder();
updateGithubControls();
Connect( wxEVT_RADIOBUTTON, wxCommandEventHandler( WIZARD_FPLIB_TABLE::OnSourceCheck ), NULL, this );
Connect( wxEVT_DIRCTRL_SELECTIONCHANGED, wxCommandEventHandler( WIZARD_FPLIB_TABLE::OnSelectFiles ), NULL, this );
Connect( wxEVT_CHECKLISTBOX, wxCommandEventHandler( WIZARD_FPLIB_TABLE::OnCheckGithubList ), NULL, this );
}
switch( m_rbPathManagement->GetSelection() )
{
case ENV_VAR_PATH: // Choice = path relative env var
case PROJECT_PATH: // Choice = path relative to the project
m_currLibDescr->m_EnvVarName = getSelectedEnvVar();
m_currLibDescr->m_DefaultPath = getSelectedEnvVarValue();
m_currLibDescr->m_IsAbsolutePath = false;
m_textOption->SetLabel( wxString::Format( wxT("%s (%s)"),
m_rbPathManagement->GetStringSelection().GetData(),
getSelectedEnvVar().GetData() ) );
WIZARD_FPLIB_TABLE::~WIZARD_FPLIB_TABLE()
{
// Use this if you want to store kicad lib URL in pcbnew/cvpcb section config:
// wxConfigBase* cfg = Kiface().KifaceSettings();
m_textPath->SetLabel( getSelectedEnvVarValue() );
break;
// Use this if you want to store kicad lib URL in common section config:
wxConfigBase* cfg = Pgm().CommonSettings();
cfg->Write( KICAD_FPLIBS_URL_KEY, GetGithubURL() );
}
case ABSOLUTE_PATH: // Choice = absolute path
m_currLibDescr->m_IsAbsolutePath = true;
m_textOption->SetLabel( m_rbPathManagement->GetStringSelection() );
WIZARD_FPLIB_TABLE::LIB_SOURCE WIZARD_FPLIB_TABLE::GetLibSource() const
{
if( m_radioAddGithub->GetValue() )
return GITHUB;
if( IsGithubPlugin() )
m_textPath->SetLabel( _("Full URL") );
else
m_textPath->SetLabel( _("Full filename") );
break;
}
wxASSERT( m_radioAddLocal->GetValue() );
return true;
return LOCAL;
}
void WIZARD_FPLIB_TABLE::OnAddFpLibs( wxCommandEvent& event )
WIZARD_FPLIB_TABLE::LIB_SCOPE WIZARD_FPLIB_TABLE::GetLibScope() const
{
if( m_currLibDescr->m_IsFile )
selectLibsFiles();
else if( m_currLibDescr->m_IsGitHub )
selectLibsGithubWithWebViewer();
else
selectLibsFolders();
if( m_radioGlobal->GetValue() )
return GLOBAL;
m_gridFpListLibs->SetGridCursor( GetLibsCount()-1, 0 );
m_gridFpListLibs->SelectRow( GetLibsCount()-1 );
}
wxASSERT( m_radioProject->GetValue() );
void WIZARD_FPLIB_TABLE::selectLibsFiles() // select a set of library files
{
wxString msk = wxT("*.") + m_currLibDescr->m_Ext;
return PROJECT;
}
wxFileDialog dlg( this, _("Select Library Files"), m_currLibDescr->m_DefaultPath,
wxEmptyString, msk,
wxFD_DEFAULT_STYLE|wxFD_FILE_MUST_EXIST|wxFD_MULTIPLE );
dlg.ShowModal();
void WIZARD_FPLIB_TABLE::OnPageChanged( wxWizardEvent& aEvent )
{
SetBitmap( KiBitmap( wizard_add_fplib_icon_xpm ) );
enableNext( true );
if( GetCurrentPage() == m_githubListDlg )
setupGithubList();
else if( GetCurrentPage() == m_fileSelectDlg )
setupFileSelect();
else if( GetCurrentPage() == m_reviewDlg )
setupReview();
}
wxArrayString filepaths;
dlg.GetPaths( filepaths );
// Create the nickname: currently make it from the filename
wxArrayString nicknames;
wxFileName fn;
void WIZARD_FPLIB_TABLE::OnSelectFiles( wxCommandEvent& aEvent )
{
int filterIdx = m_filePicker->GetFilterIndex();
for( unsigned ii = 0; ii < filepaths.GetCount(); ii++ )
if( m_selectedFilter != filterIdx )
{
fn = filepaths[ii];
nicknames.Add( fn.GetName() );
m_selectedFilter = filterIdx;
if( m_currLibDescr->m_IsAbsolutePath || m_currLibDescr->m_DefaultPath.IsEmpty() )
{
filepaths[ii] = fn.GetPathWithSep();
}
else
{
if( ! fn.MakeRelativeTo( m_currLibDescr->m_DefaultPath ) )
filepaths[ii] = fn.GetFullPath();
else
filepaths[ii].Printf( wxT("${%s}%c%s"),
GetChars( m_currLibDescr->m_EnvVarName ),
fn.GetPathSeparator(),
GetChars( fn.GetFullPath() ) );
}
#ifdef __WINDOWS__
// We store paths using Unix notation, which also works fine on Windows
filepaths[ii].Replace( wxT("\\"), wxT("/") );
#endif
// Process the event again, as in the first iteration we cannot get the list of selected items
wxCommandEvent ev( wxEVT_DIRCTRL_SELECTIONCHANGED );
AddPendingEvent( ev );
return;
}
populateLibList( nicknames, filepaths, m_currLibDescr->m_PluginName );
m_gridFpListLibs->AutoSizeColumns();
enableNext( checkFiles() );
}
void WIZARD_FPLIB_TABLE::populateLibList( const wxArrayString& aNickNames,
const wxArrayString& aPaths,
const wxString& aPluginName )
void WIZARD_FPLIB_TABLE::OnCheckGithubList( wxCommandEvent& aEvent )
{
if( aPaths.GetCount() <= 0 )
return;
wxArrayInt dummy;
// Ensure there is room for selected libs
int first_row = m_gridFpListLibs->GetTable()->GetRowsCount();
m_gridFpListLibs->AppendRows( aPaths.GetCount() );
enableNext( m_checkListGH->GetCheckedItems( dummy ) > 0 );
}
// Populates the library list
for( unsigned ii = 0; ii < aPaths.GetCount(); ii++ )
{
int jj = first_row + ii;
// Add the nickname: currently make it from filename
m_gridFpListLibs->SetCellValue( jj, 0, aNickNames[ii] );
// Add the full path:
m_gridFpListLibs->SetCellValue( jj, 1, aPaths[ii] );
// Add the plugin name:
m_gridFpListLibs->SetCellValue( jj, 2, aPluginName );
m_gridFpListLibs->SetReadOnly( jj, 2, true );
}
m_gridFpListLibs->Fit();
void WIZARD_FPLIB_TABLE::OnSourceCheck( wxCommandEvent& aEvent )
{
updateGithubControls();
setupDialogOrder();
}
// A helper dialog to show and select a set of directories
class DIALOG_SELECT_DIRLIST : public DIALOG_SELECT_DIRLIST_BASE
void WIZARD_FPLIB_TABLE::OnSelectAllGH( wxCommandEvent& aEvent )
{
public:
DIALOG_SELECT_DIRLIST( wxWindow* parent,
const wxString& aDefaultPath ):
DIALOG_SELECT_DIRLIST_BASE( parent, wxID_ANY )
{
if( !aDefaultPath.IsEmpty() )
m_dirCtrl->SetPath( aDefaultPath );
for( unsigned int i = 0; i < m_checkListGH->GetCount(); ++i )
m_checkListGH->Check( i, true );
Layout();
GetSizer()->Fit( this );
GetSizer()->SetSizeHints(this);
Centre();
}
~DIALOG_SELECT_DIRLIST() {};
// The list might be empty, e.g. in case of download error
wxArrayInt dummy;
enableNext( m_checkListGH->GetCheckedItems( dummy ) > 0 );
}
void GetPaths( wxArrayString& aPaths ) { m_dirCtrl->GetPaths( aPaths ); }
};
void WIZARD_FPLIB_TABLE::selectLibsFolders() // select a set of library folders
void WIZARD_FPLIB_TABLE::OnUnselectAllGH( wxCommandEvent& aEvent )
{
DIALOG_SELECT_DIRLIST dlg( this, m_currLibDescr->m_DefaultPath );
for( unsigned int i = 0; i < m_checkListGH->GetCount(); ++i )
m_checkListGH->Check( i, false );
if( dlg.ShowModal() != wxID_OK )
return;
enableNext( false );
}
wxArrayString filepaths;
dlg.GetPaths( filepaths );
void WIZARD_FPLIB_TABLE::OnChangeSearch( wxCommandEvent& aEvent )
{
wxString searchPhrase = m_searchCtrlGH->GetValue().Lower();
// Create the nickname: currently make it from the filename
wxArrayString nicknames;
wxFileName fn;
// Store the current selection
wxArrayInt checkedIndices;
m_checkListGH->GetCheckedItems( checkedIndices );
wxArrayString checkedStrings;
for( unsigned ii = 0; ii < filepaths.GetCount(); ii++ )
{
fn = filepaths[ii];
nicknames.Add( fn.GetName() );
for( unsigned int i = 0; i < checkedIndices.GetCount(); ++i )
checkedStrings.Add( m_checkListGH->GetString( checkedIndices[i] ).AfterLast( '/' ) );
fn.AssignDir( filepaths[ii] );
m_checkListGH->Clear();
if( m_currLibDescr->m_IsAbsolutePath || m_currLibDescr->m_DefaultPath.IsEmpty() )
// Rebuild the list, putting the matching entries on the top
int matching = 0; // number of entries matching the search phrase
for( unsigned int i = 0; i < m_githubLibs.GetCount(); ++i )
{
const wxString& lib = m_githubLibs[i].AfterLast( '/' );
bool wasChecked = ( checkedStrings.Index( lib ) != wxNOT_FOUND );
int insertedIdx = -1;
if( !searchPhrase.IsEmpty() && lib.Lower().Contains( searchPhrase ) )
{
filepaths[ii] = fn.GetFullPath();
insertedIdx = m_checkListGH->Insert( lib, matching++ );
m_checkListGH->SetSelection( insertedIdx );
}
else
{
if( ! fn.MakeRelativeTo( m_currLibDescr->m_DefaultPath ) )
filepaths[ii] = fn.GetFullPath();
else
filepaths[ii].Printf( wxT("${%s}%c%s"),
GetChars( m_currLibDescr->m_EnvVarName ),
fn.GetPathSeparator(),
GetChars( fn.GetFullPath() ) );
}
#ifdef __WINDOWS__
// We store paths using Unix notation, which also works fine on Windows
filepaths[ii].Replace( wxT("\\"), wxT("/") );
#endif
// Remove trailing path separator, if any.
if( filepaths[ii].EndsWith( wxT("/") ) )
filepaths[ii].RemoveLast();
insertedIdx = m_checkListGH->Append( lib );
if( wasChecked )
m_checkListGH->Check( insertedIdx );
}
populateLibList( nicknames, filepaths, m_currLibDescr->m_PluginName );
if( !m_checkListGH->IsEmpty() )
m_checkListGH->EnsureVisible( 0 );
}
#ifdef KICAD_USE_WEBKIT
// A helper function to run the wen viewer (see webviewer.cpp)
extern int RunWebViewer( wxWindow * aParent, const wxString& aUrlOnStart,
wxArrayString* aUrlListSelection = NULL );
#endif
void WIZARD_FPLIB_TABLE::selectLibsGithubWithWebViewer() // select a set of library on Github
void WIZARD_FPLIB_TABLE::OnWizardFinished( wxWizardEvent& aEvent )
{
// A string array to store the URLs selected from the web viewer:
wxArrayString urls;
// Run the web viewer and open the default URL: the default path
// or our github library repos
wxString defaultURL = m_currLibDescr->m_DefaultPath;
if( defaultURL.IsEmpty() )
defaultURL = wxT( "https://github.com/KiCad" );
#ifdef KICAD_USE_WEBKIT
RunWebViewer( this, defaultURL, &urls );
#else
// If the Web Viewer is not available, just add a template
// to the fp lib table.
// The user have to edit it
urls.Add( defaultURL + wxT("/newlibname.pretty") );
#endif
installGithubLibsFromList( urls );
}
void WIZARD_FPLIB_TABLE::installGithubLibsFromList( wxArrayString& aUrlList )
{
// add the libs found in aUrlList, after calculating a nickname and
// replacing the path by an env variable, if needed
// Create the nickname: currently make it from the url
wxArrayString filepaths;
wxArrayString nicknames;
for( unsigned ii = 0; ii < aUrlList.GetCount(); ii++ )
// Shall we download a localy copy of the libraries
if( GetLibSource() == GITHUB && m_downloadGithub->GetValue() )
{
wxString urlstring( aUrlList[ii] );
wxString error;
wxArrayString libs;
wxURI uri( urlstring );
// Prepare a list of libraries to download
for( std::vector<LIBRARY>::const_iterator it = m_libraries.begin();
it != m_libraries.end(); ++it )
{
wxASSERT( it->GetPluginType() == IO_MGR::GITHUB );
// We cannot use wxURL to test the validity of the url, because
// wxURL does not know https protocol we are using, and aways returns
// error for URLs starting by https. Hope this test is enough
if( uri.HasPath() )
nicknames.Add( uri.GetPath().AfterLast( '/').BeforeLast( '.' ) );
else
continue; // Should not happen: bad URL
if( it->GetStatus() != LIBRARY::INVALID )
libs.Add( it->GetAbsolutePath() );
}
if( m_currLibDescr->m_IsAbsolutePath ||
m_currLibDescr->m_DefaultPath.IsEmpty() )
if( !downloadGithubLibsFromList( libs, &error ) )
{
filepaths.Add( aUrlList[ii] ); // use the full URL
DisplayError( this, error );
m_libraries.clear();
}
else
{
wxString shortURI;
if( aUrlList[ii].Lower().StartsWith(
m_currLibDescr->m_DefaultPath.Lower(), &shortURI ) )
// Now libraries are stored locally, so update the paths to point to the download folder
for( std::vector<LIBRARY>::iterator it = m_libraries.begin();
it != m_libraries.end(); ++it )
{
shortURI.Prepend( wxT("${") + m_currLibDescr->m_EnvVarName + wxT("}") );
filepaths.Add( shortURI );
wxString path = it->GetAbsolutePath();
path.Replace( GetGithubURL(), getDownloadDir() );
it->setPath( path );
std::cout << "replaced path " << it->GetAbsolutePath() << std::endl;
it->setPluginType( IO_MGR::KICAD );
}
else // keep the full URL
filepaths.Add( aUrlList[ii] ); // use the full URL
}
}
populateLibList( nicknames, filepaths, m_currLibDescr->m_PluginName );
}
void WIZARD_FPLIB_TABLE::OnRemoveFpLibs( wxCommandEvent& event )
void WIZARD_FPLIB_TABLE::OnBrowseButtonClick( wxCommandEvent& aEvent )
{
wxArrayInt selectedRows = m_gridFpListLibs->GetSelectedRows();
int row_cursor = m_gridFpListLibs->GetGridCursorRow();
if( selectedRows.size() == 0 && row_cursor >= 0 )
selectedRows.Add( row_cursor );
wxString path = getDownloadDir();
std::sort( selectedRows.begin(), selectedRows.end() );
path = wxDirSelector( _("Choose a folder to save the downloaded libraries" ),
path, 0, wxDefaultPosition, this );
for( int ii = selectedRows.GetCount()-1; ii >= 0; ii-- )
if( !path.IsEmpty() && wxDirExists( path ) )
{
int row = selectedRows[ii];
m_gridFpListLibs->DeleteRows( row, 1 );
setDownloadDir( path );
updateGithubControls();
}
}
m_gridFpListLibs->SelectRow( m_gridFpListLibs->GetGridCursorRow() );
void WIZARD_FPLIB_TABLE::OnCheckSaveCopy( wxCommandEvent& aEvent )
{
updateGithubControls();
}
#ifdef BUILD_GITHUB_PLUGIN
#include <../github/github_getliblist.h>
void WIZARD_FPLIB_TABLE::OnGithubLibsList( wxCommandEvent& event )
bool WIZARD_FPLIB_TABLE::checkFiles() const
{
wxArrayString liblist;
getLibsListGithub( liblist );
// Get current selection (files & directories)
wxArrayString candidates;
m_filePicker->GetPaths( candidates );
if( liblist.GetCount() == 0 ) // No lib selected
return;
// Workaround, when you change filters "/" is automatically selected
int slash_index = candidates.Index( "/", true, true );
if( slash_index != wxNOT_FOUND )
candidates.RemoveAt( slash_index, 1 );
if( IsKicadPlugin() )
{
wxString msg;
if( candidates.IsEmpty() )
return false;
if( !downloadGithubLibsFromList( liblist, &msg ) )
{
wxMessageBox( msg );
return;
}
// Verify all the files/folders comply to the selected library type filter
for( unsigned int i = 0; i < candidates.GetCount(); ++i )
{
if( !passesFilter( candidates[i], m_filePicker->GetFilterIndex() ) )
return false;
}
else
installGithubLibsFromList( liblist );
return true;
}
#ifdef BUILD_GITHUB_PLUGIN
void WIZARD_FPLIB_TABLE::getLibsListGithub( wxArrayString& aList )
{
wxBeginBusyCursor();
// Be sure there is no trailing '/' at the end of the repo name
wxString git_url = m_textCtrlGithubURL->GetValue();
if( git_url.EndsWith( wxT("/" ) ) )
if( git_url.EndsWith( wxT( "/" ) ) )
{
git_url.RemoveLast();
m_textCtrlGithubURL->SetValue( git_url );
}
GITHUB_GETLIBLIST getter( git_url );
wxArrayString fullList;
getter.GetLibraryList( fullList );
getter.GetLibraryList( aList );
wxEndBusyCursor();
wxArrayInt choices;
wxString msg( _( "Urls detected as footprint .pretty libraries.\n"
"Selected urls will be added to the current footprint library list" ) );
if( wxGetSelectedChoices( choices, msg,
_( "Footprint libraries" ), fullList, this ) <= 0 )
return;
// Add selected url in list
for( unsigned ii = 0; ii < choices.GetCount(); ii++ )
{
wxString& url = fullList[choices[ii]];
aList.Add( url );
}
}
// Download the .pretty libraries found in aUrlLis and store them on disk
// in a master folder
bool WIZARD_FPLIB_TABLE::downloadGithubLibsFromList( wxArrayString& aUrlList,
wxString * aErrorMessage )
wxString* aErrorMessage )
{
wxString masterFolder;
wxString default_path;
wxGetEnv( FP_LIB_TABLE::GlobalPathEnvVariableName(), &default_path );
masterFolder = wxDirSelector( _("Choose Folder to Copy Downloaded '.pretty' Libraries" ),
default_path, 0, wxDefaultPosition, this );
if( masterFolder.IsEmpty() ) // Aborted by user
{
if( aErrorMessage )
*aErrorMessage = _( "Aborted" );
return false;
}
if( !wxDirExists( masterFolder ) )
{
if( aErrorMessage )
aErrorMessage->Printf( _( "Folder '%s' does not exists" ),
GetChars( masterFolder ) );
return false;
}
// Display a progress bar to show the downlaod state
wxProgressDialog pdlg( _("Download libraries"), wxEmptyString, aUrlList.GetCount() );
wxProgressDialog pdlg( _( "Downloading libraries" ), wxEmptyString, aUrlList.GetCount() );
// Download libs:
for( unsigned ii = 0; ii < aUrlList.GetCount(); ii++ )
......@@ -924,13 +604,13 @@ bool WIZARD_FPLIB_TABLE::downloadGithubLibsFromList( wxArrayString& aUrlList,
wxURI url( libsrc_name );
wxFileName fn( url.GetPath() );
// Set our local path
fn.SetPath( masterFolder );
fn.SetPath( getDownloadDir() );
libdst_name = fn.GetFullPath();
if( !wxDirExists( libdst_name ) )
wxMkdir( libdst_name );
pdlg.Update( ii, libsrc_name);
pdlg.Update( ii, libsrc_name );
try
{
......@@ -949,7 +629,7 @@ bool WIZARD_FPLIB_TABLE::downloadGithubLibsFromList( wxArrayString& aUrlList,
catch( const IO_ERROR& ioe )
{
if( aErrorMessage )
aErrorMessage->Printf( _("Error:\n'%s'\nwhile downloading library:\n'%s'"),
aErrorMessage->Printf( _( "Error:\n'%s'\nwhile downloading library:\n'%s'" ),
GetChars( ioe.errorText ), GetChars( libsrc_name ) );
return false;
}
......@@ -957,5 +637,190 @@ bool WIZARD_FPLIB_TABLE::downloadGithubLibsFromList( wxArrayString& aUrlList,
return true;
}
#endif /* BUILD_GITHUB_PLUGIN */
void WIZARD_FPLIB_TABLE::updateGithubControls()
{
#ifndef BUILD_GITHUB_PLUGIN
m_radioAddGithub->Enable( false );
#endif
// Disable inputs that have no meaning for the selected source
bool githubEnabled = ( GetLibSource() == GITHUB );
m_textCtrlGithubURL->Enable( githubEnabled );
m_downloadGithub->Enable( githubEnabled );
m_downloadDir->Enable( githubEnabled && wantLocalCopy() );
m_btnBrowse->Enable( githubEnabled && wantLocalCopy() );
bool valid = !( githubEnabled && wantLocalCopy() ) || wxFileName::IsDirWritable( getDownloadDir() );
// Do not allow to go further unless there is a valid directory selected
m_invalidDir->Show( !valid );
enableNext( valid );
}
void WIZARD_FPLIB_TABLE::updateLibraries()
{
// No need to update, the review list is ready
if( m_listCtrlReview->GetItemCount() != 0 )
return;
switch( GetLibSource() )
{
case LOCAL:
{
wxArrayString libs;
m_filePicker->GetPaths( libs );
// Workaround, when you change filters "/" is automatically selected
int slash_index = libs.Index( "/", true, true );
if( slash_index != wxNOT_FOUND )
libs.RemoveAt( slash_index, 1 );
m_libraries.reserve( libs.GetCount() );
for( unsigned int i = 0; i < libs.GetCount(); ++i )
m_libraries.push_back( libs[i] );
}
break;
case GITHUB:
{
wxArrayInt checkedLibs;
m_checkListGH->GetCheckedItems( checkedLibs );
m_libraries.reserve( checkedLibs.GetCount() );
for( unsigned int i = 0; i < checkedLibs.GetCount(); ++i )
m_libraries.push_back( GetGithubURL() + "/" + m_checkListGH->GetString( checkedLibs[i] ) );
}
break;
default:
wxASSERT( false );
break;
}
}
void WIZARD_FPLIB_TABLE::setupDialogOrder()
{
// Alternate the wizard pages flow depending on the selected option
switch( GetLibSource() )
{
case LOCAL:
m_welcomeDlg->SetNext( m_fileSelectDlg );
m_fileSelectDlg->SetPrev( m_welcomeDlg );
m_fileSelectDlg->SetNext( m_reviewDlg );
m_reviewDlg->SetPrev( m_fileSelectDlg );
break;
case GITHUB:
m_welcomeDlg->SetNext( m_githubListDlg );
m_githubListDlg->SetPrev( m_welcomeDlg );
m_githubListDlg->SetNext( m_reviewDlg );
m_reviewDlg->SetPrev( m_githubListDlg );
break;
default:
wxASSERT( false );
break;
}
}
void WIZARD_FPLIB_TABLE::setupGithubList()
{
// Enable 'Next' only if there is at least one library selected
wxArrayInt checkedIndices;
m_checkListGH->GetCheckedItems( checkedIndices );
enableNext( checkedIndices.GetCount() > 0 );
// Update only if necessary
if( m_githubLibs.GetCount() == 0 )
getLibsListGithub( m_githubLibs );
m_searchCtrlGH->Clear();
// Clear the review list so it will be reloaded
m_libraries.clear();
m_listCtrlReview->DeleteAllItems();
}
void WIZARD_FPLIB_TABLE::setupFileSelect()
{
// Disable the button until something is selected
enableNext( checkFiles() );
// Clear the review list so it will be reloaded
m_libraries.clear();
m_listCtrlReview->DeleteAllItems();
}
void WIZARD_FPLIB_TABLE::setupReview()
{
wxBeginBusyCursor();
updateLibraries();
int libTotalCount = m_libraries.size();
int libCount = 0;
bool validate = true;
wxProgressDialog progressDlg( _( "Please wait..." ), _( "Validating libraries" ),
libTotalCount, this,
wxPD_APP_MODAL | wxPD_CAN_ABORT | wxPD_AUTO_HIDE );
m_dvLibName->SetWidth( 280 );
// Prepare the review list
m_listCtrlReview->DeleteAllItems();
for( std::vector<LIBRARY>::iterator it = m_libraries.begin(); it != m_libraries.end(); ++it )
{
wxVector<wxVariant> row;
LIBRARY::STATUS status = it->GetStatus();
// Check if the library contents is valid
if( status == LIBRARY::NOT_CHECKED && validate )
{
it->Test();
status = it->GetStatus();
}
row.push_back( wxVariant( it->GetDescription() ) );
switch( it->GetStatus() )
{
case LIBRARY::NOT_CHECKED:
row.push_back( wxVariant( _( "NOT CHECKED" ) ) );
break;
case LIBRARY::OK:
row.push_back( wxVariant( _( "OK" ) ) );
break;
case LIBRARY::INVALID:
row.push_back( wxVariant( _( "INVALID" ) ) );
break;
}
row.push_back( wxVariant( it->GetPluginName() ) );
m_listCtrlReview->AppendItem( row );
++libCount;
if( !progressDlg.Update( libCount, wxString::Format( _( "Validating libraries %d/%d" ),
libCount, libTotalCount ) ) )
validate = false;
}
// The list should never be empty, but who knows?
enableNext( m_listCtrlReview->GetItemCount() > 0 );
wxEndBusyCursor();
}
/**
* @file wizard_add_fplib.h
*/
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2014 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 1992-2014 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 2015 CERN
* @author Maciej Suminski <maciej.suminski@cern.ch>
* Copyright (C) 2014-2015 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 1992-2015 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
......@@ -26,230 +24,254 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include <wx/wx.h>
#include <dialog_helpers.h>
#include <wizard_add_fplib_base.h>
#include <io_mgr.h>
#include <boost/optional.hpp>
// A helper class to handle the different types of lib depending
// on the plugin: ext, type of lib: files/folders ... and info
// needed to populate the main fp lib table
class LIB_DESCR
{
public:
wxString m_PluginName; // The "official" name of the plugin (see fp lib table dialog)
wxString m_Ext; // standard extension (.mod, .pretty ...)
wxString m_EnvVarName; // the environment var if selected, or empty
wxString m_DefaultPath;
bool m_IsAbsolutePath; // true if absolue path is selected
bool m_IsFile; // true for libs which are single files,
// false for libs which are directories containing footprints
bool m_IsGitHub; // true only for GitHub plugin
LIB_DESCR()
{
m_IsAbsolutePath = true;
m_IsFile = true;
m_IsGitHub = false;
}
};
class KIWAY_PLAYER;
class WIZARD_FPLIB_TABLE : public WIZARD_FPLIB_TABLE_BASE
{
int m_rowPrjEnvVarPosition; // the row of the PROJECT_VAR_NAME
int m_predefinedEnvVarCnt; // number of predefined env var when calling the wizard
// at least 3 are always defined
LIB_DESCR * m_currLibDescr;
// static members to store options during a session
static int m_last_plugin_choice;
static int m_last_defaultpath_choice;
// This enum must have the same order than m_rbPathManagement
enum OPT_PATH {
PROJECT_PATH,
ENV_VAR_PATH,
ABSOLUTE_PATH
};
// This enum must have the same order than m_rbFpLibFormat
enum OPT_PLUGIN {
KICAD_PLUGIN,
GITHUB_PLUGIN,
LEGACY_PLUGIN,
EAGLE_PLUGIN,
GEDA_PCB_PLUGIN
};
public:
WIZARD_FPLIB_TABLE( wxWindow* aParent, wxArrayString& aEnvVariableList );
wxWizardPage* GetFirstPage() { return m_pages[0]; }
WIZARD_FPLIB_TABLE( wxWindow* aParent );
~WIZARD_FPLIB_TABLE();
///> Source of the libraries (local files or Github)
enum LIB_SOURCE { LOCAL, GITHUB };
///> Scope (global/project)
enum LIB_SCOPE { GLOBAL = 1, PROJECT = 2 };
/**
* Return info on lib at line aIdx in aLibDescr
* @param aLibDescr = a wxArrayString to return the nickname, the lib URI and the lin type
* @return true if aIdx lin exists
* Function GetFirstPage
* Returns the welcoming page for the wizard.
*/
bool GetLibDescr( int aIdx, wxArrayString& aLibDescr )
inline wxWizardPage* GetFirstPage() const
{
int count = m_gridFpListLibs->GetTable()->GetRowsCount();
if( aIdx >= count )
return false;
// Return info
// Add the nickname:
aLibDescr.Add( m_gridFpListLibs->GetCellValue( aIdx, 0 ) );
// Add the full path:
aLibDescr.Add( m_gridFpListLibs->GetCellValue( aIdx, 1 ) );
// Add the plugin name:
aLibDescr.Add( m_gridFpListLibs->GetCellValue( aIdx, 2 ) );
return true;
return m_welcomeDlg;
}
private:
void initDlg( wxArrayString& aEnvVariableList );
wxString getSelectedEnvVar(); // return the selected env variable
wxString getSelectedEnvVarValue(); // return the selected env variable value
bool setSecondPage(); // Init prms for the second wizard page
bool setLastPage(); // Init prms for the last wizard page
void selectLibsFiles(); // select a set of library files
void selectLibsFolders(); // select a set of library folders
/** select a set of library on Github, using the Web viewer to explore
* the repos
/**
* Function GetGithubURL
* Returns the current Github repository URL set in the wizard.
*/
void selectLibsGithubWithWebViewer();
inline wxString GetGithubURL() const
{
return m_textCtrlGithubURL->GetValue();
}
/** Get the list of .pretty libraries on Github,
* without using the viewer, from the lib list extracted from the KiCad repos
/**
* Function SetGithubURL
* Sets the current Github repository URL used by the wizard.
* @param aUrl is the new URL to be applied.
*/
void getLibsListGithub( wxArrayString& aList );
inline void SetGithubURL( const wxString& aUrl )
{
m_textCtrlGithubURL->SetValue( aUrl );
}
/** Helper function.
* add the .pretty libraries found in aUrlList, after calculating a nickname and
* replacing the path by an env variable, if allowed and possible
/**
* Function GetLibSource
* Returns the source of libraries (local / Github).
*/
void installGithubLibsFromList( wxArrayString& aUrlList );
LIB_SOURCE GetLibSource() const;
/**
* Download the .pretty libraries found in aUrlLis and store them on disk
* in a master folder
* @return true if OK, false on error
* @param aUrlList is the list of Github .pretty libs to download
* @param aErrorMessage is a wxString pointer to store error messages if any.
* Function GetLibScope
* Returns the scope for the added libraries (global / project specific).
*/
bool downloadGithubLibsFromList( wxArrayString& aUrlList, wxString * aErrorMessage = NULL );
LIB_SCOPE GetLibScope() const;
// Wizard event handlers
void OnSourceCheck( wxCommandEvent& aEvent );
void OnSelectFiles( wxCommandEvent& aEvent );
void OnCheckGithubList( wxCommandEvent& aEvent );
void OnPageChanged( wxWizardEvent& aEvent );
void OnSelectAllGH( wxCommandEvent& aEvent );
void OnUnselectAllGH( wxCommandEvent& aEvent );
void OnChangeSearch( wxCommandEvent& aEvent );
void OnWizardFinished( wxWizardEvent& aEvent );
void OnBrowseButtonClick( wxCommandEvent& aEvent );
void OnCheckSaveCopy( wxCommandEvent& aEvent );
class LIBRARY
{
public:
LIBRARY( const wxString& aPath, const wxString& aDescription = wxEmptyString );
~LIBRARY()
{
std::cout << "destroyed " << this << std::endl;
}
///> Possible states of validation.
enum STATUS { OK, INVALID, NOT_CHECKED };
/**
* Function Test
* Uses the associated plugin to validate the library contents.
* @return True if the library and the matched plugin type are valid.
*/
bool Test();
/**
* Function GetPluginType
* Returns the plugin type, autodetected basing on the path.
* @return Returns empty boost::optional if the type could not be autodetected.
*/
inline boost::optional<IO_MGR::PCB_FILE_T> GetPluginType() const
{
return m_plugin;
}
/**
* Function GetPluginName
* Returns the plugin name, as used in the FPLIB table editor.
*/
wxString GetPluginName() const;
/**
* Function GetAbsolutePath
* Returns the absolute path for the library.
*/
inline const wxString& GetAbsolutePath() const
{
return m_path;
}
/**
* Function GetRelativePath
* Returns the relative path, based on the input path with the base part replaced.
* @param aBase is the base for the relative path.
* @param aSubstitution is the string to be replace the base path.
* @return Adjusted path if possible, or the absolute path when it is not possible.
*/
wxString GetRelativePath( const wxString& aBase, const wxString& aSubstitution = wxEmptyString ) const;
/**
* Function GetAutoPath
* Returns path that is either absolute or related to KISYSMOD/KIPRJMOD if the files
* are stored within one of the mentioned paths.
* @param aScoep is the scope for the library. It determines the environmental variables
* that are used to check the path (GLOBAL scope checks only KISYSMOD, while PROJECT
* scope checks both KISYSMOD & KIPRJMOD).
*/
wxString GetAutoPath( LIB_SCOPE aScope ) const;
/**
* Function GetDescription
* Returns the description for the library. If it is not specified in the constructor,
* it is just the filename.
*/
wxString GetDescription() const;
/**
* Function GetStatus
* Returns the validity status for the library. It requires running Test() before, to get
* a result different than NOT_CHECKED.
*/
STATUS GetStatus() const
{
return m_status;
}
protected:
inline void setPath( const wxString& aPath )
{
m_path = aPath;
}
inline void setPluginType( IO_MGR::PCB_FILE_T aType )
{
m_plugin = aType;
}
/**
* Function replaceEnv
* replaces path with environmental variable if applicable.
* @param aEnvVar is the environmental variable that should be substituted.
* @param aFilePath determines if the path is a file path (contrary to e.g. http address).
*/
wxString replaceEnv( const wxString& aEnvVar, bool aFilePath = true ) const;
wxString m_path;
wxString m_description;
boost::optional<IO_MGR::PCB_FILE_T> m_plugin;
STATUS m_status;
friend class WIZARD_FPLIB_TABLE;
};
void updateFromPlugingChoice(); // update dialog options and widgets
// depending on the plugin choice
int GetEnvVarCount() // Get the number of rows in env var table
/**
* Function GetLibraries
* Returns libraries selected by the user.
*/
const std::vector<LIBRARY>& GetLibraries() const
{
return m_gridEnvironmentVariablesList->GetTable()->GetRowsCount();
return m_libraries;
}
int GetLibsCount() // Get the number of rows in libs table
protected:
// Initialization of wizard pages
void setupDialogOrder();
void setupGithubList();
void setupFileSelect();
void setupReview();
///> Checks the selection in file picker
bool checkFiles() const;
///> Sets the target directory for libraries downloaded from Github
void setDownloadDir( const wxString& aDir )
{
return m_gridFpListLibs->GetTable()->GetRowsCount();
m_downloadDir->SetLabel( aDir );
}
bool IsGithubPlugin() // Helper funct, return true if
{ // the Github plugin is the choice
return m_rbFpLibFormat->GetSelection() == GITHUB_PLUGIN;
///> Gets the current target for downloaded libraries
inline wxString getDownloadDir()
{
return m_downloadDir->GetLabel();
}
///> Downloads the list of Github libraries
void getLibsListGithub( wxArrayString& aList );
bool IsKicadPlugin() // Helper funct, return true if
{ // the Kicad plugin is the choice
return m_rbFpLibFormat->GetSelection() == KICAD_PLUGIN;
}
///> Saves a list of Github libraries locally.
bool downloadGithubLibsFromList( wxArrayString& aUrlList, wxString* aErrorMessage );
int HasGithubEnvVarCompatible(); // Return the first index to one env var
// which defines a url compatible github
// or -1 if not found
// Populate the library list with the currently selected libs
void populateLibList( const wxArrayString& aNickNames,
const wxArrayString& aPaths,
const wxString& aPluginName );
// Virtual event functions, from WIZARD_FPLIB_TABLE_BASE
void OnFinish( wxWizardEvent& event ) { event.Skip(); }
void OnPageChanged( wxWizardEvent& event );
void OnPageChanging( wxWizardEvent& event );
void OnAddEVariable( wxCommandEvent& event );
void OnRemoveEVariable( wxCommandEvent& event );
void OnAddFpLibs( wxCommandEvent& event );
void OnRemoveFpLibs( wxCommandEvent& event );
void OnPathManagementSelection( wxCommandEvent& event );
void OnSelectEnvVarCell( wxGridEvent& event );
void OnPluginSelection( wxCommandEvent& event );
#ifdef BUILD_GITHUB_PLUGIN
void OnGithubLibsList( wxCommandEvent& event );
#endif
bool ValidateOptions();
};
///> Does the user want a local copy of Github libraries?
inline bool wantLocalCopy() const { return m_downloadGithub->GetValue(); }
///> Enables Github widgets depending on the selected options.
void updateGithubControls();
// Specialized helper classes to handle the different plugin types:
class LIB_DESCR_KICAD: public LIB_DESCR
{
public:
LIB_DESCR_KICAD(): LIB_DESCR()
{
m_PluginName = IO_MGR::ShowType( IO_MGR::KICAD );
m_Ext = wxT("pretty");
m_IsFile = false;
}
};
///> Updates m_libraries basing on dialogs contents
void updateLibraries();
class LIB_DESCR_GITHUB: public LIB_DESCR
{
public:
LIB_DESCR_GITHUB(): LIB_DESCR()
///> Enables/disable 'Next' button
inline void enableNext( bool aEnable )
{
m_PluginName = IO_MGR::ShowType( IO_MGR::GITHUB );
m_Ext = wxT("pretty");
m_IsFile = false;
m_IsGitHub = true;
}
};
wxWindow* nextBtn = FindWindowById( wxID_FORWARD );
class LIB_DESCR_LEGACY: public LIB_DESCR
{
public:
LIB_DESCR_LEGACY(): LIB_DESCR()
{
m_PluginName = IO_MGR::ShowType( IO_MGR::LEGACY );
m_Ext = wxT("mod");
if( nextBtn )
nextBtn->Enable( aEnable );
}
};
///> Cache for the downloaded Github library list
wxArrayString m_githubLibs;
class LIB_DESCR_EAGLE: public LIB_DESCR
{
public:
LIB_DESCR_EAGLE(): LIB_DESCR()
{
m_PluginName = IO_MGR::ShowType( IO_MGR::EAGLE );
m_Ext = wxT("lbr");
m_IsFile = true;
}
};
///> Libraries selected in the wizard
std::vector<LIBRARY> m_libraries;
// Aliases for wizard pages to make code more readable
wxWizardPageSimple* const m_welcomeDlg;
wxWizardPageSimple* const m_fileSelectDlg;
wxWizardPageSimple* const m_githubListDlg;
wxWizardPageSimple* const m_reviewDlg;
wxWizardPageSimple* const m_targetDlg;
class LIB_DESCR_GEDA: public LIB_DESCR
{
public:
// No specific extension known for folders
LIB_DESCR_GEDA(): LIB_DESCR()
{
m_PluginName = IO_MGR::ShowType( IO_MGR::GEDA_PCB );
m_IsFile = false;
}
// Since the same event is used for changing the selection/filter type, we need a way to
// determine what's the real cause of the event. Therefore here we store the number of the
// selected file type filter.
int m_selectedFilter;
};
///////////////////////////////////////////////////////////////////////////
// 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!
......@@ -12,210 +12,221 @@
WIZARD_FPLIB_TABLE_BASE::WIZARD_FPLIB_TABLE_BASE( wxWindow* parent, wxWindowID id, const wxString& title, const wxBitmap& bitmap, const wxPoint& pos, long style )
{
this->Create( parent, id, title, bitmap, pos, style );
this->SetSizeHints( wxSize( 450,-1 ), wxDefaultSize );
this->SetSizeHints( wxSize( 720,480 ), wxDefaultSize );
wxWizardPageSimple* m_wizPage1 = new wxWizardPageSimple( this );
wxWizardPageSimple* m_wizPage1 = new wxWizardPageSimple( this, NULL, NULL, wxArtProvider::GetBitmap( wxART_HELP_BOOK, wxART_FRAME_ICON ) );
m_pages.Add( m_wizPage1 );
m_wizPage1->SetMinSize( wxSize( 500,-1 ) );
m_wizPage1->SetMinSize( wxSize( 720,480 ) );
wxBoxSizer* bSizerPage1;
bSizerPage1 = new wxBoxSizer( wxVERTICAL );
wxBoxSizer* bSizer1;
bSizer1 = new wxBoxSizer( wxVERTICAL );
wxString m_rbFpLibFormatChoices[] = { _("KiCad (*.Pretty folder containing .kicad_mod files)"), _("GitHub (.Pretty lib stored on GitHub repos)"), _("Legacy ( old *.mod lib file)"), _("Eagle V6 xml library file"), _("Geda footprint folder (folder containing *.fp files)") };
int m_rbFpLibFormatNChoices = sizeof( m_rbFpLibFormatChoices ) / sizeof( wxString );
m_rbFpLibFormat = new wxRadioBox( m_wizPage1, wxID_ANY, _("Library Format:"), wxDefaultPosition, wxDefaultSize, m_rbFpLibFormatNChoices, m_rbFpLibFormatChoices, 1, wxRA_SPECIFY_COLS );
m_rbFpLibFormat->SetSelection( 0 );
bSizerPage1->Add( m_rbFpLibFormat, 0, wxALL|wxEXPAND, 5 );
wxFlexGridSizer* fgSizer112;
fgSizer112 = new wxFlexGridSizer( 3, 1, 0, 0 );
fgSizer112->AddGrowableRow( 1 );
fgSizer112->SetFlexibleDirection( wxBOTH );
fgSizer112->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
m_staticline2 = new wxStaticLine( m_wizPage1, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL );
bSizerPage1->Add( m_staticline2, 0, wxEXPAND | wxALL, 5 );
m_staticText1 = new wxStaticText( m_wizPage1, wxID_ANY, wxT("Welcome to the Add Footprint Libraries Wizard!\n\nPlease select the source for the libraries to add:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText1->Wrap( -1 );
fgSizer112->Add( m_staticText1, 1, wxALL|wxEXPAND, 5 );
m_bitmapGithubURL = new wxStaticBitmap( m_wizPage1, wxID_ANY, wxArtProvider::GetBitmap( wxART_INFORMATION, wxART_OTHER ), wxDefaultPosition, wxDefaultSize, 0 );
bSizerPage1->Add( m_bitmapGithubURL, 0, wxALL|wxALIGN_CENTER_HORIZONTAL, 5 );
wxBoxSizer* bSizer19;
bSizer19 = new wxBoxSizer( wxVERTICAL );
m_staticText10 = new wxStaticText( m_wizPage1, wxID_ANY, _("Default URL for KiCad libraries on Github:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText10->Wrap( -1 );
bSizerPage1->Add( m_staticText10, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
m_radioAddLocal = new wxRadioButton( m_wizPage1, wxID_ANY, wxT("Files on my computer"), wxDefaultPosition, wxDefaultSize, 0 );
bSizer19->Add( m_radioAddLocal, 0, wxALL|wxEXPAND, 5 );
m_textCtrlGithubURL = new wxTextCtrl( m_wizPage1, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
bSizerPage1->Add( m_textCtrlGithubURL, 0, wxALL|wxEXPAND, 5 );
wxBoxSizer* m_sizerGithub;
m_sizerGithub = new wxBoxSizer( wxHORIZONTAL );
m_wizPage1->SetSizer( bSizerPage1 );
m_wizPage1->Layout();
bSizerPage1->Fit( m_wizPage1 );
wxWizardPageSimple* m_wizPage2 = new wxWizardPageSimple( this );
m_pages.Add( m_wizPage2 );
bSizer19->Add( m_sizerGithub, 0, wxEXPAND, 5 );
m_wizPage2->SetMinSize( wxSize( 450,-1 ) );
wxGridSizer* gSizer1;
gSizer1 = new wxGridSizer( 2, 2, 0, 0 );
wxBoxSizer* bSizerPage2;
bSizerPage2 = new wxBoxSizer( wxVERTICAL );
wxString m_rbPathManagementChoices[] = { _("Use path relative to the project"), _("Use environment variable in path"), _("Use absolute path") };
int m_rbPathManagementNChoices = sizeof( m_rbPathManagementChoices ) / sizeof( wxString );
m_rbPathManagement = new wxRadioBox( m_wizPage2, wxID_ANY, _("Path management:"), wxDefaultPosition, wxDefaultSize, m_rbPathManagementNChoices, m_rbPathManagementChoices, 1, wxRA_SPECIFY_COLS );
m_rbPathManagement->SetSelection( 2 );
bSizerPage2->Add( m_rbPathManagement, 0, wxALL|wxEXPAND, 5 );
bSizer19->Add( gSizer1, 0, wxEXPAND, 5 );
m_staticText1 = new wxStaticText( m_wizPage2, wxID_ANY, _("Environment variables:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText1->Wrap( -1 );
bSizerPage2->Add( m_staticText1, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
wxFlexGridSizer* m_githubSizer;
m_githubSizer = new wxFlexGridSizer( 0, 2, 0, 0 );
m_githubSizer->SetFlexibleDirection( wxBOTH );
m_githubSizer->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
m_radioAddGithub = new wxRadioButton( m_wizPage1, wxID_ANY, wxT("Github repository"), wxDefaultPosition, wxDefaultSize, 0 );
m_githubSizer->Add( m_radioAddGithub, 0, wxALL|wxEXPAND, 5 );
m_textCtrlGithubURL = new wxTextCtrl( m_wizPage1, wxID_ANY, wxT("http://github.com/KiCad"), wxDefaultPosition, wxDefaultSize, 0 );
m_textCtrlGithubURL->SetMinSize( wxSize( 300,-1 ) );
m_githubSizer->Add( m_textCtrlGithubURL, 1, wxALL|wxEXPAND, 5 );
m_githubSizer->Add( 0, 0, 1, wxEXPAND, 5 );
m_downloadGithub = new wxCheckBox( m_wizPage1, wxID_ANY, wxT("Save a local copy to:"), wxDefaultPosition, wxDefaultSize, 0 );
m_downloadGithub->SetValue(true);
m_githubSizer->Add( m_downloadGithub, 0, wxALL, 5 );
m_githubSizer->Add( 0, 0, 1, wxEXPAND, 5 );
m_gridEnvironmentVariablesList = new wxGrid( m_wizPage2, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0 );
wxBoxSizer* bSizer9;
bSizer9 = new wxBoxSizer( wxHORIZONTAL );
// Grid
m_gridEnvironmentVariablesList->CreateGrid( 3, 2 );
m_gridEnvironmentVariablesList->EnableEditing( true );
m_gridEnvironmentVariablesList->EnableGridLines( true );
m_gridEnvironmentVariablesList->EnableDragGridSize( false );
m_gridEnvironmentVariablesList->SetMargins( 0, 0 );
m_downloadDir = new wxStaticText( m_wizPage1, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
m_downloadDir->Wrap( -1 );
m_downloadDir->SetMinSize( wxSize( 300,-1 ) );
// Columns
m_gridEnvironmentVariablesList->SetColSize( 0, 125 );
m_gridEnvironmentVariablesList->SetColSize( 1, 154 );
m_gridEnvironmentVariablesList->AutoSizeColumns();
m_gridEnvironmentVariablesList->EnableDragColMove( false );
m_gridEnvironmentVariablesList->EnableDragColSize( true );
m_gridEnvironmentVariablesList->SetColLabelSize( 30 );
m_gridEnvironmentVariablesList->SetColLabelValue( 0, _("Environment Variable") );
m_gridEnvironmentVariablesList->SetColLabelValue( 1, _("Path Segment") );
m_gridEnvironmentVariablesList->SetColLabelAlignment( wxALIGN_CENTRE, wxALIGN_CENTRE );
bSizer9->Add( m_downloadDir, 1, wxALIGN_CENTER_VERTICAL|wxALL, 5 );
// Rows
m_gridEnvironmentVariablesList->AutoSizeRows();
m_gridEnvironmentVariablesList->EnableDragRowSize( false );
m_gridEnvironmentVariablesList->SetRowLabelSize( 40 );
m_gridEnvironmentVariablesList->SetRowLabelAlignment( wxALIGN_CENTRE, wxALIGN_CENTRE );
m_btnBrowse = new wxButton( m_wizPage1, wxID_ANY, wxT("Browse"), wxDefaultPosition, wxDefaultSize, 0 );
bSizer9->Add( m_btnBrowse, 0, wxALL, 5 );
// Label Appearance
// Cell Defaults
m_gridEnvironmentVariablesList->SetDefaultCellAlignment( wxALIGN_LEFT, wxALIGN_TOP );
bSizerPage2->Add( m_gridEnvironmentVariablesList, 1, wxALL|wxEXPAND, 5 );
m_githubSizer->Add( bSizer9, 1, wxEXPAND, 5 );
wxBoxSizer* bSizerButs;
bSizerButs = new wxBoxSizer( wxHORIZONTAL );
m_buttonAddEV = new wxButton( m_wizPage2, wxID_ANY, _("Add Environment Variable"), wxDefaultPosition, wxDefaultSize, 0 );
bSizerButs->Add( m_buttonAddEV, 0, wxALL, 5 );
m_githubSizer->Add( 0, 0, 1, wxEXPAND, 5 );
m_buttonRemoveEV = new wxButton( m_wizPage2, wxID_ANY, _("Remove Environment Variable"), wxDefaultPosition, wxDefaultSize, 0 );
bSizerButs->Add( m_buttonRemoveEV, 0, wxALL, 5 );
m_invalidDir = new wxStaticText( m_wizPage1, wxID_ANY, wxT("It is not possible to write in the selected directory.\nPlease choose another one."), wxDefaultPosition, wxDefaultSize, 0 );
m_invalidDir->Wrap( -1 );
m_invalidDir->SetForegroundColour( wxColour( 255, 0, 0 ) );
m_githubSizer->Add( m_invalidDir, 0, wxALL, 5 );
bSizerPage2->Add( bSizerButs, 0, wxALIGN_CENTER_HORIZONTAL, 5 );
bSizer19->Add( m_githubSizer, 1, wxEXPAND, 5 );
m_wizPage2->SetSizer( bSizerPage2 );
m_wizPage2->Layout();
bSizerPage2->Fit( m_wizPage2 );
wxWizardPageSimple* m_wizPage3 = new wxWizardPageSimple( this );
m_pages.Add( m_wizPage3 );
m_wizPage3->SetMinSize( wxSize( 450,-1 ) );
fgSizer112->Add( bSizer19, 1, wxEXPAND, 5 );
wxBoxSizer* bSizerPage3;
bSizerPage3 = new wxBoxSizer( wxVERTICAL );
wxFlexGridSizer* fgSizer12;
fgSizer12 = new wxFlexGridSizer( 0, 3, 0, 0 );
fgSizer12->SetFlexibleDirection( wxBOTH );
fgSizer12->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
m_staticText8 = new wxStaticText( m_wizPage1, wxID_ANY, wxT("Visit the official"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText8->Wrap( -1 );
fgSizer12->Add( m_staticText8, 0, wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM|wxLEFT, 5 );
m_hyperlink1 = new wxHyperlinkCtrl( m_wizPage1, wxID_ANY, wxT("Kicad repository on Github"), wxT("https://github.com/KiCad"), wxDefaultPosition, wxDefaultSize, wxHL_DEFAULT_STYLE );
fgSizer12->Add( m_hyperlink1, 0, wxTOP|wxBOTTOM, 5 );
m_staticText9 = new wxStaticText( m_wizPage1, wxID_ANY, wxT("to find numerous footprint libraries!"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText9->Wrap( -1 );
fgSizer12->Add( m_staticText9, 0, wxTOP|wxBOTTOM|wxALIGN_CENTER_VERTICAL, 5 );
fgSizer112->Add( fgSizer12, 1, wxEXPAND, 5 );
bSizer1->Add( fgSizer112, 1, wxEXPAND, 5 );
m_wizPage1->SetSizer( bSizer1 );
m_wizPage1->Layout();
wxWizardPageSimple* m_wizPage2_Local = new wxWizardPageSimple( this, NULL, NULL, wxArtProvider::GetBitmap( wxART_HELP_BOOK, wxART_FRAME_ICON ) );
m_pages.Add( m_wizPage2_Local );
wxStaticBoxSizer* sbSizer1;
sbSizer1 = new wxStaticBoxSizer( new wxStaticBox( m_wizPage3, wxID_ANY, _("Options") ), wxVERTICAL );
wxBoxSizer* bSizer8;
bSizer8 = new wxBoxSizer( wxVERTICAL );
wxFlexGridSizer* fgSizer1;
fgSizer1 = new wxFlexGridSizer( 0, 2, 0, 0 );
fgSizer1->AddGrowableCol( 1 );
fgSizer1->SetFlexibleDirection( wxBOTH );
fgSizer1->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
m_staticText7 = new wxStaticText( m_wizPage2_Local, wxID_ANY, wxT("Select files or folders to add:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText7->Wrap( -1 );
bSizer8->Add( m_staticText7, 0, wxALL, 5 );
m_textPluginTitle = new wxStaticText( m_wizPage3, wxID_ANY, _("Plugin type:"), wxDefaultPosition, wxDefaultSize, 0 );
m_textPluginTitle->Wrap( -1 );
fgSizer1->Add( m_textPluginTitle, 0, wxALL, 5 );
m_filePicker = new wxGenericDirCtrl( m_wizPage2_Local, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxDIRCTRL_3D_INTERNAL|wxDIRCTRL_MULTIPLE|wxDIRCTRL_SHOW_FILTERS|wxSUNKEN_BORDER, wxEmptyString, 0 );
m_textPluginType = new wxStaticText( m_wizPage3, wxID_ANY, _("KiCad"), wxDefaultPosition, wxDefaultSize, 0 );
m_textPluginType->Wrap( -1 );
fgSizer1->Add( m_textPluginType, 1, wxALL, 5 );
m_filePicker->ShowHidden( false );
bSizer8->Add( m_filePicker, 1, wxEXPAND | wxALL, 5 );
m_textOptionTitle = new wxStaticText( m_wizPage3, wxID_ANY, _("Option:"), wxDefaultPosition, wxDefaultSize, 0 );
m_textOptionTitle->Wrap( -1 );
fgSizer1->Add( m_textOptionTitle, 0, wxBOTTOM|wxRIGHT|wxLEFT, 5 );
m_textOption = new wxStaticText( m_wizPage3, wxID_ANY, _("dummy"), wxDefaultPosition, wxDefaultSize, 0 );
m_textOption->Wrap( -1 );
fgSizer1->Add( m_textOption, 1, wxBOTTOM|wxRIGHT|wxLEFT, 5 );
m_wizPage2_Local->SetSizer( bSizer8 );
m_wizPage2_Local->Layout();
bSizer8->Fit( m_wizPage2_Local );
wxWizardPageSimple* m_wizPage2_Github = new wxWizardPageSimple( this, NULL, NULL, wxArtProvider::GetBitmap( wxART_HELP_BOOK, wxART_FRAME_ICON ) );
m_pages.Add( m_wizPage2_Github );
m_stPathTitle = new wxStaticText( m_wizPage3, wxID_ANY, _("Path:"), wxDefaultPosition, wxDefaultSize, 0 );
m_stPathTitle->Wrap( -1 );
fgSizer1->Add( m_stPathTitle, 0, wxBOTTOM|wxRIGHT|wxLEFT, 5 );
wxBoxSizer* bSizer111;
bSizer111 = new wxBoxSizer( wxVERTICAL );
m_textPath = new wxStaticText( m_wizPage3, wxID_ANY, _("dummy"), wxDefaultPosition, wxDefaultSize, 0 );
m_textPath->Wrap( -1 );
fgSizer1->Add( m_textPath, 1, wxBOTTOM|wxRIGHT|wxLEFT, 5 );
m_staticText112 = new wxStaticText( m_wizPage2_Github, wxID_ANY, wxT("Select Github libraries to add:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText112->Wrap( -1 );
bSizer111->Add( m_staticText112, 0, wxALL|wxEXPAND, 5 );
wxArrayString m_checkListGHChoices;
m_checkListGH = new wxCheckListBox( m_wizPage2_Github, wxID_ANY, wxDefaultPosition, wxDefaultSize, m_checkListGHChoices, wxLB_MULTIPLE|wxLB_NEEDED_SB );
bSizer111->Add( m_checkListGH, 1, wxALL|wxEXPAND, 5 );
sbSizer1->Add( fgSizer1, 0, wxEXPAND, 5 );
wxBoxSizer* bSizer7;
bSizer7 = new wxBoxSizer( wxHORIZONTAL );
m_btnSelectAllGH = new wxButton( m_wizPage2_Github, wxID_ANY, wxT("Select all"), wxDefaultPosition, wxDefaultSize, 0 );
bSizer7->Add( m_btnSelectAllGH, 1, wxALL, 5 );
bSizerPage3->Add( sbSizer1, 0, wxEXPAND|wxBOTTOM, 5 );
m_btnUnselectAllGH = new wxButton( m_wizPage2_Github, wxID_ANY, wxT("Unselect all"), wxDefaultPosition, wxDefaultSize, 0 );
bSizer7->Add( m_btnUnselectAllGH, 1, wxALL, 5 );
m_staticText2 = new wxStaticText( m_wizPage3, wxID_ANY, _("Library list to add in Fp table:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText2->Wrap( -1 );
bSizerPage3->Add( m_staticText2, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
wxBoxSizer* bSizer6;
bSizer6 = new wxBoxSizer( wxVERTICAL );
bSizer7->Add( 0, 0, 1, wxEXPAND, 5 );
m_gridFpListLibs = new wxGrid( m_wizPage3, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0 );
m_searchCtrlGH = new wxSearchCtrl( m_wizPage2_Github, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
#ifndef __WXMAC__
m_searchCtrlGH->ShowSearchButton( true );
#endif
m_searchCtrlGH->ShowCancelButton( false );
bSizer7->Add( m_searchCtrlGH, 2, wxALL, 5 );
// Grid
m_gridFpListLibs->CreateGrid( 0, 3 );
m_gridFpListLibs->EnableEditing( true );
m_gridFpListLibs->EnableGridLines( true );
m_gridFpListLibs->EnableDragGridSize( false );
m_gridFpListLibs->SetMargins( 0, 0 );
// Columns
m_gridFpListLibs->EnableDragColMove( false );
m_gridFpListLibs->EnableDragColSize( true );
m_gridFpListLibs->SetColLabelSize( 30 );
m_gridFpListLibs->SetColLabelValue( 0, _("NickName") );
m_gridFpListLibs->SetColLabelValue( 1, _("Path") );
m_gridFpListLibs->SetColLabelValue( 2, _("Plugin") );
m_gridFpListLibs->SetColLabelAlignment( wxALIGN_CENTRE, wxALIGN_CENTRE );
bSizer111->Add( bSizer7, 0, wxEXPAND, 5 );
// Rows
m_gridFpListLibs->EnableDragRowSize( true );
m_gridFpListLibs->SetRowLabelSize( 30 );
m_gridFpListLibs->SetRowLabelAlignment( wxALIGN_CENTRE, wxALIGN_CENTRE );
// Label Appearance
m_wizPage2_Github->SetSizer( bSizer111 );
m_wizPage2_Github->Layout();
bSizer111->Fit( m_wizPage2_Github );
wxWizardPageSimple* m_wizPage3_Review = new wxWizardPageSimple( this, NULL, NULL, wxArtProvider::GetBitmap( wxART_HELP_BOOK, wxART_FRAME_ICON ) );
m_pages.Add( m_wizPage3_Review );
// Cell Defaults
m_gridFpListLibs->SetDefaultCellAlignment( wxALIGN_LEFT, wxALIGN_TOP );
bSizer6->Add( m_gridFpListLibs, 1, wxALL|wxEXPAND, 5 );
wxBoxSizer* bSizer1111;
bSizer1111 = new wxBoxSizer( wxVERTICAL );
m_staticText1121 = new wxStaticText( m_wizPage3_Review, wxID_ANY, wxT("Review and confirm the changes to the libraries:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText1121->Wrap( -1 );
bSizer1111->Add( m_staticText1121, 0, wxALL|wxEXPAND, 5 );
bSizerPage3->Add( bSizer6, 1, wxEXPAND, 5 );
m_listCtrlReview = new wxDataViewListCtrl( m_wizPage3_Review, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxDV_HORIZ_RULES|wxDV_ROW_LINES|wxDV_VERT_RULES );
m_dvLibName = m_listCtrlReview->AppendTextColumn( wxT("Library") );
m_dvLibStatus = m_listCtrlReview->AppendTextColumn( wxT("Status") );
m_dvLibFormat = m_listCtrlReview->AppendTextColumn( wxT("Format") );
bSizer1111->Add( m_listCtrlReview, 1, wxALL|wxEXPAND, 5 );
wxBoxSizer* bSizer5;
bSizer5 = new wxBoxSizer( wxHORIZONTAL );
m_buttonGithubLibList = new wxButton( m_wizPage3, wxID_ANY, _("Github Libs List"), wxDefaultPosition, wxDefaultSize, 0 );
bSizer5->Add( m_buttonGithubLibList, 0, wxALL, 5 );
m_wizPage3_Review->SetSizer( bSizer1111 );
m_wizPage3_Review->Layout();
bSizer1111->Fit( m_wizPage3_Review );
wxWizardPageSimple* m_wizPage4_SelectTarget = new wxWizardPageSimple( this, NULL, NULL, wxArtProvider::GetBitmap( wxART_HELP_BOOK, wxART_FRAME_ICON ) );
m_pages.Add( m_wizPage4_SelectTarget );
m_buttonAddLib = new wxButton( m_wizPage3, wxID_ANY, _("Add FP Libraries"), wxDefaultPosition, wxDefaultSize, 0 );
bSizer5->Add( m_buttonAddLib, 0, wxALL, 5 );
wxBoxSizer* bSizer12;
bSizer12 = new wxBoxSizer( wxVERTICAL );
m_buttonRemoveLib = new wxButton( m_wizPage3, wxID_ANY, _("Remove FP Libraries"), wxDefaultPosition, wxDefaultSize, 0 );
bSizer5->Add( m_buttonRemoveLib, 0, wxALL, 5 );
m_staticText12 = new wxStaticText( m_wizPage4_SelectTarget, wxID_ANY, wxT("Where do you wish the new libraries to be added:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText12->Wrap( -1 );
bSizer12->Add( m_staticText12, 0, wxALL|wxEXPAND, 5 );
m_radioGlobal = new wxRadioButton( m_wizPage4_SelectTarget, wxID_ANY, wxT("To global library configuration (visible by all projects)"), wxDefaultPosition, wxDefaultSize, 0 );
bSizer12->Add( m_radioGlobal, 0, wxALL|wxEXPAND, 5 );
bSizerPage3->Add( bSizer5, 0, wxALIGN_CENTER_HORIZONTAL, 5 );
m_radioProject = new wxRadioButton( m_wizPage4_SelectTarget, wxID_ANY, wxT("To the current project only"), wxDefaultPosition, wxDefaultSize, 0 );
bSizer12->Add( m_radioProject, 0, wxALL|wxEXPAND, 5 );
m_wizPage3->SetSizer( bSizerPage3 );
m_wizPage3->Layout();
bSizerPage3->Fit( m_wizPage3 );
m_wizPage4_SelectTarget->SetSizer( bSizer12 );
m_wizPage4_SelectTarget->Layout();
bSizer12->Fit( m_wizPage4_SelectTarget );
this->Centre( wxBOTH );
......@@ -226,33 +237,27 @@ WIZARD_FPLIB_TABLE_BASE::WIZARD_FPLIB_TABLE_BASE( wxWindow* parent, wxWindowID i
}
// Connect Events
this->Connect( wxID_ANY, wxEVT_WIZARD_FINISHED, wxWizardEventHandler( WIZARD_FPLIB_TABLE_BASE::OnFinish ) );
this->Connect( wxID_ANY, wxEVT_WIZARD_FINISHED, wxWizardEventHandler( WIZARD_FPLIB_TABLE_BASE::OnWizardFinished ) );
this->Connect( wxID_ANY, wxEVT_WIZARD_PAGE_CHANGED, wxWizardEventHandler( WIZARD_FPLIB_TABLE_BASE::OnPageChanged ) );
this->Connect( wxID_ANY, wxEVT_WIZARD_PAGE_CHANGING, wxWizardEventHandler( WIZARD_FPLIB_TABLE_BASE::OnPageChanging ) );
m_rbFpLibFormat->Connect( wxEVT_COMMAND_RADIOBOX_SELECTED, wxCommandEventHandler( WIZARD_FPLIB_TABLE_BASE::OnPluginSelection ), NULL, this );
m_rbPathManagement->Connect( wxEVT_COMMAND_RADIOBOX_SELECTED, wxCommandEventHandler( WIZARD_FPLIB_TABLE_BASE::OnPathManagementSelection ), NULL, this );
m_gridEnvironmentVariablesList->Connect( wxEVT_GRID_SELECT_CELL, wxGridEventHandler( WIZARD_FPLIB_TABLE_BASE::OnSelectEnvVarCell ), NULL, this );
m_buttonAddEV->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( WIZARD_FPLIB_TABLE_BASE::OnAddEVariable ), NULL, this );
m_buttonRemoveEV->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( WIZARD_FPLIB_TABLE_BASE::OnRemoveEVariable ), NULL, this );
m_buttonGithubLibList->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( WIZARD_FPLIB_TABLE_BASE::OnGithubLibsList ), NULL, this );
m_buttonAddLib->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( WIZARD_FPLIB_TABLE_BASE::OnAddFpLibs ), NULL, this );
m_buttonRemoveLib->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( WIZARD_FPLIB_TABLE_BASE::OnRemoveFpLibs ), NULL, this );
m_downloadGithub->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( WIZARD_FPLIB_TABLE_BASE::OnCheckSaveCopy ), NULL, this );
m_btnBrowse->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( WIZARD_FPLIB_TABLE_BASE::OnBrowseButtonClick ), NULL, this );
m_btnSelectAllGH->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( WIZARD_FPLIB_TABLE_BASE::OnSelectAllGH ), NULL, this );
m_btnUnselectAllGH->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( WIZARD_FPLIB_TABLE_BASE::OnUnselectAllGH ), NULL, this );
m_searchCtrlGH->Connect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( WIZARD_FPLIB_TABLE_BASE::OnChangeSearch ), NULL, this );
}
WIZARD_FPLIB_TABLE_BASE::~WIZARD_FPLIB_TABLE_BASE()
{
// Disconnect Events
this->Disconnect( wxID_ANY, wxEVT_WIZARD_FINISHED, wxWizardEventHandler( WIZARD_FPLIB_TABLE_BASE::OnFinish ) );
this->Disconnect( wxID_ANY, wxEVT_WIZARD_FINISHED, wxWizardEventHandler( WIZARD_FPLIB_TABLE_BASE::OnWizardFinished ) );
this->Disconnect( wxID_ANY, wxEVT_WIZARD_PAGE_CHANGED, wxWizardEventHandler( WIZARD_FPLIB_TABLE_BASE::OnPageChanged ) );
this->Disconnect( wxID_ANY, wxEVT_WIZARD_PAGE_CHANGING, wxWizardEventHandler( WIZARD_FPLIB_TABLE_BASE::OnPageChanging ) );
m_rbFpLibFormat->Disconnect( wxEVT_COMMAND_RADIOBOX_SELECTED, wxCommandEventHandler( WIZARD_FPLIB_TABLE_BASE::OnPluginSelection ), NULL, this );
m_rbPathManagement->Disconnect( wxEVT_COMMAND_RADIOBOX_SELECTED, wxCommandEventHandler( WIZARD_FPLIB_TABLE_BASE::OnPathManagementSelection ), NULL, this );
m_gridEnvironmentVariablesList->Disconnect( wxEVT_GRID_SELECT_CELL, wxGridEventHandler( WIZARD_FPLIB_TABLE_BASE::OnSelectEnvVarCell ), NULL, this );
m_buttonAddEV->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( WIZARD_FPLIB_TABLE_BASE::OnAddEVariable ), NULL, this );
m_buttonRemoveEV->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( WIZARD_FPLIB_TABLE_BASE::OnRemoveEVariable ), NULL, this );
m_buttonGithubLibList->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( WIZARD_FPLIB_TABLE_BASE::OnGithubLibsList ), NULL, this );
m_buttonAddLib->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( WIZARD_FPLIB_TABLE_BASE::OnAddFpLibs ), NULL, this );
m_buttonRemoveLib->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( WIZARD_FPLIB_TABLE_BASE::OnRemoveFpLibs ), NULL, this );
m_downloadGithub->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( WIZARD_FPLIB_TABLE_BASE::OnCheckSaveCopy ), NULL, this );
m_btnBrowse->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( WIZARD_FPLIB_TABLE_BASE::OnBrowseButtonClick ), NULL, this );
m_btnSelectAllGH->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( WIZARD_FPLIB_TABLE_BASE::OnSelectAllGH ), NULL, this );
m_btnUnselectAllGH->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( WIZARD_FPLIB_TABLE_BASE::OnUnselectAllGH ), NULL, this );
m_searchCtrlGH->Disconnect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( WIZARD_FPLIB_TABLE_BASE::OnChangeSearch ), NULL, this );
m_pages.Clear();
}
This source diff could not be displayed because it is too large. You can view the blob instead.
///////////////////////////////////////////////////////////////////////////
// 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 code comes from wxWebView sample webview.cpp and is modified to be used in Kicad
* the wxWidgets sample code webview.cpp is under wxWindows licence (author Marianne Gagnon)
*
* Webviewer runs in a dialog to allows an user to select a list of URLs which are .pretty library
* folder accessible from http or https using the Github plugin.
*
* The Web viewer just return a list of URLs selected from the context menu (command copy link)
* when mouse cursor in on a http link.
* URLs strings are filtered
* Only URLs starting by "http" and ending by ".pretty" can be currently selected and stored in fp lib list
*/
/*
* 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"
#if !wxUSE_WEBVIEW_WEBKIT && !wxUSE_WEBVIEW_IE
#error "wxWidgets must be built with wxWebView support enabled. Please rebuild wxWidgets"
#endif
#include "wx/artprov.h"
#include "wx/cmdline.h"
#include "wx/notifmsg.h"
#include "wx/settings.h"
#include "wx/webview.h"
#include "wx/webviewarchivehandler.h"
#include "wx/webviewfshandler.h"
#include "wx/infobar.h"
#include "wx/filesys.h"
#include "wx/fs_arc.h"
#include <wx/clipbrd.h>
#include <wx/uri.h>
#if wxUSE_STC
#include "wx/stc/stc.h"
#else
#error "wxWidgets must be built with wxStyledTextControl enabled. Please rebuild wxWidgets"
#endif
#include <dialog_shim.h>
#include <bitmaps.h>
#include "html_link_parser.h"
// We map menu items to their history items
WX_DECLARE_HASH_MAP( int, wxSharedPtr<wxWebViewHistoryItem>,
wxIntegerHash, wxIntegerEqual, wxMenuHistoryMap );
class WEB_NAVIGATOR : public DIALOG_SHIM
{
wxArrayString* urlListSelection;
public:
WEB_NAVIGATOR( wxWindow* aParent,
const wxString& aUrlOnStart,
wxArrayString* aUrlListSelection = NULL );
virtual ~WEB_NAVIGATOR();
void InitNavigator( const wxString& aUrlOnStart );
private:
void buildToolBar();
void buildToolMenu();
void CreateFindToolBar( wxWindow* aParent );
void UpdateState();
// wxWebViewEvents:
/** Callback invoked when a navigation request was accepted
*/
void OnNavigationComplete( wxWebViewEvent& evt )
{
UpdateState();
}
/** Callback invoked when a page is finished loading
*/
void OnDocumentLoaded( wxWebViewEvent& evt )
{
UpdateState();
}
/** On new window, we veto to stop extra windows appearing
*/
void OnNewWindow( wxWebViewEvent& evt )
{
UpdateState();
}
void OnTitleChanged( wxWebViewEvent& evt )
{
SetTitle( evt.GetString() );
}
// event functions:
void OnIdle( wxIdleEvent& evt );
void OnUrl( wxCommandEvent& evt );
void OnBack( wxCommandEvent& evt );
void OnForward( wxCommandEvent& evt );
void OnStop( wxCommandEvent& evt );
void OnReload( wxCommandEvent& evt );
void OnClearHistory( wxCommandEvent& evt );
void OnNavigationRequest( wxWebViewEvent& evt );
void OnViewSourceRequest( wxCommandEvent& evt );
void OnToolsClicked( wxCommandEvent& evt );
void OnSetZoom( wxCommandEvent& evt );
void OnError( wxWebViewEvent& evt );
void OnPrint( wxCommandEvent& evt )
{
m_browser->Print();
}
void OnZoomLayout( wxCommandEvent& evt );
void OnHistory( wxCommandEvent& evt )
{
m_browser->LoadHistoryItem( m_histMenuItems[evt.GetId()] );
}
void OnFind( wxCommandEvent& evt );
void OnFindDone( wxCommandEvent& evt );
void OnFindText( wxCommandEvent& evt );
void OnFindOptions( wxCommandEvent& evt );
// only for fp lib wizard called if there is a non null
// aUrlListSelection from idle event, to see if a valid
// footprint lib was selected by user, from the context menu
// (command copy link)
void TestAndStoreFootprintLibLink();
// Alternate way to list and select fp libraries:
void OnListPrettyLibURLs( wxCommandEvent& event );
private:
wxTextCtrl* m_url;
wxWebView* m_browser;
wxToolBar* m_toolbar;
wxToolBarToolBase* m_toolbar_back;
wxToolBarToolBase* m_toolbar_forward;
wxToolBarToolBase* m_toolbar_stop;
wxToolBarToolBase* m_toolbar_reload;
wxToolBarToolBase* m_toolbar_tools;
wxToolBarToolBase* m_toolbar_ListLibs;
wxToolBarToolBase* m_find_toolbar_done;
wxToolBarToolBase* m_find_toolbar_next;
wxToolBarToolBase* m_find_toolbar_previous;
wxToolBarToolBase* m_find_toolbar_options;
wxMenuItem* m_find_toolbar_wrap;
wxMenuItem* m_find_toolbar_highlight;
wxMenuItem* m_find_toolbar_matchcase;
wxMenuItem* m_find_toolbar_wholeword;
wxMenu* m_tools_menu;
wxMenuItem* m_tools_viewSource;
wxMenuItem* m_tools_print;
wxMenu* m_tools_history_menu;
wxMenuItem* m_tools_clearhist;
wxMenuItem* m_tools_layout;
wxMenuItem* m_tools_tiny;
wxMenuItem* m_tools_small;
wxMenuItem* m_tools_medium;
wxMenuItem* m_tools_large;
wxMenuItem* m_tools_largest;
wxMenuItem* m_find;
wxInfoBar* m_info;
wxStaticText* m_info_text;
wxTextCtrl* m_find_ctrl;
wxToolBar* m_find_toolbar;
wxMenuHistoryMap m_histMenuItems;
wxString m_findText;
int m_findFlags, m_findCount;
};
class SourceViewDialog : public wxDialog
{
public:
SourceViewDialog( wxWindow* parent, wxString source );
};
// Helper function to run the web viewer from an other dialog or frame:
int RunWebViewer( wxWindow* aParent, const wxString& aUrlOnStart, wxArrayString* aUrlListSelection )
{
WEB_NAVIGATOR dlg( aParent, aUrlOnStart, aUrlListSelection );
return dlg.ShowModal();
}
WEB_NAVIGATOR::WEB_NAVIGATOR( wxWindow* aParent,
const wxString& aUrlOnStart, wxArrayString* aUrlListSelection ) :
DIALOG_SHIM( aParent, wxID_ANY, "Web Viewer", wxDefaultPosition, wxDefaultSize,
wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER )
{
urlListSelection = aUrlListSelection;
InitNavigator( aUrlOnStart );
SetMinSize( wxSize( 700, 500 ) );
GetSizer()->Fit( this );
Centre();
}
void WEB_NAVIGATOR::InitNavigator( const wxString& aUrlOnStart )
{
// To collect URLs, the Web Viewer can use the clipboard.
// Clear it before running the viewer
// For an unknown reason, wxTheClipboard->Clear() does not work,
// so use a trick
if( wxTheClipboard->Open() )
{
wxTheClipboard->SetData( new wxTextDataObject( "" ) );
wxTheClipboard->Close();
}
wxBoxSizer* topsizer = new wxBoxSizer( wxVERTICAL );
// Create the main toolbar
m_toolbar = new wxToolBar( this, wxID_ANY );
buildToolBar();
topsizer->Add( m_toolbar );
// Shows the tool to choose and select fp libs only if a selected URL list
// exists
if( urlListSelection == NULL )
m_toolbar_ListLibs->Enable( false );
// Set find parameters and create the find toolbar.
m_findFlags = wxWEBVIEW_FIND_DEFAULT;
m_findCount = 0;
CreateFindToolBar( this );
topsizer->Add( m_find_toolbar, wxSizerFlags().Expand() );
m_find_toolbar->Hide();
// Create the info panel
m_info = new wxInfoBar( this );
topsizer->Add( m_info, wxSizerFlags().Expand() );
// Create the webview engine
if( aUrlOnStart.IsEmpty() ) // Start on a blank page:
m_browser = wxWebView::New( this, wxID_ANY, wxT( "about:blank") );
else
m_browser = wxWebView::New( this, wxID_ANY, aUrlOnStart,
wxDefaultPosition, wxSize( 900, 600 ) );
m_browser->EnableHistory( true );
topsizer->Add( m_browser, wxSizerFlags().Expand().Proportion( 1 ) );
SetSizer( topsizer );
// Create the Tools menu
buildToolMenu();
if( !m_browser->CanSetZoomType( wxWEBVIEW_ZOOM_TYPE_LAYOUT ) )
m_tools_layout->Enable( false );
// Connect the toolbar events
Connect( m_toolbar_back->GetId(), wxEVT_TOOL,
wxCommandEventHandler( WEB_NAVIGATOR::OnBack ), NULL, this );
Connect( m_toolbar_forward->GetId(), wxEVT_TOOL,
wxCommandEventHandler( WEB_NAVIGATOR::OnForward ), NULL, this );
Connect( m_toolbar_stop->GetId(), wxEVT_TOOL,
wxCommandEventHandler( WEB_NAVIGATOR::OnStop ), NULL, this );
Connect( m_toolbar_reload->GetId(), wxEVT_TOOL,
wxCommandEventHandler( WEB_NAVIGATOR::OnReload ), NULL, this );
Connect( m_toolbar_tools->GetId(), wxEVT_TOOL,
wxCommandEventHandler( WEB_NAVIGATOR::OnToolsClicked ), NULL, this );
Connect( m_toolbar_ListLibs->GetId(), wxEVT_TOOL,
wxCommandEventHandler( WEB_NAVIGATOR::OnListPrettyLibURLs ), NULL, this );
Connect( m_url->GetId(), wxEVT_TEXT_ENTER,
wxCommandEventHandler( WEB_NAVIGATOR::OnUrl ), NULL, this );
// Connect find toolbar events.
Connect( m_find_toolbar_done->GetId(), wxEVT_TOOL,
wxCommandEventHandler( WEB_NAVIGATOR::OnFindDone ), NULL, this );
Connect( m_find_toolbar_next->GetId(), wxEVT_TOOL,
wxCommandEventHandler( WEB_NAVIGATOR::OnFindText ), NULL, this );
Connect( m_find_toolbar_previous->GetId(), wxEVT_TOOL,
wxCommandEventHandler( WEB_NAVIGATOR::OnFindText ), NULL, this );
// Connect find control events.
Connect( m_find_ctrl->GetId(), wxEVT_TEXT,
wxCommandEventHandler( WEB_NAVIGATOR::OnFindText ), NULL, this );
Connect( m_find_ctrl->GetId(), wxEVT_TEXT_ENTER,
wxCommandEventHandler( WEB_NAVIGATOR::OnFindText ), NULL, this );
// Connect the webview events
Connect( m_browser->GetId(), wxEVT_WEBVIEW_NAVIGATING,
wxWebViewEventHandler( WEB_NAVIGATOR::OnNavigationRequest ), NULL, this );
Connect( m_browser->GetId(), wxEVT_WEBVIEW_NAVIGATED,
wxWebViewEventHandler( WEB_NAVIGATOR::OnNavigationComplete ), NULL, this );
Connect( m_browser->GetId(), wxEVT_WEBVIEW_LOADED,
wxWebViewEventHandler( WEB_NAVIGATOR::OnDocumentLoaded ), NULL, this );
Connect( m_browser->GetId(), wxEVT_WEBVIEW_ERROR,
wxWebViewEventHandler( WEB_NAVIGATOR::OnError ), NULL, this );
Connect( m_browser->GetId(), wxEVT_WEBVIEW_NEWWINDOW,
wxWebViewEventHandler( WEB_NAVIGATOR::OnNewWindow ), NULL, this );
Connect( m_browser->GetId(), wxEVT_WEBVIEW_TITLE_CHANGED,
wxWebViewEventHandler( WEB_NAVIGATOR::OnTitleChanged ), NULL, this );
// Connect the menu events
Connect( m_tools_viewSource->GetId(), wxEVT_MENU,
wxCommandEventHandler( WEB_NAVIGATOR::OnViewSourceRequest ), NULL, this );
Connect( m_tools_print->GetId(), wxEVT_MENU,
wxCommandEventHandler( WEB_NAVIGATOR::OnPrint ), NULL, this );
Connect( m_tools_layout->GetId(), wxEVT_MENU,
wxCommandEventHandler( WEB_NAVIGATOR::OnZoomLayout ), NULL, this );
Connect( m_tools_tiny->GetId(), wxEVT_MENU,
wxCommandEventHandler( WEB_NAVIGATOR::OnSetZoom ), NULL, this );
Connect( m_tools_small->GetId(), wxEVT_MENU,
wxCommandEventHandler( WEB_NAVIGATOR::OnSetZoom ), NULL, this );
Connect( m_tools_medium->GetId(), wxEVT_MENU,
wxCommandEventHandler( WEB_NAVIGATOR::OnSetZoom ), NULL, this );
Connect( m_tools_large->GetId(), wxEVT_MENU,
wxCommandEventHandler( WEB_NAVIGATOR::OnSetZoom ), NULL, this );
Connect( m_tools_largest->GetId(), wxEVT_MENU,
wxCommandEventHandler( WEB_NAVIGATOR::OnSetZoom ), NULL, this );
Connect( m_tools_clearhist->GetId(), wxEVT_MENU,
wxCommandEventHandler( WEB_NAVIGATOR::OnClearHistory ), NULL, this );
Connect( m_find->GetId(), wxEVT_MENU,
wxCommandEventHandler( WEB_NAVIGATOR::OnFind ), NULL, this );
// Connect the idle events
Connect( wxID_ANY, wxEVT_IDLE, wxIdleEventHandler( WEB_NAVIGATOR::OnIdle ), NULL, this );
}
WEB_NAVIGATOR::~WEB_NAVIGATOR()
{
delete m_tools_menu;
}
void WEB_NAVIGATOR::buildToolMenu()
{
m_tools_menu = new wxMenu();
m_tools_print = m_tools_menu->Append( wxID_ANY, _( "Print" ) );
m_tools_viewSource = m_tools_menu->Append( wxID_ANY, _( "View Source" ) );
m_tools_menu->AppendSeparator();
m_tools_layout = m_tools_menu->AppendCheckItem( wxID_ANY, _( "Use Layout Zoom" ) );
m_tools_tiny = m_tools_menu->AppendCheckItem( wxID_ANY, _( "Tiny" ) );
m_tools_small = m_tools_menu->AppendCheckItem( wxID_ANY, _( "Small" ) );
m_tools_medium = m_tools_menu->AppendCheckItem( wxID_ANY, _( "Medium" ) );
m_tools_large = m_tools_menu->AppendCheckItem( wxID_ANY, _( "Large" ) );
m_tools_largest = m_tools_menu->AppendCheckItem( wxID_ANY, _( "Largest" ) );
m_tools_menu->AppendSeparator();
// Find
m_find = m_tools_menu->Append( wxID_ANY, _( "Find" ) );
m_tools_menu->AppendSeparator();
// History menu
m_tools_history_menu = new wxMenu();
m_tools_clearhist = m_tools_history_menu->Append( wxID_ANY, _( "Clear History" ) );
m_tools_history_menu->AppendSeparator();
m_tools_menu->AppendSubMenu( m_tools_history_menu, "History" );
}
void WEB_NAVIGATOR::buildToolBar()
{
// Populate the toolbar
m_toolbar->SetToolBitmapSize( wxSize( 26, 26 ) );
m_toolbar->SetMargins( 3, 3 );
// The tool menu (one cannot have a menubar in a dialog, so uise a tool to display a menu
m_toolbar_tools = m_toolbar->AddTool( wxID_ANY, _( "Menu" ), KiBitmap( tools_xpm ),
_("Access to some options") );
m_toolbar->AddSeparator();
// The navigation tools
m_toolbar_back = m_toolbar->AddTool( wxID_ANY, _( "Back" ), KiBitmap( left_xpm ) );
m_toolbar_forward = m_toolbar->AddTool( wxID_ANY, _( "Forward" ), KiBitmap( right_xpm ) );
m_toolbar_stop = m_toolbar->AddTool( wxID_ANY, _( "Stop" ), KiBitmap( red_xpm ) );
m_toolbar_reload = m_toolbar->AddTool( wxID_ANY, _( "Reload" ), KiBitmap( reload2_xpm ) );
m_toolbar->AddSeparator();
m_url = new wxTextCtrl( m_toolbar, wxID_ANY, wxT( "" ), wxDefaultPosition, wxSize( 400,
-1 ), wxTE_PROCESS_ENTER );
m_toolbar->AddControl( m_url, _( "URL" ) );
m_toolbar->AddSeparator();
// The Kicad footprint libraries extractor/selector tool:
m_toolbar_ListLibs =
m_toolbar->AddTool( wxID_ANY, _( "KicadLibs" ), KiBitmap( library_browse_xpm ),
_("List .pretty kicad footprint libraries and add selected libraries\n"
"to the footprint library table") );
m_toolbar->Realize();
}
void WEB_NAVIGATOR::CreateFindToolBar( wxWindow* aParent )
{
m_find_toolbar = new wxToolBar( aParent,
wxID_ANY, wxDefaultPosition, wxDefaultSize,
wxTB_HORIZONTAL | wxTB_TEXT | wxTB_HORZ_LAYOUT );
// Create find control.
m_find_ctrl = new wxTextCtrl( m_find_toolbar,
wxID_ANY, wxEmptyString, wxDefaultPosition,
wxSize( 140, -1 ), wxTE_PROCESS_ENTER );
// Find options menu
wxMenu* findmenu = new wxMenu;
m_find_toolbar_wrap = findmenu->AppendCheckItem( wxID_ANY, "Wrap" );
m_find_toolbar_matchcase = findmenu->AppendCheckItem( wxID_ANY, "Match Case" );
m_find_toolbar_wholeword = findmenu->AppendCheckItem( wxID_ANY, "Entire Word" );
m_find_toolbar_highlight = findmenu->AppendCheckItem( wxID_ANY, "Highlight" );
m_find_toolbar_highlight->Check( true );
// Add find toolbar tools.
m_find_toolbar->SetToolSeparation( 7 );
m_find_toolbar_done = m_find_toolbar->AddTool( wxID_ANY, "Close",
wxArtProvider::GetBitmap( wxART_CROSS_MARK ) );
m_find_toolbar->AddSeparator();
m_find_toolbar->AddControl( m_find_ctrl, "Find" );
m_find_toolbar->AddSeparator();
m_find_toolbar_next = m_find_toolbar->AddTool( wxID_ANY, "Next",
wxArtProvider::GetBitmap( wxART_GO_DOWN, wxART_TOOLBAR, wxSize( 16, 16 ) ) );
m_find_toolbar_previous = m_find_toolbar->AddTool( wxID_ANY, "Previous",
wxArtProvider::GetBitmap( wxART_GO_UP, wxART_TOOLBAR, wxSize( 16, 16 ) ) );
m_find_toolbar->AddSeparator();
m_find_toolbar_options = m_find_toolbar->AddTool( wxID_ANY, "Options",
wxArtProvider::GetBitmap( wxART_PLUS, wxART_TOOLBAR, wxSize( 16, 16 ) ),
"", wxITEM_DROPDOWN );
m_find_toolbar_options->SetDropdownMenu( findmenu );
m_find_toolbar->Realize();
}
// A helper function to try to validate urls names
// read in github repos.
// a valid .pretty github library name ( on github )
// is expected ending with .pretty, and to be a path
// relative github url
static bool urlFilter( const wxString& aText )
{
if( aText.Length() < 8 ) // unlikely a valid .pretty name
return false;
if( !aText.EndsWith( wxT( ".pretty" ) ) )
return false;
wxURI uri( aText );
if( !uri.GetQuery().IsEmpty() ) // the link is a request, not good
return false;
return true;
}
void WEB_NAVIGATOR::OnListPrettyLibURLs( wxCommandEvent& event )
{
if( m_browser->IsBusy() ) // a page loading is currently in progress
return;
wxString source = m_browser->GetPageSource();
wxArrayString urls;
HTML_LINK_PARSER parser( source, urls );
parser.ParseLinks( urlFilter );
// Create library list.
// From github, the links can be relative to the github server URL
// In this case, make url absolute
wxString reposUrl( m_browser->GetCurrentURL() );
wxURI reposUri( reposUrl );
wxString reposName( reposUri.GetScheme() + wxT( "://" ) + reposUri.GetServer() );
for( unsigned ii = 0; ii < urls.GetCount(); ii++ )
{
wxString url = urls[ii];
wxURI currUri( url );
if( !currUri.HasServer() )
{
if( url.StartsWith( wxT( "/" ) ) ) // path relative to the server name
url.Prepend( reposName );
else // path relative to the server currently open path
url.Prepend( reposUrl );
urls[ii] = url;
}
}
// Remove duplicates:
// A very basic test, not optimized, but usually we have only few urls
for( unsigned ii = 0; ii < urls.GetCount(); ii++ )
{
for( unsigned jj = urls.GetCount() - 1; jj > ii; jj-- )
{
if( urls[ii] == urls[jj] ) // Duplicate found
urls.RemoveAt( jj );
}
}
wxArrayInt choices;
wxString msg( _( "Urls detected as footprint .pretty libraries.\n"
"Selected urls will be added to the current footprint library list,\n"
"when closing the web viewer") );
if( wxGetSelectedChoices( choices, msg,
_( "Footprint libraries" ), urls, this ) <= 0 )
return;
// Add selected fp list in list
for( unsigned ii = 0; ii < choices.GetCount(); ii++ )
{
wxString& url = urls[choices[ii]];
urlListSelection->Add( url );
}
}
/**
* Method that retrieves the current state from the web control and updates the GUI
* the reflect this current state.
*/
void WEB_NAVIGATOR::UpdateState()
{
m_toolbar->EnableTool( m_toolbar_back->GetId(), m_browser->CanGoBack() );
m_toolbar->EnableTool( m_toolbar_forward->GetId(), m_browser->CanGoForward() );
if( m_browser->IsBusy() )
{
m_toolbar->EnableTool( m_toolbar_stop->GetId(), true );
}
else
{
m_toolbar->EnableTool( m_toolbar_stop->GetId(), false );
}
SetTitle( m_browser->GetCurrentTitle() );
m_url->SetValue( m_browser->GetCurrentURL() );
}
void WEB_NAVIGATOR::OnIdle( wxIdleEvent& WXUNUSED( evt ) )
{
if( m_browser->IsBusy() )
{
wxSetCursor( wxCURSOR_ARROWWAIT );
m_toolbar->EnableTool( m_toolbar_stop->GetId(), true );
}
else
{
wxSetCursor( wxNullCursor );
m_toolbar->EnableTool( m_toolbar_stop->GetId(), false );
if( urlListSelection )
TestAndStoreFootprintLibLink();
}
}
// only for fp lib wizard called if there is a non null
// aUrlListSelection from idle event, to see if a valid
// footprint lib was selected by user, from the context menu
// (command copy link)
void WEB_NAVIGATOR::TestAndStoreFootprintLibLink()
{
if( !urlListSelection )
return;
if( wxTheClipboard->Open() )
{
if( wxTheClipboard->IsSupported( wxDF_TEXT ) )
{
wxTextDataObject data;
if( wxTheClipboard->GetData( data ) )
{
// A valid text data is found
const wxString& text = data.GetText();
// Be sure it is a valid data for us, i.e. a valid
// kicad url
if( urlFilter( text ) && ( text.StartsWith( "http" ) ) )
{
urlListSelection->Add( text );
wxTheClipboard->SetData( new wxTextDataObject( wxEmptyString ) );
}
}
wxTheClipboard->Close();
}
}
}
/**
* Callback invoked when user entered an URL and pressed enter
*/
void WEB_NAVIGATOR::OnUrl( wxCommandEvent& WXUNUSED( evt ) )
{
m_browser->LoadURL( m_url->GetValue() );
m_browser->SetFocus();
UpdateState();
}
/**
* Callback invoked when user pressed the "back" button
*/
void WEB_NAVIGATOR::OnBack( wxCommandEvent& WXUNUSED( evt ) )
{
m_browser->GoBack();
UpdateState();
}
/**
* Callback invoked when user pressed the "forward" button
*/
void WEB_NAVIGATOR::OnForward( wxCommandEvent& WXUNUSED( evt ) )
{
m_browser->GoForward();
UpdateState();
}
/**
* Callback invoked when user pressed the "stop" button
*/
void WEB_NAVIGATOR::OnStop( wxCommandEvent& WXUNUSED( evt ) )
{
m_browser->Stop();
UpdateState();
}
/**
* Callback invoked when user pressed the "reload" button
*/
void WEB_NAVIGATOR::OnReload( wxCommandEvent& WXUNUSED( evt ) )
{
m_browser->Reload();
UpdateState();
}
void WEB_NAVIGATOR::OnClearHistory( wxCommandEvent& WXUNUSED( evt ) )
{
m_browser->ClearHistory();
UpdateState();
}
void WEB_NAVIGATOR::OnFind( wxCommandEvent& WXUNUSED( evt ) )
{
wxString value = m_browser->GetSelectedText();
if( value.Len() > 150 )
{
value.Truncate( 150 );
}
m_find_ctrl->SetValue( value );
if( !m_find_toolbar->IsShown() )
{
m_find_toolbar->Show( true );
SendSizeEvent();
}
m_find_ctrl->SelectAll();
}
void WEB_NAVIGATOR::OnFindDone( wxCommandEvent& WXUNUSED( evt ) )
{
m_browser->Find( "" );
m_find_toolbar->Show( false );
SendSizeEvent();
}
void WEB_NAVIGATOR::OnFindText( wxCommandEvent& evt )
{
int flags = 0;
if( m_find_toolbar_wrap->IsChecked() )
flags |= wxWEBVIEW_FIND_WRAP;
if( m_find_toolbar_wholeword->IsChecked() )
flags |= wxWEBVIEW_FIND_ENTIRE_WORD;
if( m_find_toolbar_matchcase->IsChecked() )
flags |= wxWEBVIEW_FIND_MATCH_CASE;
if( m_find_toolbar_highlight->IsChecked() )
flags |= wxWEBVIEW_FIND_HIGHLIGHT_RESULT;
if( m_find_toolbar_previous->GetId() == evt.GetId() )
flags |= wxWEBVIEW_FIND_BACKWARDS;
wxString find_text = m_find_ctrl->GetValue();
long count = wxNOT_FOUND;
// On windows, for an unknwon reason (bug ?) some texts in some
// html pages hang the search.
// Waiting for 2 chars before starting a search reduces the risk
// (but the risk still exists)
#ifdef __WINDOWS__
#define MIN_CHAR_CNT 2
if( find_text.Length() >= MIN_CHAR_CNT )
count = m_browser->Find( find_text, flags );
else // Reset search
m_browser->Find( wxEmptyString, flags );
#else
#define MIN_CHAR_CNT 1
count = m_browser->Find( find_text, flags );
#endif
if( m_findText != find_text )
{
m_findCount = count;
m_findText = find_text;
}
if( count != wxNOT_FOUND || find_text.Length() < MIN_CHAR_CNT )
m_find_ctrl->SetBackgroundColour( *wxWHITE );
else
m_find_ctrl->SetBackgroundColour( wxColour( 255, 101, 101 ) );
m_find_ctrl->Refresh();
}
/**
* Callback invoked when there is a request to load a new page (for instance
* when the user clicks a link)
*/
void WEB_NAVIGATOR::OnNavigationRequest( wxWebViewEvent& evt )
{
if( m_info->IsShown() )
m_info->Dismiss();
wxASSERT( m_browser->IsBusy() );
UpdateState();
}
/**
* Invoked when user selects the "View Source" menu item
*/
void WEB_NAVIGATOR::OnViewSourceRequest( wxCommandEvent& WXUNUSED( evt ) )
{
SourceViewDialog dlg( this, m_browser->GetPageSource() );
dlg.ShowModal();
}
/**
* Invoked when user selects the "Menu" item
*/
void WEB_NAVIGATOR::OnToolsClicked( wxCommandEvent& WXUNUSED( evt ) )
{
if( m_browser->GetCurrentURL() == "" )
return;
m_tools_tiny->Check( false );
m_tools_small->Check( false );
m_tools_medium->Check( false );
m_tools_large->Check( false );
m_tools_largest->Check( false );
wxWebViewZoom zoom = m_browser->GetZoom();
switch( zoom )
{
case wxWEBVIEW_ZOOM_TINY:
m_tools_tiny->Check();
break;
case wxWEBVIEW_ZOOM_SMALL:
m_tools_small->Check();
break;
case wxWEBVIEW_ZOOM_MEDIUM:
m_tools_medium->Check();
break;
case wxWEBVIEW_ZOOM_LARGE:
m_tools_large->Check();
break;
case wxWEBVIEW_ZOOM_LARGEST:
m_tools_largest->Check();
break;
}
// Firstly we clear the existing menu items, then we add the current ones
wxMenuHistoryMap::const_iterator it;
for( it = m_histMenuItems.begin(); it != m_histMenuItems.end(); ++it )
{
m_tools_history_menu->Destroy( it->first );
}
m_histMenuItems.clear();
wxVector<wxSharedPtr<wxWebViewHistoryItem> > back = m_browser->GetBackwardHistory();
wxVector<wxSharedPtr<wxWebViewHistoryItem> > forward = m_browser->GetForwardHistory();
wxMenuItem* item;
unsigned int i;
for( i = 0; i < back.size(); i++ )
{
item = m_tools_history_menu->AppendRadioItem( wxID_ANY, back[i]->GetTitle() );
m_histMenuItems[item->GetId()] = back[i];
Connect( item->GetId(), wxEVT_MENU,
wxCommandEventHandler( WEB_NAVIGATOR::OnHistory ), NULL, this );
}
wxString title = m_browser->GetCurrentTitle();
if( title.empty() )
title = "(untitled)";
item = m_tools_history_menu->AppendRadioItem( wxID_ANY, title );
item->Check();
// No need to connect the current item
m_histMenuItems[item->GetId()] =
wxSharedPtr<wxWebViewHistoryItem>( new wxWebViewHistoryItem( m_browser->GetCurrentURL(),
m_browser->GetCurrentTitle() ) );
for( i = 0; i < forward.size(); i++ )
{
item = m_tools_history_menu->AppendRadioItem( wxID_ANY, forward[i]->GetTitle() );
m_histMenuItems[item->GetId()] = forward[i];
Connect( item->GetId(), wxEVT_TOOL,
wxCommandEventHandler( WEB_NAVIGATOR::OnHistory ), NULL, this );
}
wxPoint position = ScreenToClient( wxGetMousePosition() );
PopupMenu( m_tools_menu, position.x, position.y );
}
/**
* Invoked when user selects the zoom size in the menu
*/
void WEB_NAVIGATOR::OnSetZoom( wxCommandEvent& evt )
{
if( evt.GetId() == m_tools_tiny->GetId() )
m_browser->SetZoom( wxWEBVIEW_ZOOM_TINY );
else if( evt.GetId() == m_tools_small->GetId() )
m_browser->SetZoom( wxWEBVIEW_ZOOM_SMALL );
else if( evt.GetId() == m_tools_medium->GetId() )
m_browser->SetZoom( wxWEBVIEW_ZOOM_MEDIUM );
else if( evt.GetId() == m_tools_large->GetId() )
m_browser->SetZoom( wxWEBVIEW_ZOOM_LARGE );
else if( evt.GetId() == m_tools_largest->GetId() )
m_browser->SetZoom( wxWEBVIEW_ZOOM_LARGEST );
else
wxFAIL;
}
void WEB_NAVIGATOR::OnZoomLayout( wxCommandEvent& WXUNUSED( evt ) )
{
if( m_tools_layout->IsChecked() )
m_browser->SetZoomType( wxWEBVIEW_ZOOM_TYPE_LAYOUT );
else
m_browser->SetZoomType( wxWEBVIEW_ZOOM_TYPE_TEXT );
}
/**
* Callback invoked when a loading error occurs
*/
void WEB_NAVIGATOR::OnError( wxWebViewEvent& evt )
{
#define WX_ERROR_CASE( type ) case type: \
category = # type; break;
wxString category;
switch( evt.GetInt() )
{
WX_ERROR_CASE( wxWEBVIEW_NAV_ERR_CONNECTION );
WX_ERROR_CASE( wxWEBVIEW_NAV_ERR_CERTIFICATE );
WX_ERROR_CASE( wxWEBVIEW_NAV_ERR_AUTH );
WX_ERROR_CASE( wxWEBVIEW_NAV_ERR_SECURITY );
WX_ERROR_CASE( wxWEBVIEW_NAV_ERR_NOT_FOUND );
WX_ERROR_CASE( wxWEBVIEW_NAV_ERR_REQUEST );
WX_ERROR_CASE( wxWEBVIEW_NAV_ERR_USER_CANCELLED );
WX_ERROR_CASE( wxWEBVIEW_NAV_ERR_OTHER );
}
// Show the info bar with an error
wxString msg;
msg.Printf( _( "An error occurred loading %s\n'%s'" ), evt.GetURL().GetData(),
category.GetData() );
m_info->ShowMessage( msg, wxICON_ERROR );
UpdateState();
}
SourceViewDialog::SourceViewDialog( wxWindow* parent, wxString source ) :
wxDialog( parent, wxID_ANY, "Source Code",
wxDefaultPosition, wxSize( 700, 500 ),
wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER )
{
wxStyledTextCtrl* text = new wxStyledTextCtrl( this, wxID_ANY );
text->SetMarginWidth( 1, 30 );
text->SetMarginType( 1, wxSTC_MARGIN_NUMBER );
text->SetText( source );
text->StyleClearAll();
text->SetLexer( wxSTC_LEX_HTML );
text->StyleSetForeground( wxSTC_H_DOUBLESTRING, wxColour( 255, 0, 0 ) );
text->StyleSetForeground( wxSTC_H_SINGLESTRING, wxColour( 255, 0, 0 ) );
text->StyleSetForeground( wxSTC_H_ENTITY, wxColour( 255, 0, 0 ) );
text->StyleSetForeground( wxSTC_H_TAG, wxColour( 0, 150, 0 ) );
text->StyleSetForeground( wxSTC_H_TAGUNKNOWN, wxColour( 0, 150, 0 ) );
text->StyleSetForeground( wxSTC_H_ATTRIBUTE, wxColour( 0, 0, 150 ) );
text->StyleSetForeground( wxSTC_H_ATTRIBUTEUNKNOWN, wxColour( 0, 0, 150 ) );
text->StyleSetForeground( wxSTC_H_COMMENT, wxColour( 150, 150, 150 ) );
wxBoxSizer* sizer = new wxBoxSizer( wxVERTICAL );
sizer->Add( text, 1, wxEXPAND );
SetSizer( sizer );
}
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