(* Copyright (C) 2005: * Claudio Sacerdoti Coen , * Stefano Zacchiroli * * This file is part of lablgtksourceview, the OCaml binding for the * GtkSourceView widget. * * 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 * 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 * 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. * * For details, send a mail to the authors. *) open Printf let win = GWindow.window ~title:"LablGtkSourceView test" () let scrolled_win = GBin.scrolled_window ~packing:win#add () let text = let ic = open_in "test.txt" in let size = in_channel_length ic in let buf = String.create size in really_input ic buf 0 size; close_in ic; buf let source_buffer = GSourceView.source_buffer ~text ~check_brackets:true () let source_view = GSourceView.source_view ~source_buffer ~auto_indent:true ~insert_spaces_instead_of_tabs:true ~tabs_width:2 ~show_line_numbers:true ~margin:80 ~show_margin:true ~smart_home_end:true ~packing:scrolled_win#add ~height:500 ~width:650 () let _ = win#set_allow_shrink true; ignore (win#connect#destroy (fun _ -> GMain.quit ())); (* ignore (source_view#connect#move_cursor (fun _ _ ~extend -> prerr_endline "move_cursor")); ignore (source_view#connect#undo (fun _ -> prerr_endline "undo")); *) win#show (); GMain.Main.main ()