Code cleaning: move class PAGE_INFO from common.h to class_page_info.h;

Fix issue when using a page layout file in project folder: eeschema and Pcbnew did not use it, unless using an absolute path.
Now, if the file path is not absolute, it is seen as relative to the project (which is the expected behavior)
fp lib wizard: when pcbnew id compiled with USE_GITHUB_PLUGIN=OFF, the github plugin option is no more accessible (and the web viewer no more used).
This commit is contained in:
jean-pierre charras 2014-12-23 15:30:34 +01:00
commit caafffd703
27 changed files with 390 additions and 299 deletions

View File

@ -36,16 +36,17 @@ 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 colud be not built
# 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
# 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.
# (I don't know the OSX status)
# However the default option is on
# This option could be removed soon, if no serious issue happens on Linux or OSX
# * 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
@ -418,7 +419,7 @@ add_definitions( -DWX_COMPATIBILITY )
# See line 41 of CMakeModules/FindwxWidgets.cmake
set( wxWidgets_CONFIG_OPTIONS --static=no )
if( KICAD_USE_WEBKIT )
if( KICAD_USE_WEBKIT AND BUILD_GITHUB_PLUGIN )
set( webkitlib "webview" )
else()
set( webkitlib "" )

View File

@ -24,6 +24,7 @@
#include <common.h>
#include <class_page_info.h>
#include <macros.h>

View File

@ -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,

View File

@ -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
}

View File

@ -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>

View File

@ -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;

View File

@ -8,8 +8,8 @@ endif()
add_definitions( -DCVPCB )
if( KICAD_USE_WEBKIT )
set( WEBVIEWERTOOL "webviewer" )
if( KICAD_USE_WEBKITT AND BUILD_GITHUB_PLUGIN )
set( WEBVIEWER_WXLIB "webviewer" )
add_definitions( -DKICAD_USE_WEBKIT )
endif()
@ -117,7 +117,7 @@ target_link_libraries( cvpcb_kiface
pcbcommon
pcad2kicadpcb
common
${WEBVIEWERTOOL} # before bitmaps, because it uses some bitmaps defined in bitmaps
${WEBVIEWER_WXLIB} # before bitmaps, because it uses some bitmaps defined in bitmaps
bitmaps
polygon
gal

View File

@ -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>
@ -478,8 +479,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;
}

View File

@ -36,9 +36,6 @@
GBR_LAYOUT::GBR_LAYOUT()
{
PAGE_INFO pageInfo( wxT( "GERBER" ) );
SetPageSettings( pageInfo );
m_printLayersMask.set();
}

View File

@ -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;

View File

@ -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.

View File

@ -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();
}

View File

@ -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;

242
include/class_page_info.h Normal file
View File

@ -0,0 +1,242 @@
/*
* 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_

View File

@ -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>

View File

@ -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

View File

@ -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
/**

View File

@ -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

View File

@ -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

View File

@ -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;

View File

@ -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;

View File

@ -38,7 +38,6 @@
#include <dialog_hotkeys_editor.h>
#include <pl_editor_id.h>
#define GROUP wxT("/pl_editor")

View File

@ -370,8 +370,8 @@ if( UNIX AND NOT APPLE )
list( APPEND PCBNEW_EXTRA_LIBS rt )
endif()
if( KICAD_USE_WEBKIT )
set( WEBVIEWERTOOL "webviewer" )
if( KICAD_USE_WEBKIT AND BUILD_GITHUB_PLUGIN )
set( WEBVIEWER_WXLIB "webviewer" )
add_definitions( -DKICAD_USE_WEBKIT )
endif()
@ -402,7 +402,7 @@ if( KICAD_SCRIPTING_MODULES )
idf3
${GITHUB_PLUGIN_LIBRARIES}
polygon
${WEBVIEWERTOOL}
${WEBVIEWER_WXLIB}
bitmaps
gal
${GLEW_LIBRARIES}
@ -569,7 +569,7 @@ target_link_libraries( pcbnew_kiface
common
pcad2kicadpcb
polygon
${WEBVIEWERTOOL} # before bitmaps, because it uses some bitmaps defined in bitmap
${WEBVIEWER_WXLIB} # before bitmaps, because it uses some bitmaps defined in bitmap
bitmaps
gal
lib_dxf

View File

@ -72,6 +72,14 @@ WIZARD_FPLIB_TABLE::WIZARD_FPLIB_TABLE( wxWindow* aParent, wxArrayString& aEnvVa
{
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,

View File

@ -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;
}

View File

@ -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;
}
case SH_CIRCLE:
break;
}
case SH_CIRCLE:
{
const SHAPE_CIRCLE* c = (const SHAPE_CIRCLE*) m_shape;
aGal->DrawCircle( c->GetCenter(), c->GetRadius() );
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
}
}
}

View File

@ -42,7 +42,7 @@
#include "wx/wx.h"
#if !wxUSE_WEBVIEW_WEBKIT && !wxUSE_WEBVIEW_IE
#error "A wxWebView backend is required by this sample"
#error "wxWidgets must be built with wxWebView support enabled. Please rebuild wxWidgets"
#endif
#include "wx/artprov.h"
@ -60,7 +60,7 @@
#if wxUSE_STC
#include "wx/stc/stc.h"
#else
#error "wxStyledTextControl is needed by the web viewer"
#error "wxWidgets must be built with wxStyledTextControl enabled. Please rebuild wxWidgets"
#endif
#include <dialog_shim.h>