# this is a quick proposal for new config syntax:
# not.,.. space is the delimiter for everything.. so u NEEED spaces
#
# there are now mathematicl ops available, and variables and functions ...
# vriables set:
# $ENL_SCREEN_WIDTH  : width of the screen in pixels
# $ENL_SCREEN_HEIGHT : height of the screen in pixels
# $ENL_LAST_ITEM     : the name of the last button, menu, subwin etc. defined
# $ENL_SCREEN_DEPTH  : the highest bit depth available on the screen
# $ENL_VERSION       : version multiplied by 1000 (so 1.0 = 1000, 0.01 = 10)
# $ENL_...           : suggestions for more?
#
# mathematical ops:
# +  N   : add  N
# -  N   : subtract N
# *  N   : multiply by N
# /  N   : divide by N
# |< N   : lower bound to N (if less than N set to N)
# >| N   : upper bound to N (if greater than N set to N)
# %  N   : modulo N
#
# note.. all mathematical ops to be evaluated must be instied square brackets
# like:
# [ $WIDTH - 1 ]
# They are all evaluated in left to right fashion.. no precedence of operation
# exists, and no bracket grouping allowed... so plan your operations carefully
# and keep them simple..........
#
# functions:
# function ( function_name param1 param2 param3 ... )
# function_name is the name of the function to call, and param1 etc are the
# parameters to call the function with.. each function has different params
# that is needs and different numbers of params... they can be of any type
# (string or numeric). functions may or may not return data (in string or
# numeric form).
#
# built-in-functions:
#
# function ( get_co-ord item_name co-ord_requested ) : co-ord
# returns the X or Y co-ord of the edge of an item relative to its parent
# (for buttons, iconbox and pagers this is the root window). item_name
# is the name identifier for the item, co-ord_requested is the co-ord you
# are after (values: top, bottom, left, right). it returns the co-ordiate
# of that edge in pixels relative to the top-left of the parent.
#
# function ( get_size item_name size_requested ) : size
# gets the size_requested (widht, height) of an item item_name and returns it.
#
# function ( get_image_name item_name) : image_name
# returns the image class of the specified itam_name item used for the state
# specified in state (normal, hilite, clicked).
#
# function ( get_image_file image_class state ) : image_file
# returns the filename of the specified image_class image used for the state
# specified in state (normal, hilite, clicked).
#
# function ( get_shape_color image_class color ) : color_value
# returns the R, G or B value of the transparent pixel color selected for
# that image, the color will specify with value ( R, G or B) to retuen, so
# if u call function (shape_color $ITEM R), it will return the R shape color.
# if all R, G and B are -1, then there is no transparent color.
#
# function ( get_resident image_name ) : resident
# will retunr numeric 1 or 0 as to if the image is resident or not. 1 if it
# is, 0 if it isn't.
#
# function ( get_action item_name modifier button) : action_string
# returns the action string (eg move, exec command -options etc.) from the
# item_name specified item and when it is clicked with the modifier modifiers
# pressed and the mouse button (1-3) specified.
#
# deifne CLASSES of images, to go in a new images file?
begin images
  begin class
# give it a type identifier
    type TERMINAL
# specifying resident will make E keep the 24 bit copy of the image in memory
# permenantly. in the majority of cases this is not required, but when you
# wantr to rescale images FAST, turn this on, otherwise if an image needs to
# be rescaled it has to be reloaded off disk. if not specified, it is assumed
# off.
    resident off
# buttons use all 3, pager uses normal and clicked, iconbox uses just normal
# menus use normal and normal and hilite, window borders use all 3.
    image normal  pix/term_1.ppm shape on 255 0 255
    image hilite  pix/term_2.ppm shape on 255 0 255
    image clicked pix/term_3.ppm shape on 255 0 255
  end
  begin class
    type WEB
    resident off
    image normal  pix/netscape_1.ppm shape on 255 0 255
    image hilite  pix/netscape_2.ppm shape on 255 0 255
    image clicked pix/netscape_3.ppm shape on 255 0 255
  end
  begin class
    type PAGER
    image normal  pix/pager_1.ppm shape on 255 0 255
    image clicked pix/pager_3.ppm shape on 255 0 255
  end
end

# example button config wiht new system
begin buttons
  begin button
# image class to use.......
    image class TERMINAL
# name of button.. now we'll name our things so we can identify them...
    name term_button
# specify the corner of the image that is to be used as the anchor for XY pos
    corner   bottom_left
# the siez is specifed so it will be 48 pixels wide if the screen is 1152
# side.. so if the screen is576 wide, it will be 24 wide (scaled to res),
# but since it is limited to 32, it will be 32.. 
    size X [ 48 * 1152 / $ENL_SCREEN_WIDTH |< 32 >| 48 ]
    size Y [ 32 * 900 / $ENL_SCREEN_HEIGHT |< 24 >| 32 ]
# same stoyr with position....
    location X 0
    location Y $ENL_SCREEN_HEIGHT - 1
# note the + for modifiers.....
    action none      1 exec Eterm
    action alt+shift 1 exec xterm
  end
  begin button
    image class WEB
    name web_button
    corner   bottom_left
# keep the size the original image size.. this is OPTIONAL as it will be the
# assumed default.....
    size X [ original ]
    size Y [ original ]
# more new stuff.. functions... format:
# function ( function_name param1 param2 param3 etc. )
# this will return a vaule (either string or numeric.. and can be used to
# find out info about items in E.
    location X [ function ( get_co-ord $ENL_LAST_ITEM left ) ] 
    location Y [ function ( get_co-ord $ENL_LAST_ITEM bottom ) + 1 ]
    action none      1 exec netscape
    action none      2 exec arena
  end
  begin button
    image class MAIL
    name mail_button
    corner bottom_left
# notice.. no size... therfore assume original image size.
# this put s abutton to the right of the term, making an "L" shape. wherever
# we move the term_button, the other 2 will now follow.. :)
# instead of LAST (a reserved name) we can specify a button to be relative to
# explicitly by its given name.
    location X [ function ( get_co-ord $ENL_LAST_ITEM right ) + 1 ] 
    location Y [ function ( get_co-ord $ENL_LAST_ITEM bottom ) ]
    action none      1 exec tkrat
    action none      3 exec popclient
  end
end

# the idea is now we can use the same idea for menus too? :) maybe with a
# little more detail like:
begin menus
  begin menu
    name root1
    type custom
    popupdist 32 10
    location 
    begin default
      image class MENU_LIST_ITEM
      corner top_left
      size X original
      size Y 24
      location X 0
# special... in the context of default times, WIDTH, HEIGHT and LAST_X, LAST_Y
# are implicit variables but with % infront, that are evaluated on runtime
      location Y [ %LAST_Y + %HEIGHT ]
      text size X [ %WIDTH - 10 ]
      text size Y [ %HEIGHT - 4 ]
      text location X 5
      text location Y 2
    end
    begin menutiem
      image class MENU_LIST_HEADER
      name root1.header
      type decor
      corner top_left
      location X 0
      location Y 0
# no size, so assume image original size X & Y
# also no text info, so assume  X & Y 0,0 and widht and heihgt 0,0
    end
# this is a default item.. its position is calculated as if it is the next
# item after the previous one, as if it were a default item, except this
# previous item can be fixed, determining where the menu items begin being
# arranged (ie AFETER the last of the "decor" items...
    begin menuitem
      name root1.entry_01
      type default
      text Run Eterm
      action exec Eterm -bg black -fg #aaaaaa
    end
    ....
  end
end

begin control
# currently box and opaque exist.. I'll add a new one.. CAD .. if u've seen
# windowmaker's resize box.. U'll know what I mean... the default if not
# specified will be box.
  move opaque
  resize box
# new options grid.. this will align moves or resizes to pixel units specified
# This only applies to moves and resizes by the user.. if an app resizes or
# moves itself it can do so at will. setting a grid of 1 will give default
# behavior. If not specified, 1 is assumed.
  grid move X 5
  grid move Y 5
  grid resize X 5
  grid resize Y 5
# default for autoraise is off, if not specified
  autoraise off 1000
# default focus type is pointer, unless otherwise specified.
  focus pointer
# default for snapshot pager is off, unless otherwise specified
  snapshotpager on
# states file... if not specified it is assumed to be off. states file unless
# an absolute path is given is assumed to be relative to the users
# .enlightenment directory
  statesfile on .E-window_states
end

begin cursors
# I've mved the "resize" cursor stuff in a special cursor section of type
# resize.. 
  begin cursor
    type resize
    bg_color 255 200 40
    fg_color 80 0 0
    font_size 8
# you can also define the line width.. and font size in pixels. defaults to 1
# if not specified.
    line_width 1
# draw can be either xor or write. Xor does what is done now, write does solid
# writes with a border color of fg_color, and a center color of bg_color.
# defaults to XOR if not specified
    draw xor
  end
  begin cursor
    type default
    bg_color 160 100 40
    fg_color 0 0 0
    pixmap pix/cursor_1.xbm
    pixmap pix/cursor_2.xbm
  end
  ....
end

begin desktops
# uses normal and hilite for the 2 images, if snapshots cannot be done or
# have been turned off....
  image class DESKTOP_MINI
  begin desktop
    number 0
# above or below client windows.. assume above by default    
    level above
# the background color, if there is no bg image for the desktop.. if no color
# is defined, 0 0 0 (black) is assumed as default
    bg_color 80 80 80
# this is the border for the pager. it is optional.. see below
    begin border
# image class used, normal and hilite used for unselected and selected
# versions
# this item has an implicit name of desk.border.DESK_NUM (0,1,2 etc.) for
# use with $ENL_LAST_ITEM
      image class DESK_PAGER
      corner bottom_left
      location X 0
      location Y [ $ENL_SCREEN_HEIGHT - 1 ]
      size X original
      size Y original
    end
# to do with the pager display and location.. if none is given, no pager is
# displayed for this desktop.. so the only way to switch to it is to bind
# keys to flip to it.
    begin pager
# the corner of the pager to position... RELATIVE to the pager border though
      corner bottom_left
      location X 5
      location Y [ function ( get_size $ENL_LAST_ITEM height ) - 5 ]
      size X [ function ( get_size $ENL_LAST_ITEM width ) - 20
      size Y [ function ( get_size $ENL_LAST_ITEM height ) - 10 ]
    end
# moved the "root" sectio to here.. makes more sense.    
    begin root
# the image to bwe used.. note.. any shape color is ignored, and is assumed
# always to be "solid". only the normal image is used.
      image class DESK_BG_0
# same scheme as earlier wiht sizes...
      size X original
      size Y original
    end
  end
  ....
end

begin fx
# move shadow fx to a subsection of its own..... if it isnt given it is
# assumed off.
  begin shadow
    state on
# this is the location of the drop shadow relative from the window it is
# shadowing...
    location X 5
    location Y 5
# the shadow RGB color .. if not given assumed black (0 0 0)
    bg_color 0 0 0
  end
end

begin icons
  begin iconbox
    image class ICONBOX
    corner bottom_right
    size X original
    size Y original
    location X [ $ENL_SCREEN_WIDTH - 1 ]
    location Y [ $ENL_SCREEN_HEIGHT - 1 ]
    level below
    border X 5
    border Y 1
    scroll_speed 5
    snapshot_time 350
    orientation vertical
# new option... clip. for when the iconbox can be shaped... of on, the shape
# of the iconbox "clips" the icons.. so they are "cut out" when in
# "transparent" parts.. otherwise the cions will be superimposed ontop.
    clip on
# and the usual action identifiers........
    action none 1 drag
    action none 2 iconify
    action none 3 kill_nasty
    action shift 1 snapshot
    action shift 3 unsnapshot
  end
# moved the arrow definitions out here..... arrow1 = left/up, arrow2 =
# right/down
  begin arrow2
    image class ICONBOX_ARROW_DOWN
    corner bottom_left
    size X [ function ( get_size $ENL_LAST_ITEM width ) ]
    size Y original
    location X [ function ( get_co-ord $ENL_LAST_ITEM left ) ]
    location Y [ function ( get_co-ord $ENL_LAST_ITEM top ) - 1 ]
  end
  begin arrow1
    image class ICONBOX_ARROW_UP
    corner bottom_left
    size X [ function ( get_size $ENL_LAST_ITEM width ) ]
    size Y original
    location X [ function ( get_co-ord $ENL_LAST_ITEM left ) ]
    location Y [ function ( get_co-ord $ENL_LAST_ITEM top ) - 1 ]
  end
  begin predef
  end
end

begin infobox
  status on
# image stuff set per "item"  
  shift image class INFOBOX_SHIFT
  ctrl image class INFOBOX_CTRL
  alt image class INFOBOX_ALT
  meta1 image class INFOBOX_META1
  mouse1 image class INFOBOX_MOUSE1
  mouse2 image class INFOBOX_MOUSE2
  mouse3 image class INFOBOX_MOUSE3
# new size definitions.... per entry int he list....
  size X 400
  size Y 16
# also made the key and mosue sizes (only X can be defined)
  key size X 32
  mouse size X 16
  timeout 1500
end

# nothing chnaged heer except the modifiers are like earlier...
begin keybindings
  key alt Tab cycle next
  key alt+shift Tab cycle previous
  key shift Escape exit
  ....
end

begin status
  begin text
    image class STATUS_TEXT
    corner top_left
    size X [ $ENL_SCREEN_WIDTH - 64 ]
    size Y [ $ENL_SCREEN_HEIGHT / 4 ]
    location X 32
    location Y 32
  end
  begin text_box
    image class STATUS_TEXT_BOX
    corner top_left
    size X [ function ( get_size $ENL_LAST_ITEM width ) -10 ]
    size Y [ function ( get_size $ENL_LAST_ITEM height ) -10 ]
    location X 5
    location Y 5
  end
  begin icons
    image class STATUS_ICONS
    corner top_left
    size X [ $ENL_SCREEN_WIDTH - 64 ]
    size Y [ $ENL_SCREEN_HEIGHT / 8 ]
    location X 32
    location Y [ $ENL_SCREEN_HEIGHT / 4 + 32 + 32 ]
  end
  begin icons_box
    image class STATUS_ICONS_BOX
    corner top_left
    size X [ function ( get_size $ENL_LAST_ITEM width ) -10 ]
    size Y [ function ( get_size $ENL_LAST_ITEM height ) -10 ]
    location X 5
    location Y 5
  end
# same mods happend to % status......  
% status image class STATUS_1 Enlightenment DR 0.13  
# set the bg color of the root window.... R G B style....... :)
% color 0 0 0
end

begin text
  fontface helvetica
  style bold
# as before.. shadow, outline and plain.. will add a heap more hopefully.
  apperance outline
  justification center
  fg_color 255 255 255
  bg_color 128 128 128
# new colors.. will be used for new font rendering routines.... :)
# new outline color
  ou_color 0 0 0
# new hilite color
  hi_color 192 192 192
# new low-light color
  lo_color 64 64 64
# yes! deifne different font styles for different parts.. each in its own
# begin/end section.. if no section is guevn for that item.. it is assumed
# the above default is used......
  begin title
    fontface helvetica
    style bold
# as before.. shadow, outline and plain.. will add a heap more hopefully.
    apperance outline
    justification center
    fg_color 255 255 255
    bg_color 128 128 128
# new colors.. will be used for new font rendering routines.... :)
# new outline color
    ou_color 0 0 0
# new hilite color
    hi_color 192 192 192
# new low-light color
    lo_color 64 64 64
  end
  begin infobox
    ...
  end
  begin menu
    ...
  end
  begin status
    ...
  end
  ...
end

# new.. sets variables to a value.. (can be arithmetic expression in [ ]
# brackets aswell)

% set BORDER_TOP 25
% set EXAMPLE [ $BORDER_TOP / 7 + 3 ]

begin windows
  begin window
# now tyou NAME your border.. so u can specify whihc one to use for the styles
# later on.............
    name BORDER_DEFAULT
    shaped on
    begin border
      left 12
      right 4
      top $BORDER_TOP
      bottom 2
    end
    begin subwin
      name win_button_close
      type button
      image class WIN_CLOSE
      level above
      image scale_method scale
# new stuff.. $ENL_WIN_W, $ENL_WIN_H are the widht and height of the window
# including borders of the windows at all times.... there are limits on the
# complexity of these.. you cant use functions or other variables apart
# from the above.. to signify this.. it's in {} brackets instead... also any
# variable that equates to a constant at load time (when thsi config file is
# read by E) can be used.....
# { } expressions are evaluated on-the-fly....
      point 1 location X 0
      point 1 location Y 0
      point 1 location X { $ENL_WIN_W / 2 }
      point 1 location Y { $BORDER_TOP }
      action none 1 kill
      action none 2 kill_nasty
      action none 3 iconify
    end
  end
# borderless.. note.. no subwindows..    
  begin window
    name BORDER_NONE
    shaped off
    begin border
      left 0
      right 0
      top 0
      bottom 0
    end
# now % include actually works by just throwing that files contents in where
# you % include it.. so you can create files with "templates" for things
# like buttons and menus and just % inlcude themm... much more useful...

% include subwin3
% include subwin4
% include subwin5
% include subwin6
  end
end

# new styles section.......... 
# the FIRST style that matches will eb applied (so preference is in the
# order defined )
begin styles
# create a style section per border style you want..
  begin style
# a few styles availbale... recognised ones: shaped (for shaped windows like
# xeyes), transient windows (where the app sets the transient attributes)
    type shaped
    style BORDER_SHAPED
  end
  begin style
    type transient
    style BORDER_TRANSIENT
  end
# define borders based on window size (area in pixels) in the range from
# and to in pixels inclusive.
  begin style
    area from 0
    area to [ $ENL_SCREEN_WIDTH * $ENL_SCREEN_HEIGHT * 20 / 100 ]
    style BORDER_SMALL
  end
# yes.. use wildcards for titles!
  begin style
    title *netscape*
    style BORDER_NETSCAPE
  end
# woohoo! borderless windows! :) (well all matching the "*xload*" regexp)
  begin style
    title *xload*
    style BORDER_NONE
  end
# at an abolute minimum you have to fefine a type DEFAULT so that windows get
# a border at all!
  begin style
    type DEFAULT
    style BORDER_DEFAULT
  end
end

# user-level functions....
begin functions
  begin function
# function name
    name resize_to_size
# function parameters in order, wiht type (num or string) and their name
    param num WIDTH
    param num HEIGHT
    if  
      function ( win_resize $ENL_WINDOW $WIDTH $HEIGHT )
    end
  end
end

# more thought needed to go into the other conifg files & options.. i'm
# thinking / working on it to "convert" these to a newer more powerful format

# so what do ya think? add more ideas in here where u like..

