Viewer with colors?

A place where plug-in developers can share their knowledge and experience.
Locked
acker
Posts: 6
Joined: Mon Nov 12, 2007 6:34 pm

Viewer with colors?

Post by acker »

Hello,

I was wondering which was the best method (a simple one if possible) to create a viewer plugin with syntax highlighting (being able to color different things in the file). It is important that that the file won't be read completly from disk at once (just the block you're viewing).

Any ideas?
User avatar
t-rex
Admin
Posts: 417
Joined: Sun Mar 20, 2005 6:10 pm
Location: Ashdod
Contact:

Post by t-rex »

acker
It's quite easy but in such a case it can only be a simple keyword highlighting, not syntax sensitive one.
acker
Posts: 6
Joined: Mon Nov 12, 2007 6:34 pm

Post by acker »

I've looked through the viewer APIs and I could not find one that I could use (hxxp://api.farmanager.com/en/viewerapi/index.html ). Please give me a link or something to search for.

Can I for example create a hex editor as a plugin (or anyway using existing functions from FAR) ? I don't want to manage the windows all by my self. It's important not to go with the editor if it doesn't support reading the file block by block.

Thanks
User avatar
t-rex
Admin
Posts: 417
Joined: Sun Mar 20, 2005 6:10 pm
Location: Ashdod
Contact:

Post by t-rex »

acker
No such API exists. I can think of two ways to do it:
1. Using DialogAPI - DI_USERCONTROL - you can see something like that in the MailView plugin.
2. Using the Editor - this one is tricky - your plugin opens an empty editor and uses it only as a container to display the current screen. You read the file by your self and handle all the keystrokes in the editor and you use the editor only to display the current screen contents, this way you get highlighting, modality and some other stuff for free and you only need to handle the reading of the file and simulate the navigation.
acker
Posts: 6
Joined: Mon Nov 12, 2007 6:34 pm

Post by acker »

Thank you very much for the quick and informative response.
rola
Posts: 2
Joined: Thu Jan 17, 2008 5:47 am

Post by rola »

t-rex,Thank you so much. I just met the similar problem.
intersol
Posts: 10
Joined: Wed Apr 27, 2005 8:45 am

Post by intersol »

It would be quite nice to be able to activate colorer for viewer too.
Locked