/* date = November 5th 2023 4:38 pm */

#ifndef VN_WORKSPACE_NAV_EDITOR_H
#define VN_WORKSPACE_NAV_EDITOR_H

#define W_STRING_CHUNK_SIZE 128

struct workspace_string_chunk
{
	workspace_string_chunk *Next;
	workspace_string_chunk *Prev;
	u8 Data[W_STRING_CHUNK_SIZE - 2*sizeof(workspace_string_chunk *)];
};

struct workspace_string_chunk_list
{
	workspace_string_chunk *First;
	workspace_string_chunk *Last;
};

struct scene_nav_item_node
{
	scene_nav_item_node *Next;
	scene_nav_item_node *Prev;
	
	workspace_string_chunk *HoverTextStringChunk;
	workspace_string_chunk *ActionStringChunk;
	scene_nav_item Item;
};

struct scene_nav_item_list
{
	scene_nav_item_node *First;
	scene_nav_item_node *Last;
	u64 Count;
};

struct workspace_view_nav_editor
{
	//- sixten: items
	scene_nav_item_list Items;
	scene_nav_item_node *FirstFree;
	scene_nav_item_node *LastFree;
	
	//- sixten: strings
	workspace_string_chunk_list FreeStrings;
	
	//- sixten: inspect info
	scene_nav_item_node *SelectedItem;
	b32 TextureDropdownOpen;
	b32 NavActionDropdownOpen;
	text_edit_state NavActionStringEditState;
	text_edit_state HoverTextEditState;
	s32 ActiveTextThing;
	
	//- sixten: file info
	string FileName;
	string FilePath;
};

static void W_NavEditorSerializeItems(workspace_view_nav_editor *Editor);

static scene_nav_item_node *W_SceneNavItemNodeAlloc(arena *Arena, workspace_view_nav_editor *Editor);
static void W_SceneNavItemNodeRelease(workspace_view_nav_editor *Editor, scene_nav_item_node *Node);

static void W_NavEditorInspectNode(scene_nav_item_node *Node);
static void W_NavEditorSetup(workspace_view *View, string FilePath, string FileName, string FileContents);
static void W_BuildNavEditor(workspace_view *View);

#endif //VN_WORKSPACE_NAV_EDITOR_H
