Make SYMBOL_PREVIEW_WIDGET working, and using the canvas type of the caller. Fix an issue with F3 zoom key in libedit.
This commit is contained in:
parent
6f89b41f18
commit
88cdce8d62
|
@ -655,29 +655,6 @@ void OPENGL_GAL::DrawArc( const VECTOR2D& aCenterPoint, double aRadius, double a
|
|||
Save();
|
||||
currentManager->Translate( aCenterPoint.x, aCenterPoint.y, 0.0 );
|
||||
|
||||
if( isStrokeEnabled )
|
||||
{
|
||||
currentManager->Color( strokeColor.r, strokeColor.g, strokeColor.b, strokeColor.a );
|
||||
|
||||
VECTOR2D p( cos( aStartAngle ) * aRadius, sin( aStartAngle ) * aRadius );
|
||||
double alpha;
|
||||
|
||||
for( alpha = aStartAngle + alphaIncrement; alpha <= aEndAngle; alpha += alphaIncrement )
|
||||
{
|
||||
VECTOR2D p_next( cos( alpha ) * aRadius, sin( alpha ) * aRadius );
|
||||
DrawLine( p, p_next );
|
||||
|
||||
p = p_next;
|
||||
}
|
||||
|
||||
// Draw the last missing part
|
||||
if( alpha != aEndAngle )
|
||||
{
|
||||
VECTOR2D p_last( cos( aEndAngle ) * aRadius, sin( aEndAngle ) * aRadius );
|
||||
DrawLine( p, p_last );
|
||||
}
|
||||
}
|
||||
|
||||
if( isFillEnabled )
|
||||
{
|
||||
double alpha;
|
||||
|
@ -703,6 +680,29 @@ void OPENGL_GAL::DrawArc( const VECTOR2D& aCenterPoint, double aRadius, double a
|
|||
currentManager->Vertex( endPoint.x, endPoint.y, 0.0 );
|
||||
}
|
||||
|
||||
if( isStrokeEnabled )
|
||||
{
|
||||
currentManager->Color( strokeColor.r, strokeColor.g, strokeColor.b, strokeColor.a );
|
||||
|
||||
VECTOR2D p( cos( aStartAngle ) * aRadius, sin( aStartAngle ) * aRadius );
|
||||
double alpha;
|
||||
|
||||
for( alpha = aStartAngle + alphaIncrement; alpha <= aEndAngle; alpha += alphaIncrement )
|
||||
{
|
||||
VECTOR2D p_next( cos( alpha ) * aRadius, sin( alpha ) * aRadius );
|
||||
DrawLine( p, p_next );
|
||||
|
||||
p = p_next;
|
||||
}
|
||||
|
||||
// Draw the last missing part
|
||||
if( alpha != aEndAngle )
|
||||
{
|
||||
VECTOR2D p_last( cos( aEndAngle ) * aRadius, sin( aEndAngle ) * aRadius );
|
||||
DrawLine( p, p_last );
|
||||
}
|
||||
}
|
||||
|
||||
Restore();
|
||||
}
|
||||
|
||||
|
|
|
@ -1468,14 +1468,11 @@ void EDA_DRAW_FRAME::SetNextZoomAndRedraw( const wxPoint& aCenterPoint, bool aWa
|
|||
if( idx >= (int)zoomList.size() )
|
||||
return;
|
||||
|
||||
VECTOR2D cpos = GetGalCanvas()->GetViewControls()->GetCursorPosition();
|
||||
wxPoint center( (int)cpos.x, (int)cpos.y );
|
||||
|
||||
if( m_zoomSelectBox )
|
||||
m_zoomSelectBox->SetSelection( idx );
|
||||
|
||||
if( GetScreen()->SetZoom( GetScreen()->m_ZoomList[idx] ) )
|
||||
RedrawScreen( aCenterPoint, true );
|
||||
RedrawScreen( aCenterPoint, aWarpPointer );
|
||||
}
|
||||
|
||||
|
||||
|
@ -1497,9 +1494,6 @@ void EDA_DRAW_FRAME::SetPreviousZoomAndRedraw( const wxPoint& aCenterPoint, bool
|
|||
if( idx < 0 )
|
||||
return;
|
||||
|
||||
VECTOR2D cpos = GetGalCanvas()->GetViewControls()->GetCursorPosition();
|
||||
wxPoint center( (int)cpos.x, (int)cpos.y );
|
||||
|
||||
if( m_zoomSelectBox )
|
||||
m_zoomSelectBox->SetSelection( idx );
|
||||
|
||||
|
|
|
@ -207,7 +207,8 @@ wxPanel* DIALOG_CHOOSE_COMPONENT::ConstructRightPanel( wxWindow* aParent )
|
|||
auto panel = new wxPanel( aParent );
|
||||
auto sizer = new wxBoxSizer( wxVERTICAL );
|
||||
|
||||
m_symbol_preview = new SYMBOL_PREVIEW_WIDGET( panel, Kiway() );
|
||||
m_symbol_preview = new SYMBOL_PREVIEW_WIDGET( panel, Kiway(),
|
||||
m_parent->GetGalCanvas()->GetBackend() );
|
||||
m_symbol_preview->SetLayoutDirection( wxLayout_LeftToRight );
|
||||
|
||||
if( m_show_footprints )
|
||||
|
|
|
@ -52,6 +52,8 @@ public:
|
|||
|
||||
private:
|
||||
SCH_EDIT_FRAME* m_Parent;
|
||||
SYMBOL_PREVIEW_WIDGET* m_previewNewWidget;
|
||||
SYMBOL_PREVIEW_WIDGET* m_previewOldWidget;
|
||||
wxConfigBase* m_Config;
|
||||
RESCUER* m_Rescuer;
|
||||
bool m_AskShowAgain;
|
||||
|
@ -63,6 +65,10 @@ private:
|
|||
void OnConflictSelect( wxDataViewEvent& aEvent ) override;
|
||||
void OnNeverShowClick( wxCommandEvent& aEvent ) override;
|
||||
void OnCancelClick( wxCommandEvent& aEvent ) override;
|
||||
|
||||
// Display the 2 items (old in cache and new in library) corresponding to the
|
||||
// selected conflict in m_ListOfConflicts
|
||||
void displayItemsInConflict();
|
||||
};
|
||||
|
||||
|
||||
|
@ -73,6 +79,12 @@ DIALOG_RESCUE_EACH::DIALOG_RESCUE_EACH( SCH_EDIT_FRAME* aParent, RESCUER& aRescu
|
|||
m_Rescuer( &aRescuer ),
|
||||
m_AskShowAgain( aAskShowAgain )
|
||||
{
|
||||
m_previewOldWidget = new SYMBOL_PREVIEW_WIDGET( m_previewOldPanel, Kiway(), m_Parent->GetGalCanvas()->GetBackend() );
|
||||
m_SizerOldPanel->Add( m_previewOldWidget, 1, wxEXPAND | wxALL, 5 );
|
||||
|
||||
m_previewNewWidget = new SYMBOL_PREVIEW_WIDGET( m_previewNewPanel, Kiway(), m_Parent->GetGalCanvas()->GetBackend() );
|
||||
m_SizerNewPanel->Add( m_previewNewWidget, 1, wxEXPAND | wxALL, 5 );
|
||||
|
||||
m_Config = Kiface().KifaceSettings();
|
||||
m_stdButtonsOK->SetDefault();
|
||||
|
||||
|
@ -172,6 +184,8 @@ void DIALOG_RESCUE_EACH::PopulateConflictList()
|
|||
{
|
||||
// Select the first choice
|
||||
m_ListOfConflicts->SelectRow( 0 );
|
||||
// Ensure this choice is displayed:
|
||||
displayItemsInConflict();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -209,16 +223,8 @@ void DIALOG_RESCUE_EACH::PopulateInstanceList()
|
|||
}
|
||||
|
||||
|
||||
void DIALOG_RESCUE_EACH::OnConflictSelect( wxDataViewEvent& aEvent )
|
||||
void DIALOG_RESCUE_EACH::displayItemsInConflict()
|
||||
{
|
||||
// wxformbuilder connects this event to the _dialog_, not the data view.
|
||||
// Make sure the correct item triggered it, otherwise we trigger recursively
|
||||
// and get a stack overflow.
|
||||
if( aEvent.GetEventObject() != m_ListOfConflicts )
|
||||
return;
|
||||
|
||||
PopulateInstanceList();
|
||||
|
||||
int row = m_ListOfConflicts->GetSelectedRow();
|
||||
|
||||
if( row < 0 )
|
||||
|
@ -235,6 +241,19 @@ void DIALOG_RESCUE_EACH::OnConflictSelect( wxDataViewEvent& aEvent )
|
|||
}
|
||||
|
||||
|
||||
void DIALOG_RESCUE_EACH::OnConflictSelect( wxDataViewEvent& aEvent )
|
||||
{
|
||||
// wxformbuilder connects this event to the _dialog_, not the data view.
|
||||
// Make sure the correct item triggered it, otherwise we trigger recursively
|
||||
// and get a stack overflow.
|
||||
if( aEvent.GetEventObject() != m_ListOfConflicts )
|
||||
return;
|
||||
|
||||
PopulateInstanceList();
|
||||
displayItemsInConflict();
|
||||
}
|
||||
|
||||
|
||||
bool DIALOG_RESCUE_EACH::TransferDataFromWindow()
|
||||
{
|
||||
if( !wxDialog::TransferDataFromWindow() )
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
///////////////////////////////////////////////////////////////////////////
|
||||
// C++ code generated with wxFormBuilder (version Dec 30 2017)
|
||||
// C++ code generated with wxFormBuilder (version Jul 11 2018)
|
||||
// http://www.wxformbuilder.org/
|
||||
//
|
||||
// PLEASE DO *NOT* EDIT THIS FILE!
|
||||
|
@ -53,16 +53,12 @@ DIALOG_RESCUE_EACH_BASE::DIALOG_RESCUE_EACH_BASE( wxWindow* parent, wxWindowID i
|
|||
bSizerLeftPreview->Add( m_previewOldLabel, 0, 0, 5 );
|
||||
|
||||
m_previewOldPanel = new wxPanel( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL );
|
||||
wxBoxSizer* bSizerOldPanel;
|
||||
bSizerOldPanel = new wxBoxSizer( wxVERTICAL );
|
||||
|
||||
m_previewOldWidget = new SYMBOL_PREVIEW_WIDGET( m_previewOldPanel, Kiway() );
|
||||
bSizerOldPanel->Add( m_previewOldWidget, 1, wxEXPAND, 5 );
|
||||
m_SizerOldPanel = new wxBoxSizer( wxVERTICAL );
|
||||
|
||||
|
||||
m_previewOldPanel->SetSizer( bSizerOldPanel );
|
||||
m_previewOldPanel->SetSizer( m_SizerOldPanel );
|
||||
m_previewOldPanel->Layout();
|
||||
bSizerOldPanel->Fit( m_previewOldPanel );
|
||||
m_SizerOldPanel->Fit( m_previewOldPanel );
|
||||
bSizerLeftPreview->Add( m_previewOldPanel, 1, wxEXPAND | wxALL, 5 );
|
||||
|
||||
|
||||
|
@ -78,16 +74,12 @@ DIALOG_RESCUE_EACH_BASE::DIALOG_RESCUE_EACH_BASE( wxWindow* parent, wxWindowID i
|
|||
bSizerRightPreview->Add( m_previewNewLabel, 0, 0, 5 );
|
||||
|
||||
m_previewNewPanel = new wxPanel( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL );
|
||||
wxBoxSizer* bSizerNewPanel;
|
||||
bSizerNewPanel = new wxBoxSizer( wxVERTICAL );
|
||||
|
||||
m_previewNewWidget = new SYMBOL_PREVIEW_WIDGET( m_previewNewPanel, Kiway() );
|
||||
bSizerNewPanel->Add( m_previewNewWidget, 1, wxEXPAND, 5 );
|
||||
m_SizerNewPanel = new wxBoxSizer( wxVERTICAL );
|
||||
|
||||
|
||||
m_previewNewPanel->SetSizer( bSizerNewPanel );
|
||||
m_previewNewPanel->SetSizer( m_SizerNewPanel );
|
||||
m_previewNewPanel->Layout();
|
||||
bSizerNewPanel->Fit( m_previewNewPanel );
|
||||
m_SizerNewPanel->Fit( m_previewNewPanel );
|
||||
bSizerRightPreview->Add( m_previewNewPanel, 1, wxEXPAND | wxALL, 5 );
|
||||
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
|
||||
<wxFormBuilder_Project>
|
||||
<FileVersion major="1" minor="13" />
|
||||
<FileVersion major="1" minor="14" />
|
||||
<object class="Project" expanded="1">
|
||||
<property name="class_decoration"></property>
|
||||
<property name="code_generation">C++</property>
|
||||
|
@ -14,6 +14,7 @@
|
|||
<property name="file">dialog_rescue_each_base</property>
|
||||
<property name="first_id">1000</property>
|
||||
<property name="help_provider">none</property>
|
||||
<property name="indent_with_spaces"></property>
|
||||
<property name="internationalize">1</property>
|
||||
<property name="name">dialog_rescue_each_base</property>
|
||||
<property name="namespace"></property>
|
||||
|
@ -54,13 +55,20 @@
|
|||
<property name="window_style"></property>
|
||||
<event name="OnActivate"></event>
|
||||
<event name="OnActivateApp"></event>
|
||||
<event name="OnAuiFindManager"></event>
|
||||
<event name="OnAuiPaneActivated"></event>
|
||||
<event name="OnAuiPaneButton"></event>
|
||||
<event name="OnAuiPaneClose"></event>
|
||||
<event name="OnAuiPaneMaximize"></event>
|
||||
<event name="OnAuiPaneRestore"></event>
|
||||
<event name="OnAuiRender"></event>
|
||||
<event name="OnAux1DClick"></event>
|
||||
<event name="OnAux1Down"></event>
|
||||
<event name="OnAux1Up"></event>
|
||||
<event name="OnAux2DClick"></event>
|
||||
<event name="OnAux2Down"></event>
|
||||
<event name="OnAux2Up"></event>
|
||||
<event name="OnChar"></event>
|
||||
<event name="OnCharHook"></event>
|
||||
<event name="OnClose"></event>
|
||||
<event name="OnEnterWindow"></event>
|
||||
<event name="OnEraseBackground"></event>
|
||||
|
@ -75,17 +83,23 @@
|
|||
<event name="OnLeftDClick"></event>
|
||||
<event name="OnLeftDown"></event>
|
||||
<event name="OnLeftUp"></event>
|
||||
<event name="OnMaximize"></event>
|
||||
<event name="OnMiddleDClick"></event>
|
||||
<event name="OnMiddleDown"></event>
|
||||
<event name="OnMiddleUp"></event>
|
||||
<event name="OnMotion"></event>
|
||||
<event name="OnMouseEvents"></event>
|
||||
<event name="OnMouseWheel"></event>
|
||||
<event name="OnMove"></event>
|
||||
<event name="OnMoveEnd"></event>
|
||||
<event name="OnMoveStart"></event>
|
||||
<event name="OnMoving"></event>
|
||||
<event name="OnPaint"></event>
|
||||
<event name="OnRightDClick"></event>
|
||||
<event name="OnRightDown"></event>
|
||||
<event name="OnRightUp"></event>
|
||||
<event name="OnSetFocus"></event>
|
||||
<event name="OnShow"></event>
|
||||
<event name="OnSize">OnDialogResize</event>
|
||||
<event name="OnUpdateUI"></event>
|
||||
<object class="wxBoxSizer" expanded="1">
|
||||
|
@ -130,7 +144,7 @@
|
|||
<property name="maximum_size"></property>
|
||||
<property name="min_size"></property>
|
||||
<property name="minimize_button">0</property>
|
||||
<property name="minimum_size">-1,50</property>
|
||||
<property name="minimum_size">-1,80</property>
|
||||
<property name="moveable">1</property>
|
||||
<property name="name">m_htmlPrompt</property>
|
||||
<property name="pane_border">1</property>
|
||||
|
@ -149,7 +163,14 @@
|
|||
<property name="window_extra_style"></property>
|
||||
<property name="window_name"></property>
|
||||
<property name="window_style"></property>
|
||||
<event name="OnAux1DClick"></event>
|
||||
<event name="OnAux1Down"></event>
|
||||
<event name="OnAux1Up"></event>
|
||||
<event name="OnAux2DClick"></event>
|
||||
<event name="OnAux2Down"></event>
|
||||
<event name="OnAux2Up"></event>
|
||||
<event name="OnChar"></event>
|
||||
<event name="OnCharHook"></event>
|
||||
<event name="OnEnterWindow"></event>
|
||||
<event name="OnEraseBackground"></event>
|
||||
<event name="OnHtmlCellClicked"></event>
|
||||
|
@ -210,6 +231,7 @@
|
|||
<property name="hidden">0</property>
|
||||
<property name="id">wxID_ANY</property>
|
||||
<property name="label">Symbols to update:</property>
|
||||
<property name="markup">0</property>
|
||||
<property name="max_size"></property>
|
||||
<property name="maximize_button">0</property>
|
||||
<property name="maximum_size"></property>
|
||||
|
@ -235,7 +257,14 @@
|
|||
<property name="window_name"></property>
|
||||
<property name="window_style"></property>
|
||||
<property name="wrap">-1</property>
|
||||
<event name="OnAux1DClick"></event>
|
||||
<event name="OnAux1Down"></event>
|
||||
<event name="OnAux1Up"></event>
|
||||
<event name="OnAux2DClick"></event>
|
||||
<event name="OnAux2Down"></event>
|
||||
<event name="OnAux2Up"></event>
|
||||
<event name="OnChar"></event>
|
||||
<event name="OnCharHook"></event>
|
||||
<event name="OnEnterWindow"></event>
|
||||
<event name="OnEraseBackground"></event>
|
||||
<event name="OnKeyDown"></event>
|
||||
|
@ -285,7 +314,14 @@
|
|||
<property name="window_extra_style"></property>
|
||||
<property name="window_name"></property>
|
||||
<property name="window_style"></property>
|
||||
<event name="OnAux1DClick"></event>
|
||||
<event name="OnAux1Down"></event>
|
||||
<event name="OnAux1Up"></event>
|
||||
<event name="OnAux2DClick"></event>
|
||||
<event name="OnAux2Down"></event>
|
||||
<event name="OnAux2Up"></event>
|
||||
<event name="OnChar"></event>
|
||||
<event name="OnCharHook"></event>
|
||||
<event name="OnDataViewListCtrlColumnHeaderClick"></event>
|
||||
<event name="OnDataViewListCtrlColumnHeaderRightClick"></event>
|
||||
<event name="OnDataViewListCtrlColumnReordered"></event>
|
||||
|
@ -361,6 +397,7 @@
|
|||
<property name="hidden">0</property>
|
||||
<property name="id">wxID_ANY</property>
|
||||
<property name="label">Instances of this symbol:</property>
|
||||
<property name="markup">0</property>
|
||||
<property name="max_size"></property>
|
||||
<property name="maximize_button">0</property>
|
||||
<property name="maximum_size"></property>
|
||||
|
@ -386,7 +423,14 @@
|
|||
<property name="window_name"></property>
|
||||
<property name="window_style"></property>
|
||||
<property name="wrap">-1</property>
|
||||
<event name="OnAux1DClick"></event>
|
||||
<event name="OnAux1Down"></event>
|
||||
<event name="OnAux1Up"></event>
|
||||
<event name="OnAux2DClick"></event>
|
||||
<event name="OnAux2Down"></event>
|
||||
<event name="OnAux2Up"></event>
|
||||
<event name="OnChar"></event>
|
||||
<event name="OnCharHook"></event>
|
||||
<event name="OnEnterWindow"></event>
|
||||
<event name="OnEraseBackground"></event>
|
||||
<event name="OnKeyDown"></event>
|
||||
|
@ -436,7 +480,14 @@
|
|||
<property name="window_extra_style"></property>
|
||||
<property name="window_name"></property>
|
||||
<property name="window_style"></property>
|
||||
<event name="OnAux1DClick"></event>
|
||||
<event name="OnAux1Down"></event>
|
||||
<event name="OnAux1Up"></event>
|
||||
<event name="OnAux2DClick"></event>
|
||||
<event name="OnAux2Down"></event>
|
||||
<event name="OnAux2Up"></event>
|
||||
<event name="OnChar"></event>
|
||||
<event name="OnCharHook"></event>
|
||||
<event name="OnDataViewListCtrlColumnHeaderClick"></event>
|
||||
<event name="OnDataViewListCtrlColumnHeaderRightClick"></event>
|
||||
<event name="OnDataViewListCtrlColumnReordered"></event>
|
||||
|
@ -530,6 +581,7 @@
|
|||
<property name="hidden">0</property>
|
||||
<property name="id">wxID_ANY</property>
|
||||
<property name="label">Cached Symbol:</property>
|
||||
<property name="markup">0</property>
|
||||
<property name="max_size"></property>
|
||||
<property name="maximize_button">0</property>
|
||||
<property name="maximum_size"></property>
|
||||
|
@ -555,7 +607,14 @@
|
|||
<property name="window_name"></property>
|
||||
<property name="window_style"></property>
|
||||
<property name="wrap">-1</property>
|
||||
<event name="OnAux1DClick"></event>
|
||||
<event name="OnAux1Down"></event>
|
||||
<event name="OnAux1Up"></event>
|
||||
<event name="OnAux2DClick"></event>
|
||||
<event name="OnAux2Down"></event>
|
||||
<event name="OnAux2Up"></event>
|
||||
<event name="OnChar"></event>
|
||||
<event name="OnCharHook"></event>
|
||||
<event name="OnEnterWindow"></event>
|
||||
<event name="OnEraseBackground"></event>
|
||||
<event name="OnKeyDown"></event>
|
||||
|
@ -635,7 +694,14 @@
|
|||
<property name="window_extra_style"></property>
|
||||
<property name="window_name"></property>
|
||||
<property name="window_style">wxTAB_TRAVERSAL</property>
|
||||
<event name="OnAux1DClick"></event>
|
||||
<event name="OnAux1Down"></event>
|
||||
<event name="OnAux1Up"></event>
|
||||
<event name="OnAux2DClick"></event>
|
||||
<event name="OnAux2Down"></event>
|
||||
<event name="OnAux2Up"></event>
|
||||
<event name="OnChar"></event>
|
||||
<event name="OnCharHook"></event>
|
||||
<event name="OnEnterWindow"></event>
|
||||
<event name="OnEraseBackground"></event>
|
||||
<event name="OnKeyDown"></event>
|
||||
|
@ -660,94 +726,9 @@
|
|||
<event name="OnUpdateUI"></event>
|
||||
<object class="wxBoxSizer" expanded="1">
|
||||
<property name="minimum_size"></property>
|
||||
<property name="name">bSizerOldPanel</property>
|
||||
<property name="name">m_SizerOldPanel</property>
|
||||
<property name="orient">wxVERTICAL</property>
|
||||
<property name="permission">none</property>
|
||||
<object class="sizeritem" expanded="1">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxEXPAND</property>
|
||||
<property name="proportion">1</property>
|
||||
<object class="CustomControl" expanded="1">
|
||||
<property name="BottomDockable">1</property>
|
||||
<property name="LeftDockable">1</property>
|
||||
<property name="RightDockable">1</property>
|
||||
<property name="TopDockable">1</property>
|
||||
<property name="aui_layer"></property>
|
||||
<property name="aui_name"></property>
|
||||
<property name="aui_position"></property>
|
||||
<property name="aui_row"></property>
|
||||
<property name="best_size"></property>
|
||||
<property name="bg"></property>
|
||||
<property name="caption"></property>
|
||||
<property name="caption_visible">1</property>
|
||||
<property name="center_pane">0</property>
|
||||
<property name="class">SYMBOL_PREVIEW_WIDGET</property>
|
||||
<property name="close_button">1</property>
|
||||
<property name="construction">m_previewOldWidget = new SYMBOL_PREVIEW_WIDGET( m_previewOldPanel, Kiway() );</property>
|
||||
<property name="context_help"></property>
|
||||
<property name="context_menu">1</property>
|
||||
<property name="declaration"></property>
|
||||
<property name="default_pane">0</property>
|
||||
<property name="dock">Dock</property>
|
||||
<property name="dock_fixed">0</property>
|
||||
<property name="docking">Left</property>
|
||||
<property name="enabled">1</property>
|
||||
<property name="fg"></property>
|
||||
<property name="floatable">1</property>
|
||||
<property name="font"></property>
|
||||
<property name="gripper">0</property>
|
||||
<property name="hidden">0</property>
|
||||
<property name="id">wxID_ANY</property>
|
||||
<property name="include">#include <symbol_preview_widget.h></property>
|
||||
<property name="max_size"></property>
|
||||
<property name="maximize_button">0</property>
|
||||
<property name="maximum_size"></property>
|
||||
<property name="min_size"></property>
|
||||
<property name="minimize_button">0</property>
|
||||
<property name="minimum_size"></property>
|
||||
<property name="moveable">1</property>
|
||||
<property name="name">m_previewOldWidget</property>
|
||||
<property name="pane_border">1</property>
|
||||
<property name="pane_position"></property>
|
||||
<property name="pane_size"></property>
|
||||
<property name="permission">protected</property>
|
||||
<property name="pin_button">1</property>
|
||||
<property name="pos"></property>
|
||||
<property name="resize">Resizable</property>
|
||||
<property name="settings"></property>
|
||||
<property name="show">1</property>
|
||||
<property name="size"></property>
|
||||
<property name="subclass">; forward_declare</property>
|
||||
<property name="toolbar_pane">0</property>
|
||||
<property name="tooltip"></property>
|
||||
<property name="window_extra_style"></property>
|
||||
<property name="window_name"></property>
|
||||
<property name="window_style"></property>
|
||||
<event name="OnChar"></event>
|
||||
<event name="OnEnterWindow"></event>
|
||||
<event name="OnEraseBackground"></event>
|
||||
<event name="OnKeyDown"></event>
|
||||
<event name="OnKeyUp"></event>
|
||||
<event name="OnKillFocus"></event>
|
||||
<event name="OnLeaveWindow"></event>
|
||||
<event name="OnLeftDClick"></event>
|
||||
<event name="OnLeftDown"></event>
|
||||
<event name="OnLeftUp"></event>
|
||||
<event name="OnMiddleDClick"></event>
|
||||
<event name="OnMiddleDown"></event>
|
||||
<event name="OnMiddleUp"></event>
|
||||
<event name="OnMotion"></event>
|
||||
<event name="OnMouseEvents"></event>
|
||||
<event name="OnMouseWheel"></event>
|
||||
<event name="OnPaint"></event>
|
||||
<event name="OnRightDClick"></event>
|
||||
<event name="OnRightDown"></event>
|
||||
<event name="OnRightUp"></event>
|
||||
<event name="OnSetFocus"></event>
|
||||
<event name="OnSize"></event>
|
||||
<event name="OnUpdateUI"></event>
|
||||
</object>
|
||||
</object>
|
||||
<property name="permission">protected</property>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
|
@ -795,6 +776,7 @@
|
|||
<property name="hidden">0</property>
|
||||
<property name="id">wxID_ANY</property>
|
||||
<property name="label">Library Symbol:</property>
|
||||
<property name="markup">0</property>
|
||||
<property name="max_size"></property>
|
||||
<property name="maximize_button">0</property>
|
||||
<property name="maximum_size"></property>
|
||||
|
@ -820,7 +802,14 @@
|
|||
<property name="window_name"></property>
|
||||
<property name="window_style"></property>
|
||||
<property name="wrap">-1</property>
|
||||
<event name="OnAux1DClick"></event>
|
||||
<event name="OnAux1Down"></event>
|
||||
<event name="OnAux1Up"></event>
|
||||
<event name="OnAux2DClick"></event>
|
||||
<event name="OnAux2Down"></event>
|
||||
<event name="OnAux2Up"></event>
|
||||
<event name="OnChar"></event>
|
||||
<event name="OnCharHook"></event>
|
||||
<event name="OnEnterWindow"></event>
|
||||
<event name="OnEraseBackground"></event>
|
||||
<event name="OnKeyDown"></event>
|
||||
|
@ -900,7 +889,14 @@
|
|||
<property name="window_extra_style"></property>
|
||||
<property name="window_name"></property>
|
||||
<property name="window_style">wxTAB_TRAVERSAL</property>
|
||||
<event name="OnAux1DClick"></event>
|
||||
<event name="OnAux1Down"></event>
|
||||
<event name="OnAux1Up"></event>
|
||||
<event name="OnAux2DClick"></event>
|
||||
<event name="OnAux2Down"></event>
|
||||
<event name="OnAux2Up"></event>
|
||||
<event name="OnChar"></event>
|
||||
<event name="OnCharHook"></event>
|
||||
<event name="OnEnterWindow"></event>
|
||||
<event name="OnEraseBackground"></event>
|
||||
<event name="OnKeyDown"></event>
|
||||
|
@ -925,94 +921,9 @@
|
|||
<event name="OnUpdateUI"></event>
|
||||
<object class="wxBoxSizer" expanded="1">
|
||||
<property name="minimum_size"></property>
|
||||
<property name="name">bSizerNewPanel</property>
|
||||
<property name="name">m_SizerNewPanel</property>
|
||||
<property name="orient">wxVERTICAL</property>
|
||||
<property name="permission">none</property>
|
||||
<object class="sizeritem" expanded="1">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxEXPAND</property>
|
||||
<property name="proportion">1</property>
|
||||
<object class="CustomControl" expanded="1">
|
||||
<property name="BottomDockable">1</property>
|
||||
<property name="LeftDockable">1</property>
|
||||
<property name="RightDockable">1</property>
|
||||
<property name="TopDockable">1</property>
|
||||
<property name="aui_layer"></property>
|
||||
<property name="aui_name"></property>
|
||||
<property name="aui_position"></property>
|
||||
<property name="aui_row"></property>
|
||||
<property name="best_size"></property>
|
||||
<property name="bg"></property>
|
||||
<property name="caption"></property>
|
||||
<property name="caption_visible">1</property>
|
||||
<property name="center_pane">0</property>
|
||||
<property name="class">SYMBOL_PREVIEW_WIDGET</property>
|
||||
<property name="close_button">1</property>
|
||||
<property name="construction">m_previewNewWidget = new SYMBOL_PREVIEW_WIDGET( m_previewNewPanel, Kiway() );</property>
|
||||
<property name="context_help"></property>
|
||||
<property name="context_menu">1</property>
|
||||
<property name="declaration"></property>
|
||||
<property name="default_pane">0</property>
|
||||
<property name="dock">Dock</property>
|
||||
<property name="dock_fixed">0</property>
|
||||
<property name="docking">Left</property>
|
||||
<property name="enabled">1</property>
|
||||
<property name="fg"></property>
|
||||
<property name="floatable">1</property>
|
||||
<property name="font"></property>
|
||||
<property name="gripper">0</property>
|
||||
<property name="hidden">0</property>
|
||||
<property name="id">wxID_ANY</property>
|
||||
<property name="include">#include <symbol_preview_widget.h></property>
|
||||
<property name="max_size"></property>
|
||||
<property name="maximize_button">0</property>
|
||||
<property name="maximum_size"></property>
|
||||
<property name="min_size"></property>
|
||||
<property name="minimize_button">0</property>
|
||||
<property name="minimum_size"></property>
|
||||
<property name="moveable">1</property>
|
||||
<property name="name">m_previewNewWidget</property>
|
||||
<property name="pane_border">1</property>
|
||||
<property name="pane_position"></property>
|
||||
<property name="pane_size"></property>
|
||||
<property name="permission">protected</property>
|
||||
<property name="pin_button">1</property>
|
||||
<property name="pos"></property>
|
||||
<property name="resize">Resizable</property>
|
||||
<property name="settings"></property>
|
||||
<property name="show">1</property>
|
||||
<property name="size"></property>
|
||||
<property name="subclass">; forward_declare</property>
|
||||
<property name="toolbar_pane">0</property>
|
||||
<property name="tooltip"></property>
|
||||
<property name="window_extra_style"></property>
|
||||
<property name="window_name"></property>
|
||||
<property name="window_style"></property>
|
||||
<event name="OnChar"></event>
|
||||
<event name="OnEnterWindow"></event>
|
||||
<event name="OnEraseBackground"></event>
|
||||
<event name="OnKeyDown"></event>
|
||||
<event name="OnKeyUp"></event>
|
||||
<event name="OnKillFocus"></event>
|
||||
<event name="OnLeaveWindow"></event>
|
||||
<event name="OnLeftDClick"></event>
|
||||
<event name="OnLeftDown"></event>
|
||||
<event name="OnLeftUp"></event>
|
||||
<event name="OnMiddleDClick"></event>
|
||||
<event name="OnMiddleDown"></event>
|
||||
<event name="OnMiddleUp"></event>
|
||||
<event name="OnMotion"></event>
|
||||
<event name="OnMouseEvents"></event>
|
||||
<event name="OnMouseWheel"></event>
|
||||
<event name="OnPaint"></event>
|
||||
<event name="OnRightDClick"></event>
|
||||
<event name="OnRightDown"></event>
|
||||
<event name="OnRightUp"></event>
|
||||
<event name="OnSetFocus"></event>
|
||||
<event name="OnSize"></event>
|
||||
<event name="OnUpdateUI"></event>
|
||||
</object>
|
||||
</object>
|
||||
<property name="permission">protected</property>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
|
@ -1044,25 +955,31 @@
|
|||
<property name="aui_row"></property>
|
||||
<property name="best_size"></property>
|
||||
<property name="bg"></property>
|
||||
<property name="bitmap"></property>
|
||||
<property name="caption"></property>
|
||||
<property name="caption_visible">1</property>
|
||||
<property name="center_pane">0</property>
|
||||
<property name="close_button">1</property>
|
||||
<property name="context_help"></property>
|
||||
<property name="context_menu">1</property>
|
||||
<property name="current"></property>
|
||||
<property name="default">0</property>
|
||||
<property name="default_pane">0</property>
|
||||
<property name="disabled"></property>
|
||||
<property name="dock">Dock</property>
|
||||
<property name="dock_fixed">0</property>
|
||||
<property name="docking">Left</property>
|
||||
<property name="enabled">1</property>
|
||||
<property name="fg"></property>
|
||||
<property name="floatable">1</property>
|
||||
<property name="focus"></property>
|
||||
<property name="font"></property>
|
||||
<property name="gripper">0</property>
|
||||
<property name="hidden">0</property>
|
||||
<property name="id">wxID_ANY</property>
|
||||
<property name="label">Never Show Again</property>
|
||||
<property name="margins"></property>
|
||||
<property name="markup">0</property>
|
||||
<property name="max_size"></property>
|
||||
<property name="maximize_button">0</property>
|
||||
<property name="maximum_size"></property>
|
||||
|
@ -1077,6 +994,8 @@
|
|||
<property name="permission">protected</property>
|
||||
<property name="pin_button">1</property>
|
||||
<property name="pos"></property>
|
||||
<property name="position"></property>
|
||||
<property name="pressed"></property>
|
||||
<property name="resize">Resizable</property>
|
||||
<property name="show">1</property>
|
||||
<property name="size"></property>
|
||||
|
@ -1091,8 +1010,15 @@
|
|||
<property name="window_extra_style"></property>
|
||||
<property name="window_name"></property>
|
||||
<property name="window_style"></property>
|
||||
<event name="OnAux1DClick"></event>
|
||||
<event name="OnAux1Down"></event>
|
||||
<event name="OnAux1Up"></event>
|
||||
<event name="OnAux2DClick"></event>
|
||||
<event name="OnAux2Down"></event>
|
||||
<event name="OnAux2Up"></event>
|
||||
<event name="OnButtonClick">OnNeverShowClick</event>
|
||||
<event name="OnChar"></event>
|
||||
<event name="OnCharHook"></event>
|
||||
<event name="OnEnterWindow"></event>
|
||||
<event name="OnEraseBackground"></event>
|
||||
<event name="OnKeyDown"></event>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
///////////////////////////////////////////////////////////////////////////
|
||||
// C++ code generated with wxFormBuilder (version Dec 30 2017)
|
||||
// C++ code generated with wxFormBuilder (version Jul 11 2018)
|
||||
// http://www.wxformbuilder.org/
|
||||
//
|
||||
// PLEASE DO *NOT* EDIT THIS FILE!
|
||||
|
@ -20,9 +20,11 @@
|
|||
#include <wx/string.h>
|
||||
#include <wx/stattext.h>
|
||||
#include <wx/dataview.h>
|
||||
#include <symbol_preview_widget.h>
|
||||
#include <wx/sizer.h>
|
||||
#include <wx/panel.h>
|
||||
#include <wx/bitmap.h>
|
||||
#include <wx/image.h>
|
||||
#include <wx/icon.h>
|
||||
#include <wx/button.h>
|
||||
#include <wx/dialog.h>
|
||||
|
||||
|
@ -44,10 +46,10 @@ class DIALOG_RESCUE_EACH_BASE : public DIALOG_SHIM
|
|||
wxDataViewListCtrl* m_ListOfInstances;
|
||||
wxStaticText* m_previewOldLabel;
|
||||
wxPanel* m_previewOldPanel;
|
||||
SYMBOL_PREVIEW_WIDGET* m_previewOldWidget;
|
||||
wxBoxSizer* m_SizerOldPanel;
|
||||
wxStaticText* m_previewNewLabel;
|
||||
wxPanel* m_previewNewPanel;
|
||||
SYMBOL_PREVIEW_WIDGET* m_previewNewWidget;
|
||||
wxBoxSizer* m_SizerNewPanel;
|
||||
wxButton* m_btnNeverShowAgain;
|
||||
wxStdDialogButtonSizer* m_stdButtons;
|
||||
wxButton* m_stdButtonsOK;
|
||||
|
|
|
@ -496,7 +496,7 @@ void SCH_BASE_FRAME::CenterScreen( const wxPoint& aCenterPoint, bool aWarpPointe
|
|||
|
||||
void SCH_BASE_FRAME::HardRedraw()
|
||||
{
|
||||
GetCanvas()->DisplaySheet( GetScreen() );
|
||||
// Currently: just refresh the screen
|
||||
GetCanvas()->Refresh();
|
||||
}
|
||||
|
||||
|
@ -598,15 +598,15 @@ bool SCH_BASE_FRAME::HandleBlockBegin( wxDC* aDC, EDA_KEY aKey, const wxPoint& a
|
|||
|
||||
void SCH_BASE_FRAME::createCanvas()
|
||||
{
|
||||
EDA_DRAW_PANEL_GAL::GAL_TYPE canvasType = LoadCanvasTypeSetting();
|
||||
m_canvasType = LoadCanvasTypeSetting();
|
||||
|
||||
// Allows only a CAIRO or OPENGL canvas:
|
||||
if( canvasType != EDA_DRAW_PANEL_GAL::GAL_TYPE_OPENGL &&
|
||||
canvasType != EDA_DRAW_PANEL_GAL::GAL_TYPE_CAIRO )
|
||||
canvasType = EDA_DRAW_PANEL_GAL::GAL_TYPE_OPENGL;
|
||||
if( m_canvasType != EDA_DRAW_PANEL_GAL::GAL_TYPE_OPENGL &&
|
||||
m_canvasType != EDA_DRAW_PANEL_GAL::GAL_TYPE_CAIRO )
|
||||
m_canvasType = EDA_DRAW_PANEL_GAL::GAL_TYPE_OPENGL;
|
||||
|
||||
m_canvas = new SCH_DRAW_PANEL( this, wxID_ANY, wxPoint( 0, 0 ), m_FrameSize,
|
||||
GetGalDisplayOptions(), canvasType );
|
||||
GetGalDisplayOptions(), m_canvasType );
|
||||
|
||||
m_useSingleCanvasPane = true;
|
||||
|
||||
|
|
|
@ -424,8 +424,8 @@ void SCH_PAINTER::draw( LIB_POLYLINE *aLine, int aLayer )
|
|||
for( auto p : aLine->GetPolyPoints() )
|
||||
vtx.push_back ( mapCoords( p ) );
|
||||
|
||||
if( aLine->GetFillMode() == FILLED_WITH_BG_BODYCOLOR || aLine->GetFillMode() == FILLED_SHAPE )
|
||||
vtx.push_back( vtx[0] );
|
||||
// if( aLine->GetFillMode() == FILLED_WITH_BG_BODYCOLOR || aLine->GetFillMode() == FILLED_SHAPE )
|
||||
// vtx.push_back( vtx[0] );
|
||||
|
||||
m_gal->DrawPolygon( vtx );
|
||||
}
|
||||
|
|
|
@ -29,7 +29,8 @@
|
|||
#include <pgm_base.h>
|
||||
#include <sch_painter.h>
|
||||
|
||||
SYMBOL_PREVIEW_WIDGET::SYMBOL_PREVIEW_WIDGET( wxWindow* aParent, KIWAY& aKiway ) :
|
||||
SYMBOL_PREVIEW_WIDGET::SYMBOL_PREVIEW_WIDGET( wxWindow* aParent, KIWAY& aKiway,
|
||||
EDA_DRAW_PANEL_GAL::GAL_TYPE aCanvasType ) :
|
||||
wxPanel( aParent, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0 ),
|
||||
m_kiway( aKiway ),
|
||||
m_preview( nullptr ),
|
||||
|
@ -40,8 +41,15 @@ SYMBOL_PREVIEW_WIDGET::SYMBOL_PREVIEW_WIDGET( wxWindow* aParent, KIWAY& aKiway )
|
|||
wxConfigBase* eeschemaConfig = GetNewConfig( wxString::FromUTF8( "eeschema" ) );
|
||||
m_galDisplayOptions.ReadConfig( eeschemaConfig, GAL_DISPLAY_OPTIONS_KEY );
|
||||
|
||||
EDA_DRAW_PANEL_GAL::GAL_TYPE canvasType = aCanvasType;
|
||||
|
||||
// Allows only a CAIRO or OPENGL canvas:
|
||||
if( canvasType != EDA_DRAW_PANEL_GAL::GAL_TYPE_OPENGL &&
|
||||
canvasType != EDA_DRAW_PANEL_GAL::GAL_TYPE_CAIRO )
|
||||
canvasType = EDA_DRAW_PANEL_GAL::GAL_TYPE_OPENGL;
|
||||
|
||||
m_preview = new SCH_PREVIEW_PANEL( aParent, wxID_ANY, wxDefaultPosition, wxSize( -1, -1 ),
|
||||
m_galDisplayOptions, EDA_DRAW_PANEL_GAL::GAL_TYPE_OPENGL );
|
||||
m_galDisplayOptions, canvasType );
|
||||
m_preview->SetStealsFocus( false );
|
||||
|
||||
SetBackgroundColour( *wxWHITE );
|
||||
|
@ -117,15 +125,20 @@ void SYMBOL_PREVIEW_WIDGET::DisplaySymbol( const LIB_ID& aSymbolID, int aUnit )
|
|||
view->Add( alias );
|
||||
m_previewItem = alias;
|
||||
|
||||
// Zoom to fit
|
||||
// Calculate the draw scale to fit the drawing area
|
||||
|
||||
// First, get the symbole size, in internal units
|
||||
BOX2I bBox = alias->GetPart()->GetUnitBoundingBox( aUnit, 0 );
|
||||
VECTOR2D clientSize = m_preview->GetClientSize();
|
||||
// Now calculate the drawing area size, in internal units, for a scaling factor = 1.0
|
||||
view->SetScale( 1.0 );
|
||||
VECTOR2D clientSize = view->ToWorld( m_preview->GetClientSize(), false );
|
||||
double scale = std::min( fabs( clientSize.x / bBox.GetWidth() ),
|
||||
fabs( clientSize.y / bBox.GetHeight() ) );
|
||||
|
||||
// Above calculation will yield an exact fit; add a bit of whitespace around symbol
|
||||
scale /= 1.2;
|
||||
|
||||
// Now fix the best scale
|
||||
view->SetScale( scale );
|
||||
view->SetCenter( bBox.Centre() );
|
||||
}
|
||||
|
@ -157,15 +170,19 @@ void SYMBOL_PREVIEW_WIDGET::DisplayPart( LIB_PART* aPart, int aUnit )
|
|||
view->Add( aPart );
|
||||
m_previewItem = aPart;
|
||||
|
||||
// Zoom to fit
|
||||
// Calculate the draw scale to fit the drawing area
|
||||
|
||||
// First, get the symbole size, in internal units
|
||||
BOX2I bBox = aPart->GetUnitBoundingBox( aUnit, 0 );
|
||||
VECTOR2D clientSize = m_preview->GetClientSize();
|
||||
// Now calculate the drawing area size, in internal units, for a scaling factor = 1.0
|
||||
view->SetScale( 1.0 );
|
||||
VECTOR2D clientSize = view->ToWorld( m_preview->GetClientSize(), false );
|
||||
double scale = std::min( fabs( clientSize.x / bBox.GetWidth() ),
|
||||
fabs( clientSize.y / bBox.GetHeight() ) );
|
||||
|
||||
// Above calculation will yield an exact fit; add a bit of whitespace around symbol
|
||||
scale /= 1.2;
|
||||
|
||||
// Now fix the best scale
|
||||
view->SetScale( scale );
|
||||
view->SetCenter( bBox.Centre() );
|
||||
}
|
||||
|
|
|
@ -23,13 +23,13 @@
|
|||
#include <wx/panel.h>
|
||||
#include <kiway.h>
|
||||
#include <gal/gal_display_options.h>
|
||||
#include <class_draw_panel_gal.h>
|
||||
|
||||
|
||||
class EDA_ITEM;
|
||||
class LIB_ID;
|
||||
class LIB_ALIAS;
|
||||
class LIB_PART;
|
||||
class EDA_DRAW_PANEL_GAL;
|
||||
class wxStaticText;
|
||||
class wxSizer;
|
||||
|
||||
|
@ -43,8 +43,10 @@ public:
|
|||
*
|
||||
* @param aParent - parent window
|
||||
* @param aKiway - an active Kiway instance
|
||||
* @param aCanvasType = the type of canvas (GAL_TYPE_OPENGL or GAL_TYPE_CAIRO only)
|
||||
*/
|
||||
SYMBOL_PREVIEW_WIDGET( wxWindow* aParent, KIWAY& aKiway );
|
||||
SYMBOL_PREVIEW_WIDGET( wxWindow* aParent, KIWAY& aKiway,
|
||||
EDA_DRAW_PANEL_GAL::GAL_TYPE aCanvasType );
|
||||
|
||||
~SYMBOL_PREVIEW_WIDGET() override;
|
||||
|
||||
|
|
Loading…
Reference in New Issue