changed file organization; fixed font switching bugs

master
Allen Webster 2017-03-18 14:43:30 -04:00
parent 7f761f9a2a
commit 6bbc2f76c0
9 changed files with 27 additions and 19 deletions

View File

@ -48,11 +48,11 @@
#include "4ed_style.cpp" #include "4ed_style.cpp"
#include "4ed_command.cpp" #include "4ed_command.cpp"
#include "file/4coder_buffer.cpp" #include "4ed_buffer.cpp"
#include "file/4coder_undo.cpp" #include "4ed_undo.cpp"
#include "file/4coder_file.cpp" #include "4ed_file.cpp"
#include "file/4coder_working_set.cpp" #include "4ed_working_set.cpp"
#include "file/4coder_hot_directory.cpp" #include "4ed_hot_directory.cpp"
#include "4ed_gui.h" #include "4ed_gui.h"
#include "4ed_gui.cpp" #include "4ed_gui.cpp"

View File

@ -13,8 +13,8 @@
// Buffer low level operations // Buffer low level operations
// //
#include "../font/4coder_font_data.h" #include "font/4coder_font_data.h"
#include "../4coder_helper/4coder_seek_types.h" #include "4coder_helper/4coder_seek_types.h"
typedef struct Cursor_With_Index{ typedef struct Cursor_With_Index{
i32 pos; i32 pos;
@ -310,8 +310,12 @@ to_upper(char c){
internal i32 internal i32
is_match(char *a, char *b, i32 len){ is_match(char *a, char *b, i32 len){
i32 result = 1; i32 result = 1;
for (;len > 0; --len, ++a, ++b) for (;len > 0; --len, ++a, ++b){
if (*a != *b) { result = 0; break; } if (*a != *b){
result = 0;
break;
}
}
return(result); return(result);
} }
@ -319,8 +323,12 @@ is_match(char *a, char *b, i32 len){
internal i32 internal i32
is_match_insensitive(char *a, char *b, i32 len){ is_match_insensitive(char *a, char *b, i32 len){
i32 result = 1; i32 result = 1;
for (;len > 0; --len, ++a, ++b) for (;len > 0; --len, ++a, ++b){
if (to_upper(*a) != to_upper(*b)) { result = 0; break; } if (to_upper(*a) != to_upper(*b)){
result = 0;
break;
}
}
return(result); return(result);
} }
@ -344,7 +352,7 @@ enum{
BufferModelUnit_Numbers, BufferModelUnit_Numbers,
}; };
#include "4coder_translation.cpp" #include "4ed_translation.cpp"
// //
// Implementation of the gap buffer // Implementation of the gap buffer

View File

@ -4767,15 +4767,15 @@ step_file_view(System_Functions *system, View *view, View *active_view, Input_Su
u32 total_count = system->font.get_count(); u32 total_count = system->font.get_count();
u32 count = Min(total_count, 10); u32 count = Min(total_count, 10);
for (u32 font_index = 1; font_index < count; ++font_index){ for (u32 font_index = 0; font_index < count; ++font_index){
Font_ID this_font_id = 0; Font_ID this_font_id = 0;
system->font.get_ids_by_index(font_index, 1, &font_id); system->font.get_ids_by_index(font_index, 1, &this_font_id);
char name_space[256]; char name_space[256];
String name = make_fixed_width_string(name_space); String name = make_fixed_width_string(name_space);
name.size = system->font.get_name_by_index(font_index, name.str, name.memory_size); name.size = system->font.get_name_by_index(font_index, name.str, name.memory_size);
id.id[0] = (u64)this_font_id; id.id[0] = (u64)font_index + 1;
if (this_font_id != font_id){ if (this_font_id != font_id){
if (gui_do_font_button(target, id, this_font_id, name)){ if (gui_do_font_button(target, id, this_font_id, name)){
new_font_id = this_font_id; new_font_id = this_font_id;

View File

@ -31,10 +31,10 @@ internal
Sys_Font_Get_IDs_By_Index_Sig(system_font_get_ids_by_index){ Sys_Font_Get_IDs_By_Index_Sig(system_font_get_ids_by_index){
b32 result = false; b32 result = false;
u32 stop_index = first_index + index_count; u32 stop_index = first_index + index_count;
if (stop_index < win32_fonts.font_count){ if (stop_index <= win32_fonts.font_count){
result = true; result = true;
for (u32 i = first_index; i < stop_index; ++i){ for (u32 i = first_index; i < stop_index; ++i){
id_out[i] = i; id_out[i-first_index] = i;
} }
} }
return(result); return(result);
@ -46,8 +46,8 @@ Sys_Font_Get_Name_By_Index_Sig(system_font_get_name_by_index){
if (font_index < win32_fonts.font_count){ if (font_index < win32_fonts.font_count){
Render_Font *font = &win32_fonts.fonts[font_index]; Render_Font *font = &win32_fonts.fonts[font_index];
char *name = font->name; char *name = font->name;
u32 name_len = font->name_len; length = font->name_len;
copy_partial_cs(str_out, str_out_cap, make_string(name, name_len)); copy_partial_cs(str_out, str_out_cap, make_string(name, length));
} }
return(length); return(length);
} }