<property name="enable_popup">False</property>
<child>
- <widget class="GtkScrolledWindow" id="scrolledwindow7">
+ <widget class="GtkScrolledWindow" id="ScriptScrolledWin">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="hscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
<property name="window_placement">GTK_CORNER_TOP_LEFT</property>
<child>
- <widget class="GtkTextView" id="scriptTextView">
- <property name="border_width">2</property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="editable">True</property>
- <property name="overwrite">False</property>
- <property name="accepts_tab">True</property>
- <property name="justification">GTK_JUSTIFY_LEFT</property>
- <property name="wrap_mode">GTK_WRAP_NONE</property>
- <property name="cursor_visible">True</property>
- <property name="pixels_above_lines">0</property>
- <property name="pixels_below_lines">0</property>
- <property name="pixels_inside_wrap">0</property>
- <property name="left_margin">2</property>
- <property name="right_margin">0</property>
- <property name="indent">0</property>
- <property name="text" translatable="yes"></property>
- </widget>
+ <placeholder/>
</child>
</widget>
<packing>
MetadataTypes.ownerize_tables (Helm_registry.get "matita.owner");
MatitaDb.clean_owner_environment ();
MatitaDb.create_owner_environment ();
- GtkMain.Rc.add_default_file BuildTimeConf.gtkrc; (* loads gtk rc files *)
+ GtkMain.Rc.add_default_file BuildTimeConf.gtkrc_file; (* loads gtk rc *)
ignore (GMain.Main.init ());
(* environment trust *)
let script =
MatitaScript.script
- ~buffer:gui#main#scriptTextView#buffer
+ ~buffer:gui#sourceView#buffer
~init:(Lazy.force MatitaEngine.initial_status)
~mathviewer:(MatitaMathView.mathViewer ())
~urichooser:(fun uris ->
~title:"Matita: URI chooser"
~msg:"Select the URI" ~hide_uri_entry:true
~hide_try:true ~ok_label:"_Apply" ~ok_action:`SELECT
- ~copy_cb:(fun s -> gui#main#scriptTextView#buffer#insert ("\n"^s^"\n"))
+ ~copy_cb:(fun s -> gui#sourceView#buffer#insert ("\n"^s^"\n"))
() ~id:"boh?" uris
with MatitaTypes.Cancel -> [])
()
[ main#mainWinEventBox ]
in
let console = new console ~buffer:main#logTextView#buffer () in
+ let (source_view: GSourceView.source_view) =
+ GSourceView.source_view
+ ~auto_indent:true
+ ~insert_spaces_instead_of_tabs:true ~tabs_width:2
+ ~margin:80 ~show_margin:true
+ ~smart_home_end:true
+ ~packing:main#scriptScrolledWin#add
+ ()
+ in
+ let source_buffer = source_view#source_buffer in
object (self)
val mutable chosen_file = None
val mutable _ok_not_exists = false
in
let tac_w_term ast _ =
if (MatitaScript.instance ())#onGoingProof () then
- let (buf: GText.buffer) = self#main#scriptTextView#buffer in
+ let buf = source_buffer in
buf#insert ~iter:(buf#get_iter_at_mark (`NAME "locked"))
("\n" ^ TacticAstPp.pp_tactic ast)
in
MatitaLog.error
(sprintf "Uncaught exception: %s" (Printexc.to_string exn)));
(* script *)
+ let _ =
+ match GSourceView.source_language_from_file BuildTimeConf.lang_file with
+ | None ->
+ MatitaLog.warn (sprintf "can't load language file %s"
+ BuildTimeConf.lang_file)
+ | Some matita_lang ->
+ source_buffer#set_language matita_lang;
+ source_buffer#set_highlight true
+ in
let s () = MatitaScript.instance () in
let disableSave () =
script_fname <- None;
in
let newScript () = (s ())#reset (); disableSave () in
let cursor () =
- let buf = self#main#scriptTextView#buffer in
- buf#place_cursor (buf#get_iter_at_mark (`NAME "locked"))
+ source_buffer#place_cursor
+ (source_buffer#get_iter_at_mark (`NAME "locked"))
in
let advance _ = (MatitaScript.instance ())#advance (); cursor () in
let retract _ = (MatitaScript.instance ())#retract (); cursor () in
let connect_key sym f =
connect_key self#main#mainWinEventBox#event
~modifiers:[`CONTROL] ~stop:true sym f;
- connect_key self#main#scriptTextView#event
+ connect_key self#sourceView#event
~modifiers:[`CONTROL] ~stop:true sym f
in
connect_button self#main#scriptAdvanceButton advance;
connect_menu_item self#main#newMenuItem newScript;
connect_key GdkKeysyms._period
(fun () ->
- let buf = self#main#scriptTextView#buffer in
- buf#insert ~iter:(buf#get_iter_at_mark `INSERT) ".\n";
- advance ());
+ source_buffer#insert ~iter:(source_buffer#get_iter_at_mark `INSERT)
+ ".\n";
+ advance ());
connect_key GdkKeysyms._Return
(fun () ->
- let buf = self#main#scriptTextView#buffer in
- buf#insert ~iter:(buf#get_iter_at_mark `INSERT) "\n";
- advance ());
+ source_buffer#insert ~iter:(source_buffer#get_iter_at_mark `INSERT)
+ "\n";
+ advance ());
(* script monospace font stuff *)
let font =
Helm_registry.get_opt_default Helm_registry.get
BuildTimeConf.default_script_font "matita.script_font"
in
(* let monospace_tag =
- self#main#scriptTextView#buffer#create_tag [`FONT_DESC font]
+ source_buffer#create_tag [`FONT_DESC font]
in *)
- self#main#scriptTextView#misc#modify_font_by_name font;
+ self#sourceView#misc#modify_font_by_name font;
(* let _ =
- self#main#scriptTextView#buffer#connect#changed ~callback:(fun _ ->
- let start, stop = self#main#scriptTextView#buffer#bounds in
- self#main#scriptTextView#buffer#apply_tag monospace_tag start stop)
+ source_buffer#connect#changed ~callback:(fun _ ->
+ let start, stop = source_buffer#bounds in
+ source_buffer#apply_tag monospace_tag start stop)
in *)
(* debug menu *)
self#main#debugMenu#misc#hide ();
self#main#hintMediumImage#set_file (image_path "matita-bulb-medium.png");
self#main#hintHighImage#set_file (image_path "matita-bulb-high.png");
(* focus *)
- self#main#scriptTextView#misc#grab_focus ();
+ self#sourceView#misc#grab_focus ();
(* main win dimension *)
let width = Gdk.Screen.width () in
let height = Gdk.Screen.height () in
method console = console
-
+ method sourceView: GSourceView.source_view = (source_view: GSourceView.source_view)
method about = about
method fileSel = fileSel
method main = main