NB. Display  - allows experiments with output display
NB.
NB. from Oleg Kobchenko

POPUP=: 0 : 0
pc popup dialog;pn "Appearance";
menupop "Display";
menu cmAtomic "Atomic" "" "(9!:3) 1" "";
menu cmLinear "Linear" "" "(9!:3) 2" "";
menu cmBoxed "Boxed" "" "(9!:3) 4" "";
menu cmTree "Tree" "" "(9!:3) 5" "";
menu cmParens "Parens" "" "(9!:3) 6" "";
menupopz;
menupop "Boxes";
menu cmLinedraw "0 Linedraw" "" "9!:7 'ÚÂ¿ÃÅ´ÀÁÙ³Ä'" "";
menu cmAscii "1 Ascii" "" "9!:7 '+++++++++|-'" "";
menu cmSpaces "2 Spaces" "" "9!:7 '           '" "";
menu cmCorners "3 Corners" "" "9!:7 'ÚÂ¿ÃÅ´ÀÁÙ  '" "";
menu cmNoCorners "4 No corners" "" "9!:7 '         ³Ä'" "";
menu cmDots "5 Dots" "" "9!:7 'ùùùùùùùùùùù'" "";
menusep ;
menu cmTop "0 Top" "" "(9!:17) 0,C" "";
menu cmMiddle "1 Middle" "" "(9!:17) 1,C" "";
menu cmBottom "2 Bottom" "" "(9!:17) 2,C" "";
menusep ;
menu cmLeft "0 Left" "" "(9!:17) R,0" "";
menu cmCenter "1 Center" "" "(9!:17) R,1" "";
menu cmRight "2 Right" "" "(9!:17) R,2" "";
menupopz;
xywh 0 0 150 150;cc cbExpr combodrop ws_vscroll cbs_autohscroll rightmove;
xywh 0 10 150 130;cc edSample editm es_autohscroll es_autovscroll es_readonly rightmove bottommove;
pas 0 0;pcenter;ptop;
rem form end;
)

popup_run=: 3 : 0
wd POPUP
NB. initialize form here
wd'setfont cbExpr "Courier New" 11 oem'
wd'setfont edSample "Courier New" 11 oem'

cbExpr=: '+/ %#'
t=. '`+/%#`i.5 6`,.nl 6`(0;,.i.3),:<,:4 5`|:;:"1 list names 0'
LEXPR=: }:;,&LF&.><;._1 t
wd'set cbExpr *',LEXPR
wd'setselect cbExpr 0'
wd 'pshow;'
(>({.(9!:2''),5){DISPLAY)displaymenu''
(>(LINEDRAW i.9!:6''){BOXES)boxesmenu''
(>({.9!:16''){ROWS)rowmenu''
(>({:9!:16''){COLS)colmenu''
)

popup_cbExpr_button=: popup_cbExpr_select=: 3 : 0
showsample''
if. ($t) <: i=. (t=. <;._2 LEXPR,LF) i. (<cbExpr) do.
  wd'set cbExpr *',LEXPR=: cbExpr,LF,LEXPR
  wd'setselect cbExpr 0'
else.
  wd'setselect cbExpr ',":i
end.
)

showsample=: 3 : 0
try. ".'EXPR=.',cbExpr
  REP=. {.9!:2''
  wd'set edSample *', ,LF,~"1 ":(5!:REP)<'EXPR'
catch. wd'set edSample *Wrong Sample' end.
)

DISPLAY=: <;._1'//cmAtomic/cmBoxed//cmTree/cmLinear/cmParens'

displaymenu=: 3 : 0
syschild displaymenu y.
:
wd 'set ',"1 ' 0',~"1 >;:;:^:_1 DISPLAY
wd'set ',x.
try. 9!:3 DISPLAY i. <x.
  showsample''
catch. wd'set edSample *Display Error' end.
)

popup_cmAtomic_button=: displaymenu
popup_cmLinear_button=: displaymenu
popup_cmBoxed_button=: displaymenu
popup_cmTree_button=: displaymenu
popup_cmParens_button=: displaymenu

BOXES=: <;._1'/cmLinedraw/cmAscii/cmSpaces/cmCorners/cmNoCorners/cmDots'

LINEDRAW=: a.{~ ". ];._2(0 : 0)
218 194 191 195 197 180 192 193 217 179 196
 43  43  43  43  43  43  43  43  43 124  45
 32  32  32  32  32  32  32  32  32  32  32
218 194 191 195 197 180 192 193 217  32  32
 32  32  32  32  32  32  32  32  32 179 196
249 249 249 249 249 249 249 249 249 249 249
)

BOXCHARS=: [ ;._2 (0 : 0)
ÚÂ¿ÃÅ´ÀÁÙ³Ä
+++++++++|-

ÚÂ¿ÃÅ´ÀÁÙ
         ³Ä
ùùùùùùùùùùù
)

boxesmenu=: 3 : 0
syschild boxesmenu y.
:
wd 'set ',"1 ' 0',~"1 >BOXES
wd'set ',x.
try. 9!:7 LINEDRAW {~ BOXES i. <x.
  showsample''
catch. wd'set edSample *Box Error' end.
)

popup_cmLinedraw_button=: boxesmenu
popup_cmAscii_button=: boxesmenu
popup_cmSpaces_button=: boxesmenu
popup_cmCorners_button=: boxesmenu
popup_cmNoCorners_button=: boxesmenu
popup_cmDots_button=: boxesmenu

ROWS=: <;._1'/cmTop/cmMiddle/cmBottom'

rowmenu=: 3 : 0
syschild rowmenu y.
:
wd 'set ',"1 ' 0',~"1 >ROWS
wd'set ',x.
try. 9!:17 (ROWS i. <x.),{: 9!:16''
  showsample''
catch. wd'set edSample *Row Error' end.
)

popup_cmTop_button=: rowmenu
popup_cmMiddle_button=: rowmenu
popup_cmBottom_button=: rowmenu

COLS=: <;._1'/cmLeft/cmCenter/cmRight'

colmenu=: 3 : 0
syschild colmenu y.
:
wd 'set ',"1 ' 0',~"1 >COLS
wd'set ',x.
try. 9!:17 A=: ({.9!:16''),COLS i. <x.
  showsample''
catch. wd'set edSample *Col Error' end.
)

popup_cmLeft_button=: colmenu
popup_cmCenter_button=: colmenu
popup_cmRight_button=: colmenu

popup_close=: wd bind 'pclose'

popup_run''
