This commit is contained in:
Allen Webster 2016-02-21 21:45:41 -05:00
parent ca72d0f1e0
commit 46aaa4ac5b
6 changed files with 65 additions and 74 deletions

View File

@ -21,9 +21,6 @@ enum My_Maps{
}; };
HOOK_SIG(my_start){ HOOK_SIG(my_start){
exec_command(cmd_context, cmdid_open_panel_hsplit);
exec_command(cmd_context, cmdid_change_active_panel);
exec_command(cmd_context, cmdid_open_panel_vsplit); exec_command(cmd_context, cmdid_open_panel_vsplit);
exec_command(cmd_context, cmdid_change_active_panel); exec_command(cmd_context, cmdid_change_active_panel);
} }
@ -149,9 +146,16 @@ CUSTOM_COMMAND_SIG(build_search){
push_parameter(app, cmd_context, par_cli_path, dir.str, dir.size); push_parameter(app, cmd_context, par_cli_path, dir.str, dir.size);
if (append(&dir, "build")){ if (append(&dir, "build")){
#if 1
// NOTE(allen): This version avoids an unecessary copy, both equivalents are
// included to demonstrate how using push_parameter without the helper looks.
app->push_parameter(cmd_context, app->push_parameter(cmd_context,
dynamic_int(par_cli_command), dynamic_int(par_cli_command),
dynamic_string(dir.str, dir.size)); dynamic_string(dir.str, dir.size));
#else
push_parameter(cmd_context, par_cli_command, dir.str, dir.size);
#endif
exec_command(cmd_context, cmdid_build); exec_command(cmd_context, cmdid_build);
} }
else{ else{
@ -174,7 +178,7 @@ CUSTOM_COMMAND_SIG(write_and_auto_tab){
exec_command(cmd_context, cmdid_auto_tab_line_at_cursor); exec_command(cmd_context, cmdid_auto_tab_line_at_cursor);
} }
// NOTE(allen|a3.4): How one might go about writing things like cut_line // NOTE(allen|a3.4.1): How one might go about writing things like cut_line
// same idea works for cut word and other such composite commands. // same idea works for cut word and other such composite commands.
CUSTOM_COMMAND_SIG(cut_line){ CUSTOM_COMMAND_SIG(cut_line){
exec_command(cmd_context, cmdid_seek_beginning_of_line); exec_command(cmd_context, cmdid_seek_beginning_of_line);
@ -237,6 +241,7 @@ extern "C" GET_BINDING_DATA(get_bindings){
bind_me(context, ')', MDFR_NONE, write_and_auto_tab); bind_me(context, ')', MDFR_NONE, write_and_auto_tab);
bind_me(context, ']', MDFR_NONE, write_and_auto_tab); bind_me(context, ']', MDFR_NONE, write_and_auto_tab);
bind_me(context, ';', MDFR_NONE, write_and_auto_tab); bind_me(context, ';', MDFR_NONE, write_and_auto_tab);
bind_me(context, '#', MDFR_NONE, write_and_auto_tab);
bind(context, '\t', MDFR_NONE, cmdid_word_complete); bind(context, '\t', MDFR_NONE, cmdid_word_complete);
bind(context, '\t', MDFR_CTRL, cmdid_auto_tab_range); bind(context, '\t', MDFR_CTRL, cmdid_auto_tab_range);
@ -292,8 +297,6 @@ extern "C" GET_BINDING_DATA(get_bindings){
bind(context, '?', MDFR_CTRL, cmdid_toggle_show_whitespace); bind(context, '?', MDFR_CTRL, cmdid_toggle_show_whitespace);
bind(context, '~', MDFR_CTRL, cmdid_clean_all_lines); bind(context, '~', MDFR_CTRL, cmdid_clean_all_lines);
// NOTE(allen|a3.2): These now only set the mode of the file for writing to disk
// they do no longer effect the internal representation.
bind(context, '1', MDFR_CTRL, cmdid_eol_dosify); bind(context, '1', MDFR_CTRL, cmdid_eol_dosify);
bind(context, '!', MDFR_CTRL, cmdid_eol_nixify); bind(context, '!', MDFR_CTRL, cmdid_eol_nixify);
@ -312,19 +315,4 @@ extern "C" GET_BINDING_DATA(get_bindings){
return context->write_total; return context->write_total;
} }
inline void
strset_(char *dst, char *src){
do{
*dst++ = *src++;
}while (*src);
}
#define strset(d,s) if (sizeof(s) <= sizeof(d)) strset_(d,s)
extern "C" SET_EXTRA_FONT_SIG(set_extra_font){
strset(font_out->file_name, "liberation-mono.ttf");
strset(font_out->font_name, "BIG");
font_out->size = 25;
}

View File

@ -218,7 +218,8 @@ struct Extra_Font{
struct Buffer_Summary{ struct Buffer_Summary{
// NOTE(allen): None of these members nor any of the data pointed to // NOTE(allen): None of these members nor any of the data pointed to
// by these members should be modified. // by these members should be modified, I would have made them const...
// but that actually causes problems for C++ reasons.
int file_id; int file_id;
int size; int size;
@ -303,6 +304,7 @@ enum Binding_Unit_Type{
enum Map_ID{ enum Map_ID{
mapid_global = (1 << 24), mapid_global = (1 << 24),
mapid_file, mapid_file,
// NOTE(allen): mapid_nomap will remain empty even if you attempt to fill it // NOTE(allen): mapid_nomap will remain empty even if you attempt to fill it
// it is for setting a map's parent to nothing, in cases where you don't want // it is for setting a map's parent to nothing, in cases where you don't want
// to inherit from global (which is the default). // to inherit from global (which is the default).

View File

@ -2192,6 +2192,7 @@ setup_file_commands(Command_Map *commands, Partition *part, Key_Codes *codes, Co
map_add(commands, ')', MDFR_NONE, compose_write_auto_tab_line); map_add(commands, ')', MDFR_NONE, compose_write_auto_tab_line);
map_add(commands, ']', MDFR_NONE, compose_write_auto_tab_line); map_add(commands, ']', MDFR_NONE, compose_write_auto_tab_line);
map_add(commands, ';', MDFR_NONE, compose_write_auto_tab_line); map_add(commands, ';', MDFR_NONE, compose_write_auto_tab_line);
map_add(commands, '#', MDFR_NONE, compose_write_auto_tab_line);
map_add(commands, '\t', MDFR_NONE, command_word_complete); map_add(commands, '\t', MDFR_NONE, command_word_complete);
map_add(commands, '\t', MDFR_CTRL, command_auto_tab_range); map_add(commands, '\t', MDFR_CTRL, command_auto_tab_range);

View File

@ -1,35 +1,35 @@
/* /*
* Mr. 4th Dimention - Allen Webster * Mr. 4th Dimention - Allen Webster
* *
* 16.11.2014 * 16.11.2014
* *
* Win32-US Keyboard layer for 4coder * Keyboard layer for 4coder
* *
*/ */
// TOP // TOP
globalvar u8 keycode_lookup_table[255]; globalvar u8 keycode_lookup_table[255];
internal void internal void
set_dynamic_key_names(Key_Codes *codes){ set_dynamic_key_names(Key_Codes *codes){
u8 code = 1; u8 code = 1;
u8 *codes_array = (u8*)codes; u8 *codes_array = (u8*)codes;
for (i32 i = 0; i < sizeof(*codes)/sizeof(codes->up);){ for (i32 i = 0; i < sizeof(*codes)/sizeof(codes->up);){
switch (code){ switch (code){
case '\n': code++; break; case '\n': code++; break;
case '\t': code++; break; case '\t': code++; break;
case 0x20: code = 0x7F; break; case 0x20: code = 0x7F; break;
default: default:
codes_array[i++] = code++; codes_array[i++] = code++;
} }
} }
} }
inline u8 inline u8
keycode_lookup(u8 system_code){ keycode_lookup(u8 system_code){
return keycode_lookup_table[system_code]; return keycode_lookup_table[system_code];
} }
// BOTTOM // BOTTOM

View File

@ -1,17 +1,17 @@
@echo off @echo off
REM this is here to prevent the spammation of PATH REM this is here to prevent the spammation of PATH
IF NOT DEFINED clset (call "C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\vcvarsall.bat" x64) IF NOT DEFINED clset (call "C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\vcvarsall.bat" x64)
SET clset=64 SET clset=64
SET WARNINGS=/W4 /wd4310 /wd4100 /wd4201 /wd4505 /wd4996 /wd4127 /wd4510 /wd4512 /wd4610 /WX SET WARNINGS=/W4 /wd4310 /wd4100 /wd4201 /wd4505 /wd4996 /wd4127 /wd4510 /wd4512 /wd4610 /WX
SET STUFF=/GR- /nologo SET STUFF=/GR- /nologo
SET DEBUG=/Zi SET DEBUG=/Zi
SET EXPORTS=/EXPORT:get_bindings /EXPORT:set_extra_font SET EXPORTS=/EXPORT:get_bindings
cl %WARNINGS% %STUFF% %DEBUG% 4coder_custom.cpp /Fe4coder_custom /LD /link /INCREMENTAL:NO /OPT:REF %EXPORTS% cl %WARNINGS% %STUFF% %DEBUG% 4coder_custom.cpp /Fe4coder_custom /LD /link /INCREMENTAL:NO /OPT:REF %EXPORTS%
REM more spammation preventation REM file spammation preventation
del *.exp del *.exp
del *.obj del *.obj
del *.lib del *.lib

BIN
vc120.pdb

Binary file not shown.