Gerbview: minor code cleanup.

This commit is contained in:
jean-pierre charras 2016-06-18 11:37:36 +02:00
parent 85f45eb302
commit dbd9b5e49e
11 changed files with 26 additions and 33 deletions

View File

@ -47,7 +47,7 @@ bool GERBVIEW_FRAME::Clear_DrawLayers( bool query )
return false;
}
GetGerberLayout()->GetImagesList()->DeleteAllImages();
GetImagesList()->DeleteAllImages();
GetGerberLayout()->SetBoundingBox( EDA_RECT() );
@ -70,7 +70,7 @@ void GERBVIEW_FRAME::Erase_Current_DrawLayer( bool query )
SetCurItem( NULL );
GetGerberLayout()->GetImagesList()->DeleteImage( layer );
GetImagesList()->DeleteImage( layer );
m_LayersManager->UpdateLayerIcons();
syncLayerBox();

View File

@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Apr 10 2012)
// C++ code generated with wxFormBuilder (version May 6 2016)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!
@ -14,7 +14,6 @@ BEGIN_EVENT_TABLE( LAYERS_MAP_DIALOG_BASE, DIALOG_SHIM )
EVT_BUTTON( ID_STORE_CHOICE, LAYERS_MAP_DIALOG_BASE::_wxFB_OnStoreSetup )
EVT_BUTTON( ID_GET_PREVIOUS_CHOICE, LAYERS_MAP_DIALOG_BASE::_wxFB_OnGetSetup )
EVT_BUTTON( ID_RESET_CHOICE, LAYERS_MAP_DIALOG_BASE::_wxFB_OnResetClick )
EVT_BUTTON( wxID_CANCEL, LAYERS_MAP_DIALOG_BASE::_wxFB_OnCancelClick )
EVT_BUTTON( wxID_OK, LAYERS_MAP_DIALOG_BASE::_wxFB_OnOkClick )
END_EVENT_TABLE()
@ -41,7 +40,7 @@ LAYERS_MAP_DIALOG_BASE::LAYERS_MAP_DIALOG_BASE( wxWindow* parent, wxWindowID id,
sbSizerLayersTable->Add( m_flexLeftColumnBoxSizer, 1, wxEXPAND, 5 );
m_staticlineSep = new wxStaticLine( this, ID_M_STATICLINESEP, wxDefaultPosition, wxDefaultSize, wxLI_VERTICAL );
m_staticlineSep = new wxStaticLine( sbSizerLayersTable->GetStaticBox(), ID_M_STATICLINESEP, wxDefaultPosition, wxDefaultSize, wxLI_VERTICAL );
sbSizerLayersTable->Add( m_staticlineSep, 0, wxEXPAND | wxALL, 5 );

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<wxFormBuilder_Project>
<FileVersion major="1" minor="11" />
<FileVersion major="1" minor="13" />
<object class="Project" expanded="1">
<property name="class_decoration"></property>
<property name="code_generation">C++</property>
@ -20,8 +20,10 @@
<property name="path">.</property>
<property name="precompiled_header"></property>
<property name="relative_path">1</property>
<property name="skip_lua_events">1</property>
<property name="skip_php_events">1</property>
<property name="skip_python_events">1</property>
<property name="ui_table">UI</property>
<property name="use_enum">1</property>
<property name="use_microsoft_bom">0</property>
<object class="Dialog" expanded="1">
@ -110,6 +112,7 @@
<property name="minimum_size"></property>
<property name="name">sbSizerLayersTable</property>
<property name="orient">wxHORIZONTAL</property>
<property name="parent">1</property>
<property name="permission">protected</property>
<event name="OnUpdateUI"></event>
<object class="sizeritem" expanded="1">
@ -794,7 +797,7 @@
<property name="name">m_sdbSizerButtons</property>
<property name="permission">protected</property>
<event name="OnApplyButtonClick"></event>
<event name="OnCancelButtonClick">OnCancelClick</event>
<event name="OnCancelButtonClick"></event>
<event name="OnContextHelpButtonClick"></event>
<event name="OnHelpButtonClick"></event>
<event name="OnNoButtonClick"></event>

View File

@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Apr 10 2012)
// C++ code generated with wxFormBuilder (version May 6 2016)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!
@ -11,6 +11,8 @@
#include <wx/artprov.h>
#include <wx/xrc/xmlres.h>
#include <wx/intl.h>
class DIALOG_SHIM;
#include "dialog_shim.h"
#include <wx/sizer.h>
#include <wx/gdicmn.h>
@ -40,7 +42,6 @@ class LAYERS_MAP_DIALOG_BASE : public DIALOG_SHIM
void _wxFB_OnStoreSetup( wxCommandEvent& event ){ OnStoreSetup( event ); }
void _wxFB_OnGetSetup( wxCommandEvent& event ){ OnGetSetup( event ); }
void _wxFB_OnResetClick( wxCommandEvent& event ){ OnResetClick( event ); }
void _wxFB_OnCancelClick( wxCommandEvent& event ){ OnCancelClick( event ); }
void _wxFB_OnOkClick( wxCommandEvent& event ){ OnOkClick( event ); }
@ -74,7 +75,6 @@ class LAYERS_MAP_DIALOG_BASE : public DIALOG_SHIM
virtual void OnStoreSetup( wxCommandEvent& event ) { event.Skip(); }
virtual void OnGetSetup( wxCommandEvent& event ) { event.Skip(); }
virtual void OnResetClick( wxCommandEvent& event ) { event.Skip(); }
virtual void OnCancelClick( wxCommandEvent& event ) { event.Skip(); }
virtual void OnOkClick( wxCommandEvent& event ) { event.Skip(); }

View File

@ -49,8 +49,7 @@ GERBER_DRAW_ITEM* GERBVIEW_FRAME::Locate( const wxPoint& aPosition, int aTypeloc
ref = GetNearestGridPosition( ref );
int layer = getActiveLayer();
GERBER_FILE_IMAGE_LIST* images = GetGerberLayout()->GetImagesList();
GERBER_FILE_IMAGE* gerber = images->GetGbrImage( layer );
GERBER_FILE_IMAGE* gerber = GetGbrImage( layer );
// Search first on active layer
GERBER_DRAW_ITEM* gerb_item = NULL;
@ -69,9 +68,9 @@ GERBER_DRAW_ITEM* GERBVIEW_FRAME::Locate( const wxPoint& aPosition, int aTypeloc
if( !found ) // Search on all layers
{
for( layer = 0; layer < (int)images->ImagesMaxCount(); ++layer )
for( layer = 0; layer < (int)ImagesMaxCount(); ++layer )
{
gerber = images->GetGbrImage( layer );
gerber = GetGbrImage( layer );
if( gerber == NULL ) // Graphic layer not yet used
continue;

View File

@ -42,8 +42,7 @@ void GERBVIEW_FRAME::OnLeftClick( wxDC* DC, const wxPoint& aPosition )
if( DrawStruct == NULL )
{
GERBER_FILE_IMAGE_LIST* images = GetGerberLayout()->GetImagesList();
GERBER_FILE_IMAGE* gerber = images->GetGbrImage( getActiveLayer() );
GERBER_FILE_IMAGE* gerber = GetGbrImage( getActiveLayer() );
if( gerber )
gerber->DisplayImageInfo( this );

View File

@ -36,10 +36,10 @@
*/
bool GERBVIEW_FRAME::OnRightClick( const wxPoint& aPosition, wxMenu* PopMenu )
{
GERBER_DRAW_ITEM* DrawStruct = (GERBER_DRAW_ITEM*) GetScreen()->GetCurItem();
GERBER_DRAW_ITEM* currItem = (GERBER_DRAW_ITEM*) GetScreen()->GetCurItem();
wxString msg;
bool BlockActive = !GetScreen()->m_BlockLocate.IsIdle();
bool busy = DrawStruct && DrawStruct->GetFlags();
bool busy = currItem && currItem->GetFlags();
// Do not initiate a start block validation on menu.
m_canvas->SetCanStartBlock( -1 );
@ -47,8 +47,8 @@ bool GERBVIEW_FRAME::OnRightClick( const wxPoint& aPosition, wxMenu* PopMenu )
// Simple location of elements where possible.
if( !busy )
{
DrawStruct = Locate( aPosition, CURSEUR_OFF_GRILLE );
busy = DrawStruct && DrawStruct->GetFlags();
currItem = Locate( aPosition, CURSEUR_OFF_GRILLE );
busy = currItem && currItem->GetFlags();
}
// If command in progress, end command.
@ -88,8 +88,8 @@ bool GERBVIEW_FRAME::OnRightClick( const wxPoint& aPosition, wxMenu* PopMenu )
if( BlockActive )
return true;
if( DrawStruct )
GetScreen()->SetCurItem( DrawStruct );
if( currItem )
GetScreen()->SetCurItem( currItem );
return true;
}

View File

@ -41,8 +41,8 @@ bool GERBVIEW_FRAME::Read_GERBER_File( const wxString& GERBER_FullFileName )
wxString msg;
int layer = getActiveLayer();
GERBER_FILE_IMAGE_LIST* images = GetGerberLayout()->GetImagesList();
GERBER_FILE_IMAGE* gerber = images->GetGbrImage( layer );
GERBER_FILE_IMAGE_LIST* images = GetImagesList();
GERBER_FILE_IMAGE* gerber = GetGbrImage( layer );
if( gerber == NULL )
{

View File

@ -395,12 +395,6 @@ void LAYERS_MAP_DIALOG::OnSelectLayer( wxCommandEvent& event )
}
void LAYERS_MAP_DIALOG::OnCancelClick( wxCommandEvent& event )
{
EndModal( wxID_CANCEL );
}
void LAYERS_MAP_DIALOG::OnOkClick( wxCommandEvent& event )
{
/* Make some test about copper layers:
@ -427,5 +421,6 @@ void LAYERS_MAP_DIALOG::OnOkClick( wxCommandEvent& event )
_("The exported board has not enough copper layers to handle selected inner layers") );
return;
}
EndModal( wxID_OK );
}

View File

@ -60,7 +60,6 @@ private:
void OnBrdLayersCountSelection( wxCommandEvent& event );
void OnSelectLayer( wxCommandEvent& event );
void OnOkClick( wxCommandEvent& event );
void OnCancelClick( wxCommandEvent& event );
void OnStoreSetup( wxCommandEvent& event );
void OnGetSetup( wxCommandEvent& event );

View File

@ -307,8 +307,7 @@ void GERBVIEW_FRAME::OnUpdateShowLayerManager( wxUpdateUIEvent& aEvent )
void GERBVIEW_FRAME::OnUpdateSelectDCode( wxUpdateUIEvent& aEvent )
{
int layer = getActiveLayer();
GERBER_FILE_IMAGE_LIST* images = GetGerberLayout()->GetImagesList();
GERBER_FILE_IMAGE* gerber = images->GetGbrImage( layer );
GERBER_FILE_IMAGE* gerber = GetGbrImage( layer );
int selected = ( gerber ) ? gerber->m_Selected_Tool : 0;
if( m_DCodeSelector && m_DCodeSelector->GetSelectedDCodeId() != selected )