I attached an int to each scintilla object to keep track of what's been assigned in my markers plugin. The only problem was that some markers are used by scintilla, so any plugin would have to make note of which ones were being used by the editor (with the problem that you would have to update plugins if editor changed) or, you would have to submit code to scintilla so that it also used the uniform resource allocation.
-------- Original Message --------
Lex Trotman <elextr@gmail.com> wrote:Update:Matthew has pointed out on IRC that the markers and indicators are per scintilla object, not global. He has a suggested alternative API which he will post after its tested.CheersLexOn 5 April 2013 13:09, Lex Trotman <elextr@gmail.com> wrote:
There are several plugins that share limited resources, such as scintilla markers and indicators.
At the moment there is no coordination for using those resources so plugins can interfere with one another and possibly with Geany.The only common thing between plugins and Geany is Geany, so this is a proposal to add a resources management interface to Geany.The proposed interface is below, I have tried to make it so it is easy to expand to resources that are not integers (markers and indicators are all integers)enum resource_type { GEANY_RESOURCE_MARKER, GEANY_RESOURCE_INDICATOR };gboolean alloc_int_resource( enum resource_type, int* resource_num );void free_int_resource( int resource_num );This allows extra resources to be added without ABI changes (so long as they are added to the end of the enum).If (when) other types of resource need managing then extra functions can be added again without breaking the ABI.Automatic release is not suggested because that prevents use of RAII and similar management schemes in C++ or GC for other plugin languages. For plain C plugins just call free_int_resource in the plugin_cleanup function.Any simpler, more flexible suggestions?Cheers
Lex
_______________________________________________
Devel mailing list
Devel@lists.geany.org
https://lists.geany.org/cgi-bin/mailman/listinfo/devel