[Gd-chatter] r11525 - trunk/libraries/gui-sniffer

andreas at gwydiondylan.org andreas at gwydiondylan.org
Thu Dec 6 00:04:59 CET 2007


Author: andreas
Date: Thu Dec  6 00:04:58 2007
New Revision: 11525

Modified:
   trunk/libraries/gui-sniffer/command-line.dylan
   trunk/libraries/gui-sniffer/gui-sniffer.dylan
   trunk/libraries/gui-sniffer/main.dylan
   trunk/libraries/gui-sniffer/module.dylan
Log:
job: minor

Scroll bars for the Deuce panes, a prompt for the command line, and a so
far very ugly redirection of *standard-output* to the command region.


Modified: trunk/libraries/gui-sniffer/command-line.dylan
==============================================================================
--- trunk/libraries/gui-sniffer/command-line.dylan	(original)
+++ trunk/libraries/gui-sniffer/command-line.dylan	Thu Dec  6 00:04:58 2007
@@ -131,7 +131,61 @@
        profile-commands?: profile-commands?)
 end method make-command-line-server;
 
+//--- Need a more modular way to do this (says the comment I copy&pasted...)
+define constant $prompt-image-offset :: <integer> =  4;
 
+define sealed method display-line
+    (line :: <text-line>, mode :: <nnv-shell-mode>, window :: <basic-window>,
+     x :: <integer>, y :: <integer>,
+     #key start: _start = 0, end: _end = line-length(line), align-y = #"top") => ()
+  let section = line-section(line);
+  let image = case
+		~shell-section?(section) =>
+		  #f;
+		line == section-start-line(section) =>
+		  $prompt-arrow;
+		line == section-output-line(section) =>
+		  $values-arrow;
+		otherwise =>
+		  #f;
+	      end;
+  when (image & _start = 0)	// no icon on continuation lines
+    let image-y = if (align-y == #"top") y else y - $prompt-image-height + 2 end;
+    draw-image(window, standard-images(window, image), x, image-y + $prompt-image-offset)
+  end;
+  next-method(line, mode, window, x + $prompt-image-width, y,
+	      start: _start, end: _end, align-y: align-y)
+end method display-line;
+
+define sealed method line-size
+    (line :: <text-line>, mode :: <nnv-shell-mode>, window :: <basic-window>,
+     #key start: _start, end: _end)
+ => (width :: <integer>, height :: <integer>, baseline :: <integer>)
+  ignore(_start, _end);
+  let (width, height, baseline) = next-method();
+  values(width + $prompt-image-width, height, baseline)
+end method line-size;
+
+define sealed method position->index
+    (line :: <text-line>, mode :: <nnv-shell-mode>, window :: <basic-window>,
+     x :: <integer>)
+ => (index :: <integer>)
+  let x = x - $prompt-image-width;
+  if (x < 0) 0 else next-method(line, mode, window, x) end
+end method position->index;
+
+define sealed method index->position
+    (line :: <text-line>, mode :: <nnv-shell-mode>, window :: <basic-window>,
+     index :: <integer>)
+ => (x :: <integer>)
+  next-method(line, mode, window, index)
+end method index->position;
+
+define sealed method line-margin
+    (line :: <text-line>, mode :: <nnv-shell-mode>, window :: <basic-window>)
+ => (margin :: <integer>)
+  $prompt-image-width
+end method line-margin;
 
 
 

Modified: trunk/libraries/gui-sniffer/gui-sniffer.dylan
==============================================================================
--- trunk/libraries/gui-sniffer/gui-sniffer.dylan	(original)
+++ trunk/libraries/gui-sniffer/gui-sniffer.dylan	Thu Dec  6 00:04:58 2007
@@ -377,7 +377,6 @@
 end;
 
 define function highlight-hex-dump (mframe :: <gui-sniffer-frame>)
-  format-out("FOOOOOOO\n");
   let packet = mframe.packet-table.gadget-value;
   let tree = mframe.packet-tree-view;
   let selected-packet = tree.gadget-items[tree.gadget-selection[0]];
@@ -537,10 +536,12 @@
                    make(<column-splitter>,
                         children: vector(frame.packet-table,
                                          frame.packet-tree-view,
-                                         //scrolling (scroll-bars: #"both")
-                                           frame.packet-hex-dump,
+                                         scrolling (scroll-bars: #"both")
+                                           frame.packet-hex-dump
+                                         end,
+                                         scrolling (scroll-bars: #"both")
                                            frame.nnv-shell
-                                         //end
+                                         end
                                          ));
                  end;
 
@@ -882,7 +883,7 @@
     make(<text-editor>, text: $about-text, read-only?: #t, lines: 5, columns: 50);
   layout (frame)
     frame.splash-screen-pane;
-  keyword title: = "About Network Night Vision 0.0.1";
+  keyword title: = "About Network Night Vision 0.0.2";
 end;
 
 
@@ -919,7 +920,11 @@
   with-lock($packet-list-lock)
     add!(node.network-frames, frame-with-meta);
     if (~ node.filter-expression | matches?(frame, node.filter-expression))
-      add-item(node.packet-table, make-item(node.packet-table, frame-with-meta))
+      add-item(node.packet-table, make-item(node.packet-table, frame-with-meta));
+      // if (always-scroll)
+      let (left, top, right, bottom) = box-edges(node.packet-table);
+      let (x, y) = scroll-position(node.packet-table);
+      set-scroll-position(node.packet-table, x, bottom); 
     end;
   end;
 end;

Modified: trunk/libraries/gui-sniffer/main.dylan
==============================================================================
--- trunk/libraries/gui-sniffer/main.dylan	(original)
+++ trunk/libraries/gui-sniffer/main.dylan	Thu Dec  6 00:04:58 2007
@@ -10,6 +10,10 @@
   deuce/select-buffer(frame-window(gui-sniffer), deuce/*buffer*);
   command-enabled?(close-interface, gui-sniffer) := #f;
   gadget-enabled?(gui-sniffer.stop-button) := #f;
+  frame-mapped?(gui-sniffer) := #t;
+  *standard-output* := gui-sniffer.nnv-shell-pane.command-line-server.server-output-stream;
+  write(*standard-output*, $about-text);
+  new-line(*standard-output*);
   start-frame(gui-sniffer);
 end;
 

Modified: trunk/libraries/gui-sniffer/module.dylan
==============================================================================
--- trunk/libraries/gui-sniffer/module.dylan	(original)
+++ trunk/libraries/gui-sniffer/module.dylan	Thu Dec  6 00:04:58 2007
@@ -38,6 +38,7 @@
   use duim-deuce;
   use format;
   use format-out;
+  use standard-io;
   use streams;
   use date;
   use file-system;



More information about the chatter mailing list