Fixed UI problems with new font stuff, ready to move on to Italics, Bold, & Underline tomorrow
parent
12faf0b8c2
commit
29b1488057
|
@ -23,7 +23,7 @@ default_keys(Bind_Helper *context){
|
||||||
|
|
||||||
void
|
void
|
||||||
mac_default_keys(Bind_Helper *context){
|
mac_default_keys(Bind_Helper *context){
|
||||||
|
fill_keys_mac_default(context);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -4568,16 +4568,14 @@ step_file_view(System_Functions *system, View *view, Models *models, View *activ
|
||||||
append(&m, " *");
|
append(&m, " *");
|
||||||
}
|
}
|
||||||
|
|
||||||
id.id[0] = i;
|
id.id[0] = i*2 + 0;
|
||||||
id.id[1] = 0;
|
|
||||||
if (gui_do_button(target, id, m)){
|
if (gui_do_button(target, id, m)){
|
||||||
if (new_font_id == 0){
|
if (new_font_id == 0){
|
||||||
new_font_id = i;
|
new_font_id = i;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
id.id[0] = i;
|
id.id[0] = i*2 + 1;
|
||||||
id.id[1] = 1;
|
|
||||||
if (gui_do_button(target, id, make_lit_string("edit"))){
|
if (gui_do_button(target, id, make_lit_string("edit"))){
|
||||||
view->font_edit_id = i;
|
view->font_edit_id = i;
|
||||||
if (view->color_mode == CV_Mode_Font){
|
if (view->color_mode == CV_Mode_Font){
|
||||||
|
@ -4590,8 +4588,7 @@ step_file_view(System_Functions *system, View *view, Models *models, View *activ
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
id.id[0] = 0;
|
id.id[0] = largest_id*2 + 2;
|
||||||
id.id[1] = 2;
|
|
||||||
if (gui_do_button(target, id, make_lit_string("new face"))){
|
if (gui_do_button(target, id, make_lit_string("new face"))){
|
||||||
if (new_font_id == 0){
|
if (new_font_id == 0){
|
||||||
Font_Pointers font = system->font.get_pointers_by_id(font_id);
|
Font_Pointers font = system->font.get_pointers_by_id(font_id);
|
||||||
|
@ -4654,6 +4651,8 @@ step_file_view(System_Functions *system, View *view, Models *models, View *activ
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
gui_begin_scrollable(target, scroll_context, view->gui_scroll, 9*view->line_height, show_scrollbar);
|
||||||
|
|
||||||
Font_ID font_edit_id = view->font_edit_id;
|
Font_ID font_edit_id = view->font_edit_id;
|
||||||
Font_Pointers font = system->font.get_pointers_by_id(font_edit_id);
|
Font_Pointers font = system->font.get_pointers_by_id(font_edit_id);
|
||||||
Font_Settings *settings = font.settings;
|
Font_Settings *settings = font.settings;
|
||||||
|
@ -4710,6 +4709,7 @@ step_file_view(System_Functions *system, View *view, Models *models, View *activ
|
||||||
|
|
||||||
if (loadable.valid){
|
if (loadable.valid){
|
||||||
String name = make_string(loadable.display_name, loadable.display_len);
|
String name = make_string(loadable.display_name, loadable.display_len);
|
||||||
|
++id.id[0];
|
||||||
if (gui_do_button(target, id, name)){
|
if (gui_do_button(target, id, name)){
|
||||||
if (!has_new_settings){
|
if (!has_new_settings){
|
||||||
has_new_settings = true;
|
has_new_settings = true;
|
||||||
|
@ -4719,6 +4719,8 @@ step_file_view(System_Functions *system, View *view, Models *models, View *activ
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
gui_end_scrollable(target);
|
||||||
|
|
||||||
if (has_new_settings){
|
if (has_new_settings){
|
||||||
alter_font(system, models, font_edit_id, &new_settings);
|
alter_font(system, models, font_edit_id, &new_settings);
|
||||||
}
|
}
|
||||||
|
@ -5513,13 +5515,17 @@ view_get_scroll_y(View *view){
|
||||||
}
|
}
|
||||||
|
|
||||||
internal b32
|
internal b32
|
||||||
click_button_input(GUI_Target *target, GUI_Session *session, Input_Summary *user_input,
|
click_button_input(GUI_Target *target, GUI_Session *session, b32 in_scroll, i32_Rect scroll_rect, Input_Summary *user_input, GUI_Interactive *b, b32 *is_animating){
|
||||||
GUI_Interactive *b, b32 *is_animating){
|
|
||||||
b32 result = 0;
|
b32 result = 0;
|
||||||
i32 mx = user_input->mouse.x;
|
i32 mx = user_input->mouse.x;
|
||||||
i32 my = user_input->mouse.y;
|
i32 my = user_input->mouse.y;
|
||||||
|
|
||||||
if (hit_check(mx, my, session->rect)){
|
b32 in_sub_region = true;
|
||||||
|
if (in_scroll && !hit_check(mx, my, scroll_rect)){
|
||||||
|
in_sub_region = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (in_sub_region && hit_check(mx, my, session->rect)){
|
||||||
target->hover = b->id;
|
target->hover = b->id;
|
||||||
if (user_input->mouse.press_l){
|
if (user_input->mouse.press_l){
|
||||||
target->mouse_hot = b->id;
|
target->mouse_hot = b->id;
|
||||||
|
@ -5535,12 +5541,12 @@ click_button_input(GUI_Target *target, GUI_Session *session, Input_Summary *user
|
||||||
else if (gui_id_eq(target->hover, b->id)){
|
else if (gui_id_eq(target->hover, b->id)){
|
||||||
target->hover = gui_id_zero();
|
target->hover = gui_id_zero();
|
||||||
}
|
}
|
||||||
|
|
||||||
return(result);
|
return(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
internal b32
|
internal b32
|
||||||
scroll_button_input(GUI_Target *target, GUI_Session *session, Input_Summary *user_input,
|
scroll_button_input(GUI_Target *target, GUI_Session *session, Input_Summary *user_input, GUI_id id, b32 *is_animating){
|
||||||
GUI_id id, b32 *is_animating){
|
|
||||||
b32 result = 0;
|
b32 result = 0;
|
||||||
i32 mx = user_input->mouse.x;
|
i32 mx = user_input->mouse.x;
|
||||||
i32 my = user_input->mouse.y;
|
i32 my = user_input->mouse.y;
|
||||||
|
@ -5597,6 +5603,13 @@ do_step_file_view(System_Functions *system, View *view, Models *models, i32_Rect
|
||||||
|
|
||||||
target->active = gui_id_zero();
|
target->active = gui_id_zero();
|
||||||
|
|
||||||
|
// HACK(allen): UI sucks! Now just forcing it to
|
||||||
|
// not have the bug where it clicks buttons behind the
|
||||||
|
// header buttons before the scrollable section.
|
||||||
|
b32 in_scroll = false;
|
||||||
|
i32_Rect scroll_rect = {0};
|
||||||
|
i32 prev_bottom = 0;
|
||||||
|
|
||||||
if (target->push.pos > 0){
|
if (target->push.pos > 0){
|
||||||
gui_session_init(&gui_session, target, rect, view->line_height);
|
gui_session_init(&gui_session, target, rect, view->line_height);
|
||||||
|
|
||||||
|
@ -5660,9 +5673,11 @@ do_step_file_view(System_Functions *system, View *view, Models *models, i32_Rect
|
||||||
{
|
{
|
||||||
GUI_Interactive *b = (GUI_Interactive*)h;
|
GUI_Interactive *b = (GUI_Interactive*)h;
|
||||||
|
|
||||||
if (click_button_input(target, &gui_session, user_input, b, &result.is_animating)){
|
if (click_button_input(target, &gui_session, in_scroll, scroll_rect, user_input, b, &result.is_animating)){
|
||||||
result.consumed_l = true;
|
result.consumed_l = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
prev_bottom = gui_session.rect.y1;
|
||||||
}break;
|
}break;
|
||||||
|
|
||||||
case guicom_fixed_option:
|
case guicom_fixed_option:
|
||||||
|
@ -5670,7 +5685,7 @@ do_step_file_view(System_Functions *system, View *view, Models *models, i32_Rect
|
||||||
{
|
{
|
||||||
GUI_Interactive *b = (GUI_Interactive*)h;
|
GUI_Interactive *b = (GUI_Interactive*)h;
|
||||||
|
|
||||||
if (click_button_input(target, &gui_session, user_input, b, &result.is_animating)){
|
if (click_button_input(target, &gui_session, in_scroll, scroll_rect, user_input, b, &result.is_animating)){
|
||||||
result.consumed_l = true;
|
result.consumed_l = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5768,8 +5783,18 @@ do_step_file_view(System_Functions *system, View *view, Models *models, i32_Rect
|
||||||
}
|
}
|
||||||
}break;
|
}break;
|
||||||
|
|
||||||
|
case guicom_begin_scrollable_section:
|
||||||
|
{
|
||||||
|
in_scroll = true;
|
||||||
|
scroll_rect.x0 = region.x0;
|
||||||
|
scroll_rect.y0 = prev_bottom;
|
||||||
|
scroll_rect.x1 = region.x1;
|
||||||
|
scroll_rect.y1 = region.y1;
|
||||||
|
}break;
|
||||||
|
|
||||||
case guicom_end_scrollable_section:
|
case guicom_end_scrollable_section:
|
||||||
{
|
{
|
||||||
|
in_scroll = false;
|
||||||
if (!is_file_scroll){
|
if (!is_file_scroll){
|
||||||
result.has_max_y_suggestion = 1;
|
result.has_max_y_suggestion = 1;
|
||||||
result.max_y = gui_session.suggested_max_y;
|
result.max_y = gui_session.suggested_max_y;
|
||||||
|
|
|
@ -413,8 +413,7 @@ osx_resize(int width, int height){
|
||||||
}
|
}
|
||||||
|
|
||||||
internal void
|
internal void
|
||||||
osx_push_key(Key_Code code, Key_Code chr, Key_Code chr_nocaps, b8 *mods)
|
osx_push_key(Key_Code code, Key_Code chr, Key_Code chr_nocaps, b8 *mods){
|
||||||
{
|
|
||||||
i32 count = osxvars.input.keys.count;
|
i32 count = osxvars.input.keys.count;
|
||||||
|
|
||||||
if (count < KEY_INPUT_BUFFER_SIZE){
|
if (count < KEY_INPUT_BUFFER_SIZE){
|
||||||
|
|
|
@ -9,13 +9,14 @@
|
||||||
|
|
||||||
// TOP
|
// TOP
|
||||||
|
|
||||||
|
#define IS_OBJC_LAYER
|
||||||
|
|
||||||
#define inline internal
|
#define inline internal
|
||||||
#include "4ed_defines.h"
|
#include "4ed_defines.h"
|
||||||
#undef inline
|
#undef inline
|
||||||
#include "4coder_API/version.h"
|
#include "4coder_API/version.h"
|
||||||
#include "4coder_generated/keycodes.h"
|
#include "4coder_generated/keycodes.h"
|
||||||
|
|
||||||
#define IS_OBJC_LAYER
|
|
||||||
#include "4ed_log.h"
|
#include "4ed_log.h"
|
||||||
#include "4ed_cursor_codes.h"
|
#include "4ed_cursor_codes.h"
|
||||||
#include "4ed_linked_node_macros.h"
|
#include "4ed_linked_node_macros.h"
|
||||||
|
|
Loading…
Reference in New Issue