From 6bbc2f76c0b68272375010d030a88949902451c3 Mon Sep 17 00:00:00 2001 From: Allen Webster Date: Sat, 18 Mar 2017 14:43:30 -0400 Subject: [PATCH] changed file organization; fixed font switching bugs --- 4ed_app_target.cpp | 10 ++++----- file/4coder_buffer.cpp => 4ed_buffer.cpp | 22 +++++++++++++------ file/4coder_file.cpp => 4ed_file.cpp | 0 4ed_file_view.cpp | 6 ++--- ...hot_directory.cpp => 4ed_hot_directory.cpp | 0 ...der_translation.cpp => 4ed_translation.cpp | 0 file/4coder_undo.cpp => 4ed_undo.cpp | 0 ...der_working_set.cpp => 4ed_working_set.cpp | 0 win32_4ed_fonts.cpp | 8 +++---- 9 files changed, 27 insertions(+), 19 deletions(-) rename file/4coder_buffer.cpp => 4ed_buffer.cpp (99%) rename file/4coder_file.cpp => 4ed_file.cpp (100%) rename file/4coder_hot_directory.cpp => 4ed_hot_directory.cpp (100%) rename file/4coder_translation.cpp => 4ed_translation.cpp (100%) rename file/4coder_undo.cpp => 4ed_undo.cpp (100%) rename file/4coder_working_set.cpp => 4ed_working_set.cpp (100%) diff --git a/4ed_app_target.cpp b/4ed_app_target.cpp index 82beb368..81829ef5 100644 --- a/4ed_app_target.cpp +++ b/4ed_app_target.cpp @@ -48,11 +48,11 @@ #include "4ed_style.cpp" #include "4ed_command.cpp" -#include "file/4coder_buffer.cpp" -#include "file/4coder_undo.cpp" -#include "file/4coder_file.cpp" -#include "file/4coder_working_set.cpp" -#include "file/4coder_hot_directory.cpp" +#include "4ed_buffer.cpp" +#include "4ed_undo.cpp" +#include "4ed_file.cpp" +#include "4ed_working_set.cpp" +#include "4ed_hot_directory.cpp" #include "4ed_gui.h" #include "4ed_gui.cpp" diff --git a/file/4coder_buffer.cpp b/4ed_buffer.cpp similarity index 99% rename from file/4coder_buffer.cpp rename to 4ed_buffer.cpp index de8e191c..0fe36812 100644 --- a/file/4coder_buffer.cpp +++ b/4ed_buffer.cpp @@ -13,8 +13,8 @@ // Buffer low level operations // -#include "../font/4coder_font_data.h" -#include "../4coder_helper/4coder_seek_types.h" +#include "font/4coder_font_data.h" +#include "4coder_helper/4coder_seek_types.h" typedef struct Cursor_With_Index{ i32 pos; @@ -310,8 +310,12 @@ to_upper(char c){ internal i32 is_match(char *a, char *b, i32 len){ i32 result = 1; - for (;len > 0; --len, ++a, ++b) - if (*a != *b) { result = 0; break; } + for (;len > 0; --len, ++a, ++b){ + if (*a != *b){ + result = 0; + break; + } + } return(result); } @@ -319,8 +323,12 @@ is_match(char *a, char *b, i32 len){ internal i32 is_match_insensitive(char *a, char *b, i32 len){ i32 result = 1; - for (;len > 0; --len, ++a, ++b) - if (to_upper(*a) != to_upper(*b)) { result = 0; break; } + for (;len > 0; --len, ++a, ++b){ + if (to_upper(*a) != to_upper(*b)){ + result = 0; + break; + } + } return(result); } @@ -344,7 +352,7 @@ enum{ BufferModelUnit_Numbers, }; -#include "4coder_translation.cpp" +#include "4ed_translation.cpp" // // Implementation of the gap buffer diff --git a/file/4coder_file.cpp b/4ed_file.cpp similarity index 100% rename from file/4coder_file.cpp rename to 4ed_file.cpp diff --git a/4ed_file_view.cpp b/4ed_file_view.cpp index 0fa36532..4272ae9d 100644 --- a/4ed_file_view.cpp +++ b/4ed_file_view.cpp @@ -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 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; - 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]; String name = make_fixed_width_string(name_space); 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 (gui_do_font_button(target, id, this_font_id, name)){ new_font_id = this_font_id; diff --git a/file/4coder_hot_directory.cpp b/4ed_hot_directory.cpp similarity index 100% rename from file/4coder_hot_directory.cpp rename to 4ed_hot_directory.cpp diff --git a/file/4coder_translation.cpp b/4ed_translation.cpp similarity index 100% rename from file/4coder_translation.cpp rename to 4ed_translation.cpp diff --git a/file/4coder_undo.cpp b/4ed_undo.cpp similarity index 100% rename from file/4coder_undo.cpp rename to 4ed_undo.cpp diff --git a/file/4coder_working_set.cpp b/4ed_working_set.cpp similarity index 100% rename from file/4coder_working_set.cpp rename to 4ed_working_set.cpp diff --git a/win32_4ed_fonts.cpp b/win32_4ed_fonts.cpp index 47f23787..121ab594 100644 --- a/win32_4ed_fonts.cpp +++ b/win32_4ed_fonts.cpp @@ -31,10 +31,10 @@ internal Sys_Font_Get_IDs_By_Index_Sig(system_font_get_ids_by_index){ b32 result = false; u32 stop_index = first_index + index_count; - if (stop_index < win32_fonts.font_count){ + if (stop_index <= win32_fonts.font_count){ result = true; for (u32 i = first_index; i < stop_index; ++i){ - id_out[i] = i; + id_out[i-first_index] = i; } } 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){ Render_Font *font = &win32_fonts.fonts[font_index]; char *name = font->name; - u32 name_len = font->name_len; - copy_partial_cs(str_out, str_out_cap, make_string(name, name_len)); + length = font->name_len; + copy_partial_cs(str_out, str_out_cap, make_string(name, length)); } return(length); }