Commit 10077337 authored by bguillaum's avatar bguillaum

2.16.1 fix multi-refresh

git-svn-id: svn+ssh://scm.gforge.inria.fr/svnroot/semagramme/dep2pict/trunk@8268 7838e531-6607-4d57-9587-6c381814729c
parent 50c457da
VERSION = 2.16.0
VERSION = 2.16.1
INSTALL_DIR = @prefix@@bindir@
DATA_DIR = @prefix@@datarootdir@/dep2pict/
......
......@@ -70,27 +70,43 @@ let save (ui:ui) () =
| Some file -> writeFile file !current_source
| None -> save_as (ui:ui) ()
(* -------------------------------------------------------------------------------- *)
let open_dep (ui:ui) () =
let sel = GWindow.file_selection ~title:"Open file" ~show:true() in
(* TODO deal with dep|conll... sel#complete ~filter:"*.conll"; *)
let _ = sel#ok_button#connect#clicked
~callback: (fun () ->
current_source := readFile sel#filename;
current_file := Some sel#filename;
sel#destroy ()
) in
let _ = sel#cancel_button#connect#clicked ~callback:(sel#destroy) in
()
(* -------------------------------------------------------------------------------- *)
let reload (ui:ui) () =
match !current_file with
| Some filename -> current_source := readFile filename
| Some filename ->
current_source := readFile filename;
refresh_svg ui ()
| None -> ()
(* -------------------------------------------------------------------------------- *)
let all_files () =
GFile.filter
~name:"All files"
~patterns:[ "*" ] ()
let dep_filter () =
GFile.filter
~name:"Dependency structure"
~patterns:[ "*.dep"; "*.conll" ] ()
let open_dep (ui:ui) () =
let dialog = GWindow.file_chooser_dialog
~action:`OPEN
~title:"Open File"
() in
dialog#add_button_stock `CANCEL `CANCEL ;
dialog#add_select_button_stock `OPEN `OPEN ;
dialog#add_filter (dep_filter ()) ;
dialog#add_filter (all_files ());
begin
match dialog#run () with
| `OPEN ->
current_file := dialog#filename;
reload ui ()
| `DELETE_EVENT | `CANCEL -> ()
end ;
dialog#destroy ()
(* -------------------------------------------------------------------------------- *)
let export format (ui:ui) () =
let title = sprintf "Save file as %s" format in
......@@ -147,15 +163,13 @@ let main ?infos ?file () =
let _ = ui#edit#connect#clicked ~callback:(open_editor ui) in
let _ = ui#save#connect#clicked ~callback:(save ui) in
let _ = ui#save_as#connect#clicked ~callback:(save_as ui) in
let _ = ui#open_btn#connect#clicked
~callback:(fun () -> open_dep ui (); refresh_svg ui ()) in
let _ = ui#reload#connect#clicked
~callback:(fun () -> reload ui (); refresh_svg ui ()) in
let _ = ui#open_btn#connect#clicked ~callback:(open_dep ui) in
let _ = ui#reload#connect#clicked ~callback:(reload ui) in
let _ = ui#zoom#connect#value_changed
~callback:
(fun () ->
current_zoom := ui#zoom#adjustment#value;
current_zoom := ui#zoom#adjustment#value;
refresh_svg ui ()
) in
......@@ -173,8 +187,6 @@ let main ?infos ?file () =
| Some f -> current_file := Some f; reload ui ()
);
refresh_svg ui ();
ui#check_widgets ();
ui#toplevel#show ();
GMain.Main.main ()
......@@ -23,7 +23,7 @@ let _ =
let usage = String.concat "\n" [
"================================================================================";
"=-=-=-=-= dep2pict a tool to draw dependency graphs =-=-=-=-=";
"=-=-=-=-= dep2pict: a tool to draw dependency graphs =-=-=-=-=";
"";
"Usage:";
" * dep2pict <options> input_file output_file convert input_file into output_file" ;
......@@ -35,7 +35,9 @@ let usage = String.concat "\n" [
" * output formats are: png, svg, pdf, dep";
"";
"Options:";
" -i | --infos <string> select infos to display: a '|' separated list of atoms from: \"lemma\", \"pos\", \"lpos\", \"all\", a feature name (default=\"pos\")";
" -i | --infos <string> select infos to display for conll input:";
" <string> is a '|' separated list of atoms from: \"lemma\", \"pos\", \"lpos\", \"all\",";
" (default=\"pos\")";
" -p | --position <int> number of the dep structure to display when input file contains sequence (default=0)";
" -v | --version display version number ("^version^")";
" -h | --help show this help";
......@@ -49,12 +51,13 @@ let output_file = ref None
let position = ref 0
let tips = ref false
let infos = ref []
let infos = ref ["pos"]
let rec parse_arg = function
| [] -> ()
| "-v"::_ | "--version"::_ -> printf "%s\n%!" version; exit 0
| "-h"::_ | "--help"::_ -> printf "%s\n%!" usage; exit 0
| "-i"::i::tail
| "--infos"::i::tail -> infos := Str.split (Str.regexp " *| *") i
......
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