Commit bb2bc9d1 authored by Garth Corral's avatar Garth Corral

Merged trunk @ 5339

parents f2a9ea1d 0ceb90df
......@@ -36,6 +36,22 @@ 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.
# However the default option is on and has effect only if BUILD_GITHUB_PLUGIN is ON
# This option could be removed soon, if no serious issue happens on Linux
option( KICAD_USE_WEBKIT
"Use system web kit to build a web viewer in footprint library wizard to easily select github libraries (default ON)."
ON
)
option( USE_WX_GRAPHICS_CONTEXT
"Use wxGraphicsContext for rendering (default OFF). Warning, this is experimental" )
......@@ -407,7 +423,13 @@ add_definitions( -DWX_COMPATIBILITY )
# See line 41 of CMakeModules/FindwxWidgets.cmake
set( wxWidgets_CONFIG_OPTIONS --static=no )
find_package( wxWidgets 3.0.0 COMPONENTS gl aui adv html core net base xml REQUIRED )
if( KICAD_USE_WEBKIT AND BUILD_GITHUB_PLUGIN )
set( webkitlib "webview" )
else()
set( webkitlib "" )
endif()
find_package( wxWidgets 3.0.0 COMPONENTS gl aui adv html core net base xml ${webkitlib} stc REQUIRED )
# Include wxWidgets macros.
include( ${wxWidgets_USE_FILE} )
......@@ -688,6 +710,9 @@ 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 )
......@@ -783,10 +808,6 @@ install( FILES INSTALL.txt
DESTINATION ${KICAD_DOCS}
COMPONENT resources )
install( FILES resources/freeroute.jnlp
DESTINATION ${KICAD_BIN}
COMPONENT resources )
###
# Install scripts
###
......
......@@ -330,7 +330,7 @@ if(wxWidgets_FIND_STYLE STREQUAL "win32")
# Find wxWidgets multilib libraries.
foreach(LIB core adv aui html media xrc dbgrid gl qa richtext
stc ribbon propgrid)
webview stc ribbon propgrid)
find_library(WX_${LIB}${_DBG}
NAMES
wxmsw${_UNV}31${_UCD}${_DBG}_${LIB}
......@@ -374,7 +374,7 @@ if(wxWidgets_FIND_STYLE STREQUAL "win32")
# Clear wxWidgets multilib libraries.
foreach(LIB core adv aui html media xrc dbgrid gl qa richtext
stc ribbon propgrid)
webview stc ribbon propgrid)
wx_clear_lib(WX_${LIB}${_DBG})
endforeach(LIB)
endmacro(wx_clear_all_libs)
......@@ -448,6 +448,7 @@ if(wxWidgets_FIND_STYLE STREQUAL "win32")
D:/
$ENV{ProgramFiles}
PATH_SUFFIXES
wxWidgets-3.0.2
wxWidgets-3.0.1
wxWidgets-3.0.0
wxWidgets-2.9.5
......
......@@ -8,76 +8,102 @@
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, 0x04, 0x45, 0x49, 0x44, 0x41, 0x54, 0x48, 0xc7, 0xad, 0xd6, 0xdb, 0x53, 0x1b,
0x55, 0x1c, 0x07, 0xf0, 0x85, 0x96, 0x4d, 0x68, 0x02, 0x09, 0xe5, 0x52, 0xeb, 0x40, 0x99, 0xa9,
0xd5, 0xb1, 0x40, 0x8a, 0x34, 0x85, 0xbd, 0xe4, 0x0a, 0x41, 0xd2, 0x4d, 0xc8, 0x86, 0x6c, 0xd8,
0x92, 0x0b, 0x24, 0x54, 0xa0, 0x1d, 0x4a, 0x01, 0xdb, 0xa0, 0x63, 0x7d, 0x70, 0x3a, 0xe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06, 0x62, 0x70, 0x12, 0xda, 0xe3, 0x65,
0xaf, 0xab, 0x4b, 0xd1, 0xc9, 0x62, 0x0e, 0x17, 0xfb, 0x47, 0x0e, 0x87, 0xbf, 0x05, 0xb2, 0x84,
0xa9, 0x89, 0xc7, 0x1c, 0x31, 0xf6, 0x51, 0x11, 0x02, 0x31, 0xdc, 0x30, 0x83, 0xb1, 0x19, 0x22,
0x03, 0xaf, 0x11, 0x34, 0x5c, 0x7d, 0x7b, 0xf6, 0x46, 0xbe, 0x35, 0xb2, 0x1c, 0x46, 0x62, 0xa9,
0x2d, 0xb6, 0xa9, 0x8d, 0x59, 0x2e, 0x4a, 0x4d, 0x0a, 0x83, 0xbd, 0xfe, 0xfd, 0x7e, 0x06, 0xbd,
0xa5, 0x8b, 0xe5, 0x31, 0xdc, 0xc0, 0xe7, 0xf6, 0x87, 0x23, 0x51, 0xb1, 0xab, 0x45, 0x96, 0xc3,
0xe8, 0x5c, 0x80, 0x22, 0x8f, 0xd0, 0x4f, 0xb8, 0x7b, 0x94, 0xaa, 0xed, 0x1c, 0x61, 0xaa, 0x74,
0x23, 0x0e, 0x1e, 0xae, 0x82, 0x50, 0x11, 0xff, 0x40, 0x68, 0x40, 0x56, 0xa8, 0x2c, 0x36, 0xce,
0x5f, 0x96, 0x10, 0x22, 0x40, 0x22, 0x99, 0xab, 0x45, 0x96, 0xfb, 0x0f, 0xce, 0x69, 0xf1, 0xeb,
0x07, 0xe7, 0x84, 0x0d, 0xf8, 0x07, 0x8a, 0xc1, 0xb2, 0x78, 0x5f, 0x51, 0x46, 0x42, 0x10, 0x44,
0x84, 0x52, 0xe1, 0x3b, 0xff, 0x07, 0xf9, 0xb7, 0xf1, 0x0f, 0x36, 0x8a, 0x5c, 0x27, 0xe1, 0x16,
0x56, 0x17, 0x00, 0x00, 0x00, 0x00, 0x49, 0x45, 0x4e, 0x44, 0xae, 0x42, 0x60, 0x82,
};
const BITMAP_OPAQUE change_entry_orient_xpm[1] = {{ png, sizeof( png ), "change_entry_orient_xpm" }};
......
......@@ -5,13 +5,14 @@
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"
height="48"
width="48"
version="1.1"
id="svg2"
inkscape:version="0.48.1 "
inkscape:version="0.48.4 r9939"
sodipodi:docname="change_entry_orient.svg">
<metadata
id="metadata53">
......@@ -21,7 +22,7 @@
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title></dc:title>
<dc:title />
</cc:Work>
</rdf:RDF>
</metadata>
......@@ -34,12 +35,12 @@
guidetolerance="10"
inkscape:pageopacity="0"
inkscape:pageshadow="2"
inkscape:window-width="1280"
inkscape:window-height="968"
inkscape:window-width="1920"
inkscape:window-height="1033"
id="namedview51"
showgrid="false"
inkscape:zoom="9.7321397"
inkscape:cx="8.2414503"
inkscape:cx="-8.507179"
inkscape:cy="26.142558"
inkscape:window-x="-4"
inkscape:window-y="-4"
......@@ -176,56 +177,137 @@
stdDeviation="0.77409508"
id="feGaussianBlur3842-2" />
</filter>
<linearGradient
inkscape:collect="always"
xlink:href="#a"
id="linearGradient5269"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(-0.22841461,-0.21205346,-0.25385384,0.25152007,67.875075,27.602468)"
x1="113.16"
y1="25.785999"
x2="39.268002"
y2="25.785999" />
<linearGradient
id="a">
<stop
stop-color="#0968ef"
offset="0"
id="stop5191" />
<stop
stop-color="#aecffc"
offset="1"
id="stop5193" />
</linearGradient>
<linearGradient
inkscape:collect="always"
xlink:href="#w"
id="linearGradient5262"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(0.14240515,0.2794743,0.32350927,-0.14654455,-14.926968,6.234846)"
x1="113.16"
y1="25.785999"
x2="39.268002"
y2="25.785999" />
<linearGradient
id="w"
y2="25.785999"
gradientUnits="userSpaceOnUse"
x2="39.268002"
gradientTransform="matrix(0.41788,0.8215,0.94932,-0.43076,-50.048,24.308)"
y1="25.785999"
x1="113.16">
<stop
stop-color="#0968ef"
offset="0"
id="stop5225" />
<stop
stop-color="#aecffc"
offset="1"
id="stop5227" />
</linearGradient>
<linearGradient
y2="25.785999"
x2="39.268002"
y1="25.785999"
x1="113.16"
gradientTransform="matrix(0.14240515,0.2794743,0.32350927,-0.14654455,-14.926968,6.234846)"
gradientUnits="userSpaceOnUse"
id="linearGradient5306"
xlink:href="#w"
inkscape:collect="always" />
<linearGradient
inkscape:collect="always"
xlink:href="#w"
id="linearGradient5356"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(0.1544415,0.28350851,0.35085289,-0.14865992,-18.171522,8.2663206)"
x1="113.16"
y1="25.785999"
x2="39.268002"
y2="25.785999" />
<linearGradient
inkscape:collect="always"
xlink:href="#a"
id="linearGradient5359"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(-0.24772065,-0.21511445,-0.27531005,0.25515076,71.629107,29.942384)"
x1="113.16"
y1="25.785999"
x2="39.268002"
y2="25.785999" />
</defs>
<g
id="g3890"
transform="translate(34.422029,34.730287)">
<g
id="g35-5"
transform="matrix(0,2.9379,-2.1996,0,8.491481,-32.124217)">
transform="matrix(0,2.9379,-2.1996,0,42.91351,2.60607)"
id="g35-5">
<rect
style="fill-opacity:0"
id="rect37-5"
x="0"
y="0"
height="16"
width="16"
height="16" />
y="0"
x="0"
id="rect37-5"
style="fill-opacity:0" />
</g>
<path
transform="matrix(0,0.91790986,-0.91920821,0,11.841319,-33.997331)"
inkscape:connector-curvature="0"
id="path3800-8-1"
style="opacity:0.26068373;fill:none;stroke:#37574d;stroke-width:6.38199997;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;filter:url(#filter3840-8)"
d="m 7.8690809,3.4934004 41.1855461,40.6965116 0,0"
style="opacity:0.26068373;fill:none;stroke:#37574d;stroke-width:6.38199997;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;filter:url(#filter3840-8)" />
id="path3800-8-1"
inkscape:connector-curvature="0"
transform="matrix(0,0.91790986,-0.91920821,0,46.263348,0.732956)" />
<path
inkscape:connector-curvature="0"
style="fill:url(#linearGradient5359);fill-rule:evenodd"
id="path5239"
d="m 33.53467,10.33595 11.330688,0.476184 0.669278,2.389995 -3.8141,0.479704 c 9.277651,8.056611 5.785458,17.035015 0.276844,22.356277 l -3.757555,-2.906799 c 4.080201,-4.366342 7.546153,-8.910415 -0.636423,-16.015901 l -0.835036,4.213112 -2.792572,-0.726699 z" />
<path
style="opacity:0.52083333;fill:#000000;fill-opacity:1;stroke:#991d1d;stroke-width:5.9735837;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"
d="M 42.327937,3.728631 4.156768,42.19322 l 0,0"
id="path3800-7"
d="m 8.5224219,-31.309913 -38.1711689,38.464589 0,0"
style="opacity:0.57692309;fill:none;stroke:#0539b2;stroke-width:5.9735837;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" />
</g>
inkscape:connector-curvature="0" />
<g
id="g3844">
<g
id="g35"
transform="matrix(2.9379,0,0,2.1996,2.1067,3.2221)">
transform="matrix(2.9379,0,0,2.1996,2.8259663,3.3248523)"
id="g35">
<rect
id="rect37"
x="0"
y="0"
width="16"
style="fill-opacity:0"
height="16"
fill-opacity="0" />
width="16"
y="0"
x="0"
id="rect37" />
</g>
<path
transform="matrix(0.91790986,0,0,0.91920821,0.23358571,-0.12773803)"
inkscape:connector-curvature="0"
id="path3800-8"
d="m 7.8690809,3.4934004 41.1855461,40.6965116 0,0"
style="opacity:0.26068373;fill:none;stroke:#37574d;stroke-width:6.38199997;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;filter:url(#filter3840)" />
style="fill:url(#linearGradient5356);fill-rule:evenodd"
id="path5249"
d="M 10.463058,39.219997 0.00384922,35.037945 0.24246703,32.574716 3.9974341,33.382448 C -1.7869153,22.76477 4.7456186,15.491215 11.84369,12.31378 l 2.471883,3.966358 C 8.9037643,19.032155 4.0038279,22.153579 9.1051871,31.51816 l 2.3112269,-3.677845 2.35687,1.602486 z" />
<path
style="opacity:0.26068373;fill:none;stroke:#37574d;stroke-width:6.38199997;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;filter:url(#filter3840)"
d="m 7.8690809,3.4934004 41.1855461,40.6965116 0,0"
id="path3800-8"
inkscape:connector-curvature="0"
transform="matrix(0.91790986,0,0,0.91920821,0.952852,-0.0249857)" />
<path
style="fill:none;stroke:#01a706;stroke-width:5.9735837;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"
d="M 3.6402699,3.2939114 42.104859,41.46508 l 0,0"
id="path3800"
d="m 2.9210036,3.1911591 38.4645894,38.1711689 0,0"
style="fill:none;stroke:#73ce06;stroke-width:5.9735837;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" />
</g>
inkscape:connector-curvature="0" />
</svg>
......@@ -24,6 +24,7 @@
#include <common.h>
#include <class_page_info.h>
#include <macros.h>
......
......@@ -346,6 +346,19 @@ wxString GetKicadConfigPath()
}
#include <ki_mutex.h>
const wxString ExpandEnvVarSubstitutions( const wxString& aString )
{
// wxGetenv( wchar_t* ) is not re-entrant on linux.
// Put a lock on multithreaded use of wxGetenv( wchar_t* ), called from wxEpandEnvVars(),
static MUTEX getenv_mutex;
MUTLOCK lock( getenv_mutex );
// We reserve the right to do this another way, by providing our own member
// function.
return wxExpandEnvVars( aString );
}
bool EnsureFileDirectoryExists( wxFileName* aTargetFullFileName,
const wxString& aBaseFilename,
......
......@@ -639,6 +639,9 @@ const FP_LIB_TABLE::ROW* FP_LIB_TABLE::FindRow( const wxString& aNickname )
const wxString FP_LIB_TABLE::ExpandSubstitutions( const wxString& aString )
{
// Duplicate code: the same is now in common.cpp, due to the fact it is used
// in many other places than FP_LIB_TABLE
#if 0
static MUTEX getenv_mutex;
MUTLOCK lock( getenv_mutex );
......@@ -646,6 +649,9 @@ const wxString FP_LIB_TABLE::ExpandSubstitutions( const wxString& aString )
// We reserve the right to do this another way, by providing our own member
// function.
return wxExpandEnvVars( aString );
#else
return ExpandEnvVarSubstitutions( aString );
#endif
}
......
......@@ -56,6 +56,7 @@
#include <fctsys.h>
#include <drawtxt.h>
#include <class_page_info.h>
#include <worksheet.h>
#include <class_title_block.h>
#include <worksheet_shape_builder.h>
......
......@@ -33,6 +33,7 @@
#include <painter.h>
#include <layers_id_colors_and_visibility.h>
#include <boost/foreach.hpp>
#include <class_page_info.h>
using namespace KIGFX;
......
......@@ -8,6 +8,12 @@ endif()
add_definitions( -DCVPCB )
if( KICAD_USE_WEBKITT AND BUILD_GITHUB_PLUGIN )
set( WEBVIEWER_WXLIB "webviewer" )
add_definitions( -DKICAD_USE_WEBKIT )
endif()
include_directories( BEFORE ${INC_BEFORE} )
include_directories(
./dialogs
......@@ -29,6 +35,8 @@ set( CVPCB_DIALOGS
../pcbnew/dialogs/dialog_fp_lib_table_base.cpp
../pcbnew/dialogs/dialog_fp_plugin_options.cpp
../pcbnew/dialogs/dialog_fp_plugin_options_base.cpp
../pcbnew/dialogs/wizard_add_fplib_base.cpp
../pcbnew/dialogs/wizard_add_fplib.cpp
)
set( CVPCB_SRCS
......@@ -75,9 +83,11 @@ add_executable( cvpcb WIN32 MACOSX_BUNDLE
../common/pgm_base.cpp
${CVPCB_RESOURCES}
)
set_source_files_properties( ../common/single_top.cpp PROPERTIES
COMPILE_DEFINITIONS "TOP_FRAME=FRAME_CVPCB;PGM_DATA_FILE_EXT=\"net\";BUILD_KIWAY_DLL"
)
target_link_libraries( cvpcb
#singletop # replaces common, giving us restrictive control and link warnings.
# There's way too much crap coming in from common yet.
......@@ -107,6 +117,7 @@ target_link_libraries( cvpcb_kiface
pcbcommon
pcad2kicadpcb
common
${WEBVIEWER_WXLIB} # before bitmaps, because it uses some bitmaps defined in bitmaps
bitmaps
polygon
gal
......
......@@ -965,7 +965,7 @@ void DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::copyOptionsToPanel()
}
// For components with multiple parts per package, set the unit selection
if( m_Cmp->GetUnit() <= unitChoice->GetCount() )
if( m_Cmp->GetUnit() <= (int)unitChoice->GetCount() )
unitChoice->SetSelection( m_Cmp->GetUnit() - 1 );
// Disable unit selection if only one unit exists:
......
......@@ -33,6 +33,7 @@
#include <gestfich.h>
#include <wxEeschemaStruct.h>
#include <invoke_sch_dialog.h>
#include <common.h>
#include <eeschema_id.h>
#include <general.h>
......@@ -480,8 +481,16 @@ bool SCH_EDIT_FRAME::LoadProjectFile()
// BASE_SCREEN::m_PageLayoutDescrFileName, read in config project file
// If empty, the default descr is loaded
WORKSHEET_LAYOUT& pglayout = WORKSHEET_LAYOUT::GetTheInstance();
wxString pg_fullfilename = ExpandEnvVarSubstitutions( BASE_SCREEN::m_PageLayoutDescrFileName );
pglayout.SetPageLayout( BASE_SCREEN::m_PageLayoutDescrFileName );
if( !pg_fullfilename.IsEmpty() )
{
// When the page layout filename is not absolute, therefore
// relative to the current project, make it absolute
pg_fullfilename = Prj().AbsolutePath( pg_fullfilename );
}
pglayout.SetPageLayout( pg_fullfilename );
return isRead;
}
......
......@@ -36,9 +36,6 @@
GBR_LAYOUT::GBR_LAYOUT()
{
PAGE_INFO pageInfo( wxT( "GERBER" ) );
SetPageSettings( pageInfo );
m_printLayersMask.set();
}
......
......@@ -50,7 +50,6 @@ class GBR_LAYOUT
{
private:
EDA_RECT m_BoundingBox;
PAGE_INFO m_paper;
TITLE_BLOCK m_titles;
wxPoint m_originAxisPosition;
std::bitset <GERBER_DRAWLAYERS_COUNT> m_printLayersMask; // When printing: the list of layers to print
......@@ -61,9 +60,6 @@ public:
GBR_LAYOUT();
~GBR_LAYOUT();
const PAGE_INFO& GetPageSettings() const { return m_paper; }
void SetPageSettings( const PAGE_INFO& aPageSettings ) { m_paper = aPageSettings; }
const wxPoint& GetAuxOrigin() const
{
return m_originAxisPosition;
......
......@@ -32,9 +32,6 @@
#define CURSEUR_ON_GRILLE 0
#define CURSEUR_OFF_GRILLE 1
class GERBVIEW_FRAME;
class GERBER_IMAGE;
class PAGE_INFO;
/**
* size of single line of a text from a gerber file.
* warning: some files can have very long lines, so the buffer must be large.
......
......@@ -70,6 +70,8 @@ GERBVIEW_FRAME::GERBVIEW_FRAME( KIWAY* aKiway, wxWindow* aParent ):
{
m_colorsSettings = &g_ColorsSettings;
m_gerberLayout = NULL;
PAGE_INFO pageInfo( wxT( "GERBER" ) );
SetPageSettings( pageInfo );
m_FrameName = GERBVIEW_FRAME_NAME;
m_show_layer_manager_tools = true;
......@@ -94,7 +96,7 @@ GERBVIEW_FRAME::GERBVIEW_FRAME( KIWAY* aKiway, wxWindow* aParent ):
SetVisibleLayers( -1 ); // All draw layers visible.
SetScreen( new GBR_SCREEN( GetGerberLayout()->GetPageSettings().GetSizeIU() ) );
SetScreen( new GBR_SCREEN( GetPageSettings().GetSizeIU() ) );
// Create the PCB_LAYER_WIDGET *after* SetLayout():
wxFont font = wxSystemSettings::GetFont( wxSYS_DEFAULT_GUI_FONT );
......@@ -720,8 +722,7 @@ void GERBVIEW_FRAME::setActiveLayer( int aLayer, bool doLayerWidgetUpdate )
void GERBVIEW_FRAME::SetPageSettings( const PAGE_INFO& aPageSettings )
{
wxASSERT( m_gerberLayout );
m_gerberLayout->SetPageSettings( aPageSettings );
m_paper = aPageSettings;
if( GetScreen() )
GetScreen()->InitDataPoints( aPageSettings.GetSizeIU() );
......@@ -730,19 +731,16 @@ void GERBVIEW_FRAME::SetPageSettings( const PAGE_INFO& aPageSettings )
const PAGE_INFO& GERBVIEW_FRAME::GetPageSettings() const
{
wxASSERT( m_gerberLayout );
return m_gerberLayout->GetPageSettings();
return m_paper;
}
const wxSize GERBVIEW_FRAME::GetPageSizeIU() const
{
wxASSERT( m_gerberLayout );
// this function is only needed because EDA_DRAW_FRAME is not compiled
// with either -DPCBNEW or -DEESCHEMA, so the virtual is used to route
// into an application specific source file.
return m_gerberLayout->GetPageSettings().GetSizeIU();
return GetPageSettings().GetSizeIU();
}
......
......@@ -37,6 +37,7 @@
#include <gerbview.h>
#include <class_gbr_layout.h>
#include <class_gbr_screen.h>
#include <class_page_info.h>
#define NO_AVAILABLE_LAYERS UNDEFINED_LAYER
......@@ -83,6 +84,7 @@ class GERBVIEW_FRAME : public EDA_DRAW_FRAME // PCB_BASE_FRAME
{
GBR_LAYOUT* m_gerberLayout;
wxPoint m_grid_origin;
PAGE_INFO m_paper; // used only to show paper limits to screen
public:
GBR_DISPLAY_OPTIONS m_DisplayOptions;
......
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2007-2013 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
* Copyright (C) 2008-2013 Wayne Stambaugh <stambaughw@verizon.net>
* Copyright (C) 1992-2013 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
*/
/**
* @file class_page_info.h
*/
#ifndef CLASS_PAGE_INFO_H_
#define CLASS_PAGE_INFO_H_
#include <wx/wx.h>
#include <richio.h> // for OUTPUTFORMATTER and IO_ERROR
#include <base_units.h> // for IU_PER_MILS
/**
* Class PAGE_INFO
* describes the page size and margins of a paper page on which to
* eventually print or plot. Paper sizes are often described in inches.
* Here paper is described in 1/1000th of an inch (mils). For convenience
* there are some read only accessors for internal units (IU), which is a compile
* time calculation, not runtime.
*
* @author Dick Hollenbeck
*/
class PAGE_INFO
{
public:
PAGE_INFO( const wxString& aType = PAGE_INFO::A3, bool IsPortrait = false );
// paper size names which are part of the public API, pass to SetType() or
// above constructor.
// these were once wxStrings, but it caused static construction sequence problems:
static const wxChar A4[];
static const wxChar A3[];
static const wxChar A2[];
static const wxChar A1[];
static const wxChar A0[];
static const wxChar A[];
static const wxChar B[];
static const wxChar C[];
static const wxChar D[];
static const wxChar E[];
static const wxChar GERBER[];
static const wxChar USLetter[];
static const wxChar USLegal[];
static const wxChar USLedger[];
static const wxChar Custom[]; ///< "User" defined page type
/**
* Function SetType
* sets the name of the page type and also the sizes and margins
* commonly associated with that type name.
*
* @param aStandardPageDescriptionName is a wxString constant giving one of:
* "A4" "A3" "A2" "A1" "A0" "A" "B" "C" "D" "E" "GERBER", "USLetter", "USLegal",
* "USLedger", or "User". If "User" then the width and height are custom,
* and will be set according to <b>previous</b> calls to
* static PAGE_INFO::SetUserWidthMils() and
* static PAGE_INFO::SetUserHeightMils();
* @param IsPortrait Set to true to set page orientation to portrait mode.
*
* @return bool - true if @a aStandarePageDescription was a recognized type.
*/
bool SetType( const wxString& aStandardPageDescriptionName, bool IsPortrait = false );
const wxString& GetType() const { return m_type; }
/**
* Function IsDefault
* @return True if the object has the default page settings which are A3, landscape.
*/
bool IsDefault() const { return m_type == PAGE_INFO::A3 && !m_portrait; }
/**
* Function IsCustom
* returns true if the type is Custom
*/
bool IsCustom() const;
/**
* Function SetPortrait
* will rotate the paper page 90 degrees. This PAGE_INFO may either be in
* portrait or landscape mode. Use this function to change from one to the
* other mode.
* @param isPortrait if true and not already in portrait mode, will change
* this PAGE_INFO to portrait mode. Or if false and not already in landscape mode,
* will change this PAGE_INFO to landscape mode.
*/
void SetPortrait( bool isPortrait );
bool IsPortrait() const { return m_portrait; }
/**
* Function GetWxOrientation.
* @return ws' style printing orientation (wxPORTRAIT or wxLANDSCAPE).
*/
#if wxCHECK_VERSION( 2, 9, 0 )
wxPrintOrientation GetWxOrientation() const { return IsPortrait() ? wxPORTRAIT : wxLANDSCAPE; }
#else
int GetWxOrientation() const { return IsPortrait() ? wxPORTRAIT : wxLANDSCAPE; }
#endif
/**
* Function GetPaperId
* @return wxPaperSize - wxPrintData's style paper id associated with
* page type name.
*/
wxPaperSize GetPaperId() const { return m_paper_id; }
void SetWidthMils( int aWidthInMils );
int GetWidthMils() const { return m_size.x; }
void SetHeightMils( int aHeightInMils );
int GetHeightMils() const { return m_size.y; }
const wxSize& GetSizeMils() const { return m_size; }
// Accessors returning "Internal Units (IU)". IUs are mils in EESCHEMA,
// and either deci-mils or nanometers in PCBNew.
#if defined(PCBNEW) || defined(EESCHEMA) || defined(GERBVIEW) || defined(PL_EDITOR)
int GetWidthIU() const { return IU_PER_MILS * GetWidthMils(); }
int GetHeightIU() const { return IU_PER_MILS * GetHeightMils(); }
const wxSize GetSizeIU() const { return wxSize( GetWidthIU(), GetHeightIU() ); }
#endif
/**
* Function SetCustomWidthMils
* sets the width of Custom page in mils, for any custom page
* constructed or made via SetType() after making this call.
*/
static void SetCustomWidthMils( int aWidthInMils );
/**
* Function SetCustomHeightMils
* sets the height of Custom page in mils, for any custom page
* constructed or made via SetType() after making this call.
*/
static void SetCustomHeightMils( int aHeightInMils );
/**
* Function GetCustomWidthMils.
* @return int - custom paper width in mils.
*/
static int GetCustomWidthMils() { return s_user_width; }
/**
* Function GetCustomHeightMils.
* @return int - custom paper height in mils.
*/
static int GetCustomHeightMils() { return s_user_height; }
/**
* Function GetStandardSizes
* returns the standard page types, such as "A4", "A3", etc.
static wxArrayString GetStandardSizes();
*/
/**
* Function Format
* outputs the page class to \a aFormatter in s-expression form.
*
* @param aFormatter The #OUTPUTFORMATTER object to write to.
* @param aNestLevel The indentation next level.
* @param aControlBits The control bit definition for object specific formatting.
* @throw IO_ERROR on write error.
*/
void Format( OUTPUTFORMATTER* aFormatter, int aNestLevel, int aControlBits ) const
throw( IO_ERROR );
protected:
// only the class implementation(s) may use this constructor
PAGE_INFO( const wxSize& aSizeMils, const wxString& aName, wxPaperSize aPaperId );
private:
// standard pre-defined sizes
static const PAGE_INFO pageA4;
static const PAGE_INFO pageA3;
static const PAGE_INFO pageA2;
static const PAGE_INFO pageA1;
static const PAGE_INFO pageA0;
static const PAGE_INFO pageA;
static const PAGE_INFO pageB;
static const PAGE_INFO pageC;
static const PAGE_INFO pageD;
static const PAGE_INFO pageE;
static const PAGE_INFO pageGERBER;
static const PAGE_INFO pageUSLetter;
static const PAGE_INFO pageUSLegal;
static const PAGE_INFO pageUSLedger;
static const PAGE_INFO pageUser;
// all dimensions here are in mils
wxString m_type; ///< paper type: A4, A3, etc.
wxSize m_size; ///< mils
/// Min and max page sizes for clamping.
#define MIN_PAGE_SIZE 4000
#define MAX_PAGE_SIZE 48000
bool m_portrait; ///< true if portrait, false if landscape
wxPaperSize m_paper_id; ///< wx' style paper id.
static int s_user_height;
static int s_user_width;
void updatePortrait();
void setMargins();
};
#endif // CLASS_PAGE_INFO_H_
......@@ -35,6 +35,7 @@
#include <sch_item_struct.h>
#include <class_base_screen.h>
#include <class_title_block.h>
#include <class_page_info.h>
#include <kiway_player.h>
#include <../eeschema/general.h>
......
......@@ -170,213 +170,6 @@ enum EDA_UNITS_T {
};
// forward declarations:
class LibNameList;
/**
* Class PAGE_INFO
* describes the page size and margins of a paper page on which to
* eventually print or plot. Paper sizes are often described in inches.
* Here paper is described in 1/1000th of an inch (mils). For convenience
* there are some read only accessors for internal units (IU), which is a compile
* time calculation, not runtime.
*
* @author Dick Hollenbeck
*/
class PAGE_INFO
{
public:
PAGE_INFO( const wxString& aType = PAGE_INFO::A3, bool IsPortrait = false );
// paper size names which are part of the public API, pass to SetType() or
// above constructor.
// these were once wxStrings, but it caused static construction sequence problems:
static const wxChar A4[];
static const wxChar A3[];
static const wxChar A2[];
static const wxChar A1[];
static const wxChar A0[];
static const wxChar A[];
static const wxChar B[];
static const wxChar C[];
static const wxChar D[];
static const wxChar E[];
static const wxChar GERBER[];
static const wxChar USLetter[];
static const wxChar USLegal[];
static const wxChar USLedger[];
static const wxChar Custom[]; ///< "User" defined page type
/**
* Function SetType
* sets the name of the page type and also the sizes and margins
* commonly associated with that type name.
*
* @param aStandardPageDescriptionName is a wxString constant giving one of:
* "A4" "A3" "A2" "A1" "A0" "A" "B" "C" "D" "E" "GERBER", "USLetter", "USLegal",
* "USLedger", or "User". If "User" then the width and height are custom,
* and will be set according to <b>previous</b> calls to
* static PAGE_INFO::SetUserWidthMils() and
* static PAGE_INFO::SetUserHeightMils();
* @param IsPortrait Set to true to set page orientation to portrait mode.
*
* @return bool - true if @a aStandarePageDescription was a recognized type.
*/
bool SetType( const wxString& aStandardPageDescriptionName, bool IsPortrait = false );
const wxString& GetType() const { return m_type; }
/**
* Function IsDefault
* @return True if the object has the default page settings which are A3, landscape.
*/
bool IsDefault() const { return m_type == PAGE_INFO::A3 && !m_portrait; }
/**
* Function IsCustom
* returns true if the type is Custom
*/
bool IsCustom() const;
/**
* Function SetPortrait
* will rotate the paper page 90 degrees. This PAGE_INFO may either be in
* portrait or landscape mode. Use this function to change from one to the
* other mode.
* @param isPortrait if true and not already in portrait mode, will change
* this PAGE_INFO to portrait mode. Or if false and not already in landscape mode,
* will change this PAGE_INFO to landscape mode.
*/
void SetPortrait( bool isPortrait );
bool IsPortrait() const { return m_portrait; }
/**
* Function GetWxOrientation.
* @return ws' style printing orientation (wxPORTRAIT or wxLANDSCAPE).
*/
#if wxCHECK_VERSION( 2, 9, 0 )
wxPrintOrientation GetWxOrientation() const { return IsPortrait() ? wxPORTRAIT : wxLANDSCAPE; }
#else
int GetWxOrientation() const { return IsPortrait() ? wxPORTRAIT : wxLANDSCAPE; }
#endif
/**
* Function GetPaperId
* @return wxPaperSize - wxPrintData's style paper id associated with
* page type name.
*/
wxPaperSize GetPaperId() const { return m_paper_id; }
void SetWidthMils( int aWidthInMils );
int GetWidthMils() const { return m_size.x; }
void SetHeightMils( int aHeightInMils );
int GetHeightMils() const { return m_size.y; }
const wxSize& GetSizeMils() const { return m_size; }
// Accessors returning "Internal Units (IU)". IUs are mils in EESCHEMA,
// and either deci-mils or nanometers in PCBNew.
#if defined(PCBNEW) || defined(EESCHEMA) || defined(GERBVIEW) || defined(PL_EDITOR)
int GetWidthIU() const { return IU_PER_MILS * GetWidthMils(); }
int GetHeightIU() const { return IU_PER_MILS * GetHeightMils(); }
const wxSize GetSizeIU() const { return wxSize( GetWidthIU(), GetHeightIU() ); }
#endif
/**
* Function SetCustomWidthMils
* sets the width of Custom page in mils, for any custom page
* constructed or made via SetType() after making this call.
*/
static void SetCustomWidthMils( int aWidthInMils );
/**
* Function SetCustomHeightMils
* sets the height of Custom page in mils, for any custom page
* constructed or made via SetType() after making this call.
*/
static void SetCustomHeightMils( int aHeightInMils );
/**
* Function GetCustomWidthMils.
* @return int - custom paper width in mils.
*/
static int GetCustomWidthMils() { return s_user_width; }
/**
* Function GetCustomHeightMils.
* @return int - custom paper height in mils.
*/
static int GetCustomHeightMils() { return s_user_height; }
/**
* Function GetStandardSizes
* returns the standard page types, such as "A4", "A3", etc.
static wxArrayString GetStandardSizes();
*/
/**
* Function Format
* outputs the page class to \a aFormatter in s-expression form.
*
* @param aFormatter The #OUTPUTFORMATTER object to write to.
* @param aNestLevel The indentation next level.
* @param aControlBits The control bit definition for object specific formatting.
* @throw IO_ERROR on write error.
*/
void Format( OUTPUTFORMATTER* aFormatter, int aNestLevel, int aControlBits ) const
throw( IO_ERROR );
protected:
// only the class implementation(s) may use this constructor
PAGE_INFO( const wxSize& aSizeMils, const wxString& aName, wxPaperSize aPaperId );
private:
// standard pre-defined sizes
static const PAGE_INFO pageA4;
static const PAGE_INFO pageA3;
static const PAGE_INFO pageA2;
static const PAGE_INFO pageA1;
static const PAGE_INFO pageA0;
static const PAGE_INFO pageA;
static const PAGE_INFO pageB;
static const PAGE_INFO pageC;
static const PAGE_INFO pageD;
static const PAGE_INFO pageE;
static const PAGE_INFO pageGERBER;
static const PAGE_INFO pageUSLetter;
static const PAGE_INFO pageUSLegal;
static const PAGE_INFO pageUSLedger;
static const PAGE_INFO pageUser;
// all dimensions here are in mils
wxString m_type; ///< paper type: A4, A3, etc.
wxSize m_size; ///< mils
/// Min and max page sizes for clamping.
#define MIN_PAGE_SIZE 4000
#define MAX_PAGE_SIZE 48000
bool m_portrait; ///< true if portrait, false if landscape
wxPaperSize m_paper_id; ///< wx' style paper id.
static int s_user_height;
static int s_user_width;
void updatePortrait();
void setMargins();
};
extern EDA_UNITS_T g_UserUnit; ///< display units
/// Draw color for moving objects.
......@@ -646,6 +439,15 @@ wxConfigBase* GetNewConfig( const wxString& aProgName );
*/
wxString GetKicadConfigPath();
/**
* Function ExpandEnvVarSubstitutions
* replaces any environment variable references with their values
* @param aString = a string containing (perhaps) references to env var
* @return a string where env var are replaced by their value
*/
const wxString ExpandEnvVarSubstitutions( const wxString& aString );
#ifdef __WXMAC__
/**
* OSX specific function GetOSXKicadUserDataDir
......
......@@ -35,7 +35,7 @@
#include <vector>
#include <math/box2.h>
#include <drawtxt.h>
#include <common.h> // PAGE_INFO
#include <class_page_info.h>
#include <eda_text.h> // FILL_T
/**
......
......@@ -8,12 +8,12 @@
#define WORKSHEET_H_
#include <colors.h> // EDA_COLOR_T definition
#include <class_page_info.h>
// Forward declarations:
class EDA_DRAW_PANEL;
class EDA_RECT;
class TITLE_BLOCK;
class PAGE_INFO;
/**
* Function DrawPageLayout is a core function to draw the page layout with
......
......@@ -38,6 +38,7 @@
class WORKSHEET_DATAITEM; // Forward declaration
class TITLE_BLOCK;
class PAGE_INFO;
#define TB_DEFAULT_TEXTSIZE 1.5 // default worksheet text size in mm
......
......@@ -28,8 +28,8 @@
#ifndef CLASS_PL_EDITOR_LAYOUT_H
#define CLASS_PL_EDITOR_LAYOUT_H
#include <base_struct.h> // PAGE_INFO
#include <common.h> // PAGE_INFO
#include <base_struct.h>
#include <class_page_info.h>
#include <class_title_block.h>
class EDA_DRAW_PANEL;
......
......@@ -36,7 +36,7 @@
#include <math/vector2d.h>
#include <page_layout_reader_lexer.h>
#include <macros.h>
#include <base_units.h>
#include <convert_to_biu.h>
using namespace TB_READER_T;
......
......@@ -38,7 +38,6 @@
#include <dialog_hotkeys_editor.h>
#include <pl_editor_id.h>
#define GROUP wxT("/pl_editor")
......
......@@ -129,6 +129,8 @@ set( PCBNEW_DIALOGS
footprint_wizard_frame.cpp
dialogs/dialog_footprint_wizard_list_base.cpp
dialogs/dialog_footprint_wizard_list.cpp
dialogs/wizard_add_fplib_base.cpp
dialogs/wizard_add_fplib.cpp
)
set( PCBNEW_IMPORT_DXF
......@@ -368,6 +370,11 @@ if( UNIX AND NOT APPLE )
list( APPEND PCBNEW_EXTRA_LIBS rt )
endif()
if( KICAD_USE_WEBKIT AND BUILD_GITHUB_PLUGIN )
set( WEBVIEWER_WXLIB "webviewer" )
add_definitions( -DKICAD_USE_WEBKIT )
endif()
if( KICAD_SCRIPTING_MODULES )
......@@ -375,6 +382,7 @@ if( KICAD_SCRIPTING_MODULES )
set( CMAKE_SWIG_FLAGS ${SWIG_FLAGS} )
set_source_files_properties( scripting/pcbnew.i PROPERTIES CPLUSPLUS ON )
swig_add_module( pcbnew
python
scripting/pcbnew.i
......@@ -383,6 +391,7 @@ if( KICAD_SCRIPTING_MODULES )
${PCBNEW_SRCS}
${PCBNEW_COMMON_SRCS}
)
swig_link_libraries( pcbnew
3d-viewer
pcbcommon
......@@ -393,6 +402,7 @@ if( KICAD_SCRIPTING_MODULES )
idf3
${GITHUB_PLUGIN_LIBRARIES}
polygon
${WEBVIEWER_WXLIB}
bitmaps
gal
${GLEW_LIBRARIES}
......@@ -559,6 +569,7 @@ target_link_libraries( pcbnew_kiface
common
pcad2kicadpcb
polygon
${WEBVIEWER_WXLIB} # before bitmaps, because it uses some bitmaps defined in bitmap
bitmaps
gal
lib_dxf
......
......@@ -433,10 +433,13 @@ void PCB_BASE_FRAME::OnTogglePolarCoords( wxCommandEvent& aEvent )
void PCB_BASE_FRAME::OnTogglePadDrawMode( wxCommandEvent& aEvent )
{
m_DisplayPadFill = DisplayOpt.DisplayPadFill = !m_DisplayPadFill;
EDA_DRAW_PANEL_GAL* gal = GetGalCanvas();
if( gal )
{
// Apply new display options to the GAL canvas
KIGFX::PCB_PAINTER* painter =
static_cast<KIGFX::PCB_PAINTER*> ( GetGalCanvas()->GetView()->GetPainter() );
static_cast<KIGFX::PCB_PAINTER*> ( gal->GetView()->GetPainter() );
KIGFX::PCB_RENDER_SETTINGS* settings =
static_cast<KIGFX::PCB_RENDER_SETTINGS*> ( painter->GetSettings() );
settings->LoadDisplayOptions( DisplayOpt );
......@@ -448,6 +451,7 @@ void PCB_BASE_FRAME::OnTogglePadDrawMode( wxCommandEvent& aEvent )
for( D_PAD* pad = module->Pads(); pad; pad = pad->Next() )
pad->ViewUpdate( KIGFX::VIEW_ITEM::GEOMETRY );
}
}
m_canvas->Refresh();
}
......
......@@ -43,6 +43,8 @@
#include <invoke_pcb_dialog.h>
#include <grid_tricks.h>
#include <confirm.h>
#include <wizard_add_fplib.h>
/// grid column order is established by this sequence
enum COL_ORDER
......@@ -356,6 +358,11 @@ public:
wxAuiNotebookEvent uneventful;
pageChangedHandler( uneventful );
// Gives a selection for each grid, mainly for delete lib button.
// Without that, we do not see what lib will be deleted
m_global_grid->SelectRow(0);
m_project_grid->SelectRow(0);
// for ALT+A handling, we want the initial focus to be on the first selected grid.
m_cur_grid->SetFocus();
}
......@@ -512,11 +519,32 @@ private:
// wx documentation is wrong, SetGridCursor does not make visible.
m_cur_grid->MakeCellVisible( last_row, 0 );
m_cur_grid->SetGridCursor( last_row, 0 );
m_cur_grid->SelectRow( m_cur_grid->GetGridCursorRow() );
}
}
void deleteRowHandler( wxMouseEvent& event )
{
#if 1
int currRow = getCursorRow();
wxArrayInt selectedRows = m_cur_grid->GetSelectedRows();
if( selectedRows.size() == 0 && getCursorRow() >= 0 )
selectedRows.Add( getCursorRow() );
std::sort( selectedRows.begin(), selectedRows.end() );
for( int ii = selectedRows.GetCount()-1; ii >= 0; ii-- )
{
int row = selectedRows[ii];
m_cur_grid->DeleteRows( row, 1 );
}
if( currRow >= m_cur_grid->GetNumberRows() )
m_cur_grid->SetGridCursor(m_cur_grid->GetNumberRows()-1, getCursorCol() );
m_cur_grid->SelectRow( m_cur_grid->GetGridCursorRow() );
#else
int rowCount = m_cur_grid->GetNumberRows();
int curRow = getCursorRow();
......@@ -525,9 +553,12 @@ private:
m_cur_grid->DeleteRows( curRow );
if( curRow && curRow == rowCount - 1 )
{
m_cur_grid->SetGridCursor( curRow-1, getCursorCol() );
}
}
#endif
}
void moveUpHandler( wxMouseEvent& event )
{
......@@ -557,6 +588,7 @@ private:
m_cur_grid->MakeCellVisible( curRow, curCol );
m_cur_grid->SetGridCursor( curRow, curCol );
m_cur_grid->SelectRow( getCursorRow() );
}
}
......@@ -588,6 +620,7 @@ private:
m_cur_grid->MakeCellVisible( curRow, curCol );
m_cur_grid->SetGridCursor( curRow, curCol );
m_cur_grid->SelectRow( getCursorRow() );
}
}
......@@ -623,6 +656,8 @@ private:
}
}
void OnClickLibraryWizard( wxCommandEvent& event );
void onCancelButtonClick( wxCommandEvent& event )
{
EndModal( 0 );
......@@ -719,7 +754,7 @@ private:
// the current project.
unique.insert( PROJECT_VAR_NAME );
unique.insert( FP_LIB_TABLE::GlobalPathEnvVariableName() );
// This special environment variable is used to locad 3d shapes
// This special environment variable is used to locate 3d shapes
unique.insert( KISYS3DMOD );
unique.insert( FP_LIB_TABLE::GlobalPathEnvVariableName() );
......@@ -757,6 +792,50 @@ private:
int DIALOG_FP_LIB_TABLE::m_pageNdx = 0;
void DIALOG_FP_LIB_TABLE::OnClickLibraryWizard( wxCommandEvent& event )
{
wxArrayString envVariableList;
// 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() ) )
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
while( dlg.GetLibDescr( idx++, libDescr ) )
{
if( ! libDescr[0].IsEmpty() && m_cur_grid->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] );
// Add the plugin name:
tbl->SetValue( last_row, COL_TYPE, libDescr[2] );
libgrid->MakeCellVisible( last_row, 0 );
libgrid->SetGridCursor( last_row, 0 );
}
libDescr.Clear();
}
libgrid->SelectRow( libgrid->GetGridCursorRow() );
}
int InvokePcbLibTableEditor( wxTopLevelWindow* aParent, FP_LIB_TABLE* aGlobal, FP_LIB_TABLE* aProject )
{
DIALOG_FP_LIB_TABLE dlg( aParent, aGlobal, aProject );
......
......@@ -103,6 +103,9 @@ DIALOG_FP_LIB_TABLE_BASE::DIALOG_FP_LIB_TABLE_BASE( wxWindow* parent, wxWindowID
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") );
......@@ -194,6 +197,7 @@ DIALOG_FP_LIB_TABLE_BASE::DIALOG_FP_LIB_TABLE_BASE( wxWindow* parent, wxWindowID
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_LEFT_DOWN, wxMouseEventHandler( 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_delete_button->Connect( wxEVT_LEFT_DOWN, wxMouseEventHandler( DIALOG_FP_LIB_TABLE_BASE::deleteRowHandler ), NULL, this );
m_move_up_button->Connect( wxEVT_LEFT_DOWN, wxMouseEventHandler( DIALOG_FP_LIB_TABLE_BASE::moveUpHandler ), NULL, this );
m_move_down_button->Connect( wxEVT_LEFT_DOWN, wxMouseEventHandler( DIALOG_FP_LIB_TABLE_BASE::moveDownHandler ), NULL, this );
......@@ -209,6 +213,7 @@ DIALOG_FP_LIB_TABLE_BASE::~DIALOG_FP_LIB_TABLE_BASE()
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_LEFT_DOWN, wxMouseEventHandler( 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_delete_button->Disconnect( wxEVT_LEFT_DOWN, wxMouseEventHandler( DIALOG_FP_LIB_TABLE_BASE::deleteRowHandler ), NULL, this );
m_move_up_button->Disconnect( wxEVT_LEFT_DOWN, wxMouseEventHandler( DIALOG_FP_LIB_TABLE_BASE::moveUpHandler ), NULL, this );
m_move_down_button->Disconnect( wxEVT_LEFT_DOWN, wxMouseEventHandler( DIALOG_FP_LIB_TABLE_BASE::moveDownHandler ), NULL, this );
......
......@@ -751,6 +751,94 @@
<event name="OnUpdateUI"></event>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxALL</property>
<property name="proportion">0</property>
<object class="wxButton" 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">0</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="label">Append with Wizard</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_buttonWizard</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="validator_data_type"></property>
<property name="validator_style">wxFILTER_NONE</property>
<property name="validator_type">wxDefaultValidator</property>
<property name="validator_variable"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnButtonClick">OnClickLibraryWizard</event>
<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="0">
<property name="border">5</property>
<property name="flag">wxALL</property>
......
......@@ -47,6 +47,7 @@ class DIALOG_FP_LIB_TABLE_BASE : public DIALOG_SHIM
wxPanel* m_project_panel;
wxGrid* m_project_grid;
wxButton* m_append_button;
wxButton* m_buttonWizard;
wxButton* m_delete_button;
wxButton* m_move_up_button;
wxButton* m_move_down_button;
......@@ -61,6 +62,7 @@ class DIALOG_FP_LIB_TABLE_BASE : public DIALOG_SHIM
virtual void onKeyDown( wxKeyEvent& event ) = 0;
virtual void pageChangedHandler( wxAuiNotebookEvent& event ) = 0;
virtual void appendRowHandler( wxMouseEvent& event ) = 0;
virtual void OnClickLibraryWizard( wxCommandEvent& event ) = 0;
virtual void deleteRowHandler( wxMouseEvent& event ) = 0;
virtual void moveUpHandler( wxMouseEvent& event ) = 0;
virtual void moveDownHandler( wxMouseEvent& event ) = 0;
......
......@@ -27,7 +27,6 @@
*/
#include <fctsys.h>
//#include <pgm_base.h>
#include <kiface_i.h>
#include <confirm.h>
#include <gestfich.h>
......@@ -45,7 +44,6 @@
#endif
#define FREEROUTE_URL_KEY wxT( "freeroute_url" )
#define FREEROUTE_RUN_KEY wxT( "freeroute_command" )
......@@ -63,7 +61,7 @@ DIALOG_FREEROUTE::DIALOG_FREEROUTE( PCB_EDIT_FRAME* parent ):
m_Parent = parent;
MyInit();
m_sdbSizer1OK->SetDefault();
m_sdbSizerOK->SetDefault();
GetSizer()->SetSizeHints( this );
Centre();
}
......@@ -76,27 +74,25 @@ DIALOG_FREEROUTE::DIALOG_FREEROUTE( PCB_EDIT_FRAME* parent ):
void DIALOG_FREEROUTE::MyInit()
{
SetFocus();
m_FreeRouteSetupChanged = false;
m_freeRouterIsLocal = false;
wxString msg;
m_freeRouterFound = false;
/* wxString msg;
wxConfigBase* cfg = Kiface().KifaceSettings();
cfg->Read( FREEROUTE_URL_KEY, &msg );
if( msg.IsEmpty() )
m_FreerouteURLName->SetValue( wxT( "http://www.freerouting.net/" ) );
else
m_FreerouteURLName->SetValue( msg );
cfg->Read( FREEROUTE_RUN_KEY, &msg );
*/
wxFileName fileName( FindKicadFile( wxT( "freeroute.jar" ) ), wxPATH_UNIX );
if( fileName.FileExists() )
{
m_freeRouterIsLocal = true;
m_freeRouterFound = true;
m_buttonLaunchFreeroute->SetLabel( _("Create .dsn File and Launch FreeRouter") );
}
else
m_buttonLaunchFreeroute->SetLabel( _("Create .dsn File") );
m_buttonLaunchFreeroute->Enable( m_freeRouterFound );
}
const char * s_FreeRouteHelpInfo =
......@@ -138,36 +134,29 @@ void DIALOG_FREEROUTE::OnImportButtonClick( wxCommandEvent& event )
*/
void DIALOG_FREEROUTE::OnLaunchButtonClick( wxCommandEvent& event )
{
wxString javaCommand;
wxString command;
wxString dsnFile;
if( m_freeRouterIsLocal )
if( m_freeRouterFound )
{
javaCommand = CmdRunFreeRouterLocal();
dsnFile = createDSN_File();
if( javaCommand.IsEmpty() ) // Something is wrong
if( dsnFile.IsEmpty() ) // Something is wrong or command cancelled
return;
}
else
javaCommand = wxT( "javaws" );
wxString url;
wxFileName fileName( FindKicadFile( wxT( "freeroute.jnlp" ) ), wxPATH_UNIX );
if( m_freeRouterIsLocal || fileName.FileExists() )
{
wxFileName jarfileName( FindKicadFile( wxT( "freeroute.jar" ) ), wxPATH_UNIX );
wxString command;
// Find the Java web start application on Windows.
// Find the Java application on Windows.
// Colud be no more needed since we now have to run only java, not java web start
#ifdef __WINDOWS__
#if wxCHECK_VERSION( 2, 9, 0 )
// If you thought the registry was brain dead before, now you have to deal with
// accessing it in either 64 or 32 bit mode depending on the build version of
// Windows and the build version of KiCad.
// This key works for 32 bit Java on 32 bit Windows and 64 bit Java on 64 bit Windows.
wxString keyName = m_freeRouterIsLocal ? wxT( "SOFTWARE\\JavaSoft\\Java Runtime Environment" )
: wxT( "SOFTWARE\\JavaSoft\\Java Web Start" );
wxString keyName = wxT( "SOFTWARE\\JavaSoft\\Java Runtime Environment" );
wxRegKey key( wxRegKey::HKLM, keyName,
wxIsPlatform64Bit() ? wxRegKey::WOW64ViewMode_64 :
wxRegKey::WOW64ViewMode_Default );
......@@ -175,9 +164,7 @@ void DIALOG_FREEROUTE::OnLaunchButtonClick( wxCommandEvent& event )
// It's possible that 32 bit Java is installed on 64 bit Windows.
if( !key.Exists() && wxIsPlatform64Bit() )
{
keyName = m_freeRouterIsLocal ?
wxT( "SOFTWARE\\Wow6432Node\\JavaSoft\\Java Runtime Environment" )
: wxT( "SOFTWARE\\Wow6432Node\\JavaSoft\\Java Web Start" );
keyName = wxT( "SOFTWARE\\Wow6432Node\\JavaSoft\\Java Runtime Environment" );
key.SetName( wxRegKey::HKLM, keyName );
}
......@@ -197,87 +184,47 @@ void DIALOG_FREEROUTE::OnLaunchButtonClick( wxCommandEvent& event )
key.QueryValue( wxT( "CurrentVersion" ), value );
key.SetName( key.GetName() + wxT( "\\" ) + value );
key.QueryValue( m_freeRouterIsLocal ? wxT( "JavaHome" ) : wxT( "Home" ), value );
wxString javaCommandPath = value + wxFileName::GetPathSeparator();
command = javaCommandPath;
#else
#warning Kicad needs wxWidgets >= 2.9.4. version 2.8 is only supported for testing purposes
#endif // wxCHECK_VERSION( 2, 9, 0 )
if( m_freeRouterIsLocal )
command << wxT("bin\\") << javaCommand;
key.QueryValue( wxT( "JavaHome" ), value );
command = value + wxFileName::GetPathSeparator();
command << wxT("bin\\java");
#else // __WINDOWS__
if( m_freeRouterIsLocal )
command << javaCommand;
command = wxT( "java" );;
#endif
else
// Wrap FullFileName in double quotes in case it has C:\Program Files in it.
// The space is interpreted as an argument separator.
command << javaCommand << wxChar( ' ' ) << wxChar( '"' )
<< fileName.GetFullPath() << wxChar( '"' );
ProcessExecute( command );
return;
}
url = m_FreerouteURLName->GetValue() + wxT( "/java/freeroute.jnlp" );
wxLaunchDefaultBrowser( url );
}
wxString DIALOG_FREEROUTE::CmdRunFreeRouterLocal()
{
wxString fullFileName = m_Parent->GetBoard()->GetFileName();
wxString path;
wxString name;
wxString ext;
wxString dsn_ext = wxT( ".dsn" );
wxString mask = wxT( "*" ) + dsn_ext;
wxFileName::SplitPath( fullFileName, &path, &name, &ext );
name += dsn_ext;
fullFileName = EDA_FileSelector( _( "Specctra DSN file:" ),
path,
name, // name.ext without path!
dsn_ext,
mask,
this,
wxFD_SAVE,
false
);
if( fullFileName == wxEmptyString )
return fullFileName;
if( ! m_Parent->ExportSpecctraFile( fullFileName ) ) // the file was not created
return fullFileName;
wxFileName jarfileName( FindKicadFile( wxT( "freeroute.jar" ) ), wxPATH_UNIX );
wxString command = wxT("java -jar ");
command << wxT(" -jar ");
// add "freeroute.jar" to command line:
command << wxChar( '"' ) << jarfileName.GetFullPath() << wxChar( '"' );
// add option to load the .dsn file
command << wxT( " -de " );
// add *.dsn full filename (quoted):
command << wxChar( '"' ) << fullFileName << wxChar( '"' );
command << wxChar( '"' ) << dsnFile << wxChar( '"' );
return command;
ProcessExecute( command );
}
/* wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_BUTTON
*/
void DIALOG_FREEROUTE::OnVisitButtonClick( wxCommandEvent& event )
const wxString DIALOG_FREEROUTE::createDSN_File()
{
wxString command = m_FreerouteURLName->GetValue();
wxFileName fn( m_Parent->GetBoard()->GetFileName() );
wxString dsn_ext = wxT( "dsn" );
fn.SetExt( dsn_ext );
wxString mask = wxT( "*." ) + dsn_ext;
wxString fullFileName = EDA_FileSelector( _( "Specctra DSN file:" ),
fn.GetPath(), fn.GetFullName(),
dsn_ext, mask,
this, wxFD_SAVE, false );
if( !fullFileName.IsEmpty() )
{
if( ! m_Parent->ExportSpecctraFile( fullFileName ) ) // the file was not created
return wxEmptyString;
}
wxLaunchDefaultBrowser( command );
return fullFileName;
}
/* wxEVT_COMMAND_BUTTON_CLICKED event handler for wxID_CLOSE
*/
void DIALOG_FREEROUTE::OnCancelButtonClick( wxCommandEvent& event )
......@@ -288,19 +235,6 @@ void DIALOG_FREEROUTE::OnCancelButtonClick( wxCommandEvent& event )
void DIALOG_FREEROUTE::OnOKButtonClick( wxCommandEvent& event )
{
if( m_FreeRouteSetupChanged ) // Save new config
{
Kiface().KifaceSettings()->Write(
FREEROUTE_URL_KEY, m_FreerouteURLName->GetValue() );
}
EndModal(wxID_OK);
}
/* wxEVT_COMMAND_TEXT_UPDATED event handler for ID_TEXT_EDIT_FR_URL
*/
void DIALOG_FREEROUTE::OnTextEditFrUrlUpdated( wxCommandEvent& event )
{
m_FreeRouteSetupChanged = true;
}
......@@ -31,8 +31,7 @@ class DIALOG_FREEROUTE : public DIALOG_FREEROUTE_BASE
{
private:
PCB_EDIT_FRAME* m_Parent;
bool m_FreeRouteSetupChanged;
bool m_freeRouterIsLocal;
bool m_freeRouterFound;
private:
// Virtual event handlers
......@@ -40,12 +39,11 @@ private:
void OnExportButtonClick( wxCommandEvent& event );
void OnLaunchButtonClick( wxCommandEvent& event );
void OnImportButtonClick( wxCommandEvent& event );
void OnVisitButtonClick( wxCommandEvent& event );
void OnHelpButtonClick( wxCommandEvent& event );
void OnCancelButtonClick( wxCommandEvent& event );
void OnTextEditFrUrlUpdated( wxCommandEvent& event );
void MyInit ( );
wxString CmdRunFreeRouterLocal();
const wxString createDSN_File();
public:
DIALOG_FREEROUTE( PCB_EDIT_FRAME* parent );
......
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Apr 10 2012)
// C++ code generated with wxFormBuilder (version Jun 5 2014)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!
......@@ -42,7 +42,7 @@ DIALOG_FREEROUTE_BASE::DIALOG_FREEROUTE_BASE( wxWindow* parent, wxWindowID id, c
bLeftButtonsSizer->Add( m_ExportDSN, 0, wxALL|wxEXPAND, 5 );
m_buttonLaunchFreeroute = new wxButton( this, wxID_BUTTON_LAUNCH, _("Launch FreeRouter via Java Web Start"), wxDefaultPosition, wxDefaultSize, 0 );
m_buttonLaunchFreeroute = new wxButton( this, wxID_BUTTON_LAUNCH, _("Launch FreeRouter and Launch FreeRouter"), wxDefaultPosition, wxDefaultSize, 0 );
m_buttonLaunchFreeroute->SetToolTip( _("Use Java Web Start function to run FreeRouter via Internet (or your Browser if not found)") );
bLeftButtonsSizer->Add( m_buttonLaunchFreeroute, 0, wxALL|wxEXPAND, 5 );
......@@ -61,65 +61,22 @@ DIALOG_FREEROUTE_BASE::DIALOG_FREEROUTE_BASE( wxWindow* parent, wxWindowID id, c
bUpperSizer->Add( bLeftSizer, 1, wxALIGN_TOP|wxALL|wxEXPAND, 5 );
m_staticline2 = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_VERTICAL );
bUpperSizer->Add( m_staticline2, 0, wxALL|wxEXPAND, 5 );
wxBoxSizer* bRightSizer;
bRightSizer = new wxBoxSizer( wxVERTICAL );
m_staticText3 = new wxStaticText( this, wxID_ANY, _("FreeRoute Info:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText3->Wrap( -1 );
m_staticText3->SetFont( wxFont( wxNORMAL_FONT->GetPointSize(), 70, 90, 92, false, wxEmptyString ) );
bRightSizer->Add( m_staticText3, 0, wxALL, 5 );
wxBoxSizer* bRightSubSizer;
bRightSubSizer = new wxBoxSizer( wxHORIZONTAL );
bRightSubSizer->Add( 20, 20, 0, 0, 5 );
wxBoxSizer* bRightButtonsSizer;
bRightButtonsSizer = new wxBoxSizer( wxVERTICAL );
m_buttonVisit = new wxButton( this, wxID_BUTTON_VISIT, _("Visit the FreeRouting.net Website with your Browser"), wxDefaultPosition, wxDefaultSize, 0 );
bRightButtonsSizer->Add( m_buttonVisit, 0, wxALL|wxEXPAND, 5 );
m_staticText1 = new wxStaticText( this, wxID_ANY, _("FreeRouting.net URL"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText1->Wrap( -1 );
bRightButtonsSizer->Add( m_staticText1, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
m_FreerouteURLName = new wxTextCtrl( this, wxID_TEXT_URL, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
m_FreerouteURLName->SetToolTip( _("The URL of the FreeRouting.net website") );
bRightButtonsSizer->Add( m_FreerouteURLName, 0, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
m_buttonHelp = new wxButton( this, wxID_BUTTON_HELP, _("Help"), wxDefaultPosition, wxDefaultSize, 0 );
bRightButtonsSizer->Add( m_buttonHelp, 0, wxALL|wxEXPAND, 5 );
bRightSubSizer->Add( bRightButtonsSizer, 1, wxEXPAND, 5 );
bRightSizer->Add( bRightSubSizer, 1, wxEXPAND, 5 );
bUpperSizer->Add( bRightSizer, 1, wxALIGN_TOP|wxALL|wxEXPAND, 5 );
bMainSizer->Add( bUpperSizer, 1, wxEXPAND, 5 );
m_staticline1 = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL );
bMainSizer->Add( m_staticline1, 0, wxEXPAND|wxALL, 5 );
m_sdbSizer1 = new wxStdDialogButtonSizer();
m_sdbSizer1OK = new wxButton( this, wxID_OK );
m_sdbSizer1->AddButton( m_sdbSizer1OK );
m_sdbSizer1Cancel = new wxButton( this, wxID_CANCEL );
m_sdbSizer1->AddButton( m_sdbSizer1Cancel );
m_sdbSizer1->Realize();
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_sdbSizerHelp = new wxButton( this, wxID_HELP );
m_sdbSizer->AddButton( m_sdbSizerHelp );
m_sdbSizer->Realize();
bMainSizer->Add( m_sdbSizer1, 0, wxEXPAND|wxALL, 5 );
bMainSizer->Add( m_sdbSizer, 0, wxEXPAND|wxALL, 5 );
this->SetSizer( bMainSizer );
......@@ -130,11 +87,9 @@ DIALOG_FREEROUTE_BASE::DIALOG_FREEROUTE_BASE( wxWindow* parent, wxWindowID id, c
m_ExportDSN->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_FREEROUTE_BASE::OnExportButtonClick ), NULL, this );
m_buttonLaunchFreeroute->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_FREEROUTE_BASE::OnLaunchButtonClick ), NULL, this );
m_buttonImport->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_FREEROUTE_BASE::OnImportButtonClick ), NULL, this );
m_buttonVisit->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_FREEROUTE_BASE::OnVisitButtonClick ), NULL, this );
m_FreerouteURLName->Connect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( DIALOG_FREEROUTE_BASE::OnTextEditFrUrlUpdated ), NULL, this );
m_buttonHelp->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_FREEROUTE_BASE::OnHelpButtonClick ), NULL, this );
m_sdbSizer1Cancel->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_FREEROUTE_BASE::OnCancelButtonClick ), NULL, this );
m_sdbSizer1OK->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_FREEROUTE_BASE::OnOKButtonClick ), NULL, this );
m_sdbSizerCancel->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_FREEROUTE_BASE::OnCancelButtonClick ), NULL, this );
m_sdbSizerHelp->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_FREEROUTE_BASE::OnHelpButtonClick ), NULL, this );
m_sdbSizerOK->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_FREEROUTE_BASE::OnOKButtonClick ), NULL, this );
}
DIALOG_FREEROUTE_BASE::~DIALOG_FREEROUTE_BASE()
......@@ -143,10 +98,8 @@ DIALOG_FREEROUTE_BASE::~DIALOG_FREEROUTE_BASE()
m_ExportDSN->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_FREEROUTE_BASE::OnExportButtonClick ), NULL, this );
m_buttonLaunchFreeroute->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_FREEROUTE_BASE::OnLaunchButtonClick ), NULL, this );
m_buttonImport->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_FREEROUTE_BASE::OnImportButtonClick ), NULL, this );
m_buttonVisit->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_FREEROUTE_BASE::OnVisitButtonClick ), NULL, this );
m_FreerouteURLName->Disconnect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( DIALOG_FREEROUTE_BASE::OnTextEditFrUrlUpdated ), NULL, this );
m_buttonHelp->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_FREEROUTE_BASE::OnHelpButtonClick ), NULL, this );
m_sdbSizer1Cancel->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_FREEROUTE_BASE::OnCancelButtonClick ), NULL, this );
m_sdbSizer1OK->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_FREEROUTE_BASE::OnOKButtonClick ), NULL, this );
m_sdbSizerCancel->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_FREEROUTE_BASE::OnCancelButtonClick ), NULL, this );
m_sdbSizerHelp->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_FREEROUTE_BASE::OnHelpButtonClick ), NULL, this );
m_sdbSizerOK->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_FREEROUTE_BASE::OnOKButtonClick ), NULL, this );
}
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<wxFormBuilder_Project>
<FileVersion major="1" minor="11" />
<FileVersion major="1" minor="13" />
<object class="Project" expanded="1">
<property name="class_decoration"></property>
<property name="code_generation">C++</property>
......@@ -20,8 +20,10 @@
<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">
......@@ -341,7 +343,7 @@
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_BUTTON_LAUNCH</property>
<property name="label">Launch FreeRouter via Java Web Start</property>
<property name="label">Launch FreeRouter and Launch FreeRouter</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
......@@ -490,563 +492,6 @@
</object>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxALL|wxEXPAND</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_staticline2</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_VERTICAL</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_TOP|wxALL|wxEXPAND</property>
<property name="proportion">1</property>
<object class="wxBoxSizer" expanded="1">
<property name="minimum_size"></property>
<property name="name">bRightSizer</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</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">FreeRoute Info:</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_staticText3</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</property>
<property name="proportion">1</property>
<object class="wxBoxSizer" expanded="1">
<property name="minimum_size"></property>
<property name="name">bRightSubSizer</property>
<property name="orient">wxHORIZONTAL</property>
<property name="permission">none</property>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag"></property>
<property name="proportion">0</property>
<object class="spacer" expanded="1">
<property name="height">20</property>
<property name="permission">protected</property>
<property name="width">20</property>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxEXPAND</property>
<property name="proportion">1</property>
<object class="wxBoxSizer" expanded="1">
<property name="minimum_size"></property>
<property name="name">bRightButtonsSizer</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|wxEXPAND</property>
<property name="proportion">0</property>
<object class="wxButton" 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">0</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_BUTTON_VISIT</property>
<property name="label">Visit the FreeRouting.net Website with your Browser</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_buttonVisit</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="validator_data_type"></property>
<property name="validator_style">wxFILTER_NONE</property>
<property name="validator_type">wxDefaultValidator</property>
<property name="validator_variable"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnButtonClick">OnVisitButtonClick</event>
<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">wxTOP|wxRIGHT|wxLEFT</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"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">FreeRouting.net URL</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_staticText1</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|wxBOTTOM|wxRIGHT|wxLEFT</property>
<property name="proportion">0</property>
<object class="wxTextCtrl" 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_TEXT_URL</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="maxlength">0</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_FreerouteURLName</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">The URL of the FreeRouting.net website</property>
<property name="validator_data_type"></property>
<property name="validator_style">wxFILTER_NONE</property>
<property name="validator_type">wxDefaultValidator</property>
<property name="validator_variable"></property>
<property name="value"></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="OnText">OnTextEditFrUrlUpdated</event>
<event name="OnTextEnter"></event>
<event name="OnTextMaxLen"></event>
<event name="OnTextURL"></event>
<event name="OnUpdateUI"></event>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxALL|wxEXPAND</property>
<property name="proportion">0</property>
<object class="wxButton" 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">0</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_BUTTON_HELP</property>
<property name="label">Help</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_buttonHelp</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="validator_data_type"></property>
<property name="validator_style">wxFILTER_NONE</property>
<property name="validator_type">wxDefaultValidator</property>
<property name="validator_variable"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnButtonClick">OnHelpButtonClick</event>
<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>
</object>
</object>
</object>
</object>
</object>
</object>
</object>
<object class="sizeritem" expanded="1">
......@@ -1138,18 +583,18 @@
<property name="Apply">0</property>
<property name="Cancel">1</property>
<property name="ContextHelp">0</property>
<property name="Help">0</property>
<property name="Help">1</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_sdbSizer1</property>
<property name="name">m_sdbSizer</property>
<property name="permission">protected</property>
<event name="OnApplyButtonClick"></event>
<event name="OnCancelButtonClick">OnCancelButtonClick</event>
<event name="OnContextHelpButtonClick"></event>
<event name="OnHelpButtonClick"></event>
<event name="OnHelpButtonClick">OnHelpButtonClick</event>
<event name="OnNoButtonClick"></event>
<event name="OnOKButtonClick">OnOKButtonClick</event>
<event name="OnSaveButtonClick"></event>
......
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Apr 10 2012)
// C++ code generated with wxFormBuilder (version Jun 5 2014)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!
......@@ -11,6 +11,8 @@
#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>
......@@ -21,7 +23,6 @@
#include <wx/button.h>
#include <wx/sizer.h>
#include <wx/statline.h>
#include <wx/textctrl.h>
#include <wx/dialog.h>
///////////////////////////////////////////////////////////////////////////
......@@ -29,9 +30,6 @@
#define ID_BUTTON_EXPORT_DSN 1000
#define wxID_BUTTON_LAUNCH 1001
#define wxID_BUTTON_IMPORT 1002
#define wxID_BUTTON_VISIT 1003
#define wxID_TEXT_URL 1004
#define wxID_BUTTON_HELP 1005
///////////////////////////////////////////////////////////////////////////////
/// Class DIALOG_FREEROUTE_BASE
......@@ -45,25 +43,18 @@ class DIALOG_FREEROUTE_BASE : public DIALOG_SHIM
wxButton* m_ExportDSN;
wxButton* m_buttonLaunchFreeroute;
wxButton* m_buttonImport;
wxStaticLine* m_staticline2;
wxStaticText* m_staticText3;
wxButton* m_buttonVisit;
wxStaticText* m_staticText1;
wxTextCtrl* m_FreerouteURLName;
wxButton* m_buttonHelp;
wxStaticLine* m_staticline1;
wxStdDialogButtonSizer* m_sdbSizer1;
wxButton* m_sdbSizer1OK;
wxButton* m_sdbSizer1Cancel;
wxStdDialogButtonSizer* m_sdbSizer;
wxButton* m_sdbSizerOK;
wxButton* m_sdbSizerCancel;
wxButton* m_sdbSizerHelp;
// Virtual event handlers, overide them in your derived class
virtual void OnExportButtonClick( wxCommandEvent& event ) { event.Skip(); }
virtual void OnLaunchButtonClick( wxCommandEvent& event ) { event.Skip(); }
virtual void OnImportButtonClick( wxCommandEvent& event ) { event.Skip(); }
virtual void OnVisitButtonClick( wxCommandEvent& event ) { event.Skip(); }
virtual void OnTextEditFrUrlUpdated( wxCommandEvent& event ) { event.Skip(); }
virtual void OnHelpButtonClick( wxCommandEvent& event ) { event.Skip(); }
virtual void OnCancelButtonClick( wxCommandEvent& event ) { event.Skip(); }
virtual void OnHelpButtonClick( wxCommandEvent& event ) { event.Skip(); }
virtual void OnOKButtonClick( wxCommandEvent& event ) { event.Skip(); }
......
///////////////////////////////////////////////////////////////////////////
// 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 folde.\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 );
bSizerMain->Add( m_dirCtrl, 1, wxEXPAND | wxALL, 5 );
m_staticline1 = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL );
bSizerMain->Add( m_staticline1, 0, wxEXPAND | wxALL, 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, 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 );
}
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 );
}
<?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,300</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 folde.&#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"></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 | wxALL</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_staticline1</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</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"></event>
<event name="OnContextHelpButtonClick"></event>
<event name="OnHelpButtonClick"></event>
<event name="OnNoButtonClick"></event>
<event name="OnOKButtonClick"></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_staticline1;
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(); }
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,300 ), 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) 2014 Jean-Pierre Charras, jp.charras at wanadoo.fr
* 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
*/
/** @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.
*/
#include <wx/wx.h>
#include <wx/url.h>
#include <pgm_base.h>
#include <kiface_i.h>
#include <dialog_helpers.h>
#include <project.h> // For PROJECT_VAR_NAME definition
#include <io_mgr.h>
#include <wizard_add_fplib.h>
// a key to store the default Kicad Github libs URL
#define KICAD_FPLIBS_URL_KEY wxT( "kicad_fplib_url" )
// 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" )
// 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;
WIZARD_FPLIB_TABLE::WIZARD_FPLIB_TABLE( wxWindow* aParent, wxArrayString& aEnvVariableList )
: WIZARD_FPLIB_TABLE_BASE( aParent )
{
initDlg( aEnvVariableList );
// Allows github plugin selection only when the plugin is compiled:
#ifndef BUILD_GITHUB_PLUGIN
m_rbFpLibFormat->Enable( GITHUB_PLUGIN, false );
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 );
// Gives a minimal size to the dialog, which allows displaying any page
wxSize minsize;
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 );
}
SetMinSize( minsize );
SetPageSize( minsize );
GetSizer()->SetSizeHints( this );
Center();
}
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();
// 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() );
m_last_plugin_choice = m_rbFpLibFormat->GetSelection();
m_last_defaultpath_choice = m_rbPathManagement->GetSelection();
cfg->Write( WIZARD_LAST_PLUGIN_KEY, m_last_plugin_choice );
cfg->Write( WIZARD_LAST_PATHOPTION_KEY, m_last_defaultpath_choice );
}
void WIZARD_FPLIB_TABLE::initDlg( wxArrayString& aEnvVariableList )
{
m_currLibDescr = NULL;
SetBitmap( KiBitmap( wizard_add_fplib_icon_xpm ) );
wxString msg;
wxConfigBase* cfg = Pgm().CommonSettings();
cfg->Read( KICAD_FPLIBS_URL_KEY, &msg );
cfg->Read( WIZARD_LAST_PLUGIN_KEY, &m_last_plugin_choice );
cfg->Read( WIZARD_LAST_PATHOPTION_KEY, &m_last_defaultpath_choice );
if( msg.IsEmpty() )
m_textCtrlGithubURL->SetValue( wxT( "http://github.com/KiCad/" ) );
else
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 )
{
// 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") );
}
m_rowPrjEnvVarPosition = 0;
m_predefinedEnvVarCnt = aEnvVariableList.GetCount();
for( int row = 0; row < m_predefinedEnvVarCnt; row++ )
{
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 );
}
m_gridEnvironmentVariablesList->Fit();
m_buttonRemoveEV->Enable( GetEnvVarCount() > m_predefinedEnvVarCnt );
m_gridEnvironmentVariablesList->AutoSizeColumns();
m_rbFpLibFormat->SetSelection( m_last_plugin_choice );
m_rbPathManagement->SetSelection( m_last_defaultpath_choice );
wxCommandEvent event;
updateFromPlugingChoice();
OnPathManagementSelection( event );
}
int WIZARD_FPLIB_TABLE::HasGithubEnvVarCompatible()
{
// Return true if at least one env var defines a url relative to github
for( int row = 0; row < GetEnvVarCount(); row++ )
{
if( m_gridEnvironmentVariablesList->GetCellValue(
wxGridCellCoords( row, 1 ) ).Lower().StartsWith( "http" ) )
return row;
}
return -1;
}
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( GetSelectedEnvVarValue().IsEmpty() )
{
// 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;
}
}
else
{
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;
}
}
}
// Other conficts: TODO
return true;
}
void WIZARD_FPLIB_TABLE::OnPluginSelection( wxCommandEvent& event )
{
updateFromPlugingChoice();
}
void WIZARD_FPLIB_TABLE::updateFromPlugingChoice()
{
// update dialog options and widgets depending on a plugin choice
// Project path has no sense for GITHUB_PLUGIN
bool enablePrjPathOpt = not IsGithubPlugin();
// Project path cannot be used if unknown
if( m_gridEnvironmentVariablesList->GetCellValue(
wxGridCellCoords( m_rowPrjEnvVarPosition, 1 ) ).IsEmpty() )
enablePrjPathOpt = false;
m_rbPathManagement->Enable( PROJECT_PATH, enablePrjPathOpt );
// Sometimes only the choice "absolute path" is allowed;
// Force this choice, at least make it the default choice
bool force_absolute_path = false;
// For github plugin, the project path is not allowed
if( ( m_rbPathManagement->GetSelection() == PROJECT_PATH ) && !enablePrjPathOpt )
force_absolute_path = true;
// 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 );
}
if( force_absolute_path )
m_rbPathManagement->SetSelection( ABSOLUTE_PATH );
}
void WIZARD_FPLIB_TABLE::OnPathManagementSelection( wxCommandEvent& event )
{
// Disable irrevant options, and enable others.
int row_count = GetEnvVarCount();
switch( m_rbPathManagement->GetSelection() )
{
case PROJECT_PATH: // Choice = path relative to the project
m_gridEnvironmentVariablesList->Enable( true );
m_buttonAddEV->Enable( false );
m_gridEnvironmentVariablesList->ShowRow( PROJECT_PATH );
for( int row = 0; row < row_count; row++ )
{
if( row == PROJECT_PATH )
continue;
m_gridEnvironmentVariablesList->HideRow( row );
}
break;
case ENV_VAR_PATH: // Choice = path relative to env var
m_gridEnvironmentVariablesList->Enable( true );
m_buttonAddEV->Enable( true );
for( int row = 0; row < row_count; row++ )
m_gridEnvironmentVariablesList->ShowRow( row );
break;
case ABSOLUTE_PATH: // Choice = path relative to the project
m_gridEnvironmentVariablesList->Enable( false );
m_buttonAddEV->Enable( false );
break;
}
}
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 );
}
void WIZARD_FPLIB_TABLE::OnRemoveEVariable( wxCommandEvent& event )
{
wxArrayInt selectedRows = m_gridEnvironmentVariablesList->GetSelectedRows();
int row_cursor = m_gridEnvironmentVariablesList->GetGridCursorRow();
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-- )
{
int row = selectedRows[ii];
// don't remove them env var. which are already existing in lib table
if( row > m_predefinedEnvVarCnt-1 )
m_gridEnvironmentVariablesList->DeleteRows( row, 1 );
}
m_gridEnvironmentVariablesList->SelectRow( m_gridEnvironmentVariablesList->GetGridCursorRow() );
m_buttonRemoveEV->Enable( GetEnvVarCount() > m_predefinedEnvVarCnt );
}
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 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;
}
return envVar;
}
wxString WIZARD_FPLIB_TABLE::GetSelectedEnvVarValue()
{
wxString envVarValue;
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 tp env var
envVarValue = m_gridEnvironmentVariablesList->GetCellValue(
wxGridCellCoords( row, 1 ) );
break;
case PROJECT_PATH: // Choice = path relative to the project
envVarValue = m_gridEnvironmentVariablesList->GetCellValue(
wxGridCellCoords( m_rowPrjEnvVarPosition, 1 ) );
break;
case ABSOLUTE_PATH: // Choice = absolute path
default:
break;
}
return envVarValue;
}
void WIZARD_FPLIB_TABLE::OnPageChanged( wxWizardEvent& event )
{
if( GetCurrentPage() == m_pages[2] )
setLastPage();
else if( GetCurrentPage() == m_pages[1] )
setSecondPage();
}
void WIZARD_FPLIB_TABLE::OnPageChanging( wxWizardEvent& event )
{
if( !( GetCurrentPage() == m_pages[1] && event.GetDirection() ) )
return;
if( ! ValidateOptions() )
{
event.Veto();
return;
}
if( ( m_rbPathManagement->GetSelection() != ABSOLUTE_PATH ) &&
( IsGithubPlugin() ) )
{
wxURI uri( GetSelectedEnvVarValue() );
// 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();
if( badurl )
{
wxMessageBox( wxString::Format(
_("The URL defined by env var \"%s\" is an incorrect URL.\nCannot use it"),
GetChars( GetSelectedEnvVar() ) ) );
event.Veto();
}
}
}
bool WIZARD_FPLIB_TABLE::setSecondPage()
{
// Init parameters for the second wizard page: this is only
// the current library description.
updateFromPlugingChoice();
delete m_currLibDescr;
m_currLibDescr = NULL;
switch( m_rbFpLibFormat->GetSelection() )
{
case 0: // Kicad lib type
m_currLibDescr = new LIB_DESCR_KICAD;
break;
case 1: // Github lib type
m_currLibDescr = new LIB_DESCR_GITHUB;
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;
}
return m_currLibDescr!= NULL;
}
bool WIZARD_FPLIB_TABLE::setLastPage() // Init prms for the last wizard page
{
// Update texts in last wizard page
m_textPluginType->SetLabel( m_rbFpLibFormat->GetStringSelection() );
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() ) );
m_textPath->SetLabel( GetSelectedEnvVarValue() );
break;
case ABSOLUTE_PATH: // Choice = absolute path
m_currLibDescr->m_IsAbsolutePath = true;
m_textOption->SetLabel( m_rbPathManagement->GetStringSelection() );
if( IsGithubPlugin() )
m_textPath->SetLabel( _("Full URL") );
else
m_textPath->SetLabel( _("Full filename") );
break;
}
return true;
}
void WIZARD_FPLIB_TABLE::OnAddFpLibs( wxCommandEvent& event )
{
if( m_currLibDescr->m_IsFile )
selectLibsFiles();
else if( m_currLibDescr->m_IsGitHub )
selectLibsGithub();
else
selectLibsFolders();
m_gridFpListLibs->SetGridCursor( GetLibsCount()-1, 0 );
m_gridFpListLibs->SelectRow( GetLibsCount()-1 );
}
void WIZARD_FPLIB_TABLE::selectLibsFiles() // select a set of library files
{
wxString msk = wxT("*.") + m_currLibDescr->m_Ext;
wxFileDialog dlg( this, _("Select Library Files"), m_currLibDescr->m_DefaultPath,
wxEmptyString, msk,
wxFD_DEFAULT_STYLE|wxFD_FILE_MUST_EXIST|wxFD_MULTIPLE );
dlg.ShowModal();
wxArrayString filepaths;
dlg.GetPaths( filepaths );
// Create the nickname: currently make it from the filename
wxArrayString nicknames;
wxFileName fn;
for( unsigned ii = 0; ii < filepaths.GetCount(); ii++ )
{
fn = filepaths[ii];
nicknames.Add( fn.GetName() );
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
}
populateLibList( nicknames, filepaths, m_currLibDescr->m_PluginName );
m_gridFpListLibs->AutoSizeColumns();
}
void WIZARD_FPLIB_TABLE::populateLibList( const wxArrayString& aNickNames,
const wxArrayString& aPaths,
const wxString& aPluginName )
{
if( aPaths.GetCount() <= 0 )
return;
// Ensure there is room for selected libs
int first_row = m_gridFpListLibs->GetTable()->GetRowsCount();
m_gridFpListLibs->AppendRows( aPaths.GetCount() );
// 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();
}
// A helper dialog to show and select a set of directories
class DIALOG_SELECT_DIRLIST : public DIALOG_SELECT_DIRLIST_BASE
{
public:
DIALOG_SELECT_DIRLIST( wxWindow* parent,
const wxString& aDefaultPath ):
DIALOG_SELECT_DIRLIST_BASE( parent, wxID_ANY )
{
if( !aDefaultPath.IsEmpty() )
m_dirCtrl->SetPath( aDefaultPath );
}
~DIALOG_SELECT_DIRLIST() {};
void GetPaths( wxArrayString& aPaths ) { m_dirCtrl->GetPaths( aPaths ); }
};
void WIZARD_FPLIB_TABLE::selectLibsFolders() // select a set of library folders
{
DIALOG_SELECT_DIRLIST dlg( this, m_currLibDescr->m_DefaultPath );
if( dlg.ShowModal() != wxID_OK )
return;
wxArrayString filepaths;
dlg.GetPaths( filepaths );
// Create the nickname: currently make it from the filename
wxArrayString nicknames;
wxFileName fn;
for( unsigned ii = 0; ii < filepaths.GetCount(); ii++ )
{
fn = filepaths[ii];
nicknames.Add( fn.GetName() );
fn.AssignDir( filepaths[ii] );
if( m_currLibDescr->m_IsAbsolutePath || m_currLibDescr->m_DefaultPath.IsEmpty() )
{
filepaths[ii] = fn.GetFullPath();
}
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();
}
populateLibList( nicknames, filepaths, m_currLibDescr->m_PluginName );
}
#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::selectLibsGithub() // select a set of library on Github
{
// 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 depos
wxString defaultURL = m_currLibDescr->m_DefaultPath;
if( defaultURL.IsEmpty() )
defaultURL = wxT( "https://github.com/KiCad" );
#ifdef KICAD_USE_WEBKIT
RunWebViewer( this, defaultURL, &urls );
#else
urls.Add( defaultURL + wxT("newlibname.pretty") );
#endif
// Create the nickname: currently make it from the url
wxArrayString filepaths;
wxArrayString nicknames;
for( unsigned ii = 0; ii < urls.GetCount(); ii++ )
{
wxString urlstring( urls[ii] );
wxURI uri( urlstring );
// 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( m_currLibDescr->m_IsAbsolutePath ||
m_currLibDescr->m_DefaultPath.IsEmpty() )
{
filepaths.Add( urls[ii] ); // use the full URL
}
else
{
wxString shortURI;
if( urls[ii].Lower().StartsWith(
m_currLibDescr->m_DefaultPath.Lower(), &shortURI ) )
{
shortURI.Prepend( wxT("${") + m_currLibDescr->m_EnvVarName + wxT("}") );
filepaths.Add( shortURI );
}
else // keep the full URL
filepaths.Add( urls[ii] ); // use the full URL
}
}
populateLibList( nicknames, filepaths, m_currLibDescr->m_PluginName );
}
void WIZARD_FPLIB_TABLE::OnRemoveFpLibs( wxCommandEvent& event )
{
wxArrayInt selectedRows = m_gridFpListLibs->GetSelectedRows();
int row_cursor = m_gridFpListLibs->GetGridCursorRow();
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-- )
{
int row = selectedRows[ii];
m_gridFpListLibs->DeleteRows( row, 1 );
}
m_gridFpListLibs->SelectRow( m_gridFpListLibs->GetGridCursorRow() );
}
/**
* @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.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, you may find one here:
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
* or you may search the http://www.gnu.org website for the version 2 license,
* or you may write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include <wx/wx.h>
#include <dialog_helpers.h>
#include <wizard_add_fplib_base.h>
// 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 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();
/**
* 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
*/
bool GetLibDescr( int aIdx, wxArrayString& aLibDescr )
{
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;
}
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
void selectLibsGithub(); // select a set of library on Github
void updateFromPlugingChoice(); // update dialog options and widgets
// depending on the plugin choice
int GetEnvVarCount() // Get the number of rows in env var table
{
return m_gridEnvironmentVariablesList->GetTable()->GetRowsCount();
}
int GetLibsCount() // Get the number of rows in libs table
{
return m_gridFpListLibs->GetTable()->GetRowsCount();
}
bool IsGithubPlugin() // Helper funct, return true if
{ // the Github plugin is the choice
return m_rbFpLibFormat->GetSelection() == GITHUB_PLUGIN;
}
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 );
bool ValidateOptions();
};
// 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;
}
};
class LIB_DESCR_GITHUB: public LIB_DESCR
{
public:
LIB_DESCR_GITHUB(): LIB_DESCR()
{
m_PluginName = IO_MGR::ShowType( IO_MGR::GITHUB );
m_Ext = wxT("pretty");
m_IsFile = false;
m_IsGitHub = true;
}
};
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");
}
};
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;
}
};
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;
}
};
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Jun 5 2014)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!
///////////////////////////////////////////////////////////////////////////
#include "wizard_add_fplib_base.h"
///////////////////////////////////////////////////////////////////////////
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 );
wxWizardPageSimple* m_wizPage1 = new wxWizardPageSimple( this );
m_pages.Add( m_wizPage1 );
m_wizPage1->SetMinSize( wxSize( 500,-1 ) );
wxBoxSizer* bSizerPage1;
bSizerPage1 = new wxBoxSizer( wxVERTICAL );
wxString m_rbFpLibFormatChoices[] = { _("KiCad (*.Pretty folder containing .kicad_mod files)"), _("GitHub (.Pretty lib stored on GitHub depos)"), _("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 );
m_staticline2 = new wxStaticLine( m_wizPage1, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL );
bSizerPage1->Add( m_staticline2, 0, wxEXPAND | wxALL, 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 );
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_textCtrlGithubURL = new wxTextCtrl( m_wizPage1, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
bSizerPage1->Add( m_textCtrlGithubURL, 0, wxALL|wxEXPAND, 5 );
m_wizPage1->SetSizer( bSizerPage1 );
m_wizPage1->Layout();
bSizerPage1->Fit( m_wizPage1 );
wxWizardPageSimple* m_wizPage2 = new wxWizardPageSimple( this );
m_pages.Add( m_wizPage2 );
m_wizPage2->SetMinSize( wxSize( 450,-1 ) );
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 );
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 );
m_gridEnvironmentVariablesList = new wxGrid( m_wizPage2, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0 );
// Grid
m_gridEnvironmentVariablesList->CreateGrid( 3, 2 );
m_gridEnvironmentVariablesList->EnableEditing( true );
m_gridEnvironmentVariablesList->EnableGridLines( true );
m_gridEnvironmentVariablesList->EnableDragGridSize( false );
m_gridEnvironmentVariablesList->SetMargins( 0, 0 );
// 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 );
// Rows
m_gridEnvironmentVariablesList->AutoSizeRows();
m_gridEnvironmentVariablesList->EnableDragRowSize( false );
m_gridEnvironmentVariablesList->SetRowLabelSize( 40 );
m_gridEnvironmentVariablesList->SetRowLabelAlignment( wxALIGN_CENTRE, wxALIGN_CENTRE );
// Label Appearance
// Cell Defaults
m_gridEnvironmentVariablesList->SetDefaultCellAlignment( wxALIGN_LEFT, wxALIGN_TOP );
bSizerPage2->Add( m_gridEnvironmentVariablesList, 1, wxALL|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_buttonRemoveEV = new wxButton( m_wizPage2, wxID_ANY, _("Remove Environment Variable"), wxDefaultPosition, wxDefaultSize, 0 );
bSizerButs->Add( m_buttonRemoveEV, 0, wxALL, 5 );
bSizerPage2->Add( bSizerButs, 0, wxALIGN_CENTER_HORIZONTAL, 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 ) );
wxBoxSizer* bSizerPage3;
bSizerPage3 = new wxBoxSizer( wxVERTICAL );
wxStaticBoxSizer* sbSizer1;
sbSizer1 = new wxStaticBoxSizer( new wxStaticBox( m_wizPage3, wxID_ANY, _("Options") ), wxVERTICAL );
wxFlexGridSizer* fgSizer1;
fgSizer1 = new wxFlexGridSizer( 0, 2, 0, 0 );
fgSizer1->AddGrowableCol( 1 );
fgSizer1->SetFlexibleDirection( wxBOTH );
fgSizer1->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
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_textPluginType = new wxStaticText( m_wizPage3, wxID_ANY, _("KiCad"), wxDefaultPosition, wxDefaultSize, 0 );
m_textPluginType->Wrap( -1 );
fgSizer1->Add( m_textPluginType, 1, 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_stPathTitle = new wxStaticText( m_wizPage3, wxID_ANY, _("Path:"), wxDefaultPosition, wxDefaultSize, 0 );
m_stPathTitle->Wrap( -1 );
fgSizer1->Add( m_stPathTitle, 0, wxBOTTOM|wxRIGHT|wxLEFT, 5 );
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 );
sbSizer1->Add( fgSizer1, 0, wxEXPAND, 5 );
bSizerPage3->Add( sbSizer1, 0, wxEXPAND|wxBOTTOM, 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 );
m_gridFpListLibs = new wxGrid( m_wizPage3, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0 );
// 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 );
// Rows
m_gridFpListLibs->EnableDragRowSize( true );
m_gridFpListLibs->SetRowLabelSize( 30 );
m_gridFpListLibs->SetRowLabelAlignment( wxALIGN_CENTRE, wxALIGN_CENTRE );
// Label Appearance
// Cell Defaults
m_gridFpListLibs->SetDefaultCellAlignment( wxALIGN_LEFT, wxALIGN_TOP );
bSizer6->Add( m_gridFpListLibs, 1, wxALL|wxEXPAND, 5 );
bSizerPage3->Add( bSizer6, 1, wxEXPAND, 5 );
wxBoxSizer* bSizer5;
bSizer5 = new wxBoxSizer( wxHORIZONTAL );
m_buttonAddLib = new wxButton( m_wizPage3, wxID_ANY, _("Add FP Libraries"), wxDefaultPosition, wxDefaultSize, 0 );
bSizer5->Add( m_buttonAddLib, 0, wxALL, 5 );
m_buttonRemoveLib = new wxButton( m_wizPage3, wxID_ANY, _("Remove FP Libraries"), wxDefaultPosition, wxDefaultSize, 0 );
bSizer5->Add( m_buttonRemoveLib, 0, wxALL, 5 );
bSizerPage3->Add( bSizer5, 0, wxALIGN_CENTER_HORIZONTAL, 5 );
m_wizPage3->SetSizer( bSizerPage3 );
m_wizPage3->Layout();
bSizerPage3->Fit( m_wizPage3 );
this->Centre( wxBOTH );
for ( unsigned int i = 1; i < m_pages.GetCount(); i++ )
{
m_pages.Item( i )->SetPrev( m_pages.Item( i - 1 ) );
m_pages.Item( i - 1 )->SetNext( m_pages.Item( i ) );
}
// Connect Events
this->Connect( wxID_ANY, wxEVT_WIZARD_FINISHED, wxWizardEventHandler( WIZARD_FPLIB_TABLE_BASE::OnFinish ) );
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_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 );
}
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_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_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_pages.Clear();
}
DIALOG_SELECT_DIRLIST_BASE::DIALOG_SELECT_DIRLIST_BASE( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : wxDialog( parent, id, title, pos, size, style )
{
this->SetSizeHints( wxDefaultSize, wxDefaultSize );
wxBoxSizer* bSizerMain;
bSizerMain = new wxBoxSizer( wxVERTICAL );
m_staticTextInfo = new wxStaticText( this, wxID_ANY, _("The footprint library is a folder.\nFootprints are files inside this folder."), wxDefaultPosition, wxDefaultSize, wxALIGN_CENTRE );
m_staticTextInfo->Wrap( -1 );
m_staticTextInfo->SetFont( wxFont( wxNORMAL_FONT->GetPointSize(), 70, 90, 92, false, wxEmptyString ) );
bSizerMain->Add( m_staticTextInfo, 0, wxALL|wxALIGN_CENTER_HORIZONTAL, 5 );
m_dirCtrl = new wxGenericDirCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxDIRCTRL_3D_INTERNAL|wxDIRCTRL_DIR_ONLY|wxDIRCTRL_MULTIPLE|wxSUNKEN_BORDER, wxEmptyString, 0 );
m_dirCtrl->ShowHidden( false );
bSizerMain->Add( m_dirCtrl, 1, wxEXPAND | wxALL, 5 );
m_staticline1 = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL );
bSizerMain->Add( m_staticline1, 0, wxEXPAND | wxALL, 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, wxEXPAND, 5 );
this->SetSizer( bSizerMain );
this->Layout();
this->Centre( wxBOTH );
// Connect Events
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_sdbSizerCancel->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_SELECT_DIRLIST_BASE::OnCancelClick ), NULL, this );
m_sdbSizerOK->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_SELECT_DIRLIST_BASE::OnOKClick ), NULL, this );
}
This 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)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!
///////////////////////////////////////////////////////////////////////////
#ifndef __WIZARD_ADD_FPLIB_BASE_H__
#define __WIZARD_ADD_FPLIB_BASE_H__
#include <wx/artprov.h>
#include <wx/xrc/xmlres.h>
#include <wx/intl.h>
#include <wx/string.h>
#include <wx/radiobox.h>
#include <wx/gdicmn.h>
#include <wx/font.h>
#include <wx/colour.h>
#include <wx/settings.h>
#include <wx/statline.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/wizard.h>
#include <wx/dynarray.h>
WX_DEFINE_ARRAY_PTR( wxWizardPageSimple*, WizardPages );
#include <wx/dirctrl.h>
#include <wx/dialog.h>
///////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
/// Class WIZARD_FPLIB_TABLE_BASE
///////////////////////////////////////////////////////////////////////////////
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_buttonAddLib;
wxButton* m_buttonRemoveLib;
// Virtual event handlers, overide them in your derived class
virtual void OnFinish( 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 OnAddFpLibs( wxCommandEvent& event ) { event.Skip(); }
virtual void OnRemoveFpLibs( 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 );
WizardPages m_pages;
~WIZARD_FPLIB_TABLE_BASE();
};
///////////////////////////////////////////////////////////////////////////////
/// Class DIALOG_SELECT_DIRLIST_BASE
///////////////////////////////////////////////////////////////////////////////
class DIALOG_SELECT_DIRLIST_BASE : public wxDialog
{
private:
protected:
wxStaticText* m_staticTextInfo;
wxGenericDirCtrl* m_dirCtrl;
wxStaticLine* m_staticline1;
wxStdDialogButtonSizer* m_sdbSizer;
wxButton* m_sdbSizerOK;
wxButton* m_sdbSizerCancel;
// Virtual event handlers, overide them in your derived class
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( 346,325 ), long style = wxDEFAULT_DIALOG_STYLE );
~DIALOG_SELECT_DIRLIST_BASE();
};
#endif //__WIZARD_ADD_FPLIB_BASE_H__
......@@ -76,6 +76,10 @@ static void idf_export_outline( BOARD* aPcb, IDF3_BOARD& aIDFBoard )
{
case S_SEGMENT:
{
if( ( graphic->GetStart().x == graphic->GetEnd().x )
&& ( graphic->GetStart().y == graphic->GetEnd().y ) )
break;
sp.x = graphic->GetStart().x * scale + offX;
sp.y = -graphic->GetStart().y * scale + offY;
ep.x = graphic->GetEnd().x * scale + offX;
......@@ -89,6 +93,10 @@ static void idf_export_outline( BOARD* aPcb, IDF3_BOARD& aIDFBoard )
case S_ARC:
{
if( ( graphic->GetCenter().x == graphic->GetArcStart().x )
&& ( graphic->GetCenter().y == graphic->GetArcStart().y ) )
break;
sp.x = graphic->GetCenter().x * scale + offX;
sp.y = -graphic->GetCenter().y * scale + offY;
ep.x = graphic->GetArcStart().x * scale + offX;
......@@ -102,6 +110,9 @@ static void idf_export_outline( BOARD* aPcb, IDF3_BOARD& aIDFBoard )
case S_CIRCLE:
{
if( graphic->GetRadius() == 0 )
break;
sp.x = graphic->GetCenter().x * scale + offX;
sp.y = -graphic->GetCenter().y * scale + offY;
ep.x = sp.x - graphic->GetRadius() * scale;
......
......@@ -36,6 +36,7 @@
#include <confirm.h>
#include <gestfich.h>
#include <xnode.h>
#include <common.h>
#include <macros.h>
#include <wxPcbStruct.h>
#include <class_board_design_settings.h>
......@@ -268,7 +269,17 @@ bool PCB_EDIT_FRAME::LoadProjectSettings()
// BASE_SCREEN::m_PageLayoutDescrFileName, read in config project file
// If empty, the default descr is loaded
WORKSHEET_LAYOUT& pglayout = WORKSHEET_LAYOUT::GetTheInstance();
pglayout.SetPageLayout( BASE_SCREEN::m_PageLayoutDescrFileName );
wxString pg_fullfilename = ExpandEnvVarSubstitutions(
BASE_SCREEN::m_PageLayoutDescrFileName );
if( !pg_fullfilename.IsEmpty() )
{
// When the page layout filename is not absolute, therefore
// relative to the current project, make it absolute
pg_fullfilename = Prj().AbsolutePath( pg_fullfilename );
}
pglayout.SetPageLayout( pg_fullfilename );
return rc;
}
......
......@@ -218,6 +218,11 @@ void ROUTER_PREVIEW_ITEM::ViewDraw( int aLayer, KIGFX::GAL* aGal ) const
break;
}
case SH_CONVEX:
case SH_POLYGON:
case SH_COMPOUND:
break; // Not yet in use
}
}
}
......
<?xml version="1.0" encoding="utf-8"?>
<!-- JNLP File for Freeroute -->
<jnlp
spec="6.0+"
codebase="http://freerouting.net/java"
href="freeroute.jnlp">
<information>
<title>Routing Application</title>
<vendor>FreeRouting</vendor>
<description>Printed Circuit Board Routing Application</description>
<homepage href="http://www.freerouting.net"/>
<shortcut online="true"/>
</information>
<resources>
<jar download="eager" href="router.jar"/>
<extension href="help.jnlp" name="Java Help"/>
<java version="1.6+" java-vm-args="-Xmx1024m"/>
</resources>
<application-desc main-class="gui.MainApplication">
<argument>-webstart</argument>
</application-desc>
</jnlp>
\ No newline at end of file
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