Browse Source

More ID eradication.

pull/18/head
Jeff Young 5 months ago
parent
commit
55992e6ff0
  1. 27
      include/id.h
  2. 37
      pcbnew/pcb_edit_frame.cpp
  3. 5
      pcbnew/pcb_edit_frame.h
  4. 25
      pcbnew/tools/board_editor_control.cpp
  5. 1
      pcbnew/tools/board_editor_control.h

27
include/id.h

@ -24,30 +24,12 @@
*/
/**
* @file id.h
*
* @brief Common command IDs shared by more than one of the KiCad applications.
*
* Only place command IDs used in base window class event tables or shared
* across multiple applications such as the zoom, grid, and language IDs.
* Application specific IDs should be defined in the appropriate header
* file to prevent the entire project from being rebuilt.
*
* However, we must avoid duplicate IDs in menus and toolbar items, when wxUpdateUIEvent
* are associated to menuitems and/or toolbar items
* The reason is the fact wxWidgets try to send a wxUpdateUIEvent event to a given window and,
* if a wxUpdateUIEvent event function is not defined for a menuitem, wxWidgets
* propagates this event ID to parents of the given window.
* Therefore duplicate IDs could create strange behavior in menus and subtle bugs, depending
* on the code inside the wxUpdateUIEvent event functions called in parent frames.
* I did not seen this propagation to child frames, only to parent frames
*
* Issues exist only if 2 menus have the same ID, and only one menu is associated to
* a wxUpdateUIEvent event, and this one is defined in a parent Window.
* The probability it happens is low, but not null.
*
* Therefore we reserve room in ID list for each sub application.
* Please, change these values if needed
* Most things should use the new ACTION framwork instead.
*/
@ -81,13 +63,6 @@ enum main_id
ID_PREFERENCES_RESET_PANEL,
ID_GEN_PLOT,
ID_GEN_PLOT_PS,
ID_GEN_PLOT_GERBER,
ID_GEN_PLOT_SVG,
ID_GEN_PLOT_DXF,
ID_GEN_PLOT_PDF,
ID_LANGUAGE_CHOICE,
ID_LANGUAGE_DANISH,
ID_LANGUAGE_DEFAULT,

37
pcbnew/pcb_edit_frame.cpp

@ -36,7 +36,6 @@
#include <pcbnew_settings.h>
#include <pcb_layer_box_selector.h>
#include <footprint_edit_frame.h>
#include <dialog_plot.h>
#include <dialog_find.h>
#include <dialog_footprint_properties.h>
#include <dialogs/dialog_exchange_footprints.h>
@ -1999,42 +1998,6 @@ void PCB_EDIT_FRAME::FindNext( bool reverse )
}
void PCB_EDIT_FRAME::ToPlotter( int aID )
{
PCB_PLOT_PARAMS plotSettings = GetPlotSettings();
switch( aID )
{
case ID_GEN_PLOT_GERBER:
plotSettings.SetFormat( PLOT_FORMAT::GERBER );
break;
case ID_GEN_PLOT_DXF:
plotSettings.SetFormat( PLOT_FORMAT::DXF );
break;
case ID_GEN_PLOT_PDF:
plotSettings.SetFormat( PLOT_FORMAT::PDF );
break;
case ID_GEN_PLOT_PS:
plotSettings.SetFormat( PLOT_FORMAT::POST );
break;
case ID_GEN_PLOT_SVG:
plotSettings.SetFormat( PLOT_FORMAT::SVG );
break;
case ID_GEN_PLOT:
/* keep the previous setup */
break;
default:
wxFAIL_MSG( wxT( "ToPlotter(): unexpected plot type" ) ); break;
break;
}
SetPlotSettings( plotSettings );
DIALOG_PLOT dlg( this );
dlg.ShowQuasiModal( );
}
int PCB_EDIT_FRAME::TestStandalone()
{
if( Kiface().IsSingle() )

5
pcbnew/pcb_edit_frame.h

@ -156,11 +156,6 @@ public:
*/
void FindNext( bool reverse = false );
/**
* Open a dialog frame to create plot and drill files relative to the current board.
*/
void ToPlotter( int aID );
bool LayerManagerShown();
bool PropertiesShown();
bool NetInspectorShown();

25
pcbnew/tools/board_editor_control.cpp

@ -48,6 +48,7 @@
#include <dialogs/dialog_page_settings.h>
#include <dialogs/dialog_update_pcb.h>
#include <dialogs/dialog_assign_netclass.h>
#include <dialog_plot.h>
#include <kiface_base.h>
#include <kiway.h>
#include <netlist_reader/pcb_netlist.h>
@ -368,7 +369,8 @@ int BOARD_EDITOR_CONTROL::PageSettings( const TOOL_EVENT& aEvent )
int BOARD_EDITOR_CONTROL::Plot( const TOOL_EVENT& aEvent )
{
m_frame->ToPlotter( ID_GEN_PLOT );
DIALOG_PLOT dlg( m_frame );
dlg.ShowQuasiModal();
return 0;
}
@ -530,13 +532,26 @@ int BOARD_EDITOR_CONTROL::ExportNetlist( const TOOL_EVENT& aEvent )
}
int BOARD_EDITOR_CONTROL::GenerateGerbers( const TOOL_EVENT& aEvent )
{
PCB_PLOT_PARAMS plotSettings = m_frame->GetPlotSettings();
plotSettings.SetFormat( PLOT_FORMAT::GERBER );
m_frame->SetPlotSettings( plotSettings );
DIALOG_PLOT dlg( m_frame );
dlg.ShowQuasiModal( );
return 0;
}
int BOARD_EDITOR_CONTROL::GenerateFabFiles( const TOOL_EVENT& aEvent )
{
wxCommandEvent dummy;
if( aEvent.IsAction( &PCB_ACTIONS::generateGerbers ) )
m_frame->ToPlotter( ID_GEN_PLOT_GERBER );
else if( aEvent.IsAction( &PCB_ACTIONS::generateReportFile ) )
if( aEvent.IsAction( &PCB_ACTIONS::generateReportFile ) )
m_frame->GenFootprintsReport( dummy );
else if( aEvent.IsAction( &PCB_ACTIONS::generateD356File ) )
m_frame->GenD356File( dummy );
@ -1846,7 +1861,7 @@ void BOARD_EDITOR_CONTROL::setTransitions()
}
Go( &BOARD_EDITOR_CONTROL::GenerateDrillFiles, PCB_ACTIONS::generateDrillFiles.MakeEvent() );
Go( &BOARD_EDITOR_CONTROL::GenerateFabFiles, PCB_ACTIONS::generateGerbers.MakeEvent() );
Go( &BOARD_EDITOR_CONTROL::GenerateGerbers, PCB_ACTIONS::generateGerbers.MakeEvent() );
Go( &BOARD_EDITOR_CONTROL::GeneratePosFile, PCB_ACTIONS::generatePosFile.MakeEvent() );
Go( &BOARD_EDITOR_CONTROL::GenerateFabFiles, PCB_ACTIONS::generateReportFile.MakeEvent() );
Go( &BOARD_EDITOR_CONTROL::GenerateFabFiles, PCB_ACTIONS::generateD356File.MakeEvent() );

1
pcbnew/tools/board_editor_control.h

@ -75,6 +75,7 @@ public:
int ExportNetlist( const TOOL_EVENT& aEvent );
int GenerateDrillFiles( const TOOL_EVENT& aEvent );
int GeneratePosFile( const TOOL_EVENT& aEvent );
int GenerateGerbers( const TOOL_EVENT& aEvent );
int GenerateFabFiles( const TOOL_EVENT& aEvent );
int RepairBoard( const TOOL_EVENT& aEvent );

Loading…
Cancel
Save