======================================================================================= # Changes represented in this diff and in the new and moved files listed below: # # - Allow building w/o autoconf/automake/etc but still can specify prefix # (GtkScintilla-2.0.pc is generated by a Python script now) # - Fixed use of PREFIX vs DESTDIR in Makefile # - Allow building against an external Scintilla # - Allow building scintilla w/o gthread # - Fixed memory bug in notify dispatch # - Added direct access to Scintilla document objects # # Files we added: # gtkscintilla.def.in (now also processed by scigen.py) # gtkscintilladoc.cxx (document object access) # gtkscintilladoc.h (document object access) # makefile.msc (for building on win32) # Makefile (not a generated file in our case) # pcgen.py (generates the GtkScintilla-2.0.pc file) # # Files we moved: # gtkscintilla-2.0/gtkscintilla.ctmpl to ./gtkscintilla.c.in # gtkscintilla-2.0/gtkscintilla.htmpl to ./gtkscintilla.h.in # data/scigen.py.in to ./scigen.py # ======================================================================================== *** gtkscintilla2.sf/gtkscintilla-2.0/gtkscintilla.ctmpl Sat Mar 22 04:21:24 2003 --- gtkscintilla2/gtkscintilla.c.in Wed Apr 23 15:41:50 2003 *************** *** 350,355 **** --- 350,378 ---- return buffer; } + GtkScintillaDoc *gtk_scintilla_get_doc (GtkScintilla *sci) + { + void *ptr; + + ptr = (void *)scintilla_send_message (SCINTILLA(sci->scintilla), + SCI_GETDOCPOINTER, 0, 0); + return gtk_scintilla_doc_new (ptr); + } + + void gtk_scintilla_set_doc (GtkScintilla *sci, + GtkScintillaDoc *doc) + { + void *ptr; + + if (doc == NULL) + ptr = NULL; + else + ptr = doc->sci_doc; + + scintilla_send_message (SCINTILLA(sci->scintilla), + SCI_SETDOCPOINTER, 0, (int) ptr); + } + /* --- Start of autogenerated code --- */ %scintilla_impl% *************** *** 360,366 **** notify_cb (GtkWidget *w, gint param, gpointer notif, gpointer data) { struct SCNotification *notification = (struct SCNotification *) notif; ! switch (notification->nmhdr.code) { case SCN_STYLENEEDED: g_signal_emit (G_OBJECT (data), --- 383,390 ---- notify_cb (GtkWidget *w, gint param, gpointer notif, gpointer data) { struct SCNotification *notification = (struct SCNotification *) notif; ! gchar* text; ! switch (notification->nmhdr.code) { case SCN_STYLENEEDED: g_signal_emit (G_OBJECT (data), *************** *** 402,417 **** signals[DOUBLE_CLICK], 0); break; case SCN_MODIFIED: g_signal_emit (G_OBJECT (data), signals[MODIFIED], 0, (gint) notification->position, (gint) notification->modificationType, ! (gchar *)notification->text, (gint) notification->length, (gint) notification->linesAdded, (gint) notification->line, (gint) notification->foldLevelNow, (gint) notification->foldLevelPrev); break; case SCN_MACRORECORD: g_signal_emit (G_OBJECT (data), --- 426,446 ---- signals[DOUBLE_CLICK], 0); break; case SCN_MODIFIED: + if (notification->length == 0) + text = g_strdup(""); + else + text = g_strndup (notification->text, notification->length); g_signal_emit (G_OBJECT (data), signals[MODIFIED], 0, (gint) notification->position, (gint) notification->modificationType, ! text, (gint) notification->length, (gint) notification->linesAdded, (gint) notification->line, (gint) notification->foldLevelNow, (gint) notification->foldLevelPrev); + g_free (text); break; case SCN_MACRORECORD: g_signal_emit (G_OBJECT (data), *** gtkscintilla2.sf/gtkscintilla-2.0/gtkscintilla.htmpl Sat Mar 22 04:21:24 2003 --- gtkscintilla2/gtkscintilla.h.in Fri Apr 4 18:44:44 2003 *************** *** 23,28 **** --- 23,29 ---- #define __GTK_SCINTILLA_H__ #include + #include "gtkscintilladoc.h" #ifdef __cplusplus extern "C" { *************** *** 83,88 **** --- 84,92 ---- gint start, gint end, gint *length); + GtkScintillaDoc *gtk_scintilla_get_doc (GtkScintilla *sci); + void gtk_scintilla_set_doc (GtkScintilla *sci, + GtkScintillaDoc *doc); /* --- Start of autogenerated code --- */ *** gtkscintilla2.sf/data/scigen.py.in Tue Jun 17 11:37:11 2003 --- gtkscintilla2/scigen.py Thu Apr 3 16:48:21 2003 *************** *** 1,5 **** ! #!@PYTHON@ import string import re --- 1,7 ---- ! #!/usr/bin/env python + import sys + import os import string import re *************** *** 18,23 **** --- 20,37 ---- sci_defs = [] sci_impl = [] + def extract_arg(argname, default=None): + for arg in sys.argv[1:]: + if string.find(arg, '--%s=' % argname) == 0: + return string.split(arg, '=')[1] + return default + + # Select scintilla to build against: Default to using local copy + SCINTILLA_DIR = extract_arg('scintilla-dir') + if SCINTILLA_DIR is None: + SCINTILLA_DIR = 'scintilla' + SCINTILLA_IFACE = os.path.join(SCINTILLA_DIR, 'include', 'Scintilla.iface') + def fix_name(name): str = '' *************** *** 124,130 **** sci_defs.append(val_template % dict + '\n') def main(): ! iface = open('../scintilla/include/Scintilla.iface', 'r') fun_re = '^(fun|get|set)\s+(?P\S+)\s+(?P\S+)=(?P\d+)?\(((?P\w+)\s+(?P\w+)\s*)?,(\s*(?P\w+)\s+(?P\w+))?\)' val_re = '^val\s+(?P\w+)\s*=\s*(?P.+)$' --- 138,144 ---- sci_defs.append(val_template % dict + '\n') def main(): ! iface = open(SCINTILLA_IFACE, 'r') fun_re = '^(fun|get|set)\s+(?P\S+)\s+(?P\S+)=(?P\d+)?\(((?P\w+)\s+(?P\w+)\s*)?,(\s*(?P\w+)\s+(?P\w+))?\)' val_re = '^val\s+(?P\w+)\s*=\s*(?P.+)$' *************** *** 144,156 **** iface.close() ! template = string.replace(open('gtkscintilla.ctmpl').read(), '%scintilla_impl%', string.join(sci_impl, '')) open('gtkscintilla.c', 'w').write(template) ! template = string.replace(open('gtkscintilla.htmpl').read(), '%scintilla_defs%', string.join(sci_defs, '')) open('gtkscintilla.h', 'w').write(template) if __name__ == '__main__': main() --- 158,181 ---- iface.close() ! template = string.replace(open('gtkscintilla.c.in').read(), '%scintilla_impl%', string.join(sci_impl, '')) open('gtkscintilla.c', 'w').write(template) ! template = string.replace(open('gtkscintilla.h.in').read(), '%scintilla_defs%', string.join(sci_defs, '')) open('gtkscintilla.h', 'w').write(template) + + template = open('gtkscintilla.def.in').read() + names = [] + for defn in sci_defs: + if string.find(defn, 'gtk_scintilla') != -1: + name = defn[string.find(defn, ' '):string.find(defn, '(')] + names.append(name) + + template = string.replace(template, '%scintilla_names%', + string.join(names, '\n')) + open('gtkscintilla.def', 'w').write(template) if __name__ == '__main__': main()