progress on the project system

master
Allen Webster 2016-12-24 16:09:53 -05:00
parent 8cd14b79ca
commit cd6bed08e5
9 changed files with 525 additions and 165 deletions

View File

@ -123,8 +123,8 @@ HOOK_SIG(my_start){
process_config_file(app);
change_theme(app, literal("4coder"));
change_font(app, literal("Liberation Sans"), true);
change_theme(app, default_theme_name.str, default_theme_name.size);
change_font(app, default_font_name.str, default_font_name.size, 1);
exec_command(app, open_panel_vsplit);
exec_command(app, hide_scrollbar);
@ -168,34 +168,14 @@ HOOK_SIG(my_view_adjust){
new_wrap_width = (int32_t)(new_wrap_width * .9f);
int32_t new_min_base_width = (int32_t)(new_wrap_width * .77f);
if (automatically_adjust_wrapping){
adjust_all_buffer_wrap_widths(app, new_wrap_width, new_min_base_width);
}
// no meaning for return
return(0);
}
// TODO(allen): delete this
CUSTOM_COMMAND_SIG(weird_buffer_test){
for (Buffer_Summary buffer = get_buffer_first(app, AccessAll);
buffer.exists;
get_buffer_next(app, &buffer, AccessAll)){
print_message(app, literal("filename:"));
if (buffer.file_name){
print_message(app, buffer.file_name, buffer.file_name_len);
}
else{
print_message(app, literal("*NULL*"));
}
print_message(app, literal("buffername:"));
if (buffer.buffer_name){
print_message(app, buffer.buffer_name, buffer.buffer_name_len);
}
else{
print_message(app, literal("*NULL*"));
}
}
}
// NOTE(allen|a4.0.12): This is for testing it may be removed and replaced with a better test for the buffer_get_font when you eventally read this and wonder what it's about.
CUSTOM_COMMAND_SIG(write_name_of_font){
View_Summary view = get_active_view(app, AccessOpen);
@ -257,11 +237,9 @@ OPEN_FILE_HOOK_SIG(my_file_settings){
if (treat_as_code && enable_code_wrapping && buffer.size < (1 << 18)){
// NOTE(allen|a4.0.12): There is a little bit of grossness going on here.
// If we set BufferSetting_Lex to true, it will launch a lexing job.
// If a lexing job is active when we set BufferSetting_VirtualWhitespace on
// that call can fail.
// If a lexing job is active when we set BufferSetting_VirtualWhitespace on that call can fail.
// Unfortunantely without tokens virtual whitespace doesn't really make sense.
// So for now I have it automatically turning on lexing when virtual whitespace
// is turned on.
// So for now I have it automatically turning on lexing when virtual whitespace is turned on.
// Cleaning some of that up is a goal for future versions.
buffer_set_setting(app, &buffer, BufferSetting_WrapLine, 1);
buffer_set_setting(app, &buffer, BufferSetting_VirtualWhitespace, 1);
@ -280,7 +258,7 @@ OPEN_FILE_HOOK_SIG(my_file_settings){
//
// Right now it only has access to the mouse state, but it will be
// extended to have access to the key presses soon.
static int32_t suppressing_mouse = false;
static bool32 suppressing_mouse = false;
INPUT_FILTER_SIG(my_suppress_mouse_filter){
if (suppressing_mouse){
@ -293,11 +271,11 @@ INPUT_FILTER_SIG(my_suppress_mouse_filter){
static void
set_mouse_suppression(Application_Links *app, int32_t suppress){
if (suppress){
suppressing_mouse = true;
suppressing_mouse = 1;
show_mouse_cursor(app, MouseCursorShow_Never);
}
else{
suppressing_mouse = false;
suppressing_mouse = 0;
show_mouse_cursor(app, MouseCursorShow_Always);
}
}
@ -351,7 +329,6 @@ default_keys(Bind_Helper *context){
bind(context, key_f2, MDFR_NONE, toggle_mouse);
bind(context, key_page_up, MDFR_CTRL, toggle_fullscreen);
bind(context, 'E', MDFR_ALT, exit_4coder);
bind(context, 'K', MDFR_ALT, weird_buffer_test);
end_map(context);

View File

@ -24,8 +24,7 @@
//
static int32_t
open_file(Application_Links *app, Buffer_Summary *buffer_out, char *filename,
int32_t filename_len, int32_t background, int32_t never_new){
open_file(Application_Links *app, Buffer_Summary *buffer_out, char *filename, int32_t filename_len, int32_t background, int32_t never_new){
int32_t result = false;
Buffer_Summary buffer =
get_buffer_by_name(app, filename, filename_len,
@ -54,8 +53,7 @@ open_file(Application_Links *app, Buffer_Summary *buffer_out, char *filename,
}
static int32_t
view_open_file(Application_Links *app, View_Summary *view, char *filename,
int32_t filename_len, int32_t never_new){
view_open_file(Application_Links *app, View_Summary *view, char *filename, int32_t filename_len, int32_t never_new){
int32_t result = 0;
if (view){
@ -70,8 +68,7 @@ view_open_file(Application_Links *app, View_Summary *view, char *filename,
}
static int32_t
read_line(Application_Links *app, Partition *part, Buffer_Summary *buffer,
int32_t line, String *str){
read_line(Application_Links *app, Partition *part, Buffer_Summary *buffer, int32_t line, String *str){
Partial_Cursor begin = {0};
Partial_Cursor end = {0};
@ -3444,11 +3441,272 @@ COMMAND_CALLER_HOOK(default_command_caller){
return(0);
}
struct Config_Line{
Cpp_Token id_token;
Cpp_Token subscript_token;
Cpp_Token eq_token;
Cpp_Token val_token;
int32_t val_array_start;
int32_t val_array_end;
int32_t val_array_count;
bool32 read_success;
};
struct Config_Item{
Config_Line line;
char *mem;
String id;
int32_t subscript_index;
bool32 has_subscript;
};
struct Config_Array_Reader{
char *mem;
int32_t i;
int32_t val_array_end;
bool32 good;
};
static Cpp_Token
read_config_token(Cpp_Token_Array array, int32_t *i_ptr){
Cpp_Token token = {0};
int32_t i = *i_ptr;
for (; i < array.count; ++i){
Cpp_Token comment_token = array.tokens[i];
if (comment_token.type != CPP_TOKEN_COMMENT){
break;
}
}
if (i < array.count){
token = array.tokens[i];
}
i = *i_ptr;
return(token);
}
static Config_Line
read_config_line(Cpp_Token_Array array, int32_t *i_ptr){
Config_Line config_line = {0};
int32_t i = *i_ptr;
config_line.id_token = read_config_token(array, &i);
if (config_line.id_token.type == CPP_TOKEN_IDENTIFIER){
++i;
if (i < array.count){
Cpp_Token token = read_config_token(array, &i);
bool32 subscript_success = 1;
if (token.type == CPP_TOKEN_BRACE_OPEN){
subscript_success = 0;
++i;
if (i < array.count){
config_line.subscript_token = read_config_token(array, &i);
if (config_line.subscript_token.type == CPP_TOKEN_INTEGER_CONSTANT){
++i;
if (i < array.count){
token = read_config_token(array, &i);
if (token.type == CPP_TOKEN_BRACE_CLOSE){
++i;
if (i < array.count){
token = read_config_token(array, &i);
subscript_success = 1;
}
}
}
}
}
}
if (subscript_success){
if (token.type == CPP_TOKEN_EQ){
config_line.eq_token = read_config_token(array, &i);
++i;
if (i < array.count){
Cpp_Token val_token = read_config_token(array, &i);
bool32 array_success = 1;
if (val_token.type == CPP_TOKEN_BRACE_OPEN){
array_success = 0;
++i;
if (i < array.count){
config_line.val_array_start = i;
bool32 expecting_array_item = 1;
for (; i < array.count; ++i){
Cpp_Token array_token = read_config_token(array, &i);
if (array_token.type != CPP_TOKEN_BRACE_CLOSE){
config_line.val_array_end = i;
array_success = 1;
break;
}
else{
if (array_token.type == CPP_TOKEN_COMMA){
if (!expecting_array_item){
expecting_array_item = 1;
}
else{
break;
}
}
else{
if (expecting_array_item){
expecting_array_item = 0;
++config_line.val_array_count;
}
}
}
}
}
}
if (array_success){
config_line.val_token = val_token;
++i;
if (i < array.count){
Cpp_Token semicolon_token = read_config_token(array, &i);
if (semicolon_token.type == CPP_TOKEN_SEMICOLON){
config_line.read_success = 1;
}
}
}
}
}
}
}
}
if (!config_line.read_success){
for (; i < array.count; ++i){
Cpp_Token token = read_config_token(array, &i);
if (token.type == CPP_TOKEN_SEMICOLON){
break;
}
}
}
*i_ptr = i;
return(config_line);
}
static Config_Item
get_config_item(Config_Line line, char *mem){
Config_Item item = {0};
item.line = line;
item.mem = mem;
item.id = make_string(mem + line.id_token.start,line.id_token.size);
if (line.subscript_token.size != 0){
String subscript_str = make_string(mem + line.subscript_token.start,line.subscript_token.size);
item.subscript_index = str_to_int_s(subscript_str);
item.has_subscript = 1;
}
return(item);
}
static bool32
config_var(Config_Item item, char *var_name, int32_t *subscript, uint32_t token_type, void *var_out){
bool32 result = 0;
bool32 subscript_succes = 1;
if (item.line.val_token.type == token_type){
if ((var_name == 0 && item.id.size == 0) || match(item.id, var_name)){
if (subscript){
if (item.has_subscript){
*subscript = item.subscript_index;
}
else{
subscript_succes = 0;
}
}
if (subscript_succes){
if (var_out){
switch (token_type){
case CPP_TOKEN_BOOLEAN_CONSTANT:
{
*(bool32*)var_out = (item.mem[item.line.val_token.start] == 't');
}break;
case CPP_TOKEN_INTEGER_CONSTANT:
{
String val = make_string(item.mem + item.line.val_token.start, item.line.val_token.size);
*(int32_t*)var_out = str_to_int(val);
}break;
case CPP_TOKEN_STRING_CONSTANT:
{
*(String*)var_out = make_string(item.mem + item.line.val_token.start + 1,item.line.val_token.size - 2);
}break;
case CPP_TOKEN_BRACE_OPEN:
{
Config_Array_Reader *array_reader = (Config_Array_Reader*)var_out;
array_reader->mem = item.mem;
array_reader->i = item.line.val_array_start;
array_reader->val_array_end = item.line.val_array_end;
array_reader->good = 1;
}break;
}
}
result = 1;
}
}
}
return(result);
}
static bool32
config_bool_var(Config_Item item, char *var_name, int32_t *subscript, bool32 *var_out){
bool32 result = config_var(item, var_name, subscript, CPP_TOKEN_BOOLEAN_CONSTANT, var_out);
return(result);
}
static bool32
config_int_var(Config_Item item, char *var_name, int32_t *subscript, int32_t *var_out){
bool32 result = config_var(item, var_name, subscript, CPP_TOKEN_INTEGER_CONSTANT, var_out);
return(result);
}
static bool32
config_string_var(Config_Item item, char *var_name, int32_t *subscript, String *var_out){
bool32 result = config_var(item, var_name, subscript, CPP_TOKEN_STRING_CONSTANT, var_out);
return(result);
}
static bool32
config_array_var(Config_Item item, char *var_name, int32_t *subscript, Config_Array_Reader *array_reader){
bool32 result = config_var(item, var_name, subscript, CPP_TOKEN_BRACE_OPEN, array_reader);
return(result);
}
static bool32
config_array_next_item(Config_Array_Reader *array_reader, Config_Item *item){
bool32 result = (array_reader->good);
return(result);
}
static bool32
config_array_good(Config_Array_Reader *array_reader){
bool32 result = (array_reader->good);
return(result);
}
// NOTE(allen|a4.0.12): A primordial config system (actually really hate this but it seems best at least right now... arg)
static bool32 enable_code_wrapping = 1;
static bool32 automatically_adjust_wrapping = 1;
static int32_t default_wrap_width = 672;
static int32_t default_min_base_width = 550;
static String default_theme_name = make_lit_string("4coder");
static String default_font_name = make_lit_string("Liberation Sans");
#include <stdio.h>
@ -3464,8 +3722,29 @@ adjust_all_buffer_wrap_widths(Application_Links *app, int32_t wrap_widths, int32
default_min_base_width = min_base_width;
}
static bool32
file_handle_dump(Partition *part, FILE *file, char **mem_ptr, int32_t *size_ptr){
bool32 success = 0;
fseek(file, 0, SEEK_END);
int32_t size = ftell(file);
char *mem = (char*)push_block(part, size+1);
fseek(file, 0, SEEK_SET);
int32_t check_size = (int32_t)fread(mem, 1, size, file);
if (check_size == size){
mem[size] = 0;
success = 1;
}
*mem_ptr = mem;
*size_ptr = size;
return(success);
}
static void
process_config_file(Application_Links *app){
Partition *part = &global_part;
FILE *file = fopen("config.4coder", "rb");
if (!file){
@ -3478,15 +3757,13 @@ process_config_file(Application_Links *app){
}
if (file){
Temp_Memory temp = begin_temp_memory(&global_part);
Temp_Memory temp = begin_temp_memory(part);
fseek(file, 0, SEEK_END);
int32_t size = ftell(file);
char *mem = (char*)push_block(&global_part, size+1);
fseek(file, 0, SEEK_SET);
int32_t check_size = (int32_t)fread(mem, 1, size, file);
if (check_size == size){
mem[size] = 0;
char *mem = 0;
int32_t size = 0;
bool32 file_read_success = file_handle_dump(part, file, &mem, &size);
if (file_read_success){
fclose(file);
Cpp_Token_Array array;
@ -3498,79 +3775,159 @@ process_config_file(Application_Links *app){
Cpp_Lex_Result result = cpp_lex_step(&S, mem, size+1, HAS_NULL_TERM, &array, NO_OUT_LIMIT);
if (result == LexResult_Finished){
int32_t new_wrap_width = default_wrap_width;
int32_t new_min_base_width = default_min_base_width;
for (int32_t i = 0; i < array.count; ++i){
int32_t read_setting_failed = 1;
Cpp_Token id_token = array.tokens[i];
if (id_token.type == CPP_TOKEN_IDENTIFIER){
++i;
if (i < array.count){
Cpp_Token eq_token = array.tokens[i];
if (eq_token.type == CPP_TOKEN_EQ){
++i;
if (i < array.count){
Cpp_Token val_token = array.tokens[i];
++i;
if (i < array.count){
Cpp_Token semicolon_token = array.tokens[i];
if (semicolon_token.type == CPP_TOKEN_SEMICOLON){
read_setting_failed = 0;
String id = make_string(mem + id_token.start, id_token.size);
if (match(id, "enable_code_wrapping")){
if (val_token.type == CPP_TOKEN_BOOLEAN_CONSTANT){
String val = make_string(mem + val_token.start, val_token.size);
if (val.str[0] == 't'){
enable_code_wrapping = 1;
}
else{
enable_code_wrapping = 0;
}
}
}
else if (match(id, "default_wrap_width")){
if (val_token.type == CPP_TOKEN_INTEGER_CONSTANT){
String val = make_string(mem + val_token.start, val_token.size);
new_wrap_width = str_to_int(val);
}
}
else if (match(id, "default_min_base_width")){
if (val_token.type == CPP_TOKEN_INTEGER_CONSTANT){
String val = make_string(mem + val_token.start, val_token.size);
new_min_base_width = str_to_int(val);
}
}
}
}
}
}
}
}
Config_Line config_line = read_config_line(array, &i);
if (read_setting_failed){
for (; i < array.count; ++i){
Cpp_Token token = array.tokens[i];
if (token.type == CPP_TOKEN_SEMICOLON){
break;
if (config_line.read_success){
Config_Item item = get_config_item(config_line, mem);
config_bool_var(item, "enable_code_wrapping", 0, &enable_code_wrapping);
config_bool_var(item, "automatically_adjust_wrapping", 0, &automatically_adjust_wrapping);
config_int_var(item, "default_wrap_width", 0, &new_wrap_width);
config_int_var(item, "default_min_base_width", 0, &new_min_base_width);
config_string_var(item, "default_theme_name", 0, &default_theme_name);
config_string_var(item, "default_font_name", 0, &default_font_name);
}
}
adjust_all_buffer_wrap_widths(app, new_wrap_width, new_min_base_width);
}
}
end_temp_memory(temp);
}
else{
print_message(app, literal("Did not find config.4coder, using default settings"));
}
}
// NOTE(allen): Project system setup
static char *loaded_project = 0;
CUSTOM_COMMAND_SIG(load_project){
Partition *part = &global_part;
char project_file_space[512];
String project_name = make_fixed_width_string(project_file_space);
project_name.size = directory_get_hot(app, project_name.str, project_name.memory_size);
if (project_name.size >= project_name.memory_size){
project_name.size = 0;
}
if (project_name.size != 0){
append_sc(&project_name, "/project.4coder");
terminate_with_null(&project_name);
FILE *file = fopen(project_name.str, "rb");
if (file){
Temp_Memory temp = begin_temp_memory(part);
char *mem = 0;
int32_t size = 0;
bool32 file_read_success = file_handle_dump(part, file, &mem, &size);
if (file_read_success){
fclose(file);
Cpp_Token_Array array;
array.count = 0;
array.max_count = (1 << 20)/sizeof(Cpp_Token);
array.tokens = push_array(&global_part, Cpp_Token, array.max_count);
Cpp_Lex_Data S = cpp_lex_data_init();
Cpp_Lex_Result result = cpp_lex_step(&S, mem, size+1, HAS_NULL_TERM, &array, NO_OUT_LIMIT);
if (result == LexResult_Finished){
for (int32_t i = 0; i < array.count; ++i){
Config_Line config_line = read_config_line(array, &i);
if (config_line.read_success){
Config_Item item = get_config_item(config_line, mem);
{
String str = {0};
if (config_string_var(item, "extensions", 0, &str)){
// TODO(allen)
}
}
adjust_all_buffer_wrap_widths(app, new_wrap_width, new_min_base_width);
{
#if WIN
#define FKEY_COMMAND "fkey_command_wnd"
#else
#define FKEY_COMMAND "fkey_command_linux"
#endif
int32_t index = 0;
Config_Array_Reader array_reader = {0};
if (config_array_var(item, FKEY_COMMAND, &index, &array_reader)){
if (index >= 1 && index <= 16){
Config_Item array_item = {0};
int32_t item_index = 0;
for (config_array_next_item(&array_reader, &array_item);
config_array_good(&array_reader);
config_array_next_item(&array_reader, &array_item)){
if (item_index >= 2){
break;
}
switch (item_index){
case 0:
{
if (config_int_var(array_item, 0, 0, 0)){
// TODO(allen)
}
String str = {0};
if (config_string_var(array_item, 0, 0, &str)){
// TODO(allen)
}
}break;
case 1:
{
if (config_int_var(array_item, 0, 0, 0)){
// TODO(allen)
}
String str = {0};
if (config_string_var(array_item, 0, 0, &str)){
// TODO(allen)
}
}break;
}
item_index++;
}
}
}
}
}
}
end_temp_memory(temp);
}
else{
print_message(app, literal("Did not find config.4coder, using default settings"));
}
}
end_temp_memory(temp);
}
else{
char message_space[512];
String message = make_fixed_width_string(message_space);
append_sc(&message, "Did not find project.4coder. ");
if (loaded_project != 0){
append_sc(&message, "Continuing with: ");
append_sc(&message, loaded_project);
}
else{
append_sc(&message, "Continuing without a project");
}
print_message(app, message.str, message.size);
}
}
else{
print_message(app, literal("Failed trying to get project file name"));
}
}
#endif

View File

@ -245,6 +245,31 @@ get_rect(View_Summary *view){
return(rect);
}
inline i32_Rect
get_line_x_rect(View_Summary *view){
i32_Rect rect = {0};
if (view->unwrapped_lines){
rect.x0 = (int32_t)view->mark.unwrapped_x;
rect.x1 = (int32_t)view->cursor.unwrapped_x;
}
else{
rect.x0 = (int32_t)view->mark.wrapped_x;
rect.x1 = (int32_t)view->cursor.wrapped_x;
}
rect.y0 = view->mark.line;
rect.y1 = view->cursor.line;
if (rect.y0 > rect.y1){
Swap(int32_t, rect.y0, rect.y1);
}
if (rect.x0 > rect.x1){
Swap(int32_t, rect.x0, rect.x1);
}
return(rect);
}
inline void
exec_command(Application_Links *app, Custom_Command_Function *func){
func(app);

View File

@ -49,7 +49,7 @@ seek_unwrapped_xy(float x, float y, int32_t round_down){
}
static Buffer_Seek
seek_xy(float x, float y, int32_t round_down, int32_t unwrapped){
seek_xy(float x, float y, bool32 round_down, bool32 unwrapped){
Buffer_Seek result;
result.type = unwrapped?buffer_seek_unwrapped_xy:buffer_seek_wrapped_xy;
result.x = x;

12
4ed.cpp
View File

@ -2557,11 +2557,15 @@ App_Step_Sig(app_step){
if (input->first_step){
String welcome =
make_lit_string("Welcome to " VERSION "\n"
"If you're new to 4coder there's no tutorial yet :(\n"
"you can use the key combo <ctrl o> to look for a file\n"
"and if you load README.txt you'll find all the key combos there are.\n"
"If you're new to 4coder there are some tutorials at http://4coder.net/tutorials.html\n"
"\n"
"New in alpha 4.0.12:\n"
"Newest features:\n"
"-Option to have wrap widths automatically adjust based on average view width\n"
"-The 'config.4coder' file can now be placed with the 4ed executable file\n"
"-New options in 'config.4coder' to specify the font and color theme\n"
"-New built in project configuration system\n"
"\n"
"New in alpha 4.0.12 and 4.0.13:\n"
"-Text files wrap lines at whitespace when possible\n"
"-New code wrapping feature is on by default\n"
"-Introduced a 'config.4coder' for setting several wrapping options:"

View File

@ -2157,8 +2157,9 @@ directories controlled on the custom side.
Hot_Directory *hot = &cmd->models->hot_directory;
i32 copy_max = capacity - 1;
hot_directory_clean_end(hot);
if (copy_max > hot->string.size)
if (copy_max > hot->string.size){
copy_max = hot->string.size;
}
memcpy(out, hot->string.str, copy_max);
out[copy_max] = 0;
return(hot->string.size);

View File

@ -1270,7 +1270,10 @@ stickieness_guess(Cpp_Token_Type type, Cpp_Token_Type other_type, u16 flags, u16
type == CPP_TOKEN_BRACKET_OPEN ||
type == CPP_TOKEN_BRACKET_CLOSE){
if (on_left){
guess = 0;
guess = 20;
if (other_is_words){
guess = 100;
}
}
else{
guess = 100;

View File

@ -18,22 +18,26 @@ CUSTOM_COMMAND_SIG(kill_rect){
View_Summary view = get_active_view(app, AccessOpen);
Buffer_Summary buffer = get_buffer(app, view.buffer_id, AccessOpen);
Buffer_Rect rect = get_rect(&view);
i32_Rect rect = get_line_x_rect(&view);
for (int32_t line = rect.line1; line >= rect.line0; --line){
bool32 unwrapped = view.unwrapped_lines;
for (int32_t line = rect.y1; line >= rect.y0; --line){
int32_t start = 0;
int32_t end = 0;
int32_t success = 1;
bool32 success = 1;
Full_Cursor cursor = {0};
float y = (line-1) * view.line_height;
if (success){
success = view_compute_cursor(app, &view, seek_line_char(line, rect.char0), &cursor);
success = view_compute_cursor(app, &view, seek_xy((float)rect.x0, y, 0, unwrapped), &cursor);
}
start = cursor.pos;
if (success){
success = view_compute_cursor(app, &view, seek_line_char(line, rect.char1), &cursor);
success = view_compute_cursor(app, &view, seek_xy((float)rect.x1, y, 0, unwrapped), &cursor);
}
end = cursor.pos;
@ -607,58 +611,12 @@ CUSTOM_COMMAND_SIG(write_explicit_enum_values){
end_temp_memory(temp);
}
#include <stdio.h>
#define SETTINGS_FILE ".4coder_settings"
HOOK_SIG(experimental_start){
init_memory(app);
process_config_file(app);
char theme_name[128];
char font_name[128];
FILE *file = fopen(SETTINGS_FILE, "rb");
if (!file){
char module_path[512];
int len = 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);
String theme = make_string_slowly(theme_name);
String font = make_string_slowly(font_name);
replace_char(&theme, '#', ' ');
replace_char(&font, '#', ' ');
fclose(file);
int theme_len = (int)strlen(theme_name);
int font_len = (int)strlen(font_name);
change_theme(app, theme_name, theme_len);
change_font(app, font_name, font_len, true);
}
exec_command(app, open_panel_vsplit);
exec_command(app, hide_scrollbar);
exec_command(app, change_active_panel);
exec_command(app, hide_scrollbar);
return(0);
}
extern "C" int
get_bindings(void *data, int size){
Bind_Helper context_ = begin_bind_helper(data, size);
Bind_Helper *context = &context_;
set_hook(context, hook_start, experimental_start);
set_hook(context, hook_start, my_start);
set_hook(context, hook_view_size_change, my_view_adjust);
set_open_file_hook(context, my_file_settings);

35
project.4coder Normal file
View File

@ -0,0 +1,35 @@
extensions=".c.cpp.h.hpp";
fkey_command_wnd[1] = {"build.bat", "*compilation*"};
fkey_command_wnd[2] = {"..\\misc\\run.bat", 0};
fkey_command_wnd[3] = {"site\\build.bat", "*compilation*"};
fkey_command_wnd[4] = {0, 0};
fkey_command_wnd[5] = {0, 0};
fkey_command_wnd[6] = {0, 0};
fkey_command_wnd[7] = {0, 0};
fkey_command_wnd[8] = {0, 0};
fkey_command_wnd[9] = {0, 0};
fkey_command_wnd[10] = {0, 0};
fkey_command_wnd[11] = {0, 0};
fkey_command_wnd[12] = {"package.bat", "*compilation*"};
fkey_command_wnd[13] = {0, 0};
fkey_command_wnd[14] = {0, 0};
fkey_command_wnd[15] = {0, 0};
fkey_command_wnd[16] = {0, 0};
fkey_command_linux[1] = {"make", "*compilation*"};
fkey_command_linux[2] = {"../build/4ed", 0};
fkey_command_linux[3] = {"site/build.sh", "*compilation*"};
fkey_command_linux[4] = {0, 0};
fkey_command_linux[5] = {0, 0};
fkey_command_linux[6] = {0, 0};
fkey_command_linux[7] = {0, 0};
fkey_command_linux[8] = {0, 0};
fkey_command_linux[9] = {0, 0};
fkey_command_linux[10] = {0, 0};
fkey_command_linux[11] = {0, 0};
fkey_command_linux[12] = {"package.sh", "*compilation*"};
fkey_command_linux[13] = {0, 0};
fkey_command_linux[14] = {0, 0};
fkey_command_linux[15] = {0, 0};
fkey_command_linux[16] = {0, 0};