[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

gEDA-cvs: pcb.git: branch: master updated (20dab2bdf553f86c43ead942e8c32a6356031af2)



The branch, master has been updated
       via  20dab2bdf553f86c43ead942e8c32a6356031af2 (commit)
      from  eb3c0196c031b1be6b8f7393cf3e669328549758 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.


=========
 Summary
=========

 src/crosshair.c        |   50 ++++++++++++++++++++++++++---------------------
 src/crosshair.h        |    4 +-
 src/hid/lesstif/main.c |    4 +-
 3 files changed, 32 insertions(+), 26 deletions(-)


=================
 Commit Messages
=================

commit 20dab2bdf553f86c43ead942e8c32a6356031af2
Author: Peter Clifton <pcjc2@xxxxxxxxx>
Commit: Peter Clifton <pcjc2@xxxxxxxxx>

    Don't abuse CrosshairOn() API to force a redraw.
    
    Expose DrawAttached() to the HIDs so they can call it themselves,
    and don't have to cheat by forcing Crosshair.On to false.
    
    Make DrawAttached() and DrawMark() a NOP if the relevant item is not
    being shown. Ie. if !Crosshair.On, both functions draw nothing. If
    !Marked.status, DrawMark() draws nothing.
    
    A minor change is required in CrosshairOff() to XOR un-draw before
    switching the flag to off.
    
    Not known to fix any particular bug, but it is possible that the
    crosshair should not be drawn at a given point (due to changes
    taking place inside a HideCrosshair() / RestoreCrosshair() pair.
    
    Tested with Lesstif and GTK HIDs.

:100644 100644 eb19257... 7d9fcb4... M	src/crosshair.c
:100644 100644 4573e98... ff16b1e... M	src/crosshair.h
:100644 100644 c5f3e3e... 4595b80... M	src/hid/lesstif/main.c

=========
 Changes
=========

commit 20dab2bdf553f86c43ead942e8c32a6356031af2
Author: Peter Clifton <pcjc2@xxxxxxxxx>
Commit: Peter Clifton <pcjc2@xxxxxxxxx>

    Don't abuse CrosshairOn() API to force a redraw.
    
    Expose DrawAttached() to the HIDs so they can call it themselves,
    and don't have to cheat by forcing Crosshair.On to false.
    
    Make DrawAttached() and DrawMark() a NOP if the relevant item is not
    being shown. Ie. if !Crosshair.On, both functions draw nothing. If
    !Marked.status, DrawMark() draws nothing.
    
    A minor change is required in CrosshairOff() to XOR un-draw before
    switching the flag to off.
    
    Not known to fix any particular bug, but it is possible that the
    crosshair should not be drawn at a given point (due to changes
    taking place inside a HideCrosshair() / RestoreCrosshair() pair.
    
    Tested with Lesstif and GTK HIDs.

diff --git a/src/crosshair.c b/src/crosshair.c
index eb19257..7d9fcb4 100644
--- a/src/crosshair.c
+++ b/src/crosshair.c
@@ -565,10 +565,14 @@ XORDrawMoveOrCopyObject (void)
 /* ---------------------------------------------------------------------------
  * draws additional stuff that follows the crosshair
  */
-static void
+void
 DrawAttached (void)
 {
   BDimension s;
+
+  if (!Crosshair.On)
+    return;
+
   switch (Settings.Mode)
     {
     case VIA_MODE:
@@ -684,6 +688,28 @@ DrawAttached (void)
     }
 }
 
+
+/* --------------------------------------------------------------------------
+ * draw the marker position
+ */
+void
+DrawMark (void)
+{
+  /* Mark is not drawn when the crosshair is off, or when it is not set */
+  if (!Crosshair.On || !Marked.status)
+    return;
+
+  gui->draw_line (Crosshair.GC,
+                  Marked.X - MARK_SIZE,
+                  Marked.Y - MARK_SIZE,
+                  Marked.X + MARK_SIZE, Marked.Y + MARK_SIZE);
+  gui->draw_line (Crosshair.GC,
+                  Marked.X + MARK_SIZE,
+                  Marked.Y - MARK_SIZE,
+                  Marked.X - MARK_SIZE, Marked.Y + MARK_SIZE);
+}
+
+
 /* ---------------------------------------------------------------------------
  * switches crosshair on
  */
@@ -706,9 +732,9 @@ CrosshairOff (void)
 {
   if (Crosshair.On)
     {
-      Crosshair.On = false;
       DrawAttached ();
       DrawMark ();
+      Crosshair.On = false;
     }
 }
 
@@ -1086,26 +1112,6 @@ SetCrosshairRange (LocationType MinX, LocationType MinY, LocationType MaxX,
   MoveCrosshairRelative (0, 0);
 }
 
-/* --------------------------------------------------------------------------
- * draw the marker position
- * if argument is true, draw only if it is visible, otherwise draw it regardless
- */
-void
-DrawMark (void)
-{
-  if (Marked.status)
-    {
-      gui->draw_line (Crosshair.GC,
-		      Marked.X - MARK_SIZE,
-		      Marked.Y - MARK_SIZE,
-		      Marked.X + MARK_SIZE, Marked.Y + MARK_SIZE);
-      gui->draw_line (Crosshair.GC,
-		      Marked.X + MARK_SIZE,
-		      Marked.Y - MARK_SIZE,
-		      Marked.X - MARK_SIZE, Marked.Y + MARK_SIZE);
-    }
-}
-
 /* ---------------------------------------------------------------------------
  * initializes crosshair stuff
  * clears the struct, allocates to graphical contexts and
diff --git a/src/crosshair.h b/src/crosshair.h
index 4573e98..ff16b1e 100644
--- a/src/crosshair.h
+++ b/src/crosshair.h
@@ -46,18 +46,18 @@
 #define	STATE_SECOND	1
 #define	STATE_THIRD		2
 
-
 void CrosshairOn (void);
 void CrosshairOff (void);
 void HideCrosshair (void);
 void RestoreCrosshair (void);
+void DrawAttached (void);
+void DrawMark (void);
 void MoveCrosshairRelative (LocationType, LocationType);
 bool MoveCrosshairAbsolute (LocationType, LocationType);
 void SetCrosshairRange (LocationType, LocationType, LocationType,
 			LocationType);
 void InitCrosshair (void);
 void DestroyCrosshair (void);
-void DrawMark (void);
 void FitCrosshairIntoGrid (LocationType, LocationType);
 
 #endif
diff --git a/src/hid/lesstif/main.c b/src/hid/lesstif/main.c
index c5f3e3e..4595b80 100644
--- a/src/hid/lesstif/main.c
+++ b/src/hid/lesstif/main.c
@@ -2433,7 +2433,6 @@ idle_proc (XtPointer dummy)
       int mx, my;
       BoxType region;
       lesstif_use_mask (0);
-      Crosshair.On = 0;
       pixmap = main_pixmap;
       mx = view_width;
       my = view_height;
@@ -2519,7 +2518,8 @@ idle_proc (XtPointer dummy)
       XCopyArea (display, main_pixmap, window, my_gc, 0, 0, view_width,
 		 view_height, 0, 0);
       pixmap = window;
-      CrosshairOn ();
+      DrawAttached ();
+      DrawMark ();
       need_redraw = 0;
     }
 




_______________________________________________
geda-cvs mailing list
geda-cvs@xxxxxxxxxxxxxx
http://www.seul.org/cgi-bin/mailman/listinfo/geda-cvs