method do_cyclo (main_ui:Design.main_window_extension_points) =
Metrics_parameters.Metrics.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 metrics_data = self#get_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: " metrics_data.cslocs;
add_label "# of if statements: " metrics_data.cifs;
add_label "# of assignments: " metrics_data.cassigns;
add_label "# of loops: " metrics_data.cloops;
add_label "# of function calls: " metrics_data.ccalls;
add_label "# of gotos: " metrics_data.cgotos;
add_label "# of indirect memory accesses: " metrics_data.cptrs;
add_label "Cyclomatic complexity: " (cyclo metrics_data);
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 ()