KiCad PCB EDA Suite
gerbview_frame.cpp
Go to the documentation of this file.
1/*
2 * This program source code file is part of KiCad, a free EDA CAD application.
3 *
4 * Copyright (C) 2018 Jean-Pierre Charras, jp.charras at wanadoo.fr
5 * Copyright (C) 1992-2022 KiCad Developers, see AUTHORS.txt for contributors.
6 *
7 * This program is free software: you can redistribute it and/or modify it
8 * under the terms of the GNU General Public License as published by the
9 * Free Software Foundation, either version 3 of the License, or (at your
10 * option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License along
18 * with this program. If not, see <http://www.gnu.org/licenses/>.
19 */
20
21#include <kiface_base.h>
22#include <base_units.h>
23#include <pgm_base.h>
24#include <bitmaps.h>
26#include <gerbview_frame.h>
27#include <gerbview_id.h>
28#include <gerber_file_image.h>
30#include <excellon_image.h>
32#include <gerbview_settings.h>
35#include <tool/tool_manager.h>
36#include <tool/action_toolbar.h>
38#include <tool/common_control.h>
39#include <tool/common_tools.h>
41#include <tool/zoom_tool.h>
47#include <trigo.h>
48#include <view/view.h>
49#include <base_screen.h>
50#include <gerbview_painter.h>
51#include <wx/wupdlock.h>
52
56#include <zoom_defines.h>
57
58
59GERBVIEW_FRAME::GERBVIEW_FRAME( KIWAY* aKiway, wxWindow* aParent )
60 : EDA_DRAW_FRAME( aKiway, aParent, FRAME_GERBER, wxT( "GerbView" ), wxDefaultPosition,
63 m_TextInfo( nullptr ),
65 ID_GERBVIEW_ZIP_FILE_LIST_CLEAR, _( "Clear Recent Zip Files" ) ),
67 ID_GERBVIEW_DRILL_FILE_LIST_CLEAR, _( "Clear Recent Drill Files" ) ),
69 ID_GERBVIEW_JOB_FILE_LIST_CLEAR, _( "Clear Recent Job Files" ) ),
70 m_activeLayer( 0 )
71{
73 m_gerberLayout = nullptr;
75 m_showBorderAndTitleBlock = false; // true for reference drawings.
76 m_SelLayerBox = nullptr;
77 m_DCodeSelector = nullptr;
78 m_SelComponentBox = nullptr;
79 m_SelNetnameBox = nullptr;
80 m_SelAperAttributesBox = nullptr;
81 m_cmpText = nullptr;
82 m_netText = nullptr;
83 m_apertText = nullptr;
84 m_dcodeText = nullptr;
85 m_displayMode = 0;
86 m_aboutTitle = _( "KiCad Gerber Viewer" );
87
88 SHAPE_POLY_SET dummy; // A ugly trick to force the linker to include
89 // some methods in code and avoid link errors
90
91 int fileHistorySize = Pgm().GetCommonSettings()->m_System.file_history_size;
92 m_drillFileHistory.SetMaxFiles( fileHistorySize );
93 m_zipFileHistory.SetMaxFiles( fileHistorySize );
94 m_jobFileHistory.SetMaxFiles( fileHistorySize );
95
96 auto* galCanvas = new GERBVIEW_DRAW_PANEL_GAL( this, -1, wxPoint( 0, 0 ), m_frameSize,
99
100 SetCanvas( galCanvas );
101
102 // GerbView requires draw priority for rendering negative objects
103 galCanvas->GetView()->UseDrawPriority( true );
104
105 // Give an icon
106 wxIcon icon;
107 wxIconBundle icon_bundle;
108
109 icon.CopyFromBitmap( KiBitmap( BITMAPS::icon_gerbview ) );
110 icon_bundle.AddIcon( icon );
111 icon.CopyFromBitmap( KiBitmap( BITMAPS::icon_gerbview_32 ) );
112 icon_bundle.AddIcon( icon );
113 icon.CopyFromBitmap( KiBitmap( BITMAPS::icon_gerbview_16 ) );
114 icon_bundle.AddIcon( icon );
115
116 SetIcons( icon_bundle );
117
118 // Be sure a page info is set. this default value will be overwritten later.
119 PAGE_INFO pageInfo( wxT( "GERBER" ) );
120 SetLayout( new GBR_LAYOUT() );
121 SetPageSettings( pageInfo );
122
123 SetVisibleLayers( LSET::AllLayersMask() ); // All draw layers visible.
124
126
127 // Create the PCB_LAYER_WIDGET *after* SetLayout():
129
130 // Update the minimum string length in the layer panel with the length of the last default layer
131 wxString lyrName = GetImagesList()->GetDisplayName( GetImagesList()->ImagesMaxCount(),
132 false, true );
134
135 // LoadSettings() *after* creating m_LayersManager, because LoadSettings()
136 // initialize parameters in m_LayersManager
137 LoadSettings( config() );
138
139 setupTools();
145
146 m_auimgr.SetManagedWindow( this );
147
148 m_auimgr.AddPane( m_mainToolBar, EDA_PANE().HToolbar().Name( "MainToolbar" ).Top().Layer( 6 ) );
149 m_auimgr.AddPane( m_auxiliaryToolBar, EDA_PANE().HToolbar().Name( "AuxToolbar" ).Top()
150 .Layer(4) );
151 m_auimgr.AddPane( m_messagePanel, EDA_PANE().Messages().Name( "MsgPanel" ).Bottom()
152 .Layer( 6 ) );
153 m_auimgr.AddPane( m_optionsToolBar, EDA_PANE().VToolbar().Name( "OptToolbar" ).Left()
154 .Layer( 3 ) );
155 m_auimgr.AddPane( m_LayersManager, EDA_PANE().Palette().Name( "LayersManager" ).Right()
156 .Layer( 3 ).Caption( _( "Layers Manager" ) ).PaneBorder( false )
157 .MinSize( 80, -1 ).BestSize( m_LayersManager->GetBestSize() ) );
158
159 m_auimgr.AddPane( GetCanvas(), EDA_PANE().Canvas().Name( "DrawFrame" ).Center() );
160
161 ReFillLayerWidget(); // this is near end because contents establish size
162 m_auimgr.Update();
163
164 SetActiveLayer( 0, true );
166
168
170
171 setupUnits( config() );
172
173 // Enable the axes to match legacy draw style
174 auto& galOptions = GetGalDisplayOptions();
175 galOptions.m_axesEnabled = true;
176 galOptions.NotifyChanged();
177
179 m_LayersManager->ReFillRender(); // Update colors in Render after the config is read
180
181 // Drag and drop
183 for( const auto& ext : GerberFileExtensions )
186 DragAcceptFiles( true );
187
189
190 // Ensure the window is on top
191 Raise();
192
193 // Register a call to update the toolbar sizes. It can't be done immediately because
194 // it seems to require some sizes calculated that aren't yet (at least on GTK).
195 CallAfter( [&]()
196 {
197 // Ensure the controls on the toolbars all are correctly sized
199 } );
200}
201
202
204{
205 // Ensure m_canvasType is up to date, to save it in config
207
208 // Shutdown all running tools
209 if( m_toolManager )
211
212 GetCanvas()->GetView()->Clear();
213
215 delete m_gerberLayout;
216}
217
218
220{
221 // No more vetos
222 m_isClosing = true;
224 GetCanvas()->GetView()->Clear();
225
226 if( m_toolManager )
228
229 // Be sure any OpenGL event cannot be fired after frame deletion:
230 GetCanvas()->SetEvtHandlerEnabled( false );
231
232 Destroy();
233}
234
235
236bool GERBVIEW_FRAME::OpenProjectFiles( const std::vector<wxString>& aFileSet, int aCtl )
237{
238 // Ensure the frame is shown when opening the file(s), to avoid issues (crash) on GAL
239 // when trying to change the view if it is not fully initialized.
240 // It happens when starting GerbView with a gerber job file to load
241 if( !IsShown() )
242 Show();
243
244 // The current project path is also a valid command parameter. Check if a single path
245 // rather than a file name was passed to GerbView and use it as the initial MRU path.
246 if( aFileSet.size() > 0 )
247 {
248 wxString path = aFileSet[0];
249
250 // For some reason wxApp appears to leave the trailing double quote on quoted
251 // parameters which are required for paths with spaces. Maybe this should be
252 // pushed back into PGM_SINGLE_TOP::OnPgmInit() but that may cause other issues.
253 // We can't buy a break!
254 if( path.Last() == wxChar( '\"' ) )
255 path.RemoveLast();
256
257 if( !wxFileExists( path ) && wxDirExists( path ) )
258 {
259 m_mruPath = path;
260 return true;
261 }
262
263 const unsigned limit = std::min( unsigned( aFileSet.size() ),
264 unsigned( GERBER_DRAWLAYERS_COUNT ) );
265
266 for( unsigned i = 0; i < limit; ++i )
267 {
268 wxString ext = wxFileName( aFileSet[i] ).GetExt().Lower();
269
270 if( ext == ArchiveFileExtension )
271 LoadZipArchiveFile( aFileSet[i] );
272 else if( ext == GerberJobFileExtension )
273 LoadGerberJobFile( aFileSet[i] );
274 else
275 {
276 GERBER_ORDER_ENUM fnameLayer;
277 wxString fnameExtensionMatched;
278
280 fnameExtensionMatched );
281
282 switch( fnameLayer )
283 {
285 LoadExcellonFiles( aFileSet[i] );
286 break;
288 LoadAutodetectedFiles( aFileSet[i] );
289 break;
290 default:
291 LoadGerberFiles( aFileSet[i] );
292 }
293 }
294 }
295 }
296
297 Zoom_Automatique( true ); // Zoom fit in frame
298
299 return true;
300}
301
302
304{
305 return dynamic_cast<GERBVIEW_SETTINGS*>( config() );
306}
307
308
310{
312
313 if( aCfg->m_Window.grid.sizes.empty() )
314 {
315 aCfg->m_Window.grid.sizes = { wxT( "100 mil" ),
316 wxT( "50 mil" ),
317 wxT( "25 mil" ),
318 wxT( "20 mil" ),
319 wxT( "10 mil" ),
320 wxT( "5 mil" ),
321 wxT( "2.5 mil" ),
322 wxT( "2 mil" ),
323 wxT( "1 mil" ),
324 wxT( "0.5 mil" ),
325 wxT( "0.2 mil" ),
326 wxT( "0.1 mil" ),
327 wxT( "5.0 mm" ),
328 wxT( "2.5 mm" ),
329 wxT( "1.0 mm" ),
330 wxT( "0.5 mm" ),
331 wxT( "0.25 mm" ),
332 wxT( "0.2 mm" ),
333 wxT( "0.1 mm" ),
334 wxT( "0.05 mm" ),
335 wxT( "0.025 mm" ),
336 wxT( "0.01 mm" ) };
337 }
338
339 if( aCfg->m_Window.zoom_factors.empty() )
340 {
342 }
343
344 GERBVIEW_SETTINGS* cfg = dynamic_cast<GERBVIEW_SETTINGS*>( aCfg );
345 wxCHECK( cfg, /*void*/ );
346
351
352 PAGE_INFO pageInfo( wxT( "GERBER" ) );
353 pageInfo.SetType( cfg->m_Appearance.page_type );
354 SetPageSettings( pageInfo );
355
358
362}
363
364
366{
368
369 GERBVIEW_SETTINGS* cfg = dynamic_cast<GERBVIEW_SETTINGS*>( aCfg );
370 wxCHECK( cfg, /*void*/ );
371
373
377
378 COLOR_SETTINGS* cs = Pgm().GetSettingsManager().GetColorSettings();
379 Pgm().GetSettingsManager().SaveColorSettings( cs, "gerbview" );
380}
381
382
384{
385 SETTINGS_MANAGER& mgr = Pgm().GetSettingsManager();
387 wxString currentTheme = cfg->m_ColorTheme;
388 return mgr.GetColorSettings( currentTheme );
389}
390
391
393{
394 wxWindowUpdateLocker no_update( m_LayersManager );
395
399
400 wxAuiPaneInfo& lyrs = m_auimgr.GetPane( m_LayersManager );
401 wxSize bestz = m_LayersManager->GetBestSize();
402 bestz.x += 5; // gives a little margin
403
404 lyrs.MinSize( bestz );
405 lyrs.BestSize( bestz );
406 lyrs.FloatingSize( bestz );
407
408 if( lyrs.IsDocked() )
409 m_auimgr.Update();
410 else
411 m_LayersManager->SetSize( bestz );
412
414}
415
416
417void GERBVIEW_FRAME::SetElementVisibility( int aLayerID, bool aNewState )
418{
419 KIGFX::VIEW* view = GetCanvas()->GetView();
420
421 switch( aLayerID )
422 {
423 case LAYER_DCODES:
424 gvconfig()->m_Appearance.show_dcodes = aNewState;
425
426 for( int i = 0; i < GERBER_DRAWLAYERS_COUNT; i++ )
427 {
428 int layer = GERBER_DRAW_LAYER( i );
429 int dcode_layer = GERBER_DCODE_LAYER( layer );
430 view->SetLayerVisible( dcode_layer, aNewState && view->IsLayerVisible( layer ) );
431 }
432
433 break;
434
436 {
438
440 {
441 GERBER_DRAW_ITEM* item = dynamic_cast<GERBER_DRAW_ITEM*>( aItem );
442
443 // GetLayerPolarity() returns true for negative items
444 return ( item && item->GetLayerPolarity() );
445 } );
446
447 break;
448 }
449
452
454
455 // NOTE: LAYER_DRAWINGSHEET always used for visibility, but the layer manager passes
456 // LAYER_GERBVIEW_DRAWINGSHEET because of independent color control
458 break;
459
461 SetGridVisibility( aNewState );
462 break;
463
467 break;
468
469 default:
470 wxFAIL_MSG( wxString::Format( wxT( "GERBVIEW_FRAME::SetElementVisibility(): bad arg %d" ),
471 aLayerID ) );
472 }
473
475 m_LayersManager->SetRenderState( aLayerID, aNewState );
476}
477
478
480{
481 auto painter = static_cast<KIGFX::GERBVIEW_PAINTER*>( GetCanvas()->GetView()->GetPainter() );
482 KIGFX::GERBVIEW_RENDER_SETTINGS* settings = painter->GetSettings();
484 settings->LoadColors( GetColorSettings() );
485
487}
488
489
491{
492 for( unsigned i = 0; i < ImagesMaxCount(); ++i )
493 {
494 const GERBER_FILE_IMAGE* gerber = GetGbrImage( i );
495
496 if( gerber == nullptr ) // this graphic layer is available: use it
497 return i;
498 }
499
500 return NO_AVAILABLE_LAYERS;
501}
502
503
505{
507}
508
509
510void GERBVIEW_FRAME::syncLayerBox( bool aRebuildLayerBox )
511{
512 if( aRebuildLayerBox )
514
515 m_SelLayerBox->SetSelection( GetActiveLayer() );
516
517 int dcodeSelected = -1;
519
520 if( gerber )
521 dcodeSelected = gerber->m_Selected_Tool;
522
523 if( m_DCodeSelector )
524 {
526 m_DCodeSelector->SetDCodeSelection( dcodeSelected );
527 m_DCodeSelector->Enable( gerber != nullptr );
528 }
529}
530
531
533{
534 RemapLayers( GetImagesList()->SortImagesByFileExtension() );
535}
536
537
539{
540 RemapLayers( GetImagesList()->SortImagesByZOrder() );
541}
542
543
544void GERBVIEW_FRAME::RemapLayers( std::unordered_map<int, int> remapping )
545{
547 syncLayerBox( true );
548
549 std::unordered_map<int, int> view_remapping;
550
551 for( const std::pair<const int, int>& entry : remapping )
552 {
553 view_remapping[ GERBER_DRAW_LAYER( entry.first ) ] = GERBER_DRAW_LAYER( entry.second );
554 view_remapping[ GERBER_DCODE_LAYER( entry.first ) ] = GERBER_DCODE_LAYER( entry.second );
555 }
556
557 GetCanvas()->GetView()->ReorderLayerData( view_remapping );
558 GetCanvas()->Refresh();
559}
560
561
563{
567 KIGFX::VIEW* view = GetCanvas()->GetView();
568
569 int lastVisibleLayer = -1;
570
571 for( int i = 0; i < GERBER_DRAWLAYERS_COUNT; i++ )
572 {
573 view->SetLayerDiff( GERBER_DRAW_LAYER( i ), gvconfig()->m_Display.m_DiffMode );
574
575 // Caching doesn't work with layered rendering of diff'd layers
576 if( gvconfig()->m_Display.m_DiffMode )
578 else
579 view->SetLayerTarget( GERBER_DRAW_LAYER( i ), target );
580
581 // We want the last visible layer, but deprioritize the active layer unless it's the
582 // only layer
583 if( ( lastVisibleLayer == -1 )
584 || ( view->IsLayerVisible( GERBER_DRAW_LAYER( i ) ) && i != GetActiveLayer() ) )
585 {
586 lastVisibleLayer = i;
587 }
588 }
589
590 //We don't want to diff the last visible layer onto the background, etc.
591 if( lastVisibleLayer != -1 )
592 {
593 view->SetLayerTarget( GERBER_DRAW_LAYER( lastVisibleLayer ), target );
594 view->SetLayerDiff( GERBER_DRAW_LAYER( lastVisibleLayer ), false );
595 }
596
597 view->RecacheAllItems();
598 view->MarkDirty();
599 view->UpdateAllItems( KIGFX::ALL );
600}
601
602
604{
606
607 // Display the gerber filename
608 if( gerber == nullptr )
609 {
610 SetTitle( _("Gerber Viewer") );
611
612 SetStatusText( wxEmptyString, 0 );
613
614 wxString info;
615 info.Printf( _( "Drawing layer not in use" ) );
616 m_TextInfo->SetValue( info );
617
618 if( KIUI::EnsureTextCtrlWidth( m_TextInfo, &info ) ) // Resized
619 m_auimgr.Update();
620
622 return;
623 }
624 else
625 {
626 wxString title;
627 wxFileName filename( gerber->m_FileName );
628
629 title = filename.GetFullName();
630
631 if( gerber->m_IsX2_file )
632 title += wxS( " " ) + _( "(with X2 attributes)" );
633
634 title += wxT( " \u2014 " ) + _( "Gerber Viewer" );
635 SetTitle( title );
636
637 gerber->DisplayImageInfo( this );
638
639 // Display Image Name and Layer Name (from the current gerber data):
640 wxString status;
641 status.Printf( _( "Image name: \"%s\" Layer name: \"%s\"" ),
642 gerber->m_ImageName,
643 gerber->GetLayerParams().m_LayerName );
644 SetStatusText( status, 0 );
645
646 // Display data format like fmt in X3.4Y3.4 no LZ or fmt mm X2.3 Y3.5 no TZ in main toolbar
647 wxString info;
648 info.Printf( wxT( "fmt: %s X%d.%d Y%d.%d no %cZ" ),
649 gerber->m_GerbMetric ? wxT( "mm" ) : wxT( "in" ),
650 gerber->m_FmtLen.x - gerber->m_FmtScale.x,
651 gerber->m_FmtScale.x,
652 gerber->m_FmtLen.y - gerber->m_FmtScale.y,
653 gerber->m_FmtScale.y,
654 gerber->m_NoTrailingZeros ? 'T' : 'L' );
655
656 if( gerber->m_IsX2_file )
657 info << wxT(" ") << _( "X2 attr" );
658
659 m_TextInfo->SetValue( info );
660
661 if( KIUI::EnsureTextCtrlWidth( m_TextInfo, &info ) ) // Resized
662 m_auimgr.Update();
663 }
664}
665
666
667bool GERBVIEW_FRAME::IsElementVisible( int aLayerID ) const
668{
669 switch( aLayerID )
670 {
673 case LAYER_GERBVIEW_GRID: return IsGridVisible();
676 case LAYER_GERBVIEW_BACKGROUND: return true;
677
678 default:
679 wxFAIL_MSG( wxString::Format( wxT( "GERBVIEW_FRAME::IsElementVisible(): bad arg %d" ),
680 aLayerID ) );
681 }
682
683 return true;
684}
685
686
688{
689 LSET visible = LSET::AllLayersMask();
690
691 if( GetCanvas() )
692 {
693 for( int i = 0; i < GERBER_DRAWLAYERS_COUNT; i++ )
694 visible[i] = GetCanvas()->GetView()->IsLayerVisible( GERBER_DRAW_LAYER( i ) );
695 }
696
697 return visible;
698}
699
700
702{
703 if( GetCanvas() )
704 {
705 for( int i = 0; i < GERBER_DRAWLAYERS_COUNT; i++ )
706 {
707 bool v = aLayerMask[i];
708 int layer = GERBER_DRAW_LAYER( i );
709 GetCanvas()->GetView()->SetLayerVisible( layer, v );
711 gvconfig()->m_Appearance.show_dcodes && v );
712 }
713 }
714}
715
716
717bool GERBVIEW_FRAME::IsLayerVisible( int aLayer ) const
718{
719 return m_LayersManager->IsLayerVisible( aLayer );
720}
721
722
724{
725 COLOR4D color = COLOR4D::UNSPECIFIED;
726 COLOR_SETTINGS* settings = GetColorSettings();
727
728 switch( aLayerID )
729 {
731 case LAYER_DCODES:
735 color = settings->GetColor( aLayerID );
736 break;
737
740 break;
741
742 default:
743 wxFAIL_MSG( wxString::Format( wxT( "GERBVIEW_FRAME::GetVisibleElementColor(): bad arg %d" ),
744 aLayerID ) );
745 }
746
747 return color;
748}
749
750
752{
755}
756
757
758void GERBVIEW_FRAME::SetVisibleElementColor( int aLayerID, const COLOR4D& aColor )
759{
760 COLOR_SETTINGS* settings = GetColorSettings();
761
762 settings->SetColor( aLayerID, aColor );
763
764 switch( aLayerID )
765 {
769 break;
770
772 SetGridColor( aColor );
773 break;
774
776 SetDrawBgColor( aColor );
777 break;
778
779 default:
780 break;
781 }
782}
783
784
786{
787 return GetColorSettings()->GetColor( aLayer );
788}
789
790
791void GERBVIEW_FRAME::SetLayerColor( int aLayer, const COLOR4D& aColor )
792{
793 GetColorSettings()->SetColor( aLayer, aColor );
795}
796
797
798void GERBVIEW_FRAME::SetActiveLayer( int aLayer, bool doLayerWidgetUpdate )
799{
800 m_activeLayer = aLayer;
801
802 if( gvconfig()->m_Display.m_DiffMode )
804
805 if( doLayerWidgetUpdate )
806 m_LayersManager->SelectLayer( aLayer );
807
809
811 GetCanvas()->SetFocus(); // otherwise hotkeys are stuck somewhere
812
814 GetCanvas()->Refresh();
815}
816
817
818void GERBVIEW_FRAME::SetPageSettings( const PAGE_INFO& aPageSettings )
819{
820 m_paper = aPageSettings;
821
822 if( GetScreen() )
824
825 GERBVIEW_DRAW_PANEL_GAL* drawPanel = static_cast<GERBVIEW_DRAW_PANEL_GAL*>( GetCanvas() );
826
827 // Prepare drawing-sheet template
829 &GetPageSettings(), &Prj(),
830 &GetTitleBlock(), nullptr );
831
832 if( GetScreen() )
833 {
834 drawingSheet->SetPageNumber( "1" );
835 drawingSheet->SetSheetCount( 1 );
836 }
837
840
841 // Draw panel takes ownership of the drawing-sheet
842 drawPanel->SetDrawingSheet( drawingSheet );
843}
844
845
847{
848 return m_paper;
849}
850
851
853{
854 // this function is only needed because EDA_DRAW_FRAME is not compiled
855 // with either -DPCBNEW or -DEESCHEMA, so the virtual is used to route
856 // into an application specific source file.
858}
859
860
862{
863 wxASSERT( m_gerberLayout );
865}
866
867
869{
870 wxASSERT( m_gerberLayout );
871 m_gerberLayout->SetTitleBlock( aTitleBlock );
872}
873
874
876{
878}
879
880
882{
884 GetCanvas()->GetGAL()->SetGridColor( aColor );
885 m_gridColor = aColor;
886}
887
888
890{
891 VECTOR2D gridSize = GetCanvas()->GetGAL()->GetGridSize();
892 wxString line;
893
894 line.Printf( wxT( "grid X %s Y %s" ),
895 MessageTextFromValue( gridSize.x, false ),
896 MessageTextFromValue( gridSize.y, false ) );
897
898 SetStatusText( line, 4 );
899 SetStatusText( line, 4 );
900}
901
902
904{
906
907 if( !GetScreen() )
908 return;
909
910 wxString line;
912
913 if( GetShowPolarCoords() ) // display relative polar coordinates
914 {
915 VECTOR2D v = cursorPos - GetScreen()->m_LocalOrigin;
916 EDA_ANGLE theta( VECTOR2D( v.x, -v.y ) );
917 double ro = hypot( v.x, v.y );
918
919 line.Printf( wxT( "r %s theta %s" ),
920 MessageTextFromValue( ro, false ),
921 MessageTextFromValue( theta, false ) );
922
923 SetStatusText( line, 3 );
924 }
925
926 // Display absolute coordinates:
927 line.Printf( wxT( "X %s Y %s" ),
928 MessageTextFromValue( cursorPos.x, false ),
929 MessageTextFromValue( cursorPos.y, false ) );
930 SetStatusText( line, 2 );
931
932 if( !GetShowPolarCoords() )
933 {
934 // Display relative cartesian coordinates:
935 double dXpos = cursorPos.x - GetScreen()->m_LocalOrigin.x;
936 double dYpos = cursorPos.y - GetScreen()->m_LocalOrigin.y;
937
938 line.Printf( wxT( "dx %s dy %s dist %s" ),
939 MessageTextFromValue( dXpos, false ),
940 MessageTextFromValue( dYpos,false ),
941 MessageTextFromValue( hypot( dXpos, dYpos ), false ) );
942 SetStatusText( line, 3 );
943 }
944
946}
947
948
950{
951 return m_gerberLayout->GetImagesList()->GetGbrImage( aIdx );
952}
953
954
956{
958}
959
960
962{
963 // Called on units change (see EDA_DRAW_FRAME)
967}
968
969
971{
973
974 EDA_DRAW_PANEL_GAL* galCanvas = GetCanvas();
975
976 if( m_toolManager )
977 {
979 GetCanvas()->GetViewControls(), config(), this );
981 }
982
984
986
987 galCanvas->GetView()->RecacheAllItems();
989 galCanvas->StartDrawing();
990
993
996}
997
998
1000{
1001 // Create the manager and dispatcher & route draw panel events to the dispatcher
1004 GetCanvas()->GetViewControls(), config(), this );
1007
1008 // Register tools
1016
1017 // Run the selection tool, it is supposed to be always active
1018 m_toolManager->InvokeTool( "gerbview.InteractiveSelection" );
1019}
1020
1021
1023{
1025
1027 EDITOR_CONDITIONS cond( this );
1028
1029 wxASSERT( mgr );
1030
1031#define ENABLE( x ) ACTION_CONDITIONS().Enable( x )
1032#define CHECK( x ) ACTION_CONDITIONS().Check( x )
1033
1037
1041
1045
1046 auto flashedDisplayOutlinesCond =
1047 [this] ( const SELECTION& )
1048 {
1050 };
1051
1052 auto linesFillCond =
1053 [this] ( const SELECTION& )
1054 {
1056 };
1057
1058 auto polygonsFilledCond =
1059 [this] ( const SELECTION& )
1060 {
1062 };
1063
1064 auto negativeObjectsCond =
1065 [this] ( const SELECTION& )
1066 {
1068 };
1069
1070 auto dcodeCond =
1071 [this] ( const SELECTION& )
1072 {
1074 };
1075
1076 auto diffModeCond =
1077 [this] ( const SELECTION& )
1078 {
1079 return gvconfig()->m_Display.m_DiffMode;
1080 };
1081
1082 auto highContrastModeCond =
1083 [this] ( const SELECTION& )
1084 {
1086 };
1087
1088 auto flipGerberCond =
1089 [this] ( const SELECTION& )
1090 {
1092 };
1093
1094 auto layersManagerShownCondition =
1095 [this] ( const SELECTION& aSel )
1096 {
1098 };
1099
1100 mgr->SetConditions( GERBVIEW_ACTIONS::flashedDisplayOutlines, CHECK( flashedDisplayOutlinesCond ) );
1102 mgr->SetConditions( GERBVIEW_ACTIONS::polygonsDisplayOutlines, CHECK( polygonsFilledCond ) );
1103 mgr->SetConditions( GERBVIEW_ACTIONS::negativeObjectDisplay, CHECK( negativeObjectsCond ) );
1105 mgr->SetConditions( GERBVIEW_ACTIONS::toggleDiffMode, CHECK( diffModeCond ) );
1106 mgr->SetConditions( GERBVIEW_ACTIONS::flipGerberView, CHECK( flipGerberCond ) );
1107 mgr->SetConditions( ACTIONS::highContrastMode, CHECK( highContrastModeCond ) );
1108 mgr->SetConditions( GERBVIEW_ACTIONS::toggleLayerManager, CHECK( layersManagerShownCondition ) );
1109
1110#undef CHECK
1111#undef ENABLE
1112}
1113
1114
1115void GERBVIEW_FRAME::CommonSettingsChanged( bool aEnvVarsChanged, bool aTextVarsChanged )
1116{
1117 EDA_DRAW_FRAME::CommonSettingsChanged( aEnvVarsChanged, aTextVarsChanged );
1118
1119 SetPageSettings( PAGE_INFO( gvconfig()->m_Appearance.page_type ) );
1120
1121 if( gvconfig()->m_Display.m_DiffMode )
1123
1124 SetElementVisibility( LAYER_DCODES, gvconfig()->m_Appearance.show_dcodes );
1125
1129
1131 ReFillLayerWidget(); // Update the layers list
1132 m_LayersManager->ReFillRender(); // Update colors in Render after the config is read
1133
1134 Layout();
1135 SendSizeEvent();
1136}
1137
1138
1140{
1141 return m_toolManager->GetTool<GERBVIEW_SELECTION_TOOL>()->GetSelection();
1142}
1143
1144
1146{
1148
1149 // show/hide auxiliary Vertical layers and visibility manager toolbar
1150 m_auimgr.GetPane( "LayersManager" ).Show( m_show_layer_manager_tools );
1151 m_auimgr.Update();
1152}
int color
Definition: DXF_plotter.cpp:57
BASE_SCREEN class implementation.
constexpr EDA_IU_SCALE gerbIUScale
Definition: base_units.h:108
wxBitmap KiBitmap(BITMAPS aBitmap, int aHeightTag)
Construct a wxBitmap from an image identifier Returns the image from the active theme if the image ha...
Definition: bitmap.cpp:105
@ icon_gerbview_16
@ icon_gerbview
@ icon_gerbview_32
static TOOL_ACTION toggleGrid
Definition: actions.h:143
static TOOL_ACTION millimetersUnits
Definition: actions.h:149
static TOOL_ACTION togglePolarCoords
Definition: actions.h:152
static TOOL_ACTION milsUnits
Definition: actions.h:148
static TOOL_ACTION inchesUnits
Definition: actions.h:147
static TOOL_ACTION highContrastMode
Definition: actions.h:105
static TOOL_ACTION toggleCursorStyle
Definition: actions.h:104
static TOOL_ACTION measureTool
Definition: actions.h:157
static TOOL_ACTION selectionTool
Definition: actions.h:156
static TOOL_ACTION zoomFitScreen
Definition: actions.h:98
static TOOL_ACTION zoomTool
Definition: actions.h:101
Manage TOOL_ACTION objects.
void SetConditions(const TOOL_ACTION &aAction, const ACTION_CONDITIONS &aConditions)
Set the conditions the UI elements for activating a specific tool action should use for determining t...
APP_SETTINGS_BASE is a settings class that should be derived for each standalone KiCad application.
Definition: app_settings.h:101
WINDOW_SETTINGS m_Window
Definition: app_settings.h:184
wxString m_ColorTheme
Active color theme name.
Definition: app_settings.h:187
Handles how to draw a screen (a board, a schematic ...)
Definition: base_screen.h:41
VECTOR2D m_LocalOrigin
Relative Screen cursor coordinate (on grid) in user units.
Definition: base_screen.h:90
void InitDataPoints(const wxSize &aPageSizeInternalUnits)
Definition: base_screen.cpp:46
Color settings are a bit different than most of the settings objects in that there can be more than o...
void SetColor(int aLayer, const COLOR4D &aColor)
COLOR4D GetColor(int aLayer) const
Handle actions that are shared between different applications.
Handles action that are shared between different applications.
Definition: common_tools.h:38
void SetDCodeSelection(int aDCodeId)
void SetSheetCount(int aSheetCount)
Changes the sheet-count number displayed in the title block.
void SetPageNumber(const std::string &aPageNumber)
Changes the page number displayed in the title block.
void SetPageBorderColorLayer(int aLayerId)
Overrides the layer used to pick the color of the page border (normally LAYER_GRID)
void SetColorLayer(int aLayerId)
Can be used to override which layer ID is used for drawing sheet item colors.
virtual APP_SETTINGS_BASE * config() const
Returns the settings object used in SaveSettings(), and is overloaded in KICAD_MANAGER_FRAME.
virtual void setupUIConditions()
Setup the UI conditions for the various actions and their controls in this frame.
wxAuiManager m_auimgr
std::map< const wxString, TOOL_ACTION * > m_acceptedExts
Associates files extensions with action to execute.
wxString m_aboutTitle
bool m_isClosing
Set by NonUserClose() to indicate that the user did not request the current close.
wxString m_mruPath
The base class for create windows for drawing purpose.
virtual void ClearMsgPanel()
Clear all messages from the message panel.
virtual void ActivateGalCanvas()
Use to start up the GAL drawing canvas.
void SaveSettings(APP_SETTINGS_BASE *aCfg) override
Save common frame parameters to a configuration data file.
EDA_DRAW_PANEL_GAL::GAL_TYPE m_canvasType
virtual BASE_SCREEN * GetScreen() const
Return a pointer to a BASE_SCREEN or one of its derivatives.
void setupUnits(APP_SETTINGS_BASE *aCfg)
ACTION_TOOLBAR * m_optionsToolBar
void UpdateGridSelectBox()
Rebuild the grid combobox to respond to any changes in the GUI (units, user grid changes,...
KIGFX::GAL_DISPLAY_OPTIONS & GetGalDisplayOptions()
Return a reference to the gal rendering options used by GAL for rendering.
void LoadSettings(APP_SETTINGS_BASE *aCfg) override
Load common frame parameters from a configuration file.
virtual void SwitchCanvas(EDA_DRAW_PANEL_GAL::GAL_TYPE aCanvasType)
Changes the current rendering backend.
void resolveCanvasType()
Determines the Canvas type to load (with prompt if required) and initializes m_canvasType.
EDA_MSG_PANEL * m_messagePanel
void SetCanvas(EDA_DRAW_PANEL_GAL *aPanel)
virtual void SetScreen(BASE_SCREEN *aScreen)
void RecreateToolbars()
Rebuild all toolbars, and update the checked state of check tools.
ACTION_TOOLBAR * m_mainToolBar
virtual void Zoom_Automatique(bool aWarpPointer)
Redraw the screen with best zoom level and the best centering that shows all the page or the board.
virtual void SetGridVisibility(bool aVisible)
virtual void SetDrawBgColor(const COLOR4D &aColor)
void UpdateStatusBar() override
Update the status bar information.
virtual EDA_DRAW_PANEL_GAL * GetCanvas() const
Return a pointer to GAL-based canvas of given EDA draw frame.
void unitsChangeRefresh() override
Called when when the units setting has changed to allow for any derived classes to handle refreshing ...
void CommonSettingsChanged(bool aEnvVarsChanged, bool aTextVarsChanged) override
Notification event that some of the common (suite-wide) settings have changed.
bool IsGridVisible() const
bool m_showBorderAndTitleBlock
ACTION_TOOLBAR * m_auxiliaryToolBar
bool GetShowPolarCoords() const
For those frames that support polar coordinates.
GAL_TYPE GetBackend() const
Return the type of backend currently used by GAL canvas.
virtual void SetHighContrastLayer(int aLayer)
Take care of display settings for the given layer to be displayed in high contrast mode.
void StopDrawing()
Prevent the GAL canvas from further drawing until it is recreated or StartDrawing() is called.
KIGFX::VIEW_CONTROLS * GetViewControls() const
Return a pointer to the #VIEW_CONTROLS instance used in the panel.
virtual KIGFX::VIEW * GetView() const
Return a pointer to the #VIEW instance used in the panel.
void ForceRefresh()
Force a redraw.
virtual void Refresh(bool aEraseBackground=true, const wxRect *aRect=nullptr) override
Update the board display after modifying it by a python script (note: it is automatically called by a...
@ GAL_TYPE_OPENGL
OpenGL implementation.
@ GAL_TYPE_NONE
GAL not used (the legacy wxDC engine is used)
KIGFX::GAL * GetGAL() const
Return a pointer to the GAL instance used in the panel.
void SetFocus() override
void SetEventDispatcher(TOOL_DISPATCHER *aEventDispatcher)
Set a dispatcher that processes events and forwards them to tools.
void StartDrawing()
Begin drawing if it was stopped previously.
Specialization of the wxAuiPaneInfo class for KiCad panels.
Class that groups generic conditions for editor states.
SELECTION_CONDITION CurrentTool(const TOOL_ACTION &aTool)
Create a functor testing if the specified tool is the current active tool in the frame.
SELECTION_CONDITION Units(EDA_UNITS aUnit)
Create a functor that tests if the frame has the specified units.
SELECTION_CONDITION GridVisible()
Create a functor testing if the grid is visible in a frame.
SELECTION_CONDITION PolarCoordinates()
Create a functor testing if polar coordinates are current being used.
SELECTION_CONDITION FullscreenCursor()
Create a functor testing if the cursor is full screen in a frame.
void Save(APP_SETTINGS_BASE &aSettings)
Saves history into a JSON settings object.
Definition: filehistory.cpp:67
void SetMaxFiles(size_t aMaxFiles)
Update the number of files that will be contained inside the file history.
Definition: filehistory.cpp:85
void Load(const APP_SETTINGS_BASE &aSettings)
Loads history from a JSON settings object.
Definition: filehistory.cpp:45
bool m_DisplayFlashedItemsFill
Option to draw flashed items (filled/sketch)
bool m_HighContrastMode
High contrast mode (dim un-highlighted objects)
bool m_DiffMode
Display layers in diff mode.
bool m_FlipGerberView
Display as a mirror image.
bool m_DisplayPolygonsFill
Option to draw polygons (filled/sketch)
bool m_DisplayLinesFill
Option to draw line items (filled/sketch)
A list of GERBER_DRAW_ITEM objects currently loaded.
Definition: gbr_layout.h:46
void SetTitleBlock(const TITLE_BLOCK &aTitleBlock)
Definition: gbr_layout.h:64
GERBER_FILE_IMAGE_LIST * GetImagesList() const
Definition: gbr_layout.cpp:41
TITLE_BLOCK & GetTitleBlock()
Definition: gbr_layout.h:63
bool GetLayerPolarity() const
static void GetGerberLayerFromFilename(const wxString &filename, enum GERBER_ORDER_ENUM &order, wxString &matchedExtension)
Utility function to guess which PCB layer of a gerber/drill file corresponds to based on its file ext...
const wxString GetDisplayName(int aIdx, bool aNameOnly=false, bool aFullName=false)
Get the display name for the layer at aIdx.
void DeleteAllImages()
Remove all loaded data in list, and delete all images, freeing the memory.
GERBER_FILE_IMAGE * GetGbrImage(int aIdx)
Hold the image data and parameters for one gerber file and layer parameters.
wxSize m_FmtScale
Fmt 2.3: m_FmtScale = 3, fmt 3.4: m_FmtScale = 4.
wxString m_FileName
Full File Name for this layer.
wxString m_ImageName
Image name, from IN <name>* command.
bool m_IsX2_file
True if a X2 gerber attribute was found in file.
wxSize m_FmtLen
Nb chars per coord. ex fmt 2.3, m_FmtLen = 5.
bool m_GerbMetric
false = Inches, true = metric
bool m_NoTrailingZeros
true: remove tailing zeros.
GERBER_LAYER & GetLayerParams()
void DisplayImageInfo(GERBVIEW_FRAME *aMainFrame)
Display information about image parameters in the status bar.
Abstract functions of LAYER_WIDGET so they may be tied into the GERBVIEW_FRAME's data and we can add ...
void ReFillRender()
Rebuild Render for instance after the config is read.
void ReFill()
Rebuild Render for instance after the config is read.
wxString m_LayerName
Gather all the actions that are shared by tools.
static TOOL_ACTION dcodeDisplay
static TOOL_ACTION negativeObjectDisplay
static TOOL_ACTION flashedDisplayOutlines
static TOOL_ACTION loadZipFile
static TOOL_ACTION toggleLayerManager
static TOOL_ACTION toggleDiffMode
static TOOL_ACTION flipGerberView
static TOOL_ACTION linesDisplayOutlines
static TOOL_ACTION polygonsDisplayOutlines
static TOOL_ACTION layerChanged
static TOOL_ACTION loadGerbFiles
Handle actions that are shared between different frames in Pcbnew.
void SetDrawingSheet(DS_PROXY_VIEW_ITEM *aDrawingSheet)
Set or update the drawing-sheet (borders and title block) used by the draw panel.
COLOR_SETTINGS * GetColorSettings(bool aForceRefresh=false) const override
Returns a pointer to the active color theme settings.
void SetLayerColor(int aLayer, const COLOR4D &aColor)
void CommonSettingsChanged(bool aEnvVarsChanged, bool aTextVarsChanged) override
Called after the preferences dialog is run.
wxStaticText * m_dcodeText
wxChoice * m_SelAperAttributesBox
void UpdateStatusBar() override
Update the status bar information.
COLOR4D GetVisibleElementColor(int aLayerID)
Return the color of a gerber visible element.
GERBVIEW_SETTINGS * gvconfig() const
const PAGE_INFO & GetPageSettings() const override
bool IsLayerVisible(int aLayer) const
Test whether a given layer is visible.
void DisplayGridMsg() override
Display the current grid pane on the status bar.
void SortLayersByX2Attributes()
void SetLayout(GBR_LAYOUT *aLayout)
Set the m_gerberLayout member in such as way as to ensure deleting any previous GBR_LAYOUT.
void ReCreateHToolbar() override
LSET GetVisibleLayers() const
A proxy function that calls the correspondent function in m_BoardSettings.
GBR_LAYER_BOX_SELECTOR * m_SelLayerBox
void UpdateToolbarControlSizes() override
Update the sizes of any controls in the toolbars of the frame.
bool m_show_layer_manager_tools
void LoadSettings(APP_SETTINGS_BASE *aCfg) override
Load common frame parameters from a configuration file.
GBR_LAYOUT * m_gerberLayout
void SetPageSettings(const PAGE_INFO &aPageSettings) override
const wxSize GetPageSizeIU() const override
Works off of GetPageSettings() to return the size of the paper page in the internal units of this par...
void ApplyDisplaySettingsToGAL()
Updates the GAL with display settings changes.
PAGE_INFO m_paper
bool LoadGerberJobFile(const wxString &aFileName)
Load a Gerber job file, and load gerber files found in job files.
wxStaticText * m_cmpText
GERBER_FILE_IMAGE_LIST * GetImagesList() const
Accessors to GERBER_FILE_IMAGE_LIST and GERBER_FILE_IMAGE data.
void SaveSettings(APP_SETTINGS_BASE *aCfg) override
Save common frame parameters to a configuration data file.
void syncLayerBox(bool aRebuildLayerBox=false)
Update the currently "selected" layer within m_SelLayerBox.
GBR_LAYOUT * GetGerberLayout() const
bool LoadGerberFiles(const wxString &aFileName)
Load a given Gerber file or selected file(s), if the filename is empty.
void SetTitleBlock(const TITLE_BLOCK &aTitleBlock) override
void ReCreateAuxiliaryToolbar() override
void doCloseWindow() override
wxChoice * m_SelComponentBox
FILE_HISTORY m_jobFileHistory
wxChoice * m_SelNetnameBox
int GetActiveLayer() const
Return the active layer.
wxTextCtrl * m_TextInfo
bool IsElementVisible(int aLayerID) const
Test whether a given element category is visible.
DCODE_SELECTION_BOX * m_DCodeSelector
GERBER_LAYER_WIDGET * m_LayersManager
void SetActiveLayer(int aLayer, bool doLayerWidgetUpdate=true)
change the currently active layer to aLayer and update the GERBER_LAYER_WIDGET.
wxStaticText * m_netText
void syncLayerWidget()
Update the currently "selected" layer within the GERBER_LAYER_WIDGET.
void SetVisibleElementColor(int aLayerID, const COLOR4D &aColor)
GERBVIEW_FRAME(KIWAY *aKiway, wxWindow *aParent)
unsigned ImagesMaxCount() const
The max number of file images.
void ReCreateOptToolbar() override
Create or update the left vertical toolbar (option toolbar)
SELECTION & GetCurrentSelection() override
Get the current selection from the canvas area.
void SetVisibleLayers(LSET aLayerMask)
A proxy function that calls the correspondent function in m_BoardSettings.
wxStaticText * m_apertText
COLOR4D GetLayerColor(int aLayer) const
void SortLayersByFileExtension()
void UpdateDiffLayers()
Update each layers' differential option.
GERBER_FILE_IMAGE * GetGbrImage(int aIdx) const
void SetGridVisibility(bool aVisible) override
const TITLE_BLOCK & GetTitleBlock() const override
bool LoadAutodetectedFiles(const wxString &aFileName)
Load a given file or selected file(s), if the filename is empty.
void ReFillLayerWidget()
Change out all the layers in m_Layers; called upon loading new gerber files.
FILE_HISTORY m_zipFileHistory
bool OpenProjectFiles(const std::vector< wxString > &aFileSet, int aCtl) override
Open a project or set of files given by aFileList.
void setupUIConditions() override
Setup the UI conditions for the various actions and their controls in this frame.
int getNextAvailableLayer() const
Find the next empty layer.
bool LoadZipArchiveFile(const wxString &aFileName)
Load a zipped archive file.
void UpdateTitleAndInfo()
Display the short filename (if exists) of the selected layer on the caption of the main GerbView wind...
void SetElementVisibility(int aLayerID, bool aNewState)
Change the visibility of an element category.
virtual void SetGridColor(const COLOR4D &aColor) override
void unitsChangeRefresh() override
Called when when the units setting has changed to allow for any derived classes to handle refreshing ...
void ActivateGalCanvas() override
Use to start up the GAL drawing canvas.
void RemapLayers(std::unordered_map< int, int > remapping)
Takes a layer remapping and reorders the layers.
FILE_HISTORY m_drillFileHistory
bool LoadExcellonFiles(const wxString &aFileName)
Load a drill (EXCELLON) file or many files.
COLOR4D GetGridColor() override
void ReCreateMenuBar() override
Recreates the menu bar.
Selection tool for GerbView, based on the one in Pcbnew.
std::vector< wxString > m_JobFileHistory
std::vector< wxString > m_DrillFileHistory
GBR_DISPLAY_OPTIONS m_Display
std::vector< wxString > m_ZipFileHistory
A color representation with 4 components: red, green, blue, alpha.
Definition: color4d.h:104
void SetGridColor(const COLOR4D &aGridColor)
Set the grid color.
const VECTOR2D & GetGridSize() const
Return the grid size.
Methods for drawing GerbView specific items.
Store GerbView specific render settings.
void LoadColors(const COLOR_SETTINGS *aSettings) override
void SetHighContrast(bool aEnabled)
Turns on/off high contrast display mode.
VECTOR2D GetCursorPosition() const
Return the current cursor position in world coordinates.
An abstract base class for deriving all objects that can be added to a VIEW.
Definition: view_item.h:77
Hold a (potentially large) number of VIEW_ITEMs and renders them on a graphics device provided by the...
Definition: view.h:69
void SetLayerDiff(int aLayer, bool aDiff=true)
Set the whether the layer should drawn differentially.
Definition: view.h:424
void SetLayerTarget(int aLayer, RENDER_TARGET aTarget)
Change the rendering target for a particular layer.
Definition: view.h:469
void SetLayerVisible(int aLayer, bool aVisible=true)
Control the visibility of a particular layer.
Definition: view.h:393
void Clear()
Remove all items from the view.
Definition: view.cpp:1096
void RecacheAllItems()
Rebuild GAL display lists.
Definition: view.cpp:1381
void UpdateAllItems(int aUpdateFlags)
Update all items in the view according to the given flags.
Definition: view.cpp:1478
void MarkDirty()
Force redraw of view on the next rendering.
Definition: view.h:641
bool IsLayerVisible(int aLayer) const
Return information about visibility of a particular layer.
Definition: view.h:410
PAINTER * GetPainter() const
Return the painter object used by the view for drawing #VIEW_ITEMS.
Definition: view.h:213
void MarkTargetDirty(int aTarget)
Set or clear target 'dirty' flag.
Definition: view.h:617
void UpdateAllItemsConditionally(int aUpdateFlags, std::function< bool(VIEW_ITEM *)> aCondition)
Update items in the view according to the given flags and condition.
Definition: view.cpp:1488
void ReorderLayerData(std::unordered_map< int, int > aReorderMap)
Remap the data between layer ids without invalidating that data.
Definition: view.cpp:673
PROJECT & Prj() const
Return a reference to the PROJECT associated with this KIWAY.
bool Destroy() override
Our version of Destroy() which is virtual from wxWidgets.
A minimalistic software bus for communications between various DLLs/DSOs (DSOs) within the same KiCad...
Definition: kiway.h:267
void SetRenderState(int aId, bool isSet)
Set the state of the checkbox associated with aId within the Render tab group of the widget.
void SelectLayer(int aLayer)
Change the row selection in the layer list to aLayer provided.
bool IsLayerVisible(int aLayer)
Return the visible state of the layer ROW associated with aLayer id.
wxSize GetBestSize() const
Return the preferred minimum size, taking into consideration the dynamic content.
void SetSmallestLayerString(const wxString &aString)
Set the string that is used for determining the smallest string displayed in the layer's tab.
Definition: layer_widget.h:141
LSET is a set of PCB_LAYER_IDs.
Definition: layer_ids.h:530
static LSET AllLayersMask()
Definition: lset.cpp:808
Describe the page size and margins of a paper page on which to eventually print or plot.
Definition: page_info.h:54
const wxString & GetType() const
Definition: page_info.h:94
const wxSize GetSizeIU(double aIUScale) const
Gets the page size in internal units.
Definition: page_info.h:162
bool SetType(const wxString &aStandardPageDescriptionName, bool aIsPortrait=false)
Set the name of the page type and also the sizes and margins commonly associated with that type name.
Definition: page_info.cpp:120
T * GetAppSettings(bool aLoadNow=true)
Returns a handle to the a given settings by type If the settings have already been loaded,...
COLOR_SETTINGS * GetColorSettings(const wxString &aName="user")
Retrieves a color settings object that applications can read colors from.
Represent a set of closed polygons.
Hold the information shown in the lower right corner of a plot, printout, or editing view.
Definition: title_block.h:41
TOOL_MANAGER * m_toolManager
Definition: tools_holder.h:170
TOOL_DISPATCHER * m_toolDispatcher
Definition: tools_holder.h:172
TOOL_MANAGER * GetToolManager() const
Return the MVC controller.
Definition: tools_holder.h:54
ACTIONS * m_actions
Definition: tools_holder.h:171
@ GAL_SWITCH
Rendering engine changes.
Definition: tool_base.h:81
Master controller class:
Definition: tool_manager.h:55
bool RunAction(const std::string &aActionName, bool aNow=false, T aParam=NULL)
Run the specified action.
Definition: tool_manager.h:142
void DeactivateTool()
Deactivate the currently active tool.
bool InvokeTool(TOOL_ID aToolId)
Call a tool by sending a tool activation event to tool of given ID.
ACTION_MANAGER * GetActionManager() const
Definition: tool_manager.h:196
void ResetTools(TOOL_BASE::RESET_REASON aReason)
Reset all tools (i.e.
void RegisterTool(TOOL_BASE *aTool)
Add a tool to the manager set and sets it up.
void SetEnvironment(EDA_ITEM *aModel, KIGFX::VIEW *aView, KIGFX::VIEW_CONTROLS *aViewControls, APP_SETTINGS_BASE *aSettings, TOOLS_HOLDER *aFrame)
Set the work environment (model, view, view controls and the parent window).
void InitTools()
Initializes all registered tools.
void ShutdownAllTools()
Shutdown all tools with a currently registered event loop in this tool manager by waking them up with...
wxString MessageTextFromValue(double aValue, bool aAddUnitLabel=true, EDA_DATA_TYPE aType=EDA_DATA_TYPE::DISTANCE)
A lower-precision version of StringFromValue().
#define _(s)
#define KICAD_DEFAULT_DRAWFRAME_STYLE
@ FRAME_GERBER
Definition: frame_type.h:53
#define CHECK(x)
#define NO_AVAILABLE_LAYERS
#define GERBVIEW_FRAME_NAME
The main window used in GerbView.
@ ID_GERBVIEW_JOB_FILE_LIST_CLEAR
Definition: gerbview_id.h:62
@ ID_GERBVIEW_DRILL_FILE1
Definition: gerbview_id.h:54
@ ID_GERBVIEW_ZIP_FILE_LIST_CLEAR
Definition: gerbview_id.h:68
@ ID_GERBVIEW_JOB_FILE1
Definition: gerbview_id.h:60
@ ID_GERBVIEW_ZIP_FILE1
Definition: gerbview_id.h:66
@ ID_GERBVIEW_DRILL_FILE_LIST_CLEAR
Definition: gerbview_id.h:56
const std::vector< std::string > GerberFileExtensions
Gerber files extensions Kicad is to open.
const std::string GerberJobFileExtension
const std::string DrillFileExtension
const std::string ArchiveFileExtension
#define DEFAULT_FILE_HISTORY_SIZE
IDs range for menuitems file history: The default range file history size is 9 (compatible with defau...
Definition: id.h:69
@ LAYER_GERBVIEW_DRAWINGSHEET
Definition: layer_ids.h:417
@ LAYER_GERBVIEW_BACKGROUND
Definition: layer_ids.h:416
@ LAYER_DCODES
Definition: layer_ids.h:412
@ LAYER_NEGATIVE_OBJECTS
Definition: layer_ids.h:413
@ LAYER_GERBVIEW_PAGE_LIMITS
Definition: layer_ids.h:418
@ LAYER_GERBVIEW_GRID
Definition: layer_ids.h:414
#define GERBER_DCODE_LAYER(x)
Definition: layer_ids.h:425
@ LAYER_DRAWINGSHEET
drawingsheet frame and titleblock
Definition: layer_ids.h:217
#define GERBER_DRAWLAYERS_COUNT
Definition: layer_ids.h:402
#define GERBER_DRAW_LAYER(x)
Definition: layer_ids.h:423
@ REPAINT
Item needs to be redrawn.
Definition: view_item.h:52
@ ALL
All except INITIAL_ADD.
Definition: view_item.h:53
@ TARGET_NONCACHED
Auxiliary rendering target (noncached)
Definition: definitions.h:49
@ TARGET_CACHED
Main rendering target (cached)
Definition: definitions.h:48
bool EnsureTextCtrlWidth(wxTextCtrl *aCtrl, const wxString *aString=nullptr)
Set the minimum pixel width on a text control in order to make a text string be fully visible within ...
Definition: ui_common.cpp:156
see class PGM_BASE
void Format(OUTPUTFORMATTER *out, int aNestLevel, int aCtl, const CPTREE &aTree)
Output a PTREE into s-expression format via an OUTPUTFORMATTER derivative.
Definition: ptree.cpp:200
static LIB_SYMBOL * dummy()
Used to draw a dummy shape when a LIB_SYMBOL is not found in library.
Definition: sch_symbol.cpp:74
KIWAY Kiway & Pgm(), KFCTL_STANDALONE
The global Program "get" accessor.
Definition: single_top.cpp:111
const double IU_PER_MILS
Definition: base_units.h:78
std::vector< wxString > sizes
Definition: app_settings.h:53
GRID_SETTINGS grid
Definition: app_settings.h:90
std::vector< double > zoom_factors
Definition: app_settings.h:87
VECTOR2< double > VECTOR2D
Definition: vector2d.h:617
Definition of file extensions used in Kicad.
#define ZOOM_LIST_GERBVIEW
Definition: zoom_defines.h:29