diff options
author | Jacques Garrigue <garrigue at math.nagoya-u.ac.jp> | 2000-04-13 01:11:06 +0000 |
---|---|---|
committer | Jacques Garrigue <garrigue at math.nagoya-u.ac.jp> | 2000-04-13 01:11:06 +0000 |
commit | 4b7ca40b53bbd2d36abecda486c5079021bfd790 (patch) | |
tree | 536669938c09abf06a9a4e526f23811e482c10fe | |
parent | e99d8eabe870067614a2d1ef4fccc0bcb365c596 (diff) |
suppress canvas: label
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@3068 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
-rw-r--r-- | otherlibs/labltk/Widgets.src | 62 | ||||
-rw-r--r-- | otherlibs/labltk/builtin/canvas_bind.ml | 4 | ||||
-rw-r--r-- | otherlibs/labltk/builtin/canvas_bind.mli | 9 | ||||
-rw-r--r-- | otherlibs/labltk/example/clock.ml | 35 | ||||
-rw-r--r-- | otherlibs/labltk/example/eyes.ml | 2 | ||||
-rw-r--r-- | otherlibs/labltk/example/tetris.ml | 34 |
6 files changed, 73 insertions, 73 deletions
diff --git a/otherlibs/labltk/Widgets.src b/otherlibs/labltk/Widgets.src index 7fdf547af..52f715062 100644 --- a/otherlibs/labltk/Widgets.src +++ b/otherlibs/labltk/Widgets.src @@ -402,7 +402,7 @@ widget canvas { function () addtag [widget(canvas); "addtag"; tag: string; specs: SearchSpec list] # Tag only # bbox not fully supported. should be builtin because of ambiguous result # will raise protocol__TkError if no items match TagOrId - function (int,int,int,int) bbox [canvas: widget(canvas); "bbox"; TagOrId list] + function (int,int,int,int) bbox [widget(canvas); "bbox"; TagOrId list] external bind "builtin/canvas_bind" function (float) canvasx [widget(canvas); "canvasx"; x:int; ?spacing:[int]] # function (float) canvasx [widget(canvas); "canvasx"; x:int] @@ -413,38 +413,38 @@ widget canvas { function () configure [widget(canvas); "configure"; option(canvas) list] function (string) configure_get [widget(canvas); "configure"] # TODO: check result - function (float list) coords_get [canvas: widget(canvas); "coords"; TagOrId] - function () coords_set [canvas: widget(canvas); "coords"; TagOrId; coords: int list] + function (float list) coords_get [widget(canvas); "coords"; TagOrId] + function () coords_set [widget(canvas); "coords"; TagOrId; coords: int list] # create variations (see below) - function () dchars [canvas: widget(canvas); "dchars"; TagOrId; first: Index(canvas); last: Index(canvas)] - function () delete [canvas: widget(canvas); "delete"; TagOrId list] - function () dtag [canvas: widget(canvas); "dtag"; TagOrId; tag: string] + function () dchars [widget(canvas); "dchars"; TagOrId; first: Index(canvas); last: Index(canvas)] + function () delete [widget(canvas); "delete"; TagOrId list] + function () dtag [widget(canvas); "dtag"; TagOrId; tag: string] function (TagOrId list) find [widget(canvas); "find"; specs: SearchSpec list] # focus variations function () focus_reset [widget(canvas); "focus"; ""] function (TagOrId) focus_get [widget(canvas); "focus"] - function () focus [canvas: widget(canvas); "focus"; TagOrId] - function (string list) gettags [canvas: widget(canvas); "gettags"; TagOrId] - function () icursor [canvas: widget(canvas); "icursor"; TagOrId; index: Index(canvas)] - function (int) index [canvas: widget(canvas); "index"; TagOrId; index: Index(canvas)] - function () insert [canvas: widget(canvas); "insert"; TagOrId; before: Index(canvas); text: string] - function () lower [canvas: widget(canvas); "lower"; TagOrId; ?below: [TagOrId]] - function () move [canvas: widget(canvas); "move"; TagOrId; x: int; y: int] + function () focus [widget(canvas); "focus"; TagOrId] + function (string list) gettags [widget(canvas); "gettags"; TagOrId] + function () icursor [widget(canvas); "icursor"; TagOrId; index: Index(canvas)] + function (int) index [widget(canvas); "index"; TagOrId; index: Index(canvas)] + function () insert [widget(canvas); "insert"; TagOrId; before: Index(canvas); text: string] + function () lower [widget(canvas); "lower"; TagOrId; ?below: [TagOrId]] + function () move [widget(canvas); "move"; TagOrId; x: int; y: int] unsafe function (string) postscript [widget(canvas); "postscript"; option(postscript) list] # We use raise... with Module name - function () raise [canvas: widget(canvas); "raise"; TagOrId; ?above:[TagOrId]] - function () scale [canvas: widget(canvas); "scale"; TagOrId; xorigin: int; yorigin: int; xscale: float; yscale: float] + function () raise [widget(canvas); "raise"; TagOrId; ?above:[TagOrId]] + function () scale [widget(canvas); "scale"; TagOrId; xorigin: int; yorigin: int; xscale: float; yscale: float] # For scan, use x:int and y:int since common usage is with mouse coordinates function () scan_mark [widget(canvas); "scan"; "mark"; x: int; y: int] function () scan_dragto [widget(canvas); "scan"; "dragto"; x: int; y: int] # select variations - function () select_adjust [canvas: widget(canvas); "select"; "adjust"; TagOrId; index: Index(canvas)] + function () select_adjust [widget(canvas); "select"; "adjust"; TagOrId; index: Index(canvas)] function () select_clear [widget(canvas); "select"; "clear"] - function () select_from [canvas: widget(canvas); "select"; "from"; TagOrId; index: Index(canvas)] + function () select_from [widget(canvas); "select"; "from"; TagOrId; index: Index(canvas)] function (TagOrId) select_item [widget(canvas); "select"; "item"] - function () select_to [canvas: widget(canvas); "select"; "to"; TagOrId; index: Index(canvas)] + function () select_to [widget(canvas); "select"; "to"; TagOrId; index: Index(canvas)] - function (CanvasItem) typeof [canvas: widget(canvas); "type"; TagOrId] + function (CanvasItem) typeof [widget(canvas); "type"; TagOrId] function (float,float) xview_get [widget(canvas); "xview"] function (float,float) yview_get [widget(canvas); "yview"] function () xview [widget(canvas); "xview"; scroll: ScrollValue] @@ -461,17 +461,17 @@ widget canvas { function (TagOrId) create_text [widget(canvas); "create"; "text"; x: int; y: int; option(canvastext) list] function (TagOrId) create_window [widget(canvas); "create"; "window"; x: int; y: int; option(window) list] - function (string) itemconfigure_get [canvas: widget(canvas); "itemconfigure"; TagOrId] - - function () configure_arc [canvas: widget(canvas); "itemconfigure"; TagOrId; option(arc) list] - function () configure_bitmap [canvas: widget(canvas); "itemconfigure"; TagOrId; option(bitmap) list] - function () configure_image [canvas: widget(canvas); "itemconfigure"; TagOrId; option(image) list] - function () configure_line [canvas: widget(canvas); "itemconfigure"; TagOrId; option(line) list] - function () configure_oval [canvas: widget(canvas); "itemconfigure"; TagOrId; option(oval) list] - function () configure_polygon [canvas: widget(canvas); "itemconfigure"; TagOrId; option(polygon) list] - function () configure_rectangle [canvas: widget(canvas); "itemconfigure"; TagOrId; option(rectangle) list] - function () configure_text [canvas: widget(canvas); "itemconfigure"; TagOrId; option(canvastext) list] - function () configure_window [canvas: widget(canvas); "itemconfigure"; TagOrId; option(window) list] + function (string) itemconfigure_get [widget(canvas); "itemconfigure"; TagOrId] + + function () configure_arc [widget(canvas); "itemconfigure"; TagOrId; option(arc) list] + function () configure_bitmap [widget(canvas); "itemconfigure"; TagOrId; option(bitmap) list] + function () configure_image [widget(canvas); "itemconfigure"; TagOrId; option(image) list] + function () configure_line [widget(canvas); "itemconfigure"; TagOrId; option(line) list] + function () configure_oval [widget(canvas); "itemconfigure"; TagOrId; option(oval) list] + function () configure_polygon [widget(canvas); "itemconfigure"; TagOrId; option(polygon) list] + function () configure_rectangle [widget(canvas); "itemconfigure"; TagOrId; option(rectangle) list] + function () configure_text [widget(canvas); "itemconfigure"; TagOrId; option(canvastext) list] + function () configure_window [widget(canvas); "itemconfigure"; TagOrId; option(window) list] } @@ -1537,7 +1537,7 @@ widget text { function () debug [widget(text); "debug"; switch: bool] function () delete [widget(text); "delete"; start: TextIndex; stop: TextIndex] function () delete_char [widget(text); "delete"; index: TextIndex] - function (int, int, int, int, int) dlineinfo [ widget(text); "dlineinfo"; index: TextIndex] + function (int, int, int, int, int) dlineinfo [widget(text); "dlineinfo"; index: TextIndex] function (string) get [widget(text); "get"; start: TextIndex; stop: TextIndex] function (string) get_char [widget(text); "get"; index: TextIndex] function () image_configure diff --git a/otherlibs/labltk/builtin/canvas_bind.ml b/otherlibs/labltk/builtin/canvas_bind.ml index 5b6bb9267..1ac0dac2b 100644 --- a/otherlibs/labltk/builtin/canvas_bind.ml +++ b/otherlibs/labltk/builtin/canvas_bind.ml @@ -1,6 +1,6 @@ -let bind ~canvas:widget ~events +let bind ~events ?(extend = false) ?(breakable = false) ?(fields = []) - ?action tag = + ?action widget tag = tkCommand [| cCAMLtoTKwidget widget; TkToken "bind"; diff --git a/otherlibs/labltk/builtin/canvas_bind.mli b/otherlibs/labltk/builtin/canvas_bind.mli index faf4645f6..b680c5fac 100644 --- a/otherlibs/labltk/builtin/canvas_bind.mli +++ b/otherlibs/labltk/builtin/canvas_bind.mli @@ -1,4 +1,7 @@ val bind : - canvas: canvas widget -> events: event list -> - ?extend: bool -> ?breakable: bool -> ?fields: eventField list -> - ?action: (eventInfo -> unit) -> tagOrId -> unit + events: event list -> + ?extend: bool -> + ?breakable: bool -> + ?fields: eventField list -> + ?action: (eventInfo -> unit) -> + canvas widget -> tagOrId -> unit diff --git a/otherlibs/labltk/example/clock.ml b/otherlibs/labltk/example/clock.ml index 58b0a0fae..7c8d21311 100644 --- a/otherlibs/labltk/example/clock.ml +++ b/otherlibs/labltk/example/clock.ml @@ -82,15 +82,14 @@ class clock ~parent = object (self) (* Redraw everything *) method redraw = - Canvas.coords_set ~canvas - ~coords:[ 1; 1; width - 2; height - 2 ] - (`Tag "cadran"); + Canvas.coords_set ~coords:[ 1; 1; width - 2; height - 2 ] + canvas (`Tag "cadran"); self#draw_figures; self#draw_arrows (Unix.localtime (Unix.time ())) (* Delete and redraw the figures *) method draw_figures = - Canvas.delete ~canvas [`Tag "figures"]; + Canvas.delete canvas [`Tag "figures"]; for i = 1 to 12 do let angle = float (rflag * i - 3) *. pi /. 6. in Canvas.create_text @@ -103,29 +102,27 @@ class clock ~parent = object (self) (* Resize and reposition the arrows *) method draw_arrows tm = - Canvas.configure_line ~canvas - ~width:(min width height / 40) - (`Tag "hours"); + Canvas.configure_line ~width:(min width height / 40) + canvas (`Tag "hours"); let hangle = float (rflag * (tm.Unix.tm_hour * 60 + tm.Unix.tm_min) - 180) *. pi /. 360. in - Canvas.coords_set ~canvas + Canvas.coords_set ~coords:[ self#x 0.; self#y 0.; - self#x (cos hangle /. 2.); self#y (sin hangle /. 2.) ] - (`Tag "hours"); - Canvas.configure_line ~canvas - ~width:(min width height / 50) - (`Tag "minutes"); + self#x (cos hangle /. 2.); self#y (sin hangle /. 2.) ] + canvas (`Tag "hours"); + Canvas.configure_line ~width:(min width height / 50) + canvas (`Tag "minutes"); let mangle = float (rflag * tm.Unix.tm_min - 15) *. pi /. 30. in - Canvas.coords_set ~canvas + Canvas.coords_set ~coords:[ self#x 0.; self#y 0.; - self#x (cos mangle /. 1.5); self#y (sin mangle /. 1.5) ] - (`Tag "minutes"); + self#x (cos mangle /. 1.5); self#y (sin mangle /. 1.5) ] + canvas (`Tag "minutes"); let sangle = float (rflag * tm.Unix.tm_sec - 15) *. pi /. 30. in - Canvas.coords_set ~canvas + Canvas.coords_set ~coords:[ self#x 0.; self#y 0.; - self#x (cos sangle /. 1.25); self#y (sin sangle /. 1.25) ] - (`Tag "seconds") + self#x (cos sangle /. 1.25); self#y (sin sangle /. 1.25) ] + canvas (`Tag "seconds") end (* Initialize the Tcl interpreter *) diff --git a/otherlibs/labltk/example/eyes.ml b/otherlibs/labltk/example/eyes.ml index 7aeb1d583..73286d303 100644 --- a/otherlibs/labltk/example/eyes.ml +++ b/otherlibs/labltk/example/eyes.ml @@ -48,7 +48,7 @@ let _ = else e.ev_MouseX, e.ev_MouseY in - Canvas.move ~canvas:c ~x: (nx - !curx) ~y: (ny - !cury) o; + Canvas.move ~x: (nx - !curx) ~y: (ny - !cury) c o; curx := nx; cury := ny) c diff --git a/otherlibs/labltk/example/tetris.ml b/otherlibs/labltk/example/tetris.ml index 613c616f6..70571b114 100644 --- a/otherlibs/labltk/example/tetris.ml +++ b/otherlibs/labltk/example/tetris.ml @@ -213,33 +213,33 @@ class cell t1 t2 t3 ~canvas ~x ~y = object method set ~color:col = if color = col then () else if color <> 0 & col = 0 then begin - Canvas.move t1 ~canvas + Canvas.move canvas t1 ~x:(- block_size * (x + 1) -10 - cell_border * 2) ~y:(- block_size * (y + 1) -10 - cell_border * 2); - Canvas.move t2 ~canvas + Canvas.move canvas t2 ~x:(- block_size * (x + 1) -10 - cell_border * 2) ~y:(- block_size * (y + 1) -10 - cell_border * 2); - Canvas.move t3 ~canvas + Canvas.move canvas t3 ~x:(- block_size * (x + 1) -10 - cell_border * 2) ~y:(- block_size * (y + 1) -10 - cell_border * 2) end else begin - Canvas.configure_rectangle t2 ~canvas + Canvas.configure_rectangle canvas t2 ~fill: colors.(col - 1) ~outline: colors.(col - 1); - Canvas.configure_rectangle t1 ~canvas + Canvas.configure_rectangle canvas t1 ~fill: `Black ~outline: `Black; - Canvas.configure_rectangle t3 ~canvas + Canvas.configure_rectangle canvas t3 ~fill: (`Color "light gray") ~outline: (`Color "light gray"); if color = 0 & col <> 0 then begin - Canvas.move t1 ~canvas + Canvas.move canvas t1 ~x: (block_size * (x+1)+10+ cell_border*2) ~y: (block_size * (y+1)+10+ cell_border*2); - Canvas.move t2 ~canvas + Canvas.move canvas t2 ~x: (block_size * (x+1)+10+ cell_border*2) ~y: (block_size * (y+1)+10+ cell_border*2); - Canvas.move t3 ~canvas + Canvas.move canvas t3 ~x: (block_size * (x+1)+10+ cell_border*2) ~y: (block_size * (y+1)+10+ cell_border*2) end @@ -314,9 +314,9 @@ let init fw = ~x1:(-block_size - 12) ~y1:(-block_size - 12) ~x2:(-13) ~y2:(-13) in - Canvas.raise ~canvas:c t1; - Canvas.raise ~canvas:c t2; - Canvas.lower ~canvas:c t3; + Canvas.raise c t1; + Canvas.raise c t2; + Canvas.lower c t3; new cell ~canvas:c ~x ~y t1 t2 t3 end) in @@ -338,9 +338,9 @@ let init fw = ~x1:(-block_size - 12) ~y1:(-block_size - 12) ~x2:(-13) ~y2:(-13) in - Canvas.raise ~canvas:nc t1; - Canvas.raise ~canvas:nc t2; - Canvas.lower ~canvas:nc t3; + Canvas.raise nc t1; + Canvas.raise nc t2; + Canvas.lower nc t3; new cell ~canvas:nc ~x ~y t1 t2 t3 end) in @@ -551,12 +551,12 @@ let _ = ~x: (block_size * 5 + block_size / 2) ~y: (block_size * 10 + block_size / 2) ~anchor: `Center in - Canvas.lower ~canvas i; + Canvas.lower canvas i; let img = Imagephoto.create () in fun file -> try Imagephoto.configure img ~file: file; - Canvas.configure_image ~canvas i ~image: img + Canvas.configure_image canvas i ~image: img with _ -> begin |