Add Worksheet to Render Items for GerbView.
Also added PCB Background Color. Fixes: lp:1780362 * https://bugs.launchpad.net/kicad/+bug/1780362 (cherry picked from commit f789ef1)
This commit is contained in:
parent
68e7a49b53
commit
a747d074c4
|
@ -66,8 +66,8 @@ public:
|
||||||
m_DisplayPageLimits = false;
|
m_DisplayPageLimits = false;
|
||||||
m_IsPrinting = false;
|
m_IsPrinting = false;
|
||||||
m_DisplayNegativeObjects = false;
|
m_DisplayNegativeObjects = false;
|
||||||
m_ForceBlackAndWhite = false;
|
m_ForceBlackAndWhite = false;
|
||||||
m_NegativeDrawColor = COLOR4D( DARKGRAY );
|
m_NegativeDrawColor = COLOR4D( DARKGRAY );
|
||||||
m_BgDrawColor = COLOR4D::BLACK;
|
m_BgDrawColor = COLOR4D::BLACK;
|
||||||
m_DiffMode = false;
|
m_DiffMode = false;
|
||||||
m_HighContrastMode = false;
|
m_HighContrastMode = false;
|
||||||
|
|
|
@ -75,25 +75,24 @@ PARAM_CFG_ARRAY& GERBVIEW_FRAME::GetConfigurationSettings()
|
||||||
|
|
||||||
m_configSettings.push_back( new PARAM_CFG_INT( true, wxT( "DrawModeOption" ),
|
m_configSettings.push_back( new PARAM_CFG_INT( true, wxT( "DrawModeOption" ),
|
||||||
&m_displayMode, 2, 0, 2 ) );
|
&m_displayMode, 2, 0, 2 ) );
|
||||||
m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true,
|
m_configSettings.push_back( new PARAM_CFG_SETCOLOR(
|
||||||
wxT( "DCodeColorEx" ),
|
true, wxT( "DCodeColorEx" ),
|
||||||
&g_ColorsSettings.m_LayersColors[
|
&g_ColorsSettings.m_LayersColors[LAYER_DCODES], WHITE ) );
|
||||||
LAYER_DCODES],
|
m_configSettings.push_back( new PARAM_CFG_SETCOLOR(
|
||||||
WHITE ) );
|
true, wxT( "NegativeObjectsColorEx" ),
|
||||||
m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true,
|
&g_ColorsSettings.m_LayersColors[LAYER_NEGATIVE_OBJECTS], DARKGRAY ) );
|
||||||
wxT( "NegativeObjectsColorEx" ),
|
m_configSettings.push_back( new PARAM_CFG_SETCOLOR(
|
||||||
&g_ColorsSettings.m_LayersColors[
|
true, wxT( "GridColorEx" ),
|
||||||
LAYER_NEGATIVE_OBJECTS],
|
&g_ColorsSettings.m_LayersColors[LAYER_GERBVIEW_GRID], DARKGRAY ) );
|
||||||
DARKGRAY ) );
|
m_configSettings.push_back( new PARAM_CFG_SETCOLOR(
|
||||||
m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true,
|
true, wxT( "WorksheetColorEx" ),
|
||||||
wxT( "GridColorEx" ),
|
&g_ColorsSettings.m_LayersColors[ LAYER_WORKSHEET], DARKRED ) );
|
||||||
&g_ColorsSettings.m_LayersColors[
|
m_configSettings.push_back( new PARAM_CFG_SETCOLOR(
|
||||||
LAYER_GERBVIEW_GRID],
|
true, wxT( "BackgroundColorEx" ),
|
||||||
DARKGRAY ) );
|
&g_ColorsSettings.m_LayersColors[LAYER_PCB_BACKGROUND], BLACK ) );
|
||||||
m_configSettings.push_back( new PARAM_CFG_BOOL( true,
|
m_configSettings.push_back( new PARAM_CFG_BOOL(
|
||||||
wxT( "DisplayPolarCoordinates" ),
|
true, wxT( "DisplayPolarCoordinates" ),
|
||||||
&m_DisplayOptions.m_DisplayPolarCood,
|
&m_DisplayOptions.m_DisplayPolarCood, false ) );
|
||||||
false ) );
|
|
||||||
|
|
||||||
// Default colors for layers 0 to 31
|
// Default colors for layers 0 to 31
|
||||||
static const COLOR4D color_default[] = {
|
static const COLOR4D color_default[] = {
|
||||||
|
|
|
@ -216,8 +216,7 @@ GERBVIEW_FRAME::GERBVIEW_FRAME( KIWAY* aKiway, wxWindow* aParent ):
|
||||||
"If you'd like to choose later, select Modern Toolset "
|
"If you'd like to choose later, select Modern Toolset "
|
||||||
"(Accelerated) in the Preferences menu." );
|
"(Accelerated) in the Preferences menu." );
|
||||||
|
|
||||||
wxMessageDialog dlg( this, msg, _( "Enable Graphics Acceleration" ),
|
wxMessageDialog dlg( this, msg, _( "Enable Graphics Acceleration" ), wxYES_NO );
|
||||||
wxYES_NO );
|
|
||||||
|
|
||||||
dlg.SetYesNoLabels( _( "&Enable Acceleration" ), _( "&No Thanks" ) );
|
dlg.SetYesNoLabels( _( "&Enable Acceleration" ), _( "&No Thanks" ) );
|
||||||
|
|
||||||
|
@ -385,17 +384,13 @@ void GERBVIEW_FRAME::LoadSettings( wxConfigBase* aCfg )
|
||||||
// was: wxGetApp().ReadCurrentSetupValues( GetConfigurationSettings() );
|
// was: wxGetApp().ReadCurrentSetupValues( GetConfigurationSettings() );
|
||||||
wxConfigLoadSetups( aCfg, GetConfigurationSettings() );
|
wxConfigLoadSetups( aCfg, GetConfigurationSettings() );
|
||||||
|
|
||||||
PAGE_INFO pageInfo( wxT( "GERBER" ) );
|
|
||||||
|
|
||||||
aCfg->Read( cfgShowBorderAndTitleBlock, &m_showBorderAndTitleBlock, false );
|
aCfg->Read( cfgShowBorderAndTitleBlock, &m_showBorderAndTitleBlock, false );
|
||||||
|
|
||||||
if( m_showBorderAndTitleBlock )
|
PAGE_INFO pageInfo( wxT( "GERBER" ) );
|
||||||
{
|
wxString pageType;
|
||||||
wxString pageType;
|
|
||||||
aCfg->Read( cfgShowPageSizeOption, &pageType, wxT( "GERBER" ) );
|
|
||||||
pageInfo.SetType( pageType );
|
|
||||||
}
|
|
||||||
|
|
||||||
|
aCfg->Read( cfgShowPageSizeOption, &pageType, wxT( "GERBER" ) );
|
||||||
|
pageInfo.SetType( pageType );
|
||||||
SetPageSettings( pageInfo );
|
SetPageSettings( pageInfo );
|
||||||
|
|
||||||
bool tmp;
|
bool tmp;
|
||||||
|
@ -434,8 +429,7 @@ void GERBVIEW_FRAME::SaveSettings( wxConfigBase* aCfg )
|
||||||
aCfg->Write( cfgShowPageSizeOption, GetPageSettings().GetType() );
|
aCfg->Write( cfgShowPageSizeOption, GetPageSettings().GetType() );
|
||||||
aCfg->Write( cfgShowBorderAndTitleBlock, m_showBorderAndTitleBlock );
|
aCfg->Write( cfgShowBorderAndTitleBlock, m_showBorderAndTitleBlock );
|
||||||
aCfg->Write( cfgShowDCodes, IsElementVisible( LAYER_DCODES ) );
|
aCfg->Write( cfgShowDCodes, IsElementVisible( LAYER_DCODES ) );
|
||||||
aCfg->Write( cfgShowNegativeObjects,
|
aCfg->Write( cfgShowNegativeObjects, IsElementVisible( LAYER_NEGATIVE_OBJECTS ) );
|
||||||
IsElementVisible( LAYER_NEGATIVE_OBJECTS ) );
|
|
||||||
|
|
||||||
// Save the drill file history list.
|
// Save the drill file history list.
|
||||||
// Because we have more than one file history, we must save this one
|
// Because we have more than one file history, we must save this one
|
||||||
|
@ -463,7 +457,6 @@ void GERBVIEW_FRAME::ReFillLayerWidget()
|
||||||
ReCreateAuxiliaryToolbar();
|
ReCreateAuxiliaryToolbar();
|
||||||
|
|
||||||
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
|
bestz.x += 5; // gives a little margin
|
||||||
|
|
||||||
|
@ -480,12 +473,11 @@ void GERBVIEW_FRAME::ReFillLayerWidget()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void GERBVIEW_FRAME::SetElementVisibility( GERBVIEW_LAYER_ID aItemIdVisible,
|
void GERBVIEW_FRAME::SetElementVisibility( int aLayerID, bool aNewState )
|
||||||
bool aNewState )
|
|
||||||
{
|
{
|
||||||
bool dcodes_changed = false;
|
bool dcodes_changed = false;
|
||||||
|
|
||||||
switch( aItemIdVisible )
|
switch( aLayerID )
|
||||||
{
|
{
|
||||||
case LAYER_DCODES:
|
case LAYER_DCODES:
|
||||||
dcodes_changed = m_DisplayOptions.m_DisplayDCodes != aNewState;
|
dcodes_changed = m_DisplayOptions.m_DisplayDCodes != aNewState;
|
||||||
|
@ -498,8 +490,8 @@ void GERBVIEW_FRAME::SetElementVisibility( GERBVIEW_LAYER_ID aItemIdVisible,
|
||||||
|
|
||||||
auto view = GetGalCanvas()->GetView();
|
auto view = GetGalCanvas()->GetView();
|
||||||
|
|
||||||
view->UpdateAllItemsConditionally( KIGFX::REPAINT,
|
view->UpdateAllItemsConditionally( KIGFX::REPAINT, []( KIGFX::VIEW_ITEM* aItem )
|
||||||
[]( KIGFX::VIEW_ITEM* aItem ) {
|
{
|
||||||
auto item = static_cast<GERBER_DRAW_ITEM*>( aItem );
|
auto item = static_cast<GERBER_DRAW_ITEM*>( aItem );
|
||||||
|
|
||||||
// GetLayerPolarity() returns true for negative items
|
// GetLayerPolarity() returns true for negative items
|
||||||
|
@ -508,12 +500,16 @@ void GERBVIEW_FRAME::SetElementVisibility( GERBVIEW_LAYER_ID aItemIdVisible,
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
case LAYER_WORKSHEET:
|
||||||
|
m_showBorderAndTitleBlock = aNewState;
|
||||||
|
break;
|
||||||
|
|
||||||
case LAYER_GERBVIEW_GRID:
|
case LAYER_GERBVIEW_GRID:
|
||||||
SetGridVisibility( aNewState );
|
SetGridVisibility( aNewState );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
wxLogDebug( wxT( "GERBVIEW_FRAME::SetElementVisibility(): bad arg %d" ), aItemIdVisible );
|
wxLogDebug( wxT( "GERBVIEW_FRAME::SetElementVisibility(): bad arg %d" ), aLayerID );
|
||||||
}
|
}
|
||||||
|
|
||||||
if( dcodes_changed )
|
if( dcodes_changed )
|
||||||
|
@ -524,13 +520,12 @@ void GERBVIEW_FRAME::SetElementVisibility( GERBVIEW_LAYER_ID aItemIdVisible,
|
||||||
{
|
{
|
||||||
int layer = GERBER_DRAW_LAYER( i );
|
int layer = GERBER_DRAW_LAYER( i );
|
||||||
int dcode_layer = GERBER_DCODE_LAYER( layer );
|
int dcode_layer = GERBER_DCODE_LAYER( layer );
|
||||||
view->SetLayerVisible( dcode_layer,
|
view->SetLayerVisible( dcode_layer, aNewState && view->IsLayerVisible( layer ) );
|
||||||
aNewState && view->IsLayerVisible( layer ) );
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
applyDisplaySettingsToGAL();
|
applyDisplaySettingsToGAL();
|
||||||
m_LayersManager->SetRenderState( aItemIdVisible, aNewState );
|
m_LayersManager->SetRenderState( aLayerID, aNewState );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -538,7 +533,7 @@ void GERBVIEW_FRAME::applyDisplaySettingsToGAL()
|
||||||
{
|
{
|
||||||
auto view = GetGalCanvas()->GetView();
|
auto view = GetGalCanvas()->GetView();
|
||||||
auto painter = static_cast<KIGFX::GERBVIEW_PAINTER*>( view->GetPainter() );
|
auto painter = static_cast<KIGFX::GERBVIEW_PAINTER*>( view->GetPainter() );
|
||||||
auto settings = static_cast<KIGFX::GERBVIEW_RENDER_SETTINGS*>( painter->GetSettings() );
|
KIGFX::GERBVIEW_RENDER_SETTINGS* settings = painter->GetSettings();
|
||||||
settings->LoadDisplayOptions( &m_DisplayOptions );
|
settings->LoadDisplayOptions( &m_DisplayOptions );
|
||||||
|
|
||||||
settings->ImportLegacyColors( m_colorsSettings );
|
settings->ImportLegacyColors( m_colorsSettings );
|
||||||
|
@ -785,17 +780,19 @@ void GERBVIEW_FRAME::UpdateTitleAndInfo()
|
||||||
// Display Image Name and Layer Name (from the current gerber data):
|
// Display Image Name and Layer Name (from the current gerber data):
|
||||||
wxString status;
|
wxString status;
|
||||||
status.Printf( _( "Image name: \"%s\" Layer name: \"%s\"" ),
|
status.Printf( _( "Image name: \"%s\" Layer name: \"%s\"" ),
|
||||||
GetChars( gerber->m_ImageName ),
|
gerber->m_ImageName,
|
||||||
GetChars( gerber->GetLayerParams().m_LayerName ) );
|
gerber->GetLayerParams().m_LayerName );
|
||||||
SetStatusText( status, 0 );
|
SetStatusText( status, 0 );
|
||||||
|
|
||||||
// Display data format like fmt in X3.4Y3.4 no LZ or fmt mm X2.3 Y3.5 no TZ in main toolbar
|
// Display data format like fmt in X3.4Y3.4 no LZ or fmt mm X2.3 Y3.5 no TZ in main toolbar
|
||||||
wxString info;
|
wxString info;
|
||||||
info.Printf( wxT( "fmt: %s X%d.%d Y%d.%d no %cZ" ),
|
info.Printf( wxT( "fmt: %s X%d.%d Y%d.%d no %cZ" ),
|
||||||
gerber->m_GerbMetric ? wxT( "mm" ) : wxT( "in" ),
|
gerber->m_GerbMetric ? wxT( "mm" ) : wxT( "in" ),
|
||||||
gerber->m_FmtLen.x - gerber->m_FmtScale.x, gerber->m_FmtScale.x,
|
gerber->m_FmtLen.x - gerber->m_FmtScale.x,
|
||||||
gerber->m_FmtLen.y - gerber->m_FmtScale.y, gerber->m_FmtScale.y,
|
gerber->m_FmtScale.x,
|
||||||
gerber->m_NoTrailingZeros ? 'T' : 'L' );
|
gerber->m_FmtLen.y - gerber->m_FmtScale.y,
|
||||||
|
gerber->m_FmtScale.y,
|
||||||
|
gerber->m_NoTrailingZeros ? 'T' : 'L' );
|
||||||
|
|
||||||
if( gerber->m_IsX2_file )
|
if( gerber->m_IsX2_file )
|
||||||
info << wxT(" ") << _( "X2 attr" );
|
info << wxT(" ") << _( "X2 attr" );
|
||||||
|
@ -808,24 +805,27 @@ void GERBVIEW_FRAME::UpdateTitleAndInfo()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool GERBVIEW_FRAME::IsElementVisible( GERBVIEW_LAYER_ID aItemIdVisible ) const
|
bool GERBVIEW_FRAME::IsElementVisible( int aLayerID ) const
|
||||||
{
|
{
|
||||||
switch( aItemIdVisible )
|
switch( aLayerID )
|
||||||
{
|
{
|
||||||
case LAYER_DCODES:
|
case LAYER_DCODES:
|
||||||
return m_DisplayOptions.m_DisplayDCodes;
|
return m_DisplayOptions.m_DisplayDCodes;
|
||||||
break;
|
|
||||||
|
|
||||||
case LAYER_NEGATIVE_OBJECTS:
|
case LAYER_NEGATIVE_OBJECTS:
|
||||||
return m_DisplayOptions.m_DisplayNegativeObjects;
|
return m_DisplayOptions.m_DisplayNegativeObjects;
|
||||||
break;
|
|
||||||
|
|
||||||
case LAYER_GERBVIEW_GRID:
|
case LAYER_GERBVIEW_GRID:
|
||||||
return IsGridVisible();
|
return IsGridVisible();
|
||||||
break;
|
|
||||||
|
case LAYER_WORKSHEET:
|
||||||
|
return m_showBorderAndTitleBlock;
|
||||||
|
|
||||||
|
case LAYER_PCB_BACKGROUND:
|
||||||
|
return true;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
wxLogDebug( wxT( "GERBVIEW_FRAME::IsElementVisible(): bad arg %d" ), aItemIdVisible );
|
wxLogDebug( wxT( "GERBVIEW_FRAME::IsElementVisible(): bad arg %d" ), aLayerID );
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -880,15 +880,17 @@ bool GERBVIEW_FRAME::IsLayerVisible( int aLayer ) const
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
COLOR4D GERBVIEW_FRAME::GetVisibleElementColor( GERBVIEW_LAYER_ID aItemIdVisible )
|
COLOR4D GERBVIEW_FRAME::GetVisibleElementColor( int aLayerID )
|
||||||
{
|
{
|
||||||
COLOR4D color = COLOR4D::UNSPECIFIED;
|
COLOR4D color = COLOR4D::UNSPECIFIED;
|
||||||
|
|
||||||
switch( aItemIdVisible )
|
switch( aLayerID )
|
||||||
{
|
{
|
||||||
case LAYER_NEGATIVE_OBJECTS:
|
case LAYER_NEGATIVE_OBJECTS:
|
||||||
case LAYER_DCODES:
|
case LAYER_DCODES:
|
||||||
color = m_colorsSettings->GetItemColor( aItemIdVisible );
|
case LAYER_WORKSHEET:
|
||||||
|
case LAYER_PCB_BACKGROUND:
|
||||||
|
color = m_colorsSettings->GetItemColor( aLayerID );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case LAYER_GERBVIEW_GRID:
|
case LAYER_GERBVIEW_GRID:
|
||||||
|
@ -896,8 +898,7 @@ COLOR4D GERBVIEW_FRAME::GetVisibleElementColor( GERBVIEW_LAYER_ID aItemIdVisible
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
wxLogDebug( wxT( "GERBVIEW_FRAME::GetVisibleElementColor(): bad arg %d" ),
|
wxLogDebug( wxT( "GERBVIEW_FRAME::GetVisibleElementColor(): bad arg %d" ), aLayerID );
|
||||||
(int)aItemIdVisible );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return color;
|
return color;
|
||||||
|
@ -911,24 +912,28 @@ void GERBVIEW_FRAME::SetGridVisibility( bool aVisible )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void GERBVIEW_FRAME::SetVisibleElementColor( GERBVIEW_LAYER_ID aItemIdVisible,
|
void GERBVIEW_FRAME::SetVisibleElementColor( int aLayerID, COLOR4D aColor )
|
||||||
COLOR4D aColor )
|
|
||||||
{
|
{
|
||||||
switch( aItemIdVisible )
|
switch( aLayerID )
|
||||||
{
|
{
|
||||||
case LAYER_NEGATIVE_OBJECTS:
|
case LAYER_NEGATIVE_OBJECTS:
|
||||||
case LAYER_DCODES:
|
case LAYER_DCODES:
|
||||||
m_colorsSettings->SetItemColor( aItemIdVisible, aColor );
|
case LAYER_WORKSHEET:
|
||||||
|
m_colorsSettings->SetItemColor( aLayerID, aColor );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case LAYER_GERBVIEW_GRID:
|
case LAYER_GERBVIEW_GRID:
|
||||||
SetGridColor( aColor );
|
SetGridColor( aColor );
|
||||||
m_colorsSettings->SetItemColor( aItemIdVisible, aColor );
|
m_colorsSettings->SetItemColor( aLayerID, aColor );
|
||||||
|
break;
|
||||||
|
|
||||||
|
case LAYER_PCB_BACKGROUND:
|
||||||
|
SetDrawBgColor( aColor );
|
||||||
|
m_colorsSettings->SetItemColor( aLayerID, aColor );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
wxLogDebug( wxT( "GERBVIEW_FRAME::SetVisibleElementColor(): bad arg %d" ),
|
wxLogDebug( wxT( "GERBVIEW_FRAME::SetVisibleElementColor(): bad arg %d" ), aLayerID );
|
||||||
(int) aItemIdVisible );
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -991,12 +996,11 @@ void GERBVIEW_FRAME::SetPageSettings( const PAGE_INFO& aPageSettings )
|
||||||
|
|
||||||
if( IsGalCanvasActive() )
|
if( IsGalCanvasActive() )
|
||||||
{
|
{
|
||||||
GERBVIEW_DRAW_PANEL_GAL* drawPanel =
|
auto drawPanel = static_cast<GERBVIEW_DRAW_PANEL_GAL*>( GetGalCanvas() );
|
||||||
static_cast<GERBVIEW_DRAW_PANEL_GAL*>( GetGalCanvas() );
|
|
||||||
|
|
||||||
// Prepare worksheet template
|
// Prepare worksheet template
|
||||||
KIGFX::WORKSHEET_VIEWITEM* worksheet;
|
auto worksheet =
|
||||||
worksheet = new KIGFX::WORKSHEET_VIEWITEM( IU_PER_MILS, &GetPageSettings(), &GetTitleBlock() );
|
new KIGFX::WORKSHEET_VIEWITEM( IU_PER_MILS, &GetPageSettings(), &GetTitleBlock() );
|
||||||
|
|
||||||
if( screen != NULL )
|
if( screen != NULL )
|
||||||
{
|
{
|
||||||
|
@ -1076,9 +1080,7 @@ void GERBVIEW_FRAME::SetCurItem( GERBER_DRAW_ITEM* aItem, bool aDisplayInfo )
|
||||||
void GERBVIEW_FRAME::SetGridColor( COLOR4D aColor )
|
void GERBVIEW_FRAME::SetGridColor( COLOR4D aColor )
|
||||||
{
|
{
|
||||||
if( IsGalCanvasActive() )
|
if( IsGalCanvasActive() )
|
||||||
{
|
|
||||||
GetGalCanvas()->GetGAL()->SetGridColor( aColor );
|
GetGalCanvas()->GetGAL()->SetGridColor( aColor );
|
||||||
}
|
|
||||||
|
|
||||||
m_gridColor = aColor;
|
m_gridColor = aColor;
|
||||||
}
|
}
|
||||||
|
@ -1105,7 +1107,6 @@ void GERBVIEW_FRAME::UpdateStatusBar()
|
||||||
double dXpos;
|
double dXpos;
|
||||||
double dYpos;
|
double dYpos;
|
||||||
wxString line;
|
wxString line;
|
||||||
wxString locformatter;
|
|
||||||
|
|
||||||
if( m_DisplayOptions.m_DisplayPolarCood ) // display relative polar coordinates
|
if( m_DisplayOptions.m_DisplayPolarCood ) // display relative polar coordinates
|
||||||
{
|
{
|
||||||
|
@ -1121,21 +1122,10 @@ void GERBVIEW_FRAME::UpdateStatusBar()
|
||||||
wxString formatter;
|
wxString formatter;
|
||||||
switch( GetUserUnits() )
|
switch( GetUserUnits() )
|
||||||
{
|
{
|
||||||
case INCHES:
|
case INCHES: formatter = wxT( "r %.6f theta %.1f" ); break;
|
||||||
formatter = wxT( "r %.6f theta %.1f" );
|
case MILLIMETRES: formatter = wxT( "r %.5f theta %.1f" ); break;
|
||||||
break;
|
case UNSCALED_UNITS: formatter = wxT( "r %f theta %f" ); break;
|
||||||
|
case DEGREES: wxASSERT( false ); break;
|
||||||
case MILLIMETRES:
|
|
||||||
formatter = wxT( "r %.5f theta %.1f" );
|
|
||||||
break;
|
|
||||||
|
|
||||||
case UNSCALED_UNITS:
|
|
||||||
formatter = wxT( "r %f theta %f" );
|
|
||||||
break;
|
|
||||||
|
|
||||||
case DEGREES:
|
|
||||||
wxASSERT( false );
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
line.Printf( formatter, To_User_Unit( GetUserUnits(), ro ), theta );
|
line.Printf( formatter, To_User_Unit( GetUserUnits(), ro ), theta );
|
||||||
|
@ -1148,22 +1138,23 @@ void GERBVIEW_FRAME::UpdateStatusBar()
|
||||||
dYpos = To_User_Unit( GetUserUnits(), GetCrossHairPosition().y );
|
dYpos = To_User_Unit( GetUserUnits(), GetCrossHairPosition().y );
|
||||||
|
|
||||||
wxString absformatter;
|
wxString absformatter;
|
||||||
|
wxString relformatter;
|
||||||
|
|
||||||
switch( GetUserUnits() )
|
switch( GetUserUnits() )
|
||||||
{
|
{
|
||||||
case INCHES:
|
case INCHES:
|
||||||
absformatter = wxT( "X %.6f Y %.6f" );
|
absformatter = wxT( "X %.6f Y %.6f" );
|
||||||
locformatter = wxT( "dx %.6f dy %.6f dist %.4f" );
|
relformatter = wxT( "dx %.6f dy %.6f dist %.4f" );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case MILLIMETRES:
|
case MILLIMETRES:
|
||||||
absformatter = wxT( "X %.5f Y %.5f" );
|
absformatter = wxT( "X %.5f Y %.5f" );
|
||||||
locformatter = wxT( "dx %.5f dy %.5f dist %.3f" );
|
relformatter = wxT( "dx %.5f dy %.5f dist %.3f" );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case UNSCALED_UNITS:
|
case UNSCALED_UNITS:
|
||||||
absformatter = wxT( "X %f Y %f" );
|
absformatter = wxT( "X %f Y %f" );
|
||||||
locformatter = wxT( "dx %f dy %f dist %f" );
|
relformatter = wxT( "dx %f dy %f dist %f" );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case DEGREES:
|
case DEGREES:
|
||||||
|
@ -1183,7 +1174,7 @@ void GERBVIEW_FRAME::UpdateStatusBar()
|
||||||
dYpos = To_User_Unit( GetUserUnits(), dy );
|
dYpos = To_User_Unit( GetUserUnits(), dy );
|
||||||
|
|
||||||
// We already decided the formatter above
|
// We already decided the formatter above
|
||||||
line.Printf( locformatter, dXpos, dYpos, hypot( dXpos, dYpos ) );
|
line.Printf( relformatter, dXpos, dYpos, hypot( dXpos, dYpos ) );
|
||||||
SetStatusText( line, 3 );
|
SetStatusText( line, 3 );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -200,14 +200,11 @@ private:
|
||||||
void updateNetnameListSelectBox();
|
void updateNetnameListSelectBox();
|
||||||
void updateAperAttributesSelectBox();
|
void updateAperAttributesSelectBox();
|
||||||
void updateDCodeSelectBox();
|
void updateDCodeSelectBox();
|
||||||
virtual void unitsChangeRefresh() override; // See class EDA_DRAW_FRAME
|
void unitsChangeRefresh() override; // See class EDA_DRAW_FRAME
|
||||||
|
|
||||||
// The Tool Framework initalization
|
// The Tool Framework initalization
|
||||||
void setupTools();
|
void setupTools();
|
||||||
|
|
||||||
// An array string to store warning messages when reading a gerber file.
|
|
||||||
wxArrayString m_Messages;
|
|
||||||
|
|
||||||
/// Updates the GAL with display settings changes
|
/// Updates the GAL with display settings changes
|
||||||
void applyDisplaySettingsToGAL();
|
void applyDisplaySettingsToGAL();
|
||||||
|
|
||||||
|
@ -261,27 +258,6 @@ public:
|
||||||
*/
|
*/
|
||||||
const wxString GetZoomLevelIndicator() const override;
|
const wxString GetZoomLevelIndicator() const override;
|
||||||
|
|
||||||
/**
|
|
||||||
* Function ReportMessage
|
|
||||||
* Add a message (a string) in message list
|
|
||||||
* for instance when reading a Gerber file
|
|
||||||
* @param aMessage = the string to add in list
|
|
||||||
*/
|
|
||||||
void ReportMessage( const wxString aMessage )
|
|
||||||
{
|
|
||||||
m_Messages.Add( aMessage );
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Function ClearMessageList
|
|
||||||
* Clear the message list
|
|
||||||
* Call it before reading a Gerber file
|
|
||||||
*/
|
|
||||||
void ClearMessageList()
|
|
||||||
{
|
|
||||||
m_Messages.Clear();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function GetDisplayMode
|
* Function GetDisplayMode
|
||||||
* @return 0 for fast mode (not fully compatible with negative objects)
|
* @return 0 for fast mode (not fully compatible with negative objects)
|
||||||
|
@ -302,10 +278,10 @@ public:
|
||||||
* Function IsElementVisible
|
* Function IsElementVisible
|
||||||
* tests whether a given element category is visible. Keep this as an
|
* tests whether a given element category is visible. Keep this as an
|
||||||
* inline function.
|
* inline function.
|
||||||
* @param aItemIdVisible is an item id from the enum GERBVIEW_LAYER_ID
|
* @param aLayerID is an item id from the enum GERBVIEW_LAYER_ID
|
||||||
* @return bool - true if the element is visible.
|
* @return bool - true if the element is visible.
|
||||||
*/
|
*/
|
||||||
bool IsElementVisible( GERBVIEW_LAYER_ID aItemIdVisible ) const;
|
bool IsElementVisible( int aLayerID ) const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function SetElementVisibility
|
* Function SetElementVisibility
|
||||||
|
@ -314,7 +290,7 @@ public:
|
||||||
* @param aNewState = The new visibility state of the element category
|
* @param aNewState = The new visibility state of the element category
|
||||||
* (see enum PCB)
|
* (see enum PCB)
|
||||||
*/
|
*/
|
||||||
void SetElementVisibility( GERBVIEW_LAYER_ID aItemIdVisible, bool aNewState );
|
void SetElementVisibility( int aLayerID, bool aNewState );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function SetGridVisibility(), virtual from EDA_DRAW_FRAME
|
* Function SetGridVisibility(), virtual from EDA_DRAW_FRAME
|
||||||
|
@ -351,9 +327,9 @@ public:
|
||||||
* Function GetVisibleElementColor
|
* Function GetVisibleElementColor
|
||||||
* returns the color of a gerber visible element.
|
* returns the color of a gerber visible element.
|
||||||
*/
|
*/
|
||||||
COLOR4D GetVisibleElementColor( GERBVIEW_LAYER_ID aItemIdVisible );
|
COLOR4D GetVisibleElementColor( int aLayerID );
|
||||||
|
|
||||||
void SetVisibleElementColor( GERBVIEW_LAYER_ID aItemIdVisible, COLOR4D aColor );
|
void SetVisibleElementColor( int aLayerID, COLOR4D aColor );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function GetLayerColor
|
* Function GetLayerColor
|
||||||
|
@ -375,36 +351,6 @@ public:
|
||||||
*/
|
*/
|
||||||
COLOR4D GetNegativeItemsColor();
|
COLOR4D GetNegativeItemsColor();
|
||||||
|
|
||||||
/**
|
|
||||||
* Function DisplayLinesSolidMode
|
|
||||||
* @return true to draw gerber lines in solid (filled) mode,
|
|
||||||
* false to draw gerber lines in sketch mode
|
|
||||||
*/
|
|
||||||
bool DisplayLinesSolidMode()
|
|
||||||
{
|
|
||||||
return m_DisplayOptions.m_DisplayLinesFill;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Function DisplayPolygonsSolidMode
|
|
||||||
* @return true to draw polygon in solid (filled) mode,
|
|
||||||
* false to draw polygon outlines only
|
|
||||||
*/
|
|
||||||
bool DisplayPolygonsSolidMode()
|
|
||||||
{
|
|
||||||
return m_DisplayOptions.m_DisplayPolygonsFill;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Function DisplayFlashedItemsSolidMode
|
|
||||||
* @return true to draw flashed items in solid (filled) mode,
|
|
||||||
* false to draw draw flashed in sketch mode
|
|
||||||
*/
|
|
||||||
bool DisplayFlashedItemsSolidMode()
|
|
||||||
{
|
|
||||||
return m_DisplayOptions.m_DisplayFlashedItemsFill;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function ReFillLayerWidget
|
* Function ReFillLayerWidget
|
||||||
* changes out all the layers in m_Layers and may be called upon
|
* changes out all the layers in m_Layers and may be called upon
|
||||||
|
@ -552,7 +498,6 @@ public:
|
||||||
GERBER_DRAW_ITEM* Locate( const wxPoint& aPosition, int typeloc );
|
GERBER_DRAW_ITEM* Locate( const wxPoint& aPosition, int typeloc );
|
||||||
|
|
||||||
void Process_Config( wxCommandEvent& event );
|
void Process_Config( wxCommandEvent& event );
|
||||||
void InstallGerberOptionsDialog( wxCommandEvent& event );
|
|
||||||
|
|
||||||
void OnUpdateDrawMode( wxUpdateUIEvent& aEvent );
|
void OnUpdateDrawMode( wxUpdateUIEvent& aEvent );
|
||||||
void OnUpdateCoordType( wxUpdateUIEvent& aEvent );
|
void OnUpdateCoordType( wxUpdateUIEvent& aEvent );
|
||||||
|
|
|
@ -108,26 +108,24 @@ void GERBER_LAYER_WIDGET::ReFillRender()
|
||||||
// is changed before appending to the LAYER_WIDGET. This is an automatic variable
|
// is changed before appending to the LAYER_WIDGET. This is an automatic variable
|
||||||
// not a static variable, change the color & state after copying from code to renderRows
|
// not a static variable, change the color & state after copying from code to renderRows
|
||||||
// on the stack.
|
// on the stack.
|
||||||
LAYER_WIDGET::ROW renderRows[3] = {
|
LAYER_WIDGET::ROW renderRows[6] = {
|
||||||
|
|
||||||
#define RR LAYER_WIDGET::ROW // Render Row abreviation to reduce source width
|
#define RR LAYER_WIDGET::ROW // Render Row abreviation to reduce source width
|
||||||
|
|
||||||
// text id color tooltip checked
|
// text id color tooltip checked
|
||||||
RR( _( "Grid" ), LAYER_GERBVIEW_GRID, WHITE, _( "Show the (x,y) grid dots" ) ),
|
RR( _( "DCodes" ), LAYER_DCODES, WHITE, _( "Show DCodes identification" ) ),
|
||||||
RR( _( "DCodes" ), LAYER_DCODES, WHITE, _( "Show DCodes identification" ) ),
|
RR( _( "Negative Objects" ), LAYER_NEGATIVE_OBJECTS, DARKGRAY, _( "Show negative objects in this color" ) ),
|
||||||
RR( _( "Neg. Obj." ), LAYER_NEGATIVE_OBJECTS, DARKGRAY,
|
RR(),
|
||||||
_( "Show negative objects in this color" ) ),
|
RR( _( "Grid" ), LAYER_GERBVIEW_GRID, WHITE, _( "Show the (x,y) grid dots" ) ),
|
||||||
|
RR( _( "Worksheet" ), LAYER_WORKSHEET, DARKRED, _( "Show worksheet") ),
|
||||||
|
RR( _( "Background" ), LAYER_PCB_BACKGROUND, BLACK, _( "PCB Background" ), true, false )
|
||||||
};
|
};
|
||||||
|
|
||||||
for( unsigned row=0; row<DIM(renderRows); ++row )
|
for( unsigned row=0; row<DIM(renderRows); ++row )
|
||||||
{
|
{
|
||||||
if( renderRows[row].color != COLOR4D::UNSPECIFIED ) // does this row show a color?
|
if( renderRows[row].color != COLOR4D::UNSPECIFIED ) // does this row show a color?
|
||||||
{
|
renderRows[row].color = myframe->GetVisibleElementColor( renderRows[row].id );
|
||||||
renderRows[row].color = myframe->GetVisibleElementColor(
|
renderRows[row].state = myframe->IsElementVisible( renderRows[row].id );
|
||||||
( GERBVIEW_LAYER_ID )renderRows[row].id );
|
|
||||||
}
|
|
||||||
renderRows[row].state = myframe->IsElementVisible(
|
|
||||||
( GERBVIEW_LAYER_ID )renderRows[row].id );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
AppendRenderRows( renderRows, DIM(renderRows) );
|
AppendRenderRows( renderRows, DIM(renderRows) );
|
||||||
|
@ -324,7 +322,7 @@ void GERBER_LAYER_WIDGET::OnLayerVisible( int aLayer, bool isVisible, bool isFin
|
||||||
|
|
||||||
void GERBER_LAYER_WIDGET::OnRenderColorChange( int aId, COLOR4D aColor )
|
void GERBER_LAYER_WIDGET::OnRenderColorChange( int aId, COLOR4D aColor )
|
||||||
{
|
{
|
||||||
myframe->SetVisibleElementColor( (GERBVIEW_LAYER_ID) aId, aColor );
|
myframe->SetVisibleElementColor( aId, aColor );
|
||||||
|
|
||||||
auto galCanvas = myframe->GetGalCanvas();
|
auto galCanvas = myframe->GetGalCanvas();
|
||||||
|
|
||||||
|
@ -347,7 +345,7 @@ void GERBER_LAYER_WIDGET::OnRenderColorChange( int aId, COLOR4D aColor )
|
||||||
|
|
||||||
void GERBER_LAYER_WIDGET::OnRenderEnable( int aId, bool isEnabled )
|
void GERBER_LAYER_WIDGET::OnRenderEnable( int aId, bool isEnabled )
|
||||||
{
|
{
|
||||||
myframe->SetElementVisibility( (GERBVIEW_LAYER_ID) aId, isEnabled );
|
myframe->SetElementVisibility( aId, isEnabled );
|
||||||
|
|
||||||
auto galCanvas = myframe->GetGalCanvas();
|
auto galCanvas = myframe->GetGalCanvas();
|
||||||
|
|
||||||
|
|
|
@ -33,7 +33,7 @@ using namespace KIGFX;
|
||||||
|
|
||||||
GERBVIEW_RENDER_SETTINGS::GERBVIEW_RENDER_SETTINGS()
|
GERBVIEW_RENDER_SETTINGS::GERBVIEW_RENDER_SETTINGS()
|
||||||
{
|
{
|
||||||
m_backgroundColor = COLOR4D( 0.0, 0.0, 0.0, 1.0 );
|
m_backgroundColor = COLOR4D::BLACK;
|
||||||
|
|
||||||
m_spotFill = true;
|
m_spotFill = true;
|
||||||
m_lineFill = true;
|
m_lineFill = true;
|
||||||
|
@ -72,6 +72,8 @@ void GERBVIEW_RENDER_SETTINGS::ImportLegacyColors( const COLORS_DESIGN_SETTINGS*
|
||||||
for( int i = GAL_LAYER_ID_START; i < GAL_LAYER_ID_END; i++ )
|
for( int i = GAL_LAYER_ID_START; i < GAL_LAYER_ID_END; i++ )
|
||||||
m_layerColors[i] = aSettings->GetLayerColor( i );
|
m_layerColors[i] = aSettings->GetLayerColor( i );
|
||||||
|
|
||||||
|
SetBackgroundColor( aSettings->GetItemColor( LAYER_PCB_BACKGROUND ) );
|
||||||
|
|
||||||
update();
|
update();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -89,6 +91,7 @@ void GERBVIEW_RENDER_SETTINGS::LoadDisplayOptions( const GBR_DISPLAY_OPTIONS* aO
|
||||||
m_diffMode = aOptions->m_DiffMode;
|
m_diffMode = aOptions->m_DiffMode;
|
||||||
m_hiContrastEnabled = aOptions->m_HighContrastMode;
|
m_hiContrastEnabled = aOptions->m_HighContrastMode;
|
||||||
m_showPageLimits = aOptions->m_DisplayPageLimits;
|
m_showPageLimits = aOptions->m_DisplayPageLimits;
|
||||||
|
m_backgroundColor = aOptions->m_BgDrawColor;
|
||||||
|
|
||||||
update();
|
update();
|
||||||
}
|
}
|
||||||
|
@ -103,9 +106,6 @@ const COLOR4D& GERBVIEW_RENDER_SETTINGS::GetColor( const VIEW_ITEM* aItem, int a
|
||||||
if( IsDCodeLayer( aLayer ) )
|
if( IsDCodeLayer( aLayer ) )
|
||||||
return m_layerColors[ LAYER_DCODES ];
|
return m_layerColors[ LAYER_DCODES ];
|
||||||
|
|
||||||
if( aLayer == LAYER_WORKSHEET )
|
|
||||||
return m_layerColors[ LAYER_WORKSHEET ];
|
|
||||||
|
|
||||||
if( item )
|
if( item )
|
||||||
{
|
{
|
||||||
if( item->IsSelected() )
|
if( item->IsSelected() )
|
||||||
|
|
Loading…
Reference in New Issue