Commit a29004db authored by Zoggy's avatar Zoggy
Browse files

prepare release 3.0: upgrade to ocaml 3.12, lablgtk3, ocf

parent 18b5f706
Release 1.7:
Release 3.0:
- upgrade to ocaml 4.12.0 and lablgtk3
- use Ocf instead of Config_file
Release 1.6:
- more robust handling of required tools version numbers
......
......@@ -584,7 +584,6 @@ PACKAGE_URL=
ac_unique_file="master.Makefile.in"
ac_subst_vars='LTLIBOBJS
LIBOBJS
XMLLIGHT_INCLUDES
CWLIB_BYTE
CWLIB
GELIB_BYTE
......@@ -607,6 +606,7 @@ OCAMLLEX
OCAMLDEP
OCAMLOPT
OCAMLC
PACKAGES
VERSION
ac_prefix_program
target_alias
......@@ -1706,8 +1706,9 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu
VERSION=1.5
VERSION=3.0
PACKAGE_NAME=lablgtk3-extras
PACKAGES=ocf,lablgtk3-sourceview3,xmlm
# The root directory where we will compile
ROOT=`pwd`
......@@ -1722,7 +1723,7 @@ fi
if test ${WINDOWS} = 1 ; then
INCS='-I "C:\ocamlmgw\lib" -I "C:\ocamlmgw\lib\lablgtk2" -ccopt "-LC:/opt/gtk/lib"';
INCS='-I "C:\ocamlmgw\lib" -I "C:\ocamlmgw\lib\lablgtk3" -ccopt "-LC:/opt/gtk/lib"';
echo '
OCAMLDEP="ocamldep.opt"
OCAMLYACC="ocamlyacc"
......@@ -1901,10 +1902,11 @@ CWLIB_BYTE=configwin.cma
# Finally create the master.Makefile.in and other files
ACFILES="master.Makefile src/gtke_version.ml src/gtke_install.ml"
ACFILES="master.Makefile src/gtke_version.ml src/gtke_install.ml src/META"
ac_config_files="$ac_config_files $ACFILES"
......@@ -3063,13 +3065,12 @@ if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then
$as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;}
fi
chmod a-w master.Makefile
chmod a-w src/gtke_version.ml src/gtke_install.ml master.Makefile
chmod a-w src/gtke_version.ml src/gtke_install.ml master.Makefile src/META
# List values
echo "
### Results of configuration ###
Libraries will be installed with findlib (package ${PACKAGE_NAME})
Libraries will be installed with findlib (packages ${PACKAGE_NAME} and ${PACKAGE_NAME}.configwin)
"
......@@ -27,8 +27,9 @@
# check for one particular file of the sources
AC_INIT(master.Makefile.in)
VERSION=1.5
VERSION=3.0
PACKAGE_NAME=lablgtk3-extras
PACKAGES=ocf,lablgtk3-sourceview3,xmlm
# The root directory where we will compile
ROOT=`pwd`
......@@ -42,7 +43,7 @@ AC_ARG_ENABLE(windows,
[ WINDOWS=1])
if test ${WINDOWS} = 1 ; then
INCS='-I "C:\ocamlmgw\lib" -I "C:\ocamlmgw\lib\lablgtk2" -ccopt "-LC:/opt/gtk/lib"';
INCS='-I "C:\ocamlmgw\lib" -I "C:\ocamlmgw\lib\lablgtk3" -ccopt "-LC:/opt/gtk/lib"';
echo '
OCAMLDEP="ocamldep.opt"
OCAMLYACC="ocamlyacc"
......@@ -105,6 +106,9 @@ CWLIB_BYTE=configwin.cma
# substitutions to perform
AC_SUBST(VERSION)
AC_SUBST(PACKAGE_NAME)
AC_SUBST(PACKAGES)
AC_SUBST(OCAMLC)
AC_SUBST(OCAMLOPT)
......@@ -130,19 +134,16 @@ AC_SUBST(GELIB_BYTE)
AC_SUBST(CWLIB)
AC_SUBST(CWLIB_BYTE)
AC_SUBST(XMLLIGHT_INCLUDES)
# Finally create the master.Makefile.in and other files
ACFILES="master.Makefile src/gtke_version.ml src/gtke_install.ml"
ACFILES="master.Makefile src/gtke_version.ml src/gtke_install.ml src/META"
AC_OUTPUT($ACFILES)
chmod a-w master.Makefile
chmod a-w src/gtke_version.ml src/gtke_install.ml master.Makefile
chmod a-w src/gtke_version.ml src/gtke_install.ml master.Makefile src/META
# List values
echo "
### Results of configuration ###
Libraries will be installed with findlib (package ${PACKAGE_NAME})
Libraries will be installed with findlib (packages ${PACKAGE_NAME} and ${PACKAGE_NAME}.configwin)
"
......@@ -7,7 +7,7 @@ doc: ["https://framagit.org/zoggy/lablgtk-extras/"]
dev-repo: "git+https://framagit.org/zoggy/lablgtk-extras.git"
bug-reports: "https://framagit.org/zoggy/lablgtk-extras/-/issues"
name: "lablgtk3-extras"
version: "1.7"
version: "3.0"
synopsis: "A collection of additional tools and libraries to develop ocaml applications based on Lablgtk3"
tags: [
"gtk"
......@@ -21,7 +21,7 @@ build: [
depends: [
"ocaml" {>= "4.12.0"}
"ocamlfind" {build}
"config-file" {>= "1.1"}
"ocf" {>= "0.6.0"}
"xmlm" {>= "1.1.1"}
"lablgtk3" {>= "3.1.1"}
"lablgtk3-sourceview3" {>= "3.1.1"}
......
......@@ -44,7 +44,10 @@ OCAMLDOCOPT= @OCAMLDOC_OPT@
OCAMLPP=
LABLGLADECC=@LABLGLADECC@
VERSION=@VERSION@
PACKAGE_NAME=@PACKAGE_NAME@
PACKAGES=@PACKAGES@
# For installation
##############
......@@ -53,7 +56,6 @@ CP=cp -f
CPDIR=$(CP) -r
RM=rm -fR
MV=mv
PACKAGE_NAME=@PACKAGE_NAME@
GELIB=@GELIB@
GELIB_BYTE=@GELIB_BYTE@
......
description = "Additional libraries for Lablgtk3"
requires = "unix,xmlm,lablgtk3,config-file,lablgtk3.sourceview3"
version = "1.5"
requires = "ocf,lablgtk3-sourceview3,xmlm"
version = "3.0"
archive(byte) = "lablgtkextras.cma"
archive(native) = "lablgtkextras.cmxa"
package "configwin" (
version = "1.5"
version = "3.0"
description = "Easy build of configuration window with GTK"
requires = "lablgtk3-extras"
archive(byte) = "configwin.cma"
......
description = "Additional libraries for Lablgtk3"
requires = "@PACKAGES@"
version = "@VERSION@"
archive(byte) = "lablgtkextras.cma"
archive(native) = "lablgtkextras.cmxa"
package "configwin" (
version = "@VERSION@"
description = "Easy build of configuration window with GTK"
requires = "@PACKAGE_NAME@"
archive(byte) = "configwin.cma"
archive(native) = "configwin.cmxa"
)
......@@ -26,8 +26,7 @@
include ../master.Makefile
PACKAGES=config-file,lablgtk3-sourceview3,xmlm
OF_FLAGS= -package $(PACKAGES)
OF_FLAGS= -package $(PACKAGES) -thread
COMPFLAGS=-annot -g -warn-error +1..49-3
......@@ -100,7 +99,9 @@ install:
$(GELIB) $(GELIB_BYTE) $(GELIB:.cmxa=.a) $(GELIB_CMIFILES) \
$(GELIB_CMOFILES) $(GELIB_CMXFILES) \
$(GELIB_CMXFILES:.cmx=.o) $(GELIB_CMIFILES:.cmi=.mli) \
$(CWLIB) $(CWLIB_BYTE) $(CWLIB:.cmxa=.a) $(CWLIB:.cmxa=.cmi) $(CWLIB:.cmxa=.mli)
$(CWLIB) $(CWLIB_BYTE) $(CWLIB:.cmxa=.a) $(CWLIB_CMIFILES) \
$(CWLIB_CMOFILES) $(CWLIB_CMXFILES) \
$(CWLIB_CMXFILES:.cmx=.o) $(CWLIB:.cmxa=.mli)
uninstall:
@$(OCAMLFIND) remove $(PACKAGE_NAME)
......
......@@ -38,8 +38,8 @@ type return_button =
let string_to_key = Configwin_types.string_to_key
let key_to_string = Configwin_types.key_to_string
let key_cp_wrapper = Configwin_types.key_cp_wrapper
class key_cp = Configwin_types.key_cp
let key_wrapper = Configwin_types.key_wrapper
let key_option = Configwin_types.key_option
let string = Configwin_ihm.string
......
......@@ -54,17 +54,15 @@ type return_button =
(** {2 The key option class (to use with the {!Config_file} library)} *)
val string_to_key : string -> Gdk.Tags.modifier list * int
val key_to_string : Gdk.Tags.modifier list * int -> string
val key_cp_wrapper : (Gdk.Tags.modifier list * int) Config_file.wrappers
val key_wrapper : (Gdk.Tags.modifier list * int) Ocf.wrapper
class key_cp :
?group:Config_file.group ->
string list ->
?short_name:string ->
Gdk.Tags.modifier list * int ->
string -> [Gdk.Tags.modifier list * int] Config_file.cp_custom_type
val key_option :
?doc:string ->
?cb:(Gdk.Tags.modifier list * int -> unit) ->
Gdk.Tags.modifier list * int ->
(Gdk.Tags.modifier list * int) Ocf.conf_option
(** {2 Functions to create parameters} *)
......
......@@ -27,8 +27,6 @@
open Configwin_types
module O = Config_file
let file_html_config = Filename.concat Configwin_messages.home ".configwin_html"
let debug = false
......@@ -37,24 +35,20 @@ let dbg = if debug then prerr_endline else (fun _ -> ())
(** Return the config group for the html config file,
and the option for bindings. *)
let html_config_file_and_option () =
let ini = new O.group in
let bindings = new O.list_cp
Configwin_types.htmlbinding_cp_wrapper
~group: ini
["bindings"]
~short_name: "bd"
[ { html_key = Configwin_types.string_to_key "A-b" ;
html_begin = "<b>";
html_end = "</b>" ;
} ;
{ html_key = Configwin_types.string_to_key "A-i" ;
html_begin = "<i>";
html_end = "</i>" ;
}
]
""
in
ini#read file_html_config ;
let default =
[ { html_key = Configwin_types.string_to_key "A-b" ;
html_begin = "<b>";
html_end = "</b>" ;
} ;
{ html_key = Configwin_types.string_to_key "A-i" ;
html_begin = "<i>";
html_end = "</i>" ;
}
]
in
let bindings = Ocf.list Configwin_types.htmlbinding_wrapper default in
let ini = Ocf.add Ocf.group ["bindings"] bindings in
Ocf.from_file ini file_html_config ;
(ini, bindings)
(** This variable contains the last directory where the user selected a file.*)
......@@ -688,7 +682,7 @@ class html_param_box param =
let (mods, k) = hb.html_key in
Okey.add wview ~mods k (self#exec hb.html_begin hb.html_end)
in
List.iter add_shortcut html_bindings#get;
List.iter add_shortcut (Ocf.get html_bindings);
dbg "html_param_box:end"
end
......
......@@ -25,8 +25,6 @@
(** This module contains the types used in Configwin. *)
open Config_file
let name_to_keysym =
("Button1", Configwin_keys.xk_Pointer_Button1) ::
("Button2", Configwin_keys.xk_Pointer_Button2) ::
......@@ -78,39 +76,34 @@ let key_to_string (m, k) =
[] -> s
| c :: m ->
iter m ((
match c with
`CONTROL -> "C"
| `SHIFT -> "S"
| `LOCK -> "L"
| `MOD1 -> "A"
| `MOD2 -> "2"
| `MOD3 -> "3"
| `MOD4 -> "4"
| `MOD5 -> "5"
| _ -> raise Not_found
) ^ s)
match c with
| `CONTROL -> "C"
| `SHIFT -> "S"
| `LOCK -> "L"
| `MOD1 -> "A"
| `MOD2 -> "2"
| `MOD3 -> "3"
| `MOD4 -> "4"
| `MOD5 -> "5"
| _ -> raise Not_found
) ^ s)
in
iter m ("-" ^ s)
let value_to_key v =
match v with
Raw.String s -> string_to_key s
| _ ->
prerr_endline "value_to_key";
raise Not_found
let key_to_value k =
Raw.String (key_to_string k)
let key_cp_wrapper =
{
to_raw = key_to_value ;
of_raw = value_to_key ;
}
let key_wrapper =
let to_j ?with_doc k = `String (key_to_string k) in
let from_j ?def = function
| `String s -> string_to_key s
| json ->
let msg = Printf.sprintf
"Invalid key %S" (Yojson.Safe.to_string json)
in
failwith msg
in
Ocf.Wrapper.make to_j from_j
(** A class to define key options, with the {!Config_file} module. *)
class key_cp =
[(Gdk.Tags.modifier list * int)] Config_file.cp_custom_type key_cp_wrapper
(** To define key options, with the {!Ocf} module. *)
let key_option ?doc ?cb = Ocf.option ?doc ?cb key_wrapper
(** This type represents a string or filename parameter, or
any other type, depending on the given conversion functions. *)
......@@ -255,19 +248,22 @@ type html_binding = {
mutable html_end : string ;
}
let htmlbinding_cp_wrapper =
let w = Config_file.tuple3_wrappers
key_cp_wrapper
Config_file.string_wrappers
Config_file.string_wrappers
let htmlbinding_wrapper =
let from_hb t = (t.html_key, t.html_begin, t.html_end) in
let w = Ocf.Wrapper.triple
key_wrapper
Ocf.Wrapper.string
Ocf.Wrapper.string
in
{
to_raw = (fun v -> w.to_raw (v.html_key, v.html_begin, v.html_end)) ;
of_raw =
(fun r -> let (k,b,e) = w.of_raw r in
{ html_key = k ; html_begin = b ; html_end = e }
) ;
}
let to_j ?with_doc t = w.Ocf.Wrapper.to_json ?with_doc (from_hb t) in
let from_j ?def json =
let def = match def with
| None -> None
| Some hb -> Some (from_hb hb)
in
let (k,b,e) = w.from_json ?def json in
{ html_key = k ; html_begin = b ; html_end = e }
in
Ocf.Wrapper.make to_j from_j
class htmlbinding_cp =
[html_binding] Config_file.option_cp htmlbinding_cp_wrapper
let htmlbinding_option ?doc ?cb = Ocf.option ?doc ?cb htmlbinding_wrapper
......@@ -35,7 +35,8 @@ let home =
let sourceviews_basename = "sourceviews";;
let rc_dir =
let d = Filename.concat home ".mlgtksourceview2" in
let d_config = Filename.concat home ".config" in
let d = Filename.concat d_config "mlgtksourceview3" in
let exist =
try (Unix.stat d).Unix.st_kind = Unix.S_DIR
with _ -> false
......@@ -43,15 +44,16 @@ let rc_dir =
if not exist then
begin
try
(try Unix.mkdir d_config 0o700 with _ -> ());
Unix.mkdir d 0o700;
let old_d = Filename.concat home ".mlgtksourceview" in
let old_sv_file = Filename.concat old_d sourceviews_basename in
let new_sv_file = Filename.concat d sourceviews_basename in
if Sys.file_exists old_sv_file then
let old_d = Filename.concat home ".mlgtksourceview2" in
(*let old_sv_file = Filename.concat old_d sourceviews_basename in
let new_sv_file = Filename.concat d sourceviews_basename in*)
if Sys.file_exists old_d then
begin
let com = Printf.sprintf "cp %s %s"
(Filename.quote old_sv_file)
(Filename.quote new_sv_file)
let com = Printf.sprintf "cp %s/* %s/"
(Filename.quote old_d)
(Filename.quote d)
in
ignore (Sys.command com)
end;
......@@ -112,24 +114,20 @@ let source_style_scheme_by_name ?(manager=source_style_scheme_manager) name =
let scheme_rc_file = Filename.concat rc_dir "source_style_scheme";;
let scheme_options_group () =
let scheme_group = new Config_file.group in
let scheme_name = new Config_file.option_cp
Config_file.string_wrappers
~group: scheme_group
["scheme_name"] None ""
in
let scheme_name = Ocf.(option_ Wrapper.string None) in
let scheme_group = Ocf.add Ocf.group ["scheme_name"] scheme_name in
(scheme_group, scheme_name)
;;
let store_style_scheme_selection sss =
let (group, name) = scheme_options_group () in
name#set (match sss with None -> None | Some sss -> Some sss#name);
group#write scheme_rc_file;;
Ocf.set name (match sss with None -> None | Some sss -> Some sss#name);
Ocf.to_file group scheme_rc_file;;
let read_style_scheme_selection ?(manager=source_style_scheme_manager) () =
let (group, name) = scheme_options_group () in
group#read scheme_rc_file;
match name#get with
Ocf.from_file group scheme_rc_file;
match Ocf.get name with
None -> None
| Some name -> source_style_scheme_by_name ~manager name
;;
......
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