multi-fonting, explicity monospace font for build panel

This commit is contained in:
Allen Webster 2016-07-14 12:41:23 -04:00
parent dacf7f1675
commit c8d881c1b5
15 changed files with 248 additions and 250 deletions

View File

@ -76,6 +76,7 @@ Coming Soon</i><div>
<li><a href='#print_message_doc'>print_message</a></li>
<li><a href='#change_theme_doc'>change_theme</a></li>
<li><a href='#change_font_doc'>change_font</a></li>
<li><a href='#buffer_set_font_doc'>buffer_set_font</a></li>
<li><a href='#set_theme_colors_doc'>set_theme_colors</a></li>
<li><a href='#get_theme_colors_doc'>get_theme_colors</a></li>
<li><a href='#directory_get_hot_doc'>directory_get_hot</a></li>
@ -898,11 +899,11 @@ only use for this call is in an interactive command that makes calls to get_user
<div style='font-weight: 600;'>len</div>
<div style='margin-bottom: 6mm;'><div style='margin-left: 5mm; margin-right: 5mm;'>The len parameter specifies the length of the name string.</div></div>
</div>
<div style='margin-top: 3mm; margin-bottom: 3mm; color: #309030;'><b><i>Description</i></b></div><div style='margin-left: 5mm; margin-right: 5mm;'>This call changes 4coder's theme to one of the built in themes.</div></div><hr>
<div style='margin-top: 3mm; margin-bottom: 3mm; color: #309030;'><b><i>Description</i></b></div><div style='margin-left: 5mm; margin-right: 5mm;'>This call changes 4coder's color pallet to one of the built in themes.</div></div><hr>
<div id='change_font_doc' style='margin-bottom: 1cm;'>
<h4>&sect;3.3.44: change_font</h4>
<div style='font-family: "Courier New", Courier, monospace; text-align: left; margin-top: 3mm; margin-bottom: 3mm; font-size: .95em; background: #DFDFDF; padding: 0.25em;'>void app->change_font(
<div style='margin-left: 4mm;'>Application_Links *app,<br>char *name,<br>int32_t len<br></div>)
<div style='margin-left: 4mm;'>Application_Links *app,<br>char *name,<br>int32_t len,<br>bool32 apply_to_all_files<br></div>)
</div>
<div style='margin-top: 3mm; margin-bottom: 3mm; color: #309030;'><b><i>Parameters</i></b></div><div>
<div style='font-weight: 600;'>name</div>
@ -912,9 +913,32 @@ only use for this call is in an interactive command that makes calls to get_user
<div style='font-weight: 600;'>len</div>
<div style='margin-bottom: 6mm;'><div style='margin-left: 5mm; margin-right: 5mm;'>The len parameter specifies the length of the name string.</div></div>
</div>
<div style='margin-top: 3mm; margin-bottom: 3mm; color: #309030;'><b><i>Description</i></b></div><div style='margin-left: 5mm; margin-right: 5mm;'>This call changes 4coder's font to one of the built in fonts.</div></div><hr>
<div>
<div style='font-weight: 600;'>apply_to_all_files</div>
<div style='margin-bottom: 6mm;'><div style='margin-left: 5mm; margin-right: 5mm;'>If this is set all open files change to this font. Usually this should be true
durring the start hook because several files already exist at that time.</div></div>
</div>
<div style='margin-top: 3mm; margin-bottom: 3mm; color: #309030;'><b><i>Description</i></b></div><div style='margin-left: 5mm; margin-right: 5mm;'>This call changes 4coder's default font to one of the built in fonts.</div></div><hr>
<div id='buffer_set_font_doc' style='margin-bottom: 1cm;'>
<h4>&sect;3.3.45: buffer_set_font</h4>
<div style='font-family: "Courier New", Courier, monospace; text-align: left; margin-top: 3mm; margin-bottom: 3mm; font-size: .95em; background: #DFDFDF; padding: 0.25em;'>void app->buffer_set_font(
<div style='margin-left: 4mm;'>Application_Links *app,<br>Buffer_Summary *buffer,<br>char *name,<br>int32_t len<br></div>)
</div>
<div style='margin-top: 3mm; margin-bottom: 3mm; color: #309030;'><b><i>Parameters</i></b></div><div>
<div style='font-weight: 600;'>buffer</div>
<div style='margin-bottom: 6mm;'><div style='margin-left: 5mm; margin-right: 5mm;'>This parameter the buffer that shall have it's font changed</div></div>
</div>
<div>
<div style='font-weight: 600;'>name</div>
<div style='margin-bottom: 6mm;'><div style='margin-left: 5mm; margin-right: 5mm;'>The name parameter specifies the name of the font to begin using; it need not be null terminated.</div></div>
</div>
<div>
<div style='font-weight: 600;'>len</div>
<div style='margin-bottom: 6mm;'><div style='margin-left: 5mm; margin-right: 5mm;'>The len parameter specifies the length of the name string.</div></div>
</div>
<div style='margin-top: 3mm; margin-bottom: 3mm; color: #309030;'><b><i>Description</i></b></div><div style='margin-left: 5mm; margin-right: 5mm;'>This call sets the display font of a particular buffer.</div></div><hr>
<div id='set_theme_colors_doc' style='margin-bottom: 1cm;'>
<h4>&sect;3.3.45: set_theme_colors</h4>
<h4>&sect;3.3.46: set_theme_colors</h4>
<div style='font-family: "Courier New", Courier, monospace; text-align: left; margin-top: 3mm; margin-bottom: 3mm; font-size: .95em; background: #DFDFDF; padding: 0.25em;'>void app->set_theme_colors(
<div style='margin-left: 4mm;'>Application_Links *app,<br>Theme_Color *colors,<br>int32_t count<br></div>)
</div>
@ -930,7 +954,7 @@ only use for this call is in an interactive command that makes calls to get_user
struct's tag is set to the color code in the struct. If the tag value is invalid
no change is made to the color pallet.</div></div><hr>
<div id='get_theme_colors_doc' style='margin-bottom: 1cm;'>
<h4>&sect;3.3.46: get_theme_colors</h4>
<h4>&sect;3.3.47: get_theme_colors</h4>
<div style='font-family: "Courier New", Courier, monospace; text-align: left; margin-top: 3mm; margin-bottom: 3mm; font-size: .95em; background: #DFDFDF; padding: 0.25em;'>void app->get_theme_colors(
<div style='margin-left: 4mm;'>Application_Links *app,<br>Theme_Color *colors,<br>int32_t count<br></div>)
</div>
@ -946,7 +970,7 @@ no change is made to the color pallet.</div></div><hr>
color from the slot in the main color pallet specified by the tag. If the tag
value is invalid the color is filled with black.</div></div><hr>
<div id='directory_get_hot_doc' style='margin-bottom: 1cm;'>
<h4>&sect;3.3.47: directory_get_hot</h4>
<h4>&sect;3.3.48: directory_get_hot</h4>
<div style='font-family: "Courier New", Courier, monospace; text-align: left; margin-top: 3mm; margin-bottom: 3mm; font-size: .95em; background: #DFDFDF; padding: 0.25em;'>int32_t app->directory_get_hot(
<div style='margin-left: 4mm;'>Application_Links *app,<br>char *out,<br>int32_t capacity<br></div>)
</div>
@ -964,7 +988,7 @@ accessed in the GUI. Whenever the GUI is opened it shows the hot directory.
In the future this will be deprecated and eliminated in favor of more flexible
directories controlled on the custom side.</div></div><hr>
<div id='get_file_list_doc' style='margin-bottom: 1cm;'>
<h4>&sect;3.3.48: get_file_list</h4>
<h4>&sect;3.3.49: get_file_list</h4>
<div style='font-family: "Courier New", Courier, monospace; text-align: left; margin-top: 3mm; margin-bottom: 3mm; font-size: .95em; background: #DFDFDF; padding: 0.25em;'>File_List app->get_file_list(
<div style='margin-left: 4mm;'>Application_Links *app,<br>char *dir,<br>int32_t len<br></div>)
</div>
@ -980,7 +1004,7 @@ directories controlled on the custom side.</div></div><hr>
the specified directory. The File_List returned should be passed to free_file_list
when it is no longer in use.</div></div><hr>
<div id='free_file_list_doc' style='margin-bottom: 1cm;'>
<h4>&sect;3.3.49: free_file_list</h4>
<h4>&sect;3.3.50: free_file_list</h4>
<div style='font-family: "Courier New", Courier, monospace; text-align: left; margin-top: 3mm; margin-bottom: 3mm; font-size: .95em; background: #DFDFDF; padding: 0.25em;'>void app->free_file_list(
<div style='margin-left: 4mm;'>Application_Links *app,<br>File_List list<br></div>)
</div>
@ -990,25 +1014,25 @@ when it is no longer in use.</div></div><hr>
</div>
<div style='margin-top: 3mm; margin-bottom: 3mm; color: #309030;'><b><i>Description</i></b></div><div style='margin-left: 5mm; margin-right: 5mm;'>After this call the file list passed in should not be read or written to.</div></div><hr>
<div id='memory_allocate_doc' style='margin-bottom: 1cm;'>
<h4>&sect;3.3.50: memory_allocate</h4>
<h4>&sect;3.3.51: memory_allocate</h4>
<div style='font-family: "Courier New", Courier, monospace; text-align: left; margin-top: 3mm; margin-bottom: 3mm; font-size: .95em; background: #DFDFDF; padding: 0.25em;'>void* app->memory_allocate(
<div style='margin-left: 4mm;'>Application_Links *app,<br>int32_t size<br></div>)
</div>
<div style='margin-top: 3mm; margin-bottom: 3mm; color: #309030;'><b><i>Description</i></b></div><div style='margin-left: 5mm; margin-right: 5mm;'>TODO</div></div><hr>
<div id='memory_set_protection_doc' style='margin-bottom: 1cm;'>
<h4>&sect;3.3.51: memory_set_protection</h4>
<h4>&sect;3.3.52: memory_set_protection</h4>
<div style='font-family: "Courier New", Courier, monospace; text-align: left; margin-top: 3mm; margin-bottom: 3mm; font-size: .95em; background: #DFDFDF; padding: 0.25em;'>bool32 app->memory_set_protection(
<div style='margin-left: 4mm;'>Application_Links *app,<br>void *ptr,<br>int32_t size,<br>Memory_Protect_Flags flags<br></div>)
</div>
<div style='margin-top: 3mm; margin-bottom: 3mm; color: #309030;'><b><i>Description</i></b></div><div style='margin-left: 5mm; margin-right: 5mm;'>TODO</div></div><hr>
<div id='memory_free_doc' style='margin-bottom: 1cm;'>
<h4>&sect;3.3.52: memory_free</h4>
<h4>&sect;3.3.53: memory_free</h4>
<div style='font-family: "Courier New", Courier, monospace; text-align: left; margin-top: 3mm; margin-bottom: 3mm; font-size: .95em; background: #DFDFDF; padding: 0.25em;'>void app->memory_free(
<div style='margin-left: 4mm;'>Application_Links *app,<br>void *mem,<br>int32_t size<br></div>)
</div>
<div style='margin-top: 3mm; margin-bottom: 3mm; color: #309030;'><b><i>Description</i></b></div><div style='margin-left: 5mm; margin-right: 5mm;'>TODO</div></div><hr>
<div id='file_exists_doc' style='margin-bottom: 1cm;'>
<h4>&sect;3.3.53: file_exists</h4>
<h4>&sect;3.3.54: file_exists</h4>
<div style='font-family: "Courier New", Courier, monospace; text-align: left; margin-top: 3mm; margin-bottom: 3mm; font-size: .95em; background: #DFDFDF; padding: 0.25em;'>bool32 app->file_exists(
<div style='margin-left: 4mm;'>Application_Links *app,<br>char *filename,<br>int len<br></div>)
</div>
@ -1022,7 +1046,7 @@ when it is no longer in use.</div></div><hr>
</div>
<div style='margin-top: 3mm; margin-bottom: 3mm; color: #309030;'><b><i>Return</i></b></div><div style='margin-left: 5mm; margin-right: 5mm;'>This call returns non-zero if and only if the file exists.</div></div><hr>
<div id='directory_cd_doc' style='margin-bottom: 1cm;'>
<h4>&sect;3.3.54: directory_cd</h4>
<h4>&sect;3.3.55: directory_cd</h4>
<div style='font-family: "Courier New", Courier, monospace; text-align: left; margin-top: 3mm; margin-bottom: 3mm; font-size: .95em; background: #DFDFDF; padding: 0.25em;'>bool32 app->directory_cd(
<div style='margin-left: 4mm;'>Application_Links *app,<br>char *dir,<br>int *len,<br>int capacity,<br>char *rel_path,<br>int rel_len<br></div>)
</div>
@ -1055,7 +1079,7 @@ will contain "C:/Users/MySelf/Documents" and len will contain the length of that
string. This call can also be used with rel set to ".." to traverse to parent
folders.</div></div><hr>
<div id='get_4ed_path_doc' style='margin-bottom: 1cm;'>
<h4>&sect;3.3.55: get_4ed_path</h4>
<h4>&sect;3.3.56: get_4ed_path</h4>
<div style='font-family: "Courier New", Courier, monospace; text-align: left; margin-top: 3mm; margin-bottom: 3mm; font-size: .95em; background: #DFDFDF; padding: 0.25em;'>bool32 app->get_4ed_path(
<div style='margin-left: 4mm;'>Application_Links *app,<br>char *out,<br>int32_t capacity<br></div>)
</div>
@ -1069,7 +1093,7 @@ folders.</div></div><hr>
</div>
<div style='margin-top: 3mm; margin-bottom: 3mm; color: #309030;'><b><i>Return</i></b></div><div style='margin-left: 5mm; margin-right: 5mm;'>This call returns non-zero on success.</div></div><hr>
<div id='show_mouse_cursor_doc' style='margin-bottom: 1cm;'>
<h4>&sect;3.3.56: show_mouse_cursor</h4>
<h4>&sect;3.3.57: show_mouse_cursor</h4>
<div style='font-family: "Courier New", Courier, monospace; text-align: left; margin-top: 3mm; margin-bottom: 3mm; font-size: .95em; background: #DFDFDF; padding: 0.25em;'>void app->show_mouse_cursor(
<div style='margin-left: 4mm;'>Application_Links *app,<br>Mouse_Cursor_Show_Type show<br></div>)
</div>
@ -1103,7 +1127,7 @@ when a buffer is closed it's id may be recycled by future, different buffers.</d
<h4>&sect;3.4.5: View_ID</h4>
<div style='font-family: "Courier New", Courier, monospace; text-align: left; margin-top: 3mm; margin-bottom: 3mm; font-size: .95em; background: #DFDFDF; padding: 0.25em;'>typedef int32_t View_ID;</div>
<div style='margin-top: 3mm; margin-bottom: 3mm; color: #309030;'><b><i>Description</i></b></div><div style='margin-left: 5mm; margin-right: 5mm;'>View_ID is used to name a 4coder view. Each view has a unique id in
the range [1,16].</div></div><hr>
the interval [1,16].</div></div><hr>
<div id='Key_Modifier_doc' style='margin-bottom: 1cm;'>
<h4>&sect;3.4.6: Key_Modifier</h4>
<div style='font-family: "Courier New", Courier, monospace; text-align: left; margin-top: 3mm; margin-bottom: 3mm; font-size: .95em; background: #DFDFDF; padding: 0.25em;'>enum Key_Modifier;</div>
@ -2302,6 +2326,7 @@ Coming Soon</i><div>
<li><a href='#float_to_str_size_str_doc'>float_to_str_size</a></li>
<li><a href='#append_float_to_str_str_doc'>append_float_to_str</a></li>
<li><a href='#float_to_str_str_doc'>float_to_str</a></li>
<li><a href='#str_is_int_str_doc'>str_is_int</a></li>
<li><a href='#str_to_int_str_doc'>str_to_int</a></li>
<li><a href='#hexchar_to_int_str_doc'>hexchar_to_int</a></li>
<li><a href='#int_to_hexchar_str_doc'>int_to_hexchar</a></li>
@ -3065,81 +3090,87 @@ fstr_bool float_to_str(
</div>
<div style='margin-top: 3mm; margin-bottom: 3mm; color: #309030;'><b><i>Description</i></b></div><div style='margin-left: 5mm; margin-right: 5mm;'>This call appends a string representation of x onto dest. If there is enough
space in dest this call returns non-zero.</div></div><hr>
<div id='str_to_int_str_doc'><h4>&sect;4.3.88: str_to_int</h4>
<div id='str_is_int_str_doc'><h4>&sect;4.3.88: str_is_int</h4>
<div style='font-family: "Courier New", Courier, monospace; text-align: left; margin-top: 3mm; margin-bottom: 3mm; font-size: .95em; background: #DFDFDF; padding: 0.25em;'>
fstr_bool str_is_int(
<div style='margin-left: 4mm;'>String str<br></div>)
</div>
<div style='margin-top: 3mm; margin-bottom: 3mm; color: #309030;'><b><i>Description</i></b></div><div style='margin-left: 5mm; margin-right: 5mm;'>If str is a valid string representation of an integer, this call returns non-zero.</div></div><hr>
<div id='str_to_int_str_doc'><h4>&sect;4.3.89: str_to_int</h4>
<div style='font-family: "Courier New", Courier, monospace; text-align: left; margin-top: 3mm; margin-bottom: 3mm; font-size: .95em; background: #DFDFDF; padding: 0.25em;'>
int32_t str_to_int(
<div style='margin-left: 4mm;'>char *str<br></div>)
</div>
<div style='margin-top: 3mm; margin-bottom: 3mm; color: #309030;'><b><i>Description</i></b></div><div style='margin-left: 5mm; margin-right: 5mm;'>If str represents a valid string representation of an integer, this call will return
<div style='margin-top: 3mm; margin-bottom: 3mm; color: #309030;'><b><i>Description</i></b></div><div style='margin-left: 5mm; margin-right: 5mm;'>If str is a valid string representation of an integer, this call will return
the integer represented by the string. Otherwise this call returns zero.</div></div><hr>
<div><h4>&sect;4.3.89: str_to_int</h4>
<div><h4>&sect;4.3.90: str_to_int</h4>
<div style='font-family: "Courier New", Courier, monospace; text-align: left; margin-top: 3mm; margin-bottom: 3mm; font-size: .95em; background: #DFDFDF; padding: 0.25em;'>
int32_t str_to_int(
<div style='margin-left: 4mm;'>String str<br></div>)
</div>
<div style='margin-top: 3mm; margin-bottom: 3mm; color: #309030;'><b><i>Description</i></b></div><div style='margin-left: 5mm; margin-right: 5mm;'>If str represents a valid string representation of an integer, this call will return
the integer represented by the string. Otherwise this call returns zero.</div></div><hr>
<div id='hexchar_to_int_str_doc'><h4>&sect;4.3.90: hexchar_to_int</h4>
<div id='hexchar_to_int_str_doc'><h4>&sect;4.3.91: hexchar_to_int</h4>
<div style='font-family: "Courier New", Courier, monospace; text-align: left; margin-top: 3mm; margin-bottom: 3mm; font-size: .95em; background: #DFDFDF; padding: 0.25em;'>
int32_t hexchar_to_int(
<div style='margin-left: 4mm;'>char c<br></div>)
</div>
<div style='margin-top: 3mm; margin-bottom: 3mm; color: #309030;'><b><i>Description</i></b></div><div style='margin-left: 5mm; margin-right: 5mm;'>If c is a valid hexadecimal digit [0-9a-fA-F] this call returns the value of
the integer value of the digit. Otherwise the return is some nonsense value.</div></div><hr>
<div id='int_to_hexchar_str_doc'><h4>&sect;4.3.91: int_to_hexchar</h4>
<div id='int_to_hexchar_str_doc'><h4>&sect;4.3.92: int_to_hexchar</h4>
<div style='font-family: "Courier New", Courier, monospace; text-align: left; margin-top: 3mm; margin-bottom: 3mm; font-size: .95em; background: #DFDFDF; padding: 0.25em;'>
char int_to_hexchar(
<div style='margin-left: 4mm;'>int32_t x<br></div>)
</div>
<div style='margin-top: 3mm; margin-bottom: 3mm; color: #309030;'><b><i>Description</i></b></div><div style='margin-left: 5mm; margin-right: 5mm;'>If x is in the range [0,15] this call returns the equivalent lowercase hexadecimal digit.
Otherwise the return is some nonsense value.</div></div><hr>
<div id='hexstr_to_int_str_doc'><h4>&sect;4.3.92: hexstr_to_int</h4>
<div id='hexstr_to_int_str_doc'><h4>&sect;4.3.93: hexstr_to_int</h4>
<div style='font-family: "Courier New", Courier, monospace; text-align: left; margin-top: 3mm; margin-bottom: 3mm; font-size: .95em; background: #DFDFDF; padding: 0.25em;'>
uint32_t hexstr_to_int(
<div style='margin-left: 4mm;'>String str<br></div>)
</div>
<div style='margin-top: 3mm; margin-bottom: 3mm; color: #309030;'><b><i>Description</i></b></div><div style='margin-left: 5mm; margin-right: 5mm;'>This call interprets str has a hexadecimal representation of an integer and returns
the represented integer value.</div></div><hr>
<div id='color_to_hexstr_str_doc'><h4>&sect;4.3.93: color_to_hexstr</h4>
<div id='color_to_hexstr_str_doc'><h4>&sect;4.3.94: color_to_hexstr</h4>
<div style='font-family: "Courier New", Courier, monospace; text-align: left; margin-top: 3mm; margin-bottom: 3mm; font-size: .95em; background: #DFDFDF; padding: 0.25em;'>
fstr_bool color_to_hexstr(
<div style='margin-left: 4mm;'>String *s,<br>uint32_t color<br></div>)
</div>
<div style='margin-top: 3mm; margin-bottom: 3mm; color: #309030;'><b><i>Description</i></b></div><div style='margin-left: 5mm; margin-right: 5mm;'>This call fills s with the hexadecimal representation of the color.
If there is enough memory in s to represent the color this call returns non-zero.</div></div><hr>
<div id='hexstr_to_color_str_doc'><h4>&sect;4.3.94: hexstr_to_color</h4>
<div id='hexstr_to_color_str_doc'><h4>&sect;4.3.95: hexstr_to_color</h4>
<div style='font-family: "Courier New", Courier, monospace; text-align: left; margin-top: 3mm; margin-bottom: 3mm; font-size: .95em; background: #DFDFDF; padding: 0.25em;'>
fstr_bool hexstr_to_color(
<div style='margin-left: 4mm;'>String s,<br>uint32_t *out<br></div>)
</div>
<div style='margin-top: 3mm; margin-bottom: 3mm; color: #309030;'><b><i>Description</i></b></div><div style='margin-left: 5mm; margin-right: 5mm;'>This call interprets s as a color and writes the 32-bit integer representation into out.</div></div><hr>
<div id='reverse_seek_slash_str_doc'><h4>&sect;4.3.95: reverse_seek_slash</h4>
<div id='reverse_seek_slash_str_doc'><h4>&sect;4.3.96: reverse_seek_slash</h4>
<div style='font-family: "Courier New", Courier, monospace; text-align: left; margin-top: 3mm; margin-bottom: 3mm; font-size: .95em; background: #DFDFDF; padding: 0.25em;'>
int32_t reverse_seek_slash(
<div style='margin-left: 4mm;'>String str,<br>int32_t pos<br></div>)
</div>
<div style='margin-top: 3mm; margin-bottom: 3mm; color: #309030;'><b><i>Description</i></b></div><div style='margin-left: 5mm; margin-right: 5mm;'>This call searches for a slash in str by starting pos bytes from the end and going backwards.</div></div><hr>
<div><h4>&sect;4.3.96: reverse_seek_slash</h4>
<div><h4>&sect;4.3.97: reverse_seek_slash</h4>
<div style='font-family: "Courier New", Courier, monospace; text-align: left; margin-top: 3mm; margin-bottom: 3mm; font-size: .95em; background: #DFDFDF; padding: 0.25em;'>
int32_t reverse_seek_slash(
<div style='margin-left: 4mm;'>String str<br></div>)
</div>
<div style='margin-top: 3mm; margin-bottom: 3mm; color: #309030;'><b><i>Description</i></b></div><div style='margin-left: 5mm; margin-right: 5mm;'>This call searches for a slash in str by starting at the end and going backwards.</div></div><hr>
<div id='front_of_directory_str_doc'><h4>&sect;4.3.97: front_of_directory</h4>
<div id='front_of_directory_str_doc'><h4>&sect;4.3.98: front_of_directory</h4>
<div style='font-family: "Courier New", Courier, monospace; text-align: left; margin-top: 3mm; margin-bottom: 3mm; font-size: .95em; background: #DFDFDF; padding: 0.25em;'>
String front_of_directory(
<div style='margin-left: 4mm;'>String dir<br></div>)
</div>
<div style='margin-top: 3mm; margin-bottom: 3mm; color: #309030;'><b><i>Description</i></b></div><div style='margin-left: 5mm; margin-right: 5mm;'>This call returns a substring of dir containing only the file name or
folder name furthest to the right in the directory.</div><div style='margin-top: 3mm; margin-bottom: 3mm; color: #309030;'><b><i>See Also</i></b></div><div style='margin-left: 5mm; margin-right: 5mm;'><a href='#substr_doc'>substr</a></div></div><hr>
<div id='path_of_directory_str_doc'><h4>&sect;4.3.98: path_of_directory</h4>
<div id='path_of_directory_str_doc'><h4>&sect;4.3.99: path_of_directory</h4>
<div style='font-family: "Courier New", Courier, monospace; text-align: left; margin-top: 3mm; margin-bottom: 3mm; font-size: .95em; background: #DFDFDF; padding: 0.25em;'>
String path_of_directory(
<div style='margin-left: 4mm;'>String dir<br></div>)
</div>
<div style='margin-top: 3mm; margin-bottom: 3mm; color: #309030;'><b><i>Description</i></b></div><div style='margin-left: 5mm; margin-right: 5mm;'>This call returns a substring of dir containing the whole path except
for the final file or folder name.</div><div style='margin-top: 3mm; margin-bottom: 3mm; color: #309030;'><b><i>See Also</i></b></div><div style='margin-left: 5mm; margin-right: 5mm;'><a href='#substr_doc'>substr</a></div></div><hr>
<div id='set_last_folder_str_doc'><h4>&sect;4.3.99: set_last_folder</h4>
<div id='set_last_folder_str_doc'><h4>&sect;4.3.100: set_last_folder</h4>
<div style='font-family: "Courier New", Courier, monospace; text-align: left; margin-top: 3mm; margin-bottom: 3mm; font-size: .95em; background: #DFDFDF; padding: 0.25em;'>
fstr_bool set_last_folder(
<div style='margin-left: 4mm;'>String *dir,<br>char *folder_name,<br>char slash<br></div>)
@ -3159,7 +3190,7 @@ at the end of the directory.</div></div>
</div>
<div style='margin-top: 3mm; margin-bottom: 3mm; color: #309030;'><b><i>Description</i></b></div><div style='margin-left: 5mm; margin-right: 5mm;'>This call deletes the last file name or folder name in the dir string and appends the new provided one.
If there is enough memory in dir this call returns non-zero.</div></div><hr>
<div><h4>&sect;4.3.100: set_last_folder</h4>
<div><h4>&sect;4.3.101: set_last_folder</h4>
<div style='font-family: "Courier New", Courier, monospace; text-align: left; margin-top: 3mm; margin-bottom: 3mm; font-size: .95em; background: #DFDFDF; padding: 0.25em;'>
fstr_bool set_last_folder(
<div style='margin-left: 4mm;'>String *dir,<br>String folder_name,<br>char slash<br></div>)
@ -3178,20 +3209,20 @@ fstr_bool set_last_folder(
</div>
<div style='margin-top: 3mm; margin-bottom: 3mm; color: #309030;'><b><i>Description</i></b></div><div style='margin-left: 5mm; margin-right: 5mm;'>This call deletes the last file name or folder name in the dir string and appends the new provided one.
If there is enough memory in dir this call returns non-zero.</div></div><hr>
<div id='file_extension_str_doc'><h4>&sect;4.3.101: file_extension</h4>
<div id='file_extension_str_doc'><h4>&sect;4.3.102: file_extension</h4>
<div style='font-family: "Courier New", Courier, monospace; text-align: left; margin-top: 3mm; margin-bottom: 3mm; font-size: .95em; background: #DFDFDF; padding: 0.25em;'>
String file_extension(
<div style='margin-left: 4mm;'>String str<br></div>)
</div>
<div style='margin-top: 3mm; margin-bottom: 3mm; color: #309030;'><b><i>Description</i></b></div><div style='margin-left: 5mm; margin-right: 5mm;'>This call returns a substring containing only the file extension of the provided filename.</div><div style='margin-top: 3mm; margin-bottom: 3mm; color: #309030;'><b><i>See Also</i></b></div><div style='margin-left: 5mm; margin-right: 5mm;'><a href='#substr_doc'>substr</a></div></div><hr>
<div id='remove_last_folder_str_doc'><h4>&sect;4.3.102: remove_last_folder</h4>
<div id='remove_last_folder_str_doc'><h4>&sect;4.3.103: remove_last_folder</h4>
<div style='font-family: "Courier New", Courier, monospace; text-align: left; margin-top: 3mm; margin-bottom: 3mm; font-size: .95em; background: #DFDFDF; padding: 0.25em;'>
fstr_bool remove_last_folder(
<div style='margin-left: 4mm;'>String *str<br></div>)
</div>
<div style='margin-top: 3mm; margin-bottom: 3mm; color: #309030;'><b><i>Description</i></b></div><div style='margin-left: 5mm; margin-right: 5mm;'>This call attemps to delete a folder or filename off the end of a path string.
This call returns non-zero on success.</div></div><hr>
<div id='string_set_match_str_doc'><h4>&sect;4.3.103: string_set_match</h4>
<div id='string_set_match_str_doc'><h4>&sect;4.3.104: string_set_match</h4>
<div style='font-family: "Courier New", Courier, monospace; text-align: left; margin-top: 3mm; margin-bottom: 3mm; font-size: .95em; background: #DFDFDF; padding: 0.25em;'>
fstr_bool string_set_match(
<div style='margin-left: 4mm;'>String *str_set,<br>int32_t count,<br>String str,<br>int32_t *match_index<br></div>)

View File

@ -41,7 +41,8 @@
#define END_QUERY_BAR_SIG(n) void n(Application_Links *app, Query_Bar *bar, uint32_t flags)
#define PRINT_MESSAGE_SIG(n) void n(Application_Links *app, char *str, int32_t len)
#define CHANGE_THEME_SIG(n) void n(Application_Links *app, char *name, int32_t len)
#define CHANGE_FONT_SIG(n) void n(Application_Links *app, char *name, int32_t len)
#define CHANGE_FONT_SIG(n) void n(Application_Links *app, char *name, int32_t len, bool32 apply_to_all_files)
#define BUFFER_SET_FONT_SIG(n) void n(Application_Links *app, Buffer_Summary *buffer, char *name, int32_t len)
#define SET_THEME_COLORS_SIG(n) void n(Application_Links *app, Theme_Color *colors, int32_t count)
#define GET_THEME_COLORS_SIG(n) void n(Application_Links *app, Theme_Color *colors, int32_t count)
#define DIRECTORY_GET_HOT_SIG(n) int32_t n(Application_Links *app, char *out, int32_t capacity)
@ -99,6 +100,7 @@ extern "C"{
typedef PRINT_MESSAGE_SIG(Print_Message_Function);
typedef CHANGE_THEME_SIG(Change_Theme_Function);
typedef CHANGE_FONT_SIG(Change_Font_Function);
typedef BUFFER_SET_FONT_SIG(Buffer_Set_Font_Function);
typedef SET_THEME_COLORS_SIG(Set_Theme_Colors_Function);
typedef GET_THEME_COLORS_SIG(Get_Theme_Colors_Function);
typedef DIRECTORY_GET_HOT_SIG(Directory_Get_Hot_Function);
@ -159,6 +161,7 @@ struct Application_Links{
Print_Message_Function *print_message;
Change_Theme_Function *change_theme;
Change_Font_Function *change_font;
Buffer_Set_Font_Function *buffer_set_font;
Set_Theme_Colors_Function *set_theme_colors;
Get_Theme_Colors_Function *get_theme_colors;
Directory_Get_Hot_Function *directory_get_hot;
@ -221,6 +224,7 @@ app_links->end_query_bar = End_Query_Bar;\
app_links->print_message = Print_Message;\
app_links->change_theme = Change_Theme;\
app_links->change_font = Change_Font;\
app_links->buffer_set_font = Buffer_Set_Font;\
app_links->set_theme_colors = Set_Theme_Colors;\
app_links->get_theme_colors = Get_Theme_Colors;\
app_links->directory_get_hot = Directory_Get_Hot;\

View File

@ -126,16 +126,16 @@ CUSTOM_COMMAND_SIG(seek_whitespace_down_end_line){
}
HOOK_SIG(my_start){
init_memory(app);
app->change_theme(app, literal("4coder"));
app->change_font(app, literal("Liberation Sans"), true);
exec_command(app, open_panel_vsplit);
exec_command(app, hide_scrollbar);
exec_command(app, change_active_panel);
exec_command(app, hide_scrollbar);
app->change_theme(app, literal("4coder"));
app->change_font(app, literal("Liberation Sans"));
init_memory(app);
// Theme options:
// "4coder"
// "Handmade Hero"

View File

@ -37,6 +37,9 @@ CUSTOM_COMMAND_SIG(build_in_build_panel){
execute_standard_build(app, &build_view, &original_buffer);
buffer = app->get_buffer_by_name(app, literal("*compilation*"), AccessAll);
app->buffer_set_font(app, &buffer, literal("Inconsolata"));
prev_location = null_location;
}

View File

@ -119,15 +119,19 @@ parse_error(String line, Jump_Location *location,
int colon_pos1 = find(line, 0, ':');
int colon_pos2 = find(line, colon_pos1+1, ':');
String filename = substr(line, 0, colon_pos1);
String line_number = substr(line, colon_pos1+1, colon_pos2 - colon_pos1 - 1);
if (filename.size > 0 && line_number.size > 0){
location->file = filename;
location->line = str_to_int(line_number);
location->column = 0;
*colon_char = colon_pos2;
result = true;
if (colon_pos2 < line.size){
String filename = substr(line, 0, colon_pos1);
String line_number = substr(line, colon_pos1+1, colon_pos2 - colon_pos1 - 1);
if (str_is_int(line_number)){
if (filename.size > 0 && line_number.size > 0){
location->file = filename;
location->line = str_to_int(line_number);
location->column = 0;
*colon_char = colon_pos2;
result = true;
}
}
}
}
}

View File

@ -133,6 +133,7 @@ FSTRING_LINK fstr_bool append_u64_to_str(String *dest, uint64_t x);
FSTRING_LINK int32_t float_to_str_size(float x);
FSTRING_LINK fstr_bool append_float_to_str(String *dest, float x);
FSTRING_LINK fstr_bool float_to_str(String *dest, float x);
FSTRING_LINK fstr_bool str_is_int(String str);
FSTRING_LINK int32_t str_to_int(char *str);
FSTRING_LINK int32_t str_to_int(String str);
FSTRING_LINK int32_t hexchar_to_int(char c);
@ -1332,6 +1333,20 @@ float_to_str(String *dest, float x){
}
#endif
#ifdef FSTRING_IMPLEMENTATION
FSTRING_LINK fstr_bool
str_is_int(String str){
fstr_bool result = true;
for (int32_t i = 0; i < str.size; ++i){
if (!char_is_numeric(str.str[i])){
result = false;
break;
}
}
return(result);
}
#endif
#ifdef FSTRING_IMPLEMENTATION
FSTRING_LINK int32_t
str_to_int(char *str){

View File

@ -1,6 +1,5 @@
/* DOC(bool32 is an alias name to signal that an integer parameter or field is for
true/false vales.) */
typedef int32_t bool32;
@ -18,7 +17,7 @@ when a buffer is closed it's id may be recycled by future, different buffers.) *
typedef int32_t Buffer_ID;
/* DOC(View_ID is used to name a 4coder view. Each view has a unique id in
the range [1,16].) */
the interval [1,16].) */
typedef int32_t View_ID;
#define ENUM(type,name) typedef type name; enum name##_

56
4ed.cpp
View File

@ -833,7 +833,6 @@ app_hardcode_styles(Models *models){
i16 fonts = 1;
models->global_font.font_id = fonts + 0;
models->global_font.font_changed = 0;
/////////////////
style_set_name(style, make_lit_string("4coder"));
@ -1697,17 +1696,6 @@ App_Step_Sig(app_step){
}
}
// NOTE(allen): begin allowing the cursors and scroll locations
// to move around.
{
Panel *panel = 0, *used_panels = 0;
used_panels = &models->layout.used_sentinel;
for (dll_items(panel, used_panels)){
Assert(panel->view);
view_begin_cursor_scroll_updates(panel->view);
}
}
// NOTE(allen): reorganizing panels on screen
{
i32 prev_width = models->layout.full_width;
@ -2319,17 +2307,6 @@ App_Step_Sig(app_step){
update_command_data(vars, cmd);
// NOTE(allen): post scroll vars back to the view's gui targets
{
Panel *panel = 0, *used_panels = 0;
used_panels = &models->layout.used_sentinel;
for (dll_items(panel, used_panels)){
Assert(panel->view);
view_end_cursor_scroll_updates(panel->view);
}
}
// NOTE(allen): command execution
{
Key_Summary key_data = get_key_data(&vars->available_input);
@ -2631,39 +2608,6 @@ App_Step_Sig(app_step){
}
}
// NOTE(allen): send style change messages if the style has changed
if (models->global_font.font_changed){
models->global_font.font_changed = 0;
File_Node *node, *used_nodes;
Editing_File *file;
Render_Font *font = get_font_info(models->font_set, models->global_font.font_id)->font;
float *advance_data = 0;
if (font) advance_data = font->advance_data;
used_nodes = &models->working_set.used_sentinel;
for (dll_items(node, used_nodes)){
file = (Editing_File*)node;
file_measure_starts_widths(system, &models->mem.general, &file->state.buffer, advance_data);
}
Panel *panel, *used_panels;
used_panels = &models->layout.used_sentinel;
for (dll_items(panel, used_panels)){
update_view_line_height(models, panel->view);
remeasure_file_view(system, panel->view);
}
}
// NOTE(allen): post scroll vars back to the view's gui targets
{
Panel *panel = 0, *used_panels = &models->layout.used_sentinel;
for (dll_items(panel, used_panels)){
Assert(panel->view);
view_end_cursor_scroll_updates(panel->view);
}
}
// NOTE(allen): on the first frame there should be no scrolling
if (input->first_step){
Panel *panel = 0, *used_panels = &models->layout.used_sentinel;

View File

@ -791,16 +791,6 @@ DOC_SEE(Buffer_Batch_Edit_Type)
bool32 result = false;
app->print_message(app, literal("Buffer_Batch_Edit:\n"));
{
char space[512];
String str = make_fixed_width_string(space);
append(&str, "edit_count: ");
append_int_to_str(&str, edit_count);
append(&str, '\n');
app->print_message(app, str.str, str.size);
}
if (file){
Temp_Memory temp = begin_temp_memory(part);
Buffer_Edit *inverse_edits = push_array(part, Buffer_Edit, edit_count);
@ -832,7 +822,6 @@ DOC_SEE(Buffer_Setting_ID)
Command_Data *cmd = (Command_Data*)app->cmd_context;
System_Functions *system = cmd->system;
Models *models = cmd->models;
Editing_File *file = imp_get_file(cmd, buffer);
bool32 result = false;
@ -1738,28 +1727,6 @@ DOC_SEE(int_color)
return(result);
}
/*
API_EXPORT void
View_Set_Paste_Rewrite_(Application_Links *app, View_Summary *view){
Command_Data *cmd = (Command_Data*)app->cmd_context;
View *vptr = imp_get_view(cmd, view);
if (vptr){
vptr->next_mode.rewrite = true;
}
}
API_EXPORT int
View_Get_Paste_Rewrite_(Application_Links *app, View_Summary *view){
Command_Data *cmd = (Command_Data*)app->cmd_context;
View *vptr = imp_get_view(cmd, view);
int result = false;
if (vptr){
result = vptr->mode.rewrite;
}
return(result);
}
*/
API_EXPORT User_Input
Get_User_Input(Application_Links *app, Input_Type_Flag get_type, Input_Type_Flag abort_type)/*
DOC_PARAM(get_type, The get_type parameter specifies the set of input types that should be returned.)
@ -1895,7 +1862,7 @@ API_EXPORT void
Change_Theme(Application_Links *app, char *name, int32_t len)/*
DOC_PARAM(name, The name parameter specifies the name of the theme to begin using; it need not be null terminated.)
DOC_PARAM(len, The len parameter specifies the length of the name string.)
DOC(This call changes 4coder's theme to one of the built in themes.)
DOC(This call changes 4coder's color pallet to one of the built in themes.)
*/{
Command_Data *cmd = (Command_Data*)app->cmd_context;
Style_Library *styles = &cmd->models->styles;
@ -1914,20 +1881,55 @@ DOC(This call changes 4coder's theme to one of the built in themes.)
}
API_EXPORT void
Change_Font(Application_Links *app, char *name, int32_t len)/*
Change_Font(Application_Links *app, char *name, int32_t len, bool32 apply_to_all_files)/*
DOC_PARAM(name, The name parameter specifies the name of the font to begin using; it need not be null terminated.)
DOC_PARAM(len, The len parameter specifies the length of the name string.)
DOC(This call changes 4coder's font to one of the built in fonts.)
DOC_PARAM(apply_to_all_files, If this is set all open files change to this font. Usually this should be true
durring the start hook because several files already exist at that time.)
DOC(This call changes 4coder's default font to one of the built in fonts.)
*/{
Command_Data *cmd = (Command_Data*)app->cmd_context;
Font_Set *set = cmd->models->font_set;
Style_Font *global_font = &cmd->models->global_font;
String font_name = make_string(name, len);
i16 font_id = 0;
if (font_set_extract(set, font_name, &font_id)){
global_font->font_id = font_id;
global_font->font_changed = 1;
if (apply_to_all_files){
System_Functions *system = cmd->system;
Models *models = cmd->models;
File_Node *node = 0;
File_Node *sentinel = &models->working_set.used_sentinel;
for (dll_items(node, sentinel)){
Editing_File *file = (Editing_File*)node;
file_set_font(system, models, file, font_id);
}
}
}
}
API_EXPORT void
Buffer_Set_Font(Application_Links *app, Buffer_Summary *buffer, char *name, int32_t len)/*
DOC_PARAM(buffer, This parameter the buffer that shall have it's font changed)
DOC_PARAM(name, The name parameter specifies the name of the font to begin using; it need not be null terminated.)
DOC_PARAM(len, The len parameter specifies the length of the name string.)
DOC(This call sets the display font of a particular buffer.)
*/{
Command_Data *cmd = (Command_Data*)app->cmd_context;
System_Functions *system = cmd->system;
Models *models = cmd->models;
Editing_File *file = imp_get_file(cmd, buffer);
Font_Set *set = models->font_set;
String font_name = make_string(name, len);
i16 font_id = 0;
if (font_set_extract(set, font_name, &font_id)){
file_set_font(system, models, file, font_id);
}
}

View File

@ -119,6 +119,7 @@ struct Text_Effect{
struct Editing_File_Settings{
i32 base_map_id;
i32 dos_write_mode;
i16 font_id;
b8 unwrapped_lines;
b8 tokens_exist;
b8 is_initialized;

View File

@ -414,7 +414,7 @@ inline Full_Cursor
view_compute_cursor_from_pos(View *view, i32 pos){
Editing_File *file = view->file_data.file;
Models *models = view->persistent.models;
Render_Font *font = get_font_info(models->font_set, models->global_font.font_id)->font;
Render_Font *font = get_font_info(models->font_set, file->settings.font_id)->font;
Full_Cursor result = {};
if (font){
@ -429,7 +429,7 @@ inline Full_Cursor
view_compute_cursor_from_unwrapped_xy(View *view, f32 seek_x, f32 seek_y, b32 round_down = 0){
Editing_File *file = view->file_data.file;
Models *models = view->persistent.models;
Render_Font *font = get_font_info(models->font_set, models->global_font.font_id)->font;
Render_Font *font = get_font_info(models->font_set, file->settings.font_id)->font;
Full_Cursor result = {};
if (font){
@ -445,7 +445,7 @@ internal Full_Cursor
view_compute_cursor_from_wrapped_xy(View *view, f32 seek_x, f32 seek_y, b32 round_down = 0){
Editing_File *file = view->file_data.file;
Models *models = view->persistent.models;
Render_Font *font = get_font_info(models->font_set, models->global_font.font_id)->font;
Render_Font *font = get_font_info(models->font_set, file->settings.font_id)->font;
Full_Cursor result = {};
if (font){
@ -462,7 +462,7 @@ internal Full_Cursor
view_compute_cursor_from_line_pos(View *view, i32 line, i32 pos){
Editing_File *file = view->file_data.file;
Models *models = view->persistent.models;
Render_Font *font = get_font_info(models->font_set, models->global_font.font_id)->font;
Render_Font *font = get_font_info(models->font_set, file->settings.font_id)->font;
Full_Cursor result = {};
if (font){
@ -1046,22 +1046,22 @@ file_create_from_string(System_Functions *system, Models *models,
General_Memory *general = &models->mem.general;
Partition *part = &models->mem.part;
Buffer_Init_Type init;
i32 page_size, scratch_size, init_success;
file->state = editing_file_state_zero();
init = buffer_begin_init(&file->state.buffer, val.str, val.size);
for (; buffer_init_need_more(&init); ){
page_size = buffer_init_page_size(&init);
i32 page_size = buffer_init_page_size(&init);
page_size = LargeRoundUp(page_size, Kbytes(4));
if (page_size < Kbytes(4)) page_size = Kbytes(4);
void *data = general_memory_allocate(general, page_size);
buffer_init_provide_page(&init, data, page_size);
}
scratch_size = partition_remaining(part);
i32 scratch_size = partition_remaining(part);
Assert(scratch_size > 0);
init_success = buffer_end_init(&init, part->base + part->pos, scratch_size);
b32 init_success = buffer_end_init(&init, part->base + part->pos, scratch_size);
AllowLocal(init_success);
Assert(init_success);
@ -1076,6 +1076,7 @@ file_create_from_string(System_Functions *system, Models *models,
file_synchronize_times(system, file, name);
i16 font_id = models->global_font.font_id;
file->settings.font_id = font_id;
Render_Font *font = get_font_info(font_set, font_id)->font;
float *advance_data = 0;
if (font) advance_data = font->advance_data;
@ -1735,6 +1736,12 @@ file_view_nullify_file(View *view){
view->file_data = file_viewing_data_zero();
}
internal void
update_view_line_height(Models *models, View *view, i16 font_id){
Render_Font *font = get_font_info(models->font_set, font_id)->font;
view->line_height = font->height;
}
internal void
view_set_file(View *view, Editing_File *file, Models *models){
if (view->file_data.file != 0){
@ -1760,6 +1767,11 @@ view_set_file(View *view, Editing_File *file, Models *models){
if (file_is_ready(file)){
view_measure_wraps(&models->mem.general, view);
}
update_view_line_height(models, view, file->settings.font_id);
}
else{
update_view_line_height(models, view, models->global_font.font_id);
}
}
@ -2150,7 +2162,7 @@ file_do_single_edit(System_Functions *system,
i32 new_line_count = buffer_count_newlines(&file->state.buffer, start, start+str_len);
i32 line_shift = new_line_count - replaced_line_count;
i16 font_id = models->global_font.font_id;
i16 font_id = file->settings.font_id;
Render_Font *font = get_font_info(models->font_set, font_id)->font;
file_grow_starts_widths_as_needed(general, buffer, line_shift);
@ -2224,7 +2236,7 @@ file_do_batch_edit(System_Functions *system, Models *models, Editing_File *file,
// NOTE(allen): meta data
{
Buffer_Measure_Starts state = {};
i16 font_id = models->global_font.font_id;
i16 font_id = file->settings.font_id;
Render_Font *font = get_font_info(models->font_set, font_id)->font;
float *advance_data = 0;
if (font) advance_data = font->advance_data;
@ -3078,12 +3090,6 @@ style_get_color(Style *style, Cpp_Token token){
return result;
}
internal void
update_view_line_height(Models *models, View *view){
Font_Info *fnt_info = get_font_info(models->font_set, models->global_font.font_id);
view->line_height = fnt_info->height;
}
internal void
remeasure_file_view(System_Functions *system, View *view){
if (file_is_ready(view->file_data.file)){
@ -3099,6 +3105,22 @@ remeasure_file_view(System_Functions *system, View *view){
}
}
internal void
file_set_font(System_Functions *system, Models *models, Editing_File *file, i16 font_id){
Render_Font *font = get_font_info(models->font_set, font_id)->font;
f32 *advance_data = font->advance_data;
file->settings.font_id = font_id;
file_measure_starts_widths(system, &models->mem.general, &file->state.buffer, advance_data);
Editing_Layout *layout = &models->layout;
for (View_Iter iter = file_view_iter_init(layout, file, 0);
file_view_iter_good(iter);
iter = file_view_iter_next(iter)){
update_view_line_height(models, iter.view, font_id);
remeasure_file_view(system, iter.view);
}
}
inline void
view_show_GUI(View *view, View_UI ui){
view->map = &view->persistent.models->map_ui;
@ -3586,48 +3608,6 @@ view_reinit_scrolling(View *view){
return(scroll);
}
// TODO(allen): GTFO!
internal void
view_begin_cursor_scroll_updates(View *view){
#if 0
if (view->file_data.file && view->file_data.file == view->prev_context.file){
Assert(view->prev_cursor_pos == view_get_cursor_pos(view));
}
#endif
}
internal void
view_end_cursor_scroll_updates(View *view){
#if 0
if (view->edit_pos){
i32 set_type = view->edit_pos->last_set_type;
switch (set_type){
case EditPos_None: break;
case EditPos_CursorSet:
{
if (view->gui_target.did_file){
view->edit_pos->scroll.max_y = view_compute_max_target_y(view);
}
view_move_view_to_cursor(view, &view->edit_pos->scroll, false);
gui_post_scroll_vars(&view->gui_target, &view->edit_pos->scroll, view->scroll_region);
}break;
case EditPos_ScrollSet:
{
view_move_cursor_to_view(view, view->edit_pos->scroll);
gui_post_scroll_vars(&view->gui_target, &view->edit_pos->scroll, view->scroll_region);
}break;
}
}
#endif
}
internal b32
file_step(View *view, i32_Rect region, Input_Summary *user_input, b32 is_active, b32 *consumed_l){
i32 is_animating = 0;
@ -4079,12 +4059,6 @@ step_file_view(System_Functions *system, View *view, View *active_view, Input_Su
scroll_context.id[1] = view->showing_ui;
scroll_context.id[0] = (u64)(view->file_data.file);
// TODO(allen): ????
#if 0
gui_get_scroll_vars(target, scroll_context, &view->scroll_region);
#endif
GUI_Scroll_Vars scroll_zero = {0};
GUI_Scroll_Vars *scroll = &scroll_zero;
@ -4168,9 +4142,12 @@ step_file_view(System_Functions *system, View *view, View *active_view, Input_Su
}
message = make_lit_string("Set Font");
id.id[0] = (u64)(&models->global_font);
if (gui_do_button(target, id, message)){
view->color_mode = CV_Mode_Font;
if (view->file_data.file){
id.id[0] = (u64)(&view->file_data.file->settings.font_id);
if (gui_do_button(target, id, message)){
view->color_mode = CV_Mode_Font;
}
}
message = make_lit_string("Theme Library - Click to Select");
@ -4198,11 +4175,12 @@ step_file_view(System_Functions *system, View *view, View *active_view, Input_Su
case CV_Mode_Font:
{
Assert(view->file_data.file);
Font_Set *font_set = models->font_set;
Font_Info *info = 0;
i16 i = 1, count = (i16)models->font_set->count + 1;
i16 font_id = 0, new_font_id = 0;
String message = make_lit_string("Back");
@ -4211,8 +4189,8 @@ step_file_view(System_Functions *system, View *view, View *active_view, Input_Su
view->color_mode = CV_Mode_Library;
}
font_id = models->global_font.font_id;
new_font_id = font_id;
i16 font_id = view->file_data.file->settings.font_id;
i16 new_font_id = font_id;
for (i = 1; i < count; ++i){
info = get_font_info(font_set, i);
@ -4231,7 +4209,7 @@ step_file_view(System_Functions *system, View *view, View *active_view, Input_Su
}
}
models->global_font.font_id = (i16)(new_font_id);
file_set_font(system, models, view->file_data.file, new_font_id);
}break;
case CV_Mode_Adjusting:
@ -5341,7 +5319,7 @@ draw_file_loaded(View *view, i32_Rect rect, b32 is_active, Render_Target *target
i32 max = partition_remaining(part) / sizeof(Buffer_Render_Item);
Buffer_Render_Item *items = push_array(part, Buffer_Render_Item, max);
i16 font_id = models->global_font.font_id;
i16 font_id = file->settings.font_id;
Render_Font *font = get_font_info(models->font_set, font_id)->font;
float *advance_data = 0;
if (font) advance_data = font->advance_data;
@ -5496,7 +5474,8 @@ draw_file_loaded(View *view, i32_Rect rect, b32 is_active, Render_Target *target
}
internal void
draw_text_field(Render_Target *target, View *view, i32_Rect rect, String p, String t){
draw_text_field(Render_Target *target, View *view, i16 font_id,
i32_Rect rect, String p, String t){
Models *models = view->persistent.models;
Style *style = main_style(models);
@ -5507,8 +5486,6 @@ draw_text_field(Render_Target *target, View *view, i32_Rect rect, String p, Stri
i32 x = rect.x0;
i32 y = rect.y0 + 2;
i16 font_id = models->global_font.font_id;
if (target){
draw_rectangle(target, rect, back_color);
x = CEIL32(draw_string(target, font_id, p, x, y, text2_color));
@ -5517,7 +5494,8 @@ draw_text_field(Render_Target *target, View *view, i32_Rect rect, String p, Stri
}
internal void
draw_text_with_cursor(Render_Target *target, View *view, i32_Rect rect, String s, i32 pos){
draw_text_with_cursor(Render_Target *target, View *view, i16 font_id,
i32_Rect rect, String s, i32 pos){
Models *models = view->persistent.models;
Style *style = main_style(models);
@ -5529,8 +5507,6 @@ draw_text_with_cursor(Render_Target *target, View *view, i32_Rect rect, String s
f32 x = (f32)rect.x0;
i32 y = rect.y0 + 2;
i16 font_id = models->global_font.font_id;
if (target){
draw_rectangle(target, rect, back_color);
@ -5565,7 +5541,6 @@ internal void
draw_file_bar(Render_Target *target, View *view, Editing_File *file, i32_Rect rect){
File_Bar bar;
Models *models = view->persistent.models;
Style_Font *font = &models->global_font;
Style *style = main_style(models);
Interactive_Style bar_style = style->main.file_info_style;
@ -5577,7 +5552,7 @@ draw_file_bar(Render_Target *target, View *view, Editing_File *file, i32_Rect re
bar.rect = rect;
if (target){
bar.font_id = font->font_id;
bar.font_id = file->settings.font_id;
bar.pos_x = (f32)bar.rect.x0;
bar.pos_y = (f32)bar.rect.y0;
bar.text_shift_y = 2;
@ -5660,11 +5635,8 @@ get_margin_color(i32 active_level, Style *style){
internal void
draw_color_button(GUI_Target *gui_target, Render_Target *target, View *view,
i32_Rect rect, GUI_id id, u32 fore, u32 back, String text){
Models *models = view->persistent.models;
i16 font_id, i32_Rect rect, GUI_id id, u32 fore, u32 back, String text){
i32 active_level = gui_active_level(gui_target, id);
i16 font_id = models->global_font.font_id;
if (active_level > 0){
Swap(u32, back, fore);
@ -5692,13 +5664,13 @@ draw_font_button(GUI_Target *gui_target, Render_Target *target, View *view,
}
internal void
draw_fat_option_block(GUI_Target *gui_target, Render_Target *target, View *view, i32_Rect rect, GUI_id id,
draw_fat_option_block(GUI_Target *gui_target, Render_Target *target, View *view,
i16 font_id, i32_Rect rect, GUI_id id,
String text, String pop, i8 checkbox = -1){
Models *models = view->persistent.models;
Style *style = main_style(models);
i32 active_level = gui_active_level(gui_target, id);
i16 font_id = models->global_font.font_id;
i32_Rect inner = get_inner_rect(rect, 3);
@ -5734,12 +5706,12 @@ draw_fat_option_block(GUI_Target *gui_target, Render_Target *target, View *view,
}
internal void
draw_button(GUI_Target *gui_target, Render_Target *target, View *view, i32_Rect rect, GUI_id id, String text){
draw_button(GUI_Target *gui_target, Render_Target *target, View *view,
i16 font_id, i32_Rect rect, GUI_id id, String text){
Models *models = view->persistent.models;
Style *style = main_style(models);
i32 active_level = gui_active_level(gui_target, id);
i16 font_id = models->global_font.font_id;
i32_Rect inner = get_inner_rect(rect, 3);
@ -5760,11 +5732,11 @@ draw_button(GUI_Target *gui_target, Render_Target *target, View *view, i32_Rect
}
internal void
draw_style_preview(GUI_Target *gui_target, Render_Target *target, View *view, i32_Rect rect, GUI_id id, Style *style){
draw_style_preview(GUI_Target *gui_target, Render_Target *target, View *view,
i16 font_id, i32_Rect rect, GUI_id id, Style *style){
Models *models = view->persistent.models;
i32 active_level = gui_active_level(gui_target, id);
i16 font_id = models->global_font.font_id;
Font_Info *info = get_font_info(models->font_set, font_id);
i32_Rect inner = get_inner_rect(rect, 3);
@ -5819,6 +5791,11 @@ do_render_file_view(System_Functions *system, View *view, GUI_Scroll_Vars *scrol
i32 max_y = view_compute_max_target_y(view);
i16 font_id = 0;
if (file){
font_id = file->settings.font_id;
}
if (gui_target->push.pos > 0){
gui_session_init(&gui_session, gui_target, rect, view->line_height);
@ -5857,7 +5834,7 @@ do_render_file_view(System_Functions *system, View *view, GUI_Scroll_Vars *scrol
void *ptr = (h+1);
String p = gui_read_string(&ptr);
String t = gui_read_string(&ptr);
draw_text_field(target, view, gui_session.rect, p, t);
draw_text_field(target, view, font_id, gui_session.rect, p, t);
}break;
case guicom_text_with_cursor:
@ -5866,7 +5843,7 @@ do_render_file_view(System_Functions *system, View *view, GUI_Scroll_Vars *scrol
String s = gui_read_string(&ptr);
i32 pos = gui_read_integer(&ptr);
draw_text_with_cursor(target, view, gui_session.rect, s, pos);
draw_text_with_cursor(target, view, font_id, gui_session.rect, s, pos);
}break;
case guicom_color_button:
@ -5877,7 +5854,7 @@ do_render_file_view(System_Functions *system, View *view, GUI_Scroll_Vars *scrol
u32 back = (u32)gui_read_integer(&ptr);
String t = gui_read_string(&ptr);
draw_color_button(gui_target, target, view, gui_session.rect, b->id, fore, back, t);
draw_color_button(gui_target, target, view, font_id, gui_session.rect, b->id, fore, back, t);
}break;
case guicom_font_button:
@ -5902,7 +5879,7 @@ do_render_file_view(System_Functions *system, View *view, GUI_Scroll_Vars *scrol
append(&f, system->slash);
}
draw_fat_option_block(gui_target, target, view, gui_session.rect, b->id, f, m);
draw_fat_option_block(gui_target, target, view, font_id, gui_session.rect, b->id, f, m);
}break;
case guicom_style_preview:
@ -5911,7 +5888,7 @@ do_render_file_view(System_Functions *system, View *view, GUI_Scroll_Vars *scrol
i32 style_index = *(i32*)(b + 1);
Style *style = get_style(view->persistent.models, style_index);
draw_style_preview(gui_target, target, view, gui_session.rect, b->id, style);
draw_style_preview(gui_target, target, view, font_id, gui_session.rect, b->id, style);
}break;
case guicom_fixed_option:
@ -5927,7 +5904,7 @@ do_render_file_view(System_Functions *system, View *view, GUI_Scroll_Vars *scrol
status = (i8)gui_read_byte(&ptr);
}
draw_fat_option_block(gui_target, target, view, gui_session.rect, b->id, f, m, status);
draw_fat_option_block(gui_target, target, view, font_id, gui_session.rect, b->id, f, m, status);
}break;
case guicom_button:
@ -5936,7 +5913,7 @@ do_render_file_view(System_Functions *system, View *view, GUI_Scroll_Vars *scrol
void *ptr = (b + 1);
String t = gui_read_string(&ptr);
draw_button(gui_target, target, view, gui_session.rect, b->id, t);
draw_button(gui_target, target, view, font_id, gui_session.rect, b->id, t);
}break;
case guicom_scrollable_bar:
@ -6061,8 +6038,6 @@ live_set_alloc_view(Live_Views *live_set, Panel *panel, Models *models){
result.view->persistent.models = models;
update_view_line_height(models, result.view);
init_query_set(&result.view->query_set);
{

View File

@ -11,7 +11,6 @@
struct Style_Font{
i16 font_id;
i16 font_changed;
};
struct Style{

View File

@ -1,4 +1,4 @@
Distribution Date: 12.7.2016 (dd.mm.yyyy)
Distribution Date: 14.7.2016 (dd.mm.yyyy)
Thank you for contributing to the 4coder project!

View File

@ -1250,9 +1250,22 @@ space in dest this call returns non-zero.) */{
return(result);
}
FSTRING_LINK fstr_bool
str_is_int(String str)/*
DOC(If str is a valid string representation of an integer, this call returns non-zero.) */{
fstr_bool result = true;
for (int32_t i = 0; i < str.size; ++i){
if (!char_is_numeric(str.str[i])){
result = false;
break;
}
}
return(result);
}
FSTRING_LINK int32_t
str_to_int(char *str)/*
DOC(If str represents a valid string representation of an integer, this call will return
DOC(If str is a valid string representation of an integer, this call will return
the integer represented by the string. Otherwise this call returns zero.) */{
int32_t x = 0;
for (; *str; ++str){

View File

@ -190,8 +190,8 @@ CUSTOM_COMMAND_SIG(save_theme_settings){
#include <stdio.h>
#define SETTINGS_FILE ".4coder_settings"
HOOK_SIG(experimental_start_hook){
my_start(app);
HOOK_SIG(experimental_start){
init_memory(app);
char theme_name[128];
char font_name[128];
@ -217,8 +217,16 @@ HOOK_SIG(experimental_start_hook){
fclose(file);
app->change_theme(app, theme_name, (int)strlen(theme_name));
app->change_font(app, font_name, (int)strlen(font_name));
int theme_len = (int)strlen(theme_name);
int font_len = (int)strlen(font_name);
app->change_theme(app, theme_name, theme_len);
app->change_font(app, font_name, font_len, true);
exec_command(app, open_panel_vsplit);
exec_command(app, hide_scrollbar);
exec_command(app, change_active_panel);
exec_command(app, hide_scrollbar);
}
return(0);
@ -229,7 +237,7 @@ get_bindings(void *data, int size){
Bind_Helper context_ = begin_bind_helper(data, size);
Bind_Helper *context = &context_;
set_hook(context, hook_start, experimental_start_hook);
set_hook(context, hook_start, experimental_start);
set_open_file_hook(context, my_file_settings);
set_input_filter(context, my_suppress_mouse_filter);
set_command_caller(context, default_command_caller);