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
......
This diff is collapsed.
......@@ -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)">
<rect
style="fill-opacity:0"
id="rect37-5"
x="0"
y="0"
width="16"
height="16" />
</g>
<path
transform="matrix(0,0.91790986,-0.91920821,0,11.841319,-33.997331)"
inkscape:connector-curvature="0"
id="path3800-8-1"
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)" />
<path
inkscape:connector-curvature="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" />
transform="matrix(0,2.9379,-2.1996,0,42.91351,2.60607)"
id="g35-5">
<rect
height="16"
width="16"
y="0"
x="0"
id="rect37-5"
style="fill-opacity:0" />
</g>
<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-8)"
d="m 7.8690809,3.4934004 41.1855461,40.6965116 0,0"
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"
inkscape:connector-curvature="0" />
<g
id="g3844">
<g
id="g35"
transform="matrix(2.9379,0,0,2.1996,2.1067,3.2221)">
<rect
id="rect37"
x="0"
y="0"
width="16"
height="16"
fill-opacity="0" />
</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)" />
<path
inkscape:connector-curvature="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" />
transform="matrix(2.9379,0,0,2.1996,2.8259663,3.3248523)"
id="g35">
<rect
style="fill-opacity:0"
height="16"
width="16"
y="0"
x="0"
id="rect37" />
</g>
<path
inkscape:connector-curvature="0"
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"
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,20 +433,24 @@ 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();
// Apply new display options to the GAL canvas
KIGFX::PCB_PAINTER* painter =
static_cast<KIGFX::PCB_PAINTER*> ( GetGalCanvas()->GetView()->GetPainter() );
KIGFX::PCB_RENDER_SETTINGS* settings =
static_cast<KIGFX::PCB_RENDER_SETTINGS*> ( painter->GetSettings() );
settings->LoadDisplayOptions( DisplayOpt );
// Update pads
BOARD* board = GetBoard();
for( MODULE* module = board->m_Modules; module; module = module->Next() )
if( gal )
{
for( D_PAD* pad = module->Pads(); pad; pad = pad->Next() )
pad->ViewUpdate( KIGFX::VIEW_ITEM::GEOMETRY );
// Apply new display options to the GAL canvas
KIGFX::PCB_PAINTER* painter =
static_cast<KIGFX::PCB_PAINTER*> ( gal->GetView()->GetPainter() );
KIGFX::PCB_RENDER_SETTINGS* settings =
static_cast<KIGFX::PCB_RENDER_SETTINGS*> ( painter->GetSettings() );
settings->LoadDisplayOptions( DisplayOpt );
// Update pads
BOARD* board = GetBoard();
for( MODULE* module = board->m_Modules; module; module = module->Next() )
{
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,8 +553,11 @@ 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;
......
......@@ -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 );
}
///////////////////////////////////////////////////////////////////////////
// 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 );
}
This diff is collapsed.
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Jun 5 2014)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!
///////////////////////////////////////////////////////////////////////////
#ifndef __DIALOG_SELECT_DIRLIST_BASE_H__
#define __DIALOG_SELECT_DIRLIST_BASE_H__
#include <wx/artprov.h>
#include <wx/xrc/xmlres.h>
#include <wx/intl.h>
class DIALOG_SHIM;
#include "dialog_shim.h"
#include <wx/string.h>
#include <wx/stattext.h>
#include <wx/gdicmn.h>
#include <wx/font.h>
#include <wx/colour.h>
#include <wx/settings.h>
#include <wx/dirctrl.h>
#include <wx/statline.h>
#include <wx/sizer.h>
#include <wx/button.h>
#include <wx/dialog.h>
///////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
/// Class DIALOG_SELECT_DIRLIST_BASE
///////////////////////////////////////////////////////////////////////////////
class DIALOG_SELECT_DIRLIST_BASE : public DIALOG_SHIM
{
private:
protected:
wxStaticText* m_staticText;
wxGenericDirCtrl* m_dirCtrl;
wxStaticLine* m_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__
This diff is collapsed.
/**
* @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;
}
};
This diff is collapsed.
This diff is collapsed.
///////////////////////////////////////////////////////////////////////////
// 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;
}
......
......@@ -159,65 +159,70 @@ void ROUTER_PREVIEW_ITEM::ViewDraw( int aLayer, KIGFX::GAL* aGal ) const
switch( m_shape->Type() )
{
case SH_LINE_CHAIN:
{
const SHAPE_LINE_CHAIN* l = (const SHAPE_LINE_CHAIN*) m_shape;
drawLineChain( *l, aGal );
break;
}
case SH_LINE_CHAIN:
{
const SHAPE_LINE_CHAIN* l = (const SHAPE_LINE_CHAIN*) m_shape;
drawLineChain( *l, aGal );
break;
}
case SH_SEGMENT:
case SH_SEGMENT:
{
const SHAPE_SEGMENT* s = (const SHAPE_SEGMENT*) m_shape;
aGal->DrawLine( s->GetSeg().A, s->GetSeg().B );
if( m_clearance > 0 )
{
const SHAPE_SEGMENT* s = (const SHAPE_SEGMENT*) m_shape;
aGal->SetLayerDepth( ClearanceOverlayDepth );
aGal->SetStrokeColor( COLOR4D( DARKDARKGRAY ) );
aGal->SetLineWidth( m_width + 2 * m_clearance );
aGal->DrawLine( s->GetSeg().A, s->GetSeg().B );
}
if( m_clearance > 0 )
{
aGal->SetLayerDepth( ClearanceOverlayDepth );
aGal->SetStrokeColor( COLOR4D( DARKDARKGRAY ) );
aGal->SetLineWidth( m_width + 2 * m_clearance );
aGal->DrawLine( s->GetSeg().A, s->GetSeg().B );
}
break;
}
break;
}
case SH_CIRCLE:
{
const SHAPE_CIRCLE* c = (const SHAPE_CIRCLE*) m_shape;
aGal->DrawCircle( c->GetCenter(), c->GetRadius() );
case SH_CIRCLE:
if( m_clearance > 0 )
{
const SHAPE_CIRCLE* c = (const SHAPE_CIRCLE*) m_shape;
aGal->DrawCircle( c->GetCenter(), c->GetRadius() );
if( m_clearance > 0 )
{
aGal->SetLayerDepth( ClearanceOverlayDepth );
aGal->SetFillColor( COLOR4D( DARKDARKGRAY ) );
aGal->SetIsStroke( false );
aGal->DrawCircle( c->GetCenter(), c->GetRadius() + m_clearance );
}
break;
aGal->SetLayerDepth( ClearanceOverlayDepth );
aGal->SetFillColor( COLOR4D( DARKDARKGRAY ) );
aGal->SetIsStroke( false );
aGal->DrawCircle( c->GetCenter(), c->GetRadius() + m_clearance );
}
case SH_RECT:
break;
}
case SH_RECT:
{
const SHAPE_RECT* r = (const SHAPE_RECT*) m_shape;
aGal->DrawRectangle( r->GetPosition(), r->GetPosition() + r->GetSize() );
if( m_clearance > 0 )
{
const SHAPE_RECT* r = (const SHAPE_RECT*) m_shape;
aGal->DrawRectangle( r->GetPosition(), r->GetPosition() + r->GetSize() );
if( m_clearance > 0 )
{
aGal->SetLayerDepth( ClearanceOverlayDepth );
VECTOR2I p0( r->GetPosition() ), s( r->GetSize() );
aGal->SetStrokeColor( COLOR4D( DARKDARKGRAY ) );
aGal->SetIsStroke( true );
aGal->SetLineWidth( 2 * m_clearance );
aGal->DrawLine( p0, VECTOR2I( p0.x + s.x, p0.y ) );
aGal->DrawLine( p0, VECTOR2I( p0.x, p0.y + s.y ) );
aGal->DrawLine( p0 + s , VECTOR2I( p0.x + s.x, p0.y ) );
aGal->DrawLine( p0 + s, VECTOR2I( p0.x, p0.y + s.y ) );
}
break;
aGal->SetLayerDepth( ClearanceOverlayDepth );
VECTOR2I p0( r->GetPosition() ), s( r->GetSize() );
aGal->SetStrokeColor( COLOR4D( DARKDARKGRAY ) );
aGal->SetIsStroke( true );
aGal->SetLineWidth( 2 * m_clearance );
aGal->DrawLine( p0, VECTOR2I( p0.x + s.x, p0.y ) );
aGal->DrawLine( p0, VECTOR2I( p0.x, p0.y + s.y ) );
aGal->DrawLine( p0 + s , VECTOR2I( p0.x + s.x, p0.y ) );
aGal->DrawLine( p0 + s, VECTOR2I( p0.x, p0.y + s.y ) );
}
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 diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment