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:
parent
2ded7bf82a
commit
dbb78db7ef
|
@ -699,7 +699,7 @@ void EDA_3D_CANVAS::TakeScreenshot( wxCommandEvent& event )
|
||||||
|
|
||||||
unsigned char* pixelbuffer = (unsigned char*) malloc( viewport.x * viewport.y * 3 );
|
unsigned char* pixelbuffer = (unsigned char*) malloc( viewport.x * viewport.y * 3 );
|
||||||
unsigned char* alphabuffer = (unsigned char*) malloc( viewport.x * viewport.y );
|
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 );
|
glPixelStorei( GL_PACK_ALIGNMENT, 1 );
|
||||||
glReadBuffer( GL_BACK_LEFT );
|
glReadBuffer( GL_BACK_LEFT );
|
||||||
|
@ -710,10 +710,10 @@ void EDA_3D_CANVAS::TakeScreenshot( wxCommandEvent& event )
|
||||||
viewport.x, viewport.y,
|
viewport.x, viewport.y,
|
||||||
GL_ALPHA, GL_UNSIGNED_BYTE, alphabuffer );
|
GL_ALPHA, GL_UNSIGNED_BYTE, alphabuffer );
|
||||||
|
|
||||||
image.SetData( pixelbuffer );
|
image_3d.SetData( pixelbuffer );
|
||||||
image.SetAlpha( alphabuffer );
|
image_3d.SetAlpha( alphabuffer );
|
||||||
image = image.Mirror( false );
|
image_3d = image_3d.Mirror( false );
|
||||||
wxBitmap bitmap( image );
|
wxBitmap bitmap( image_3d );
|
||||||
|
|
||||||
if( event.GetId() == ID_TOOL_SCREENCOPY_TOCLIBBOARD )
|
if( event.GetId() == ID_TOOL_SCREENCOPY_TOCLIBBOARD )
|
||||||
{
|
{
|
||||||
|
|
|
@ -460,20 +460,28 @@ const wxString GERBER_IMAGE_LIST::GetDisplayName( int aIdx )
|
||||||
if( aIdx >= 0 && aIdx < (int)m_GERBER_List.size() )
|
if( aIdx >= 0 && aIdx < (int)m_GERBER_List.size() )
|
||||||
gerber = m_GERBER_List[aIdx];
|
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 ) )
|
if( gerber && IsUsed(aIdx ) )
|
||||||
{
|
{
|
||||||
|
wxFileName fn( gerber->m_FileName );
|
||||||
|
|
||||||
if( gerber->m_FileFunction )
|
if( gerber->m_FileFunction )
|
||||||
{
|
{
|
||||||
if( gerber->m_FileFunction->IsCopper() )
|
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->GetFileType() ),
|
||||||
GetChars( gerber->m_FileFunction->GetBrdLayerId() ),
|
GetChars( gerber->m_FileFunction->GetBrdLayerId() ),
|
||||||
GetChars( gerber->m_FileFunction->GetBrdLayerSide() ) );
|
GetChars( gerber->m_FileFunction->GetBrdLayerSide() ) );
|
||||||
}
|
}
|
||||||
else
|
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->GetFileType() ),
|
||||||
GetChars( gerber->m_FileFunction->GetBrdLayerId() ) );
|
GetChars( gerber->m_FileFunction->GetBrdLayerId() ) );
|
||||||
}
|
}
|
||||||
|
|
|
@ -353,7 +353,12 @@ public:
|
||||||
/**
|
/**
|
||||||
* @return a name for image aIdx which can be used in layers manager
|
* @return a name for image aIdx which can be used in layers manager
|
||||||
* and layer selector
|
* 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 )
|
* @param aIdx = the index ( 0 ... GERBER_DRAWLAYERS_COUNT-1 )
|
||||||
*/
|
*/
|
||||||
const wxString GetDisplayName( int aIdx );
|
const wxString GetDisplayName( int aIdx );
|
||||||
|
|
|
@ -40,12 +40,13 @@
|
||||||
|
|
||||||
void GBR_LAYER_BOX_SELECTOR::Resync()
|
void GBR_LAYER_BOX_SELECTOR::Resync()
|
||||||
{
|
{
|
||||||
|
#define BM_SIZE 14
|
||||||
Freeze();
|
Freeze();
|
||||||
Clear();
|
Clear();
|
||||||
|
|
||||||
for( int layerid = 0; layerid < GERBER_DRAWLAYERS_COUNT; ++layerid )
|
for( int layerid = 0; layerid < GERBER_DRAWLAYERS_COUNT; ++layerid )
|
||||||
{
|
{
|
||||||
wxBitmap layerbmp( 14, 14 );
|
wxBitmap layerbmp( BM_SIZE, BM_SIZE );
|
||||||
wxString layername;
|
wxString layername;
|
||||||
|
|
||||||
if( !IsLayerEnabled( layerid ) )
|
if( !IsLayerEnabled( layerid ) )
|
||||||
|
@ -59,6 +60,11 @@ void GBR_LAYER_BOX_SELECTOR::Resync()
|
||||||
Append( layername, layerbmp, (void*)(intptr_t) layerid );
|
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();
|
Thaw();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -212,7 +212,7 @@ void GERBER_LAYER_WIDGET::onPopupSelection( wxCommandEvent& event )
|
||||||
case ID_SORT_GBR_LAYERS:
|
case ID_SORT_GBR_LAYERS:
|
||||||
g_GERBER_List.SortImagesByZOrder( myframe->GetItemsList() );
|
g_GERBER_List.SortImagesByZOrder( myframe->GetItemsList() );
|
||||||
myframe->ReFillLayerWidget();
|
myframe->ReFillLayerWidget();
|
||||||
myframe->syncLayerBox();
|
myframe->syncLayerBox( true );
|
||||||
myframe->GetCanvas()->Refresh();
|
myframe->GetCanvas()->Refresh();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -313,10 +313,12 @@ void GERBVIEW_FRAME::SaveSettings( wxConfigBase* aCfg )
|
||||||
void GERBVIEW_FRAME::ReFillLayerWidget()
|
void GERBVIEW_FRAME::ReFillLayerWidget()
|
||||||
{
|
{
|
||||||
m_LayersManager->ReFill();
|
m_LayersManager->ReFill();
|
||||||
|
m_SelLayerBox->Resync();
|
||||||
|
|
||||||
wxAuiPaneInfo& lyrs = m_auimgr.GetPane( m_LayersManager );
|
wxAuiPaneInfo& lyrs = m_auimgr.GetPane( m_LayersManager );
|
||||||
|
|
||||||
wxSize bestz = m_LayersManager->GetBestSize();
|
wxSize bestz = m_LayersManager->GetBestSize();
|
||||||
|
bestz.x += 5; // gives a little margin
|
||||||
|
|
||||||
lyrs.MinSize( bestz );
|
lyrs.MinSize( bestz );
|
||||||
lyrs.BestSize( 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() );
|
m_SelLayerBox->SetSelection( getActiveLayer() );
|
||||||
|
|
||||||
int dcodeSelected = -1;
|
int dcodeSelected = -1;
|
||||||
|
|
|
@ -438,9 +438,11 @@ public:
|
||||||
* Function syncLayerBox
|
* Function syncLayerBox
|
||||||
* updates the currently "selected" layer within m_SelLayerBox
|
* updates the currently "selected" layer within m_SelLayerBox
|
||||||
* The currently active layer, as defined by the return value of
|
* 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
|
* Function UpdateTitleAndInfo
|
||||||
|
|
|
@ -90,7 +90,7 @@ void GERBVIEW_FRAME::ReCreateHToolbar( void )
|
||||||
|
|
||||||
m_SelLayerBox = new GBR_LAYER_BOX_SELECTOR( m_mainToolBar,
|
m_SelLayerBox = new GBR_LAYER_BOX_SELECTOR( m_mainToolBar,
|
||||||
ID_TOOLBARH_GERBVIEW_SELECT_ACTIVE_LAYER,
|
ID_TOOLBARH_GERBVIEW_SELECT_ACTIVE_LAYER,
|
||||||
wxDefaultPosition, wxSize( 150, -1 ), 0,NULL);
|
wxDefaultPosition, wxDefaultSize, 0,NULL);
|
||||||
m_SelLayerBox->Resync();
|
m_SelLayerBox->Resync();
|
||||||
|
|
||||||
m_mainToolBar->AddControl( m_SelLayerBox );
|
m_mainToolBar->AddControl( m_SelLayerBox );
|
||||||
|
@ -114,7 +114,7 @@ void GERBVIEW_FRAME::ReCreateHToolbar( void )
|
||||||
m_mainToolBar->AddControl( m_DCodeSelector );
|
m_mainToolBar->AddControl( m_DCodeSelector );
|
||||||
|
|
||||||
m_TextInfo = new wxTextCtrl( m_mainToolBar, wxID_ANY, wxEmptyString, wxDefaultPosition,
|
m_TextInfo = new wxTextCtrl( m_mainToolBar, wxID_ANY, wxEmptyString, wxDefaultPosition,
|
||||||
wxSize(150,-1), wxTE_READONLY );
|
wxDefaultSize, wxTE_READONLY );
|
||||||
m_mainToolBar->AddControl( m_TextInfo );
|
m_mainToolBar->AddControl( m_TextInfo );
|
||||||
|
|
||||||
// after adding the buttons to the toolbar, must call Realize() to reflect the changes
|
// after adding the buttons to the toolbar, must call Realize() to reflect the changes
|
||||||
|
|
|
@ -485,10 +485,9 @@ bool BOARD_NETLIST_UPDATER::deleteSinglePadNets()
|
||||||
|
|
||||||
std::vector<D_PAD*> padlist = m_board->GetPads();
|
std::vector<D_PAD*> padlist = m_board->GetPads();
|
||||||
|
|
||||||
for( unsigned ii = 0; ii < padlist.size(); ii++ )
|
for( unsigned kk = 0; kk < padlist.size(); kk++ )
|
||||||
{
|
{
|
||||||
pad = padlist[ii];
|
pad = padlist[kk];
|
||||||
|
|
||||||
|
|
||||||
if( pad->GetNetname().IsEmpty() )
|
if( pad->GetNetname().IsEmpty() )
|
||||||
continue;
|
continue;
|
||||||
|
|
Loading…
Reference in New Issue