X-Git-Url: http://matita.cs.unibo.it/gitweb/?a=blobdiff_plain;ds=sidebyside;f=helm%2Focaml%2Flogger%2Fui_logger.ml;h=09e50e6273a1071fdc75be1c8a22b2c397c72d03;hb=d3c72d6856cd185e5b3e9f2e8b928b78c7031ed1;hp=0197486135de534f9d8180426c627068aeadc630;hpb=05a96edc1a298d5a6d92919e0b68f0377604387f;p=helm.git diff --git a/helm/ocaml/logger/ui_logger.ml b/helm/ocaml/logger/ui_logger.ml index 019748613..09e50e627 100644 --- a/helm/ocaml/logger/ui_logger.ml +++ b/helm/ocaml/logger/ui_logger.ml @@ -11,12 +11,37 @@ type html_tag = type html_msg = [ `Error of html_tag | `Msg of html_tag ] -class html_logger ~width ~height ~packing ~show () = - let scrolled_window = GBin.scrolled_window ~packing ~show () in +let string_of_html_msg = + let rec string_of_html_tag = function + | `T s -> s + | `L msgs -> String.concat "\n" (List.map string_of_html_tag msgs) + | `BR -> "\n" + in + function + | `Error tag -> "Error: " ^ string_of_html_tag tag + | `Msg tag -> string_of_html_tag tag + +let html_of_html_msg = + let rec string_of_html_tag = function + | `T s -> s + | `L msgs -> + sprintf "" + (String.concat "\n" + (List.map + (fun msg -> sprintf "
  • %s
  • " (string_of_html_tag msg)) + msgs)) + | `BR -> "
    \n" + in + function + | `Error tag -> "Error: " ^ string_of_html_tag tag ^ "" + | `Msg tag -> string_of_html_tag tag + +class html_logger ?width ?height ?packing ?show () = + let scrolled_window = GBin.scrolled_window ?packing ?show () in let vadj = scrolled_window#vadjustment in let tv = GText.view ~editable:false ~cursor_visible:false - ~width ~height ~packing:(scrolled_window#add) () + ?width ?height ~packing:(scrolled_window#add) () in let green = tv#buffer#create_tag