7
mirror of https://gitlab.com/kicad/code/kicad.git synced 2025-04-14 13:29:35 +00:00

Clean up some dangling legacy odds and ends.

This commit is contained in:
Jeff Young 2019-06-01 00:24:38 +01:00
parent c71c1d4d1a
commit 7553cc2651
36 changed files with 11 additions and 390 deletions

View File

@ -110,37 +110,6 @@ COLOR4D::COLOR4D( EDA_COLOR_T aColor )
}
COLOR4D& COLOR4D::SetToLegacyHighlightColor()
{
EDA_COLOR_T legacyColor = GetNearestLegacyColor( *this );
EDA_COLOR_T highlightColor = g_ColorRefs[legacyColor].m_LightColor;
// The alpha channel is not modified. Only R, G, B values are set,
// because legacy color does not know the alpha chanel.
r = g_ColorRefs[highlightColor].m_Red / 255.0;
g = g_ColorRefs[highlightColor].m_Green / 255.0;
b = g_ColorRefs[highlightColor].m_Blue / 255.0;
return *this;
}
COLOR4D& COLOR4D::SetToNearestLegacyColor()
{
EDA_COLOR_T legacyColor = GetNearestLegacyColor( *this );
// The alpha channel is not modified. Only R, G, B values are set,
// because legacy color does not know the alpha chanel.
r = g_ColorRefs[legacyColor].m_Red / 255.0;
g = g_ColorRefs[legacyColor].m_Green / 255.0;
b = g_ColorRefs[legacyColor].m_Blue / 255.0;
return *this;
}
unsigned int COLOR4D::ToU32() const
{
return ToColour().GetRGB();
@ -157,109 +126,6 @@ COLOR4D::COLOR4D( EDA_COLOR_T aColor )
a = c.Alpha() / 255.0;
}
EDA_COLOR_T COLOR4D::GetNearestLegacyColor( const COLOR4D &aColor )
{
// Cache layer implemented here, because all callers are using wxColour
static std::map< unsigned int, unsigned int > nearestCache;
static double hues[NBCOLORS];
static double values[NBCOLORS];
unsigned int colorInt = aColor.ToU32();
auto search = nearestCache.find( colorInt );
if( search != nearestCache.end() )
return static_cast<EDA_COLOR_T>( search->second );
// First use ColorFindNearest to check for exact matches
EDA_COLOR_T nearest = ColorFindNearest( aColor.r * 255.0, aColor.g * 255.0, aColor.b * 255.0 );
if( COLOR4D( nearest ) == aColor )
{
nearestCache.insert( std::pair< unsigned int, unsigned int >(
colorInt, static_cast<unsigned int>( nearest ) ) );
return nearest;
}
// If not, use hue and value to match.
// Hue will be NAN for grayscale colors.
// The legacy color palette is a grid across hue and value.
// We can exploit that to find a good match -- hue is most apparent to the user.
// So, first we determine the closest hue match, and then the closest value from that
// "grid row" in the legacy palette.
double h, s, v;
aColor.ToHSV( h, s, v );
double minDist = 360.0;
double legacyHue = 0.0;
if( std::isnan( h ) )
{
legacyHue = NAN;
}
else
{
for( EDA_COLOR_T candidate = ::BLACK;
candidate < NBCOLORS; candidate = NextColor( candidate ) )
{
double ch;
if( hues[candidate] == 0.0 && values[candidate] == 0.0 )
{
COLOR4D candidate4d( candidate );
double cs, cv;
candidate4d.ToHSV( ch, cs, cv );
values[candidate] = cv;
// Set the hue to non-zero for black so that we won't do this more than once
hues[candidate] = ( cv == 0.0 ) ? 1.0 : ch;
}
else
{
ch = hues[candidate];
}
if( fabs( ch - h ) < minDist )
{
minDist = fabs( ch - h );
legacyHue = ch;
}
}
}
// Now we have the desired hue; let's find the nearest value
minDist = 1.0;
for( EDA_COLOR_T candidate = ::BLACK;
candidate < NBCOLORS; candidate = NextColor( candidate ) )
{
// If the target hue is NAN, we didn't extract the value for any colors above
if( std::isnan( legacyHue ) )
{
double ch, cs, cv;
COLOR4D candidate4d( candidate );
candidate4d.ToHSV( ch, cs, cv );
values[candidate] = cv;
hues[candidate] = ( cv == 0.0 ) ? 1.0 : ch;
}
if( ( std::isnan( legacyHue ) != std::isnan( hues[candidate] ) ) || hues[candidate] != legacyHue )
continue;
if( fabs( values[candidate] - v ) < minDist )
{
minDist = fabs( values[candidate] - v );
nearest = candidate;
}
}
nearestCache.insert( std::pair< unsigned int, unsigned int >(
colorInt, static_cast<unsigned int>( nearest ) ) );
return nearest;
}
#endif
namespace KIGFX {

View File

@ -46,7 +46,6 @@
#include <ws_draw_item.h>
#include <page_info.h>
#include <title_block.h>
#include <advanced_config.h>
/**
* Definition for enabling and disabling scroll bar setting trace output. See the
@ -641,10 +640,9 @@ EDA_DRAW_PANEL_GAL::GAL_TYPE EDA_DRAW_FRAME::LoadCanvasTypeSetting()
canvasType = EDA_DRAW_PANEL_GAL::GAL_TYPE_NONE;
}
// Coerce the value into a GAL type when Legacy is not available
// Default to Cairo, and on the first, user will be prompted for OpenGL
if( canvasType == EDA_DRAW_PANEL_GAL::GAL_TYPE_NONE
&& !ADVANCED_CFG::GetCfg().AllowLegacyCanvas() )
// Legacy canvas no longer supported. Switch to Cairo, and on the first instantiation
// the user will be prompted to switch to OpenGL
if( canvasType == EDA_DRAW_PANEL_GAL::GAL_TYPE_NONE )
{
#ifdef __WXMAC__
// Cairo renderer doesn't handle Retina displays

View File

@ -66,16 +66,13 @@ GAL_OPTIONS_PANEL::GAL_OPTIONS_PANEL( wxWindow* aParent, KIGFX::GAL_DISPLAY_OPTI
wxBoxSizer* sLeftSizer = new wxBoxSizer( wxVERTICAL );
m_mainSizer->Add( sLeftSizer, 1, wxALL | wxEXPAND, 0 );
// @todo LEGACY: not required when legacy is gone
const wxString galOnlySuffix = _( " (not supported in Legacy Toolset)" );
/*
* Grid settings subpanel
*/
{
wxStaticBox* sGridOpts = new wxStaticBox( this, wxID_ANY, _( "Grid Options" ) );
wxStaticBoxSizer* sGridSettings;
sGridSettings = new wxStaticBoxSizer( new wxStaticBox( this,
wxID_ANY, _( "Grid Options" ) + galOnlySuffix ), wxVERTICAL );
sGridSettings = new wxStaticBoxSizer( sGridOpts, wxVERTICAL );
wxString m_gridStyleChoices[] = {
_( "Dots" ),
@ -136,16 +133,8 @@ GAL_OPTIONS_PANEL::GAL_OPTIONS_PANEL( wxWindow* aParent, KIGFX::GAL_DISPLAY_OPTI
* Cursor settings subpanel
*/
{
wxString cursorDisplayTitle = _( "Cursor Options" );
// cursor is not shown in legacy on OSX
// @todo LEGACY remove this
#ifdef __APPLE__
cursorDisplayTitle += galOnlySuffix;
#endif
auto sCursorSettings = new wxStaticBoxSizer( new wxStaticBox( this,
wxID_ANY, cursorDisplayTitle ), wxVERTICAL );
wxID_ANY, _( "Cursor Options" ) ), wxVERTICAL );
sLeftSizer->Add( sCursorSettings, 1, wxTOP | wxRIGHT | wxEXPAND, 5 );
@ -162,19 +151,9 @@ GAL_OPTIONS_PANEL::GAL_OPTIONS_PANEL( wxWindow* aParent, KIGFX::GAL_DISPLAY_OPTI
m_cursorShape->SetSelection( 0 );
m_cursorShape->SetToolTip( _( "Cursor shape for drawing, placement and movement tools" ) );
sCursorSettings->Add( m_cursorShape, 0, wxALL | wxEXPAND, 5 );
#ifdef __APPLE__
// Whole section is galOnly on OSX; no need for further qualifier here
m_forceCursorDisplay = new wxCheckBox( this, wxID_ANY, _( "Always show crosshairs" ) );
#else
// User a shorter galOnly qualifier as otherwise the label is obnoxiously long
// @todo LEGACY remove this
m_forceCursorDisplay = new wxCheckBox( this, wxID_ANY,
_( "Always show crosshairs (not in Legacy)" ) );
#endif
sCursorSettings->Add( m_forceCursorDisplay, 0, wxALL | wxEXPAND, 5 );
}
}

View File

@ -1123,8 +1123,6 @@ void GERBVIEW_FRAME::ActivateGalCanvas()
m_toolManager->ResetTools( TOOL_BASE::GAL_SWITCH );
}
m_colorsSettings->SetLegacyMode( false );
galCanvas->GetGAL()->SetGridColor( GetLayerColor( LAYER_GERBVIEW_GRID ) );
SetPageSettings( GetPageSettings() );

View File

@ -83,12 +83,6 @@ static EDA_HOTKEY HkSwitch2NextCopperLayer( _HKI( "Switch to Next Layer" ),
static EDA_HOTKEY HkSwitch2PreviousCopperLayer( _HKI( "Switch to Previous Layer" ),
HK_SWITCH_LAYER_TO_PREVIOUS, '-' );
static EDA_HOTKEY HkCanvasDefault( _HKI( "Switch to Legacy Toolset" ),
HK_CANVAS_LEGACY,
#ifdef __WXMAC__
GR_KB_ALT +
#endif
WXK_F9 );
static EDA_HOTKEY HkCanvasOpenGL( _HKI( "Switch to Modern Toolset with hardware-accelerated graphics (recommended)" ),
HK_CANVAS_OPENGL,
#ifdef __WXMAC__
@ -115,7 +109,6 @@ EDA_HOTKEY* gerbviewHotkeyList[] = {
&HkSwitchHighContrastMode,
&HkSwitch2NextCopperLayer,
&HkSwitch2PreviousCopperLayer,
&HkCanvasDefault,
&HkCanvasOpenGL,
&HkCanvasCairo,
&HkMeasureTool,

View File

@ -103,25 +103,6 @@ public:
*/
COLOR4D LegacyMix( COLOR4D aColor ) const;
/**
* Function SetToLegacyHighlightColor()
* Sets the color to the "light" version of the nearest matching
* legacy color (see g_ColorRefs in colors.cpp).
*/
COLOR4D& SetToLegacyHighlightColor();
/**
* Function SetToNearestLegacyColor()
* Sets the color to the nearest matching
* legacy color (see g_ColorRefs in colors.cpp).
*/
COLOR4D& SetToNearestLegacyColor();
COLOR4D AsLegacyColor() const
{
return COLOR4D( COLOR4D::GetNearestLegacyColor( *this ) );
}
/**
* Packs the color into an unsigned int for compatibility with legacy canvas.
* Note that this is a lossy downsampling and also that the alpha channel is lost.
@ -132,11 +113,6 @@ public:
* Unpacks from a unsigned int in the legacy EDA_COLOR_T format.
*/
void FromU32( unsigned int aPackedColor );
/**
* Determines the "nearest" EDA_COLOR_T according to ColorFindNearest
*/
static EDA_COLOR_T GetNearestLegacyColor( const COLOR4D &aColor );
#endif /* WX_COMPATIBLITY */

View File

@ -355,15 +355,6 @@ public:
*/
void Compile_Ratsnest( bool aDisplayStatus );
/**
* function Displays the general ratsnest
* Only ratsnest with the status bit CH_VISIBLE is set are displayed
* @param aDC = the current device context (can be NULL)
* @param aNetcode if > 0, Display only the ratsnest relative to the
* corresponding net_code
*/
void DrawGeneralRatsnest( wxDC* aDC, int aNetcode = 0 );
/* Functions relative to Undo/redo commands: */
/**

View File

@ -45,8 +45,6 @@ public:
* @param aParent parent window
* @param aColor initial swatch color
* @param aID id to use when sending swatch events
* @param aArbitraryColors true to allow selection of any 32 bits color for GAL canvas,
* and false to allow a selection from a set of colors accepted by the legacy canvas.
*/
COLOR_SWATCH( wxWindow* aParent, KIGFX::COLOR4D aColor, int aID, KIGFX::COLOR4D aBackground );

View File

@ -172,8 +172,6 @@ void BOARD_COMMIT::Push( const wxString& aMessage, bool aCreateUndoEntry, bool a
module->Delete( boardItem );
}
board->m_Status_Pcb = 0; // it is done in the legacy view (ratsnest perhaps?)
break;
// Board items
@ -207,9 +205,6 @@ void BOARD_COMMIT::Push( const wxString& aMessage, bool aCreateUndoEntry, bool a
if( !( changeFlags & CHT_DONE ) )
board->Remove( module ); // handles connectivity
// Clear flags to indicate, that the ratsnest, list of nets & pads are not valid anymore
board->m_Status_Pcb = 0;
}
break;

View File

@ -115,7 +115,6 @@ BOARD::BOARD() :
m_fileFormatVersionAtLoad = LEGACY_BOARD_FILE_VERSION;
m_colorsSettings = &dummyColorsSettings;
m_Status_Pcb = 0; // Status word: bit 1 = calculate.
m_CurrentZoneContour = NULL; // This ZONE_CONTAINER handle the
// zone contour currently in progress
@ -836,8 +835,6 @@ void BOARD::SetElementVisibility( GAL_LAYER_ID aLayer, bool isEnabled )
zone->SetLocalRatsnestVisible( isEnabled );
}
m_Status_Pcb = 0;
break;
}
@ -909,9 +906,6 @@ void BOARD::Add( BOARD_ITEM* aBoardItem, ADD_MODE aMode )
else
m_Modules.PushFront( (MODULE*) aBoardItem );
// Because the list of pads has changed, reset the status
// This indicate the list of pad and nets must be recalculated before use
m_Status_Pcb = 0;
break;
case PCB_DIMENSION_T:

View File

@ -236,10 +236,6 @@ public:
const wxString &GetFileName() const { return m_fileName; }
/// Flags used in ratsnest calculation and update.
int m_Status_Pcb;
private:
DLIST<BOARD_ITEM> m_Drawings; // linked list of lines & texts

View File

@ -250,7 +250,6 @@ void DIALOG_DRC_CONTROL::OnStartdrcClick( wxCommandEvent& event )
// run all the tests, with no UI at this time.
m_Messages->Clear();
wxSafeYield(); // Allows time slice to refresh the Messages
m_brdEditor->GetBoard()->m_Status_Pcb = 0; // Force full connectivity and ratsnest calculations
m_tester->RunTests(m_Messages);
m_Notebook->ChangeSelection( 0 ); // display the "Problems/Markers" tab

View File

@ -449,8 +449,6 @@ void PCB_EDIT_FRAME::Exchange_Module( MODULE* aSrc, MODULE* aDest, BOARD_COMMIT&
aCommit.Remove( aSrc );
aCommit.Add( aDest );
// @todo LEGACY should be unnecessary
GetBoard()->m_Status_Pcb = 0;
aDest->ClearFlags();
}

View File

@ -1572,9 +1572,6 @@ bool DIALOG_PAD_PROPERTIES::TransferDataFromWindow()
commit.Push( _( "Modify pad" ) );
if( rastnestIsChanged ) // The net ratsnest must be recalculated
m_board->m_Status_Pcb = 0;
return true;
}

View File

@ -49,6 +49,7 @@ bool PANEL_PCBNEW_SETTINGS::TransferDataToWindow()
rotationAngle = AngleToStringDegrees( (double)m_Frame->GetRotationAngle() );
m_RotationAngle->SetValue( rotationAngle );
// JEY TODO: clean out legacy-routing settings
m_TrackAutodel->SetValue( m_Frame->Settings().m_legacyAutoDeleteOldTrack );
m_Track_45_Only_Ctrl->SetValue( m_Frame->Settings().m_legacyUse45DegreeTracks );
m_Segments_45_Only_Ctrl->SetValue( m_Frame->Settings().m_use45DegreeGraphicSegments );

View File

@ -105,6 +105,7 @@ void DRC::addMarkerToPcb( MARKER_PCB* aMarker )
{
// In legacy routing mode, do not add markers to the board.
// only shows the drc error message
// JEY TODO: clear out the legacyRoutingMode stuff...
if( m_drcInLegacyRoutingMode )
{
m_pcbEditorFrame->SetMsgPanel( aMarker );

View File

@ -188,12 +188,6 @@ void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
ArchiveModulesOnBoard( true );
break;
case ID_GEN_IMPORT_GRAPHICS_FILE:
InvokeDialogImportGfxBoard( this );
GetGalCanvas()->Refresh();
break;
default:
wxLogDebug( wxT( "PCB_EDIT_FRAME::Process_Special_Functions() unknown event id %d" ), id );
break;

View File

@ -580,9 +580,6 @@ bool PCB_EDIT_FRAME::OpenProjectFiles( const std::vector<wxString>& aFileSet, in
if( !converted )
UpdateFileHistory( GetBoard()->GetFileName() );
// Rebuild the new pad list (for drc and ratsnet control ...)
GetBoard()->m_Status_Pcb = 0;
// Select netclass Default as current netclass (it always exists)
SetCurrentNetClass( NETCLASS::Default );

View File

@ -104,7 +104,6 @@ BEGIN_EVENT_TABLE( FOOTPRINT_EDIT_FRAME, PCB_BASE_FRAME )
EVT_TOOL( ID_MODEDIT_CREATE_NEW_LIB, FOOTPRINT_EDIT_FRAME::Process_Special_Functions )
EVT_TOOL( ID_MODEDIT_ADD_LIBRARY, FOOTPRINT_EDIT_FRAME::Process_Special_Functions )
EVT_TOOL( ID_MODEDIT_SHEET_SET, FOOTPRINT_EDIT_FRAME::Process_Special_Functions )
EVT_TOOL( ID_GEN_IMPORT_GRAPHICS_FILE, FOOTPRINT_EDIT_FRAME::Process_Special_Functions )
EVT_TOOL( wxID_PRINT, FOOTPRINT_EDIT_FRAME::ToPrinter )
EVT_TOOL( ID_MODEDIT_EDIT_MODULE, FOOTPRINT_EDIT_FRAME::Process_Special_Functions )
EVT_TOOL( ID_MODEDIT_CHECK, FOOTPRINT_EDIT_FRAME::Process_Special_Functions )

View File

@ -460,14 +460,6 @@ void FOOTPRINT_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
}
break;
case ID_GEN_IMPORT_GRAPHICS_FILE:
if( GetBoard()->m_Modules )
{
InvokeDialogImportGfxModule( this, GetBoard()->m_Modules );
GetGalCanvas()->Refresh();
}
break;
default:
wxLogDebug( wxT( "FOOTPRINT_EDIT_FRAME::Process_Special_Functions error" ) );
break;

View File

@ -329,7 +329,6 @@ MODULE* FOOTPRINT_EDIT_FRAME::Import_Module( const wxString& aName )
module->SetPosition( wxPoint( 0, 0 ) );
GetBoard()->m_Status_Pcb = 0;
GetBoard()->BuildListOfNets();
updateView();
@ -858,8 +857,6 @@ bool FOOTPRINT_EDIT_FRAME::SaveFootprintToBoard( bool aAddNew )
}
newmodule->ClearFlags();
// @todo LEGACY should be unnecessary
mainpcb->m_Status_Pcb = 0;
return true;
}

View File

@ -187,12 +187,6 @@ static EDA_HOTKEY HkDecreaseLineWidth( _HKI( "Decrease Line Width" ), HK_DEC_LIN
static EDA_HOTKEY HkSetGridOrigin( _HKI( "Set Grid Origin" ), HK_SET_GRID_ORIGIN, 'S' );
static EDA_HOTKEY HkResetGridOrigin( _HKI( "Reset Grid Origin" ), HK_RESET_GRID_ORIGIN, 'Z' );
static EDA_HOTKEY HkCanvasDefault( _HKI( "Switch to Legacy Toolset (not all features will be available" ),
HK_CANVAS_LEGACY,
#ifdef __WXMAC__
GR_KB_ALT +
#endif
WXK_F9 );
static EDA_HOTKEY HkCanvasOpenGL( _HKI( "Switch to Modern Toolset with hardware-accelerated graphics (recommended)" ),
HK_CANVAS_OPENGL,
#ifdef __WXMAC__
@ -477,7 +471,6 @@ EDA_HOTKEY* board_edit_Hotkey_List[] =
// Display
&HkSwitchHighContrastMode,
&HkCanvasDefault,
&HkCanvasCairo,
&HkCanvasOpenGL,
NULL
@ -514,7 +507,6 @@ EDA_HOTKEY* module_edit_Hotkey_List[] = {
// Display
&HkSwitchHighContrastMode,
&HkCanvasDefault,
&HkCanvasCairo,
&HkCanvasOpenGL,
NULL

View File

@ -379,17 +379,3 @@ void DIALOG_IMPORT_GFX::updatePcbImportOffsets_mm()
}
// Used only in legacy canvas by the board editor.
bool InvokeDialogImportGfxBoard( PCB_BASE_FRAME* aCaller )
{
// Legacy R.I.P.
return true;
}
// Used only in legacy canvas by the footprint editor.
bool InvokeDialogImportGfxModule( PCB_BASE_FRAME* aCaller, MODULE* aModule )
{
// Legacy R.I.P.
return true;
}

View File

@ -95,23 +95,6 @@ void Invoke3DShapeLibsDownloaderWizard( wxWindow* aCaller );
void InvokePluginOptionsEditor( wxWindow* aCaller, const wxString& aNickname,
const wxString& aPluginType, const wxString& aOptions, wxString* aResult );
/**
* Shows the modal DIALOG_IMPORT_GFX for importing a DXF file to a board.
* @param aCaller is the wxTopLevelWindow which is invoking the dialog.
* @return true if the import was made.
*/
bool InvokeDialogImportGfxBoard( PCB_BASE_FRAME* aCaller );
/**
* shows the modal DIALOG_IMPORT_GFX for importing a DXF file as footprint outlines.
*
* @param aCaller is the wxTopLevelWindow which is invoking the dialog.
* @param aModule is the footprint currently edited.
* @return true if the import was made.
*/
bool InvokeDialogImportGfxModule( PCB_BASE_FRAME* aCaller, MODULE* aModule );
/**
* Function InvokeExportSVG
* shows the Export SVG dialog

View File

@ -110,7 +110,6 @@ bool FOOTPRINT_EDIT_FRAME::Load_Module_From_BOARD( MODULE* aModule )
if( !Clear_Pcb( true ) )
return false;
GetBoard()->m_Status_Pcb = 0;
newModule = new MODULE( *aModule );
newModule->SetParent( GetBoard() );
newModule->SetLink( aModule->GetTimeStamp() );

Some files were not shown because too many files have changed in this diff Show More