2016-02-01 05:03:42 +00:00
|
|
|
/*
|
|
|
|
* Mr. 4th Dimention - Allen Webster
|
|
|
|
*
|
2016-05-06 15:34:08 +00:00
|
|
|
* 06.05.2016 (dd.mm.yyyy)
|
2016-02-01 05:03:42 +00:00
|
|
|
*
|
|
|
|
* Global app level settings definition
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
// TOP
|
|
|
|
|
2018-03-24 21:43:57 +00:00
|
|
|
#if !defined(FRED_APP_MODELS_H)
|
|
|
|
#define FRED_APP_MODELS_H
|
|
|
|
|
2016-02-01 05:03:42 +00:00
|
|
|
struct App_Settings{
|
|
|
|
char *init_files[8];
|
|
|
|
i32 init_files_count;
|
|
|
|
i32 init_files_max;
|
2017-01-30 18:41:08 +00:00
|
|
|
|
2017-06-23 23:07:18 +00:00
|
|
|
char **custom_flags;
|
|
|
|
i32 custom_flags_count;
|
|
|
|
|
2016-02-01 05:03:42 +00:00
|
|
|
i32 initial_line;
|
|
|
|
b32 lctrl_lalt_is_altgr;
|
2016-03-21 22:27:27 +00:00
|
|
|
|
2017-11-20 23:31:57 +00:00
|
|
|
i32 font_size;
|
|
|
|
b32 use_hinting;
|
2016-02-01 05:03:42 +00:00
|
|
|
};
|
|
|
|
|
2019-08-13 00:57:25 +00:00
|
|
|
enum App_State{
|
|
|
|
APP_STATE_EDIT,
|
|
|
|
APP_STATE_RESIZING,
|
|
|
|
// never below this
|
|
|
|
APP_STATE_COUNT
|
|
|
|
};
|
|
|
|
|
2019-11-07 01:36:30 +00:00
|
|
|
struct Model_View_Command_Function{
|
|
|
|
Model_View_Command_Function *next;
|
|
|
|
Custom_Command_Function *custom_func;
|
|
|
|
View_ID view_id;
|
|
|
|
};
|
|
|
|
|
2019-11-22 22:09:52 +00:00
|
|
|
struct Model_Input_Event_Node{
|
|
|
|
Model_Input_Event_Node *next;
|
|
|
|
Input_Event event;
|
|
|
|
};
|
|
|
|
|
2016-03-07 05:13:20 +00:00
|
|
|
struct Models{
|
2019-10-22 04:10:29 +00:00
|
|
|
Arena arena_;
|
2019-10-01 02:06:21 +00:00
|
|
|
Arena *arena;
|
|
|
|
Heap heap;
|
2019-03-29 21:21:50 +00:00
|
|
|
|
2016-03-04 01:41:52 +00:00
|
|
|
App_Settings settings;
|
2019-08-13 00:57:25 +00:00
|
|
|
App_State state;
|
2016-03-04 01:41:52 +00:00
|
|
|
|
2019-09-02 21:32:52 +00:00
|
|
|
Face_ID global_face_id;
|
2017-03-11 18:35:12 +00:00
|
|
|
|
2019-08-04 05:36:13 +00:00
|
|
|
Coroutine_Group coroutines;
|
2016-03-04 01:41:52 +00:00
|
|
|
|
2019-03-21 03:18:08 +00:00
|
|
|
Child_Process_Container child_processes;
|
2016-09-09 13:04:51 +00:00
|
|
|
Custom_API config_api;
|
|
|
|
|
2019-11-05 06:25:19 +00:00
|
|
|
Tick_Function *tick;
|
2019-10-15 03:26:00 +00:00
|
|
|
Render_Caller_Function *render_caller;
|
|
|
|
Delta_Rule_Function *delta_rule;
|
|
|
|
umem delta_rule_memory_size;
|
|
|
|
|
2019-10-10 22:57:02 +00:00
|
|
|
Hook_Function *buffer_viewer_update;
|
2019-10-13 20:17:22 +00:00
|
|
|
Custom_Command_Function *view_event_handler;
|
2017-11-30 23:25:49 +00:00
|
|
|
Buffer_Name_Resolver_Function *buffer_name_resolver;
|
2019-10-14 22:57:47 +00:00
|
|
|
Buffer_Hook_Function *begin_buffer;
|
|
|
|
Buffer_Hook_Function *end_buffer;
|
|
|
|
Buffer_Hook_Function *new_file;
|
|
|
|
Buffer_Hook_Function *save_file;
|
|
|
|
Buffer_Edit_Range_Function *buffer_edit_range;
|
|
|
|
Buffer_Region_Function *buffer_region;
|
2019-10-29 04:27:20 +00:00
|
|
|
Layout_Function *layout_func;
|
2016-09-09 13:04:51 +00:00
|
|
|
|
2019-02-25 23:42:13 +00:00
|
|
|
Color_Table fallback_color_table;
|
|
|
|
Color_Table color_table;
|
2016-03-04 01:41:52 +00:00
|
|
|
|
2019-11-07 01:36:30 +00:00
|
|
|
Model_View_Command_Function *free_view_cmd_funcs;
|
|
|
|
Model_View_Command_Function *first_view_cmd_func;
|
|
|
|
Model_View_Command_Function *last_view_cmd_func;
|
|
|
|
|
2019-11-22 22:09:52 +00:00
|
|
|
Arena *virtual_event_arena;
|
|
|
|
Model_Input_Event_Node *free_virtual_event;
|
|
|
|
Model_Input_Event_Node *first_virtual_event;
|
|
|
|
Model_Input_Event_Node *last_virtual_event;
|
|
|
|
|
2019-02-05 09:13:38 +00:00
|
|
|
Layout layout;
|
2016-03-04 01:41:52 +00:00
|
|
|
Working_Set working_set;
|
2019-10-25 23:33:50 +00:00
|
|
|
Live_Views view_set;
|
2019-02-08 10:03:48 +00:00
|
|
|
Global_History global_history;
|
2019-04-01 00:36:09 +00:00
|
|
|
Text_Layout_Container text_layouts;
|
2019-07-24 07:41:40 +00:00
|
|
|
Font_Set font_set;
|
2017-05-19 23:55:50 +00:00
|
|
|
|
2019-09-04 05:31:35 +00:00
|
|
|
Managed_ID_Set managed_id_set;
|
2018-08-18 08:16:52 +00:00
|
|
|
Dynamic_Workspace dynamic_workspace;
|
2018-08-12 03:45:09 +00:00
|
|
|
Lifetime_Allocator lifetime_allocator;
|
2018-06-23 03:03:58 +00:00
|
|
|
|
2016-03-20 21:51:58 +00:00
|
|
|
Editing_File *message_buffer;
|
2016-06-29 17:45:26 +00:00
|
|
|
Editing_File *scratch_buffer;
|
2019-08-16 02:54:06 +00:00
|
|
|
Editing_File *log_buffer;
|
2019-11-22 22:09:52 +00:00
|
|
|
Editing_File *keyboard_buffer;
|
2016-05-19 18:01:36 +00:00
|
|
|
|
2016-03-04 01:41:52 +00:00
|
|
|
Hot_Directory hot_directory;
|
2016-05-19 18:01:36 +00:00
|
|
|
|
2016-05-29 21:34:52 +00:00
|
|
|
b32 keep_playing;
|
2016-06-07 16:26:11 +00:00
|
|
|
|
2017-11-30 19:02:37 +00:00
|
|
|
b32 has_new_title;
|
|
|
|
char *title_space;
|
|
|
|
i32 title_capacity;
|
2018-03-10 02:06:55 +00:00
|
|
|
|
2019-03-30 21:51:56 +00:00
|
|
|
Panel *resizing_intermediate_panel;
|
|
|
|
|
|
|
|
Plat_Handle period_wakeup_timer;
|
2019-02-25 23:42:13 +00:00
|
|
|
i32 frame_counter;
|
2019-03-30 21:51:56 +00:00
|
|
|
u32 next_animate_delay;
|
2019-02-25 23:42:13 +00:00
|
|
|
b32 animate_next_frame;
|
|
|
|
|
2019-10-26 20:48:50 +00:00
|
|
|
Profile_Global_List profile_list;
|
|
|
|
|
2019-02-25 23:42:13 +00:00
|
|
|
// Last frame state
|
|
|
|
Vec2_i32 prev_p;
|
|
|
|
Panel *prev_mouse_panel;
|
|
|
|
b32 animated_last_frame;
|
|
|
|
u64 last_render_usecond_stamp;
|
|
|
|
|
2018-11-18 19:47:28 +00:00
|
|
|
// Event Context
|
2018-11-20 04:18:57 +00:00
|
|
|
Application_Step_Input *input;
|
2019-10-14 22:57:47 +00:00
|
|
|
i64 current_input_sequence_number;
|
|
|
|
User_Input current_input;
|
|
|
|
b8 current_input_unhandled;
|
2018-11-18 19:47:28 +00:00
|
|
|
|
2019-10-10 20:15:47 +00:00
|
|
|
b8 in_render_mode;
|
2018-11-18 19:47:28 +00:00
|
|
|
Render_Target *target;
|
2016-03-04 01:41:52 +00:00
|
|
|
};
|
|
|
|
|
2018-03-24 21:43:57 +00:00
|
|
|
////////////////////////////////
|
|
|
|
|
2018-08-26 09:55:12 +00:00
|
|
|
typedef i32 Dynamic_Workspace_Type;
|
|
|
|
enum{
|
|
|
|
DynamicWorkspace_Global = 0,
|
2018-09-26 18:06:57 +00:00
|
|
|
DynamicWorkspace_Unassociated = 1,
|
|
|
|
DynamicWorkspace_Buffer = 2,
|
|
|
|
DynamicWorkspace_View = 3,
|
|
|
|
DynamicWorkspace_Intersected = 4,
|
2018-08-26 09:55:12 +00:00
|
|
|
};
|
|
|
|
|
2018-03-24 21:43:57 +00:00
|
|
|
enum Input_Types{
|
|
|
|
Input_AnyKey,
|
|
|
|
Input_Esc,
|
|
|
|
Input_MouseMove,
|
|
|
|
Input_MouseLeftButton,
|
|
|
|
Input_MouseRightButton,
|
|
|
|
Input_MouseWheel,
|
|
|
|
Input_Count
|
|
|
|
};
|
|
|
|
|
|
|
|
struct Consumption_Record{
|
|
|
|
b32 consumed;
|
|
|
|
char consumer[32];
|
|
|
|
};
|
|
|
|
|
|
|
|
struct File_Init{
|
2019-06-01 23:58:28 +00:00
|
|
|
String_Const_u8 name;
|
2018-03-24 21:43:57 +00:00
|
|
|
Editing_File **ptr;
|
|
|
|
b32 read_only;
|
|
|
|
};
|
2016-05-06 15:34:08 +00:00
|
|
|
|
2018-03-24 21:43:57 +00:00
|
|
|
enum Command_Line_Action{
|
|
|
|
CLAct_Nothing,
|
|
|
|
CLAct_Ignore,
|
|
|
|
CLAct_UserFile,
|
|
|
|
CLAct_CustomDLL,
|
|
|
|
CLAct_InitialFilePosition,
|
|
|
|
CLAct_WindowSize,
|
|
|
|
CLAct_WindowMaximize,
|
|
|
|
CLAct_WindowPosition,
|
|
|
|
CLAct_WindowFullscreen,
|
|
|
|
CLAct_FontSize,
|
|
|
|
CLAct_FontUseHinting,
|
|
|
|
//
|
|
|
|
CLAct_COUNT,
|
|
|
|
};
|
|
|
|
|
|
|
|
enum Command_Line_Mode{
|
|
|
|
CLMode_App,
|
|
|
|
CLMode_Custom
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
// BOTTOM
|
2016-05-06 15:34:08 +00:00
|
|
|
|