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

andreas at gwydiondylan.org andreas at gwydiondylan.org
Sun Dec 16 22:59:52 CET 2007


Author: andreas
Date: Sun Dec 16 22:59:50 2007
New Revision: 11547

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

Removal of highlights in hexviewer pane, proper handling of initial
message on command line.


Modified: trunk/libraries/gui-sniffer/command-line.dylan
==============================================================================
--- trunk/libraries/gui-sniffer/command-line.dylan	(original)
+++ trunk/libraries/gui-sniffer/command-line.dylan	Sun Dec 16 22:59:50 2007
@@ -66,12 +66,15 @@
     inc!(*nnv-shell-count*);
     name := format-to-string("NNV shell %d", *nnv-shell-count*)
   end;
-  make-empty-buffer(buffer-class,
-                    name:       name,
-                    major-mode: major-mode,
-                    anonymous?: anonymous?,
-                    section-class: section-class,
-                    editor: editor);
+  let buffer = make-empty-buffer(buffer-class,
+                                 name:       name,
+                                 major-mode: major-mode,
+                                 anonymous?: anonymous?,
+                                 section-class: section-class,
+                                 editor: editor);
+  let node = make-empty-section-node(buffer);
+  add-node!(buffer, node, after: #"start");
+  buffer
 end method make-shell;
 
 define class <nnv-editor> (<basic-editor>) end;
@@ -95,6 +98,7 @@
              interval: buffer,
              window: window,
              direction: #"output");
+    stream-position(stream) := buffer.buffer-start-node.interval-end-bp;
     let server
       = make-command-line-server
         (real-context: context,

Modified: trunk/libraries/gui-sniffer/gui-sniffer.dylan
==============================================================================
--- trunk/libraries/gui-sniffer/gui-sniffer.dylan	(original)
+++ trunk/libraries/gui-sniffer/gui-sniffer.dylan	Sun Dec 16 22:59:50 2007
@@ -379,14 +379,16 @@
 define function highlight-hex-dump (mframe :: <gui-sniffer-frame>)
   let packet = mframe.packet-table.gadget-value;
   let tree = mframe.packet-tree-view;
-  let selected-packet = tree.gadget-items[tree.gadget-selection[0]];
+  if (tree.gadget-selection.size > 0)
+    let selected-packet = tree.gadget-items[tree.gadget-selection[0]];
 
-  let start-highlight = compute-absolute-offset(selected-packet, packet.real-frame);
-  let end-highlight = start-highlight + compute-length(selected-packet);
-  format-out("start highlight %d end highlight %d\n", start-highlight, end-highlight);
-  set-highlight(mframe, start-highlight, end-highlight);
+    let start-highlight = compute-absolute-offset(selected-packet, packet.real-frame);
+    let end-highlight = start-highlight + compute-length(selected-packet);
+    set-highlight(mframe, start-highlight, end-highlight);
+  else
+    remove-highlight(mframe);
+  end;
   redisplay-window(mframe.packet-hex-dump);
-
 end;
 
 define variable *count* :: <integer> = 0;
@@ -538,12 +540,12 @@
                    make(<column-splitter>,
                         children: vector(frame.packet-table,
                                          frame.packet-tree-view,
-                                         scrolling (scroll-bars: #"both")
-                                           frame.packet-hex-dump
-                                         end,
-                                         scrolling (scroll-bars: #"both")
+//                                         scrolling (scroll-bars: #"both")
+                                           frame.packet-hex-dump,
+//                                         end,
+//                                         scrolling (scroll-bars: #"both")
                                            frame.nnv-shell
-                                         end
+//                                         end
                                          ));
                  end;
 
@@ -704,6 +706,7 @@
   apply-filter(frame);
   let packets = map(real-frame, frame.packet-table.gadget-items);
   let payloads = map(method(x) real-payload(x).data end, packets);
+  // urgh, apply seems to crash when payloads.size exceeds a certain size...
   show-payloads(apply(concatenate, payloads), owner: frame);
 end;
 

Modified: trunk/libraries/gui-sniffer/hex-view.dylan
==============================================================================
--- trunk/libraries/gui-sniffer/hex-view.dylan	(original)
+++ trunk/libraries/gui-sniffer/hex-view.dylan	Sun Dec 16 22:59:50 2007
@@ -111,6 +111,22 @@
   end;
 end;
 
+define method remove-highlight (frame)
+  let window :: <basic-window> = frame-window(frame);
+  let name = "Network Night Vision";
+  let editor = frame-editor(frame);
+  let buffer = find-buffer(editor, name);
+  if (buffer)
+    For (i from 0,
+        line = buffer.buffer-start-node.node-section.section-start-line then line.line-next,
+        while: line)
+      line.line-style-changes := #[];
+    end;
+    select-buffer-in-appropriate-window(window, buffer);
+    initialize-redisplay-for-buffer(window, buffer);
+  end;
+end;
+
 define method show-hexdump (frame :: <basic-editor-frame>,
                            text)
   let lines = split(hexdump(text), '\n');

Modified: trunk/libraries/gui-sniffer/main.dylan
==============================================================================
--- trunk/libraries/gui-sniffer/main.dylan	(original)
+++ trunk/libraries/gui-sniffer/main.dylan	Sun Dec 16 22:59:50 2007
@@ -14,6 +14,7 @@
   *standard-output* := gui-sniffer.nnv-shell-pane.command-line-server.server-output-stream;
   write(*standard-output*, $about-text);
   new-line(*standard-output*);
+  recenter-window(gui-sniffer.nnv-shell-pane, gui-sniffer.nnv-shell-pane.window-point.bp-line, #"bottom");
   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	Sun Dec 16 22:59:50 2007
@@ -10,7 +10,7 @@
   use deuce;
   use deuce-internals;
 
-  export show-hexdump, set-highlight, hexdump;
+  export show-hexdump, set-highlight, hexdump, remove-highlight;
 end;
 
 define module command-line



More information about the chatter mailing list