Gerbview: Shows now in the Layer manager the filename of gerber or drill files loaded.

A fex minor compil warnng fixes
This commit is contained in:
jean-pierre charras 2016-05-23 17:47:16 +02:00
parent 2ded7bf82a
commit dbb78db7ef
9 changed files with 44 additions and 20 deletions

View File

@ -699,7 +699,7 @@ void EDA_3D_CANVAS::TakeScreenshot( wxCommandEvent& event )
unsigned char* pixelbuffer = (unsigned char*) malloc( viewport.x * viewport.y * 3 );
unsigned char* alphabuffer = (unsigned char*) malloc( viewport.x * viewport.y );
wxImage image( viewport.x, viewport.y );
wxImage image_3d( viewport.x, viewport.y );
glPixelStorei( GL_PACK_ALIGNMENT, 1 );
glReadBuffer( GL_BACK_LEFT );
@ -710,10 +710,10 @@ void EDA_3D_CANVAS::TakeScreenshot( wxCommandEvent& event )
viewport.x, viewport.y,
GL_ALPHA, GL_UNSIGNED_BYTE, alphabuffer );
image.SetData( pixelbuffer );
image.SetAlpha( alphabuffer );
image = image.Mirror( false );
wxBitmap bitmap( image );
image_3d.SetData( pixelbuffer );
image_3d.SetAlpha( alphabuffer );
image_3d = image_3d.Mirror( false );
wxBitmap bitmap( image_3d );
if( event.GetId() == ID_TOOL_SCREENCOPY_TOCLIBBOARD )
{

View File

@ -460,20 +460,28 @@ const wxString GERBER_IMAGE_LIST::GetDisplayName( int aIdx )
if( aIdx >= 0 && aIdx < (int)m_GERBER_List.size() )
gerber = m_GERBER_List[aIdx];
// if a file is loaded, build the name:
// <id> <short filename> <X2 FileFunction info> if a X2 FileFunction info is found
// or (if no FileFunction info)
// <id> <short filename> *
if( gerber && IsUsed(aIdx ) )
{
wxFileName fn( gerber->m_FileName );
if( gerber->m_FileFunction )
{
if( gerber->m_FileFunction->IsCopper() )
{
name.Printf( _( "Layer %d (%s, %s, %s)" ), aIdx + 1,
name.Printf( "%d %s (%s, %s, %s)", aIdx + 1,
fn.GetFullName().GetData(),
GetChars( gerber->m_FileFunction->GetFileType() ),
GetChars( gerber->m_FileFunction->GetBrdLayerId() ),
GetChars( gerber->m_FileFunction->GetBrdLayerSide() ) );
}
else
{
name.Printf( _( "Layer %d (%s, %s)" ), aIdx + 1,
name.Printf( "%d %s (%s, %s)", aIdx + 1,
fn.GetFullName().GetData(),
GetChars( gerber->m_FileFunction->GetFileType() ),
GetChars( gerber->m_FileFunction->GetBrdLayerId() ) );
}

View File

@ -353,7 +353,12 @@ public:
/**
* @return a name for image aIdx which can be used in layers manager
* and layer selector
* is is "Layer n" (n = aIdx+1), followed by file attribute info (if X2 format)
* if a file is loaded, the name is:
* "<aIdx+1> <short filename> <X2 FileFunction info> if a X2 FileFunction info is found"
* or (if no FileFunction info)
* "<aIdx+1> <short filename> *"
* if no file loaded, the name is:
* "Layer n" with n = aIdx+1
* @param aIdx = the index ( 0 ... GERBER_DRAWLAYERS_COUNT-1 )
*/
const wxString GetDisplayName( int aIdx );

View File

@ -40,12 +40,13 @@
void GBR_LAYER_BOX_SELECTOR::Resync()
{
#define BM_SIZE 14
Freeze();
Clear();
for( int layerid = 0; layerid < GERBER_DRAWLAYERS_COUNT; ++layerid )
{
wxBitmap layerbmp( 14, 14 );
wxBitmap layerbmp( BM_SIZE, BM_SIZE );
wxString layername;
if( !IsLayerEnabled( layerid ) )
@ -59,6 +60,11 @@ void GBR_LAYER_BOX_SELECTOR::Resync()
Append( layername, layerbmp, (void*)(intptr_t) layerid );
}
// Ensure the width of the widget is enough to show the text and the icon
SetMinSize( wxSize( -1, -1 ) );
int minwidth = GetBestSize().x + BM_SIZE + 10;
SetMinSize( wxSize( minwidth, -1 ) );
Thaw();
}

View File

@ -212,7 +212,7 @@ void GERBER_LAYER_WIDGET::onPopupSelection( wxCommandEvent& event )
case ID_SORT_GBR_LAYERS:
g_GERBER_List.SortImagesByZOrder( myframe->GetItemsList() );
myframe->ReFillLayerWidget();
myframe->syncLayerBox();
myframe->syncLayerBox( true );
myframe->GetCanvas()->Refresh();
break;
}

View File

@ -313,10 +313,12 @@ void GERBVIEW_FRAME::SaveSettings( wxConfigBase* aCfg )
void GERBVIEW_FRAME::ReFillLayerWidget()
{
m_LayersManager->ReFill();
m_SelLayerBox->Resync();
wxAuiPaneInfo& lyrs = m_auimgr.GetPane( m_LayersManager );
wxSize bestz = m_LayersManager->GetBestSize();
bestz.x += 5; // gives a little margin
lyrs.MinSize( bestz );
lyrs.BestSize( bestz );
@ -384,9 +386,11 @@ void GERBVIEW_FRAME::syncLayerWidget()
}
void GERBVIEW_FRAME::syncLayerBox()
void GERBVIEW_FRAME::syncLayerBox( bool aRebuildLayerBox )
{
m_SelLayerBox->Resync();
if( aRebuildLayerBox )
m_SelLayerBox->Resync();
m_SelLayerBox->SetSelection( getActiveLayer() );
int dcodeSelected = -1;

View File

@ -438,9 +438,11 @@ public:
* Function syncLayerBox
* updates the currently "selected" layer within m_SelLayerBox
* The currently active layer, as defined by the return value of
* getActiveLayer(). And updates the colored icon in the toolbar.
* getActiveLayer().
* @param aRebuildLayerBox = true to rebuild the layer box
* false to just updates the selection.
*/
void syncLayerBox();
void syncLayerBox( bool aRebuildLayerBox = false );
/**
* Function UpdateTitleAndInfo

View File

@ -90,7 +90,7 @@ void GERBVIEW_FRAME::ReCreateHToolbar( void )
m_SelLayerBox = new GBR_LAYER_BOX_SELECTOR( m_mainToolBar,
ID_TOOLBARH_GERBVIEW_SELECT_ACTIVE_LAYER,
wxDefaultPosition, wxSize( 150, -1 ), 0,NULL);
wxDefaultPosition, wxDefaultSize, 0,NULL);
m_SelLayerBox->Resync();
m_mainToolBar->AddControl( m_SelLayerBox );
@ -114,7 +114,7 @@ void GERBVIEW_FRAME::ReCreateHToolbar( void )
m_mainToolBar->AddControl( m_DCodeSelector );
m_TextInfo = new wxTextCtrl( m_mainToolBar, wxID_ANY, wxEmptyString, wxDefaultPosition,
wxSize(150,-1), wxTE_READONLY );
wxDefaultSize, wxTE_READONLY );
m_mainToolBar->AddControl( m_TextInfo );
// after adding the buttons to the toolbar, must call Realize() to reflect the changes

View File

@ -485,10 +485,9 @@ bool BOARD_NETLIST_UPDATER::deleteSinglePadNets()
std::vector<D_PAD*> padlist = m_board->GetPads();
for( unsigned ii = 0; ii < padlist.size(); ii++ )
{
pad = padlist[ii];
for( unsigned kk = 0; kk < padlist.size(); kk++ )
{
pad = padlist[kk];
if( pad->GetNetname().IsEmpty() )
continue;