Re: [Kicad-developers] wxWidgets Event Tables or Bind and lambdas

2019-07-15 Thread Wayne Stambaugh
On 7/12/2019 8:46 AM, Simon Richter wrote: > Hi, > > My layout would be > > m_footprintListBox->Bind( wxEVT_RIGHT_DOWN, > [this]( wxMouseEvent& ) > { > this->PopupMenu( this->m_footprintContextMenu ); > } ); I like the way this looks compared to the other

Re: [Kicad-developers] wxWidgets Event Tables or Bind and lambdas

2019-07-15 Thread Wayne Stambaugh
Ian, I would prefer that we not mix event handling styles unless there is a good reason such as dynamically binding/unbinding for adding temporary event handling. For new code, I'm fine with either method with the caveat that all of the Bind calls be defined in the same function rather than

Re: [Kicad-developers] wxWidgets Event Tables or Bind and lambdas

2019-07-12 Thread Seth Hillbrand
On 2019-07-12 08:29, Jeff Young wrote: These are currently reasonably common in the code: 1) m_footprintListBox->Bind( wxEVT_RIGHT_DOWN, [this]( wxMouseEvent& ) { this->PopupMenu( this->m_footprintContextMenu ); } ); 2) m_footprintListBox->Bind( wxEVT_RIGHT_DOWN, [this]( wxMouseEvent& )

Re: [Kicad-developers] wxWidgets Event Tables or Bind and lambdas

2019-07-12 Thread Simon Richter
Hi, > I prefer the way Simon has it formatted, since the lambda follows the > general function formatting guidelines. I am indifferent to the grouping of > arguments around it though, and the clang-format script would seem to > prefer doing it this way: > function( arg1, arg2, arg3, arg4, arg5,

Re: [Kicad-developers] wxWidgets Event Tables or Bind and lambdas

2019-07-12 Thread Ian McInerney
I prefer the way Simon has it formatted, since the lambda follows the general function formatting guidelines. I am indifferent to the grouping of arguments around it though, and the clang-format script would seem to prefer doing it this way: function( arg1, arg2, arg3, arg4, arg5, arg6,

Re: [Kicad-developers] wxWidgets Event Tables or Bind and lambdas

2019-07-12 Thread Simon Richter
Hi, My layout would be m_footprintListBox->Bind( wxEVT_RIGHT_DOWN, [this]( wxMouseEvent& ) { this->PopupMenu( this->m_footprintContextMenu ); } ); Rationale: - it follows the "indent twice for round parentheses" rule - the lambda begins on the first

Re: [Kicad-developers] wxWidgets Event Tables or Bind and lambdas

2019-07-12 Thread Jeff Young
These are currently reasonably common in the code: 1) m_footprintListBox->Bind( wxEVT_RIGHT_DOWN, [this]( wxMouseEvent& ) { this->PopupMenu( this->m_footprintContextMenu ); } ); 2) m_footprintListBox->Bind( wxEVT_RIGHT_DOWN, [this]( wxMouseEvent& ) {

Re: [Kicad-developers] wxWidgets Event Tables or Bind and lambdas

2019-07-12 Thread Ian McInerney
The higher SNR was one reason why I was thinking of switching the handlers over to them, since then we don't need the separate function declaration/function body, and it also makes it clearer what the actions do. For instance this is one that I have added during my work on cvpcb for the context

Re: [Kicad-developers] wxWidgets Event Tables or Bind and lambdas

2019-07-12 Thread Jeff Young
We already have a lot of classes which use both. FWIW, the wxWidgets folks encourage Bind. As for lamdas, I think they’re pretty rare (for this use) in the code at present. But they do appear to result in a higher signal-to-noise ratio for very short handlers. While we’re on the subject, we

Re: [Kicad-developers] wxWidgets Event Tables or Bind and lambdas

2019-07-12 Thread Simon Richter
Hi, On Fri, Jul 12, 2019 at 11:11:21AM +0200, Ian McInerney wrote: > Other windows seem to use the Bind method with lambda functions for these > small functions, and I have used them as well for some new bindings for the > actionization when needed. My main question is, is it acceptable to also

[Kicad-developers] wxWidgets Event Tables or Bind and lambdas

2019-07-12 Thread Ian McInerney
This is mainly a code style/implementation question about what should be used going forward. I am in the process of going through CVPCB and converting it to actions, and also implementing the copy/paste/delete/undo/redo features. This necessitates changes to the event table (mainly removal of