+class page () =
+ let vbox1 = GPack.vbox () in
+ let scrolled_window1 =
+ GBin.scrolled_window ~border_width:10
+ ~packing:(vbox1#pack ~expand:true ~padding:5) () in
+ let proofw =
+ GMathView.math_view ~width:400 ~height:275
+ ~packing:(scrolled_window1#add) () in
+ let hbox3 =
+ GPack.hbox ~packing:(vbox1#pack ~expand:false ~fill:false ~padding:5) () in
+ let exactb =
+ GButton.button ~label:"Exact"
+ ~packing:(hbox3#pack ~expand:false ~fill:false ~padding:5) () in
+ let introsb =
+ GButton.button ~label:"Intros"
+ ~packing:(hbox3#pack ~expand:false ~fill:false ~padding:5) () in
+ let applyb =
+ GButton.button ~label:"Apply"
+ ~packing:(hbox3#pack ~expand:false ~fill:false ~padding:5) () in
+ let elimsimplintrosb =
+ GButton.button ~label:"ElimSimplIntros"
+ ~packing:(hbox3#pack ~expand:false ~fill:false ~padding:5) () in
+ let elimtypeb =
+ GButton.button ~label:"ElimType"
+ ~packing:(hbox3#pack ~expand:false ~fill:false ~padding:5) () in
+ let whdb =
+ GButton.button ~label:"Whd"
+ ~packing:(hbox3#pack ~expand:false ~fill:false ~padding:5) () in
+ let reduceb =
+ GButton.button ~label:"Reduce"
+ ~packing:(hbox3#pack ~expand:false ~fill:false ~padding:5) () in
+ let simplb =
+ GButton.button ~label:"Simpl"
+ ~packing:(hbox3#pack ~expand:false ~fill:false ~padding:5) () in
+ let foldb =
+ GButton.button ~label:"Fold"
+ ~packing:(hbox3#pack ~expand:false ~fill:false ~padding:5) () in
+ let cutb =
+ GButton.button ~label:"Cut"
+ ~packing:(hbox3#pack ~expand:false ~fill:false ~padding:5) () in
+ let changeb =
+ GButton.button ~label:"Change"
+ ~packing:(hbox3#pack ~expand:false ~fill:false ~padding:5) () in
+ let hbox4 =
+ GPack.hbox ~packing:(vbox1#pack ~expand:false ~fill:false ~padding:5) () in
+ let letinb =
+ GButton.button ~label:"Let ... In"
+ ~packing:(hbox4#pack ~expand:false ~fill:false ~padding:5) () in
+ let ringb =
+ GButton.button ~label:"Ring"
+ ~packing:(hbox4#pack ~expand:false ~fill:false ~padding:5) () in
+ let clearbodyb =
+ GButton.button ~label:"ClearBody"
+ ~packing:(hbox4#pack ~expand:false ~fill:false ~padding:5) () in
+ let clearb =
+ GButton.button ~label:"Clear"
+ ~packing:(hbox4#pack ~expand:false ~fill:false ~padding:5) () in
+ let fourierb =
+ GButton.button ~label:"Fourier"
+ ~packing:(hbox4#pack ~expand:false ~fill:false ~padding:5) () in
+ let rewritesimplb =
+ GButton.button ~label:"RewriteSimpl ->"
+ ~packing:(hbox4#pack ~expand:false ~fill:false ~padding:5) () in
+ let reflexivityb =
+ GButton.button ~label:"Reflexivity"
+ ~packing:(hbox4#pack ~expand:false ~fill:false ~padding:5) () in
+ let symmetryb =
+ GButton.button ~label:"Symmetry"
+ ~packing:(hbox4#pack ~expand:false ~fill:false ~padding:5) () in
+ let transitivityb =
+ GButton.button ~label:"Transitivity"
+ ~packing:(hbox4#pack ~expand:false ~fill:false ~padding:5) () in
+ let hbox5 =
+ GPack.hbox ~packing:(vbox1#pack ~expand:false ~fill:false ~padding:5) () in
+ let leftb =
+ GButton.button ~label:"Left"
+ ~packing:(hbox5#pack ~expand:false ~fill:false ~padding:5) () in
+ let rightb =
+ GButton.button ~label:"Right"
+ ~packing:(hbox5#pack ~expand:false ~fill:false ~padding:5) () in
+ let assumptionb =
+ GButton.button ~label:"Assumption"
+ ~packing:(hbox5#pack ~expand:false ~fill:false ~padding:5) () in
+object
+ method proofw = proofw
+ method content = vbox1
+ initializer
+ ignore(exactb#connect#clicked exact) ;
+ ignore(applyb#connect#clicked apply) ;
+ ignore(elimsimplintrosb#connect#clicked elimsimplintros) ;
+ ignore(elimtypeb#connect#clicked elimtype) ;
+ ignore(whdb#connect#clicked whd) ;
+ ignore(reduceb#connect#clicked reduce) ;
+ ignore(simplb#connect#clicked simpl) ;
+ ignore(foldb#connect#clicked fold) ;
+ ignore(cutb#connect#clicked cut) ;
+ ignore(changeb#connect#clicked change) ;
+ ignore(letinb#connect#clicked letin) ;
+ ignore(ringb#connect#clicked ring) ;
+ ignore(clearbodyb#connect#clicked clearbody) ;
+ ignore(clearb#connect#clicked clear) ;
+ ignore(fourierb#connect#clicked fourier) ;
+ ignore(rewritesimplb#connect#clicked rewritesimpl) ;
+ ignore(reflexivityb#connect#clicked reflexivity) ;
+ ignore(symmetryb#connect#clicked symmetry) ;
+ ignore(transitivityb#connect#clicked transitivity) ;
+ ignore(leftb#connect#clicked left) ;
+ ignore(rightb#connect#clicked right) ;
+ ignore(assumptionb#connect#clicked assumption) ;
+ ignore(introsb#connect#clicked intros) ;
+ initializer
+ ignore(proofw#connect#selection_changed (choose_selection proofw)) ;
+end
+;;
+
+class notebook =
+object(self)
+ val notebook = GPack.notebook ()
+ val pages = ref []
+ val mutable skip_switch_page_event = false
+ method notebook = notebook
+ method add_page n =
+ let new_page = new page () in
+ pages := !pages @ [n,new_page] ;
+ notebook#append_page
+ ~tab_label:((GMisc.label ~text:("?" ^ string_of_int n) ())#coerce)
+ new_page#content#coerce
+ method remove_all_pages =
+ List.iter (function _ -> notebook#remove_page 0) !pages ;
+ pages := [] ;
+ method set_current_page n =
+ let (_,page) = List.find (function (m,_) -> m=n) !pages in
+ let new_page = notebook#page_num page#content#coerce in
+ if new_page <> notebook#current_page then
+ skip_switch_page_event <- true ;
+ notebook#goto_page new_page
+ method set_empty_page = self#add_page (-1)
+ method proofw =
+ (snd (List.nth !pages notebook#current_page))#proofw
+ initializer
+ ignore
+ (notebook#connect#switch_page
+ (function i ->
+ let skip = skip_switch_page_event in
+ skip_switch_page_event <- false ;
+ if not skip then
+ try
+ let metano = fst (List.nth !pages i) in
+ setgoal metano
+ with _ -> ()
+ ))
+end
+;;
+