[Gd-chatter] r11534 - branches/opendylan-melange/gtk-duim

andreas at gwydiondylan.org andreas at gwydiondylan.org
Wed Dec 12 00:51:17 CET 2007


Author: andreas
Date: Wed Dec 12 00:51:16 2007
New Revision: 11534

Modified:
   branches/opendylan-melange/gtk-duim/gtk-draw.dylan
   branches/opendylan-melange/gtk-duim/gtk-fonts.dylan
   branches/opendylan-melange/gtk-duim/gtk-gadgets.dylan
   branches/opendylan-melange/gtk-duim/gtk-pixmaps.dylan
Log:
Job: fd
lock font access
fix copy-area for gtk-mediums
lock drawing primitives
fix gtktreecontrol when setting roots dynamically


Modified: branches/opendylan-melange/gtk-duim/gtk-draw.dylan
==============================================================================
--- branches/opendylan-melange/gtk-duim/gtk-draw.dylan	(original)
+++ branches/opendylan-melange/gtk-duim/gtk-draw.dylan	Wed Dec 12 00:51:16 2007
@@ -19,14 +19,16 @@
   let transform = medium-device-transform(medium);
   with-device-coordinates (transform, x, y)
     let thickness = pen-width(medium-pen(medium));
-    if (thickness < 2)
-      gdk-draw-point(drawable, gcontext, x, y)
-    else 
-      let thickness/2 = truncate/(thickness, 2);
-      gdk-draw-arc(drawable, gcontext, $true,
-		   x - thickness/2, y - thickness/2, thickness, thickness,
-		   0, $2pi-in-64ths-of-degree)
-    end
+    with-gdk-lock
+      if (thickness < 2)
+        gdk-draw-point(drawable, gcontext, x, y)
+      else 
+        let thickness/2 = truncate/(thickness, 2);
+        gdk-draw-arc(drawable, gcontext, $true,
+                     x - thickness/2, y - thickness/2, thickness, thickness,
+                     0, $2pi-in-64ths-of-degree)
+      end
+    end;
   end;
   #f
 end method draw-point;
@@ -37,26 +39,28 @@
     = update-drawing-state(medium);
   let transform = medium-device-transform(medium);
   let thickness = pen-width(medium-pen(medium));
-  if (thickness < 2)
-    do-coordinates
-      (method (x, y)
-	 with-device-coordinates (transform, x, y)
+  with-gdk-lock
+    if (thickness < 2)
+      do-coordinates
+        (method (x, y)
+	   with-device-coordinates (transform, x, y)
 	   //---*** Use gdk-draw-points
-	   gdk-draw-point(drawable, gcontext, x, y)
-	 end
-       end,
-       coord-seq)
-  else
-    let thickness/2 = truncate/(thickness, 2);
-    do-coordinates
-      (method (x, y)
-	 with-device-coordinates (transform, x, y)
-	   gdk-draw-arc(drawable, gcontext, $true,
-			x - thickness/2, y - thickness/2, thickness, thickness,
-			0, $2pi-in-64ths-of-degree)
-	 end
-       end,
-       coord-seq)
+	     gdk-draw-point(drawable, gcontext, x, y)
+	   end
+         end,
+         coord-seq)
+    else
+      let thickness/2 = truncate/(thickness, 2);
+      do-coordinates
+        (method (x, y)
+           with-device-coordinates (transform, x, y)
+	     gdk-draw-arc(drawable, gcontext, $true,
+                          x - thickness/2, y - thickness/2, thickness, thickness,
+                          0, $2pi-in-64ths-of-degree)
+           end
+         end,
+         coord-seq)
+    end;
   end;
   #f
 end method draw-points;
@@ -91,7 +95,9 @@
     = update-drawing-state(medium, pen: medium-pen(medium));
   let transform = medium-device-transform(medium);
   with-device-coordinates (transform, x1, y1, x2, y2)
-    gdk-draw-line(drawable, gcontext, x1, y1, x2, y2)
+    with-gdk-lock
+      gdk-draw-line(drawable, gcontext, x1, y1, x2, y2)
+    end;
   end;
   #f
 end method draw-line;
@@ -102,13 +108,15 @@
     = update-drawing-state(medium, pen: medium-pen(medium));
   let transform = medium-device-transform(medium);
   //---*** Use gdk-draw-segments
-  do-endpoint-coordinates
-    (method (x1, y1, x2, y2)
-       with-device-coordinates (transform, x1, y1, x2, y2)
-	 gdk-draw-line(drawable, gcontext, x1, y1, x2, y2)
-       end
-     end,
-     coord-seq);
+  with-gdk-lock
+    do-endpoint-coordinates
+      (method (x1, y1, x2, y2)
+         with-device-coordinates (transform, x1, y1, x2, y2)
+	   gdk-draw-line(drawable, gcontext, x1, y1, x2, y2)
+         end
+       end,
+       coord-seq);
+  end;
   #f
 end method draw-lines;
 
@@ -125,9 +133,11 @@
       = update-drawing-state(medium, pen: ~filled? & medium-pen(medium));
     //---*** Might need to use 'gdk-gc-set-ts-origin' to set tile/stipple origin to x1/y1
     with-device-coordinates (transform, x1, y1, x2, y2)
-      gdk-draw-rectangle(drawable, gcontext,
-			 if (filled?) $true else $false end,
-			 x1, y1, x2 - x1, y2 - y1)
+      with-gdk-lock
+        gdk-draw-rectangle(drawable, gcontext,
+                           if (filled?) $true else $false end,
+                           x1, y1, x2 - x1, y2 - y1)
+      end
     end
   end;
   #f
@@ -146,9 +156,11 @@
     do-endpoint-coordinates
       (method (x1, y1, x2, y2)
 	 with-device-coordinates (transform, x1, y1, x2, y2)
-	   gdk-draw-rectangle(drawable, gcontext, 
-			      if (filled?) $true else $false end,
-			      x1, y1, x2 - x1, y2 - y1)
+           with-gdk-lock
+             gdk-draw-rectangle(drawable, gcontext, 
+			        if (filled?) $true else $false end,
+                                x1, y1, x2 - x1, y2 - y1)
+           end
 	 end
        end,
        coord-seq);
@@ -233,11 +245,12 @@
 	end
       end;
     // end;
-    if (filled?)
-      gdk-draw-polygon(drawable, gcontext, 
-                       $true,
-                       points, npoints)
-    else
+    with-gdk-lock
+      if (filled?)
+        gdk-draw-polygon(drawable, gcontext, 
+                         $true,
+                         points, npoints)
+      else
 // ---*** gdk-draw-lines doesn't work on Win32 for some reason so use kludge instead.
 // ---*** Kludge draws each line in turn after frigging the gcontext so that
 // ---*** the line ends don't go over the start of the next line.
@@ -245,37 +258,38 @@
 // ---*** (I tried both Dylan stack allocated and gdk-gc-new gcontexts)
 // ---*** so the code has to frig a potentially shared gcontext (= not good).
 //      gdk-draw-lines(drawable, gcontext, points, npoints)
-      with-stack-structure (gcontext-values :: <GdkGCValues>)
-        let old-cap-style = #f;
-        block ()
-          gdk-gc-get-values(gcontext, gcontext-values);
-          old-cap-style := gcontext-values.GdkGCValues-cap-style;
-          gdk-gc-set-line-attributes(gcontext,
-                                     gcontext-values.GdkGCValues-line-width,
-                                     gcontext-values.GdkGCValues-line-style,
-                                     $gdk-cap-butt, // NB short lines for better joins
-                                     gcontext-values.GdkGCValues-join-style);
-          let previous-p = pointer-value-address(points, index: 0);
-          for (i from 1 below npoints)
-            let previous-x :: <integer> = previous-p.GdkPoint-x;
-            let previous-y :: <integer> = previous-p.GdkPoint-y;
-            let p = pointer-value-address(points, index: i);
-            let x = p.GdkPoint-x;
-            let y = p.GdkPoint-y;
-            gdk-draw-line(drawable, gcontext, previous-x, previous-y, x, y);
-            previous-p := p;
-          end;
-        cleanup
-          if (old-cap-style)
+        with-stack-structure (gcontext-values :: <GdkGCValues>)
+          let old-cap-style = #f;
+          block ()
+            gdk-gc-get-values(gcontext, gcontext-values);
+            old-cap-style := gcontext-values.GdkGCValues-cap-style;
             gdk-gc-set-line-attributes(gcontext,
                                        gcontext-values.GdkGCValues-line-width,
                                        gcontext-values.GdkGCValues-line-style,
-                                       old-cap-style,
+                                       $gdk-cap-butt, // NB short lines for better joins
                                        gcontext-values.GdkGCValues-join-style);
-          end;
-        end block;
-      end with-stack-structure;
-    end
+            let previous-p = pointer-value-address(points, index: 0);
+            for (i from 1 below npoints)
+              let previous-x :: <integer> = previous-p.GdkPoint-x;
+              let previous-y :: <integer> = previous-p.GdkPoint-y;
+              let p = pointer-value-address(points, index: i);
+              let x = p.GdkPoint-x;
+              let y = p.GdkPoint-y;
+              gdk-draw-line(drawable, gcontext, previous-x, previous-y, x, y);
+              previous-p := p;
+            end;
+          cleanup
+            if (old-cap-style)
+              gdk-gc-set-line-attributes(gcontext,
+                                         gcontext-values.GdkGCValues-line-width,
+                                         gcontext-values.GdkGCValues-line-style,
+                                         old-cap-style,
+                                         gcontext-values.GdkGCValues-join-style);
+            end;
+          end block;
+        end with-stack-structure;
+      end if;
+    end with-gdk-lock;
   end;
   #f
 end method draw-polygon;
@@ -308,10 +322,12 @@
 	    end;
 	x-radius := abs(x-radius);
 	y-radius := abs(y-radius);
-	gdk-draw-arc(drawable, gcontext, 
-		     if (filled?) $true else $false end,
-		     center-x - x-radius, center-y - y-radius,
-		     x-radius * 2, y-radius * 2, angle, delta-angle)
+        with-gdk-lock
+          gdk-draw-arc(drawable, gcontext, 
+                       if (filled?) $true else $false end,
+                       center-x - x-radius, center-y - y-radius,
+                       x-radius * 2, y-radius * 2, angle, delta-angle)
+        end
       else
 	ignoring("draw-ellipse for tilted ellipses");
 	#f
@@ -424,22 +440,24 @@
 
 define sealed method clear-box
     (medium :: <gtk-medium>, left, top, right, bottom) => ()
-  let (drawable :: <GdkDrawable>, gcontext :: <GdkGC>)
-    = get-gcontext(medium);
-  let colormap = gdk-gc-get-colormap(gcontext);
-  with-stack-structure (color :: <GdkColor>)
-    gdk-color-white(colormap, color);
-    gdk-gc-set-foreground(gcontext, color);
-  end;
-  let sheet = medium-sheet(medium);
-  let transform = sheet-device-transform(sheet);
-  with-device-coordinates (transform, left, top, right, bottom)
-    //gdk-window-clear-area(drawable, left, top, right - left, bottom - top)
-    gdk-draw-rectangle(drawable, gcontext, $true, left, top, right - left, bottom - top); 
-  end;
-  with-stack-structure (color :: <GdkColor>)
-    gdk-color-black(colormap, color);
-    gdk-gc-set-foreground(gcontext, color);
+  with-gdk-lock
+    let (drawable :: <GdkDrawable>, gcontext :: <GdkGC>)
+      = get-gcontext(medium);
+    let colormap = gdk-gc-get-colormap(gcontext);
+    with-stack-structure (color :: <GdkColor>)
+      gdk-color-white(colormap, color);
+      gdk-gc-set-foreground(gcontext, color);
+    end;
+    let sheet = medium-sheet(medium);
+    let transform = sheet-device-transform(sheet);
+    with-device-coordinates (transform, left, top, right, bottom)
+      //gdk-window-clear-area(drawable, left, top, right - left, bottom - top)
+      gdk-draw-rectangle(drawable, gcontext, $true, left, top, right - left, bottom - top); 
+    end;
+    with-stack-structure (color :: <GdkColor>)
+      gdk-color-black(colormap, color);
+      gdk-gc-set-foreground(gcontext, color);
+    end;
   end;
 end method clear-box;
 
@@ -464,58 +482,69 @@
      #key start: _start :: <integer> = 0, end: _end :: <integer> = size(string),
           align-x = #"left", align-y = #"baseline", do-tabs? = #f,
           towards-x, towards-y, transform-glyphs?) => (record)
-  let text-style :: <text-style> = medium-merged-text-style(medium);
-  let font :: <gtk-font> = text-style-mapping(port(medium), text-style);
-  let length :: <integer> = size(string);
-  let (drawable :: <GdkDrawable>, gcontext :: <GdkGC>)
-    = update-drawing-state(medium, font: font);
-  let screen = gdk-drawable-get-screen(drawable);
-//  let renderer = gdk-pango-renderer-get-default(screen);
-//  gdk-pango-renderer-set-gc(renderer, gcontext);
-  let context = gdk-pango-context-get-for-screen(screen);
-  let (_font, _width, _height, ascent) = gtk-font-metrics(font, context);
-  let layout = pango-layout-new(context);
-  pango-layout-set-font-description(layout, font.%font-description);
-  let transform = medium-device-transform(medium);
-  with-device-coordinates (transform, x, y)
-    when (towards-x & towards-y)
-      convert-to-device-coordinates!(transform, towards-x, towards-y)
-    end;
-    //---*** What about x and y alignment?
-    if (do-tabs?)
-      let tab-width  = text-size(medium, " ") * 8;
-      let tab-origin = if (do-tabs? == #t) x else do-tabs? end;
-      let x = 0;
-      let s = _start;
-      block (break)
-	while (#t)
-	  let e = position(string, '\t', start: s, end: _end) | _end;
-	  let substring = copy-sequence(string, start: s, end: e);
-          pango-layout-set-text(layout, substring, e - s);
-//          pango-layout-context-changed(layout);
-//          pango-renderer-draw-layout(renderer, layout, tab-origin + x, y);
-          gdk-draw-layout(drawable, gcontext, tab-origin + x, y - ascent, layout);
-	  if (e = _end)
-	    break()
-	  else
-            with-stack-structure (rectangle :: <PangoRectangle>)
-              pango-layout-get-pixel-extents(layout, null-pointer(<PangoRectangle>), rectangle);
-              x := floor/(x + rectangle.PangoRectangle-x + rectangle.PangoRectangle-width 
-                            + tab-width, tab-width) * tab-width;
-              s := min(e + 1, _end)
+  with-gdk-lock
+    let text-style :: <text-style> = medium-merged-text-style(medium);
+    let font :: <gtk-font> = text-style-mapping(port(medium), text-style);
+    let length :: <integer> = size(string);
+    let (drawable :: <GdkDrawable>, gcontext :: <GdkGC>)
+      = update-drawing-state(medium, font: font);
+    let screen = gdk-drawable-get-screen(drawable);
+    //  let renderer = gdk-pango-renderer-get-default(screen);
+    //  gdk-pango-renderer-set-gc(renderer, gcontext);
+    let context = gdk-pango-context-get-for-screen(screen);
+    let (_font, _width, _height, ascent) = gtk-font-metrics(font, context);
+    let layout = pango-layout-new(context);
+    pango-layout-set-font-description(layout, font.%font-description);
+    let transform = medium-device-transform(medium);
+    with-device-coordinates (transform, x, y)
+      when (towards-x & towards-y)
+        convert-to-device-coordinates!(transform, towards-x, towards-y)
+      end;
+      //---*** What about x and y alignment?
+      if (do-tabs?)
+        let tab-width  = text-size(medium, " ") * 8;
+        let tab-origin = if (do-tabs? == #t) x else do-tabs? end;
+        let x = 0;
+        let s = _start;
+        block (break)
+          while (#t)
+            let e = position(string, '\t', start: s, end: _end) | _end;
+            let substring = copy-sequence(string, start: s, end: e);
+            pango-layout-set-text(layout, substring, e - s);
+            //          pango-layout-context-changed(layout);
+            //          pango-renderer-draw-layout(renderer, layout, tab-origin + x, y);
+            gdk-draw-layout(drawable, gcontext, tab-origin + x, y - ascent, layout);
+            if (e = _end)
+              break()
+            else
+              with-stack-structure (rectangle :: <PangoRectangle>)
+                pango-layout-get-pixel-extents(layout, null-pointer(<PangoRectangle>), rectangle);
+                x := floor/(x + rectangle.PangoRectangle-x + rectangle.PangoRectangle-width 
+                              + tab-width, tab-width) * tab-width;
+                s := min(e + 1, _end)
+              end;
+            end
+          end
+        end
+      else
+        let substring
+          = if (_start = 0 & _end = length) 
+              string
+            else
+              copy-sequence(string, start: _start, end: _end)
             end;
-	  end
-	end
+        pango-layout-set-text(layout, substring, -1);
+        //pango-layout-context-changed(layout);
+        //pango-renderer-draw-layout(renderer, layout, x, y);
+        gdk-draw-layout(drawable, gcontext, x, y - ascent, layout);
       end
-    else
-      let substring
-	= if (_start = 0 & _end = length) string
-	  else copy-sequence(string, start: _start, end: _end) end;
-      pango-layout-set-text(layout, substring, -1);
-      //pango-layout-context-changed(layout);
-      //pango-renderer-draw-layout(renderer, layout, x, y);
-      gdk-draw-layout(drawable, gcontext, x, y - ascent, layout);
     end
   end
 end method draw-text;
 
+
+
+
+
+
+

Modified: branches/opendylan-melange/gtk-duim/gtk-fonts.dylan
==============================================================================
--- branches/opendylan-melange/gtk-duim/gtk-fonts.dylan	(original)
+++ branches/opendylan-melange/gtk-duim/gtk-fonts.dylan	Wed Dec 12 00:51:16 2007
@@ -114,7 +114,7 @@
                          attributes,
                          size);
     duim-debug-message("do-text-style-mapping: %s", font-name);
-    let font-description = pango-font-description-from-string(font-name); 
+    let font-description = with-gdk-lock pango-font-description-from-string(font-name) end; 
     let font = make(<gtk-font>, name: font-name, description: font-description);
     table[text-style] := font;
     font
@@ -201,12 +201,14 @@
     (font :: <gtk-font>, pango-context :: <PangoContext>)
  => (font :: <gtk-font>,
      width :: <integer>, height :: <integer>, ascent :: <integer>, descent :: <integer>)
-  let metrics = pango-context-get-metrics(pango-context, font.%font-description, pango-language-get-default());
-  values(font,
-         round/(pango-font-metrics-get-approximate-char-width(metrics), $PANGO-SCALE),
-         round/(pango-font-metrics-get-ascent(metrics) + pango-font-metrics-get-descent(metrics), $PANGO-SCALE),
-         round/(pango-font-metrics-get-ascent(metrics), $PANGO-SCALE),
-         round/(pango-font-metrics-get-descent(metrics), $PANGO-SCALE));
+  with-gdk-lock
+    let metrics = pango-context-get-metrics(pango-context, font.%font-description, pango-language-get-default());
+    values(font,
+           round/(pango-font-metrics-get-approximate-char-width(metrics), $PANGO-SCALE),
+           round/(pango-font-metrics-get-ascent(metrics) + pango-font-metrics-get-descent(metrics), $PANGO-SCALE),
+           round/(pango-font-metrics-get-ascent(metrics), $PANGO-SCALE),
+           round/(pango-font-metrics-get-descent(metrics), $PANGO-SCALE));
+  end;
 end;
 
 define sealed method gtk-font-metrics
@@ -249,16 +251,18 @@
 	     _start :: <integer>, _end :: <integer>)
 	 => (x1 :: <integer>, y1 :: <integer>, 
 	     x2 :: <integer>, y2 :: <integer>)
-          let layout = pango-layout-new(gtk-get-pango-context-from-port(_port));
-          pango-layout-set-font-description(layout, font.%font-description);
-          pango-layout-set-text(layout,
-                                copy-sequence(string, start: _start, end: _end),
-                                _end - _start); 
-          with-stack-structure (rectangle :: <PangoRectangle>)
-            pango-layout-get-pixel-extents(layout, null-pointer(<PangoRectangle>), rectangle);
-            values(rectangle.PangoRectangle-x, rectangle.PangoRectangle-y,
-                   rectangle.PangoRectangle-x + rectangle.PangoRectangle-width,
-                   rectangle.PangoRectangle-y + rectangle.PangoRectangle-height)
+          with-gdk-lock
+            let layout = pango-layout-new(gtk-get-pango-context-from-port(_port));
+            pango-layout-set-font-description(layout, font.%font-description);
+            pango-layout-set-text(layout,
+                                  copy-sequence(string, start: _start, end: _end),
+                                  _end - _start); 
+            with-stack-structure (rectangle :: <PangoRectangle>)
+              pango-layout-get-pixel-extents(layout, null-pointer(<PangoRectangle>), rectangle);
+              values(rectangle.PangoRectangle-x, rectangle.PangoRectangle-y,
+                     rectangle.PangoRectangle-x + rectangle.PangoRectangle-width,
+                     rectangle.PangoRectangle-y + rectangle.PangoRectangle-height)
+            end;
           end;
 	end method measure-string;
   case

Modified: branches/opendylan-melange/gtk-duim/gtk-gadgets.dylan
==============================================================================
--- branches/opendylan-melange/gtk-duim/gtk-gadgets.dylan	(original)
+++ branches/opendylan-melange/gtk-duim/gtk-gadgets.dylan	Wed Dec 12 00:51:16 2007
@@ -1713,7 +1713,7 @@
     //remember index into gadget-items (for selection)
     let index = gadget-items(pane).size - 1;
     let np = null-pointer(<GtkTreeIter>);
-    let gtk-parent = gtk-iter(parent) | np;
+    let gtk-parent = ((node-generation(item) > 0) & gtk-iter(parent)) | np;
     let children? = tree-control-children-predicate(pane);
     with-gdk-lock
       with-stack-structure (iter :: <GtkTreeIter>)
@@ -1761,17 +1761,10 @@
 
 define sealed method do-expand-node
     (pane :: <gtk-tree-control>, node :: <gtk-tree-node>) => ()
-//are we supposed to do something here?
-/*  unless (empty?(node-children(node)))
-    let mirror = sheet-direct-mirror(pane);
-    when (mirror)
-      let handle = window-handle(mirror);
-      let item-handle :: <HTREEITEM> = node.%handle;
-      duim-debug-message("Expanding node object %= for tree %=",
-                         node-object(node), pane);
-      SendMessage(handle, $TVM-EXPAND, $TVE-EXPAND, pointer-address(item-handle))
-    end
-  end */
+  with-gdk-lock
+    let path = gtk-tree-model-get-path(pane.store-model, node.gtk-iter);
+    gtk-tree-view-expand-row(pane.sheet-direct-mirror.mirror-widget , path, $false)
+  end;
 end method do-expand-node;
 
 define sealed method update-list-control-items
@@ -1779,46 +1772,15 @@
  => ()
   let model = gadget.store-model;
   let roots = tree-control-roots(gadget);
-  let children? = tree-control-children-predicate(gadget);
-  let label-function = gadget-label-key(gadget);
   with-gdk-lock
     gtk-tree-store-clear(model);
-    gadget-items(gadget).size := 0;
-    let np = null-pointer(<GtkTreeIter>);
-    with-stack-structure (iter :: <GtkTreeIter>)
-      with-stack-structure (data :: <GValue>)
-        for (tln in roots, i from 0)
-          gtk-tree-store-insert-before(model, iter, np, np);
-          let node = do-make-node(gadget, <tree-node>,
-                                  object: tln, gtk-iter: iter);
-          add!(tree-control-root-nodes(gadget), node);
-          g-value-nullify(data);
-          let label = label-function(tln);
-          unless (instance?(label, <string>))
-            label := format-to-string("%=", label);
-          end;
-          g-value-set-value(data, label);
-          gtk-tree-store-set-value(model, iter, 1, data);
-          g-value-nullify(data);
-          g-value-set-value(data, i);
-          gtk-tree-store-set-value(model, iter, 0, data);
-          add!(gadget.gadget-items, tln);
-          if (children?(tln))
-            with-stack-structure (dummy :: <GtkTreeIter>)
-              with-stack-structure (dummy-value :: <GValue>)
-                gtk-tree-store-insert-before(model, dummy, iter, np);
-                g-value-nullify(dummy-value);
-                g-value-set-value(dummy-value, "this is just a dummy");
-                gtk-tree-store-set-value(model, dummy, 1, dummy-value);
-                g-value-nullify(dummy-value);
-                g-value-set-value(dummy-value, -1);
-                gtk-tree-store-set-value(model, dummy, 0, dummy-value);
-              end;
-            end;
-          end;
-        end;
-      end;
-    end;
+  end;
+  gadget-selection(gadget) := #[];
+  gadget-items(gadget).size := 0;
+  tree-control-root-nodes(gadget) := make(<stretchy-vector>);
+  for (tln in roots)
+    let node = make-node(gadget, tln);
+    add-node(gadget, gadget, node, setting-roots?: #t);
   end;
 end;
 
@@ -1855,9 +1817,24 @@
   let path = map(string-to-integer,
                  split(as(<byte-string>, gtk-tree-path-to-string(path)),
                        ':'));
-  let tree-node = find-node-list(sheet, path);
-  tree-node.gtk-iter := iter;
-  expand-node(sheet, tree-node);
+  let node = find-node-list(sheet, path);
+  node.gtk-iter := iter;
+  let tree = sheet;
+  unless (node-state(node))
+    with-busy-cursor (tree)
+      // If no items have ever been added, do it now
+      let children-predicate = tree-control-children-predicate(tree);
+      when (children-predicate(node-object(node)))
+	let children-generator = tree-control-children-generator(tree);  
+	let objects = children-generator(node-object(node));
+	let nodes = map-as(<simple-vector>,
+			   method (object) make-node(tree, object) end, objects);
+	do-add-nodes(tree, node, nodes)
+      end;
+      node-state(node) := #"expanded"
+    end
+  end;
+
   with-stack-structure (iter2 :: <GtkTreeIter>)
     //remove the dummy entry
     let res = gtk-tree-model-iter-children(model, iter2, iter);

Modified: branches/opendylan-melange/gtk-duim/gtk-pixmaps.dylan
==============================================================================
--- branches/opendylan-melange/gtk-duim/gtk-pixmaps.dylan	(original)
+++ branches/opendylan-melange/gtk-duim/gtk-pixmaps.dylan	Wed Dec 12 00:51:16 2007
@@ -115,35 +115,33 @@
 
 /// BitBlt
 
-//---*** THESE ALL NEED TO GET A GC TO DO THE COPYING ON AND ESTABLISH THE COPYING GCONTEXT
-
 define sealed method do-copy-area
     (from-medium :: <gtk-medium>, from-x :: <integer>, from-y :: <integer>,
      width :: <integer>, height :: <integer>,
      to-medium :: <gtk-medium>, to-x :: <integer>, to-y :: <integer>,
      #key function = $boole-1) => ()
   if (from-medium == to-medium)
+    let (drawable, gcontext) = get-gcontext(from-medium);
     let sheet     = medium-sheet(from-medium);
     let transform = sheet-device-transform(sheet);
-    let drawable  = medium-drawable(from-medium);
     with-device-coordinates (transform, from-x, from-y, to-x, to-y)
       with-device-distances (transform, width, height)
-	gdk-window-copy-area(drawable, gcontext, to-x, to-y,
-			     drawable, from-x, from-y, width, height)
+	gdk-draw-drawable(drawable, gcontext, drawable, from-x, from-y,
+                          to-x, to-y, width, height)
       end
     end
   else
+    let from-drawable = get-gcontext(from-medium);
+    let (to-drawable, gcontext) = get-gcontext(from-medium);
     let from-sheet     = medium-sheet(from-medium);
     let from-transform = sheet-device-transform(from-sheet);
-    let from-drawable  = medium-drawable(from-medium);
     let to-sheet       = medium-sheet(to-medium);
     let to-transform   = sheet-device-transform(to-sheet);
-    let to-drawable    = medium-drawable(to-medium);
     with-device-coordinates (from-transform, from-x, from-y)
       with-device-coordinates (to-transform, to-x, to-y)
 	with-device-distances (from-transform, width, height)
-	  gdk-window-copy-area(to-drawable, gcontext, to-x, to-y,
-			       from-drawable, from-x, from-y, width, height)
+	  gdk-draw-drawable(to-drawable, gcontext, from-drawable, from-x, from-y,
+                            to-x, to-y, width, height)
 	end
       end
     end



More information about the chatter mailing list