New idea for mac-4coder-like organization, added debug to command caller

master
Allen Webster 2017-11-08 19:56:26 -05:00
parent 30c16d6752
commit 7ee470cf6e
5 changed files with 530 additions and 626 deletions

View File

@ -870,7 +870,7 @@ STRUCT Binding_Unit{
STRUCT{ int32_t total_size; int32_t user_map_count; int32_t error; } header;
STRUCT{ int32_t mapid; int32_t replace; int32_t bind_count; } map_begin;
STRUCT{ int32_t mapid; } map_inherit;
STRUCT{ Key_Code code; uint8_t modifiers; int32_t command_id; } binding;
STRUCT{ Key_Code code; uint8_t modifiers; Command_ID command_id; } binding;
STRUCT{ Key_Code code; uint8_t modifiers; Custom_Command_Function *func; } callback;
STRUCT{ int32_t hook_id; void *func; } hook;
};

View File

@ -54,6 +54,22 @@ START_HOOK_SIG(default_start){
COMMAND_CALLER_HOOK(default_command_caller){
View_Summary view = get_active_view(app, AccessAll);
#if 1
#include <stdio.h>
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;

View File

@ -86,7 +86,7 @@ end_map(Bind_Helper *helper){
}
inline void
bind(Bind_Helper *helper, Key_Code code, uint8_t modifiers, int32_t cmdid){
bind(Bind_Helper *helper, Key_Code code, uint8_t modifiers, Command_ID cmdid){
if (helper->group == 0 && helper->error == 0) helper->error = BH_ERR_MISSING_BEGIN;
if (!helper->error) ++helper->group->map_begin.bind_count;
@ -113,6 +113,16 @@ bind(Bind_Helper *helper, Key_Code code, uint8_t modifiers, Custom_Command_Funct
write_unit(helper, unit);
}
inline void
bind(Bind_Helper *helper, Key_Code code, uint8_t modifiers, Generic_Command cmd){
if (cmd.cmdid < cmdid_count){
bind(helper, code, modifiers, cmd.cmdid);
}
else{
bind(helper, code, modifiers, cmd.command);
}
}
inline void
bind_vanilla_keys(Bind_Helper *helper, int32_t cmdid){
bind(helper, 0, 0, cmdid);

File diff suppressed because it is too large Load Diff

View File

@ -1070,7 +1070,7 @@ WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdS
}
LOG("Creating window... ");
i32 window_style = WS_CAPTION|WS_MINIMIZEBOX|WS_BORDER;
i32 window_style = WS_OVERLAPPEDWINDOW;
if (!plat_settings.fullscreen_window && plat_settings.maximize_window){
window_style |= WS_MAXIMIZE;
}