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

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



The branch, master has been updated
       via  4ca6a1a838f4b4439647f7ebfda2e67a7e44e0b3 (commit)
       via  e7d89b690575f1373505797bf60e3a3face27b63 (commit)
       via  a4bf3f0eebb5c438acf31388ed6bf2135b84addd (commit)
       via  47e58b25ac92749a07489ec05c971fa9b60a35f7 (commit)
      from  e323e4636ef7b7239003a41ba305221bc6d9bab1 (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/hid.h                 |   33 ++++++++++++++++++++++++++-
 src/hid/common/hidnogui.c |   24 +++++++++++++++++++-
 src/hid/gtk/gtkhid-gdk.c  |   23 +++++++++++++++++++
 src/hid/gtk/gtkhid-main.c |    4 +++
 src/hid/gtk/gui.h         |    3 ++
 src/hid/lesstif/main.c    |   52 +++++++++++++++++++++++++++++++++++++++++++-
 6 files changed, 134 insertions(+), 5 deletions(-)


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

commit 4ca6a1a838f4b4439647f7ebfda2e67a7e44e0b3
Author: Peter Clifton <pcjc2@xxxxxxxxx>
Commit: Peter Clifton <pcjc2@xxxxxxxxx>

    hid/lesstif: Hook up debug drawing APIs

:100644 100644 cfb65be... 3922fc4... M	src/hid/lesstif/main.c

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

    hid/gtk: Hook up debug drawing APIs

:100644 100644 a47803e... 45f1e96... M	src/hid/gtk/gtkhid-gdk.c
:100644 100644 f5e2717... ac961db... M	src/hid/gtk/gtkhid-main.c
:100644 100644 6cdeff2... d52d088... M	src/hid/gtk/gui.h

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

    Add HID apis to handle live debug drawing from the core
    
    It is envisaved that this API should ONLY be used for debugging, not
    presenting a user-interface. In general, the GUIs may have their own
    special requirements for drawing the board, and this API is not meant
    to allow the core to augment or present user-visible drawing. This is
    reflected in the API naming.
    
    Request permission for debug drawing
    
    HID *ddraw = gui->request_debug_draw (void);
    
    Returns a HID pointer which should be used rather than the global
    gui-> for making drawing calls. If the return value is NULL, then
    permission has been denied, and the debug drawing must not continue.
    
    
    Flush pending drawing to the screen
    
    void ddraw->flush_debug_draw (void);
    
    May be implemented as a NOOP if the GUI has chosen to send the debug
    drawing directly to the screen.
    
    
    When finished, the user must inform the GUI to clean up resources:
    
    ddraw->finish_debug_draw (void);
    
    Any remaining rendering will be flushed to the screen.

:100644 100644 2b9ca40... 820760e... M	src/hid.h
:100644 100644 c146fd2... f9d5949... M	src/hid/common/hidnogui.c

commit 47e58b25ac92749a07489ec05c971fa9b60a35f7
Author: Peter Clifton <pcjc2@xxxxxxxxx>
Commit: Peter Clifton <pcjc2@xxxxxxxxx>

    hid/lesstif: Ensure crosshair and mark updates go to the screen
    
    The "pixmap" global might be pointing at one of the backing pixmaps
    when we are called.
    
    Does not fix any known bug, just in preparation for another patch
    relating to debug drawing which may leave pixmap pointing to the
    backing store.

:100644 100644 6a42706... cfb65be... M	src/hid/lesstif/main.c

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

commit 4ca6a1a838f4b4439647f7ebfda2e67a7e44e0b3
Author: Peter Clifton <pcjc2@xxxxxxxxx>
Commit: Peter Clifton <pcjc2@xxxxxxxxx>

    hid/lesstif: Hook up debug drawing APIs

diff --git a/src/hid/lesstif/main.c b/src/hid/lesstif/main.c
index cfb65be..3922fc4 100644
--- a/src/hid/lesstif/main.c
+++ b/src/hid/lesstif/main.c
@@ -3870,6 +3870,38 @@ lesstif_progress (int so_far, int total, const char *message)
   return 0;
 }
 
+static HID *
+lesstif_request_debug_draw (void)
+{
+  /* Send drawing to the backing pixmap */
+  pixmap = main_pixmap;
+  return &lesstif_hid;
+}
+
+static void
+lesstif_flush_debug_draw (void)
+{
+  /* Copy the backing pixmap to the display and redraw any attached objects */
+  XSetFunction (display, my_gc, GXcopy);
+  XCopyArea (display, main_pixmap, window, my_gc, 0, 0, view_width,
+             view_height, 0, 0);
+  pixmap = window;
+  if (crosshair_on)
+    {
+      DrawAttached ();
+      DrawMark ();
+    }
+  pixmap = main_pixmap;
+}
+
+static void
+lesstif_finish_debug_draw (void)
+{
+  lesstif_flush_debug_draw ();
+  /* No special tear down requirements
+   */
+}
+
 #include "dolists.h"
 
 void
@@ -3933,6 +3965,10 @@ hid_lesstif_init ()
   lesstif_hid.progress                = lesstif_progress;
   lesstif_hid.edit_attributes         = lesstif_attributes_dialog;
 
+  lesstif_hid.request_debug_draw      = lesstif_request_debug_draw;
+  lesstif_hid.flush_debug_draw        = lesstif_flush_debug_draw;
+  lesstif_hid.finish_debug_draw       = lesstif_finish_debug_draw;
+
   hid_register_hid (&lesstif_hid);
 #include "lesstif_lists.h"
 }

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

    hid/gtk: Hook up debug drawing APIs

diff --git a/src/hid/gtk/gtkhid-gdk.c b/src/hid/gtk/gtkhid-gdk.c
index a47803e..45f1e96 100644
--- a/src/hid/gtk/gtkhid-gdk.c
+++ b/src/hid/gtk/gtkhid-gdk.c
@@ -1299,3 +1299,26 @@ ghid_render_pixmap (int cx, int cy, double zoom, int width, int height, int dept
 
   return pixmap;
 }
+
+HID *
+ghid_request_debug_draw (void)
+{
+  /* No special setup requirements, drawing goes into
+   * the backing pixmap. */
+  return &ghid_hid;
+}
+
+void
+ghid_flush_debug_draw (void)
+{
+  ghid_screen_update ();
+  gdk_flush ();
+}
+
+void
+ghid_finish_debug_draw (void)
+{
+  ghid_flush_debug_draw ();
+  /* No special tear down requirements
+   */
+}
diff --git a/src/hid/gtk/gtkhid-main.c b/src/hid/gtk/gtkhid-main.c
index f5e2717..ac961db 100644
--- a/src/hid/gtk/gtkhid-main.c
+++ b/src/hid/gtk/gtkhid-main.c
@@ -2157,6 +2157,10 @@ hid_gtk_init ()
   ghid_hid.drc_gui                  = &ghid_drc_gui,
   ghid_hid.edit_attributes          = ghid_attributes;
 
+  ghid_hid.request_debug_draw       = ghid_request_debug_draw;
+  ghid_hid.flush_debug_draw         = ghid_flush_debug_draw;
+  ghid_hid.finish_debug_draw        = ghid_finish_debug_draw;
+
   hid_register_hid (&ghid_hid);
 #include "gtk_lists.h"
 }
diff --git a/src/hid/gtk/gui.h b/src/hid/gtk/gui.h
index 6cdeff2..d52d088 100644
--- a/src/hid/gtk/gui.h
+++ b/src/hid/gtk/gui.h
@@ -499,6 +499,9 @@ gboolean ghid_drawing_area_expose_cb (GtkWidget *, GdkEventExpose *,
 gboolean ghid_pinout_preview_expose (GtkWidget * widget, GdkEventExpose * ev);
 GdkPixmap *ghid_render_pixmap (int cx, int cy, double zoom,
                                int width, int height, int depth);
+HID *ghid_request_debug_draw (void);
+void ghid_flush_debug_draw (void);
+void ghid_finish_debug_draw (void);
 
 /* gtkhid-main.c */
 void ghid_pan_fixup (void);

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

    Add HID apis to handle live debug drawing from the core
    
    It is envisaved that this API should ONLY be used for debugging, not
    presenting a user-interface. In general, the GUIs may have their own
    special requirements for drawing the board, and this API is not meant
    to allow the core to augment or present user-visible drawing. This is
    reflected in the API naming.
    
    Request permission for debug drawing
    
    HID *ddraw = gui->request_debug_draw (void);
    
    Returns a HID pointer which should be used rather than the global
    gui-> for making drawing calls. If the return value is NULL, then
    permission has been denied, and the debug drawing must not continue.
    
    
    Flush pending drawing to the screen
    
    void ddraw->flush_debug_draw (void);
    
    May be implemented as a NOOP if the GUI has chosen to send the debug
    drawing directly to the screen.
    
    
    When finished, the user must inform the GUI to clean up resources:
    
    ddraw->finish_debug_draw (void);
    
    Any remaining rendering will be flushed to the screen.

diff --git a/src/hid.h b/src/hid.h
index 2b9ca40..820760e 100644
--- a/src/hid.h
+++ b/src/hid.h
@@ -230,9 +230,10 @@ typedef enum
     int (*throw_drc_dialog) (void);
   } HID_DRC_GUI;
 
+  typedef struct hid_st HID;
 
 /* This is the main HID structure.  */
-  typedef struct
+  struct hid_st
   {
     /* The size of this structure.  We use this as a compatibility
        check; a HID built with a different hid.h than we're expecting
@@ -543,7 +544,35 @@ typedef enum
 
     void (*edit_attributes) (char *owner, AttributeListType *attrlist_);
 
-  } HID;
+    /* Debug drawing support. These APIs must be implemented (non NULL),
+     * but they do not have to be functional. request_debug_draw can
+     * return NULL to indicate debug drawing is not permitted.
+     *
+     * Debug drawing is not gauranteed to be re-entrant.
+     * The caller must not nest requests for debug drawing.
+     */
+
+    /* Request permission for debug drawing
+     *
+     * Returns a HID pointer which should be used rather than the global
+     * gui-> for making drawing calls. If the return value is NULL, then
+     * permission has been denied, and the drawing must not continue.
+     */
+    HID *(*request_debug_draw) (void);
+
+    /* Flush pending drawing to the screen
+     *
+     * May be implemented as a NOOP if the GUI has chosen to send the
+     * debug drawing directly to the screen.
+     */
+    void (*flush_debug_draw)   (void);
+
+    /* When finished, the user must inform the GUI to clean up resources
+     *
+     * Any remaining rendering will be flushed to the screen.
+     */
+    void (*finish_debug_draw)  (void);
+  };
 
 /* Call this as soon as possible from main().  No other HID calls are
    valid until this is called.  */
diff --git a/src/hid/common/hidnogui.c b/src/hid/common/hidnogui.c
index c146fd2..f9d5949 100644
--- a/src/hid/common/hidnogui.c
+++ b/src/hid/common/hidnogui.c
@@ -427,6 +427,22 @@ nogui_progress (int so_far, int total, const char *message)
   return 0;
 }
 
+static HID *
+nogui_request_debug_draw (void)
+{
+  return NULL;
+}
+
+static void
+nogui_flush_debug_draw (void)
+{
+}
+
+static void
+nogui_finish_debug_draw (void)
+{
+}
+
 HID hid_nogui = {
   sizeof (HID),
   "nogui",
@@ -484,7 +500,10 @@ HID hid_nogui = {
   nogui_beep,
   nogui_progress,
   0 /* nogui_drc_gui */ ,
-  0 /* edit_attributes */
+  0 /* edit_attributes */,
+  nogui_request_debug_draw,
+  nogui_flush_debug_draw,
+  nogui_finish_debug_draw,
 };
 
 #define AD(x) if (!d->x) d->x = s->x
@@ -545,4 +564,7 @@ apply_default_hid (HID * d, HID * s)
   AD (progress);
   AD (drc_gui);
   AD (edit_attributes);
+  AD (request_debug_draw);
+  AD (flush_debug_draw);
+  AD (finish_debug_draw);
 }

commit 47e58b25ac92749a07489ec05c971fa9b60a35f7
Author: Peter Clifton <pcjc2@xxxxxxxxx>
Commit: Peter Clifton <pcjc2@xxxxxxxxx>

    hid/lesstif: Ensure crosshair and mark updates go to the screen
    
    The "pixmap" global might be pointing at one of the backing pixmaps
    when we are called.
    
    Does not fix any known bug, just in preparation for another patch
    relating to debug drawing which may leave pixmap pointing to the
    backing store.

diff --git a/src/hid/lesstif/main.c b/src/hid/lesstif/main.c
index 6a42706..cfb65be 100644
--- a/src/hid/lesstif/main.c
+++ b/src/hid/lesstif/main.c
@@ -2903,6 +2903,7 @@ static void
 lesstif_notify_crosshair_change (bool changes_complete)
 {
   static int invalidate_depth = 0;
+  Pixmap save_pixmap;
 
   if (changes_complete)
     invalidate_depth --;
@@ -2920,7 +2921,12 @@ lesstif_notify_crosshair_change (bool changes_complete)
     }
 
   if (invalidate_depth == 0 && crosshair_on)
-    DrawAttached ();
+    {
+      save_pixmap = pixmap;
+      pixmap = window;
+      DrawAttached ();
+      pixmap = save_pixmap;
+    }
 
   if (!changes_complete)
     invalidate_depth ++;
@@ -2930,6 +2936,7 @@ static void
 lesstif_notify_mark_change (bool changes_complete)
 {
   static int invalidate_depth = 0;
+  Pixmap save_pixmap;
 
   if (changes_complete)
     invalidate_depth --;
@@ -2947,7 +2954,12 @@ lesstif_notify_mark_change (bool changes_complete)
     }
 
   if (invalidate_depth == 0 && crosshair_on)
-    DrawMark ();
+    {
+      save_pixmap = pixmap;
+      pixmap = window;
+      DrawMark ();
+      pixmap = save_pixmap;
+    }
 
   if (!changes_complete)
     invalidate_depth ++;




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