2011-12-12 14:02:37 +00:00
|
|
|
/*
|
|
|
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
|
|
|
*
|
2016-05-27 08:20:17 +00:00
|
|
|
* Copyright (C) 2016 Jean-Pierre Charras, jp.charras at wanadoo.fr
|
2018-01-08 04:05:03 +00:00
|
|
|
* Copyright (C) 1992-2018 KiCad Developers, see AUTHORS.txt for contributors.
|
2011-12-12 14:02:37 +00:00
|
|
|
*
|
2018-01-08 04:05:03 +00:00
|
|
|
* 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 3 of the License, or (at your
|
|
|
|
* option) any later version.
|
2011-12-12 14:02:37 +00:00
|
|
|
*
|
2018-01-08 04:05:03 +00:00
|
|
|
* 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.
|
2011-12-12 14:02:37 +00:00
|
|
|
*
|
2018-01-08 04:05:03 +00:00
|
|
|
* You should have received a copy of the GNU General Public License along
|
|
|
|
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
2011-12-12 14:02:37 +00:00
|
|
|
*/
|
|
|
|
|
2011-09-23 13:57:12 +00:00
|
|
|
/**
|
|
|
|
* @file gerbview_frame.cpp
|
|
|
|
*/
|
2007-05-06 16:03:28 +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>
|
2015-09-25 19:41:14 +00:00
|
|
|
#include <pgm_base.h>
|
2018-01-29 15:39:40 +00:00
|
|
|
#include <eda_base_frame.h>
|
2012-01-23 04:33:36 +00:00
|
|
|
#include <class_drawpanel.h>
|
|
|
|
#include <build_version.h>
|
2013-05-02 18:06:58 +00:00
|
|
|
#include <trigo.h>
|
2012-04-18 07:07:13 +00:00
|
|
|
#include <base_units.h>
|
2018-01-29 12:26:58 +00:00
|
|
|
#include <gbr_layer_box_selector.h>
|
2013-01-12 17:32:24 +00:00
|
|
|
#include <msgpanel.h>
|
2017-02-20 12:20:39 +00:00
|
|
|
#include <bitmaps.h>
|
2017-08-19 16:28:11 +00:00
|
|
|
#include <wildcards_and_files_ext.h>
|
2009-02-04 15:25:03 +00:00
|
|
|
|
2012-01-23 04:33:36 +00:00
|
|
|
#include <gerbview.h>
|
2014-06-27 17:07:42 +00:00
|
|
|
#include <gerbview_frame.h>
|
2012-01-23 04:33:36 +00:00
|
|
|
#include <gerbview_id.h>
|
|
|
|
#include <hotkeys.h>
|
2018-01-29 12:26:58 +00:00
|
|
|
#include <gerber_file_image.h>
|
|
|
|
#include <gerber_file_image_list.h>
|
2012-01-23 04:33:36 +00:00
|
|
|
#include <dialog_helpers.h>
|
2018-01-29 12:26:58 +00:00
|
|
|
#include <DCodeSelectionbox.h>
|
|
|
|
#include <gerbview_layer_widget.h>
|
2010-10-06 17:28:07 +00:00
|
|
|
|
2017-09-17 22:43:20 +00:00
|
|
|
#include <gerbview_draw_panel_gal.h>
|
|
|
|
#include <gal/graphics_abstraction_layer.h>
|
|
|
|
#include <tool/tool_manager.h>
|
|
|
|
#include <tool/tool_dispatcher.h>
|
|
|
|
#include <tools/gerbview_actions.h>
|
|
|
|
#include <view/view.h>
|
|
|
|
#include <gerbview_painter.h>
|
|
|
|
|
2007-05-06 16:03:28 +00:00
|
|
|
|
2011-03-12 09:50:21 +00:00
|
|
|
// Config keywords
|
2013-01-21 20:02:07 +00:00
|
|
|
static const wxString cfgShowPageSizeOption( wxT( "PageSizeOpt" ) );
|
2012-05-04 17:44:42 +00:00
|
|
|
static const wxString cfgShowDCodes( wxT( "ShowDCodesOpt" ) );
|
2013-01-06 13:31:49 +00:00
|
|
|
static const wxString cfgShowNegativeObjects( wxT( "ShowNegativeObjectsOpt" ) );
|
2012-05-04 17:44:42 +00:00
|
|
|
static const wxString cfgShowBorderAndTitleBlock( wxT( "ShowBorderAndTitleBlock" ) );
|
2018-01-08 04:05:03 +00:00
|
|
|
static const wxString IconScaleEntry = "GvIconScale";
|
2011-09-23 13:57:12 +00:00
|
|
|
|
2017-09-10 14:21:56 +00:00
|
|
|
// Colors for layers and items
|
|
|
|
COLORS_DESIGN_SETTINGS g_ColorsSettings( FRAME_GERBER );
|
|
|
|
|
* 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
|
|
|
GERBVIEW_FRAME::GERBVIEW_FRAME( KIWAY* aKiway, wxWindow* aParent ):
|
2014-04-19 18:47:20 +00:00
|
|
|
EDA_DRAW_FRAME( aKiway, aParent, FRAME_GERBER, wxT( "GerbView" ),
|
* 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
|
|
|
wxDefaultPosition, wxDefaultSize, KICAD_DEFAULT_DRAWFRAME_STYLE, GERBVIEW_FRAME_NAME )
|
2007-05-06 16:03:28 +00:00
|
|
|
{
|
2016-08-16 10:56:20 +00:00
|
|
|
m_auxiliaryToolBar = NULL;
|
2012-05-04 17:44:42 +00:00
|
|
|
m_colorsSettings = &g_ColorsSettings;
|
2013-06-27 19:12:01 +00:00
|
|
|
m_gerberLayout = NULL;
|
2015-01-06 07:38:58 +00:00
|
|
|
m_zoomLevelCoeff = ZOOM_FACTOR( 110 ); // Adjusted to roughly displays zoom level = 1
|
2015-09-25 23:34:57 +00:00
|
|
|
// when the screen shows a 1:1 image
|
|
|
|
// obviously depends on the monitor,
|
|
|
|
// but this is an acceptable value
|
2015-01-06 07:38:58 +00:00
|
|
|
|
2014-12-23 13:01:59 +00:00
|
|
|
PAGE_INFO pageInfo( wxT( "GERBER" ) );
|
|
|
|
SetPageSettings( pageInfo );
|
2012-05-04 17:44:42 +00:00
|
|
|
|
2010-02-03 14:05:17 +00:00
|
|
|
m_show_layer_manager_tools = true;
|
2008-12-08 15:27:13 +00:00
|
|
|
|
2011-12-22 21:57:50 +00:00
|
|
|
m_showAxis = true; // true to show X and Y axis on screen
|
2015-05-19 16:39:05 +00:00
|
|
|
m_showBorderAndTitleBlock = false; // true for reference drawings.
|
|
|
|
m_hotkeysDescrList = GerbviewHokeysDescr;
|
2010-12-17 20:34:29 +00:00
|
|
|
m_SelLayerBox = NULL;
|
|
|
|
m_DCodeSelector = NULL;
|
2018-01-29 01:30:43 +00:00
|
|
|
m_SelComponentBox = nullptr;
|
|
|
|
m_SelNetnameBox = nullptr;
|
|
|
|
m_SelAperAttributesBox = nullptr;
|
2010-12-17 20:34:29 +00:00
|
|
|
m_displayMode = 0;
|
2011-09-24 18:33:28 +00:00
|
|
|
m_drillFileHistory.SetBaseId( ID_GERBVIEW_DRILL_FILE1 );
|
2017-01-26 09:45:28 +00:00
|
|
|
m_zipFileHistory.SetBaseId( ID_GERBVIEW_ZIP_FILE1 );
|
2017-08-19 16:28:11 +00:00
|
|
|
m_jobFileHistory.SetBaseId( ID_GERBVIEW_JOB_FILE1 );
|
2010-07-27 12:47:08 +00:00
|
|
|
|
2017-09-17 22:43:20 +00:00
|
|
|
EDA_DRAW_PANEL_GAL* galCanvas = new GERBVIEW_DRAW_PANEL_GAL( this, -1, wxPoint( 0, 0 ),
|
|
|
|
m_FrameSize,
|
|
|
|
GetGalDisplayOptions(),
|
|
|
|
EDA_DRAW_PANEL_GAL::GAL_TYPE_NONE );
|
|
|
|
|
|
|
|
SetGalCanvas( galCanvas );
|
|
|
|
|
|
|
|
// GerbView requires draw priority for rendering negative objects
|
|
|
|
galCanvas->GetView()->UseDrawPriority( true );
|
|
|
|
|
2011-12-22 13:28:11 +00:00
|
|
|
if( m_canvas )
|
2011-12-29 20:11:42 +00:00
|
|
|
m_canvas->SetEnableBlockCommands( true );
|
2008-04-17 16:25:29 +00:00
|
|
|
|
|
|
|
// Give an icon
|
2011-09-09 19:30:59 +00:00
|
|
|
wxIcon icon;
|
|
|
|
icon.CopyFromBitmap( KiBitmap( icon_gerbview_xpm ) );
|
|
|
|
SetIcon( icon );
|
2008-04-17 16:25:29 +00:00
|
|
|
|
2012-05-04 17:44:42 +00:00
|
|
|
SetLayout( new GBR_LAYOUT() );
|
2009-11-09 14:00:22 +00:00
|
|
|
|
2014-06-27 17:07:42 +00:00
|
|
|
SetVisibleLayers( -1 ); // All draw layers visible.
|
2011-12-31 05:44:00 +00:00
|
|
|
|
2014-12-23 13:01:59 +00:00
|
|
|
SetScreen( new GBR_SCREEN( GetPageSettings().GetSizeIU() ) );
|
2011-12-22 21:57:50 +00:00
|
|
|
|
2012-05-04 17:44:42 +00:00
|
|
|
// Create the PCB_LAYER_WIDGET *after* SetLayout():
|
|
|
|
wxFont font = wxSystemSettings::GetFont( wxSYS_DEFAULT_GUI_FONT );
|
|
|
|
int pointSize = font.GetPointSize();
|
|
|
|
int screenHeight = wxSystemSettings::GetMetric( wxSYS_SCREEN_Y );
|
2010-12-08 20:12:46 +00:00
|
|
|
|
2010-02-03 14:05:17 +00:00
|
|
|
if( screenHeight <= 900 )
|
|
|
|
pointSize = (pointSize * 8) / 10;
|
2010-12-08 20:12:46 +00:00
|
|
|
|
2011-12-22 13:28:11 +00:00
|
|
|
m_LayersManager = new GERBER_LAYER_WIDGET( this, m_canvas, pointSize );
|
2010-02-03 14:05:17 +00:00
|
|
|
|
|
|
|
// LoadSettings() *after* creating m_LayersManager, because LoadSettings()
|
|
|
|
// initialize parameters in m_LayersManager
|
* 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
|
|
|
LoadSettings( config() );
|
|
|
|
|
2008-04-17 16:25:29 +00:00
|
|
|
SetSize( m_FramePos.x, m_FramePos.y, m_FrameSize.x, m_FrameSize.y );
|
2012-05-06 16:55:51 +00:00
|
|
|
|
2013-06-27 19:12:01 +00:00
|
|
|
if( m_LastGridSizeId < 0 )
|
|
|
|
m_LastGridSizeId = 0;
|
|
|
|
if( m_LastGridSizeId > ID_POPUP_GRID_LEVEL_0_0_1MM-ID_POPUP_GRID_LEVEL_1000 )
|
|
|
|
m_LastGridSizeId = ID_POPUP_GRID_LEVEL_0_0_1MM-ID_POPUP_GRID_LEVEL_1000;
|
2011-09-14 15:08:44 +00:00
|
|
|
GetScreen()->SetGrid( ID_POPUP_GRID_LEVEL_1000 + m_LastGridSizeId );
|
2009-11-07 14:45:14 +00:00
|
|
|
|
2018-01-29 01:30:43 +00:00
|
|
|
m_auimgr.SetManagedWindow( this );
|
|
|
|
|
2008-04-17 16:25:29 +00:00
|
|
|
ReCreateMenuBar();
|
|
|
|
ReCreateHToolbar();
|
|
|
|
ReCreateOptToolbar();
|
2016-08-16 10:56:20 +00:00
|
|
|
ReCreateAuxiliaryToolbar();
|
2009-11-09 14:00:22 +00:00
|
|
|
|
2012-05-04 17:44:42 +00:00
|
|
|
EDA_PANEINFO horiz;
|
2011-09-15 18:25:44 +00:00
|
|
|
horiz.HorizontalToolbarPane();
|
|
|
|
|
2012-05-04 17:44:42 +00:00
|
|
|
EDA_PANEINFO vert;
|
2011-09-15 18:25:44 +00:00
|
|
|
vert.VerticalToolbarPane();
|
|
|
|
|
2012-05-04 17:44:42 +00:00
|
|
|
EDA_PANEINFO mesg;
|
2011-09-15 18:25:44 +00:00
|
|
|
mesg.MessageToolbarPane();
|
|
|
|
|
2014-07-15 16:53:13 +00:00
|
|
|
// Create a wxAuiPaneInfo for the Layers Manager, not derived from the template.
|
|
|
|
// the Layers Manager is floatable, but initially docked at far right
|
2012-05-04 17:44:42 +00:00
|
|
|
EDA_PANEINFO lyrs;
|
2011-09-15 18:25:44 +00:00
|
|
|
lyrs.LayersToolbarPane();
|
|
|
|
lyrs.MinSize( m_LayersManager->GetBestSize() );
|
|
|
|
lyrs.BestSize( m_LayersManager->GetBestSize() );
|
2010-02-03 14:05:17 +00:00
|
|
|
lyrs.Caption( _( "Visibles" ) );
|
2014-07-14 18:59:41 +00:00
|
|
|
lyrs.TopDockable( false ).BottomDockable( false );
|
2011-09-15 18:25:44 +00:00
|
|
|
|
2010-02-03 14:05:17 +00:00
|
|
|
|
2011-12-16 13:32:23 +00:00
|
|
|
if( m_mainToolBar )
|
|
|
|
m_auimgr.AddPane( m_mainToolBar,
|
|
|
|
wxAuiPaneInfo( horiz ).Name( wxT( "m_mainToolBar" ) ).Top().Row( 0 ) );
|
2009-11-02 22:24:55 +00:00
|
|
|
|
2016-08-16 10:56:20 +00:00
|
|
|
if( m_auxiliaryToolBar ) // the auxiliary horizontal toolbar, that shows component and netname lists
|
|
|
|
{
|
|
|
|
m_auimgr.AddPane( m_auxiliaryToolBar,
|
|
|
|
wxAuiPaneInfo( horiz ).Name( wxT( "m_auxiliaryToolBar" ) ).Top().Row( 1 ) );
|
|
|
|
}
|
|
|
|
|
2011-12-14 20:03:15 +00:00
|
|
|
if( m_drawToolBar )
|
|
|
|
m_auimgr.AddPane( m_drawToolBar,
|
|
|
|
wxAuiPaneInfo( vert ).Name( wxT( "m_drawToolBar" ) ).Right().Row( 1 ) );
|
2010-02-03 14:05:17 +00:00
|
|
|
|
2010-12-08 20:12:46 +00:00
|
|
|
m_auimgr.AddPane( m_LayersManager,
|
2011-09-15 18:25:44 +00:00
|
|
|
lyrs.Name( wxT( "m_LayersManagerToolBar" ) ).Right().Layer( 0 ) );
|
2009-11-02 22:24:55 +00:00
|
|
|
|
2011-12-14 20:03:15 +00:00
|
|
|
if( m_optionsToolBar )
|
|
|
|
m_auimgr.AddPane( m_optionsToolBar,
|
|
|
|
wxAuiPaneInfo( vert ).Name( wxT( "m_optionsToolBar" ) ).Left() );
|
2009-11-02 22:24:55 +00:00
|
|
|
|
2011-12-22 13:28:11 +00:00
|
|
|
if( m_canvas )
|
|
|
|
m_auimgr.AddPane( m_canvas,
|
2011-02-08 14:48:38 +00:00
|
|
|
wxAuiPaneInfo().Name( wxT( "DrawFrame" ) ).CentrePane() );
|
2009-11-02 22:24:55 +00:00
|
|
|
|
2017-09-17 22:43:20 +00:00
|
|
|
if( GetGalCanvas() )
|
|
|
|
m_auimgr.AddPane( (wxWindow*) GetGalCanvas(),
|
|
|
|
wxAuiPaneInfo().Name( wxT( "DrawFrameGal" ) ).CentrePane().Hide() );
|
|
|
|
|
2011-12-12 14:02:37 +00:00
|
|
|
if( m_messagePanel )
|
|
|
|
m_auimgr.AddPane( m_messagePanel,
|
2012-05-04 17:44:42 +00:00
|
|
|
wxAuiPaneInfo( mesg ).Name( wxT( "MsgPanel" ) ).Bottom().Layer( 10 ) );
|
2009-11-02 22:24:55 +00:00
|
|
|
|
2011-04-07 19:17:51 +00:00
|
|
|
ReFillLayerWidget(); // this is near end because contents establish size
|
2009-11-02 22:24:55 +00:00
|
|
|
m_auimgr.Update();
|
2014-05-19 18:24:07 +00:00
|
|
|
|
2017-09-17 22:43:20 +00:00
|
|
|
setupTools();
|
|
|
|
|
|
|
|
SetActiveLayer( 0, true );
|
2015-03-06 17:46:04 +00:00
|
|
|
Zoom_Automatique( false ); // Gives a default zoom value
|
2016-05-27 08:20:17 +00:00
|
|
|
UpdateTitleAndInfo();
|
2017-09-17 22:43:20 +00:00
|
|
|
|
2017-09-20 08:53:58 +00:00
|
|
|
EDA_DRAW_PANEL_GAL::GAL_TYPE canvasType = loadCanvasTypeSetting();
|
2017-09-17 22:43:20 +00:00
|
|
|
|
2018-01-04 14:28:02 +00:00
|
|
|
// Nudge user to switch to OpenGL if they are on legacy or Cairo
|
|
|
|
if( m_firstRunDialogSetting < 1 )
|
|
|
|
{
|
|
|
|
if( canvasType != EDA_DRAW_PANEL_GAL::GAL_TYPE_OPENGL )
|
|
|
|
{
|
|
|
|
wxString msg = _( "KiCad can use your graphics card to give you a smoother "
|
|
|
|
"and faster experience. This option is turned off by "
|
|
|
|
"default since it is not compatible with all computers.\n\n"
|
|
|
|
"Would you like to try enabling graphics acceleration?\n\n"
|
|
|
|
"If you'd like to choose later, select the Modern "
|
|
|
|
"(Accelerated) graphics mode in the View menu." );
|
|
|
|
|
|
|
|
wxMessageDialog dlg( this, msg, _( "Enable Graphics Acceleration" ),
|
|
|
|
wxYES_NO );
|
|
|
|
|
|
|
|
dlg.SetYesNoLabels( _( "&Enable Acceleration" ), _( "&No Thanks" ) );
|
|
|
|
|
|
|
|
if( dlg.ShowModal() == wxID_YES )
|
|
|
|
{
|
|
|
|
// Save Cairo as default in case OpenGL crashes
|
|
|
|
saveCanvasTypeSetting( EDA_DRAW_PANEL_GAL::GAL_TYPE_CAIRO );
|
|
|
|
|
|
|
|
// Switch to OpenGL, which will save the new setting if successful
|
|
|
|
wxCommandEvent evt( wxEVT_MENU, ID_MENU_CANVAS_OPENGL );
|
|
|
|
auto handler = GetEventHandler();
|
|
|
|
handler->ProcessEvent( evt );
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
// If they were on legacy, switch them to Cairo
|
|
|
|
|
|
|
|
if( canvasType == EDA_DRAW_PANEL_GAL::GAL_TYPE_NONE )
|
|
|
|
{
|
|
|
|
wxCommandEvent evt( wxEVT_MENU, ID_MENU_CANVAS_CAIRO );
|
|
|
|
auto handler = GetEventHandler();
|
|
|
|
handler->ProcessEvent( evt );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
m_firstRunDialogSetting = 1;
|
|
|
|
SaveSettings( config() );
|
|
|
|
}
|
|
|
|
|
|
|
|
// Canvas may have been updated by the dialog
|
|
|
|
canvasType = loadCanvasTypeSetting();
|
|
|
|
|
2017-09-17 22:43:20 +00:00
|
|
|
if( canvasType != EDA_DRAW_PANEL_GAL::GAL_TYPE_NONE )
|
|
|
|
{
|
|
|
|
if( GetGalCanvas()->SwitchBackend( canvasType ) )
|
|
|
|
UseGalCanvas( true );
|
2017-09-20 08:30:48 +00:00
|
|
|
|
2017-09-17 22:43:20 +00:00
|
|
|
wxUpdateUIEvent e;
|
|
|
|
OnUpdateSwitchCanvas( e );
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2017-11-28 03:12:31 +00:00
|
|
|
m_colorsSettings->SetLegacyMode( true );
|
2017-09-17 22:43:20 +00:00
|
|
|
m_canvas->Refresh();
|
|
|
|
}
|
|
|
|
|
|
|
|
// Enable the axes to match legacy draw style
|
|
|
|
auto& galOptions = GetGalDisplayOptions();
|
|
|
|
galOptions.m_axesEnabled = true;
|
|
|
|
galOptions.NotifyChanged();
|
|
|
|
|
|
|
|
m_LayersManager->ReFill();
|
|
|
|
m_LayersManager->ReFillRender(); // Update colors in Render after the config is read
|
2007-05-06 16:03:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2011-03-12 09:50:21 +00:00
|
|
|
GERBVIEW_FRAME::~GERBVIEW_FRAME()
|
2007-05-06 16:03:28 +00:00
|
|
|
{
|
2017-09-17 22:43:20 +00:00
|
|
|
GetGerberLayout()->GetImagesList()->DeleteAllImages();
|
2018-01-22 07:55:26 +00:00
|
|
|
delete m_gerberLayout;
|
2007-05-06 16:03:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2011-03-12 09:50:21 +00:00
|
|
|
void GERBVIEW_FRAME::OnCloseWindow( wxCloseEvent& Event )
|
2007-05-06 16:03:28 +00:00
|
|
|
{
|
2018-01-22 20:15:46 +00:00
|
|
|
if( m_toolManager )
|
|
|
|
m_toolManager->DeactivateTool();
|
|
|
|
|
|
|
|
if( IsGalCanvasActive() )
|
|
|
|
{
|
|
|
|
GetGalCanvas()->GetView()->Clear();
|
|
|
|
// Be sure any OpenGL event cannot be fired after frame deletion:
|
|
|
|
GetGalCanvas()->SetEvtHandlerEnabled( false );
|
|
|
|
}
|
|
|
|
|
|
|
|
GetGalCanvas()->StopDrawing();
|
|
|
|
|
2008-04-17 16:25:29 +00:00
|
|
|
Destroy();
|
2007-05-06 16:03:28 +00:00
|
|
|
}
|
|
|
|
|
2008-04-17 16:25: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
|
|
|
bool GERBVIEW_FRAME::OpenProjectFiles( const std::vector<wxString>& aFileSet, int aCtl )
|
|
|
|
{
|
2015-09-25 19:41:14 +00:00
|
|
|
// The current project path is also a valid command parameter. Check if a single path
|
2015-09-25 23:34:57 +00:00
|
|
|
// rather than a file name was passed to GerbView and use it as the initial MRU path.
|
|
|
|
if( aFileSet.size() > 0 )
|
2015-09-25 19:41:14 +00:00
|
|
|
{
|
2015-09-25 23:34:57 +00:00
|
|
|
wxString path = aFileSet[0];
|
2015-09-25 19:41:14 +00:00
|
|
|
|
2015-09-25 23:34:57 +00:00
|
|
|
// For some reason wxApp appears to leave the trailing double quote on quoted
|
|
|
|
// parameters which are required for paths with spaces. Maybe this should be
|
|
|
|
// pushed back into PGM_SINGLE_TOP::OnPgmInit() but that may cause other issues.
|
|
|
|
// We can't buy a break!
|
|
|
|
if( path.Last() == wxChar( '\"' ) )
|
|
|
|
path.RemoveLast();
|
* 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
|
|
|
|
2015-09-25 23:34:57 +00:00
|
|
|
if( !wxFileExists( path ) && wxDirExists( path ) )
|
|
|
|
{
|
|
|
|
wxLogDebug( wxT( "MRU path: %s." ), GetChars( path ) );
|
|
|
|
m_mruPath = path;
|
|
|
|
return true;
|
|
|
|
}
|
* 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
|
|
|
|
2015-09-25 23:34:57 +00:00
|
|
|
const unsigned limit = std::min( unsigned( aFileSet.size() ),
|
|
|
|
unsigned( GERBER_DRAWLAYERS_COUNT ) );
|
|
|
|
|
|
|
|
int layer = 0;
|
|
|
|
|
|
|
|
for( unsigned i=0; i<limit; ++i, ++layer )
|
|
|
|
{
|
2017-09-17 22:43:20 +00:00
|
|
|
SetActiveLayer( layer );
|
2016-06-05 12:26:39 +00:00
|
|
|
|
|
|
|
// Try to guess the type of file by its ext
|
|
|
|
// if it is .drl (Kicad files), it is a drill file
|
|
|
|
wxFileName fn( aFileSet[i] );
|
|
|
|
wxString ext = fn.GetExt();
|
|
|
|
|
2017-08-19 16:28:11 +00:00
|
|
|
if( ext == DrillFileExtension ) // In Excellon format
|
2016-06-05 12:26:39 +00:00
|
|
|
LoadExcellonFiles( aFileSet[i] );
|
2017-08-19 16:28:11 +00:00
|
|
|
else if( ext == GerberJobFileExtension )
|
|
|
|
LoadGerberJobFile( aFileSet[i] );
|
2016-06-05 12:26:39 +00:00
|
|
|
else
|
|
|
|
LoadGerberFiles( aFileSet[i] );
|
2015-09-25 23:34:57 +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
|
|
|
}
|
|
|
|
|
|
|
|
Zoom_Automatique( true ); // Zoom fit in frame
|
|
|
|
|
|
|
|
UpdateTitleAndInfo();
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2011-09-14 15:08:44 +00:00
|
|
|
double GERBVIEW_FRAME::BestZoom()
|
|
|
|
{
|
2018-02-13 21:19:41 +00:00
|
|
|
double defaultGerberZoom = 1.0;
|
2013-06-27 19:12:01 +00:00
|
|
|
EDA_RECT bbox = GetGerberLayout()->ComputeBoundingBox();
|
2011-09-14 15:08:44 +00:00
|
|
|
|
2016-05-26 11:57:43 +00:00
|
|
|
if( bbox.GetWidth() == 0 || bbox.GetHeight() == 0 )
|
2016-05-26 12:42:27 +00:00
|
|
|
{
|
2018-02-13 21:19:41 +00:00
|
|
|
SetScrollCenterPosition( wxPoint( 0, 0 ) );
|
|
|
|
return defaultGerberZoom;
|
2016-05-26 12:42:27 +00:00
|
|
|
}
|
2016-05-26 11:57:43 +00:00
|
|
|
|
2018-02-13 21:19:41 +00:00
|
|
|
double sizeX = (double) bbox.GetWidth();
|
|
|
|
double sizeY = (double) bbox.GetHeight();
|
|
|
|
wxPoint centre = bbox.Centre();
|
2016-05-26 12:42:27 +00:00
|
|
|
|
2018-02-13 21:19:41 +00:00
|
|
|
// Reserve no margin because GetGerberLayout()->ComputeBoundingBox() builds one in.
|
|
|
|
double margin_scale_factor = 1.0;
|
2011-09-14 15:08:44 +00:00
|
|
|
|
2018-02-13 21:19:41 +00:00
|
|
|
return bestZoom( sizeX, sizeY, margin_scale_factor, centre );
|
2011-09-14 15:08:44 +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 GERBVIEW_FRAME::LoadSettings( wxConfigBase* aCfg )
|
2009-11-22 20:55:05 +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 );
|
2009-11-22 20:55:05 +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
|
|
|
// was: wxGetApp().ReadCurrentSetupValues( GetConfigurationSettings() );
|
|
|
|
wxConfigLoadSetups( aCfg, GetConfigurationSettings() );
|
2011-03-12 09:50:21 +00:00
|
|
|
|
2012-05-04 17:44:42 +00:00
|
|
|
PAGE_INFO pageInfo( wxT( "GERBER" ) );
|
2011-12-22 21:57:50 +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( cfgShowBorderAndTitleBlock, &m_showBorderAndTitleBlock, false );
|
2010-12-08 20:12:46 +00:00
|
|
|
|
2011-12-31 05:44:00 +00:00
|
|
|
if( m_showBorderAndTitleBlock )
|
|
|
|
{
|
2012-05-04 17:44:42 +00:00
|
|
|
wxString pageType;
|
* 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( cfgShowPageSizeOption, &pageType, wxT( "GERBER" ) );
|
2011-12-31 05:44:00 +00:00
|
|
|
pageInfo.SetType( pageType );
|
|
|
|
}
|
2010-12-08 20:12:46 +00:00
|
|
|
|
2011-12-22 21:57:50 +00:00
|
|
|
SetPageSettings( pageInfo );
|
2010-12-08 20:12:46 +00:00
|
|
|
|
2011-12-22 21:57:50 +00:00
|
|
|
GetScreen()->InitDataPoints( pageInfo.GetSizeIU() );
|
2010-12-08 20:12:46 +00:00
|
|
|
|
2013-01-06 13:31:49 +00:00
|
|
|
bool tmp;
|
* 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( cfgShowDCodes, &tmp, true );
|
2017-03-13 03:19:33 +00:00
|
|
|
SetElementVisibility( LAYER_DCODES, tmp );
|
* 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( cfgShowNegativeObjects, &tmp, false );
|
2017-03-13 03:19:33 +00:00
|
|
|
SetElementVisibility( LAYER_NEGATIVE_OBJECTS, tmp );
|
2011-03-17 19:14:45 +00:00
|
|
|
|
2017-01-26 09:45:28 +00:00
|
|
|
// because we have more than one file history, we must read this one
|
2011-03-17 19:14:45 +00:00
|
|
|
// using a specific path
|
* 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->SetPath( wxT( "drl_files" ) );
|
|
|
|
m_drillFileHistory.Load( *aCfg );
|
|
|
|
aCfg->SetPath( wxT( ".." ) );
|
2017-01-26 09:45:28 +00:00
|
|
|
|
|
|
|
// because we have more than one file history, we must read this one
|
|
|
|
// using a specific path
|
|
|
|
aCfg->SetPath( wxT( "zip_files" ) );
|
|
|
|
m_zipFileHistory.Load( *aCfg );
|
|
|
|
aCfg->SetPath( wxT( ".." ) );
|
2017-08-19 16:28:11 +00:00
|
|
|
|
|
|
|
// because we have more than one file history, we must read this one
|
|
|
|
// using a specific path
|
|
|
|
aCfg->SetPath( "job_files" );
|
|
|
|
m_jobFileHistory.Load( *aCfg );
|
|
|
|
aCfg->SetPath( wxT( ".." ) );
|
2009-11-22 20:55:05 +00:00
|
|
|
}
|
|
|
|
|
2010-12-08 20:12:46 +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 GERBVIEW_FRAME::SaveSettings( wxConfigBase* aCfg )
|
2009-11-22 20:55:05 +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-11-22 20:55:05 +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
|
|
|
// was: wxGetApp().SaveCurrentSetupValues( GetConfigurationSettings() );
|
|
|
|
wxConfigSaveSetups( aCfg, GetConfigurationSettings() );
|
2011-03-12 09:50:21 +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( cfgShowPageSizeOption, GetPageSettings().GetType() );
|
|
|
|
aCfg->Write( cfgShowBorderAndTitleBlock, m_showBorderAndTitleBlock );
|
2017-03-13 03:19:33 +00:00
|
|
|
aCfg->Write( cfgShowDCodes, IsElementVisible( LAYER_DCODES ) );
|
* 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( cfgShowNegativeObjects,
|
2017-03-13 03:19:33 +00:00
|
|
|
IsElementVisible( LAYER_NEGATIVE_OBJECTS ) );
|
2010-12-15 20:15:24 +00:00
|
|
|
|
2011-03-26 08:20:25 +00:00
|
|
|
// Save the drill file history list.
|
2017-01-26 09:45:28 +00:00
|
|
|
// Because we have more than one file history, we must save this one
|
2011-03-17 19:14:45 +00:00
|
|
|
// in a specific path
|
* 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->SetPath( wxT( "drl_files" ) );
|
|
|
|
m_drillFileHistory.Save( *aCfg );
|
|
|
|
aCfg->SetPath( wxT( ".." ) );
|
2017-01-26 09:45:28 +00:00
|
|
|
|
|
|
|
// Save the zip file history list.
|
|
|
|
aCfg->SetPath( wxT( "zip_files" ) );
|
|
|
|
m_zipFileHistory.Save( *aCfg );
|
|
|
|
aCfg->SetPath( wxT( ".." ) );
|
2017-08-19 16:28:11 +00:00
|
|
|
|
|
|
|
// Save the job file history list.
|
|
|
|
aCfg->SetPath( "job_files" );
|
|
|
|
m_jobFileHistory.Save( *aCfg );
|
|
|
|
aCfg->SetPath( ".." );
|
2010-02-03 14:05:17 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2011-03-12 09:50:21 +00:00
|
|
|
void GERBVIEW_FRAME::ReFillLayerWidget()
|
2010-02-03 14:05:17 +00:00
|
|
|
{
|
|
|
|
m_LayersManager->ReFill();
|
2016-05-23 15:47:16 +00:00
|
|
|
m_SelLayerBox->Resync();
|
2016-08-16 10:56:20 +00:00
|
|
|
ReCreateAuxiliaryToolbar();
|
2010-02-03 14:05:17 +00:00
|
|
|
|
2012-05-04 17:44:42 +00:00
|
|
|
wxAuiPaneInfo& lyrs = m_auimgr.GetPane( m_LayersManager );
|
2010-02-03 14:05:17 +00:00
|
|
|
|
2012-05-04 17:44:42 +00:00
|
|
|
wxSize bestz = m_LayersManager->GetBestSize();
|
2016-05-23 15:47:16 +00:00
|
|
|
bestz.x += 5; // gives a little margin
|
2010-02-03 14:05:17 +00:00
|
|
|
|
|
|
|
lyrs.MinSize( bestz );
|
|
|
|
lyrs.BestSize( bestz );
|
|
|
|
lyrs.FloatingSize( bestz );
|
|
|
|
|
|
|
|
if( lyrs.IsDocked() )
|
|
|
|
m_auimgr.Update();
|
|
|
|
else
|
|
|
|
m_LayersManager->SetSize( bestz );
|
2010-02-14 18:14:33 +00:00
|
|
|
|
2010-05-17 20:35:46 +00:00
|
|
|
syncLayerWidget();
|
2010-02-03 14:05:17 +00:00
|
|
|
}
|
|
|
|
|
2015-09-25 23:34:57 +00:00
|
|
|
|
2017-03-13 03:19:33 +00:00
|
|
|
void GERBVIEW_FRAME::SetElementVisibility( GERBVIEW_LAYER_ID aItemIdVisible,
|
2012-09-12 17:28:55 +00:00
|
|
|
bool aNewState )
|
2010-02-03 14:05:17 +00:00
|
|
|
{
|
2012-05-04 17:44:42 +00:00
|
|
|
switch( aItemIdVisible )
|
|
|
|
{
|
2017-03-13 03:19:33 +00:00
|
|
|
case LAYER_DCODES:
|
2012-05-04 17:44:42 +00:00
|
|
|
m_DisplayOptions.m_DisplayDCodes = aNewState;
|
|
|
|
break;
|
|
|
|
|
2017-03-13 03:19:33 +00:00
|
|
|
case LAYER_NEGATIVE_OBJECTS:
|
2013-01-06 13:31:49 +00:00
|
|
|
m_DisplayOptions.m_DisplayNegativeObjects = aNewState;
|
|
|
|
break;
|
|
|
|
|
2017-03-13 03:19:33 +00:00
|
|
|
case LAYER_GERBVIEW_GRID:
|
2012-05-04 17:44:42 +00:00
|
|
|
SetGridVisibility( aNewState );
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
wxLogDebug( wxT( "GERBVIEW_FRAME::SetElementVisibility(): bad arg %d" ), aItemIdVisible );
|
|
|
|
}
|
2015-09-25 23:34:57 +00:00
|
|
|
|
2017-09-17 22:43:20 +00:00
|
|
|
applyDisplaySettingsToGAL();
|
2012-05-04 17:44:42 +00:00
|
|
|
m_LayersManager->SetRenderState( aItemIdVisible, aNewState );
|
2009-11-22 20:55:05 +00:00
|
|
|
}
|
2010-02-04 09:08:08 +00:00
|
|
|
|
|
|
|
|
2017-09-17 22:43:20 +00:00
|
|
|
void GERBVIEW_FRAME::applyDisplaySettingsToGAL()
|
|
|
|
{
|
|
|
|
auto view = GetGalCanvas()->GetView();
|
|
|
|
auto painter = static_cast<KIGFX::GERBVIEW_PAINTER*>( view->GetPainter() );
|
|
|
|
auto settings = static_cast<KIGFX::GERBVIEW_RENDER_SETTINGS*>( painter->GetSettings() );
|
|
|
|
settings->LoadDisplayOptions( &m_DisplayOptions );
|
|
|
|
|
|
|
|
settings->ImportLegacyColors( m_colorsSettings );
|
|
|
|
|
|
|
|
view->RecacheAllItems();
|
|
|
|
view->MarkTargetDirty( KIGFX::TARGET_NONCACHED );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2014-06-27 17:07:42 +00:00
|
|
|
int GERBVIEW_FRAME::getNextAvailableLayer( int aLayer ) const
|
2011-03-02 15:24:39 +00:00
|
|
|
{
|
2014-06-27 17:07:42 +00:00
|
|
|
int layer = aLayer;
|
2011-03-02 15:24:39 +00:00
|
|
|
|
2016-06-17 18:00:29 +00:00
|
|
|
for( unsigned i = 0; i < ImagesMaxCount(); ++i )
|
2011-03-02 15:24:39 +00:00
|
|
|
{
|
2016-06-17 18:00:29 +00:00
|
|
|
const GERBER_FILE_IMAGE* gerber = GetGbrImage( layer );
|
2011-03-02 15:24:39 +00:00
|
|
|
|
2016-06-15 08:26:41 +00:00
|
|
|
if( gerber == NULL ) // this graphic layer is available: use it
|
2011-03-02 15:24:39 +00:00
|
|
|
return layer;
|
|
|
|
|
2016-06-15 08:26:41 +00:00
|
|
|
++layer; // try next graphic layer
|
2011-03-02 15:24:39 +00:00
|
|
|
|
2016-06-17 18:00:29 +00:00
|
|
|
if( layer >= (int)ImagesMaxCount() )
|
2014-06-27 17:07:42 +00:00
|
|
|
layer = 0;
|
2011-03-02 15:24:39 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return NO_AVAILABLE_LAYERS;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2011-03-12 09:50:21 +00:00
|
|
|
void GERBVIEW_FRAME::syncLayerWidget()
|
2010-02-04 09:08:08 +00:00
|
|
|
{
|
2017-09-17 22:43:20 +00:00
|
|
|
m_LayersManager->SelectLayer( GetActiveLayer() );
|
2010-10-06 17:28:07 +00:00
|
|
|
UpdateTitleAndInfo();
|
2010-02-04 09:08:08 +00:00
|
|
|
}
|
|
|
|
|
2010-12-17 20:34:29 +00:00
|
|
|
|
2016-05-23 15:47:16 +00:00
|
|
|
void GERBVIEW_FRAME::syncLayerBox( bool aRebuildLayerBox )
|
2010-02-04 09:08:08 +00:00
|
|
|
{
|
2016-05-23 15:47:16 +00:00
|
|
|
if( aRebuildLayerBox )
|
|
|
|
m_SelLayerBox->Resync();
|
|
|
|
|
2017-09-17 22:43:20 +00:00
|
|
|
m_SelLayerBox->SetSelection( GetActiveLayer() );
|
2014-11-22 11:52:57 +00:00
|
|
|
|
2016-06-17 18:00:29 +00:00
|
|
|
int dcodeSelected = -1;
|
2017-09-17 22:43:20 +00:00
|
|
|
GERBER_FILE_IMAGE* gerber = GetGbrImage( GetActiveLayer() );
|
2011-02-08 14:48:38 +00:00
|
|
|
|
2010-12-17 20:34:29 +00:00
|
|
|
if( gerber )
|
|
|
|
dcodeSelected = gerber->m_Selected_Tool;
|
2011-02-08 14:48:38 +00:00
|
|
|
|
2010-12-17 20:34:29 +00:00
|
|
|
if( m_DCodeSelector )
|
|
|
|
{
|
2016-08-17 08:19:10 +00:00
|
|
|
updateDCodeSelectBox();
|
2010-12-17 20:34:29 +00:00
|
|
|
m_DCodeSelector->SetDCodeSelection( dcodeSelected );
|
|
|
|
m_DCodeSelector->Enable( gerber != NULL );
|
|
|
|
}
|
2011-02-08 14:48:38 +00:00
|
|
|
|
2010-10-06 17:28:07 +00:00
|
|
|
UpdateTitleAndInfo();
|
2010-02-04 09:08:08 +00:00
|
|
|
}
|
|
|
|
|
2015-09-25 23:34:57 +00:00
|
|
|
|
2011-03-12 09:50:21 +00:00
|
|
|
void GERBVIEW_FRAME::Liste_D_Codes()
|
2010-09-28 14:42:05 +00:00
|
|
|
{
|
2012-05-04 17:44:42 +00:00
|
|
|
int ii, jj;
|
|
|
|
wxString Line;
|
|
|
|
wxArrayString list;
|
2016-06-17 18:00:29 +00:00
|
|
|
double scale = g_UserUnit == INCHES ? IU_PER_MILS * 1000 : IU_PER_MM;
|
2017-09-17 22:43:20 +00:00
|
|
|
int curr_layer = GetActiveLayer();
|
2010-09-28 14:42:05 +00:00
|
|
|
|
2016-06-17 18:00:29 +00:00
|
|
|
for( int layer = 0; layer < (int)ImagesMaxCount(); ++layer )
|
2010-09-28 14:42:05 +00:00
|
|
|
{
|
2016-06-17 18:00:29 +00:00
|
|
|
GERBER_FILE_IMAGE* gerber = GetGbrImage( layer );
|
2010-12-08 20:12:46 +00:00
|
|
|
|
2010-09-28 14:42:05 +00:00
|
|
|
if( gerber == NULL )
|
|
|
|
continue;
|
|
|
|
|
2016-06-05 12:26:39 +00:00
|
|
|
if( gerber->GetDcodesCount() == 0 )
|
2010-09-28 14:42:05 +00:00
|
|
|
continue;
|
|
|
|
|
|
|
|
if( layer == curr_layer )
|
|
|
|
Line.Printf( wxT( "*** Active layer (%2.2d) ***" ), layer + 1 );
|
|
|
|
else
|
|
|
|
Line.Printf( wxT( "*** layer %2.2d ***" ), layer + 1 );
|
2010-12-08 20:12:46 +00:00
|
|
|
|
2011-04-19 14:28:34 +00:00
|
|
|
list.Add( Line );
|
2010-09-28 14:42:05 +00:00
|
|
|
|
2013-09-29 18:24:38 +00:00
|
|
|
const char* units = g_UserUnit == INCHES ? "\"" : "mm";
|
2016-06-17 18:00:29 +00:00
|
|
|
|
2010-09-28 14:42:05 +00:00
|
|
|
for( ii = 0, jj = 1; ii < TOOLS_MAX_COUNT; ii++ )
|
|
|
|
{
|
2017-09-17 22:43:20 +00:00
|
|
|
D_CODE* pt_D_code = gerber->GetDCODE( ii + FIRST_DCODE );
|
2010-12-08 20:12:46 +00:00
|
|
|
|
2010-09-28 14:42:05 +00:00
|
|
|
if( pt_D_code == NULL )
|
|
|
|
continue;
|
|
|
|
|
|
|
|
if( !pt_D_code->m_InUse && !pt_D_code->m_Defined )
|
|
|
|
continue;
|
|
|
|
|
2016-08-16 10:56:20 +00:00
|
|
|
Line.Printf( wxT( "tool %2.2d: D%2.2d V %.4f %s H %.4f %s %s attribute '%s'" ),
|
2010-09-28 14:42:05 +00:00
|
|
|
jj,
|
|
|
|
pt_D_code->m_Num_Dcode,
|
2013-09-29 18:24:38 +00:00
|
|
|
pt_D_code->m_Size.y / scale, units,
|
|
|
|
pt_D_code->m_Size.x / scale, units,
|
2016-08-16 10:56:20 +00:00
|
|
|
D_CODE::ShowApertureType( pt_D_code->m_Shape ),
|
|
|
|
pt_D_code->m_AperFunction.IsEmpty()? wxT( "none" ) : GetChars( pt_D_code->m_AperFunction )
|
2010-09-28 14:42:05 +00:00
|
|
|
);
|
|
|
|
|
|
|
|
if( !pt_D_code->m_Defined )
|
2016-08-16 10:56:20 +00:00
|
|
|
Line += wxT( " (not defined)" );
|
2010-09-28 14:42:05 +00:00
|
|
|
|
2016-05-24 15:56:52 +00:00
|
|
|
if( pt_D_code->m_InUse )
|
2016-08-16 10:56:20 +00:00
|
|
|
Line += wxT( " (in use)" );
|
2010-09-28 14:42:05 +00:00
|
|
|
|
2011-04-19 14:28:34 +00:00
|
|
|
list.Add( Line );
|
2010-09-28 14:42:05 +00:00
|
|
|
jj++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-05-04 17:44:42 +00:00
|
|
|
wxSingleChoiceDialog dlg( this, wxEmptyString, _( "D Codes" ), list, (void**) NULL,
|
|
|
|
wxCHOICEDLG_STYLE & ~wxCANCEL );
|
2010-12-08 20:12:46 +00:00
|
|
|
|
2011-04-19 14:28:34 +00:00
|
|
|
dlg.ShowModal();
|
2010-09-28 14:42:05 +00:00
|
|
|
}
|
2010-10-06 17:28:07 +00:00
|
|
|
|
2010-12-08 20:12:46 +00:00
|
|
|
|
2011-03-12 09:50:21 +00:00
|
|
|
void GERBVIEW_FRAME::UpdateTitleAndInfo()
|
2010-10-06 17:28:07 +00:00
|
|
|
{
|
2017-09-17 22:43:20 +00:00
|
|
|
GERBER_FILE_IMAGE* gerber = GetGbrImage( GetActiveLayer() );
|
2010-12-08 20:12:46 +00:00
|
|
|
|
2010-10-06 17:28:07 +00:00
|
|
|
// Display the gerber filename
|
|
|
|
if( gerber == NULL )
|
|
|
|
{
|
2016-09-26 17:15:33 +00:00
|
|
|
SetTitle( "GerbView" );
|
|
|
|
|
2010-10-06 17:28:07 +00:00
|
|
|
SetStatusText( wxEmptyString, 0 );
|
2016-05-27 08:20:17 +00:00
|
|
|
|
2016-09-26 17:15:33 +00:00
|
|
|
wxString info;
|
2017-09-17 22:43:20 +00:00
|
|
|
info.Printf( _( "Drawing layer %d not in use" ), GetActiveLayer() + 1 );
|
2016-09-26 17:15:33 +00:00
|
|
|
m_TextInfo->SetValue( info );
|
|
|
|
|
|
|
|
if( EnsureTextCtrlWidth( m_TextInfo, &info ) ) // Resized
|
2016-05-27 08:20:17 +00:00
|
|
|
m_auimgr.Update();
|
|
|
|
|
2010-10-17 16:42:06 +00:00
|
|
|
ClearMsgPanel();
|
2010-10-06 17:28:07 +00:00
|
|
|
return;
|
|
|
|
}
|
2016-09-26 17:15:33 +00:00
|
|
|
else
|
|
|
|
{
|
|
|
|
wxString title;
|
|
|
|
title.Printf( L"GerbView \u2014 %s%s",
|
|
|
|
gerber->m_FileName,
|
|
|
|
gerber->m_IsX2_file
|
|
|
|
? " " + _( "(with X2 attributes)" )
|
|
|
|
: wxString( wxEmptyString ) );
|
|
|
|
SetTitle( title );
|
|
|
|
|
|
|
|
gerber->DisplayImageInfo( this );
|
|
|
|
|
|
|
|
// Display Image Name and Layer Name (from the current gerber data):
|
|
|
|
wxString status;
|
2017-12-15 11:37:46 +00:00
|
|
|
status.Printf( _( "Image name: \"%s\" Layer name: \"%s\"" ),
|
2016-09-26 17:15:33 +00:00
|
|
|
GetChars( gerber->m_ImageName ),
|
|
|
|
GetChars( gerber->GetLayerParams().m_LayerName ) );
|
|
|
|
SetStatusText( status, 0 );
|
|
|
|
|
|
|
|
// Display data format like fmt in X3.4Y3.4 no LZ or fmt mm X2.3 Y3.5 no TZ in main toolbar
|
|
|
|
wxString info;
|
|
|
|
info.Printf( wxT( "fmt: %s X%d.%d Y%d.%d no %cZ" ),
|
|
|
|
gerber->m_GerbMetric ? wxT( "mm" ) : wxT( "in" ),
|
|
|
|
gerber->m_FmtLen.x - gerber->m_FmtScale.x, gerber->m_FmtScale.x,
|
|
|
|
gerber->m_FmtLen.y - gerber->m_FmtScale.y, gerber->m_FmtScale.y,
|
|
|
|
gerber->m_NoTrailingZeros ? 'T' : 'L' );
|
|
|
|
|
|
|
|
if( gerber->m_IsX2_file )
|
|
|
|
info << wxT(" ") << _( "X2 attr" );
|
|
|
|
|
|
|
|
m_TextInfo->SetValue( info );
|
|
|
|
|
|
|
|
if( EnsureTextCtrlWidth( m_TextInfo, &info ) ) // Resized
|
|
|
|
m_auimgr.Update();
|
|
|
|
}
|
2010-10-06 17:28:07 +00:00
|
|
|
}
|
|
|
|
|
2015-09-25 23:34:57 +00:00
|
|
|
|
2017-03-13 03:19:33 +00:00
|
|
|
bool GERBVIEW_FRAME::IsElementVisible( GERBVIEW_LAYER_ID aItemIdVisible ) const
|
2012-05-04 17:44:42 +00:00
|
|
|
{
|
|
|
|
switch( aItemIdVisible )
|
|
|
|
{
|
2017-03-13 03:19:33 +00:00
|
|
|
case LAYER_DCODES:
|
2012-05-04 17:44:42 +00:00
|
|
|
return m_DisplayOptions.m_DisplayDCodes;
|
|
|
|
break;
|
|
|
|
|
2017-03-13 03:19:33 +00:00
|
|
|
case LAYER_NEGATIVE_OBJECTS:
|
2013-01-06 13:31:49 +00:00
|
|
|
return m_DisplayOptions.m_DisplayNegativeObjects;
|
|
|
|
break;
|
|
|
|
|
2017-03-13 03:19:33 +00:00
|
|
|
case LAYER_GERBVIEW_GRID:
|
2012-05-04 17:44:42 +00:00
|
|
|
return IsGridVisible();
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
2012-09-12 17:28:55 +00:00
|
|
|
wxLogDebug( wxT( "GERBVIEW_FRAME::IsElementVisible(): bad arg %d" ), aItemIdVisible );
|
2012-05-04 17:44:42 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2014-06-27 17:07:42 +00:00
|
|
|
long GERBVIEW_FRAME::GetVisibleLayers() const
|
2012-05-04 17:44:42 +00:00
|
|
|
{
|
2017-09-18 01:03:58 +00:00
|
|
|
long layerMask = 0;
|
|
|
|
|
|
|
|
if( auto canvas = GetGalCanvas() )
|
|
|
|
{
|
|
|
|
// NOTE: This assumes max 32 drawlayers!
|
|
|
|
for( int i = 0; i < GERBER_DRAWLAYERS_COUNT; i++ )
|
|
|
|
{
|
|
|
|
if( canvas->GetView()->IsLayerVisible( GERBER_DRAW_LAYER( i ) ) )
|
|
|
|
layerMask |= ( 1 << i );
|
|
|
|
}
|
|
|
|
|
|
|
|
return layerMask;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
return -1;
|
|
|
|
}
|
2012-05-04 17:44:42 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2014-06-27 17:07:42 +00:00
|
|
|
void GERBVIEW_FRAME::SetVisibleLayers( long aLayerMask )
|
2012-05-04 17:44:42 +00:00
|
|
|
{
|
2017-09-17 22:43:20 +00:00
|
|
|
if( auto canvas = GetGalCanvas() )
|
|
|
|
{
|
|
|
|
// NOTE: This assumes max 32 drawlayers!
|
|
|
|
for( int i = 0; i < GERBER_DRAWLAYERS_COUNT; i++ )
|
|
|
|
{
|
|
|
|
bool v = ( aLayerMask & ( 1 << i ) );
|
|
|
|
int layer = GERBER_DRAW_LAYER( i );
|
|
|
|
canvas->GetView()->SetLayerVisible( layer, v );
|
|
|
|
canvas->GetView()->SetLayerVisible( GERBER_DCODE_LAYER( layer ), v );
|
|
|
|
}
|
|
|
|
}
|
2012-05-04 17:44:42 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2014-06-27 17:07:42 +00:00
|
|
|
bool GERBVIEW_FRAME::IsLayerVisible( int aLayer ) const
|
2012-05-04 17:44:42 +00:00
|
|
|
{
|
|
|
|
if( ! m_DisplayOptions.m_IsPrinting )
|
2017-09-17 22:43:20 +00:00
|
|
|
{
|
|
|
|
if( IsGalCanvasActive() )
|
|
|
|
aLayer = GERBER_DRAW_LAYER( aLayer );
|
|
|
|
|
2013-04-09 16:00:46 +00:00
|
|
|
return m_LayersManager->IsLayerVisible( aLayer );
|
2017-09-17 22:43:20 +00:00
|
|
|
}
|
2012-05-04 17:44:42 +00:00
|
|
|
else
|
2014-06-27 17:07:42 +00:00
|
|
|
return GetGerberLayout()->IsLayerPrintable( aLayer );
|
2012-05-04 17:44:42 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2017-08-04 12:43:02 +00:00
|
|
|
COLOR4D GERBVIEW_FRAME::GetVisibleElementColor( GERBVIEW_LAYER_ID aItemIdVisible )
|
2012-05-04 17:44:42 +00:00
|
|
|
{
|
2017-02-20 17:48:27 +00:00
|
|
|
COLOR4D color = COLOR4D::UNSPECIFIED;
|
2012-05-04 17:44:42 +00:00
|
|
|
|
|
|
|
switch( aItemIdVisible )
|
|
|
|
{
|
2017-03-13 03:19:33 +00:00
|
|
|
case LAYER_NEGATIVE_OBJECTS:
|
|
|
|
case LAYER_DCODES:
|
2012-05-04 17:44:42 +00:00
|
|
|
color = m_colorsSettings->GetItemColor( aItemIdVisible );
|
|
|
|
break;
|
|
|
|
|
2017-03-13 03:19:33 +00:00
|
|
|
case LAYER_GERBVIEW_GRID:
|
2012-05-04 17:44:42 +00:00
|
|
|
color = GetGridColor();
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
2012-09-12 17:28:55 +00:00
|
|
|
wxLogDebug( wxT( "GERBVIEW_FRAME::GetVisibleElementColor(): bad arg %d" ),
|
|
|
|
(int)aItemIdVisible );
|
2012-05-04 17:44:42 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return color;
|
|
|
|
}
|
|
|
|
|
2015-09-25 23:34:57 +00:00
|
|
|
|
2012-05-04 17:44:42 +00:00
|
|
|
void GERBVIEW_FRAME::SetGridVisibility( bool aVisible )
|
|
|
|
{
|
|
|
|
EDA_DRAW_FRAME::SetGridVisibility( aVisible );
|
2017-03-13 03:19:33 +00:00
|
|
|
m_LayersManager->SetRenderState( LAYER_GERBVIEW_GRID, aVisible );
|
2012-05-04 17:44:42 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2017-03-13 03:19:33 +00:00
|
|
|
void GERBVIEW_FRAME::SetVisibleElementColor( GERBVIEW_LAYER_ID aItemIdVisible,
|
2017-02-20 16:57:41 +00:00
|
|
|
COLOR4D aColor )
|
2012-05-04 17:44:42 +00:00
|
|
|
{
|
|
|
|
switch( aItemIdVisible )
|
|
|
|
{
|
2017-03-13 03:19:33 +00:00
|
|
|
case LAYER_NEGATIVE_OBJECTS:
|
|
|
|
case LAYER_DCODES:
|
2012-05-04 17:44:42 +00:00
|
|
|
m_colorsSettings->SetItemColor( aItemIdVisible, aColor );
|
|
|
|
break;
|
|
|
|
|
2017-03-13 03:19:33 +00:00
|
|
|
case LAYER_GERBVIEW_GRID:
|
2017-09-17 22:43:20 +00:00
|
|
|
// Ensure grid always has low alpha
|
|
|
|
aColor.a = 0.8;
|
2012-05-04 17:44:42 +00:00
|
|
|
SetGridColor( aColor );
|
|
|
|
m_colorsSettings->SetItemColor( aItemIdVisible, aColor );
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
2012-09-12 17:28:55 +00:00
|
|
|
wxLogDebug( wxT( "GERBVIEW_FRAME::SetVisibleElementColor(): bad arg %d" ),
|
|
|
|
(int) aItemIdVisible );
|
2012-05-04 17:44:42 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-08-04 12:43:02 +00:00
|
|
|
COLOR4D GERBVIEW_FRAME::GetNegativeItemsColor()
|
2013-01-06 13:31:49 +00:00
|
|
|
{
|
2017-03-13 03:19:33 +00:00
|
|
|
if( IsElementVisible( LAYER_NEGATIVE_OBJECTS ) )
|
|
|
|
return GetVisibleElementColor( LAYER_NEGATIVE_OBJECTS );
|
2013-01-06 13:31:49 +00:00
|
|
|
else
|
2014-06-20 11:13:04 +00:00
|
|
|
return GetDrawBgColor();
|
2013-01-06 13:31:49 +00:00
|
|
|
}
|
2012-05-04 17:44:42 +00:00
|
|
|
|
2013-01-06 13:31:49 +00:00
|
|
|
|
2017-02-20 16:57:41 +00:00
|
|
|
COLOR4D GERBVIEW_FRAME::GetLayerColor( int aLayer ) const
|
2012-05-04 17:44:42 +00:00
|
|
|
{
|
|
|
|
return m_colorsSettings->GetLayerColor( aLayer );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2017-02-20 16:57:41 +00:00
|
|
|
void GERBVIEW_FRAME::SetLayerColor( int aLayer, COLOR4D aColor )
|
2012-05-04 17:44:42 +00:00
|
|
|
{
|
|
|
|
m_colorsSettings->SetLayerColor( aLayer, aColor );
|
2017-09-17 22:43:20 +00:00
|
|
|
applyDisplaySettingsToGAL();
|
2012-05-04 17:44:42 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2017-09-17 22:43:20 +00:00
|
|
|
int GERBVIEW_FRAME::GetActiveLayer()
|
2012-05-04 17:44:42 +00:00
|
|
|
{
|
|
|
|
return ( (GBR_SCREEN*) GetScreen() )->m_Active_Layer;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2017-09-17 22:43:20 +00:00
|
|
|
void GERBVIEW_FRAME::SetActiveLayer( int aLayer, bool doLayerWidgetUpdate )
|
2012-05-04 17:44:42 +00:00
|
|
|
{
|
|
|
|
( (GBR_SCREEN*) GetScreen() )->m_Active_Layer = aLayer;
|
|
|
|
|
|
|
|
if( doLayerWidgetUpdate )
|
2017-09-17 22:43:20 +00:00
|
|
|
m_LayersManager->SelectLayer( GetActiveLayer() );
|
|
|
|
|
|
|
|
if( IsGalCanvasActive() )
|
|
|
|
{
|
|
|
|
m_toolManager->RunAction( GERBVIEW_ACTIONS::layerChanged ); // notify other tools
|
|
|
|
GetGalCanvas()->SetFocus(); // otherwise hotkeys are stuck somewhere
|
|
|
|
|
2017-09-25 01:12:58 +00:00
|
|
|
// NOTE(JE) The next two calls are slow (scales with number of items)
|
2017-09-17 22:43:20 +00:00
|
|
|
GetGalCanvas()->SetTopLayer( GERBER_DRAW_LAYER( aLayer ) );
|
|
|
|
GetGalCanvas()->SetHighContrastLayer( GERBER_DRAW_LAYER( aLayer ) );
|
|
|
|
|
2017-09-25 01:12:58 +00:00
|
|
|
GetGalCanvas()->Refresh();
|
2017-09-17 22:43:20 +00:00
|
|
|
}
|
2012-05-04 17:44:42 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void GERBVIEW_FRAME::SetPageSettings( const PAGE_INFO& aPageSettings )
|
|
|
|
{
|
2014-12-23 13:01:59 +00:00
|
|
|
m_paper = aPageSettings;
|
2012-05-04 17:44:42 +00:00
|
|
|
|
|
|
|
if( GetScreen() )
|
|
|
|
GetScreen()->InitDataPoints( aPageSettings.GetSizeIU() );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
const PAGE_INFO& GERBVIEW_FRAME::GetPageSettings() const
|
|
|
|
{
|
2014-12-23 13:01:59 +00:00
|
|
|
return m_paper;
|
2012-05-04 17:44:42 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
const wxSize GERBVIEW_FRAME::GetPageSizeIU() const
|
|
|
|
{
|
|
|
|
// 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.
|
2014-12-23 13:01:59 +00:00
|
|
|
return GetPageSettings().GetSizeIU();
|
2012-05-04 17:44:42 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
const TITLE_BLOCK& GERBVIEW_FRAME::GetTitleBlock() const
|
|
|
|
{
|
2013-06-27 19:12:01 +00:00
|
|
|
wxASSERT( m_gerberLayout );
|
|
|
|
return m_gerberLayout->GetTitleBlock();
|
2012-05-04 17:44:42 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void GERBVIEW_FRAME::SetTitleBlock( const TITLE_BLOCK& aTitleBlock )
|
|
|
|
{
|
2013-06-27 19:12:01 +00:00
|
|
|
wxASSERT( m_gerberLayout );
|
|
|
|
m_gerberLayout->SetTitleBlock( aTitleBlock );
|
2012-05-04 17:44:42 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2013-08-03 05:15:23 +00:00
|
|
|
const wxPoint& GERBVIEW_FRAME::GetAuxOrigin() const
|
2012-05-04 17:44:42 +00:00
|
|
|
{
|
2013-06-27 19:12:01 +00:00
|
|
|
wxASSERT( m_gerberLayout );
|
2013-08-03 05:15:23 +00:00
|
|
|
return m_gerberLayout->GetAuxOrigin();
|
2012-05-04 17:44:42 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2013-08-03 05:15:23 +00:00
|
|
|
void GERBVIEW_FRAME::SetAuxOrigin( const wxPoint& aPosition )
|
2012-05-04 17:44:42 +00:00
|
|
|
{
|
2013-06-27 19:12:01 +00:00
|
|
|
wxASSERT( m_gerberLayout );
|
2013-08-03 05:15:23 +00:00
|
|
|
m_gerberLayout->SetAuxOrigin( aPosition );
|
2012-05-04 17:44:42 +00:00
|
|
|
}
|
|
|
|
|
2013-01-12 17:32:24 +00:00
|
|
|
|
2012-05-04 17:44:42 +00:00
|
|
|
void GERBVIEW_FRAME::SetCurItem( GERBER_DRAW_ITEM* aItem, bool aDisplayInfo )
|
|
|
|
{
|
|
|
|
GetScreen()->SetCurItem( aItem );
|
|
|
|
|
|
|
|
if( aItem )
|
|
|
|
{
|
|
|
|
if( aDisplayInfo )
|
2013-01-12 17:32:24 +00:00
|
|
|
{
|
|
|
|
MSG_PANEL_ITEMS items;
|
|
|
|
aItem->GetMsgPanelInfo( items );
|
|
|
|
SetMsgPanel( items );
|
|
|
|
}
|
2012-05-04 17:44:42 +00:00
|
|
|
}
|
|
|
|
else
|
2013-01-12 17:32:24 +00:00
|
|
|
{
|
2012-05-04 17:44:42 +00:00
|
|
|
EraseMsgBox();
|
2013-01-12 17:32:24 +00:00
|
|
|
}
|
2012-05-04 17:44:42 +00:00
|
|
|
}
|
|
|
|
|
2013-01-12 17:32:24 +00:00
|
|
|
|
2017-09-17 22:43:20 +00:00
|
|
|
void GERBVIEW_FRAME::SetGridColor( COLOR4D aColor )
|
|
|
|
{
|
|
|
|
if( IsGalCanvasActive() )
|
|
|
|
{
|
|
|
|
GetGalCanvas()->GetGAL()->SetGridColor( aColor );
|
|
|
|
}
|
|
|
|
|
|
|
|
m_gridColor = aColor;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2013-06-27 19:12:01 +00:00
|
|
|
EDA_RECT GERBVIEW_FRAME::GetGerberLayoutBoundingBox()
|
2012-05-04 17:44:42 +00:00
|
|
|
{
|
2013-06-27 19:12:01 +00:00
|
|
|
GetGerberLayout()->ComputeBoundingBox();
|
|
|
|
return GetGerberLayout()->GetBoundingBox();
|
2012-05-04 17:44:42 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void GERBVIEW_FRAME::UpdateStatusBar()
|
|
|
|
{
|
|
|
|
EDA_DRAW_FRAME::UpdateStatusBar();
|
|
|
|
|
|
|
|
GBR_SCREEN* screen = (GBR_SCREEN*) GetScreen();
|
|
|
|
|
|
|
|
if( !screen )
|
|
|
|
return;
|
|
|
|
|
|
|
|
int dx;
|
|
|
|
int dy;
|
|
|
|
double dXpos;
|
|
|
|
double dYpos;
|
|
|
|
wxString line;
|
|
|
|
wxString locformatter;
|
|
|
|
|
|
|
|
if( m_DisplayOptions.m_DisplayPolarCood ) // display relative polar coordinates
|
|
|
|
{
|
|
|
|
double theta, ro;
|
|
|
|
|
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
|
|
|
|
2013-05-01 17:32:36 +00:00
|
|
|
// atan2 in the 0,0 case returns 0
|
2016-01-17 15:59:24 +00:00
|
|
|
theta = RAD2DEG( atan2( (double) -dy, (double) dx ) );
|
2012-05-04 17:44:42 +00:00
|
|
|
|
2013-05-01 17:32:36 +00:00
|
|
|
ro = hypot( dx, dy );
|
2012-05-04 17:44:42 +00:00
|
|
|
wxString formatter;
|
|
|
|
switch( g_UserUnit )
|
|
|
|
{
|
|
|
|
case INCHES:
|
2013-02-24 17:31:18 +00:00
|
|
|
formatter = wxT( "Ro %.6f Th %.1f" );
|
2012-05-04 17:44:42 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case MILLIMETRES:
|
2013-02-24 17:31:18 +00:00
|
|
|
formatter = wxT( "Ro %.5f Th %.1f" );
|
2012-05-04 17:44:42 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case UNSCALED_UNITS:
|
|
|
|
formatter = wxT( "Ro %f Th %f" );
|
|
|
|
break;
|
2015-02-19 15:03:45 +00:00
|
|
|
|
|
|
|
case DEGREES:
|
|
|
|
wxASSERT( false );
|
|
|
|
break;
|
2012-05-04 17:44:42 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
line.Printf( formatter, To_User_Unit( g_UserUnit, ro ), theta );
|
|
|
|
|
|
|
|
SetStatusText( line, 3 );
|
|
|
|
}
|
|
|
|
|
|
|
|
// 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-05-04 17:44:42 +00:00
|
|
|
|
|
|
|
wxString absformatter;
|
|
|
|
|
|
|
|
switch( g_UserUnit )
|
|
|
|
{
|
|
|
|
case INCHES:
|
2013-02-24 17:31:18 +00:00
|
|
|
absformatter = wxT( "X %.6f Y %.6f" );
|
2015-01-06 07:38:58 +00:00
|
|
|
locformatter = wxT( "dx %.6f dy %.6f dist %.4f" );
|
2012-05-04 17:44:42 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case MILLIMETRES:
|
2013-02-24 17:31:18 +00:00
|
|
|
absformatter = wxT( "X %.5f Y %.5f" );
|
2015-01-06 07:38:58 +00:00
|
|
|
locformatter = wxT( "dx %.5f dy %.5f dist %.3f" );
|
2012-05-04 17:44:42 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case UNSCALED_UNITS:
|
|
|
|
absformatter = wxT( "X %f Y %f" );
|
2015-04-19 18:41:57 +00:00
|
|
|
locformatter = wxT( "dx %f dy %f dist %f" );
|
2012-05-04 17:44:42 +00:00
|
|
|
break;
|
2015-02-19 15:03:45 +00:00
|
|
|
|
|
|
|
case DEGREES:
|
|
|
|
wxASSERT( false );
|
|
|
|
break;
|
2012-05-04 17:44:42 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
line.Printf( absformatter, dXpos, dYpos );
|
|
|
|
SetStatusText( line, 2 );
|
|
|
|
|
|
|
|
if( !m_DisplayOptions.m_DisplayPolarCood ) // display relative cartesian coordinates
|
|
|
|
{
|
|
|
|
// 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 );
|
|
|
|
|
|
|
|
// 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 );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-01-06 07:38:58 +00:00
|
|
|
|
|
|
|
const wxString GERBVIEW_FRAME::GetZoomLevelIndicator() const
|
|
|
|
{
|
|
|
|
return EDA_DRAW_FRAME::GetZoomLevelIndicator();
|
|
|
|
}
|
2016-06-17 18:00:29 +00:00
|
|
|
|
|
|
|
GERBER_FILE_IMAGE* GERBVIEW_FRAME::GetGbrImage( int aIdx ) const
|
|
|
|
{
|
|
|
|
return m_gerberLayout->GetImagesList()->GetGbrImage( aIdx );
|
|
|
|
}
|
|
|
|
|
|
|
|
unsigned GERBVIEW_FRAME::ImagesMaxCount() const
|
|
|
|
{
|
|
|
|
return m_gerberLayout->GetImagesList()->ImagesMaxCount();
|
|
|
|
}
|
|
|
|
|
2016-08-17 08:19:10 +00:00
|
|
|
|
|
|
|
void GERBVIEW_FRAME::unitsChangeRefresh()
|
|
|
|
{ // Called on units change (see EDA_DRAW_FRAME)
|
|
|
|
EDA_DRAW_FRAME::unitsChangeRefresh();
|
|
|
|
updateDCodeSelectBox();
|
2016-09-26 17:15:33 +00:00
|
|
|
}
|
2017-09-17 22:43:20 +00:00
|
|
|
|
|
|
|
|
|
|
|
void GERBVIEW_FRAME::UseGalCanvas( bool aEnable )
|
|
|
|
{
|
|
|
|
EDA_DRAW_FRAME::UseGalCanvas( aEnable );
|
|
|
|
|
|
|
|
EDA_DRAW_PANEL_GAL* galCanvas = GetGalCanvas();
|
|
|
|
|
|
|
|
if( m_toolManager )
|
|
|
|
m_toolManager->SetEnvironment( m_gerberLayout, GetGalCanvas()->GetView(),
|
|
|
|
GetGalCanvas()->GetViewControls(), this );
|
|
|
|
|
|
|
|
if( aEnable )
|
|
|
|
{
|
|
|
|
if( m_toolManager )
|
|
|
|
m_toolManager->ResetTools( TOOL_BASE::GAL_SWITCH );
|
|
|
|
|
2017-11-28 03:12:31 +00:00
|
|
|
m_colorsSettings->SetLegacyMode( false );
|
|
|
|
|
2017-09-17 22:43:20 +00:00
|
|
|
galCanvas->GetGAL()->SetGridColor( GetLayerColor( LAYER_GERBVIEW_GRID ) );
|
|
|
|
|
|
|
|
galCanvas->GetView()->RecacheAllItems();
|
|
|
|
galCanvas->SetEventDispatcher( m_toolDispatcher );
|
|
|
|
galCanvas->StartDrawing();
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if( m_toolManager )
|
|
|
|
m_toolManager->ResetTools( TOOL_BASE::GAL_SWITCH );
|
|
|
|
|
|
|
|
galCanvas->StopDrawing();
|
|
|
|
|
|
|
|
// Redirect all events to the legacy canvas
|
|
|
|
galCanvas->SetEventDispatcher( NULL );
|
|
|
|
|
2017-11-28 03:12:31 +00:00
|
|
|
m_colorsSettings->SetLegacyMode( true );
|
2017-09-17 22:43:20 +00:00
|
|
|
m_canvas->Refresh();
|
|
|
|
}
|
|
|
|
|
|
|
|
m_LayersManager->ReFill();
|
|
|
|
m_LayersManager->ReFillRender();
|
|
|
|
|
|
|
|
ReCreateOptToolbar();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void GERBVIEW_FRAME::setupTools()
|
|
|
|
{
|
|
|
|
// Create the manager and dispatcher & route draw panel events to the dispatcher
|
|
|
|
m_toolManager = new TOOL_MANAGER;
|
|
|
|
m_toolManager->SetEnvironment( m_gerberLayout, GetGalCanvas()->GetView(),
|
|
|
|
GetGalCanvas()->GetViewControls(), this );
|
|
|
|
m_actions = new GERBVIEW_ACTIONS();
|
|
|
|
m_toolDispatcher = new TOOL_DISPATCHER( m_toolManager, m_actions );
|
|
|
|
|
|
|
|
// Register tools
|
|
|
|
m_actions->RegisterAllTools( m_toolManager );
|
|
|
|
m_toolManager->InitTools();
|
|
|
|
|
|
|
|
// Run the selection tool, it is supposed to be always active
|
|
|
|
m_toolManager->InvokeTool( "gerbview.InteractiveSelection" );
|
|
|
|
}
|
|
|
|
|
2018-01-08 04:05:03 +00:00
|
|
|
|
|
|
|
int GERBVIEW_FRAME::GetIconScale()
|
|
|
|
{
|
|
|
|
int scale = 0;
|
|
|
|
Kiface().KifaceSettings()->Read( IconScaleEntry, &scale, 0 );
|
|
|
|
return scale;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void GERBVIEW_FRAME::SetIconScale( int aScale )
|
|
|
|
{
|
|
|
|
Kiface().KifaceSettings()->Write( IconScaleEntry, aScale );
|
|
|
|
ReCreateMenuBar();
|
|
|
|
ReCreateHToolbar();
|
|
|
|
ReCreateOptToolbar();
|
|
|
|
ReCreateAuxiliaryToolbar();
|
|
|
|
Layout();
|
|
|
|
SendSizeEvent();
|
|
|
|
}
|