X-Git-Url: http://matita.cs.unibo.it/gitweb/?a=blobdiff_plain;f=helm%2FDEVEL%2Flablgtksourceview%2FgSourceView.ml;h=251f76c59f1a506896646cbef0cdf85f65bf6b69;hb=97c2d258a5c524eb5c4b85208899d80751a2c82f;hp=f5c1236470c0b13e340650dbbb48a9b78c4aa4dc;hpb=c6573e4244c6b06969969c920dcd2b8a9908ac9c;p=helm.git diff --git a/helm/DEVEL/lablgtksourceview/gSourceView.ml b/helm/DEVEL/lablgtksourceview/gSourceView.ml index f5c123647..251f76c59 100644 --- a/helm/DEVEL/lablgtksourceview/gSourceView.ml +++ b/helm/DEVEL/lablgtksourceview/gSourceView.ml @@ -1,26 +1,22 @@ -(* Copyright (C) 2005: - * Stefano Zacchiroli - * Claudio Sacerdoti Coen +(* + * lablgtksourceview, OCaml binding for the GtkSourceView text widget * - * This file is part of lablgtksourceview, the OCaml binding for the - * GtkSourceView widget. + * Copyright (C) 2005 Stefano Zacchiroli * - * lablgtksourceview is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of the + * This library is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation; either version 2.1 of the * License, or (at your option) any later version. - * - * lablgtksourceview is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of + * + * This library is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with lablgtksourceview; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. + * Lesser General Public License for more details. * - * For details, send a mail to the authors. + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 + * USA *) open Gaux @@ -70,11 +66,35 @@ object (self) match SourceLanguagesManager.get_language_from_mime_type obj s with | None -> None | Some obj -> Some (new source_language obj) + method lang_files_dirs = SourceLanguagesManager.get_lang_files_dirs obj end +(* let source_languages_manager ?lang_files_dirs () = + let properties = + match lang_files_dirs with + | None -> [] + | Some dirs -> + let list_obj = gslist_of_string_list dirs in + [Gobject.param + "lang-files-dirs" + (`OBJECT (Some list_obj))] + in + new source_languages_manager (SourceLanguagesManager.create properties) *) + let source_languages_manager () = new source_languages_manager (SourceLanguagesManager.create []) +let source_language_from_file ?languages_manager fname = + let languages_manager = + match languages_manager with + | None -> source_languages_manager () + | Some lm -> lm + in + let manager_obj = languages_manager#as_source_languages_manager in + match SourceLanguage.new_from_file fname manager_obj with + | None -> None + | Some lang_obj -> Some (new source_language lang_obj) + (** {2 GtkSourceBuffer} *) class source_buffer_signals obj' = @@ -188,3 +208,12 @@ let source_view ?source_buffer = Gobject.set_params (Gobject.try_cast obj "GtkSourceView") pl; new source_view obj))) +(** {2 Misc} *) + +let find_matching_bracket iter = + let iter = iter#copy in + if SourceViewMisc.find_matching_bracket iter#as_iter then + Some iter + else + None +