Pelles C > Add-ins
Syntax highlighter + Code refresh from disk
(1/1)
Garvan:
Hi Pelle:
I adapted your new add-in syntax highlighter to BCX syntax and converted the DLL to BCX BASIC. I needed to make only a few small changes to code folding and for multi-line comments. It works very well, and is very fast, even with 400+ keywords!
I have a question about how best to run the BCX translator before compiling the source. I am using code like this;
AddIn_SendIDECommand(g_hwndMain,AIC_FILE_SAVEALL);
system(join(4,BcxPath() , "BC " , bcxbuf , " -p"));
AddIn_SendIDECommand(g_hwndMain,AIC_PROJ_BUILDALL);
And it works fine, but I need a way to automatically refresh the C source file if it is open in the IDE during the translation process. I don’t want to leave the C file open but not updated.
Is there a way to refresh files from disk?
Can I close and reopen a file in the IDE?
Am I using the wrong command to run the translator? I want the translation to complete before the BUILD starts.
Can you offer any suggestions?
Thanks very much for your work!
Garvan
Pelle:
Hello Garvan,
--- Quote from: "Garvan" ---I adapted your new add-in syntax highlighter to BCX syntax and converted the DLL to BCX BASIC. I needed to make only a few small changes to code folding and for multi-line comments. It works very well, and is very fast, even with 400+ keywords!
--- End quote ---
Nice to hear! Yes, keeping the keywords sorted makes all the difference.
--- Quote from: "Garvan" ---
Is there a way to refresh files from disk?
Can I close and reopen a file in the IDE?
--- End quote ---
No way to refresh, but it should work to send a WM_CLOSE message to the source window, and then using AddIn_OpenDocument() to open a named file. I assume you know the window handle of the source MDI window.
--- Quote from: "Garvan" ---
Am I using the wrong command to run the translator? I want the translation to complete before the BUILD starts.
--- End quote ---
This looks OK for now. My plan is to (somehow) add the possibility to specify 'build commands' (translator or compiler to run) in the ADDIN_ADD_FILE_TYPE. I'm not sure yet about the best/most flexible way - but this should make everything simpler. The IDE will take care of everything that has to do with building the program. The current solution should be considered "temporary" - until I find a better solution.
Pelle
Garvan:
--- Quote from: "Pelle" ---No way to refresh, but it should work to send a WM_CLOSE message to the source window, and then using AddIn_OpenDocument() to open a named file. I assume you know the window handle of the source MDI window.
--- End quote ---
I found the handle of the source MDI window using AddIn_EnumDocuments() and closed it with SendMessage() as you suggested.
Thanks for your help
Garvan
Navigation
[0] Message Index
Go to full version