part of the way to making panel positions fixed

This commit is contained in:
Allen Webster 2016-09-09 11:04:38 -04:00
parent aea67fa68b
commit 6eacad6221
9 changed files with 182 additions and 74 deletions

View File

@ -116,7 +116,8 @@ Flags can be combined with bit or to specify a state with multiple modifiers.<br
whitespace in a file. Whenever the view switches to a new buffer this setting is turned off.<br><br></div></div></div><div><div><span style='font-family: "Courier New", Courier, monospace; text-align: left;'><span style='font-weight: 600;'>ViewSetting_ShowScrollbar</span></span></div><div style='margin-bottom: 6mm;'><div style='margin-left: 5mm; margin-right: 5mm;'>The ViewSetting_ShowScrollbar setting determines whether a scroll bar is
attached to a view in it's scrollable section.<br><br></div></div></div></div><hr><div id='Buffer_Create_Flag_doc' style='margin-bottom: 1cm;'><h4>&sect;3.4.14: Buffer_Create_Flag</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 Buffer_Create_Flag;</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;'>A Buffer_Create_Flag field specifies how a buffer should be created.<br><br></div><div style='margin-top: 3mm; margin-bottom: 3mm; color: #309030;'><b><i>Values</i></b></div><div><div><span style='font-family: "Courier New", Courier, monospace; text-align: left;'><span style='font-weight: 600;'>BufferCreate_Background</span> = 0x1</span></div><div style='margin-bottom: 6mm;'><div style='margin-left: 5mm; margin-right: 5mm;'>BufferCreate_Background is not currently implemented.<br><br></div></div></div><div><div><span style='font-family: "Courier New", Courier, monospace; text-align: left;'><span style='font-weight: 600;'>BufferCreate_AlwaysNew</span> = 0x2</span></div><div style='margin-bottom: 6mm;'><div style='margin-left: 5mm; margin-right: 5mm;'>When BufferCreate_AlwaysNew is set it indicates the buffer should be
cleared to empty even if it's associated file already has content.<br><br></div></div></div><div><div><span style='font-family: "Courier New", Courier, monospace; text-align: left;'><span style='font-weight: 600;'>BufferCreate_NeverNew</span> = 0x4</span></div><div style='margin-bottom: 6mm;'><div style='margin-left: 5mm; margin-right: 5mm;'>When BufferCreate_NeverNew is set it indicates that the buffer should
only be created if it is an existing file or an open buffer.<br><br></div></div></div></div><hr><div id='Buffer_Kill_Flag_doc' style='margin-bottom: 1cm;'><h4>&sect;3.4.15: Buffer_Kill_Flag</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 Buffer_Kill_Flag;</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;'>A Buffer_Kill_Flag field specifies how a buffer should be killed.<br><br></div><div style='margin-top: 3mm; margin-bottom: 3mm; color: #309030;'><b><i>Values</i></b></div><div><div><span style='font-family: "Courier New", Courier, monospace; text-align: left;'><span style='font-weight: 600;'>BufferKill_Background</span> = 0x1</span></div><div style='margin-bottom: 6mm;'><div style='margin-left: 5mm; margin-right: 5mm;'>BufferKill_Background is not currently implemented.<br><br></div></div></div><div><div><span style='font-family: "Courier New", Courier, monospace; text-align: left;'><span style='font-weight: 600;'>BufferKill_AlwaysKill</span> = 0x2</span></div><div style='margin-bottom: 6mm;'><div style='margin-left: 5mm; margin-right: 5mm;'>When BufferKill_AlwaysKill is set it indicates the buffer should be killed
only be created if it is an existing file or if a buffer with the given name
is already open.<br><br></div></div></div></div><hr><div id='Buffer_Kill_Flag_doc' style='margin-bottom: 1cm;'><h4>&sect;3.4.15: Buffer_Kill_Flag</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 Buffer_Kill_Flag;</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;'>A Buffer_Kill_Flag field specifies how a buffer should be killed.<br><br></div><div style='margin-top: 3mm; margin-bottom: 3mm; color: #309030;'><b><i>Values</i></b></div><div><div><span style='font-family: "Courier New", Courier, monospace; text-align: left;'><span style='font-weight: 600;'>BufferKill_Background</span> = 0x1</span></div><div style='margin-bottom: 6mm;'><div style='margin-left: 5mm; margin-right: 5mm;'>BufferKill_Background is not currently implemented.<br><br></div></div></div><div><div><span style='font-family: "Courier New", Courier, monospace; text-align: left;'><span style='font-weight: 600;'>BufferKill_AlwaysKill</span> = 0x2</span></div><div style='margin-bottom: 6mm;'><div style='margin-left: 5mm; margin-right: 5mm;'>When BufferKill_AlwaysKill is set it indicates the buffer should be killed
without asking, even when the buffer is dirty.<br><br></div></div></div></div><hr><div id='Access_Flag_doc' style='margin-bottom: 1cm;'><h4>&sect;3.4.16: Access_Flag</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 Access_Flag;</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;'>An Access_Flag field specifies what sort of permission you grant to an
access call. An access call is usually one the returns a summary struct. If a
4coder object has a particular protection flag set and the corresponding bit is

37
4ed.cpp
View File

@ -20,7 +20,6 @@ typedef enum App_State{
typedef struct App_State_Resizing{
Panel_Divider *divider;
f32 min, max;
} App_State_Resizing;
typedef struct CLI_Process{
@ -2608,9 +2607,6 @@ App_Step_Sig(app_step){
end_temp_memory(temp);
}
vars->resizing.min = 0.f;
vars->resizing.max = 1.f;
}
}break;
@ -2618,20 +2614,29 @@ App_Step_Sig(app_step){
{
if (input->mouse.l){
Panel_Divider *divider = vars->resizing.divider;
i32 pos = 0;
if (divider->v_divider){
pos = clamp(0, mx, models->layout.full_width);
}
else{
pos = clamp(0, my, models->layout.full_height);
}
divider->pos = layout_compute_position(&models->layout, divider, pos);
i32 mouse_position = 0;
if (divider->pos < vars->resizing.min){
divider->pos = vars->resizing.min;
b32 do_absolute_positions = 0;
if (do_absolute_positions){
i32 absolute_positions[MAX_VIEWS];
i32 min = 0, max = 0;
i32 div_id = (i32)(divider - models->layout.dividers);
layout_compute_absolute_positions(&models->layout, absolute_positions);
mouse_position = (divider->v_divider)?(mx):(my);
layout_get_min_max(&models->layout, divider, absolute_positions, &min, &max);
absolute_positions[div_id] = clamp(min, mouse_position, max);
layout_update_all_positions(&models->layout, absolute_positions);
}
else if (divider->pos > vars->resizing.max){
divider->pos = vars->resizing.max - 1;
else{
if (divider->v_divider){
mouse_position = clamp(0, mx, models->layout.full_width);
}
else{
mouse_position = clamp(0, my, models->layout.full_height);
}
divider->pos = layout_compute_position(&models->layout, divider, );
}
layout_fix_all_panels(&models->layout);

5
4ed.h
View File

@ -34,11 +34,6 @@ struct Key_Input_Data{
char modifiers[MDFR_INDEX_COUNT];
};
inline Key_Input_Data
key_input_data_zero(){
Key_Input_Data data={0};
return(data);
}
struct Key_Summary{
i32 count;

View File

@ -87,11 +87,11 @@ TMin(u32);
TMin(u64);
#undef TMin
#define TMin(t,v) globalconst t min_##t = ((t)v)
TMin(i8, -0xF0);
TMin(i16, -0xF000);
TMin(i32, -0xF00000);
TMin(i64, -0xF0000000LL);
#define TMin(t,v) globalconst t min_##t = ((t)(v))
TMin(i8, -127-1);
TMin(i16, -32767-1);
TMin(i32, -2147483647-1);
TMin(i64, -9223372036854775807-1);
#undef TMin
internal i32

View File

@ -754,10 +754,10 @@ struct Hot_Directory_Match{
};
internal b32
filename_match(String query, Absolutes *absolutes, String filename, b32 case_sensitive){
filename_match(String query, Absolutes *absolutes, String filename){
b32 result;
result = (query.size == 0);
if (!result) result = wildcard_match_s(absolutes, filename, case_sensitive);
if (!result) result = wildcard_match_s(absolutes, filename, 0);
return result;
}

View File

@ -3211,7 +3211,7 @@ get_exhaustive_info(System_Functions *system, Working_Set *working_set, Exhausti
result.info->filename_len, result.info->filename_len+1);
result.is_folder = (result.info->folder != 0);
result.name_match = (filename_match(loop->front_name, &loop->absolutes, filename, 0) != 0);
result.name_match = (filename_match(loop->front_name, &loop->absolutes, filename) != 0);
result.is_loaded = (file != 0 && file_is_ready(file));
result.message = null_string;
@ -4024,7 +4024,7 @@ step_file_view(System_Functions *system, View *view, View *active_view, Input_Su
Editing_File *file = (Editing_File*)node;
Assert(!file->is_dummy);
if (filename_match(view->dest, &absolutes, file->name.live_name, 1)){
if (filename_match(view->dest, &absolutes, file->name.live_name)){
View_Iter iter = file_view_iter_init(layout, file, 0);
if (file_view_iter_good(iter)){
reserved_files[reserved_top++] = file;

View File

@ -210,7 +210,7 @@ panel_fix_internal_area(Panel *panel){
internal i32_Rect
layout_get_rect(Editing_Layout *layout, i32 id, i32 which_child){
i32 divider_chain[16];
i32 divider_chain[MAX_VIEWS];
i32 chain_count = 0;
Panel_Divider *dividers = layout->dividers;
@ -232,26 +232,18 @@ layout_get_rect(Editing_Layout *layout, i32 id, i32 which_child){
Panel_Divider *div = dividers + divider_chain[i];
if (div->v_divider){
if (div->child1 == divider_chain[i-1]){
r.x1 = ROUND32(lerp((f32)r.x0,
div->pos,
(f32)r.x1));
r.x1 = ROUND32(lerp((f32)r.x0, div->pos, (f32)r.x1));
}
else{
r.x0 = ROUND32(lerp((f32)r.x0,
div->pos,
(f32)r.x1));
r.x0 = ROUND32(lerp((f32)r.x0, div->pos, (f32)r.x1));
}
}
else{
if (div->child1 == divider_chain[i-1]){
r.y1 = ROUND32(lerp((f32)r.y0,
div->pos,
(f32)r.y1));
r.y1 = ROUND32(lerp((f32)r.y0, div->pos, (f32)r.y1));
}
else{
r.y0 = ROUND32(lerp((f32)r.y0,
div->pos,
(f32)r.y1));
r.y0 = ROUND32(lerp((f32)r.y0, div->pos, (f32)r.y1));
}
}
}
@ -260,28 +252,20 @@ layout_get_rect(Editing_Layout *layout, i32 id, i32 which_child){
case 1:
{
if (original_div->v_divider){
r.x0 = ROUND32(lerp((f32)r.x0,
original_div->pos,
(f32)r.x1));
r.x0 = ROUND32(lerp((f32)r.x0, original_div->pos, (f32)r.x1));
}
else{
r.y0 = ROUND32(lerp((f32)r.y0,
original_div->pos,
(f32)r.y1));
r.y0 = ROUND32(lerp((f32)r.y0, original_div->pos, (f32)r.y1));
}
}break;
case -1:
{
if (original_div->v_divider){
r.x1 = ROUND32(lerp((f32)r.x0,
original_div->pos,
(f32)r.x1));
r.x1 = ROUND32(lerp((f32)r.x0, original_div->pos, (f32)r.x1));
}
else{
r.y1 = ROUND32(lerp((f32)r.y0,
original_div->pos,
(f32)r.y1));
r.y1 = ROUND32(lerp((f32)r.y0, original_div->pos, (f32)r.y1));
}
}break;
}
@ -384,5 +368,117 @@ layout_compute_position(Editing_Layout *layout, Panel_Divider *divider, i32 pos)
return(l);
}
internal void
layout_compute_abs_step(Editing_Layout *layout, i32 divider_id, i32_Rect rect, i32 *abs_pos){
Panel_Divider *div = layout->dividers + divider_id;
i32 p0 = 0, p1 = 0;
if (div->v_divider){
p0 = rect.x0; p1 = rect.x1;
}
else{
p0 = rect.y0; p1 = rect.y1;
}
i32 pos = lerp(p0, div->pos, p1);
i32_Rect r1, r2;
r1 = rect; r2 = rect;
abs_pos[divider_id] = pos;
if (div->v_divider){
r1.x1 = pos; r2.x0 = pos;
}
else{
r1.y1 = pos; r2.y0 = pos;
}
if (div->child1 != -1){
layout_compute_abs_step(layout, div->child1, r1, abs_pos);
}
if (div->child2 != -1){
layout_compute_abs_step(layout, div->child2, r2, abs_pos);
}
}
internal void
layout_compute_absolute_positions(Editing_Layout *layout, i32 *abs_pos){
i32_Rect r;
r.x0 = 0;
r.y0 = 0;
r.x1 = layout->full_width;
r.y1 = layout->full_height;
if (layout->panel_count > 1){
layout_compute_abs_step(layout, layout->root, r, abs_pos);
}
}
internal void
layout_get_min_max_step_up(Editing_Layout *layout, b32 v, i32 divider_id, i32 which_child,
i32 *abs_pos, i32 *min_out, i32 *max_out){
Panel_Divider *divider = layout->dividers + divider_id;
if (divider->v_divider == v){
if (which_child == -1){
if (*max_out > abs_pos[divider_id]){
*max_out = abs_pos[divider_id];
}
}
else{
if (*min_out < abs_pos[divider_id]){
*min_out = abs_pos[divider_id];
}
}
}
if (divider->parent != -1){
layout_get_min_max_step_up(layout, v, divider->parent, divider->which_child,
abs_pos, min_out, max_out);
}
}
internal void
layout_get_min_max_step_down(Editing_Layout *layout, b32 v, i32 divider_id, i32 which_child,
i32 *abs_pos, i32 *min_out, i32 *max_out){
}
internal void
layout_get_min_max(Editing_Layout *layout, Panel_Divider *divider, i32 *abs_pos, i32 *min_out, i32 *max_out){
*min_out = 0;
*max_out = max_i32;
if (layout->panel_count > 1){
if (divider->parent != -1){
layout_get_min_max_step_up(layout, divider->v_divider, divider->parent, divider->which_child,
abs_pos, min_out, max_out);
}
if (divider->child1 != -1){
layout_get_min_max_step_down(layout, divider->v_divider, divider->child1, -1,
abs_pos, min_out, max_out);
}
if (divider->child2 != -1){
layout_get_min_max_step_down(layout, divider->v_divider, divider->child1, 1,
abs_pos, min_out, max_out);
}
}
else{
if (divider->v_divider){
*max_out = layout->full_width;
}
else{
*max_out = layout->full_height;
}
}
}
internal void
layout_update_all_positions(Editing_Layout *layout, i32 *abs_pos){
}
// BOTTOM

View File

@ -86,6 +86,7 @@
; BEFORE I SHIP
;
; [X] case insensitive interactive switch buffer
; [X] tokens in the custom API
; [X] token seeking on custom side
; [X] auto indent on the custom side
@ -97,7 +98,6 @@
; [] make panel resizing not whacky with child panels
; [] mouse down/up distinction
; [] occasionally missing the (!) mark on files on windows
; [] case insensitive interactive switch buffer
; [] scroll down on compilation buffer durring compilation
; [] why are command line files not loading any more?
;
@ -139,7 +139,10 @@
; [X] add to APIs
; [X] try to make win32 version better
; [X] don't execute frames on events dealing only with ctrl/alt/shift
; [X] hook on exit
; [X] additional hooks
; [X] new file
; [X] hook on exit
; [X] file out of sync
;
; [] binary buffers
@ -159,22 +162,25 @@
; [] break buffer name ties by adding parent directories instead of <#>
; [] undo groups
; [] cursor/scroll grouping
; [] file status in custom API
; [] allow for arbitrary wrap positions independent of view width
; [] word level wrapping ~ temporary measure really want to have totally formatted code
; [] additional hooks
; [X] new file
; [] file out of sync
; [] word level wrapping ~ temporary measure really want to have totally formatted code presentation
; [] double binding warnings
;
;
; [] the "main_4coder" experiment
; [] multi-line editing
; [] multi-cursor editing
;
; meta programming system
; [X] condense system into single meta compiler
; [] formalize the rewriter for the 4coder_string.h so it can be used for other single header libs
; [] formalize the documentation writer so the TOC can be better and so it's easier to shoot off other docs
; [] profile and optimize the current metagen system
; [] expand the use of 4coder_types.h to also allow static variable and function declarations
; [] get more of the helper functions going through the documentation system
;
; GUI related tech
; [X] consolidate all GUI code properly
; [X] rewrite GUI
@ -182,6 +188,7 @@
; [] scroll bar position and size options
; [] GUI API
;
; search related tech
; [X] replace word (incremental and/or in range)
; [X] caps insensitivety
@ -190,11 +197,13 @@
; [] optimize search
; [] smarter isearch behavior
;
; theme related business
; [] fix the versioning system for themes
; [] theme switch per panel?
; [] allow multiple font faces with effects
;
; control schemes
; [] emacs style sub-maps
; [] vim style modes
@ -203,6 +212,7 @@
; [] command meta data
; [] macros
;
; code engine
; [X] lexer with multiple chunk input
; [X] more correct auto-indentation
@ -210,6 +220,15 @@
; [] preprocessor
; [] AST generator
;
; "virtual text"
; [] line numbers
; [] macro expansion
; [] error text at line
; [] word complete ghosting
; [] fancy code presentation mode
;
; [X] cuber's return to previous buffer idea
; [] miblo's various number editors
;
@ -221,14 +240,6 @@
; [] explicit panel layout
; [] polish for hot directories
;
; "virtual text"
; [] line numbers
; [] macro expansion
; [] error text at line
; [] word complete ghosting
;
; [] the "main_4coder" experiment
;
; [] tutorials
; [] 4edT thing
; [] unicode/UTF support

View File

@ -680,9 +680,9 @@ metagen(char *cdir){
static void
do_buildsuper(char *cdir){
BEGIN_TIME_SECTION();
buildsuper(cdir, BUILD_DIR, "../code/4coder_default_bindings.cpp");
//buildsuper(cdir, BUILD_DIR, "../code/4coder_default_bindings.cpp");
#if defined(IS_WINDOWS)
//buildsuper(cdir, BUILD_DIR, "../code/internal_4coder_tests.cpp");
buildsuper(cdir, BUILD_DIR, "../code/internal_4coder_tests.cpp");
#else
buildsuper(cdir, BUILD_DIR, "../code/power/4coder_experiments.cpp");
#endif