method do_cyclo (main_ui:Design.main_window_extension_points) =
Metrics_parameters.debug "Cyclo";
let dialog = GWindow.window
~title:"Measure"
~modal:false
~position:`CENTER_ON_PARENT
~width:300 ~height:300 ~border_width:3
~resizable:true
()
in
dialog#set_transient_for main_ui#main_window#as_window;
let a_vbox = GPack.vbox ~packing:dialog#add () in
ignore (dialog#event#connect#delete
~callback:(fun _ -> dialog#misc#hide ();
true));
let data = self#get_data in
let (slocs, ifs, assigns, loops, calls, gotos, mems, cyclos) = data in
let add_label msg n =
let text = msg ^ string_of_int n in
ignore (GMisc.label ~text ~packing:a_vbox#add ())
in
add_label "#Lines of source code: " slocs;
add_label "#Lines of if statements: " ifs;
add_label "#Lines of assignments: " assigns;
add_label "#Lines of loops: " loops;
add_label "#Lines of function calls: " calls;
add_label "#Lines of gotos: " gotos;
add_label "#Lines of memory accesses: " mems;
add_label "Cyclomatic complexity: " cyclos;
let close_button = GButton.button ~stock:`OK ~packing:a_vbox#add () in
close_button#set_border_width 10;
ignore (close_button#connect#clicked ~callback:dialog#misc#hide);
dialog#show ()