[Gambas-user] Extensible Image Viewer

Tobias Boege taboege at ...626...
Tue Jul 28 04:39:44 CEST 2015


Hi list,

I have written (and uploaded to the software farm) an image viewer in
Gambas. But wait: it's an *extensible* image viewer. If you write the
first letter of the important words after one another you get "Geiv"
which is the project's name... :-|

Extensibility is accomplished by a plugin system (the base code for this
is also in the software farm for some days now, it's called "Plugins").
It's a bit of a hack but works nicely for my purposes.

The code is super small as even the most trivial automatisms are left for
plugins. Vast amounts of lines are event and property declarations and
Raise statements. [ A hell to do debugging with, I foresee. I have likely
overdone it here but I'm not a software engineer so I don't care :-) ]

My plan is to reserve a dot directory in a user's home directory for plugins
and configuration files. The project on the farm, however, contains three
plugin files just to show that you can do non-trivial things with them:

 - one of them provides basic image viewer things like zoom, background
   color, image centering and the ability to keep the zoom setting across
   file switches while at the same time letting the viewport on the image
   reset itself (something "feh" seems to be incapable of),
 - the second implements natural (i.e. "ls -v" like) sorting of the file
   list, and
 - the third downloads a manga from mangafox.me page by page on demand,
   but reusing images it already downloaded (normally I have a crawler
   script (in Gambas, of course) for that which downloads the whole thing
   and keeps it on disk, but it was nice to see that it could be done with
   a plugin and in an on-demand fashion). [ And look, it's only 4:45 am! ]

Note that the project gets its stuff entirely from the command line. As you
may know, you can edit the preset arguments in the IDE under "Project" ->
"Properties" -> "Arguments". Left and right arrow navigate through the file
list, up and down arrow move the viewport, "+" and "-" zoom, "r" refreshes
the viewer (and causes the image to be centered), "f" toggles fullscreen and
escape exits.

Attached is also a patch to the IDE which enables Gambas syntax highlighting
for *.plugin files. However, the help popups an completions don't appear
when editing such a file. I guess that's because they're not recognised as
source files?

If someone gets a decent icon done, I'll gladly take it.

Regards,
Tobi

-- 
"There's an old saying: Don't change anything... ever!" -- Mr. Monk
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ide-highlight-plugin-files.patch
Type: text/x-diff
Size: 901 bytes
Desc: not available
URL: <http://lists.gambas-basic.org/pipermail/user/attachments/20150728/caa13f6f/attachment.patch>


More information about the User mailing list