[Geany-devel] Markers

WILLIAM FRASER william.fraser at xxxxx
Sun Feb 26 13:08:14 UTC 2012

There is a problem as I understand it with checking for the
SC_MARK_AVAILABLE marker to see if a marker is available...

Markers seem by default to be set to 0 (SC_MARK_CIRCLE) by scintilla. So
there is no way to tell if a marker is being used with the default marker
icon (SC_MARK_CIRCLE), or is not being used. The following code dropped in
anywhere that it will get run (I placed it in the DefineMarkers function of
geanynummberedbookmarks) will demonstrate:

GtkWidget *dialog;
gchar temp[10000];
gint m[32];
sprintf(temp,"%d %d %d %d %d %d %d %d\n%d %d %d %d %d %d %d %d\n%d %d %d %d
%d %d %d %d\n%d %d %d %d %d %d %d

This displays the value of each marker, and those that aren't being used
for anything are showing up as 0, and not 28 (SC_MARK_AVAILABLE).

I can see 4 options, and I'd like to see what people think about them, or
if they can think of any better solutions:
1) agree between plugin developers which markers they will use and use them
staticly (as we are now, but ensuring they don't overlap)
2) change scintilla or geany so that markers are set to SC_MARK_AVAILABLE
when it is initialised.
3) Have a plugin that is run before any others or some static code usable
by all plugins that sets all editor unused markers to SC_MARK_AVAILABLE
ready for the other plugins.
4) Have an option in the preferences for each plugin that uses markers to
allow users to define which markers are to be used by that plugin.

There are pros & cons to each of these:

With option 1 we will probably run out of markers for anyone wanting to
develop a new plugin. Also would have to change code if editor's use of
markers changed. It is easiest to implement here and now.

Option 2 would be the most versatile in the long run, but would require
altering someone else's project purely for our own devices, and it would
require anyone using a plugin using markers to have to use the latest
version of geany.

Option 3 would mean we could handle marker allocation in-house, but would
require an extra plugin, and can we ensure that it would be loaded before
any other plugin? Or would we agree that any plugin using markers would
have to access a shared piece of code that's keeping track of which markers
are being used to see what's available?

Option 4 would be simple for us to implement, but would be messy, and
complicated for the user (like having to set IRQ numbers in the old day to
get your PC to work).

My personal preference would be some shared static function that any plugin
using markers could access.

Looking forward to your opinions.

William Fraser
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.geany.org/pipermail/devel/attachments/20120226/47831c0e/attachment.html>

More information about the Devel mailing list