2014-10-21 18:36:45 +00:00
|
|
|
/*
|
|
|
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
|
|
|
*
|
|
|
|
* Copyright (C) 2011-2014 Jean-Pierre Charras jp.charras at wanadoo.fr
|
2018-03-05 17:11:18 +00:00
|
|
|
* Copyright (C) 1992-2018 KiCad Developers, see AUTHORS.txt for contributors.
|
2014-10-21 18:36:45 +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 2
|
|
|
|
* of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, you may find one here:
|
|
|
|
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
|
|
|
* or you may search the http://www.gnu.org website for the version 2 license,
|
|
|
|
* or you may write to the Free Software Foundation, Inc.,
|
|
|
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
|
|
|
*/
|
|
|
|
|
2011-09-23 20:00:30 +00:00
|
|
|
/**
|
|
|
|
* @file events_called_functions.cpp
|
2011-09-30 18:15:37 +00:00
|
|
|
* @brief GerbView command event functions.
|
2011-09-23 20:00:30 +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 <pgm_base.h>
|
2012-01-23 04:33:36 +00:00
|
|
|
#include <class_drawpanel.h>
|
|
|
|
#include <gestfich.h>
|
2011-09-23 20:00:30 +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 <kicad_device_context.h>
|
|
|
|
#include <gerbview_id.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>
|
2012-01-23 04:33:36 +00:00
|
|
|
#include <dialog_show_page_borders.h>
|
2011-09-23 20:00:30 +00:00
|
|
|
|
2017-09-17 22:43:20 +00:00
|
|
|
#include <tool/tool_manager.h>
|
|
|
|
#include <gerbview_painter.h>
|
|
|
|
#include <view/view.h>
|
|
|
|
|
2011-09-23 20:00:30 +00:00
|
|
|
|
|
|
|
// Event table:
|
|
|
|
|
2012-05-04 17:44:42 +00:00
|
|
|
BEGIN_EVENT_TABLE( GERBVIEW_FRAME, EDA_DRAW_FRAME )
|
2011-09-23 20:00:30 +00:00
|
|
|
EVT_CLOSE( GERBVIEW_FRAME::OnCloseWindow )
|
|
|
|
EVT_SIZE( GERBVIEW_FRAME::OnSize )
|
|
|
|
|
|
|
|
EVT_TOOL( wxID_FILE, GERBVIEW_FRAME::Files_io )
|
|
|
|
EVT_TOOL( ID_GERBVIEW_ERASE_ALL, GERBVIEW_FRAME::Files_io )
|
|
|
|
EVT_TOOL( ID_GERBVIEW_LOAD_DRILL_FILE, GERBVIEW_FRAME::Files_io )
|
2017-01-26 09:45:28 +00:00
|
|
|
EVT_TOOL( ID_GERBVIEW_LOAD_ZIP_ARCHIVE_FILE, GERBVIEW_FRAME::Files_io )
|
2017-08-19 16:28:11 +00:00
|
|
|
EVT_TOOL( ID_GERBVIEW_LOAD_JOB_FILE, GERBVIEW_FRAME::Files_io )
|
2011-09-23 20:00:30 +00:00
|
|
|
EVT_TOOL( ID_NEW_BOARD, GERBVIEW_FRAME::Files_io )
|
2011-10-16 08:02:36 +00:00
|
|
|
EVT_TOOL( ID_GERBVIEW_SET_PAGE_BORDER, GERBVIEW_FRAME::Process_Special_Functions )
|
2011-09-23 20:00:30 +00:00
|
|
|
|
|
|
|
// Menu Files:
|
|
|
|
EVT_MENU( wxID_FILE, GERBVIEW_FRAME::Files_io )
|
|
|
|
EVT_MENU( ID_NEW_BOARD, GERBVIEW_FRAME::Files_io )
|
|
|
|
EVT_MENU( ID_GERBVIEW_EXPORT_TO_PCBNEW, GERBVIEW_FRAME::ExportDataInPcbnewFormat )
|
|
|
|
|
|
|
|
EVT_MENU_RANGE( wxID_FILE1, wxID_FILE9, GERBVIEW_FRAME::OnGbrFileHistory )
|
2017-01-26 09:45:28 +00:00
|
|
|
|
2011-09-23 20:00:30 +00:00
|
|
|
EVT_MENU_RANGE( ID_GERBVIEW_DRILL_FILE1, ID_GERBVIEW_DRILL_FILE9,
|
|
|
|
GERBVIEW_FRAME::OnDrlFileHistory )
|
|
|
|
|
2017-01-26 09:45:28 +00:00
|
|
|
EVT_MENU_RANGE( ID_GERBVIEW_ZIP_FILE1, ID_GERBVIEW_ZIP_FILE9,
|
|
|
|
GERBVIEW_FRAME::OnZipFileHistory )
|
|
|
|
|
2017-08-19 16:28:11 +00:00
|
|
|
EVT_MENU_RANGE( ID_GERBVIEW_JOB_FILE1, ID_GERBVIEW_JOB_FILE9,
|
|
|
|
GERBVIEW_FRAME::OnJobFileHistory )
|
|
|
|
|
2011-09-23 20:00:30 +00:00
|
|
|
EVT_MENU( wxID_EXIT, GERBVIEW_FRAME::OnQuit )
|
|
|
|
|
|
|
|
// menu Preferences
|
|
|
|
EVT_MENU_RANGE( ID_PREFERENCES_HOTKEY_START, ID_PREFERENCES_HOTKEY_END,
|
|
|
|
GERBVIEW_FRAME::Process_Config )
|
|
|
|
|
|
|
|
EVT_MENU( ID_MENU_GERBVIEW_SHOW_HIDE_LAYERS_MANAGER_DIALOG,
|
|
|
|
GERBVIEW_FRAME::OnSelectOptionToolbar )
|
|
|
|
EVT_MENU( wxID_PREFERENCES, GERBVIEW_FRAME::InstallGerberOptionsDialog )
|
2017-09-17 22:43:20 +00:00
|
|
|
EVT_UPDATE_UI( ID_MENU_CANVAS_LEGACY, GERBVIEW_FRAME::OnUpdateSwitchCanvas )
|
|
|
|
EVT_UPDATE_UI( ID_MENU_CANVAS_CAIRO, GERBVIEW_FRAME::OnUpdateSwitchCanvas )
|
|
|
|
EVT_UPDATE_UI( ID_MENU_CANVAS_OPENGL, GERBVIEW_FRAME::OnUpdateSwitchCanvas )
|
2018-01-21 11:04:04 +00:00
|
|
|
EVT_MENU( ID_MENU_CANVAS_LEGACY, GERBVIEW_FRAME::OnSwitchCanvas )
|
|
|
|
EVT_MENU( ID_MENU_CANVAS_CAIRO, GERBVIEW_FRAME::OnSwitchCanvas )
|
|
|
|
EVT_MENU( ID_MENU_CANVAS_OPENGL, GERBVIEW_FRAME::OnSwitchCanvas )
|
2011-09-23 20:00:30 +00:00
|
|
|
|
|
|
|
// menu Postprocess
|
|
|
|
EVT_MENU( ID_GERBVIEW_SHOW_LIST_DCODES, GERBVIEW_FRAME::Process_Special_Functions )
|
|
|
|
EVT_MENU( ID_GERBVIEW_SHOW_SOURCE, GERBVIEW_FRAME::OnShowGerberSourceFile )
|
|
|
|
EVT_MENU( ID_MENU_GERBVIEW_SELECT_PREFERED_EDITOR,
|
|
|
|
EDA_BASE_FRAME::OnSelectPreferredEditor )
|
|
|
|
|
|
|
|
// menu Miscellaneous
|
2016-08-16 10:56:20 +00:00
|
|
|
EVT_MENU( ID_GERBVIEW_ERASE_CURR_LAYER, GERBVIEW_FRAME::Process_Special_Functions )
|
2011-09-23 20:00:30 +00:00
|
|
|
|
|
|
|
// Menu Help
|
|
|
|
EVT_MENU( wxID_HELP, EDA_DRAW_FRAME::GetKicadHelp )
|
2015-09-23 18:43:40 +00:00
|
|
|
EVT_MENU( wxID_INDEX, EDA_DRAW_FRAME::GetKicadHelp )
|
2016-09-24 00:44:52 +00:00
|
|
|
EVT_MENU( ID_HELP_GET_INVOLVED, EDA_DRAW_FRAME::GetKicadContribute )
|
2011-09-23 20:00:30 +00:00
|
|
|
EVT_MENU( wxID_ABOUT, EDA_DRAW_FRAME::GetKicadAbout )
|
|
|
|
|
|
|
|
EVT_TOOL( wxID_UNDO, GERBVIEW_FRAME::Process_Special_Functions )
|
|
|
|
EVT_TOOL( wxID_PRINT, GERBVIEW_FRAME::ToPrinter )
|
|
|
|
EVT_COMBOBOX( ID_TOOLBARH_GERBVIEW_SELECT_ACTIVE_LAYER,
|
|
|
|
GERBVIEW_FRAME::OnSelectActiveLayer )
|
|
|
|
|
|
|
|
EVT_SELECT_DCODE( ID_TOOLBARH_GERBER_SELECT_ACTIVE_DCODE, GERBVIEW_FRAME::OnSelectActiveDCode )
|
|
|
|
|
|
|
|
// Vertical toolbar:
|
|
|
|
EVT_TOOL( ID_NO_TOOL_SELECTED, GERBVIEW_FRAME::Process_Special_Functions )
|
|
|
|
|
|
|
|
EVT_MENU_RANGE( ID_POPUP_GENERAL_START_RANGE, ID_POPUP_GENERAL_END_RANGE,
|
|
|
|
GERBVIEW_FRAME::Process_Special_Functions )
|
|
|
|
|
|
|
|
// Option toolbar
|
2016-06-10 11:08:16 +00:00
|
|
|
//EVT_TOOL( ID_NO_TOOL_SELECTED, GERBVIEW_FRAME::Process_Special_Functions ) // mentioned below
|
|
|
|
EVT_TOOL( ID_ZOOM_SELECTION, GERBVIEW_FRAME::Process_Special_Functions )
|
2017-09-17 22:43:20 +00:00
|
|
|
EVT_TOOL( ID_TB_MEASUREMENT_TOOL, GERBVIEW_FRAME::Process_Special_Functions )
|
2012-05-04 17:44:42 +00:00
|
|
|
EVT_TOOL( ID_TB_OPTIONS_SHOW_POLAR_COORD, GERBVIEW_FRAME::OnSelectOptionToolbar )
|
2011-09-23 20:00:30 +00:00
|
|
|
EVT_TOOL( ID_TB_OPTIONS_SHOW_POLYGONS_SKETCH, GERBVIEW_FRAME::OnSelectOptionToolbar )
|
|
|
|
EVT_TOOL( ID_TB_OPTIONS_SHOW_FLASHED_ITEMS_SKETCH, GERBVIEW_FRAME::OnSelectOptionToolbar )
|
|
|
|
EVT_TOOL( ID_TB_OPTIONS_SHOW_LINES_SKETCH, GERBVIEW_FRAME::OnSelectOptionToolbar )
|
|
|
|
EVT_TOOL( ID_TB_OPTIONS_SHOW_LAYERS_MANAGER_VERTICAL_TOOLBAR,
|
|
|
|
GERBVIEW_FRAME::OnSelectOptionToolbar )
|
|
|
|
EVT_TOOL( ID_TB_OPTIONS_SHOW_DCODES, GERBVIEW_FRAME::OnSelectOptionToolbar )
|
2013-01-06 13:31:49 +00:00
|
|
|
EVT_TOOL( ID_TB_OPTIONS_SHOW_NEGATIVE_ITEMS, GERBVIEW_FRAME::OnSelectOptionToolbar )
|
2011-09-23 20:00:30 +00:00
|
|
|
EVT_TOOL_RANGE( ID_TB_OPTIONS_SHOW_GBR_MODE_0, ID_TB_OPTIONS_SHOW_GBR_MODE_2,
|
|
|
|
GERBVIEW_FRAME::OnSelectDisplayMode )
|
2017-09-17 22:43:20 +00:00
|
|
|
EVT_TOOL( ID_TB_OPTIONS_DIFF_MODE, GERBVIEW_FRAME::OnSelectOptionToolbar )
|
|
|
|
EVT_TOOL( ID_TB_OPTIONS_HIGH_CONTRAST_MODE, GERBVIEW_FRAME::OnSelectOptionToolbar )
|
2011-09-23 20:00:30 +00:00
|
|
|
|
2016-08-16 10:56:20 +00:00
|
|
|
// Auxiliary horizontal toolbar
|
2017-09-17 22:43:20 +00:00
|
|
|
EVT_CHOICE( ID_GBR_AUX_TOOLBAR_PCB_CMP_CHOICE, GERBVIEW_FRAME::OnSelectHighlightChoice )
|
|
|
|
EVT_CHOICE( ID_GBR_AUX_TOOLBAR_PCB_NET_CHOICE, GERBVIEW_FRAME::OnSelectHighlightChoice )
|
|
|
|
EVT_CHOICE( ID_GBR_AUX_TOOLBAR_PCB_APERATTRIBUTES_CHOICE, GERBVIEW_FRAME::OnSelectHighlightChoice )
|
2016-08-16 10:56:20 +00:00
|
|
|
|
|
|
|
// Right click context menu
|
|
|
|
EVT_MENU( ID_HIGHLIGHT_CMP_ITEMS, GERBVIEW_FRAME::Process_Special_Functions )
|
|
|
|
EVT_MENU( ID_HIGHLIGHT_NET_ITEMS, GERBVIEW_FRAME::Process_Special_Functions )
|
|
|
|
EVT_MENU( ID_HIGHLIGHT_APER_ATTRIBUTE_ITEMS, GERBVIEW_FRAME::Process_Special_Functions )
|
|
|
|
EVT_MENU( ID_HIGHLIGHT_REMOVE_ALL, GERBVIEW_FRAME::Process_Special_Functions )
|
|
|
|
|
2016-06-10 11:08:16 +00:00
|
|
|
EVT_UPDATE_UI( ID_NO_TOOL_SELECTED, GERBVIEW_FRAME::OnUpdateSelectTool )
|
|
|
|
EVT_UPDATE_UI( ID_ZOOM_SELECTION, GERBVIEW_FRAME::OnUpdateSelectTool )
|
2017-09-17 22:43:20 +00:00
|
|
|
EVT_UPDATE_UI( ID_TB_MEASUREMENT_TOOL, GERBVIEW_FRAME::OnUpdateSelectTool )
|
2012-05-04 17:44:42 +00:00
|
|
|
EVT_UPDATE_UI( ID_TB_OPTIONS_SHOW_POLAR_COORD, GERBVIEW_FRAME::OnUpdateCoordType )
|
2011-09-23 20:00:30 +00:00
|
|
|
EVT_UPDATE_UI( ID_TB_OPTIONS_SHOW_FLASHED_ITEMS_SKETCH,
|
|
|
|
GERBVIEW_FRAME::OnUpdateFlashedItemsDrawMode )
|
|
|
|
EVT_UPDATE_UI( ID_TB_OPTIONS_SHOW_LINES_SKETCH, GERBVIEW_FRAME::OnUpdateLinesDrawMode )
|
|
|
|
EVT_UPDATE_UI( ID_TB_OPTIONS_SHOW_POLYGONS_SKETCH, GERBVIEW_FRAME::OnUpdatePolygonsDrawMode )
|
|
|
|
EVT_UPDATE_UI( ID_TB_OPTIONS_SHOW_DCODES, GERBVIEW_FRAME::OnUpdateShowDCodes )
|
2013-01-06 13:31:49 +00:00
|
|
|
EVT_UPDATE_UI( ID_TB_OPTIONS_SHOW_NEGATIVE_ITEMS, GERBVIEW_FRAME::OnUpdateShowNegativeItems )
|
2011-09-23 20:00:30 +00:00
|
|
|
EVT_UPDATE_UI( ID_TB_OPTIONS_SHOW_LAYERS_MANAGER_VERTICAL_TOOLBAR,
|
|
|
|
GERBVIEW_FRAME::OnUpdateShowLayerManager )
|
2017-09-18 01:26:07 +00:00
|
|
|
EVT_UPDATE_UI( ID_TB_OPTIONS_DIFF_MODE, GERBVIEW_FRAME::OnUpdateDiffMode )
|
|
|
|
EVT_UPDATE_UI( ID_TB_OPTIONS_HIGH_CONTRAST_MODE, GERBVIEW_FRAME::OnUpdateHighContrastMode )
|
2011-09-23 20:00:30 +00:00
|
|
|
|
|
|
|
EVT_UPDATE_UI( ID_TOOLBARH_GERBER_SELECT_ACTIVE_DCODE, GERBVIEW_FRAME::OnUpdateSelectDCode )
|
|
|
|
EVT_UPDATE_UI( ID_TOOLBARH_GERBVIEW_SELECT_ACTIVE_LAYER,
|
|
|
|
GERBVIEW_FRAME::OnUpdateLayerSelectBox )
|
|
|
|
EVT_UPDATE_UI_RANGE( ID_TB_OPTIONS_SHOW_GBR_MODE_0, ID_TB_OPTIONS_SHOW_GBR_MODE_2,
|
|
|
|
GERBVIEW_FRAME::OnUpdateDrawMode )
|
|
|
|
|
|
|
|
END_EVENT_TABLE()
|
|
|
|
|
|
|
|
|
|
|
|
/* Handles the selection of tools, menu, and popup menu commands.
|
|
|
|
*/
|
|
|
|
void GERBVIEW_FRAME::Process_Special_Functions( wxCommandEvent& event )
|
|
|
|
{
|
|
|
|
int id = event.GetId();
|
|
|
|
|
|
|
|
switch( id )
|
|
|
|
{
|
|
|
|
case ID_POPUP_PLACE_BLOCK:
|
|
|
|
case ID_POPUP_ZOOM_BLOCK:
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_POPUP_CANCEL_CURRENT_COMMAND:
|
2011-12-22 13:28:11 +00:00
|
|
|
m_canvas->EndMouseCapture();
|
2011-09-23 20:00:30 +00:00
|
|
|
|
2012-03-26 23:47:08 +00:00
|
|
|
if( GetScreen()->m_BlockLocate.GetCommand() != BLOCK_IDLE )
|
2011-09-23 20:00:30 +00:00
|
|
|
{
|
|
|
|
/* Should not be executed, except bug */
|
2012-03-26 23:47:08 +00:00
|
|
|
GetScreen()->m_BlockLocate.SetCommand( BLOCK_IDLE );
|
|
|
|
GetScreen()->m_BlockLocate.SetState( STATE_NO_BLOCK );
|
2011-09-23 20:00:30 +00:00
|
|
|
GetScreen()->m_BlockLocate.ClearItemsList();
|
|
|
|
}
|
|
|
|
|
|
|
|
if( GetToolId() == ID_NO_TOOL_SELECTED )
|
2017-06-12 14:17:48 +00:00
|
|
|
SetNoToolSelected();
|
2011-09-23 20:00:30 +00:00
|
|
|
else
|
2012-02-28 20:14:17 +00:00
|
|
|
m_canvas->SetCursor( (wxStockCursor) m_canvas->GetCurrentCursor() );
|
2011-09-23 20:00:30 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
2011-12-22 13:28:11 +00:00
|
|
|
m_canvas->EndMouseCapture();
|
2011-09-23 20:00:30 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2016-08-16 10:56:20 +00:00
|
|
|
GERBER_DRAW_ITEM* currItem = (GERBER_DRAW_ITEM*) GetScreen()->GetCurItem();
|
2011-09-23 20:00:30 +00:00
|
|
|
|
|
|
|
switch( id )
|
|
|
|
{
|
2011-10-16 08:02:36 +00:00
|
|
|
case ID_GERBVIEW_SET_PAGE_BORDER:
|
|
|
|
{
|
2011-12-31 05:44:00 +00:00
|
|
|
DIALOG_PAGE_SHOW_PAGE_BORDERS dlg( this );
|
2011-12-22 13:28:11 +00:00
|
|
|
|
2011-12-31 05:44:00 +00:00
|
|
|
if( dlg.ShowModal() == wxID_OK )
|
|
|
|
m_canvas->Refresh();
|
2011-10-16 08:02:36 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
2016-08-16 10:56:20 +00:00
|
|
|
case ID_GERBVIEW_ERASE_CURR_LAYER:
|
2014-07-14 18:59:41 +00:00
|
|
|
Erase_Current_DrawLayer( true );
|
2011-09-23 20:00:30 +00:00
|
|
|
ClearMsgPanel();
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_NO_TOOL_SELECTED:
|
2017-06-12 14:17:48 +00:00
|
|
|
SetNoToolSelected();
|
2011-09-23 20:00:30 +00:00
|
|
|
break;
|
|
|
|
|
2016-06-10 11:08:16 +00:00
|
|
|
case ID_ZOOM_SELECTION:
|
2017-06-10 07:06:25 +00:00
|
|
|
// This tool is located on the main toolbar: switch it on or off on click
|
|
|
|
if( GetToolId() != ID_ZOOM_SELECTION )
|
|
|
|
SetToolID( ID_ZOOM_SELECTION, wxCURSOR_MAGNIFIER, _( "Zoom to selection" ) );
|
|
|
|
else
|
2017-06-12 14:17:48 +00:00
|
|
|
SetNoToolSelected();
|
2016-06-10 11:08:16 +00:00
|
|
|
break;
|
|
|
|
|
2017-09-17 22:43:20 +00:00
|
|
|
case ID_TB_MEASUREMENT_TOOL:
|
|
|
|
SetToolID( id, wxCURSOR_DEFAULT, _( "Unsupported tool in this canvas" ) );
|
|
|
|
break;
|
|
|
|
|
2011-09-23 20:00:30 +00:00
|
|
|
case ID_POPUP_CLOSE_CURRENT_TOOL:
|
2011-12-22 13:28:11 +00:00
|
|
|
SetToolID( ID_NO_TOOL_SELECTED, m_canvas->GetDefaultCursor(), wxEmptyString );
|
2011-09-23 20:00:30 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_POPUP_CANCEL_CURRENT_COMMAND:
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_GERBVIEW_SHOW_LIST_DCODES:
|
|
|
|
Liste_D_Codes();
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_POPUP_PLACE_BLOCK:
|
2018-03-04 21:20:01 +00:00
|
|
|
if( !IsGalCanvasActive() )
|
|
|
|
{
|
2018-03-05 17:11:18 +00:00
|
|
|
INSTALL_UNBUFFERED_DC( dc, m_canvas );
|
2018-03-04 21:20:01 +00:00
|
|
|
GetScreen()->m_BlockLocate.SetCommand( BLOCK_MOVE );
|
|
|
|
m_canvas->SetAutoPanRequest( false );
|
2018-03-05 17:11:18 +00:00
|
|
|
HandleBlockPlace( &dc );
|
2018-03-04 21:20:01 +00:00
|
|
|
}
|
2011-09-23 20:00:30 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_POPUP_ZOOM_BLOCK:
|
2018-03-04 21:20:01 +00:00
|
|
|
if( !IsGalCanvasActive() )
|
|
|
|
{
|
2018-03-05 17:11:18 +00:00
|
|
|
INSTALL_UNBUFFERED_DC( dc, m_canvas );
|
2018-03-04 21:20:01 +00:00
|
|
|
GetScreen()->m_BlockLocate.SetCommand( BLOCK_ZOOM );
|
|
|
|
GetScreen()->m_BlockLocate.SetMessageBlock( this );
|
2018-03-05 17:11:18 +00:00
|
|
|
HandleBlockEnd( &dc );
|
2018-03-04 21:20:01 +00:00
|
|
|
}
|
2011-09-23 20:00:30 +00:00
|
|
|
break;
|
|
|
|
|
2016-08-16 10:56:20 +00:00
|
|
|
case ID_HIGHLIGHT_CMP_ITEMS:
|
|
|
|
if( m_SelComponentBox->SetStringSelection( currItem->GetNetAttributes().m_Cmpref ) )
|
|
|
|
m_canvas->Refresh();
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_HIGHLIGHT_NET_ITEMS:
|
|
|
|
if( m_SelNetnameBox->SetStringSelection( currItem->GetNetAttributes().m_Netname ) )
|
|
|
|
m_canvas->Refresh();
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_HIGHLIGHT_APER_ATTRIBUTE_ITEMS:
|
|
|
|
{
|
|
|
|
D_CODE* apertDescr = currItem->GetDcodeDescr();
|
|
|
|
if( m_SelAperAttributesBox->SetStringSelection( apertDescr->m_AperFunction ) )
|
|
|
|
m_canvas->Refresh();
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_HIGHLIGHT_REMOVE_ALL:
|
|
|
|
m_SelComponentBox->SetSelection( 0 );
|
|
|
|
m_SelNetnameBox->SetSelection( 0 );
|
|
|
|
m_SelAperAttributesBox->SetSelection( 0 );
|
|
|
|
|
2017-09-17 22:43:20 +00:00
|
|
|
if( GetGbrImage( GetActiveLayer() ) )
|
|
|
|
GetGbrImage( GetActiveLayer() )->m_Selected_Tool = 0;
|
2016-08-16 10:56:20 +00:00
|
|
|
|
|
|
|
m_canvas->Refresh();
|
|
|
|
break;
|
|
|
|
|
2011-09-23 20:00:30 +00:00
|
|
|
default:
|
|
|
|
wxFAIL_MSG( wxT( "GERBVIEW_FRAME::Process_Special_Functions error" ) );
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2017-09-17 22:43:20 +00:00
|
|
|
void GERBVIEW_FRAME::OnSelectHighlightChoice( wxCommandEvent& event )
|
|
|
|
{
|
|
|
|
if( IsGalCanvasActive() )
|
|
|
|
{
|
|
|
|
auto settings = static_cast<KIGFX::GERBVIEW_PAINTER*>( GetGalCanvas()->GetView()->GetPainter() )->GetSettings();
|
|
|
|
|
|
|
|
switch( event.GetId() )
|
|
|
|
{
|
|
|
|
case ID_GBR_AUX_TOOLBAR_PCB_CMP_CHOICE:
|
|
|
|
settings->m_componentHighlightString = m_SelComponentBox->GetStringSelection();
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_GBR_AUX_TOOLBAR_PCB_NET_CHOICE:
|
|
|
|
settings->m_netHighlightString = m_SelNetnameBox->GetStringSelection();
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_GBR_AUX_TOOLBAR_PCB_APERATTRIBUTES_CHOICE:
|
|
|
|
settings->m_attributeHighlightString = m_SelAperAttributesBox->GetStringSelection();
|
|
|
|
break;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2018-02-26 00:08:27 +00:00
|
|
|
GetGalCanvas()->GetView()->UpdateAllItems( KIGFX::COLOR );
|
2017-09-17 22:43:20 +00:00
|
|
|
GetGalCanvas()->Refresh();
|
|
|
|
}
|
|
|
|
else
|
|
|
|
m_canvas->Refresh();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2011-09-23 20:00:30 +00:00
|
|
|
void GERBVIEW_FRAME::OnSelectActiveDCode( wxCommandEvent& event )
|
|
|
|
{
|
2017-09-17 22:43:20 +00:00
|
|
|
GERBER_FILE_IMAGE* gerber_image = GetGbrImage( GetActiveLayer() );
|
2011-12-22 13:28:11 +00:00
|
|
|
|
2011-09-23 20:00:30 +00:00
|
|
|
if( gerber_image )
|
|
|
|
{
|
|
|
|
int tool = m_DCodeSelector->GetSelectedDCodeId();
|
2011-12-22 13:28:11 +00:00
|
|
|
|
2011-09-23 20:00:30 +00:00
|
|
|
if( tool != gerber_image->m_Selected_Tool )
|
|
|
|
{
|
|
|
|
gerber_image->m_Selected_Tool = tool;
|
2011-12-22 13:28:11 +00:00
|
|
|
m_canvas->Refresh();
|
2011-09-23 20:00:30 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
Modular-Kicad milestone B), major portions:
*) Rework the set language support, simplify it by using KIWAY. Now any major
frame with a "change language" menu can change the language for all KIWAY_PLAYERs
in the whole KIWAY. Multiple KIWAYs are not supported yet.
*) Simplify "modal wxFrame" support, and add that support exclusively to
KIWAY_PLAYER where it is inherited by all derivatives. The function
KIWAY_PLAYER::ShowModal() is in the vtable and so is cross module capable.
*) Remove the requirements and assumptions that the wxFrame hierarchy always
had PCB_EDIT_FRAME and SCH_EDIT_FRAME as immediate parents of their viewers
and editors. This is no longer the case, nor required.
*) Use KIWAY::Player() everywhere to make KIWAY_PLAYERs, this registers the
KIWAY_PLAYER within the KIWAY and makes it very easy to find an open frame
quickly. It also gives control to the KIWAY as to frame hierarchical
relationships.
*) Change single_top to use the KIWAY for loading a KIFACE and instantiating
the single KIWAY_PLAYER, see bullet immediately above.
*) Add KIWAY::OnKiwayEnd() and call it from PGM_BASE at program termination, this
gives the KIFACEs a chance to save their final configuration dope to disk.
*) Add dedicated FRAME_T's for the modal frames, so m_Ident can be tested and
these modal frames are distinctly different than their non-modal equivalents.
KIWAY_PLAYER::IsModal() is !not! a valid test during the wxFrame's constructor,
so this is another important reason for having a dedicated FRAME_T for each
modal wxFrame.
On balance, more lines were deleted than were added to achieve all this.
2014-05-03 17:40:19 +00:00
|
|
|
|
2011-09-23 20:00:30 +00:00
|
|
|
void GERBVIEW_FRAME::OnSelectActiveLayer( wxCommandEvent& event )
|
|
|
|
{
|
2018-03-04 04:43:16 +00:00
|
|
|
SetActiveLayer( event.GetSelection(), true );
|
2011-09-23 20:00:30 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void GERBVIEW_FRAME::OnShowGerberSourceFile( wxCommandEvent& event )
|
|
|
|
{
|
2017-09-17 22:43:20 +00:00
|
|
|
int layer = GetActiveLayer();
|
2016-06-17 18:00:29 +00:00
|
|
|
GERBER_FILE_IMAGE* gerber_layer = GetGbrImage( layer );
|
2011-09-23 20:00:30 +00:00
|
|
|
|
|
|
|
if( gerber_layer )
|
|
|
|
{
|
* 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
|
|
|
wxString editorname = Pgm().GetEditorName();
|
2011-09-23 20:00:30 +00:00
|
|
|
if( !editorname.IsEmpty() )
|
|
|
|
{
|
|
|
|
wxFileName fn( gerber_layer->m_FileName );
|
2017-01-26 09:45:28 +00:00
|
|
|
|
|
|
|
// Call the editor only if the Gerber/drill source file is available.
|
|
|
|
// This is not always the case, because it can be a temporary file
|
|
|
|
// if it comes from a zip archive.
|
|
|
|
if( !fn.FileExists() )
|
|
|
|
{
|
|
|
|
wxString msg;
|
2017-12-15 11:37:46 +00:00
|
|
|
msg.Printf( _( "Source file \"%s\" is not available" ),
|
2017-01-26 09:45:28 +00:00
|
|
|
GetChars( fn.GetFullPath() ) );
|
|
|
|
wxMessageBox( msg );
|
|
|
|
}
|
|
|
|
else
|
|
|
|
ExecuteFile( this, editorname, QuoteFullPath( fn ) );
|
2011-09-23 20:00:30 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
wxMessageBox( _( "No editor defined. Please select one" ) );
|
2013-03-06 19:32:59 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
else
|
|
|
|
{
|
|
|
|
wxString msg;
|
|
|
|
msg.Printf( _( "No file loaded on the active layer %d" ), layer + 1 );
|
|
|
|
wxMessageBox( msg );
|
2011-09-23 20:00:30 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void GERBVIEW_FRAME::OnSelectDisplayMode( wxCommandEvent& event )
|
|
|
|
{
|
|
|
|
int oldMode = GetDisplayMode();
|
|
|
|
|
|
|
|
switch( event.GetId() )
|
|
|
|
{
|
|
|
|
case ID_TB_OPTIONS_SHOW_GBR_MODE_0:
|
|
|
|
SetDisplayMode( 0 );
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_TB_OPTIONS_SHOW_GBR_MODE_1:
|
|
|
|
SetDisplayMode( 1 );
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_TB_OPTIONS_SHOW_GBR_MODE_2:
|
|
|
|
SetDisplayMode( 2 );
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
if( GetDisplayMode() != oldMode )
|
2011-12-22 13:28:11 +00:00
|
|
|
m_canvas->Refresh();
|
2011-09-23 20:00:30 +00:00
|
|
|
}
|
|
|
|
|
Modular-Kicad milestone B), major portions:
*) Rework the set language support, simplify it by using KIWAY. Now any major
frame with a "change language" menu can change the language for all KIWAY_PLAYERs
in the whole KIWAY. Multiple KIWAYs are not supported yet.
*) Simplify "modal wxFrame" support, and add that support exclusively to
KIWAY_PLAYER where it is inherited by all derivatives. The function
KIWAY_PLAYER::ShowModal() is in the vtable and so is cross module capable.
*) Remove the requirements and assumptions that the wxFrame hierarchy always
had PCB_EDIT_FRAME and SCH_EDIT_FRAME as immediate parents of their viewers
and editors. This is no longer the case, nor required.
*) Use KIWAY::Player() everywhere to make KIWAY_PLAYERs, this registers the
KIWAY_PLAYER within the KIWAY and makes it very easy to find an open frame
quickly. It also gives control to the KIWAY as to frame hierarchical
relationships.
*) Change single_top to use the KIWAY for loading a KIFACE and instantiating
the single KIWAY_PLAYER, see bullet immediately above.
*) Add KIWAY::OnKiwayEnd() and call it from PGM_BASE at program termination, this
gives the KIFACEs a chance to save their final configuration dope to disk.
*) Add dedicated FRAME_T's for the modal frames, so m_Ident can be tested and
these modal frames are distinctly different than their non-modal equivalents.
KIWAY_PLAYER::IsModal() is !not! a valid test during the wxFrame's constructor,
so this is another important reason for having a dedicated FRAME_T for each
modal wxFrame.
On balance, more lines were deleted than were added to achieve all this.
2014-05-03 17:40:19 +00:00
|
|
|
|
2011-09-23 20:00:30 +00:00
|
|
|
void GERBVIEW_FRAME::OnQuit( wxCommandEvent& event )
|
|
|
|
{
|
|
|
|
Close( true );
|
|
|
|
}
|
|
|
|
|
Modular-Kicad milestone B), major portions:
*) Rework the set language support, simplify it by using KIWAY. Now any major
frame with a "change language" menu can change the language for all KIWAY_PLAYERs
in the whole KIWAY. Multiple KIWAYs are not supported yet.
*) Simplify "modal wxFrame" support, and add that support exclusively to
KIWAY_PLAYER where it is inherited by all derivatives. The function
KIWAY_PLAYER::ShowModal() is in the vtable and so is cross module capable.
*) Remove the requirements and assumptions that the wxFrame hierarchy always
had PCB_EDIT_FRAME and SCH_EDIT_FRAME as immediate parents of their viewers
and editors. This is no longer the case, nor required.
*) Use KIWAY::Player() everywhere to make KIWAY_PLAYERs, this registers the
KIWAY_PLAYER within the KIWAY and makes it very easy to find an open frame
quickly. It also gives control to the KIWAY as to frame hierarchical
relationships.
*) Change single_top to use the KIWAY for loading a KIFACE and instantiating
the single KIWAY_PLAYER, see bullet immediately above.
*) Add KIWAY::OnKiwayEnd() and call it from PGM_BASE at program termination, this
gives the KIFACEs a chance to save their final configuration dope to disk.
*) Add dedicated FRAME_T's for the modal frames, so m_Ident can be tested and
these modal frames are distinctly different than their non-modal equivalents.
KIWAY_PLAYER::IsModal() is !not! a valid test during the wxFrame's constructor,
so this is another important reason for having a dedicated FRAME_T for each
modal wxFrame.
On balance, more lines were deleted than were added to achieve all this.
2014-05-03 17:40:19 +00:00
|
|
|
|
|
|
|
void GERBVIEW_FRAME::ShowChangedLanguage()
|
2011-09-23 20:00:30 +00:00
|
|
|
{
|
Modular-Kicad milestone B), major portions:
*) Rework the set language support, simplify it by using KIWAY. Now any major
frame with a "change language" menu can change the language for all KIWAY_PLAYERs
in the whole KIWAY. Multiple KIWAYs are not supported yet.
*) Simplify "modal wxFrame" support, and add that support exclusively to
KIWAY_PLAYER where it is inherited by all derivatives. The function
KIWAY_PLAYER::ShowModal() is in the vtable and so is cross module capable.
*) Remove the requirements and assumptions that the wxFrame hierarchy always
had PCB_EDIT_FRAME and SCH_EDIT_FRAME as immediate parents of their viewers
and editors. This is no longer the case, nor required.
*) Use KIWAY::Player() everywhere to make KIWAY_PLAYERs, this registers the
KIWAY_PLAYER within the KIWAY and makes it very easy to find an open frame
quickly. It also gives control to the KIWAY as to frame hierarchical
relationships.
*) Change single_top to use the KIWAY for loading a KIFACE and instantiating
the single KIWAY_PLAYER, see bullet immediately above.
*) Add KIWAY::OnKiwayEnd() and call it from PGM_BASE at program termination, this
gives the KIFACEs a chance to save their final configuration dope to disk.
*) Add dedicated FRAME_T's for the modal frames, so m_Ident can be tested and
these modal frames are distinctly different than their non-modal equivalents.
KIWAY_PLAYER::IsModal() is !not! a valid test during the wxFrame's constructor,
so this is another important reason for having a dedicated FRAME_T for each
modal wxFrame.
On balance, more lines were deleted than were added to achieve all this.
2014-05-03 17:40:19 +00:00
|
|
|
// call my base class
|
|
|
|
EDA_DRAW_FRAME::ShowChangedLanguage();
|
|
|
|
|
2011-09-23 20:00:30 +00:00
|
|
|
m_LayersManager->SetLayersManagerTabsText();
|
Modular-Kicad milestone B), major portions:
*) Rework the set language support, simplify it by using KIWAY. Now any major
frame with a "change language" menu can change the language for all KIWAY_PLAYERs
in the whole KIWAY. Multiple KIWAYs are not supported yet.
*) Simplify "modal wxFrame" support, and add that support exclusively to
KIWAY_PLAYER where it is inherited by all derivatives. The function
KIWAY_PLAYER::ShowModal() is in the vtable and so is cross module capable.
*) Remove the requirements and assumptions that the wxFrame hierarchy always
had PCB_EDIT_FRAME and SCH_EDIT_FRAME as immediate parents of their viewers
and editors. This is no longer the case, nor required.
*) Use KIWAY::Player() everywhere to make KIWAY_PLAYERs, this registers the
KIWAY_PLAYER within the KIWAY and makes it very easy to find an open frame
quickly. It also gives control to the KIWAY as to frame hierarchical
relationships.
*) Change single_top to use the KIWAY for loading a KIFACE and instantiating
the single KIWAY_PLAYER, see bullet immediately above.
*) Add KIWAY::OnKiwayEnd() and call it from PGM_BASE at program termination, this
gives the KIFACEs a chance to save their final configuration dope to disk.
*) Add dedicated FRAME_T's for the modal frames, so m_Ident can be tested and
these modal frames are distinctly different than their non-modal equivalents.
KIWAY_PLAYER::IsModal() is !not! a valid test during the wxFrame's constructor,
so this is another important reason for having a dedicated FRAME_T for each
modal wxFrame.
On balance, more lines were deleted than were added to achieve all this.
2014-05-03 17:40:19 +00:00
|
|
|
|
2011-09-23 20:00:30 +00:00
|
|
|
wxAuiPaneInfo& pane_info = m_auimgr.GetPane( m_LayersManager );
|
|
|
|
pane_info.Caption( _( "Visibles" ) );
|
|
|
|
m_auimgr.Update();
|
|
|
|
|
|
|
|
ReFillLayerWidget();
|
|
|
|
}
|
2012-05-04 17:44:42 +00:00
|
|
|
|
Modular-Kicad milestone B), major portions:
*) Rework the set language support, simplify it by using KIWAY. Now any major
frame with a "change language" menu can change the language for all KIWAY_PLAYERs
in the whole KIWAY. Multiple KIWAYs are not supported yet.
*) Simplify "modal wxFrame" support, and add that support exclusively to
KIWAY_PLAYER where it is inherited by all derivatives. The function
KIWAY_PLAYER::ShowModal() is in the vtable and so is cross module capable.
*) Remove the requirements and assumptions that the wxFrame hierarchy always
had PCB_EDIT_FRAME and SCH_EDIT_FRAME as immediate parents of their viewers
and editors. This is no longer the case, nor required.
*) Use KIWAY::Player() everywhere to make KIWAY_PLAYERs, this registers the
KIWAY_PLAYER within the KIWAY and makes it very easy to find an open frame
quickly. It also gives control to the KIWAY as to frame hierarchical
relationships.
*) Change single_top to use the KIWAY for loading a KIFACE and instantiating
the single KIWAY_PLAYER, see bullet immediately above.
*) Add KIWAY::OnKiwayEnd() and call it from PGM_BASE at program termination, this
gives the KIFACEs a chance to save their final configuration dope to disk.
*) Add dedicated FRAME_T's for the modal frames, so m_Ident can be tested and
these modal frames are distinctly different than their non-modal equivalents.
KIWAY_PLAYER::IsModal() is !not! a valid test during the wxFrame's constructor,
so this is another important reason for having a dedicated FRAME_T for each
modal wxFrame.
On balance, more lines were deleted than were added to achieve all this.
2014-05-03 17:40:19 +00:00
|
|
|
|
2012-05-04 17:44:42 +00:00
|
|
|
void GERBVIEW_FRAME::OnSelectOptionToolbar( wxCommandEvent& event )
|
|
|
|
{
|
Modular-Kicad milestone B), major portions:
*) Rework the set language support, simplify it by using KIWAY. Now any major
frame with a "change language" menu can change the language for all KIWAY_PLAYERs
in the whole KIWAY. Multiple KIWAYs are not supported yet.
*) Simplify "modal wxFrame" support, and add that support exclusively to
KIWAY_PLAYER where it is inherited by all derivatives. The function
KIWAY_PLAYER::ShowModal() is in the vtable and so is cross module capable.
*) Remove the requirements and assumptions that the wxFrame hierarchy always
had PCB_EDIT_FRAME and SCH_EDIT_FRAME as immediate parents of their viewers
and editors. This is no longer the case, nor required.
*) Use KIWAY::Player() everywhere to make KIWAY_PLAYERs, this registers the
KIWAY_PLAYER within the KIWAY and makes it very easy to find an open frame
quickly. It also gives control to the KIWAY as to frame hierarchical
relationships.
*) Change single_top to use the KIWAY for loading a KIFACE and instantiating
the single KIWAY_PLAYER, see bullet immediately above.
*) Add KIWAY::OnKiwayEnd() and call it from PGM_BASE at program termination, this
gives the KIFACEs a chance to save their final configuration dope to disk.
*) Add dedicated FRAME_T's for the modal frames, so m_Ident can be tested and
these modal frames are distinctly different than their non-modal equivalents.
KIWAY_PLAYER::IsModal() is !not! a valid test during the wxFrame's constructor,
so this is another important reason for having a dedicated FRAME_T for each
modal wxFrame.
On balance, more lines were deleted than were added to achieve all this.
2014-05-03 17:40:19 +00:00
|
|
|
int id = event.GetId();
|
|
|
|
bool state;
|
2018-02-25 17:38:35 +00:00
|
|
|
bool needs_refresh = false;
|
Modular-Kicad milestone B), major portions:
*) Rework the set language support, simplify it by using KIWAY. Now any major
frame with a "change language" menu can change the language for all KIWAY_PLAYERs
in the whole KIWAY. Multiple KIWAYs are not supported yet.
*) Simplify "modal wxFrame" support, and add that support exclusively to
KIWAY_PLAYER where it is inherited by all derivatives. The function
KIWAY_PLAYER::ShowModal() is in the vtable and so is cross module capable.
*) Remove the requirements and assumptions that the wxFrame hierarchy always
had PCB_EDIT_FRAME and SCH_EDIT_FRAME as immediate parents of their viewers
and editors. This is no longer the case, nor required.
*) Use KIWAY::Player() everywhere to make KIWAY_PLAYERs, this registers the
KIWAY_PLAYER within the KIWAY and makes it very easy to find an open frame
quickly. It also gives control to the KIWAY as to frame hierarchical
relationships.
*) Change single_top to use the KIWAY for loading a KIFACE and instantiating
the single KIWAY_PLAYER, see bullet immediately above.
*) Add KIWAY::OnKiwayEnd() and call it from PGM_BASE at program termination, this
gives the KIFACEs a chance to save their final configuration dope to disk.
*) Add dedicated FRAME_T's for the modal frames, so m_Ident can be tested and
these modal frames are distinctly different than their non-modal equivalents.
KIWAY_PLAYER::IsModal() is !not! a valid test during the wxFrame's constructor,
so this is another important reason for having a dedicated FRAME_T for each
modal wxFrame.
On balance, more lines were deleted than were added to achieve all this.
2014-05-03 17:40:19 +00:00
|
|
|
|
2018-03-04 21:59:12 +00:00
|
|
|
GBR_DISPLAY_OPTIONS options = m_DisplayOptions;
|
|
|
|
|
2012-05-04 17:44:42 +00:00
|
|
|
switch( id )
|
|
|
|
{
|
|
|
|
case ID_MENU_GERBVIEW_SHOW_HIDE_LAYERS_MANAGER_DIALOG:
|
|
|
|
state = ! m_show_layer_manager_tools;
|
|
|
|
id = ID_TB_OPTIONS_SHOW_LAYERS_MANAGER_VERTICAL_TOOLBAR;
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
state = m_optionsToolBar->GetToolToggled( id );
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
switch( id )
|
|
|
|
{
|
|
|
|
case ID_TB_OPTIONS_SHOW_POLAR_COORD:
|
2018-03-04 21:59:12 +00:00
|
|
|
options.m_DisplayPolarCood = state;
|
2012-05-04 17:44:42 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_TB_OPTIONS_SHOW_FLASHED_ITEMS_SKETCH:
|
2018-03-04 21:59:12 +00:00
|
|
|
options.m_DisplayFlashedItemsFill = not state;
|
2018-02-25 20:14:28 +00:00
|
|
|
needs_refresh = true;
|
2012-05-04 17:44:42 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_TB_OPTIONS_SHOW_LINES_SKETCH:
|
2018-03-04 21:59:12 +00:00
|
|
|
options.m_DisplayLinesFill = not state;
|
2018-02-25 20:14:28 +00:00
|
|
|
needs_refresh = true;
|
2012-05-04 17:44:42 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_TB_OPTIONS_SHOW_POLYGONS_SKETCH:
|
2018-03-04 21:59:12 +00:00
|
|
|
options.m_DisplayPolygonsFill = not state;
|
2018-02-25 20:14:28 +00:00
|
|
|
needs_refresh = true;
|
2012-05-04 17:44:42 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_TB_OPTIONS_SHOW_DCODES:
|
2017-03-13 03:19:33 +00:00
|
|
|
SetElementVisibility( LAYER_DCODES, state );
|
2012-05-04 17:44:42 +00:00
|
|
|
m_canvas->Refresh( true );
|
|
|
|
break;
|
|
|
|
|
2013-01-06 13:31:49 +00:00
|
|
|
case ID_TB_OPTIONS_SHOW_NEGATIVE_ITEMS:
|
2017-03-13 03:19:33 +00:00
|
|
|
SetElementVisibility( LAYER_NEGATIVE_OBJECTS, state );
|
2018-02-27 02:15:32 +00:00
|
|
|
needs_refresh = true;
|
2013-01-06 13:31:49 +00:00
|
|
|
break;
|
|
|
|
|
2017-09-17 22:43:20 +00:00
|
|
|
case ID_TB_OPTIONS_DIFF_MODE:
|
2018-03-04 21:59:12 +00:00
|
|
|
options.m_DiffMode = state;
|
2018-02-25 17:38:35 +00:00
|
|
|
needs_refresh = true;
|
2017-09-17 22:43:20 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_TB_OPTIONS_HIGH_CONTRAST_MODE:
|
2018-03-04 21:59:12 +00:00
|
|
|
options.m_HighContrastMode = state;
|
2018-02-25 17:38:35 +00:00
|
|
|
needs_refresh = true;
|
2017-09-17 22:43:20 +00:00
|
|
|
break;
|
|
|
|
|
2012-05-04 17:44:42 +00:00
|
|
|
case ID_TB_OPTIONS_SHOW_LAYERS_MANAGER_VERTICAL_TOOLBAR:
|
Modular-Kicad milestone B), major portions:
*) Rework the set language support, simplify it by using KIWAY. Now any major
frame with a "change language" menu can change the language for all KIWAY_PLAYERs
in the whole KIWAY. Multiple KIWAYs are not supported yet.
*) Simplify "modal wxFrame" support, and add that support exclusively to
KIWAY_PLAYER where it is inherited by all derivatives. The function
KIWAY_PLAYER::ShowModal() is in the vtable and so is cross module capable.
*) Remove the requirements and assumptions that the wxFrame hierarchy always
had PCB_EDIT_FRAME and SCH_EDIT_FRAME as immediate parents of their viewers
and editors. This is no longer the case, nor required.
*) Use KIWAY::Player() everywhere to make KIWAY_PLAYERs, this registers the
KIWAY_PLAYER within the KIWAY and makes it very easy to find an open frame
quickly. It also gives control to the KIWAY as to frame hierarchical
relationships.
*) Change single_top to use the KIWAY for loading a KIFACE and instantiating
the single KIWAY_PLAYER, see bullet immediately above.
*) Add KIWAY::OnKiwayEnd() and call it from PGM_BASE at program termination, this
gives the KIFACEs a chance to save their final configuration dope to disk.
*) Add dedicated FRAME_T's for the modal frames, so m_Ident can be tested and
these modal frames are distinctly different than their non-modal equivalents.
KIWAY_PLAYER::IsModal() is !not! a valid test during the wxFrame's constructor,
so this is another important reason for having a dedicated FRAME_T for each
modal wxFrame.
On balance, more lines were deleted than were added to achieve all this.
2014-05-03 17:40:19 +00:00
|
|
|
|
2012-05-04 17:44:42 +00:00
|
|
|
// show/hide auxiliary Vertical layers and visibility manager toolbar
|
|
|
|
m_show_layer_manager_tools = state;
|
|
|
|
m_auimgr.GetPane( wxT( "m_LayersManagerToolBar" ) ).Show( m_show_layer_manager_tools );
|
|
|
|
m_auimgr.Update();
|
|
|
|
GetMenuBar()->SetLabel( ID_MENU_GERBVIEW_SHOW_HIDE_LAYERS_MANAGER_DIALOG,
|
|
|
|
m_show_layer_manager_tools ?
|
|
|
|
_("Hide &Layers Manager" ) : _("Show &Layers Manager" ));
|
|
|
|
break;
|
|
|
|
|
2017-09-17 22:43:20 +00:00
|
|
|
// collect GAL-only tools here:
|
|
|
|
case ID_TB_MEASUREMENT_TOOL:
|
|
|
|
SetToolID( id, wxCURSOR_DEFAULT, _( "Unsupported tool in this canvas" ) );
|
|
|
|
break;
|
|
|
|
|
2012-05-04 17:44:42 +00:00
|
|
|
default:
|
|
|
|
wxMessageBox( wxT( "GERBVIEW_FRAME::OnSelectOptionToolbar error" ) );
|
|
|
|
break;
|
|
|
|
}
|
2018-02-25 17:38:35 +00:00
|
|
|
|
|
|
|
if( needs_refresh )
|
2018-03-04 21:59:12 +00:00
|
|
|
UpdateDisplayOptions( options );
|
2012-05-04 17:44:42 +00:00
|
|
|
}
|
|
|
|
|
2016-06-10 11:08:16 +00:00
|
|
|
|
|
|
|
void GERBVIEW_FRAME::OnUpdateSelectTool( wxUpdateUIEvent& aEvent )
|
|
|
|
{
|
2017-06-10 07:06:25 +00:00
|
|
|
aEvent.Check( GetToolId() == aEvent.GetId() );
|
2016-06-10 11:08:16 +00:00
|
|
|
}
|
2017-09-17 22:43:20 +00:00
|
|
|
|
|
|
|
|
2018-01-21 11:04:04 +00:00
|
|
|
void GERBVIEW_FRAME::OnSwitchCanvas( wxCommandEvent& aEvent )
|
2017-09-17 22:43:20 +00:00
|
|
|
{
|
|
|
|
switch( aEvent.GetId() )
|
|
|
|
{
|
|
|
|
case ID_MENU_CANVAS_LEGACY:
|
2018-01-21 11:04:04 +00:00
|
|
|
SwitchCanvas( EDA_DRAW_PANEL_GAL::GAL_TYPE_NONE );
|
2017-09-17 22:43:20 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_MENU_CANVAS_CAIRO:
|
2018-01-21 11:04:04 +00:00
|
|
|
SwitchCanvas( EDA_DRAW_PANEL_GAL::GAL_TYPE_CAIRO );
|
2017-09-17 22:43:20 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_MENU_CANVAS_OPENGL:
|
2018-01-21 11:04:04 +00:00
|
|
|
SwitchCanvas( EDA_DRAW_PANEL_GAL::GAL_TYPE_OPENGL );
|
2017-09-17 22:43:20 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void GERBVIEW_FRAME::OnUpdateSwitchCanvas( wxUpdateUIEvent& aEvent )
|
|
|
|
{
|
|
|
|
wxMenuBar* menuBar = GetMenuBar();
|
|
|
|
EDA_DRAW_PANEL_GAL* gal_canvas = GetGalCanvas();
|
|
|
|
EDA_DRAW_PANEL_GAL::GAL_TYPE canvasType = EDA_DRAW_PANEL_GAL::GAL_TYPE_NONE;
|
|
|
|
|
|
|
|
if( IsGalCanvasActive() && gal_canvas )
|
|
|
|
canvasType = gal_canvas->GetBackend();
|
|
|
|
|
|
|
|
struct { int menuId; int galType; } menuList[] =
|
|
|
|
{
|
|
|
|
{ ID_MENU_CANVAS_LEGACY, EDA_DRAW_PANEL_GAL::GAL_TYPE_NONE },
|
|
|
|
{ ID_MENU_CANVAS_OPENGL, EDA_DRAW_PANEL_GAL::GAL_TYPE_OPENGL },
|
|
|
|
{ ID_MENU_CANVAS_CAIRO, EDA_DRAW_PANEL_GAL::GAL_TYPE_CAIRO },
|
|
|
|
};
|
|
|
|
|
|
|
|
for( auto ii: menuList )
|
|
|
|
{
|
|
|
|
wxMenuItem* item = menuBar->FindItem( ii.menuId );
|
|
|
|
if( ii.galType == canvasType )
|
|
|
|
{
|
|
|
|
item->Check( true );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|