!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!
! @ l-old-maxbox
!
! &1: "1d" or "2d"
!
! Limit number of plotted boxes
!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!
define character layout*2
let layout "&1"
let do%maxbox abs(do%maxbox) ! Sanity check
!
if (layout.eq."1d") then
   ! case: p-old-over.cube, p-old-pv.cube
   if (true%nbox.gt.do%maxbox) then
      message w maxbox "Too many planes to be shown: "'true%nbox'
      message w maxbox "Default to current limit (do%maxbox): "'do%maxbox'
      message w maxbox "Change do%maxbox to increase current limit"
      let true%nbox do%maxbox
      let true%last[1] true%first[1]+(do%maxbox-1)*true%step[1]
   endif
else if (layout.eq."2d") then
   ! case: p-old-spectrum.cube
   ! Check number of plotted box
   define integer maxbox
   let maxbox sqrt(do%maxbox)
   if ((true%nxybox[1].gt.maxbox).or.(true%nxybox[2].gt.maxbox)) then
      message w maxbox "Too many boxes to be shown: "'true%nxybox[1]'" x "'true%nxybox[2]'
      message w maxbox "Default to current limit (sqrt(do%maxbox)): "'maxbox'
      message w maxbox "Change do%maxbox to increase current limit"
      for iaxis 1 to 2
         if (true%nxybox[iaxis].gt.maxbox) then
            let true%nxybox[iaxis] maxbox
            let true%step[iaxis] floor((true%last[iaxis]-true%first[iaxis])/maxbox)
         endif
      next
      message w maxbox "Sample one spectra every "'true%step[1]'" x "'true%step[2]'
   endif
else
   message e maxbox "Unknow layout type: "'layout'
   return base
endif
!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
