right alt
This commit is contained in:
parent
0aa1df3da0
commit
7009115967
|
@ -17,7 +17,9 @@
|
||||||
clear_parameters(cmd_context)
|
clear_parameters(cmd_context)
|
||||||
#define push_memory(cmd_context, len) app->push_memory(cmd_context, len)
|
#define push_memory(cmd_context, len) app->push_memory(cmd_context, len)
|
||||||
|
|
||||||
|
#ifndef literal
|
||||||
#define literal(s) s, (sizeof(s)-1)
|
#define literal(s) s, (sizeof(s)-1)
|
||||||
|
#endif
|
||||||
|
|
||||||
// NOTE(allen|a3.1): All of your custom ids should be >= mapid_user_custom.
|
// NOTE(allen|a3.1): All of your custom ids should be >= mapid_user_custom.
|
||||||
// I recommend enumerating your own map ids as shown here.
|
// I recommend enumerating your own map ids as shown here.
|
||||||
|
|
|
@ -132,6 +132,7 @@ enum Param_ID{
|
||||||
par_cli_path,
|
par_cli_path,
|
||||||
par_cli_command,
|
par_cli_command,
|
||||||
par_cli_overlap_with_conflict,
|
par_cli_overlap_with_conflict,
|
||||||
|
par_cli_always_bind_to_view,
|
||||||
// never below this
|
// never below this
|
||||||
par_type_count
|
par_type_count
|
||||||
};
|
};
|
||||||
|
@ -284,7 +285,7 @@ struct Application_Links{
|
||||||
Directory_CD *directory_cd;
|
Directory_CD *directory_cd;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct Config_API{
|
struct Custom_API{
|
||||||
Get_Binding_Data_Function *get_bindings;
|
Get_Binding_Data_Function *get_bindings;
|
||||||
Set_Extra_Font_Function *set_extra_font;
|
Set_Extra_Font_Function *set_extra_font;
|
||||||
};
|
};
|
||||||
|
|
68
4cpp_lexer.h
68
4cpp_lexer.h
|
@ -1537,41 +1537,47 @@ cpp_get_token(Cpp_Token_Stack *token_stack, int pos){
|
||||||
last = token_stack->count;
|
last = token_stack->count;
|
||||||
|
|
||||||
Cpp_Get_Token_Result result = {};
|
Cpp_Get_Token_Result result = {};
|
||||||
while (1){
|
if (token_stack->count > 0){
|
||||||
result.token_index = (first + last)/2;
|
for (;;){
|
||||||
|
result.token_index = (first + last)/2;
|
||||||
|
|
||||||
int this_start = token_stack->tokens[result.token_index].start;
|
int this_start = token_stack->tokens[result.token_index].start;
|
||||||
int next_start;
|
int next_start;
|
||||||
if (result.token_index + 1 < token_stack->count){
|
if (result.token_index + 1 < token_stack->count){
|
||||||
next_start = token_stack->tokens[result.token_index+1].start;
|
next_start = token_stack->tokens[result.token_index+1].start;
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
next_start = this_start + token_stack->tokens[result.token_index].size;
|
||||||
|
}
|
||||||
|
if (this_start <= pos && pos < next_start){
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
else if (pos < this_start){
|
||||||
|
last = result.token_index;
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
first = result.token_index + 1;
|
||||||
|
}
|
||||||
|
if (first == last){
|
||||||
|
result.token_index = first;
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else{
|
|
||||||
next_start = this_start + token_stack->tokens[result.token_index].size;
|
|
||||||
}
|
|
||||||
if (this_start <= pos && pos < next_start){
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
else if (pos < this_start){
|
|
||||||
last = result.token_index;
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
first = result.token_index + 1;
|
|
||||||
}
|
|
||||||
if (first == last){
|
|
||||||
result.token_index = first;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (result.token_index == token_stack->count){
|
if (result.token_index == token_stack->count){
|
||||||
--result.token_index;
|
--result.token_index;
|
||||||
result.in_whitespace = 1;
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
Cpp_Token *token = token_stack->tokens + result.token_index;
|
|
||||||
if (token->start + token->size <= pos){
|
|
||||||
result.in_whitespace = 1;
|
result.in_whitespace = 1;
|
||||||
}
|
}
|
||||||
|
else{
|
||||||
|
Cpp_Token *token = token_stack->tokens + result.token_index;
|
||||||
|
if (token->start + token->size <= pos){
|
||||||
|
result.in_whitespace = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
result.token_index = -1;
|
||||||
|
result.in_whitespace = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
|
@ -1612,7 +1618,7 @@ cpp_relex_nonalloc_start(Cpp_File file, Cpp_Token_Stack *stack,
|
||||||
else{
|
else{
|
||||||
state.start_token_i = result.token_index-1;
|
state.start_token_i = result.token_index-1;
|
||||||
}
|
}
|
||||||
|
|
||||||
result = cpp_get_token(stack, end);
|
result = cpp_get_token(stack, end);
|
||||||
if (result.token_index < 0) result.token_index = 0;
|
if (result.token_index < 0) result.token_index = 0;
|
||||||
else if (end > stack->tokens[result.token_index].start) ++result.token_index;
|
else if (end > stack->tokens[result.token_index].start) ++result.token_index;
|
||||||
|
|
29
4ed.h
29
4ed.h
|
@ -26,15 +26,17 @@ enum Key_Control{
|
||||||
CONTROL_KEY_SHIFT,
|
CONTROL_KEY_SHIFT,
|
||||||
CONTROL_KEY_CONTROL,
|
CONTROL_KEY_CONTROL,
|
||||||
CONTROL_KEY_ALT,
|
CONTROL_KEY_ALT,
|
||||||
|
CONTROL_KEY_CAPS,
|
||||||
// always last
|
// always last
|
||||||
CONTROL_KEY_COUNT
|
CONTROL_KEY_COUNT
|
||||||
};
|
};
|
||||||
|
|
||||||
struct Key_Event_Data{
|
struct Key_Event_Data{
|
||||||
u8 keycode;
|
u8 keycode;
|
||||||
//u8 apply_shift;
|
|
||||||
u8 character;
|
u8 character;
|
||||||
u8 character_no_caps_lock;
|
u8 character_no_caps_lock;
|
||||||
|
|
||||||
|
b8 modifiers[CONTROL_KEY_COUNT];
|
||||||
};
|
};
|
||||||
|
|
||||||
struct Key_Input_Data{
|
struct Key_Input_Data{
|
||||||
|
@ -42,37 +44,28 @@ struct Key_Input_Data{
|
||||||
Key_Event_Data hold[KEY_INPUT_BUFFER_SIZE];
|
Key_Event_Data hold[KEY_INPUT_BUFFER_SIZE];
|
||||||
i32 press_count;
|
i32 press_count;
|
||||||
i32 hold_count;
|
i32 hold_count;
|
||||||
|
|
||||||
b8 control_keys[CONTROL_KEY_COUNT];
|
|
||||||
b8 caps_lock;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
struct Key_Summary{
|
struct Key_Summary{
|
||||||
i32 count;
|
i32 count;
|
||||||
Key_Event_Data keys[KEY_INPUT_BUFFER_DSIZE];
|
Key_Event_Data keys[KEY_INPUT_BUFFER_DSIZE];
|
||||||
bool8 modifiers[CONTROL_KEY_COUNT];
|
|
||||||
};
|
};
|
||||||
|
|
||||||
struct Key_Single{
|
inline Key_Event_Data
|
||||||
Key_Event_Data key;
|
|
||||||
b8 *modifiers;
|
|
||||||
};
|
|
||||||
|
|
||||||
inline Key_Single
|
|
||||||
get_single_key(Key_Summary *summary, i32 index){
|
get_single_key(Key_Summary *summary, i32 index){
|
||||||
Assert(index >= 0 && index < summary->count);
|
Assert(index >= 0 && index < summary->count);
|
||||||
Key_Single key;
|
Key_Event_Data key;
|
||||||
key.key = summary->keys[index];
|
key = summary->keys[index];
|
||||||
key.modifiers = summary->modifiers;
|
|
||||||
return key;
|
return key;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct Mouse_State{
|
struct Mouse_State{
|
||||||
b32 out_of_window;
|
b32 out_of_window;
|
||||||
b32 left_button, right_button;
|
b8 left_button, right_button;
|
||||||
b32 left_button_prev, right_button_prev;
|
b8 left_button_pressed, right_button_pressed;
|
||||||
i32 x, y;
|
b8 left_button_released, right_button_released;
|
||||||
i16 wheel;
|
i16 wheel;
|
||||||
|
i32 x, y;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct Mouse_Summary{
|
struct Mouse_Summary{
|
||||||
|
@ -135,7 +128,7 @@ struct Exchange{
|
||||||
Key_Codes *loose_codes, \
|
Key_Codes *loose_codes, \
|
||||||
Clipboard_Contents clipboard, \
|
Clipboard_Contents clipboard, \
|
||||||
String current_directory, \
|
String current_directory, \
|
||||||
Config_API api)
|
Custom_API api)
|
||||||
|
|
||||||
typedef App_Init_Sig(App_Init);
|
typedef App_Init_Sig(App_Init);
|
||||||
|
|
||||||
|
|
|
@ -190,7 +190,7 @@ draw_rgb_slider(Render_Target *target, Vec4 base, i32 channel,
|
||||||
}
|
}
|
||||||
|
|
||||||
internal void
|
internal void
|
||||||
do_label(UI_State *state, UI_Layout *layout, char *text, f32 height = 2.f){
|
do_label(UI_State *state, UI_Layout *layout, char *text, int text_size, f32 height = 2.f){
|
||||||
Style *style = state->style;
|
Style *style = state->style;
|
||||||
i16 font_id = style->font_id;
|
i16 font_id = style->font_id;
|
||||||
i32 line_height = get_font_info(state->font_set, font_id)->height;
|
i32 line_height = get_font_info(state->font_set, font_id)->height;
|
||||||
|
@ -202,11 +202,18 @@ do_label(UI_State *state, UI_Layout *layout, char *text, f32 height = 2.f){
|
||||||
u32 fore = style->main.default_color;
|
u32 fore = style->main.default_color;
|
||||||
draw_rectangle(target, label, back);
|
draw_rectangle(target, label, back);
|
||||||
i32 height = label.y1 - label.y0;
|
i32 height = label.y1 - label.y0;
|
||||||
draw_string(target, font_id, text, label.x0,
|
|
||||||
|
String textstr = make_string(text, text_size);
|
||||||
|
draw_string(target, font_id, textstr, label.x0,
|
||||||
label.y0 + (height - line_height)/2, fore);
|
label.y0 + (height - line_height)/2, fore);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inline void
|
||||||
|
do_label(UI_State *state, UI_Layout *layout, String text, f32 height = 2.f){
|
||||||
|
do_label(state, layout, text.str, text.size, height);
|
||||||
|
}
|
||||||
|
|
||||||
internal void
|
internal void
|
||||||
do_scroll_bar(UI_State *state, i32_Rect rect){
|
do_scroll_bar(UI_State *state, i32_Rect rect){
|
||||||
i32 id = 1;
|
i32 id = 1;
|
||||||
|
@ -447,19 +454,19 @@ do_channel_field(i32 sub_id, Color_UI *ui, u8 *channel, Channel_Field_Type ftype
|
||||||
Key_Summary *keys = ui->state.keys;
|
Key_Summary *keys = ui->state.keys;
|
||||||
Key_Codes *codes = ui->state.codes;
|
Key_Codes *codes = ui->state.codes;
|
||||||
for (i32 key_i = 0; key_i < keys->count; ++key_i){
|
for (i32 key_i = 0; key_i < keys->count; ++key_i){
|
||||||
Key_Single key = get_single_key(keys, key_i);
|
Key_Event_Data key = get_single_key(keys, key_i);
|
||||||
|
|
||||||
if (key.key.keycode == codes->right){
|
if (key.keycode == codes->right){
|
||||||
++indx;
|
++indx;
|
||||||
if (indx > digit_count-1) indx = 0;
|
if (indx > digit_count-1) indx = 0;
|
||||||
}
|
}
|
||||||
if (key.key.keycode == codes->left){
|
if (key.keycode == codes->left){
|
||||||
--indx;
|
--indx;
|
||||||
if (indx < 0) indx = digit_count-1;
|
if (indx < 0) indx = digit_count-1;
|
||||||
}
|
}
|
||||||
|
|
||||||
i32 new_value = *channel;
|
i32 new_value = *channel;
|
||||||
if (key.key.keycode == codes->up || key.key.keycode == codes->down){
|
if (key.keycode == codes->up || key.keycode == codes->down){
|
||||||
i32 place = digit_count-1-indx;
|
i32 place = digit_count-1-indx;
|
||||||
i32 base = (ftype == CF_DEC)?10:0x10;
|
i32 base = (ftype == CF_DEC)?10:0x10;
|
||||||
i32 step_amount = 1;
|
i32 step_amount = 1;
|
||||||
|
@ -467,13 +474,13 @@ do_channel_field(i32 sub_id, Color_UI *ui, u8 *channel, Channel_Field_Type ftype
|
||||||
step_amount *= base;
|
step_amount *= base;
|
||||||
--place;
|
--place;
|
||||||
}
|
}
|
||||||
if (key.key.keycode == codes->down){
|
if (key.keycode == codes->down){
|
||||||
step_amount = 0 - step_amount;
|
step_amount = 0 - step_amount;
|
||||||
}
|
}
|
||||||
new_value += step_amount;
|
new_value += step_amount;
|
||||||
}
|
}
|
||||||
|
|
||||||
u8 c = (u8)key.key.character;
|
u8 c = (u8)key.character;
|
||||||
bool32 is_good = (ftype == CF_DEC)?char_is_numeric(c):char_is_hex(c);
|
bool32 is_good = (ftype == CF_DEC)?char_is_numeric(c):char_is_hex(c);
|
||||||
if (is_good){
|
if (is_good){
|
||||||
string_buffer[indx] = c;
|
string_buffer[indx] = c;
|
||||||
|
@ -1563,7 +1570,7 @@ step_draw_library(System_Functions *system, Exchange *exchange, Mem_Options *mem
|
||||||
switch (mode){
|
switch (mode){
|
||||||
case CV_MODE_LIBRARY:
|
case CV_MODE_LIBRARY:
|
||||||
{
|
{
|
||||||
do_label(&ui.state, &ui.layout, "Current Theme - Click to Edit");
|
do_label(&ui.state, &ui.layout, literal("Current Theme - Click to Edit"));
|
||||||
if (do_style_preview(&ui, color_view->main_style)){
|
if (do_style_preview(&ui, color_view->main_style)){
|
||||||
color_view->mode = CV_MODE_ADJUSTING;
|
color_view->mode = CV_MODE_ADJUSTING;
|
||||||
color_view->state.selected = {};
|
color_view->state.selected = {};
|
||||||
|
@ -1592,7 +1599,7 @@ step_draw_library(System_Functions *system, Exchange *exchange, Mem_Options *mem
|
||||||
memset(color_view->import_export_check, 0, sizeof(color_view->import_export_check));
|
memset(color_view->import_export_check, 0, sizeof(color_view->import_export_check));
|
||||||
}
|
}
|
||||||
|
|
||||||
do_label(&ui.state, &ui.layout, "Theme Library - Click to Select");
|
do_label(&ui.state, &ui.layout, literal("Theme Library - Click to Select"));
|
||||||
|
|
||||||
i32 style_count = color_view->styles->count;
|
i32 style_count = color_view->styles->count;
|
||||||
Style *style = color_view->styles->styles;
|
Style *style = color_view->styles->styles;
|
||||||
|
@ -1606,12 +1613,12 @@ step_draw_library(System_Functions *system, Exchange *exchange, Mem_Options *mem
|
||||||
|
|
||||||
case CV_MODE_IMPORT_FILE:
|
case CV_MODE_IMPORT_FILE:
|
||||||
{
|
{
|
||||||
do_label(&ui.state, &ui.layout, "Current Theme");
|
do_label(&ui.state, &ui.layout, literal("Current Theme"));
|
||||||
do_style_preview(&ui, color_view->main_style);
|
do_style_preview(&ui, color_view->main_style);
|
||||||
|
|
||||||
b32 file_selected = 0;
|
b32 file_selected = 0;
|
||||||
|
|
||||||
do_label(&ui.state, &ui.layout, "Import Which File?");
|
do_label(&ui.state, &ui.layout, literal("Import Which File?"));
|
||||||
begin_row(&ui.layout, 2);
|
begin_row(&ui.layout, 2);
|
||||||
if (do_button(-2, &ui.state, &ui.layout, "*.p4c only", 2, 1, color_view->p4c_only)){
|
if (do_button(-2, &ui.state, &ui.layout, "*.p4c only", 2, 1, color_view->p4c_only)){
|
||||||
color_view->p4c_only = !color_view->p4c_only;
|
color_view->p4c_only = !color_view->p4c_only;
|
||||||
|
@ -1671,12 +1678,12 @@ step_draw_library(System_Functions *system, Exchange *exchange, Mem_Options *mem
|
||||||
|
|
||||||
case CV_MODE_EXPORT_FILE:
|
case CV_MODE_EXPORT_FILE:
|
||||||
{
|
{
|
||||||
do_label(&ui.state, &ui.layout, "Current Theme");
|
do_label(&ui.state, &ui.layout, literal("Current Theme"));
|
||||||
do_style_preview(&ui, color_view->main_style);
|
do_style_preview(&ui, color_view->main_style);
|
||||||
|
|
||||||
b32 file_selected = 0;
|
b32 file_selected = 0;
|
||||||
|
|
||||||
do_label(&ui.state, &ui.layout, "Export File Name?");
|
do_label(&ui.state, &ui.layout, literal("Export File Name?"));
|
||||||
begin_row(&ui.layout, 2);
|
begin_row(&ui.layout, 2);
|
||||||
if (do_button(-2, &ui.state, &ui.layout, "Finish Export", 2)){
|
if (do_button(-2, &ui.state, &ui.layout, "Finish Export", 2)){
|
||||||
file_selected = 1;
|
file_selected = 1;
|
||||||
|
@ -1722,14 +1729,14 @@ step_draw_library(System_Functions *system, Exchange *exchange, Mem_Options *mem
|
||||||
|
|
||||||
case CV_MODE_IMPORT:
|
case CV_MODE_IMPORT:
|
||||||
{
|
{
|
||||||
do_label(&ui.state, &ui.layout, "Current Theme");
|
do_label(&ui.state, &ui.layout, literal("Current Theme"));
|
||||||
do_style_preview(&ui, color_view->main_style);
|
do_style_preview(&ui, color_view->main_style);
|
||||||
|
|
||||||
i32 style_count = color_view->inspecting_styles.count;
|
i32 style_count = color_view->inspecting_styles.count;
|
||||||
Style *styles = color_view->inspecting_styles.styles;
|
Style *styles = color_view->inspecting_styles.styles;
|
||||||
bool8 *import_check = color_view->import_export_check;
|
bool8 *import_check = color_view->import_export_check;
|
||||||
|
|
||||||
do_label(&ui.state, &ui.layout, "Pack");
|
do_label(&ui.state, &ui.layout, literal("Pack"));
|
||||||
begin_row(&ui.layout, 2);
|
begin_row(&ui.layout, 2);
|
||||||
if (do_button(-2, &ui.state, &ui.layout, "Finish Import", 2)){
|
if (do_button(-2, &ui.state, &ui.layout, "Finish Import", 2)){
|
||||||
Style *style = styles;
|
Style *style = styles;
|
||||||
|
@ -1753,10 +1760,10 @@ step_draw_library(System_Functions *system, Exchange *exchange, Mem_Options *mem
|
||||||
|
|
||||||
case CV_MODE_EXPORT:
|
case CV_MODE_EXPORT:
|
||||||
{
|
{
|
||||||
do_label(&ui.state, &ui.layout, "Current Theme");
|
do_label(&ui.state, &ui.layout, literal("Current Theme"));
|
||||||
do_style_preview(&ui, color_view->main_style);
|
do_style_preview(&ui, color_view->main_style);
|
||||||
|
|
||||||
do_label(&ui.state, &ui.layout, "Export Which Themes?");
|
do_label(&ui.state, &ui.layout, literal("Export Which Themes?"));
|
||||||
begin_row(&ui.layout, 2);
|
begin_row(&ui.layout, 2);
|
||||||
if (do_button(-2, &ui.state, &ui.layout, "Export", 2)){
|
if (do_button(-2, &ui.state, &ui.layout, "Export", 2)){
|
||||||
color_view->mode = CV_MODE_EXPORT_FILE;
|
color_view->mode = CV_MODE_EXPORT_FILE;
|
||||||
|
|
|
@ -126,7 +126,7 @@ apply_shift_to_code(u8 keycode){
|
||||||
}
|
}
|
||||||
|
|
||||||
internal Command_Binding
|
internal Command_Binding
|
||||||
map_extract(Command_Map *map, Key_Single key){
|
map_extract(Command_Map *map, Key_Event_Data key){
|
||||||
Command_Binding bind = {};
|
Command_Binding bind = {};
|
||||||
|
|
||||||
b32 ctrl = key.modifiers[CONTROL_KEY_CONTROL];
|
b32 ctrl = key.modifiers[CONTROL_KEY_CONTROL];
|
||||||
|
@ -135,16 +135,16 @@ map_extract(Command_Map *map, Key_Single key){
|
||||||
u16 code;
|
u16 code;
|
||||||
u8 command = MDFR_NONE;
|
u8 command = MDFR_NONE;
|
||||||
|
|
||||||
if (key.key.character_no_caps_lock != 0 &&
|
if (key.character_no_caps_lock != 0 &&
|
||||||
key.key.character_no_caps_lock != ' ') shift = 0;
|
key.character_no_caps_lock != ' ') shift = 0;
|
||||||
|
|
||||||
if (shift) command |= MDFR_SHIFT;
|
if (shift) command |= MDFR_SHIFT;
|
||||||
if (ctrl) command |= MDFR_CTRL;
|
if (ctrl) command |= MDFR_CTRL;
|
||||||
if (alt) command |= MDFR_ALT;
|
if (alt) command |= MDFR_ALT;
|
||||||
|
|
||||||
code = key.key.character_no_caps_lock;
|
code = key.character_no_caps_lock;
|
||||||
if (code == 0){
|
if (code == 0){
|
||||||
code = key.key.keycode;
|
code = key.keycode;
|
||||||
map_find(map, code, command, &bind);
|
map_find(map, code, command, &bind);
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
|
|
|
@ -218,9 +218,12 @@ draw_os_events(Debug_View *view, i32_Rect rect, Render_Target *target,
|
||||||
|
|
||||||
i16 font_id = view->font_id;
|
i16 font_id = view->font_id;
|
||||||
i32 line_height = get_font_info(&target->font_set, font_id)->height;
|
i32 line_height = get_font_info(&target->font_set, font_id)->height;
|
||||||
|
|
||||||
|
#if 0
|
||||||
draw_modifiers(view, target, active_input->keys.modifiers,
|
draw_modifiers(view, target, active_input->keys.modifiers,
|
||||||
0xFFFFFFFF, 0xFF444444, &x, y);
|
0xFFFFFFFF, 0xFF444444, &x, y);
|
||||||
|
#endif
|
||||||
|
|
||||||
max_x = x;
|
max_x = x;
|
||||||
x = rect.x0;
|
x = rect.x0;
|
||||||
y += line_height;
|
y += line_height;
|
||||||
|
@ -325,7 +328,8 @@ step_debug_view(Debug_View *view, i32_Rect rect, Render_Target *target,
|
||||||
Input_Summary *active_input){
|
Input_Summary *active_input){
|
||||||
persist i32 max_past = ArrayCount(view->past_keys);
|
persist i32 max_past = ArrayCount(view->past_keys);
|
||||||
|
|
||||||
bool8 *modifiers = active_input->keys.modifiers;
|
#if 0
|
||||||
|
b8 *modifiers = active_input->keys.modifiers;
|
||||||
for (i32 i = 0; i < active_input->keys.count; ++i){
|
for (i32 i = 0; i < active_input->keys.count; ++i){
|
||||||
Dbg_Past_Key *past_key = view->past_keys + view->past_key_pos;
|
Dbg_Past_Key *past_key = view->past_keys + view->past_key_pos;
|
||||||
++view->past_key_pos;
|
++view->past_key_pos;
|
||||||
|
@ -350,6 +354,7 @@ step_debug_view(Debug_View *view, i32_Rect rect, Render_Target *target,
|
||||||
|
|
||||||
if (active_input->mouse.wheel_used)
|
if (active_input->mouse.wheel_used)
|
||||||
view->prev_mouse_wheel = active_input->mouse.wheel_amount;
|
view->prev_mouse_wheel = active_input->mouse.wheel_amount;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
internal
|
internal
|
||||||
|
|
|
@ -95,6 +95,7 @@ struct Editing_File_Settings{
|
||||||
i32 dos_write_mode;
|
i32 dos_write_mode;
|
||||||
b32 tokens_exist;
|
b32 tokens_exist;
|
||||||
b32 super_locked;
|
b32 super_locked;
|
||||||
|
b32 is_initialized;
|
||||||
};
|
};
|
||||||
|
|
||||||
// NOTE(allen): This part of the Editing_File is cleared whenever
|
// NOTE(allen): This part of the Editing_File is cleared whenever
|
||||||
|
@ -425,10 +426,10 @@ struct Single_Line_Mode{
|
||||||
internal Single_Line_Input_Step
|
internal Single_Line_Input_Step
|
||||||
app_single_line_input_core(System_Functions *system,
|
app_single_line_input_core(System_Functions *system,
|
||||||
Key_Codes *codes, Working_Set *working_set,
|
Key_Codes *codes, Working_Set *working_set,
|
||||||
Key_Single key, Single_Line_Mode mode){
|
Key_Event_Data key, Single_Line_Mode mode){
|
||||||
Single_Line_Input_Step result = {};
|
Single_Line_Input_Step result = {};
|
||||||
|
|
||||||
if (key.key.keycode == codes->back){
|
if (key.keycode == codes->back){
|
||||||
result.hit_backspace = 1;
|
result.hit_backspace = 1;
|
||||||
if (mode.string->size > 0){
|
if (mode.string->size > 0){
|
||||||
result.made_a_change = 1;
|
result.made_a_change = 1;
|
||||||
|
@ -453,7 +454,7 @@ app_single_line_input_core(System_Functions *system,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (key.key.character == '\n' || key.key.character == '\t'){
|
else if (key.character == '\n' || key.character == '\t'){
|
||||||
result.made_a_change = 1;
|
result.made_a_change = 1;
|
||||||
if (key.modifiers[CONTROL_KEY_CONTROL] ||
|
if (key.modifiers[CONTROL_KEY_CONTROL] ||
|
||||||
key.modifiers[CONTROL_KEY_ALT]){
|
key.modifiers[CONTROL_KEY_ALT]){
|
||||||
|
@ -490,17 +491,17 @@ app_single_line_input_core(System_Functions *system,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (key.key.keycode == codes->esc){
|
else if (key.keycode == codes->esc){
|
||||||
result.hit_esc = 1;
|
result.hit_esc = 1;
|
||||||
result.made_a_change = 1;
|
result.made_a_change = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (key.key.character){
|
else if (key.character){
|
||||||
result.hit_a_character = 1;
|
result.hit_a_character = 1;
|
||||||
if (!key.modifiers[CONTROL_KEY_CONTROL] &&
|
if (!key.modifiers[CONTROL_KEY_CONTROL] &&
|
||||||
!key.modifiers[CONTROL_KEY_ALT]){
|
!key.modifiers[CONTROL_KEY_ALT]){
|
||||||
if (mode.string->size+1 < mode.string->memory_size){
|
if (mode.string->size+1 < mode.string->memory_size){
|
||||||
u8 new_character = (u8)key.key.character;
|
u8 new_character = (u8)key.character;
|
||||||
mode.string->str[mode.string->size] = new_character;
|
mode.string->str[mode.string->size] = new_character;
|
||||||
mode.string->size++;
|
mode.string->size++;
|
||||||
mode.string->str[mode.string->size] = 0;
|
mode.string->str[mode.string->size] = 0;
|
||||||
|
@ -521,7 +522,7 @@ app_single_line_input_core(System_Functions *system,
|
||||||
|
|
||||||
inline Single_Line_Input_Step
|
inline Single_Line_Input_Step
|
||||||
app_single_line_input_step(System_Functions *system,
|
app_single_line_input_step(System_Functions *system,
|
||||||
Key_Codes *codes, Key_Single key, String *string){
|
Key_Codes *codes, Key_Event_Data key, String *string){
|
||||||
Single_Line_Mode mode = {};
|
Single_Line_Mode mode = {};
|
||||||
mode.type = SINGLE_LINE_STRING;
|
mode.type = SINGLE_LINE_STRING;
|
||||||
mode.string = string;
|
mode.string = string;
|
||||||
|
@ -530,7 +531,7 @@ app_single_line_input_step(System_Functions *system,
|
||||||
|
|
||||||
inline Single_Line_Input_Step
|
inline Single_Line_Input_Step
|
||||||
app_single_file_input_step(System_Functions *system,
|
app_single_file_input_step(System_Functions *system,
|
||||||
Key_Codes *codes, Working_Set *working_set, Key_Single key,
|
Key_Codes *codes, Working_Set *working_set, Key_Event_Data key,
|
||||||
String *string, Hot_Directory *hot_directory,
|
String *string, Hot_Directory *hot_directory,
|
||||||
bool32 fast_folder_select){
|
bool32 fast_folder_select){
|
||||||
Single_Line_Mode mode = {};
|
Single_Line_Mode mode = {};
|
||||||
|
@ -543,13 +544,13 @@ app_single_file_input_step(System_Functions *system,
|
||||||
|
|
||||||
inline Single_Line_Input_Step
|
inline Single_Line_Input_Step
|
||||||
app_single_number_input_step(System_Functions *system,
|
app_single_number_input_step(System_Functions *system,
|
||||||
Key_Codes *codes, Key_Single key, String *string){
|
Key_Codes *codes, Key_Event_Data key, String *string){
|
||||||
Single_Line_Input_Step result = {};
|
Single_Line_Input_Step result = {};
|
||||||
Single_Line_Mode mode = {};
|
Single_Line_Mode mode = {};
|
||||||
mode.type = SINGLE_LINE_STRING;
|
mode.type = SINGLE_LINE_STRING;
|
||||||
mode.string = string;
|
mode.string = string;
|
||||||
|
|
||||||
char c = (char)key.key.character;
|
char c = (char)key.character;
|
||||||
if (c == 0 || c == '\n' || char_is_numeric(c))
|
if (c == 0 || c == '\n' || char_is_numeric(c))
|
||||||
result = app_single_line_input_core(system, codes, 0, key, mode);
|
result = app_single_line_input_core(system, codes, 0, key, mode);
|
||||||
return result;
|
return result;
|
||||||
|
@ -936,8 +937,8 @@ ui_do_text_field_input(UI_State *state, String *str){
|
||||||
bool32 result = 0;
|
bool32 result = 0;
|
||||||
Key_Summary *keys = state->keys;
|
Key_Summary *keys = state->keys;
|
||||||
for (i32 key_i = 0; key_i < keys->count; ++key_i){
|
for (i32 key_i = 0; key_i < keys->count; ++key_i){
|
||||||
Key_Single key = get_single_key(keys, key_i);
|
Key_Event_Data key = get_single_key(keys, key_i);
|
||||||
char c = (char)key.key.character;
|
char c = (char)key.character;
|
||||||
if (char_is_basic(c) && str->size < str->memory_size-1){
|
if (char_is_basic(c) && str->size < str->memory_size-1){
|
||||||
str->str[str->size++] = c;
|
str->str[str->size++] = c;
|
||||||
str->str[str->size] = 0;
|
str->str[str->size] = 0;
|
||||||
|
@ -945,7 +946,7 @@ ui_do_text_field_input(UI_State *state, String *str){
|
||||||
else if (c == '\n'){
|
else if (c == '\n'){
|
||||||
result = 1;
|
result = 1;
|
||||||
}
|
}
|
||||||
else if (key.key.keycode == state->codes->back && str->size > 0){
|
else if (key.keycode == state->codes->back && str->size > 0){
|
||||||
str->str[--str->size] = 0;
|
str->str[--str->size] = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -958,7 +959,7 @@ ui_do_file_field_input(System_Functions *system,
|
||||||
bool32 result = 0;
|
bool32 result = 0;
|
||||||
Key_Summary *keys = state->keys;
|
Key_Summary *keys = state->keys;
|
||||||
for (i32 key_i = 0; key_i < keys->count; ++key_i){
|
for (i32 key_i = 0; key_i < keys->count; ++key_i){
|
||||||
Key_Single key = get_single_key(keys, key_i);
|
Key_Event_Data key = get_single_key(keys, key_i);
|
||||||
String *str = &hot_dir->string;
|
String *str = &hot_dir->string;
|
||||||
terminate_with_null(str);
|
terminate_with_null(str);
|
||||||
Single_Line_Input_Step step =
|
Single_Line_Input_Step step =
|
||||||
|
@ -974,7 +975,7 @@ ui_do_line_field_input(System_Functions *system,
|
||||||
bool32 result = 0;
|
bool32 result = 0;
|
||||||
Key_Summary *keys = state->keys;
|
Key_Summary *keys = state->keys;
|
||||||
for (i32 key_i = 0; key_i < keys->count; ++key_i){
|
for (i32 key_i = 0; key_i < keys->count; ++key_i){
|
||||||
Key_Single key = get_single_key(keys, key_i);
|
Key_Event_Data key = get_single_key(keys, key_i);
|
||||||
terminate_with_null(string);
|
terminate_with_null(string);
|
||||||
Single_Line_Input_Step step =
|
Single_Line_Input_Step step =
|
||||||
app_single_line_input_step(system, state->codes, key, string);
|
app_single_line_input_step(system, state->codes, key, string);
|
||||||
|
@ -1552,10 +1553,8 @@ working_set_get_available_file(Working_Set *working_set){
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (result.file){
|
if (result.file) *result.file = {};
|
||||||
*result.file = {};
|
|
||||||
}
|
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
@ -1639,7 +1638,7 @@ Job_Callback_Sig(job_full_lex){
|
||||||
status = cpp_lex_file_nonalloc(cpp_file, &tokens, status);
|
status = cpp_lex_file_nonalloc(cpp_file, &tokens, status);
|
||||||
}
|
}
|
||||||
|
|
||||||
i32 new_max = LargeRoundUp(tokens.count, Kbytes(1));
|
i32 new_max = LargeRoundUp(tokens.count+1, Kbytes(1));
|
||||||
|
|
||||||
system->acquire_lock(FRAME_LOCK);
|
system->acquire_lock(FRAME_LOCK);
|
||||||
{
|
{
|
||||||
|
@ -2247,9 +2246,9 @@ view_file_loaded_init(System_Functions *system, File_View *view, i32 cursor_pos)
|
||||||
}
|
}
|
||||||
|
|
||||||
internal void
|
internal void
|
||||||
view_set_file(System_Functions *system, File_View *view, Editing_File *file,
|
view_set_file(System_Functions *system, File_View *view,
|
||||||
Font_Set *set, Style *style, Custom_Command_Function *open_hook,
|
Editing_File *file, Font_Set *set, Style *style,
|
||||||
void *cmd_context, Application_Links *app){
|
Hook_Function *open_hook, void *cmd_context, Application_Links *app){
|
||||||
Panel *panel = view->view_base.panel;
|
Panel *panel = view->view_base.panel;
|
||||||
view->file = file;
|
view->file = file;
|
||||||
view->locked = file->settings.super_locked;
|
view->locked = file->settings.super_locked;
|
||||||
|
@ -2295,8 +2294,11 @@ view_set_file(System_Functions *system, File_View *view, Editing_File *file,
|
||||||
|
|
||||||
view->vel_y = 1.f;
|
view->vel_y = 1.f;
|
||||||
view->vel_x = 1.f;
|
view->vel_x = 1.f;
|
||||||
|
|
||||||
if (open_hook) open_hook(cmd_context, app);
|
if (open_hook && file->settings.is_initialized == 0){
|
||||||
|
open_hook(cmd_context, app);
|
||||||
|
file->settings.is_initialized = 1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
struct Relative_Scrolling{
|
struct Relative_Scrolling{
|
||||||
|
@ -2723,8 +2725,7 @@ file_do_single_edit(System_Functions *system,
|
||||||
}
|
}
|
||||||
|
|
||||||
internal void
|
internal void
|
||||||
view_do_white_batch_edit(System_Functions *system,
|
view_do_white_batch_edit(System_Functions *system, Mem_Options *mem, File_View *view, Editing_File *file,
|
||||||
Mem_Options *mem, File_View *view, Editing_File *file,
|
|
||||||
Editing_Layout *layout, Edit_Spec spec, History_Mode history_mode){
|
Editing_Layout *layout, Edit_Spec spec, History_Mode history_mode){
|
||||||
if (view->locked) return;
|
if (view->locked) return;
|
||||||
#if BUFFER_EXPERIMENT_SCALPEL <= 3
|
#if BUFFER_EXPERIMENT_SCALPEL <= 3
|
||||||
|
@ -2871,7 +2872,7 @@ view_undo_redo(System_Functions *system,
|
||||||
|
|
||||||
Assert(step.type == expected_type);
|
Assert(step.type == expected_type);
|
||||||
|
|
||||||
Edit_Spec spec;
|
Edit_Spec spec = {};
|
||||||
spec.step = step;
|
spec.step = step;
|
||||||
|
|
||||||
if (step.child_count == 0){
|
if (step.child_count == 0){
|
||||||
|
@ -4341,7 +4342,7 @@ HANDLE_COMMAND_SIG(handle_command_file_view){
|
||||||
if (binding.function) binding.function(system, command, binding);
|
if (binding.function) binding.function(system, command, binding);
|
||||||
file_view->mode = file_view->next_mode;
|
file_view->mode = file_view->next_mode;
|
||||||
|
|
||||||
if (key.key.keycode == codes->esc)
|
if (key.keycode == codes->esc)
|
||||||
view_set_widget(file_view, FWIDG_NONE);
|
view_set_widget(file_view, FWIDG_NONE);
|
||||||
}break;
|
}break;
|
||||||
|
|
||||||
|
|
|
@ -115,7 +115,7 @@ font_set_load(Partition *partition, Font_Set *set, i16 font_id){
|
||||||
font__insert(&set->used_slots, slot);
|
font__insert(&set->used_slots, slot);
|
||||||
|
|
||||||
Render_Font *font = (Render_Font*)(slot + 1);
|
Render_Font *font = (Render_Font*)(slot + 1);
|
||||||
set->font_load(partition, font, info->filename.str, info->pt_size, 4);
|
set->font_load(font, info->filename.str, info->pt_size, 4);
|
||||||
info->font = font;
|
info->font = font;
|
||||||
slot->font_id = font_id;
|
slot->font_id = font_id;
|
||||||
}
|
}
|
||||||
|
|
|
@ -113,8 +113,7 @@ step_draw_int_view(System_Functions *system, Interactive_View *view,
|
||||||
b32 new_dir = 0;
|
b32 new_dir = 0;
|
||||||
b32 complete = 0;
|
b32 complete = 0;
|
||||||
|
|
||||||
terminate_with_null(&view->query);
|
do_label(&state, &layout, view->query, 1.f);
|
||||||
do_label(&state, &layout, view->query.str, 1.f);
|
|
||||||
|
|
||||||
switch (view->interaction){
|
switch (view->interaction){
|
||||||
case INTV_SYS_FILE_LIST:
|
case INTV_SYS_FILE_LIST:
|
||||||
|
@ -142,7 +141,7 @@ step_draw_int_view(System_Functions *system, Interactive_View *view,
|
||||||
String s = make_fixed_width_string(s_);
|
String s = make_fixed_width_string(s_);
|
||||||
append(&s, view->dest);
|
append(&s, view->dest);
|
||||||
append(&s, " has unsaved changes, kill it?");
|
append(&s, " has unsaved changes, kill it?");
|
||||||
do_label(&state, &layout, s.str, 1.f);
|
do_label(&state, &layout, s, 1.f);
|
||||||
|
|
||||||
i32 id = 0;
|
i32 id = 0;
|
||||||
if (do_list_option(++id, &state, &layout, make_lit_string("(Y)es"))){
|
if (do_list_option(++id, &state, &layout, make_lit_string("(Y)es"))){
|
||||||
|
|
|
@ -49,7 +49,7 @@ typedef Do_View_Sig(Do_View_Function);
|
||||||
#define HANDLE_COMMAND_SIG(name) \
|
#define HANDLE_COMMAND_SIG(name) \
|
||||||
void (name)(System_Functions *system, View *view, \
|
void (name)(System_Functions *system, View *view, \
|
||||||
Command_Data *command, Command_Binding binding, \
|
Command_Data *command, Command_Binding binding, \
|
||||||
Key_Single key, Key_Codes *codes)
|
Key_Event_Data key, Key_Codes *codes)
|
||||||
|
|
||||||
typedef HANDLE_COMMAND_SIG(Handle_Command_Function);
|
typedef HANDLE_COMMAND_SIG(Handle_Command_Function);
|
||||||
|
|
||||||
|
|
|
@ -47,7 +47,7 @@ struct Mem_Options{
|
||||||
inline Partition
|
inline Partition
|
||||||
partition_open(void *memory, i32 size){
|
partition_open(void *memory, i32 size){
|
||||||
Partition partition;
|
Partition partition;
|
||||||
partition.base = (u8*)memory;;
|
partition.base = (u8*)memory;
|
||||||
partition.pos = 0;
|
partition.pos = 0;
|
||||||
partition.max = size;
|
partition.max = size;
|
||||||
return partition;
|
return partition;
|
||||||
|
|
|
@ -14,6 +14,7 @@ struct Menu_View{
|
||||||
Style *style;
|
Style *style;
|
||||||
Working_Set *working_set;
|
Working_Set *working_set;
|
||||||
Delay *delay;
|
Delay *delay;
|
||||||
|
Font_Set *font_set;
|
||||||
UI_State state;
|
UI_State state;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -33,14 +34,14 @@ step_draw_menu_view(Menu_View *view, Render_Target *target, i32_Rect rect,
|
||||||
|
|
||||||
UI_State state =
|
UI_State state =
|
||||||
ui_state_init(&view->state, target, user_input,
|
ui_state_init(&view->state, target, user_input,
|
||||||
view->style, &target->font_set, view->working_set, input_stage);
|
view->style, view->font_set, view->working_set, input_stage);
|
||||||
|
|
||||||
UI_Layout layout;
|
UI_Layout layout;
|
||||||
begin_layout(&layout, rect);
|
begin_layout(&layout, rect);
|
||||||
|
|
||||||
i32 id = 0;
|
i32 id = 0;
|
||||||
|
|
||||||
do_label(&state, &layout, "Menu", 2.f);
|
do_label(&state, &layout, literal("Menu"), 2.f);
|
||||||
|
|
||||||
if (do_list_option_lit(++id, &state, &layout, "Theme Options")){
|
if (do_list_option_lit(++id, &state, &layout, "Theme Options")){
|
||||||
delayed_action(view->delay, DACT_THEME_OPTIONS, {}, view->view_base.panel);
|
delayed_action(view->delay, DACT_THEME_OPTIONS, {}, view->view_base.panel);
|
||||||
|
@ -67,7 +68,8 @@ Do_View_Sig(do_menu_view){
|
||||||
}
|
}
|
||||||
|
|
||||||
internal Menu_View*
|
internal Menu_View*
|
||||||
menu_view_init(View *view, Style *style, Working_Set *working_set, Delay *delay){
|
menu_view_init(View *view, Style *style, Working_Set *working_set,
|
||||||
|
Delay *delay, Font_Set *font_set){
|
||||||
view->type = VIEW_TYPE_INTERACTIVE;
|
view->type = VIEW_TYPE_INTERACTIVE;
|
||||||
view->do_view = do_menu_view;
|
view->do_view = do_menu_view;
|
||||||
|
|
||||||
|
@ -76,6 +78,7 @@ menu_view_init(View *view, Style *style, Working_Set *working_set, Delay *delay)
|
||||||
result->style = style;
|
result->style = style;
|
||||||
result->working_set = working_set;
|
result->working_set = working_set;
|
||||||
result->delay = delay;
|
result->delay = delay;
|
||||||
|
result->font_set = font_set;
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -101,6 +101,10 @@ _OutDbgStr(u8*);
|
||||||
|
|
||||||
#define Swap(a,b) {auto t = a; a = b; b = t;}
|
#define Swap(a,b) {auto t = a; a = b; b = t;}
|
||||||
|
|
||||||
|
#ifndef literal
|
||||||
|
#define literal(s) s, (sizeof(s)-1)
|
||||||
|
#endif
|
||||||
|
|
||||||
#define Min(a,b) (((a)<(b))?(a):(b))
|
#define Min(a,b) (((a)<(b))?(a):(b))
|
||||||
#define Max(a,b) (((a)>(b))?(a):(b))
|
#define Max(a,b) (((a)>(b))?(a):(b))
|
||||||
|
|
||||||
|
|
|
@ -269,11 +269,16 @@ launch_rendering(Render_Target *target){
|
||||||
|
|
||||||
#undef ExtractStruct
|
#undef ExtractStruct
|
||||||
|
|
||||||
internal
|
internal i32
|
||||||
Font_Info_Load_Sig(draw_font_info_load){
|
draw_font_info_load(Partition *partition,
|
||||||
|
char *filename,
|
||||||
|
i32 pt_size,
|
||||||
|
i32 *height,
|
||||||
|
i32 *advance){
|
||||||
i32 result = 1;
|
i32 result = 1;
|
||||||
Data file;
|
Data file;
|
||||||
file = system_load_file(filename);
|
file = system_load_file(filename);
|
||||||
|
|
||||||
Temp_Memory temp = begin_temp_memory(partition);
|
Temp_Memory temp = begin_temp_memory(partition);
|
||||||
stbtt_packedchar *chardata = push_array(partition, stbtt_packedchar, 256);
|
stbtt_packedchar *chardata = push_array(partition, stbtt_packedchar, 256);
|
||||||
|
|
||||||
|
@ -283,7 +288,7 @@ Font_Info_Load_Sig(draw_font_info_load){
|
||||||
tex_width = pt_size*128*oversample;
|
tex_width = pt_size*128*oversample;
|
||||||
tex_height = pt_size*2*oversample;
|
tex_height = pt_size*2*oversample;
|
||||||
void *block = push_block(partition, tex_width * tex_height);
|
void *block = push_block(partition, tex_width * tex_height);
|
||||||
|
|
||||||
if (!file.data){
|
if (!file.data){
|
||||||
result = 0;
|
result = 0;
|
||||||
}
|
}
|
||||||
|
@ -342,18 +347,25 @@ Font_Info_Load_Sig(draw_font_info_load){
|
||||||
|
|
||||||
system_free_memory(file.data);
|
system_free_memory(file.data);
|
||||||
}
|
}
|
||||||
|
|
||||||
end_temp_memory(temp);
|
end_temp_memory(temp);
|
||||||
|
|
||||||
return(result);
|
return(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
internal
|
internal i32
|
||||||
Font_Load_Sig(draw_font_load){
|
draw_font_load(void *base_block, i32 size,
|
||||||
|
Render_Font *font_out,
|
||||||
|
char *filename,
|
||||||
|
i32 pt_size,
|
||||||
|
i32 tab_width){
|
||||||
i32 result = 1;
|
i32 result = 1;
|
||||||
Data file;
|
Data file;
|
||||||
file = system_load_file(filename);
|
file = system_load_file(filename);
|
||||||
Temp_Memory temp = begin_temp_memory(partition);
|
|
||||||
|
Partition partition_ = partition_open(base_block, size);
|
||||||
|
Partition *partition = &partition_;
|
||||||
|
|
||||||
stbtt_packedchar *chardata = font_out->chardata;
|
stbtt_packedchar *chardata = font_out->chardata;
|
||||||
|
|
||||||
i32 oversample = 2;
|
i32 oversample = 2;
|
||||||
|
@ -395,14 +407,6 @@ Font_Load_Sig(draw_font_load){
|
||||||
|
|
||||||
stbtt_pack_context spc;
|
stbtt_pack_context spc;
|
||||||
|
|
||||||
#if 0
|
|
||||||
if (stbtt_BakeFontBitmap((u8*)file.data, 0, (f32)pt_size,
|
|
||||||
memory_cursor, tex_width, tex_height, 0, 128,
|
|
||||||
font_out->chardata, partition) <= 0){
|
|
||||||
result = 0;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (stbtt_PackBegin(&spc, (u8*)block, tex_width, tex_height, tex_width, 1, partition)){
|
if (stbtt_PackBegin(&spc, (u8*)block, tex_width, tex_height, tex_width, 1, partition)){
|
||||||
stbtt_PackSetOversampling(&spc, oversample, oversample);
|
stbtt_PackSetOversampling(&spc, oversample, oversample);
|
||||||
if (stbtt_PackFontRange(&spc, (u8*)file.data, 0,
|
if (stbtt_PackFontRange(&spc, (u8*)file.data, 0,
|
||||||
|
@ -456,8 +460,6 @@ Font_Load_Sig(draw_font_load){
|
||||||
}
|
}
|
||||||
system_free_memory(file.data);
|
system_free_memory(file.data);
|
||||||
}
|
}
|
||||||
|
|
||||||
end_temp_memory(temp);
|
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
|
@ -107,7 +107,6 @@ struct Render_Piece_Combined{
|
||||||
typedef Draw_Push_Piece_Sig(Draw_Push_Piece);
|
typedef Draw_Push_Piece_Sig(Draw_Push_Piece);
|
||||||
|
|
||||||
#define Font_Load_Sig(name) i32 name( \
|
#define Font_Load_Sig(name) i32 name( \
|
||||||
Partition *partition, \
|
|
||||||
Render_Font *font_out, \
|
Render_Font *font_out, \
|
||||||
char *filename, \
|
char *filename, \
|
||||||
i32 pt_size, \
|
i32 pt_size, \
|
||||||
|
|
|
@ -20,15 +20,18 @@ draw_pop_clip(Render_Target *target){
|
||||||
}
|
}
|
||||||
|
|
||||||
internal void
|
internal void
|
||||||
begin_render_section(Render_Target *target){
|
begin_render_section(Render_Target *target, System_Functions *system){
|
||||||
Font_Set *font_set = &target->font_set;
|
Font_Set *font_set = &target->font_set;
|
||||||
font_set->used_this_frame = 0;
|
font_set->used_this_frame = 0;
|
||||||
memset(font_set->font_used_flags, 0, font_set->max);
|
memset(font_set->font_used_flags, 0, font_set->max);
|
||||||
|
target->size = 0;
|
||||||
|
system->acquire_lock(RENDER_LOCK);
|
||||||
}
|
}
|
||||||
|
|
||||||
internal void
|
internal void
|
||||||
end_render_section(Render_Target *target){
|
end_render_section(Render_Target *target, System_Functions *system){
|
||||||
//Font_Set *font_set = &target->font_set;
|
//Font_Set *font_set = &target->font_set;
|
||||||
|
system->release_lock(RENDER_LOCK);
|
||||||
}
|
}
|
||||||
|
|
||||||
internal void
|
internal void
|
||||||
|
|
|
@ -61,6 +61,9 @@ struct Thread_Context;
|
||||||
|
|
||||||
enum Lock_ID{
|
enum Lock_ID{
|
||||||
FRAME_LOCK,
|
FRAME_LOCK,
|
||||||
|
INPUT_LOCK,
|
||||||
|
FONT_LOCK,
|
||||||
|
RENDER_LOCK,
|
||||||
CANCEL_LOCK0,
|
CANCEL_LOCK0,
|
||||||
CANCEL_LOCK1,
|
CANCEL_LOCK1,
|
||||||
CANCEL_LOCK2,
|
CANCEL_LOCK2,
|
||||||
|
|
1034
win32_4ed.cpp
1034
win32_4ed.cpp
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue