Implementing every 4coder list in the new UI system.

master
Allen Webster 2018-08-03 19:41:38 -07:00
parent 468a7a33bc
commit 3d70957efd
26 changed files with 1683 additions and 880 deletions

View File

@ -180,14 +180,17 @@ ENUM(int32_t, View_Setting_ID){
/* DOC(ViewSetting_Null is not a valid setting, it is reserved to detect errors.) */
ViewSetting_Null,
/* DOC(The ViewSetting_ShowWhitespace setting determines whether the view highlights whitespace in a file. Whenever the view switches to a new buffer this setting is turned off.) */
/* DOC(Determines whether the view highlights whitespace in a file. Whenever the view switches to a new buffer this setting is turned off.) */
ViewSetting_ShowWhitespace,
/* DOC(The ViewSetting_ShowScrollbar setting determines whether a scroll bar is attached to a view in it's scrollable section.) */
/* DOC(Determines whether a scroll bar is attached to a view in it's scrollable section.) */
ViewSetting_ShowScrollbar,
/* DOC(The ViewSetting_ShowFileBar settings determines whether to show the file bar.) */
/* DOC(Determines whether to show the file bar.) */
ViewSetting_ShowFileBar,
/* DOC(Determines what command map the view uses when it is in ui mode.) */
ViewSetting_UICommandMap
};
/* DOC(A Buffer_Create_Flag field specifies how a buffer should be created.) */
@ -340,7 +343,9 @@ TYPEDEF uint32_t Key_Code;
DOC_SEE(Key_Modifier_Flag) */
TYPEDEF uint8_t Key_Modifier;
/* DOC(Key_Event_Data describes a key event, including the translation to a character, the translation to a character ignoring the state of caps lock, and an array of all the modifiers that were pressed at the time of the event.) */
/* DOC(Key_Event_Data describes a key event, including the translation to a character, the translation to a character ignoring the state of caps lock, and an array of all the modifiers that were pressed at the time of the event.)
DOC_SEE(Key_Modifier_Index)
*/
STRUCT Key_Event_Data{
/* DOC(This field is the raw keycode which is always non-zero in valid key events.) */
Key_Code keycode;
@ -701,24 +706,34 @@ STRUCT Event_Message{
int32_t type;
};
ENUM(int32_t, UI_Item_Type){
ENUM(int16_t, UI_Item_Type){
UIType_Option,
UIType_TextField,
};
ENUM(int32_t, UI_Activation_Level){
ENUM(int8_t, UI_Activation_Level){
UIActivation_None,
UIActivation_Hover,
UIActivation_Active,
};
ENUM(int8_t, UI_Coordinate_System){
UICoordinates_Scrolled,
UICoordinates_ViewRelative,
UICoordinates_COUNT,
};
STRUCT UI_Item{
UI_Item_Type type;
String query;
String string;
String status;
void *user_data;
UI_Activation_Level activation_level;
UI_Coordinate_System coordinates;
// 32-bits of padding to fill here
union{
String query;
String status;
};
String string;
void *user_data;
i32_Rect rectangle;
};
@ -737,8 +752,7 @@ STRUCT UI_List{
STRUCT UI_Control{
UI_Item *items;
int32_t count;
i32_Rect bounding_box;
i32_Rect bounding_box[UICoordinates_COUNT];
};
/*
@ -856,6 +870,8 @@ UNION Generic_Command{
DOC(User_Input describes a user input event which can be either a key press or mouse event.)
DOC_SEE(User_Input_Type_ID)
DOC_SEE(Generic_Command)
DOC_SEE(Key_Event_Data)
DOC_SEE(Mouse_State)
*/
STRUCT User_Input{
/* DOC(This field specifies whether the event was a key press or mouse event.) */

View File

@ -1,6 +1,6 @@
#define MAJOR 4
#define MINOR 0
#define PATCH 28
#define PATCH 29
// string
#define VN__(a,b,c) #a "." #b "." #c

View File

@ -1441,36 +1441,6 @@ CUSTOM_DOC("Advances forewards through the undo history.")
exec_command(app, cmdid_redo);
}
CUSTOM_COMMAND_SIG(interactive_new)
CUSTOM_DOC("Interactively creates a new file.")
{
exec_command(app, cmdid_interactive_new);
}
CUSTOM_COMMAND_SIG(interactive_open)
CUSTOM_DOC("Interactively opens a file.")
{
exec_command(app, cmdid_interactive_open);
}
CUSTOM_COMMAND_SIG(interactive_open_or_new)
CUSTOM_DOC("Interactively opens or creates a new file.")
{
exec_command(app, cmdid_interactive_open_or_new);
}
CUSTOM_COMMAND_SIG(interactive_switch_buffer)
CUSTOM_DOC("Interactively switch to an open buffer.")
{
exec_command(app, cmdid_interactive_switch_buffer);
}
CUSTOM_COMMAND_SIG(interactive_kill_buffer)
CUSTOM_DOC("Interactively kill an open buffer.")
{
exec_command(app, cmdid_interactive_kill_buffer);
}
CUSTOM_COMMAND_SIG(reopen)
CUSTOM_DOC("Reopen the current buffer from the hard drive.")
{
@ -1497,214 +1467,6 @@ CUSTOM_DOC("Opens the 4coder colors and fonts selector menu.")
////////////////////////////////
CUSTOM_COMMAND_SIG(interactive_switch_buffer_DUMMY_API_EXPLORATION)
CUSTOM_DOC("Interactively switch to an open buffer.")
{
Partition *scratch = &global_part;
View_Summary view = get_active_view(app, AccessAll);
view_start_ui_mode(app, &view);
int32_t x0 = 0;
int32_t x1 = view.view_region.x1 - view.view_region.x0;
int32_t line_height = (int32_t)view.line_height;
int32_t block_height = line_height*2;
int32_t hot_buffer_id = 0;
int32_t item_index = 0;
Temp_Memory temp = begin_temp_memory(scratch);
String text_field = push_string(scratch, 256);
for(;;){
Temp_Memory full_temp = begin_temp_memory(scratch);
refresh_view(app, &view);
Mouse_State mouse_state = get_mouse_state(app);
int32_t mx = mouse_state.x - view.file_region.x0 + (int32_t)view.scroll_vars.scroll_x;
int32_t my = mouse_state.y - view.file_region.y0 + (int32_t)view.scroll_vars.scroll_y;
int32_t y_pos = line_height;
UI_List list = {0};
int32_t item_index_counter = 0;
UI_Item *highlighted_item = 0;
UI_Item *hot_item = 0;
UI_Item *hovered_item = 0;
int32_t option_item_count = 0;
for (Buffer_Summary buffer = get_buffer_first(app, AccessAll);
buffer.exists;
get_buffer_next(app, &buffer, AccessAll)){
String buffer_name = make_string(buffer.buffer_name, buffer.buffer_name_len);
if (text_field.size == 0 || has_substr(buffer_name, text_field)){
i32_Rect item_rect = {0};
item_rect.x0 = x0;
item_rect.y0 = y_pos;
item_rect.x1 = x1;
item_rect.y1 = y_pos + block_height;
y_pos = item_rect.y1;
UI_Item item = {0};
item.type = UIType_Option;
item.string = push_string_copy(scratch, buffer_name);
char *status = "";
switch (buffer.dirty){
case DirtyState_UnsavedChanges: status = " *"; break;
case DirtyState_UnloadedChanges: status = " !"; break;
}
item.status = push_string_copy(scratch, status);
item.user_data = (void*)buffer.buffer_id;
item.activation_level = UIActivation_None;
item.rectangle = item_rect;
UI_Item *item_ptr = ui_list_add_item(scratch, &list, item);
option_item_count += 1;
if (item_rect.x0 <= mx && mx < item_rect.x1 &&
item_rect.y0 <= my && my < item_rect.y1){
hovered_item = item_ptr;
}
if (item_index_counter == item_index){
highlighted_item = item_ptr;
}
item_index_counter += 1;
if (buffer.buffer_id == hot_buffer_id){
hot_item = item_ptr;
}
}
}
if (hovered_item != 0){
hovered_item->activation_level = UIActivation_Hover;
}
if (hot_item != 0){
if (hot_item == hovered_item){
hot_item->activation_level = UIActivation_Active;
}
else{
hot_item->activation_level = UIActivation_Hover;
}
}
if (highlighted_item != 0){
highlighted_item->activation_level = UIActivation_Active;
}
{
i32_Rect item_rect = {0};
item_rect.x0 = x0;
item_rect.y0 = 0;
item_rect.x1 = x1;
item_rect.y1 = line_height;
y_pos = item_rect.y1;
UI_Item item = {0};
item.type = UIType_TextField;
item.query = push_string_copy(scratch, "Switch: ");
item.string = text_field;
item.activation_level = UIActivation_Active;
item.user_data = 0;
item.rectangle = item_rect;
ui_list_add_item(scratch, &list, item);
}
UI_Control control = ui_list_to_ui_control(scratch, &list);
view_set_ui(app, &view, &control);
for (;;){
bool32 needs_full_update = false;
User_Input in = get_user_input(app, EventAll, EventOnEsc);
if (in.abort){
goto done;
}
UI_Item *activated_item = 0;
switch (in.type){
case UserInputKey:
{
if (in.key.keycode == '\n' || in.key.keycode == '\t'){
activated_item = highlighted_item;
}
else if (in.key.keycode == key_back){
backspace_utf8(&text_field);
needs_full_update = true;
item_index = 0;
}
else if (in.key.keycode == key_up || in.key.keycode == key_page_up){
item_index = item_index - 1;
if (item_index < 0){
item_index = 0;
}
needs_full_update = true;
}
else if (in.key.keycode == key_down || in.key.keycode == key_page_down){
item_index = item_index + 1;
if (item_index > option_item_count - 1){
item_index = option_item_count - 1;
}
needs_full_update = true;
}
else{
uint8_t character[4];
uint32_t length = to_writable_character(in, character);
if (length > 0){
append(&text_field, make_string(character, length));
needs_full_update = true;
item_index = 0;
}
}
}break;
case UserInputMouse:
{
if (in.mouse.wheel != 0){
GUI_Scroll_Vars scroll = view.scroll_vars;
scroll.target_y += in.mouse.wheel;
view_set_scroll(app, &view, scroll);
}
if (in.mouse.press_l || in.mouse.release_l){
int32_t mx = in.mouse.x - view.file_region.x0;
int32_t my = in.mouse.y - view.file_region.y0;
UI_Item *clicked = ui_control_get_mouse_hit(&control, mx, my);
if (in.mouse.press_l){
if (clicked != 0){
hot_buffer_id = (int32_t)clicked->user_data;
}
}
if (in.mouse.release_l){
if (clicked != 0){
if (hot_buffer_id == (int32_t)clicked->user_data){
activated_item = clicked;
}
}
hot_buffer_id = 0;
}
needs_full_update = true;
}
if (mx != in.mouse.x || my != in.mouse.y){
needs_full_update = true;
}
}break;
}
if (activated_item != 0){
int32_t buffer_id = (int32_t)activated_item->user_data;
view_set_buffer(app, &view, buffer_id, 0);
goto done;
}
if (needs_full_update){
goto full_update;
}
}
full_update:;
end_temp_memory(full_temp);
}
done:;
view_end_ui_mode(app, &view);
end_temp_memory(temp);
}
////////////////////////////////
CUSTOM_COMMAND_SIG(open_in_other)
CUSTOM_DOC("Interactively opens a file in the other panel.")
{

View File

@ -9,6 +9,7 @@
enum Default_Maps{
default_code_map,
default_lister_ui_map,
default_maps_count,
};

View File

@ -274,11 +274,15 @@ OPEN_FILE_HOOK_SIG(default_file_settings){
}
int32_t map_id = (treat_as_code)?((int32_t)default_code_map):((int32_t)mapid_file);
int32_t map_id_query = 0;
buffer_set_setting(app, &buffer, BufferSetting_MapID, default_lister_ui_map);
buffer_get_setting(app, &buffer, BufferSetting_MapID, &map_id_query);
Assert(map_id_query == default_lister_ui_map);
buffer_set_setting(app, &buffer, BufferSetting_WrapPosition, global_config.default_wrap_width);
buffer_set_setting(app, &buffer, BufferSetting_MinimumBaseWrapPosition, global_config.default_min_base_width);
buffer_set_setting(app, &buffer, BufferSetting_MapID, map_id);
int32_t map_id_query = 0;
buffer_get_setting(app, &buffer, BufferSetting_MapID, &map_id_query);
Assert(map_id_query == map_id);
buffer_set_setting(app, &buffer, BufferSetting_ParserContext, parse_context_id);

View File

@ -22,6 +22,7 @@
#include "4coder_lib/4coder_utf8.h"
#include "4coder_lib/4cpp_lexer.h"
#include "4coder_ui_helper.h"
#include "4coder_helper.h"
#include "4coder_default_framework.h"
#include "4coder_config.h"
@ -37,13 +38,14 @@
#include "4coder_default_framework_variables.cpp"
#include "4coder_buffer_seek_constructors.cpp"
#include "4coder_ui_helper.cpp"
#include "4coder_helper.cpp"
#include "4coder_ui_helper.cpp"
#include "4coder_font_helper.cpp"
#include "4coder_config.cpp"
#include "4coder_default_framework.cpp"
#include "4coder_seek.cpp"
#include "4coder_base_commands.cpp"
#include "4coder_lists.cpp"
#include "4coder_auto_indent.cpp"
#include "4coder_search.cpp"
#include "4coder_jumping.cpp"

View File

@ -55,6 +55,7 @@ struct Application_Links;
#define VIEW_START_UI_MODE_SIG(n) int32_t n(Application_Links *app, View_Summary *view)
#define VIEW_END_UI_MODE_SIG(n) int32_t n(Application_Links *app, View_Summary *view)
#define VIEW_SET_UI_SIG(n) bool32 n(Application_Links *app, View_Summary *view, UI_Control *control)
#define VIEW_GET_UI_COPY_SIG(n) UI_Control n(Application_Links *app, View_Summary *view, struct Partition *part)
#define GET_USER_INPUT_SIG(n) User_Input n(Application_Links *app, Input_Type_Flag get_type, Input_Type_Flag abort_type)
#define GET_COMMAND_INPUT_SIG(n) User_Input n(Application_Links *app)
#define GET_MOUSE_STATE_SIG(n) Mouse_State n(Application_Links *app)
@ -147,6 +148,7 @@ typedef VIEW_GET_VARIABLE_SIG(View_Get_Variable_Function);
typedef VIEW_START_UI_MODE_SIG(View_Start_UI_Mode_Function);
typedef VIEW_END_UI_MODE_SIG(View_End_UI_Mode_Function);
typedef VIEW_SET_UI_SIG(View_Set_UI_Function);
typedef VIEW_GET_UI_COPY_SIG(View_Get_UI_Copy_Function);
typedef GET_USER_INPUT_SIG(Get_User_Input_Function);
typedef GET_COMMAND_INPUT_SIG(Get_Command_Input_Function);
typedef GET_MOUSE_STATE_SIG(Get_Mouse_State_Function);
@ -241,6 +243,7 @@ View_Get_Variable_Function *view_get_variable;
View_Start_UI_Mode_Function *view_start_ui_mode;
View_End_UI_Mode_Function *view_end_ui_mode;
View_Set_UI_Function *view_set_ui;
View_Get_UI_Copy_Function *view_get_ui_copy;
Get_User_Input_Function *get_user_input;
Get_Command_Input_Function *get_command_input;
Get_Mouse_State_Function *get_mouse_state;
@ -334,6 +337,7 @@ View_Get_Variable_Function *view_get_variable_;
View_Start_UI_Mode_Function *view_start_ui_mode_;
View_End_UI_Mode_Function *view_end_ui_mode_;
View_Set_UI_Function *view_set_ui_;
View_Get_UI_Copy_Function *view_get_ui_copy_;
Get_User_Input_Function *get_user_input_;
Get_Command_Input_Function *get_command_input_;
Get_Mouse_State_Function *get_mouse_state_;
@ -435,6 +439,7 @@ app_links->view_get_variable_ = View_Get_Variable;\
app_links->view_start_ui_mode_ = View_Start_UI_Mode;\
app_links->view_end_ui_mode_ = View_End_UI_Mode;\
app_links->view_set_ui_ = View_Set_UI;\
app_links->view_get_ui_copy_ = View_Get_UI_Copy;\
app_links->get_user_input_ = Get_User_Input;\
app_links->get_command_input_ = Get_Command_Input;\
app_links->get_mouse_state_ = Get_Mouse_State;\
@ -528,6 +533,7 @@ static inline bool32 view_get_variable(Application_Links *app, View_Summary *vie
static inline int32_t view_start_ui_mode(Application_Links *app, View_Summary *view){return(app->view_start_ui_mode(app, view));}
static inline int32_t view_end_ui_mode(Application_Links *app, View_Summary *view){return(app->view_end_ui_mode(app, view));}
static inline bool32 view_set_ui(Application_Links *app, View_Summary *view, UI_Control *control){return(app->view_set_ui(app, view, control));}
static inline UI_Control view_get_ui_copy(Application_Links *app, View_Summary *view, struct Partition *part){return(app->view_get_ui_copy(app, view, part));}
static inline User_Input get_user_input(Application_Links *app, Input_Type_Flag get_type, Input_Type_Flag abort_type){return(app->get_user_input(app, get_type, abort_type));}
static inline User_Input get_command_input(Application_Links *app){return(app->get_command_input(app));}
static inline Mouse_State get_mouse_state(Application_Links *app){return(app->get_mouse_state(app));}
@ -621,6 +627,7 @@ static inline bool32 view_get_variable(Application_Links *app, View_Summary *vie
static inline int32_t view_start_ui_mode(Application_Links *app, View_Summary *view){return(app->view_start_ui_mode_(app, view));}
static inline int32_t view_end_ui_mode(Application_Links *app, View_Summary *view){return(app->view_end_ui_mode_(app, view));}
static inline bool32 view_set_ui(Application_Links *app, View_Summary *view, UI_Control *control){return(app->view_set_ui_(app, view, control));}
static inline UI_Control view_get_ui_copy(Application_Links *app, View_Summary *view, struct Partition *part){return(app->view_get_ui_copy_(app, view, part));}
static inline User_Input get_user_input(Application_Links *app, Input_Type_Flag get_type, Input_Type_Flag abort_type){return(app->get_user_input_(app, get_type, abort_type));}
static inline User_Input get_command_input(Application_Links *app){return(app->get_command_input_(app));}
static inline Mouse_State get_mouse_state(Application_Links *app){return(app->get_mouse_state_(app));}

View File

@ -2,7 +2,7 @@
#define command_id(c) (fcoder_metacmd_ID_##c)
#define command_metadata(c) (&fcoder_metacmd_table[command_id(c)])
#define command_metadata_by_id(id) (&fcoder_metacmd_table[id])
#define command_one_past_last_id 185
#define command_one_past_last_id 200
#if defined(CUSTOM_COMMAND_SIG)
#define PROC_LINKS(x,y) x
#else
@ -77,7 +77,6 @@ CUSTOM_COMMAND_SIG(interactive_new);
CUSTOM_COMMAND_SIG(interactive_open);
CUSTOM_COMMAND_SIG(interactive_open_or_new);
CUSTOM_COMMAND_SIG(interactive_switch_buffer);
CUSTOM_COMMAND_SIG(interactive_switch_buffer_DUMMY_API_EXPLORATION);
CUSTOM_COMMAND_SIG(kill_buffer);
CUSTOM_COMMAND_SIG(left_adjust_view);
CUSTOM_COMMAND_SIG(list_all_functions_current_buffer);
@ -91,6 +90,22 @@ CUSTOM_COMMAND_SIG(list_all_locations_of_type_definition);
CUSTOM_COMMAND_SIG(list_all_locations_of_type_definition_of_identifier);
CUSTOM_COMMAND_SIG(list_all_substring_locations);
CUSTOM_COMMAND_SIG(list_all_substring_locations_case_insensitive);
CUSTOM_COMMAND_SIG(list_mode__activate);
CUSTOM_COMMAND_SIG(list_mode__backspace_text_field);
CUSTOM_COMMAND_SIG(list_mode__backspace_text_field__default);
CUSTOM_COMMAND_SIG(list_mode__backspace_text_field__file_path);
CUSTOM_COMMAND_SIG(list_mode__mouse_press);
CUSTOM_COMMAND_SIG(list_mode__mouse_release);
CUSTOM_COMMAND_SIG(list_mode__move_down);
CUSTOM_COMMAND_SIG(list_mode__move_down__default);
CUSTOM_COMMAND_SIG(list_mode__move_up);
CUSTOM_COMMAND_SIG(list_mode__move_up__default);
CUSTOM_COMMAND_SIG(list_mode__quit);
CUSTOM_COMMAND_SIG(list_mode__repaint);
CUSTOM_COMMAND_SIG(list_mode__wheel_scroll);
CUSTOM_COMMAND_SIG(list_mode__write_character);
CUSTOM_COMMAND_SIG(list_mode__write_character__default);
CUSTOM_COMMAND_SIG(list_mode__write_character__file_path);
CUSTOM_COMMAND_SIG(load_project);
CUSTOM_COMMAND_SIG(make_directory_query);
CUSTOM_COMMAND_SIG(move_down);
@ -205,7 +220,7 @@ char *source_name;
int32_t source_name_len;
int32_t line_number;
};
static Command_Metadata fcoder_metacmd_table[185] = {
static Command_Metadata fcoder_metacmd_table[200] = {
{ PROC_LINKS(allow_mouse, 0), "allow_mouse", 11, "Shows the mouse and causes all mouse input to be processed normally.", 68, "w:\\4ed\\code\\4coder_default_framework.cpp", 43, 191 },
{ PROC_LINKS(auto_tab_line_at_cursor, 0), "auto_tab_line_at_cursor", 23, "Auto-indents the line on which the cursor sits.", 47, "w:\\4ed\\code\\4coder_auto_indent.cpp", 37, 722 },
{ PROC_LINKS(auto_tab_range, 0), "auto_tab_range", 14, "Auto-indents the range between the cursor and the mark.", 55, "w:\\4ed\\code\\4coder_auto_indent.cpp", 37, 733 },
@ -269,13 +284,12 @@ static Command_Metadata fcoder_metacmd_table[185] = {
{ PROC_LINKS(if0_off, 0), "if0_off", 7, "Surround the range between the cursor and mark with an '#if 0' and an '#endif'", 78, "w:\\4ed\\code\\4coder_combined_write_commands.cpp", 49, 82 },
{ PROC_LINKS(increase_face_size, 0), "increase_face_size", 18, "Increase the size of the face used by the current buffer.", 57, "w:\\4ed\\code\\4coder_base_commands.cpp", 39, 519 },
{ PROC_LINKS(increase_line_wrap, 0), "increase_line_wrap", 18, "Increases the current buffer's width for line wrapping.", 55, "w:\\4ed\\code\\4coder_base_commands.cpp", 39, 497 },
{ PROC_LINKS(interactive_kill_buffer, 0), "interactive_kill_buffer", 23, "Interactively kill an open buffer.", 34, "w:\\4ed\\code\\4coder_base_commands.cpp", 39, 1468 },
{ PROC_LINKS(interactive_new, 0), "interactive_new", 15, "Interactively creates a new file.", 33, "w:\\4ed\\code\\4coder_base_commands.cpp", 39, 1444 },
{ PROC_LINKS(interactive_open, 0), "interactive_open", 16, "Interactively opens a file.", 27, "w:\\4ed\\code\\4coder_base_commands.cpp", 39, 1450 },
{ PROC_LINKS(interactive_open_or_new, 0), "interactive_open_or_new", 23, "Interactively opens or creates a new file.", 42, "w:\\4ed\\code\\4coder_base_commands.cpp", 39, 1456 },
{ PROC_LINKS(interactive_switch_buffer, 0), "interactive_switch_buffer", 25, "Interactively switch to an open buffer.", 39, "w:\\4ed\\code\\4coder_base_commands.cpp", 39, 1462 },
{ PROC_LINKS(interactive_switch_buffer_DUMMY_API_EXPLORATION, 0), "interactive_switch_buffer_DUMMY_API_EXPLORATION", 47, "Interactively switch to an open buffer.", 39, "w:\\4ed\\code\\4coder_base_commands.cpp", 39, 1500 },
{ PROC_LINKS(kill_buffer, 0), "kill_buffer", 11, "Kills the current buffer.", 25, "w:\\4ed\\code\\4coder_base_commands.cpp", 39, 1486 },
{ PROC_LINKS(interactive_kill_buffer, 0), "interactive_kill_buffer", 23, "Interactively kill an open buffer.", 34, "w:\\4ed\\code\\4coder_lists.cpp", 31, 378 },
{ PROC_LINKS(interactive_new, 0), "interactive_new", 15, "Interactively creates a new file.", 33, "w:\\4ed\\code\\4coder_lists.cpp", 31, 505 },
{ PROC_LINKS(interactive_open, 0), "interactive_open", 16, "Interactively opens a file.", 27, "w:\\4ed\\code\\4coder_lists.cpp", 31, 564 },
{ PROC_LINKS(interactive_open_or_new, 0), "interactive_open_or_new", 23, "Interactively open a file out of the file system.", 49, "w:\\4ed\\code\\4coder_lists.cpp", 31, 438 },
{ PROC_LINKS(interactive_switch_buffer, 0), "interactive_switch_buffer", 25, "Interactively switch to an open buffer.", 39, "w:\\4ed\\code\\4coder_lists.cpp", 31, 349 },
{ PROC_LINKS(kill_buffer, 0), "kill_buffer", 11, "Kills the current buffer.", 25, "w:\\4ed\\code\\4coder_base_commands.cpp", 39, 1456 },
{ PROC_LINKS(left_adjust_view, 0), "left_adjust_view", 16, "Sets the left size of the view near the x position of the cursor.", 65, "w:\\4ed\\code\\4coder_base_commands.cpp", 39, 135 },
{ PROC_LINKS(list_all_functions_current_buffer, 0), "list_all_functions_current_buffer", 33, "Creates a jump list of lines of the current buffer that appear to define or declare functions.", 94, "w:\\4ed\\code\\4coder_function_list.cpp", 39, 318 },
{ PROC_LINKS(list_all_locations, 0), "list_all_locations", 18, "Queries the user for a string and lists all exact case-sensitive matches found in all open buffers.", 99, "w:\\4ed\\code\\4coder_search.cpp", 32, 741 },
@ -288,6 +302,22 @@ static Command_Metadata fcoder_metacmd_table[185] = {
{ PROC_LINKS(list_all_locations_of_type_definition_of_identifier, 0), "list_all_locations_of_type_definition_of_identifier", 51, "Reads a token or word under the cursor and lists all locations of strings that appear to define a type whose name matches it.", 125, "w:\\4ed\\code\\4coder_search.cpp", 32, 800 },
{ PROC_LINKS(list_all_substring_locations, 0), "list_all_substring_locations", 28, "Queries the user for a string and lists all case-sensitive substring matches found in all open buffers.", 103, "w:\\4ed\\code\\4coder_search.cpp", 32, 747 },
{ PROC_LINKS(list_all_substring_locations_case_insensitive, 0), "list_all_substring_locations_case_insensitive", 45, "Queries the user for a string and lists all case-insensitive substring matches found in all open buffers.", 105, "w:\\4ed\\code\\4coder_search.cpp", 32, 759 },
{ PROC_LINKS(list_mode__activate, 0), "list_mode__activate", 19, "A list mode command that activates the list's action on the highlighted item.", 77, "w:\\4ed\\code\\4coder_lists.cpp", 31, 17 },
{ PROC_LINKS(list_mode__backspace_text_field, 0), "list_mode__backspace_text_field", 31, "A list mode command that backspaces one character from the text field.", 70, "w:\\4ed\\code\\4coder_lists.cpp", 31, 169 },
{ PROC_LINKS(list_mode__backspace_text_field__default, 0), "list_mode__backspace_text_field__default", 40, "A list mode command that backspaces one character from the text field.", 70, "w:\\4ed\\code\\4coder_lists.cpp", 31, 52 },
{ PROC_LINKS(list_mode__backspace_text_field__file_path, 0), "list_mode__backspace_text_field__file_path", 42, "A list mode command that backspaces one character from the text field.", 70, "w:\\4ed\\code\\4coder_lists.cpp", 31, 124 },
{ PROC_LINKS(list_mode__mouse_press, 0), "list_mode__mouse_press", 22, "A list mode command that beings a click interaction with a list item under the mouse.", 85, "w:\\4ed\\code\\4coder_lists.cpp", 31, 214 },
{ PROC_LINKS(list_mode__mouse_release, 0), "list_mode__mouse_release", 24, "A list mode command that ends a click interaction with a list item under the mouse, possibly activating it.", 107, "w:\\4ed\\code\\4coder_lists.cpp", 31, 226 },
{ PROC_LINKS(list_mode__move_down, 0), "list_mode__move_down", 20, "A list mode command that moves the highlighted item one down in the list.", 73, "w:\\4ed\\code\\4coder_lists.cpp", 31, 189 },
{ PROC_LINKS(list_mode__move_down__default, 0), "list_mode__move_down__default", 29, "A list mode command that moves the highlighted item one down in the list.", 73, "w:\\4ed\\code\\4coder_lists.cpp", 31, 83 },
{ PROC_LINKS(list_mode__move_up, 0), "list_mode__move_up", 18, "A list mode command that moves the highlighted item one up in the list.", 71, "w:\\4ed\\code\\4coder_lists.cpp", 31, 179 },
{ PROC_LINKS(list_mode__move_up__default, 0), "list_mode__move_up__default", 27, "A list mode command that moves the highlighted item one up in the list.", 71, "w:\\4ed\\code\\4coder_lists.cpp", 31, 67 },
{ PROC_LINKS(list_mode__quit, 0), "list_mode__quit", 15, "A list mode command that quits the list without executing any actions.", 70, "w:\\4ed\\code\\4coder_lists.cpp", 31, 8 },
{ PROC_LINKS(list_mode__repaint, 0), "list_mode__repaint", 18, "A list mode command that updates the lists UI data.", 51, "w:\\4ed\\code\\4coder_lists.cpp", 31, 242 },
{ PROC_LINKS(list_mode__wheel_scroll, 0), "list_mode__wheel_scroll", 23, "A list mode command that scrolls the list in response to the mouse wheel.", 73, "w:\\4ed\\code\\4coder_lists.cpp", 31, 199 },
{ PROC_LINKS(list_mode__write_character, 0), "list_mode__write_character", 26, "A list mode command that inserts a new character to the text field.", 67, "w:\\4ed\\code\\4coder_lists.cpp", 31, 159 },
{ PROC_LINKS(list_mode__write_character__default, 0), "list_mode__write_character__default", 35, "A list mode command that inserts a new character to the text field.", 67, "w:\\4ed\\code\\4coder_lists.cpp", 31, 32 },
{ PROC_LINKS(list_mode__write_character__file_path, 0), "list_mode__write_character__file_path", 37, "A list mode command that inserts a new character to the text field.", 67, "w:\\4ed\\code\\4coder_lists.cpp", 31, 99 },
{ PROC_LINKS(load_project, 0), "load_project", 12, "Looks for a project.4coder file in the current directory and tries to load it. Looks in parent directories until a project file is found or there are no more parents.", 167, "w:\\4ed\\code\\4coder_project_commands.cpp", 42, 1071 },
{ PROC_LINKS(make_directory_query, 0), "make_directory_query", 20, "Queries the user for a name and creates a new directory with the given name.", 76, "w:\\4ed\\code\\4coder_base_commands.cpp", 39, 1120 },
{ PROC_LINKS(move_down, 0), "move_down", 9, "Moves the cursor down one line.", 31, "w:\\4ed\\code\\4coder_base_commands.cpp", 39, 250 },
@ -305,9 +335,9 @@ static Command_Metadata fcoder_metacmd_table[185] = {
{ PROC_LINKS(newline_or_goto_position_sticky, 0), "newline_or_goto_position_sticky", 31, "If the buffer in the active view is writable, inserts a character, otherwise performs goto_jump_at_cursor.", 106, "w:\\4ed\\code\\4coder_jump_sticky.cpp", 37, 556 },
{ PROC_LINKS(open_all_code, 0), "open_all_code", 13, "Open all code in the current directory. File types are determined by extensions. An extension is considered code based on the extensions specified in 4coder.config.", 164, "w:\\4ed\\code\\4coder_project_commands.cpp", 42, 1055 },
{ PROC_LINKS(open_all_code_recursive, 0), "open_all_code_recursive", 23, "Works as open_all_code but also runs in all subdirectories.", 59, "w:\\4ed\\code\\4coder_project_commands.cpp", 42, 1062 },
{ PROC_LINKS(open_color_tweaker, 0), "open_color_tweaker", 18, "Opens the 4coder colors and fonts selector menu.", 48, "w:\\4ed\\code\\4coder_base_commands.cpp", 39, 1492 },
{ PROC_LINKS(open_color_tweaker, 0), "open_color_tweaker", 18, "Opens the 4coder colors and fonts selector menu.", 48, "w:\\4ed\\code\\4coder_base_commands.cpp", 39, 1462 },
{ PROC_LINKS(open_file_in_quotes, 0), "open_file_in_quotes", 19, "Reads a filename from surrounding '\"' characters and attempts to open the corresponding file.", 94, "w:\\4ed\\code\\4coder_base_commands.cpp", 39, 1339 },
{ PROC_LINKS(open_in_other, 0), "open_in_other", 13, "Interactively opens a file in the other panel.", 46, "w:\\4ed\\code\\4coder_base_commands.cpp", 39, 1708 },
{ PROC_LINKS(open_in_other, 0), "open_in_other", 13, "Interactively opens a file in the other panel.", 46, "w:\\4ed\\code\\4coder_base_commands.cpp", 39, 1470 },
{ PROC_LINKS(open_long_braces, 0), "open_long_braces", 16, "At the cursor, insert a '{' and '}' separated by a blank line.", 62, "w:\\4ed\\code\\4coder_combined_write_commands.cpp", 49, 58 },
{ PROC_LINKS(open_long_braces_break, 0), "open_long_braces_break", 22, "At the cursor, insert a '{' and '}break;' separated by a blank line.", 68, "w:\\4ed\\code\\4coder_combined_write_commands.cpp", 49, 74 },
{ PROC_LINKS(open_long_braces_semicolon, 0), "open_long_braces_semicolon", 26, "At the cursor, insert a '{' and '};' separated by a blank line.", 63, "w:\\4ed\\code\\4coder_combined_write_commands.cpp", 49, 66 },
@ -329,11 +359,11 @@ static Command_Metadata fcoder_metacmd_table[185] = {
{ PROC_LINKS(redo, 0), "redo", 4, "Advances forewards through the undo history.", 44, "w:\\4ed\\code\\4coder_base_commands.cpp", 39, 1438 },
{ PROC_LINKS(remap_interactive, 0), "remap_interactive", 17, "Switch to a named key binding map.", 34, "w:\\4ed\\code\\4coder_default_framework.cpp", 43, 211 },
{ PROC_LINKS(rename_file_query, 0), "rename_file_query", 17, "Queries the user for a new name and renames the file of the current buffer, altering the buffer's name too.", 107, "w:\\4ed\\code\\4coder_base_commands.cpp", 39, 1078 },
{ PROC_LINKS(reopen, 0), "reopen", 6, "Reopen the current buffer from the hard drive.", 46, "w:\\4ed\\code\\4coder_base_commands.cpp", 39, 1474 },
{ PROC_LINKS(reopen, 0), "reopen", 6, "Reopen the current buffer from the hard drive.", 46, "w:\\4ed\\code\\4coder_base_commands.cpp", 39, 1444 },
{ PROC_LINKS(replace_in_range, 0), "replace_in_range", 16, "Queries the user for two strings, and replaces all occurences of the first string in the range between the cursor and the mark with the second string.", 150, "w:\\4ed\\code\\4coder_base_commands.cpp", 39, 810 },
{ PROC_LINKS(reverse_search, 0), "reverse_search", 14, "Begins an incremental search up through the current buffer for a user specified string.", 87, "w:\\4ed\\code\\4coder_base_commands.cpp", 39, 781 },
{ PROC_LINKS(reverse_search_identifier, 0), "reverse_search_identifier", 25, "Begins an incremental search up through the current buffer for the word or token under the cursor.", 98, "w:\\4ed\\code\\4coder_base_commands.cpp", 39, 799 },
{ PROC_LINKS(save, 0), "save", 4, "Saves the current buffer.", 25, "w:\\4ed\\code\\4coder_base_commands.cpp", 39, 1480 },
{ PROC_LINKS(save, 0), "save", 4, "Saves the current buffer.", 25, "w:\\4ed\\code\\4coder_base_commands.cpp", 39, 1450 },
{ PROC_LINKS(save_all_dirty_buffers, 0), "save_all_dirty_buffers", 22, "Saves all buffers marked dirty (showing the '*' indicator).", 59, "w:\\4ed\\code\\4coder_base_commands.cpp", 39, 977 },
{ PROC_LINKS(save_to_query, 0), "save_to_query", 13, "Queries the user for a name and saves the contents of the current buffer, altering the buffer's name too.", 105, "w:\\4ed\\code\\4coder_base_commands.cpp", 39, 1038 },
{ PROC_LINKS(scope_absorb_down, 0), "scope_absorb_down", 17, "If a scope is currently selected, and a statement or block statement is present below the current scope, the statement is moved into the scope.", 143, "w:\\4ed\\code\\4coder_scope_commands.cpp", 40, 738 },
@ -460,121 +490,136 @@ static int32_t fcoder_metacmd_ID_interactive_new = 64;
static int32_t fcoder_metacmd_ID_interactive_open = 65;
static int32_t fcoder_metacmd_ID_interactive_open_or_new = 66;
static int32_t fcoder_metacmd_ID_interactive_switch_buffer = 67;
static int32_t fcoder_metacmd_ID_interactive_switch_buffer_DUMMY_API_EXPLORATION = 68;
static int32_t fcoder_metacmd_ID_kill_buffer = 69;
static int32_t fcoder_metacmd_ID_left_adjust_view = 70;
static int32_t fcoder_metacmd_ID_list_all_functions_current_buffer = 71;
static int32_t fcoder_metacmd_ID_list_all_locations = 72;
static int32_t fcoder_metacmd_ID_list_all_locations_case_insensitive = 73;
static int32_t fcoder_metacmd_ID_list_all_locations_of_identifier = 74;
static int32_t fcoder_metacmd_ID_list_all_locations_of_identifier_case_insensitive = 75;
static int32_t fcoder_metacmd_ID_list_all_locations_of_selection = 76;
static int32_t fcoder_metacmd_ID_list_all_locations_of_selection_case_insensitive = 77;
static int32_t fcoder_metacmd_ID_list_all_locations_of_type_definition = 78;
static int32_t fcoder_metacmd_ID_list_all_locations_of_type_definition_of_identifier = 79;
static int32_t fcoder_metacmd_ID_list_all_substring_locations = 80;
static int32_t fcoder_metacmd_ID_list_all_substring_locations_case_insensitive = 81;
static int32_t fcoder_metacmd_ID_load_project = 82;
static int32_t fcoder_metacmd_ID_make_directory_query = 83;
static int32_t fcoder_metacmd_ID_move_down = 84;
static int32_t fcoder_metacmd_ID_move_down_10 = 85;
static int32_t fcoder_metacmd_ID_move_down_textual = 86;
static int32_t fcoder_metacmd_ID_move_left = 87;
static int32_t fcoder_metacmd_ID_move_line_down = 88;
static int32_t fcoder_metacmd_ID_move_line_up = 89;
static int32_t fcoder_metacmd_ID_move_right = 90;
static int32_t fcoder_metacmd_ID_move_up = 91;
static int32_t fcoder_metacmd_ID_move_up_10 = 92;
static int32_t fcoder_metacmd_ID_newline_or_goto_position_direct = 93;
static int32_t fcoder_metacmd_ID_newline_or_goto_position_same_panel_direct = 94;
static int32_t fcoder_metacmd_ID_newline_or_goto_position_same_panel_sticky = 95;
static int32_t fcoder_metacmd_ID_newline_or_goto_position_sticky = 96;
static int32_t fcoder_metacmd_ID_open_all_code = 97;
static int32_t fcoder_metacmd_ID_open_all_code_recursive = 98;
static int32_t fcoder_metacmd_ID_open_color_tweaker = 99;
static int32_t fcoder_metacmd_ID_open_file_in_quotes = 100;
static int32_t fcoder_metacmd_ID_open_in_other = 101;
static int32_t fcoder_metacmd_ID_open_long_braces = 102;
static int32_t fcoder_metacmd_ID_open_long_braces_break = 103;
static int32_t fcoder_metacmd_ID_open_long_braces_semicolon = 104;
static int32_t fcoder_metacmd_ID_open_matching_file_cpp = 105;
static int32_t fcoder_metacmd_ID_open_panel_hsplit = 106;
static int32_t fcoder_metacmd_ID_open_panel_vsplit = 107;
static int32_t fcoder_metacmd_ID_page_down = 108;
static int32_t fcoder_metacmd_ID_page_up = 109;
static int32_t fcoder_metacmd_ID_paste = 110;
static int32_t fcoder_metacmd_ID_paste_and_indent = 111;
static int32_t fcoder_metacmd_ID_paste_next = 112;
static int32_t fcoder_metacmd_ID_paste_next_and_indent = 113;
static int32_t fcoder_metacmd_ID_place_in_scope = 114;
static int32_t fcoder_metacmd_ID_project_fkey_command = 115;
static int32_t fcoder_metacmd_ID_project_go_to_root_directory = 116;
static int32_t fcoder_metacmd_ID_query_replace = 117;
static int32_t fcoder_metacmd_ID_query_replace_identifier = 118;
static int32_t fcoder_metacmd_ID_query_replace_selection = 119;
static int32_t fcoder_metacmd_ID_redo = 120;
static int32_t fcoder_metacmd_ID_remap_interactive = 121;
static int32_t fcoder_metacmd_ID_rename_file_query = 122;
static int32_t fcoder_metacmd_ID_reopen = 123;
static int32_t fcoder_metacmd_ID_replace_in_range = 124;
static int32_t fcoder_metacmd_ID_reverse_search = 125;
static int32_t fcoder_metacmd_ID_reverse_search_identifier = 126;
static int32_t fcoder_metacmd_ID_save = 127;
static int32_t fcoder_metacmd_ID_save_all_dirty_buffers = 128;
static int32_t fcoder_metacmd_ID_save_to_query = 129;
static int32_t fcoder_metacmd_ID_scope_absorb_down = 130;
static int32_t fcoder_metacmd_ID_search = 131;
static int32_t fcoder_metacmd_ID_search_identifier = 132;
static int32_t fcoder_metacmd_ID_seek_alphanumeric_left = 133;
static int32_t fcoder_metacmd_ID_seek_alphanumeric_or_camel_left = 134;
static int32_t fcoder_metacmd_ID_seek_alphanumeric_or_camel_right = 135;
static int32_t fcoder_metacmd_ID_seek_alphanumeric_right = 136;
static int32_t fcoder_metacmd_ID_seek_beginning_of_line = 137;
static int32_t fcoder_metacmd_ID_seek_beginning_of_textual_line = 138;
static int32_t fcoder_metacmd_ID_seek_end_of_line = 139;
static int32_t fcoder_metacmd_ID_seek_end_of_textual_line = 140;
static int32_t fcoder_metacmd_ID_seek_token_left = 141;
static int32_t fcoder_metacmd_ID_seek_token_right = 142;
static int32_t fcoder_metacmd_ID_seek_white_or_token_left = 143;
static int32_t fcoder_metacmd_ID_seek_white_or_token_right = 144;
static int32_t fcoder_metacmd_ID_seek_whitespace_down = 145;
static int32_t fcoder_metacmd_ID_seek_whitespace_down_end_line = 146;
static int32_t fcoder_metacmd_ID_seek_whitespace_left = 147;
static int32_t fcoder_metacmd_ID_seek_whitespace_right = 148;
static int32_t fcoder_metacmd_ID_seek_whitespace_up = 149;
static int32_t fcoder_metacmd_ID_seek_whitespace_up_end_line = 150;
static int32_t fcoder_metacmd_ID_select_all = 151;
static int32_t fcoder_metacmd_ID_set_bindings_choose = 152;
static int32_t fcoder_metacmd_ID_set_bindings_default = 153;
static int32_t fcoder_metacmd_ID_set_bindings_mac_default = 154;
static int32_t fcoder_metacmd_ID_set_mark = 155;
static int32_t fcoder_metacmd_ID_setup_build_bat = 156;
static int32_t fcoder_metacmd_ID_setup_build_bat_and_sh = 157;
static int32_t fcoder_metacmd_ID_setup_build_sh = 158;
static int32_t fcoder_metacmd_ID_setup_new_project = 159;
static int32_t fcoder_metacmd_ID_show_filebar = 160;
static int32_t fcoder_metacmd_ID_show_scrollbar = 161;
static int32_t fcoder_metacmd_ID_snipe_token_or_word = 162;
static int32_t fcoder_metacmd_ID_snipe_token_or_word_right = 163;
static int32_t fcoder_metacmd_ID_suppress_mouse = 164;
static int32_t fcoder_metacmd_ID_swap_buffers_between_panels = 165;
static int32_t fcoder_metacmd_ID_to_lowercase = 166;
static int32_t fcoder_metacmd_ID_to_uppercase = 167;
static int32_t fcoder_metacmd_ID_toggle_filebar = 168;
static int32_t fcoder_metacmd_ID_toggle_fullscreen = 169;
static int32_t fcoder_metacmd_ID_toggle_line_wrap = 170;
static int32_t fcoder_metacmd_ID_toggle_mouse = 171;
static int32_t fcoder_metacmd_ID_toggle_show_whitespace = 172;
static int32_t fcoder_metacmd_ID_toggle_virtual_whitespace = 173;
static int32_t fcoder_metacmd_ID_undo = 174;
static int32_t fcoder_metacmd_ID_view_buffer_other_panel = 175;
static int32_t fcoder_metacmd_ID_word_complete = 176;
static int32_t fcoder_metacmd_ID_write_and_auto_tab = 177;
static int32_t fcoder_metacmd_ID_write_block = 178;
static int32_t fcoder_metacmd_ID_write_character = 179;
static int32_t fcoder_metacmd_ID_write_hack = 180;
static int32_t fcoder_metacmd_ID_write_note = 181;
static int32_t fcoder_metacmd_ID_write_todo = 182;
static int32_t fcoder_metacmd_ID_write_underscore = 183;
static int32_t fcoder_metacmd_ID_write_zero_struct = 184;
static int32_t fcoder_metacmd_ID_kill_buffer = 68;
static int32_t fcoder_metacmd_ID_left_adjust_view = 69;
static int32_t fcoder_metacmd_ID_list_all_functions_current_buffer = 70;
static int32_t fcoder_metacmd_ID_list_all_locations = 71;
static int32_t fcoder_metacmd_ID_list_all_locations_case_insensitive = 72;
static int32_t fcoder_metacmd_ID_list_all_locations_of_identifier = 73;
static int32_t fcoder_metacmd_ID_list_all_locations_of_identifier_case_insensitive = 74;
static int32_t fcoder_metacmd_ID_list_all_locations_of_selection = 75;
static int32_t fcoder_metacmd_ID_list_all_locations_of_selection_case_insensitive = 76;
static int32_t fcoder_metacmd_ID_list_all_locations_of_type_definition = 77;
static int32_t fcoder_metacmd_ID_list_all_locations_of_type_definition_of_identifier = 78;
static int32_t fcoder_metacmd_ID_list_all_substring_locations = 79;
static int32_t fcoder_metacmd_ID_list_all_substring_locations_case_insensitive = 80;
static int32_t fcoder_metacmd_ID_list_mode__activate = 81;
static int32_t fcoder_metacmd_ID_list_mode__backspace_text_field = 82;
static int32_t fcoder_metacmd_ID_list_mode__backspace_text_field__default = 83;
static int32_t fcoder_metacmd_ID_list_mode__backspace_text_field__file_path = 84;
static int32_t fcoder_metacmd_ID_list_mode__mouse_press = 85;
static int32_t fcoder_metacmd_ID_list_mode__mouse_release = 86;
static int32_t fcoder_metacmd_ID_list_mode__move_down = 87;
static int32_t fcoder_metacmd_ID_list_mode__move_down__default = 88;
static int32_t fcoder_metacmd_ID_list_mode__move_up = 89;
static int32_t fcoder_metacmd_ID_list_mode__move_up__default = 90;
static int32_t fcoder_metacmd_ID_list_mode__quit = 91;
static int32_t fcoder_metacmd_ID_list_mode__repaint = 92;
static int32_t fcoder_metacmd_ID_list_mode__wheel_scroll = 93;
static int32_t fcoder_metacmd_ID_list_mode__write_character = 94;
static int32_t fcoder_metacmd_ID_list_mode__write_character__default = 95;
static int32_t fcoder_metacmd_ID_list_mode__write_character__file_path = 96;
static int32_t fcoder_metacmd_ID_load_project = 97;
static int32_t fcoder_metacmd_ID_make_directory_query = 98;
static int32_t fcoder_metacmd_ID_move_down = 99;
static int32_t fcoder_metacmd_ID_move_down_10 = 100;
static int32_t fcoder_metacmd_ID_move_down_textual = 101;
static int32_t fcoder_metacmd_ID_move_left = 102;
static int32_t fcoder_metacmd_ID_move_line_down = 103;
static int32_t fcoder_metacmd_ID_move_line_up = 104;
static int32_t fcoder_metacmd_ID_move_right = 105;
static int32_t fcoder_metacmd_ID_move_up = 106;
static int32_t fcoder_metacmd_ID_move_up_10 = 107;
static int32_t fcoder_metacmd_ID_newline_or_goto_position_direct = 108;
static int32_t fcoder_metacmd_ID_newline_or_goto_position_same_panel_direct = 109;
static int32_t fcoder_metacmd_ID_newline_or_goto_position_same_panel_sticky = 110;
static int32_t fcoder_metacmd_ID_newline_or_goto_position_sticky = 111;
static int32_t fcoder_metacmd_ID_open_all_code = 112;
static int32_t fcoder_metacmd_ID_open_all_code_recursive = 113;
static int32_t fcoder_metacmd_ID_open_color_tweaker = 114;
static int32_t fcoder_metacmd_ID_open_file_in_quotes = 115;
static int32_t fcoder_metacmd_ID_open_in_other = 116;
static int32_t fcoder_metacmd_ID_open_long_braces = 117;
static int32_t fcoder_metacmd_ID_open_long_braces_break = 118;
static int32_t fcoder_metacmd_ID_open_long_braces_semicolon = 119;
static int32_t fcoder_metacmd_ID_open_matching_file_cpp = 120;
static int32_t fcoder_metacmd_ID_open_panel_hsplit = 121;
static int32_t fcoder_metacmd_ID_open_panel_vsplit = 122;
static int32_t fcoder_metacmd_ID_page_down = 123;
static int32_t fcoder_metacmd_ID_page_up = 124;
static int32_t fcoder_metacmd_ID_paste = 125;
static int32_t fcoder_metacmd_ID_paste_and_indent = 126;
static int32_t fcoder_metacmd_ID_paste_next = 127;
static int32_t fcoder_metacmd_ID_paste_next_and_indent = 128;
static int32_t fcoder_metacmd_ID_place_in_scope = 129;
static int32_t fcoder_metacmd_ID_project_fkey_command = 130;
static int32_t fcoder_metacmd_ID_project_go_to_root_directory = 131;
static int32_t fcoder_metacmd_ID_query_replace = 132;
static int32_t fcoder_metacmd_ID_query_replace_identifier = 133;
static int32_t fcoder_metacmd_ID_query_replace_selection = 134;
static int32_t fcoder_metacmd_ID_redo = 135;
static int32_t fcoder_metacmd_ID_remap_interactive = 136;
static int32_t fcoder_metacmd_ID_rename_file_query = 137;
static int32_t fcoder_metacmd_ID_reopen = 138;
static int32_t fcoder_metacmd_ID_replace_in_range = 139;
static int32_t fcoder_metacmd_ID_reverse_search = 140;
static int32_t fcoder_metacmd_ID_reverse_search_identifier = 141;
static int32_t fcoder_metacmd_ID_save = 142;
static int32_t fcoder_metacmd_ID_save_all_dirty_buffers = 143;
static int32_t fcoder_metacmd_ID_save_to_query = 144;
static int32_t fcoder_metacmd_ID_scope_absorb_down = 145;
static int32_t fcoder_metacmd_ID_search = 146;
static int32_t fcoder_metacmd_ID_search_identifier = 147;
static int32_t fcoder_metacmd_ID_seek_alphanumeric_left = 148;
static int32_t fcoder_metacmd_ID_seek_alphanumeric_or_camel_left = 149;
static int32_t fcoder_metacmd_ID_seek_alphanumeric_or_camel_right = 150;
static int32_t fcoder_metacmd_ID_seek_alphanumeric_right = 151;
static int32_t fcoder_metacmd_ID_seek_beginning_of_line = 152;
static int32_t fcoder_metacmd_ID_seek_beginning_of_textual_line = 153;
static int32_t fcoder_metacmd_ID_seek_end_of_line = 154;
static int32_t fcoder_metacmd_ID_seek_end_of_textual_line = 155;
static int32_t fcoder_metacmd_ID_seek_token_left = 156;
static int32_t fcoder_metacmd_ID_seek_token_right = 157;
static int32_t fcoder_metacmd_ID_seek_white_or_token_left = 158;
static int32_t fcoder_metacmd_ID_seek_white_or_token_right = 159;
static int32_t fcoder_metacmd_ID_seek_whitespace_down = 160;
static int32_t fcoder_metacmd_ID_seek_whitespace_down_end_line = 161;
static int32_t fcoder_metacmd_ID_seek_whitespace_left = 162;
static int32_t fcoder_metacmd_ID_seek_whitespace_right = 163;
static int32_t fcoder_metacmd_ID_seek_whitespace_up = 164;
static int32_t fcoder_metacmd_ID_seek_whitespace_up_end_line = 165;
static int32_t fcoder_metacmd_ID_select_all = 166;
static int32_t fcoder_metacmd_ID_set_bindings_choose = 167;
static int32_t fcoder_metacmd_ID_set_bindings_default = 168;
static int32_t fcoder_metacmd_ID_set_bindings_mac_default = 169;
static int32_t fcoder_metacmd_ID_set_mark = 170;
static int32_t fcoder_metacmd_ID_setup_build_bat = 171;
static int32_t fcoder_metacmd_ID_setup_build_bat_and_sh = 172;
static int32_t fcoder_metacmd_ID_setup_build_sh = 173;
static int32_t fcoder_metacmd_ID_setup_new_project = 174;
static int32_t fcoder_metacmd_ID_show_filebar = 175;
static int32_t fcoder_metacmd_ID_show_scrollbar = 176;
static int32_t fcoder_metacmd_ID_snipe_token_or_word = 177;
static int32_t fcoder_metacmd_ID_snipe_token_or_word_right = 178;
static int32_t fcoder_metacmd_ID_suppress_mouse = 179;
static int32_t fcoder_metacmd_ID_swap_buffers_between_panels = 180;
static int32_t fcoder_metacmd_ID_to_lowercase = 181;
static int32_t fcoder_metacmd_ID_to_uppercase = 182;
static int32_t fcoder_metacmd_ID_toggle_filebar = 183;
static int32_t fcoder_metacmd_ID_toggle_fullscreen = 184;
static int32_t fcoder_metacmd_ID_toggle_line_wrap = 185;
static int32_t fcoder_metacmd_ID_toggle_mouse = 186;
static int32_t fcoder_metacmd_ID_toggle_show_whitespace = 187;
static int32_t fcoder_metacmd_ID_toggle_virtual_whitespace = 188;
static int32_t fcoder_metacmd_ID_undo = 189;
static int32_t fcoder_metacmd_ID_view_buffer_other_panel = 190;
static int32_t fcoder_metacmd_ID_word_complete = 191;
static int32_t fcoder_metacmd_ID_write_and_auto_tab = 192;
static int32_t fcoder_metacmd_ID_write_block = 193;
static int32_t fcoder_metacmd_ID_write_character = 194;
static int32_t fcoder_metacmd_ID_write_hack = 195;
static int32_t fcoder_metacmd_ID_write_note = 196;
static int32_t fcoder_metacmd_ID_write_todo = 197;
static int32_t fcoder_metacmd_ID_write_underscore = 198;
static int32_t fcoder_metacmd_ID_write_zero_struct = 199;
#endif

View File

@ -15,22 +15,25 @@ key_mouse_left = 55308,
key_mouse_right = 55309,
key_mouse_left_release = 55310,
key_mouse_right_release = 55311,
key_f1 = 55312,
key_f2 = 55313,
key_f3 = 55314,
key_f4 = 55315,
key_f5 = 55316,
key_f6 = 55317,
key_f7 = 55318,
key_f8 = 55319,
key_f9 = 55320,
key_f10 = 55321,
key_f11 = 55322,
key_f12 = 55323,
key_f13 = 55324,
key_f14 = 55325,
key_f15 = 55326,
key_f16 = 55327,
key_mouse_wheel = 55312,
key_mouse_move = 55313,
key_animate = 55314,
key_f1 = 55315,
key_f2 = 55316,
key_f3 = 55317,
key_f4 = 55318,
key_f5 = 55319,
key_f6 = 55320,
key_f7 = 55321,
key_f8 = 55322,
key_f9 = 55323,
key_f10 = 55324,
key_f11 = 55325,
key_f12 = 55326,
key_f13 = 55327,
key_f14 = 55328,
key_f15 = 55329,
key_f16 = 55330,
};
static char*
global_key_name(uint32_t key_code, int32_t *size){
@ -52,6 +55,9 @@ case key_mouse_left: result = "key_mouse_left"; *size = sizeof("key_mouse_left")
case key_mouse_right: result = "key_mouse_right"; *size = sizeof("key_mouse_right")-1; break;
case key_mouse_left_release: result = "key_mouse_left_release"; *size = sizeof("key_mouse_left_release")-1; break;
case key_mouse_right_release: result = "key_mouse_right_release"; *size = sizeof("key_mouse_right_release")-1; break;
case key_mouse_wheel: result = "key_mouse_wheel"; *size = sizeof("key_mouse_wheel")-1; break;
case key_mouse_move: result = "key_mouse_move"; *size = sizeof("key_mouse_move")-1; break;
case key_animate: result = "key_animate"; *size = sizeof("key_animate")-1; break;
case key_f1: result = "key_f1"; *size = sizeof("key_f1")-1; break;
case key_f2: result = "key_f2"; *size = sizeof("key_f2")-1; break;
case key_f3: result = "key_f3"; *size = sizeof("key_f3")-1; break;

View File

@ -10,7 +10,7 @@ bind(context, 'n', MDFR_CTRL, interactive_new);
bind(context, 'o', MDFR_CTRL, interactive_open_or_new);
bind(context, 'o', MDFR_ALT, open_in_other);
bind(context, 'k', MDFR_CTRL, interactive_kill_buffer);
bind(context, 'i', MDFR_CTRL, interactive_switch_buffer_DUMMY_API_EXPLORATION);
bind(context, 'i', MDFR_CTRL, interactive_switch_buffer);
bind(context, 'h', MDFR_CTRL, project_go_to_root_directory);
bind(context, 'S', MDFR_CTRL, save_all_dirty_buffers);
bind(context, 'c', MDFR_ALT, open_color_tweaker);
@ -150,6 +150,22 @@ bind(context, '2', MDFR_ALT, open_matching_file_cpp);
bind(context, '0', MDFR_CTRL, write_zero_struct);
bind(context, 'I', MDFR_CTRL, list_all_functions_current_buffer);
end_map(context);
begin_map(context, default_lister_ui_map);
bind_vanilla_keys(context, list_mode__write_character);
bind(context, key_esc, MDFR_NONE, list_mode__quit);
bind(context, '\n', MDFR_NONE, list_mode__activate);
bind(context, '\t', MDFR_NONE, list_mode__activate);
bind(context, key_back, MDFR_NONE, list_mode__backspace_text_field);
bind(context, key_up, MDFR_NONE, list_mode__move_up);
bind(context, key_page_up, MDFR_NONE, list_mode__move_up);
bind(context, key_down, MDFR_NONE, list_mode__move_down);
bind(context, key_page_down, MDFR_NONE, list_mode__move_down);
bind(context, key_mouse_wheel, MDFR_NONE, list_mode__wheel_scroll);
bind(context, key_mouse_left, MDFR_NONE, list_mode__mouse_press);
bind(context, key_mouse_left_release, MDFR_NONE, list_mode__mouse_release);
bind(context, key_mouse_move, MDFR_NONE, list_mode__repaint);
bind(context, key_animate, MDFR_NONE, list_mode__repaint);
end_map(context);
}
void fill_keys_mac_default(Bind_Helper *context){
begin_map(context, mapid_global);
@ -300,6 +316,22 @@ bind(context, '2', MDFR_CTRL, open_matching_file_cpp);
bind(context, '0', MDFR_CMND, write_zero_struct);
bind(context, 'I', MDFR_CMND, list_all_functions_current_buffer);
end_map(context);
begin_map(context, default_lister_ui_map);
bind_vanilla_keys(context, list_mode__write_character);
bind(context, key_esc, MDFR_NONE, list_mode__quit);
bind(context, '\n', MDFR_NONE, list_mode__activate);
bind(context, '\t', MDFR_NONE, list_mode__activate);
bind(context, key_back, MDFR_NONE, list_mode__backspace_text_field);
bind(context, key_up, MDFR_NONE, list_mode__move_up);
bind(context, key_page_up, MDFR_NONE, list_mode__move_up);
bind(context, key_down, MDFR_NONE, list_mode__move_down);
bind(context, key_page_down, MDFR_NONE, list_mode__move_down);
bind(context, key_mouse_wheel, MDFR_NONE, list_mode__wheel_scroll);
bind(context, key_mouse_left, MDFR_NONE, list_mode__mouse_press);
bind(context, key_mouse_left_release, MDFR_NONE, list_mode__mouse_release);
bind(context, key_mouse_move, MDFR_NONE, list_mode__repaint);
bind(context, key_animate, MDFR_NONE, list_mode__repaint);
end_map(context);
}
#endif
#if defined(CUSTOM_COMMAND_SIG)
@ -344,7 +376,7 @@ static Meta_Key_Bind fcoder_binds_for_default_mapid_global[45] = {
{0, 111, 1, "interactive_open_or_new", 23, LINK_PROCS(interactive_open_or_new)},
{0, 111, 2, "open_in_other", 13, LINK_PROCS(open_in_other)},
{0, 107, 1, "interactive_kill_buffer", 23, LINK_PROCS(interactive_kill_buffer)},
{0, 105, 1, "interactive_switch_buffer_DUMMY_API_EXPLORATION", 47, LINK_PROCS(interactive_switch_buffer_DUMMY_API_EXPLORATION)},
{0, 105, 1, "interactive_switch_buffer", 25, LINK_PROCS(interactive_switch_buffer)},
{0, 104, 1, "project_go_to_root_directory", 28, LINK_PROCS(project_go_to_root_directory)},
{0, 83, 1, "save_all_dirty_buffers", 22, LINK_PROCS(save_all_dirty_buffers)},
{0, 99, 2, "open_color_tweaker", 18, LINK_PROCS(open_color_tweaker)},
@ -364,9 +396,6 @@ static Meta_Key_Bind fcoder_binds_for_default_mapid_global[45] = {
{0, 69, 2, "exit_4coder", 11, LINK_PROCS(exit_4coder)},
{0, 43, 1, "increase_face_size", 18, LINK_PROCS(increase_face_size)},
{0, 45, 1, "decrease_face_size", 18, LINK_PROCS(decrease_face_size)},
{0, 55312, 0, "project_fkey_command", 20, LINK_PROCS(project_fkey_command)},
{0, 55313, 0, "project_fkey_command", 20, LINK_PROCS(project_fkey_command)},
{0, 55314, 0, "project_fkey_command", 20, LINK_PROCS(project_fkey_command)},
{0, 55315, 0, "project_fkey_command", 20, LINK_PROCS(project_fkey_command)},
{0, 55316, 0, "project_fkey_command", 20, LINK_PROCS(project_fkey_command)},
{0, 55317, 0, "project_fkey_command", 20, LINK_PROCS(project_fkey_command)},
@ -380,6 +409,9 @@ static Meta_Key_Bind fcoder_binds_for_default_mapid_global[45] = {
{0, 55325, 0, "project_fkey_command", 20, LINK_PROCS(project_fkey_command)},
{0, 55326, 0, "project_fkey_command", 20, LINK_PROCS(project_fkey_command)},
{0, 55327, 0, "project_fkey_command", 20, LINK_PROCS(project_fkey_command)},
{0, 55328, 0, "project_fkey_command", 20, LINK_PROCS(project_fkey_command)},
{0, 55329, 0, "project_fkey_command", 20, LINK_PROCS(project_fkey_command)},
{0, 55330, 0, "project_fkey_command", 20, LINK_PROCS(project_fkey_command)},
};
static Meta_Key_Bind fcoder_binds_for_default_mapid_file[66] = {
{1, 0, 0, "write_character", 15, LINK_PROCS(write_character)},
@ -483,10 +515,27 @@ static Meta_Key_Bind fcoder_binds_for_default_default_code_map[32] = {
{0, 48, 1, "write_zero_struct", 17, LINK_PROCS(write_zero_struct)},
{0, 73, 1, "list_all_functions_current_buffer", 33, LINK_PROCS(list_all_functions_current_buffer)},
};
static Meta_Sub_Map fcoder_submaps_for_default[3] = {
static Meta_Key_Bind fcoder_binds_for_default_default_lister_ui_map[14] = {
{1, 0, 0, "list_mode__write_character", 26, LINK_PROCS(list_mode__write_character)},
{0, 55307, 0, "list_mode__quit", 15, LINK_PROCS(list_mode__quit)},
{0, 10, 0, "list_mode__activate", 19, LINK_PROCS(list_mode__activate)},
{0, 9, 0, "list_mode__activate", 19, LINK_PROCS(list_mode__activate)},
{0, 55296, 0, "list_mode__backspace_text_field", 31, LINK_PROCS(list_mode__backspace_text_field)},
{0, 55297, 0, "list_mode__move_up", 18, LINK_PROCS(list_mode__move_up)},
{0, 55305, 0, "list_mode__move_up", 18, LINK_PROCS(list_mode__move_up)},
{0, 55298, 0, "list_mode__move_down", 20, LINK_PROCS(list_mode__move_down)},
{0, 55306, 0, "list_mode__move_down", 20, LINK_PROCS(list_mode__move_down)},
{0, 55312, 0, "list_mode__wheel_scroll", 23, LINK_PROCS(list_mode__wheel_scroll)},
{0, 55308, 0, "list_mode__mouse_press", 22, LINK_PROCS(list_mode__mouse_press)},
{0, 55310, 0, "list_mode__mouse_release", 24, LINK_PROCS(list_mode__mouse_release)},
{0, 55313, 0, "list_mode__repaint", 18, LINK_PROCS(list_mode__repaint)},
{0, 55314, 0, "list_mode__repaint", 18, LINK_PROCS(list_mode__repaint)},
};
static Meta_Sub_Map fcoder_submaps_for_default[4] = {
{"mapid_global", 12, "The following bindings apply in all situations.", 47, 0, 0, fcoder_binds_for_default_mapid_global, 45},
{"mapid_file", 10, "The following bindings apply in general text files and most apply in code files, but some are overriden by other commands specific to code files.", 145, 0, 0, fcoder_binds_for_default_mapid_file, 66},
{"default_code_map", 16, "The following commands only apply in files where the lexer (syntax highlighting) is turned on.", 94, "mapid_file", 10, fcoder_binds_for_default_default_code_map, 32},
{"default_lister_ui_map", 21, "These commands apply in 'lister mode' such as when you open a file.", 67, 0, 0, fcoder_binds_for_default_default_lister_ui_map, 14},
};
static Meta_Key_Bind fcoder_binds_for_mac_default_mapid_global[45] = {
{0, 112, 4, "open_panel_vsplit", 17, LINK_PROCS(open_panel_vsplit)},
@ -518,9 +567,6 @@ static Meta_Key_Bind fcoder_binds_for_mac_default_mapid_global[45] = {
{0, 69, 1, "exit_4coder", 11, LINK_PROCS(exit_4coder)},
{0, 43, 1, "increase_face_size", 18, LINK_PROCS(increase_face_size)},
{0, 45, 1, "decrease_face_size", 18, LINK_PROCS(decrease_face_size)},
{0, 55312, 0, "project_fkey_command", 20, LINK_PROCS(project_fkey_command)},
{0, 55313, 0, "project_fkey_command", 20, LINK_PROCS(project_fkey_command)},
{0, 55314, 0, "project_fkey_command", 20, LINK_PROCS(project_fkey_command)},
{0, 55315, 0, "project_fkey_command", 20, LINK_PROCS(project_fkey_command)},
{0, 55316, 0, "project_fkey_command", 20, LINK_PROCS(project_fkey_command)},
{0, 55317, 0, "project_fkey_command", 20, LINK_PROCS(project_fkey_command)},
@ -534,6 +580,9 @@ static Meta_Key_Bind fcoder_binds_for_mac_default_mapid_global[45] = {
{0, 55325, 0, "project_fkey_command", 20, LINK_PROCS(project_fkey_command)},
{0, 55326, 0, "project_fkey_command", 20, LINK_PROCS(project_fkey_command)},
{0, 55327, 0, "project_fkey_command", 20, LINK_PROCS(project_fkey_command)},
{0, 55328, 0, "project_fkey_command", 20, LINK_PROCS(project_fkey_command)},
{0, 55329, 0, "project_fkey_command", 20, LINK_PROCS(project_fkey_command)},
{0, 55330, 0, "project_fkey_command", 20, LINK_PROCS(project_fkey_command)},
};
static Meta_Key_Bind fcoder_binds_for_mac_default_mapid_file[64] = {
{1, 0, 0, "write_character", 15, LINK_PROCS(write_character)},
@ -635,12 +684,29 @@ static Meta_Key_Bind fcoder_binds_for_mac_default_default_code_map[32] = {
{0, 48, 4, "write_zero_struct", 17, LINK_PROCS(write_zero_struct)},
{0, 73, 4, "list_all_functions_current_buffer", 33, LINK_PROCS(list_all_functions_current_buffer)},
};
static Meta_Sub_Map fcoder_submaps_for_mac_default[3] = {
static Meta_Key_Bind fcoder_binds_for_mac_default_default_lister_ui_map[14] = {
{1, 0, 0, "list_mode__write_character", 26, LINK_PROCS(list_mode__write_character)},
{0, 55307, 0, "list_mode__quit", 15, LINK_PROCS(list_mode__quit)},
{0, 10, 0, "list_mode__activate", 19, LINK_PROCS(list_mode__activate)},
{0, 9, 0, "list_mode__activate", 19, LINK_PROCS(list_mode__activate)},
{0, 55296, 0, "list_mode__backspace_text_field", 31, LINK_PROCS(list_mode__backspace_text_field)},
{0, 55297, 0, "list_mode__move_up", 18, LINK_PROCS(list_mode__move_up)},
{0, 55305, 0, "list_mode__move_up", 18, LINK_PROCS(list_mode__move_up)},
{0, 55298, 0, "list_mode__move_down", 20, LINK_PROCS(list_mode__move_down)},
{0, 55306, 0, "list_mode__move_down", 20, LINK_PROCS(list_mode__move_down)},
{0, 55312, 0, "list_mode__wheel_scroll", 23, LINK_PROCS(list_mode__wheel_scroll)},
{0, 55308, 0, "list_mode__mouse_press", 22, LINK_PROCS(list_mode__mouse_press)},
{0, 55310, 0, "list_mode__mouse_release", 24, LINK_PROCS(list_mode__mouse_release)},
{0, 55313, 0, "list_mode__repaint", 18, LINK_PROCS(list_mode__repaint)},
{0, 55314, 0, "list_mode__repaint", 18, LINK_PROCS(list_mode__repaint)},
};
static Meta_Sub_Map fcoder_submaps_for_mac_default[4] = {
{"mapid_global", 12, "The following bindings apply in all situations.", 47, 0, 0, fcoder_binds_for_mac_default_mapid_global, 45},
{"mapid_file", 10, "The following bindings apply in general text files and most apply in code files, but some are overriden by other commands specific to code files.", 145, 0, 0, fcoder_binds_for_mac_default_mapid_file, 64},
{"default_code_map", 16, "The following commands only apply in files where the lexer (syntax highlighting) is turned on.", 94, "mapid_file", 10, fcoder_binds_for_mac_default_default_code_map, 32},
{"default_lister_ui_map", 21, "These commands apply in 'lister mode' such as when you open a file.", 67, 0, 0, fcoder_binds_for_mac_default_default_lister_ui_map, 14},
};
static Meta_Mapping fcoder_meta_maps[2] = {
{"default", 7, "The default 4coder bindings - typically good for Windows and Linux", 66, fcoder_submaps_for_default, 3, LINK_PROCS(fill_keys_default)},
{"mac_default", 11, "Default 4coder bindings on a Mac keyboard", 41, fcoder_submaps_for_mac_default, 3, LINK_PROCS(fill_keys_mac_default)},
{"default", 7, "The default 4coder bindings - typically good for Windows and Linux", 66, fcoder_submaps_for_default, 4, LINK_PROCS(fill_keys_default)},
{"mac_default", 11, "Default 4coder bindings on a Mac keyboard", 41, fcoder_submaps_for_mac_default, 4, LINK_PROCS(fill_keys_mac_default)},
};

View File

@ -1012,7 +1012,7 @@ get_token_or_word_under_pos(Application_Links *app, Buffer_Summary *buffer, int3
static String
build_string(Partition *part, char *s0, char *s1, char *s2){
String sr = {0};
sr.memory_size = str_size(s0) + str_size(s1) + str_size(s2);
sr.memory_size = str_size(s0) + str_size(s1) + str_size(s2) + 1;
sr.str = push_array(part, char, sr.memory_size);
if (sr.str != 0){
append(&sr, s0);
@ -1025,91 +1025,98 @@ build_string(Partition *part, char *s0, char *s1, char *s2){
static String
build_string(Partition *part, char *s0, char *s1, String s2){
String sr = {0};
sr.memory_size = str_size(s0) + str_size(s1) + s2.size;
sr.memory_size = str_size(s0) + str_size(s1) + s2.size + 1;
sr.str = push_array(part, char, sr.memory_size);
if (sr.str != 0){
append(&sr, s0);
append(&sr, s1);
append(&sr, s2);
}
terminate_with_null(&sr);
return(sr);
}
static String
build_string(Partition *part, char *s0, String s1, char *s2){
String sr = {0};
sr.memory_size = str_size(s0) + s1.size + str_size(s2);
sr.memory_size = str_size(s0) + s1.size + str_size(s2) + 1;
sr.str = push_array(part, char, sr.memory_size);
if (sr.str != 0){
append(&sr, s0);
append(&sr, s1);
append(&sr, s2);
}
terminate_with_null(&sr);
return(sr);
}
static String
build_string(Partition *part, char *s0, String s1, String s2){
String sr = {0};
sr.memory_size = str_size(s0) + s1.size + s2.size;
sr.memory_size = str_size(s0) + s1.size + s2.size + 1;
sr.str = push_array(part, char, sr.memory_size);
if (sr.str != 0){
append(&sr, s0);
append(&sr, s1);
append(&sr, s2);
}
terminate_with_null(&sr);
return(sr);
}
static String
build_string(Partition *part, String s0, char *s1, char *s2){
String sr = {0};
sr.memory_size = s0.size + str_size(s1) + str_size(s2);
sr.memory_size = s0.size + str_size(s1) + str_size(s2) + 1;
sr.str = push_array(part, char, sr.memory_size);
if (sr.str != 0){
append(&sr, s0);
append(&sr, s1);
append(&sr, s2);
}
terminate_with_null(&sr);
return(sr);
}
static String
build_string(Partition *part, String s0, char *s1, String s2){
String sr = {0};
sr.memory_size = s0.size + str_size(s1) + s2.size;
sr.memory_size = s0.size + str_size(s1) + s2.size + 1;
sr.str = push_array(part, char, sr.memory_size);
if (sr.str != 0){
append(&sr, s0);
append(&sr, s1);
append(&sr, s2);
}
terminate_with_null(&sr);
return(sr);
}
static String
build_string(Partition *part, String s0, String s1, char *s2){
String sr = {0};
sr.memory_size = s0.size + s1.size + str_size(s2);
sr.memory_size = s0.size + s1.size + str_size(s2) + 1;
sr.str = push_array(part, char, sr.memory_size);
if (sr.str != 0){
append(&sr, s0);
append(&sr, s1);
append(&sr, s2);
}
terminate_with_null(&sr);
return(sr);
}
static String
build_string(Partition *part, String s0, String s1, String s2){
String sr = {0};
sr.memory_size = s0.size + s1.size + s2.size;
sr.memory_size = s0.size + s1.size + s2.size + 1;
sr.str = push_array(part, char, sr.memory_size);
if (sr.str != 0){
append(&sr, s0);
append(&sr, s1);
append(&sr, s2);
}
terminate_with_null(&sr);
return(sr);
}

586
4coder_lists.cpp Normal file
View File

@ -0,0 +1,586 @@
/*
4coder_lists.cpp - List helpers and list commands
such as open file, switch buffer, or kill buffer.
*/
// TOP
CUSTOM_COMMAND_SIG(list_mode__quit)
CUSTOM_DOC("A list mode command that quits the list without executing any actions.")
{
View_Summary view = get_active_view(app, AccessAll);
Lister_State *state = view_get_lister_state(&view);
state->initialized = false;
view_end_ui_mode(app, &view);
}
CUSTOM_COMMAND_SIG(list_mode__activate)
CUSTOM_DOC("A list mode command that activates the list's action on the highlighted item.")
{
View_Summary view = get_active_view(app, AccessAll);
Lister_State *state = view_get_lister_state(&view);
if (state->initialized){
void *user_data = 0;
if (0 <= state->raw_item_index && state->raw_item_index < state->lister.options.count){
user_data = lister_get_user_data(&state->lister, state->raw_item_index);
}
lister_call_activate_handler(app, &global_part, &global_general, &view,
state, user_data, false);
}
}
CUSTOM_COMMAND_SIG(list_mode__write_character__default)
CUSTOM_DOC("A list mode command that inserts a new character to the text field.")
{
Partition *scratch = &global_part;
View_Summary view = get_active_view(app, AccessAll);
Lister_State *state = view_get_lister_state(&view);
if (state->initialized){
User_Input in = get_command_input(app);
uint8_t character[4];
uint32_t length = to_writable_character(in, character);
if (length > 0){
append(&state->lister.text_field, make_string(character, length));
append(&state->lister.key_string, make_string(character, length));
state->item_index = 0;
view_zero_scroll(app, &view);
lister_update_ui(app, scratch, &view, state);
}
}
}
CUSTOM_COMMAND_SIG(list_mode__backspace_text_field__default)
CUSTOM_DOC("A list mode command that backspaces one character from the text field.")
{
Partition *scratch = &global_part;
View_Summary view = get_active_view(app, AccessAll);
Lister_State *state = view_get_lister_state(&view);
if (state->initialized){
backspace_utf8(&state->lister.text_field);
backspace_utf8(&state->lister.key_string);
state->item_index = 0;
view_zero_scroll(app, &view);
lister_update_ui(app, scratch, &view, state);
}
}
CUSTOM_COMMAND_SIG(list_mode__move_up__default)
CUSTOM_DOC("A list mode command that moves the highlighted item one up in the list.")
{
Partition *scratch = &global_part;
View_Summary view = get_active_view(app, AccessAll);
Lister_State *state = view_get_lister_state(&view);
if (state->initialized){
state->item_index = state->item_index - 1;
if (state->item_index < 0){
state->item_index = state->option_item_count - 1;
}
state->set_view_vertical_focus_to_item = true;
lister_update_ui(app, scratch, &view, state);
}
}
CUSTOM_COMMAND_SIG(list_mode__move_down__default)
CUSTOM_DOC("A list mode command that moves the highlighted item one down in the list.")
{
Partition *scratch = &global_part;
View_Summary view = get_active_view(app, AccessAll);
Lister_State *state = view_get_lister_state(&view);
if (state->initialized){
state->item_index = state->item_index + 1;
if (state->item_index > state->option_item_count - 1){
state->item_index = 0;
}
state->set_view_vertical_focus_to_item = true;
lister_update_ui(app, scratch, &view, state);
}
}
CUSTOM_COMMAND_SIG(list_mode__write_character__file_path)
CUSTOM_DOC("A list mode command that inserts a new character to the text field.")
{
Partition *scratch = &global_part;
View_Summary view = get_active_view(app, AccessAll);
Lister_State *state = view_get_lister_state(&view);
if (state->initialized){
User_Input in = get_command_input(app);
uint8_t character[4];
uint32_t length = to_writable_character(in, character);
if (length > 0){
append(&state->lister.text_field, make_string(character, length));
copy(&state->lister.key_string, front_of_directory(state->lister.text_field));
if (character[0] == '/' || character[0] == '\\'){
String new_hot = state->lister.text_field;
directory_set_hot(app, new_hot.str, new_hot.size);
lister_call_refresh_handler(app, &state->arena, &state->lister);
}
state->item_index = 0;
view_zero_scroll(app, &view);
lister_update_ui(app, scratch, &view, state);
}
}
}
CUSTOM_COMMAND_SIG(list_mode__backspace_text_field__file_path)
CUSTOM_DOC("A list mode command that backspaces one character from the text field.")
{
Partition *scratch = &global_part;
View_Summary view = get_active_view(app, AccessAll);
Lister_State *state = view_get_lister_state(&view);
if (state->initialized){
if (state->lister.text_field.size > 0){
char last_char = state->lister.text_field.str[state->lister.text_field.size - 1];
backspace_utf8(&state->lister.text_field);
if (last_char == '/' || last_char == '\\'){
User_Input input = get_command_input(app);
bool32 is_modified =
input.key.modifiers[MDFR_SHIFT_INDEX] ||
input.key.modifiers[MDFR_CONTROL_INDEX] ||
input.key.modifiers[MDFR_ALT_INDEX] ||
input.key.modifiers[MDFR_COMMAND_INDEX];
String new_hot = path_of_directory(state->lister.text_field);
if (!is_modified){
state->lister.text_field.size = new_hot.size;
}
directory_set_hot(app, new_hot.str, new_hot.size);
lister_call_refresh_handler(app, &state->arena, &state->lister);
}
else{
copy(&state->lister.key_string, front_of_directory(state->lister.text_field));
}
state->item_index = 0;
view_zero_scroll(app, &view);
lister_update_ui(app, scratch, &view, state);
}
}
}
CUSTOM_COMMAND_SIG(list_mode__write_character)
CUSTOM_DOC("A list mode command that inserts a new character to the text field.")
{
View_Summary view = get_active_view(app, AccessAll);
Lister_State *state = view_get_lister_state(&view);
if (state->lister.write_character != 0){
state->lister.write_character(app);
}
}
CUSTOM_COMMAND_SIG(list_mode__backspace_text_field)
CUSTOM_DOC("A list mode command that backspaces one character from the text field.")
{
View_Summary view = get_active_view(app, AccessAll);
Lister_State *state = view_get_lister_state(&view);
if (state->lister.backspace != 0){
state->lister.backspace(app);
}
}
CUSTOM_COMMAND_SIG(list_mode__move_up)
CUSTOM_DOC("A list mode command that moves the highlighted item one up in the list.")
{
View_Summary view = get_active_view(app, AccessAll);
Lister_State *state = view_get_lister_state(&view);
if (state->lister.navigate_up != 0){
state->lister.navigate_up(app);
}
}
CUSTOM_COMMAND_SIG(list_mode__move_down)
CUSTOM_DOC("A list mode command that moves the highlighted item one down in the list.")
{
View_Summary view = get_active_view(app, AccessAll);
Lister_State *state = view_get_lister_state(&view);
if (state->lister.navigate_down != 0){
state->lister.navigate_down(app);
}
}
CUSTOM_COMMAND_SIG(list_mode__wheel_scroll)
CUSTOM_DOC("A list mode command that scrolls the list in response to the mouse wheel.")
{
Partition *scratch = &global_part;
View_Summary view = get_active_view(app, AccessAll);
GUI_Scroll_Vars scroll = view.scroll_vars;
Mouse_State mouse = get_mouse_state(app);
scroll.target_y += mouse.wheel;
view_set_scroll(app, &view, scroll);
Lister_State *state = view_get_lister_state(&view);
if (state->initialized){
lister_update_ui(app, scratch, &view, state);
}
}
CUSTOM_COMMAND_SIG(list_mode__mouse_press)
CUSTOM_DOC("A list mode command that beings a click interaction with a list item under the mouse.")
{
Partition *scratch = &global_part;
View_Summary view = get_active_view(app, AccessAll);
Lister_State *state = view_get_lister_state(&view);
if (state->initialized){
UI_Item clicked = lister_get_clicked_item(app, &view, scratch);
state->hot_user_data = clicked.user_data;
}
}
CUSTOM_COMMAND_SIG(list_mode__mouse_release)
CUSTOM_DOC("A list mode command that ends a click interaction with a list item under the mouse, possibly activating it.")
{
Partition *scratch = &global_part;
View_Summary view = get_active_view(app, AccessAll);
Lister_State *state = view_get_lister_state(&view);
if (state->initialized && state->hot_user_data != 0){
UI_Item clicked = lister_get_clicked_item(app, &view, scratch);
if (state->hot_user_data == clicked.user_data){
lister_call_activate_handler(app, &global_part, &global_general, &view,
state, clicked.user_data, true);
}
}
state->hot_user_data = 0;
}
CUSTOM_COMMAND_SIG(list_mode__repaint)
CUSTOM_DOC("A list mode command that updates the lists UI data.")
{
Partition *scratch = &global_part;
View_Summary view = get_active_view(app, AccessAll);
Lister_State *state = view_get_lister_state(&view);
if (state->initialized){
lister_update_ui(app, scratch, &view, state);
}
}
////////////////////////////////
static void
list_mode_use_default_handlers(Lister *lister){
lister->write_character = list_mode__write_character__default;
lister->backspace = list_mode__backspace_text_field__default;
lister->navigate_up = list_mode__move_up__default;
lister->navigate_down = list_mode__move_down__default;
}
static void
generate_all_buffers_list(Application_Links *app, Partition *arena, Lister *lister){
lister_begin_new_item_set(lister);
for (Buffer_Summary buffer = get_buffer_first(app, AccessAll);
buffer.exists;
get_buffer_next(app, &buffer, AccessAll)){
String buffer_name = make_string(buffer.buffer_name, buffer.buffer_name_len);
Dirty_State dirty = buffer.dirty;
int32_t buffer_id = buffer.buffer_id;
String status = {0};
switch (dirty){
case DirtyState_UnsavedChanges: status = make_lit_string(" *"); break;
case DirtyState_UnloadedChanges: status = make_lit_string(" !"); break;
}
lister_add_item(arena, lister, buffer_name, status, (void*)buffer_id);
}
}
static void
generate_hot_directory_file_list(Application_Links *app, Partition *arena, Lister *lister){
{
Temp_Memory temp = begin_temp_memory(arena);
String hot = get_hot_directory(app, arena);
if (hot.str[hot.size - 1] != '/' &&
hot.str[hot.size - 1] != '\\'){
append_s_char(&hot, '/');
}
lister_set_text_field_string(lister, hot);
lister_set_key_string(lister, front_of_directory(hot));
end_temp_memory(temp);
}
lister_begin_new_item_set(lister);
Temp_Memory temp = begin_temp_memory(arena);
String hot = get_hot_directory(app, arena);
File_List file_list = {0};
if (hot.str != 0){
file_list = get_file_list(app, hot.str, hot.size);
}
end_temp_memory(temp);
if (hot.str != 0){
for (File_Info *info = file_list.infos, *one_past_last = file_list.infos + file_list.count;
info < one_past_last;
info += 1){
if (!info->folder) continue;
String file_name = build_string(arena,
make_string(info->filename, info->filename_len),
"/", "");
String status = make_lit_string("");
lister_add_item(arena, lister, lister_prealloced(file_name), status, file_name.str);
}
for (File_Info *info = file_list.infos, *one_past_last = file_list.infos + file_list.count;
info < one_past_last;
info += 1){
if (info->folder) continue;
String file_name = push_string_copy(arena, make_string(info->filename, info->filename_len));
char *is_loaded = "";
char *status_flag = "";
Buffer_Summary buffer = get_buffer_by_file_name(app,
info->filename, info->filename_len,
AccessAll);
if (buffer.exists){
is_loaded = " LOADED";
switch (buffer.dirty){
case DirtyState_UnsavedChanges: status_flag = " *"; break;
case DirtyState_UnloadedChanges: status_flag = " !"; break;
}
}
String status = build_string(arena, is_loaded, status_flag, "");
lister_add_item(arena, lister, lister_prealloced(file_name), lister_prealloced(status), file_name.str);
}
free_file_list(app, file_list);
}
}
static Lister_Activation_Code
activate_switch_buffer(Application_Links *app, View_Summary *view, String text_field,
void *user_data, bool32 activated_by_mouse){
if (user_data != 0){
Buffer_ID buffer_id = (Buffer_ID)(user_data);
view_set_buffer(app, view, buffer_id, SetBuffer_KeepOriginalGUI);
}
return(ListerActivation_Finished);
}
CUSTOM_COMMAND_SIG(interactive_switch_buffer)
CUSTOM_DOC("Interactively switch to an open buffer.")
{
Partition *scratch = &global_part;
View_Summary view = get_active_view(app, AccessAll);
for (;view_end_ui_mode(app, &view););
view_start_ui_mode(app, &view);
view_set_setting(app, &view, ViewSetting_UICommandMap, default_lister_ui_map);
Lister_State *state = view_get_lister_state(&view);
init_lister_state(state, &global_general);
lister_first_init(&state->lister);
lister_set_query_string(&state->lister, "Switch: ");
list_mode_use_default_handlers(&state->lister);
state->lister.activate = activate_switch_buffer;
state->lister.refresh = generate_all_buffers_list;
generate_all_buffers_list(app, &state->arena, &state->lister);
lister_update_ui(app, scratch, &view, state);
}
static Lister_Activation_Code
activate_kill_buffer(Application_Links *app, View_Summary *view, String text_field,
void *user_data, bool32 activated_by_mouse){
if (user_data != 0){
Buffer_ID buffer_id = (Buffer_ID)(user_data);
kill_buffer(app, buffer_identifier(buffer_id), view->view_id, 0);
}
return(ListerActivation_Finished);
}
CUSTOM_COMMAND_SIG(interactive_kill_buffer)
CUSTOM_DOC("Interactively kill an open buffer.")
{
Partition *scratch = &global_part;
View_Summary view = get_active_view(app, AccessAll);
for (;view_end_ui_mode(app, &view););
view_start_ui_mode(app, &view);
view_set_setting(app, &view, ViewSetting_UICommandMap, default_lister_ui_map);
Lister_State *state = view_get_lister_state(&view);
init_lister_state(state, &global_general);
lister_first_init(&state->lister);
lister_set_query_string(&state->lister, "Kill: ");
list_mode_use_default_handlers(&state->lister);
state->lister.activate = activate_kill_buffer;
state->lister.refresh = generate_all_buffers_list;
generate_all_buffers_list(app, &state->arena, &state->lister);
lister_update_ui(app, scratch, &view, state);
}
static Lister_Activation_Code
activate_open_or_new(Application_Links *app, View_Summary *view, String text_field,
void *user_data, bool32 activated_by_mouse){
Partition *scratch = &global_part;
Lister_Activation_Code result = 0;
Temp_Memory temp = begin_temp_memory(scratch);
String file_name = {0};
if (user_data == 0){
file_name = text_field;
}
else{
file_name = make_string_slowly((char*)user_data);
}
if (file_name.size == 0){
result = ListerActivation_Finished;
}
else{
String full_file_name = get_hot_directory(app, scratch);
if (full_file_name.str[full_file_name.size - 1] != '/' &&
full_file_name.str[full_file_name.size - 1] != '\\'){
full_file_name = build_string(scratch, full_file_name, "/", file_name);
}
else{
full_file_name = build_string(scratch, full_file_name, "", file_name);
}
if (file_name.str[file_name.size - 1] == '/' && user_data != 0){
directory_set_hot(app, full_file_name.str, full_file_name.size);
result = ListerActivation_ContinueAndRefresh;
}
else{
Buffer_Summary buffer = create_buffer(app, full_file_name.str, full_file_name.size, 0);
if (buffer.exists){
view_set_buffer(app, view, buffer.buffer_id, SetBuffer_KeepOriginalGUI);
}
result = ListerActivation_Finished;
}
}
end_temp_memory(temp);
return(result);
}
CUSTOM_COMMAND_SIG(interactive_open_or_new)
CUSTOM_DOC("Interactively open a file out of the file system.")
{
Partition *scratch = &global_part;
View_Summary view = get_active_view(app, AccessAll);
for (;view_end_ui_mode(app, &view););
view_start_ui_mode(app, &view);
view_set_setting(app, &view, ViewSetting_UICommandMap, default_lister_ui_map);
Lister_State *state = view_get_lister_state(&view);
init_lister_state(state, &global_general);
lister_first_init(&state->lister);
lister_set_query_string(&state->lister, "Open: ");
list_mode_use_default_handlers(&state->lister);
state->lister.write_character = list_mode__write_character__file_path;
state->lister.backspace = list_mode__backspace_text_field__file_path;
state->lister.activate = activate_open_or_new;
state->lister.refresh = generate_hot_directory_file_list;
generate_hot_directory_file_list(app, &state->arena, &state->lister);
lister_update_ui(app, scratch, &view, state);
}
static Lister_Activation_Code
activate_new(Application_Links *app, View_Summary *view, String text_field,
void *user_data, bool32 activated_by_mouse){
Partition *scratch = &global_part;
Lister_Activation_Code result = 0;
Temp_Memory temp = begin_temp_memory(scratch);
String file_name = front_of_directory(text_field);
bool32 is_folder = false;
if (user_data != 0){
String item_name = make_string_slowly((char*)user_data);
if (item_name.str[item_name.size - 1] == '/'){
file_name = item_name;
is_folder = true;
}
else if (activated_by_mouse){
file_name = item_name;
}
}
if (file_name.size == 0){
result = ListerActivation_Finished;
}
else{
String full_file_name = get_hot_directory(app, scratch);
if (full_file_name.str[full_file_name.size - 1] != '/' &&
full_file_name.str[full_file_name.size - 1] != '\\'){
full_file_name = build_string(scratch, full_file_name, "/", file_name);
}
else{
full_file_name = build_string(scratch, full_file_name, "", file_name);
}
if (is_folder){
directory_set_hot(app, full_file_name.str, full_file_name.size);
result = ListerActivation_ContinueAndRefresh;
}
else{
Buffer_Summary buffer = create_buffer(app, full_file_name.str, full_file_name.size, BufferCreate_AlwaysNew);
if (buffer.exists){
view_set_buffer(app, view, buffer.buffer_id, SetBuffer_KeepOriginalGUI);
}
result = ListerActivation_Finished;
}
}
end_temp_memory(temp);
return(result);
}
CUSTOM_COMMAND_SIG(interactive_new)
CUSTOM_DOC("Interactively creates a new file.")
{
Partition *scratch = &global_part;
View_Summary view = get_active_view(app, AccessAll);
for (;view_end_ui_mode(app, &view););
view_start_ui_mode(app, &view);
view_set_setting(app, &view, ViewSetting_UICommandMap, default_lister_ui_map);
Lister_State *state = view_get_lister_state(&view);
init_lister_state(state, &global_general);
lister_first_init(&state->lister);
lister_set_query_string(&state->lister, "New: ");
list_mode_use_default_handlers(&state->lister);
state->lister.write_character = list_mode__write_character__file_path;
state->lister.backspace = list_mode__backspace_text_field__file_path;
state->lister.activate = activate_new;
state->lister.refresh = generate_hot_directory_file_list;
generate_hot_directory_file_list(app, &state->arena, &state->lister);
lister_update_ui(app, scratch, &view, state);
}
static Lister_Activation_Code
activate_open(Application_Links *app, View_Summary *view, String text_field,
void *user_data, bool32 activated_by_mouse){
Partition *scratch = &global_part;
Lister_Activation_Code result = 0;
Temp_Memory temp = begin_temp_memory(scratch);
String file_name = {0};
if (user_data != 0){
file_name = make_string_slowly((char*)user_data);
}
if (file_name.size == 0){
result = ListerActivation_Finished;
}
else{
String full_file_name = get_hot_directory(app, scratch);
if (full_file_name.str[full_file_name.size - 1] != '/' &&
full_file_name.str[full_file_name.size - 1] != '\\'){
full_file_name = build_string(scratch, full_file_name, "/", file_name);
}
else{
full_file_name = build_string(scratch, full_file_name, "", file_name);
}
if (file_name.str[file_name.size - 1] == '/' && user_data != 0){
directory_set_hot(app, full_file_name.str, full_file_name.size);
result = ListerActivation_ContinueAndRefresh;
}
else{
Buffer_Summary buffer = create_buffer(app, full_file_name.str, full_file_name.size, 0);
if (buffer.exists){
view_set_buffer(app, view, buffer.buffer_id, SetBuffer_KeepOriginalGUI);
}
result = ListerActivation_Finished;
}
}
end_temp_memory(temp);
return(result);
}
CUSTOM_COMMAND_SIG(interactive_open)
CUSTOM_DOC("Interactively opens a file.")
{
Partition *scratch = &global_part;
View_Summary view = get_active_view(app, AccessAll);
for (;view_end_ui_mode(app, &view););
view_start_ui_mode(app, &view);
view_set_setting(app, &view, ViewSetting_UICommandMap, default_lister_ui_map);
Lister_State *state = view_get_lister_state(&view);
init_lister_state(state, &global_general);
lister_first_init(&state->lister);
lister_set_query_string(&state->lister, "Open: ");
list_mode_use_default_handlers(&state->lister);
state->lister.write_character = list_mode__write_character__file_path;
state->lister.backspace = list_mode__backspace_text_field__file_path;
state->lister.activate = activate_open;
state->lister.refresh = generate_hot_directory_file_list;
generate_hot_directory_file_list(app, &state->arena, &state->lister);
lister_update_ui(app, scratch, &view, state);
}
// BOTTOM

View File

@ -13,58 +13,477 @@ ui_list_add_item(Partition *arena, UI_List *list, UI_Item item){
return(&node->fixed);
}
static i32_Rect
ui__rect_union(i32_Rect a, i32_Rect b){
if (b.x1 > b.x0 && b.y1 > b.y0){
if (a.x0 > b.x0){
a.x0 = b.x0;
}
if (a.x1 < b.x1){
a.x1 = b.x1;
}
if (a.y0 > b.y0){
a.y0 = b.y0;
}
if (a.y1 < b.y1){
a.y1 = b.y1;
}
}
return(a);
}
static UI_Control
ui_list_to_ui_control(Partition *arena, UI_List *list){
UI_Control control = {0};
control.items = push_array(arena, UI_Item, list->count);
if (list->count > 0){
control.bounding_box = list->first->fixed.rectangle;
i32_Rect neg_inf_rect = {0};
neg_inf_rect.x0 = INT32_MAX;
neg_inf_rect.y0 = INT32_MAX;
neg_inf_rect.x1 = INT32_MIN;
neg_inf_rect.y1 = INT32_MIN;
for (uint32_t i = 0; i < UICoordinates_COUNT; ++i){
control.bounding_box[i] = neg_inf_rect;
}
for (UI_Item_Node *node = list->first;
node != 0;
node = node->next){
control.items[control.count++] = node->fixed;
if (control.bounding_box.x0 > node->fixed.rectangle.x0){
control.bounding_box.x0 = node->fixed.rectangle.x0;
}
if (control.bounding_box.x1 < node->fixed.rectangle.x1){
control.bounding_box.x1 = node->fixed.rectangle.x1;
}
if (control.bounding_box.y0 > node->fixed.rectangle.y0){
control.bounding_box.y0 = node->fixed.rectangle.y0;
}
if (control.bounding_box.y1 < node->fixed.rectangle.y1){
control.bounding_box.y1 = node->fixed.rectangle.y1;
UI_Item *item = &control.items[control.count++];
*item = node->fixed;
if (item->coordinates >= UICoordinates_COUNT){
item->coordinates = UICoordinates_Scrolled;
}
control.bounding_box[item->coordinates] = ui__rect_union(control.bounding_box[item->coordinates], item->rectangle);
}
return(control);
}
static void
ui_control_set_top(UI_Control *control, int32_t top_y){
control->bounding_box.y0 = top_y;
control->bounding_box[UICoordinates_Scrolled].y0 = top_y;
}
static void
ui_control_set_bottom(UI_Control *control, int32_t bottom_y){
control->bounding_box.y1 = bottom_y;
control->bounding_box[UICoordinates_Scrolled].y1 = bottom_y;
}
static UI_Item*
ui_control_get_mouse_hit(UI_Control *control, int32_t mx, int32_t my){
if (control->bounding_box.x0 <= mx && mx < control->bounding_box.x1 &&
control->bounding_box.y0 <= my && my < control->bounding_box.y1){
int32_t count = control->count;
UI_Item *item = control->items + count - 1;
for (int32_t i = 0; i < count; ++i, item -= 1){
i32_Rect r = item->rectangle;
if (r.x0 <= mx && mx < r.x1 && r.y0 <= my && my < r.y1){
return(item);
}
ui_control_get_mouse_hit(UI_Control *control,
int32_t mx_scrolled, int32_t my_scrolled,
int32_t mx_unscrolled, int32_t my_unscrolled){
int32_t count = control->count;
UI_Item *item = control->items + count - 1;
for (int32_t i = 0; i < count; ++i, item -= 1){
i32_Rect r = item->rectangle;
switch (item->coordinates){
case UICoordinates_Scrolled:
{
if (r.x0 <= mx_scrolled && mx_scrolled < r.x1 && r.y0 <= my_scrolled && my_scrolled < r.y1){
return(item);
}
}break;
case UICoordinates_ViewRelative:
{
if (r.x0 <= mx_unscrolled && mx_unscrolled < r.x1 && r.y0 <= my_unscrolled && my_unscrolled < r.y1){
return(item);
}
}break;
}
}
return(0);
}
////////////////////////////////
static void
view_zero_scroll(Application_Links *app, View_Summary *view){
GUI_Scroll_Vars zero_scroll = {0};
view_set_scroll(app, view, zero_scroll);
}
static void
view_set_vertical_focus(Application_Links *app, View_Summary *view,
int32_t y_top, int32_t y_bot){
GUI_Scroll_Vars scroll = view->scroll_vars;
int32_t view_y_top = scroll.target_y;
int32_t view_y_dim = view->file_region.y1 - view->file_region.y0;
int32_t view_y_bot = view_y_top + view_y_dim;
int32_t line_dim = (int32_t)view->line_height;
int32_t hot_y_top = view_y_top + line_dim*3;
int32_t hot_y_bot = view_y_bot - line_dim*3;
if (hot_y_bot - hot_y_top < line_dim*6){
int32_t quarter_view_y_dim = view_y_dim/4;
hot_y_top = view_y_top + quarter_view_y_dim;
hot_y_bot = view_y_bot - quarter_view_y_dim;
}
int32_t hot_y_dim = hot_y_bot - hot_y_top;
int32_t skirt_dim = hot_y_top - view_y_top;
int32_t y_dim = y_bot - y_top;
if (y_dim > hot_y_dim){
scroll.target_y = y_top - skirt_dim;
view_set_scroll(app, view, scroll);
}
else{
if (y_top < hot_y_top){
scroll.target_y = y_top - skirt_dim;
view_set_scroll(app, view, scroll);
}
else if (y_bot > hot_y_bot){
scroll.target_y = y_bot + skirt_dim - view_y_dim;
view_set_scroll(app, view, scroll);
}
}
}
static void
get_view_relative_points(int32_t x_window, int32_t y_window, View_Summary view,
int32_t *x_scrolled_out, int32_t *y_scrolled_out,
int32_t *x_view_out, int32_t *y_view_out){
int32_t x = x_window - view.file_region.x0;
int32_t y = y_window - view.file_region.y0;
if (x_scrolled_out != 0 && y_scrolled_out != 0){
*x_scrolled_out = x + (int32_t)view.scroll_vars.scroll_x;
*y_scrolled_out = y + (int32_t)view.scroll_vars.scroll_y;
}
if (x_view_out != 0 && y_view_out != 0){
*x_view_out = x;
*y_view_out = y;
}
}
static void
get_view_relative_points_x(int32_t x_window, View_Summary view, int32_t *x_scrolled_out, int32_t *x_view_out){
int32_t y_ignore = 0;
get_view_relative_points(x_window, y_ignore, view,
x_scrolled_out, &y_ignore, x_view_out, &y_ignore);
}
static void
get_view_relative_points_y(int32_t y_window, View_Summary view, int32_t *y_scrolled_out, int32_t *y_view_out){
int32_t x_ignore = 0;
get_view_relative_points(x_ignore, y_window, view,
&x_ignore, y_scrolled_out, &x_ignore, y_view_out);
}
static void
get_view_relative_mouse_positions(Mouse_State mouse, View_Summary view,
int32_t *x_scrolled_out, int32_t *y_scrolled_out,
int32_t *x_view_out, int32_t *y_view_out){
get_view_relative_points(mouse.x, mouse.y, view,
x_scrolled_out, y_scrolled_out,
x_view_out, y_view_out);
}
static void
get_view_relative_mouse_positions(Application_Links *app, View_Summary view,
int32_t *x_scrolled_out, int32_t *y_scrolled_out,
int32_t *x_view_out, int32_t *y_view_out){
get_view_relative_mouse_positions(get_mouse_state(app), view,
x_scrolled_out, y_scrolled_out,
x_view_out, y_view_out);
}
////////////////////////////////
Lister_State global_lister_state_[16] = {};
Lister_State *global_lister_state = global_lister_state_ - 1;
static Lister_State*
view_get_lister_state(View_Summary *view){
return(&global_lister_state[view->view_id]);
}
static void
init_lister_state(Lister_State *state, General_Memory *general){
state->initialized = true;
state->hot_user_data = 0;
state->item_index = 0;
state->set_view_vertical_focus_to_item = false;
state->option_item_count = 0;
if (state->arena.base != 0){
general_memory_free(general, state->arena.base);
}
int32_t arena_size = (64 << 10);
state->arena = make_part(general_memory_allocate(general, arena_size), arena_size);
memset(&state->lister, 0, sizeof(state->lister));
}
static UI_Item
lister_get_clicked_item(Application_Links *app, View_Summary *view, Partition *scratch){
Temp_Memory temp = begin_temp_memory(scratch);
UI_Control control = view_get_ui_copy(app, view, scratch);
Mouse_State mouse = get_mouse_state(app);
int32_t mxs = 0;
int32_t mys = 0;
int32_t mxu = 0;
int32_t myu = 0;
get_view_relative_mouse_positions(mouse, *view, &mxs, &mys, &mxu, &myu);
UI_Item *clicked = ui_control_get_mouse_hit(&control, mxs, mys, mxu, myu);
UI_Item result = {0};
if (clicked != 0){
result = *clicked;
}
end_temp_memory(temp);
return(result);
}
static void
lister_update_ui(Application_Links *app, Partition *scratch, View_Summary *view,
Lister_State *state){
int32_t x0 = 0;
int32_t x1 = view->view_region.x1 - view->view_region.x0;
int32_t line_height = (int32_t)view->line_height;
int32_t block_height = line_height*2;
Temp_Memory full_temp = begin_temp_memory(scratch);
int32_t mx = 0;
int32_t my = 0;
refresh_view(app, view);
get_view_relative_mouse_positions(app, *view, &mx, &my, 0, 0);
int32_t y_pos = line_height;
state->raw_item_index = -1;
UI_List list = {0};
UI_Item *highlighted_item = 0;
UI_Item *hot_item = 0;
UI_Item *hovered_item = 0;
int32_t item_index_counter = 0;
int32_t raw_index_counter = 0;
for (Lister_Option_Node *node = state->lister.options.first;
node != 0;
node = node->next){
if (state->lister.key_string.size == 0 ||
has_substr(node->string, state->lister.key_string)){
i32_Rect item_rect = {0};
item_rect.x0 = x0;
item_rect.y0 = y_pos;
item_rect.x1 = x1;
item_rect.y1 = y_pos + block_height;
y_pos = item_rect.y1;
UI_Item item = {0};
item.type = UIType_Option;
item.activation_level = UIActivation_None;
item.coordinates = UICoordinates_Scrolled;
item.string = node->string;
item.status = node->status;
item.user_data = node->user_data;
item.rectangle = item_rect;
UI_Item *item_ptr = ui_list_add_item(scratch, &list, item);
if (item_rect.x0 <= mx && mx < item_rect.x1 &&
item_rect.y0 <= my && my < item_rect.y1){
hovered_item = item_ptr;
}
if (item_index_counter == state->item_index){
highlighted_item = item_ptr;
state->raw_item_index = raw_index_counter;
}
item_index_counter += 1;
if (node->user_data == state->hot_user_data && hot_item != 0){
hot_item = item_ptr;
}
}
raw_index_counter += 1;
}
state->option_item_count = item_index_counter;
if (hovered_item != 0){
hovered_item->activation_level = UIActivation_Hover;
}
if (hot_item != 0){
if (hot_item == hovered_item){
hot_item->activation_level = UIActivation_Active;
}
else{
hot_item->activation_level = UIActivation_Hover;
}
}
if (highlighted_item != 0){
highlighted_item->activation_level = UIActivation_Active;
}
if (state->set_view_vertical_focus_to_item){
if (highlighted_item != 0){
view_set_vertical_focus(app, view,
highlighted_item->rectangle.y0, highlighted_item->rectangle.y1);
}
state->set_view_vertical_focus_to_item = false;
}
{
i32_Rect item_rect = {0};
item_rect.x0 = x0;
item_rect.y0 = 0;
item_rect.x1 = x1;
item_rect.y1 = item_rect.y0 + line_height;
y_pos = item_rect.y1;
UI_Item item = {0};
item.type = UIType_TextField;
item.activation_level = UIActivation_Active;
item.coordinates = UICoordinates_ViewRelative;
item.query = state->lister.query;
item.string = state->lister.text_field;
item.user_data = 0;
item.rectangle = item_rect;
ui_list_add_item(scratch, &list, item);
}
UI_Control control = ui_list_to_ui_control(scratch, &list);
view_set_ui(app, view, &control);
end_temp_memory(full_temp);
}
static Lister_Prealloced_String
lister_prealloced(String string){
Lister_Prealloced_String result = {0};
result.string = string;
return(result);
}
static void
lister_first_init(Lister *lister){
memset(lister, 0, sizeof(*lister));
lister->query = make_fixed_width_string(lister->query_space);
lister->text_field = make_fixed_width_string(lister->text_field_space);
lister->key_string = make_fixed_width_string(lister->key_string_space);
}
static void
lister_begin_new_item_set(Lister *lister){
memset(&lister->options, 0, sizeof(lister->options));
}
static void
lister_add_item(Partition *arena, Lister *lister,
Lister_Prealloced_String string, Lister_Prealloced_String status,
void *user_data){
Lister_Option_Node *node = push_array(arena, Lister_Option_Node, 1);
node->string = string.string;
node->status = status.string;
node->user_data = user_data;
zdll_push_back(lister->options.first, lister->options.last, node);
lister->options.count += 1;
}
static void
lister_add_item(Partition *arena, Lister *lister,
Lister_Prealloced_String string, String status,
void *user_data){
lister_add_item(arena, lister,
string,
lister_prealloced(push_string_copy(arena, status)),
user_data);
}
static void
lister_add_item(Partition *arena, Lister *lister,
String string, Lister_Prealloced_String status,
void *user_data){
lister_add_item(arena, lister,
lister_prealloced(push_string_copy(arena, string)),
status,
user_data);
}
static void
lister_add_item(Partition *arena, Lister *lister,
String string, String status,
void *user_data){
lister_add_item(arena, lister,
lister_prealloced(push_string_copy(arena, string)),
lister_prealloced(push_string_copy(arena, status)),
user_data);
}
static void*
lister_get_user_data(Lister *lister, int32_t index){
if (0 <= index && index < lister->options.count){
int32_t counter = 0;
for (Lister_Option_Node *node = lister->options.first;
node != 0;
node = node->next){
if (counter == index){
return(node->user_data);
}
counter += 1;
}
}
return(0);
}
static void
lister_call_refresh_handler(Application_Links *app, Partition *arena, Lister *lister){
if (lister->refresh != 0){
arena->pos = 0;
lister->refresh(app, arena, lister);
}
}
static void
lister_call_activate_handler(Application_Links *app, Partition *scratch, General_Memory *general,
View_Summary *view, Lister_State *state,
void *user_data, bool32 activated_by_mouse){
Lister *lister = &state->lister;
Lister_Activation_Code code = ListerActivation_Finished;
if (lister->activate != 0){
code = lister->activate(app, view, lister->text_field, user_data, activated_by_mouse);
}
switch (code){
case ListerActivation_Finished:
{
state->initialized = false;
view_end_ui_mode(app, view);
if (state->arena.base != 0){
general_memory_free(general, state->arena.base);
memset(&state->arena, 0, sizeof(state->arena));
}
}break;
case ListerActivation_ContinueAndRefresh:
{
state->item_index = 0;
lister_call_refresh_handler(app, &state->arena, lister);
lister_update_ui(app, scratch, view, state);
}break;
}
}
static void
lister_set_query_string(Lister *lister, char *string){
copy(&lister->query, string);
}
static void
lister_set_query_string(Lister *lister, String string){
copy(&lister->query, string);
}
static void
lister_set_text_field_string(Lister *lister, char *string){
copy(&lister->text_field, string);
}
static void
lister_set_text_field_string(Lister *lister, String string){
copy(&lister->text_field, string);
}
static void
lister_set_key_string(Lister *lister, char *string){
copy(&lister->key_string, string);
}
static void
lister_set_key_string(Lister *lister, String string){
copy(&lister->key_string, string);
}
// BOTTOM

74
4coder_ui_helper.h Normal file
View File

@ -0,0 +1,74 @@
/*
* Helpers for ui data structures.
*/
// TOP
#if !defined(FCODER_UI_HELPER_H)
#define FCODER_UI_HELPER_H
typedef int32_t Lister_Activation_Code;
enum{
ListerActivation_Finished = 0,
ListerActivation_Continue = 1,
ListerActivation_ContinueAndRefresh = 2,
};
typedef Lister_Activation_Code Lister_Activation_Function_Type(Application_Links *app, View_Summary *view,
String text_field, void *user_data, bool32 activated_by_mouse);
typedef void Lister_Regenerate_List_Function_Type(Application_Links *app, Partition *arena, struct Lister *lister);
struct Lister_Option_Node{
Lister_Option_Node *next;
Lister_Option_Node *prev;
String string;
String status;
void *user_data;
};
struct Lister_Option_List{
Lister_Option_Node *first;
Lister_Option_Node *last;
int32_t count;
};
struct Lister{
// Event Handlers
Lister_Activation_Function_Type *activate;
Lister_Regenerate_List_Function_Type *refresh;
Custom_Command_Function *write_character;
Custom_Command_Function *backspace;
Custom_Command_Function *navigate_up;
Custom_Command_Function *navigate_down;
void *user_data;
// List Data
char query_space[256];
String query;
char text_field_space[256];
String text_field;
char key_string_space[256];
String key_string;
Lister_Option_List options;
};
struct Lister_Prealloced_String{
String string;
};
struct Lister_State{
bool32 initialized;
void *hot_user_data;
int32_t item_index;
int32_t raw_item_index;
bool32 set_view_vertical_focus_to_item;
int32_t option_item_count;
Partition arena;
Lister lister;
};
#endif
// BOTTOM

106
4ed.cpp
View File

@ -194,7 +194,6 @@ panel_make_empty(System_Functions *system, Models *models, Panel *panel){
Assert(panel->view == 0);
View_And_ID new_view = live_set_alloc_view(&models->mem.general, &models->live_set, panel);
view_set_file(system, models, new_view.view, models->scratch_buffer);
new_view.view->transient.map = models->scratch_buffer->settings.base_map_id;
return(new_view.view);
}
@ -1430,7 +1429,7 @@ App_Step_Sig(app_step){
// NOTE(allen): prepare input information
{
if (models->input_filter){
if (models->input_filter != 0){
models->input_filter(&input->mouse);
}
@ -1452,6 +1451,22 @@ App_Step_Sig(app_step){
mouse_event.keycode = key_mouse_right_release;
input->keys.keys[input->keys.count++] = mouse_event;
}
if (input->mouse.wheel != 0){
mouse_event.keycode = key_mouse_wheel;
input->keys.keys[input->keys.count++] = mouse_event;
}
if (input->mouse.x != models->prev_x &&
input->mouse.y != models->prev_y){
mouse_event.keycode = key_mouse_move;
input->keys.keys[input->keys.count++] = mouse_event;
}
if (models->animated_last_frame){
mouse_event.keycode = key_animate;
input->keys.keys[input->keys.count++] = mouse_event;
}
}
// NOTE(allen): detect mouse hover status
@ -1678,34 +1693,9 @@ App_Step_Sig(app_step){
}
}
// NOTE(allen): pass events to debug
// NOTE(allen): Get Available Input
vars->available_input = init_available_input(&input->keys, &input->mouse);
{
Debug_Data *debug = &models->debug;
Key_Input_Data key_data = get_key_data(&vars->available_input);
Debug_Input_Event *events = debug->input_events;
i32 count = key_data.count;
i32 preserved_inputs = ArrayCount(debug->input_events) - count;
debug->this_frame_count = count;
memmove(events + count, events, sizeof(Debug_Input_Event)*preserved_inputs);
for (i32 i = 0; i < key_data.count; ++i){
Key_Event_Data key = key_data.keys[i];
events[i].key = key.keycode;
events[i].consumer[0] = 0;
events[i].is_hold = key.modifiers[MDFR_HOLD_INDEX];
events[i].is_ctrl = key.modifiers[MDFR_CONTROL_INDEX];
events[i].is_alt = key.modifiers[MDFR_ALT_INDEX];
events[i].is_shift = key.modifiers[MDFR_SHIFT_INDEX];
}
}
// NOTE(allen): Keyboard and Mouse input to command coroutine.
if (models->command_coroutine != 0){
Coroutine_Head *command_coroutine = models->command_coroutine;
@ -1752,7 +1742,7 @@ App_Step_Sig(app_step){
i32 map = mapid_global;
if (view != 0){
map = view->transient.map;
map = view_get_map(view);
}
Command_Binding cmd_bind = map_extract_recursive(&models->mapping, map, key);
@ -1882,7 +1872,7 @@ App_Step_Sig(app_step){
}
else{
scroll_vars = &view->transient.ui_scroll;
i32 bottom = view->transient.ui_control.bounding_box.y1;
i32 bottom = view->transient.ui_control.bounding_box[UICoordinates_Scrolled].y1;
max_y = view_compute_max_target_y_from_bottom_y(view, (f32)bottom);
file_scroll = false;
}
@ -1907,7 +1897,6 @@ App_Step_Sig(app_step){
*scroll_vars = ip_result.scroll;
}
}
}
}
@ -1932,7 +1921,8 @@ App_Step_Sig(app_step){
USE_VIEW(view);
Assert(view != 0);
Command_Binding cmd_bind = map_extract_recursive(&models->mapping, view->transient.map, key);
i32 map = view_get_map(view);
Command_Binding cmd_bind = map_extract_recursive(&models->mapping, map, key);
if (cmd_bind.function){
if (key.keycode == key_esc){
@ -1975,54 +1965,6 @@ App_Step_Sig(app_step){
}
}
// NOTE(allen): pass consumption data to debug
{
Debug_Data *debug = &models->debug;
i32 count = debug->this_frame_count;
Consumption_Record *record = 0;
record = &vars->available_input.records[Input_MouseLeftButton];
if (record->consumed && record->consumer[0] != 0){
Debug_Input_Event *event = debug->input_events;
for (i32 i = 0; i < count; ++i, ++event){
if (event->key == key_mouse_left && event->consumer[0] == 0){
memcpy(event->consumer, record->consumer, sizeof(record->consumer));
}
}
}
record = &vars->available_input.records[Input_MouseRightButton];
if (record->consumed && record->consumer[0] != 0){
Debug_Input_Event *event = debug->input_events;
for (i32 i = 0; i < count; ++i, ++event){
if (event->key == key_mouse_right && event->consumer[0] == 0){
memcpy(event->consumer, record->consumer, sizeof(record->consumer));
}
}
}
record = &vars->available_input.records[Input_Esc];
if (record->consumed && record->consumer[0] != 0){
Debug_Input_Event *event = debug->input_events;
for (i32 i = 0; i < count; ++i, ++event){
if (event->key == key_esc && event->consumer[0] == 0){
memcpy(event->consumer, record->consumer, sizeof(record->consumer));
}
}
}
record = &vars->available_input.records[Input_AnyKey];
if (record->consumed){
Debug_Input_Event *event = debug->input_events;
for (i32 i = 0; i < count; ++i, ++event){
if (event->consumer[0] == 0){
memcpy(event->consumer, record->consumer, sizeof(record->consumer));
}
}
}
}
// NOTE(allen): panel resizing
switch (vars->state){
case APP_STATE_EDIT:
@ -2249,6 +2191,10 @@ App_Step_Sig(app_step){
app_result.lctrl_lalt_is_altgr = models->settings.lctrl_lalt_is_altgr;
app_result.perform_kill = !models->keep_playing;
// NOTE(allen): Update Frame to Frame States
models->prev_x = input->mouse.x;
models->prev_y = input->mouse.y;
models->animated_last_frame = app_result.animating;
models->frame_counter += 1;
// end-of-app_step

8
4ed.h
View File

@ -25,8 +25,14 @@ struct Application_Memory{
i32 debug_memory_size;
};
// TODO(allen): // TODO(allen): // TODO(allen): // TODO(allen): // TODO(allen):
// TODO(allen): // TODO(allen): // TODO(allen): // TODO(allen): // TODO(allen):
// TODO(allen): // TODO(allen): // TODO(allen): // TODO(allen): // TODO(allen):
// TODO(allen): // TODO(allen): // TODO(allen): // TODO(allen): // TODO(allen):
// TODO(allen): // TODO(allen): // TODO(allen): // TODO(allen): // TODO(allen):
// TODO(allen): Fix this nonsense
#define KEY_INPUT_BUFFER_SIZE 8
#define KEY_EXTRA_SIZE 2
#define KEY_EXTRA_SIZE 5
struct Key_Input_Data{
Key_Event_Data keys[KEY_INPUT_BUFFER_SIZE + KEY_EXTRA_SIZE];

View File

@ -338,7 +338,8 @@ DOC_SEE(Command_Line_Interface_Flag)
View *vptr = imp_get_view(cmd, view);
if (vptr != 0){
view_set_file(system, models, vptr, file);
view_show_file(vptr);
// TODO(allen): // TODO(allen): // TODO(allen): // TODO(allen): // TODO(allen):
// Send "quit UI" events!
}
}
}
@ -623,8 +624,7 @@ DOC_SEE(Access_Flag)
String fname = make_string(name, len);
Editing_File_Name canon = {0};
if (get_canon_name(system, fname,
&canon)){
if (get_canon_name(system, fname, &canon)){
Editing_File *file = working_set_contains_canon(working_set, canon.name);
fill_buffer_summary(&buffer, file, working_set);
if (!access_test(buffer.lock_flags, access)){
@ -1127,16 +1127,6 @@ DOC_SEE(Buffer_Setting_ID)
else if (value <= mapid_nomap){
file->settings.base_map_id = value;
}
for (Panel *panel = models->layout.used_sentinel.next;
panel != &models->layout.used_sentinel;
panel = panel->next){
View *view = panel->view;
if (view->transient.file_data.file != file){
continue;
}
view->transient.map = file->settings.base_map_id;
}
}break;
case BufferSetting_Eol:
@ -1402,10 +1392,17 @@ DOC_SEE(Buffer_Create_Flag)
fill_buffer_summary(&result, file, cmd);
}
if (file != 0 && (flags & BufferCreate_JustChangedFile)){
if (file != 0 && (flags & BufferCreate_JustChangedFile) != 0){
file->state.ignore_behind_os = 1;
}
if (file != 0 && (flags & BufferCreate_AlwaysNew) != 0){
i32 size = buffer_size(&file->state.buffer);
if (size > 0){
edit_single(system, models, file, 0, size, 0, 0);
}
}
end_temp_memory(temp);
}
@ -1843,6 +1840,11 @@ DOC_RETURN(returns non-zero on success)
*value_out = !vptr->transient.hide_file_bar;
}break;
case ViewSetting_UICommandMap:
{
*value_out = vptr->transient.ui_map_id;
}break;
default:
{
result = 0;
@ -1885,6 +1887,11 @@ DOC_SEE(View_Setting_ID)
vptr->transient.hide_file_bar = !value;
}break;
case ViewSetting_UICommandMap:
{
vptr->transient.ui_map_id = value;
}break;
default:
{
result = false;
@ -2110,7 +2117,8 @@ DOC_SEE(Set_Buffer_Flag)
if (file != vptr->transient.file_data.file){
view_set_file(system, models, vptr, file);
if (!(flags & SetBuffer_KeepOriginalGUI)){
view_show_file(vptr);
// TODO(allen): // TODO(allen): // TODO(allen): // TODO(allen): // TODO(allen):
// Send "quit UI" events!
}
}
}
@ -2240,22 +2248,72 @@ View_Set_UI(Application_Links *app, View_Summary *view, UI_Control *control){
}
memset(&vptr->transient.ui_control, 0, sizeof(vptr->transient.ui_control));
if (control->count > 0){
i32 memory_size = sizeof(UI_Item)*control->count;
vptr->transient.ui_control.items = (UI_Item*)general_memory_allocate(general, memory_size);
if (vptr->transient.ui_control.items != 0){
vptr->transient.ui_control.count = control->count;
memcpy(vptr->transient.ui_control.items, control->items, memory_size);
i32 string_size = 0;
for (UI_Item *item = control->items, *one_past_last = control->items + control->count;
item < one_past_last;
item += 1){
string_size += item->query.size;
string_size += item->string.size;
}
i32 all_items_size = sizeof(UI_Item)*control->count;
i32 memory_size = all_items_size + string_size;
UI_Item *new_items = (UI_Item*)general_memory_allocate(general, memory_size);
if (new_items != 0){
char *string_space = (char*)(new_items + control->count);
Partition string_alloc = make_part(string_space, string_size);
i32 count = control->count;
memcpy(new_items, control->items, all_items_size);
for (UI_Item *item = new_items, *one_past_last = new_items + count;
item < one_past_last;
item += 1){
String *fixup[2];
fixup[0] = &item->query;
fixup[1] = &item->string;
for (i32 i = 0; i < ArrayCount(fixup); i += 1){
String old = *fixup[i];
char *new_str = push_array(&string_alloc, char, old.size);
fixup[i]->str = new_str;
fixup[i]->size = old.size;
fixup[i]->memory_size = old.size;
memcpy(new_str, old.str, old.size);
}
}
vptr->transient.ui_control.items = new_items;
vptr->transient.ui_control.count = count;
}
else{
return(false);
}
}
vptr->transient.ui_control.bounding_box = control->bounding_box;
memcpy(vptr->transient.ui_control.bounding_box, control->bounding_box,
sizeof(control->bounding_box));
return(true);
}
return(false);
}
API_EXPORT UI_Control
View_Get_UI_Copy(Application_Links *app, View_Summary *view, struct Partition *part){
Command_Data *cmd = (Command_Data*)app->cmd_context;
View *vptr = imp_get_view(cmd, view);
UI_Control result = {0};
if (vptr != 0){
UI_Control *control = &vptr->transient.ui_control;
result.items = push_array(part, UI_Item, control->count);
if (result.items != 0){
result.count = control->count;
// TODO(allen): Fixup the pointers
memcpy(result.items, control->items, sizeof(*result.items)*result.count);
}
else{
return(result);
}
memcpy(result.bounding_box, control->bounding_box, sizeof(result.bounding_box));
}
return(result);
}
API_EXPORT User_Input
Get_User_Input(Application_Links *app, Input_Type_Flag get_type, Input_Type_Flag abort_type)
/*
@ -2784,19 +2842,17 @@ Directory_Get_Hot(Application_Links *app, char *out, int32_t capacity)
DOC_PARAM(out, On success this character buffer is filled with the 4coder 'hot directory'.)
DOC_PARAM(capacity, Specifies the capacity in bytes of the of the out buffer.)
DOC(4coder has a concept of a 'hot directory' which is the directory most recently accessed in the GUI. Whenever the GUI is opened it shows the hot directory. In the future this will be deprecated and eliminated in favor of more flexible hot directories created and controlled in the custom layer.)
DOC_RETURN(This call returns the length of the hot directory string whether or not it was successfully copied into the output buffer. The call is successful if and only if capacity is greater than or equal to the return size.)
DOC_RETURN(This call returns the length of the hot directory string whether or not it was successfully copied into the output buffer. The call is successful if and only if capacity is greater than or equal to the return value.)
DOC_SEE(directory_set_hot)
*/{
Command_Data *cmd = (Command_Data*)app->cmd_context;
Hot_Directory *hot = &cmd->models->hot_directory;
hot_directory_clean_end(hot);
if (capacity > 0){
i32 copy_max = capacity - 1;
if (copy_max > hot->string.size){
copy_max = hot->string.size;
if (capacity >= hot->string.size){
memcpy(out, hot->string.str, hot->string.size);
if (capacity > hot->string.size){
out[hot->string.size] = 0;
}
memcpy(out, hot->string.str, copy_max);
out[copy_max] = 0;
}
return(hot->string.size);
}

View File

@ -31,20 +31,6 @@ struct App_Settings{
};
global_const App_Settings null_app_settings = {0};
struct Debug_Input_Event{
Key_Code key;
char consumer[32];
b8 is_hold;
b8 is_ctrl;
b8 is_alt;
b8 is_shift;
};
struct Debug_Data{
Debug_Input_Event input_events[16];
i32 this_frame_count;
};
struct Models{
Mem_Options mem;
App_Settings settings;
@ -55,6 +41,10 @@ struct Models{
Command_Binding prev_command;
i32 prev_x;
i32 prev_y;
b32 animated_last_frame;
Coroutine_Head *command_coroutine;
u32 command_coroutine_flags[2];
@ -92,8 +82,6 @@ struct Models{
b32 keep_playing;
Debug_Data debug;
Key_Code user_up_key;
Key_Code user_down_key;
Key_Modifier user_up_key_modifier;

View File

@ -26,7 +26,6 @@ get_or_add_map_index(Mapping *mapping, i32 mapid){
return(result);
}
// HACK(allen): This seems busted, investigate.
internal i32
get_map_index(Mapping *mapping, i32 mapid){
i32 user_map_count = mapping->user_map_count;
@ -36,10 +35,6 @@ get_map_index(Mapping *mapping, i32 mapid){
if (map_id_table[result] == mapid){
break;
}
if (map_id_table[result] == 0){
result = user_map_count;
break;
}
}
return(result);
}

View File

@ -216,8 +216,7 @@ edit_single(System_Functions *system, Models *models, Editing_File *file,
spec.step.edit.end = end;
spec.step.edit.len = len;
spec.str = (u8*)str;
edit_single__inner(system, models, file, spec,
hist_normal);
edit_single__inner(system, models, file, spec, hist_normal);
}
internal Edit_Spec

View File

@ -9,6 +9,16 @@
// TOP
internal i32
view_get_map(View *view){
if (view->transient.ui_mode_counter > 0){
return(view->transient.ui_map_id);
}
else{
return(view->transient.file_data.file->settings.base_map_id);
}
}
internal View_And_ID
live_set_alloc_view(General_Memory *general, Live_Views *live_set, Panel *panel){
Assert(live_set->count < live_set->max);
@ -346,13 +356,6 @@ view_post_paste_effect(View *view, f32 seconds, i32 start, i32 size, u32 color){
////////////////////////////////
inline void
view_show_file(View *view){
Editing_File *file = view->transient.file_data.file;
Assert(file != 0);
view->transient.map = file->settings.base_map_id;
}
internal void
view_set_file(System_Functions *system, Models *models, View *view, Editing_File *file){
Assert(file != 0);
@ -380,10 +383,6 @@ view_set_file(System_Functions *system, Models *models, View *view, Editing_File
if (edit_pos->cursor.line == 0){
view_cursor_move(system, view, 0);
}
if (view->transient.ui_mode_counter == 0){
view_show_file(view);
}
}
////////////////////////////////

View File

@ -35,7 +35,6 @@ struct View_Transient{
struct View *prev;
struct Panel *panel;
b32 in_use;
i32 map;
File_Viewing_Data file_data;
Dynamic_Variable_Block dynamic_vars;
@ -49,6 +48,7 @@ struct View_Transient{
i32 ui_mode_counter;
UI_Control ui_control;
GUI_Scroll_Vars ui_scroll;
i32 ui_map_id;
b32 hide_scrollbar;
b32 hide_file_bar;

View File

@ -1,7 +1,7 @@
/*
* Mr. 4th Dimention - Allen Webster
*
* 19.08.2015
* ??.??.2018
*
* View GUI layouts and implementations
*
@ -29,85 +29,6 @@ interactive_begin_sure_to_kill(System_Functions *system, View *view, Models *mod
}
////////////////////////////////
internal Single_Line_Input_Step
app_single_line_input__inner(System_Functions *system, Working_Set *working_set, Key_Event_Data key, Single_Line_Mode mode){
Single_Line_Input_Step result = {0};
b8 ctrl = key.modifiers[MDFR_CONTROL_INDEX];
b8 cmnd = key.modifiers[MDFR_COMMAND_INDEX];
b8 alt = key.modifiers[MDFR_ALT_INDEX];
b8 is_modified = (ctrl || cmnd || alt);
if (key.keycode == key_back){
result.hit_backspace = true;
if (mode.string->size > 0){
result.made_a_change = true;
--mode.string->size;
b32 was_slash = char_is_slash(mode.string->str[mode.string->size]);
terminate_with_null(mode.string);
if (mode.type == SINGLE_LINE_FILE && was_slash && !is_modified){
remove_last_folder(mode.string);
terminate_with_null(mode.string);
hot_directory_set(system, mode.hot_directory, *mode.string);
}
}
}
else if (key.character == '\n' || key.character == '\t'){
// NOTE(allen): do nothing!
}
else if (key.keycode == key_esc){
result.hit_esc = true;
result.made_a_change = true;
}
else if (key.character != 0){
result.hit_a_character = true;
if (!is_modified){
u8 c[4];
u32 c_len = 0;
u32_to_utf8_unchecked(key.character, c, &c_len);
Assert(mode.string->memory_size >= 0);
if (mode.string->size + c_len < (u32)mode.string->memory_size){
result.made_a_change = true;
append(mode.string, make_string(c, c_len));
terminate_with_null(mode.string);
if (mode.type == SINGLE_LINE_FILE && char_is_slash(c[0])){
hot_directory_set(system, mode.hot_directory, *mode.string);
}
}
}
else{
result.did_command = true;
}
}
return(result);
}
inline Single_Line_Input_Step
app_single_line_input_step(System_Functions *system, Key_Event_Data key, String *string){
Single_Line_Mode mode = {};
mode.type = SINGLE_LINE_STRING;
mode.string = string;
return(app_single_line_input__inner(system, 0, key, mode));
}
inline Single_Line_Input_Step
app_single_file_input_step(System_Functions *system,
Working_Set *working_set, Key_Event_Data key,
String *string, Hot_Directory *hot_directory){
Single_Line_Mode mode = {};
mode.type = SINGLE_LINE_FILE;
mode.string = string;
mode.hot_directory = hot_directory;
return(app_single_line_input__inner(system, working_set, key, mode));
}
////////////////////////////////
global_const Style_Color_Edit colors_to_edit[] = {
@ -163,13 +84,19 @@ do_step_file_view(System_Functions *system, View *view, Models *models, i32_Rect
rect.y0 = top_bar_rect.y1;
}
if (user_input->mouse.wheel != 0){
result.scroll.target_y += user_input->mouse.wheel;
result.scroll.target_y = clamp(0, result.scroll.target_y, max_y);
result.is_animating = true;
}
i32 bar_count = 0;
for (Query_Slot *slot = view->transient.query_set.used_slot;
slot != 0;
slot = slot->next, ++bar_count);
view->transient.widget_height = (f32)bar_count*(view->transient.line_height + 2);
if (view->transient.ui_mode_counter == 0){
if (user_input->mouse.wheel != 0){
result.scroll.target_y += user_input->mouse.wheel;
result.scroll.target_y = clamp(0, result.scroll.target_y, max_y);
result.is_animating = true;
}
view->transient.file_region = rect;
Editing_File *file = view->transient.file_data.file;
@ -248,47 +175,6 @@ draw_text_field(System_Functions *system, Render_Target *target, View *view, Mod
}
}
internal void
draw_text_with_cursor(System_Functions *system, Render_Target *target, View *view, Models *models, Face_ID font_id, i32_Rect rect, String s, i32 pos){
Style *style = &models->styles.styles[0];
u32 back_color = style->main.margin_color;
u32 text_color = style->main.default_color;
u32 cursor_color = style->main.cursor_color;
u32 at_cursor_color = style->main.at_cursor_color;
f32 x = (f32)rect.x0;
i32 y = rect.y0 + 2;
if (target){
draw_rectangle(target, rect, back_color);
if (pos >= 0 && pos < s.size){
Font_Pointers font = system->font.get_pointers_by_id(font_id);
String part1 = substr(s, 0, pos);
String part2 = substr(s, pos, 1);
String part3 = substr(s, pos+1, s.size-pos-1);
x = draw_string(system, target, font_id, part1, floor32(x), y, text_color);
f32 adv = font_get_glyph_advance(system, font.settings, font.metrics, font.pages, s.str[pos]);
i32_Rect cursor_rect;
cursor_rect.x0 = floor32(x);
cursor_rect.x1 = floor32(x) + ceil32(adv);
cursor_rect.y0 = y;
cursor_rect.y1 = y + view->transient.line_height;
draw_rectangle(target, cursor_rect, cursor_color);
x = draw_string(system, target, font_id, part2, floor32(x), y, at_cursor_color);
draw_string(system, target, font_id, part3, floor32(x), y, text_color);
}
else{
draw_string(system, target, font_id, s, floor32(x), y, text_color);
}
}
}
internal void
intbar_draw_string(System_Functions *system, Render_Target *target, File_Bar *bar, String str, u32 char_color){
draw_string(system, target, bar->font_id, str, (i32)(bar->pos_x + bar->text_shift_x), (i32)(bar->pos_y + bar->text_shift_y), char_color);
@ -386,6 +272,27 @@ do_render_file_view(System_Functions *system, View *view, Models *models, GUI_Sc
draw_file_bar(system, target, view, models, file, top_bar_rect);
}
i32 bar_count = 0;
for (Query_Slot *slot = view->transient.query_set.used_slot;
slot != 0;
slot = slot->next, ++bar_count){
i32_Rect query_bar_rect = {0};
query_bar_rect.x0 = rect.x0;
query_bar_rect.y0 = rect.y0;
query_bar_rect.x1 = rect.x1;
query_bar_rect.y1 = rect.y0 + line_height + 2;
rect.y0 = query_bar_rect.y1;
u32 back_color = style->main.margin_color;
u32 text1_color = style->main.default_color;
u32 text2_color = style->main.file_info_style.pop1_color;
i32 x = query_bar_rect.x0;
i32 y = query_bar_rect.y0 + 2;
draw_rectangle(target, query_bar_rect, back_color);
x = ceil32(draw_string(system, target, font_id, slot->query_bar->prompt, x, y, text2_color));
draw_string(system, target, font_id, slot->query_bar->string, x, y, text1_color);
}
view->transient.widget_height = (f32)bar_count*(view->transient.line_height + 2);
draw_push_clip(target, rect);
if (view->transient.ui_mode_counter == 0){
if (file_is_ready(file)){
@ -400,10 +307,23 @@ do_render_file_view(System_Functions *system, View *view, Models *models, GUI_Sc
GUI_Scroll_Vars scroll = view->transient.ui_scroll;
for (i32 i = 0; i < item_count; ++i, item += 1){
f32_Rect item_rect = f32R(item->rectangle);
item_rect.x0 += rect_f32.x0 - scroll.scroll_x;
item_rect.y0 += rect_f32.y0 - scroll.scroll_y;
item_rect.x1 += rect_f32.x0 - scroll.scroll_x;
item_rect.y1 += rect_f32.y0 - scroll.scroll_y;
switch (item->coordinates){
case UICoordinates_Scrolled:
{
item_rect.x0 += rect_f32.x0 - scroll.scroll_x;
item_rect.y0 += rect_f32.y0 - scroll.scroll_y;
item_rect.x1 += rect_f32.x0 - scroll.scroll_x;
item_rect.y1 += rect_f32.y0 - scroll.scroll_y;
}break;
case UICoordinates_ViewRelative:
{
item_rect.x0 += rect_f32.x0;
item_rect.y0 += rect_f32.y0;
item_rect.x1 += rect_f32.x0;
item_rect.y1 += rect_f32.y0;
}break;
}
if (rect_opverlap(item_rect, rect_f32)){
switch (item->type){

View File

@ -51,6 +51,9 @@ M(mouse_left) \
M(mouse_right) \
M(mouse_left_release) \
M(mouse_right_release) \
M(mouse_wheel) \
M(mouse_move) \
M(animate) \
M(f1) \
M(f2) \
M(f3) \
@ -68,6 +71,7 @@ M(f14) \
M(f15) \
M(f16)
enum{
key_enum_kicker_offer = 0xD800 - 1,
#define DefKeyEnum(n) key_##n,
@ -682,7 +686,7 @@ generate_remapping_code_and_data(){
bind(mappings, 'o', MDFR_CTRL, interactive_open_or_new);
bind(mappings, 'o', MDFR_ALT, open_in_other);
bind(mappings, 'k', MDFR_CTRL, interactive_kill_buffer);
bind(mappings, 'i', MDFR_CTRL, interactive_switch_buffer_DUMMY_API_EXPLORATION);
bind(mappings, 'i', MDFR_CTRL, interactive_switch_buffer);
bind(mappings, 'h', MDFR_CTRL, project_go_to_root_directory);
bind(mappings, 'S', MDFR_CTRL, save_all_dirty_buffers);
@ -859,6 +863,27 @@ generate_remapping_code_and_data(){
bind(mappings, 'I', MDFR_CTRL, list_all_functions_current_buffer);
end_map(mappings);
// NOTE(allen): LISTER
begin_map(mappings, default_lister_ui_map,
"These commands apply in 'lister mode' such as when you open a file.");
bind_vanilla_keys(mappings, MDFR_NONE, list_mode__write_character);
bind(mappings, key_esc, MDFR_NONE, list_mode__quit);
bind(mappings, '\n', MDFR_NONE, list_mode__activate);
bind(mappings, '\t', MDFR_NONE, list_mode__activate);
bind(mappings, key_back , MDFR_NONE, list_mode__backspace_text_field);
bind(mappings, key_up , MDFR_NONE, list_mode__move_up);
bind(mappings, key_page_up , MDFR_NONE, list_mode__move_up);
bind(mappings, key_down , MDFR_NONE, list_mode__move_down);
bind(mappings, key_page_down, MDFR_NONE, list_mode__move_down);
bind(mappings, key_mouse_wheel , MDFR_NONE, list_mode__wheel_scroll);
bind(mappings, key_mouse_left , MDFR_NONE, list_mode__mouse_press);
bind(mappings, key_mouse_left_release, MDFR_NONE, list_mode__mouse_release);
bind(mappings, key_mouse_move, MDFR_NONE, list_mode__repaint);
bind(mappings, key_animate , MDFR_NONE, list_mode__repaint);
end_map(mappings);
}
end_mapping(mappings);
@ -1051,6 +1076,27 @@ generate_remapping_code_and_data(){
bind(mappings, 'I', MDFR_CMND, list_all_functions_current_buffer);
end_map(mappings);
// NOTE(allen): LISTER
begin_map(mappings, default_lister_ui_map,
"These commands apply in 'lister mode' such as when you open a file.");
bind_vanilla_keys(mappings, MDFR_NONE, list_mode__write_character);
bind(mappings, key_esc, MDFR_NONE, list_mode__quit);
bind(mappings, '\n', MDFR_NONE, list_mode__activate);
bind(mappings, '\t', MDFR_NONE, list_mode__activate);
bind(mappings, key_back , MDFR_NONE, list_mode__backspace_text_field);
bind(mappings, key_up , MDFR_NONE, list_mode__move_up);
bind(mappings, key_page_up , MDFR_NONE, list_mode__move_up);
bind(mappings, key_down , MDFR_NONE, list_mode__move_down);
bind(mappings, key_page_down, MDFR_NONE, list_mode__move_down);
bind(mappings, key_mouse_wheel , MDFR_NONE, list_mode__wheel_scroll);
bind(mappings, key_mouse_left , MDFR_NONE, list_mode__mouse_press);
bind(mappings, key_mouse_left_release, MDFR_NONE, list_mode__mouse_release);
bind(mappings, key_mouse_move, MDFR_NONE, list_mode__repaint);
bind(mappings, key_animate , MDFR_NONE, list_mode__repaint);
end_map(mappings);
}
end_mapping(mappings);

View File

@ -182,162 +182,15 @@ The following commands only apply in files where the lexer (syntax highlighting)
\ITEM \STYLE{code} <ctrl I> \END Creates a jump list of lines of the current buffer that appear to define or declare functions.
\END
\END
\END
\SECTION{Map: mac-default}
\SECTION{mapid-global}
The following bindings apply in all situations.
\SECTION{default-lister-ui-map}
These commands apply in 'lister mode' such as when you open a file.
\LIST
\ITEM \STYLE{code} <cmnd p> \END Create a new panel by vertically splitting the active panel.
\ITEM \STYLE{code} <cmnd _> \END Create a new panel by horizontally splitting the active panel.
\ITEM \STYLE{code} <cmnd P> \END Closes the currently active panel if it is not the only panel open.
\ITEM \STYLE{code} <cmnd ,> \END Change the currently active panel, moving to the panel with the next highest view_id.
\ITEM \STYLE{code} <cmnd <> \END Change the currently active panel, moving to the panel with the next lowest view_id.
\ITEM \STYLE{code} <cmnd n> \END Interactively creates a new file.
\ITEM \STYLE{code} <cmnd o> \END Interactively opens or creates a new file.
\ITEM \STYLE{code} <ctrl o> \END Interactively opens a file in the other panel.
\ITEM \STYLE{code} <cmnd k> \END Interactively kill an open buffer.
\ITEM \STYLE{code} <cmnd i> \END Interactively switch to an open buffer.
\ITEM \STYLE{code} <cmnd h> \END Changes 4coder's hot directory to the root directory of the currently loaded project. With no loaded project nothing hapepns.
\ITEM \STYLE{code} <cmnd S> \END Saves all buffers marked dirty (showing the '*' indicator).
\ITEM \STYLE{code} <ctrl c> \END Opens the 4coder colors and fonts selector menu.
\ITEM \STYLE{code} <ctrl .> \END If the special build panel is open, makes the build panel the active panel.
\ITEM \STYLE{code} <ctrl ,> \END If the special build panel is open, closes it.
\ITEM \STYLE{code} <ctrl n> \END If a buffer containing jump locations has been locked in, goes to the next jump in the buffer, skipping sub jump locations.
\ITEM \STYLE{code} <ctrl N> \END If a buffer containing jump locations has been locked in, goes to the previous jump in the buffer, skipping sub jump locations.
\ITEM \STYLE{code} <ctrl M> \END If a buffer containing jump locations has been locked in, goes to the first jump in the buffer.
\ITEM \STYLE{code} <ctrl m> \END Looks for a build.bat, build.sh, or makefile in the current and parent directories. Runs the first that it finds and prints the output to *compilation*. Puts the *compilation* buffer in a panel at the footer of the current view.
\ITEM \STYLE{code} <ctrl z> \END Queries for an output buffer name and system command, runs the system command as a CLI and prints the output to the specified buffer.
\ITEM \STYLE{code} <ctrl Z> \END If the command execute_any_cli has already been used, this will execute a CLI reusing the most recent buffer name and command.
\ITEM \STYLE{code} <ctrl x> \END Execute a 'long form' command.
\ITEM \STYLE{code} <ctrl W> \END Sets the current view to show it's scrollbar.
\ITEM \STYLE{code} <ctrl w> \END Sets the current view to hide it's scrollbar.
\ITEM \STYLE{code} <ctrl b> \END Toggles the visibility status of the current view's filebar.
\ITEM \STYLE{code} <ctrl @> \END Toggles the mouse suppression mode, see suppress_mouse and allow_mouse.
\ITEM \STYLE{code} <ctrl E> \END Attempts to close 4coder.
\ITEM \STYLE{code} <ctrl +> \END Increase the size of the face used by the current buffer.
\ITEM \STYLE{code} <ctrl -> \END Decrease the size of the face used by the current buffer.
\ITEM \STYLE{code} <f1> \END Run an 'fkey command' configured in a project.4coder file. Determines the index of the 'fkey command' by which function key or numeric key was pressed to trigger the command.
\ITEM \STYLE{code} <f2> \END Run an 'fkey command' configured in a project.4coder file. Determines the index of the 'fkey command' by which function key or numeric key was pressed to trigger the command.
\ITEM \STYLE{code} <f3> \END Run an 'fkey command' configured in a project.4coder file. Determines the index of the 'fkey command' by which function key or numeric key was pressed to trigger the command.
\ITEM \STYLE{code} <f4> \END Run an 'fkey command' configured in a project.4coder file. Determines the index of the 'fkey command' by which function key or numeric key was pressed to trigger the command.
\ITEM \STYLE{code} <f5> \END Run an 'fkey command' configured in a project.4coder file. Determines the index of the 'fkey command' by which function key or numeric key was pressed to trigger the command.
\ITEM \STYLE{code} <f6> \END Run an 'fkey command' configured in a project.4coder file. Determines the index of the 'fkey command' by which function key or numeric key was pressed to trigger the command.
\ITEM \STYLE{code} <f7> \END Run an 'fkey command' configured in a project.4coder file. Determines the index of the 'fkey command' by which function key or numeric key was pressed to trigger the command.
\ITEM \STYLE{code} <f8> \END Run an 'fkey command' configured in a project.4coder file. Determines the index of the 'fkey command' by which function key or numeric key was pressed to trigger the command.
\ITEM \STYLE{code} <f9> \END Run an 'fkey command' configured in a project.4coder file. Determines the index of the 'fkey command' by which function key or numeric key was pressed to trigger the command.
\ITEM \STYLE{code} <f10> \END Run an 'fkey command' configured in a project.4coder file. Determines the index of the 'fkey command' by which function key or numeric key was pressed to trigger the command.
\ITEM \STYLE{code} <f11> \END Run an 'fkey command' configured in a project.4coder file. Determines the index of the 'fkey command' by which function key or numeric key was pressed to trigger the command.
\ITEM \STYLE{code} <f12> \END Run an 'fkey command' configured in a project.4coder file. Determines the index of the 'fkey command' by which function key or numeric key was pressed to trigger the command.
\ITEM \STYLE{code} <f13> \END Run an 'fkey command' configured in a project.4coder file. Determines the index of the 'fkey command' by which function key or numeric key was pressed to trigger the command.
\ITEM \STYLE{code} <f14> \END Run an 'fkey command' configured in a project.4coder file. Determines the index of the 'fkey command' by which function key or numeric key was pressed to trigger the command.
\ITEM \STYLE{code} <f15> \END Run an 'fkey command' configured in a project.4coder file. Determines the index of the 'fkey command' by which function key or numeric key was pressed to trigger the command.
\ITEM \STYLE{code} <f16> \END Run an 'fkey command' configured in a project.4coder file. Determines the index of the 'fkey command' by which function key or numeric key was pressed to trigger the command.
\END
\END
\SECTION{mapid-file}
The following bindings apply in general text files and most apply in code files, but some are overriden by other commands specific to code files.
\LIST
\ITEM \STYLE{code} <any character> \END Inserts whatever character was used to trigger this command.
\ITEM \STYLE{code} <alt any character> \END Inserts whatever character was used to trigger this command.
\ITEM \STYLE{code} <left click> \END Sets the cursor position to the mouse position.
\ITEM \STYLE{code} <left release> \END Sets the mark position to the mouse position.
\ITEM \STYLE{code} <right click> \END Sets the mark position to the mouse position.
\ITEM \STYLE{code} <left> \END Moves the cursor one character to the left.
\ITEM \STYLE{code} <right> \END Moves the cursor one character to the right.
\ITEM \STYLE{code} <delete> \END Deletes the character to the right of the cursor.
\ITEM \STYLE{code} <shift delete> \END Deletes the character to the right of the cursor.
\ITEM \STYLE{code} <backspace> \END Deletes the character to the left of the cursor.
\ITEM \STYLE{code} <shift backspace> \END Deletes the character to the left of the cursor.
\ITEM \STYLE{code} <up> \END Moves the cursor up one line.
\ITEM \STYLE{code} <down> \END Moves the cursor down one line.
\ITEM \STYLE{code} <end> \END Seeks the cursor to the end of the visual line.
\ITEM \STYLE{code} <home> \END Seeks the cursor to the beginning of the visual line.
\ITEM \STYLE{code} <ctrl page up> \END Sets the cursor to the beginning of the file.
\ITEM \STYLE{code} <ctrl page down> \END Sets the cursor to the end of the file.
\ITEM \STYLE{code} <page up> \END Scrolls the view up one view height and moves the cursor up one view height.
\ITEM \STYLE{code} <page down> \END Scrolls the view down one view height and moves the cursor down one view height.
\ITEM \STYLE{code} <cmnd right> \END Seek right for the next boundary between whitespace and non-whitespace.
\ITEM \STYLE{code} <cmnd left> \END Seek left for the next boundary between whitespace and non-whitespace.
\ITEM \STYLE{code} <cmnd up> \END Seeks the cursor up to the next blank line and places it at the end of the line.
\ITEM \STYLE{code} <cmnd down> \END Seeks the cursor down to the next blank line and places it at the end of the line.
\ITEM \STYLE{code} <cmnd backspace> \END Delete characters between the cursor position and the first alphanumeric boundary to the left.
\ITEM \STYLE{code} <cmnd delete> \END Delete characters between the cursor position and the first alphanumeric boundary to the right.
\ITEM \STYLE{code} <ctrl backspace> \END Delete a single, whole token on or to the left of the cursor and post it to the clipboard.
\ITEM \STYLE{code} <ctrl delete> \END Delete a single, whole token on or to the right of the cursor and post it to the clipboard.
\ITEM \STYLE{code} <cmnd /> \END Sets the mark to the current position of the cursor.
\ITEM \STYLE{code} <cmnd a> \END Queries the user for two strings, and replaces all occurences of the first string in the range between the cursor and the mark with the second string.
\ITEM \STYLE{code} <cmnd c> \END Copy the text in the range from the cursor to the mark onto the clipboard.
\ITEM \STYLE{code} <cmnd d> \END Deletes the text in the range between the cursor and the mark.
\ITEM \STYLE{code} <cmnd D> \END Delete the line the on which the cursor sits.
\ITEM \STYLE{code} <cmnd e> \END Centers the view vertically on the line on which the cursor sits.
\ITEM \STYLE{code} <cmnd E> \END Sets the left size of the view near the x position of the cursor.
\ITEM \STYLE{code} <cmnd f> \END Begins an incremental search down through the current buffer for a user specified string.
\ITEM \STYLE{code} <cmnd F> \END Queries the user for a string and lists all exact case-sensitive matches found in all open buffers.
\ITEM \STYLE{code} <ctrl F> \END Queries the user for a string and lists all case-insensitive substring matches found in all open buffers.
\ITEM \STYLE{code} <cmnd g> \END Queries the user for a number, and jumps the cursor to the corresponding line.
\ITEM \STYLE{code} <cmnd G> \END Reads the string in the selected range and lists all exact case-sensitive mathces in all open buffers.
\ITEM \STYLE{code} <cmnd K> \END Kills the current buffer.
\ITEM \STYLE{code} <cmnd l> \END Toggles the current buffer's line wrapping status.
\ITEM \STYLE{code} <cmnd L> \END Create a copy of the line on which the cursor sits.
\ITEM \STYLE{code} <cmnd m> \END Swaps the position of the cursor and the mark.
\ITEM \STYLE{code} <cmnd O> \END Reopen the current buffer from the hard drive.
\ITEM \STYLE{code} <cmnd q> \END Queries the user for two strings, and incrementally replaces every occurence of the first string with the second string.
\ITEM \STYLE{code} <cmnd Q> \END Queries the user for a string, and incrementally replace every occurence of the word or token found at the cursor with the specified string.
\ITEM \STYLE{code} <cmnd r> \END Begins an incremental search up through the current buffer for a user specified string.
\ITEM \STYLE{code} <cmnd s> \END Saves the current buffer.
\ITEM \STYLE{code} <ctrl s> \END Queries the user for a name and saves the contents of the current buffer, altering the buffer's name too.
\ITEM \STYLE{code} <cmnd t> \END Begins an incremental search down through the current buffer for the word or token under the cursor.
\ITEM \STYLE{code} <cmnd T> \END Reads a token or word under the cursor and lists all exact case-sensitive mathces in all open buffers.
\ITEM \STYLE{code} <cmnd v> \END Paste from the top of clipboard and run auto-indent on the newly pasted text.
\ITEM \STYLE{code} <ctrl v> \END Toggles the current buffer's virtual whitespace status.
\ITEM \STYLE{code} <cmnd V> \END Paste the next item on the clipboard and run auto-indent on the newly pasted text.
\ITEM \STYLE{code} <cmnd x> \END Cut the text in the range from the cursor to the mark onto the clipboard.
\ITEM \STYLE{code} <cmnd y> \END Advances forewards through the undo history.
\ITEM \STYLE{code} <cmnd z> \END Advances backwards through the undo history.
\ITEM \STYLE{code} <cmnd 1> \END Set the other non-active panel to view the buffer that the active panel views, and switch to that panel.
\ITEM \STYLE{code} <cmnd 2> \END Set the other non-active panel to view the buffer that the active panel views, and switch to that panel.
\ITEM \STYLE{code} <cmnd ?> \END Toggles the current buffer's whitespace visibility status.
\ITEM \STYLE{code} <cmnd ~> \END Removes trailing whitespace from all lines in the current buffer.
\ITEM \STYLE{code} <return> \END If the buffer in the active view is writable, inserts a character, otherwise performs goto_jump_at_cursor.
\ITEM \STYLE{code} <shift return> \END If the buffer in the active view is writable, inserts a character, otherwise performs goto_jump_at_cursor_same_panel.
\ITEM \STYLE{code} <shift space> \END Inserts whatever character was used to trigger this command.
\END
\END
\SECTION{default-code-map}
The following commands only apply in files where the lexer (syntax highlighting) is turned on.
\LIST
\ITEM \STYLE{code} <cmnd right> \END Seek right for boundary between alphanumeric characters or camel case word and non-alphanumeric characters.
\ITEM \STYLE{code} <cmnd left> \END Seek left for boundary between alphanumeric characters or camel case word and non-alphanumeric characters.
\ITEM \STYLE{code} <return> \END Inserts a character and auto-indents the line on which the cursor sits.
\ITEM \STYLE{code} <shift return> \END Inserts a character and auto-indents the line on which the cursor sits.
\ITEM \STYLE{code} <}> \END Inserts a character and auto-indents the line on which the cursor sits.
\ITEM \STYLE{code} <)> \END Inserts a character and auto-indents the line on which the cursor sits.
\ITEM \STYLE{code} <]> \END Inserts a character and auto-indents the line on which the cursor sits.
\ITEM \STYLE{code} <;> \END Inserts a character and auto-indents the line on which the cursor sits.
\ITEM \STYLE{code} <#> \END Inserts a character and auto-indents the line on which the cursor sits.
\ITEM \STYLE{code} <tab> \END Iteratively tries completing the word to the left of the cursor with other words in open buffers that have the same prefix string.
\ITEM \STYLE{code} <cmnd tab> \END Auto-indents the range between the cursor and the mark.
\ITEM \STYLE{code} <shift tab> \END Auto-indents the line on which the cursor sits.
\ITEM \STYLE{code} <ctrl h> \END At the cursor, insert a '// HACK' comment, includes user name if it was specified in config.4coder.
\ITEM \STYLE{code} <ctrl r> \END At the cursor, insert a block comment.
\ITEM \STYLE{code} <ctrl t> \END At the cursor, insert a '// TODO' comment, includes user name if it was specified in config.4coder.
\ITEM \STYLE{code} <ctrl y> \END At the cursor, insert a '// NOTE' comment, includes user name if it was specified in config.4coder.
\ITEM \STYLE{code} <ctrl D> \END Queries user for string, lists all locations of strings that appear to define a type whose name matches the input string.
\ITEM \STYLE{code} <ctrl T> \END Reads a token or word under the cursor and lists all locations of strings that appear to define a type whose name matches it.
\ITEM \STYLE{code} <cmnd [> \END At the cursor, insert a '{' and '}' separated by a blank line.
\ITEM \STYLE{code} <cmnd {> \END At the cursor, insert a '{' and '};' separated by a blank line.
\ITEM \STYLE{code} <cmnd }> \END At the cursor, insert a '{' and '}break;' separated by a blank line.
\ITEM \STYLE{code} <ctrl [> \END Finds the scope enclosed by '{' '}' surrounding the cursor and puts the cursor and mark on the '{' and '}'.
\ITEM \STYLE{code} <ctrl ]> \END Finds the first scope started by '{' before the cursor and puts the cursor and mark on the '{' and '}'.
\ITEM \STYLE{code} <ctrl '> \END Finds the first scope started by '{' after the cursor and puts the cursor and mark on the '{' and '}'.
\ITEM \STYLE{code} <ctrl /> \END Wraps the code contained in the range between cursor and mark with a new curly brace scope.
\ITEM \STYLE{code} <ctrl -> \END Deletes the braces surrounding the currently selected scope. Leaves the contents within the scope.
\ITEM \STYLE{code} <ctrl j> \END If a scope is currently selected, and a statement or block statement is present below the current scope, the statement is moved into the scope.
\ITEM \STYLE{code} <ctrl i> \END Surround the range between the cursor and mark with an '#if 0' and an '#endif'
\ITEM \STYLE{code} <ctrl 1> \END Reads a filename from surrounding '"' characters and attempts to open the corresponding file.
\ITEM \STYLE{code} <ctrl 2> \END If the current file is a *.cpp or *.h, attempts to open the corresponding *.h or *.cpp file in the other view.
\ITEM \STYLE{code} <cmnd 0> \END At the cursor, insert a ' = {0};'.
\ITEM \STYLE{code} <cmnd I> \END Creates a jump list of lines of the current buffer that appear to define or declare functions.
\END
\END
\END
\ITEM \STYLE{code} <any character> \END A list mode command that inserts a new character to the text field.
\ITEM \STYLE{code} <escape> \END A list mode command that quits the list without executing any actions.
\ITEM \STYLE{code} <return> \END A list mode command that activates the list's action on the highlighted item.
\ITEM \STYLE{code} <tab> \END A list mode command that activates the list's action on the highlighted item.
\ITEM \STYLE{code} <backspace> \END A list mode command that backspaces one character from the text field.
\ITEM \STYLE{code} <up> \END A list mode command that moves the highlighted item one up in the list.
\ITEM \STYLE{code} <page up> \END A list mode command that moves the highlighted item one up in the list.
\ITEM \STYLE{code} <down> \END A list mode command that moves the highlighted item one down in the list.
\ITEM \STYLE{code} <page down> \END A list mode command that moves the highlighted item one down in the list.

View File

@ -12,7 +12,7 @@ At_Cursor = Back;
Mark = 0xFF808080;
Highlight = 0xFF006080;
At_Highlight = Back;
Default = 0xFFDDDDDD;
Default = 0xFFB8B8B0;
Comment = 0xFF6AC000;
Keyword = 0xFFFFDDAA;
Str_Constant = Keyword;