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>
70#include <wx/event.h>
71#include <widgets/ui_common.h>
72#include <widgets/search_pane.h>
73#include <wx/dirdlg.h>
74#include <wx/filedlg.h>
75#include <wx/debug.h>
76#include <wx/socket.h>
77
78#include <wx/fdrepdlg.h>
80
81#define FR_HISTORY_LIST_CNT 10
82
83
84BEGIN_EVENT_TABLE( EDA_DRAW_FRAME, KIWAY_PLAYER )
87
88 EVT_ACTIVATE( EDA_DRAW_FRAME::onActivate )
89END_EVENT_TABLE()
90
91
92bool EDA_DRAW_FRAME::m_openGLFailureOccured = false;
93
94
95EDA_DRAW_FRAME::EDA_DRAW_FRAME( KIWAY* aKiway, wxWindow* aParent, FRAME_T aFrameType,
96 const wxString& aTitle, const wxPoint& aPos, const wxSize& aSize,
97 long aStyle, const wxString& aFrameName, const EDA_IU_SCALE& aIuScale ) :
98 KIWAY_PLAYER( aKiway, aParent, aFrameType, aTitle, aPos, aSize, aStyle, aFrameName, aIuScale ),
99 m_socketServer( nullptr ),
101{
102 m_gridSelectBox = nullptr;
103 m_zoomSelectBox = nullptr;
104 m_zoomCustomEntry = wxNOT_FOUND;
105 m_overrideLocksCb = nullptr;
106 m_searchPane = nullptr;
108
110 m_canvas = nullptr;
111 m_toolDispatcher = nullptr;
112 m_messagePanel = nullptr;
113 m_currentScreen = nullptr;
114 m_showBorderAndTitleBlock = false; // true to display reference sheet.
115 m_gridColor = COLOR4D( DARKGRAY ); // Default grid color
116 m_drawBgColor = COLOR4D( BLACK ); // the background color of the draw canvas:
117 // BLACK for Pcbnew, BLACK or WHITE for Eeschema
118 m_colorSettings = nullptr;
119 m_polarCoords = false;
120 m_findReplaceData = std::make_unique<EDA_SEARCH_DATA>();
121 m_hotkeyPopup = nullptr;
122 m_propertiesPanel = nullptr;
123 m_netInspectorPanel = nullptr;
124
126
127 m_auimgr.SetFlags( wxAUI_MGR_DEFAULT );
128
129 if( ( aStyle & wxFRAME_NO_TASKBAR ) == 0 )
130 {
131 CreateStatusBar( 8 )->SetDoubleBuffered( true );
132
133 GetStatusBar()->SetFont( KIUI::GetStatusFont( this ) );
134
135 // set the size of the status bar subwindows:
137 }
138
139 m_messagePanel = new EDA_MSG_PANEL( this, -1, wxPoint( 0, m_frameSize.y ), wxDefaultSize );
140 m_messagePanel->SetBackgroundColour( COLOR4D( LIGHTGRAY ).ToColour() );
141 m_msgFrameHeight = m_messagePanel->GetBestSize().y;
142
143 // Create child subwindows.
144 GetClientSize( &m_frameSize.x, &m_frameSize.y );
145 m_framePos.x = m_framePos.y = 0;
147
149
150 Bind( wxEVT_DPI_CHANGED,
151 [&]( wxDPIChangedEvent& aEvent )
152 {
153 if( ( GetWindowStyle() & wxFRAME_NO_TASKBAR ) == 0 )
155
156 wxMoveEvent dummy;
157 OnMove( dummy );
158
159 // we need to kludge the msg panel to the correct size again
160 // especially important even for first launches as the constructor of the window
161 // here usually doesn't have the correct dpi awareness yet
163 m_msgFrameHeight = m_messagePanel->GetBestSize().y;
165
166 m_messagePanel->SetPosition( wxPoint( 0, m_frameSize.y ) );
168
169 aEvent.Skip();
170 } );
171}
172
173
175{
178
179 delete m_actions;
180 delete m_toolManager;
181 delete m_toolDispatcher;
182 delete m_canvas;
183
184 delete m_currentScreen;
185 m_currentScreen = nullptr;
186
187 m_auimgr.UnInit();
188
189 ReleaseFile();
190}
191
192
197
198
200{
202
203 // Grid selection
204 auto gridSelectorFactory =
205 [this]( ACTION_TOOLBAR* aToolbar )
206 {
207 if( !m_gridSelectBox )
208 m_gridSelectBox = new wxChoice( aToolbar, ID_ON_GRID_SELECT );
209
211
212 aToolbar->Add( m_gridSelectBox );
213 };
214
216
217 // Zoom selection
218 auto zoomSelectorFactory =
219 [this]( ACTION_TOOLBAR* aToolbar )
220 {
221 if( !m_zoomSelectBox )
222 m_zoomSelectBox = new wxChoice( aToolbar, ID_ON_ZOOM_SELECT );
223
225 aToolbar->Add( m_zoomSelectBox );
226 };
227
229
230 auto overrideLocksFactory =
231 [this]( ACTION_TOOLBAR* aToolbar )
232 {
233 if( !m_overrideLocksCb )
234 {
235 m_overrideLocksCb = new wxCheckBox( aToolbar, ID_ON_OVERRIDE_LOCKS, _( "Override locks" ) );
236
237 // Clicking the checkbox takes focus off the canvas, so return it
238 m_overrideLocksCb->Bind( wxEVT_CHECKBOX,
239 [this]( wxCommandEvent& aEvent )
240 {
241 if( m_toolManager )
243
244 if( m_canvas )
245 m_canvas->SetFocus();
246
247 aEvent.Skip();
248 } );
249 }
250
251 aToolbar->Add( m_overrideLocksCb );
252 };
253
255}
256
257
259{
260 switch( aId )
261 {
262 case ID_ON_GRID_SELECT: m_gridSelectBox = nullptr; break;
263 case ID_ON_ZOOM_SELECT: m_zoomSelectBox = nullptr; break;
264 case ID_ON_OVERRIDE_LOCKS: m_overrideLocksCb = nullptr; break;
265 }
266}
267
268
270{
271 if( m_file_checker )
272 m_file_checker->UnlockFile();
273}
274
275
276bool EDA_DRAW_FRAME::LockFile( const wxString& aFileName )
277{
278 // We need to explicitly reset here to get the deletion before we create a new unique_ptr that
279 // may be for the same file.
280 m_file_checker.reset();
281
282 m_file_checker = std::make_unique<LOCKFILE>( aFileName );
283
284 // If the file is valid, return true. This could mean that the file is locked or it could mean
285 // that the file is read-only.
286 return m_file_checker->Valid();
287}
288
289
291{
292 // Notify all tools the units have changed
293 if( m_toolManager )
295
299
300 switch( GetUserUnits() )
301 {
302 default:
306 }
307}
308
309
311{
312 if( m_toolManager->GetTool<COMMON_TOOLS>() )
313 {
315 m_toolManager->GetTool<COMMON_TOOLS>()->ToggleUnits( dummy );
316 }
317 else
318 {
321
322 wxCommandEvent e( EDA_EVT_UNITS_CHANGED );
323 ProcessEventLocally( e );
324 }
325}
326
327
329{
331
332 COMMON_SETTINGS* settings = Pgm().GetCommonSettings();
334
335 if( m_supportsAutoSave && m_autoSaveTimer->IsRunning() )
336 {
337 if( GetAutoSaveInterval() > 0 )
338 {
339 m_autoSaveTimer->Start( GetAutoSaveInterval() * 1000, wxTIMER_ONE_SHOT );
340 }
341 else
342 {
343 m_autoSaveTimer->Stop();
344 m_autoSavePending = false;
345 }
346 }
347
348 viewControls->LoadSettings();
350
351 m_galDisplayOptions.ReadCommonConfig( *settings, this );
352
355
356 if( m_lastToolbarIconSize == 0
358 {
361 }
362
363#ifndef __WXMAC__
365#endif
366
367 // Notify all tools the preferences have changed
368 if( m_toolManager )
370}
371
372
374{
375 if( m_messagePanel )
376 m_messagePanel->EraseMsgBox();
377}
378
379
381{
384
385 if( m_gridSelectBox == nullptr )
386 return;
387
388 // Update grid values with the current units setting.
389 m_gridSelectBox->Clear();
390 wxArrayString gridsList;
391
392 wxCHECK( config(), /* void */ );
393
394 GRID_MENU::BuildChoiceList( &gridsList, GetWindowSettings( config() ), this );
395
396 for( const wxString& grid : gridsList )
397 m_gridSelectBox->Append( grid );
398
399 m_gridSelectBox->Append( wxT( "---" ) );
400 m_gridSelectBox->Append( _( "Edit Grids..." ) );
401
402 m_gridSelectBox->SetSelection( GetWindowSettings( config() )->grid.last_size_idx );
403}
404
405
406void EDA_DRAW_FRAME::OnUpdateSelectGrid( wxUpdateUIEvent& aEvent )
407{
408 // No need to update the grid select box if it doesn't exist or the grid setting change
409 // was made using the select box.
410 if( m_gridSelectBox == nullptr )
411 return;
412
413 wxCHECK( config(), /* void */ );
414
416 idx = std::clamp( idx, 0, (int) m_gridSelectBox->GetCount() - 1 );
417
418 if( idx != m_gridSelectBox->GetSelection() )
419 m_gridSelectBox->SetSelection( idx );
420}
421
422
423
424void EDA_DRAW_FRAME::OnUpdateSelectZoom( wxUpdateUIEvent& aEvent )
425{
426 if( m_zoomSelectBox == nullptr )
427 return;
428
429 double zoom = GetCanvas()->GetGAL()->GetZoomFactor();
430
431 wxCHECK( config(), /* void */ );
432
433 const std::vector<double>& zoomList = GetWindowSettings( config() )->zoom_factors;
434 int preset = wxNOT_FOUND;
435
436 for( size_t jj = 0; jj < zoomList.size(); ++jj )
437 {
438 if( zoomList[jj] == zoom )
439 {
440 preset = (int) jj + 1; // index 0 is Zoom Auto
441 break;
442 }
443 }
444
445 if( preset != wxNOT_FOUND )
446 {
447 // Zoom is on a preset, so drop the custom entry and select the preset.
448 if( m_zoomCustomEntry != wxNOT_FOUND )
449 {
451 m_zoomCustomEntry = wxNOT_FOUND;
452 }
453
454 if( m_zoomSelectBox->GetSelection() != preset )
455 m_zoomSelectBox->SetSelection( preset );
456 }
457 else
458 {
459 // Off-preset zoom, show the exact value in its own entry just below Zoom Auto.
460 wxString text = wxString::Format( _( "Zoom %.2f" ), zoom );
461
462 if( m_zoomCustomEntry == wxNOT_FOUND )
463 m_zoomCustomEntry = m_zoomSelectBox->Insert( text, 1 );
464 else if( m_zoomSelectBox->GetString( m_zoomCustomEntry ) != text )
466
467 if( m_zoomSelectBox->GetSelection() != m_zoomCustomEntry )
468 m_zoomSelectBox->SetSelection( m_zoomCustomEntry );
469 }
470}
471
472
473void EDA_DRAW_FRAME::OnSelectGrid( wxCommandEvent& event )
474{
475 wxCHECK_RET( m_gridSelectBox, wxS( "m_gridSelectBox uninitialized" ) );
476
477 int idx = m_gridSelectBox->GetCurrentSelection();
478
479 if( idx == int( m_gridSelectBox->GetCount() ) - 2 )
480 {
481 // wxWidgets will check the separator, which we don't want.
482 // Re-check the current grid.
483 wxUpdateUIEvent dummy;
485 }
486 else if( idx == int( m_gridSelectBox->GetCount() ) - 1 )
487 {
488 // wxWidgets will check the Grid Settings... entry, which we don't want.
489 // Re-check the current grid.
490 wxUpdateUIEvent dummy;
492
493 // Give a time-slice to close the menu before opening the dialog.
494 // (Only matters on some versions of GTK.)
495 wxSafeYield();
496
498 }
499 else
500 {
501 m_toolManager->RunAction( ACTIONS::gridPreset, idx );
502 }
503
505 m_canvas->Refresh();
506
507 // Needed on Windows because clicking on m_gridSelectBox remove the focus from m_canvas
508 // (Windows specific
509 m_canvas->SetFocus();
510}
511
512
514{
516 return m_overrideLocksCb->GetValue();
517
518 return false;
519}
520
521
523{
524 wxCHECK( config(), true );
525
526 return GetWindowSettings( config() )->grid.show;
527}
528
529
531{
532 wxCHECK( config(), /* void */ );
533
534 GetWindowSettings( config() )->grid.show = aVisible;
535
536 // Update the display with the new grid
537 if( GetCanvas() )
538 {
539 // Check to ensure these exist, since this function could be called before
540 // the GAL and View have been created
541 if( GetCanvas()->GetGAL() )
542 GetCanvas()->GetGAL()->SetGridVisibility( aVisible );
543
544 if( GetCanvas()->GetView() )
546
547 GetCanvas()->Refresh();
548 }
549}
550
551
553{
554 wxCHECK( config(), false );
555
557}
558
559
561{
562 wxCHECK( config(), /* void */ );
563
565}
566
567
568std::unique_ptr<GRID_HELPER> EDA_DRAW_FRAME::MakeGridHelper()
569{
570 return nullptr;
571}
572
573
575{
576 if( m_zoomSelectBox == nullptr )
577 return;
578
579 double zoom = m_canvas->GetGAL()->GetZoomFactor();
580
581 m_zoomSelectBox->Clear();
582 m_zoomSelectBox->Append( _( "Zoom Auto" ) );
583 m_zoomSelectBox->SetSelection( 0 );
584 m_zoomCustomEntry = wxNOT_FOUND;
585
586 wxCHECK( config(), /* void */ );
587
588 for( unsigned ii = 0; ii < GetWindowSettings( config() )->zoom_factors.size(); ++ii )
589 {
590 double current = GetWindowSettings( config() )->zoom_factors[ii];
591
592 m_zoomSelectBox->Append( wxString::Format( _( "Zoom %.2f" ), current ) );
593
594 if( zoom == current )
595 m_zoomSelectBox->SetSelection( (int) ii + 1 );
596 }
597}
598
599
600void EDA_DRAW_FRAME::OnSelectZoom( wxCommandEvent& event )
601{
602 wxCHECK_RET( m_zoomSelectBox, wxS( "m_zoomSelectBox uninitialized" ) );
603
604 int id = m_zoomSelectBox->GetCurrentSelection();
605
606 if( id < 0 || id >= (int) m_zoomSelectBox->GetCount() )
607 return;
608
609 // Picking the custom entry means keep the current zoom, so nothing to do.
610 if( id == m_zoomCustomEntry )
611 return;
612
613 // The custom entry pushes the presets down by one, so shift back to the real preset id.
614 int preset = id;
615
616 if( m_zoomCustomEntry != wxNOT_FOUND && id > m_zoomCustomEntry )
617 preset = id - 1;
618
619 m_toolManager->RunAction( ACTIONS::zoomPreset, preset );
621 m_canvas->Refresh();
622
623 // Needed on Windows (only) because clicking on m_zoomSelectBox removes the focus from m_canvas
624 m_canvas->SetFocus();
625}
626
627
628void EDA_DRAW_FRAME::OnMove( wxMoveEvent& aEvent )
629{
630 // If the window is moved to a different display, the scaling factor may change
631 double oldFactor = m_galDisplayOptions.m_scaleFactor;
632 m_galDisplayOptions.UpdateScaleFactor();
633
634 if( oldFactor != m_galDisplayOptions.m_scaleFactor && m_canvas )
635 {
636 // wx has not laid the frame out for the new DPI yet, so defer until the canvas has
637 // reached its final size
638 EDA_DRAW_PANEL_GAL* canvas = GetCanvas();
639
640 canvas->CallAfter( [canvas]() { canvas->ResizeGal( true ); } );
641 }
642
643 aEvent.Skip();
644}
645
646
648{
649 COMMON_TOOLS* commonTools = m_toolManager->GetTool<COMMON_TOOLS>();
650 CONDITIONAL_MENU& aMenu = aToolMenu.GetMenu();
651
652 aMenu.AddSeparator( 1000 );
653
654 std::shared_ptr<ZOOM_MENU> zoomMenu = std::make_shared<ZOOM_MENU>( this );
655 zoomMenu->SetTool( commonTools );
656 aToolMenu.RegisterSubMenu( zoomMenu );
657
658 std::shared_ptr<GRID_MENU> gridMenu = std::make_shared<GRID_MENU>( this );
659 gridMenu->SetTool( commonTools );
660 aToolMenu.RegisterSubMenu( gridMenu );
661
662 aMenu.AddMenu( zoomMenu.get(), SELECTION_CONDITIONS::ShowAlways, 1000 );
663 aMenu.AddMenu( gridMenu.get(), SELECTION_CONDITIONS::ShowAlways, 1000 );
664}
665
666
667void EDA_DRAW_FRAME::DisplayToolMsg( const wxString& msg )
668{
669 if( m_isClosing )
670 return;
671
672 SetStatusText( msg, 6 );
673}
674
675
676void EDA_DRAW_FRAME::DisplayConstraintsMsg( const wxString& msg )
677{
678 if( m_isClosing )
679 return;
680
681 SetStatusText( msg, 7 );
682}
683
684
686{
687 if( m_isClosing )
688 return;
689
690 wxString msg;
691
692 GRID_SETTINGS& gridSettings = GetWindowSettings( config() )->grid;
693 int currentIdx = gridSettings.last_size_idx;
694
695 msg.Printf( _( "grid %s" ), gridSettings.grids[currentIdx].UserUnitsMessageText( this, false ) );
696
697 SetStatusText( msg, 4 );
698}
699
700
702{
703 if( m_isClosing )
704 return;
705
706 wxString msg;
707
708 switch( GetUserUnits() )
709 {
710 case EDA_UNITS::INCH: msg = _( "inches" ); break;
711 case EDA_UNITS::MILS: msg = _( "mils" ); break;
712 case EDA_UNITS::MM: msg = _( "mm" ); break;
713 default: msg = _( "Units" ); break;
714 }
715
716 SetStatusText( msg, 5 );
717}
718
719
720void EDA_DRAW_FRAME::OnSize( wxSizeEvent& SizeEv )
721{
722 EDA_BASE_FRAME::OnSize( SizeEv );
723
724 m_frameSize = GetClientSize( );
725
726 SizeEv.Skip();
727}
728
729
731{
732 constexpr int numLocalFields = 8;
733
734 wxStatusBar* stsbar = GetStatusBar();
735 int spacer = KIUI::GetTextSize( wxT( "M" ), stsbar ).x;
736
737 // Note this is a KISTATUSBAR and there are fields to the right of the ones we know about
738 int totalFields = stsbar->GetFieldsCount();
739
740 std::vector<int> dims = {
741 // remainder of status bar on far left is set to a default or whatever is left over.
742 -2,
743
744 // When using GetTextSize() remember the width of character '1' is not the same
745 // as the width of '0' unless the font is fixed width, and it usually won't be.
746
747 // zoom:
748 KIUI::GetTextSize( wxT( "Z 762000" ), stsbar ).x + spacer,
749
750 // cursor coords
751 KIUI::GetTextSize( wxT( "X 00000.0000 Y 00000.0000" ), stsbar ).x + spacer,
752
753 // delta distances
754 KIUI::GetTextSize( wxT( "dx 00000.0000 dy 00000.0000 dist 00000.0000" ), stsbar ).x + spacer,
755
756 // grid size
757 KIUI::GetTextSize( wxT( "grid 0000.0000 x 0000.0000" ), stsbar ).x + spacer,
758
759 // units display, Inches is bigger than mm
760 KIUI::GetTextSize( _( "Inches" ), stsbar ).x + spacer,
761
762 // Size for the "Current Tool" panel
763 -1,
764
765 // constraint mode
766 KIUI::GetTextSize( _( "Constrain to H, V, 45" ), stsbar).x + spacer
767 };
768
769 for( int idx = numLocalFields; idx < totalFields; ++idx )
770 dims.emplace_back( stsbar->GetStatusWidth( idx ) );
771
772 SetStatusWidths( dims.size(), dims.data() );
773}
774
775
776wxStatusBar* EDA_DRAW_FRAME::OnCreateStatusBar( int number, long style, wxWindowID id, const wxString& name )
777{
778 return new KISTATUSBAR( number, this, id, KISTATUSBAR::STYLE_FLAGS::WARNING_ICON );
779}
780
781
783{
784 if( m_isClosing )
785 return;
786
787 SetStatusText( GetZoomLevelIndicator(), 1 );
788
789 // Absolute and relative cursor positions are handled by overloading this function and
790 // handling the internal to user units conversion at the appropriate level.
791
792 // refresh units display
794}
795
796
798{
799 // returns a human readable value which can be displayed as zoom
800 // level indicator in dialogs.
801 double zoom = m_canvas->GetGAL()->GetZoomFactor();
802 return wxString::Format( wxT( "Z %.2f" ), zoom );
803}
804
805
807{
809
811 WINDOW_SETTINGS* window = GetWindowSettings( aCfg );
812
813 // Read units used in dialogs and toolbars
814 SetUserUnits( static_cast<EDA_UNITS>( aCfg->m_System.units ) );
815
817
818 m_galDisplayOptions.ReadConfig( *cmnCfg, *window, this );
819
820 m_findReplaceData->findString = aCfg->m_FindReplace.find_string;
821 m_findReplaceData->replaceString = aCfg->m_FindReplace.replace_string;
822 m_findReplaceData->matchMode = static_cast<EDA_SEARCH_MATCH_MODE>( aCfg->m_FindReplace.match_mode );
823 m_findReplaceData->matchCase = aCfg->m_FindReplace.match_case;
824 m_findReplaceData->searchAndReplace = aCfg->m_FindReplace.search_and_replace;
825
826 for( const wxString& s : aCfg->m_FindReplace.find_history )
828
829 for( const wxString& s : aCfg->m_FindReplace.replace_history )
831
833}
834
835
837{
839
840 WINDOW_SETTINGS* window = GetWindowSettings( aCfg );
841
842 aCfg->m_System.units = static_cast<int>( GetUserUnits() );
844
845 m_galDisplayOptions.WriteConfig( *window );
846
847 aCfg->m_FindReplace.search_and_replace = m_findReplaceData->searchAndReplace;
848
849 aCfg->m_FindReplace.find_string = m_findReplaceData->findString;
850 aCfg->m_FindReplace.replace_string = m_findReplaceData->replaceString;
851
852 aCfg->m_FindReplace.find_history.clear();
853 aCfg->m_FindReplace.replace_history.clear();
854
855 for( size_t i = 0; i < m_findStringHistoryList.GetCount() && i < FR_HISTORY_LIST_CNT; i++ )
856 aCfg->m_FindReplace.find_history.push_back( m_findStringHistoryList[ i ].ToStdString() );
857
858 for( size_t i = 0; i < m_replaceStringHistoryList.GetCount() && i < FR_HISTORY_LIST_CNT; i++ )
859 aCfg->m_FindReplace.replace_history.push_back( m_replaceStringHistoryList[ i ].ToStdString() );
860
861 // Save the units used in this frame
862 if( m_toolManager )
863 {
864 if( COMMON_TOOLS* cmnTool = m_toolManager->GetTool<COMMON_TOOLS>() )
865 {
866 aCfg->m_System.last_imperial_units = static_cast<int>( cmnTool->GetLastImperialUnits() );
867 aCfg->m_System.last_metric_units = static_cast<int>( cmnTool->GetLastMetricUnits() );
868 }
869 }
870}
871
872
873void EDA_DRAW_FRAME::AppendMsgPanel( const wxString& aTextUpper, const wxString& aTextLower, int aPadding )
874{
876 m_messagePanel->AppendMessage( aTextUpper, aTextLower, aPadding );
877}
878
879
881{
883 m_messagePanel->EraseMsgBox();
884}
885
886
887void EDA_DRAW_FRAME::SetMsgPanel( const std::vector<MSG_PANEL_ITEM>& aList )
888{
890 {
891 m_messagePanel->EraseMsgBox();
892
893 for( const MSG_PANEL_ITEM& item : aList )
894 m_messagePanel->AppendMessage( item );
895 }
896}
897
898
899void EDA_DRAW_FRAME::SetMsgPanel( const wxString& aTextUpper, const wxString& aTextLower, int aPadding )
900{
902 {
903 m_messagePanel->EraseMsgBox();
904 m_messagePanel->AppendMessage( aTextUpper, aTextLower, aPadding );
905 }
906}
907
908
910{
911 wxCHECK_RET( aItem, wxT( "Invalid EDA_ITEM pointer. Bad programmer." ) );
912
913 std::vector<MSG_PANEL_ITEM> items;
914 aItem->GetMsgPanelInfo( this, items );
915 SetMsgPanel( items );
916}
917
918
922
923
925{
926 GetCanvas()->SetEvtHandlerEnabled( true );
928}
929
930
938
939
941{
942#ifdef __WXMAC__
943 // Cairo renderer doesn't handle Retina displays so there's really only one game
944 // in town for Mac
946#endif
947
949
950 if( COMMON_SETTINGS* cfg = Pgm().GetCommonSettings() )
951 canvasType = EDA_DRAW_PANEL_GAL::ResolveStoredCanvasType( cfg->m_Graphics.canvas_type );
952
953 wxString envCanvasType;
954
955 if( wxGetEnv( "KICAD_SOFTWARE_RENDERING", &envCanvasType ) )
956 {
957 if( envCanvasType.CmpNoCase( "1" ) == 0
958 || envCanvasType.CmpNoCase( "true" ) == 0
959 || envCanvasType.CmpNoCase( "yes" ) == 0 )
960 {
961 // Force software rendering if the environment variable is set
963 }
964 }
965
966 return canvasType;
967}
968
969
971{
972 // Not all classes derived from EDA_DRAW_FRAME can save the canvas type, because some
973 // have a fixed type, or do not have a option to set the canvas type (they inherit from
974 // a parent frame)
975 static std::vector<FRAME_T> s_allowedFrames = { FRAME_SCH,
981
982 if( !alg::contains( s_allowedFrames, m_ident ) )
983 return false;
984
985 if( wxGetEnv( "KICAD_SOFTWARE_RENDERING", nullptr ) )
986 {
987 // If the environment variable is set, don't save the canvas type.
988 return false;
989 }
990
991 if( aCanvasType < EDA_DRAW_PANEL_GAL::GAL_TYPE_NONE || aCanvasType >= EDA_DRAW_PANEL_GAL::GAL_TYPE_LAST )
992 {
993 wxASSERT( false );
994 return false;
995 }
996
997 if( COMMON_SETTINGS* cfg = Pgm().GetCommonSettings() )
998 cfg->m_Graphics.canvas_type = static_cast<int>( aCanvasType );
999
1000 return false;
1001}
1002
1003
1005{
1006 const VECTOR2I& gridOrigin = GetGridOrigin();
1007 VECTOR2D gridSize = GetCanvas()->GetGAL()->GetGridSize();
1008
1009 double xOffset = fmod( gridOrigin.x, gridSize.x );
1010 int x = KiROUND( (aPosition.x - xOffset) / gridSize.x );
1011 double yOffset = fmod( gridOrigin.y, gridSize.y );
1012 int y = KiROUND( (aPosition.y - yOffset) / gridSize.y );
1013
1014 return KiROUND( x * gridSize.x + xOffset, y * gridSize.y + yOffset );
1015}
1016
1017
1019{
1020 const VECTOR2I& gridOrigin = GetGridOrigin();
1021 VECTOR2D gridSize = GetCanvas()->GetGAL()->GetGridSize() / 2.0;
1022
1023 double xOffset = fmod( gridOrigin.x, gridSize.x );
1024 int x = KiROUND( (aPosition.x - xOffset) / gridSize.x );
1025 double yOffset = fmod( gridOrigin.y, gridSize.y );
1026 int y = KiROUND( (aPosition.y - yOffset) / gridSize.y );
1027
1028 return KiROUND( x * gridSize.x + xOffset, y * gridSize.y + yOffset );
1029}
1030
1031
1032const BOX2I EDA_DRAW_FRAME::GetDocumentExtents( bool aIncludeAllVisible ) const
1033{
1034 return BOX2I();
1035}
1036
1037
1039{
1040 // To be implemented by subclasses.
1041}
1042
1043
1044void EDA_DRAW_FRAME::Zoom_Automatique( bool aWarpPointer )
1045{
1047}
1048
1049
1050std::vector<wxWindow*> EDA_DRAW_FRAME::findDialogs()
1051{
1052 std::vector<wxWindow*> dialogs;
1053
1054 for( wxWindow* window : GetChildren() )
1055 {
1056 if( dynamic_cast<DIALOG_SHIM*>( window ) )
1057 dialogs.push_back( window );
1058 }
1059
1060 return dialogs;
1061}
1062
1063
1064void EDA_DRAW_FRAME::FocusOnLocation( const VECTOR2I& aPos, bool aAllowScroll )
1065{
1066 bool centerView = false;
1067 std::vector<BOX2D> dialogScreenRects;
1068
1069 if( aAllowScroll )
1070 {
1071 BOX2D r = GetCanvas()->GetView()->GetViewport();
1072
1073 // Center if we're off the current view, or within 10% of its edge
1074 r.Inflate( - r.GetWidth() / 10.0 );
1075
1076 if( !r.Contains( aPos ) )
1077 centerView = true;
1078
1079 for( wxWindow* dialog : findDialogs() )
1080 {
1081 dialogScreenRects.emplace_back( ToVECTOR2D( GetCanvas()->ScreenToClient( dialog->GetScreenPosition() ) ),
1082 ToVECTOR2D( dialog->GetSize() ) );
1083 }
1084
1085 // Center if we're behind an obscuring dialog, or within 10% of its edge
1086 for( BOX2D rect : dialogScreenRects )
1087 {
1088 rect.Inflate( rect.GetWidth() / 10 );
1089
1090 if( rect.Contains( GetCanvas()->GetView()->ToScreen( aPos ) ) )
1091 centerView = true;
1092 }
1093 }
1094
1095 if( centerView )
1096 {
1097 try
1098 {
1099 GetCanvas()->GetView()->SetCenter( aPos, dialogScreenRects );
1100 }
1101 catch( const Clipper2Lib::Clipper2Exception& e )
1102 {
1103 wxFAIL_MSG( wxString::Format( wxT( "Clipper2 exception occurred centering object: %s" ), e.what() ) );
1104 }
1105 }
1106
1108}
1109
1110
1111void PrintDrawingSheet( const RENDER_SETTINGS* aSettings, const PAGE_INFO& aPageInfo,
1112 const wxString& aSheetName, const wxString& aSheetPath,
1113 const wxString& aFileName, const TITLE_BLOCK& aTitleBlock,
1114 const std::map<wxString, wxString>* aProperties, int aSheetCount,
1115 const wxString& aPageNumber, double aMils2Iu, const PROJECT* aProject,
1116 const wxString& aSheetLayer, bool aIsFirstPage )
1117{
1118 DS_DRAW_ITEM_LIST drawList( unityScale );
1119
1120 drawList.SetDefaultPenSize( aSettings->GetDefaultPenWidth() );
1121 drawList.SetPlotterMilsToIUfactor( aMils2Iu );
1122 drawList.SetPageNumber( aPageNumber );
1123 drawList.SetSheetCount( aSheetCount );
1124 drawList.SetFileName( aFileName );
1125 drawList.SetSheetName( aSheetName );
1126 drawList.SetSheetPath( aSheetPath );
1127 drawList.SetSheetLayer( aSheetLayer );
1128 drawList.SetProject( aProject );
1129 drawList.SetIsFirstPage( aIsFirstPage );
1130 drawList.SetProperties( aProperties );
1131
1132 drawList.BuildDrawItemsList( aPageInfo, aTitleBlock );
1133
1134 // Draw item list
1135 drawList.Print( aSettings );
1136}
1137
1138
1140 const std::map<wxString, wxString>* aProperties,
1141 double aMils2Iu, const wxString &aFilename,
1142 const wxString &aSheetLayer )
1143{
1145 return;
1146
1147 wxDC* DC = aSettings->GetPrintDC();
1148 wxPoint origin = DC->GetDeviceOrigin();
1149
1150 if( origin.y > 0 )
1151 {
1152 DC->SetDeviceOrigin( 0, 0 );
1153 DC->SetAxisOrientation( true, false );
1154 }
1155
1157 aFilename, GetTitleBlock(), aProperties, aScreen->GetPageCount(),
1158 aScreen->GetPageNumber(), aMils2Iu, &Prj(), aSheetLayer,
1159 aScreen->GetVirtualPageNumber() == 1 );
1160
1161 if( origin.y > 0 )
1162 {
1163 DC->SetDeviceOrigin( origin.x, origin.y );
1164 DC->SetAxisOrientation( true, true );
1165 }
1166}
1167
1168
1170{
1171 // Virtual function. Base class implementation returns an empty string.
1172 return wxEmptyString;
1173}
1174
1175
1177{
1178 // Virtual function. Base class implementation returns an empty string.
1179 return wxEmptyString;
1180}
1181
1182
1183bool EDA_DRAW_FRAME::LibraryFileBrowser( const wxString& aTitle, bool doOpen, wxFileName& aFilename,
1184 const wxString& wildcard, const wxString& ext,
1185 bool isDirectory, FILEDLG_HOOK_NEW_LIBRARY* aFileDlgHook )
1186{
1187 aFilename.SetExt( ext );
1188
1189 wxString defaultDir = aFilename.GetPath();
1190
1191 if( defaultDir.IsEmpty() )
1192 defaultDir = GetMruPath();
1193
1194 if( isDirectory && doOpen )
1195 {
1196 wxDirDialog dlg( this, aTitle, defaultDir, wxDD_DEFAULT_STYLE | wxDD_DIR_MUST_EXIST );
1197
1198 if( dlg.ShowModal() == wxID_CANCEL )
1199 return false;
1200
1201 aFilename = dlg.GetPath();
1202 aFilename.SetExt( ext );
1203 }
1204 else
1205 {
1206 // Ensure the file has a dummy name, otherwise GTK will display the regex from the filter
1207 if( aFilename.GetName().empty() )
1208 aFilename.SetName( wxS( "Library" ) );
1209
1210 wxFileDialog dlg( this, aTitle, defaultDir, aFilename.GetFullName(), wildcard,
1211 doOpen ? wxFD_OPEN | wxFD_FILE_MUST_EXIST
1212 : wxFD_SAVE | wxFD_CHANGE_DIR | wxFD_OVERWRITE_PROMPT );
1213
1214 if( aFileDlgHook )
1215 dlg.SetCustomizeHook( *aFileDlgHook );
1216
1218
1219 if( dlg.ShowModal() == wxID_CANCEL )
1220 return false;
1221
1222 aFilename = dlg.GetPath();
1223 aFilename.SetExt( ext );
1224 }
1225
1226 SetMruPath( aFilename.GetPath() );
1227
1228 return true;
1229}
1230
1231
1233{
1235
1236 if( m_searchPane )
1237 {
1238 wxAuiPaneInfo& search_pane_info = m_auimgr.GetPane( m_searchPane );
1239 search_pane_info.Caption( _( "Search" ) );
1240 }
1241
1242 if( m_propertiesPanel )
1243 {
1244 wxAuiPaneInfo& properties_pane_info = m_auimgr.GetPane( m_propertiesPanel );
1245 properties_pane_info.Caption( _( "Properties" ) );
1246 }
1247
1249 {
1250 wxAuiPaneInfo& net_inspector_panel_info = m_auimgr.GetPane( m_netInspectorPanel );
1251 net_inspector_panel_info.Caption( _( "Net Inspector" ) );
1252 }
1253}
1254
1255
1257{
1258 if( m_isClosing || !m_propertiesPanel || !m_propertiesPanel->IsShownOnScreen() )
1259 return;
1260
1261 m_propertiesPanel->UpdateData();
1262}
1263
1264
1269
1270
1272{
1273 if( !m_colorSettings || aForceRefresh )
1274 {
1276 const_cast<EDA_DRAW_FRAME*>( this )->m_colorSettings = colorSettings;
1277 }
1278
1279 return m_colorSettings;
1280}
1281
1282
1284{
1286
1287 ACTION_MANAGER* mgr = m_toolManager->GetActionManager();
1288 EDITOR_CONDITIONS cond( this );
1289
1290 wxASSERT( mgr );
1291
1295}
1296
1297
1299 const std::function<bool( const SELECTION& )>& aEnable )
1300{
1301 ACTION_MANAGER* mgr = m_toolManager->GetActionManager();
1302 const std::string arcToolPrefix = aDrawArc.GetName();
1303
1304 // Every arc tool action extends the plain action's name, so one compare covers them all
1305 const SELECTION_CONDITION arcToolActive =
1306 [this, arcToolPrefix]( const SELECTION& )
1307 {
1308 return CurrentToolName().starts_with( arcToolPrefix );
1309 };
1310
1312
1313 do
1314 {
1315 const SELECTION_CONDITION inMode =
1316 [this, mode]( const SELECTION& )
1317 {
1318 APP_SETTINGS_BASE* cfg = config();
1319
1320 return cfg && cfg->m_ArcDrawMode == mode;
1321 };
1322
1323 if( const TOOL_ACTION* action = drawArcAction( mode ) )
1324 mgr->SetConditions( *action, ACTION_CONDITIONS().Enable( aEnable ).Check( inMode && arcToolActive ) );
1325
1326 mode = IncrementArcDrawMode( mode );
1327 } while( mode != ARC_DRAW_MODE::CENTER_START_END );
1328}
1329
1330
1332{
1333 APP_SETTINGS_BASE* cfg = config();
1334
1335 // The arc group would otherwise start on its first entry and overwrite the saved mode
1336 if( const TOOL_ACTION* action = cfg ? drawArcAction( cfg->m_ArcDrawMode ) : nullptr )
1337 SelectToolbarAction( *action );
1338}
1339
1340
1342{
1343 COMMON_TOOLS* cmnTool = m_toolManager->GetTool<COMMON_TOOLS>();
1344
1345 if( cmnTool )
1346 {
1347 // Tell the tool what the units used last session
1348 cmnTool->SetLastUnits( static_cast<EDA_UNITS>( aCfg->m_System.last_imperial_units ) );
1349 cmnTool->SetLastUnits( static_cast<EDA_UNITS>( aCfg->m_System.last_metric_units ) );
1350 }
1351
1352 // Tell the tool what units the frame is currently using
1353 switch( static_cast<EDA_UNITS>( aCfg->m_System.units ) )
1354 {
1355 default:
1356 case EDA_UNITS::MM: m_toolManager->RunAction( ACTIONS::millimetersUnits ); break;
1357 case EDA_UNITS::INCH: m_toolManager->RunAction( ACTIONS::inchesUnits ); break;
1358 case EDA_UNITS::MILS: m_toolManager->RunAction( ACTIONS::milsUnits ); break;
1359 }
1360}
1361
1362
1363void EDA_DRAW_FRAME::GetUnitPair( EDA_UNITS& aPrimaryUnit, EDA_UNITS& aSecondaryUnits )
1364{
1365 COMMON_TOOLS* cmnTool = m_toolManager->GetTool<COMMON_TOOLS>();
1366
1367 aPrimaryUnit = GetUserUnits();
1368 aSecondaryUnits = EDA_UNITS::MILS;
1369
1370 if( EDA_UNIT_UTILS::IsImperialUnit( aPrimaryUnit ) )
1371 {
1372 if( cmnTool )
1373 aSecondaryUnits = cmnTool->GetLastMetricUnits();
1374 else
1375 aSecondaryUnits = EDA_UNITS::MM;
1376 }
1377 else
1378 {
1379 if( cmnTool )
1380 aSecondaryUnits = cmnTool->GetLastImperialUnits();
1381 else
1382 aSecondaryUnits = EDA_UNITS::MILS;
1383 }
1384}
1385
1386
1388{
1390
1391 // If we had an OpenGL failure this session, use the fallback GAL but don't update the
1392 // user preference silently:
1393
1396
1397 if( m_canvasType != GetCanvas()->GetBackend() )
1398 {
1399 // SwitchCanvas overwrites m_canvasType with whatever backend it ended up on
1401
1402 // Try to switch (will automatically fallback if necessary)
1403 SwitchCanvas( requested );
1404
1405 if( GetCanvas()->GetBackend() != requested )
1406 {
1408 m_openGLFailureOccured = true; // Store failure for other EDA_DRAW_FRAMEs
1409 }
1410 }
1411}
1412
1413
1414void EDA_DRAW_FRAME::handleActivateEvent( wxActivateEvent& aEvent )
1415{
1416 // Force a refresh of the message panel to ensure that the text is the right color
1417 // when the window activates
1418 if( !IsIconized() )
1419 m_messagePanel->Refresh();
1420}
1421
1422
1423void EDA_DRAW_FRAME::onActivate( wxActivateEvent& aEvent )
1424{
1425 handleActivateEvent( aEvent );
1426
1427 aEvent.Skip();
1428}
1429
1430
1431bool EDA_DRAW_FRAME::SaveCanvasImageToFile( const wxString& aFileName, BITMAP_TYPE aBitmapType )
1432{
1433 wxImage image;
1434
1435
1436 if( !GetCanvas()->GetScreenshot( image ) )
1437 {
1438 wxSize image_size = GetCanvas()->GetClientSize();
1439 wxClientDC dc( GetCanvas() );
1440 wxBitmap bitmap( image_size.x, image_size.y );
1441 wxMemoryDC memdc;
1442
1443 memdc.SelectObject( bitmap );
1444 memdc.Blit( 0, 0, image_size.x, image_size.y, &dc, 0, 0 );
1445 memdc.SelectObject( wxNullBitmap );
1446
1447 image = bitmap.ConvertToImage();
1448 }
1449
1450 wxBitmapType type = wxBITMAP_TYPE_PNG;
1451 switch( aBitmapType )
1452 {
1453 case BITMAP_TYPE::PNG: type = wxBITMAP_TYPE_PNG; break;
1454 case BITMAP_TYPE::BMP: type = wxBITMAP_TYPE_BMP; break;
1455 case BITMAP_TYPE::JPG: type = wxBITMAP_TYPE_JPEG; break;
1456 }
1457
1458 bool retv = image.SaveFile( aFileName, type );
1459
1460 image.Destroy();
1461 return retv;
1462}
1463
1464
1466{
1467 wxCHECK( aCfg, aAction.show_button );
1468
1469 for( const auto& [identifier, visible] : aCfg->m_Plugins.actions )
1470 {
1471 if( identifier == aAction.identifier )
1472 return visible;
1473 }
1474
1475 return aAction.show_button;
1476}
1477
1478
1479std::vector<const PLUGIN_ACTION*> EDA_DRAW_FRAME::GetOrderedPluginActions( PLUGIN_ACTION_SCOPE aScope,
1480 APP_SETTINGS_BASE* aCfg )
1481{
1482 std::vector<const PLUGIN_ACTION*> actions;
1483 wxCHECK( aCfg, actions );
1484
1486 std::vector<const PLUGIN_ACTION*> unsorted = mgr.GetActionsForScope( aScope );
1487 std::map<wxString, const PLUGIN_ACTION*> actionMap;
1488 std::set<const PLUGIN_ACTION*> handled;
1489
1490 for( const PLUGIN_ACTION* action : unsorted )
1491 actionMap[action->identifier] = action;
1492
1493 for( const auto& identifier : aCfg->m_Plugins.actions | std::views::keys )
1494 {
1495 if( actionMap.contains( identifier ) )
1496 {
1497 const PLUGIN_ACTION* action = actionMap[ identifier ];
1498 actions.emplace_back( action );
1499 handled.insert( action );
1500 }
1501 }
1502
1503 for( const auto& action : actionMap | std::views::values )
1504 {
1505 if( !handled.contains( action ) )
1506 actions.emplace_back( action );
1507 }
1508
1509 return actions;
1510}
1511
1512
1514{
1515 wxCHECK( aMenu, 0 );
1516
1518
1519 mgr.MenuBindings( m_ident ).clear();
1520
1521 std::vector<const PLUGIN_ACTION*> actions = GetOrderedPluginActions( PluginActionScope(), config() );
1522
1523 size_t count = 0;
1524
1525 for( const PLUGIN_ACTION* action : actions )
1526 {
1527 const std::vector<wxImage>& images =
1528 KIPLATFORM::UI::IsDarkTheme() && !action->icon_dark.empty() ? action->icon_dark : action->icon_light;
1529
1531 wxBitmapBundle icon;
1532
1533 if( images.empty() )
1534 {
1535 icon = KiBitmapBundleDef( BITMAPS::puzzle_piece, iconSize );
1536 }
1537 else
1538 {
1539 wxVector<wxBitmap> bitmaps;
1540
1541 for( const wxImage& img : images )
1542 bitmaps.push_back( wxBitmap( img ) );
1543
1544 icon = BITMAP_STORE::MakeBitmapBundleDef( bitmaps, iconSize );
1545 }
1546
1547 if( !icon.IsOk() )
1548 continue;
1549
1550 wxMenuItem* item = KIUI::AddMenuItem( aMenu, wxID_ANY, action->name, action->description, icon );
1551
1552 Connect( item->GetId(), wxEVT_COMMAND_MENU_SELECTED,
1553 wxCommandEventHandler( EDA_DRAW_FRAME::OnApiPluginInvoke ) );
1554
1555 mgr.MenuBindings( m_ident ).insert( { item->GetId(), action->identifier } );
1556
1557 ++count;
1558 }
1559
1560 return count;
1561}
1562
1563
1565{
1567
1568 mgr.ButtonBindings( m_ident ).clear();
1569
1570 std::vector<const PLUGIN_ACTION*> actions = GetOrderedPluginActions( PluginActionScope(), config() );
1571
1573
1574 for( const PLUGIN_ACTION* action : actions )
1575 {
1576 if( !IsPluginActionButtonVisible( *action, config() ) )
1577 continue;
1578
1579 const std::vector<wxImage>& images = KIPLATFORM::UI::IsDarkTheme() && !action->icon_dark.empty()
1580 ? action->icon_dark
1581 : action->icon_light;
1582
1583 if( images.empty() )
1584 continue;
1585
1586 wxVector<wxBitmap> bitmaps;
1587
1588 for( const wxImage& img : images )
1589 bitmaps.push_back( wxBitmap( img ) );
1590
1591 wxBitmapBundle icon = BITMAP_STORE::MakeBitmapBundleDef( bitmaps, iconSize );
1592
1593 if( !icon.IsOk() )
1594 continue;
1595
1596 wxAuiToolBarItem* button = aToolbar->AddTool( wxID_ANY, wxEmptyString, icon, action->name );
1597
1598 Connect( button->GetId(), wxEVT_COMMAND_MENU_SELECTED,
1599 wxCommandEventHandler( EDA_DRAW_FRAME::OnApiPluginInvoke ) );
1600
1601 mgr.ButtonBindings( m_ident ).insert( { button->GetId(), action->identifier } );
1602 }
1603}
1604
1605
1606void EDA_DRAW_FRAME::OnApiPluginInvoke( wxCommandEvent& aEvent )
1607{
1609
1610 std::optional<wxString> identifier;
1611
1612 if( mgr.ButtonBindings( m_ident ).contains( aEvent.GetId() ) )
1613 identifier = mgr.ButtonBindings( m_ident ).at( aEvent.GetId() );
1614 else if( mgr.MenuBindings( m_ident ).contains( aEvent.GetId() ) )
1615 identifier = mgr.MenuBindings( m_ident ).at( aEvent.GetId() );
1616
1617 if( !identifier )
1618 return;
1619
1620 std::shared_ptr<REPORTER> reporter;
1621
1622 if( KISTATUSBAR* statusBar = dynamic_cast<KISTATUSBAR*>( GetStatusBar() ) )
1623 reporter = std::make_shared<STATUSBAR_WARNING_REPORTER>( statusBar, wxS( "plugin" ) );
1624
1625 mgr.InvokeAction( *identifier, reporter );
1626}
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:275
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.
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.
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.
static bool m_openGLFailureOccured
Has any failure occurred when switching to OpenGL in any EDA_DRAW_FRAME?
BASE_SCREEN * m_currentScreen
current used SCREEN
virtual wxString GetScreenDesc() const
VECTOR2I GetNearestGridPosition(const VECTOR2I &aPosition) const
Return the nearest aGridSize location to aPosition.
EDA_MSG_PANEL * m_messagePanel
virtual const VECTOR2I & GetGridOrigin() const =0
Return the absolute coordinates of the origin of the snap grid.
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
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:345
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:611
void SetCenter(const VECTOR2D &aCenter)
Set the center point of the VIEW (i.e.
Definition view.cpp:677
void MarkTargetDirty(int aTarget)
Set or clear target 'dirty' flag.
Definition view.h:661
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:546
virtual API_PLUGIN_MANAGER & GetPluginManager() const
Definition pgm_base.h:139
Container for project specific data.
Definition project.h:63
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:51
void AllowNetworkFileSystems(wxDialog *aDialog)
Configure a file dialog to show network and virtual file systems.
Definition wxgtk/ui.cpp:533
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:78
bool contains(const _Container &__container, _Value __value)
Returns true if the container contains the given value.
Definition kicad_algo.h:96
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