2011-10-15 13:25:57 +00:00
|
|
|
/*
|
|
|
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
|
|
|
*
|
2012-06-08 09:56:42 +00:00
|
|
|
* Copyright (C) 2012 Jean-Pierre Charras, jean-pierre.charras@ujf-grenoble.fr
|
|
|
|
* Copyright (C) 2012 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
|
2011-10-15 13:25:57 +00:00
|
|
|
* Copyright (C) 2011 Wayne Stambaugh <stambaughw@verizon.net>
|
|
|
|
* Copyright (C) 1992-2011 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 basepcbframe.cpp
|
|
|
|
*/
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2012-01-23 04:33:36 +00:00
|
|
|
#include <fctsys.h>
|
* KIWAY Milestone A): Make major modules into DLL/DSOs.
! The initial testing of this commit should be done using a Debug build so that
all the wxASSERT()s are enabled. Also, be sure and keep enabled the
USE_KIWAY_DLLs option. The tree won't likely build without it. Turning it
off is senseless anyways. If you want stable code, go back to a prior version,
the one tagged with "stable".
* Relocate all functionality out of the wxApp derivative into more finely
targeted purposes:
a) DLL/DSO specific
b) PROJECT specific
c) EXE or process specific
d) configuration file specific data
e) configuration file manipulations functions.
All of this functionality was blended into an extremely large wxApp derivative
and that was incompatible with the desire to support multiple concurrently
loaded DLL/DSO's ("KIFACE")s and multiple concurrently open projects.
An amazing amount of organization come from simply sorting each bit of
functionality into the proper box.
* Switch to wxConfigBase from wxConfig everywhere except instantiation.
* Add classes KIWAY, KIFACE, KIFACE_I, SEARCH_STACK, PGM_BASE, PGM_KICAD,
PGM_SINGLE_TOP,
* Remove "Return" prefix on many function names.
* Remove obvious comments from CMakeLists.txt files, and from else() and endif()s.
* Fix building boost for use in a DSO on linux.
* Remove some of the assumptions in the CMakeLists.txt files that windows had
to be the host platform when building windows binaries.
* Reduce the number of wxStrings being constructed at program load time via
static construction.
* Pass wxConfigBase* to all SaveSettings() and LoadSettings() functions so that
these functions are useful even when the wxConfigBase comes from another
source, as is the case in the KICAD_MANAGER_FRAME.
* Move the setting of the KIPRJMOD environment variable into class PROJECT,
so that it can be moved into a project variable soon, and out of FP_LIB_TABLE.
* Add the KIWAY_PLAYER which is associated with a particular PROJECT, and all
its child wxFrames and wxDialogs now have a Kiway() member function which
returns a KIWAY& that that window tree branch is in support of. This is like
wxWindows DNA in that child windows get this member with proper value at time
of construction.
* Anticipate some of the needs for milestones B) and C) and make code
adjustments now in an effort to reduce work in those milestones.
* No testing has been done for python scripting, since milestone C) has that
being largely reworked and re-thought-out.
2014-03-20 00:42:08 +00:00
|
|
|
#include <kiface_i.h>
|
2012-01-23 04:33:36 +00:00
|
|
|
#include <wxstruct.h>
|
|
|
|
#include <pcbcommon.h>
|
|
|
|
#include <confirm.h>
|
* KIWAY Milestone A): Make major modules into DLL/DSOs.
! The initial testing of this commit should be done using a Debug build so that
all the wxASSERT()s are enabled. Also, be sure and keep enabled the
USE_KIWAY_DLLs option. The tree won't likely build without it. Turning it
off is senseless anyways. If you want stable code, go back to a prior version,
the one tagged with "stable".
* Relocate all functionality out of the wxApp derivative into more finely
targeted purposes:
a) DLL/DSO specific
b) PROJECT specific
c) EXE or process specific
d) configuration file specific data
e) configuration file manipulations functions.
All of this functionality was blended into an extremely large wxApp derivative
and that was incompatible with the desire to support multiple concurrently
loaded DLL/DSO's ("KIFACE")s and multiple concurrently open projects.
An amazing amount of organization come from simply sorting each bit of
functionality into the proper box.
* Switch to wxConfigBase from wxConfig everywhere except instantiation.
* Add classes KIWAY, KIFACE, KIFACE_I, SEARCH_STACK, PGM_BASE, PGM_KICAD,
PGM_SINGLE_TOP,
* Remove "Return" prefix on many function names.
* Remove obvious comments from CMakeLists.txt files, and from else() and endif()s.
* Fix building boost for use in a DSO on linux.
* Remove some of the assumptions in the CMakeLists.txt files that windows had
to be the host platform when building windows binaries.
* Reduce the number of wxStrings being constructed at program load time via
static construction.
* Pass wxConfigBase* to all SaveSettings() and LoadSettings() functions so that
these functions are useful even when the wxConfigBase comes from another
source, as is the case in the KICAD_MANAGER_FRAME.
* Move the setting of the KIPRJMOD environment variable into class PROJECT,
so that it can be moved into a project variable soon, and out of FP_LIB_TABLE.
* Add the KIWAY_PLAYER which is associated with a particular PROJECT, and all
its child wxFrames and wxDialogs now have a Kiway() member function which
returns a KIWAY& that that window tree branch is in support of. This is like
wxWindows DNA in that child windows get this member with proper value at time
of construction.
* Anticipate some of the needs for milestones B) and C) and make code
adjustments now in an effort to reduce work in those milestones.
* No testing has been done for python scripting, since milestone C) has that
being largely reworked and re-thought-out.
2014-03-20 00:42:08 +00:00
|
|
|
//#include <pgm_base.h>
|
|
|
|
#include <kiface_i.h>
|
2012-01-23 04:33:36 +00:00
|
|
|
#include <dialog_helpers.h>
|
|
|
|
#include <kicad_device_context.h>
|
|
|
|
#include <wxBasePcbFrame.h>
|
2012-04-13 18:51:24 +00:00
|
|
|
#include <base_units.h>
|
2013-01-12 17:32:24 +00:00
|
|
|
#include <msgpanel.h>
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2012-01-23 04:33:36 +00:00
|
|
|
#include <pcbnew.h>
|
* KIWAY Milestone A): Make major modules into DLL/DSOs.
! The initial testing of this commit should be done using a Debug build so that
all the wxASSERT()s are enabled. Also, be sure and keep enabled the
USE_KIWAY_DLLs option. The tree won't likely build without it. Turning it
off is senseless anyways. If you want stable code, go back to a prior version,
the one tagged with "stable".
* Relocate all functionality out of the wxApp derivative into more finely
targeted purposes:
a) DLL/DSO specific
b) PROJECT specific
c) EXE or process specific
d) configuration file specific data
e) configuration file manipulations functions.
All of this functionality was blended into an extremely large wxApp derivative
and that was incompatible with the desire to support multiple concurrently
loaded DLL/DSO's ("KIFACE")s and multiple concurrently open projects.
An amazing amount of organization come from simply sorting each bit of
functionality into the proper box.
* Switch to wxConfigBase from wxConfig everywhere except instantiation.
* Add classes KIWAY, KIFACE, KIFACE_I, SEARCH_STACK, PGM_BASE, PGM_KICAD,
PGM_SINGLE_TOP,
* Remove "Return" prefix on many function names.
* Remove obvious comments from CMakeLists.txt files, and from else() and endif()s.
* Fix building boost for use in a DSO on linux.
* Remove some of the assumptions in the CMakeLists.txt files that windows had
to be the host platform when building windows binaries.
* Reduce the number of wxStrings being constructed at program load time via
static construction.
* Pass wxConfigBase* to all SaveSettings() and LoadSettings() functions so that
these functions are useful even when the wxConfigBase comes from another
source, as is the case in the KICAD_MANAGER_FRAME.
* Move the setting of the KIPRJMOD environment variable into class PROJECT,
so that it can be moved into a project variable soon, and out of FP_LIB_TABLE.
* Add the KIWAY_PLAYER which is associated with a particular PROJECT, and all
its child wxFrames and wxDialogs now have a Kiway() member function which
returns a KIWAY& that that window tree branch is in support of. This is like
wxWindows DNA in that child windows get this member with proper value at time
of construction.
* Anticipate some of the needs for milestones B) and C) and make code
adjustments now in an effort to reduce work in those milestones.
* No testing has been done for python scripting, since milestone C) has that
being largely reworked and re-thought-out.
2014-03-20 00:42:08 +00:00
|
|
|
#include <fp_lib_table.h>
|
2012-01-23 04:33:36 +00:00
|
|
|
#include <pcbnew_id.h>
|
|
|
|
#include <class_board.h>
|
Introduction of Graphics Abstraction Layer based rendering for pcbnew.
New classes:
- VIEW - represents view that is seen by user, takes care of layer ordering & visibility and how it is displayed (which location, how much zoomed, etc.)
- VIEW_ITEM - Base class for every item that can be displayed on VIEW (the biggest change is that now it may be necessary to override ViewBBox & ViewGetLayers method for derived classes).
- EDA_DRAW_PANEL_GAL - Inherits after EDA_DRAW_PANEL, displays VIEW output, right now it is not editable (in opposite to usual EDA_DRAW_PANEL).
- GAL/OPENGL_GAL/CAIRO_GAL - Base Graphics Abstraction Layer class + two different flavours (Cairo is not fully supported yet), that offers methods to draw primitives using different libraries.
- WX_VIEW_CONTROLS - Controller for VIEW, handles user events, allows zooming, panning, etc.
- PAINTER/PCB_PAINTER - Classes that uses GAL interface to draw items (as you may have already guessed - PCB_PAINTER is a class for drawing PCB specific object, PAINTER is an abstract class). Its methods are invoked by VIEW, when an item has to be drawn. To display a new type of item - you need to implement draw(ITEM_TYPE*) method that draws it using GAL methods.
- STROKE_FONT - Implements stroke font drawing using GAL methods.
Most important changes to Kicad original code:
* EDA_ITEM now inherits from VIEW_ITEM, which is a base class for all drawable objects.
* EDA_DRAW_FRAME contains both usual EDA_DRAW_PANEL and new EDA_DRAW_PANEL_GAL, that can be switched anytime.
* There are some new layers for displaying multilayer pads, vias & pads holes (these are not shown yet on the right sidebar in pcbnew)
* Display order of layers is different than in previous versions (if you are curious - you may check m_galLayerOrder@pcbnew/basepcbframe.cpp). Preserving usual order would result in not very natural display, such as showing silkscreen texts on the bottom.
* Introduced new hotkey (Alt+F12) and new menu option (View->Switch canvas) for switching canvas during runtime.
* Some of classes (mostly derived from BOARD_ITEM) now includes ViewBBox & ViewGetLayers methods.
* Removed tools/class_painter.h, as now it is extended and included in source code.
Build changes:
* GAL-based rendering option is turned on by a new compilation CMake option KICAD_GAL.
* When compiling with CMake option KICAD_GAL=ON, GLEW and Cairo libraries are required.
* GAL-related code is compiled into a static library (common/libgal).
* Build with KICAD_GAL=OFF should not need any new libraries and should come out as a standard version of Kicad
Currently most of items in pcbnew can be displayed using OpenGL (to be done are DIMENSIONS and MARKERS).
More details about GAL can be found in: http://www.ohwr.org/attachments/1884/view-spec.pdf
2013-04-02 06:54:03 +00:00
|
|
|
#include <class_track.h>
|
|
|
|
#include <class_module.h>
|
|
|
|
#include <class_drawsegment.h>
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2012-01-23 04:33:36 +00:00
|
|
|
#include <collectors.h>
|
|
|
|
#include <class_drawpanel.h>
|
Introduction of Graphics Abstraction Layer based rendering for pcbnew.
New classes:
- VIEW - represents view that is seen by user, takes care of layer ordering & visibility and how it is displayed (which location, how much zoomed, etc.)
- VIEW_ITEM - Base class for every item that can be displayed on VIEW (the biggest change is that now it may be necessary to override ViewBBox & ViewGetLayers method for derived classes).
- EDA_DRAW_PANEL_GAL - Inherits after EDA_DRAW_PANEL, displays VIEW output, right now it is not editable (in opposite to usual EDA_DRAW_PANEL).
- GAL/OPENGL_GAL/CAIRO_GAL - Base Graphics Abstraction Layer class + two different flavours (Cairo is not fully supported yet), that offers methods to draw primitives using different libraries.
- WX_VIEW_CONTROLS - Controller for VIEW, handles user events, allows zooming, panning, etc.
- PAINTER/PCB_PAINTER - Classes that uses GAL interface to draw items (as you may have already guessed - PCB_PAINTER is a class for drawing PCB specific object, PAINTER is an abstract class). Its methods are invoked by VIEW, when an item has to be drawn. To display a new type of item - you need to implement draw(ITEM_TYPE*) method that draws it using GAL methods.
- STROKE_FONT - Implements stroke font drawing using GAL methods.
Most important changes to Kicad original code:
* EDA_ITEM now inherits from VIEW_ITEM, which is a base class for all drawable objects.
* EDA_DRAW_FRAME contains both usual EDA_DRAW_PANEL and new EDA_DRAW_PANEL_GAL, that can be switched anytime.
* There are some new layers for displaying multilayer pads, vias & pads holes (these are not shown yet on the right sidebar in pcbnew)
* Display order of layers is different than in previous versions (if you are curious - you may check m_galLayerOrder@pcbnew/basepcbframe.cpp). Preserving usual order would result in not very natural display, such as showing silkscreen texts on the bottom.
* Introduced new hotkey (Alt+F12) and new menu option (View->Switch canvas) for switching canvas during runtime.
* Some of classes (mostly derived from BOARD_ITEM) now includes ViewBBox & ViewGetLayers methods.
* Removed tools/class_painter.h, as now it is extended and included in source code.
Build changes:
* GAL-based rendering option is turned on by a new compilation CMake option KICAD_GAL.
* When compiling with CMake option KICAD_GAL=ON, GLEW and Cairo libraries are required.
* GAL-related code is compiled into a static library (common/libgal).
* Build with KICAD_GAL=OFF should not need any new libraries and should come out as a standard version of Kicad
Currently most of items in pcbnew can be displayed using OpenGL (to be done are DIMENSIONS and MARKERS).
More details about GAL can be found in: http://www.ohwr.org/attachments/1884/view-spec.pdf
2013-04-02 06:54:03 +00:00
|
|
|
#include <class_drawpanel_gal.h>
|
|
|
|
#include <view/view.h>
|
2013-03-28 16:30:09 +00:00
|
|
|
#include <math/vector2d.h>
|
2013-05-01 17:32:36 +00:00
|
|
|
#include <trigo.h>
|
Introduction of Graphics Abstraction Layer based rendering for pcbnew.
New classes:
- VIEW - represents view that is seen by user, takes care of layer ordering & visibility and how it is displayed (which location, how much zoomed, etc.)
- VIEW_ITEM - Base class for every item that can be displayed on VIEW (the biggest change is that now it may be necessary to override ViewBBox & ViewGetLayers method for derived classes).
- EDA_DRAW_PANEL_GAL - Inherits after EDA_DRAW_PANEL, displays VIEW output, right now it is not editable (in opposite to usual EDA_DRAW_PANEL).
- GAL/OPENGL_GAL/CAIRO_GAL - Base Graphics Abstraction Layer class + two different flavours (Cairo is not fully supported yet), that offers methods to draw primitives using different libraries.
- WX_VIEW_CONTROLS - Controller for VIEW, handles user events, allows zooming, panning, etc.
- PAINTER/PCB_PAINTER - Classes that uses GAL interface to draw items (as you may have already guessed - PCB_PAINTER is a class for drawing PCB specific object, PAINTER is an abstract class). Its methods are invoked by VIEW, when an item has to be drawn. To display a new type of item - you need to implement draw(ITEM_TYPE*) method that draws it using GAL methods.
- STROKE_FONT - Implements stroke font drawing using GAL methods.
Most important changes to Kicad original code:
* EDA_ITEM now inherits from VIEW_ITEM, which is a base class for all drawable objects.
* EDA_DRAW_FRAME contains both usual EDA_DRAW_PANEL and new EDA_DRAW_PANEL_GAL, that can be switched anytime.
* There are some new layers for displaying multilayer pads, vias & pads holes (these are not shown yet on the right sidebar in pcbnew)
* Display order of layers is different than in previous versions (if you are curious - you may check m_galLayerOrder@pcbnew/basepcbframe.cpp). Preserving usual order would result in not very natural display, such as showing silkscreen texts on the bottom.
* Introduced new hotkey (Alt+F12) and new menu option (View->Switch canvas) for switching canvas during runtime.
* Some of classes (mostly derived from BOARD_ITEM) now includes ViewBBox & ViewGetLayers methods.
* Removed tools/class_painter.h, as now it is extended and included in source code.
Build changes:
* GAL-based rendering option is turned on by a new compilation CMake option KICAD_GAL.
* When compiling with CMake option KICAD_GAL=ON, GLEW and Cairo libraries are required.
* GAL-related code is compiled into a static library (common/libgal).
* Build with KICAD_GAL=OFF should not need any new libraries and should come out as a standard version of Kicad
Currently most of items in pcbnew can be displayed using OpenGL (to be done are DIMENSIONS and MARKERS).
More details about GAL can be found in: http://www.ohwr.org/attachments/1884/view-spec.pdf
2013-04-02 06:54:03 +00:00
|
|
|
#include <pcb_painter.h>
|
2013-10-02 12:26:14 +00:00
|
|
|
#include <worksheet_viewitem.h>
|
2013-11-25 15:50:03 +00:00
|
|
|
#include <ratsnest_data.h>
|
|
|
|
#include <ratsnest_viewitem.h>
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2013-08-02 14:53:50 +00:00
|
|
|
#include <tool/tool_manager.h>
|
|
|
|
#include <tool/tool_dispatcher.h>
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2012-01-05 08:07:11 +00:00
|
|
|
// Configuration entry names.
|
2009-04-05 20:49:15 +00:00
|
|
|
static const wxString UserGridSizeXEntry( wxT( "PcbUserGrid_X" ) );
|
|
|
|
static const wxString UserGridSizeYEntry( wxT( "PcbUserGrid_Y" ) );
|
|
|
|
static const wxString UserGridUnitsEntry( wxT( "PcbUserGrid_Unit" ) );
|
2009-04-23 15:02:18 +00:00
|
|
|
static const wxString DisplayPadFillEntry( wxT( "DiPadFi" ) );
|
2009-09-29 04:44:35 +00:00
|
|
|
static const wxString DisplayViaFillEntry( wxT( "DiViaFi" ) );
|
2009-04-23 15:02:18 +00:00
|
|
|
static const wxString DisplayPadNumberEntry( wxT( "DiPadNu" ) );
|
|
|
|
static const wxString DisplayModuleEdgeEntry( wxT( "DiModEd" ) );
|
|
|
|
static const wxString DisplayModuleTextEntry( wxT( "DiModTx" ) );
|
2011-09-09 11:02:03 +00:00
|
|
|
static const wxString FastGrid1Entry( wxT( "FastGrid1" ) );
|
|
|
|
static const wxString FastGrid2Entry( wxT( "FastGrid2" ) );
|
2009-04-23 15:02:18 +00:00
|
|
|
|
2013-09-19 07:55:37 +00:00
|
|
|
const LAYER_NUM PCB_BASE_FRAME::GAL_LAYER_ORDER[] =
|
|
|
|
{
|
2013-10-02 09:39:08 +00:00
|
|
|
ITEM_GAL_LAYER( GP_OVERLAY ),
|
2014-02-03 13:14:53 +00:00
|
|
|
NETNAMES_GAL_LAYER( PADS_NETNAMES_VISIBLE ),
|
2013-09-19 07:55:37 +00:00
|
|
|
DRAW_N, COMMENT_N, ECO1_N, ECO2_N, EDGE_N,
|
|
|
|
UNUSED_LAYER_29, UNUSED_LAYER_30, UNUSED_LAYER_31,
|
|
|
|
ITEM_GAL_LAYER( MOD_TEXT_FR_VISIBLE ),
|
|
|
|
ITEM_GAL_LAYER( MOD_REFERENCES_VISIBLE), ITEM_GAL_LAYER( MOD_VALUES_VISIBLE ),
|
|
|
|
|
2013-11-25 15:50:03 +00:00
|
|
|
ITEM_GAL_LAYER( RATSNEST_VISIBLE ),
|
2013-09-19 07:55:37 +00:00
|
|
|
ITEM_GAL_LAYER( VIAS_HOLES_VISIBLE ), ITEM_GAL_LAYER( PADS_HOLES_VISIBLE ),
|
|
|
|
ITEM_GAL_LAYER( VIAS_VISIBLE ), ITEM_GAL_LAYER( PADS_VISIBLE ),
|
|
|
|
|
2014-02-03 13:14:53 +00:00
|
|
|
NETNAMES_GAL_LAYER( PAD_FR_NETNAMES_VISIBLE ), ITEM_GAL_LAYER( PAD_FR_VISIBLE ), SOLDERMASK_N_FRONT,
|
|
|
|
NETNAMES_GAL_LAYER( LAYER_16_NETNAMES_VISIBLE ), LAYER_N_FRONT,
|
2013-09-19 07:55:37 +00:00
|
|
|
SILKSCREEN_N_FRONT, SOLDERPASTE_N_FRONT, ADHESIVE_N_FRONT,
|
2014-02-03 13:14:53 +00:00
|
|
|
NETNAMES_GAL_LAYER( LAYER_15_NETNAMES_VISIBLE ), LAYER_N_15,
|
|
|
|
NETNAMES_GAL_LAYER( LAYER_14_NETNAMES_VISIBLE ), LAYER_N_14,
|
|
|
|
NETNAMES_GAL_LAYER( LAYER_13_NETNAMES_VISIBLE ), LAYER_N_13,
|
|
|
|
NETNAMES_GAL_LAYER( LAYER_12_NETNAMES_VISIBLE ), LAYER_N_12,
|
|
|
|
NETNAMES_GAL_LAYER( LAYER_11_NETNAMES_VISIBLE ), LAYER_N_11,
|
|
|
|
NETNAMES_GAL_LAYER( LAYER_10_NETNAMES_VISIBLE ), LAYER_N_10,
|
|
|
|
NETNAMES_GAL_LAYER( LAYER_9_NETNAMES_VISIBLE ), LAYER_N_9,
|
|
|
|
NETNAMES_GAL_LAYER( LAYER_8_NETNAMES_VISIBLE ), LAYER_N_8,
|
|
|
|
NETNAMES_GAL_LAYER( LAYER_7_NETNAMES_VISIBLE ), LAYER_N_7,
|
|
|
|
NETNAMES_GAL_LAYER( LAYER_6_NETNAMES_VISIBLE ), LAYER_N_6,
|
|
|
|
NETNAMES_GAL_LAYER( LAYER_5_NETNAMES_VISIBLE ), LAYER_N_5,
|
|
|
|
NETNAMES_GAL_LAYER( LAYER_4_NETNAMES_VISIBLE ), LAYER_N_4,
|
|
|
|
NETNAMES_GAL_LAYER( LAYER_3_NETNAMES_VISIBLE ), LAYER_N_3,
|
|
|
|
NETNAMES_GAL_LAYER( LAYER_2_NETNAMES_VISIBLE ), LAYER_N_2,
|
|
|
|
NETNAMES_GAL_LAYER( PAD_BK_NETNAMES_VISIBLE ), ITEM_GAL_LAYER( PAD_BK_VISIBLE ), SOLDERMASK_N_BACK,
|
|
|
|
NETNAMES_GAL_LAYER( LAYER_1_NETNAMES_VISIBLE ), LAYER_N_BACK,
|
2013-09-19 07:55:37 +00:00
|
|
|
|
|
|
|
ADHESIVE_N_BACK, SOLDERPASTE_N_BACK, SILKSCREEN_N_BACK,
|
|
|
|
ITEM_GAL_LAYER( MOD_TEXT_BK_VISIBLE ),
|
|
|
|
ITEM_GAL_LAYER( WORKSHEET )
|
|
|
|
};
|
2009-04-05 20:49:15 +00:00
|
|
|
|
2011-03-01 19:26:17 +00:00
|
|
|
BEGIN_EVENT_TABLE( PCB_BASE_FRAME, EDA_DRAW_FRAME )
|
2011-02-21 13:54:29 +00:00
|
|
|
EVT_MENU_RANGE( ID_POPUP_PCB_ITEM_SELECTION_START, ID_POPUP_PCB_ITEM_SELECTION_END,
|
2011-03-01 19:26:17 +00:00
|
|
|
PCB_BASE_FRAME::ProcessItemSelection )
|
|
|
|
|
|
|
|
EVT_TOOL( ID_TB_OPTIONS_SHOW_POLAR_COORD, PCB_BASE_FRAME::OnTogglePolarCoords )
|
|
|
|
EVT_TOOL( ID_TB_OPTIONS_SHOW_PADS_SKETCH, PCB_BASE_FRAME::OnTogglePadDrawMode )
|
|
|
|
|
|
|
|
EVT_UPDATE_UI( ID_TB_OPTIONS_SHOW_POLAR_COORD, PCB_BASE_FRAME::OnUpdateCoordType )
|
|
|
|
EVT_UPDATE_UI( ID_TB_OPTIONS_SHOW_PADS_SKETCH, PCB_BASE_FRAME::OnUpdatePadDrawMode )
|
|
|
|
EVT_UPDATE_UI( ID_ON_GRID_SELECT, PCB_BASE_FRAME::OnUpdateSelectGrid )
|
|
|
|
EVT_UPDATE_UI( ID_ON_ZOOM_SELECT, PCB_BASE_FRAME::OnUpdateSelectZoom )
|
2013-11-02 00:24:38 +00:00
|
|
|
|
2011-03-01 19:26:17 +00:00
|
|
|
EVT_UPDATE_UI_RANGE( ID_ZOOM_IN, ID_ZOOM_PAGE, PCB_BASE_FRAME::OnUpdateSelectZoom )
|
2007-10-07 18:24:15 +00:00
|
|
|
END_EVENT_TABLE()
|
2007-09-12 02:14:07 +00:00
|
|
|
|
|
|
|
|
2014-04-19 18:47:20 +00:00
|
|
|
PCB_BASE_FRAME::PCB_BASE_FRAME( KIWAY* aKiway, wxWindow* aParent, FRAME_T aFrameType,
|
* KIWAY Milestone A): Make major modules into DLL/DSOs.
! The initial testing of this commit should be done using a Debug build so that
all the wxASSERT()s are enabled. Also, be sure and keep enabled the
USE_KIWAY_DLLs option. The tree won't likely build without it. Turning it
off is senseless anyways. If you want stable code, go back to a prior version,
the one tagged with "stable".
* Relocate all functionality out of the wxApp derivative into more finely
targeted purposes:
a) DLL/DSO specific
b) PROJECT specific
c) EXE or process specific
d) configuration file specific data
e) configuration file manipulations functions.
All of this functionality was blended into an extremely large wxApp derivative
and that was incompatible with the desire to support multiple concurrently
loaded DLL/DSO's ("KIFACE")s and multiple concurrently open projects.
An amazing amount of organization come from simply sorting each bit of
functionality into the proper box.
* Switch to wxConfigBase from wxConfig everywhere except instantiation.
* Add classes KIWAY, KIFACE, KIFACE_I, SEARCH_STACK, PGM_BASE, PGM_KICAD,
PGM_SINGLE_TOP,
* Remove "Return" prefix on many function names.
* Remove obvious comments from CMakeLists.txt files, and from else() and endif()s.
* Fix building boost for use in a DSO on linux.
* Remove some of the assumptions in the CMakeLists.txt files that windows had
to be the host platform when building windows binaries.
* Reduce the number of wxStrings being constructed at program load time via
static construction.
* Pass wxConfigBase* to all SaveSettings() and LoadSettings() functions so that
these functions are useful even when the wxConfigBase comes from another
source, as is the case in the KICAD_MANAGER_FRAME.
* Move the setting of the KIPRJMOD environment variable into class PROJECT,
so that it can be moved into a project variable soon, and out of FP_LIB_TABLE.
* Add the KIWAY_PLAYER which is associated with a particular PROJECT, and all
its child wxFrames and wxDialogs now have a Kiway() member function which
returns a KIWAY& that that window tree branch is in support of. This is like
wxWindows DNA in that child windows get this member with proper value at time
of construction.
* Anticipate some of the needs for milestones B) and C) and make code
adjustments now in an effort to reduce work in those milestones.
* No testing has been done for python scripting, since milestone C) has that
being largely reworked and re-thought-out.
2014-03-20 00:42:08 +00:00
|
|
|
const wxString& aTitle, const wxPoint& aPos, const wxSize& aSize,
|
|
|
|
long aStyle, const wxString & aFrameName ) :
|
|
|
|
EDA_DRAW_FRAME( aKiway, aParent, aFrameType, aTitle, aPos, aSize, aStyle, aFrameName )
|
2007-06-05 12:10:51 +00:00
|
|
|
{
|
2009-04-05 20:49:15 +00:00
|
|
|
m_Pcb = NULL;
|
2013-08-05 14:28:58 +00:00
|
|
|
m_toolManager = NULL;
|
|
|
|
m_toolDispatcher = NULL;
|
2007-09-05 04:48:47 +00:00
|
|
|
|
2009-04-07 07:24:33 +00:00
|
|
|
m_DisplayPadFill = true; // How to draw pads
|
2009-09-29 04:44:35 +00:00
|
|
|
m_DisplayViaFill = true; // How to draw vias
|
2009-04-07 07:24:33 +00:00
|
|
|
m_DisplayPadNum = true; // show pads number
|
2007-09-05 04:48:47 +00:00
|
|
|
|
2010-01-27 20:07:50 +00:00
|
|
|
m_DisplayModEdge = FILLED; // How to display module drawings (line/ filled / sketch)
|
|
|
|
m_DisplayModText = FILLED; // How to display module texts (line/ filled / sketch)
|
2012-01-05 08:07:11 +00:00
|
|
|
m_DisplayPcbTrackFill = true; // false = sketch , true = filled
|
2008-12-08 15:27:13 +00:00
|
|
|
m_Draw3DFrame = NULL; // Display Window in 3D mode (OpenGL)
|
2007-10-07 18:24:15 +00:00
|
|
|
|
2009-04-05 20:49:15 +00:00
|
|
|
m_UserGridSize = wxRealPoint( 100.0, 100.0 );
|
2010-07-12 14:07:09 +00:00
|
|
|
m_UserGridUnit = INCHES;
|
2009-04-05 20:49:15 +00:00
|
|
|
m_Collector = new GENERAL_COLLECTOR();
|
2011-09-09 11:02:03 +00:00
|
|
|
|
|
|
|
m_FastGrid1 = 0;
|
|
|
|
m_FastGrid2 = 0;
|
2011-12-14 20:03:15 +00:00
|
|
|
|
2013-12-26 22:36:43 +00:00
|
|
|
SetGalCanvas( new EDA_DRAW_PANEL_GAL(
|
|
|
|
this, -1, wxPoint( 0, 0 ), m_FrameSize,
|
|
|
|
EDA_DRAW_PANEL_GAL::GAL_TYPE_OPENGL ) );
|
|
|
|
|
2013-11-01 12:56:20 +00:00
|
|
|
// Hide by default, it has to be explicitly shown
|
2013-12-26 22:36:43 +00:00
|
|
|
GetGalCanvas()->Hide();
|
Introduction of Graphics Abstraction Layer based rendering for pcbnew.
New classes:
- VIEW - represents view that is seen by user, takes care of layer ordering & visibility and how it is displayed (which location, how much zoomed, etc.)
- VIEW_ITEM - Base class for every item that can be displayed on VIEW (the biggest change is that now it may be necessary to override ViewBBox & ViewGetLayers method for derived classes).
- EDA_DRAW_PANEL_GAL - Inherits after EDA_DRAW_PANEL, displays VIEW output, right now it is not editable (in opposite to usual EDA_DRAW_PANEL).
- GAL/OPENGL_GAL/CAIRO_GAL - Base Graphics Abstraction Layer class + two different flavours (Cairo is not fully supported yet), that offers methods to draw primitives using different libraries.
- WX_VIEW_CONTROLS - Controller for VIEW, handles user events, allows zooming, panning, etc.
- PAINTER/PCB_PAINTER - Classes that uses GAL interface to draw items (as you may have already guessed - PCB_PAINTER is a class for drawing PCB specific object, PAINTER is an abstract class). Its methods are invoked by VIEW, when an item has to be drawn. To display a new type of item - you need to implement draw(ITEM_TYPE*) method that draws it using GAL methods.
- STROKE_FONT - Implements stroke font drawing using GAL methods.
Most important changes to Kicad original code:
* EDA_ITEM now inherits from VIEW_ITEM, which is a base class for all drawable objects.
* EDA_DRAW_FRAME contains both usual EDA_DRAW_PANEL and new EDA_DRAW_PANEL_GAL, that can be switched anytime.
* There are some new layers for displaying multilayer pads, vias & pads holes (these are not shown yet on the right sidebar in pcbnew)
* Display order of layers is different than in previous versions (if you are curious - you may check m_galLayerOrder@pcbnew/basepcbframe.cpp). Preserving usual order would result in not very natural display, such as showing silkscreen texts on the bottom.
* Introduced new hotkey (Alt+F12) and new menu option (View->Switch canvas) for switching canvas during runtime.
* Some of classes (mostly derived from BOARD_ITEM) now includes ViewBBox & ViewGetLayers methods.
* Removed tools/class_painter.h, as now it is extended and included in source code.
Build changes:
* GAL-based rendering option is turned on by a new compilation CMake option KICAD_GAL.
* When compiling with CMake option KICAD_GAL=ON, GLEW and Cairo libraries are required.
* GAL-related code is compiled into a static library (common/libgal).
* Build with KICAD_GAL=OFF should not need any new libraries and should come out as a standard version of Kicad
Currently most of items in pcbnew can be displayed using OpenGL (to be done are DIMENSIONS and MARKERS).
More details about GAL can be found in: http://www.ohwr.org/attachments/1884/view-spec.pdf
2013-04-02 06:54:03 +00:00
|
|
|
|
2011-12-14 20:03:15 +00:00
|
|
|
m_auxiliaryToolBar = NULL;
|
2007-06-05 12:10:51 +00:00
|
|
|
}
|
|
|
|
|
2007-09-05 04:48:47 +00:00
|
|
|
|
2011-03-01 19:26:17 +00:00
|
|
|
PCB_BASE_FRAME::~PCB_BASE_FRAME()
|
2007-06-05 12:10:51 +00:00
|
|
|
{
|
2007-09-05 04:48:47 +00:00
|
|
|
delete m_Collector;
|
++PCBNew
* Removed Pcb_Frame argument from BOARD() constructor, since it precludes
having a BOARD being edited by more than one editor, it was a bad design.
And this meant removing m_PcbFrame from BOARD.
* removed BOARD::SetWindowFrame(), and BOARD::m_PcbFrame
* Removed the global BOARD_DESIGN_SETTINGS which was in class_board.cpp
* added BOARD_DESIGN_SETTINGS to the BOARD class, a full instance
* a couple dialogs now only change BOARD_DESIGN_SETTINGS when OK is pressed,
such as dialog_mask_clearance, dialog_drc, etc.
* Removed common/pcbcommon.cpp's int g_CurrentVersionPCB = 1 and replaced it
with build_version.h's #define BOARD_FILE_VERSION, although there may be a
better place for this constant.
* Made the public functions in PARAM_CFG_ARRAY be type const.
void SaveParam(..) const and void ReadParam(..) const
* PARAM_CFG_BASE now has virtual destructor since we have various way of
destroying the derived class and boost::ptr_vector must be told about this.
* Pass const PARAM_CFG_ARRAY& instead of PARAM_CFG_ARRAY so that we can use
an automatic PARAM_CFG_ARRAY which is on the stack.\
* PCB_EDIT_FRAME::GetProjectFileParameters() may no longer cache the array,
since it has to access the current BOARD and the BOARD can change.
Remember BOARD_DESIGN_SETTINGS are now in the BOARD.
* Made the m_BoundingBox member private, this was a brutally hard task,
and indicative of the lack of commitment to accessors and object oriented
design on the part of KiCad developers. We must do better.
Added BOARD::GetBoundingBox, SetBoundingBox(), ComputeBoundingBox().
* Added PCB_BASE_FRAME::GetBoardBoundingBox() which calls BOARD::ComputeBoundingBox()
2011-12-05 06:15:33 +00:00
|
|
|
|
2012-02-02 17:45:37 +00:00
|
|
|
delete m_Pcb; // is already NULL for FOOTPRINT_EDIT_FRAME
|
2013-12-26 22:36:43 +00:00
|
|
|
delete GetGalCanvas();
|
2007-06-05 12:10:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
* KIWAY Milestone A): Make major modules into DLL/DSOs.
! The initial testing of this commit should be done using a Debug build so that
all the wxASSERT()s are enabled. Also, be sure and keep enabled the
USE_KIWAY_DLLs option. The tree won't likely build without it. Turning it
off is senseless anyways. If you want stable code, go back to a prior version,
the one tagged with "stable".
* Relocate all functionality out of the wxApp derivative into more finely
targeted purposes:
a) DLL/DSO specific
b) PROJECT specific
c) EXE or process specific
d) configuration file specific data
e) configuration file manipulations functions.
All of this functionality was blended into an extremely large wxApp derivative
and that was incompatible with the desire to support multiple concurrently
loaded DLL/DSO's ("KIFACE")s and multiple concurrently open projects.
An amazing amount of organization come from simply sorting each bit of
functionality into the proper box.
* Switch to wxConfigBase from wxConfig everywhere except instantiation.
* Add classes KIWAY, KIFACE, KIFACE_I, SEARCH_STACK, PGM_BASE, PGM_KICAD,
PGM_SINGLE_TOP,
* Remove "Return" prefix on many function names.
* Remove obvious comments from CMakeLists.txt files, and from else() and endif()s.
* Fix building boost for use in a DSO on linux.
* Remove some of the assumptions in the CMakeLists.txt files that windows had
to be the host platform when building windows binaries.
* Reduce the number of wxStrings being constructed at program load time via
static construction.
* Pass wxConfigBase* to all SaveSettings() and LoadSettings() functions so that
these functions are useful even when the wxConfigBase comes from another
source, as is the case in the KICAD_MANAGER_FRAME.
* Move the setting of the KIPRJMOD environment variable into class PROJECT,
so that it can be moved into a project variable soon, and out of FP_LIB_TABLE.
* Add the KIWAY_PLAYER which is associated with a particular PROJECT, and all
its child wxFrames and wxDialogs now have a Kiway() member function which
returns a KIWAY& that that window tree branch is in support of. This is like
wxWindows DNA in that child windows get this member with proper value at time
of construction.
* Anticipate some of the needs for milestones B) and C) and make code
adjustments now in an effort to reduce work in those milestones.
* No testing has been done for python scripting, since milestone C) has that
being largely reworked and re-thought-out.
2014-03-20 00:42:08 +00:00
|
|
|
FP_LIB_TABLE* PCB_BASE_FRAME::FootprintLibs() const
|
|
|
|
{
|
|
|
|
PROJECT& prj = Prj();
|
|
|
|
FP_LIB_TABLE* tbl = dynamic_cast<FP_LIB_TABLE*>( prj.Elem( PROJECT::FPTBL ) );
|
|
|
|
|
|
|
|
if( !tbl )
|
|
|
|
{
|
2014-03-21 01:24:35 +00:00
|
|
|
// Stack the project specific FP_LIB_TABLE overlay on top of the global table.
|
|
|
|
// ~FP_LIB_TABLE() will not touch the fallback table, so multiple projects may
|
|
|
|
// stack this way, all using the same global fallback table.
|
* KIWAY Milestone A): Make major modules into DLL/DSOs.
! The initial testing of this commit should be done using a Debug build so that
all the wxASSERT()s are enabled. Also, be sure and keep enabled the
USE_KIWAY_DLLs option. The tree won't likely build without it. Turning it
off is senseless anyways. If you want stable code, go back to a prior version,
the one tagged with "stable".
* Relocate all functionality out of the wxApp derivative into more finely
targeted purposes:
a) DLL/DSO specific
b) PROJECT specific
c) EXE or process specific
d) configuration file specific data
e) configuration file manipulations functions.
All of this functionality was blended into an extremely large wxApp derivative
and that was incompatible with the desire to support multiple concurrently
loaded DLL/DSO's ("KIFACE")s and multiple concurrently open projects.
An amazing amount of organization come from simply sorting each bit of
functionality into the proper box.
* Switch to wxConfigBase from wxConfig everywhere except instantiation.
* Add classes KIWAY, KIFACE, KIFACE_I, SEARCH_STACK, PGM_BASE, PGM_KICAD,
PGM_SINGLE_TOP,
* Remove "Return" prefix on many function names.
* Remove obvious comments from CMakeLists.txt files, and from else() and endif()s.
* Fix building boost for use in a DSO on linux.
* Remove some of the assumptions in the CMakeLists.txt files that windows had
to be the host platform when building windows binaries.
* Reduce the number of wxStrings being constructed at program load time via
static construction.
* Pass wxConfigBase* to all SaveSettings() and LoadSettings() functions so that
these functions are useful even when the wxConfigBase comes from another
source, as is the case in the KICAD_MANAGER_FRAME.
* Move the setting of the KIPRJMOD environment variable into class PROJECT,
so that it can be moved into a project variable soon, and out of FP_LIB_TABLE.
* Add the KIWAY_PLAYER which is associated with a particular PROJECT, and all
its child wxFrames and wxDialogs now have a Kiway() member function which
returns a KIWAY& that that window tree branch is in support of. This is like
wxWindows DNA in that child windows get this member with proper value at time
of construction.
* Anticipate some of the needs for milestones B) and C) and make code
adjustments now in an effort to reduce work in those milestones.
* No testing has been done for python scripting, since milestone C) has that
being largely reworked and re-thought-out.
2014-03-20 00:42:08 +00:00
|
|
|
tbl = new FP_LIB_TABLE( &GFootprintTable );
|
2014-03-21 01:24:35 +00:00
|
|
|
|
* KIWAY Milestone A): Make major modules into DLL/DSOs.
! The initial testing of this commit should be done using a Debug build so that
all the wxASSERT()s are enabled. Also, be sure and keep enabled the
USE_KIWAY_DLLs option. The tree won't likely build without it. Turning it
off is senseless anyways. If you want stable code, go back to a prior version,
the one tagged with "stable".
* Relocate all functionality out of the wxApp derivative into more finely
targeted purposes:
a) DLL/DSO specific
b) PROJECT specific
c) EXE or process specific
d) configuration file specific data
e) configuration file manipulations functions.
All of this functionality was blended into an extremely large wxApp derivative
and that was incompatible with the desire to support multiple concurrently
loaded DLL/DSO's ("KIFACE")s and multiple concurrently open projects.
An amazing amount of organization come from simply sorting each bit of
functionality into the proper box.
* Switch to wxConfigBase from wxConfig everywhere except instantiation.
* Add classes KIWAY, KIFACE, KIFACE_I, SEARCH_STACK, PGM_BASE, PGM_KICAD,
PGM_SINGLE_TOP,
* Remove "Return" prefix on many function names.
* Remove obvious comments from CMakeLists.txt files, and from else() and endif()s.
* Fix building boost for use in a DSO on linux.
* Remove some of the assumptions in the CMakeLists.txt files that windows had
to be the host platform when building windows binaries.
* Reduce the number of wxStrings being constructed at program load time via
static construction.
* Pass wxConfigBase* to all SaveSettings() and LoadSettings() functions so that
these functions are useful even when the wxConfigBase comes from another
source, as is the case in the KICAD_MANAGER_FRAME.
* Move the setting of the KIPRJMOD environment variable into class PROJECT,
so that it can be moved into a project variable soon, and out of FP_LIB_TABLE.
* Add the KIWAY_PLAYER which is associated with a particular PROJECT, and all
its child wxFrames and wxDialogs now have a Kiway() member function which
returns a KIWAY& that that window tree branch is in support of. This is like
wxWindows DNA in that child windows get this member with proper value at time
of construction.
* Anticipate some of the needs for milestones B) and C) and make code
adjustments now in an effort to reduce work in those milestones.
* No testing has been done for python scripting, since milestone C) has that
being largely reworked and re-thought-out.
2014-03-20 00:42:08 +00:00
|
|
|
prj.Elem( PROJECT::FPTBL, tbl );
|
|
|
|
}
|
|
|
|
|
|
|
|
return tbl;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2011-03-01 19:26:17 +00:00
|
|
|
void PCB_BASE_FRAME::SetBoard( BOARD* aBoard )
|
2008-03-04 04:22:27 +00:00
|
|
|
{
|
2012-02-02 17:45:37 +00:00
|
|
|
delete m_Pcb;
|
2008-03-04 04:22:27 +00:00
|
|
|
m_Pcb = aBoard;
|
|
|
|
}
|
|
|
|
|
2011-12-31 05:44:00 +00:00
|
|
|
|
2011-12-22 21:57:50 +00:00
|
|
|
void PCB_BASE_FRAME::SetPageSettings( const PAGE_INFO& aPageSettings )
|
|
|
|
{
|
|
|
|
wxASSERT( m_Pcb );
|
|
|
|
m_Pcb->SetPageSettings( aPageSettings );
|
2011-12-31 05:44:00 +00:00
|
|
|
|
|
|
|
if( GetScreen() )
|
|
|
|
GetScreen()->InitDataPoints( aPageSettings.GetSizeIU() );
|
2011-12-22 21:57:50 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
const PAGE_INFO& PCB_BASE_FRAME::GetPageSettings() const
|
|
|
|
{
|
|
|
|
wxASSERT( m_Pcb );
|
|
|
|
return m_Pcb->GetPageSettings();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
const wxSize PCB_BASE_FRAME::GetPageSizeIU() const
|
|
|
|
{
|
|
|
|
wxASSERT( m_Pcb );
|
|
|
|
|
2011-12-31 05:44:00 +00:00
|
|
|
// 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_Pcb->GetPageSettings().GetSizeIU();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2013-08-03 05:15:23 +00:00
|
|
|
const wxPoint& PCB_BASE_FRAME::GetAuxOrigin() const
|
2011-12-31 05:44:00 +00:00
|
|
|
{
|
|
|
|
wxASSERT( m_Pcb );
|
2013-08-03 05:15:23 +00:00
|
|
|
return m_Pcb->GetAuxOrigin();
|
2011-12-31 05:44:00 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2013-08-03 05:15:23 +00:00
|
|
|
void PCB_BASE_FRAME::SetAuxOrigin( const wxPoint& aPoint )
|
2011-12-31 05:44:00 +00:00
|
|
|
{
|
|
|
|
wxASSERT( m_Pcb );
|
2013-08-03 05:15:23 +00:00
|
|
|
m_Pcb->SetAuxOrigin( aPoint );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
const wxPoint& PCB_BASE_FRAME::GetGridOrigin() const
|
|
|
|
{
|
|
|
|
wxASSERT( m_Pcb );
|
|
|
|
return m_Pcb->GetGridOrigin();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void PCB_BASE_FRAME::SetGridOrigin( const wxPoint& aPoint )
|
|
|
|
{
|
|
|
|
wxASSERT( m_Pcb );
|
|
|
|
m_Pcb->SetGridOrigin( aPoint );
|
2011-12-22 21:57:50 +00:00
|
|
|
}
|
|
|
|
|
2008-03-04 04:22:27 +00:00
|
|
|
|
2012-01-09 08:35:06 +00:00
|
|
|
const TITLE_BLOCK& PCB_BASE_FRAME::GetTitleBlock() const
|
|
|
|
{
|
|
|
|
wxASSERT( m_Pcb );
|
|
|
|
return m_Pcb->GetTitleBlock();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void PCB_BASE_FRAME::SetTitleBlock( const TITLE_BLOCK& aTitleBlock )
|
|
|
|
{
|
|
|
|
wxASSERT( m_Pcb );
|
|
|
|
m_Pcb->SetTitleBlock( aTitleBlock );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2012-02-02 17:45:37 +00:00
|
|
|
BOARD_DESIGN_SETTINGS& PCB_BASE_FRAME::GetDesignSettings() const
|
|
|
|
{
|
|
|
|
wxASSERT( m_Pcb );
|
|
|
|
return m_Pcb->GetDesignSettings();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void PCB_BASE_FRAME::SetDesignSettings( const BOARD_DESIGN_SETTINGS& aSettings )
|
|
|
|
{
|
|
|
|
wxASSERT( m_Pcb );
|
|
|
|
m_Pcb->SetDesignSettings( aSettings );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2012-02-06 05:44:19 +00:00
|
|
|
const ZONE_SETTINGS& PCB_BASE_FRAME::GetZoneSettings() const
|
|
|
|
{
|
|
|
|
wxASSERT( m_Pcb );
|
|
|
|
return m_Pcb->GetZoneSettings();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void PCB_BASE_FRAME::SetZoneSettings( const ZONE_SETTINGS& aSettings )
|
|
|
|
{
|
|
|
|
wxASSERT( m_Pcb );
|
|
|
|
m_Pcb->SetZoneSettings( aSettings );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2012-04-05 18:27:56 +00:00
|
|
|
const PCB_PLOT_PARAMS& PCB_BASE_FRAME::GetPlotSettings() const
|
|
|
|
{
|
|
|
|
wxASSERT( m_Pcb );
|
|
|
|
return m_Pcb->GetPlotOptions();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void PCB_BASE_FRAME::SetPlotSettings( const PCB_PLOT_PARAMS& aSettings )
|
|
|
|
{
|
|
|
|
wxASSERT( m_Pcb );
|
|
|
|
m_Pcb->SetPlotOptions( aSettings );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
++PCBNew
* Removed Pcb_Frame argument from BOARD() constructor, since it precludes
having a BOARD being edited by more than one editor, it was a bad design.
And this meant removing m_PcbFrame from BOARD.
* removed BOARD::SetWindowFrame(), and BOARD::m_PcbFrame
* Removed the global BOARD_DESIGN_SETTINGS which was in class_board.cpp
* added BOARD_DESIGN_SETTINGS to the BOARD class, a full instance
* a couple dialogs now only change BOARD_DESIGN_SETTINGS when OK is pressed,
such as dialog_mask_clearance, dialog_drc, etc.
* Removed common/pcbcommon.cpp's int g_CurrentVersionPCB = 1 and replaced it
with build_version.h's #define BOARD_FILE_VERSION, although there may be a
better place for this constant.
* Made the public functions in PARAM_CFG_ARRAY be type const.
void SaveParam(..) const and void ReadParam(..) const
* PARAM_CFG_BASE now has virtual destructor since we have various way of
destroying the derived class and boost::ptr_vector must be told about this.
* Pass const PARAM_CFG_ARRAY& instead of PARAM_CFG_ARRAY so that we can use
an automatic PARAM_CFG_ARRAY which is on the stack.\
* PCB_EDIT_FRAME::GetProjectFileParameters() may no longer cache the array,
since it has to access the current BOARD and the BOARD can change.
Remember BOARD_DESIGN_SETTINGS are now in the BOARD.
* Made the m_BoundingBox member private, this was a brutally hard task,
and indicative of the lack of commitment to accessors and object oriented
design on the part of KiCad developers. We must do better.
Added BOARD::GetBoundingBox, SetBoundingBox(), ComputeBoundingBox().
* Added PCB_BASE_FRAME::GetBoardBoundingBox() which calls BOARD::ComputeBoundingBox()
2011-12-05 06:15:33 +00:00
|
|
|
EDA_RECT PCB_BASE_FRAME::GetBoardBoundingBox( bool aBoardEdgesOnly ) const
|
|
|
|
{
|
|
|
|
wxASSERT( m_Pcb );
|
|
|
|
|
|
|
|
EDA_RECT area = m_Pcb->ComputeBoundingBox( aBoardEdgesOnly );
|
|
|
|
|
|
|
|
if( area.GetWidth() == 0 && area.GetHeight() == 0 )
|
|
|
|
{
|
2011-12-22 21:57:50 +00:00
|
|
|
wxSize pageSize = GetPageSizeIU();
|
|
|
|
|
2011-12-14 20:03:15 +00:00
|
|
|
if( m_showBorderAndTitleBlock )
|
++PCBNew
* Removed Pcb_Frame argument from BOARD() constructor, since it precludes
having a BOARD being edited by more than one editor, it was a bad design.
And this meant removing m_PcbFrame from BOARD.
* removed BOARD::SetWindowFrame(), and BOARD::m_PcbFrame
* Removed the global BOARD_DESIGN_SETTINGS which was in class_board.cpp
* added BOARD_DESIGN_SETTINGS to the BOARD class, a full instance
* a couple dialogs now only change BOARD_DESIGN_SETTINGS when OK is pressed,
such as dialog_mask_clearance, dialog_drc, etc.
* Removed common/pcbcommon.cpp's int g_CurrentVersionPCB = 1 and replaced it
with build_version.h's #define BOARD_FILE_VERSION, although there may be a
better place for this constant.
* Made the public functions in PARAM_CFG_ARRAY be type const.
void SaveParam(..) const and void ReadParam(..) const
* PARAM_CFG_BASE now has virtual destructor since we have various way of
destroying the derived class and boost::ptr_vector must be told about this.
* Pass const PARAM_CFG_ARRAY& instead of PARAM_CFG_ARRAY so that we can use
an automatic PARAM_CFG_ARRAY which is on the stack.\
* PCB_EDIT_FRAME::GetProjectFileParameters() may no longer cache the array,
since it has to access the current BOARD and the BOARD can change.
Remember BOARD_DESIGN_SETTINGS are now in the BOARD.
* Made the m_BoundingBox member private, this was a brutally hard task,
and indicative of the lack of commitment to accessors and object oriented
design on the part of KiCad developers. We must do better.
Added BOARD::GetBoundingBox, SetBoundingBox(), ComputeBoundingBox().
* Added PCB_BASE_FRAME::GetBoardBoundingBox() which calls BOARD::ComputeBoundingBox()
2011-12-05 06:15:33 +00:00
|
|
|
{
|
|
|
|
area.SetOrigin( 0, 0 );
|
2011-12-22 21:57:50 +00:00
|
|
|
area.SetEnd( pageSize.x, pageSize.y );
|
++PCBNew
* Removed Pcb_Frame argument from BOARD() constructor, since it precludes
having a BOARD being edited by more than one editor, it was a bad design.
And this meant removing m_PcbFrame from BOARD.
* removed BOARD::SetWindowFrame(), and BOARD::m_PcbFrame
* Removed the global BOARD_DESIGN_SETTINGS which was in class_board.cpp
* added BOARD_DESIGN_SETTINGS to the BOARD class, a full instance
* a couple dialogs now only change BOARD_DESIGN_SETTINGS when OK is pressed,
such as dialog_mask_clearance, dialog_drc, etc.
* Removed common/pcbcommon.cpp's int g_CurrentVersionPCB = 1 and replaced it
with build_version.h's #define BOARD_FILE_VERSION, although there may be a
better place for this constant.
* Made the public functions in PARAM_CFG_ARRAY be type const.
void SaveParam(..) const and void ReadParam(..) const
* PARAM_CFG_BASE now has virtual destructor since we have various way of
destroying the derived class and boost::ptr_vector must be told about this.
* Pass const PARAM_CFG_ARRAY& instead of PARAM_CFG_ARRAY so that we can use
an automatic PARAM_CFG_ARRAY which is on the stack.\
* PCB_EDIT_FRAME::GetProjectFileParameters() may no longer cache the array,
since it has to access the current BOARD and the BOARD can change.
Remember BOARD_DESIGN_SETTINGS are now in the BOARD.
* Made the m_BoundingBox member private, this was a brutally hard task,
and indicative of the lack of commitment to accessors and object oriented
design on the part of KiCad developers. We must do better.
Added BOARD::GetBoundingBox, SetBoundingBox(), ComputeBoundingBox().
* Added PCB_BASE_FRAME::GetBoardBoundingBox() which calls BOARD::ComputeBoundingBox()
2011-12-05 06:15:33 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2011-12-22 21:57:50 +00:00
|
|
|
area.SetOrigin( -pageSize.x / 2, -pageSize.y / 2 );
|
|
|
|
area.SetEnd( pageSize.x / 2, pageSize.y / 2 );
|
++PCBNew
* Removed Pcb_Frame argument from BOARD() constructor, since it precludes
having a BOARD being edited by more than one editor, it was a bad design.
And this meant removing m_PcbFrame from BOARD.
* removed BOARD::SetWindowFrame(), and BOARD::m_PcbFrame
* Removed the global BOARD_DESIGN_SETTINGS which was in class_board.cpp
* added BOARD_DESIGN_SETTINGS to the BOARD class, a full instance
* a couple dialogs now only change BOARD_DESIGN_SETTINGS when OK is pressed,
such as dialog_mask_clearance, dialog_drc, etc.
* Removed common/pcbcommon.cpp's int g_CurrentVersionPCB = 1 and replaced it
with build_version.h's #define BOARD_FILE_VERSION, although there may be a
better place for this constant.
* Made the public functions in PARAM_CFG_ARRAY be type const.
void SaveParam(..) const and void ReadParam(..) const
* PARAM_CFG_BASE now has virtual destructor since we have various way of
destroying the derived class and boost::ptr_vector must be told about this.
* Pass const PARAM_CFG_ARRAY& instead of PARAM_CFG_ARRAY so that we can use
an automatic PARAM_CFG_ARRAY which is on the stack.\
* PCB_EDIT_FRAME::GetProjectFileParameters() may no longer cache the array,
since it has to access the current BOARD and the BOARD can change.
Remember BOARD_DESIGN_SETTINGS are now in the BOARD.
* Made the m_BoundingBox member private, this was a brutally hard task,
and indicative of the lack of commitment to accessors and object oriented
design on the part of KiCad developers. We must do better.
Added BOARD::GetBoundingBox, SetBoundingBox(), ComputeBoundingBox().
* Added PCB_BASE_FRAME::GetBoardBoundingBox() which calls BOARD::ComputeBoundingBox()
2011-12-05 06:15:33 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return area;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2012-01-05 08:07:11 +00:00
|
|
|
double PCB_BASE_FRAME::BestZoom()
|
2007-06-05 12:10:51 +00:00
|
|
|
{
|
2011-09-14 15:08:44 +00:00
|
|
|
if( m_Pcb == NULL )
|
2012-05-06 20:10:43 +00:00
|
|
|
return 1.0;
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2012-05-06 20:10:43 +00:00
|
|
|
EDA_RECT ibbbox = GetBoardBoundingBox();
|
|
|
|
DSIZE clientz = m_canvas->GetClientSize();
|
|
|
|
DSIZE boardz( ibbbox.GetWidth(), ibbbox.GetHeight() );
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2012-05-06 20:10:43 +00:00
|
|
|
double iu_per_du_X = clientz.x ? boardz.x / clientz.x : 1.0;
|
|
|
|
double iu_per_du_Y = clientz.y ? boardz.y / clientz.y : 1.0;
|
2011-02-21 13:54:29 +00:00
|
|
|
|
2012-05-06 20:10:43 +00:00
|
|
|
double bestzoom = std::max( iu_per_du_X, iu_per_du_Y );
|
2011-11-07 19:04:24 +00:00
|
|
|
|
2013-08-03 05:15:23 +00:00
|
|
|
SetScrollCenterPosition( ibbbox.Centre() );
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2012-05-06 20:10:43 +00:00
|
|
|
return bestzoom;
|
2007-06-05 12:10:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2012-05-28 20:01:51 +00:00
|
|
|
void PCB_BASE_FRAME::CursorGoto( const wxPoint& aPos, bool aWarp )
|
2007-12-04 07:04:53 +00:00
|
|
|
{
|
|
|
|
// factored out of pcbnew/find.cpp
|
|
|
|
|
2012-05-28 20:01:51 +00:00
|
|
|
INSTALL_UNBUFFERED_DC( dc, m_canvas );
|
2008-02-08 00:16:59 +00:00
|
|
|
|
2012-01-05 08:07:11 +00:00
|
|
|
// There may be need to reframe the drawing.
|
2011-12-22 13:28:11 +00:00
|
|
|
if( !m_canvas->IsPointOnDisplay( aPos ) )
|
2007-12-04 07:04:53 +00:00
|
|
|
{
|
2013-08-03 05:15:23 +00:00
|
|
|
SetCrossHairPosition( aPos );
|
2012-05-28 20:01:51 +00:00
|
|
|
RedrawScreen( aPos, aWarp );
|
2007-12-04 07:04:53 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2007-12-06 07:35:26 +00:00
|
|
|
// Put cursor on item position
|
2011-12-22 13:28:11 +00:00
|
|
|
m_canvas->CrossHairOff( &dc );
|
2013-08-03 05:15:23 +00:00
|
|
|
SetCrossHairPosition( aPos );
|
2012-05-28 20:01:51 +00:00
|
|
|
|
|
|
|
if( aWarp )
|
|
|
|
m_canvas->MoveCursorToCrossHair();
|
2007-12-04 07:04:53 +00:00
|
|
|
}
|
2012-05-28 20:01:51 +00:00
|
|
|
m_canvas->CrossHairOn( &dc );
|
|
|
|
m_canvas->CrossHairOn( &dc );
|
2007-12-04 07:04:53 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-10-06 16:16:48 +00:00
|
|
|
// Virtual function
|
2011-03-01 19:26:17 +00:00
|
|
|
void PCB_BASE_FRAME::ReCreateMenuBar( void )
|
2007-06-05 12:10:51 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2012-01-05 08:07:11 +00:00
|
|
|
// Virtual functions: Do nothing for PCB_BASE_FRAME window
|
2011-03-01 19:26:17 +00:00
|
|
|
void PCB_BASE_FRAME::Show3D_Frame( wxCommandEvent& event )
|
2007-06-05 12:10:51 +00:00
|
|
|
{
|
2007-05-06 16:03:28 +00:00
|
|
|
}
|
2007-06-05 12:10:51 +00:00
|
|
|
|
|
|
|
|
2011-03-01 19:26:17 +00:00
|
|
|
// Note: virtual, overridden in PCB_EDIT_FRAME;
|
2013-03-31 13:27:46 +00:00
|
|
|
void PCB_BASE_FRAME::SwitchLayer( wxDC* DC, LAYER_NUM layer )
|
2007-06-15 12:04:24 +00:00
|
|
|
{
|
2013-03-31 13:27:46 +00:00
|
|
|
LAYER_NUM preslayer = ((PCB_SCREEN*)GetScreen())->m_Active_Layer;
|
2007-09-05 04:48:47 +00:00
|
|
|
|
2007-10-10 21:35:41 +00:00
|
|
|
// Check if the specified layer matches the present layer
|
|
|
|
if( layer == preslayer )
|
2007-09-05 04:48:47 +00:00
|
|
|
return;
|
2007-10-07 18:24:15 +00:00
|
|
|
|
2007-10-10 21:35:41 +00:00
|
|
|
// Copper layers cannot be selected unconditionally; how many
|
|
|
|
// of those layers are currently enabled needs to be checked.
|
2013-04-09 16:00:46 +00:00
|
|
|
if( IsCopperLayer( layer ) )
|
2007-10-10 21:35:41 +00:00
|
|
|
{
|
|
|
|
// If only one copper layer is enabled, the only such layer
|
|
|
|
// that can be selected to is the "Copper" layer (so the
|
|
|
|
// selection of any other copper layer is disregarded).
|
2010-01-31 20:01:46 +00:00
|
|
|
if( m_Pcb->GetCopperLayerCount() < 2 )
|
2007-10-10 21:35:41 +00:00
|
|
|
{
|
2009-12-07 03:46:13 +00:00
|
|
|
if( layer != LAYER_N_BACK )
|
2007-10-10 21:35:41 +00:00
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// If more than one copper layer is enabled, the "Copper"
|
|
|
|
// and "Component" layers can be selected, but the total
|
|
|
|
// number of copper layers determines which internal
|
|
|
|
// layers are also capable of being selected.
|
|
|
|
else
|
|
|
|
{
|
2009-12-07 03:46:13 +00:00
|
|
|
if( ( layer != LAYER_N_BACK ) && ( layer != LAYER_N_FRONT )
|
2010-01-31 20:01:46 +00:00
|
|
|
&& ( layer >= m_Pcb->GetCopperLayerCount() - 1 ) )
|
2007-10-10 21:35:41 +00:00
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Is yet more checking required? E.g. when the layer to be selected
|
|
|
|
// is a non-copper layer, or when switching between a copper layer
|
|
|
|
// and a non-copper layer, or vice-versa?
|
|
|
|
// ...
|
2007-09-05 04:48:47 +00:00
|
|
|
|
2009-10-28 11:48:47 +00:00
|
|
|
GetScreen()->m_Active_Layer = layer;
|
2007-09-05 04:48:47 +00:00
|
|
|
|
|
|
|
if( DisplayOpt.ContrastModeDisplay )
|
2013-09-20 15:29:32 +00:00
|
|
|
m_canvas->Refresh();
|
2007-06-15 12:04:24 +00:00
|
|
|
}
|
|
|
|
|
2007-09-12 02:14:07 +00:00
|
|
|
|
2011-03-01 19:26:17 +00:00
|
|
|
void PCB_BASE_FRAME::OnTogglePolarCoords( wxCommandEvent& aEvent )
|
2011-02-21 13:54:29 +00:00
|
|
|
{
|
|
|
|
SetStatusText( wxEmptyString );
|
|
|
|
DisplayOpt.DisplayPolarCood = !DisplayOpt.DisplayPolarCood;
|
|
|
|
UpdateStatusBar();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2011-03-01 19:26:17 +00:00
|
|
|
void PCB_BASE_FRAME::OnTogglePadDrawMode( wxCommandEvent& aEvent )
|
2011-02-21 13:54:29 +00:00
|
|
|
{
|
|
|
|
m_DisplayPadFill = DisplayOpt.DisplayPadFill = !m_DisplayPadFill;
|
2013-04-08 08:54:31 +00:00
|
|
|
|
|
|
|
// Apply new display options to the GAL canvas
|
2013-10-14 14:13:35 +00:00
|
|
|
KIGFX::PCB_PAINTER* painter =
|
2013-12-26 22:36:43 +00:00
|
|
|
static_cast<KIGFX::PCB_PAINTER*> ( GetGalCanvas()->GetView()->GetPainter() );
|
2013-10-14 14:13:35 +00:00
|
|
|
KIGFX::PCB_RENDER_SETTINGS* settings =
|
|
|
|
static_cast<KIGFX::PCB_RENDER_SETTINGS*> ( painter->GetSettings() );
|
2013-04-08 08:54:31 +00:00
|
|
|
settings->LoadDisplayOptions( DisplayOpt );
|
2013-12-26 22:36:43 +00:00
|
|
|
GetGalCanvas()->GetView()->RecacheAllItems( true );
|
2013-04-08 08:54:31 +00:00
|
|
|
|
2013-09-20 15:29:32 +00:00
|
|
|
m_canvas->Refresh();
|
2011-02-21 13:54:29 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2011-03-01 19:26:17 +00:00
|
|
|
void PCB_BASE_FRAME::OnUpdateCoordType( wxUpdateUIEvent& aEvent )
|
2011-02-21 13:54:29 +00:00
|
|
|
{
|
|
|
|
aEvent.Check( DisplayOpt.DisplayPolarCood );
|
2011-12-14 20:03:15 +00:00
|
|
|
m_optionsToolBar->SetToolShortHelp( ID_TB_OPTIONS_SHOW_POLAR_COORD,
|
2011-02-21 13:54:29 +00:00
|
|
|
DisplayOpt.DisplayPolarCood ?
|
|
|
|
_( "Display rectangular coordinates" ) :
|
|
|
|
_( "Display polar coordinates" ) );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2011-03-01 19:26:17 +00:00
|
|
|
void PCB_BASE_FRAME::OnUpdatePadDrawMode( wxUpdateUIEvent& aEvent )
|
2011-02-21 13:54:29 +00:00
|
|
|
{
|
|
|
|
aEvent.Check( !m_DisplayPadFill );
|
2011-12-14 20:03:15 +00:00
|
|
|
m_optionsToolBar->SetToolShortHelp( ID_TB_OPTIONS_SHOW_PADS_SKETCH,
|
2011-02-21 13:54:29 +00:00
|
|
|
m_DisplayPadFill ?
|
|
|
|
_( "Show pads in outline mode" ) :
|
|
|
|
_( "Show pads in fill mode" ) );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2011-03-01 19:26:17 +00:00
|
|
|
void PCB_BASE_FRAME::OnUpdateSelectGrid( wxUpdateUIEvent& aEvent )
|
2011-02-21 13:54:29 +00:00
|
|
|
{
|
|
|
|
// No need to update the grid select box if it doesn't exist or the grid setting change
|
|
|
|
// was made using the select box.
|
2011-12-14 20:03:15 +00:00
|
|
|
if( m_gridSelectBox == NULL || m_auxiliaryToolBar == NULL )
|
2011-02-21 13:54:29 +00:00
|
|
|
return;
|
|
|
|
|
|
|
|
int select = wxNOT_FOUND;
|
|
|
|
|
2011-03-01 19:26:17 +00:00
|
|
|
for( size_t i = 0; i < GetScreen()->GetGridCount(); i++ )
|
2011-02-21 13:54:29 +00:00
|
|
|
{
|
2011-03-01 19:26:17 +00:00
|
|
|
if( GetScreen()->GetGridId() == GetScreen()->GetGrid( i ).m_Id )
|
2011-02-21 13:54:29 +00:00
|
|
|
{
|
2011-03-01 19:26:17 +00:00
|
|
|
select = (int) i;
|
|
|
|
break;
|
2011-02-21 13:54:29 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-12-14 20:03:15 +00:00
|
|
|
if( select != m_gridSelectBox->GetSelection() )
|
|
|
|
m_gridSelectBox->SetSelection( select );
|
2011-02-21 13:54:29 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2011-03-01 19:26:17 +00:00
|
|
|
void PCB_BASE_FRAME::OnUpdateSelectZoom( wxUpdateUIEvent& aEvent )
|
2011-02-21 13:54:29 +00:00
|
|
|
{
|
2011-12-14 20:03:15 +00:00
|
|
|
if( m_zoomSelectBox == NULL || m_auxiliaryToolBar == NULL )
|
2011-02-21 13:54:29 +00:00
|
|
|
return;
|
|
|
|
|
|
|
|
int current = 0;
|
|
|
|
|
2012-05-06 20:10:43 +00:00
|
|
|
for( unsigned i = 0; i < GetScreen()->m_ZoomList.size(); i++ )
|
2011-02-21 13:54:29 +00:00
|
|
|
{
|
|
|
|
if( GetScreen()->GetZoom() == GetScreen()->m_ZoomList[i] )
|
|
|
|
{
|
|
|
|
current = i + 1;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-12-14 20:03:15 +00:00
|
|
|
if( current != m_zoomSelectBox->GetSelection() )
|
|
|
|
m_zoomSelectBox->SetSelection( current );
|
2011-02-21 13:54:29 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2011-03-01 19:26:17 +00:00
|
|
|
void PCB_BASE_FRAME::ProcessItemSelection( wxCommandEvent& aEvent )
|
2007-09-12 02:14:07 +00:00
|
|
|
{
|
2011-02-21 13:54:29 +00:00
|
|
|
int id = aEvent.GetId();
|
2007-10-07 18:24:15 +00:00
|
|
|
|
2007-09-12 02:14:07 +00:00
|
|
|
// index into the collector list:
|
2007-10-07 18:24:15 +00:00
|
|
|
int itemNdx = id - ID_POPUP_PCB_ITEM_SELECTION_START;
|
|
|
|
|
2011-02-21 13:54:29 +00:00
|
|
|
if( id >= ID_POPUP_PCB_ITEM_SELECTION_START && id <= ID_POPUP_PCB_ITEM_SELECTION_END )
|
2007-10-07 18:24:15 +00:00
|
|
|
{
|
|
|
|
BOARD_ITEM* item = (*m_Collector)[itemNdx];
|
2011-12-29 20:11:42 +00:00
|
|
|
m_canvas->SetAbortRequest( false );
|
2007-09-12 02:14:07 +00:00
|
|
|
|
2008-02-05 02:13:16 +00:00
|
|
|
#if 0 && defined (DEBUG)
|
2007-10-07 18:24:15 +00:00
|
|
|
item->Show( 0, std::cout );
|
2007-09-12 02:14:07 +00:00
|
|
|
#endif
|
2007-10-07 18:24:15 +00:00
|
|
|
|
|
|
|
SetCurItem( item );
|
|
|
|
}
|
2007-09-12 02:14:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2011-03-01 19:26:17 +00:00
|
|
|
void PCB_BASE_FRAME::SetCurItem( BOARD_ITEM* aItem, bool aDisplayInfo )
|
2007-09-12 02:14:07 +00:00
|
|
|
{
|
2008-04-17 16:25:29 +00:00
|
|
|
GetScreen()->SetCurItem( aItem );
|
2008-02-08 00:16:59 +00:00
|
|
|
|
2007-09-12 02:14:07 +00:00
|
|
|
if( aItem )
|
2007-10-10 12:43:30 +00:00
|
|
|
{
|
2009-10-14 18:14:58 +00:00
|
|
|
if( aDisplayInfo )
|
2013-01-12 17:32:24 +00:00
|
|
|
{
|
|
|
|
MSG_PANEL_ITEMS items;
|
|
|
|
aItem->GetMsgPanelInfo( items );
|
|
|
|
SetMsgPanel( items );
|
|
|
|
}
|
2008-02-08 00:16:59 +00:00
|
|
|
|
2008-12-04 04:28:11 +00:00
|
|
|
#if 0 && defined(DEBUG)
|
2007-10-10 12:43:30 +00:00
|
|
|
aItem->Show( 0, std::cout );
|
|
|
|
#endif
|
2008-02-08 00:16:59 +00:00
|
|
|
|
2007-10-10 12:43:30 +00:00
|
|
|
}
|
2007-09-12 02:14:07 +00:00
|
|
|
else
|
|
|
|
{
|
2007-10-10 12:43:30 +00:00
|
|
|
// we can use either of these two:
|
2008-02-08 00:16:59 +00:00
|
|
|
|
2013-01-12 17:32:24 +00:00
|
|
|
MSG_PANEL_ITEMS items;
|
|
|
|
m_Pcb->GetMsgPanelInfo( items ); // show the BOARD stuff
|
|
|
|
SetMsgPanel( items );
|
2008-02-08 00:16:59 +00:00
|
|
|
|
2008-02-05 02:13:16 +00:00
|
|
|
#if 0 && defined(DEBUG)
|
2007-10-10 12:43:30 +00:00
|
|
|
std::cout << "SetCurItem(NULL)\n";
|
|
|
|
#endif
|
|
|
|
|
2007-09-12 02:14:07 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2011-03-01 19:26:17 +00:00
|
|
|
BOARD_ITEM* PCB_BASE_FRAME::GetCurItem()
|
2007-10-07 18:24:15 +00:00
|
|
|
{
|
2008-04-17 16:25:29 +00:00
|
|
|
return GetScreen()->GetCurItem();
|
2007-09-12 02:14:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2011-03-01 19:26:17 +00:00
|
|
|
GENERAL_COLLECTORS_GUIDE PCB_BASE_FRAME::GetCollectorsGuide()
|
2007-09-05 04:48:47 +00:00
|
|
|
{
|
2010-01-31 20:01:46 +00:00
|
|
|
GENERAL_COLLECTORS_GUIDE guide( m_Pcb->GetVisibleLayers(),
|
2009-11-12 15:43:38 +00:00
|
|
|
( (PCB_SCREEN*)GetScreen())->m_Active_Layer );
|
2007-09-05 04:48:47 +00:00
|
|
|
|
|
|
|
// account for the globals
|
2010-01-31 20:01:46 +00:00
|
|
|
guide.SetIgnoreMTextsMarkedNoShow( ! m_Pcb->IsElementVisible( MOD_TEXT_INVISIBLE ));
|
|
|
|
guide.SetIgnoreMTextsOnCopper( ! m_Pcb->IsElementVisible( MOD_TEXT_BK_VISIBLE ));
|
|
|
|
guide.SetIgnoreMTextsOnCmp( ! m_Pcb->IsElementVisible( MOD_TEXT_FR_VISIBLE ));
|
|
|
|
guide.SetIgnoreModulesOnCu( ! m_Pcb->IsElementVisible( MOD_BK_VISIBLE ) );
|
|
|
|
guide.SetIgnoreModulesOnCmp( ! m_Pcb->IsElementVisible( MOD_FR_VISIBLE ) );
|
2010-02-05 10:56:23 +00:00
|
|
|
guide.SetIgnorePadsOnBack( ! m_Pcb->IsElementVisible( PAD_BK_VISIBLE ) );
|
|
|
|
guide.SetIgnorePadsOnFront( ! m_Pcb->IsElementVisible( PAD_FR_VISIBLE ) );
|
2011-12-14 22:35:03 +00:00
|
|
|
guide.SetIgnoreModulesVals( ! m_Pcb->IsElementVisible( MOD_VALUES_VISIBLE ) );
|
|
|
|
guide.SetIgnoreModulesRefs( ! m_Pcb->IsElementVisible( MOD_REFERENCES_VISIBLE ) );
|
2007-09-05 04:48:47 +00:00
|
|
|
|
|
|
|
return guide;
|
|
|
|
}
|
2008-12-19 13:51:48 +00:00
|
|
|
|
2011-03-01 19:26:17 +00:00
|
|
|
void PCB_BASE_FRAME::SetToolID( int aId, int aCursor, const wxString& aToolMsg )
|
2008-12-19 13:51:48 +00:00
|
|
|
{
|
|
|
|
bool redraw = false;
|
|
|
|
|
2011-01-21 19:30:59 +00:00
|
|
|
EDA_DRAW_FRAME::SetToolID( aId, aCursor, aToolMsg );
|
2008-12-19 13:51:48 +00:00
|
|
|
|
2010-07-27 16:49:38 +00:00
|
|
|
if( aId < 0 )
|
2008-12-19 13:51:48 +00:00
|
|
|
return;
|
|
|
|
|
|
|
|
// handle color changes for transitions in and out of ID_TRACK_BUTT
|
2011-02-24 20:22:12 +00:00
|
|
|
if( ( GetToolId() == ID_TRACK_BUTT && aId != ID_TRACK_BUTT )
|
|
|
|
|| ( GetToolId() != ID_TRACK_BUTT && aId== ID_TRACK_BUTT ) )
|
2008-12-19 13:51:48 +00:00
|
|
|
{
|
|
|
|
if( DisplayOpt.ContrastModeDisplay )
|
|
|
|
redraw = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
// must do this after the tool has been set, otherwise pad::Draw() does
|
|
|
|
// not show proper color when DisplayOpt.ContrastModeDisplay is true.
|
2013-09-20 15:29:32 +00:00
|
|
|
if( redraw && m_canvas)
|
|
|
|
m_canvas->Refresh();
|
2008-12-19 13:51:48 +00:00
|
|
|
}
|
|
|
|
|
2009-11-12 15:43:38 +00:00
|
|
|
|
2009-01-31 10:05:16 +00:00
|
|
|
/*
|
|
|
|
* Update the status bar information.
|
|
|
|
*/
|
2011-03-01 19:26:17 +00:00
|
|
|
void PCB_BASE_FRAME::UpdateStatusBar()
|
2008-12-19 13:51:48 +00:00
|
|
|
{
|
2011-01-21 19:30:59 +00:00
|
|
|
EDA_DRAW_FRAME::UpdateStatusBar();
|
2008-12-19 13:51:48 +00:00
|
|
|
|
2012-04-13 18:51:24 +00:00
|
|
|
PCB_SCREEN* screen = GetScreen();
|
|
|
|
|
|
|
|
if( !screen )
|
|
|
|
return;
|
2011-02-05 02:21:11 +00:00
|
|
|
|
2012-04-13 18:51:24 +00:00
|
|
|
int dx;
|
|
|
|
int dy;
|
|
|
|
double dXpos;
|
|
|
|
double dYpos;
|
|
|
|
wxString line;
|
|
|
|
wxString locformatter;
|
2008-12-19 13:51:48 +00:00
|
|
|
|
2012-04-13 18:51:24 +00:00
|
|
|
if( DisplayOpt.DisplayPolarCood ) // display polar coordinates
|
|
|
|
{
|
2011-02-05 02:21:11 +00:00
|
|
|
double theta, ro;
|
2008-12-19 13:51:48 +00:00
|
|
|
|
2013-08-03 05:15:23 +00:00
|
|
|
dx = GetCrossHairPosition().x - screen->m_O_Curseur.x;
|
|
|
|
dy = GetCrossHairPosition().y - screen->m_O_Curseur.y;
|
2008-12-19 13:51:48 +00:00
|
|
|
|
2013-05-01 17:32:36 +00:00
|
|
|
theta = ArcTangente( -dy, dx ) / 10;
|
2008-12-19 13:51:48 +00:00
|
|
|
|
2013-05-01 17:32:36 +00:00
|
|
|
ro = hypot( dx, dy );
|
2010-07-12 14:07:09 +00:00
|
|
|
wxString formatter;
|
|
|
|
switch( g_UserUnit )
|
|
|
|
{
|
2012-05-06 23:32:01 +00:00
|
|
|
#if defined( USE_PCBNEW_NANOMETRE )
|
|
|
|
case INCHES:
|
|
|
|
formatter = wxT( "Ro %.6f Th %.1f" );
|
|
|
|
break;
|
|
|
|
|
|
|
|
case MILLIMETRES:
|
|
|
|
formatter = wxT( "Ro %.6f Th %.1f" );
|
|
|
|
break;
|
|
|
|
#else
|
2010-07-12 14:07:09 +00:00
|
|
|
case INCHES:
|
|
|
|
formatter = wxT( "Ro %.4f Th %.1f" );
|
|
|
|
break;
|
|
|
|
|
|
|
|
case MILLIMETRES:
|
|
|
|
formatter = wxT( "Ro %.3f Th %.1f" );
|
|
|
|
break;
|
2012-05-06 23:32:01 +00:00
|
|
|
#endif
|
2010-07-12 14:07:09 +00:00
|
|
|
|
|
|
|
case UNSCALED_UNITS:
|
|
|
|
formatter = wxT( "Ro %f Th %f" );
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2012-04-13 18:51:24 +00:00
|
|
|
line.Printf( formatter, To_User_Unit( g_UserUnit, ro ), theta );
|
2009-04-09 18:16:16 +00:00
|
|
|
|
2012-05-04 17:44:42 +00:00
|
|
|
SetStatusText( line, 3 );
|
2008-12-19 13:51:48 +00:00
|
|
|
}
|
2012-04-13 18:51:24 +00:00
|
|
|
|
2012-05-04 17:44:42 +00:00
|
|
|
// Display absolute coordinates:
|
2013-08-03 05:15:23 +00:00
|
|
|
dXpos = To_User_Unit( g_UserUnit, GetCrossHairPosition().x );
|
|
|
|
dYpos = To_User_Unit( g_UserUnit, GetCrossHairPosition().y );
|
2012-04-13 18:51:24 +00:00
|
|
|
|
2012-05-04 17:44:42 +00:00
|
|
|
// The following sadly is an if Eeschema/if Pcbnew
|
|
|
|
wxString absformatter;
|
2012-04-13 18:51:24 +00:00
|
|
|
|
2012-05-04 17:44:42 +00:00
|
|
|
switch( g_UserUnit )
|
|
|
|
{
|
2012-05-06 23:32:01 +00:00
|
|
|
case INCHES:
|
|
|
|
absformatter = wxT( "X %.6f Y %.6f" );
|
|
|
|
locformatter = wxT( "dx %.6f dy %.6f d %.6f" );
|
|
|
|
break;
|
|
|
|
|
|
|
|
case MILLIMETRES:
|
|
|
|
absformatter = wxT( "X %.6f Y %.6f" );
|
|
|
|
locformatter = wxT( "dx %.6f dy %.6f d %.6f" );
|
|
|
|
break;
|
2012-05-04 17:44:42 +00:00
|
|
|
|
|
|
|
case UNSCALED_UNITS:
|
|
|
|
absformatter = wxT( "X %f Y %f" );
|
|
|
|
locformatter = wxT( "dx %f dy %f d %f" );
|
|
|
|
break;
|
2012-04-13 18:51:24 +00:00
|
|
|
}
|
|
|
|
|
2012-05-04 17:44:42 +00:00
|
|
|
line.Printf( absformatter, dXpos, dYpos );
|
|
|
|
SetStatusText( line, 2 );
|
2012-04-13 18:51:24 +00:00
|
|
|
|
2012-05-04 17:44:42 +00:00
|
|
|
if( !DisplayOpt.DisplayPolarCood ) // display relative cartesian coordinates
|
2012-04-13 18:51:24 +00:00
|
|
|
{
|
2012-05-04 17:44:42 +00:00
|
|
|
// Display relative coordinates:
|
2013-08-03 05:15:23 +00:00
|
|
|
dx = GetCrossHairPosition().x - screen->m_O_Curseur.x;
|
|
|
|
dy = GetCrossHairPosition().y - screen->m_O_Curseur.y;
|
2012-05-04 17:44:42 +00:00
|
|
|
dXpos = To_User_Unit( g_UserUnit, dx );
|
|
|
|
dYpos = To_User_Unit( g_UserUnit, dy );
|
2012-04-13 18:51:24 +00:00
|
|
|
|
2012-05-04 17:44:42 +00:00
|
|
|
// We already decided the formatter above
|
2013-05-01 17:32:36 +00:00
|
|
|
line.Printf( locformatter, dXpos, dYpos, hypot( dXpos, dYpos ) );
|
2012-05-04 17:44:42 +00:00
|
|
|
SetStatusText( line, 3 );
|
|
|
|
}
|
2008-12-19 13:51:48 +00:00
|
|
|
}
|
2009-04-05 20:49:15 +00:00
|
|
|
|
|
|
|
|
2011-03-01 19:26:17 +00:00
|
|
|
void PCB_BASE_FRAME::unitsChangeRefresh()
|
|
|
|
{
|
|
|
|
EDA_DRAW_FRAME::unitsChangeRefresh(); // Update the status bar.
|
|
|
|
|
|
|
|
updateGridSelectBox();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
* KIWAY Milestone A): Make major modules into DLL/DSOs.
! The initial testing of this commit should be done using a Debug build so that
all the wxASSERT()s are enabled. Also, be sure and keep enabled the
USE_KIWAY_DLLs option. The tree won't likely build without it. Turning it
off is senseless anyways. If you want stable code, go back to a prior version,
the one tagged with "stable".
* Relocate all functionality out of the wxApp derivative into more finely
targeted purposes:
a) DLL/DSO specific
b) PROJECT specific
c) EXE or process specific
d) configuration file specific data
e) configuration file manipulations functions.
All of this functionality was blended into an extremely large wxApp derivative
and that was incompatible with the desire to support multiple concurrently
loaded DLL/DSO's ("KIFACE")s and multiple concurrently open projects.
An amazing amount of organization come from simply sorting each bit of
functionality into the proper box.
* Switch to wxConfigBase from wxConfig everywhere except instantiation.
* Add classes KIWAY, KIFACE, KIFACE_I, SEARCH_STACK, PGM_BASE, PGM_KICAD,
PGM_SINGLE_TOP,
* Remove "Return" prefix on many function names.
* Remove obvious comments from CMakeLists.txt files, and from else() and endif()s.
* Fix building boost for use in a DSO on linux.
* Remove some of the assumptions in the CMakeLists.txt files that windows had
to be the host platform when building windows binaries.
* Reduce the number of wxStrings being constructed at program load time via
static construction.
* Pass wxConfigBase* to all SaveSettings() and LoadSettings() functions so that
these functions are useful even when the wxConfigBase comes from another
source, as is the case in the KICAD_MANAGER_FRAME.
* Move the setting of the KIPRJMOD environment variable into class PROJECT,
so that it can be moved into a project variable soon, and out of FP_LIB_TABLE.
* Add the KIWAY_PLAYER which is associated with a particular PROJECT, and all
its child wxFrames and wxDialogs now have a Kiway() member function which
returns a KIWAY& that that window tree branch is in support of. This is like
wxWindows DNA in that child windows get this member with proper value at time
of construction.
* Anticipate some of the needs for milestones B) and C) and make code
adjustments now in an effort to reduce work in those milestones.
* No testing has been done for python scripting, since milestone C) has that
being largely reworked and re-thought-out.
2014-03-20 00:42:08 +00:00
|
|
|
void PCB_BASE_FRAME::LoadSettings( wxConfigBase* aCfg )
|
2009-04-05 20:49:15 +00:00
|
|
|
{
|
* KIWAY Milestone A): Make major modules into DLL/DSOs.
! The initial testing of this commit should be done using a Debug build so that
all the wxASSERT()s are enabled. Also, be sure and keep enabled the
USE_KIWAY_DLLs option. The tree won't likely build without it. Turning it
off is senseless anyways. If you want stable code, go back to a prior version,
the one tagged with "stable".
* Relocate all functionality out of the wxApp derivative into more finely
targeted purposes:
a) DLL/DSO specific
b) PROJECT specific
c) EXE or process specific
d) configuration file specific data
e) configuration file manipulations functions.
All of this functionality was blended into an extremely large wxApp derivative
and that was incompatible with the desire to support multiple concurrently
loaded DLL/DSO's ("KIFACE")s and multiple concurrently open projects.
An amazing amount of organization come from simply sorting each bit of
functionality into the proper box.
* Switch to wxConfigBase from wxConfig everywhere except instantiation.
* Add classes KIWAY, KIFACE, KIFACE_I, SEARCH_STACK, PGM_BASE, PGM_KICAD,
PGM_SINGLE_TOP,
* Remove "Return" prefix on many function names.
* Remove obvious comments from CMakeLists.txt files, and from else() and endif()s.
* Fix building boost for use in a DSO on linux.
* Remove some of the assumptions in the CMakeLists.txt files that windows had
to be the host platform when building windows binaries.
* Reduce the number of wxStrings being constructed at program load time via
static construction.
* Pass wxConfigBase* to all SaveSettings() and LoadSettings() functions so that
these functions are useful even when the wxConfigBase comes from another
source, as is the case in the KICAD_MANAGER_FRAME.
* Move the setting of the KIPRJMOD environment variable into class PROJECT,
so that it can be moved into a project variable soon, and out of FP_LIB_TABLE.
* Add the KIWAY_PLAYER which is associated with a particular PROJECT, and all
its child wxFrames and wxDialogs now have a Kiway() member function which
returns a KIWAY& that that window tree branch is in support of. This is like
wxWindows DNA in that child windows get this member with proper value at time
of construction.
* Anticipate some of the needs for milestones B) and C) and make code
adjustments now in an effort to reduce work in those milestones.
* No testing has been done for python scripting, since milestone C) has that
being largely reworked and re-thought-out.
2014-03-20 00:42:08 +00:00
|
|
|
EDA_DRAW_FRAME::LoadSettings( aCfg );
|
2011-02-21 13:54:29 +00:00
|
|
|
|
2009-11-12 15:43:38 +00:00
|
|
|
// Ensure grid id is an existent grid id:
|
2009-11-07 14:36:54 +00:00
|
|
|
if( (m_LastGridSizeId <= 0) ||
|
|
|
|
(m_LastGridSizeId > (ID_POPUP_GRID_USER - ID_POPUP_GRID_LEVEL_1000)) )
|
|
|
|
m_LastGridSizeId = ID_POPUP_GRID_LEVEL_500 - ID_POPUP_GRID_LEVEL_1000;
|
|
|
|
|
* KIWAY Milestone A): Make major modules into DLL/DSOs.
! The initial testing of this commit should be done using a Debug build so that
all the wxASSERT()s are enabled. Also, be sure and keep enabled the
USE_KIWAY_DLLs option. The tree won't likely build without it. Turning it
off is senseless anyways. If you want stable code, go back to a prior version,
the one tagged with "stable".
* Relocate all functionality out of the wxApp derivative into more finely
targeted purposes:
a) DLL/DSO specific
b) PROJECT specific
c) EXE or process specific
d) configuration file specific data
e) configuration file manipulations functions.
All of this functionality was blended into an extremely large wxApp derivative
and that was incompatible with the desire to support multiple concurrently
loaded DLL/DSO's ("KIFACE")s and multiple concurrently open projects.
An amazing amount of organization come from simply sorting each bit of
functionality into the proper box.
* Switch to wxConfigBase from wxConfig everywhere except instantiation.
* Add classes KIWAY, KIFACE, KIFACE_I, SEARCH_STACK, PGM_BASE, PGM_KICAD,
PGM_SINGLE_TOP,
* Remove "Return" prefix on many function names.
* Remove obvious comments from CMakeLists.txt files, and from else() and endif()s.
* Fix building boost for use in a DSO on linux.
* Remove some of the assumptions in the CMakeLists.txt files that windows had
to be the host platform when building windows binaries.
* Reduce the number of wxStrings being constructed at program load time via
static construction.
* Pass wxConfigBase* to all SaveSettings() and LoadSettings() functions so that
these functions are useful even when the wxConfigBase comes from another
source, as is the case in the KICAD_MANAGER_FRAME.
* Move the setting of the KIPRJMOD environment variable into class PROJECT,
so that it can be moved into a project variable soon, and out of FP_LIB_TABLE.
* Add the KIWAY_PLAYER which is associated with a particular PROJECT, and all
its child wxFrames and wxDialogs now have a Kiway() member function which
returns a KIWAY& that that window tree branch is in support of. This is like
wxWindows DNA in that child windows get this member with proper value at time
of construction.
* Anticipate some of the needs for milestones B) and C) and make code
adjustments now in an effort to reduce work in those milestones.
* No testing has been done for python scripting, since milestone C) has that
being largely reworked and re-thought-out.
2014-03-20 00:42:08 +00:00
|
|
|
aCfg->Read( m_FrameName + UserGridSizeXEntry, &m_UserGridSize.x, 0.01 );
|
|
|
|
aCfg->Read( m_FrameName + UserGridSizeYEntry, &m_UserGridSize.y, 0.01 );
|
2011-04-02 16:14:07 +00:00
|
|
|
|
|
|
|
long itmp;
|
* KIWAY Milestone A): Make major modules into DLL/DSOs.
! The initial testing of this commit should be done using a Debug build so that
all the wxASSERT()s are enabled. Also, be sure and keep enabled the
USE_KIWAY_DLLs option. The tree won't likely build without it. Turning it
off is senseless anyways. If you want stable code, go back to a prior version,
the one tagged with "stable".
* Relocate all functionality out of the wxApp derivative into more finely
targeted purposes:
a) DLL/DSO specific
b) PROJECT specific
c) EXE or process specific
d) configuration file specific data
e) configuration file manipulations functions.
All of this functionality was blended into an extremely large wxApp derivative
and that was incompatible with the desire to support multiple concurrently
loaded DLL/DSO's ("KIFACE")s and multiple concurrently open projects.
An amazing amount of organization come from simply sorting each bit of
functionality into the proper box.
* Switch to wxConfigBase from wxConfig everywhere except instantiation.
* Add classes KIWAY, KIFACE, KIFACE_I, SEARCH_STACK, PGM_BASE, PGM_KICAD,
PGM_SINGLE_TOP,
* Remove "Return" prefix on many function names.
* Remove obvious comments from CMakeLists.txt files, and from else() and endif()s.
* Fix building boost for use in a DSO on linux.
* Remove some of the assumptions in the CMakeLists.txt files that windows had
to be the host platform when building windows binaries.
* Reduce the number of wxStrings being constructed at program load time via
static construction.
* Pass wxConfigBase* to all SaveSettings() and LoadSettings() functions so that
these functions are useful even when the wxConfigBase comes from another
source, as is the case in the KICAD_MANAGER_FRAME.
* Move the setting of the KIPRJMOD environment variable into class PROJECT,
so that it can be moved into a project variable soon, and out of FP_LIB_TABLE.
* Add the KIWAY_PLAYER which is associated with a particular PROJECT, and all
its child wxFrames and wxDialogs now have a Kiway() member function which
returns a KIWAY& that that window tree branch is in support of. This is like
wxWindows DNA in that child windows get this member with proper value at time
of construction.
* Anticipate some of the needs for milestones B) and C) and make code
adjustments now in an effort to reduce work in those milestones.
* No testing has been done for python scripting, since milestone C) has that
being largely reworked and re-thought-out.
2014-03-20 00:42:08 +00:00
|
|
|
aCfg->Read( m_FrameName + UserGridUnitsEntry, &itmp, ( long )INCHES );
|
2011-09-06 19:42:46 +00:00
|
|
|
m_UserGridUnit = (EDA_UNITS_T) itmp;
|
* KIWAY Milestone A): Make major modules into DLL/DSOs.
! The initial testing of this commit should be done using a Debug build so that
all the wxASSERT()s are enabled. Also, be sure and keep enabled the
USE_KIWAY_DLLs option. The tree won't likely build without it. Turning it
off is senseless anyways. If you want stable code, go back to a prior version,
the one tagged with "stable".
* Relocate all functionality out of the wxApp derivative into more finely
targeted purposes:
a) DLL/DSO specific
b) PROJECT specific
c) EXE or process specific
d) configuration file specific data
e) configuration file manipulations functions.
All of this functionality was blended into an extremely large wxApp derivative
and that was incompatible with the desire to support multiple concurrently
loaded DLL/DSO's ("KIFACE")s and multiple concurrently open projects.
An amazing amount of organization come from simply sorting each bit of
functionality into the proper box.
* Switch to wxConfigBase from wxConfig everywhere except instantiation.
* Add classes KIWAY, KIFACE, KIFACE_I, SEARCH_STACK, PGM_BASE, PGM_KICAD,
PGM_SINGLE_TOP,
* Remove "Return" prefix on many function names.
* Remove obvious comments from CMakeLists.txt files, and from else() and endif()s.
* Fix building boost for use in a DSO on linux.
* Remove some of the assumptions in the CMakeLists.txt files that windows had
to be the host platform when building windows binaries.
* Reduce the number of wxStrings being constructed at program load time via
static construction.
* Pass wxConfigBase* to all SaveSettings() and LoadSettings() functions so that
these functions are useful even when the wxConfigBase comes from another
source, as is the case in the KICAD_MANAGER_FRAME.
* Move the setting of the KIPRJMOD environment variable into class PROJECT,
so that it can be moved into a project variable soon, and out of FP_LIB_TABLE.
* Add the KIWAY_PLAYER which is associated with a particular PROJECT, and all
its child wxFrames and wxDialogs now have a Kiway() member function which
returns a KIWAY& that that window tree branch is in support of. This is like
wxWindows DNA in that child windows get this member with proper value at time
of construction.
* Anticipate some of the needs for milestones B) and C) and make code
adjustments now in an effort to reduce work in those milestones.
* No testing has been done for python scripting, since milestone C) has that
being largely reworked and re-thought-out.
2014-03-20 00:42:08 +00:00
|
|
|
aCfg->Read( m_FrameName + DisplayPadFillEntry, &m_DisplayPadFill, true );
|
|
|
|
aCfg->Read( m_FrameName + DisplayViaFillEntry, &m_DisplayViaFill, true );
|
|
|
|
aCfg->Read( m_FrameName + DisplayPadNumberEntry, &m_DisplayPadNum, true );
|
|
|
|
aCfg->Read( m_FrameName + DisplayModuleEdgeEntry, &m_DisplayModEdge, ( long )FILLED );
|
2011-02-21 13:54:29 +00:00
|
|
|
|
* KIWAY Milestone A): Make major modules into DLL/DSOs.
! The initial testing of this commit should be done using a Debug build so that
all the wxASSERT()s are enabled. Also, be sure and keep enabled the
USE_KIWAY_DLLs option. The tree won't likely build without it. Turning it
off is senseless anyways. If you want stable code, go back to a prior version,
the one tagged with "stable".
* Relocate all functionality out of the wxApp derivative into more finely
targeted purposes:
a) DLL/DSO specific
b) PROJECT specific
c) EXE or process specific
d) configuration file specific data
e) configuration file manipulations functions.
All of this functionality was blended into an extremely large wxApp derivative
and that was incompatible with the desire to support multiple concurrently
loaded DLL/DSO's ("KIFACE")s and multiple concurrently open projects.
An amazing amount of organization come from simply sorting each bit of
functionality into the proper box.
* Switch to wxConfigBase from wxConfig everywhere except instantiation.
* Add classes KIWAY, KIFACE, KIFACE_I, SEARCH_STACK, PGM_BASE, PGM_KICAD,
PGM_SINGLE_TOP,
* Remove "Return" prefix on many function names.
* Remove obvious comments from CMakeLists.txt files, and from else() and endif()s.
* Fix building boost for use in a DSO on linux.
* Remove some of the assumptions in the CMakeLists.txt files that windows had
to be the host platform when building windows binaries.
* Reduce the number of wxStrings being constructed at program load time via
static construction.
* Pass wxConfigBase* to all SaveSettings() and LoadSettings() functions so that
these functions are useful even when the wxConfigBase comes from another
source, as is the case in the KICAD_MANAGER_FRAME.
* Move the setting of the KIPRJMOD environment variable into class PROJECT,
so that it can be moved into a project variable soon, and out of FP_LIB_TABLE.
* Add the KIWAY_PLAYER which is associated with a particular PROJECT, and all
its child wxFrames and wxDialogs now have a Kiway() member function which
returns a KIWAY& that that window tree branch is in support of. This is like
wxWindows DNA in that child windows get this member with proper value at time
of construction.
* Anticipate some of the needs for milestones B) and C) and make code
adjustments now in an effort to reduce work in those milestones.
* No testing has been done for python scripting, since milestone C) has that
being largely reworked and re-thought-out.
2014-03-20 00:42:08 +00:00
|
|
|
aCfg->Read( m_FrameName + FastGrid1Entry, &itmp, ( long )0);
|
2011-09-09 11:02:03 +00:00
|
|
|
m_FastGrid1 = itmp;
|
* KIWAY Milestone A): Make major modules into DLL/DSOs.
! The initial testing of this commit should be done using a Debug build so that
all the wxASSERT()s are enabled. Also, be sure and keep enabled the
USE_KIWAY_DLLs option. The tree won't likely build without it. Turning it
off is senseless anyways. If you want stable code, go back to a prior version,
the one tagged with "stable".
* Relocate all functionality out of the wxApp derivative into more finely
targeted purposes:
a) DLL/DSO specific
b) PROJECT specific
c) EXE or process specific
d) configuration file specific data
e) configuration file manipulations functions.
All of this functionality was blended into an extremely large wxApp derivative
and that was incompatible with the desire to support multiple concurrently
loaded DLL/DSO's ("KIFACE")s and multiple concurrently open projects.
An amazing amount of organization come from simply sorting each bit of
functionality into the proper box.
* Switch to wxConfigBase from wxConfig everywhere except instantiation.
* Add classes KIWAY, KIFACE, KIFACE_I, SEARCH_STACK, PGM_BASE, PGM_KICAD,
PGM_SINGLE_TOP,
* Remove "Return" prefix on many function names.
* Remove obvious comments from CMakeLists.txt files, and from else() and endif()s.
* Fix building boost for use in a DSO on linux.
* Remove some of the assumptions in the CMakeLists.txt files that windows had
to be the host platform when building windows binaries.
* Reduce the number of wxStrings being constructed at program load time via
static construction.
* Pass wxConfigBase* to all SaveSettings() and LoadSettings() functions so that
these functions are useful even when the wxConfigBase comes from another
source, as is the case in the KICAD_MANAGER_FRAME.
* Move the setting of the KIPRJMOD environment variable into class PROJECT,
so that it can be moved into a project variable soon, and out of FP_LIB_TABLE.
* Add the KIWAY_PLAYER which is associated with a particular PROJECT, and all
its child wxFrames and wxDialogs now have a Kiway() member function which
returns a KIWAY& that that window tree branch is in support of. This is like
wxWindows DNA in that child windows get this member with proper value at time
of construction.
* Anticipate some of the needs for milestones B) and C) and make code
adjustments now in an effort to reduce work in those milestones.
* No testing has been done for python scripting, since milestone C) has that
being largely reworked and re-thought-out.
2014-03-20 00:42:08 +00:00
|
|
|
aCfg->Read( m_FrameName + FastGrid2Entry, &itmp, ( long )0);
|
2011-09-09 11:02:03 +00:00
|
|
|
m_FastGrid2 = itmp;
|
|
|
|
|
2012-01-03 17:14:17 +00:00
|
|
|
if( m_DisplayModEdge < LINE || m_DisplayModEdge > SKETCH )
|
2009-04-23 15:02:18 +00:00
|
|
|
m_DisplayModEdge = FILLED;
|
2011-02-21 13:54:29 +00:00
|
|
|
|
* KIWAY Milestone A): Make major modules into DLL/DSOs.
! The initial testing of this commit should be done using a Debug build so that
all the wxASSERT()s are enabled. Also, be sure and keep enabled the
USE_KIWAY_DLLs option. The tree won't likely build without it. Turning it
off is senseless anyways. If you want stable code, go back to a prior version,
the one tagged with "stable".
* Relocate all functionality out of the wxApp derivative into more finely
targeted purposes:
a) DLL/DSO specific
b) PROJECT specific
c) EXE or process specific
d) configuration file specific data
e) configuration file manipulations functions.
All of this functionality was blended into an extremely large wxApp derivative
and that was incompatible with the desire to support multiple concurrently
loaded DLL/DSO's ("KIFACE")s and multiple concurrently open projects.
An amazing amount of organization come from simply sorting each bit of
functionality into the proper box.
* Switch to wxConfigBase from wxConfig everywhere except instantiation.
* Add classes KIWAY, KIFACE, KIFACE_I, SEARCH_STACK, PGM_BASE, PGM_KICAD,
PGM_SINGLE_TOP,
* Remove "Return" prefix on many function names.
* Remove obvious comments from CMakeLists.txt files, and from else() and endif()s.
* Fix building boost for use in a DSO on linux.
* Remove some of the assumptions in the CMakeLists.txt files that windows had
to be the host platform when building windows binaries.
* Reduce the number of wxStrings being constructed at program load time via
static construction.
* Pass wxConfigBase* to all SaveSettings() and LoadSettings() functions so that
these functions are useful even when the wxConfigBase comes from another
source, as is the case in the KICAD_MANAGER_FRAME.
* Move the setting of the KIPRJMOD environment variable into class PROJECT,
so that it can be moved into a project variable soon, and out of FP_LIB_TABLE.
* Add the KIWAY_PLAYER which is associated with a particular PROJECT, and all
its child wxFrames and wxDialogs now have a Kiway() member function which
returns a KIWAY& that that window tree branch is in support of. This is like
wxWindows DNA in that child windows get this member with proper value at time
of construction.
* Anticipate some of the needs for milestones B) and C) and make code
adjustments now in an effort to reduce work in those milestones.
* No testing has been done for python scripting, since milestone C) has that
being largely reworked and re-thought-out.
2014-03-20 00:42:08 +00:00
|
|
|
aCfg->Read( m_FrameName + DisplayModuleTextEntry, &m_DisplayModText, ( long )FILLED );
|
2011-02-21 13:54:29 +00:00
|
|
|
|
2012-01-03 17:14:17 +00:00
|
|
|
if( m_DisplayModText < LINE || m_DisplayModText > SKETCH )
|
2009-04-23 15:02:18 +00:00
|
|
|
m_DisplayModText = FILLED;
|
2011-04-02 16:14:07 +00:00
|
|
|
|
2013-07-25 16:04:15 +00:00
|
|
|
// Apply display settings for GAL
|
2013-12-26 22:36:43 +00:00
|
|
|
KIGFX::VIEW* view = GetGalCanvas()->GetView();
|
2013-08-07 08:52:50 +00:00
|
|
|
|
|
|
|
// Set rendering order and properties of layers
|
2013-09-19 07:55:37 +00:00
|
|
|
for( LAYER_NUM i = 0; (unsigned) i < sizeof(GAL_LAYER_ORDER) / sizeof(LAYER_NUM); ++i )
|
2013-07-25 16:04:15 +00:00
|
|
|
{
|
2013-09-19 07:55:37 +00:00
|
|
|
LAYER_NUM layer = GAL_LAYER_ORDER[i];
|
2013-10-14 14:13:35 +00:00
|
|
|
wxASSERT( layer < KIGFX::VIEW::VIEW_MAX_LAYERS );
|
2013-07-25 16:04:15 +00:00
|
|
|
|
2013-08-07 08:52:50 +00:00
|
|
|
view->SetLayerOrder( layer, i );
|
2013-07-25 16:04:15 +00:00
|
|
|
|
2013-08-07 08:52:50 +00:00
|
|
|
if( IsCopperLayer( layer ) )
|
2013-08-05 14:28:58 +00:00
|
|
|
{
|
|
|
|
// Copper layers are required for netname layers
|
2013-08-07 08:52:50 +00:00
|
|
|
view->SetRequired( GetNetnameLayer( layer ), layer );
|
2013-10-14 14:13:35 +00:00
|
|
|
view->SetLayerTarget( layer, KIGFX::TARGET_CACHED );
|
2013-08-05 14:28:58 +00:00
|
|
|
}
|
2013-08-07 08:52:50 +00:00
|
|
|
else if( IsNetnameLayer( layer ) )
|
2013-08-05 14:28:58 +00:00
|
|
|
{
|
|
|
|
// Netnames are drawn only when scale is sufficient (level of details)
|
|
|
|
// so there is no point in caching them
|
2013-10-14 14:13:35 +00:00
|
|
|
view->SetLayerTarget( layer, KIGFX::TARGET_NONCACHED );
|
2013-08-05 14:28:58 +00:00
|
|
|
}
|
2013-07-25 16:04:15 +00:00
|
|
|
}
|
|
|
|
|
2013-08-05 14:28:58 +00:00
|
|
|
// Some more required layers settings
|
|
|
|
view->SetRequired( ITEM_GAL_LAYER( VIAS_HOLES_VISIBLE ), ITEM_GAL_LAYER( VIAS_VISIBLE ) );
|
|
|
|
view->SetRequired( ITEM_GAL_LAYER( PADS_HOLES_VISIBLE ), ITEM_GAL_LAYER( PADS_VISIBLE ) );
|
2014-02-03 13:14:53 +00:00
|
|
|
view->SetRequired( NETNAMES_GAL_LAYER( PADS_NETNAMES_VISIBLE ), ITEM_GAL_LAYER( PADS_VISIBLE ) );
|
2013-09-13 15:45:40 +00:00
|
|
|
|
2014-02-03 13:14:53 +00:00
|
|
|
view->SetRequired( NETNAMES_GAL_LAYER( PAD_FR_NETNAMES_VISIBLE ), ITEM_GAL_LAYER( PAD_FR_VISIBLE ) );
|
2013-09-13 15:45:40 +00:00
|
|
|
view->SetRequired( ADHESIVE_N_FRONT, ITEM_GAL_LAYER( PAD_FR_VISIBLE ) );
|
|
|
|
view->SetRequired( SOLDERPASTE_N_FRONT, ITEM_GAL_LAYER( PAD_FR_VISIBLE ) );
|
|
|
|
view->SetRequired( SOLDERMASK_N_FRONT, ITEM_GAL_LAYER( PAD_FR_VISIBLE ) );
|
|
|
|
|
2014-02-03 13:14:53 +00:00
|
|
|
view->SetRequired( NETNAMES_GAL_LAYER( PAD_BK_NETNAMES_VISIBLE ), ITEM_GAL_LAYER( PAD_BK_VISIBLE ) );
|
2013-09-13 15:45:40 +00:00
|
|
|
view->SetRequired( ADHESIVE_N_BACK, ITEM_GAL_LAYER( PAD_BK_VISIBLE ) );
|
|
|
|
view->SetRequired( SOLDERPASTE_N_BACK, ITEM_GAL_LAYER( PAD_BK_VISIBLE ) );
|
|
|
|
view->SetRequired( SOLDERMASK_N_BACK, ITEM_GAL_LAYER( PAD_BK_VISIBLE ) );
|
|
|
|
|
2013-10-14 14:13:35 +00:00
|
|
|
view->SetLayerTarget( ITEM_GAL_LAYER( GP_OVERLAY ), KIGFX::TARGET_OVERLAY );
|
2013-11-25 15:50:03 +00:00
|
|
|
view->SetLayerTarget( ITEM_GAL_LAYER( RATSNEST_VISIBLE ), KIGFX::TARGET_OVERLAY );
|
2013-08-05 14:28:58 +00:00
|
|
|
|
2013-07-25 16:04:15 +00:00
|
|
|
// Apply layer coloring scheme & display options
|
|
|
|
if( view->GetPainter() )
|
|
|
|
{
|
2013-10-14 14:13:35 +00:00
|
|
|
KIGFX::PCB_RENDER_SETTINGS* settings = new KIGFX::PCB_RENDER_SETTINGS();
|
2013-07-25 16:04:15 +00:00
|
|
|
|
|
|
|
// Load layers' colors from PCB data
|
|
|
|
settings->ImportLegacyColors( m_Pcb->GetColorsSettings() );
|
|
|
|
view->GetPainter()->ApplySettings( settings );
|
|
|
|
|
|
|
|
// Load display options (such as filled/outline display of items)
|
|
|
|
settings->LoadDisplayOptions( DisplayOpt );
|
|
|
|
}
|
|
|
|
|
2011-04-02 16:14:07 +00:00
|
|
|
// WxWidgets 2.9.1 seems call setlocale( LC_NUMERIC, "" )
|
|
|
|
// when reading doubles in config,
|
|
|
|
// but forget to back to current locale. So we call SetLocaleTo_Default
|
|
|
|
SetLocaleTo_Default( );
|
2009-04-05 20:49:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
* KIWAY Milestone A): Make major modules into DLL/DSOs.
! The initial testing of this commit should be done using a Debug build so that
all the wxASSERT()s are enabled. Also, be sure and keep enabled the
USE_KIWAY_DLLs option. The tree won't likely build without it. Turning it
off is senseless anyways. If you want stable code, go back to a prior version,
the one tagged with "stable".
* Relocate all functionality out of the wxApp derivative into more finely
targeted purposes:
a) DLL/DSO specific
b) PROJECT specific
c) EXE or process specific
d) configuration file specific data
e) configuration file manipulations functions.
All of this functionality was blended into an extremely large wxApp derivative
and that was incompatible with the desire to support multiple concurrently
loaded DLL/DSO's ("KIFACE")s and multiple concurrently open projects.
An amazing amount of organization come from simply sorting each bit of
functionality into the proper box.
* Switch to wxConfigBase from wxConfig everywhere except instantiation.
* Add classes KIWAY, KIFACE, KIFACE_I, SEARCH_STACK, PGM_BASE, PGM_KICAD,
PGM_SINGLE_TOP,
* Remove "Return" prefix on many function names.
* Remove obvious comments from CMakeLists.txt files, and from else() and endif()s.
* Fix building boost for use in a DSO on linux.
* Remove some of the assumptions in the CMakeLists.txt files that windows had
to be the host platform when building windows binaries.
* Reduce the number of wxStrings being constructed at program load time via
static construction.
* Pass wxConfigBase* to all SaveSettings() and LoadSettings() functions so that
these functions are useful even when the wxConfigBase comes from another
source, as is the case in the KICAD_MANAGER_FRAME.
* Move the setting of the KIPRJMOD environment variable into class PROJECT,
so that it can be moved into a project variable soon, and out of FP_LIB_TABLE.
* Add the KIWAY_PLAYER which is associated with a particular PROJECT, and all
its child wxFrames and wxDialogs now have a Kiway() member function which
returns a KIWAY& that that window tree branch is in support of. This is like
wxWindows DNA in that child windows get this member with proper value at time
of construction.
* Anticipate some of the needs for milestones B) and C) and make code
adjustments now in an effort to reduce work in those milestones.
* No testing has been done for python scripting, since milestone C) has that
being largely reworked and re-thought-out.
2014-03-20 00:42:08 +00:00
|
|
|
void PCB_BASE_FRAME::SaveSettings( wxConfigBase* aCfg )
|
2009-04-05 20:49:15 +00:00
|
|
|
{
|
* KIWAY Milestone A): Make major modules into DLL/DSOs.
! The initial testing of this commit should be done using a Debug build so that
all the wxASSERT()s are enabled. Also, be sure and keep enabled the
USE_KIWAY_DLLs option. The tree won't likely build without it. Turning it
off is senseless anyways. If you want stable code, go back to a prior version,
the one tagged with "stable".
* Relocate all functionality out of the wxApp derivative into more finely
targeted purposes:
a) DLL/DSO specific
b) PROJECT specific
c) EXE or process specific
d) configuration file specific data
e) configuration file manipulations functions.
All of this functionality was blended into an extremely large wxApp derivative
and that was incompatible with the desire to support multiple concurrently
loaded DLL/DSO's ("KIFACE")s and multiple concurrently open projects.
An amazing amount of organization come from simply sorting each bit of
functionality into the proper box.
* Switch to wxConfigBase from wxConfig everywhere except instantiation.
* Add classes KIWAY, KIFACE, KIFACE_I, SEARCH_STACK, PGM_BASE, PGM_KICAD,
PGM_SINGLE_TOP,
* Remove "Return" prefix on many function names.
* Remove obvious comments from CMakeLists.txt files, and from else() and endif()s.
* Fix building boost for use in a DSO on linux.
* Remove some of the assumptions in the CMakeLists.txt files that windows had
to be the host platform when building windows binaries.
* Reduce the number of wxStrings being constructed at program load time via
static construction.
* Pass wxConfigBase* to all SaveSettings() and LoadSettings() functions so that
these functions are useful even when the wxConfigBase comes from another
source, as is the case in the KICAD_MANAGER_FRAME.
* Move the setting of the KIPRJMOD environment variable into class PROJECT,
so that it can be moved into a project variable soon, and out of FP_LIB_TABLE.
* Add the KIWAY_PLAYER which is associated with a particular PROJECT, and all
its child wxFrames and wxDialogs now have a Kiway() member function which
returns a KIWAY& that that window tree branch is in support of. This is like
wxWindows DNA in that child windows get this member with proper value at time
of construction.
* Anticipate some of the needs for milestones B) and C) and make code
adjustments now in an effort to reduce work in those milestones.
* No testing has been done for python scripting, since milestone C) has that
being largely reworked and re-thought-out.
2014-03-20 00:42:08 +00:00
|
|
|
EDA_DRAW_FRAME::SaveSettings( aCfg );
|
2009-04-05 20:49:15 +00:00
|
|
|
|
* KIWAY Milestone A): Make major modules into DLL/DSOs.
! The initial testing of this commit should be done using a Debug build so that
all the wxASSERT()s are enabled. Also, be sure and keep enabled the
USE_KIWAY_DLLs option. The tree won't likely build without it. Turning it
off is senseless anyways. If you want stable code, go back to a prior version,
the one tagged with "stable".
* Relocate all functionality out of the wxApp derivative into more finely
targeted purposes:
a) DLL/DSO specific
b) PROJECT specific
c) EXE or process specific
d) configuration file specific data
e) configuration file manipulations functions.
All of this functionality was blended into an extremely large wxApp derivative
and that was incompatible with the desire to support multiple concurrently
loaded DLL/DSO's ("KIFACE")s and multiple concurrently open projects.
An amazing amount of organization come from simply sorting each bit of
functionality into the proper box.
* Switch to wxConfigBase from wxConfig everywhere except instantiation.
* Add classes KIWAY, KIFACE, KIFACE_I, SEARCH_STACK, PGM_BASE, PGM_KICAD,
PGM_SINGLE_TOP,
* Remove "Return" prefix on many function names.
* Remove obvious comments from CMakeLists.txt files, and from else() and endif()s.
* Fix building boost for use in a DSO on linux.
* Remove some of the assumptions in the CMakeLists.txt files that windows had
to be the host platform when building windows binaries.
* Reduce the number of wxStrings being constructed at program load time via
static construction.
* Pass wxConfigBase* to all SaveSettings() and LoadSettings() functions so that
these functions are useful even when the wxConfigBase comes from another
source, as is the case in the KICAD_MANAGER_FRAME.
* Move the setting of the KIPRJMOD environment variable into class PROJECT,
so that it can be moved into a project variable soon, and out of FP_LIB_TABLE.
* Add the KIWAY_PLAYER which is associated with a particular PROJECT, and all
its child wxFrames and wxDialogs now have a Kiway() member function which
returns a KIWAY& that that window tree branch is in support of. This is like
wxWindows DNA in that child windows get this member with proper value at time
of construction.
* Anticipate some of the needs for milestones B) and C) and make code
adjustments now in an effort to reduce work in those milestones.
* No testing has been done for python scripting, since milestone C) has that
being largely reworked and re-thought-out.
2014-03-20 00:42:08 +00:00
|
|
|
aCfg->Write( m_FrameName + UserGridSizeXEntry, m_UserGridSize.x );
|
|
|
|
aCfg->Write( m_FrameName + UserGridSizeYEntry, m_UserGridSize.y );
|
|
|
|
aCfg->Write( m_FrameName + UserGridUnitsEntry, ( long )m_UserGridUnit );
|
|
|
|
aCfg->Write( m_FrameName + DisplayPadFillEntry, m_DisplayPadFill );
|
|
|
|
aCfg->Write( m_FrameName + DisplayViaFillEntry, m_DisplayViaFill );
|
|
|
|
aCfg->Write( m_FrameName + DisplayPadNumberEntry, m_DisplayPadNum );
|
|
|
|
aCfg->Write( m_FrameName + DisplayModuleEdgeEntry, ( long )m_DisplayModEdge );
|
|
|
|
aCfg->Write( m_FrameName + DisplayModuleTextEntry, ( long )m_DisplayModText );
|
|
|
|
aCfg->Write( m_FrameName + FastGrid1Entry, ( long )m_FastGrid1 );
|
|
|
|
aCfg->Write( m_FrameName + FastGrid2Entry, ( long )m_FastGrid2 );
|
2009-04-05 20:49:15 +00:00
|
|
|
}
|
2010-02-19 13:23:58 +00:00
|
|
|
|
|
|
|
|
2012-01-09 08:35:06 +00:00
|
|
|
void PCB_BASE_FRAME::OnModify()
|
2010-02-19 13:23:58 +00:00
|
|
|
{
|
2011-10-15 13:25:57 +00:00
|
|
|
GetScreen()->SetModify();
|
|
|
|
GetScreen()->SetSave();
|
2010-02-19 13:23:58 +00:00
|
|
|
}
|
2011-02-21 13:54:29 +00:00
|
|
|
|
|
|
|
|
2011-03-01 19:26:17 +00:00
|
|
|
void PCB_BASE_FRAME::updateGridSelectBox()
|
2011-02-21 13:54:29 +00:00
|
|
|
{
|
|
|
|
UpdateStatusBar();
|
|
|
|
DisplayUnitsMsg();
|
|
|
|
|
2011-12-14 20:03:15 +00:00
|
|
|
if( m_gridSelectBox == NULL )
|
2011-02-21 13:54:29 +00:00
|
|
|
return;
|
|
|
|
|
|
|
|
// Update grid values with the current units setting.
|
2011-12-14 20:03:15 +00:00
|
|
|
m_gridSelectBox->Clear();
|
2011-02-21 13:54:29 +00:00
|
|
|
|
|
|
|
wxString msg;
|
2013-02-26 11:25:30 +00:00
|
|
|
wxString format = _( "Grid:");
|
2011-02-21 13:54:29 +00:00
|
|
|
|
|
|
|
switch( g_UserUnit )
|
|
|
|
{
|
2013-02-26 11:25:30 +00:00
|
|
|
case INCHES: // the grid size is displayed in mils
|
2011-02-21 13:54:29 +00:00
|
|
|
case MILLIMETRES:
|
2013-02-26 11:25:30 +00:00
|
|
|
format += wxT( " %.6f" );
|
2011-02-21 13:54:29 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case UNSCALED_UNITS:
|
|
|
|
format += wxT( " %f" );
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
for( size_t i = 0; i < GetScreen()->GetGridCount(); i++ )
|
|
|
|
{
|
|
|
|
GRID_TYPE& grid = GetScreen()->GetGrid( i );
|
2012-04-13 18:51:24 +00:00
|
|
|
double value = To_User_Unit( g_UserUnit, grid.m_Size.x );
|
2013-02-26 11:25:30 +00:00
|
|
|
if( g_UserUnit == INCHES )
|
|
|
|
value *= 1000;
|
2011-02-21 13:54:29 +00:00
|
|
|
|
|
|
|
if( grid.m_Id != ID_POPUP_GRID_USER )
|
|
|
|
{
|
2013-02-26 11:25:30 +00:00
|
|
|
msg.Printf( format.GetData(), value );
|
|
|
|
StripTrailingZeros( msg );
|
2011-02-21 13:54:29 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
msg = _( "User Grid" );
|
|
|
|
|
2011-12-14 20:03:15 +00:00
|
|
|
m_gridSelectBox->Append( msg, (void*) &grid.m_Id );
|
2011-02-21 13:54:29 +00:00
|
|
|
|
|
|
|
if( ( m_LastGridSizeId + ID_POPUP_GRID_LEVEL_1000 ) == GetScreen()->GetGrid( i ).m_Id )
|
2011-12-14 20:03:15 +00:00
|
|
|
m_gridSelectBox->SetSelection( i );
|
2011-02-21 13:54:29 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-03-01 19:26:17 +00:00
|
|
|
void PCB_BASE_FRAME::updateZoomSelectBox()
|
2011-02-21 13:54:29 +00:00
|
|
|
{
|
2011-12-14 20:03:15 +00:00
|
|
|
if( m_zoomSelectBox == NULL )
|
2011-02-21 13:54:29 +00:00
|
|
|
return;
|
|
|
|
|
|
|
|
wxString msg;
|
|
|
|
|
2011-12-14 20:03:15 +00:00
|
|
|
m_zoomSelectBox->Clear();
|
|
|
|
m_zoomSelectBox->Append( _( "Auto" ) );
|
|
|
|
m_zoomSelectBox->SetSelection( 0 );
|
2011-02-21 13:54:29 +00:00
|
|
|
|
2012-05-06 20:10:43 +00:00
|
|
|
for( unsigned i = 0; i < GetScreen()->m_ZoomList.size(); ++i )
|
2011-02-21 13:54:29 +00:00
|
|
|
{
|
|
|
|
msg = _( "Zoom " );
|
|
|
|
|
2012-04-23 21:56:26 +00:00
|
|
|
wxString value = wxString::Format( wxT( "%g" ),
|
|
|
|
|
|
|
|
// @todo could do scaling here and show a "percentage"
|
|
|
|
GetScreen()->m_ZoomList[i]
|
|
|
|
);
|
|
|
|
|
2011-07-05 12:46:14 +00:00
|
|
|
msg += value;
|
2011-02-21 13:54:29 +00:00
|
|
|
|
2011-12-14 20:03:15 +00:00
|
|
|
m_zoomSelectBox->Append( msg );
|
2011-02-21 13:54:29 +00:00
|
|
|
|
|
|
|
if( GetScreen()->GetZoom() == GetScreen()->m_ZoomList[i] )
|
2011-12-14 20:03:15 +00:00
|
|
|
m_zoomSelectBox->SetSelection( i + 1 );
|
2011-02-21 13:54:29 +00:00
|
|
|
}
|
|
|
|
}
|