
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:addButton("file_backup")
toolBar:addSeparator()
toolBar:addButton("editor_def")
toolBar:addButton("editor_spr")
toolBar:addButton("editor_anim")
toolBar:addButton("editor_st")
toolBar:addButton("editor_cmd")
toolBar:addButton("editor_snd")
toolBar:addButton("view_organizer")
toolBar:addSeparator()
toolBar:addButton("tools_pal_editor")
toolBar:addSeparator()
toolBar:addButton("tools_options")
toolBar:addButton("file_run")

toolBar = FF.toolBar("extra")
toolBar:addButton("view_calculator")
toolBar:addSeparator()
toolBar:addButton("view_zoomout")
toolBar:addButton("view_zoomin")
toolBar:addSeparator()
toolBar:addButton("spr_align_centerleft")
toolBar:addButton("spr_align_centercenter")
toolBar:addButton("spr_align_centerright")
toolBar:addButton("spr_align_topcenter")
toolBar:addButton("spr_align_bottomcenter")
toolBar:addButton("spr_align_topleft")
toolBar:addButton("spr_align_topright")
toolBar:addButton("spr_align_bottomleft")
toolBar:addButton("spr_align_bottomright")

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

local layout2 = FF.gridLayout()
layout2:addControl("def_new", 0, 0):icon(22):flat()
layout2:addControl("def_open", 0, 1):icon(22):flat()
layout2:addControl("def_save", 0, 2):icon(22):flat() 
layout2:addControl("def_saveas", 0, 3):icon(22):flat()
layout2:addControl("edit_cut", 0 ,4):icon(22):flat()
layout2:addControl("edit_copy", 0, 5):icon(22):flat()
layout2:addControl("edit_paste", 0, 6):icon(22):flat()
layout2:addControl("edit_find_replace", 1, 0):icon(22):flat()
layout2:addControl("edit_undo", 1, 1):icon(22):flat()
layout2:addControl("edit_redo", 1, 2):icon(22):flat()
layout:addLayout(layout2, 1)

layout:addControl("def_tree")

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

layout2 = FF.gridLayout()
layout2:addControl("spr_add", 0, 0):icon(22):flat()
layout2:addControl("spr_openimg", 0, 1):icon(22):flat()
layout2:addControl("spr_saveimgas", 0, 2):icon(22):flat() 
layout2:addControl("spr_save", 0, 3):icon(22):flat()
layout2:addControl("spr_duplicate", 0 ,4):icon(22):flat()
layout2:addControl("spr_delete", 0, 5):icon(22):flat()
layout2:addControl("spr_delete_grp", 0, 6):icon(22):flat()
layout2:addControl("edit_find_replace", 1, 0):icon(22):flat()
layout2:addControl("spr_crop", 1, 1):icon(22):flat()
layout2:addControl("spr_rename_grp", 1, 2):icon(22):flat()
layout2:addControl("spr_saveimg", 1, 2):icon(22):flat() 
layout2:addControl("spr_edit_img", 1, 3):icon(22):flat()
layout:addLayout(layout2, 0, 0, 1, -1)

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

layout:addControl("spr_name_lb", 3, 0, 1, -1)
layout:addControl("spr_name", 4, 0, 1, -1)

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

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

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

layout:addVerticalSpacer(14, 0)

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

layout2 = FF.gridLayout()
layout2:addControl("pal_add", 0, 0):icon(22):flat()
layout2:addControl("pal_open", 0, 1):icon(22):flat()
layout2:addControl("pal_save", 0, 2):icon(22):flat() 
layout2:addControl("pal_delete", 0, 3):icon(22):flat()
layout2:addControl("pal_switch_count", 0 ,4):icon(22):flat()
layout2:addControl("pal_remap", 0, 5):icon(22):flat()
layout2:addControl("pal_undo", 1, 0):icon(22):flat()
layout2:addControl("pal_redo", 1, 1):icon(22):flat()
layout2:addControl("pal_switch_color", 1, 2):icon(22):flat()
layout2:addControl("pal_pick_color", 1, 3):icon(22):flat()
layout2:addControl("pal_set_color", 1, 4):icon(22):flat()
layout2:addControl("pal_apply_sprite", 1, 5):icon(22):flat()
layout:addLayout(layout2, 0, 0, 1, -1)

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

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

layout2 = FF.horizontalLayout()
layout2:addControl("anim_new"):icon(22):flat()
layout2:addControl("anim_open"):icon(22):flat()
layout2:addControl("anim_save"):icon(22):flat()
layout2:addControl("anim_saveas"):icon(22):flat()
layout2:addControl("anim_code"):icon(22):flat()
layout2:addControl("anim_save_gif"):icon(22):flat()
layout2:addControl("anim_play"):icon(22):flat()
layout2:addControl("anim_stop"):icon(22):flat()
layout:addLayout(layout2, 0, 0, 1, -1)

layout:addControl("anim_delete", 1, 0):icon(22):flat()
layout:addControl("anim_sel", 1, 1, 1, 6):horizontal()
layout:addControl("anim_add", 1, 7):icon(22):flat()
layout:addControl("anim_sel_lb", 2, 0, 1, -1):align(FF.Align.HCenter, FF.Align.VCenter) 
layout:addControl("anim_name_lb", 3, 0, 1, 2)
layout:addControl("anim_name", 3, 2, 1, 6)
layout:addControl("anim_number_lb", 4, 0, 1, 2)
layout:addControl("anim_number", 4, 2, 1, 5)
layout:addControl("edit_find_replace", 4, 7)

layout:addControl("anim_frame_lb", 5, 0, 1, -1):align(FF.Align.HCenter, FF.Align.VCenter) 
layout:addControl("anim_frame_delete", 6, 0):icon(22):flat()
layout:addControl("anim_frame_sel", 6, 1, 1, 6):horizontal()
layout:addControl("anim_frame_add", 6, 7):icon(22):flat()
layout:addControl("anim_frame_sel_lb", 7, 0, 1, -1):align(FF.Align.HCenter, FF.Align.VCenter) 

layout:addControl("anim_frame_grp_lb", 8, 0, 1, 4)
layout:addControl("anim_frame_grp", 9, 0, 1, 4)
layout:addControl("anim_frame_num_lb", 8, 4, 1, 4)
layout:addControl("anim_frame_num", 9, 4, 1, 4) 
layout:addControl("anim_frame_xaxis_lb", 10, 0, 1, 2)
layout:addControl("anim_frame_xaxis", 10, 2, 1, 2) 
layout:addControl("anim_frame_yaxis_lb", 10, 4, 1, 2)
layout:addControl("anim_frame_yaxis", 10, 6, 1, 2) 

layout:addControl("anim_frame_time_lb", 11, 0, 1, 3) 
layout:addControl("anim_frame_time", 12, 0, 1, 3) 
layout:addControl("anim_frameall_time", 12, 3):icon(22):flat()
layout:addControl("anim_frame_flip_lb", 11, 4, 1, 3) 
layout:addControl("anim_frame_flip", 12, 4, 1, 3) 
layout:addControl("anim_frameall_flip", 12, 7):icon(22):flat()
layout:addControl("anim_frame_trans_lb", 13, 0, 1, 3) 
layout:addControl("anim_frame_trans", 14, 0, 1, 3) 
layout:addControl("anim_frame_transsrc_lb", 13, 3, 1, 2) 
layout:addControl("anim_frame_transsrc", 14, 3, 1, 2) 
layout:addControl("anim_frame_transdst_lb", 13, 5, 1, 2) 
layout:addControl("anim_frame_transdst", 14, 5, 1, 2) 
layout:addControl("anim_frameall_trans", 14, 7):icon(22):flat()
layout:addControl("anim_frame_loop", 15, 0, 1, -1) 

layout2 = FF.horizontalLayout()
layout2:addControl("anim_box_add_attack"):icon(22):flat()
layout2:addControl("anim_box_add_collision"):icon(22):flat()
layout2:addControl("anim_box_del"):icon(22):flat()
layout2:addControl("anim_box_prev"):icon(22):flat()
layout2:addControl("anim_box_type"):icon(22):flat()
layout2:addControl("anim_box_default"):icon(22):flat()
layout:addLayout(layout2, 16, 0, 1, -1)

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

layout:addControl("anim_frame_intp", 18, 0, 1, -1):align(FF.Align.HCenter, FF.Align.VCenter) 
layout:addControl("anim_frame_intp_blend", 19, 0, 1, 4) 
layout:addControl("anim_frame_intp_offset", 19, 4, 1, 4) 
layout:addControl("anim_frame_intp_scale", 20, 0, 1, 4) 
layout:addControl("anim_frame_intp_angle", 20, 4, 1, 4) 

layout:addVerticalSpacer(21, 0)

panel = FF.extraPanel("thumbnails") 
layout = FF.verticalLayout(panel)
layout.margin = 8
layout.spacing = 4

layout2 = FF.gridLayout()
layout2:addControl("thumb_grp_list", 0, 0, 1, 3) 
layout2:addControl("thumb_add", 0, 3):icon(22):flat()
layout2:addControl("thumb_add_all", 0, 4):icon(22):flat()
layout2:addControl("thumb_new", 0, 5):icon(22):flat()
layout2:addControl("thumb_new_all", 0, 6):icon(22):flat()
layout2:addControl("thumb_save", 0, 7):icon(22):flat()
layout:addLayout(layout2, 0)

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("states")
layout = FF.verticalLayout(panel)
layout.margin = 8

layout2 = FF.gridLayout()
layout2:addControl("st_new", 0, 0):icon(22):flat()
layout2:addControl("st_open", 0, 1):icon(22):flat()
layout2:addControl("st_save", 0, 2):icon(22):flat() 
layout2:addControl("st_saveas", 0, 3):icon(22):flat()
layout2:addControl("edit_cut", 0 ,4):icon(22):flat()
layout2:addControl("edit_copy", 0, 5):icon(22):flat()
layout2:addControl("edit_paste", 0, 6):icon(22):flat()
layout2:addControl("edit_find_replace", 1, 0):icon(22):flat()
layout2:addControl("edit_undo", 1, 1):icon(22):flat()
layout2:addControl("edit_redo", 1, 2):icon(22):flat()
layout2:addControl("st_palfx", 1, 3):icon(22):flat()
layout2:addControl("st_offset", 1, 4):icon(22):flat()
layout2:addControl("st_throw", 1, 5):icon(22):flat()
--layout2:addControl("st_var_log", 1, 6):icon(22):flat()
layout:addLayout(layout2, 1)

layout:addControl("st_tree")

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

layout2 = FF.gridLayout()
layout2:addControl("cmd_new", 0, 0):icon(22):flat()
layout2:addControl("cmd_open", 0, 1):icon(22):flat()
layout2:addControl("cmd_save", 0, 2):icon(22):flat() 
layout2:addControl("cmd_saveas", 0, 3):icon(22):flat()
layout2:addControl("edit_cut", 0 ,4):icon(22):flat()
layout2:addControl("edit_copy", 0, 5):icon(22):flat()
layout2:addControl("edit_paste", 0, 6):icon(22):flat()
layout2:addControl("edit_find_replace", 1, 0):icon(22):flat()
layout2:addControl("edit_undo", 1, 1):icon(22):flat()
layout2:addControl("edit_redo", 1, 2):icon(22):flat()
layout:addLayout(layout2, 1)

layout:addControl("cmd_tree")

panel = FF.panel("sounds")
layout = FF.verticalLayout(panel)
layout.margin = 8

layout2 = FF.gridLayout()
layout2:addControl("snd_new", 0, 0):icon(22):flat()
layout2:addControl("snd_open", 0, 1):icon(22):flat()
layout2:addControl("snd_save", 0, 2):icon(22):flat() 
layout2:addControl("snd_saveas", 0, 3):icon(22):flat()
layout2:addControl("snd_play", 0 ,4):icon(22):flat()
layout2:addControl("snd_play_loop", 0, 5):icon(22):flat()
layout2:addControl("snd_stop", 0, 6):icon(22):flat()
layout2:addControl("snd_add", 1, 0):icon(22):flat()
layout2:addControl("snd_open_sample", 1, 1):icon(22):flat()
layout2:addControl("snd_save_sample", 1, 2):icon(22):flat()
layout2:addControl("snd_duplicate", 1, 3):icon(22):flat()
layout2:addControl("snd_delete", 1, 4):icon(22):flat()
layout:addLayout(layout2, 1)

layout:addControl("snd_sel"):horizontal()
layout:addControl("snd_sel_lb"):align(FF.Align.HCenter, FF.Align.VCenter) 

layout2 = FF.gridLayout()
layout2.spacing = 4
layout2:addControl("snd_grp_lb", 0, 0)
layout2:addControl("snd_grp", 0, 1, 1, 3)
layout2:addControl("snd_num_lb", 1, 0)
layout2:addControl("snd_num", 1, 1, 1, 3) 
layout:addLayout(layout2, 1)

layout:addControl("snd_info_lb")
layout:addVerticalSpacer()

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") 
