# # # patch "autocolor.ml" # from [9d59f87e56d79aad8c632cff38b12fab557814df] # to [7a11e879e6fa3d3ec1a812b1c2b3146ed8c14bf7] # # patch "database.mli" # from [a3da1f59cd5330dfc47c0ba6e854c75c19f83a6f] # to [e625fe5288be50deeba869016d15b7a60a716da4] # # patch "ui.ml" # from [d87af029600a71eb22e88ecd31c17d788ceabba4] # to [cb79a5993595b871401f3526c39f3cc65691e4b9] # # patch "viz_style.ml" # from [9f453028636cbd6f0dbc058a8cbb38a4880c563e] # to [16b9d44d9f49fea0f4e4c6fff304ba88721833eb] # # patch "viz_types.ml" # from [392de3299992cb0b698cc920941cf4ad6a87a78b] # to [b177305737662bf59ed350101297330d685fdece] # # patch "viz_types.mli" # from [a26eeb13ea1ec9c013b24223091d747033070f0c] # to [ef5c4f984fb95cf80c5e14ed740614a6547daf39] # ============================================================ --- autocolor.ml 9d59f87e56d79aad8c632cff38b12fab557814df +++ autocolor.ml 7a11e879e6fa3d3ec1a812b1c2b3146ed8c14bf7 @@ -44,42 +44,14 @@ let autocolor_hash s = s hue li sat r g b ; rgba_color triplet -let quasi_random n = - let v = ref (float n) in - for i = 1 to 8 do - let d = float (n lsr i) /. float (1 lsl i) in - if i mod 2 = 1 - then v := !v -. d - else v := !v +. d - done ; - fst (modf (!v /. 2.)) - -let hex = [| 0.; 1./.3.; 2./.3.; 1./.6.; 3./.6.; 5./.6. |] -let quasi_random_hue n = - let displ = quasi_random (n / 6) in - hex.(n mod 6) +. displ /. 6. - let white = 0xffffffffl -let autocolor_quasi_random db s = - try - let id = Database.get_key_rowid db s in - let hue = quasi_random_hue id in - let (r, g, b) as triplet = hls_to_rgb hue 0.75 0.75 in - if Viz_misc.debug "color" - then Printf.eprintf - "autocolor (%30s) = id=%2d H=%.2f R=%3d G=%3d B=%3d\n%!" s id hue r g b ; - rgba_color triplet - with Not_found -> - white - let autocolor kind db = let lookup_autocolor = Viz_misc.make_cache begin match kind with | NONE -> (fun id -> white) - | BY_KEYID -> autocolor_quasi_random db | BY_AUTHOR_HASH -> autocolor_hash | BY_BRANCH_HASH -> autocolor_hash end in ============================================================ --- database.mli a3da1f59cd5330dfc47c0ba6e854c75c19f83a6f +++ database.mli e625fe5288be50deeba869016d15b7a60a716da4 @@ -19,7 +19,7 @@ val get_matching_ids : t -> string -> val get_matching_dates : t -> string -> (string * string) list val get_matching_ids : t -> string -> (string * string) list -val get_key_rowid : t -> string -> int +(* val get_key_rowid : t -> string -> int *) val run_monotone_diff : t -> string -> ============================================================ --- ui.ml d87af029600a71eb22e88ecd31c17d788ceabba4 +++ ui.ml cb79a5993595b871401f3526c39f3cc65691e4b9 @@ -208,7 +208,6 @@ module Prefs = struct if group = None then Some b#group else group) None [ "no automatic coloring", NONE ; - "color by key_id", BY_KEYID ; "color by author", BY_AUTHOR_HASH ; "color by branch", BY_BRANCH_HASH ] ) end ; ============================================================ --- viz_style.ml 9f453028636cbd6f0dbc058a8cbb38a4880c563e +++ viz_style.ml 16b9d44d9f49fea0f4e4c6fff304ba88721833eb @@ -38,13 +38,11 @@ let autocolor_of_item = function let autocolor_of_item = function | `STRING "none" | `BOOL false -> NONE - | `STRING "key" | `STRING "keyid" -> BY_KEYID | `STRING "author" -> BY_AUTHOR_HASH | `STRING "branch" -> BY_BRANCH_HASH | _ -> failwith "autocolor_of_item" let string_of_autocolor = function | NONE -> "none" - | BY_KEYID -> "key" | BY_AUTHOR_HASH -> "author" | BY_BRANCH_HASH -> "branch" let item_of_autocolor ac = @@ -154,7 +152,6 @@ let match_style { autocolor = autocolor_ else begin let autocolor_key = match autocolor_pref with - | BY_KEYID -> Database.fetch_cert_signer db id "branch" | BY_AUTHOR_HASH -> Database.fetch_cert_value db id "author" | BY_BRANCH_HASH -> Database.fetch_cert_value db id "branch" | NONE -> [] in @@ -245,7 +242,7 @@ let defaults = let defaults = { font = "Monospace 8" ; - autocolor = BY_KEYID ; + autocolor = BY_AUTHOR_HASH ; lr_layout = false ; monotone_path = "mtn" ; dot_path = "dot" ; ============================================================ --- viz_types.ml 392de3299992cb0b698cc920941cf4ad6a87a78b +++ viz_types.ml b177305737662bf59ed350101297330d685fdece @@ -115,6 +115,5 @@ type autocolor = type autocolor = | NONE - | BY_KEYID | BY_AUTHOR_HASH | BY_BRANCH_HASH ============================================================ --- viz_types.mli a26eeb13ea1ec9c013b24223091d747033070f0c +++ viz_types.mli ef5c4f984fb95cf80c5e14ed740614a6547daf39 @@ -115,6 +115,5 @@ type autocolor = type autocolor = | NONE - | BY_KEYID | BY_AUTHOR_HASH | BY_BRANCH_HASH