Author Topic: Commit 6241 candidate to be partly reverted ?  (Read 12140 times)

Offline Jenna

  • Administrator
  • Lives here!
  • *****
  • Posts: 7255
Commit 6241 candidate to be partly reverted ?
« on: January 11, 2011, 05:49:21 pm »
Because nobody has answered in one of the both threads below, I start a new one.

The bug described in the second thread (changing all default ID's of local declared controls to wxID_ANY) can be quite confusing and might not be recognized at first sight.
What's more it forces the developer to touch all ID's of local stored controls, that have events (annoying and time consuming).

http://forums.codeblocks.org/index.php/topic,12345.msg94192.html#msg94192
http://forums.codeblocks.org/index.php/topic,14003.msg94191.html#msg94191

Offline thomas

  • Administrator
  • Lives here!
  • *****
  • Posts: 3979
Re: Commit 6241 candidate to be partly reverted ?
« Reply #1 on: January 11, 2011, 08:17:13 pm »
That is about wxSmith only, right? So should Byo not be the one who decides, since he's probably the one who knows best?

EDIT: Though I see that he's not been reading the forum for 7 months :(
« Last Edit: January 11, 2011, 08:19:45 pm by thomas »
"We should forget about small efficiencies, say about 97% of the time: Premature quotation is the root of public humiliation."

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9694
Re: Commit 6241 candidate to be partly reverted ?
« Reply #2 on: January 11, 2011, 08:18:13 pm »
Because nobody has answered in one of the both threads below, I start a new one.
I wanted to try this myself because I had the same case as Loaden described many times in other projects. That's why I thought it is useful. However, for menus I usually define my own ID's and do not let them have auto-generated. If I got you right that this would be changed on the fly which is of course not what's intended. However, if I set an ID to be a member I usually explicitly want to use the ID. If it is not set to "member" then I personally do not use it at all. That's why the concept of Loaden's patch works well for me.

However, I see the point when it would not work and in fact changing "is member" multiple times is not what I did and if it causes hassle that that's not what we want.

So I would agree to filter by type, but would suggest to leave the types as an option, including "all" and "none". That would provide most flexibility, but also causes most change (I know).
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: https://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: https://wiki.codeblocks.org/index.php?title=FAQ

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9694
Re: Commit 6241 candidate to be partly reverted ?
« Reply #3 on: January 11, 2011, 08:19:04 pm »
That is about wxSmith only, right? So should Byo not be the one who decides, since he's probably the one who knows best?
Yes, but Byo has literally retired since ages, so I'm afraid the decision is up to us.
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: https://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: https://wiki.codeblocks.org/index.php?title=FAQ

Offline Jenna

  • Administrator
  • Lives here!
  • *****
  • Posts: 7255
Re: Commit 6241 candidate to be partly reverted ?
« Reply #4 on: January 11, 2011, 09:21:31 pm »
For menuitems and at least tools in a toolbar it makes no sense to keep them as member, because the menubar or the toolbar owns them after they have been added to it.
And there is no need to use "own" Id's for them (even if I also prefer to have meaningful names), but it's not up to an IDE to force the user to use a special programming style.

Offline Jenna

  • Administrator
  • Lives here!
  • *****
  • Posts: 7255
Re: Commit 6241 candidate to be partly reverted ?
« Reply #5 on: January 11, 2011, 09:41:26 pm »
Here comes a simple patch, that only changes the ID, if the control is local and has no events (registered in wxSmith):

Code
--- codeblocks.trunk/src/plugins/contrib/wxSmith/wxwidgets/wxscorrector.cpp 
+++ codeblocks.trunk/src/plugins/contrib/wxSmith/wxwidgets/wxscorrector.cpp
@@ -207,7 +207,8 @@
         }
     }
 
-    if ( Item->GetPropertiesFlags() & flLocal )
+    if ( (Item->GetPropertiesFlags() & flLocal) &&
+         ((Item->GetEvents().GetCount()) <= 0) )
     {
         wxString prefix = s_IdPrefix;
         prefix << Item->GetInfo().DefaultVarName.Upper();

This is most likley the simplest solution (but without additional configuration and therefore a little less flexibility).

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9694
Re: Commit 6241 candidate to be partly reverted ?
« Reply #6 on: January 12, 2011, 07:03:53 am »
Code
--- codeblocks.trunk/src/plugins/contrib/wxSmith/wxwidgets/wxscorrector.cpp 
+++ codeblocks.trunk/src/plugins/contrib/wxSmith/wxwidgets/wxscorrector.cpp
@@ -207,7 +207,8 @@
         }
     }
 
-    if ( Item->GetPropertiesFlags() & flLocal )
+    if ( (Item->GetPropertiesFlags() & flLocal) &&
+         ((Item->GetEvents().GetCount()) <= 0) )
     {
         wxString prefix = s_IdPrefix;
         prefix << Item->GetInfo().DefaultVarName.Upper();
This is most likley the simplest solution (but without additional configuration and therefore a little less flexibility).
OK, I'll try. BTW: I would like to open an wxSmith branch to allow certain other extensions for testing. I've still a couple of controls for wxSmith not yet committed. However, the build systems for these is not tested at all and probably wrong. So I'll open a branch accordingly and this would be commit there, too... OK?
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: https://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: https://wiki.codeblocks.org/index.php?title=FAQ

Offline Jenna

  • Administrator
  • Lives here!
  • *****
  • Posts: 7255
Re: Commit 6241 candidate to be partly reverted ?
« Reply #7 on: January 12, 2011, 07:24:58 am »
BTW: I would like to open an wxSmith branch to allow certain other extensions for testing. I've still a couple of controls for wxSmith not yet committed. However, the build systems for these is not tested at all and probably wrong. So I'll open a branch accordingly and this would be commit there, too... OK?

Yes !

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9694
Re: Commit 6241 candidate to be partly reverted ?
« Reply #8 on: January 12, 2011, 07:32:27 am »
Yes !
branch is done, commit at will. I'll do the same whenever I find the time...
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: https://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: https://wiki.codeblocks.org/index.php?title=FAQ

Offline Jenna

  • Administrator
  • Lives here!
  • *****
  • Posts: 7255
Re: Commit 6241 candidate to be partly reverted ?
« Reply #9 on: February 07, 2011, 01:50:39 pm »
It's (possibly) brought up by a user again: http://forums.codeblocks.org/index.php/topic,14178.msg95264.html#msg95264

What about commiting the fix I posted some posts above.

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9694
Re: Commit 6241 candidate to be partly reverted ?
« Reply #10 on: February 07, 2011, 01:59:24 pm »
What about commiting the fix I posted some posts above.
Go ahead! In fact I had applied the patch since that day but forgot about it. However, it doesn't seem to hurt my "daily" use of wxSmith. So no objections. :-)
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: https://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: https://wiki.codeblocks.org/index.php?title=FAQ

Offline Jenna

  • Administrator
  • Lives here!
  • *****
  • Posts: 7255
Re: Commit 6241 candidate to be partly reverted ?
« Reply #11 on: February 07, 2011, 02:26:06 pm »
What about commiting the fix I posted some posts above.
Go ahead! In fact I had applied the patch since that day but forgot about it. However, it doesn't seem to hurt my "daily" use of wxSmith. So no objections. :-)
Done in svn r6972 !

Offline vid512

  • Multiple posting newcomer
  • *
  • Posts: 36
Re: Commit 6241 candidate to be partly reverted ?
« Reply #12 on: December 31, 2011, 04:17:03 pm »
You can now input multiple "wxID_ANY", but you can't input multiple "-1" (even though first "-1" gets rightly fixed to wxID_ANY). I think it would be nice to save few keypressed with allowing "-1" even when it isn't the first one.

(using Codeblocks rev 7639 from jenslody repo on Ubuntu 11.10 32-bit w/ fluxbox)