Author Topic: wrap char mode feature added for Editor Tweak plugin  (Read 23395 times)

Offline dmoore

  • Developer
  • Lives here!
  • *****
  • Posts: 1576
Re: wrap char mode feature added for Editor Tweak plugin
« Reply #15 on: October 04, 2013, 12:31:04 am »
where is the patch?

Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 5226
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: wrap char mode feature added for Editor Tweak plugin
« Reply #16 on: October 04, 2013, 03:23:23 am »
This is often a problem with GTK so I assumed it would also be a problem with wxGTK. If you are sure it isn't then go ahead and remove it.
Ok, I asked this question on wx forums, and some one give me the reply, Re: wxMenu Check() cause event handler to be called?, now I need some one help to give me the result on Linux. BTW: I do have have a Linux system.
Ping, any one can test this on Linux, thanks.
@dmoore
Testing this under wxGTK don't need any patches, you just open the EditorTweak source, and set a breakpoint in any menu item event handler. Then you need to open two editors, change one menu item status. Now, you can swith between two editors, and the menu item status will change after the swith, you need to see wether the event handler will be called after the swith. If yes, this means we need m_isUpdatingUI. This means programmatically change the menu item status will cause its event handler be called.
If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.

Offline dmoore

  • Developer
  • Lives here!
  • *****
  • Posts: 1576
Re: wrap char mode feature added for Editor Tweak plugin
« Reply #17 on: October 04, 2013, 06:22:58 pm »
Ok, seems to work fine without the m_isUpdatingUI check. Go ahead and commit your change.

Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 5226
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: wrap char mode feature added for Editor Tweak plugin
« Reply #18 on: October 06, 2013, 12:48:29 pm »
Ok, seems to work fine without the m_isUpdatingUI check. Go ahead and commit your change.
Thank you for testing.
Committed in r9382, I also did some code clean up. Please adjust if I did something wrong. :)
If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.

Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 5226
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: wrap char mode feature added for Editor Tweak plugin
« Reply #19 on: October 06, 2013, 02:36:48 pm »
BTW: I see the same EVT_UPDATE_UI issue in Editor Tweak Plugin. By search the forum, I found that it was discussed several years ago in Re: wxUpdateUIEvent performance issues.

My idea is the same as Jens said, if we bind same function to many menu items. The function will be called many times for each menu item.

Oh, here is new idea: can we set a timer in the update function(maybe a static member variable to remember the time stamp the function was called), then check if we have already called the function in 100ms, we can simply return from the function to avoid the redundant/unnecessary updates.
If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.

Offline dmoore

  • Developer
  • Lives here!
  • *****
  • Posts: 1576
Re: wrap char mode feature added for Editor Tweak plugin
« Reply #20 on: October 06, 2013, 03:00:26 pm »
I think (but may be misremembering) we fixed a pretty major bug in wxScintilla that was generating a lot of UpdateUI messages. So while it's probably inefficient to have so many handlers for the same event I don't think the performance penalty is all that bad because there is an order of magnitude fewer calls. Fine if you want to combine the handlers, but I personally would seek out some other solution than a timer. (Adding latency as a workaround sucks!)
« Last Edit: October 06, 2013, 04:26:53 pm by dmoore »

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 11939
    • Travis build status
Re: wrap char mode feature added for Editor Tweak plugin
« Reply #21 on: October 06, 2013, 03:25:57 pm »
But is it a performance problem? You know first rule of optimisations, right? Measure before doing anything...
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline gd_on

  • Regular
  • ***
  • Posts: 468
Re: wrap char mode feature added for Editor Tweak plugin
« Reply #22 on: October 06, 2013, 06:41:49 pm »
SVN 9382 has a problem for me on Windows.
C::B starts, but is not able to load a project: it hangs and I have to kill C::B.
If I disable Editor Tweaks, my project can be loaded.
This problem does not happen with svn 9380 (I have not tried svn 9381)

gd_on
Windows 10 or 7, svn C::B (last version or almost!), WxWidgets 3.1.2, Compilers 8.1.0, 32 bits (sjlj, posix : gcc and gfortran installed in C:\MinGW32) or 64 bits by Compilers 8.1.0 (seh, posix : in C:\MinGW64).

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 11939
    • Travis build status
Re: wrap char mode feature added for Editor Tweak plugin
« Reply #23 on: October 06, 2013, 07:30:03 pm »
Are you sure you've rebuild it correctly?

This is the main discussion about this commit: http://forums.codeblocks.org/index.php/topic,18358.msg125852/topicseen.html#msg125852

@admins: Please move these posts there.
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9496
Re: wrap char mode feature added for Editor Tweak plugin
« Reply #24 on: October 06, 2013, 07:40:33 pm »
@admins: Please move these posts there.
Done.
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: http://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: http://wiki.codeblocks.org/index.php?title=FAQ

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9496
Re: wrap char mode feature added for Editor Tweak plugin
« Reply #25 on: October 06, 2013, 08:20:16 pm »
C::B starts, but is not able to load a project: it hangs and I have to kill C::B.
If I disable Editor Tweaks, my project can be loaded.
Even worse for me: C::B crashes immediately on startup not leaving any debug log if I leave the editortweaks plugin enabled. It works fine when disabling (removing) this plugin.
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: http://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: http://wiki.codeblocks.org/index.php?title=FAQ

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 11939
    • Travis build status
Re: wrap char mode feature added for Editor Tweak plugin
« Reply #26 on: October 06, 2013, 08:23:54 pm »
Should be fixed in trunk.

@devs: Please add -Werror=return-type in your global compiler settings, it makes life a lot easier :)
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 5226
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: wrap char mode feature added for Editor Tweak plugin
« Reply #27 on: October 06, 2013, 09:01:18 pm »
Should be fixed in trunk.

@devs: Please add -Werror=return-type in your global compiler settings, it makes life a lot easier :)
Thank you for fixing this.
I am sorry about this error commit.
If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9496
Re: wrap char mode feature added for Editor Tweak plugin
« Reply #28 on: October 06, 2013, 09:53:51 pm »
Should be fixed in trunk.
I'm afraid not - its still crashing for me. ???
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: http://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: http://wiki.codeblocks.org/index.php?title=FAQ

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9496
Re: wrap char mode feature added for Editor Tweak plugin
« Reply #29 on: October 06, 2013, 10:05:24 pm »
I'm afraid not - its still crashing for me. ???
OK - now it should be REALLY fixed.

The reason was a exception diue to the call of UpdateUI which calls the SDK function to obtain an editor before the plugin is actually attached.
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: http://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: http://wiki.codeblocks.org/index.php?title=FAQ