why-ide : source view

parent 0f297130
......@@ -259,15 +259,15 @@ why-ide-no:
why-ide: bin/why-ide.$(OCAMLBEST)
bin/why-ide.opt: $(GCMX)
$(if $(QUIET),@echo 'Linking $@' &&) $(OCAMLOPT) $(OFLAGS) -o $@ threads.cmxa nums.cmxa lablgtk.cmxa gtkThread.cmx $^
$(if $(QUIET),@echo 'Linking $@' &&) $(OCAMLOPT) $(OFLAGS) -o $@ threads.cmxa nums.cmxa lablgtk.cmxa lablgtksourceview.cmxa gtkThread.cmx $^
$(STRIP) $@
bin/why-ide.static: $(GCMX)
$(if $(QUIET),@echo 'Linking $@' &&) $(OCAMLOPT) -cclib -static $(OFLAGS) -o $@ threads.cmxa nums.cmxa lablgtk.cmxa gtkThread.cmx $^
$(if $(QUIET),@echo 'Linking $@' &&) $(OCAMLOPT) -cclib -static $(OFLAGS) -o $@ threads.cmxa nums.cmxa lablgtk.cmxa lablgtksourceview.cmxa gtkThread.cmx $^
$(STRIP) $@
bin/why-ide.byte: $(GCMO)
$(if $(QUIET),@echo 'Linking $@' &&) $(OCAMLC) $(BFLAGS) -o $@ nums.cma lablgtk.cma threads.cma gtkThread.cmo $^
$(if $(QUIET),@echo 'Linking $@' &&) $(OCAMLC) $(BFLAGS) -o $@ nums.cma lablgtk.cma lablgtksourceview.cma threads.cma gtkThread.cmo $^
# bench
#######
......
......@@ -259,6 +259,7 @@ dnl fi
# checking for lablgtk2
AC_CHECK_FILE($OCAMLLIB/lablgtk2/lablgtk.cma,LABLGTK2=yes,LABLGTK2=no)
AC_CHECK_FILE($OCAMLLIB/lablgtk2/lablgtksourceview.cma,LABLGTK2=yes,LABLGTK2=no)
# AC_CHECK_PROG(LABLGTK2,lablgtk2,yes,no) not always available (Win32)
# TODO: check gtksourceview
if test "$LABLGTK2" = yes ; then
......
......@@ -4,10 +4,28 @@ let () = ignore (GtkMain.Main.init ())
(* config *)
let window_width = 1024
let window_height = 768
let font_name = "Monospace 10"
(* command line *)
let font_size = ref 10
let font_family = "Monospace"
let file = ref None
let set_file f = match !file with
| Some _ ->
raise (Arg.Bad "only one file, please")
| None ->
if not (Filename.check_suffix f ".why") then
raise (Arg.Bad ("don't know what to do with " ^ f));
if not (Sys.file_exists f) then begin
Format.eprintf "why-ide: %s: no such file@." f; exit 1
end;
file := Some f
let spec = []
let () = Arg.parse spec set_file "why-ide [options] file.why"
(* windows, etc *)
let main () =
let w = GWindow.window
......@@ -31,15 +49,31 @@ let main () =
(* top line *)
let top_box = GPack.hbox ~packing:vbox#pack () in
(* le bouton Replay *)
(* Replay *)
let button =
GButton.button ~label:"repousser le front d'obsolescence"
~packing:top_box#add ()
~packing:top_box#add ()
in
ignore (button#connect#clicked
(fun () -> Format.printf "Andrei, tu es trop fort !@."));
(* source view *)
let scrolled_win = GBin.scrolled_window
~hpolicy: `AUTOMATIC ~vpolicy: `AUTOMATIC
~packing:vbox#add ()
in
let source_view =
GSourceView.source_view
~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
()
in
source_view#misc#modify_font_by_name font_name;
w#add_accel_group accel_group;
w#show ()
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment