An ALE File That Mimics XV

A real-world ALE file that demonstrates much of ALE's capabilities is this one that defines the interface of xv, a popular UNIX image manipulation tool.


// xv is copyrighted by John Bradley.
// All rights reserved.  No copyright infringement is intended.

section main
{
   // Top section components
   
   logo(p, p, 5, 5, LT)
   
   flow(HORIZONTAL, logo.r + 5, w - 5, 5)
   {
      display    ((w - (5 + logo.w) - 10) / 3 - 1, logo.h / 2 - 1, 0, 0, CT)
      bitControl (display.w, display.h,                      0, 0, CT)
      algorithms (display.w, display.h,                      0, 0, CT)
   }
   
   root      (display.w, display.h, display.l,    display.b + 1, LT)
   windows   (display.w, display.h, bitControl.l, display.b + 1, LT)
   imageSize (display.w, display.h, algorithms.l, display.b + 1, LT)
   
   // Middle section components
   
   messageArea (.8 * w, .55 * h, 5, logo.b + 5, LT)
   
   flow(VERTICAL, messageArea.t, messageArea.b, w - 5)
   {
      next   (w - ((5 + messageArea.w) + 10), messageArea.h / 7, 0, 0, RC)
      prev   (next.w, next.h,                              0, 0, RC)
      load   (next.w, next.h,                              0, 0, RC)
      save   (next.w, next.h,                              0, 0, RC)
      print  (next.w, next.h,                              0, 0, RC)
      delete (next.w, next.h,                              0, 0, RC)
      files  (next.w, next.h,                              0, 0, RC)
   }
   
   // Bottom row of buttons, the first two are half the size of the other
   // 5 full size buttons
   
   xvPad    ((w - 10) / 12, p, 5, h - 5,         LB)
   xvPrompt (xvPad.w, p,       xvPad.r, xvPad.b, LB)
   
   flow(HORIZONTAL, xvPrompt.r, w - 5, xvPad.b)
   {
      crop     (xvPad.w * 2, xvPad.h, 0, 0, CB)
      uncrop   (crop.w, crop.h,       0, 0, CB)
      autocrop (crop.w, crop.h,       0, 0, CB)
      aboutXV  (crop.w, crop.h,       0, 0, CB)
      quit     (crop.w, crop.h,       0, 0, CB)
   }
   
   // Next to bottom row of buttons 10 buttons that are the same size as the
   // smaller two in the previous row above, one full size button
   
   buttonOne   (xvPad.w,     p, xvPad.l,       xvPad.t,          LB)
   buttonTwo   (buttonOne.w, p, xvPrompt.r,    buttonOne.b,      RB)
   buttonThree (buttonOne.w, p, crop.l,        buttonOne.b,      LB)
   buttonFour  (buttonOne.w, p, crop.r,        buttonOne.b,      RB)
   smaller     (buttonOne.w, p, uncrop.l,      buttonOne.b,      LB)
   bigger      (buttonOne.w, p, uncrop.r,      buttonOne.b,      RB)
   rotateLeft  (buttonOne.w, p, autocrop.l,    buttonOne.b,      LB)
   rotateRight (buttonOne.w, p, autocrop.r,    buttonOne.b,      RB)
   hMirror     (buttonOne.w, p, aboutXV.l,     buttonOne.b,      LB)
   vMirror     (buttonOne.w, p, aboutXV.r,     buttonOne.b,      RB)
   grab        (quit.w, quit.h, quit.l,        buttonOne.b,      LB)
   
   // The status line
   
   status      (w - 10, p,      5, (grab.t + messageArea.b) / 2, LC)
}