Browse Source

* The cursor should be displayed correctly now

sg 26 years ago
parent
commit
d54ecf3a0e
2 changed files with 25 additions and 11 deletions
  1. 12 1
      fcl/shedit/drawing.inc
  2. 13 10
      fcl/shedit/gtkshedit.pp

+ 12 - 1
fcl/shedit/drawing.inc

@@ -89,6 +89,10 @@ procedure TSHTextEdit.DrawContent(x1, y1, x2, y2: Integer);
     // Erase free space below the text area
     if py < y2 then
       Renderer.ClearRect(0, py, x2, y2);
+
+    if (FCursorX >= x1) and (FCursorY >= y1) and
+      (FCursorX <= x2) and (FCursorY <= y2) then
+      ShowCursor;
   end;
 
 var
@@ -103,6 +107,10 @@ var
 
 begin
 
+  if (FCursorX >= x1) and (FCursorY >= y1) and
+    (FCursorX <= x2) and (FCursorY <= y2) then
+    HideCursor;
+
   if (FDoc = nil) or (FDoc.LineCount <= y1) then begin
     PostprocessOutput(y1);
     exit;
@@ -216,7 +224,10 @@ end;
 
 {
   $Log$
-  Revision 1.1  1999-10-29 15:59:04  peter
+  Revision 1.2  1999-12-08 00:42:54  sg
+  * The cursor should be displayed correctly now
+
+  Revision 1.1  1999/10/29 15:59:04  peter
     * inserted in fcl
 
 }

+ 13 - 10
fcl/shedit/gtkshedit.pp

@@ -352,7 +352,7 @@ var
      begin
        SetGCColor(CurColor);
        gdk_draw_rectangle(PGdkDrawable(GdkWnd), GC, 1,
-                          x1 * CharW + LeftIndent, y * CharH, (rx2 - rx1 + 1) * CharW + LeftIndent, CharH);
+                          x1 * CharW + LeftIndent, y * CharH, (rx2 - rx1 + 1) * CharW, CharH);
        rx1:=rx2;
      end;
   end;
@@ -465,10 +465,10 @@ var
   px,py : integer;
 begin
   writeln('Showcursor ',x,',',y);
-    px:=x*CharW + LeftIndent;
-    py:=y*CharH;
-    SetGCColor(colBlack);
-    gdk_draw_rectangle(PGdkDrawable(GdkWnd), GC, 1, px, py, px+2, py+CharH);
+  px := x * CharW + LeftIndent;
+  py := y * CharH;
+  SetGCColor(colBlack);
+  gdk_draw_rectangle(PGdkDrawable(GdkWnd), GC, 1, px, py, 2, CharH);
 
 {  r.x:=x * CharW;
   r.y:=y * CharH;
@@ -483,10 +483,10 @@ var
   r : TGdkRectangle;
 begin
   writeln('Hidecursor ',x,',',y);
-  r.x:=x * CharW + LeftIndent;
-  r.y:=y * CharH;
-  r.Width:=CharW;
-  r.Height:=CharH;
+  r.x := x * CharW + LeftIndent;
+  r.y := y * CharH;
+  r.Width := 2;
+  r.Height := CharH;
   gtk_widget_draw(PGtkWidget(PaintBox), @r);
 end;
 
@@ -519,7 +519,10 @@ end;
 end.
 {
   $Log$
-  Revision 1.2  1999-12-06 21:27:27  peter
+  Revision 1.3  1999-12-08 00:42:54  sg
+  * The cursor should be displayed correctly now
+
+  Revision 1.2  1999/12/06 21:27:27  peter
     * gtk updates, redrawing works now much better and clears only between
       x1 and x2