
local toolBar = FF.toolBar("main")
toolBar.iconSize = 32
toolBar:addButton("file_new")
toolBar:addButton("file_close") 
toolBar:addButton("file_open") 
toolBar:addButton("file_save") 
toolBar:addSeparator() 
toolBar:addButton("file_run") 
toolBar:addSeparator() 
toolBar:addButton("editor_def") 
toolBar:addButton("editor_spr") 
toolBar:addButton("editor_anim") 
toolBar:addButton("editor_cmd") 
toolBar:addButton("editor_st") 
toolBar:addButton("editor_snd") 
--toolBar:addButton("editor_bg") 
toolBar:addButton("ref_docs") 
toolBar:addSeparator() 
toolBar:addButton("tools_options") 

local panel = FF.panel("definitions")
local layout = FF.verticalLayout(panel)
layout.margin = 8
layout:addControl("def_tree")

panel = FF.panel("sprites") 
layout = FF.gridLayout(panel)
layout.margin = 8
layout.spacing = 4

layout:addControl("spr_sel", 0, 0, 1, -1):horizontal()
layout:addControl("spr_sel_lb", 1, 0, 1, -1):align(FF.Align.HCenter, FF.Align.VCenter) 

local layout2 = FF.gridLayout()
layout2.spacing = 4
layout2:addControl("spr_name_lb", 0, 0, 1, -1)
layout2:addControl("spr_name", 1, 0, 1, -1)
layout2:addControl("spr_grp_lb", 2, 0, 1, 2)
layout2:addControl("spr_grp", 3, 0, 1, 2)
layout2:addControl("spr_num_lb", 2, 2, 1, 2)
layout2:addControl("spr_num", 3, 2, 1, 2) 
layout2:addControl("spr_xaxis_lb", 4, 0, 1, 2)
layout2:addControl("spr_xaxis", 5, 0, 1, 2)
layout2:addControl("spr_yaxis_lb", 4, 2, 1, 2)
layout2:addControl("spr_yaxis", 5, 2, 1, 2) 
layout:addLayout(layout2, 2, 0, 1, -1)

layout:addControl("spr_dec_load", 3, 0, 1, -1) 
layout:addControl("spr_switch_pal", 4, 0, 1, -1) 
layout:addControl("spr_trans_color", 5, 0, 1, -1) 
layout:addControl("spr_info_lb", 6, 0, 1, -1):align(FF.Align.HCenter, FF.Align.VCenter) 
layout:addControl("spr_onion_skin", 7, 0, 1, -1) 
layout:addControl("spr_onion_sel", 8, 0, 1, -1):horizontal() 
layout:addControl("spr_onion_lb", 9, 0, 1, -1):align(FF.Align.HCenter, FF.Align.VCenter)

layout:addControl("spr_layers_menu", 2, 0):icon(22):flat() 
layout:addControl("spr_layers_blendmode", 2, 1, 1, 2)
layout:addControl("spr_layers_opacity", 2, 3)
layout:addControl("spr_layers_list", 3, 0, 9, 4)
layout:addControl("spr_tool_canvasmove", 2, 4):icon(22):flat() 
layout:addControl("spr_tool_selmove", 3, 4):icon(22):flat()
layout:addControl("spr_tool_rectsel", 4, 4):icon(22):flat()
layout:addControl("spr_tool_freesel", 5, 4):icon(22):flat()
layout:addControl("spr_tool_picker", 6, 4):icon(22):flat()
layout:addControl("spr_tool_pen", 7, 4):icon(22):flat()
layout:addControl("spr_tool_eraser", 8, 4):icon(22):flat()
layout:addControl("spr_tool_remap_pen", 9, 4):icon(22):flat()
layout:addControl("spr_tool_paintbucket", 10, 4):icon(22):flat()
layout:addControl("spr_foreground", 11, 4):size(26,26) 
layout:addControl("spr_background", 12, 4):size(26,26) 
layout:addControl("spr_tool_options", 12, 0, 1, 4)

layout:addVerticalSpacer(13, 0)

panel = FF.extraPanel("palettes") 
layout = FF.gridLayout(panel)
layout.margin = 8
layout.spacing = 6

layout:addControl("pal_sel", 0, 0, 1, -1):horizontal()
layout:addControl("pal_sel_lb", 1, 0, 1, -1):align(FF.Align.HCenter, FF.Align.VCenter) 
layout:addControl("pal_grp_lb", 2, 0)
layout:addControl("pal_grp", 3, 0)
layout:addControl("pal_num_lb", 2, 1)
layout:addControl("pal_num", 3, 1)
layout:addControl("pal_view", 4, 0, 1, -1) 
layout:addVerticalSpacer(5, 0)

panel = FF.panel("animations") 
layout = FF.gridLayout(panel)
layout.margin = 8
layout.spacing = 4

layout:addControl("anim_sel", 0, 0, 1, -1):horizontal()
layout:addControl("anim_sel_lb", 1, 0, 1, -1):align(FF.Align.HCenter, FF.Align.VCenter) 

layout2 = FF.gridLayout()
layout2.spacing = 4
layout2:addControl("anim_number_lb", 0, 0) 
layout2:addControl("anim_number", 1, 0) 
layout2:addControl("anim_name_lb", 0, 1, 1, 3) 
layout2:addControl("anim_name", 1, 1, 1, 3) 
layout:addLayout(layout2, 2, 0, 2, -1)

layout:addControl("anim_frame_lb", 4, 0, 1, -1):align(FF.Align.HCenter, FF.Align.VCenter) 
layout:addControl("anim_frame_sel", 5, 0, 1, -1):horizontal()
layout:addControl("anim_frame_sel_lb", 6, 0, 1, -1):align(FF.Align.HCenter, FF.Align.VCenter) 
layout:addControl("anim_frame_grp_lb", 7, 0, 1, 2) 
layout:addControl("anim_frame_grp", 8, 0, 1, 2)
layout:addControl("anim_frame_num_lb", 7, 2, 1, 2)  
layout:addControl("anim_frame_num", 8, 2, 1, 2) 
layout:addControl("anim_frame_xaxis_lb", 9, 0, 1, 2) 
layout:addControl("anim_frame_xaxis", 10, 0, 1, 2)  
layout:addControl("anim_frame_yaxis_lb", 9, 2, 1, 2) 
layout:addControl("anim_frame_yaxis", 10, 2, 1, 2)  
layout:addControl("anim_frame_time_lb", 11, 0, 1, 2) 
layout:addControl("anim_frame_time", 12, 0, 1, 2)  
layout:addControl("anim_frame_flip_lb", 11, 2, 1, 2) 
layout:addControl("anim_frame_flip", 12, 2, 1, 2)  
layout:addControl("anim_frame_trans_lb", 13, 0, 1, 2) 
layout:addControl("anim_frame_trans", 14, 0, 1, 2) 
layout:addControl("anim_frame_transsrc_lb", 13, 2) 
layout:addControl("anim_frame_transsrc", 14, 2) 
layout:addControl("anim_frame_transdst_lb", 13, 3) 
layout:addControl("anim_frame_transdst", 14, 3) 

layout2 = FF.gridLayout()
layout2.spacing = 4
layout2:addControl("anim_frame_xscale_lb", 0, 0) 
layout2:addControl("anim_frame_xscale", 1, 0) 
layout2:addControl("anim_frame_yscale_lb", 0, 1) 
layout2:addControl("anim_frame_yscale", 1, 1) 
layout2:addControl("anim_frame_angle_lb", 0, 2) 
layout2:addControl("anim_frame_angle", 1, 2) 
layout:addLayout(layout2, 15, 0, 1, -1)

layout:addControl("anim_frame_loop", 16, 0, 1, -1) 
layout:addControl("anim_frame_intp", 17, 0, 1, -1):align(FF.Align.HCenter, FF.Align.VCenter) 
layout:addControl("anim_frame_intp_blend", 18, 0, 1, 2) 
layout:addControl("anim_frame_intp_offset", 18, 2, 1, 2) 
layout:addControl("anim_frame_intp_scale", 19, 0, 1, 2) 
layout:addControl("anim_frame_intp_angle", 19, 2, 1, 2) 

layout:addVerticalSpacer(20, 0)

panel = FF.extraPanel("thumbnails") 
layout = FF.verticalLayout(panel)
layout.margin = 8
layout.spacing = 6
layout:addControl("thumb_grp_list") 
layout:addControl("thumb_view") 
layout:addControl("anim_onion_skin") 
layout:addControl("anim_onion_sel"):horizontal()
layout:addControl("anim_onion_framesel"):horizontal()
layout:addControl("anim_onion_lb"):align(FF.Align.HCenter, FF.Align.VCenter)

panel = FF.panel("commands") 
layout = FF.verticalLayout(panel)
layout.margin = 8
layout:addControl("cmd_tree") 

panel = FF.panel("states") 
layout = FF.verticalLayout(panel)
layout.margin = 8
layout.spacing = 4
layout:addControl("st_tree") 

panel = FF.panel("sounds") 
layout = FF.gridLayout(panel)
layout.margin = 8
layout.spacing = 4

layout:addControl("snd_sel", 1, 0, 1, -1):horizontal()
layout:addControl("snd_sel_lb", 2, 0, 1, -1):align(FF.Align.HCenter, FF.Align.VCenter)
layout:addControl("snd_grp_lb", 3, 0) 
layout:addControl("snd_grp", 4, 0) 
layout:addControl("snd_num_lb", 3, 1) 
layout:addControl("snd_num", 4, 1) 
layout:addControl("snd_info_lb", 5, 0, 1, -1) 
layout:addVerticalSpacer(6, 0)

panel = FF.extraPanel("organizer") 
layout = FF.verticalLayout(panel)
layout.margin = 8
layout.spacing = 6

layout2 = FF.gridLayout()
layout2:addControl("org_up", 0, 0):icon(22):flat()
layout2:addControl("org_down", 0, 1):icon(22):flat()
layout2:addControl("org_up_10", 0, 2):icon(22):flat()
layout2:addControl("org_down_10", 0, 3):icon(22):flat()
layout2:addControl("org_top", 0, 4):icon(22):flat()
layout2:addControl("org_bottom", 0, 5):icon(22):flat()
layout2:addControl("org_auto", 0, 6):icon(22):flat()
layout2:addControl("org_palette", 0, 7):icon(22):flat()
layout:addLayout(layout2, 0)

layout:addControl("org_list") 
