debugging scroll bar crap

This commit is contained in:
Allen Webster 2016-04-21 23:28:00 -04:00
parent eda7588799
commit efc042af3e
4 changed files with 20 additions and 14 deletions

View File

@ -3620,15 +3620,13 @@ step_file_view(System_Functions *system, View *view, b32 is_active){
Models *models = view->models;
f32 min_target_y = view->file_scroll.min_y;
f32 max_target_y = view->file_scroll.max_y;
b32 debug = 1;
gui_begin_top_level(target);
{
gui_do_top_bar(target);
if (debug){
#if 0
{
char prompt_space[256];
char text_space[256];
String prompt, text;
@ -3648,6 +3646,7 @@ step_file_view(System_Functions *system, View *view, b32 is_active){
int_to_str((int)view->gui_target.scroll_updated.target_y, &text);
gui_do_text_field(target, prompt, text);
}
#endif
if (view->showing_ui == VUI_None){
gui_begin_overlap(target);
@ -3684,10 +3683,7 @@ step_file_view(System_Functions *system, View *view, b32 is_active){
}
gui_begin_scrollable(target, view->showing_ui, view->file_scroll, delta);
if (view->file_scroll.scroll_y < min_target_y) view->file_scroll.scroll_y = min_target_y;
if (view->file_scroll.scroll_y > max_target_y) view->file_scroll.scroll_y = max_target_y;
gui_do_file(target);
gui_end_scrollable(target);

View File

@ -410,6 +410,13 @@ gui_get_scroll_vars(GUI_Target *target, u32 scroll_id, GUI_Scroll_Vars *vars_out
b32 result = 0;
if (target->scroll_id == scroll_id){
*vars_out = target->scroll_updated;
if (vars_out->target_y < vars_out->min_y) vars_out->target_y = vars_out->min_y;
if (vars_out->target_y > vars_out->max_y) vars_out->target_y = vars_out->max_y;
if (vars_out->scroll_y < vars_out->min_y) vars_out->scroll_y = vars_out->min_y;
if (vars_out->scroll_y > vars_out->max_y) vars_out->scroll_y = vars_out->max_y;
if (gui_id_eq(target->active, gui_id_scrollbar())){
result = 1;
}
@ -727,6 +734,9 @@ gui_interpret(GUI_Target *target, GUI_Session *session, GUI_Header *h){
always_give_to_user = 1;
session->suggested_min_y = -(f32)(session->clip_rect.y0 - session->rect.y0);
session->suggested_max_y = (f32)(session->scrollable_items_bottom - session->full_rect.y1 * .5f);
if (session->suggested_max_y < 0){
session->suggested_max_y = 0;
}
break;
}

View File

@ -1,5 +1,5 @@
@echo off
REM "w:\4ed\misc\build_exp.bat" /Zi
"w:\4ed\misc\build_all.bat" /DFRED_SUPER /DFRED_NOT_PACKAGE /Zi
REM "w:\4ed\misc\build_all.bat" /O2 /Zi
REM "build_exp.bat" /Zi
"build_all.bat" /DFRED_SUPER /DFRED_NOT_PACKAGE /Zi
REM "build_all.bat" /O2 /Zi

View File

@ -8,7 +8,7 @@ set ICON=..\res\icon.res
set DEFINES=
pushd ..\meta
cl %WARNINGOPS% ..\code\4ed_metagen.cpp /Femetagen
cl %OPTS% ..\code\4ed_metagen.cpp /Femetagen
popd
pushd ..\code
"..\meta\metagen"
@ -18,9 +18,9 @@ pushd ..\build
call "..\code\buildsuper.bat" ..\code\4coder_custom.cpp
set EXPORTS=/EXPORT:app_get_functions
cl %WARNINGOPS% %INCLUDES% %DEFINES% ..\code\4ed_app_target.cpp %* /Fe4ed_app /LD /link /INCREMENTAL:NO /OPT:REF %EXPORTS%
cl %OPTS% %INCLUDES% %DEFINES% ..\code\4ed_app_target.cpp %* /Fe4ed_app /LD /link /INCREMENTAL:NO /OPT:REF %EXPORTS%
cl %WARNINGOPS% %INCLUDES% %DEFINES% ..\code\win32_4ed.cpp %LIBS% %ICON% %* /Fe4ed
cl %OPTS% %INCLUDES% %DEFINES% ..\code\win32_4ed.cpp %LIBS% %ICON% %* /Fe4ed
popd