diff --git a/4coder_default_hooks.cpp b/4coder_default_hooks.cpp index a53c00aa..f32275bd 100644 --- a/4coder_default_hooks.cpp +++ b/4coder_default_hooks.cpp @@ -39,6 +39,8 @@ START_HOOK_SIG(default_start){ load_project(app); } + set_title(app, "TESTINGGGG!!!!!!! BOOOYYAAA!!!!!"); + // no meaning for return return(0); } @@ -52,23 +54,6 @@ START_HOOK_SIG(default_start){ COMMAND_CALLER_HOOK(default_command_caller){ View_Summary view = get_active_view(app, AccessAll); -#if 0 - // NOTE(allen): Debugging input. -#include - User_Input in = get_command_input(app); - if (in.type == UserInputKey){ - Key_Event_Data key = in.key; - fprintf(stdout, "keycode %u/'%c'\n", key.keycode, (char)key.keycode); - fprintf(stdout, "character %u/'%c'\n", key.character, (char)key.character); - fprintf(stdout, "character_no_caps_lock %u/'%c'\n", key.character_no_caps_lock, (char)key.character_no_caps_lock); - fprintf(stdout, "ctrl: %s ", key.modifiers[MDFR_CONTROL_INDEX]?" true":"false"); - fprintf(stdout, "alt: %s " , key.modifiers[MDFR_ALT_INDEX] ?" true":"false"); - fprintf(stdout, "cmnd: %s ", key.modifiers[MDFR_COMMAND_INDEX]?" true":"false"); - fprintf(stdout, "shift: %s", key.modifiers[MDFR_SHIFT_INDEX] ?" true":"false"); - fprintf(stdout, "\n"); - } -#endif - view_paste_index[view.view_id].next_rewrite = 0; exec_command(app, cmd); view_paste_index[view.view_id].rewrite = view_paste_index[view.view_id].next_rewrite; diff --git a/4coder_generated/app_functions.h b/4coder_generated/app_functions.h index 569cb76f..7e9ac99f 100644 --- a/4coder_generated/app_functions.h +++ b/4coder_generated/app_functions.h @@ -83,6 +83,7 @@ struct Application_Links; #define SET_FULLSCREEN_SIG(n) bool32 n(Application_Links *app, bool32 full_screen) #define IS_FULLSCREEN_SIG(n) bool32 n(Application_Links *app) #define SEND_EXIT_SIGNAL_SIG(n) void n(Application_Links *app) +#define SET_TITLE_SIG(n) void n(Application_Links *app, char *title) typedef GLOBAL_SET_SETTING_SIG(Global_Set_Setting_Function); typedef GLOBAL_SET_MAPPING_SIG(Global_Set_Mapping_Function); typedef EXEC_COMMAND_SIG(Exec_Command_Function); @@ -167,6 +168,7 @@ typedef SHOW_MOUSE_CURSOR_SIG(Show_Mouse_Cursor_Function); typedef SET_FULLSCREEN_SIG(Set_Fullscreen_Function); typedef IS_FULLSCREEN_SIG(Is_Fullscreen_Function); typedef SEND_EXIT_SIGNAL_SIG(Send_Exit_Signal_Function); +typedef SET_TITLE_SIG(Set_Title_Function); struct Application_Links{ #if defined(ALLOW_DEP_4CODER) Global_Set_Setting_Function *global_set_setting; @@ -253,6 +255,7 @@ Show_Mouse_Cursor_Function *show_mouse_cursor; Set_Fullscreen_Function *set_fullscreen; Is_Fullscreen_Function *is_fullscreen; Send_Exit_Signal_Function *send_exit_signal; +Set_Title_Function *set_title; #else Global_Set_Setting_Function *global_set_setting_; Global_Set_Mapping_Function *global_set_mapping_; @@ -338,6 +341,7 @@ Show_Mouse_Cursor_Function *show_mouse_cursor_; Set_Fullscreen_Function *set_fullscreen_; Is_Fullscreen_Function *is_fullscreen_; Send_Exit_Signal_Function *send_exit_signal_; +Set_Title_Function *set_title_; #endif void *memory; int32_t memory_size; @@ -430,7 +434,8 @@ app_links->get_4ed_path_ = Get_4ed_Path;\ app_links->show_mouse_cursor_ = Show_Mouse_Cursor;\ app_links->set_fullscreen_ = Set_Fullscreen;\ app_links->is_fullscreen_ = Is_Fullscreen;\ -app_links->send_exit_signal_ = Send_Exit_Signal;} while(false) +app_links->send_exit_signal_ = Send_Exit_Signal;\ +app_links->set_title_ = Set_Title;} while(false) #if defined(ALLOW_DEP_4CODER) static inline bool32 global_set_setting(Application_Links *app, Global_Setting_ID setting, int32_t value){return(app->global_set_setting(app, setting, value));} static inline bool32 global_set_mapping(Application_Links *app, void *data, int32_t size){return(app->global_set_mapping(app, data, size));} @@ -516,6 +521,7 @@ static inline void show_mouse_cursor(Application_Links *app, Mouse_Cursor_Show_T static inline bool32 set_fullscreen(Application_Links *app, bool32 full_screen){return(app->set_fullscreen(app, full_screen));} static inline bool32 is_fullscreen(Application_Links *app){return(app->is_fullscreen(app));} static inline void send_exit_signal(Application_Links *app){(app->send_exit_signal(app));} +static inline void set_title(Application_Links *app, char *title){(app->set_title(app, title));} #else static inline bool32 global_set_setting(Application_Links *app, Global_Setting_ID setting, int32_t value){return(app->global_set_setting_(app, setting, value));} static inline bool32 global_set_mapping(Application_Links *app, void *data, int32_t size){return(app->global_set_mapping_(app, data, size));} @@ -601,4 +607,5 @@ static inline void show_mouse_cursor(Application_Links *app, Mouse_Cursor_Show_T static inline bool32 set_fullscreen(Application_Links *app, bool32 full_screen){return(app->set_fullscreen_(app, full_screen));} static inline bool32 is_fullscreen(Application_Links *app){return(app->is_fullscreen_(app));} static inline void send_exit_signal(Application_Links *app){(app->send_exit_signal_(app));} +static inline void set_title(Application_Links *app, char *title){(app->set_title_(app, title));} #endif diff --git a/4coder_generated/command_metadata.h b/4coder_generated/command_metadata.h index 06eadb3b..e11ea584 100644 --- a/4coder_generated/command_metadata.h +++ b/4coder_generated/command_metadata.h @@ -292,7 +292,7 @@ static Command_Metadata fcoder_metacmd_table[192] = { { 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, "/Users/allenwebster/4ed/code/4coder_default_include.cpp", 55, 466 }, { 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, "/Users/allenwebster/4ed/code/4coder_search.cpp", 46, 708 }, { 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, "/Users/allenwebster/4ed/code/4coder_search.cpp", 46, 728 }, -{ 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, "/Users/allenwebster/4ed/code/4coder_project_commands.cpp", 56, 400 }, +{ 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, "/Users/allenwebster/4ed/code/4coder_project_commands.cpp", 56, 408 }, { 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, "/Users/allenwebster/4ed/code/4coder_base_commands.cpp", 53, 1130 }, { PROC_LINKS(miblo_decrement_basic, 0), "miblo_decrement_basic", 21, "Decrement an integer under the cursor by one.", 45, "/Users/allenwebster/4ed/code/power/4coder_miblo_numbers.cpp", 59, 119 }, { PROC_LINKS(miblo_decrement_time_stamp, 0), "miblo_decrement_time_stamp", 26, "Decrement a time stamp under the cursor by one second. (format [m]m:ss or h:mm:ss", 81, "/Users/allenwebster/4ed/code/power/4coder_miblo_numbers.cpp", 59, 392 }, @@ -333,13 +333,13 @@ static Command_Metadata fcoder_metacmd_table[192] = { { PROC_LINKS(paste_next, 0), "paste_next", 10, "If the previous command was paste or paste_next, replaces the paste range with the next text down on the clipboard, otherwise operates as the paste command.", 156, "/Users/allenwebster/4ed/code/4coder_clipboard.cpp", 49, 108 }, { PROC_LINKS(paste_next_and_indent, 0), "paste_next_and_indent", 21, "Paste the next item on the clipboard and run auto-indent on the newly pasted text.", 82, "/Users/allenwebster/4ed/code/4coder_default_include.cpp", 55, 398 }, { PROC_LINKS(place_in_scope, 0), "place_in_scope", 14, "Wraps the code contained in the range between cursor and mark with a new curly brace scope.", 91, "/Users/allenwebster/4ed/code/4coder_scope_commands.cpp", 54, 486 }, -{ PROC_LINKS(project_fkey_command, 0), "project_fkey_command", 20, "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.", 175, "/Users/allenwebster/4ed/code/4coder_project_commands.cpp", 56, 567 }, -{ PROC_LINKS(project_go_to_root_directory, 0), "project_go_to_root_directory", 28, "Changes 4coder's hot directory to the root directory of the currently loaded project. With no loaded project nothing hapepns.", 125, "/Users/allenwebster/4ed/code/4coder_project_commands.cpp", 56, 593 }, +{ PROC_LINKS(project_fkey_command, 0), "project_fkey_command", 20, "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.", 175, "/Users/allenwebster/4ed/code/4coder_project_commands.cpp", 56, 575 }, +{ PROC_LINKS(project_go_to_root_directory, 0), "project_go_to_root_directory", 28, "Changes 4coder's hot directory to the root directory of the currently loaded project. With no loaded project nothing hapepns.", 125, "/Users/allenwebster/4ed/code/4coder_project_commands.cpp", 56, 601 }, { PROC_LINKS(query_replace, 0), "query_replace", 13, "Queries the user for two strings, and incrementally replaces every occurence of the first string with the second string.", 120, "/Users/allenwebster/4ed/code/4coder_base_commands.cpp", 53, 983 }, { PROC_LINKS(query_replace_identifier, 0), "query_replace_identifier", 24, "Queries the user for a string, and incrementally replace every occurence of the word or token found at the cursor with the specified string.", 140, "/Users/allenwebster/4ed/code/4coder_base_commands.cpp", 53, 1004 }, { PROC_LINKS(query_replace_selection, 0), "query_replace_selection", 23, "Queries the user for a string, and incrementally replace every occurence of the string found in the selected range with the specified string.", 141, "/Users/allenwebster/4ed/code/4coder_default_include.cpp", 55, 240 }, { PROC_LINKS(redo, 0), "redo", 4, "Advances forewards through the undo history.", 44, "/Users/allenwebster/4ed/code/4coder_base_commands.cpp", 53, 1171 }, -{ PROC_LINKS(reload_current_project, 0), "reload_current_project", 22, "If a project file has already been loaded, reloads the same file. Useful for when the project configuration is changed.", 120, "/Users/allenwebster/4ed/code/4coder_project_commands.cpp", 56, 471 }, +{ PROC_LINKS(reload_current_project, 0), "reload_current_project", 22, "If a project file has already been loaded, reloads the same file. Useful for when the project configuration is changed.", 120, "/Users/allenwebster/4ed/code/4coder_project_commands.cpp", 56, 479 }, { PROC_LINKS(remap_interactive, 0), "remap_interactive", 17, "Switch to a named key binding map.", 34, "/Users/allenwebster/4ed/code/4coder_default_framework.h", 55, 743 }, { 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, "/Users/allenwebster/4ed/code/4coder_base_commands.cpp", 53, 1088 }, { PROC_LINKS(rename_parameter, 0), "rename_parameter", 16, "If the cursor is found to be on the name of a function parameter in the signature of a function definition, all occurences within the scope of the function will be replaced with a new provided string.", 200, "/Users/allenwebster/4ed/code/power/4coder_experiments.cpp", 57, 387 }, @@ -376,7 +376,7 @@ static Command_Metadata fcoder_metacmd_table[192] = { { PROC_LINKS(set_bindings_default, 0), "set_bindings_default", 20, "Remap keybindings using the 'default' mapping rule.", 51, "/Users/allenwebster/4ed/code/4coder_remapping_commands.cpp", 58, 63 }, { PROC_LINKS(set_bindings_mac_default, 0), "set_bindings_mac_default", 24, "Remap keybindings using the 'mac-default' mapping rule.", 55, "/Users/allenwebster/4ed/code/4coder_remapping_commands.cpp", 58, 77 }, { PROC_LINKS(set_mark, 0), "set_mark", 8, "Sets the mark to the current position of the cursor.", 52, "/Users/allenwebster/4ed/code/4coder_base_commands.cpp", 53, 100 }, -{ PROC_LINKS(setup_new_project, 0), "setup_new_project", 17, "Queries the user for several configuration options and initializes a new 4coder project with build scripts for every OS.", 120, "/Users/allenwebster/4ed/code/4coder_project_commands.cpp", 56, 650 }, +{ PROC_LINKS(setup_new_project, 0), "setup_new_project", 17, "Queries the user for several configuration options and initializes a new 4coder project with build scripts for every OS.", 120, "/Users/allenwebster/4ed/code/4coder_project_commands.cpp", 56, 658 }, { PROC_LINKS(show_filebar, 0), "show_filebar", 12, "Sets the current view to show it's filebar.", 43, "/Users/allenwebster/4ed/code/4coder_base_commands.cpp", 53, 548 }, { PROC_LINKS(show_scrollbar, 0), "show_scrollbar", 14, "Sets the current view to show it's scrollbar.", 45, "/Users/allenwebster/4ed/code/4coder_base_commands.cpp", 53, 534 }, { PROC_LINKS(snipe_token_or_word, 0), "snipe_token_or_word", 19, "Delete a single, whole token on or to the left of the cursor and post it to the clipboard.", 90, "/Users/allenwebster/4ed/code/4coder_default_include.cpp", 55, 187 }, diff --git a/4coder_project_commands.cpp b/4coder_project_commands.cpp index ffc064d4..7648ae4c 100644 --- a/4coder_project_commands.cpp +++ b/4coder_project_commands.cpp @@ -392,6 +392,14 @@ load_project_from_config_data(Application_Links *app, Partition *part, char *con else{ open_all_code(app, project_dir); } + + // Set window title + char space[1024]; + String builder = make_fixed_width_string(space); + append(&builder, "4coder: "); + append(&builder, project_dir); + terminate_with_null(&builder); + //set_title(app, builder.str); } end_temp_memory(temp); diff --git a/4ed.cpp b/4ed.cpp index 7b90fc65..48fa2ff3 100644 --- a/4ed.cpp +++ b/4ed.cpp @@ -1710,8 +1710,6 @@ App_Step_Sig(app_step){ cmd->key = null_key_event_data; if (input->first_step){ - system->set_title("TESTINGGGG!!!!!!! BOOOYYAAA!!!!!"); - // Open command line files. char space[512]; String cl_filename = make_fixed_width_string(space); diff --git a/4ed_api_implementation.cpp b/4ed_api_implementation.cpp index cc0069af..4c98570c 100644 --- a/4ed_api_implementation.cpp +++ b/4ed_api_implementation.cpp @@ -2808,11 +2808,7 @@ DOC(This call tells 4coder to set the full_screen mode. The change to full scre API_EXPORT bool32 Is_Fullscreen(Application_Links *app) /* -DOC(This call returns true if the 4coder is in full screen mode. This call -takes toggles that have already occured this frame into account. So it may return -true even though the frame has not ended and actually put 4coder into full screen. If -it returns true though, 4coder will definitely be full screen by the beginning of the next -frame if the state is not changed.) +DOC(This call returns true if the 4coder is in full screen mode. This call takes toggles that have already occured this frame into account. So it may return true even though the frame has not ended and actually put 4coder into full screen. If it returns true though, 4coder will definitely be full screen by the beginning of the next frame if the state is not changed.) */{ Command_Data *cmd = (Command_Data*)app->cmd_context; System_Functions *system = cmd->system; @@ -2823,13 +2819,23 @@ frame if the state is not changed.) API_EXPORT void Send_Exit_Signal(Application_Links *app) /* -DOC(This call sends a signal to 4coder to attempt to exit. If there are unsaved -files this triggers a dialogue ensuring you're okay with closing.) +DOC(This call sends a signal to 4coder to attempt to exit. If there are unsaved files this triggers a dialogue ensuring you're okay with closing.) */{ Command_Data *cmd = (Command_Data*)app->cmd_context; System_Functions *system = cmd->system; system->send_exit_signal(); } +API_EXPORT void +Set_Title(Application_Links *app, char *title) +/* +DOC_PARAM(title, A null terminated string indicating the new title for the 4coder window.) +DOC(Sets 4coder's window title to the specified title string.) +*/{ + Command_Data *cmd = (Command_Data*)app->cmd_context; + System_Functions *system = cmd->system; + system->set_title(title); +} + // BOTTOM