aboutsummaryrefslogtreecommitdiff
path: root/ide/preferences.ml
diff options
context:
space:
mode:
authorherbelin2009-08-14 14:02:23 +0000
committerherbelin2009-08-14 14:02:23 +0000
commit6af2902ddd8ea6d4171b882726e9bb4d2fc45748 (patch)
tree049d8e8c360f11bcd9ac9bc4a60f2c10f6e39adf /ide/preferences.ml
parent79a25a71dd3519d8e7a6bd9f3a004c7c0da3a1b5 (diff)
Tried to make F1 documentation tool working in CoqIDE.
In trunk: New strategy for compiling and finding index_url.txt. After all, this file is not specific to CoqIDE but to the documentation. Hence, it seems better to install it close to the documentation. If the documentation is locally installed, it is easy to find the file index_url.txt but what to do if the documentation is remote? We would need a http getter. Does this mean we have to rely on wget or so? In the absence of answer to this question, it seems reasonable, first to assume the doc to be locally installed, second to have a local copy of index_url.txt ready in the installation directory of CoqIDE. Also added an "automatic" field in the CoqIDE url preference to prevent the user to have to update his preference file every time a new version of Coq is out and the link to the doc change. In 8.2: Added a minima the installation of index_urls.txt but the user will have to update its preferences because the links "http://coq.inria.fr/doc/Reference-Manual010.html#..." do not longer exist. git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/coq/trunk@12278 85f007b7-540e-0410-9357-904b9bb8a0f7
Diffstat (limited to 'ide/preferences.ml')
-rw-r--r--ide/preferences.ml33
1 files changed, 27 insertions, 6 deletions
diff --git a/ide/preferences.ml b/ide/preferences.ml
index 0478978837..daa3839e06 100644
--- a/ide/preferences.ml
+++ b/ide/preferences.ml
@@ -101,6 +101,8 @@ type pref =
mutable opposite_tabs : bool;
}
+let use_default_doc_url = "(automatic)"
+
let (current:pref ref) =
ref {
cmd_coqc = "coqc";
@@ -224,7 +226,6 @@ let save_pref () =
add "opposite_tabs" [string_of_bool p.opposite_tabs] ++
Config_lexer.print_file pref_file
with _ -> prerr_endline "Could not save preferences."
-
let load_pref () =
(try GtkData.AccelMap.load accel_file with _ -> ());
@@ -269,7 +270,10 @@ let load_pref () =
set_command_with_pair_compat "cmd_browse" (fun v -> np.cmd_browse <- v);
set_command_with_pair_compat "cmd_editor" (fun v -> np.cmd_editor <- v);
set_hd "text_font" (fun v -> np.text_font <- Pango.Font.from_string v);
- set_hd "doc_url" (fun v -> np.doc_url <- v);
+ set_hd "doc_url" (fun v ->
+ if not (Flags.is_standard_doc_url v) && v <> use_default_doc_url then
+ prerr_endline ("Warning: Non-standard URL for Coq documentation in preference file: "^v);
+ np.doc_url <- v);
set_hd "library_url" (fun v -> np.library_url <- v);
set_bool "show_toolbar" (fun v -> np.show_toolbar <- v);
set_bool "contextual_menus_on_goal"
@@ -535,11 +539,28 @@ let configure ?(apply=(fun () -> ())) () =
else !current.cmd_browse])
!current.cmd_browse
in
- let doc_url =
- string ~f:(fun s -> !current.doc_url <- s) " Manual URL" !current.doc_url in
+ let doc_url =
+ let predefined = [
+ use_default_doc_url
+ ] in
+ combo
+ "Manual URL"
+ ~f:(fun s -> !current.doc_url <- s)
+ ~new_allowed: true
+ (predefined@[if List.mem !current.doc_url predefined then ""
+ else !current.doc_url])
+ !current.doc_url in
let library_url =
- string ~f:(fun s -> !current.library_url <- s) "Library URL" !current.library_url in
-
+ let predefined = [
+ Coq_config.wwwstdlib
+ ] in
+ combo
+ "Library URL"
+ ~f:(fun s -> !current.library_url <- s)
+ (predefined@[if List.mem !current.library_url predefined then ""
+ else !current.library_url])
+ !current.library_url
+ in
let automatic_tactics =
strings
~f:(fun l -> !current.automatic_tactics <- l)