diff --git a/4coder_custom.h b/4coder_custom.h index 4484b8d9..67292040 100644 --- a/4coder_custom.h +++ b/4coder_custom.h @@ -358,6 +358,7 @@ struct Application_Links; // File system navigation #define DIRECTORY_GET_HOT_SIG(n) int n(Application_Links *app, char *out, int capacity) +#define GET_4ED_PATH_SIG(n) int n(Application_Links *app, char *out, int capacity) #define FILE_EXISTS_SIG(n) int n(Application_Links *app, char *filename, int len) #define DIRECTORY_CD_SIG(n) int n(Application_Links *app, char *dir, int *len, int capacity, char *rel_path, int rel_len) #define GET_FILE_LIST_SIG(n) File_List n(Application_Links *app, char *dir, int len) @@ -442,6 +443,7 @@ extern "C"{ // File system navigation typedef DIRECTORY_GET_HOT_SIG(Directory_Get_Hot_Function); + typedef GET_4ED_PATH_SIG(Get_4ed_Path_Function); typedef FILE_EXISTS_SIG(File_Exists_Function); typedef DIRECTORY_CD_SIG(Directory_CD_Function); typedef GET_FILE_LIST_SIG(Get_File_List_Function); @@ -507,6 +509,7 @@ struct Application_Links{ // File system navigation Directory_Get_Hot_Function *directory_get_hot; + Get_4ed_Path_Function *get_4ed_path; File_Exists_Function *file_exists; Directory_CD_Function *directory_cd; Get_File_List_Function *get_file_list; diff --git a/4ed.cpp b/4ed.cpp index b8fa736b..4e51ece5 100644 --- a/4ed.cpp +++ b/4ed.cpp @@ -2557,6 +2557,7 @@ app_links_init(System_Functions *system, Application_Links *app_links, void *dat app_links->clear_parameters = external_clear_parameters; app_links->directory_get_hot = external_directory_get_hot; + app_links->get_4ed_path = system->get_4ed_path; app_links->file_exists = system->file_exists; app_links->directory_cd = system->directory_cd; app_links->get_file_list = external_get_file_list; diff --git a/4ed_file_view.cpp b/4ed_file_view.cpp index be5383f4..af525a44 100644 --- a/4ed_file_view.cpp +++ b/4ed_file_view.cpp @@ -2365,7 +2365,6 @@ get_line_indentation_marks(Partition *part, Buffer *buffer, Cpp_Token_Stack toke switch(token->type){ case CPP_TOKEN_BRACE_OPEN: case CPP_TOKEN_BRACE_CLOSE: - case CPP_TOKEN_PARENTHESE_OPEN: goto out_of_loop; } } diff --git a/4ed_system.h b/4ed_system.h index 3953a8d3..a723b1c9 100644 --- a/4ed_system.h +++ b/4ed_system.h @@ -212,9 +212,10 @@ struct System_Functions{ System_File_Track *file_track; System_File_Untrack *file_untrack; - // file system navigation (4coder_custom.h): 2 + // file system navigation (4coder_custom.h): 3 File_Exists_Function *file_exists; Directory_CD_Function *directory_cd; + Get_4ed_Path_Function *get_4ed_path; // clipboard: 1 System_Post_Clipboard *post_clipboard; diff --git a/power/4coder_experiments.cpp b/power/4coder_experiments.cpp index 9398407d..521bf70a 100644 --- a/power/4coder_experiments.cpp +++ b/power/4coder_experiments.cpp @@ -313,13 +313,23 @@ void experiment_extension(Bind_Helper *context){ #include +#define SETTINGS_FILE ".4coder_settings" HOOK_SIG(experimental_start_hook){ my_start(app); - FILE *file = fopen(".4coder_settings", "rb"); char theme_name[128]; char font_name[128]; + FILE *file = fopen(SETTINGS_FILE, "rb"); + + if (!file){ + char module_path[512]; + int len; + len = app->get_4ed_path(app, module_path, 448); + memcpy(module_path+len, SETTINGS_FILE, sizeof(SETTINGS_FILE)); + file = fopen(module_path, "rb"); + } + if (file){ fscanf(file, "%127s\n%127s", theme_name, font_name); diff --git a/win32_4ed.cpp b/win32_4ed.cpp index a8566fc0..87e3bfc3 100644 --- a/win32_4ed.cpp +++ b/win32_4ed.cpp @@ -43,7 +43,7 @@ #include "4ed_internal.h" #include "system_shared.h" -#define FPS 30 +#define FPS 60 #define frame_useconds (1000000 / FPS) // TODO(allen): Do we still need all of these? I've abandoned the @@ -582,6 +582,18 @@ DIRECTORY_CD_SIG(system_directory_cd){ return(result); } +GET_4ED_PATH_SIG(system_get_4ed_path){ + String str = make_string(out, 0, capacity); + i32 result = 0; + i32 size = GetModuleFileName(0, out, capacity); + if (size < capacity-1){ + str.size = size; + remove_last_folder(&str); + result = str.size; + } + return(result); +} + internal Sys_Post_Clipboard_Sig(system_post_clipboard){ if (OpenClipboard(win32vars.window_handle)){ @@ -1124,6 +1136,7 @@ Win32LoadSystemCode(){ win32vars.system->file_exists = system_file_exists; win32vars.system->directory_cd = system_directory_cd; + win32vars.system->get_4ed_path = system_get_4ed_path; win32vars.system->post_clipboard = system_post_clipboard; win32vars.system->time = system_time;