Commit 277ca2d3 authored by MARCHE Claude's avatar MARCHE Claude

new IDE: expand/collapse status of rows seems to work now

parent 23d527c6
......@@ -439,14 +439,75 @@ install_no_local::
install_local: bin/why3config
###############
# GUI
###############
ifeq (@enable_ide@,yes)
GUI_FILES = xml session gconfig db gmain
GUIMODULES = $(addprefix src/ide/, $(GUI_FILES))
GUIML = $(addsuffix .ml, $(GUIMODULES))
GUIMLI = $(addsuffix .mli, $(GUIMODULES))
GUICMO = $(addsuffix .cmo, $(GUIMODULES))
GUICMX = $(addsuffix .cmx, $(GUIMODULES))
$(GUICMO) $(GUICMX): INCLUDES += -I src/ide -I @SQLITE3LIB@
# build targets
byte: bin/why3gui.byte
opt: bin/why3gui.opt
bin/why3gui.opt bin/why3gui.byte: INCLUDES += -I @LABLGTK2LIB@ -I @SQLITE3LIB@
bin/why3gui.opt bin/why3gui.byte: EXTOBJS +=
bin/why3gui.opt bin/why3gui.byte: EXTLIBS += lablgtk lablgtksourceview2 sqlite3
bin/why3gui.opt: src/why.cmxa $(PGMCMX) $(GUICMX)
$(if $(QUIET), @echo 'Linking $@' &&) \
$(OCAMLOPT) $(OFLAGS) -o $@ $(EXTCMXA) $^
$(STRIP) $@
bin/why3gui.byte: src/why.cma $(PGMCMO) $(GUICMO)
$(if $(QUIET),@echo 'Linking $@' &&) \
$(OCAMLC) $(BFLAGS) -o $@ $(EXTCMA) $^
bin/why3gui: bin/why3gui.@OCAMLBEST@
ln -sf why3gui.@OCAMLBEST@ $@
# depend and clean targets
include .depend.gui
.depend.gui: src/ide/xml.ml
$(OCAMLDEP) -slash -I src -I src/ide $(GUIML) $(GUIMLI) > $@
depend: .depend.gui
clean::
rm -f src/ide/*.cm[iox] src/ide/*.o
rm -f src/ide/*.annot src/ide/*~
rm -f bin/why3gui.byte bin/why3gui.opt bin/why3gui
rm -f .depend.gui
install_no_local::
cp -f bin/why3gui.@OCAMLBEST@ $(BINDIR)/why3gui
install_local: bin/why3gui
endif
###############
# IDE
###############
ifeq (@enable_ide@,yes)
IDE_FILES = xml session gconfig db gmain
# IDE_FILES = xml session gconfig newmain
# IDE_FILES = xml session gconfig db gmain
IDE_FILES = xml session gconfig newmain
IDEMODULES = $(addprefix src/ide/, $(IDE_FILES))
......@@ -455,16 +516,16 @@ IDEMLI = $(addsuffix .mli, $(IDEMODULES))
IDECMO = $(addsuffix .cmo, $(IDEMODULES))
IDECMX = $(addsuffix .cmx, $(IDEMODULES))
$(IDECMO) $(IDECMX): INCLUDES += -I src/ide -I @SQLITE3LIB@
$(IDECMO) $(IDECMX): INCLUDES += -I src/ide
# build targets
byte: bin/why3ide.byte
opt: bin/why3ide.opt
bin/why3ide.opt bin/why3ide.byte: INCLUDES += -I @LABLGTK2LIB@ -I @SQLITE3LIB@
bin/why3ide.opt bin/why3ide.byte: INCLUDES += -I @LABLGTK2LIB@
bin/why3ide.opt bin/why3ide.byte: EXTOBJS +=
bin/why3ide.opt bin/why3ide.byte: EXTLIBS += lablgtk lablgtksourceview2 sqlite3
bin/why3ide.opt bin/why3ide.byte: EXTLIBS += lablgtk lablgtksourceview2
bin/why3ide.opt: src/why.cmxa $(PGMCMX) $(IDECMX)
$(if $(QUIET), @echo 'Linking $@' &&) \
......
......@@ -351,14 +351,9 @@ module M = Session.Make
let set_row_status row b =
if b then
begin
(* goals_view#collapse_row row#path; *)
goals_model#set ~row:row#iter ~column:status_column !image_yes;
end
goals_model#set ~row:row#iter ~column:status_column !image_yes
else
begin
goals_model#set ~row:row#iter ~column:status_column !image_unknown;
end
goals_model#set ~row:row#iter ~column:status_column !image_unknown
let set_proof_state ~obsolete a =
let row = a.M.proof_key in
......@@ -392,7 +387,14 @@ let row_expanded b iter _path =
| M.Theory t ->
eprintf "theory_expanded <- %b@." b;
M.set_theory_expanded t b
| _ -> ()
| M.Goal g ->
eprintf "goal_expanded <- %b@." b;
M.set_goal_expanded g b
| M.Transformation tr ->
eprintf "transf_expanded <- %b@." b;
M.set_transf_expanded tr b
| M.Proof_attempt _ -> ()
let (_:GtkSignal.id) =
goals_view#connect#row_collapsed ~callback:(row_expanded false)
......@@ -403,16 +405,22 @@ let (_:GtkSignal.id) =
let notify any =
let row,exp =
match any with
| M.Goal g -> (M.goal_key g),false (* g.M.file_expanded *)
| M.Goal g ->
if M.goal_expanded g then
begin
let n =
Hashtbl.fold (fun _ _ acc -> acc+1) (M.external_proofs g) 0
in
eprintf "expand_row on a goal with %d proofs@." n;
end;
(M.goal_key g),(M.goal_expanded g)
| M.Theory t -> (M.theory_key t),(M.theory_expanded t)
| M.File f -> f.M.file_key,f.M.file_expanded
| M.Proof_attempt a -> a.M.proof_key,false
| M.Transformation tr -> tr.M.transf_key,false
| M.Transformation tr -> tr.M.transf_key,tr.M.transf_expanded
in
if exp then
(eprintf "exp@."; goals_view#expand_row row#path)
else
((*eprintf "col@.";*) goals_view#collapse_row row#path);
if exp then goals_view#expand_to_path row#path else
goals_view#collapse_row row#path;
match any with
| M.Goal g ->
set_row_status row (M.goal_proved g)
......@@ -439,7 +447,7 @@ let init =
begin
Hashtbl.replace model_index ind any;
end;
goals_view#expand_row row#path;
(* useless since it has no child: goals_view#expand_row row#path; *)
goals_model#set ~row:row#iter ~column:icon_column
(match any with
| M.Goal _ -> !image_file
......@@ -1130,12 +1138,15 @@ let save_file () =
let f = !current_file in
if f <> "" then
begin
M.save_session ();
let s = source_view#source_buffer#get_text () in
let c = open_out f in
output_string c s;
close_out c;
reload ()
end
else
info_window `ERROR "No file currently edited"
let (_ : GMenu.image_menu_item) =
file_factory#add_image_item ~key:GdkKeysyms._S
......
This diff is collapsed.
......@@ -98,15 +98,20 @@ module Make(O: OBSERVER) : sig
mutable transf_proved : bool;
transf_key : O.key;
mutable subgoals : goal list;
mutable transf_expanded : bool;
}
(** a transformation of a given goal *)
val set_transf_expanded : transf -> bool -> unit
val goal_name : goal -> string
val goal_expl : goal -> string
val get_task : goal -> Task.task
val goal_key : goal -> O.key
val goal_proved : goal -> bool
val transformations : goal -> (string, transf) Hashtbl.t
val goal_expanded : goal -> bool
val set_goal_expanded : goal -> bool -> unit
type proof_attempt = private
{ prover : prover_data;
......@@ -118,6 +123,8 @@ module Make(O: OBSERVER) : sig
}
(** a proof attempt for a given goal *)
val external_proofs : goal -> (string, proof_attempt) Hashtbl.t
type theory
(** a theory, holding a collection of goals *)
......
......@@ -16,7 +16,7 @@ theory TestInt
use import int.Int
goal Test1: 2+2 = 5
goal Test1: 2+2 = 4
goal Test2: forall x:int. x*x >= 0
......
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