[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];
for(i=0;i<32;i++)
m[i]=scintilla_send_message(sci,SCI_MARKERSYMBOLDEFINED,i,0);
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
%d",m[0],m[1],m[2],m[3],m[4],m[5],m[6],m[7],m[8],m[9],m[10],m[11],m[12],m[13],m[14],m[15],m[16],m[17],m[18],m[19],m[20],m[21],m[22],m[23],m[24],m[25],m[26],m[27],m[28],m[29],m[30],m[31]);
dialog=gtk_message_dialog_new(GTK_WINDOW(geany->main_widgets->window),
GTK_DIALOG_DESTROY_WITH_PARENT,
GTK_MESSAGE_ERROR,
GTK_BUTTONS_NONE,
"%s",temp);
gtk_dialog_add_button(GTK_DIALOG(dialog),_("_Okay"),GTK_RESPONSE_OK);
gtk_dialog_run(GTK_DIALOG(dialog));
gtk_widget_destroy(dialog);
g_free(temp);

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