aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorgareuselesinge2013-10-22 09:22:14 +0000
committergareuselesinge2013-10-22 09:22:14 +0000
commitad4343b8daf31569fe46c53032ce5fc409076672 (patch)
tree7672c75cd00842f9170aac78ffacd47bd24ad09c
parent8a4315ed0852b4a7559da977d7e2aa3fe939dd79 (diff)
wg_Detachable: move out of wg_Command
git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/coq/trunk@16903 85f007b7-540e-0410-9357-904b9bb8a0f7
-rw-r--r--ide/ide.mllib1
-rw-r--r--ide/wg_Command.ml78
-rw-r--r--ide/wg_Command.mli30
-rw-r--r--ide/wg_Detachable.ml83
-rw-r--r--ide/wg_Detachable.mli39
5 files changed, 125 insertions, 106 deletions
diff --git a/ide/ide.mllib b/ide/ide.mllib
index 1c07f6c0ec..8bc1337ff1 100644
--- a/ide/ide.mllib
+++ b/ide/ide.mllib
@@ -21,6 +21,7 @@ Sentence
Gtk_parsing
Wg_ProofView
Wg_MessageView
+Wg_Detachable
Wg_Find
Wg_Completion
Wg_ScriptView
diff --git a/ide/wg_Command.ml b/ide/wg_Command.ml
index 6c0d1c3ad0..99caa1c335 100644
--- a/ide/wg_Command.ml
+++ b/ide/wg_Command.ml
@@ -6,85 +6,11 @@
(* * GNU Lesser General Public License Version 2.1 *)
(************************************************************************)
-class type detachable_signals =
- object
- inherit GContainer.container_signals
- method attached : callback:(GObj.widget -> unit) -> unit
- method detached : callback:(GObj.widget -> unit) -> unit
- end
-
-class detachable (obj : ([> Gtk.box] as 'a) Gobject.obj) =
-
- object(self)
- inherit GPack.box_skel (obj :> Gtk.box Gobject.obj) as super
-
- val but = GButton.button ()
- val win = GWindow.window ()
- val frame = GBin.frame ~shadow_type:`NONE ()
- val mutable detached = false
- val mutable detached_cb = (fun _ -> ())
- val mutable attached_cb = (fun _ -> ())
-
- method child = frame#child
- method add = frame#add
- method pack ?from ?expand ?fill ?padding w =
- if frame#all_children = [] then self#add w
- else raise (Invalid_argument "detachable#pack")
-
- method title = win#title
- method set_title = win#set_title
-
- method connect : detachable_signals = object
- inherit GContainer.container_signals_impl obj
- method attached ~callback = attached_cb <- callback
- method detached ~callback = detached_cb <- callback
- end
-
- method show =
- if detached then win#present ()
- else self#misc#show ();
-
- method hide =
- if detached then win#misc#hide ()
- else self#misc#hide ()
-
- method visible = win#misc#visible || self#misc#visible
-
- initializer
- self#set_homogeneous false;
- super#pack ~expand:false but#coerce;
- super#pack ~expand:true ~fill:true frame#coerce;
- win#misc#hide ();
- but#add (GMisc.label
- ~markup:"<span size='x-small'>D\nE\nT\nA\nC\nH</span>" ())#coerce;
- ignore(win#event#connect#delete ~callback:(fun _ ->
- win#misc#hide ();
- frame#misc#reparent self#coerce;
- detached <- false;
- attached_cb self#child;
- true));
- ignore(but#connect#clicked ~callback:(fun _ ->
- frame#misc#reparent win#coerce;
- self#misc#hide ();
- win#present ();
- detached <- true;
- detached_cb self#child;
- ))
-
- end
-
-let detachable ?title =
- GtkPack.Box.make_params [] ~cont:(
- GContainer.pack_container
- ~create:(fun p ->
- let d = new detachable (GtkPack.Box.create `HORIZONTAL p) in
- Option.iter d#set_title title;
- d))
-
open Preferences
class command_window name coqtop =
- let frame = detachable ~title:(Printf.sprintf "Query pane (%s)" name) () in
+ let frame = Wg_Detachable.detachable
+ ~title:(Printf.sprintf "Query pane (%s)" name) () in
let _ = frame#hide in
let _ = GtkData.AccelGroup.create () in
let notebook =
diff --git a/ide/wg_Command.mli b/ide/wg_Command.mli
index 92ad858f46..9799e8a99d 100644
--- a/ide/wg_Command.mli
+++ b/ide/wg_Command.mli
@@ -6,36 +6,6 @@
(* * GNU Lesser General Public License Version 2.1 *)
(************************************************************************)
-class type detachable_signals =
- object
- inherit GContainer.container_signals
- method attached : callback:(GObj.widget -> unit) -> unit
- method detached : callback:(GObj.widget -> unit) -> unit
- end
-
-class detachable : ([> Gtk.box] as 'a) Gobject.obj ->
- object
- inherit GPack.box_skel
- val obj : Gtk.box Gobject.obj
- method connect : detachable_signals
- method child : GObj.widget
- method show : unit
- method hide : unit
- method visible : bool
- method title : string
- method set_title : string -> unit
-
- end
-
-val detachable :
- ?title:string ->
- ?homogeneous:bool ->
- ?spacing:int ->
- ?border_width:int ->
- ?width:int ->
- ?height:int ->
- ?packing:(GObj.widget -> unit) -> ?show:bool -> unit -> detachable
-
class command_window : string -> Coq.coqtop ->
object
method new_query : ?command:string -> ?term:string -> unit -> unit
diff --git a/ide/wg_Detachable.ml b/ide/wg_Detachable.ml
new file mode 100644
index 0000000000..787b9aec9c
--- /dev/null
+++ b/ide/wg_Detachable.ml
@@ -0,0 +1,83 @@
+(************************************************************************)
+(* v * The Coq Proof Assistant / The Coq Development Team *)
+(* <O___,, * INRIA - CNRS - LIX - LRI - PPS - Copyright 1999-2012 *)
+(* \VV/ **************************************************************)
+(* // * This file is distributed under the terms of the *)
+(* * GNU Lesser General Public License Version 2.1 *)
+(************************************************************************)
+
+class type detachable_signals =
+ object
+ inherit GContainer.container_signals
+ method attached : callback:(GObj.widget -> unit) -> unit
+ method detached : callback:(GObj.widget -> unit) -> unit
+ end
+
+class detachable (obj : ([> Gtk.box] as 'a) Gobject.obj) =
+
+ object(self)
+ inherit GPack.box_skel (obj :> Gtk.box Gobject.obj) as super
+
+ val but = GButton.button ()
+ val win = GWindow.window ()
+ val frame = GBin.frame ~shadow_type:`NONE ()
+ val mutable detached = false
+ val mutable detached_cb = (fun _ -> ())
+ val mutable attached_cb = (fun _ -> ())
+
+ method child = frame#child
+ method add = frame#add
+ method pack ?from ?expand ?fill ?padding w =
+ if frame#all_children = [] then self#add w
+ else raise (Invalid_argument "detachable#pack")
+
+ method title = win#title
+ method set_title = win#set_title
+
+ method connect : detachable_signals = object
+ inherit GContainer.container_signals_impl obj
+ method attached ~callback = attached_cb <- callback
+ method detached ~callback = detached_cb <- callback
+ end
+
+ method show =
+ if detached then win#present ()
+ else self#misc#show ();
+
+ method hide =
+ if detached then win#misc#hide ()
+ else self#misc#hide ()
+
+ method visible = win#misc#visible || self#misc#visible
+
+ initializer
+ self#set_homogeneous false;
+ super#pack ~expand:false but#coerce;
+ super#pack ~expand:true ~fill:true frame#coerce;
+ win#misc#hide ();
+ but#add (GMisc.label
+ ~markup:"<span size='x-small'>D\nE\nT\nA\nC\nH</span>" ())#coerce;
+ ignore(win#event#connect#delete ~callback:(fun _ ->
+ win#misc#hide ();
+ frame#misc#reparent self#coerce;
+ detached <- false;
+ attached_cb self#child;
+ true));
+ ignore(but#connect#clicked ~callback:(fun _ ->
+ frame#misc#reparent win#coerce;
+ self#misc#hide ();
+ win#present ();
+ detached <- true;
+ detached_cb self#child;
+ ))
+
+ end
+
+let detachable ?title =
+ GtkPack.Box.make_params [] ~cont:(
+ GContainer.pack_container
+ ~create:(fun p ->
+ let d = new detachable (GtkPack.Box.create `HORIZONTAL p) in
+ Option.iter d#set_title title;
+ d))
+
diff --git a/ide/wg_Detachable.mli b/ide/wg_Detachable.mli
new file mode 100644
index 0000000000..69ff1d71e6
--- /dev/null
+++ b/ide/wg_Detachable.mli
@@ -0,0 +1,39 @@
+(************************************************************************)
+(* v * The Coq Proof Assistant / The Coq Development Team *)
+(* <O___,, * INRIA - CNRS - LIX - LRI - PPS - Copyright 1999-2012 *)
+(* \VV/ **************************************************************)
+(* // * This file is distributed under the terms of the *)
+(* * GNU Lesser General Public License Version 2.1 *)
+(************************************************************************)
+
+class type detachable_signals =
+ object
+ inherit GContainer.container_signals
+ method attached : callback:(GObj.widget -> unit) -> unit
+ method detached : callback:(GObj.widget -> unit) -> unit
+ end
+
+class detachable : ([> Gtk.box] as 'a) Gobject.obj ->
+ object
+ inherit GPack.box_skel
+ val obj : Gtk.box Gobject.obj
+ method connect : detachable_signals
+ method child : GObj.widget
+ method show : unit
+ method hide : unit
+ method visible : bool
+ method title : string
+ method set_title : string -> unit
+
+ end
+
+val detachable :
+ ?title:string ->
+ ?homogeneous:bool ->
+ ?spacing:int ->
+ ?border_width:int ->
+ ?width:int ->
+ ?height:int ->
+ ?packing:(GObj.widget -> unit) -> ?show:bool -> unit -> detachable
+
+