View split transition API fixups
parent
e6edfebdba
commit
0bc8ee17f9
|
@ -245,12 +245,11 @@ system file still agrees with the buffer's state.) */
|
|||
the last sync point.) */
|
||||
DirtyState_UnsavedChanges = 1,
|
||||
|
||||
/* DOC(DirtyState_UnsavedChanges indicates that the underlying file has been edited since
|
||||
/* DOC(DirtyStateUnloadedChanges indicates that the underlying file has been edited since
|
||||
the last sync point .) */
|
||||
DirtyState_UnloadedChanges = 2,
|
||||
|
||||
/* DOC(DirtyState_UnsavedChanges indicates that there have been changes in the buffer since
|
||||
the last sync point and that the underlying file ahs been edited since the last sync point.) */
|
||||
/* DOC(TODO) */
|
||||
DirtyState_UnsavedChangesAndUnloadedChanges = 3,
|
||||
};
|
||||
|
||||
|
@ -347,13 +346,13 @@ ENUM(int32_t, Panel_Split_Kind){
|
|||
};
|
||||
|
||||
ENUM(int32_t, Panel_Split_Orientation){
|
||||
PanelSplit_LeftAndRight,
|
||||
PanelSplit_TopAndBottom,
|
||||
PanelSplit_LeftAndRight = 0,
|
||||
PanelSplit_TopAndBottom = 1,
|
||||
};
|
||||
|
||||
ENUM(int32_t, Panel_Child){
|
||||
PanelChild_Min,
|
||||
PanelChild_Max,
|
||||
PanelChild_Min = 0,
|
||||
PanelChild_Max = 1,
|
||||
};
|
||||
|
||||
/* DOC(Key_Code is the alias for key codes including raw codes and codes translated to textual input that takes modifiers into account.) */
|
||||
|
|
|
@ -311,13 +311,15 @@ open_view(Application_Links *app, View_Summary *view_location, View_Split_Positi
|
|||
if (view_location != 0 && view_location->exists){
|
||||
Panel_ID panel_id = 0;
|
||||
if (view_get_panel(app, view_location->view_id, &panel_id)){
|
||||
bool32 vertical = (position == ViewSplit_Left || position == ViewSplit_Right);
|
||||
b32 vertical = (position == ViewSplit_Left || position == ViewSplit_Right);
|
||||
if (panel_split(app, panel_id, vertical?PanelSplit_LeftAndRight:PanelSplit_TopAndBottom)){
|
||||
Panel_ID left_panel_id = 0;
|
||||
if (panel_get_child(app, panel_id, PanelChild_Min, &left_panel_id)){
|
||||
Panel_ID new_panel_id = 0;
|
||||
Panel_Child child = (position == ViewSplit_Left || position == ViewSplit_Top)?PanelChild_Min:PanelChild_Max;
|
||||
if (panel_get_child(app, panel_id, child, &new_panel_id)){
|
||||
View_ID new_view_id = 0;
|
||||
if (panel_get_view(app, left_panel_id, &new_view_id)){
|
||||
get_view_summary(app, new_view_id, AccessAll, view_location);
|
||||
if (panel_get_view(app, new_panel_id, &new_view_id)){
|
||||
get_view_summary(app, new_view_id, AccessAll, &view);
|
||||
get_view_summary(app, view_location->view_id, AccessAll, view_location);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -377,14 +379,28 @@ enum{
|
|||
ViewSplitKind_FixedPixels,
|
||||
};
|
||||
|
||||
static bool32
|
||||
static b32
|
||||
view_set_split(Application_Links *app, View_Summary *view, View_Split_Kind kind, float t){
|
||||
bool32 result = false;
|
||||
b32 result = false;
|
||||
if (view != 0 && view->exists){
|
||||
Panel_ID panel_id = 0;
|
||||
if (view_get_panel(app, view->view_id, &panel_id)){
|
||||
result = panel_set_split(app, panel_id, kind, t);
|
||||
get_view_summary(app, view->view_id, AccessAll, view);
|
||||
Panel_ID parent_panel_id = 0;
|
||||
if (panel_get_parent(app, panel_id, &parent_panel_id)){
|
||||
Panel_ID min_child_id = 0;
|
||||
if (panel_get_child(app, parent_panel_id, PanelChild_Min, &min_child_id)){
|
||||
b32 panel_is_min = (min_child_id == panel_id);
|
||||
Panel_Split_Kind panel_kind = 0;
|
||||
if (kind == ViewSplitKind_Ratio){
|
||||
panel_kind = panel_is_min?PanelSplitKind_Ratio_Min:PanelSplitKind_Ratio_Max;
|
||||
}
|
||||
else{
|
||||
panel_kind = panel_is_min?PanelSplitKind_FixedPixels_Min:PanelSplitKind_FixedPixels_Max;
|
||||
}
|
||||
result = panel_set_split(app, parent_panel_id, panel_kind, t);
|
||||
get_view_summary(app, view->view_id, AccessAll, view);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return(result);
|
||||
|
|
|
@ -77,7 +77,7 @@ static View_Summary
|
|||
open_footer_panel(Application_Links *app, View_Summary *view){
|
||||
View_Summary special_view = open_view(app, view, ViewSplit_Bottom);
|
||||
new_view_settings(app, &special_view);
|
||||
view_set_split_pixel_size(app, &special_view, (int32_t)(special_view.line_height*30.f));
|
||||
view_set_split_pixel_size(app, &special_view, (int32_t)(special_view.line_height*20.f));
|
||||
view_set_passive(app, &special_view, true);
|
||||
return(special_view);
|
||||
}
|
||||
|
@ -309,7 +309,7 @@ CUSTOM_DOC("Switch to a named key binding map.")
|
|||
|
||||
static void
|
||||
default_4coder_initialize(Application_Links *app, i32 override_font_size, b32 override_hinting){
|
||||
i32 part_size = (16 << 10);
|
||||
i32 part_size = (32 << 20);
|
||||
void *part_mem = memory_allocate(app, part_size);
|
||||
global_part = make_part(part_mem, part_size);
|
||||
|
||||
|
|
|
@ -303,7 +303,7 @@ default_buffer_render_caller(Application_Links *app, View_ID view_id, Range on_s
|
|||
Highlight_Record *record = push_array(scratch, Highlight_Record, 1);
|
||||
record->first = i + on_screen_range.first;
|
||||
record->one_past_last = record->first + 4;
|
||||
record->color = Stag_COUNT + 1;
|
||||
record->color = Stag_Text_Cycle_2;
|
||||
tail.str += 3;
|
||||
tail.size -= 3;
|
||||
i += 3;
|
||||
|
@ -312,7 +312,7 @@ default_buffer_render_caller(Application_Links *app, View_ID view_id, Range on_s
|
|||
Highlight_Record *record = push_array(scratch, Highlight_Record, 1);
|
||||
record->first = i + on_screen_range.first;
|
||||
record->one_past_last = record->first + 4;
|
||||
record->color = Stag_COUNT + 10;
|
||||
record->color = Stag_Text_Cycle_1;
|
||||
tail.str += 3;
|
||||
tail.size -= 3;
|
||||
i += 3;
|
||||
|
@ -640,7 +640,7 @@ HOOK_SIG(default_exit){
|
|||
for (Buffer_Summary buffer = get_buffer_first(app, AccessAll);
|
||||
buffer.exists;
|
||||
get_buffer_next(app, &buffer, AccessAll)){
|
||||
if (buffer.dirty & DirtyState_UnsavedChanges){
|
||||
if (HasFlag(buffer.dirty, DirtyState_UnsavedChanges)){
|
||||
has_unsaved_changes = true;
|
||||
break;
|
||||
}
|
||||
|
@ -655,7 +655,6 @@ HOOK_SIG(default_exit){
|
|||
return(1);
|
||||
}
|
||||
|
||||
// TODO(allen): call this hook when a view's buffer is set.
|
||||
// TODO(allen): how to deal with multiple sizes on a single view
|
||||
// TODO(allen): expected character advance.
|
||||
HOOK_SIG(default_view_adjust){
|
||||
|
@ -680,32 +679,6 @@ HOOK_SIG(default_view_adjust){
|
|||
return(0);
|
||||
}
|
||||
|
||||
#if 0
|
||||
{
|
||||
int32_t count = 0;
|
||||
int32_t new_wrap_width = 0;
|
||||
for (View_Summary view = get_view_first(app, AccessAll);
|
||||
view.exists;
|
||||
get_view_next(app, &view, AccessAll)){
|
||||
new_wrap_width += view.view_region.x1 - view.view_region.x0;
|
||||
++count;
|
||||
}
|
||||
|
||||
new_wrap_width /= count;
|
||||
new_wrap_width = (int32_t)(new_wrap_width * .9f);
|
||||
|
||||
int32_t new_min_base_width = (int32_t)(new_wrap_width * .77f);
|
||||
if (global_config.automatically_adjust_wrapping){
|
||||
adjust_all_buffer_wrap_widths(app, new_wrap_width, new_min_base_width);
|
||||
global_config.default_wrap_width = new_wrap_width;
|
||||
global_config.default_min_base_width = new_min_base_width;
|
||||
}
|
||||
|
||||
// no meaning for return
|
||||
return(0);
|
||||
}
|
||||
#endif
|
||||
|
||||
BUFFER_NAME_RESOLVER_SIG(default_buffer_name_resolution){
|
||||
if (conflict_count > 1){
|
||||
// List of unresolved conflicts
|
||||
|
|
|
@ -66,7 +66,7 @@ file_get_access_flags(Editing_File *file){
|
|||
internal b32
|
||||
file_needs_save(Editing_File *file){
|
||||
b32 result = false;
|
||||
if (file->state.dirty == DirtyState_UnsavedChanges){
|
||||
if (HasFlag(file->state.dirty, DirtyState_UnsavedChanges)){
|
||||
result = true;
|
||||
}
|
||||
return(result);
|
||||
|
|
Loading…
Reference in New Issue