KiCad PCB EDA Suite
Loading...
Searching...
No Matches
eda_draw_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) 2004-2017 Jean-Pierre Charras, jp.charras at wanadoo.fr
5 * Copyright (C) 2008 Wayne Stambaugh <[email protected]>
6 * Copyright The KiCad Developers, see AUTHORS.txt for contributors.
7 *
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License
10 * as published by the Free Software Foundation; either version 2
11 * of the License, or (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program. If not, see <https://www.gnu.org/licenses/>.
20 */
21
23#include <base_screen.h>
24#include <bitmaps.h>
25#include <bitmap_store.h>
26#include <confirm.h>
27#include <core/arraydim.h>
28#include <core/kicad_algo.h>
29#include <dialog_shim.h>
31#include <eda_draw_frame.h>
32#include <eda_search_data.h>
33#include <file_history.h>
35#include <id.h>
36#include <kiface_base.h>
37#include <kiplatform/ui.h>
38#include <lockfile.h>
39#include <macros.h>
40#include <math/vector2wx.h>
41#include <page_info.h>
42#include <paths.h>
43#include <pgm_base.h>
44#include <reporter.h>
45#include <render_settings.h>
50#include <title_block.h>
51#include <tool/actions.h>
52#include <tool/action_toolbar.h>
53#include <tool/common_tools.h>
54#include <tool/grid_helper.h>
55#include <tool/grid_menu.h>
58#include <tool/tool_manager.h>
59#include <tool/tool_menu.h>
60#include <tool/zoom_menu.h>
61#include <trace_helpers.h>
62#include <view/view.h>
64#include <view/view_controls.h>
65#include <widgets/kistatusbar.h>
66#include <widgets/msgpanel.h>
71#include <project.h>
72#include <wx/event.h>
73#include <widgets/ui_common.h>
74#include <widgets/search_pane.h>
75#include <wx/dirdlg.h>
76#include <wx/filedlg.h>
77#include <wx/debug.h>
78#include <wx/socket.h>
79
80#include <wx/fdrepdlg.h>
82
83#define FR_HISTORY_LIST_CNT 10
84
85
86BEGIN_EVENT_TABLE( EDA_DRAW_FRAME, KIWAY_PLAYER )
89
90 EVT_ACTIVATE( EDA_DRAW_FRAME::onActivate )
91END_EVENT_TABLE()
92
93
94std::set<EDA_DRAW_PANEL_GAL::GAL_TYPE> EDA_DRAW_FRAME::m_failedCanvases;
95
96
97EDA_DRAW_FRAME::EDA_DRAW_FRAME( KIWAY* aKiway, wxWindow* aParent, FRAME_T aFrameType,
98 const wxString& aTitle, const wxPoint& aPos, const wxSize& aSize,
99 long aStyle, const wxString& aFrameName, const EDA_IU_SCALE& aIuScale ) :
100 KIWAY_PLAYER( aKiway, aParent, aFrameType, aTitle, aPos, aSize, aStyle, aFrameName, aIuScale ),
101 m_socketServer( nullptr ),
103{
104 m_gridSelectBox = nullptr;
105 m_zoomSelectBox = nullptr;
106 m_zoomCustomEntry = wxNOT_FOUND;
107 m_overrideLocksCb = nullptr;
108 m_searchPane = nullptr;
110
112 m_canvas = nullptr;
113 m_toolDispatcher = nullptr;
114 m_messagePanel = nullptr;
115 m_currentScreen = nullptr;
116 m_showBorderAndTitleBlock = false; // true to display reference sheet.
117 m_gridColor = COLOR4D( DARKGRAY ); // Default grid color
118 m_drawBgColor = COLOR4D( BLACK ); // the background color of the draw canvas:
119 // BLACK for Pcbnew, BLACK or WHITE for Eeschema
120 m_colorSettings = nullptr;
121 m_polarCoords = false;
122 m_findReplaceData = std::make_unique<EDA_SEARCH_DATA>();
123 m_hotkeyPopup = nullptr;
124 m_propertiesPanel = nullptr;
125 m_netInspectorPanel = nullptr;
126 m_gitCommitPane = nullptr;
127
129
130 m_auimgr.SetFlags( wxAUI_MGR_DEFAULT );
131
132 if( ( aStyle & wxFRAME_NO_TASKBAR ) == 0 )
133 {
134 CreateStatusBar( 8 )->SetDoubleBuffered( true );
135
136 GetStatusBar()->SetFont( KIUI::GetStatusFont( this ) );
137
138 // set the size of the status bar subwindows:
140 }
141
142 m_messagePanel = new EDA_MSG_PANEL( this, -1, wxPoint( 0, m_frameSize.y ), wxDefaultSize );
143 m_messagePanel->SetBackgroundColour( COLOR4D( LIGHTGRAY ).ToColour() );
144 m_msgFrameHeight = m_messagePanel->GetBestSize().y;
145
146 // Create child subwindows.
147 GetClientSize( &m_frameSize.x, &m_frameSize.y );
148 m_framePos.x = m_framePos.y = 0;
150
152
153 Bind( wxEVT_DPI_CHANGED,
154 [&]( wxDPIChangedEvent& aEvent )
155 {
156 if( ( GetWindowStyle() & wxFRAME_NO_TASKBAR ) == 0 )
158
159 wxMoveEvent dummy;
160 OnMove( dummy );
161
162 // we need to kludge the msg panel to the correct size again
163 // especially important even for first launches as the constructor of the window
164 // here usually doesn't have the correct dpi awareness yet
166 m_msgFrameHeight = m_messagePanel->GetBestSize().y;
168
169 m_messagePanel->SetPosition( wxPoint( 0, m_frameSize.y ) );
171
172 aEvent.Skip();
173 } );
174}
175
176
178{
179 if( m_failedCanvases.empty() )
181
182 delete m_actions;
183 delete m_toolManager;
184 delete m_toolDispatcher;
185 delete m_canvas;
186
187 delete m_currentScreen;
188 m_currentScreen = nullptr;
189
190 m_auimgr.UnInit();
191
192 ReleaseFile();
193}
194
195
200
201
203{
205
206 // Grid selection
207 auto gridSelectorFactory =
208 [this]( ACTION_TOOLBAR* aToolbar )
209 {
210 if( !m_gridSelectBox )
211 m_gridSelectBox = new wxChoice( aToolbar, ID_ON_GRID_SELECT );
212
214
215 aToolbar->Add( m_gridSelectBox );
216 };
217
219
220 // Zoom selection
221 auto zoomSelectorFactory =
222 [this]( ACTION_TOOLBAR* aToolbar )
223 {
224 if( !m_zoomSelectBox )
225 m_zoomSelectBox = new wxChoice( aToolbar, ID_ON_ZOOM_SELECT );
226
228 aToolbar->Add( m_zoomSelectBox );
229 };
230
232
233 auto overrideLocksFactory =
234 [this]( ACTION_TOOLBAR* aToolbar )
235 {
236 if( !m_overrideLocksCb )
237 {
238 m_overrideLocksCb = new wxCheckBox( aToolbar, ID_ON_OVERRIDE_LOCKS, _( "Override locks" ) );
239
240 // Clicking the checkbox takes focus off the canvas, so return it
241 m_overrideLocksCb->Bind( wxEVT_CHECKBOX,
242 [this]( wxCommandEvent& aEvent )
243 {
244 if( m_toolManager )
246
247 if( m_canvas )
248 m_canvas->SetFocus();
249
250 aEvent.Skip();
251 } );
252 }
253
254 aToolbar->Add( m_overrideLocksCb );
255 };
256
258}
259
260
262{
263 switch( aId )
264 {
265 case ID_ON_GRID_SELECT: m_gridSelectBox = nullptr; break;
266 case ID_ON_ZOOM_SELECT: m_zoomSelectBox = nullptr; break;
267 case ID_ON_OVERRIDE_LOCKS: m_overrideLocksCb = nullptr; break;
268 }
269}
270
271
273{
274 if( m_file_checker )
275 m_file_checker->UnlockFile();
276}
277
278
279bool EDA_DRAW_FRAME::LockFile( const wxString& aFileName )
280{
281 // We need to explicitly reset here to get the deletion before we create a new unique_ptr that
282 // may be for the same file.
283 m_file_checker.reset();
284
285 m_file_checker = std::make_unique<LOCKFILE>( aFileName );
286
287 // If the file is valid, return true. This could mean that the file is locked or it could mean
288 // that the file is read-only.
289 return m_file_checker->Valid();
290}
291
292
294{
295 // Notify all tools the units have changed
296 if( m_toolManager )
298
302
303 switch( GetUserUnits() )
304 {
305 default:
309 }
310}
311
312
314{
315 if( m_toolManager->GetTool<COMMON_TOOLS>() )
316 {
318 m_toolManager->GetTool<COMMON_TOOLS>()->ToggleUnits( dummy );
319 }
320 else
321 {
324
325 wxCommandEvent e( EDA_EVT_UNITS_CHANGED );
326 ProcessEventLocally( e );
327 }
328}
329
330
332{
334
335 COMMON_SETTINGS* settings = Pgm().GetCommonSettings();
337
338 if( m_supportsAutoSave && m_autoSaveTimer->IsRunning() )
339 {
340 if( GetAutoSaveInterval() > 0 )
341 {
342 m_autoSaveTimer->Start( GetAutoSaveInterval() * 1000, wxTIMER_ONE_SHOT );
343 }
344 else
345 {
346 m_autoSaveTimer->Stop();
347 m_autoSavePending = false;
348 }
349 }
350
351 viewControls->LoadSettings();
353
354 m_galDisplayOptions.ReadCommonConfig( *settings, this );
355
358
359 if( m_lastToolbarIconSize == 0
361 {
364 }
365
366 // A rendering engine change in Preferences applies in place
368
369 // Version control can have just been turned on or off.
371
372 if( m_gitCommitPane )
373 m_gitCommitPane->ReloadAdvancedWindow();
374
375 // Notify all tools the preferences have changed
376 if( m_toolManager )
378}
379
380
382{
383 if( m_messagePanel )
384 m_messagePanel->EraseMsgBox();
385}
386
387
389{
392
393 if( m_gridSelectBox == nullptr )
394 return;
395
396 // Update grid values with the current units setting.
397 m_gridSelectBox->Clear();
398 wxArrayString gridsList;
399
400 wxCHECK( config(), /* void */ );
401
402 GRID_MENU::BuildChoiceList( &gridsList, GetWindowSettings( config() ), this );
403
404 for( const wxString& grid : gridsList )
405 m_gridSelectBox->Append( grid );
406
407 m_gridSelectBox->Append( wxT( "---" ) );
408 m_gridSelectBox->Append( _( "Edit Grids..." ) );
409
410 m_gridSelectBox->SetSelection( GetWindowSettings( config() )->grid.last_size_idx );
411}
412
413
414void EDA_DRAW_FRAME::OnUpdateSelectGrid( wxUpdateUIEvent& aEvent )
415{
416 // No need to update the grid select box if it doesn't exist or the grid setting change
417 // was made using the select box.
418 if( m_gridSelectBox == nullptr )
419 return;
420
421 wxCHECK( config(), /* void */ );
422
424 idx = std::clamp( idx, 0, (int) m_gridSelectBox->GetCount() - 1 );
425
426 if( idx != m_gridSelectBox->GetSelection() )
427 m_gridSelectBox->SetSelection( idx );
428}
429
430
431
432void EDA_DRAW_FRAME::OnUpdateSelectZoom( wxUpdateUIEvent& aEvent )
433{
435}
436
437
439{
440 if( m_zoomSelectBox == nullptr )
441 return;
442
443 double zoom = GetCanvas()->GetGAL()->GetZoomFactor();
444
445 wxCHECK( config(), /* void */ );
446
447 const std::vector<double>& zoomList = GetWindowSettings( config() )->zoom_factors;
448 int preset = wxNOT_FOUND;
449
450 for( size_t jj = 0; jj < zoomList.size(); ++jj )
451 {
452 if( zoomList[jj] == zoom )
453 {
454 preset = (int) jj + 1; // index 0 is Zoom Auto
455 break;
456 }
457 }
458
459 if( preset != wxNOT_FOUND )
460 {
461 // Zoom is on a preset, so drop the custom entry and select the preset.
462 if( m_zoomCustomEntry != wxNOT_FOUND )
463 {
465 m_zoomCustomEntry = wxNOT_FOUND;
466 }
467
468 if( m_zoomSelectBox->GetSelection() != preset )
469 m_zoomSelectBox->SetSelection( preset );
470 }
471 else
472 {
473 // Off-preset zoom, show the exact value in its own entry just below Zoom Auto.
474 wxString text = wxString::Format( _( "Zoom %.2f" ), zoom );
475
476 if( m_zoomCustomEntry == wxNOT_FOUND )
477 m_zoomCustomEntry = m_zoomSelectBox->Insert( text, 1 );
478 else if( m_zoomSelectBox->GetString( m_zoomCustomEntry ) != text )
480
481 if( m_zoomSelectBox->GetSelection() != m_zoomCustomEntry )
482 m_zoomSelectBox->SetSelection( m_zoomCustomEntry );
483 }
484}
485
486
487void EDA_DRAW_FRAME::OnSelectGrid( wxCommandEvent& event )
488{
489 wxCHECK_RET( m_gridSelectBox, wxS( "m_gridSelectBox uninitialized" ) );
490
491 int idx = m_gridSelectBox->GetCurrentSelection();
492
493 if( idx == int( m_gridSelectBox->GetCount() ) - 2 )
494 {
495 // wxWidgets will check the separator, which we don't want.
496 // Re-check the current grid.
497 wxUpdateUIEvent dummy;
499 }
500 else if( idx == int( m_gridSelectBox->GetCount() ) - 1 )
501 {
502 // wxWidgets will check the Grid Settings... entry, which we don't want.
503 // Re-check the current grid.
504 wxUpdateUIEvent dummy;
506
507 // Give a time-slice to close the menu before opening the dialog.
508 // (Only matters on some versions of GTK.)
509 wxSafeYield();
510
512 }
513 else
514 {
515 m_toolManager->RunAction( ACTIONS::gridPreset, idx );
516 }
517
519 m_canvas->Refresh();
520
521 // Needed on Windows because clicking on m_gridSelectBox remove the focus from m_canvas
522 // (Windows specific
523 m_canvas->SetFocus();
524}
525
526
528{
530 return m_overrideLocksCb->GetValue();
531
532 return false;
533}
534
535
537{
538 APP_SETTINGS_BASE* cfg = config();
539
540 if( !cfg )
541 return true;
542
543 return GetWindowSettings( cfg )->grid.show;
544}
545
546
548{
549 wxCHECK( config(), /* void */ );
550
551 GetWindowSettings( config() )->grid.show = aVisible;
552
553 // Update the display with the new grid
554 if( GetCanvas() )
555 {
556 // Check to ensure these exist, since this function could be called before
557 // the GAL and View have been created
558 if( GetCanvas()->GetGAL() )
559 GetCanvas()->GetGAL()->SetGridVisibility( aVisible );
560
561 if( GetCanvas()->GetView() )
563
564 GetCanvas()->Refresh();
565 }
566}
567
568
570{
571 APP_SETTINGS_BASE* cfg = config();
572
573 if( !cfg )
574 return false;
575
577}
578
579
581{
582 wxCHECK( config(), /* void */ );
583
585}
586
587
588std::unique_ptr<GRID_HELPER> EDA_DRAW_FRAME::MakeGridHelper()
589{
590 return nullptr;
591}
592
593
595{
596 if( m_zoomSelectBox == nullptr )
597 return;
598
599 double zoom = m_canvas->GetGAL()->GetZoomFactor();
600
601 m_zoomSelectBox->Clear();
602 m_zoomSelectBox->Append( _( "Zoom Auto" ) );
603 m_zoomSelectBox->SetSelection( 0 );
604 m_zoomCustomEntry = wxNOT_FOUND;
605
606 wxCHECK( config(), /* void */ );
607
608 for( unsigned ii = 0; ii < GetWindowSettings( config() )->zoom_factors.size(); ++ii )
609 {
610 double current = GetWindowSettings( config() )->zoom_factors[ii];
611
612 m_zoomSelectBox->Append( wxString::Format( _( "Zoom %.2f" ), current ) );
613
614 if( zoom == current )
615 m_zoomSelectBox->SetSelection( (int) ii + 1 );
616 }
617}
618
619
620void EDA_DRAW_FRAME::OnSelectZoom( wxCommandEvent& event )
621{
622 wxCHECK_RET( m_zoomSelectBox, wxS( "m_zoomSelectBox uninitialized" ) );
623
624 int id = m_zoomSelectBox->GetCurrentSelection();
625
626 if( id < 0 || id >= (int) m_zoomSelectBox->GetCount() )
627 return;
628
629 // Picking the custom entry means keep the current zoom, so nothing to do.
630 if( id == m_zoomCustomEntry )
631 return;
632
633 // The custom entry pushes the presets down by one, so shift back to the real preset id.
634 int preset = id;
635
636 if( m_zoomCustomEntry != wxNOT_FOUND && id > m_zoomCustomEntry )
637 preset = id - 1;
638
639 m_toolManager->RunAction( ACTIONS::zoomPreset, preset );
641 m_canvas->Refresh();
642
643 // Needed on Windows (only) because clicking on m_zoomSelectBox removes the focus from m_canvas
644 m_canvas->SetFocus();
645}
646
647
648void EDA_DRAW_FRAME::OnMove( wxMoveEvent& aEvent )
649{
650 // If the window is moved to a different display, the scaling factor may change
651 double oldFactor = m_galDisplayOptions.m_scaleFactor;
652 m_galDisplayOptions.UpdateScaleFactor();
653
654 if( oldFactor != m_galDisplayOptions.m_scaleFactor && m_canvas )
655 {
656 // wx has not laid the frame out for the new DPI yet, so defer until the canvas has
657 // reached its final size
658 EDA_DRAW_PANEL_GAL* canvas = GetCanvas();
659
660 canvas->CallAfter( [canvas]() { canvas->ResizeGal( true ); } );
661 }
662
663 aEvent.Skip();
664}
665
666
668{
669 COMMON_TOOLS* commonTools = m_toolManager->GetTool<COMMON_TOOLS>();
670 CONDITIONAL_MENU& aMenu = aToolMenu.GetMenu();
671
672 aMenu.AddSeparator( 1000 );
673
674 std::shared_ptr<ZOOM_MENU> zoomMenu = std::make_shared<ZOOM_MENU>( this );
675 zoomMenu->SetTool( commonTools );
676 aToolMenu.RegisterSubMenu( zoomMenu );
677
678 std::shared_ptr<GRID_MENU> gridMenu = std::make_shared<GRID_MENU>( this );
679 gridMenu->SetTool( commonTools );
680 aToolMenu.RegisterSubMenu( gridMenu );
681
682 aMenu.AddMenu( zoomMenu.get(), SELECTION_CONDITIONS::ShowAlways, 1000 );
683 aMenu.AddMenu( gridMenu.get(), SELECTION_CONDITIONS::ShowAlways, 1000 );
684}
685
686
687void EDA_DRAW_FRAME::DisplayToolMsg( const wxString& msg )
688{
689 if( m_isClosing )
690 return;
691
692 SetStatusText( msg, 6 );
693}
694
695
696void EDA_DRAW_FRAME::DisplayConstraintsMsg( const wxString& msg )
697{
698 if( m_isClosing )
699 return;
700
701 SetStatusText( msg, 7 );
702}
703
704
706{
707 if( m_isClosing )
708 return;
709
710 wxString msg;
711
712 GRID_SETTINGS& gridSettings = GetWindowSettings( config() )->grid;
713 int currentIdx = gridSettings.last_size_idx;
714
715 msg.Printf( _( "grid %s" ), gridSettings.grids[currentIdx].UserUnitsMessageText( this, false ) );
716
717 SetStatusText( msg, 4 );
718}
719
720
722{
723 if( m_isClosing )
724 return;
725
726 wxString msg;
727
728 switch( GetUserUnits() )
729 {
730 case EDA_UNITS::INCH: msg = _( "inches" ); break;
731 case EDA_UNITS::MILS: msg = _( "mils" ); break;
732 case EDA_UNITS::MM: msg = _( "mm" ); break;
733 default: msg = _( "Units" ); break;
734 }
735
736 SetStatusText( msg, 5 );
737}
738
739
740void EDA_DRAW_FRAME::OnSize( wxSizeEvent& SizeEv )
741{
742 EDA_BASE_FRAME::OnSize( SizeEv );
743
744 m_frameSize = GetClientSize( );
745
746 SizeEv.Skip();
747}
748
749
751{
752 constexpr int numLocalFields = 8;
753
754 wxStatusBar* stsbar = GetStatusBar();
755 int spacer = KIUI::GetTextSize( wxT( "M" ), stsbar ).x;
756
757 // Note this is a KISTATUSBAR and there are fields to the right of the ones we know about
758 int totalFields = stsbar->GetFieldsCount();
759
760 std::vector<int> dims = {
761 // remainder of status bar on far left is set to a default or whatever is left over.
762 -2,
763
764 // When using GetTextSize() remember the width of character '1' is not the same
765 // as the width of '0' unless the font is fixed width, and it usually won't be.
766
767 // zoom:
768 KIUI::GetTextSize( wxT( "Z 762000" ), stsbar ).x + spacer,
769
770 // cursor coords
771 KIUI::GetTextSize( wxT( "X 00000.0000 Y 00000.0000" ), stsbar ).x + spacer,
772
773 // delta distances
774 KIUI::GetTextSize( wxT( "dx 00000.0000 dy 00000.0000 dist 00000.0000" ), stsbar ).x + spacer,
775
776 // grid size
777 KIUI::GetTextSize( wxT( "grid 0000.0000 x 0000.0000" ), stsbar ).x + spacer,
778
779 // units display, Inches is bigger than mm
780 KIUI::GetTextSize( _( "Inches" ), stsbar ).x + spacer,
781
782 // Size for the "Current Tool" panel
783 -1,
784
785 // constraint mode
786 KIUI::GetTextSize( _( "Constrain to H, V, 45" ), stsbar).x + spacer
787 };
788
789 for( int idx = numLocalFields; idx < totalFields; ++idx )
790 dims.emplace_back( stsbar->GetStatusWidth( idx ) );
791
792 SetStatusWidths( dims.size(), dims.data() );
793}
794
795
796wxStatusBar* EDA_DRAW_FRAME::OnCreateStatusBar( int number, long style, wxWindowID id, const wxString& name )
797{
798 return new KISTATUSBAR( number, this, id, KISTATUSBAR::STYLE_FLAGS::WARNING_ICON );
799}
800
801
803{
804 if( m_isClosing )
805 return;
806
807 SetStatusText( GetZoomLevelIndicator(), 1 );
808
809 // Update-UI events come at most every m_UpdateUIEventInterval, so the last step of a zoom
810 // could leave the box one step behind the status bar until the mouse moves
812
813 // Absolute and relative cursor positions are handled by overloading this function and
814 // handling the internal to user units conversion at the appropriate level.
815
816 // refresh units display
818}
819
820
822{
823 // returns a human readable value which can be displayed as zoom
824 // level indicator in dialogs.
825 double zoom = m_canvas->GetGAL()->GetZoomFactor();
826 return wxString::Format( wxT( "Z %.2f" ), zoom );
827}
828
829
831{
833
835 WINDOW_SETTINGS* window = GetWindowSettings( aCfg );
836
837 // Read units used in dialogs and toolbars
838 SetUserUnits( static_cast<EDA_UNITS>( aCfg->m_System.units ) );
839
841
842 m_galDisplayOptions.ReadConfig( *cmnCfg, *window, this );
843
844 m_findReplaceData->findString = aCfg->m_FindReplace.find_string;
845 m_findReplaceData->replaceString = aCfg->m_FindReplace.replace_string;
846 m_findReplaceData->matchMode = static_cast<EDA_SEARCH_MATCH_MODE>( aCfg->m_FindReplace.match_mode );
847 m_findReplaceData->matchCase = aCfg->m_FindReplace.match_case;
848 m_findReplaceData->searchAndReplace = aCfg->m_FindReplace.search_and_replace;
849
850 for( const wxString& s : aCfg->m_FindReplace.find_history )
852
853 for( const wxString& s : aCfg->m_FindReplace.replace_history )
855
857}
858
859
861{
863
864 WINDOW_SETTINGS* window = GetWindowSettings( aCfg );
865
866 aCfg->m_System.units = static_cast<int>( GetUserUnits() );
868
869 m_galDisplayOptions.WriteConfig( *window );
870
871 aCfg->m_FindReplace.search_and_replace = m_findReplaceData->searchAndReplace;
872
873 aCfg->m_FindReplace.find_string = m_findReplaceData->findString;
874 aCfg->m_FindReplace.replace_string = m_findReplaceData->replaceString;
875
876 aCfg->m_FindReplace.find_history.clear();
877 aCfg->m_FindReplace.replace_history.clear();
878
879 for( size_t i = 0; i < m_findStringHistoryList.GetCount() && i < FR_HISTORY_LIST_CNT; i++ )
880 aCfg->m_FindReplace.find_history.push_back( m_findStringHistoryList[ i ].ToStdString() );
881
882 for( size_t i = 0; i < m_replaceStringHistoryList.GetCount() && i < FR_HISTORY_LIST_CNT; i++ )
883 aCfg->m_FindReplace.replace_history.push_back( m_replaceStringHistoryList[ i ].ToStdString() );
884
885 // Save the units used in this frame
886 if( m_toolManager )
887 {
888 if( COMMON_TOOLS* cmnTool = m_toolManager->GetTool<COMMON_TOOLS>() )
889 {
890 aCfg->m_System.last_imperial_units = static_cast<int>( cmnTool->GetLastImperialUnits() );
891 aCfg->m_System.last_metric_units = static_cast<int>( cmnTool->GetLastMetricUnits() );
892 }
893 }
894}
895
896
897void EDA_DRAW_FRAME::AppendMsgPanel( const wxString& aTextUpper, const wxString& aTextLower, int aPadding )
898{
900 m_messagePanel->AppendMessage( aTextUpper, aTextLower, aPadding );
901}
902
903
905{
907 m_messagePanel->EraseMsgBox();
908}
909
910
911void EDA_DRAW_FRAME::SetMsgPanel( const std::vector<MSG_PANEL_ITEM>& aList )
912{
914 {
915 m_messagePanel->EraseMsgBox();
916
917 for( const MSG_PANEL_ITEM& item : aList )
918 m_messagePanel->AppendMessage( item );
919 }
920}
921
922
923void EDA_DRAW_FRAME::SetMsgPanel( const wxString& aTextUpper, const wxString& aTextLower, int aPadding )
924{
926 {
927 m_messagePanel->EraseMsgBox();
928 m_messagePanel->AppendMessage( aTextUpper, aTextLower, aPadding );
929 }
930}
931
932
934{
935 wxCHECK_RET( aItem, wxT( "Invalid EDA_ITEM pointer. Bad programmer." ) );
936
937 std::vector<MSG_PANEL_ITEM> items;
938 aItem->GetMsgPanelInfo( this, items );
939 SetMsgPanel( items );
940}
941
942
946
947
949{
950 GetCanvas()->SetEvtHandlerEnabled( true );
952}
953
954
962
963
965{
967
968 if( COMMON_SETTINGS* cfg = Pgm().GetCommonSettings() )
969 canvasType = EDA_DRAW_PANEL_GAL::ResolveStoredCanvasType( cfg->m_Graphics.canvas_type );
970
971 wxString envCanvasType;
972
973 if( wxGetEnv( "KICAD_SOFTWARE_RENDERING", &envCanvasType ) )
974 {
975 if( envCanvasType.CmpNoCase( "1" ) == 0
976 || envCanvasType.CmpNoCase( "true" ) == 0
977 || envCanvasType.CmpNoCase( "yes" ) == 0 )
978 {
979 // Force software rendering if the environment variable is set
981 }
982 }
983
984#ifdef __WXMAC__
985 // Cairo doesn't handle Retina displays, so it is not a valid screen backend on Mac
986 if( canvasType == EDA_DRAW_PANEL_GAL::GAL_TYPE_CAIRO )
988#endif
989
990 return canvasType;
991}
992
993
995{
996 // Not all classes derived from EDA_DRAW_FRAME can save the canvas type, because some
997 // have a fixed type, or do not have a option to set the canvas type (they inherit from
998 // a parent frame)
999 static std::vector<FRAME_T> s_allowedFrames = { FRAME_SCH,
1005
1006 if( !alg::contains( s_allowedFrames, m_ident ) )
1007 return false;
1008
1009 if( wxGetEnv( "KICAD_SOFTWARE_RENDERING", nullptr ) )
1010 {
1011 // If the environment variable is set, don't save the canvas type.
1012 return false;
1013 }
1014
1015 if( aCanvasType < EDA_DRAW_PANEL_GAL::GAL_TYPE_NONE || aCanvasType >= EDA_DRAW_PANEL_GAL::GAL_TYPE_LAST )
1016 {
1017 wxASSERT( false );
1018 return false;
1019 }
1020
1021 if( COMMON_SETTINGS* cfg = Pgm().GetCommonSettings() )
1022 {
1023 cfg->m_Graphics.canvas_type = static_cast<int>( aCanvasType );
1024 return true;
1025 }
1026
1027 return false;
1028}
1029
1030
1032{
1033 const VECTOR2I& gridOrigin = GetGridOrigin();
1034 VECTOR2D gridSize = GetCanvas()->GetGAL()->GetGridSize();
1035
1036 double xOffset = fmod( gridOrigin.x, gridSize.x );
1037 int x = KiROUND( (aPosition.x - xOffset) / gridSize.x );
1038 double yOffset = fmod( gridOrigin.y, gridSize.y );
1039 int y = KiROUND( (aPosition.y - yOffset) / gridSize.y );
1040
1041 return KiROUND( x * gridSize.x + xOffset, y * gridSize.y + yOffset );
1042}
1043
1044
1046{
1047 const VECTOR2I& gridOrigin = GetGridOrigin();
1048 VECTOR2D gridSize = GetCanvas()->GetGAL()->GetGridSize() / 2.0;
1049
1050 double xOffset = fmod( gridOrigin.x, gridSize.x );
1051 int x = KiROUND( (aPosition.x - xOffset) / gridSize.x );
1052 double yOffset = fmod( gridOrigin.y, gridSize.y );
1053 int y = KiROUND( (aPosition.y - yOffset) / gridSize.y );
1054
1055 return KiROUND( x * gridSize.x + xOffset, y * gridSize.y + yOffset );
1056}
1057
1058
1059const BOX2I EDA_DRAW_FRAME::GetDocumentExtents( bool aIncludeAllVisible ) const
1060{
1061 return BOX2I();
1062}
1063
1064
1066{
1067 // To be implemented by subclasses.
1068}
1069
1070
1071void EDA_DRAW_FRAME::Zoom_Automatique( bool aWarpPointer )
1072{
1074}
1075
1076
1077std::vector<wxWindow*> EDA_DRAW_FRAME::findDialogs()
1078{
1079 std::vector<wxWindow*> dialogs;
1080
1081 for( wxWindow* window : GetChildren() )
1082 {
1083 if( dynamic_cast<DIALOG_SHIM*>( window ) )
1084 dialogs.push_back( window );
1085 }
1086
1087 return dialogs;
1088}
1089
1090
1091void EDA_DRAW_FRAME::FocusOnLocation( const VECTOR2I& aPos, bool aAllowScroll )
1092{
1093 bool centerView = false;
1094 std::vector<BOX2D> dialogScreenRects;
1095
1096 if( aAllowScroll )
1097 {
1098 BOX2D r = GetCanvas()->GetView()->GetViewport();
1099
1100 // Center if we're off the current view, or within 10% of its edge
1101 r.Inflate( - r.GetWidth() / 10.0 );
1102
1103 if( !r.Contains( aPos ) )
1104 centerView = true;
1105
1106 for( wxWindow* dialog : findDialogs() )
1107 {
1108 dialogScreenRects.emplace_back( ToVECTOR2D( GetCanvas()->ScreenToClient( dialog->GetScreenPosition() ) ),
1109 ToVECTOR2D( dialog->GetSize() ) );
1110 }
1111
1112 // Center if we're behind an obscuring dialog, or within 10% of its edge
1113 for( BOX2D rect : dialogScreenRects )
1114 {
1115 rect.Inflate( rect.GetWidth() / 10 );
1116
1117 if( rect.Contains( GetCanvas()->GetView()->ToScreen( aPos ) ) )
1118 centerView = true;
1119 }
1120 }
1121
1122 if( centerView )
1123 {
1124 try
1125 {
1126 GetCanvas()->GetView()->SetCenter( aPos, dialogScreenRects );
1127 }
1128 catch( const Clipper2Lib::Clipper2Exception& e )
1129 {
1130 wxFAIL_MSG( wxString::Format( wxT( "Clipper2 exception occurred centering object: %s" ), e.what() ) );
1131 }
1132 }
1133
1135}
1136
1137
1138void PrintDrawingSheet( const RENDER_SETTINGS* aSettings, const PAGE_INFO& aPageInfo,
1139 const wxString& aSheetName, const wxString& aSheetPath,
1140 const wxString& aFileName, const TITLE_BLOCK& aTitleBlock,
1141 const std::map<wxString, wxString>* aProperties, int aSheetCount,
1142 const wxString& aPageNumber, double aMils2Iu, const PROJECT* aProject,
1143 const wxString& aSheetLayer, bool aIsFirstPage )
1144{
1145 DS_DRAW_ITEM_LIST drawList( unityScale );
1146
1147 drawList.SetDefaultPenSize( aSettings->GetDefaultPenWidth() );
1148 drawList.SetPlotterMilsToIUfactor( aMils2Iu );
1149 drawList.SetPageNumber( aPageNumber );
1150 drawList.SetSheetCount( aSheetCount );
1151 drawList.SetFileName( aFileName );
1152 drawList.SetSheetName( aSheetName );
1153 drawList.SetSheetPath( aSheetPath );
1154 drawList.SetSheetLayer( aSheetLayer );
1155 drawList.SetProject( aProject );
1156 drawList.SetIsFirstPage( aIsFirstPage );
1157 drawList.SetProperties( aProperties );
1158
1159 drawList.BuildDrawItemsList( aPageInfo, aTitleBlock );
1160
1161 // Draw item list
1162 drawList.Print( aSettings );
1163}
1164
1165
1167 const std::map<wxString, wxString>* aProperties,
1168 double aMils2Iu, const wxString &aFilename,
1169 const wxString &aSheetLayer )
1170{
1172 return;
1173
1174 wxDC* DC = aSettings->GetPrintDC();
1175 wxPoint origin = DC->GetDeviceOrigin();
1176
1177 if( origin.y > 0 )
1178 {
1179 DC->SetDeviceOrigin( 0, 0 );
1180 DC->SetAxisOrientation( true, false );
1181 }
1182
1184 aFilename, GetTitleBlock(), aProperties, aScreen->GetPageCount(),
1185 aScreen->GetPageNumber(), aMils2Iu, &Prj(), aSheetLayer,
1186 aScreen->GetVirtualPageNumber() == 1 );
1187
1188 if( origin.y > 0 )
1189 {
1190 DC->SetDeviceOrigin( origin.x, origin.y );
1191 DC->SetAxisOrientation( true, true );
1192 }
1193}
1194
1195
1197{
1198 // Virtual function. Base class implementation returns an empty string.
1199 return wxEmptyString;
1200}
1201
1202
1204{
1205 // Virtual function. Base class implementation returns an empty string.
1206 return wxEmptyString;
1207}
1208
1209
1210bool EDA_DRAW_FRAME::LibraryFileBrowser( const wxString& aTitle, bool doOpen, wxFileName& aFilename,
1211 const wxString& wildcard, const wxString& ext,
1212 bool isDirectory, FILEDLG_HOOK_NEW_LIBRARY* aFileDlgHook )
1213{
1214 aFilename.SetExt( ext );
1215
1216 wxString defaultDir = aFilename.GetPath();
1217
1218 if( defaultDir.IsEmpty() )
1219 defaultDir = GetMruPath();
1220
1221 if( isDirectory && doOpen )
1222 {
1223 wxDirDialog dlg( this, aTitle, defaultDir, wxDD_DEFAULT_STYLE | wxDD_DIR_MUST_EXIST );
1224
1225 if( dlg.ShowModal() == wxID_CANCEL )
1226 return false;
1227
1228 aFilename = dlg.GetPath();
1229 aFilename.SetExt( ext );
1230 }
1231 else
1232 {
1233 // Ensure the file has a dummy name, otherwise GTK will display the regex from the filter
1234 if( aFilename.GetName().empty() )
1235 aFilename.SetName( wxS( "Library" ) );
1236
1237 wxFileDialog dlg( this, aTitle, defaultDir, aFilename.GetFullName(), wildcard,
1238 doOpen ? wxFD_OPEN | wxFD_FILE_MUST_EXIST
1239 : wxFD_SAVE | wxFD_CHANGE_DIR | wxFD_OVERWRITE_PROMPT );
1240
1241 if( aFileDlgHook )
1242 dlg.SetCustomizeHook( *aFileDlgHook );
1243
1245
1246 if( dlg.ShowModal() == wxID_CANCEL )
1247 return false;
1248
1249 aFilename = dlg.GetPath();
1250 aFilename.SetExt( ext );
1251 }
1252
1253 SetMruPath( aFilename.GetPath() );
1254
1255 return true;
1256}
1257
1258
1260{
1262
1263 if( m_searchPane )
1264 {
1265 wxAuiPaneInfo& search_pane_info = m_auimgr.GetPane( m_searchPane );
1266 search_pane_info.Caption( _( "Search" ) );
1267 }
1268
1269 if( m_propertiesPanel )
1270 {
1271 wxAuiPaneInfo& properties_pane_info = m_auimgr.GetPane( m_propertiesPanel );
1272 properties_pane_info.Caption( _( "Properties" ) );
1273 }
1274
1276 {
1277 wxAuiPaneInfo& net_inspector_panel_info = m_auimgr.GetPane( m_netInspectorPanel );
1278 net_inspector_panel_info.Caption( _( "Net Inspector" ) );
1279 }
1280}
1281
1282
1284{
1285 if( m_isClosing || !m_propertiesPanel || !m_propertiesPanel->IsShownOnScreen() )
1286 return;
1287
1288 m_propertiesPanel->UpdateData();
1289}
1290
1291
1293{
1294 return m_gitCommitPane && m_auimgr.GetPane( GitCommitPaneName() ).IsShown();
1295}
1296
1297
1299{
1300 if( !m_gitCommitPane )
1301 return;
1302
1303 wxAuiPaneInfo& pane = m_auimgr.GetPane( GitCommitPaneName() );
1304 bool show = !pane.IsShown();
1305
1306 pane.Show( show );
1307
1308 if( show )
1310
1311 m_auimgr.Update();
1312}
1313
1314
1316{
1317 if( !IsGitCommitPaneShown() )
1318 return;
1319
1320 // Gated on the preference so no editor binds a repository behind it.
1321 if( Pgm().GetCommonSettings()->m_Git.enableGit )
1323
1324 // Refreshed either way, or turning the preference off never reaches the panel.
1325 m_gitCommitPane->RefreshFileList();
1326}
1327
1328
1333
1334
1336{
1337 if( !m_colorSettings || aForceRefresh )
1338 {
1340 const_cast<EDA_DRAW_FRAME*>( this )->m_colorSettings = colorSettings;
1341 }
1342
1343 return m_colorSettings;
1344}
1345
1346
1348{
1350
1351 ACTION_MANAGER* mgr = m_toolManager->GetActionManager();
1352 EDITOR_CONDITIONS cond( this );
1353
1354 wxASSERT( mgr );
1355
1359}
1360
1361
1363 const std::function<bool( const SELECTION& )>& aEnable )
1364{
1365 ACTION_MANAGER* mgr = m_toolManager->GetActionManager();
1366 const std::string arcToolPrefix = aDrawArc.GetName();
1367
1368 // Every arc tool action extends the plain action's name, so one compare covers them all
1369 const SELECTION_CONDITION arcToolActive =
1370 [this, arcToolPrefix]( const SELECTION& )
1371 {
1372 return CurrentToolName().starts_with( arcToolPrefix );
1373 };
1374
1376
1377 do
1378 {
1379 const SELECTION_CONDITION inMode =
1380 [this, mode]( const SELECTION& )
1381 {
1382 APP_SETTINGS_BASE* cfg = config();
1383
1384 return cfg && cfg->m_ArcDrawMode == mode;
1385 };
1386
1387 if( const TOOL_ACTION* action = drawArcAction( mode ) )
1388 mgr->SetConditions( *action, ACTION_CONDITIONS().Enable( aEnable ).Check( inMode && arcToolActive ) );
1389
1390 mode = IncrementArcDrawMode( mode );
1391 } while( mode != ARC_DRAW_MODE::CENTER_START_END );
1392}
1393
1394
1396{
1397 APP_SETTINGS_BASE* cfg = config();
1398
1399 // The arc group would otherwise start on its first entry and overwrite the saved mode
1400 if( const TOOL_ACTION* action = cfg ? drawArcAction( cfg->m_ArcDrawMode ) : nullptr )
1401 SelectToolbarAction( *action );
1402}
1403
1404
1406{
1407 COMMON_TOOLS* cmnTool = m_toolManager->GetTool<COMMON_TOOLS>();
1408
1409 if( cmnTool )
1410 {
1411 // Tell the tool what the units used last session
1412 cmnTool->SetLastUnits( static_cast<EDA_UNITS>( aCfg->m_System.last_imperial_units ) );
1413 cmnTool->SetLastUnits( static_cast<EDA_UNITS>( aCfg->m_System.last_metric_units ) );
1414 }
1415
1416 // Tell the tool what units the frame is currently using
1417 switch( static_cast<EDA_UNITS>( aCfg->m_System.units ) )
1418 {
1419 default:
1420 case EDA_UNITS::MM: m_toolManager->RunAction( ACTIONS::millimetersUnits ); break;
1421 case EDA_UNITS::INCH: m_toolManager->RunAction( ACTIONS::inchesUnits ); break;
1422 case EDA_UNITS::MILS: m_toolManager->RunAction( ACTIONS::milsUnits ); break;
1423 }
1424}
1425
1426
1427void EDA_DRAW_FRAME::GetUnitPair( EDA_UNITS& aPrimaryUnit, EDA_UNITS& aSecondaryUnits )
1428{
1429 COMMON_TOOLS* cmnTool = m_toolManager->GetTool<COMMON_TOOLS>();
1430
1431 aPrimaryUnit = GetUserUnits();
1432 aSecondaryUnits = EDA_UNITS::MILS;
1433
1434 if( EDA_UNIT_UTILS::IsImperialUnit( aPrimaryUnit ) )
1435 {
1436 if( cmnTool )
1437 aSecondaryUnits = cmnTool->GetLastMetricUnits();
1438 else
1439 aSecondaryUnits = EDA_UNITS::MM;
1440 }
1441 else
1442 {
1443 if( cmnTool )
1444 aSecondaryUnits = cmnTool->GetLastImperialUnits();
1445 else
1446 aSecondaryUnits = EDA_UNITS::MILS;
1447 }
1448}
1449
1450
1452{
1454
1455 // A canvas that failed this session falls back without changing the saved preference
1456 if( CanvasFailed( m_canvasType ) )
1458
1459 if( m_canvasType != GetCanvas()->GetBackend() )
1460 {
1461 // SwitchCanvas overwrites m_canvasType with whatever backend it ended up on
1463
1464 // Try to switch (will automatically fallback if necessary)
1465 SwitchCanvas( requested );
1466
1467 if( GetCanvas()->GetBackend() != requested )
1468 {
1470 m_failedCanvases.insert( requested ); // Store failure for other EDA_DRAW_FRAMEs
1471 }
1472 }
1473}
1474
1475
1476void EDA_DRAW_FRAME::handleActivateEvent( wxActivateEvent& aEvent )
1477{
1478 // Force a refresh of the message panel to ensure that the text is the right color
1479 // when the window activates
1480 if( !IsIconized() )
1481 m_messagePanel->Refresh();
1482}
1483
1484
1485void EDA_DRAW_FRAME::onActivate( wxActivateEvent& aEvent )
1486{
1487 handleActivateEvent( aEvent );
1488
1489 aEvent.Skip();
1490}
1491
1492
1493bool EDA_DRAW_FRAME::SaveCanvasImageToFile( const wxString& aFileName, BITMAP_TYPE aBitmapType )
1494{
1495 wxImage image;
1496
1497
1498 if( !GetCanvas()->GetScreenshot( image ) )
1499 {
1500 wxSize image_size = GetCanvas()->GetClientSize();
1501 wxClientDC dc( GetCanvas() );
1502 wxBitmap bitmap( image_size.x, image_size.y );
1503 wxMemoryDC memdc;
1504
1505 memdc.SelectObject( bitmap );
1506 memdc.Blit( 0, 0, image_size.x, image_size.y, &dc, 0, 0 );
1507 memdc.SelectObject( wxNullBitmap );
1508
1509 image = bitmap.ConvertToImage();
1510 }
1511
1512 wxBitmapType type = wxBITMAP_TYPE_PNG;
1513 switch( aBitmapType )
1514 {
1515 case BITMAP_TYPE::PNG: type = wxBITMAP_TYPE_PNG; break;
1516 case BITMAP_TYPE::BMP: type = wxBITMAP_TYPE_BMP; break;
1517 case BITMAP_TYPE::JPG: type = wxBITMAP_TYPE_JPEG; break;
1518 }
1519
1520 bool retv = image.SaveFile( aFileName, type );
1521
1522 image.Destroy();
1523 return retv;
1524}
1525
1526
1528{
1529 wxCHECK( aCfg, aAction.show_button );
1530
1531 for( const auto& [identifier, visible] : aCfg->m_Plugins.actions )
1532 {
1533 if( identifier == aAction.identifier )
1534 return visible;
1535 }
1536
1537 return aAction.show_button;
1538}
1539
1540
1541std::vector<const PLUGIN_ACTION*> EDA_DRAW_FRAME::GetOrderedPluginActions( PLUGIN_ACTION_SCOPE aScope,
1542 APP_SETTINGS_BASE* aCfg )
1543{
1544 std::vector<const PLUGIN_ACTION*> actions;
1545 wxCHECK( aCfg, actions );
1546
1548 std::vector<const PLUGIN_ACTION*> unsorted = mgr.GetActionsForScope( aScope );
1549 std::map<wxString, const PLUGIN_ACTION*> actionMap;
1550 std::set<const PLUGIN_ACTION*> handled;
1551
1552 for( const PLUGIN_ACTION* action : unsorted )
1553 actionMap[action->identifier] = action;
1554
1555 for( const auto& identifier : aCfg->m_Plugins.actions | std::views::keys )
1556 {
1557 if( actionMap.contains( identifier ) )
1558 {
1559 const PLUGIN_ACTION* action = actionMap[ identifier ];
1560 actions.emplace_back( action );
1561 handled.insert( action );
1562 }
1563 }
1564
1565 for( const auto& action : actionMap | std::views::values )
1566 {
1567 if( !handled.contains( action ) )
1568 actions.emplace_back( action );
1569 }
1570
1571 return actions;
1572}
1573
1574
1576{
1577 wxCHECK( aMenu, 0 );
1578
1580
1581 mgr.MenuBindings( m_ident ).clear();
1582
1583 std::vector<const PLUGIN_ACTION*> actions = GetOrderedPluginActions( PluginActionScope(), config() );
1584
1585 size_t count = 0;
1586
1587 for( const PLUGIN_ACTION* action : actions )
1588 {
1589 const std::vector<wxImage>& images =
1590 KIPLATFORM::UI::IsDarkTheme() && !action->icon_dark.empty() ? action->icon_dark : action->icon_light;
1591
1593 wxBitmapBundle icon;
1594
1595 if( images.empty() )
1596 {
1597 icon = KiBitmapBundleDef( BITMAPS::puzzle_piece, iconSize );
1598 }
1599 else
1600 {
1601 wxVector<wxBitmap> bitmaps;
1602
1603 for( const wxImage& img : images )
1604 bitmaps.push_back( wxBitmap( img ) );
1605
1606 icon = BITMAP_STORE::MakeBitmapBundleDef( bitmaps, iconSize );
1607 }
1608
1609 if( !icon.IsOk() )
1610 continue;
1611
1612 wxMenuItem* item = KIUI::AddMenuItem( aMenu, wxID_ANY, action->name, action->description, icon );
1613
1614 Connect( item->GetId(), wxEVT_COMMAND_MENU_SELECTED,
1615 wxCommandEventHandler( EDA_DRAW_FRAME::OnApiPluginInvoke ) );
1616
1617 mgr.MenuBindings( m_ident ).insert( { item->GetId(), action->identifier } );
1618
1619 ++count;
1620 }
1621
1622 return count;
1623}
1624
1625
1627{
1629
1630 mgr.ButtonBindings( m_ident ).clear();
1631
1632 std::vector<const PLUGIN_ACTION*> actions = GetOrderedPluginActions( PluginActionScope(), config() );
1633
1635
1636 for( const PLUGIN_ACTION* action : actions )
1637 {
1638 if( !IsPluginActionButtonVisible( *action, config() ) )
1639 continue;
1640
1641 const std::vector<wxImage>& images = KIPLATFORM::UI::IsDarkTheme() && !action->icon_dark.empty()
1642 ? action->icon_dark
1643 : action->icon_light;
1644
1645 if( images.empty() )
1646 continue;
1647
1648 wxVector<wxBitmap> bitmaps;
1649
1650 for( const wxImage& img : images )
1651 bitmaps.push_back( wxBitmap( img ) );
1652
1653 wxBitmapBundle icon = BITMAP_STORE::MakeBitmapBundleDef( bitmaps, iconSize );
1654
1655 if( !icon.IsOk() )
1656 continue;
1657
1658 wxAuiToolBarItem* button = aToolbar->AddTool( wxID_ANY, wxEmptyString, icon, action->name );
1659
1660 Connect( button->GetId(), wxEVT_COMMAND_MENU_SELECTED,
1661 wxCommandEventHandler( EDA_DRAW_FRAME::OnApiPluginInvoke ) );
1662
1663 mgr.ButtonBindings( m_ident ).insert( { button->GetId(), action->identifier } );
1664 }
1665}
1666
1667
1668void EDA_DRAW_FRAME::OnApiPluginInvoke( wxCommandEvent& aEvent )
1669{
1671
1672 std::optional<wxString> identifier;
1673
1674 if( mgr.ButtonBindings( m_ident ).contains( aEvent.GetId() ) )
1675 identifier = mgr.ButtonBindings( m_ident ).at( aEvent.GetId() );
1676 else if( mgr.MenuBindings( m_ident ).contains( aEvent.GetId() ) )
1677 identifier = mgr.MenuBindings( m_ident ).at( aEvent.GetId() );
1678
1679 if( !identifier )
1680 return;
1681
1682 std::shared_ptr<REPORTER> reporter;
1683
1684 if( KISTATUSBAR* statusBar = dynamic_cast<KISTATUSBAR*>( GetStatusBar() ) )
1685 reporter = std::make_shared<STATUSBAR_WARNING_REPORTER>( statusBar, wxS( "plugin" ) );
1686
1687 mgr.InvokeAction( *identifier, reporter );
1688}
const char * name
ARC_DRAW_MODE
Construction sequence used when interactively drawing a circular arc.
@ CENTER_START_END
Center, then start (sets radius), then sweep to the end.
ARC_DRAW_MODE IncrementArcDrawMode(ARC_DRAW_MODE aMode)
Return the next mode in the cycle order used by the cycle-mode action.
BASE_SCREEN class implementation.
constexpr EDA_IU_SCALE unityScale
Definition base_units.h:131
wxBitmapBundle KiBitmapBundleDef(BITMAPS aBitmap, int aDefHeight)
Construct and return a bitmap bundle for the given icon ID, with the default bitmap size being aDefHe...
Definition bitmap.cpp:112
BITMAP_TYPE
BOX2< VECTOR2I > BOX2I
Definition box2.h:914
constexpr BOX2I KiROUND(const BOX2D &aBoxD)
Definition box2.h:982
BOX2< VECTOR2D > BOX2D
Definition box2.h:915
static TOOL_ACTION gridProperties
Definition actions.h:196
static TOOL_ACTION millimetersUnits
Definition actions.h:202
static TOOL_ACTION updatePreferences
Definition actions.h:276
static TOOL_ACTION gridPreset
Definition actions.h:193
static TOOL_ACTION updateUnits
Definition actions.h:203
static TOOL_ACTION milsUnits
Definition actions.h:201
static TOOL_ACTION inchesUnits
Definition actions.h:200
static TOOL_ACTION zoomFitScreen
Definition actions.h:138
static TOOL_ACTION zoomPreset
Definition actions.h:141
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...
Define the structure of a menu based on ACTIONs.
Definition action_menu.h:43
static ACTION_TOOLBAR_CONTROL gridSelect
static ACTION_TOOLBAR_CONTROL overrideLocks
static ACTION_TOOLBAR_CONTROL zoomSelect
Define the structure of a toolbar with buttons that invoke ACTIONs.
Responsible for loading plugin definitions for API-based plugins (ones that do not run inside KiCad i...
void InvokeAction(const wxString &aIdentifier, std::shared_ptr< REPORTER > aReporter=nullptr)
std::vector< const PLUGIN_ACTION * > GetActionsForScope(PLUGIN_ACTION_SCOPE aScope)
std::map< int, wxString > & ButtonBindings(FRAME_T aFrame)
std::map< int, wxString > & MenuBindings(FRAME_T aFrame)
APP_SETTINGS_BASE is a settings class that should be derived for each standalone KiCad application.
ARC_DRAW_MODE m_ArcDrawMode
Construction sequence last used by the arc drawing tool in this application.
FIND_REPLACE m_FindReplace
Handles how to draw a screen (a board, a schematic ...)
Definition base_screen.h:37
int GetPageCount() const
Definition base_screen.h:68
int GetVirtualPageNumber() const
Definition base_screen.h:71
const wxString & GetPageNumber() const
static wxBitmapBundle MakeBitmapBundleDef(const wxVector< wxBitmap > &aBitmaps, int aDefHeight)
Constructs a bitmap bundle from the given bitmaps.
constexpr BOX2< Vec > & Inflate(coord_type dx, coord_type dy)
Inflates the rectangle horizontally by dx and vertically by dy.
Definition box2.h:553
constexpr size_type GetWidth() const
Definition box2.h:211
constexpr bool Contains(const Vec &aPoint) const
Definition box2.h:165
Color settings are a bit different than most of the settings objects in that there can be more than o...
APPEARANCE m_Appearance
Handles action that are shared between different applications.
void SetLastUnits(EDA_UNITS aUnit)
EDA_UNITS GetLastImperialUnits()
EDA_UNITS GetLastMetricUnits()
void AddSeparator(int aOrder=ANY_ORDER)
Add a separator to the menu.
Dialog helper object to sit in the inheritance tree between wxDialog and any class written by wxFormB...
Definition dialog_shim.h:80
Store the list of graphic items: rect, lines, polygons and texts to draw/plot the title block and fra...
void SetPlotterMilsToIUfactor(double aMils2Iu)
Set the scalar to convert pages units (mils) to plot units.
void BuildDrawItemsList(const PAGE_INFO &aPageInfo, const TITLE_BLOCK &aTitleBlock)
Drawing or plot the drawing sheet.
void SetSheetPath(const wxString &aSheetPath)
Set the sheet path to draw/plot.
void SetFileName(const wxString &aFileName)
Set the filename to draw/plot.
void SetDefaultPenSize(int aPenSize)
void Print(const RENDER_SETTINGS *aSettings)
Draws the item list created by BuildDrawItemsList.
void SetSheetName(const wxString &aSheetName)
Set the sheet name to draw/plot.
void SetIsFirstPage(bool aIsFirstPage)
Set if the page is the first page.
void SetProperties(const std::map< wxString, wxString > *aProps)
Set properties used for text variable resolution.
void SetSheetLayer(const wxString &aSheetLayer)
Set the sheet layer to draw/plot.
void SetSheetCount(int aSheetCount)
Set the value of the count of sheets, for basic inscriptions.
void SetPageNumber(const wxString &aPageNumber)
Set the value of the sheet number.
void SetProject(const PROJECT *aProject)
void SelectToolbarAction(const TOOL_ACTION &aAction) override
Select the given action in the toolbar group which contains it, if any.
virtual APP_SETTINGS_BASE * config() const
Return the settings object used in SaveSettings(), and is overloaded in KICAD_MANAGER_FRAME.
void CommonSettingsChanged(int aFlags) override
Notification event that some of the common (suite-wide) settings have changed.
virtual WINDOW_SETTINGS * GetWindowSettings(APP_SETTINGS_BASE *aCfg)
Return a pointer to the window settings for this frame.
void OnToolbarSizeChanged()
Update toolbars if desired toolbar icon changed.
void ShowChangedLanguage() override
Redraw the menus and what not in current language.
static const wxString GitCommitPaneName()
Named here rather than beside the editors' other panes, because the project manager docks this one to...
virtual void setupUIConditions()
Setup the UI conditions for the various actions and their controls in this frame.
void RegisterCustomToolbarControlFactory(const ACTION_TOOLBAR_CONTROL &aControlDesc, const ACTION_TOOLBAR_CONTROL_FACTORY &aControlFactory)
Register a creation factory for toolbar controls that are present in this frame.
virtual void configureToolbars()
wxTimer * m_autoSaveTimer
wxAuiManager m_auimgr
int GetMaxUndoItems() const
virtual void LoadSettings(APP_SETTINGS_BASE *aCfg)
Load common frame parameters from a configuration file.
wxString GetMruPath() const
virtual void OnSize(wxSizeEvent &aEvent)
int GetAutoSaveInterval() const
virtual void SaveSettings(APP_SETTINGS_BASE *aCfg)
Save common frame parameters to a configuration data file.
void SetMruPath(const wxString &aPath)
bool m_isClosing
Set by the close window event handler after frames are asked if they can close.
The base class for create windows for drawing purpose.
virtual const BOX2I GetDocumentExtents(bool aIncludeAllVisible=true) const
Return bounding box of document with option to not include some items.
wxCheckBox * m_overrideLocksCb
wxArrayString m_replaceStringHistoryList
virtual void ClearMsgPanel()
Clear all messages from the message panel.
static std::vector< const PLUGIN_ACTION * > GetOrderedPluginActions(PLUGIN_ACTION_SCOPE aScope, APP_SETTINGS_BASE *aCfg)
Return ordered list of plugin actions for display in the toolbar.
void configureToolbars() override
EDA_DRAW_PANEL_GAL * m_canvas
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.
static bool CanvasFailed(EDA_DRAW_PANEL_GAL::GAL_TYPE aCanvas)
GIT_COMMIT_PANE * m_gitCommitPane
GAL_DISPLAY_OPTIONS_IMPL m_galDisplayOptions
This the frame's interface to setting GAL display options.
virtual const TITLE_BLOCK & GetTitleBlock() const =0
void onActivate(wxActivateEvent &aEvent)
COLOR_SETTINGS * m_colorSettings
wxChoice * m_gridSelectBox
void AddStandardSubMenus(TOOL_MENU &aMenu)
Construct a "basic" menu for a tool, containing only items that apply to all tools (e....
void ReleaseFile()
Release the current file marked in use.
EDA_DRAW_PANEL_GAL::GAL_TYPE m_canvasType
The current canvas type.
virtual wxString GetFullScreenDesc() const
void OnSelectGrid(wxCommandEvent &event)
Command event handler for selecting grid sizes.
void DisplayToolMsg(const wxString &msg) override
std::unique_ptr< LOCKFILE > m_file_checker
Prevents opening same file multiple times.
void OnUpdateSelectZoom(wxUpdateUIEvent &aEvent)
Update the checked item in the zoom wxchoice.
virtual const PAGE_INFO & GetPageSettings() const =0
void DisplayUnitsMsg()
Display current unit pane in the status bar.
void setupUnits(APP_SETTINGS_BASE *aCfg)
void SetMsgPanel(const std::vector< MSG_PANEL_ITEM > &aList)
Clear the message panel and populates it with the contents of aList.
void setArcModeConditions(const TOOL_ACTION &aDrawArc, const std::function< bool(const SELECTION &)> &aEnable)
Check each arc mode's tool action while the arc tool runs in that mode.
void UpdateGridSelectBox()
Rebuild the grid combobox to respond to any changes in the GUI (units, user grid changes,...
bool LockFile(const wxString &aFileName)
Mark a schematic file as being in use.
virtual void HardRedraw()
Rebuild the GAL and redraws the screen.
void LoadSettings(APP_SETTINGS_BASE *aCfg) override
Load common frame parameters from a configuration file.
bool SaveCanvasImageToFile(const wxString &aFileName, BITMAP_TYPE aBitmapType)
Save the current view as an image file.
void UpdateZoomSelectBox()
Rebuild the grid combobox to respond to any changes in the GUI (units, user grid changes,...
virtual void SwitchCanvas(EDA_DRAW_PANEL_GAL::GAL_TYPE aCanvasType)
Change the current rendering backend.
virtual void OnSize(wxSizeEvent &event) override
Recalculate the size of toolbars and display panel when the frame size changes.
const wxString GetZoomLevelIndicator() const
Return a human readable value for display in dialogs.
virtual void OnSelectZoom(wxCommandEvent &event)
Set the zoom factor when selected by the zoom list box in the main tool bar.
virtual void resolveCanvasType()
Determine the canvas type to load (with prompt if required) and initializes m_canvasType.
BASE_SCREEN * m_currentScreen
current used SCREEN
virtual wxString GetScreenDesc() const
VECTOR2I GetNearestGridPosition(const VECTOR2I &aPosition) const
Return the nearest aGridSize location to aPosition.
void SyncZoomSelectBox()
Show the current zoom in the zoom wxchoice, as a preset or as its own entry.
EDA_MSG_PANEL * m_messagePanel
virtual const VECTOR2I & GetGridOrigin() const =0
Return the absolute coordinates of the origin of the snap grid.
void RefreshGitCommitPane()
Attach the git session if needed and refresh the version-control pane, when it is shown.
bool saveCanvasTypeSetting(EDA_DRAW_PANEL_GAL::GAL_TYPE aCanvasType)
Store the canvas type in the application settings.
virtual const TOOL_ACTION * drawArcAction(ARC_DRAW_MODE aMode) const
The action that starts the arc tool in aMode, or nullptr in a frame without an arc tool.
EDA_DRAW_FRAME(KIWAY *aKiway, wxWindow *aParent, FRAME_T aFrameType, const wxString &aTitle, const wxPoint &aPos, const wxSize &aSize, long aStyle, const wxString &aFrameName, const EDA_IU_SCALE &aIuScale)
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.
NET_INSPECTOR_PANEL * m_netInspectorPanel
bool LibraryFileBrowser(const wxString &aTitle, bool doOpen, wxFileName &aFilename, const wxString &wildcard, const wxString &ext, bool isDirectory, FILEDLG_HOOK_NEW_LIBRARY *aFileDlgHook=nullptr)
virtual void SetGridVisibility(bool aVisible)
virtual void handleActivateEvent(wxActivateEvent &aEvent)
Handle a window activation event.
virtual void AddApiPluginTools(ACTION_TOOLBAR *aToolbar)
Append actions from API plugins to the given toolbar.
virtual void OnApiPluginInvoke(wxCommandEvent &aEvent)
Handler for activating an API plugin (via toolbar or menu).
virtual void UpdateMsgPanel()
Redraw the message panel.
wxStatusBar * OnCreateStatusBar(int number, long style, wxWindowID id, const wxString &name) override
Create the status line (like a wxStatusBar).
virtual COLOR_SETTINGS * GetColorSettings(bool aForceRefresh=false) const
Returns a pointer to the active color theme settings.
void ToggleUserUnits() override
void FocusOnLocation(const VECTOR2I &aPos, bool aAllowScroll=true)
Useful to focus on a particular location, in find functions.
virtual void CreateHotkeyPopup()
void UpdateStatusBar() override
Update the status bar information.
void syncToolbarSelections() override
Called after the toolbars are rebuilt so a frame can select the group entries that reflect its saved ...
void GetUnitPair(EDA_UNITS &aPrimaryUnit, EDA_UNITS &aSecondaryUnits) override
Get the pair or units in current use.
void ShowChangedLanguage() override
Redraw the menus and what not in current language.
void PrintDrawingSheet(const RENDER_SETTINGS *aSettings, BASE_SCREEN *aScreen, const std::map< wxString, wxString > *aProperties, double aMils2Iu, const wxString &aFilename, const wxString &aSheetLayer=wxEmptyString)
Print the drawing-sheet (frame and title block).
virtual EDA_DRAW_PANEL_GAL * GetCanvas() const
Return a pointer to GAL-based canvas of given EDA draw frame.
wxSocketServer * m_socketServer
SEARCH_PANE * m_searchPane
EDA_SEARCH_DATA & GetFindReplaceData()
void unitsChangeRefresh() override
Called when when the units setting has changed to allow for any derived classes to handle refreshing ...
void OnMove(wxMoveEvent &aEvent) override
std::vector< wxWindow * > findDialogs()
virtual void DisplayGridMsg()
Display current grid size in the status bar.
EDA_DRAW_PANEL_GAL::GAL_TYPE loadCanvasTypeSetting()
Return the canvas type stored in the application settings.
void setupUIConditions() override
Setup the UI conditions for the various actions and their controls in this frame.
wxArrayString m_findStringHistoryList
static std::set< EDA_DRAW_PANEL_GAL::GAL_TYPE > m_failedCanvases
The canvases that have failed in any EDA_DRAW_FRAME this session.
wxChoice * m_zoomSelectBox
size_t AddApiPluginMenuItems(ACTION_MENU *aMenu)
Append actions from API plugins to the given menu.
virtual std::unique_ptr< GRID_HELPER > MakeGridHelper()
virtual PLUGIN_ACTION_SCOPE PluginActionScope() const
std::unique_ptr< EDA_SEARCH_DATA > m_findReplaceData
void CommonSettingsChanged(int aFlags) override
Notification event that some of the common (suite-wide) settings have changed.
void DisplayConstraintsMsg(const wxString &msg)
void AppendMsgPanel(const wxString &aTextUpper, const wxString &aTextLower, int aPadding=6)
Append a message to the message panel.
virtual void SetGridOverrides(bool aOverride)
PROPERTIES_PANEL * m_propertiesPanel
bool m_showBorderAndTitleBlock
VECTOR2I GetNearestHalfGridPosition(const VECTOR2I &aPosition) const
Return the nearest aGridSize / 2 location to aPosition.
void ClearToolbarControl(int aId) override
bool GetOverrideLocks() const
HOTKEY_CYCLE_POPUP * m_hotkeyPopup
virtual void UpdateProperties()
void OnUpdateSelectGrid(wxUpdateUIEvent &aEvent)
Update the checked item in the grid wxchoice.
static bool IsPluginActionButtonVisible(const PLUGIN_ACTION &aAction, APP_SETTINGS_BASE *aCfg)
static constexpr GAL_TYPE GAL_FALLBACK
GAL_TYPE GetBackend() const
Return the type of backend currently used by GAL canvas.
KIGFX::VIEW_CONTROLS * GetViewControls() const
Return a pointer to the KIGFX::VIEW_CONTROLS instance used in the panel.
virtual KIGFX::VIEW * GetView() const
Return a pointer to the KIGFX::VIEW instance used in the panel.
void ResizeGal(bool aForce=false)
Resize the GAL to the current client size of this panel.
virtual void Refresh(bool aEraseBackground=true, const wxRect *aRect=nullptr) override
@ GAL_TYPE_LAST
Sentinel, do not use as a parameter.
@ GAL_TYPE_OPENGL
OpenGL implementation.
@ GAL_TYPE_CAIRO
Cairo 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 UpdateTouchpadGestureHandler()
Apply the current native touchpad gesture preference to the active backend window.
virtual bool SwitchBackend(GAL_TYPE aGalType)
Switch method of rendering graphics.
void StartDrawing()
Begin drawing if it was stopped previously.
static GAL_TYPE ResolveStoredCanvasType(int aStoredCanvasType)
Convert a stored canvas type setting into a backend that can actually be used.
A base class for most all the KiCad significant classes used in schematics and boards.
Definition eda_item.h:98
virtual void GetMsgPanelInfo(EDA_DRAW_FRAME *aFrame, std::vector< MSG_PANEL_ITEM > &aList)
Populate aList of MSG_PANEL_ITEM objects with it's internal state for display purposes.
Definition eda_item.h:296
A panel to display various information messages.
Definition msgpanel.h:97
Class that groups generic conditions for editor states.
SELECTION_CONDITION Units(EDA_UNITS aUnit)
Create a functor that tests if the frame has the specified units.
static const TOOL_EVENT SelectedEvent
Definition actions.h:346
static void BuildChoiceList(wxArrayString *aGridsList, WINDOW_SETTINGS *aCfg, EDA_DRAW_FRAME *aParent)
Definition grid_menu.cpp:79
Similar to EDA_VIEW_SWITCHER, this dialog is a popup that shows feedback when using a hotkey to cycle...
A color representation with 4 components: red, green, blue, alpha.
Definition color4d.h:101
double GetZoomFactor() const
const VECTOR2D & GetGridSize() const
Return the grid size.
void SetGridVisibility(bool aVisibility)
Set the visibility setting of the grid.
Container for all the knowledge about how graphical objects are drawn on any output surface/device.
An interface for classes handling user events controlling the view behavior such as zooming,...
virtual void LoadSettings()
Load new settings from program common settings.
virtual void SetCrossHairCursorPosition(const VECTOR2D &aPosition, bool aWarpView=true)=0
Move the graphic crosshair cursor to the requested position expressed in world coordinates.
BOX2D GetViewport() const
Return the current viewport visible area rectangle.
Definition view.cpp:861
void SetCenter(const VECTOR2D &aCenter)
Set the center point of the VIEW (i.e.
Definition view.cpp:971
void MarkTargetDirty(int aTarget)
Set or clear target 'dirty' flag.
Definition view.h:729
KISTATUSBAR is a wxStatusBar suitable for Kicad manager.
Definition kistatusbar.h:50
PROJECT & Prj() const
Return a reference to the PROJECT associated with this KIWAY.
A wxFrame capable of the OpenProjectFiles function, meaning it can load a portion of a KiCad project.
KIWAY_PLAYER(KIWAY *aKiway, wxWindow *aParent, FRAME_T aFrameType, const wxString &aTitle, const wxPoint &aPos, const wxSize &aSize, long aStyle, const wxString &aFrameName, const EDA_IU_SCALE &aIuScale)
A minimalistic software bus for communications between various DLLs/DSOs (DSOs) within the same KiCad...
Definition kiway.h:348
EDA_MSG_PANEL items for displaying messages.
Definition msgpanel.h:50
Describe the page size and margins of a paper page on which to eventually print or plot.
Definition page_info.h:75
virtual COMMON_SETTINGS * GetCommonSettings() const
Definition pgm_base.cpp:562
virtual API_PLUGIN_MANAGER & GetPluginManager() const
Definition pgm_base.h:139
Container for project specific data.
Definition project.h:63
virtual bool AttachGitRepository()
Find the Git repository containing the project directory and bind it to the session.
Definition project.cpp:93
static bool ShowAlways(const SELECTION &aSelection)
The default condition function (always returns true).
Hold the information shown in the lower right corner of a plot, printout, or editing view.
Definition title_block.h:38
TOOL_MANAGER * m_toolManager
std::string CurrentToolName() const
TOOL_DISPATCHER * m_toolDispatcher
TOOL_MANAGER * GetToolManager() const
Return the MVC controller.
ACTIONS * m_actions
Represent a single user action.
const std::string & GetName() const
Return name of the action.
Generic, UI-independent tool event.
Definition tool_event.h:167
bool RunAction(const std::string &aActionName, T aParam)
Run the specified action immediately, pausing the current action to run the new one.
Manage a CONDITIONAL_MENU and some number of CONTEXT_MENUs as sub-menus.
Definition tool_menu.h:39
CONDITIONAL_MENU & GetMenu()
Definition tool_menu.cpp:40
void RegisterSubMenu(std::shared_ptr< ACTION_MENU > aSubMenu)
Store a submenu of this menu model.
Definition tool_menu.cpp:46
EDA_UNITS GetUserUnits() const
void SetUserUnits(EDA_UNITS aUnits)
@ LIGHTGRAY
Definition color4d.h:43
@ DARKGRAY
Definition color4d.h:42
@ BLACK
Definition color4d.h:40
This file is part of the common library.
#define _(s)
#define DEFAULT_MAX_UNDO_ITEMS
#define FR_HISTORY_LIST_CNT
Maximum size of the find/replace history stacks.
void PrintDrawingSheet(const RENDER_SETTINGS *aSettings, const PAGE_INFO &aPageInfo, const wxString &aSheetName, const wxString &aSheetPath, const wxString &aFileName, const TITLE_BLOCK &aTitleBlock, const std::map< wxString, wxString > *aProperties, int aSheetCount, const wxString &aPageNumber, double aMils2Iu, const PROJECT *aProject, const wxString &aSheetLayer, bool aIsFirstPage)
Print the border and title block.
EDA_SEARCH_MATCH_MODE
EDA_UNITS
Definition eda_units.h:44
FRAME_T
The set of EDA_BASE_FRAME derivatives, typically stored in EDA_BASE_FRAME::m_Ident.
Definition frame_type.h:29
@ FRAME_PCB_EDITOR
Definition frame_type.h:38
@ FRAME_SCH_SYMBOL_EDITOR
Definition frame_type.h:31
@ FRAME_SCH
Definition frame_type.h:30
@ FRAME_PL_EDITOR
Definition frame_type.h:55
@ FRAME_FOOTPRINT_EDITOR
Definition frame_type.h:39
@ FRAME_GERBER
Definition frame_type.h:53
@ ID_ON_GRID_SELECT
Definition id.h:113
@ ID_ON_ZOOM_SELECT
Definition id.h:112
@ ID_ON_OVERRIDE_LOCKS
Definition id.h:114
This file contains miscellaneous commonly used macros and functions.
Message panel definition file.
KICOMMON_API bool IsImperialUnit(EDA_UNITS aUnit)
Definition eda_units.cpp:43
@ TARGET_NONCACHED
Auxiliary rendering target (noncached)
Definition definitions.h:34
bool IsDarkTheme()
Determine if the desktop interface is currently using a dark theme or a light theme.
Definition wxgtk/ui.cpp:54
void AllowNetworkFileSystems(wxDialog *aDialog)
Configure a file dialog to show network and virtual file systems.
Definition wxgtk/ui.cpp:640
KICOMMON_API wxFont GetStatusFont(wxWindow *aWindow)
KICOMMON_API wxMenuItem * AddMenuItem(wxMenu *aMenu, int aId, const wxString &aText, const wxBitmapBundle &aImage, wxItemKind aType=wxITEM_NORMAL)
Create and insert a menu item with an icon into aMenu.
KICOMMON_API wxSize GetTextSize(const wxString &aSingleLine, wxWindow *aWindow)
Return the size of aSingleLine of text when it is rendered in aWindow using whatever font is currentl...
Definition ui_common.cpp:80
bool contains(const _Container &__container, _Value __value)
Returns true if the container contains the given value.
Definition kicad_algo.h:96
STL namespace.
PGM_BASE & Pgm()
The global program "get" accessor.
see class PGM_BASE
PLUGIN_ACTION_SCOPE
std::function< bool(const SELECTION &)> SELECTION_CONDITION
Functor type that checks a specific condition for selected items.
#define DEFAULT_THEME
std::vector< FAB_LAYER_COLOR > dummy
Functors that can be used to figure out how the action controls should be displayed in the UI and if ...
std::vector< wxString > replace_history
std::vector< wxString > find_history
std::vector< std::pair< wxString, bool > > actions
Ordered list of plugin actions mapped to whether or not they are shown in the toolbar.
std::vector< GRID > grids
An action performed by a plugin via the IPC API.
Definition api_plugin.h:74
wxString identifier
Definition api_plugin.h:79
Store the common settings that are saved and loaded for each window / frame.
GRID_SETTINGS grid
std::vector< double > zoom_factors
IbisParser parser & reporter
wxLogTrace helper definitions.
Functions to provide common constants and other functions to assist in making a consistent UI.
VECTOR2< int32_t > VECTOR2I
Definition vector2d.h:708
VECTOR2< double > VECTOR2D
Definition vector2d.h:707
VECTOR2D ToVECTOR2D(const wxPoint &aPoint)
Definition vector2wx.h:36