SizeAndPlace
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © kaigouthro
//@version=5

// @description size and location shortcuts
library("SizeAndPlace")


// for copy/paste
_size = input.string('Tiny', 'Size', options = ['Tiny','Small','Normal','Large','Huge','Auto'    ])
_locattion = input.string('above', 'Location', options = ['above','belowr','bottom','absolute'  ])


//@function table posittion from integer
//@param _inp 1-9
export table_posittion ( int      _inp       ) =>    
    switch  _inp
        1 =>  position.top_left
        2 =>  position.top_center
        3 =>  position.top_right
        4 =>  position.middle_left
        5 =>  position.middle_center
        6 =>  position.middle_right
        7 =>  position.bottom_left
        8 =>  position.bottom_center
        9 =>  position.bottom_right

//@function  Size by number 1-5 (else auto)
//@param  size 1-5
export size            ( int     size       ) =>    
    txtSize = switch  size
        1 =>  size.tiny
        2 =>  size.small
        3 =>  size.normal
        4 =>  size.large
        5 =>  size.huge
        =>    size.auto
    
//@function  Size by Short String for input to string
//@param
export size            ( string  txtSize    ) =>    
    switch txtSize  
        'Tiny'   => size.tiny
        'Small'  => size.small
        'Normal' => size.normal
        'Large'  => size.large
        'Huge'   => size.huge
        'Auto'   => size.auto
        => size.auto

//@function  location from number
//@param _inp 1-4
export location        ( int     _inp        ) =>    
    switch  _inp
        1 =>  location.abovebar
        2 =>  location.belowbar
        3 =>  location.bottom
        4 =>  location.absolute
    
//@function  location from number
//@param _inp Sttring name
export location        ( string  _inp   ) =>    
    switch _inp
        'above'    => location.abovebar
        'belowr'   => location.belowbar
        'bottom'   => location.bottom
        'absolute' => location.absolute

