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

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



The branch, master has been updated
       via  a1d652788c846c6ec5b7a143a538f2544a2ce262 (commit)
      from  14d6b636fffdba8ffe271b458d2d177e7c1eb016 (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        |   48 ++----------------------------------------------
 src/crosshair.h        |    2 --
 src/global.h           |    1 -
 src/hid/lesstif/main.c |   33 +++++++++++++++++++++++++++------
 4 files changed, 29 insertions(+), 55 deletions(-)


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

commit a1d652788c846c6ec5b7a143a538f2544a2ce262
Author: Peter Clifton <pcjc2@xxxxxxxxx>
Commit: Peter Clifton <pcjc2@xxxxxxxxx>

    Move crosshair on / off functionality into lesstif HID.
    
    Lesstif is the only GUI which turns attached objects on and off, when
    the mouse leaves the viewport, so it might as well manage it internally.

:100644 100644 9498879... 2abe960... M	src/crosshair.c
:100644 100644 efa6679... 6e9656e... M	src/crosshair.h
:100644 100644 904d6fe... f6620c9... M	src/global.h
:100644 100644 703da61... 928a1ae... M	src/hid/lesstif/main.c

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

commit a1d652788c846c6ec5b7a143a538f2544a2ce262
Author: Peter Clifton <pcjc2@xxxxxxxxx>
Commit: Peter Clifton <pcjc2@xxxxxxxxx>

    Move crosshair on / off functionality into lesstif HID.
    
    Lesstif is the only GUI which turns attached objects on and off, when
    the mouse leaves the viewport, so it might as well manage it internally.

diff --git a/src/crosshair.c b/src/crosshair.c
index 9498879..2abe960 100644
--- a/src/crosshair.c
+++ b/src/crosshair.c
@@ -547,9 +547,6 @@ XORDrawMoveOrCopyObject (void)
 void
 DrawAttached (void)
 {
-  if (!Crosshair.On)
-    return;
-
   switch (Settings.Mode)
     {
     case VIA_MODE:
@@ -681,8 +678,8 @@ DrawAttached (void)
 void
 DrawMark (void)
 {
-  /* Mark is not drawn when the crosshair is off, or when it is not set */
-  if (!Crosshair.On || !Marked.status)
+  /* Mark is not drawn when it is not set */
+  if (!Marked.status)
     return;
 
   gui->draw_line (Crosshair.GC,
@@ -740,45 +737,6 @@ notify_mark_change (bool changes_complete)
     gui->notify_mark_change (changes_complete);
 }
 
-/* ---------------------------------------------------------------------------
- * switches crosshair on
- */
-void
-CrosshairOn (void)
-{
-  if (Crosshair.On)
-    return;
-
-  notify_crosshair_change (false);
-  if (Marked.status)
-    notify_mark_change (false);
-
-  Crosshair.On = true;
-
-  notify_crosshair_change (true);
-  if (Marked.status)
-    notify_mark_change (true);
-}
-
-/* ---------------------------------------------------------------------------
- * switches crosshair off
- */
-void
-CrosshairOff (void)
-{
-  if (!Crosshair.On)
-    return;
-
-  notify_crosshair_change (false);
-  if (Marked.status)
-    notify_mark_change (false);
-
-  Crosshair.On = false;
-
-  notify_crosshair_change (true);
-  if (Marked.status)
-    notify_mark_change (true);
-}
 
 /* ---------------------------------------------------------------------------
  * Convenience for plugins using the old {Hide,Restore}Crosshair API.
@@ -1172,8 +1130,6 @@ InitCrosshair (void)
   gui->set_line_cap (Crosshair.GC, Trace_Cap);
   gui->set_line_width (Crosshair.GC, 1);
 
-  Crosshair.On = true;
-
   /* set initial shape */
   Crosshair.shape = Basic_Crosshair_Shape;
 
diff --git a/src/crosshair.h b/src/crosshair.h
index efa6679..6e9656e 100644
--- a/src/crosshair.h
+++ b/src/crosshair.h
@@ -48,8 +48,6 @@
 
 void notify_crosshair_change (bool changes_complete);
 void notify_mark_change (bool changes_complete);
-void CrosshairOn (void);
-void CrosshairOff (void);
 void HideCrosshair (void);
 void RestoreCrosshair (void);
 void DrawAttached (void);
diff --git a/src/global.h b/src/global.h
index 904d6fe..f6620c9 100644
--- a/src/global.h
+++ b/src/global.h
@@ -583,7 +583,6 @@ typedef struct			/* holds cursor information */
   LocationType X,		/* position in PCB coordinates */
     Y, MinX,			/* lowest and highest coordinates */
     MinY, MaxX, MaxY;
-  bool On;			/* flag for 'is visible' */
   AttachedLineType AttachedLine;	/* data of new lines... */
   AttachedBoxType AttachedBox;
   PolygonType AttachedPolygon;
diff --git a/src/hid/lesstif/main.c b/src/hid/lesstif/main.c
index 703da61..928a1ae 100644
--- a/src/hid/lesstif/main.c
+++ b/src/hid/lesstif/main.c
@@ -139,6 +139,24 @@ static int view_left_x = 0, view_top_y = 0;
 static double view_zoom = 1000, prev_view_zoom = 1000;
 static int flip_x = 0, flip_y = 0;
 static int autofade = 0;
+static bool crosshair_on = true;
+
+static void
+ShowCrosshair (bool show)
+{
+  if (crosshair_on == show)
+    return;
+
+  notify_crosshair_change (false);
+  if (Marked.status)
+    notify_mark_change (false);
+
+  crosshair_on = show;
+
+  notify_crosshair_change (true);
+  if (Marked.status)
+    notify_mark_change (true);
+}
 
 static int
 flag_flipx (int x)
@@ -1413,7 +1431,7 @@ work_area_input (Widget w, XtPointer v, XEvent * e, Boolean * ctd)
 
     case LeaveNotify:
       crosshair_in_window = 0;
-      CrosshairOff ();
+      ShowCrosshair (false);
       need_idle_proc ();
       break;
 
@@ -1421,7 +1439,7 @@ work_area_input (Widget w, XtPointer v, XEvent * e, Boolean * ctd)
       crosshair_in_window = 1;
       in_move_event = 1;
       EventMoveCrosshair (Px (e->xcrossing.x), Py (e->xcrossing.y));
-      CrosshairOn ();
+      ShowCrosshair (true);
       in_move_event = 0;
       need_idle_proc ();
       break;
@@ -2518,8 +2536,11 @@ idle_proc (XtPointer dummy)
       XCopyArea (display, main_pixmap, window, my_gc, 0, 0, view_width,
 		 view_height, 0, 0);
       pixmap = window;
-      DrawAttached ();
-      DrawMark ();
+      if (crosshair_on)
+        {
+          DrawAttached ();
+          DrawMark ();
+        }
       need_redraw = 0;
     }
 
@@ -2898,7 +2919,7 @@ lesstif_notify_crosshair_change (bool changes_complete)
       return;
     }
 
-  if (invalidate_depth == 0)
+  if (invalidate_depth == 0 && crosshair_on)
     DrawAttached ();
 
   if (!changes_complete)
@@ -2925,7 +2946,7 @@ lesstif_notify_mark_change (bool changes_complete)
       return;
     }
 
-  if (invalidate_depth == 0)
+  if (invalidate_depth == 0 && crosshair_on)
     DrawMark ();
 
   if (!changes_complete)




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