Re: [Kicad-developers] How to make single-plane .cpp from .png?

2019-08-05 Thread Johannes Sprigode
If I may chip in.

The new symbols (16x16) I created for the horizontal text are done in
inkscape and exported as png.

Post processed in gimp to an 8-bit grey scale with alpha which reduced
them from ~300 to ~170 something bytes.

They still appear to have the same quality as you have seen. Settings
attached.

The same should be doable for those cursors, or anything alike.

Cheers

Johannes

On 6/08/19 9:51 AM, Jeff Young wrote:
> If you open the PNG in Gimp and then export as XBM it works.  (Note that 
> while wxBitmap’s constructor purports to support sizes, if you pass anything 
> under 32x32 you’ll get garbage.)
>
> However, the cursors aren’t greyscale (they’re true black-and-white), so the 
> whole SVG source idea produces some pretty ugly cursors.  I think we’ll have 
> to specify them as bitmaps.
>
>> On 5 Aug 2019, at 15:25, Jeff Young  wrote:
>>
>> I also tried online converters for PNG -> XBM and directly from the source 
>> (SVG -> XBM), but they all give me black images….
>>
>>
>>> On 5 Aug 2019, at 15:15, Jeff Young  wrote:
>>>
>>> I found doc on the colour modes; 0 is monochrome without alpha, 2 is RGB, 4 
>>> is monochrome with alpha and 6 is RGBA.
>>>
>>> So -c 0 should be correct.  
>>>
>>> But it appears wxBitmap is expecting XBM data rather than PNG data.  Hm…..
>>>
>>>
 On 5 Aug 2019, at 14:46, Jeff Young  wrote:

 pngcrush -c 0 makes a single-plane char array, but it appears to be in a 
 different order or something (the array is the right size, but produces a 
 garbage cursor).

 Anyone know what the other colour modes are?  (0, 2, 4, 6)

> On 5 Aug 2019, at 13:22, Jeff Young  wrote:
>
> Our PNG2cpp.cmake script makes a 3 or 4 plane (ie: colour) char array.
>
> wxWidgets’ wxBitmap() constructor needs a single plane char array.  John 
> Beard created a couple for the SPICE cursors, but I’m not sure how he did 
> it.
>
> Thanks,
> Jeff.
>
>
> ___
> Mailing list: https://launchpad.net/~kicad-developers
> Post to : kicad-developers@lists.launchpad.net
> Unsubscribe : https://launchpad.net/~kicad-developers
> More help   : https://help.launchpad.net/ListHelp

 ___
 Mailing list: https://launchpad.net/~kicad-developers
 Post to : kicad-developers@lists.launchpad.net
 Unsubscribe : https://launchpad.net/~kicad-developers
 More help   : https://help.launchpad.net/ListHelp
>>>
>>> ___
>>> Mailing list: https://launchpad.net/~kicad-developers
>>> Post to : kicad-developers@lists.launchpad.net
>>> Unsubscribe : https://launchpad.net/~kicad-developers
>>> More help   : https://help.launchpad.net/ListHelp
>>
>> ___
>> Mailing list: https://launchpad.net/~kicad-developers
>> Post to : kicad-developers@lists.launchpad.net
>> Unsubscribe : https://launchpad.net/~kicad-developers
>> More help   : https://help.launchpad.net/ListHelp
>
> ___
> Mailing list: https://launchpad.net/~kicad-developers
> Post to : kicad-developers@lists.launchpad.net
> Unsubscribe : https://launchpad.net/~kicad-developers
> More help   : https://help.launchpad.net/ListHelp


signature.asc
Description: OpenPGP digital signature
___
Mailing list: https://launchpad.net/~kicad-developers
Post to : kicad-developers@lists.launchpad.net
Unsubscribe : https://launchpad.net/~kicad-developers
More help   : https://help.launchpad.net/ListHelp


Re: [Kicad-developers] [Patch] Move pcbnew layer toolbar icon values to member struct

2019-08-05 Thread Jeff Young
Hi Ian,

I’ve merged your patch.  Thanks!

Cheers,
Jeff.


> On 5 Aug 2019, at 09:13, Ian McInerney  wrote:
> 
> Here is an updated version of this patch that goes with the constexpr color 
> definitions instead of the initialize-on-first-use.
> 
> -Ian
> 
> On Mon, Aug 5, 2019 at 12:20 PM Ian McInerney  > wrote:
> This patch moves the static variables in the toolbar icon creation function 
> into a member struct of the PCB_EDIT_FRAME class. These statics had posed 
> some issues on Linux before, and are also not very good for having multiple 
> PCB_EDIT_FRAME instances at one time.
> 
> This patch is dependent upon the prior patch I just sent to fix the 
> initialization of the COLOR4D static variables.
> <0001-pcbnew-Move-layer-toolbar-icon-previous-values-to-st.patch>___
> Mailing list: https://launchpad.net/~kicad-developers
> Post to : kicad-developers@lists.launchpad.net
> Unsubscribe : https://launchpad.net/~kicad-developers
> More help   : https://help.launchpad.net/ListHelp

___
Mailing list: https://launchpad.net/~kicad-developers
Post to : kicad-developers@lists.launchpad.net
Unsubscribe : https://launchpad.net/~kicad-developers
More help   : https://help.launchpad.net/ListHelp


Re: [Kicad-developers] [Patch] Return event handled flag from dispatchHotkey

2019-08-05 Thread Jeff Young
Hi Ian,

I’ve merged your patch.  Thanks!

Cheers,
Jeff.


> On 5 Aug 2019, at 14:03, Ian McInerney  wrote:
> 
> This patch modifies the event dispatch in the tool manager to return whether 
> a hotkey has been handled with an action (instead of just returning true if 
> an action with the hotkey exists). This will allow the handler to continue 
> processing the event if the action with the hotkey does not have any active 
> transitions.
> 
> This is something that was discussed on the list before with the hotkey 
> handling (https://lists.launchpad.net/kicad-developers/msg41725.html 
> ), and it seemed 
> the discussion said this was a change that should be made (and then fix any 
> fallout from it). I don't think this will break anything, but it will make 
> more keyboard events being passed into the interactive tools.
> 
> -Ian
> <0001-Return-handled-status-for-actions-run-from-hotkeys.patch>___
> Mailing list: https://launchpad.net/~kicad-developers
> Post to : kicad-developers@lists.launchpad.net
> Unsubscribe : https://launchpad.net/~kicad-developers
> More help   : https://help.launchpad.net/ListHelp

___
Mailing list: https://launchpad.net/~kicad-developers
Post to : kicad-developers@lists.launchpad.net
Unsubscribe : https://launchpad.net/~kicad-developers
More help   : https://help.launchpad.net/ListHelp


Re: [Kicad-developers] How to make single-plane .cpp from .png?

2019-08-05 Thread Jeff Young
If you open the PNG in Gimp and then export as XBM it works.  (Note that while 
wxBitmap’s constructor purports to support sizes, if you pass anything under 
32x32 you’ll get garbage.)

However, the cursors aren’t greyscale (they’re true black-and-white), so the 
whole SVG source idea produces some pretty ugly cursors.  I think we’ll have to 
specify them as bitmaps.

> On 5 Aug 2019, at 15:25, Jeff Young  wrote:
> 
> I also tried online converters for PNG -> XBM and directly from the source 
> (SVG -> XBM), but they all give me black images….
> 
> 
>> On 5 Aug 2019, at 15:15, Jeff Young  wrote:
>> 
>> I found doc on the colour modes; 0 is monochrome without alpha, 2 is RGB, 4 
>> is monochrome with alpha and 6 is RGBA.
>> 
>> So -c 0 should be correct.  
>> 
>> But it appears wxBitmap is expecting XBM data rather than PNG data.  Hm…..
>> 
>> 
>>> On 5 Aug 2019, at 14:46, Jeff Young  wrote:
>>> 
>>> pngcrush -c 0 makes a single-plane char array, but it appears to be in a 
>>> different order or something (the array is the right size, but produces a 
>>> garbage cursor).
>>> 
>>> Anyone know what the other colour modes are?  (0, 2, 4, 6)
>>> 
 On 5 Aug 2019, at 13:22, Jeff Young  wrote:
 
 Our PNG2cpp.cmake script makes a 3 or 4 plane (ie: colour) char array.
 
 wxWidgets’ wxBitmap() constructor needs a single plane char array.  John 
 Beard created a couple for the SPICE cursors, but I’m not sure how he did 
 it.
 
 Thanks,
 Jeff.
 
 
 ___
 Mailing list: https://launchpad.net/~kicad-developers
 Post to : kicad-developers@lists.launchpad.net
 Unsubscribe : https://launchpad.net/~kicad-developers
 More help   : https://help.launchpad.net/ListHelp
>>> 
>>> 
>>> ___
>>> Mailing list: https://launchpad.net/~kicad-developers
>>> Post to : kicad-developers@lists.launchpad.net
>>> Unsubscribe : https://launchpad.net/~kicad-developers
>>> More help   : https://help.launchpad.net/ListHelp
>> 
>> 
>> ___
>> Mailing list: https://launchpad.net/~kicad-developers
>> Post to : kicad-developers@lists.launchpad.net
>> Unsubscribe : https://launchpad.net/~kicad-developers
>> More help   : https://help.launchpad.net/ListHelp
> 
> 
> ___
> Mailing list: https://launchpad.net/~kicad-developers
> Post to : kicad-developers@lists.launchpad.net
> Unsubscribe : https://launchpad.net/~kicad-developers
> More help   : https://help.launchpad.net/ListHelp


___
Mailing list: https://launchpad.net/~kicad-developers
Post to : kicad-developers@lists.launchpad.net
Unsubscribe : https://launchpad.net/~kicad-developers
More help   : https://help.launchpad.net/ListHelp


Re: [Kicad-developers] How to make single-plane .cpp from .png?

2019-08-05 Thread Jeff Young
I also tried online converters for PNG -> XBM and directly from the source (SVG 
-> XBM), but they all give me black images….


> On 5 Aug 2019, at 15:15, Jeff Young  wrote:
> 
> I found doc on the colour modes; 0 is monochrome without alpha, 2 is RGB, 4 
> is monochrome with alpha and 6 is RGBA.
> 
> So -c 0 should be correct.  
> 
> But it appears wxBitmap is expecting XBM data rather than PNG data.  Hm…..
> 
> 
>> On 5 Aug 2019, at 14:46, Jeff Young  wrote:
>> 
>> pngcrush -c 0 makes a single-plane char array, but it appears to be in a 
>> different order or something (the array is the right size, but produces a 
>> garbage cursor).
>> 
>> Anyone know what the other colour modes are?  (0, 2, 4, 6)
>> 
>>> On 5 Aug 2019, at 13:22, Jeff Young  wrote:
>>> 
>>> Our PNG2cpp.cmake script makes a 3 or 4 plane (ie: colour) char array.
>>> 
>>> wxWidgets’ wxBitmap() constructor needs a single plane char array.  John 
>>> Beard created a couple for the SPICE cursors, but I’m not sure how he did 
>>> it.
>>> 
>>> Thanks,
>>> Jeff.
>>> 
>>> 
>>> ___
>>> Mailing list: https://launchpad.net/~kicad-developers
>>> Post to : kicad-developers@lists.launchpad.net
>>> Unsubscribe : https://launchpad.net/~kicad-developers
>>> More help   : https://help.launchpad.net/ListHelp
>> 
>> 
>> ___
>> Mailing list: https://launchpad.net/~kicad-developers
>> Post to : kicad-developers@lists.launchpad.net
>> Unsubscribe : https://launchpad.net/~kicad-developers
>> More help   : https://help.launchpad.net/ListHelp
> 
> 
> ___
> Mailing list: https://launchpad.net/~kicad-developers
> Post to : kicad-developers@lists.launchpad.net
> Unsubscribe : https://launchpad.net/~kicad-developers
> More help   : https://help.launchpad.net/ListHelp


___
Mailing list: https://launchpad.net/~kicad-developers
Post to : kicad-developers@lists.launchpad.net
Unsubscribe : https://launchpad.net/~kicad-developers
More help   : https://help.launchpad.net/ListHelp


Re: [Kicad-developers] How to make single-plane .cpp from .png?

2019-08-05 Thread Jeff Young
I found doc on the colour modes; 0 is monochrome without alpha, 2 is RGB, 4 is 
monochrome with alpha and 6 is RGBA.

So -c 0 should be correct.  

But it appears wxBitmap is expecting XBM data rather than PNG data.  Hm…..


> On 5 Aug 2019, at 14:46, Jeff Young  wrote:
> 
> pngcrush -c 0 makes a single-plane char array, but it appears to be in a 
> different order or something (the array is the right size, but produces a 
> garbage cursor).
> 
> Anyone know what the other colour modes are?  (0, 2, 4, 6)
> 
>> On 5 Aug 2019, at 13:22, Jeff Young  wrote:
>> 
>> Our PNG2cpp.cmake script makes a 3 or 4 plane (ie: colour) char array.
>> 
>> wxWidgets’ wxBitmap() constructor needs a single plane char array.  John 
>> Beard created a couple for the SPICE cursors, but I’m not sure how he did it.
>> 
>> Thanks,
>> Jeff.
>> 
>> 
>> ___
>> Mailing list: https://launchpad.net/~kicad-developers
>> Post to : kicad-developers@lists.launchpad.net
>> Unsubscribe : https://launchpad.net/~kicad-developers
>> More help   : https://help.launchpad.net/ListHelp
> 
> 
> ___
> Mailing list: https://launchpad.net/~kicad-developers
> Post to : kicad-developers@lists.launchpad.net
> Unsubscribe : https://launchpad.net/~kicad-developers
> More help   : https://help.launchpad.net/ListHelp


___
Mailing list: https://launchpad.net/~kicad-developers
Post to : kicad-developers@lists.launchpad.net
Unsubscribe : https://launchpad.net/~kicad-developers
More help   : https://help.launchpad.net/ListHelp


Re: [Kicad-developers] How to make single-plane .cpp from .png?

2019-08-05 Thread Jeff Young
pngcrush -c 0 makes a single-plane char array, but it appears to be in a 
different order or something (the array is the right size, but produces a 
garbage cursor).

Anyone know what the other colour modes are?  (0, 2, 4, 6)

> On 5 Aug 2019, at 13:22, Jeff Young  wrote:
> 
> Our PNG2cpp.cmake script makes a 3 or 4 plane (ie: colour) char array.
> 
> wxWidgets’ wxBitmap() constructor needs a single plane char array.  John 
> Beard created a couple for the SPICE cursors, but I’m not sure how he did it.
> 
> Thanks,
> Jeff.
> 
> 
> ___
> Mailing list: https://launchpad.net/~kicad-developers
> Post to : kicad-developers@lists.launchpad.net
> Unsubscribe : https://launchpad.net/~kicad-developers
> More help   : https://help.launchpad.net/ListHelp


___
Mailing list: https://launchpad.net/~kicad-developers
Post to : kicad-developers@lists.launchpad.net
Unsubscribe : https://launchpad.net/~kicad-developers
More help   : https://help.launchpad.net/ListHelp


[Kicad-developers] [Patch] Return event handled flag from dispatchHotkey

2019-08-05 Thread Ian McInerney
This patch modifies the event dispatch in the tool manager to return
whether a hotkey has been handled with an action (instead of just returning
true if an action with the hotkey exists). This will allow the handler to
continue processing the event if the action with the hotkey does not have
any active transitions.

This is something that was discussed on the list before with the hotkey
handling (https://lists.launchpad.net/kicad-developers/msg41725.html), and
it seemed the discussion said this was a change that should be made (and
then fix any fallout from it). I don't think this will break anything, but
it will make more keyboard events being passed into the interactive tools.

-Ian
From d1a5e31a7349152bddb029d14bae68fd1983a6bf Mon Sep 17 00:00:00 2001
From: Ian McInerney 
Date: Mon, 5 Aug 2019 14:19:44 +0200
Subject: [PATCH] Return handled status for actions run from hotkeys

---
 common/tool/action_manager.cpp |  6 ++
 common/tool/tool_manager.cpp   | 37 --
 include/tool/tool_manager.h| 21 +++
 3 files changed, 37 insertions(+), 27 deletions(-)

diff --git a/common/tool/action_manager.cpp b/common/tool/action_manager.cpp
index 9e26c49b4..96e1eabd0 100644
--- a/common/tool/action_manager.cpp
+++ b/common/tool/action_manager.cpp
@@ -152,8 +152,7 @@ bool ACTION_MANAGER::RunHotKey( int aHotKey ) const
 "ACTION_MANAGER::RunHotKey Running action %s for hotkey %s", context->GetName(),
 KeyNameFromKeyCode( aHotKey ) );
 
-m_toolMgr->RunAction( *context, true );
-return true;
+return m_toolMgr->RunAction( *context, true );
 }
 else if( global )
 {
@@ -161,8 +160,7 @@ bool ACTION_MANAGER::RunHotKey( int aHotKey ) const
 "ACTION_MANAGER::RunHotKey Running action: %s for hotkey %s", global->GetName(),
 KeyNameFromKeyCode( aHotKey ) );
 
-m_toolMgr->RunAction( *global, true );
-return true;
+return m_toolMgr->RunAction( *global, true );
 }
 
 wxLogTrace( kicadTraceToolStack, "ACTION_MANAGER::RunHotKey No action found for key %s",
diff --git a/common/tool/tool_manager.cpp b/common/tool/tool_manager.cpp
index 71870b267..f56f6ce37 100644
--- a/common/tool/tool_manager.cpp
+++ b/common/tool/tool_manager.cpp
@@ -278,8 +278,9 @@ bool TOOL_MANAGER::RunAction( const std::string& aActionName, bool aNow, void* a
 }
 
 
-void TOOL_MANAGER::RunAction( const TOOL_ACTION& aAction, bool aNow, void* aParam )
+bool TOOL_MANAGER::RunAction( const TOOL_ACTION& aAction, bool aNow, void* aParam )
 {
+bool   handled = false;
 TOOL_EVENT event = aAction.MakeEvent();
 
 // Allow to override the action parameter
@@ -289,7 +290,7 @@ void TOOL_MANAGER::RunAction( const TOOL_ACTION& aAction, bool aNow, void* aPara
 if( aNow )
 {
 TOOL_STATE* current = m_activeState;
-processEvent( event );
+handled = processEvent( event );
 setActiveState( current );
 UpdateUI( event );
 }
@@ -297,6 +298,8 @@ void TOOL_MANAGER::RunAction( const TOOL_ACTION& aAction, bool aNow, void* aPara
 {
 PostEvent( event );
 }
+
+return handled;
 }
 
 
@@ -956,22 +959,26 @@ bool TOOL_MANAGER::processEvent( const TOOL_EVENT& aEvent )
 {
 wxLogTrace( kicadTraceToolStack, "TOOL_MANAGER::processEvent %s", aEvent.Format() );
 
-if( dispatchHotKey( aEvent ) )
-return true;
-
-bool handled = false;
+// First try to dispatch the action associated with the event if it is a key press event
+bool handled = dispatchHotKey( aEvent );
 
-handled |= dispatchInternal( aEvent );
-handled |= dispatchActivation( aEvent );
+if( !handled )
+{
+// If the event is not handled through a hotkey activation, pass it to the currently
+// running tool loops
+handled |= dispatchInternal( aEvent );
+handled |= dispatchActivation( aEvent );
 
-DispatchContextMenu( aEvent );
+// Open the context menu if requested by a tool
+DispatchContextMenu( aEvent );
 
-// Dispatch queue
-while( !m_eventQueue.empty() )
-{
-TOOL_EVENT event = m_eventQueue.front();
-m_eventQueue.pop_front();
-processEvent( event );
+// Dispatch any remaining events in the event queue
+while( !m_eventQueue.empty() )
+{
+TOOL_EVENT event = m_eventQueue.front();
+m_eventQueue.pop_front();
+processEvent( event );
+}
 }
 
 wxLogTrace( kicadTraceToolStack, "TOOL_MANAGER::processEvent handled: %s  %s",
diff --git a/include/tool/tool_manager.h b/include/tool/tool_manager.h
index d1056bdba..14622d994 100644
--- a/include/tool/tool_manager.h
+++ b/include/tool/tool_manager.h
@@ -122,30 +122,35 @@ public:
  * Function RunAction()
  * Runs the specified action.
  *
+ * This function will only return if the action has been handled when the action is run
+  

[Kicad-developers] How to make single-plane .cpp from .png?

2019-08-05 Thread Jeff Young
Our PNG2cpp.cmake script makes a 3 or 4 plane (ie: colour) char array.

wxWidgets’ wxBitmap() constructor needs a single plane char array.  John Beard 
created a couple for the SPICE cursors, but I’m not sure how he did it.

Thanks,
Jeff.


___
Mailing list: https://launchpad.net/~kicad-developers
Post to : kicad-developers@lists.launchpad.net
Unsubscribe : https://launchpad.net/~kicad-developers
More help   : https://help.launchpad.net/ListHelp


Re: [Kicad-developers] Anyone know where the sources to the simulation cursors are?

2019-08-05 Thread Seth Hillbrand

Maybe Orson has the answer here?

On 2019-08-05 12:06, Jeff Young wrote:



___
Mailing list: https://launchpad.net/~kicad-developers
Post to : kicad-developers@lists.launchpad.net
Unsubscribe : https://launchpad.net/~kicad-developers
More help   : https://help.launchpad.net/ListHelp


___
Mailing list: https://launchpad.net/~kicad-developers
Post to : kicad-developers@lists.launchpad.net
Unsubscribe : https://launchpad.net/~kicad-developers
More help   : https://help.launchpad.net/ListHelp


[Kicad-developers] Anyone know where the sources to the simulation cursors are?

2019-08-05 Thread Jeff Young


___
Mailing list: https://launchpad.net/~kicad-developers
Post to : kicad-developers@lists.launchpad.net
Unsubscribe : https://launchpad.net/~kicad-developers
More help   : https://help.launchpad.net/ListHelp


Re: [Kicad-developers] [Patch] Move pcbnew layer toolbar icon values to member struct

2019-08-05 Thread Ian McInerney
Here is an updated version of this patch that goes with the constexpr color
definitions instead of the initialize-on-first-use.

-Ian

On Mon, Aug 5, 2019 at 12:20 PM Ian McInerney 
wrote:

> This patch moves the static variables in the toolbar icon creation
> function into a member struct of the PCB_EDIT_FRAME class. These statics
> had posed some issues on Linux before, and are also not very good for
> having multiple PCB_EDIT_FRAME instances at one time.
>
> This patch is dependent upon the prior patch I just sent to fix the
> initialization of the COLOR4D static variables.
>
From 8ca5a3a0f77f42c63d441655a7904276db802f85 Mon Sep 17 00:00:00 2001
From: Ian McInerney 
Date: Mon, 5 Aug 2019 17:10:58 +0200
Subject: [PATCH] pcbnew: Move layer toolbar icon previous values to struct

The static variables posed problems on Linux, and also were
not as portable for multiple instances of PCB_EDIT_FRAME.
---
 pcbnew/pcb_edit_frame.h| 26 ++
 pcbnew/toolbars_pcb_editor.cpp | 33 +
 2 files changed, 39 insertions(+), 20 deletions(-)

diff --git a/pcbnew/pcb_edit_frame.h b/pcbnew/pcb_edit_frame.h
index f246160bf..d00fa5033 100644
--- a/pcbnew/pcb_edit_frame.h
+++ b/pcbnew/pcb_edit_frame.h
@@ -109,6 +109,32 @@ protected:
 
 wxString  m_lastPath[ LAST_PATH_SIZE ];
 
+
+/**
+ * Store the previous layer toolbar icon state information
+ */
+struct LAYER_TOOLBAR_ICON_VALUES
+{
+int previous_requested_scale;
+COLOR4D previous_active_layer_color;
+COLOR4D previous_Route_Layer_TOP_color;
+COLOR4D previous_Route_Layer_BOTTOM_color;
+COLOR4D previous_via_color;
+COLOR4D previous_background_color;
+
+LAYER_TOOLBAR_ICON_VALUES()
+: previous_requested_scale( 0 ),
+  previous_active_layer_color( COLOR4D::UNSPECIFIED ),
+  previous_Route_Layer_TOP_color( COLOR4D::UNSPECIFIED ),
+  previous_Route_Layer_BOTTOM_color( COLOR4D::UNSPECIFIED ),
+  previous_via_color( COLOR4D::UNSPECIFIED ),
+  previous_background_color( COLOR4D::UNSPECIFIED )
+{
+}
+};
+
+LAYER_TOOLBAR_ICON_VALUES m_prevIconVal;
+
 // The Tool Framework initalization
 void setupTools();
 
diff --git a/pcbnew/toolbars_pcb_editor.cpp b/pcbnew/toolbars_pcb_editor.cpp
index f7c8e0526..d8b0edab4 100644
--- a/pcbnew/toolbars_pcb_editor.cpp
+++ b/pcbnew/toolbars_pcb_editor.cpp
@@ -90,60 +90,53 @@ void PCB_EDIT_FRAME::PrepareLayerIndicator( bool aForceRebuild )
 COLOR4Dactive_layer_color, top_color, bottom_color, via_color, background_color;
 bool   change = aForceRebuild;
 
-static int previous_requested_scale;
-static COLOR4D previous_active_layer_color = COLOR4D::UNSPECIFIED;
-static COLOR4D previous_Route_Layer_TOP_color = COLOR4D::UNSPECIFIED;
-static COLOR4D previous_Route_Layer_BOTTOM_color = COLOR4D::UNSPECIFIED;
-static COLOR4D previous_via_color = COLOR4D::UNSPECIFIED;
-static COLOR4D previous_background_color = COLOR4D::UNSPECIFIED;
-
 int requested_scale;
 Pgm().CommonSettings()->Read( ICON_SCALE_KEY, _scale, 0 );
 
-if( requested_scale != previous_requested_scale )
+if( m_prevIconVal.previous_requested_scale != requested_scale )
 {
-previous_requested_scale = requested_scale;
+m_prevIconVal.previous_requested_scale = requested_scale;
 change = true;
 }
 
-active_layer_color = Settings().Colors().GetLayerColor(GetActiveLayer());
+active_layer_color = Settings().Colors().GetLayerColor( GetActiveLayer() );
 
-if( previous_active_layer_color != active_layer_color )
+if( m_prevIconVal.previous_active_layer_color != active_layer_color )
 {
-previous_active_layer_color = active_layer_color;
+m_prevIconVal.previous_active_layer_color = active_layer_color;
 change = true;
 }
 
 top_color = Settings().Colors().GetLayerColor( GetScreen()->m_Route_Layer_TOP );
 
-if( previous_Route_Layer_TOP_color != top_color )
+if( m_prevIconVal.previous_Route_Layer_TOP_color != top_color )
 {
-previous_Route_Layer_TOP_color = top_color;
+m_prevIconVal.previous_Route_Layer_TOP_color = top_color;
 change = true;
 }
 
 bottom_color = Settings().Colors().GetLayerColor( GetScreen()->m_Route_Layer_BOTTOM );
 
-if( previous_Route_Layer_BOTTOM_color != bottom_color )
+if( m_prevIconVal.previous_Route_Layer_BOTTOM_color != bottom_color )
 {
-previous_Route_Layer_BOTTOM_color = bottom_color;
+m_prevIconVal.previous_Route_Layer_BOTTOM_color = bottom_color;
 change = true;
 }
 
 int via_type = GetDesignSettings().m_CurrentViaType;
 via_color = Settings().Colors().GetItemColor( LAYER_VIAS + via_type );
 
-if( previous_via_color != via_color )
+if( m_prevIconVal.previous_via_color != via_color 

Re: [Kicad-developers] [Patch] Fix initialization order for COLOR4D statics

2019-08-05 Thread Ian McInerney
The updated patch using constexpr (which now only affects the color4d
files) is attached.

Simon, thanks for the suggestion to use constexpr. It ended up working by
just declaring the variables constexpr and also making one of the
constructors constexpr. Definitely much simpler.

-Ian

On Mon, Aug 5, 2019 at 2:10 PM Wayne Stambaugh  wrote:

> On 8/5/19 5:03 AM, Simon Richter wrote:
> > Hi,
> >
> > On Mon, Aug 05, 2019 at 10:58:44AM +0200, Ian McInerney wrote:
> >
> >> I tracked it down to the fact that COLOR4D has some static colors that
> were
> >> being used to initialize some other static variables in pcbnew's layer
> >> widgets. I have moved all the static colors to an initialize on first
> use
> >> paradigm (so now we just call them like a function, e.g.
> >> COLOR4D::UNSPECIFIED() ) to fix it.
> >
> > Can that be solved by constexpr?
> >
> >Simon
> >
>
> I would prefer the constexpr solution if it resolves the issue.  It
> certainly would be a much simpler patch.
>
> Wayne
>
> ___
> Mailing list: https://launchpad.net/~kicad-developers
> Post to : kicad-developers@lists.launchpad.net
> Unsubscribe : https://launchpad.net/~kicad-developers
> More help   : https://help.launchpad.net/ListHelp
>
From 06c283922ae6c01be0de45c74c25185c6884955a Mon Sep 17 00:00:00 2001
From: Ian McInerney 
Date: Mon, 5 Aug 2019 15:54:13 +0200
Subject: [PATCH] Fix initialization of COLOR4D statics

Just declaring as static const would give an initialization order
fiasco since they were being used to initialize other statics.
---
 common/gal/color4d.cpp | 6 +++---
 include/gal/color4d.h  | 4 ++--
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/common/gal/color4d.cpp b/common/gal/color4d.cpp
index bc71f45bc..eadc3c220 100644
--- a/common/gal/color4d.cpp
+++ b/common/gal/color4d.cpp
@@ -362,6 +362,6 @@ COLOR4D& COLOR4D::Saturate( double aFactor )
 return *this;
 }
 
-const COLOR4D COLOR4D::UNSPECIFIED( 0, 0, 0, 0 );
-const COLOR4D COLOR4D::WHITE( 1, 1, 1, 1 );
-const COLOR4D COLOR4D::BLACK( 0, 0, 0, 1 );
+constexpr COLOR4D COLOR4D::UNSPECIFIED( 0, 0, 0, 0 );
+constexpr COLOR4D COLOR4D::WHITE( 1, 1, 1, 1 );
+constexpr COLOR4D COLOR4D::BLACK( 0, 0, 0, 1 );
diff --git a/include/gal/color4d.h b/include/gal/color4d.h
index 1b3932623..acd48205e 100644
--- a/include/gal/color4d.h
+++ b/include/gal/color4d.h
@@ -2,7 +2,7 @@
  * This program source code file is part of KICAD, a free EDA CAD application.
  *
  * Copyright (C) 2012 Torsten Hueter, torstenhtr  gmx.de
- * Copyright (C) 2017 Kicad Developers, see AUTHORS.txt for contributors.
+ * Copyright (C) 2017-2019 Kicad Developers, see AUTHORS.txt for contributors.
  *
  * Color class
  *
@@ -53,7 +53,7 @@ public:
  * @param aBlue  is the blue component  [0.0 .. 1.0].
  * @param aAlpha is the alpha value [0.0 .. 1.0].
  */
-COLOR4D( double aRed, double aGreen, double aBlue, double aAlpha ) :
+constexpr COLOR4D( double aRed, double aGreen, double aBlue, double aAlpha ) :
 r( aRed ), g( aGreen ), b( aBlue ), a( aAlpha )
 {
 assert( r >= 0.0 && r <= 1.0 );
-- 
2.21.0

___
Mailing list: https://launchpad.net/~kicad-developers
Post to : kicad-developers@lists.launchpad.net
Unsubscribe : https://launchpad.net/~kicad-developers
More help   : https://help.launchpad.net/ListHelp


Re: [Kicad-developers] 5.1.3 release

2019-08-05 Thread Frank Severinsen
Hi Eeli

Jeff disabled it during this fix: 


It's reenabled in nightlies, but I'm not sure if the router improvements are 
too big to put in V5.1 branch

Den 5. august 2019 kl. 15.42.16 +02.00, skrev Eeli Kaikkonen 
:

> 
> 
> 
> ma 5. elok. 2019 klo 16.02 Eeli Kaikkonen () 
> kirjoitti:
> 
> > A very quick notice and maybe alert. I just tried 5.1.4-4-g450dac4b1from 
> > Windows testing downloads. I can't drag vias with D. I will test further. 
> > It it's really a bug it may affect 5.1.4.
> > 
> > 
> I'm not sure what this is, but here's a screencast. What I do:
> 1. Press D on a via which is attached to tracks. Nothing seems to happen 
> until the cursor reaches a point where the via can be moved. Before that it 
> looks like non-functioning.
> 2. Press D on a stitching via. It doesn't move and nothing happens. 
> (Previously it was moved, although there was a bug which let it be placed to 
> violated DRC. So, maybe this is on purpose?)
> 3. Press G on a stiching via. It moves. Very good.
> 
> Because none of them was moved when I tried quickly with D I thought there's 
> some problem.
> 
> Ubtp0AruRO.mp4 
> 
> 
> Eeli Kaikkonen
> 
> 
> ___
> Mailing list: 
> Post to : 
> Unsubscribe : 
> More help : 
> 

___
Mailing list: https://launchpad.net/~kicad-developers
Post to : kicad-developers@lists.launchpad.net
Unsubscribe : https://launchpad.net/~kicad-developers
More help   : https://help.launchpad.net/ListHelp


Re: [Kicad-developers] 5.1.3 release

2019-08-05 Thread Eeli Kaikkonen
ma 5. elok. 2019 klo 16.02 Eeli Kaikkonen (eeli.kaikko...@gmail.com)
kirjoitti:

> A very quick notice and maybe alert. I just tried 5.1.4-4-g450dac4b1from
> Windows testing downloads. I can't drag vias with D. I will test further.
> It it's really a bug it may affect 5.1.4.
>
>
I'm not sure what this is, but here's a screencast. What I do:
1. Press D on a via which is attached to tracks. Nothing seems to happen
until the cursor reaches a point where the via can be moved. Before that it
looks like non-functioning.
2. Press D on a stitching via. It doesn't move and nothing happens.
(Previously it was moved, although there was a bug which let it be placed
to violated DRC. So, maybe this is on purpose?)
3. Press G on a stiching via. It moves. Very good.

Because none of them was moved when I tried quickly with D I thought
there's some problem.
 Ubtp0AruRO.mp4


Eeli Kaikkonen
___
Mailing list: https://launchpad.net/~kicad-developers
Post to : kicad-developers@lists.launchpad.net
Unsubscribe : https://launchpad.net/~kicad-developers
More help   : https://help.launchpad.net/ListHelp


Re: [Kicad-developers] 5.1.3 release

2019-08-05 Thread Steven A. Falco
On 8/4/19 6:02 PM, Rene Pöschl wrote:
> On 04/08/2019 19:03, Wayne Stambaugh wrote:
>> Please tag the doc, translation,
>> and library repos to 5.1.4 using the same commit as 5.1.3.  I'll update
>> the release announcement and there will be no official 5.1.3 release.
>> Thank you everyone for your cooperation and patience.
>>
>> Cheers,
>>
>> Wayne
> 
> 
> The library is tagged

Good - as soon as doc and i18n get tagged I'll start a Fedora build.

Steve

___
Mailing list: https://launchpad.net/~kicad-developers
Post to : kicad-developers@lists.launchpad.net
Unsubscribe : https://launchpad.net/~kicad-developers
More help   : https://help.launchpad.net/ListHelp


Re: [Kicad-developers] 5.1.3 release

2019-08-05 Thread Eeli Kaikkonen
su 4. elok. 2019 klo 20.03 Wayne Stambaugh (stambau...@gmail.com) kirjoitti:

>
> I decided to revert all of the commits that contained UI string changes
> and tagged 5.1.4.  It's ugly but it contains the Fedora fix along with
> the update footprint position fix.  I already uploaded the source
> archive and started a 5.1.5 milestone.  Please tag the doc, translation,
> and library repos to 5.1.4 using the same commit as 5.1.3.  I'll update
> the release announcement and there will be no official 5.1.3 release.
> Thank you everyone for your cooperation and patience.
>

A very quick notice and maybe alert. I just tried 5.1.4-4-g450dac4b1from
Windows testing downloads. I can't drag vias with D. I will test further.
It it's really a bug it may affect 5.1.4.

Eeli Kaikkonen
___
Mailing list: https://launchpad.net/~kicad-developers
Post to : kicad-developers@lists.launchpad.net
Unsubscribe : https://launchpad.net/~kicad-developers
More help   : https://help.launchpad.net/ListHelp


Re: [Kicad-developers] [Patch] Fix initialization order for COLOR4D statics

2019-08-05 Thread Wayne Stambaugh
On 8/5/19 5:03 AM, Simon Richter wrote:
> Hi,
> 
> On Mon, Aug 05, 2019 at 10:58:44AM +0200, Ian McInerney wrote:
> 
>> I tracked it down to the fact that COLOR4D has some static colors that were
>> being used to initialize some other static variables in pcbnew's layer
>> widgets. I have moved all the static colors to an initialize on first use
>> paradigm (so now we just call them like a function, e.g.
>> COLOR4D::UNSPECIFIED() ) to fix it.
> 
> Can that be solved by constexpr?
> 
>Simon
> 

I would prefer the constexpr solution if it resolves the issue.  It
certainly would be a much simpler patch.

Wayne

___
Mailing list: https://launchpad.net/~kicad-developers
Post to : kicad-developers@lists.launchpad.net
Unsubscribe : https://launchpad.net/~kicad-developers
More help   : https://help.launchpad.net/ListHelp


[Kicad-developers] [Patch] Move pcbnew layer toolbar icon values to member struct

2019-08-05 Thread Ian McInerney
This patch moves the static variables in the toolbar icon creation function
into a member struct of the PCB_EDIT_FRAME class. These statics had posed
some issues on Linux before, and are also not very good for having multiple
PCB_EDIT_FRAME instances at one time.

This patch is dependent upon the prior patch I just sent to fix the
initialization of the COLOR4D static variables.
From ee05e8c32b789d72d95df422b0d6d71ae78bd0f8 Mon Sep 17 00:00:00 2001
From: Ian McInerney 
Date: Mon, 5 Aug 2019 12:16:32 +0200
Subject: [PATCH] pcbnew: Move layer toolbar icon previous values to struct

The static variables posed problems on Linux, and also were
not as portable for multiple instances of PCB_EDIT_FRAME.
---
 pcbnew/pcb_edit_frame.h| 26 ++
 pcbnew/toolbars_pcb_editor.cpp | 33 +
 2 files changed, 39 insertions(+), 20 deletions(-)

diff --git a/pcbnew/pcb_edit_frame.h b/pcbnew/pcb_edit_frame.h
index f246160bf..1dee81613 100644
--- a/pcbnew/pcb_edit_frame.h
+++ b/pcbnew/pcb_edit_frame.h
@@ -109,6 +109,32 @@ protected:
 
 wxString  m_lastPath[ LAST_PATH_SIZE ];
 
+
+/**
+ * Store the previous layer toolbar icon state information
+ */
+struct LAYER_TOOLBAR_ICON_VALUES
+{
+int previous_requested_scale;
+COLOR4D previous_active_layer_color;
+COLOR4D previous_Route_Layer_TOP_color;
+COLOR4D previous_Route_Layer_BOTTOM_color;
+COLOR4D previous_via_color;
+COLOR4D previous_background_color;
+
+LAYER_TOOLBAR_ICON_VALUES()
+: previous_requested_scale( 0 ),
+  previous_active_layer_color( COLOR4D::UNSPECIFIED() ),
+  previous_Route_Layer_TOP_color( COLOR4D::UNSPECIFIED() ),
+  previous_Route_Layer_BOTTOM_color( COLOR4D::UNSPECIFIED() ),
+  previous_via_color( COLOR4D::UNSPECIFIED() ),
+  previous_background_color( COLOR4D::UNSPECIFIED() )
+{
+}
+};
+
+LAYER_TOOLBAR_ICON_VALUES m_prevIconVal;
+
 // The Tool Framework initalization
 void setupTools();
 
diff --git a/pcbnew/toolbars_pcb_editor.cpp b/pcbnew/toolbars_pcb_editor.cpp
index abad13918..d8b0edab4 100644
--- a/pcbnew/toolbars_pcb_editor.cpp
+++ b/pcbnew/toolbars_pcb_editor.cpp
@@ -90,60 +90,53 @@ void PCB_EDIT_FRAME::PrepareLayerIndicator( bool aForceRebuild )
 COLOR4Dactive_layer_color, top_color, bottom_color, via_color, background_color;
 bool   change = aForceRebuild;
 
-static int previous_requested_scale;
-static COLOR4D previous_active_layer_color = COLOR4D::UNSPECIFIED();
-static COLOR4D previous_Route_Layer_TOP_color = COLOR4D::UNSPECIFIED();
-static COLOR4D previous_Route_Layer_BOTTOM_color = COLOR4D::UNSPECIFIED();
-static COLOR4D previous_via_color = COLOR4D::UNSPECIFIED();
-static COLOR4D previous_background_color = COLOR4D::UNSPECIFIED();
-
 int requested_scale;
 Pgm().CommonSettings()->Read( ICON_SCALE_KEY, _scale, 0 );
 
-if( requested_scale != previous_requested_scale )
+if( m_prevIconVal.previous_requested_scale != requested_scale )
 {
-previous_requested_scale = requested_scale;
+m_prevIconVal.previous_requested_scale = requested_scale;
 change = true;
 }
 
-active_layer_color = Settings().Colors().GetLayerColor(GetActiveLayer());
+active_layer_color = Settings().Colors().GetLayerColor( GetActiveLayer() );
 
-if( previous_active_layer_color != active_layer_color )
+if( m_prevIconVal.previous_active_layer_color != active_layer_color )
 {
-previous_active_layer_color = active_layer_color;
+m_prevIconVal.previous_active_layer_color = active_layer_color;
 change = true;
 }
 
 top_color = Settings().Colors().GetLayerColor( GetScreen()->m_Route_Layer_TOP );
 
-if( previous_Route_Layer_TOP_color != top_color )
+if( m_prevIconVal.previous_Route_Layer_TOP_color != top_color )
 {
-previous_Route_Layer_TOP_color = top_color;
+m_prevIconVal.previous_Route_Layer_TOP_color = top_color;
 change = true;
 }
 
 bottom_color = Settings().Colors().GetLayerColor( GetScreen()->m_Route_Layer_BOTTOM );
 
-if( previous_Route_Layer_BOTTOM_color != bottom_color )
+if( m_prevIconVal.previous_Route_Layer_BOTTOM_color != bottom_color )
 {
-previous_Route_Layer_BOTTOM_color = bottom_color;
+m_prevIconVal.previous_Route_Layer_BOTTOM_color = bottom_color;
 change = true;
 }
 
 int via_type = GetDesignSettings().m_CurrentViaType;
 via_color = Settings().Colors().GetItemColor( LAYER_VIAS + via_type );
 
-if( previous_via_color != via_color )
+if( m_prevIconVal.previous_via_color != via_color )
 {
-previous_via_color = via_color;
+m_prevIconVal.previous_via_color = via_color;
 change = true;
 }
 
 background_color = 

Re: [Kicad-developers] [Patch] Fix initialization order for COLOR4D statics

2019-08-05 Thread Ian McInerney
Forgot that I split the updating the widget into a separate commit. Here is
an updated patch that just fixes the initialization (I updated the message).

-Ian

On Mon, Aug 5, 2019 at 10:58 AM Ian McInerney 
wrote:

> I decided to instrument my debug build with the address sanitizer and see
> what happened, and it has pointed out an initialization order fiasco in the
> loading of pcbnew.
>
> I tracked it down to the fact that COLOR4D has some static colors that
> were being used to initialize some other static variables in pcbnew's layer
> widgets. I have moved all the static colors to an initialize on first use
> paradigm (so now we just call them like a function, e.g.
> COLOR4D::UNSPECIFIED() ) to fix it.
>
> Also, this patch cleans up the layer toolbar button creation by moving all
> the statics into a member struct (this was done by Jeff as the fix in 5.1).
>
> -Ian
>
From 6f369328b3e4c3a66117a08d4e10736bfb081268 Mon Sep 17 00:00:00 2001
From: Ian McInerney 
Date: Mon, 5 Aug 2019 10:51:29 +0200
Subject: [PATCH] Fix initialization of COLOR4D statics

The previous implementation would give an initialization order
fiasco since they were being used to initialize other statics.
This moves them to an initialize on first use paradigm.
---
 .../3d_canvas/create_3Dgraphic_brd_items.cpp  |  2 +-
 common/board_printout.cpp |  4 ++--
 common/colors_design_settings.cpp |  4 ++--
 common/eda_draw_frame.cpp |  2 +-
 common/eda_text.cpp   |  2 +-
 common/gal/cairo/cairo_gal.cpp|  2 +-
 common/gal/color4d.cpp|  6 +
 common/gal/opengl/antialiasing.cpp| 10 
 common/gal/opengl/opengl_compositor.cpp   |  2 +-
 common/gal/opengl/opengl_gal.cpp  |  2 +-
 common/gr_basic.cpp   |  8 +++
 common/plotters/DXF_plotter.cpp   | 10 +++-
 common/plotters/PS_plotter.cpp|  2 +-
 common/plotters/common_plot_functions.cpp |  4 ++--
 common/widgets/color_swatch.cpp   |  4 ++--
 common/widgets/layer_box_selector.cpp |  2 +-
 eeschema/dialogs/dialog_edit_line_style.cpp   |  6 ++---
 .../dialogs/dialog_print_using_printer.cpp|  4 ++--
 eeschema/eeschema.cpp |  6 ++---
 eeschema/lib_text.cpp |  2 +-
 eeschema/sch_line.cpp | 16 ++---
 eeschema/sch_sheet.cpp|  2 +-
 .../widgets/widget_eeschema_color_config.cpp  |  6 ++---
 gerbview/gbr_display_options.h|  2 +-
 gerbview/gerbview_frame.cpp   |  2 +-
 gerbview/gerbview_layer_widget.cpp|  2 +-
 gerbview/gerbview_painter.cpp |  2 +-
 include/eda_draw_frame.h  |  2 +-
 include/gal/color4d.h | 24 +++
 include/msgpanel.h|  2 +-
 include/plotter.h |  4 ++--
 ...board_items_to_polygon_shape_transform.cpp |  2 +-
 pcbnew/dialogs/dialog_pad_properties.cpp  |  2 +-
 pcbnew/exporters/export_vrml.cpp  |  2 +-
 pcbnew/exporters/gen_drill_report_files.cpp   |  4 ++--
 pcbnew/layer_widget.cpp   |  6 ++---
 pcbnew/layer_widget.h | 11 +
 pcbnew/pad_print_functions.cpp|  6 ++---
 pcbnew/pcb_layer_widget.cpp   |  4 ++--
 pcbnew/pcbnew_printout.cpp|  6 ++---
 pcbnew/plot_board_layers.cpp  |  8 ---
 pcbnew/plot_brditems_plotter.cpp  |  4 ++--
 pcbnew/toolbars_pcb_editor.cpp| 10 
 pcbnew/tools/zone_create_helper.cpp   |  2 +-
 qa/eeschema/mocks_eeschema.cpp|  4 ++--
 .../test_gal_pixel_alignment.cpp  |  2 +-
 46 files changed, 116 insertions(+), 105 deletions(-)

diff --git a/3d-viewer/3d_canvas/create_3Dgraphic_brd_items.cpp b/3d-viewer/3d_canvas/create_3Dgraphic_brd_items.cpp
index 737297ef0..c3faeb9b2 100644
--- a/3d-viewer/3d_canvas/create_3Dgraphic_brd_items.cpp
+++ b/3d-viewer/3d_canvas/create_3Dgraphic_brd_items.cpp
@@ -106,7 +106,7 @@ void CINFO3D_VISU::AddShapeWithClearanceToContainer( const TEXTE_PCB* aText,
 s_boardBBox3DU = _board2dBBox3DU;
 
 // not actually used, but needed by GRText
-const COLOR4D dummy_color = COLOR4D::BLACK;
+const COLOR4D dummy_color = COLOR4D::BLACK();
 
 if( aText->IsMultilineAllowed() )
 {
diff --git a/common/board_printout.cpp b/common/board_printout.cpp
index dfc7e9725..7ab909090 100644
--- a/common/board_printout.cpp
+++ b/common/board_printout.cpp
@@ -114,7 +114,7 @@ void BOARD_PRINTOUT::DrawPage( const wxString& aLayerName, int aPageNum, int aPa
 if( m_settings.m_blackWhite )
 {
 for( int i = 0; i < LAYER_ID_COUNT; ++i )
-dstSettings->SetLayerColor( i, COLOR4D::BLACK );
+

Re: [Kicad-developers] [Patch] Fix initialization order for COLOR4D statics

2019-08-05 Thread Simon Richter
Hi,

On Mon, Aug 05, 2019 at 10:58:44AM +0200, Ian McInerney wrote:

> I tracked it down to the fact that COLOR4D has some static colors that were
> being used to initialize some other static variables in pcbnew's layer
> widgets. I have moved all the static colors to an initialize on first use
> paradigm (so now we just call them like a function, e.g.
> COLOR4D::UNSPECIFIED() ) to fix it.

Can that be solved by constexpr?

   Simon

___
Mailing list: https://launchpad.net/~kicad-developers
Post to : kicad-developers@lists.launchpad.net
Unsubscribe : https://launchpad.net/~kicad-developers
More help   : https://help.launchpad.net/ListHelp


[Kicad-developers] [Patch] Fix initialization order for COLOR4D statics

2019-08-05 Thread Ian McInerney
I decided to instrument my debug build with the address sanitizer and see
what happened, and it has pointed out an initialization order fiasco in the
loading of pcbnew.

I tracked it down to the fact that COLOR4D has some static colors that were
being used to initialize some other static variables in pcbnew's layer
widgets. I have moved all the static colors to an initialize on first use
paradigm (so now we just call them like a function, e.g.
COLOR4D::UNSPECIFIED() ) to fix it.

Also, this patch cleans up the layer toolbar button creation by moving all
the statics into a member struct (this was done by Jeff as the fix in 5.1).

-Ian
From 3c63160bea386a08f169d0bde4680804fad037e1 Mon Sep 17 00:00:00 2001
From: Ian McInerney 
Date: Mon, 5 Aug 2019 10:51:29 +0200
Subject: [PATCH] Fix initialization of COLOR4D statics

The previous implementation would give an initialization order
fiasco since they were being used to initialize other statics.
This moves them to an initialize on first use paradigm.

Also move the statics in the layer toolbar button creation into
a member struct.
---
 .../3d_canvas/create_3Dgraphic_brd_items.cpp  |  2 +-
 common/board_printout.cpp |  4 ++--
 common/colors_design_settings.cpp |  4 ++--
 common/eda_draw_frame.cpp |  2 +-
 common/eda_text.cpp   |  2 +-
 common/gal/cairo/cairo_gal.cpp|  2 +-
 common/gal/color4d.cpp|  6 +
 common/gal/opengl/antialiasing.cpp| 10 
 common/gal/opengl/opengl_compositor.cpp   |  2 +-
 common/gal/opengl/opengl_gal.cpp  |  2 +-
 common/gr_basic.cpp   |  8 +++
 common/plotters/DXF_plotter.cpp   | 10 +++-
 common/plotters/PS_plotter.cpp|  2 +-
 common/plotters/common_plot_functions.cpp |  4 ++--
 common/widgets/color_swatch.cpp   |  4 ++--
 common/widgets/layer_box_selector.cpp |  2 +-
 eeschema/dialogs/dialog_edit_line_style.cpp   |  6 ++---
 .../dialogs/dialog_print_using_printer.cpp|  4 ++--
 eeschema/eeschema.cpp |  6 ++---
 eeschema/lib_text.cpp |  2 +-
 eeschema/sch_line.cpp | 16 ++---
 eeschema/sch_sheet.cpp|  2 +-
 .../widgets/widget_eeschema_color_config.cpp  |  6 ++---
 gerbview/gbr_display_options.h|  2 +-
 gerbview/gerbview_frame.cpp   |  2 +-
 gerbview/gerbview_layer_widget.cpp|  2 +-
 gerbview/gerbview_painter.cpp |  2 +-
 include/eda_draw_frame.h  |  2 +-
 include/gal/color4d.h | 24 +++
 include/msgpanel.h|  2 +-
 include/plotter.h |  4 ++--
 ...board_items_to_polygon_shape_transform.cpp |  2 +-
 pcbnew/dialogs/dialog_pad_properties.cpp  |  2 +-
 pcbnew/exporters/export_vrml.cpp  |  2 +-
 pcbnew/exporters/gen_drill_report_files.cpp   |  4 ++--
 pcbnew/layer_widget.cpp   |  6 ++---
 pcbnew/layer_widget.h | 11 +
 pcbnew/pad_print_functions.cpp|  6 ++---
 pcbnew/pcb_layer_widget.cpp   |  4 ++--
 pcbnew/pcbnew_printout.cpp|  6 ++---
 pcbnew/plot_board_layers.cpp  |  8 ---
 pcbnew/plot_brditems_plotter.cpp  |  4 ++--
 pcbnew/toolbars_pcb_editor.cpp| 10 
 pcbnew/tools/zone_create_helper.cpp   |  2 +-
 qa/eeschema/mocks_eeschema.cpp|  4 ++--
 .../test_gal_pixel_alignment.cpp  |  2 +-
 46 files changed, 116 insertions(+), 105 deletions(-)

diff --git a/3d-viewer/3d_canvas/create_3Dgraphic_brd_items.cpp b/3d-viewer/3d_canvas/create_3Dgraphic_brd_items.cpp
index 737297ef0..c3faeb9b2 100644
--- a/3d-viewer/3d_canvas/create_3Dgraphic_brd_items.cpp
+++ b/3d-viewer/3d_canvas/create_3Dgraphic_brd_items.cpp
@@ -106,7 +106,7 @@ void CINFO3D_VISU::AddShapeWithClearanceToContainer( const TEXTE_PCB* aText,
 s_boardBBox3DU = _board2dBBox3DU;
 
 // not actually used, but needed by GRText
-const COLOR4D dummy_color = COLOR4D::BLACK;
+const COLOR4D dummy_color = COLOR4D::BLACK();
 
 if( aText->IsMultilineAllowed() )
 {
diff --git a/common/board_printout.cpp b/common/board_printout.cpp
index dfc7e9725..7ab909090 100644
--- a/common/board_printout.cpp
+++ b/common/board_printout.cpp
@@ -114,7 +114,7 @@ void BOARD_PRINTOUT::DrawPage( const wxString& aLayerName, int aPageNum, int aPa
 if( m_settings.m_blackWhite )
 {
 for( int i = 0; i < LAYER_ID_COUNT; ++i )
-dstSettings->SetLayerColor( i, COLOR4D::BLACK );
+dstSettings->SetLayerColor( i, COLOR4D::BLACK() );
 }
 else // color enabled
 {
@@ -196,7 +196,7 @@ void BOARD_PRINTOUT::setupViewLayers( const std::unique_ptr& aView,
 

Re: [Kicad-developers] [PATCH] Crash Reporter

2019-08-05 Thread Nick Østergaard
Ok, thanks. Just a note, there are two packages for msys2
mingw-packages that provided.

I see you based your pkgbuild on the 3.0 one...

On Thu, 1 Aug 2019 at 17:01, Tomasz Wlostowski
 wrote:
>
> On 30/07/2019 20:03, Nick Østergaard wrote:
> > I get the same error. :(
> >
>
> Hi Nick,
>
> We had two problems:
> - wrong check macro (I removed it in the last commit from my branch)
> - wrong build of wx (must be configured with --enable-backtrace - fixed
> PKGBUILD in the attachment).
>
> Latest code here:
> https://github.com/twlostow/kicad-dev/tree/tom-crash-reporter-aug01
>
> Cheers,
> Tom

___
Mailing list: https://launchpad.net/~kicad-developers
Post to : kicad-developers@lists.launchpad.net
Unsubscribe : https://launchpad.net/~kicad-developers
More help   : https://help.launchpad.net/ListHelp