Code::Blocks Forums

User forums => Using Code::Blocks => Topic started by: jumafra on January 16, 2008, 11:33:50 pm

Title: Files modified externally not refreshed
Post by: jumafra on January 16, 2008, 11:33:50 pm
Hello,

I have some post-build commands that create/replace a log file which I have open on C::B editor.
After build process ends, the file isn't refreshed/reloaded, unless C::B looses and regains focus.
Would it be possible to have it reload files which are modified externally immediatly?
Regards,
Juan.

edit:
Using Rev 4820 on WinXP SP2
Title: Re: Files modified externally not refreshed
Post by: MortenMacFly on January 17, 2008, 01:19:25 pm
Would it be possible to have it reload files which are modified externally immediatly?
This is rather unlikely.
Becasue that would require polling all files "permanently" for modification. I guess that's not desired. Currently the modification check is bound to when the editor gets activated again. At that time it's most likely the user wold like to really modify the file. So to avoid conflicts the question is raised there at minimal (computing) cost.
Title: Re: Files modified externally not refreshed
Post by: MortenMacFly on January 17, 2008, 01:20:32 pm
Anyways: I guess it could be easy to implement as a plugin - something like a menu entry "refresh all open editors". A very simple (5-liner or so ;-)) C::B plugin.
Title: Re: Files modified externally not refreshed
Post by: jumafra on January 18, 2008, 03:12:47 am
Currently the modification check is bound to when the editor gets activated again.
Right now C::B itself has to loose focus for the file(s) to be refreshed. Wouldn't it be better to poll open files when switching editor tabs?.
Title: Re: Files modified externally not refreshed
Post by: thomas on January 18, 2008, 09:29:36 am
That might work, but then we'd probably have people working on notebooks complain that the CPU fan spins up every time. Not sure.
Title: Re: Files modified externally not refreshed
Post by: jumafra on January 19, 2008, 07:13:46 am
Yeah, that might increase resources usage unnecessarily for most C::B users.
I guess I'll have to bear with it, and remember to force refresh. Or maybe, as Morten suggests, to implement that as a plugin... If only I knew how.
Regards
Juan
Title: Re: Files modified externally not refreshed
Post by: thomas on January 19, 2008, 01:10:33 pm
Like this:

[attachment deleted by admin]
Title: Re: Files modified externally not refreshed
Post by: jumafra on January 22, 2008, 06:28:35 am
Thanks Thomas. I'll give it a try when I have a proper wx building environment set.
Regards
Juan
Title: Re: Files modified externally not refreshed
Post by: MortenMacFly on January 22, 2008, 08:17:38 am
Like this:
Did I say 5-liner? Thomas did it in a two-liner... cool stuff! ;-)
Title: Re: Files modified externally not refreshed
Post by: thomas on January 22, 2008, 01:21:22 pm
Actually that plugin is harmless enough to be in the source tree and nightly builds.

There's nothing in it that could possibly break something. The worst thing to happen would be some CPU cycles burnt, and if someone doesn't like it, he doesn't need to load the plugin...
Title: Re: Files modified externally not refreshed
Post by: dmoore on January 22, 2008, 04:00:06 pm
IMO those two lines are harmless+useful enough that they shouldn't be a plugin at all and part of the core (make it possible to disable in environment/editor settings)