Developer forums (C::B DEVELOPMENT STRICTLY!) > Plugins development
Semantic highlight
mistar:
--- Quote from: MortenMacFly on May 19, 2012, 01:52:20 pm ---I'm afraid I don't really understand. When you load a project, C::B does not load all files, so there is no such event you are asking for. If you are interested in parsing all files when the project is opened, you need the EVT_PROJECT_OPEN or better EVT_PROJECT_ACTIVATE. Then, in addition you can use EVT_PROJECT_TARGETS_MODIFIED, EVT_PROJECT_FILE_CHANGED, EVT_PROJECT_FILE_ADDED and EVT_PROJECT_END_REMOVE_FILES to check for changes in the setup. There is EVT_SETTINGS_CHANGED for checking, if the project's settings have been changed.
However, it makes no sense to prepare semantic highlighting for files that are actually not really opened, a.k.a. shown as an editor. Imagine you have workspaces with several 1000 files - how long shall the user wait? So semantic highlight IMHO gets interesting, once you see a file in an editor, that's why I pointed you to the EVT_EDITOR_ACTIVATED event.
Have a look at the Code::Completion plugin. It does all that: Checking for project settings, checking for file changes, running external tools (like the compiler to query the compiler's internal settings), workign once a file is opened and so on. CC would not work if all that was not possible.
If you still believe you need more, provide patches. The one you provided does not help you much, it is the same as the EVT_EDITOR_ACTIVATED event, once you did the changes as I suggested. Maybe I'll understand better your needs if you show what you have in mind.
For the wxExecute issue: Run it as an external process, use the C::B SDK to do so, maybe even in a thread. then you won't have such issues. It works really nice in several plugins we already ave, so I see no reason why it should not work for you, except you might have done something wrong. Again: in that case provide a test case / sample to reproduce.
--- End quote ---
I do not want to scan all project's files ;)
But I really don't see why is EVT_EDITOR_ACTIVATED the same as EVT_EDITOR_OPENED/LOADED...
I need to 'process' a file whenever a tab for this file appears in the C::B tab bar and 'process' this file when its tab disappears.
This is exactly what you said: I do not need to process files that are not displayed as tabs (aka opened in my terminology).
EVT_EDITOR_ACTIVATED is posted every time an editor gets focus and this is not what I need (or I really don't understand you...).
By 'process' I mean (among others) getting the project the file belongs to (which cannot be done using EVT_EDITOR_OPEN)
to get compile options.
But you are right, I'll have a look at CC plugin...
PS. I've checked that EVT_SETTINGS_CHANGED is not posted when a target's settings are changed...
oBFusCATed:
Why do you need this?
I think you need something like EVT_EDITOR_MODIFIED event*, so you get a notification, when the contents of the editor gets modified.
At the start you'll do the first pass on EVT_EDITOR_ACTIVATED and mark it as highlighted, then when you get a modified event you'll do the re-highlighting...
* If there is no such event you can add it easily I think, just make sure you don't fire it for every key press.
Probably you can use a timer and group multiple changes together...
p.s. and don't forget to test the performance with massive files 30-40k lines of code :)
mistar:
--- Quote from: oBFusCATed on May 19, 2012, 02:28:00 pm ---Why do you need this?
I think you need something like EVT_EDITOR_MODIFIED event*, so you get a notification, when the contents of the editor gets modified.
At the start you'll do the first pass on EVT_EDITOR_ACTIVATED and mark it as highlighted, then when you get a modified event you'll do the re-highlighting...
--- End quote ---
This is an idea, but I don't like it because every time I catch EVT_EDITOR_ACTIVATED I search some set of editors for the one I am processing...
I really don't understand your reluctance in introducing new events ;)
If some things are natural and allows for better performance why not introduce them?
BTW: why don't you program in C? Why people introduced C++? After all, you can do everything in pure C or better, assembly or pure machine code ;P
MortenMacFly:
--- Quote from: oBFusCATed on May 19, 2012, 02:28:00 pm ---* If there is no such event you can add it easily I think, just make sure you don't fire it for every key press.
Probably you can use a timer and group multiple changes together...
--- End quote ---
cbEVT_EDITOR_MODIFIED
We have them all... ;-)
oBFusCATed:
--- Quote from: mistar on May 19, 2012, 02:46:09 pm ---BTW: why don't you program in C? Why people introduced C++? After all, you can do everything in pure C or better, assembly or pure machine code ;P
--- End quote ---
What is this comment? Something serious or just a joke?
BTW: I have no problem adding new events, but I don't understand the logic behind the current system, so I can't comment if your proposal is good or not, I'm just telling you what would I do if I'm implementing you.
BTW2: If you use a hash table there would be no performance problems :)
Navigation
[0] Message Index
[#] Next page
[*] Previous page
Go to full version