Gerbview: fix mismatch between shown layers and visibility indicator in layers manager,
after loading (or reloading) files. Remove also not used code. Fixes #8847 https://gitlab.com/kicad/code/kicad/issues/8847
This commit is contained in:
parent
9a9a155d67
commit
a2bb176b68
|
@ -297,15 +297,15 @@ public:
|
|||
bool unarchiveFiles( const wxString& aFullFileName, REPORTER* aReporter = nullptr );
|
||||
|
||||
/**
|
||||
* Load a photoplot (Gerber) file or many files.
|
||||
* Load a given Gerber file or selected file(s), if the filename is empty.
|
||||
*
|
||||
* @param aFileName - void string or file name with full path to open or empty string to
|
||||
* open a new file. In this case one one file is loaded
|
||||
* if void string: user will be prompted for filename(s)
|
||||
* @param aFileName - file name with full path to open or empty string.
|
||||
* if empty string: a dialog will be opened to select one or
|
||||
* a set of files
|
||||
* @return true if file was opened successfully.
|
||||
*/
|
||||
bool LoadGerberFiles( const wxString& aFileName );
|
||||
bool Read_GERBER_File( const wxString& GERBER_FullFileName );
|
||||
bool Read_GERBER_File( const wxString& GERBER_FullFileName );
|
||||
|
||||
/**
|
||||
* Load a drill (EXCELLON) file or many files.
|
||||
|
|
|
@ -217,7 +217,8 @@ void GERBER_LAYER_WIDGET::ReFill()
|
|||
int aRow = findLayerRow( layer );
|
||||
bool visible = true;
|
||||
COLOR4D color = m_frame->GetLayerColor( GERBER_DRAW_LAYER( layer ) );
|
||||
wxString msg = GetImagesList()->GetDisplayName( layer, /* include layer number */ false,
|
||||
wxString msg = GetImagesList()->GetDisplayName( layer,
|
||||
/* include layer number */ false,
|
||||
/* Get the full name */ true );
|
||||
|
||||
if( m_frame->GetCanvas() )
|
||||
|
@ -226,7 +227,10 @@ void GERBER_LAYER_WIDGET::ReFill()
|
|||
visible = m_frame->IsLayerVisible( layer );
|
||||
|
||||
if( aRow >= 0 )
|
||||
{
|
||||
updateLayerRow( findLayerRow( layer ), msg );
|
||||
SetLayerVisible( layer, visible );
|
||||
}
|
||||
else
|
||||
AppendLayerRow( LAYER_WIDGET::ROW( msg, layer, color, wxEmptyString, visible, true ) );
|
||||
}
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2010 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
|
||||
* Copyright (C) 2010-2021 KiCad Developers, see change_log.txt for contributors.
|
||||
* Copyright (C) 2010-2021 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
|
@ -862,144 +862,3 @@ void LAYER_WIDGET::UpdateLayerIcons()
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#if defined(STAND_ALONE)
|
||||
|
||||
#include <wx/aui/aui.h>
|
||||
|
||||
|
||||
/**
|
||||
* A test class here to exercise the LAYER_WIDGET and explore use cases.
|
||||
*
|
||||
* @see http://www.kirix.com/labs/wxaui/screenshots.html for ideas.
|
||||
*/
|
||||
class MYFRAME : public wxFrame
|
||||
{
|
||||
// example of how to derive from LAYER_WIDGET in order to provide the
|
||||
// abstract methods.
|
||||
class MYLAYERS : public LAYER_WIDGET
|
||||
{
|
||||
public:
|
||||
// your constructor could take a BOARD argument. here I leave it
|
||||
// out because this source module wants to know nothing of BOARDs
|
||||
// to maximize re-use.
|
||||
MYLAYERS( wxWindow* aParent ) :
|
||||
LAYER_WIDGET( aParent, aParent )
|
||||
{
|
||||
}
|
||||
|
||||
void OnLayerColorChange( int aLayer, const COLOR4D& aColor )
|
||||
{
|
||||
/* a test trigger only
|
||||
if( aLayer == 2 )
|
||||
{
|
||||
ClearLayerRows();
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
bool OnLayerSelect( LAYER_NUM aLayer )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
void OnLayerVisible( LAYER_NUM aLayer, bool isVisible, bool isFinal )
|
||||
{
|
||||
}
|
||||
|
||||
void OnRenderColorChange( int aId, const COLOR4D& aColor )
|
||||
{
|
||||
}
|
||||
|
||||
void OnRenderEnable( int aId, bool isEnabled )
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
public:
|
||||
MYFRAME( wxWindow * parent ) :
|
||||
wxFrame( parent, -1, wxT( "wxAUI Test" ), wxDefaultPosition,
|
||||
wxSize( 800, 600 ), wxDEFAULT_FRAME_STYLE )
|
||||
{
|
||||
// notify wxAUI which frame to use
|
||||
m_mgr.SetManagedWindow( this );
|
||||
|
||||
MYLAYERS* lw = new MYLAYERS( this );
|
||||
|
||||
// add some layer rows
|
||||
static const LAYER_WIDGET::ROW layerRows[] = {
|
||||
LAYER_WIDGET::ROW( wxT( "layer 1" ), 0, RED, wxT( "RED" ), false ),
|
||||
LAYER_WIDGET::ROW( wxT( "layer 2" ), 1, GREEN, wxT( "GREEN" ), true ),
|
||||
LAYER_WIDGET::ROW( wxT( "brown_layer" ), 2, BROWN, wxT( "BROWN" ), true ),
|
||||
LAYER_WIDGET::ROW( wxT( "layer_4_you" ), 3, BLUE, wxT( "BLUE" ), false ),
|
||||
};
|
||||
|
||||
lw->AppendLayerRows( layerRows, arrayDim(layerRows) );
|
||||
|
||||
// add some render rows
|
||||
static const LAYER_WIDGET::ROW renderRows[] = {
|
||||
LAYER_WIDGET::ROW( wxT( "With Very Large Ears" ), 0, COLOR4D::UNSPECIFIED,
|
||||
wxT( "Spock here" ) ),
|
||||
LAYER_WIDGET::ROW( wxT( "With Legs" ), 1, YELLOW ),
|
||||
LAYER_WIDGET::ROW( wxT( "With Oval Eyes" ), 1, BROWN, wxT( "My eyes are upon you" ) ),
|
||||
};
|
||||
|
||||
lw->AppendRenderRows( renderRows, arrayDim(renderRows) );
|
||||
|
||||
lw->SelectLayerRow( 1 );
|
||||
|
||||
wxAuiPaneInfo li;
|
||||
li.MinSize( lw->GetBestSize() );
|
||||
li.BestSize( lw->GetBestSize() );
|
||||
li.Left();
|
||||
li.CloseButton( false );
|
||||
li.Caption( wxT( "Layers" ) );
|
||||
m_mgr.AddPane( lw, li );
|
||||
|
||||
|
||||
wxTextCtrl* text2 = new wxTextCtrl( this, -1, wxT( "Pane 2 - sample text" ),
|
||||
wxDefaultPosition, wxSize( 200, 150 ),
|
||||
wxNO_BORDER | wxTE_MULTILINE );
|
||||
m_mgr.AddPane( text2, wxBOTTOM, wxT( "Pane Number Two" ) );
|
||||
|
||||
wxTextCtrl* text3 = new wxTextCtrl( this, -1, wxT( "Main content window" ),
|
||||
wxDefaultPosition, wxSize( 200, 150 ),
|
||||
wxNO_BORDER | wxTE_MULTILINE );
|
||||
m_mgr.AddPane( text3, wxCENTER );
|
||||
|
||||
// tell the manager to "commit" all the changes just made
|
||||
m_mgr.Update();
|
||||
}
|
||||
|
||||
~MYFRAME()
|
||||
{
|
||||
// deinitialize the frame manager
|
||||
m_mgr.UnInit();
|
||||
}
|
||||
|
||||
private:
|
||||
wxAuiManager m_mgr;
|
||||
};
|
||||
|
||||
|
||||
// our normal wxApp-derived class, as usual
|
||||
class MyApp : public wxApp
|
||||
{
|
||||
public:
|
||||
|
||||
bool OnInit()
|
||||
{
|
||||
wxFrame* frame = new MYFRAME( nullptr );
|
||||
|
||||
SetTopWindow( frame );
|
||||
frame->Show();
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
DECLARE_APP( MyApp );
|
||||
IMPLEMENT_APP( MyApp );
|
||||
|
||||
#endif // STAND_ALONE
|
||||
|
|
Loading…
Reference in New Issue