changes to customization file setup

master
Allen Webster 2016-05-07 13:25:45 -04:00
parent b085323942
commit 52bf9471a4
7 changed files with 27 additions and 47 deletions

View File

@ -1,33 +0,0 @@
// Delete CustomCurrent to define your own customizations or
// set it to one of the preexisting options
#define Custom_Current Custom_Default
#define Custom_Default 1
// The following customization schemes are power users only:
#define Custom_HandmadeHero 2
// TOP
#if Custom_Current == Custom_Default
# include "4coder_default_bindings.cpp"
#elif Custom_Current == Custom_HandmadeHero
# include "power/4coder_casey.cpp"
#endif
extern "C" GET_BINDING_DATA(get_bindings){
Bind_Helper context_actual = begin_bind_helper(data, size);
Bind_Helper *context = &context_actual;
#if Custom_Current == Custom_Default
default_get_bindings(context, true);
#elif Custom_Current == Custom_HandmadeHero
casey_get_bindings(context);
#endif
end_bind_helper(context);
return context->write_total;
}
// BOTTOM

View File

@ -235,6 +235,7 @@ CUSTOM_COMMAND_SIG(build_at_launch_location){
exec_command(app, cmdid_command_line);
}
#if 0
// NOTE(allen|a4) See 4coder_styles.h for a list of available style tags.
// There are style tags corresponding to every color in the theme editor.
CUSTOM_COMMAND_SIG(improve_theme){
@ -264,15 +265,16 @@ CUSTOM_COMMAND_SIG(ruin_theme){
app->set_theme_colors(app, colors, count);
}
#endif
void default_get_bindings(Bind_Helper *context, int set_hooks){
int get_bindings(void *data, int size){
Bind_Helper context_ = begin_bind_helper(data, size);
Bind_Helper *context = &context_;
// NOTE(allen|a3.1): Hooks have no loyalties to maps. All hooks are global
// and once set they always apply, regardless of what map is active.
if (set_hooks){
set_hook(context, hook_start, my_start);
set_hook(context, hook_open_file, my_file_settings);
//set_hook(context, hook_frame, my_frame); // Example of a frame hook, but disabled by default.
}
set_hook(context, hook_start, my_start);
set_hook(context, hook_open_file, my_file_settings);
set_scroll_rule(context, smooth_scroll_rule);
@ -299,9 +301,6 @@ void default_get_bindings(Bind_Helper *context, int set_hooks){
bind(context, 'M', MDFR_ALT | MDFR_CTRL, open_my_files);
bind(context, 'M', MDFR_ALT, build_at_launch_location);
bind(context, '`', MDFR_ALT, improve_theme);
bind(context, '~', MDFR_ALT, ruin_theme);
end_map(context);
@ -431,6 +430,9 @@ void default_get_bindings(Bind_Helper *context, int set_hooks){
bind(context, 'T', MDFR_CTRL | MDFR_ALT, begin_html_mode);
end_map(context);
int result = end_bind_helper(context);
return(result);
}
// BOTTOM

View File

@ -172,12 +172,15 @@ set_scroll_rule(Bind_Helper *helper, Scroll_Rule_Function *func){
write_unit(helper, unit);
}
inline void
inline int
end_bind_helper(Bind_Helper *helper){
int result;
if (helper->header){
helper->header->header.total_size = (int)(helper->cursor - helper->start);
helper->header->header.error = helper->error;
}
result = helper->write_total;
return(result);
}
// NOTE(allen): Useful functions and overloads on app links

View File

@ -3959,7 +3959,9 @@ App_Step_Sig(app_step){
for (dll_items(panel, used_panels)){
view = panel->view;
if (view->current_scroll){
gui_get_scroll_vars(&view->gui_target, view->showing_ui, view->current_scroll);
GUI_Scroll_Vars vars = {0};
gui_get_scroll_vars(&view->gui_target, view->showing_ui, &vars);
view->current_scroll->region = vars.region;
}
}
}

View File

@ -1,5 +1,11 @@
#!/bin/bash
#!/bin/sh
g++ -Wno-write-strings -std=gnu++0x 4coder_custom.cpp -shared -o 4coder_custom.so -fPIC
SOURCE="$1"
if [ -z "$SOURCE" ]
then
SOURCE="4coder_default_bindings.cpp"
fi
g++ -Wno-write-strings -std=gnu++0x $SOURCE -shared -o 4coder_custom.so -fPIC

View File

@ -23,7 +23,7 @@
#include "4ed_mem.cpp"
#include "4ed_math.cpp"
#include "4coder_custom.cpp"
#include "4coder_default_bindings.cpp"
#undef exec_command
#undef exec_command_keep_stack

View File

@ -26,7 +26,7 @@
#include <stdlib.h>
#include "4coder_custom.cpp"
#include "4coder_default_bindings.cpp"
#undef exec_command
#undef exec_command_keep_stack