NO

Author Topic: Syntax highlighter + Code refresh from disk  (Read 8280 times)

Garvan

  • Guest
Syntax highlighter + Code refresh from disk
« on: October 16, 2004, 07:04:16 PM »
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

Offline Pelle

  • Administrator
  • Member
  • *****
  • Posts: 2266
    • http://www.smorgasbordet.com
Re: Syntax highlighter + Code refresh from disk
« Reply #1 on: October 16, 2004, 11:43:50 PM »
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!

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?

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.

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
/Pelle

Garvan

  • Guest
Re: Syntax highlighter + Code refresh from disk
« Reply #2 on: October 17, 2004, 09:47:06 AM »
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.


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