]> git.mdlowis.com Git - archive/tide-ocaml.git/commitdiff
overhauled drawing code to use new mutable cursor type
authorMichael D. Lowis <mike@mdlowis.com>
Wed, 25 Oct 2017 01:58:30 +0000 (21:58 -0400)
committerMichael D. Lowis <mike@mdlowis.com>
Wed, 25 Oct 2017 01:58:30 +0000 (21:58 -0400)
Makefile
edit.ml
lib/draw.ml

index 3057d3b93be773a3f1c92848bafacbd0e12cf3a1..a904b9a65c5d22a3579f490b1f5bf1246739945d 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -4,7 +4,7 @@ INCS = -I . -I lib -I /usr/X11R6/include -I /usr/include/freetype2 -I /usr/X11R6
 LIBS = -L/usr/X11R6/lib -lX11 -lXft -lfontconfig
 
 ifeq ($(NATIVE), 1)
-       OC         = ocamlopt
+    OC         = ocamlopt
     OCFLAGS    = -g
     MKLIB      = ocamlmklib
     MKLIBFLAGS = -custom
diff --git a/edit.ml b/edit.ml
index c3f1250e4f7cc4e0008e01b93c617c38d809335d..8817801cd773b9f0bfdd06869109cc64de1378a2 100644 (file)
--- a/edit.ml
+++ b/edit.ml
@@ -86,17 +86,17 @@ let onmousemove mods x y = ()
 
 let onupdate width height =
   let csr = Draw.Cursor.make (width, height) 0 0 in
-  (*
   Draw.status csr "UNSI> *scratch*";
   Draw.tags csr !tags_buf;
   Draw.scroll csr;
   Draw.edit csr !edit_buf
-  *)
+  (*
   let (pos : drawpos) = { x = 0; y = 0 } in
   let pos = draw_status pos width "UNSI> *scratch*" in
   let pos = draw_tags pos width (height / font.height / 4) "Sample tags data" in
   let pos = draw_scroll pos height in
   let _   = draw_edit pos width height in ()
+  *)
 
 let onshutdown () = ()
 
index 81e4e206f78da537f10da502660f6aaa8da79613..945ca1fc11754e02eb59c11bcfbba4f125e5cbd8 100644 (file)
@@ -9,15 +9,15 @@ module Cursor = struct
   }
 
   let make dim x y =
-    let height, width = dim in
+    let width, height = dim in
     { height = height; width = width;
       startx = x; starty = y; x = x; y = y }
 end
 
-open Cursor
-
 let font = X11.font_load "Verdana:size=11"
 
+open Cursor
+
 let rectangle color width height csr =
   X11.draw_rect (X11.make_rect csr.x csr.y width height color)
 
@@ -38,30 +38,27 @@ let vrule height csr =
   rule_bkg 1 (height - csr.y) csr;
   csr.x <- csr.x + 1
 
-let status csr str = ()
-let tags csr buf = ()
-let scroll csr = ()
-let edit csr buf = ()
-
-(*
+let status csr str =
+  let height = (4 + font.height) in
+  dark_bkg csr.width height csr;
+  string str csr;
+  hrule csr.width csr
 
-let draw_status pos width text =
+let tags csr buf =
   let height = (4 + font.height) in
-  draw_dark_bkg width height pos;
-  let pos = draw_text text pos in
-  draw_hrule width pos
+  light_bkg csr.width height csr;
+  string "Quit Save Undo Redo Cut Copy Paste | Find " csr;
+  hrule csr.width csr
 
-let draw_tags pos width maxlns text =
-  let bkgheight = ((font.height * maxlns) + 4) in
-  draw_light_bkg width bkgheight pos;
-  let pos = draw_text text pos in
-  draw_hrule width pos
+let scroll csr =
+  rule_bkg 14 csr.height csr;
+  dark_bkg 14 (csr.height / 2) csr;
+  csr.x <- csr.x + 14;
+  vrule csr.height csr
 
-let draw_scroll pos height =
-  let rulepos = { pos with x = 14 } in
-  draw_gray_bkg rulepos.x height pos;
-  draw_dark_bkg rulepos.x (height/2) pos;
-  draw_vrule height rulepos
+let edit csr buf = ()
+
+(*
 
 let draw_buffer pos width height =
   let x = ref pos.x and y = ref pos.y in