rebol [ Title: "Dump-Face" File: %dump-face.r Author: "Romano Paolo Tenca" Date: 04/10/03 History: { 1.0.1 04/10/03 check if face in more panes new refinements 1.0.0 04/06/02 first public release } Purpose: { Dump a face and its subfaces and deep find shared faces in a pane (for debugging) Returns the face itself, so can be used like probe. Overwrite the standard Rebol function. } ] context [ get-safe: func [x [object!] w [word!]][if in x w [get/any in x w]] found: depth: none prt: func [face depth flag n color] [ print [ depth "N." n "Var:" get-safe face 'var "Sty:" get-safe face 'style "Off:" face/offset "Siz:" face/size "Edg:" all [get-safe face 'edge face/edge/size] either flag [join "Flg: " all [get-safe face 'flags copy form face/flags]][""] either color [join "Clr: " all [get-safe face 'color copy form face/color]][""] either get-safe face 'text [rejoin [{Txt: "} copy/part form face/text 15 {"}]][""] ] ] system/words/dump-face: func [ "Dump a face or a pane and its subfaces (for debugging). Changed by ana" face [object! block!] /flag "Show also flags" /color "Show also color" ][ found: copy [] depth: copy "^-" dump-face face flag color ] dump-face: func [ face [object! block!] flag [logic! none!] color [logic! none!] /local f ][ either block? face [ print [depth type? face] foreach f face [either object? f [dump-face f flag color] [print [depth "Styles Name:" f]]] ][ if f: find found face [ print ["*** The face N." 1 + length? found "is in more than one pane. See the N." index? f] ] append found face prt face depth flag length? found color insert depth tab either function? get-safe face 'pane [ if all [in face 'subface object? face/subface] [ print [depth "-- Subface (List):"] dump-face face/subface flag color ] ][ if object? get-safe face 'pane [ print [depth "-- Pane: object!"] dump-face face/pane flag color ] if block? get-safe face 'pane [ print [depth "-- Pane: block! [" length? face/pane "]"] foreach f face/pane [dump-face f flag color] ] ] remove depth ] if 1 = length? depth [clear found] face ] ] ;all what follow can be commented out or cancelled if not value? 'my_local_user [ print "Example of 'face in more than one pane':" x: make-face/size/spec 'text 3x3 [text: "Duplicated face"] y: layout [p1: panel [ p2: panel []]] append y/pane x append p1/parent-face/pane x append p2/parent-face/pane x dump-face/flag y halt ]