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

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



The branch, master has been updated
       via  78fd1e9c758e6df30e7f953fcdd8ac4f39fb864f (commit)
       via  944752767041b782599180d132c1aa58251e2dbc (commit)
      from  07a98acbf1cb75536e777a9f240d5e338ce22f51 (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/autoroute.c        |   24 +++++++-----
 src/hid/lesstif/main.c |   90 +++++++++++++++++++++++++++++++++++++++++++++++-
 2 files changed, 103 insertions(+), 11 deletions(-)


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

commit 78fd1e9c758e6df30e7f953fcdd8ac4f39fb864f
Author: Peter Clifton <pcjc2@xxxxxxxxx>
Commit: Peter Clifton <pcjc2@xxxxxxxxx>

    hid/lesstif: Simple progress() implementation to present a cancel button
    
    Does not yet draw an actual progress bar, as I'm not familiar enough
    with coding for Lesstif.

:100644 100644 b2c1098... f43d7d7... M	src/hid/lesstif/main.c

commit 944752767041b782599180d132c1aa58251e2dbc
Author: Peter Clifton <pcjc2@xxxxxxxxx>
Commit: Peter Clifton <pcjc2@xxxxxxxxx>

    autoroute.c: When live-drawing, only emit one via per location
    
    I'd accidentally put the live-draw via in a place where it would
    emit one via for every layer group - causing warnings in PCB's
    log about dropped vias.

:100644 100644 8aca7d0... c766c14... M	src/autoroute.c

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

commit 78fd1e9c758e6df30e7f953fcdd8ac4f39fb864f
Author: Peter Clifton <pcjc2@xxxxxxxxx>
Commit: Peter Clifton <pcjc2@xxxxxxxxx>

    hid/lesstif: Simple progress() implementation to present a cancel button
    
    Does not yet draw an actual progress bar, as I'm not familiar enough
    with coding for Lesstif.

diff --git a/src/hid/lesstif/main.c b/src/hid/lesstif/main.c
index b2c1098..f43d7d7 100644
--- a/src/hid/lesstif/main.c
+++ b/src/hid/lesstif/main.c
@@ -3840,10 +3840,98 @@ lesstif_beep (void)
   fflush (stdout);
 }
 
+
+static bool progress_cancelled = false;
+
+static void
+progress_cancel_callback (Widget w, void *v, void *cbs)
+{
+  progress_cancelled = true;
+}
+
+static Widget progress_dialog = 0;
+static Widget progress_cancel, progress_label;
+
+static void
+lesstif_progress_dialog (int sp_far, int total, const char *msg)
+{
+  XmString xs;
+
+  if (mainwind == 0)
+    return;
+
+  if (progress_dialog == 0)
+    {
+      n = 0;
+      stdarg (XmNdefaultButtonType, XmDIALOG_CANCEL_BUTTON);
+      stdarg (XmNtitle, "Progress");
+      stdarg (XmNdialogStyle, XmDIALOG_FULL_APPLICATION_MODAL);
+      progress_dialog = XmCreateQuestionDialog (mainwind, "progress", args, n);
+      XtAddCallback (progress_dialog, XmNcancelCallback,
+                     (XtCallbackProc) progress_cancel_callback, NULL);
+
+      progress_cancel = XmMessageBoxGetChild (progress_dialog, XmDIALOG_CANCEL_BUTTON);
+      progress_label =  XmMessageBoxGetChild (progress_dialog, XmDIALOG_MESSAGE_LABEL);
+
+      XtUnmanageChild (XmMessageBoxGetChild (progress_dialog, XmDIALOG_OK_BUTTON));
+      XtUnmanageChild (XmMessageBoxGetChild (progress_dialog, XmDIALOG_HELP_BUTTON));
+
+      stdarg (XmNdefaultPosition, False);
+      XtSetValues (progress_dialog, args, n);
+    }
+
+  n = 0;
+  xs = XmStringCreateLocalized ((char *)msg);
+  stdarg (XmNmessageString, xs);
+  XtSetValues (progress_dialog, args, n);
+
+  return;
+}
+
+#define MIN_TIME_SEPARATION (500./1000.) /* 50ms */
 static int
 lesstif_progress (int so_far, int total, const char *message)
 {
-  return 0;
+  static bool visible = false;
+  static bool started = false;
+  XEvent e;
+  struct timeval time;
+  static struct timeval last_time;
+  double time_delta;
+  int retval = 0;
+
+  if (so_far == 0 && total == 0 && message == NULL)
+    {
+      XtUnmanageChild (progress_dialog);
+      visible = false;
+      progress_cancelled = false;
+      return retval;
+    }
+
+  gettimeofday (&time, NULL);
+
+  time_delta = (time.tv_sec - last_time.tv_sec) +
+               (double)(time.tv_usec - last_time.tv_usec) / 1000000.;
+
+  if (started && time_delta < MIN_TIME_SEPARATION)
+    return retval;
+
+  /* Create or update the progress dialog */
+  lesstif_progress_dialog (so_far, total, message);
+
+  if (!started)
+    XtManageChild (progress_dialog);
+
+  /* Dispatch one event - ideally we would keep dispatching until we
+   * were about to block, but I can't see how to do this with Xt
+   */
+  XtAppNextEvent (app_context, &e);
+  XtDispatchEvent (&e);
+
+  /* Note the time we did this */
+  gettimeofday (&last_time, NULL);
+
+  return progress_cancelled;
 }
 
 static HID *

commit 944752767041b782599180d132c1aa58251e2dbc
Author: Peter Clifton <pcjc2@xxxxxxxxx>
Commit: Peter Clifton <pcjc2@xxxxxxxxx>

    autoroute.c: When live-drawing, only emit one via per location
    
    I'd accidentally put the live-draw via in a place where it would
    emit one via for every layer group - causing warnings in PCB's
    log about dropped vias.

diff --git a/src/autoroute.c b/src/autoroute.c
index 8aca7d0..c766c14 100644
--- a/src/autoroute.c
+++ b/src/autoroute.c
@@ -3205,6 +3205,17 @@ RD_DrawVia (routedata_t * rd, LocationType X, LocationType Y,
   routebox_t *rb, *first_via = NULL;
   int i;
   int ka = AutoRouteParameters.style->Keepaway;
+  PinType *live_via = NULL;
+
+  if (TEST_FLAG (LIVEROUTEFLAG, PCB))
+    {
+       live_via = CreateNewVia (PCB->Data, X, Y, radius * 2,
+                                2 * AutoRouteParameters.style->Keepaway, 0,
+                                AutoRouteParameters.style->Hole, NULL,
+                                MakeFlags (0));
+       if (live_via != NULL)
+         DrawVia (live_via);
+    }
 
   /* a via cuts through every layer group */
   for (i = 0; i < max_group; i++)
@@ -3246,16 +3257,7 @@ RD_DrawVia (routedata_t * rd, LocationType X, LocationType Y,
       /* and add it to the r-tree! */
       r_insert_entry (rd->layergrouptree[rb->group], &rb->box, 1);
       rb->flags.homeless = 0;	/* not homeless anymore */
-
-      if (TEST_FLAG (LIVEROUTEFLAG, PCB))
-	{
-	   PinType *via = CreateNewVia (PCB->Data, X, Y, radius * 2,
-					2 * rb->style->Keepaway, 0,
-					rb->style->Hole, NULL, MakeFlags (0));
-	   rb->livedraw_obj.via = via;
-	   if (via != NULL)
-	     DrawVia (via);
-	}
+      rb->livedraw_obj.via = live_via;
     }
 }
 static void
@@ -4614,11 +4616,13 @@ ripout_livedraw_obj (routebox_t *rb)
       LayerType *layer = LAYER_PTR (PCB->LayerGroups.Entries[rb->group][0]);
       EraseLine (rb->livedraw_obj.line);
       DestroyObject (PCB->Data, LINE_TYPE, layer, rb->livedraw_obj.line, NULL);
+      rb->livedraw_obj.line = NULL;
     }
   if (rb->type == VIA && rb->livedraw_obj.via)
     {
       EraseVia (rb->livedraw_obj.via);
       DestroyObject (PCB->Data, VIA_TYPE, rb->livedraw_obj.via, NULL, NULL);
+      rb->livedraw_obj.via = NULL;
     }
 }
 




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