
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_load_backup") 
toolBar:addButton("file_backup") 
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") 

toolBar = FF.toolBar("extra")
toolBar.iconSize = 22
toolBar:addButton("editor_new") 
toolBar:addButton("editor_open") 
toolBar:addButton("editor_save") 
toolBar:addButton("editor_saveas") 
toolBar:addSeparator() 
toolBar:addButton("edit_undo") 
toolBar:addButton("edit_redo") 
toolBar:addSeparator() 
toolBar:addButton("edit_cut") 
toolBar:addButton("edit_copy") 
toolBar:addButton("edit_paste") 
toolBar:addSeparator() 
toolBar:addButton("edit_find_replace") 

toolBar = FF.toolBar("code")
toolBar:addButton("edit_find_replace_multi") 
toolBar:addSeparator() 
toolBar:addButton("code_goto") 
toolBar:addButton("code_prev_error") 
toolBar:addButton("code_next_error") 
toolBar:addButton("code_comment") 

toolBar = FF.toolBar("graphics")
toolBar:addSeparator() 
toolBar:addButton("view_organizer") 
--toolBar:addButton("view_issues") 
toolBar:addSeparator() 
toolBar:addButton("view_zoomreset") 
toolBar:addButton("view_zoomout") 
toolBar:addButton("view_zoomin") 
toolBar:addButton("view_center_origin") 
toolBar:addButton("view_guide_lines") 
toolBar:addButton("view_attack_box") 
toolBar:addButton("view_collision_box") 

toolBar = FF.toolBar("sound")
toolBar:addSeparator() 
toolBar:addButton("view_organizer") 
toolBar:addSeparator() 
toolBar:addButton("view_zoomreset") 
toolBar:addButton("view_zoomout") 
toolBar:addButton("view_zoomin") 

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

local layout2 = FF.horizontalLayout()
layout2:addControl("spr_add"):icon(22):flat()
layout2:addControl("spr_delete"):icon(22):flat()
layout2:addControl("spr_duplicate"):icon(22):flat() 
layout2:addControl("spr_delete_grp"):icon(22):flat()
layout2:addControl("spr_rename_grp"):icon(22):flat()
layout2:addControl("spr_saveimg"):icon(22):flat()
layout2:addControl("spr_openimg"):icon(22):flat()
layout2:addControl("spr_saveimgas"):icon(22):flat()
layout2:addControl("spr_edit_img"):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)
layout:addControl("spr_prev_grp", 6, 0):icon(22):flat()
layout:addControl("spr_grp_lb", 5, 1, 1, 3)
layout:addControl("spr_grp", 6, 1, 1, 3)
layout:addControl("spr_next_grp", 6, 4):icon(22):flat()
layout:addControl("spr_num_lb", 5, 5, 1, 3)
layout:addControl("spr_num", 6, 5, 1, 3) 
layout:addControl("spr_xaxis_lb", 7, 0, 1, 2)
layout:addControl("spr_xaxis", 7, 2, 1, 3) 
layout:addControl("spr_yaxis_lb", 8, 0, 1, 2)
layout:addControl("spr_yaxis", 8, 2, 1, 3) 
layout:addControl("spr_pos_left", 7, 5, 2, 1):icon(22):flat()
layout:addControl("spr_pos_up", 7, 6):icon(22):flat()
layout:addControl("spr_pos_right", 7, 7, 2, 1):icon(22):flat()
layout:addControl("spr_pos_down", 8, 6):icon(22):flat()

layout2 = FF.verticalLayout()
layout2.spacing = 4
layout2:addControl("spr_dec_load") 
layout2:addControl("spr_switch_pal") 
layout2:addControl("spr_trans_color") 
layout2:addControl("spr_info_lb"):align(FF.Align.HCenter, FF.Align.VCenter) 
layout2:addControl("spr_onion_skin") 
layout2:addControl("spr_onion_sel"):horizontal() 
layout2:addControl("spr_onion_lb"):align(FF.Align.HCenter, FF.Align.VCenter)
layout:addLayout(layout2, 9, 0, 1, -1) 

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

layout:addVerticalSpacer(14, 0)

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

layout2 = FF.gridLayout()
layout2:addControl("pal_add", 0, 0):icon(22):flat()
layout2:addControl("pal_delete", 0, 1):icon(22):flat()
layout2:addControl("pal_open", 0, 2):icon(22):flat()
layout2:addControl("pal_save", 0, 3):icon(22):flat()
layout2:addControl("pal_undo", 0, 4):icon(22):flat()
layout2:addControl("pal_redo", 0, 5):icon(22):flat() 

layout2:addControl("pal_switch_count", 1, 0):icon(22):flat()
layout2:addControl("pal_switch_color", 1, 1):icon(22):flat()
layout2:addControl("pal_pick_color", 1, 2):icon(22):flat()
layout2:addControl("pal_set_color", 1, 3):icon(22):flat()
layout2:addControl("pal_remap", 1, 4):icon(22):flat()
layout2:addControl("pal_apply_sprite", 1, 5):icon(22):flat()

layout2:addControl("tools_pal_editor", 0, 6, 2, 2):size(42,56):icon(32):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)
layout:addControl("pal_grp", 4, 0)
layout:addControl("pal_num_lb", 3, 1)
layout:addControl("pal_num", 4, 1)
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_add"):icon(22):flat()
layout2:addControl("anim_delete"):icon(22):flat()
layout2:addControl("anim_duplicate"):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()
layout2:addControl("anim_editcode"):icon(22):flat()
layout:addLayout(layout2, 0, 0, 1, -1)

layout:addControl("anim_sel", 1, 0, 1, -1):horizontal()
layout:addControl("anim_sel_lb", 2, 0, 1, -1):align(FF.Align.HCenter, FF.Align.VCenter) 
layout:addControl("anim_number_lb", 3, 0, 1, 3) 
layout:addControl("anim_number", 4, 0, 1, 3) 
layout:addControl("anim_name_lb", 3, 3, 1, 5) 
layout:addControl("anim_name", 4, 3, 1, 5) 

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

layout2 = FF.gridLayout()
layout2.margin = 0
layout2.spacing = 4
layout2:addControl("anim_frame_grp_lb", 0, 0):size(70, 16)
layout2:addControl("anim_frame_grp", 1, 0):size(70, 16)
layout2:addControl("anim_frame_num_lb", 0, 1):size(70, 16)
layout2:addControl("anim_frame_num", 1, 1):size(70, 16)
layout2:addControl("anim_frame_xaxis_lb", 2, 0):size(70, 16)
layout2:addControl("anim_frame_xaxis", 3, 0):size(70, 16) 
layout2:addControl("anim_frame_yaxis_lb", 2, 1):size(70, 16)
layout2:addControl("anim_frame_yaxis", 3, 1):size(70, 16) 
layout:addLayout(layout2, 8, 0, 3, 5)

layout:addControl("anim_pos_left", 8, 5, 2, 1):icon(22):flat()
layout:addControl("anim_pos_up", 8, 6):icon(22):flat()
layout:addControl("anim_pos_right", 8, 7, 2, 1):icon(22):flat()
layout:addControl("anim_pos_down", 9, 6):icon(22):flat()

layout:addControl("anim_frameall_offset", 10, 5):icon(22):flat()
layout:addControl("anim_frame_align", 10, 7):icon(22):flat()
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.gridLayout()
layout2.margin = 0
layout2.spacing = 4
layout2:addControl("anim_frame_xscale_lb", 0, 0, 1, 2) 
layout2:addControl("anim_frame_xscale", 1, 0, 1, 2) 
layout2:addControl("anim_frame_yscale_lb", 0, 2, 1, 2) 
layout2:addControl("anim_frame_yscale", 1, 2, 1, 2) 
layout2:addControl("anim_frameall_scale", 1, 4):icon(22):flat()
layout2:addControl("anim_frame_angle_lb", 0, 5, 1, 2) 
layout2:addControl("anim_frame_angle", 1, 5, 1, 2) 
layout:addLayout(layout2, 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, 4) 
layout:addControl("anim_frame_intp_offset", 18, 4, 1, 4) 
layout:addControl("anim_frame_intp_scale", 19, 0, 1, 4) 
layout:addControl("anim_frame_intp_angle", 19, 4, 1, 4) 

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_delall"):icon(22):flat()
layout2:addControl("anim_box_delall_anim"):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, 20, 0, 1, -1)

layout:addVerticalSpacer(21, 0)

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

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("commands") 
layout = FF.verticalLayout(panel)
layout.margin = 8
layout:addControl("cmd_tree") 

panel = FF.panel("states") 
layout = FF.gridLayout(panel)
layout.margin = 8
layout.spacing = 4
layout:addControl("st_palfx", 0, 0):icon(22):flat()
layout:addControl("st_offset", 0, 1):icon(22):flat()
layout:addControl("st_throw", 0, 2):icon(22):flat()
--layout:addControl("st_var_log", 0, 3):icon(22):flat()
--layout:addControl("st_var_list", 0, 4):icon(22):flat()

layout:addControl("st_tree", 1, 0, 1, 8) 

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

layout2 = FF.horizontalLayout()
layout2:addControl("snd_add"):icon(22):flat()
layout2:addControl("snd_delete"):icon(22):flat()
layout2:addControl("snd_duplicate"):icon(22):flat()
layout2:addControl("snd_open_sample"):icon(22):flat()
layout2:addControl("snd_save_sample"):icon(22):flat()
layout2:addControl("snd_play"):icon(22):flat()
layout2:addControl("snd_play_loop"):icon(22):flat()
layout2:addControl("snd_stop"):icon(22):flat()
layout:addLayout(layout2, 0, 0, 1, -1)

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_prev_grp", 4, 0):icon(22):flat()
layout:addControl("snd_grp_lb", 3, 1, 1, 3) 
layout:addControl("snd_grp", 4, 1, 1, 3) 
layout:addControl("snd_next_grp", 4, 4):icon(22):flat()
layout:addControl("snd_num_lb", 3, 5, 1, 3) 
layout:addControl("snd_num", 4, 5, 1, 3) 
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")
