Use preview items instead of highlightNets & status popup
The router preview item can be specific to the part that is being tuned, rather than the whole net. It's also less visually noisy as it doesn't dim/undim the rest of the board. Using kigfx preview items for the status keeps us from having a bunch of focus issues with the status popup window.
This commit is contained in:
parent
2a2dc3a508
commit
b13590f4c0
|
@ -141,86 +141,3 @@ void STATUS_TEXT_POPUP::SetTextColor( const wxColour& aColor )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
STATUS_MIN_MAX_POPUP::STATUS_MIN_MAX_POPUP( EDA_DRAW_FRAME* aFrame ) :
|
|
||||||
STATUS_POPUP( aFrame ),
|
|
||||||
m_frame( aFrame ),
|
|
||||||
m_min( 0.0 ),
|
|
||||||
m_max( 0.0 )
|
|
||||||
{
|
|
||||||
m_icon = new wxStaticBitmap( m_panel, wxID_ANY, KiBitmap( BITMAPS::checked_ok ),
|
|
||||||
wxDefaultPosition, wxSize( 12, 12 ) );
|
|
||||||
|
|
||||||
m_currentLabel = new wxStaticText( m_panel, wxID_ANY, _( "current" ) );
|
|
||||||
wxStaticText* minLabel = new wxStaticText( m_panel, wxID_ANY, _( "min" ) );
|
|
||||||
wxStaticText* maxLabel = new wxStaticText( m_panel, wxID_ANY, _( "max" ) );
|
|
||||||
|
|
||||||
wxFont infoFont = KIUI::GetStatusFont( this );
|
|
||||||
m_currentLabel->SetFont( infoFont );
|
|
||||||
minLabel->SetFont( infoFont );
|
|
||||||
maxLabel->SetFont( infoFont );
|
|
||||||
|
|
||||||
m_currentText = new wxStaticText( m_panel, wxID_ANY, wxEmptyString );
|
|
||||||
m_minText = new wxStaticText( m_panel, wxID_ANY, wxEmptyString );
|
|
||||||
m_maxText = new wxStaticText( m_panel, wxID_ANY, wxEmptyString );
|
|
||||||
|
|
||||||
wxBoxSizer* currentSizer = new wxBoxSizer( wxVERTICAL );
|
|
||||||
currentSizer->Add( m_currentLabel, 0, 0, 5 );
|
|
||||||
currentSizer->Add( m_currentText, 0, 0, 5 );
|
|
||||||
|
|
||||||
wxBoxSizer* minSizer = new wxBoxSizer( wxVERTICAL );
|
|
||||||
minSizer->Add( minLabel, 0, 0, 5 );
|
|
||||||
minSizer->Add( m_minText, 0, 0, 5 );
|
|
||||||
|
|
||||||
wxBoxSizer* maxSizer = new wxBoxSizer( wxVERTICAL );
|
|
||||||
maxSizer->Add( maxLabel, 0, 0, 5 );
|
|
||||||
maxSizer->Add( m_maxText, 0, 0, 5 );
|
|
||||||
|
|
||||||
m_topSizer->Add( currentSizer, 0, wxLEFT | wxRIGHT, 3 );
|
|
||||||
m_topSizer->Add( m_icon, 0, wxALL | wxALIGN_BOTTOM | wxRESERVE_SPACE_EVEN_IF_HIDDEN, 1 );
|
|
||||||
m_topSizer->Add( minSizer, 0, wxLEFT | wxRIGHT, 3 );
|
|
||||||
m_topSizer->Add( maxSizer, 0, wxLEFT | wxRIGHT, 3 );
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void STATUS_MIN_MAX_POPUP::SetMinMax( double aMin, double aMax )
|
|
||||||
{
|
|
||||||
m_min = aMin;
|
|
||||||
m_minText->SetLabel( m_frame->MessageTextFromValue( m_min, false ) );
|
|
||||||
m_max = aMax;
|
|
||||||
m_maxText->SetLabel( m_frame->MessageTextFromValue( m_max, false ) );
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void STATUS_MIN_MAX_POPUP::ClearMinMax()
|
|
||||||
{
|
|
||||||
m_min = 0;
|
|
||||||
m_minText->SetLabel( wxT( "---" ) );
|
|
||||||
m_max = std::numeric_limits<double>::max();
|
|
||||||
m_maxText->SetLabel( wxT( "---" ) );
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void STATUS_MIN_MAX_POPUP::SetCurrent( double aCurrent, const wxString& aLabel )
|
|
||||||
{
|
|
||||||
m_currentLabel->SetLabel( aLabel );
|
|
||||||
m_currentText->SetLabel( m_frame->MessageTextFromValue( aCurrent ) );
|
|
||||||
m_icon->Show( aCurrent >= m_min && aCurrent <= m_max );
|
|
||||||
|
|
||||||
wxColour normal = wxSystemSettings::GetColour( wxSYS_COLOUR_BTNTEXT );
|
|
||||||
|
|
||||||
// Determine the background color first and choose a contrasting value
|
|
||||||
COLOR4D bg = GetBackgroundColour();
|
|
||||||
COLOR4D red;
|
|
||||||
double bg_h, bg_s, bg_l;
|
|
||||||
bg.ToHSL( bg_h, bg_s, bg_l );
|
|
||||||
red.FromHSL( 0, 1.0, bg_l < 0.5 ? 0.7 : 0.3 );
|
|
||||||
|
|
||||||
m_minText->SetForegroundColour( aCurrent < m_min ? red.ToColour() : normal );
|
|
||||||
m_maxText->SetForegroundColour( aCurrent > m_max ? red.ToColour() : normal );
|
|
||||||
|
|
||||||
m_topSizer->Layout();
|
|
||||||
updateSize();
|
|
||||||
|
|
||||||
Refresh();
|
|
||||||
Update();
|
|
||||||
}
|
|
|
@ -105,31 +105,4 @@ protected:
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Extension of #STATUS_POPUP for displaying a value with min and max.
|
|
||||||
*/
|
|
||||||
class STATUS_MIN_MAX_POPUP : public STATUS_POPUP
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
STATUS_MIN_MAX_POPUP( EDA_DRAW_FRAME* aFrame );
|
|
||||||
virtual ~STATUS_MIN_MAX_POPUP() {}
|
|
||||||
|
|
||||||
void SetMinMax( double aMin, double aMax );
|
|
||||||
void ClearMinMax();
|
|
||||||
|
|
||||||
void SetCurrent( double aCurrent, const wxString& aLabel );
|
|
||||||
|
|
||||||
protected:
|
|
||||||
EDA_DRAW_FRAME* m_frame;
|
|
||||||
double m_min;
|
|
||||||
double m_max;
|
|
||||||
|
|
||||||
private:
|
|
||||||
wxStaticText* m_currentLabel;
|
|
||||||
wxStaticText* m_currentText;
|
|
||||||
wxStaticText* m_minText;
|
|
||||||
wxStaticText* m_maxText;
|
|
||||||
wxStaticBitmap* m_icon;
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif /* __STATUS_POPUP_H_*/
|
#endif /* __STATUS_POPUP_H_*/
|
||||||
|
|
|
@ -29,10 +29,10 @@
|
||||||
#include <magic_enum.hpp>
|
#include <magic_enum.hpp>
|
||||||
|
|
||||||
#include <wx/debug.h>
|
#include <wx/debug.h>
|
||||||
|
#include <gal/graphics_abstraction_layer.h>
|
||||||
#include <geometry/shape_circle.h>
|
#include <geometry/shape_circle.h>
|
||||||
#include <kiplatform/ui.h>
|
#include <kiplatform/ui.h>
|
||||||
#include <dialogs/dialog_unit_entry.h>
|
#include <dialogs/dialog_unit_entry.h>
|
||||||
#include <status_popup.h>
|
|
||||||
#include <collectors.h>
|
#include <collectors.h>
|
||||||
#include <scoped_set_reset.h>
|
#include <scoped_set_reset.h>
|
||||||
|
|
||||||
|
@ -50,6 +50,7 @@
|
||||||
#include <tools/zone_filler_tool.h>
|
#include <tools/zone_filler_tool.h>
|
||||||
|
|
||||||
#include <preview_items/draw_context.h>
|
#include <preview_items/draw_context.h>
|
||||||
|
#include <preview_items/preview_utils.h>
|
||||||
#include <view/view.h>
|
#include <view/view.h>
|
||||||
|
|
||||||
#include <router/pns_dp_meander_placer.h>
|
#include <router/pns_dp_meander_placer.h>
|
||||||
|
@ -60,6 +61,7 @@
|
||||||
#include <router/pns_arc.h>
|
#include <router/pns_arc.h>
|
||||||
#include <router/pns_solid.h>
|
#include <router/pns_solid.h>
|
||||||
#include <router/pns_topology.h>
|
#include <router/pns_topology.h>
|
||||||
|
#include <router/router_preview_item.h>
|
||||||
|
|
||||||
#include <dialogs/dialog_tuning_pattern_properties.h>
|
#include <dialogs/dialog_tuning_pattern_properties.h>
|
||||||
|
|
||||||
|
@ -72,6 +74,112 @@ enum LENGTH_TUNING_MODE
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
class TUNING_STATUS_VIEW_ITEM : public EDA_ITEM
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
TUNING_STATUS_VIEW_ITEM( PCB_BASE_EDIT_FRAME* aFrame ) :
|
||||||
|
EDA_ITEM( NOT_USED ), // Never added to anything - just a preview
|
||||||
|
m_frame( aFrame )
|
||||||
|
{ }
|
||||||
|
|
||||||
|
wxString GetClass() const override { return wxT( "TUNING_STATUS" ); }
|
||||||
|
|
||||||
|
#if defined(DEBUG)
|
||||||
|
void Show( int nestLevel, std::ostream& os ) const override {}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
VECTOR2I GetPosition() const override { return m_pos; }
|
||||||
|
void SetPosition( const VECTOR2I& aPos ) override { m_pos = aPos; };
|
||||||
|
|
||||||
|
void SetMinMax( double aMin, double aMax )
|
||||||
|
{
|
||||||
|
m_min = aMin;
|
||||||
|
m_minText = m_frame->MessageTextFromValue( m_min, false );
|
||||||
|
m_max = aMax;
|
||||||
|
m_maxText = m_frame->MessageTextFromValue( m_max, false );
|
||||||
|
}
|
||||||
|
|
||||||
|
void ClearMinMax()
|
||||||
|
{
|
||||||
|
m_min = 0.0;
|
||||||
|
m_minText = wxT( "---" );
|
||||||
|
m_max = std::numeric_limits<double>::max();
|
||||||
|
m_maxText = wxT( "---" );
|
||||||
|
}
|
||||||
|
|
||||||
|
void SetCurrent( double aCurrent, const wxString& aLabel )
|
||||||
|
{
|
||||||
|
m_current = aCurrent;
|
||||||
|
m_currentText = m_frame->MessageTextFromValue( aCurrent );
|
||||||
|
m_currentLabel = aLabel;
|
||||||
|
}
|
||||||
|
|
||||||
|
const BOX2I ViewBBox() const override
|
||||||
|
{
|
||||||
|
BOX2I tmp;
|
||||||
|
|
||||||
|
// this is an edit-time artefact; no reason to try and be smart with the bounding box
|
||||||
|
// (besides, we can't tell the text extents without a view to know what the scale is)
|
||||||
|
tmp.SetMaximum();
|
||||||
|
return tmp;
|
||||||
|
}
|
||||||
|
|
||||||
|
void ViewGetLayers( int aLayers[], int& aCount ) const override
|
||||||
|
{
|
||||||
|
aLayers[0] = LAYER_SELECT_OVERLAY;
|
||||||
|
aLayers[1] = LAYER_GP_OVERLAY;
|
||||||
|
aCount = 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
void ViewDraw( int aLayer, KIGFX::VIEW* aView ) const override
|
||||||
|
{
|
||||||
|
KIGFX::GAL* gal = aView->GetGAL();
|
||||||
|
RENDER_SETTINGS* rs = aView->GetPainter()->GetSettings();
|
||||||
|
bool drawingDropShadows = ( aLayer == LAYER_GP_OVERLAY );
|
||||||
|
|
||||||
|
gal->PushDepth();
|
||||||
|
gal->SetLayerDepth( gal->GetMinDepth() );
|
||||||
|
|
||||||
|
if( drawingDropShadows )
|
||||||
|
gal->SetStrokeColor( KIGFX::PREVIEW::GetShadowColor( gal->GetStrokeColor() ) );
|
||||||
|
else
|
||||||
|
gal->SetStrokeColor( rs->GetLayerColor( LAYER_AUX_ITEMS ) );
|
||||||
|
|
||||||
|
std::vector<wxString> strings;
|
||||||
|
wxString status;
|
||||||
|
|
||||||
|
if( m_current < m_min )
|
||||||
|
status = _( "(too short)" );
|
||||||
|
else if( m_current > m_max )
|
||||||
|
status = _( "(too long)" );
|
||||||
|
|
||||||
|
strings.push_back( wxString::Format( wxT( "%s: %s %s" ),
|
||||||
|
m_currentLabel,
|
||||||
|
m_currentText,
|
||||||
|
status ) );
|
||||||
|
|
||||||
|
strings.push_back( wxString::Format( _( "Min: %s" ), m_minText ) );
|
||||||
|
strings.push_back( wxString::Format( _( "Max: %s" ), m_maxText ) );
|
||||||
|
|
||||||
|
KIGFX::PREVIEW::DrawTextNextToCursor( aView, GetPosition(), { -1 , 1 }, strings,
|
||||||
|
drawingDropShadows );
|
||||||
|
|
||||||
|
gal->PopDepth();
|
||||||
|
}
|
||||||
|
|
||||||
|
protected:
|
||||||
|
EDA_DRAW_FRAME* m_frame;
|
||||||
|
VECTOR2I m_pos;
|
||||||
|
double m_min;
|
||||||
|
double m_max;
|
||||||
|
double m_current;
|
||||||
|
wxString m_currentLabel;
|
||||||
|
wxString m_currentText;
|
||||||
|
wxString m_minText;
|
||||||
|
wxString m_maxText;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
class PCB_TUNING_PATTERN : public PCB_GENERATOR
|
class PCB_TUNING_PATTERN : public PCB_GENERATOR
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
@ -240,8 +348,8 @@ public:
|
||||||
|
|
||||||
void ShowPropertiesDialog( PCB_BASE_EDIT_FRAME* aEditFrame ) override;
|
void ShowPropertiesDialog( PCB_BASE_EDIT_FRAME* aEditFrame ) override;
|
||||||
|
|
||||||
void UpdateStatus( GENERATOR_TOOL* aTool, PCB_BASE_EDIT_FRAME* aFrame,
|
std::vector<EDA_ITEM*> GetPreviewItems( GENERATOR_TOOL* aTool, PCB_BASE_EDIT_FRAME* aFrame,
|
||||||
STATUS_MIN_MAX_POPUP* aPopup ) override;
|
bool aStatusOnly = false ) override;
|
||||||
|
|
||||||
void GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITEM>& aList ) override;
|
void GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITEM>& aList ) override;
|
||||||
|
|
||||||
|
@ -1681,32 +1789,49 @@ void PCB_TUNING_PATTERN::ShowPropertiesDialog( PCB_BASE_EDIT_FRAME* aEditFrame )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void PCB_TUNING_PATTERN::UpdateStatus( GENERATOR_TOOL* aTool, PCB_BASE_EDIT_FRAME* aFrame,
|
std::vector<EDA_ITEM*> PCB_TUNING_PATTERN::GetPreviewItems( GENERATOR_TOOL* aTool,
|
||||||
STATUS_MIN_MAX_POPUP* aPopup )
|
PCB_BASE_EDIT_FRAME* aFrame,
|
||||||
|
bool aStatusOnly )
|
||||||
{
|
{
|
||||||
auto* placer = dynamic_cast<PNS::MEANDER_PLACER_BASE*>( aTool->Router()->Placer() );
|
std::vector<EDA_ITEM*> previewItems;
|
||||||
|
KIGFX::VIEW* view = aFrame->GetCanvas()->GetView();
|
||||||
|
|
||||||
if( !placer )
|
if( auto* placer = dynamic_cast<PNS::MEANDER_PLACER_BASE*>( aTool->Router()->Placer() ) )
|
||||||
return;
|
{
|
||||||
|
if( !aStatusOnly )
|
||||||
|
{
|
||||||
|
PNS::ITEM_SET items = placer->TunedPath();
|
||||||
|
|
||||||
|
for( PNS::ITEM* item : items )
|
||||||
|
previewItems.push_back( new ROUTER_PREVIEW_ITEM( item, view, true ) );
|
||||||
|
}
|
||||||
|
|
||||||
|
TUNING_STATUS_VIEW_ITEM* statusItem = new TUNING_STATUS_VIEW_ITEM( aFrame );
|
||||||
|
|
||||||
if( m_unconstrained )
|
if( m_unconstrained )
|
||||||
{
|
{
|
||||||
aPopup->ClearMinMax();
|
statusItem->ClearMinMax();
|
||||||
}
|
}
|
||||||
else if( m_tuningMode == DIFF_PAIR_SKEW )
|
else if( m_tuningMode == DIFF_PAIR_SKEW )
|
||||||
{
|
{
|
||||||
aPopup->SetMinMax( m_settings.m_targetSkew.Min(), m_settings.m_targetSkew.Max() );
|
statusItem->SetMinMax( m_settings.m_targetSkew.Min(), m_settings.m_targetSkew.Max() );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
aPopup->SetMinMax( (double) m_settings.m_targetLength.Min(),
|
statusItem->SetMinMax( (double) m_settings.m_targetLength.Min(),
|
||||||
(double) m_settings.m_targetLength.Max() );
|
(double) m_settings.m_targetLength.Max() );
|
||||||
}
|
}
|
||||||
|
|
||||||
if( m_tuningMode == DIFF_PAIR_SKEW )
|
if( m_tuningMode == DIFF_PAIR_SKEW )
|
||||||
aPopup->SetCurrent( (double) placer->TuningResult(), _( "current skew" ) );
|
statusItem->SetCurrent( (double) placer->TuningResult(), _( "Skew" ) );
|
||||||
else
|
else
|
||||||
aPopup->SetCurrent( (double) placer->TuningResult(), _( "current length" ) );
|
statusItem->SetCurrent( (double) placer->TuningResult(), _( "Length" ) );
|
||||||
|
|
||||||
|
statusItem->SetPosition( aFrame->GetToolManager()->GetMousePosition() );
|
||||||
|
previewItems.push_back( statusItem );
|
||||||
|
}
|
||||||
|
|
||||||
|
return previewItems;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1912,20 +2037,22 @@ int DRAWING_TOOL::PlaceTuningPattern( const TOOL_EVENT& aEvent )
|
||||||
|
|
||||||
if( dummyPattern )
|
if( dummyPattern )
|
||||||
{
|
{
|
||||||
m_statusPopup->Popup();
|
|
||||||
canvas()->SetStatusPopup( m_statusPopup.get() );
|
|
||||||
|
|
||||||
dummyPattern->EditStart( generatorTool, m_board, m_frame, nullptr );
|
dummyPattern->EditStart( generatorTool, m_board, m_frame, nullptr );
|
||||||
dummyPattern->Update( generatorTool, m_board, m_frame, nullptr );
|
dummyPattern->Update( generatorTool, m_board, m_frame, nullptr );
|
||||||
|
|
||||||
dummyPattern->UpdateStatus( generatorTool, m_frame, m_statusPopup.get() );
|
m_preview.FreeItems();
|
||||||
m_statusPopup->Move( KIPLATFORM::UI::GetMousePosition() + wxPoint( 20, 20 ) );
|
|
||||||
|
for( EDA_ITEM* item : dummyPattern->GetPreviewItems( generatorTool, m_frame ) )
|
||||||
|
m_preview.Add( item );
|
||||||
|
|
||||||
generatorTool->Router()->StopRouting();
|
generatorTool->Router()->StopRouting();
|
||||||
|
|
||||||
|
m_view->Update( &m_preview );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
m_statusPopup->Hide();
|
m_preview.FreeItems();
|
||||||
|
m_view->Update( &m_preview );
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -1937,13 +2064,7 @@ int DRAWING_TOOL::PlaceTuningPattern( const TOOL_EVENT& aEvent )
|
||||||
m_tuningPattern->EditStart( generatorTool, m_board, m_frame, nullptr );
|
m_tuningPattern->EditStart( generatorTool, m_board, m_frame, nullptr );
|
||||||
m_tuningPattern->Update( generatorTool, m_board, m_frame, nullptr );
|
m_tuningPattern->Update( generatorTool, m_board, m_frame, nullptr );
|
||||||
|
|
||||||
m_statusPopup->Popup();
|
|
||||||
canvas()->SetStatusPopup( m_statusPopup.get() );
|
|
||||||
|
|
||||||
m_view->Update( &m_preview );
|
m_view->Update( &m_preview );
|
||||||
|
|
||||||
m_tuningPattern->UpdateStatus( generatorTool, m_frame, m_statusPopup.get() );
|
|
||||||
m_statusPopup->Move( KIPLATFORM::UI::GetMousePosition() + wxPoint( 20, 20 ) );
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -1962,8 +2083,6 @@ int DRAWING_TOOL::PlaceTuningPattern( const TOOL_EVENT& aEvent )
|
||||||
// First click already made; clean up tuning pattern preview
|
// First click already made; clean up tuning pattern preview
|
||||||
m_tuningPattern->EditRevert( generatorTool, m_board, m_frame, nullptr );
|
m_tuningPattern->EditRevert( generatorTool, m_board, m_frame, nullptr );
|
||||||
|
|
||||||
m_preview.Clear();
|
|
||||||
|
|
||||||
delete m_tuningPattern;
|
delete m_tuningPattern;
|
||||||
m_tuningPattern = nullptr;
|
m_tuningPattern = nullptr;
|
||||||
}
|
}
|
||||||
|
@ -1989,18 +2108,10 @@ int DRAWING_TOOL::PlaceTuningPattern( const TOOL_EVENT& aEvent )
|
||||||
if( collector.GetCount() > 1 )
|
if( collector.GetCount() > 1 )
|
||||||
selectionTool->GuessSelectionCandidates( collector, cursorPos );
|
selectionTool->GuessSelectionCandidates( collector, cursorPos );
|
||||||
|
|
||||||
BOARD_ITEM* item = collector.GetCount() == 1 ? collector[ 0 ] : nullptr;
|
if( collector.GetCount() == 1 )
|
||||||
|
m_pickerItem = static_cast<BOARD_CONNECTED_ITEM*>( collector[0] );
|
||||||
if( !m_pickerItem )
|
|
||||||
{
|
|
||||||
m_pickerItem = static_cast<BOARD_CONNECTED_ITEM*>( item );
|
|
||||||
generatorTool->HighlightNets( m_pickerItem );
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
m_pickerItem = nullptr;
|
||||||
m_pickerItem = static_cast<BOARD_CONNECTED_ITEM*>( item );
|
|
||||||
generatorTool->UpdateHighlightedNets( m_pickerItem );
|
|
||||||
}
|
|
||||||
|
|
||||||
updateHoverStatus();
|
updateHoverStatus();
|
||||||
}
|
}
|
||||||
|
@ -2018,7 +2129,7 @@ int DRAWING_TOOL::PlaceTuningPattern( const TOOL_EVENT& aEvent )
|
||||||
{
|
{
|
||||||
// First click; create a tuning pattern
|
// First click; create a tuning pattern
|
||||||
|
|
||||||
generatorTool->HighlightNets( nullptr );
|
m_preview.FreeItems();
|
||||||
|
|
||||||
m_frame->SetActiveLayer( m_pickerItem->GetLayer() );
|
m_frame->SetActiveLayer( m_pickerItem->GetLayer() );
|
||||||
m_tuningPattern = PCB_TUNING_PATTERN::CreateNew( generatorTool, m_frame,
|
m_tuningPattern = PCB_TUNING_PATTERN::CreateNew( generatorTool, m_frame,
|
||||||
|
@ -2039,7 +2150,7 @@ int DRAWING_TOOL::PlaceTuningPattern( const TOOL_EVENT& aEvent )
|
||||||
m_tuningPattern->SetEnd( closestPt );
|
m_tuningPattern->SetEnd( closestPt );
|
||||||
}
|
}
|
||||||
|
|
||||||
m_preview.Add( m_tuningPattern );
|
m_preview.Add( m_tuningPattern->Clone() );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if( m_pickerItem && m_tuningPattern )
|
else if( m_pickerItem && m_tuningPattern )
|
||||||
|
@ -2107,12 +2218,7 @@ int DRAWING_TOOL::PlaceTuningPattern( const TOOL_EVENT& aEvent )
|
||||||
controls->ShowCursor( false );
|
controls->ShowCursor( false );
|
||||||
m_frame->GetCanvas()->SetCurrentCursor( KICURSOR::ARROW );
|
m_frame->GetCanvas()->SetCurrentCursor( KICURSOR::ARROW );
|
||||||
|
|
||||||
canvas()->SetStatusPopup( nullptr );
|
m_preview.FreeItems();
|
||||||
m_statusPopup->Hide();
|
|
||||||
|
|
||||||
generatorTool->HighlightNets( nullptr );
|
|
||||||
|
|
||||||
m_preview.Clear();
|
|
||||||
m_view->Remove( &m_preview );
|
m_view->Remove( &m_preview );
|
||||||
|
|
||||||
m_frame->GetCanvas()->Refresh();
|
m_frame->GetCanvas()->Refresh();
|
||||||
|
|
|
@ -71,6 +71,14 @@ bool PCB_GENERATOR::Update( GENERATOR_TOOL* aTool, BOARD* aBoard, PCB_BASE_EDIT_
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
std::vector<EDA_ITEM*> PCB_GENERATOR::GetPreviewItems( GENERATOR_TOOL* aTool,
|
||||||
|
PCB_BASE_EDIT_FRAME* aFrame,
|
||||||
|
bool aStatusOnly )
|
||||||
|
{
|
||||||
|
return std::vector<EDA_ITEM*>();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
bool PCB_GENERATOR::MakeEditPoints( std::shared_ptr<EDIT_POINTS> aEditPoints ) const
|
bool PCB_GENERATOR::MakeEditPoints( std::shared_ptr<EDIT_POINTS> aEditPoints ) const
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -63,6 +63,10 @@ public:
|
||||||
virtual bool Update( GENERATOR_TOOL* aTool, BOARD* aBoard, PCB_BASE_EDIT_FRAME* aFrame,
|
virtual bool Update( GENERATOR_TOOL* aTool, BOARD* aBoard, PCB_BASE_EDIT_FRAME* aFrame,
|
||||||
BOARD_COMMIT* aCommit );
|
BOARD_COMMIT* aCommit );
|
||||||
|
|
||||||
|
virtual std::vector<EDA_ITEM*> GetPreviewItems( GENERATOR_TOOL* aTool,
|
||||||
|
PCB_BASE_EDIT_FRAME* aFrame,
|
||||||
|
bool aStatusOnly = false );
|
||||||
|
|
||||||
virtual bool MakeEditPoints( std::shared_ptr<EDIT_POINTS> aEditPoints ) const;
|
virtual bool MakeEditPoints( std::shared_ptr<EDIT_POINTS> aEditPoints ) const;
|
||||||
|
|
||||||
virtual bool UpdateFromEditPoints( std::shared_ptr<EDIT_POINTS> aEditPoints,
|
virtual bool UpdateFromEditPoints( std::shared_ptr<EDIT_POINTS> aEditPoints,
|
||||||
|
@ -93,9 +97,6 @@ public:
|
||||||
|
|
||||||
virtual void ShowPropertiesDialog( PCB_BASE_EDIT_FRAME* aEditFrame ) {};
|
virtual void ShowPropertiesDialog( PCB_BASE_EDIT_FRAME* aEditFrame ) {};
|
||||||
|
|
||||||
virtual void UpdateStatus( GENERATOR_TOOL* aTool, PCB_BASE_EDIT_FRAME* aFrame,
|
|
||||||
STATUS_MIN_MAX_POPUP* aPopup ) {};
|
|
||||||
|
|
||||||
wxString GetItemDescription( UNITS_PROVIDER* aUnitsProvider ) const override;
|
wxString GetItemDescription( UNITS_PROVIDER* aUnitsProvider ) const override;
|
||||||
|
|
||||||
virtual wxString GetPluralName() const = 0;
|
virtual wxString GetPluralName() const = 0;
|
||||||
|
|
|
@ -464,6 +464,20 @@ const ITEM_SET DP_MEANDER_PLACER::Traces()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
const ITEM_SET DP_MEANDER_PLACER::TunedPath()
|
||||||
|
{
|
||||||
|
ITEM_SET lines;
|
||||||
|
|
||||||
|
for( ITEM* item : m_tunedPathN )
|
||||||
|
lines.Add( item );
|
||||||
|
|
||||||
|
for( ITEM* item : m_tunedPathP )
|
||||||
|
lines.Add( item );
|
||||||
|
|
||||||
|
return lines;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
const VECTOR2I& DP_MEANDER_PLACER::CurrentStart() const
|
const VECTOR2I& DP_MEANDER_PLACER::CurrentStart() const
|
||||||
{
|
{
|
||||||
return m_currentStart;
|
return m_currentStart;
|
||||||
|
|
|
@ -93,6 +93,8 @@ public:
|
||||||
|
|
||||||
const ITEM_SET Traces() override;
|
const ITEM_SET Traces() override;
|
||||||
|
|
||||||
|
const ITEM_SET TunedPath() override;
|
||||||
|
|
||||||
/// @copydoc PLACEMENT_ALGO::CurrentStart()
|
/// @copydoc PLACEMENT_ALGO::CurrentStart()
|
||||||
const VECTOR2I& CurrentStart() const override;
|
const VECTOR2I& CurrentStart() const override;
|
||||||
|
|
||||||
|
|
|
@ -278,6 +278,11 @@ const ITEM_SET MEANDER_PLACER::Traces()
|
||||||
return ITEM_SET( &m_currentTrace );
|
return ITEM_SET( &m_currentTrace );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const ITEM_SET MEANDER_PLACER::TunedPath()
|
||||||
|
{
|
||||||
|
return m_tunedPath;
|
||||||
|
}
|
||||||
|
|
||||||
const VECTOR2I& MEANDER_PLACER::CurrentStart() const
|
const VECTOR2I& MEANDER_PLACER::CurrentStart() const
|
||||||
{
|
{
|
||||||
return m_currentStart;
|
return m_currentStart;
|
||||||
|
|
|
@ -73,6 +73,9 @@ public:
|
||||||
/// @copydoc PLACEMENT_ALGO::Traces()
|
/// @copydoc PLACEMENT_ALGO::Traces()
|
||||||
const ITEM_SET Traces() override;
|
const ITEM_SET Traces() override;
|
||||||
|
|
||||||
|
/// @copydoc PNS_MEANDER_PLACER_BASE::TunedPath()
|
||||||
|
const ITEM_SET TunedPath() override;
|
||||||
|
|
||||||
/// @copydoc PLACEMENT_ALGO::CurrentStart()
|
/// @copydoc PLACEMENT_ALGO::CurrentStart()
|
||||||
const VECTOR2I& CurrentStart() const override;
|
const VECTOR2I& CurrentStart() const override;
|
||||||
|
|
||||||
|
|
|
@ -114,6 +114,8 @@ public:
|
||||||
|
|
||||||
int GetTotalPadToDieLength( const LINE& aLine ) const;
|
int GetTotalPadToDieLength( const LINE& aLine ) const;
|
||||||
|
|
||||||
|
virtual const ITEM_SET TunedPath() = 0;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
/**
|
/**
|
||||||
* Take a set of meanders in \a aTuned and tunes their length to extend the original line
|
* Take a set of meanders in \a aTuned and tunes their length to extend the original line
|
||||||
|
|
|
@ -38,11 +38,13 @@
|
||||||
using namespace KIGFX;
|
using namespace KIGFX;
|
||||||
|
|
||||||
|
|
||||||
ROUTER_PREVIEW_ITEM::ROUTER_PREVIEW_ITEM( const PNS::ITEM* aItem, KIGFX::VIEW* aView ) :
|
ROUTER_PREVIEW_ITEM::ROUTER_PREVIEW_ITEM( const PNS::ITEM* aItem, KIGFX::VIEW* aView,
|
||||||
|
bool aIsHoverItem ) :
|
||||||
EDA_ITEM( NOT_USED ),
|
EDA_ITEM( NOT_USED ),
|
||||||
m_view( aView ),
|
m_view( aView ),
|
||||||
m_shape( nullptr ),
|
m_shape( nullptr ),
|
||||||
m_hole( nullptr )
|
m_hole( nullptr ),
|
||||||
|
m_isHoverItem( aIsHoverItem )
|
||||||
{
|
{
|
||||||
BOARD_ITEM* boardItem = aItem ? aItem->BoardItem() : nullptr;
|
BOARD_ITEM* boardItem = aItem ? aItem->BoardItem() : nullptr;
|
||||||
|
|
||||||
|
@ -94,6 +96,7 @@ ROUTER_PREVIEW_ITEM::ROUTER_PREVIEW_ITEM( const SHAPE& aShape, KIGFX::VIEW* aVie
|
||||||
m_width = 0;
|
m_width = 0;
|
||||||
m_depth = 0;
|
m_depth = 0;
|
||||||
m_isHeadTrace = false;
|
m_isHeadTrace = false;
|
||||||
|
m_isHoverItem = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -175,6 +178,9 @@ void ROUTER_PREVIEW_ITEM::Update( const PNS::ITEM* aItem )
|
||||||
|
|
||||||
if( aItem->Marker() & PNS::MK_VIOLATION )
|
if( aItem->Marker() & PNS::MK_VIOLATION )
|
||||||
m_color = COLOR4D( 0, 1, 0, 1 );
|
m_color = COLOR4D( 0, 1, 0, 1 );
|
||||||
|
|
||||||
|
if( m_isHoverItem )
|
||||||
|
m_color = m_color.WithAlpha( 1.0 );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -501,34 +507,14 @@ const COLOR4D ROUTER_PREVIEW_ITEM::getLayerColor( int aLayer ) const
|
||||||
COLOR4D color = settings->GetLayerColor( aLayer );
|
COLOR4D color = settings->GetLayerColor( aLayer );
|
||||||
|
|
||||||
if( m_isHeadTrace )
|
if( m_isHeadTrace )
|
||||||
{
|
|
||||||
return color.Saturate( 1.0 );
|
return color.Saturate( 1.0 );
|
||||||
}
|
else if( m_isHoverItem )
|
||||||
|
return color.Brightened( 0.7 );
|
||||||
|
|
||||||
return color;
|
return color;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
const COLOR4D ROUTER_PREVIEW_ITEM::assignColor( int aStyle ) const
|
|
||||||
{
|
|
||||||
COLOR4D color;
|
|
||||||
|
|
||||||
switch( aStyle )
|
|
||||||
{
|
|
||||||
case 0: color = COLOR4D( 0, 1, 0, 1 ); break;
|
|
||||||
case 1: color = COLOR4D( 1, 0, 0, 1 ); break;
|
|
||||||
case 2: color = COLOR4D( 1, 1, 0, 1 ); break;
|
|
||||||
case 3: color = COLOR4D( 0, 0, 1, 1 ); break;
|
|
||||||
case 4: color = COLOR4D( 1, 1, 1, 1 ); break;
|
|
||||||
case 5: color = COLOR4D( 1, 1, 0, 1 ); break;
|
|
||||||
case 6: color = COLOR4D( 0, 1, 1, 1 ); break;
|
|
||||||
case 32: color = COLOR4D( 0, 0, 1, 1 ); break;
|
|
||||||
default: color = COLOR4D( 0.4, 0.4, 0.4, 1 ); break;
|
|
||||||
}
|
|
||||||
|
|
||||||
return color;
|
|
||||||
}
|
|
||||||
|
|
||||||
const int ROUTER_PREVIEW_ITEM::ClearanceOverlayDepth = -VIEW::VIEW_MAX_LAYERS - 10;
|
const int ROUTER_PREVIEW_ITEM::ClearanceOverlayDepth = -VIEW::VIEW_MAX_LAYERS - 10;
|
||||||
const int ROUTER_PREVIEW_ITEM::BaseOverlayDepth = -VIEW::VIEW_MAX_LAYERS - 20;
|
const int ROUTER_PREVIEW_ITEM::BaseOverlayDepth = -VIEW::VIEW_MAX_LAYERS - 20;
|
||||||
const int ROUTER_PREVIEW_ITEM::ViaOverlayDepth = -VIEW::VIEW_MAX_LAYERS - 50;
|
const int ROUTER_PREVIEW_ITEM::ViaOverlayDepth = -VIEW::VIEW_MAX_LAYERS - 50;
|
||||||
|
|
|
@ -62,40 +62,20 @@ public:
|
||||||
static const int PathOverlayDepth;
|
static const int PathOverlayDepth;
|
||||||
|
|
||||||
ROUTER_PREVIEW_ITEM( const SHAPE& aShape, KIGFX::VIEW* aView = nullptr);
|
ROUTER_PREVIEW_ITEM( const SHAPE& aShape, KIGFX::VIEW* aView = nullptr);
|
||||||
ROUTER_PREVIEW_ITEM( const PNS::ITEM* aItem = nullptr, KIGFX::VIEW* aView = nullptr);
|
ROUTER_PREVIEW_ITEM( const PNS::ITEM* aItem = nullptr, KIGFX::VIEW* aView = nullptr,
|
||||||
|
bool aIsHoverItem = false );
|
||||||
~ROUTER_PREVIEW_ITEM();
|
~ROUTER_PREVIEW_ITEM();
|
||||||
|
|
||||||
void Update( const PNS::ITEM* aItem );
|
void Update( const PNS::ITEM* aItem );
|
||||||
|
|
||||||
void SetColor( const KIGFX::COLOR4D& aColor )
|
void SetColor( const KIGFX::COLOR4D& aColor ) { m_color = aColor; }
|
||||||
{
|
void SetDepth( double aDepth ) { m_depth = aDepth; }
|
||||||
m_color = aColor;
|
void SetWidth( int aWidth ) { m_width = aWidth; }
|
||||||
}
|
|
||||||
|
|
||||||
void SetDepth( double aDepth )
|
void SetClearance( int aClearance ) { m_clearance = aClearance; }
|
||||||
{
|
void ShowClearance( bool aEnabled ) { m_showClearance = aEnabled; }
|
||||||
m_depth = aDepth;
|
|
||||||
}
|
|
||||||
|
|
||||||
void SetWidth( double aWidth )
|
void SetIsHeadTrace( bool aIsHead ) { m_isHeadTrace = aIsHead; }
|
||||||
{
|
|
||||||
m_width = aWidth;
|
|
||||||
}
|
|
||||||
|
|
||||||
void SetClearance( int aClearance )
|
|
||||||
{
|
|
||||||
m_clearance = aClearance;
|
|
||||||
}
|
|
||||||
|
|
||||||
void ShowClearance( bool aEnabled )
|
|
||||||
{
|
|
||||||
m_showClearance = aEnabled;
|
|
||||||
}
|
|
||||||
|
|
||||||
void SetIsHeadTrace( bool aIsHead )
|
|
||||||
{
|
|
||||||
m_isHeadTrace = aIsHead;
|
|
||||||
}
|
|
||||||
|
|
||||||
#if defined(DEBUG)
|
#if defined(DEBUG)
|
||||||
void Show( int aA, std::ostream& aB ) const override {}
|
void Show( int aA, std::ostream& aB ) const override {}
|
||||||
|
@ -124,7 +104,6 @@ public:
|
||||||
void drawShape( const SHAPE* aShape, KIGFX::GAL* aGal ) const;
|
void drawShape( const SHAPE* aShape, KIGFX::GAL* aGal ) const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
const KIGFX::COLOR4D assignColor( int aStyle ) const;
|
|
||||||
const KIGFX::COLOR4D getLayerColor( int aLayer ) const;
|
const KIGFX::COLOR4D getLayerColor( int aLayer ) const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -136,6 +115,7 @@ private:
|
||||||
ITEM_TYPE m_type;
|
ITEM_TYPE m_type;
|
||||||
|
|
||||||
bool m_isHeadTrace;
|
bool m_isHeadTrace;
|
||||||
|
bool m_isHoverItem;
|
||||||
int m_width;
|
int m_width;
|
||||||
int m_layer;
|
int m_layer;
|
||||||
int m_originLayer;
|
int m_originLayer;
|
||||||
|
|
|
@ -301,8 +301,6 @@ void DRAWING_TOOL::Reset( RESET_REASON aReason )
|
||||||
m_textAttrs.m_Halign = GR_TEXT_H_ALIGN_LEFT;
|
m_textAttrs.m_Halign = GR_TEXT_H_ALIGN_LEFT;
|
||||||
m_textAttrs.m_Valign = GR_TEXT_V_ALIGN_TOP;
|
m_textAttrs.m_Valign = GR_TEXT_V_ALIGN_TOP;
|
||||||
|
|
||||||
m_statusPopup = std::make_unique<STATUS_MIN_MAX_POPUP>( m_frame );
|
|
||||||
|
|
||||||
UpdateStatusBar();
|
UpdateStatusBar();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -358,9 +358,6 @@ private:
|
||||||
BOARD_CONNECTED_ITEM* m_pickerItem;
|
BOARD_CONNECTED_ITEM* m_pickerItem;
|
||||||
PCB_TUNING_PATTERN* m_tuningPattern;
|
PCB_TUNING_PATTERN* m_tuningPattern;
|
||||||
|
|
||||||
std::unique_ptr<STATUS_MIN_MAX_POPUP> m_statusPopup;
|
|
||||||
|
|
||||||
|
|
||||||
static const unsigned int WIDTH_STEP; // Amount of width change for one -/+ key press
|
static const unsigned int WIDTH_STEP; // Amount of width change for one -/+ key press
|
||||||
static const unsigned int COORDS_PADDING; // Padding from coordinates limits for this tool
|
static const unsigned int COORDS_PADDING; // Padding from coordinates limits for this tool
|
||||||
|
|
||||||
|
|
|
@ -259,44 +259,6 @@ int GENERATOR_TOOL::GenEditAction( const TOOL_EVENT& aEvent )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void GENERATOR_TOOL::HighlightNets( BOARD_CONNECTED_ITEM* aStartItem )
|
|
||||||
{
|
|
||||||
if( aStartItem && aStartItem->GetNet() )
|
|
||||||
{
|
|
||||||
PNS::RULE_RESOLVER* resolver = m_router->GetRuleResolver();
|
|
||||||
std::set<PNS::NET_HANDLE> nets = { aStartItem->GetNet() };
|
|
||||||
|
|
||||||
if( PNS::NET_HANDLE coupledNet = resolver->DpCoupledNet( aStartItem->GetNet() ) )
|
|
||||||
nets.insert( coupledNet );
|
|
||||||
|
|
||||||
highlightNets( true, nets );
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
highlightNets( false );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void GENERATOR_TOOL::UpdateHighlightedNets( BOARD_CONNECTED_ITEM* aStartItem )
|
|
||||||
{
|
|
||||||
if( aStartItem && aStartItem->GetNet() )
|
|
||||||
{
|
|
||||||
PNS::RULE_RESOLVER* resolver = m_router->GetRuleResolver();
|
|
||||||
std::set<PNS::NET_HANDLE> nets = { aStartItem->GetNet() };
|
|
||||||
|
|
||||||
if( PNS::NET_HANDLE coupledNet = resolver->DpCoupledNet( aStartItem->GetNet() ) )
|
|
||||||
nets.insert( coupledNet );
|
|
||||||
|
|
||||||
updateHighlightedNets( nets );
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
highlightNets( false );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void GENERATOR_TOOL::setTransitions()
|
void GENERATOR_TOOL::setTransitions()
|
||||||
{
|
{
|
||||||
// Generator actions
|
// Generator actions
|
||||||
|
|
|
@ -60,9 +60,6 @@ public:
|
||||||
int RegenerateItem( const TOOL_EVENT& aEvent );
|
int RegenerateItem( const TOOL_EVENT& aEvent );
|
||||||
int GenEditAction( const TOOL_EVENT& aEvent );
|
int GenEditAction( const TOOL_EVENT& aEvent );
|
||||||
|
|
||||||
void HighlightNets( BOARD_CONNECTED_ITEM* aStartItem );
|
|
||||||
void UpdateHighlightedNets( BOARD_CONNECTED_ITEM* aStartItem );
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
///< Set up handlers for various events.
|
///< Set up handlers for various events.
|
||||||
void setTransitions() override;
|
void setTransitions() override;
|
||||||
|
|
|
@ -124,8 +124,6 @@ void PCB_POINT_EDITOR::Reset( RESET_REASON aReason )
|
||||||
m_editPoints.reset();
|
m_editPoints.reset();
|
||||||
m_altConstraint.reset();
|
m_altConstraint.reset();
|
||||||
getViewControls()->SetAutoPan( false );
|
getViewControls()->SetAutoPan( false );
|
||||||
|
|
||||||
m_statusPopup = std::make_unique<STATUS_MIN_MAX_POPUP>( getEditFrame<PCB_BASE_EDIT_FRAME>() );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -492,6 +490,9 @@ int PCB_POINT_EDITOR::OnSelectionChange( const TOOL_EVENT& aEvent )
|
||||||
if( !m_editPoints )
|
if( !m_editPoints )
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
m_preview.FreeItems();
|
||||||
|
getView()->Add( &m_preview );
|
||||||
|
|
||||||
getView()->Add( m_editPoints.get() );
|
getView()->Add( m_editPoints.get() );
|
||||||
setEditedPoint( nullptr );
|
setEditedPoint( nullptr );
|
||||||
updateEditedPoint( aEvent );
|
updateEditedPoint( aEvent );
|
||||||
|
@ -582,11 +583,14 @@ int PCB_POINT_EDITOR::OnSelectionChange( const TOOL_EVENT& aEvent )
|
||||||
{
|
{
|
||||||
if( grid.GetUseGrid() )
|
if( grid.GetUseGrid() )
|
||||||
{
|
{
|
||||||
VECTOR2I gridPt = grid.BestSnapAnchor( pos, {}, grid.GetItemGrid( item ), { item } );
|
VECTOR2I gridPt = grid.BestSnapAnchor( pos, {}, grid.GetItemGrid( item ),
|
||||||
|
{ item } );
|
||||||
|
|
||||||
VECTOR2I last = m_editedPoint->GetPosition();
|
VECTOR2I last = m_editedPoint->GetPosition();
|
||||||
VECTOR2I delta = pos - last;
|
VECTOR2I delta = pos - last;
|
||||||
VECTOR2I deltaGrid = gridPt - grid.BestSnapAnchor( last, {}, grid.GetItemGrid( item ), { item } );
|
VECTOR2I deltaGrid = gridPt - grid.BestSnapAnchor( last, {},
|
||||||
|
grid.GetItemGrid( item ),
|
||||||
|
{ item } );
|
||||||
|
|
||||||
if( abs( delta.x ) > grid.GetGrid().x / 2 )
|
if( abs( delta.x ) > grid.GetGrid().x / 2 )
|
||||||
pos.x = last.x + deltaGrid.x;
|
pos.x = last.x + deltaGrid.x;
|
||||||
|
@ -613,9 +617,10 @@ int PCB_POINT_EDITOR::OnSelectionChange( const TOOL_EVENT& aEvent )
|
||||||
}
|
}
|
||||||
else if( m_editedPoint->GetGridConstraint() == SNAP_TO_GRID )
|
else if( m_editedPoint->GetGridConstraint() == SNAP_TO_GRID )
|
||||||
{
|
{
|
||||||
m_editedPoint->SetPosition(
|
m_editedPoint->SetPosition( grid.BestSnapAnchor( m_editedPoint->GetPosition(),
|
||||||
grid.BestSnapAnchor( m_editedPoint->GetPosition(), snapLayers,
|
snapLayers,
|
||||||
grid.GetItemGrid( item ), { item } ) );
|
grid.GetItemGrid( item ),
|
||||||
|
{ item } ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
updateItem( &commit );
|
updateItem( &commit );
|
||||||
|
@ -649,8 +654,7 @@ int PCB_POINT_EDITOR::OnSelectionChange( const TOOL_EVENT& aEvent )
|
||||||
|
|
||||||
if( item->Type() == PCB_GENERATOR_T )
|
if( item->Type() == PCB_GENERATOR_T )
|
||||||
{
|
{
|
||||||
m_statusPopup->Hide();
|
m_preview.FreeItems();
|
||||||
|
|
||||||
m_toolMgr->RunSynchronousAction( PCB_ACTIONS::genPushEdit, &commit,
|
m_toolMgr->RunSynchronousAction( PCB_ACTIONS::genPushEdit, &commit,
|
||||||
static_cast<PCB_GENERATOR*>( item ) );
|
static_cast<PCB_GENERATOR*>( item ) );
|
||||||
}
|
}
|
||||||
|
@ -696,6 +700,9 @@ int PCB_POINT_EDITOR::OnSelectionChange( const TOOL_EVENT& aEvent )
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
m_preview.FreeItems();
|
||||||
|
getView()->Remove( &m_preview );
|
||||||
|
|
||||||
if( m_editPoints )
|
if( m_editPoints )
|
||||||
{
|
{
|
||||||
getView()->Remove( m_editPoints.get() );
|
getView()->Remove( m_editPoints.get() );
|
||||||
|
@ -1499,9 +1506,14 @@ void PCB_POINT_EDITOR::updateItem( BOARD_COMMIT* aCommit )
|
||||||
generatorItem->UpdateFromEditPoints( m_editPoints, aCommit );
|
generatorItem->UpdateFromEditPoints( m_editPoints, aCommit );
|
||||||
m_toolMgr->RunSynchronousAction( PCB_ACTIONS::genUpdateEdit, aCommit, generatorItem );
|
m_toolMgr->RunSynchronousAction( PCB_ACTIONS::genUpdateEdit, aCommit, generatorItem );
|
||||||
|
|
||||||
m_statusPopup->Popup();
|
m_preview.FreeItems();
|
||||||
generatorItem->UpdateStatus( generatorTool, frame(), m_statusPopup.get() );
|
|
||||||
m_statusPopup->Move( KIPLATFORM::UI::GetMousePosition() + wxPoint( 20, 20 ) );
|
for( EDA_ITEM* previewItem : generatorItem->GetPreviewItems( generatorTool, frame(), true ) )
|
||||||
|
m_preview.Add( previewItem );
|
||||||
|
|
||||||
|
generatorTool->Router()->StopRouting();
|
||||||
|
|
||||||
|
getView()->Update( &m_preview );
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -184,7 +184,7 @@ private:
|
||||||
|
|
||||||
ARC_EDIT_MODE m_arcEditMode;
|
ARC_EDIT_MODE m_arcEditMode;
|
||||||
|
|
||||||
std::unique_ptr<STATUS_MIN_MAX_POPUP> m_statusPopup;
|
PCB_SELECTION m_preview;
|
||||||
|
|
||||||
// Alternative constraint, enabled while a modifier key is held
|
// Alternative constraint, enabled while a modifier key is held
|
||||||
std::shared_ptr<EDIT_CONSTRAINT<EDIT_POINT>> m_altConstraint;
|
std::shared_ptr<EDIT_CONSTRAINT<EDIT_POINT>> m_altConstraint;
|
||||||
|
|
Loading…
Reference in New Issue