Commit 2bd9b9e9 authored by erwan's avatar erwan
Browse files

Only display custum mode buttons if sasa uses -custd

parent 4260d18d
# Time-stamp: <modified the 04/05/2021 (at 11:11) by Erwan Jahier>
# Time-stamp: <modified the 06/05/2021 (at 14:39) by Erwan Jahier>
sasa=$(DIR)/bin/sasa -l 100
......@@ -58,11 +58,11 @@ rdbgui-demo: grid10.ml
rdbg-luciole: grid4.ml
echo "" > include.ml
rdbg --luciole -sut "sasa -rif grid4.dot --custom-daemon" --missing-vars-last
rdbg --luciole -sut "sasa -rif grid4.dot --custom-daemon"
rdbgui-luciole: grid4.ml
rdbgui-custd: grid4.ml
echo "" > include.ml
rdbgui4sasa --luciole -sut "sasa -rif grid4.dot --custom-daemon" --missing-vars-last
rdbgui4sasa -sut "sasa -rif grid4.dot --custom-daemon"
rdbg3: ring.ml
......
......@@ -399,15 +399,27 @@ let main () =
Printf.fprintf oc_stdin "print_sasa_event false !e;;\n%!"; (* print the first event *)
let bbox = GPack.hbox ~packing: box#add () in
let ze_step =
if custom_mode then
custom_daemon text_out w
else
s
in
let step () =
ze_step();
d()
in
let change_label button str =
let icon = button#image in
button#set_label str;
button#set_image icon
button#set_image icon;
refresh ()
in
let button_cb cmd () =
cmd ();
let txt = Printf.sprintf "%s" (str_of_sasa_event false !e) in
text_out#buffer#set_text txt
text_out#buffer#set_text txt;
refresh ()
in
let button_cb_string cmd () =
let txt = Printf.sprintf "%s" (cmd ()) in
......@@ -426,7 +438,7 @@ let main () =
in
step_button#misc#set_tooltip_text "Move FORWARD to the next STEP";
change_label step_button "_Step";
ignore (step_button#connect#clicked ~callback:(button_cb sd));
ignore (step_button#connect#clicked ~callback:(button_cb step));
let back_round_button =
GButton.button ~packing:bbox#add ~stock:`MEDIA_PREVIOUS ~use_mnemonic:true
......@@ -567,36 +579,36 @@ let main () =
"Use osage, but show only links to the parent (works if State.t contains a 'par:int' field)";
ignore (par_dot_button#connect#clicked
~callback:(fun () ->
p ((par_dot_button#misc#tooltip_text)^"\n"^(help_string "d_par"));
dot_view := d_par; !dot_view()));
p ((par_dot_button#misc#tooltip_text)^"\n"^(help_string "d_par"));
dot_view := d_par; !dot_view()));
ignore (par_fd_button#connect#clicked
~callback:(fun () ->
p ((par_fd_button#misc#tooltip_text)^"\n"^(help_string "fd_par"));
dot_view := fd_par; !dot_view()));
p ((par_fd_button#misc#tooltip_text)^"\n"^(help_string "fd_par"));
dot_view := fd_par; !dot_view()));
ignore (par_sf_button#connect#clicked
~callback:(fun () ->
p ((par_sf_button#misc#tooltip_text)^"\n"^(help_string "sf_par"));
dot_view := sf_par; !dot_view()));
p ((par_sf_button#misc#tooltip_text)^"\n"^(help_string "sf_par"));
dot_view := sf_par; !dot_view()));
ignore (par_ne_button#connect#clicked
~callback:(fun () ->
p ((par_ne_button#misc#tooltip_text)^"\n"^(help_string "ne_par"));
dot_view := ne_par; !dot_view()));
p ((par_ne_button#misc#tooltip_text)^"\n"^(help_string "ne_par"));
dot_view := ne_par; !dot_view()));
ignore (par_tw_button#connect#clicked
~callback:(fun () ->
p ((par_tw_button#misc#tooltip_text)^"\n"^(help_string "tw_par"));
dot_view := tw_par; !dot_view()));
p ((par_tw_button#misc#tooltip_text)^"\n"^(help_string "tw_par"));
dot_view := tw_par; !dot_view()));
ignore (par_ci_button#connect#clicked
~callback:(fun () ->
p ((par_ci_button#misc#tooltip_text)^"\n"^(help_string "ci_par"));
dot_view := ci_par; !dot_view()));
p ((par_ci_button#misc#tooltip_text)^"\n"^(help_string "ci_par"));
dot_view := ci_par; !dot_view()));
ignore (par_pa_button#connect#clicked
~callback:(fun () ->
p ((par_pa_button#misc#tooltip_text)^"\n"^(help_string "pa_par"));
dot_view := pa_par; !dot_view()));
p ((par_pa_button#misc#tooltip_text)^"\n"^(help_string "pa_par"));
dot_view := pa_par; !dot_view()));
ignore (par_os_button#connect#clicked
~callback:(fun () ->
p ((par_os_button#misc#tooltip_text)^"\n"^(help_string "os_par"));
dot_view := os_par; !dot_view()))
p ((par_os_button#misc#tooltip_text)^"\n"^(help_string "os_par"));
dot_view := os_par; !dot_view()))
in
let have_parent () = (* is there a parent field in the state ? *)
......@@ -654,14 +666,13 @@ let main () =
(* Affichage d'informations *)
(* let gtext_content = ref "" in *)
let step = custom_daemon text_out w in
refresh ()
let gui = main
(* todo
- couper les grosses fonctions en morceaux
- cacher les messages issus du #use
- lire les commandes dans text_in
- ne pas afficher la bouton demons custom pour les sessions pas custom
- cacher les boutons de rounds en mode manuel
- cacher le bouton step en mode manuel central
- faire les modes automatiques
......@@ -671,4 +682,5 @@ let gui = main
https://lazka.github.io/pgi-docs/Gtk-3.0/classes/SpinButton.html#Gtk.SpinButton
*)
;;
gui()
gui();;
let quote str = if String.contains str ' ' then ("\""^str^"\"") else str
let gui =
Printf.sprintf " --ocaml-cmd \"#use \\\"gtkgui.ml\\\";;\""
let rdbg_cmd =
String.concat " " ("rdbg"::(List.tl (List.map quote (Array.to_list Sys.argv)))) ^
" --ocaml-cmd \"#use \\\"gtkgui.ml\\\";;\""
String.concat " " ("rdbg"::(List.tl (List.map quote (Array.to_list Sys.argv)))) ^ gui
let welcome () =
Printf.printf "rdbgui4sasa is a GUI wrapper around rdbg when used with sasa\n";
......
Supports Markdown
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