kicad-developers team mailing list archive
-
kicad-developers team
-
Mailing list archive
-
Message #37488
Re: GAL canvas strategy - testers needed!
Le 14/09/2018 à 11:30, Jeff Young a écrit :
> I pushed JP’s patches.
>
> What’s our plan for getting this branch merged to master?
>
> Cheers,
> Jeff.
>
Hi Jeff,
Attached 3 other patches.
The patch 0003 is mandatory, because it fixes a Eeschema crash at startup.
Currently there a blocking issue in Eeschema:
If a text or a symbol is added, the action cannot be undone.
If it is undone, the new item is still on screen, and any added item
(for instance adding a wire) crashes Eeschema.
An annoying but not blocking issue is the fact Scrollbars are no longer
displayed in GAL mode (I don't know why).
There are in Eeschema a few (minor?) cosmetic problems:
In Symbol selector the preview canvas shows artifacts in OpenGL mode.
Symbols with filled arcs have outlines drawn as pie, not arc in Cairo mode.
--
Jean-Pierre CHARRAS
From 5c24f435428b35d8c64acbbcd00ccbdcc0b1b0f5 Mon Sep 17 00:00:00 2001
From: jean-pierre charras <jp.charras@xxxxxxxxxx>
Date: Sat, 15 Sep 2018 09:00:13 +0200
Subject: [PATCH 1/3] Make SYMBOL_PREVIEW_WIDGET working, and using the canvas
type of the caller. Fix an issue with F3 zoom key in libedit.
---
common/gal/opengl/opengl_gal.cpp | 46 +--
common/legacy_gal/eda_draw_frame.cpp | 8 +-
eeschema/dialogs/dialog_choose_component.cpp | 3 +-
eeschema/dialogs/dialog_rescue_each.cpp | 37 ++-
eeschema/dialogs/dialog_rescue_each_base.cpp | 22 +-
eeschema/dialogs/dialog_rescue_each_base.fbp | 280 +++++++------------
eeschema/dialogs/dialog_rescue_each_base.h | 10 +-
eeschema/project_rescue.cpp | 2 +-
eeschema/sch_base_frame.cpp | 12 +-
eeschema/sch_painter.cpp | 4 +-
eeschema/widgets/symbol_preview_widget.cpp | 31 +-
eeschema/widgets/symbol_preview_widget.h | 6 +-
12 files changed, 207 insertions(+), 254 deletions(-)
diff --git a/common/gal/opengl/opengl_gal.cpp b/common/gal/opengl/opengl_gal.cpp
index 62c567d52..1ba0747c7 100644
--- a/common/gal/opengl/opengl_gal.cpp
+++ b/common/gal/opengl/opengl_gal.cpp
@@ -653,29 +653,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;
@@ -701,6 +678,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();
}
diff --git a/common/legacy_gal/eda_draw_frame.cpp b/common/legacy_gal/eda_draw_frame.cpp
index 9d8718c52..2a39567a7 100644
--- a/common/legacy_gal/eda_draw_frame.cpp
+++ b/common/legacy_gal/eda_draw_frame.cpp
@@ -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 );
diff --git a/eeschema/dialogs/dialog_choose_component.cpp b/eeschema/dialogs/dialog_choose_component.cpp
index 9ef0ad824..ff4fb81f7 100644
--- a/eeschema/dialogs/dialog_choose_component.cpp
+++ b/eeschema/dialogs/dialog_choose_component.cpp
@@ -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 )
diff --git a/eeschema/dialogs/dialog_rescue_each.cpp b/eeschema/dialogs/dialog_rescue_each.cpp
index 48bde0054..099a7c98f 100644
--- a/eeschema/dialogs/dialog_rescue_each.cpp
+++ b/eeschema/dialogs/dialog_rescue_each.cpp
@@ -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() )
diff --git a/eeschema/dialogs/dialog_rescue_each_base.cpp b/eeschema/dialogs/dialog_rescue_each_base.cpp
index 336523c80..dfc87bf5a 100644
--- a/eeschema/dialogs/dialog_rescue_each_base.cpp
+++ b/eeschema/dialogs/dialog_rescue_each_base.cpp
@@ -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_SizerOldPanel = new wxBoxSizer( wxVERTICAL );
- m_previewOldWidget = new SYMBOL_PREVIEW_WIDGET( m_previewOldPanel, Kiway() );
- bSizerOldPanel->Add( m_previewOldWidget, 1, wxEXPAND, 5 );
-
- 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 );
diff --git a/eeschema/dialogs/dialog_rescue_each_base.fbp b/eeschema/dialogs/dialog_rescue_each_base.fbp
index 8b032182d..086b3a75b 100644
--- a/eeschema/dialogs/dialog_rescue_each_base.fbp
+++ b/eeschema/dialogs/dialog_rescue_each_base.fbp
@@ -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>
diff --git a/eeschema/dialogs/dialog_rescue_each_base.h b/eeschema/dialogs/dialog_rescue_each_base.h
index f6bc920b9..47f61ce27 100644
--- a/eeschema/dialogs/dialog_rescue_each_base.h
+++ b/eeschema/dialogs/dialog_rescue_each_base.h
@@ -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;
diff --git a/eeschema/project_rescue.cpp b/eeschema/project_rescue.cpp
index dce3a40a2..32fb10e85 100644
--- a/eeschema/project_rescue.cpp
+++ b/eeschema/project_rescue.cpp
@@ -338,7 +338,7 @@ RESCUE_SYMBOL_LIB_TABLE_CANDIDATE::RESCUE_SYMBOL_LIB_TABLE_CANDIDATE(
LIB_PART* aLibCandidate ) : RESCUE_CANDIDATE()
{
m_requested_id = aRequestedId;
- m_requested_name = aRequestedId.GetLibItemName();
+ m_requested_name = aRequestedId.Format();
m_new_id = aNewId;
m_lib_candidate = aLibCandidate;
m_cache_candidate = aCacheCandidate;
diff --git a/eeschema/sch_base_frame.cpp b/eeschema/sch_base_frame.cpp
index 3a71df32b..86a63fbf4 100644
--- a/eeschema/sch_base_frame.cpp
+++ b/eeschema/sch_base_frame.cpp
@@ -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;
diff --git a/eeschema/sch_painter.cpp b/eeschema/sch_painter.cpp
index 5dfd7e4c8..875f8d00a 100644
--- a/eeschema/sch_painter.cpp
+++ b/eeschema/sch_painter.cpp
@@ -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 );
}
diff --git a/eeschema/widgets/symbol_preview_widget.cpp b/eeschema/widgets/symbol_preview_widget.cpp
index 7364a3d54..43741ef88 100644
--- a/eeschema/widgets/symbol_preview_widget.cpp
+++ b/eeschema/widgets/symbol_preview_widget.cpp
@@ -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() );
}
diff --git a/eeschema/widgets/symbol_preview_widget.h b/eeschema/widgets/symbol_preview_widget.h
index b0944f476..c817b1fe4 100644
--- a/eeschema/widgets/symbol_preview_widget.h
+++ b/eeschema/widgets/symbol_preview_widget.h
@@ -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;
--
2.17.0.windows.1
From e891c9ecd7795dc3be5449ac7b7d7135f6c1e6b4 Mon Sep 17 00:00:00 2001
From: jean-pierre charras <jp.charras@xxxxxxxxxx>
Date: Sat, 15 Sep 2018 12:55:53 +0200
Subject: [PATCH 2/3] Eeschema, Cairo backend: fix a minor but annoying render
issue.
---
common/draw_panel_gal.cpp | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/common/draw_panel_gal.cpp b/common/draw_panel_gal.cpp
index adb45b0db..543769151 100644
--- a/common/draw_panel_gal.cpp
+++ b/common/draw_panel_gal.cpp
@@ -171,10 +171,10 @@ void EDA_DRAW_PANEL_GAL::onPaint( wxPaintEvent& WXUNUSED( aEvent ) )
m_gal->BeginDrawing();
m_gal->SetClearColor( settings->GetBackgroundColor() );
m_gal->SetCursorColor( settings->GetLayerColor( LAYER_CURSOR ) );
- m_gal->ClearScreen( );
if( m_view->IsDirty() )
{
+ m_gal->ClearScreen();
m_view->ClearTargets();
// Grid has to be redrawn only when the NONCACHED target is redrawn
--
2.17.0.windows.1
From 6bf4c25d7425ae3c4443fb1e89bc397ee2f15a1a Mon Sep 17 00:00:00 2001
From: jean-pierre charras <jp.charras@xxxxxxxxxx>
Date: Sat, 15 Sep 2018 16:01:35 +0200
Subject: [PATCH 3/3] Eeschema: fix a crash at startup in OpenGL engine, when
Eeschema is started from Kicad.
Can be platform dependent. The crash was due to a wxPaintEvent fired before the GAL engine is fully initialized.
---
eeschema/sch_draw_panel.cpp | 11 ++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)
diff --git a/eeschema/sch_draw_panel.cpp b/eeschema/sch_draw_panel.cpp
index 95d593664..c717c02f7 100644
--- a/eeschema/sch_draw_panel.cpp
+++ b/eeschema/sch_draw_panel.cpp
@@ -50,9 +50,9 @@ BEGIN_EVENT_TABLE( SCH_DRAW_PANEL, wxScrolledCanvas )
// EVT_MAGNIFY( EDA_DRAW_PANEL::OnMagnify )
#endif
// EVT_MOUSE_EVENTS( EDA_DRAW_PANEL::OnMouseEvent )
- EVT_CHAR( SCH_DRAW_PANEL::OnKeyEvent )
- EVT_CHAR_HOOK( SCH_DRAW_PANEL::OnCharHook )
- EVT_PAINT( SCH_DRAW_PANEL::onPaint )
+ EVT_CHAR( SCH_DRAW_PANEL::OnKeyEvent )
+ EVT_CHAR_HOOK( SCH_DRAW_PANEL::OnCharHook )
+ EVT_PAINT( SCH_DRAW_PANEL::onPaint )
// EVT_ERASE_BACKGROUND( EDA_DRAW_PANEL::OnEraseBackground )
// EVT_SCROLLWIN( EDA_DRAW_PANEL::OnScroll )
// EVT_ACTIVATE( EDA_DRAW_PANEL::OnActivate )
@@ -675,6 +675,11 @@ void SCH_DRAW_PANEL::OnKeyEvent( wxKeyEvent& event )
void SCH_DRAW_PANEL::onPaint( wxPaintEvent& aEvent )
{
+ if( !m_gal->IsInitialized() )
+ // The first wxPaintEvent can be fired at startup before the GAL engine is fully initialized
+ // (depending on platforms). Do nothing in this case
+ return;
+
if( m_painter )
static_cast<KIGFX::SCH_PAINTER*>(m_painter.get())->GetSettings()->ImportLegacyColors( nullptr );
--
2.17.0.windows.1
Follow ups
References