#!../mofe --f
# This script demonstrates how to create multiple edit panes sharing the
# the same text source
# 
# Gustaf Neumann                             Mohegan Lake, Dec 3 1994

set roman  -*-times-medium-r-*-*-16-*-*-*-*-*-*-1
set italic -*-times-medium-i-*-*-16-*-*-*-*-*-*-1
set bold   -*-times-bold-r-*-*-16-*-*-*-*-*-*-1

mergeResources topLevel \
  *selectColor	DEFAULT_SELECT_COLOR \
  *FontList $roman=roman,$italic=italic,$bold=bold \
  *renderTable roman,italic,bold \
  *renderTable.fontType FONT_IS_FONT \
  *renderTable.bold.renditionForeground yellow \
  *renderTable.italic.renditionForeground green \
  *renderTable.italic.underlineType SINGLE_LINE \
  *renderTable.roman.font  $roman \
  *renderTable.italic.font $italic \
  *renderTable.bold.font   $bold

mergeResources topLevel \
    *columns 80 *editMode MULTI_LINE_EDIT \
    *activateCallback %w

XmRowColumn rc topLevel
 XmPanedWindow p rc
  XmScrolledCSText e p rows 10 columns 80 paneMinimum 20  \
      cstextValue {^roman This is ^bold text ^roman is to be ^italic shared^roman ....}
  XmRowColumn btns rc orientation horizontal
   XmPushButton addTextPane btns
   XmPushButton quit btns

realize
#sV e renderTable roman,italic,bold 

set nrPanes 1
proc addTextPane {} {
  global nrPanes 
  set newHt [expr 9*[gV p height]/(10*[incr nrPanes])]
  XmScrolledCSText e$nrPanes p \
      allowResize true source [gV e source] \
      paneMinimum $newHt
  sV [parent e$nrPanes] paneMinimum 20
}
