1
(**************************************************************************)
3
(* This file is part of Frama-C. *)
5
(* Copyright (C) 2007-2008 *)
6
(* CEA (Commissariat � l'�nergie Atomique) *)
8
(* you can redistribute it and/or modify it under the terms of the GNU *)
9
(* Lesser General Public License as published by the Free Software *)
10
(* Foundation, version 2.1. *)
12
(* It is distributed in the hope that it will be useful, *)
13
(* but WITHOUT ANY WARRANTY; without even the implied warranty of *)
14
(* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *)
15
(* GNU Lesser General Public License for more details. *)
17
(* See the GNU Lesser General Public License version 2.1 *)
18
(* for more details (enclosed in the file licenses/LGPLv2.1). *)
20
(**************************************************************************)
25
(* Build a read only text view for C source code. *)
27
let set_language_to_C (buffer:GSourceView.source_buffer) =
28
let original_source_language_manager = GSourceView.source_languages_manager () in
30
original_source_language_manager#get_language_from_mime_type "text/x-csrc"
32
begin match original_lang with
33
| Some lang -> buffer#set_language lang
34
| None -> Format.printf "No such mime type@."
36
buffer#set_highlight true
39
(* let d = GWindow.font_selection_dialog ~title:"tutu" ~show:true () in
40
d#selection#set_preview_text
41
(Format.sprintf "%s %s %s %s"
42
Utf8_logic.forall Utf8_logic.exists Utf8_logic.eq Utf8_logic.neq) ;
44
let original_source_window =
45
GSourceView.source_view
46
~show_line_numbers:true
47
~show_line_markers:true
53
original_source_window#misc#render_icon ~size:`MENU `DIALOG_WARNING
55
original_source_window#set_marker_pixbuf "warning" pixbuf;*)
56
let original_source_buffer = original_source_window#source_buffer in
57
set_language_to_C original_source_buffer;
58
(* ignore (original_source_buffer#create_marker ~typ:"warning" original_source_buffer#start_iter ) ;*)
60
original_source_window#set_highlight_current_line true
62
(* very old gtksourceview do not have this property. *)
64
original_source_window
68
let original_source_buffer = GSourceView.source_buffer () in
69
set_language_to_C original_source_buffer;
70
original_source_buffer