This commit is contained in:
Allen Webster 2016-09-16 21:54:28 -04:00
commit 21bbf919cd
3 changed files with 88 additions and 82 deletions

View File

@ -48,8 +48,7 @@ If the View_Summary returned is a null summary, the loop is finished.
Views should not be closed or opened durring a view loop.<br><br></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='#Access_Flag_doc'>Access_Flag</a></div><div style='margin-left: 5mm; margin-right: 5mm;'><a href='#get_view_next_doc'>get_view_next</a></div></div><hr><div id='get_view_next_doc' style='margin-bottom: 1cm;'><h4>&sect;3.3.23: get_view_next</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_view_next(<div style='margin-left: 4mm;'>Application_Links *app,<br>View_Summary *view,<br>Access_Flag access<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;'>view</div><div style='margin-bottom: 6mm;'><div style='margin-left: 5mm; margin-right: 5mm;'>The View_Summary pointed to by view is iterated to the next view or to a null summary if this is the last view.</div></div></div><div><div style='font-weight: 600;'>access</div><div style='margin-bottom: 6mm;'><div style='margin-left: 5mm; margin-right: 5mm;'>The access parameter determines what levels of protection this call can access. The view outputted will be the next view that is accessible.</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 steps a View_Summary to the next view in the global view order.<br><br>
If the view outputted does not exist, the loop is finished.
Views should not be closed or opened durring a view loop.<br><br></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='#Access_Flag_doc'>Access_Flag</a></div><div style='margin-left: 5mm; margin-right: 5mm;'><a href='#get_view_first_doc'>get_view_first</a></div></div><hr><div id='get_view_doc' style='margin-bottom: 1cm;'><h4>&sect;3.3.24: get_view</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;'>View_Summary app->get_view(<div style='margin-left: 4mm;'>Application_Links *app,<br>View_ID view_id,<br>Access_Flag access<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;'>view_id</div><div style='margin-bottom: 6mm;'><div style='margin-left: 5mm; margin-right: 5mm;'>The view_id specifies the view to try to get.</div></div></div><div><div style='font-weight: 600;'>access</div><div style='margin-bottom: 6mm;'><div style='margin-left: 5mm; margin-right: 5mm;'>The access parameter determines what levels of protection this call can access.</div></div></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 a summary that describes the indicated view if it is open and accessible.</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='#Access_Flag_doc'>Access_Flag</a></div></div><hr><div id='get_active_view_doc' style='margin-bottom: 1cm;'><h4>&sect;3.3.25: get_active_view</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;'>View_Summary app->get_active_view(<div style='margin-left: 4mm;'>Application_Links *app,<br>Access_Flag access<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;'>access</div><div style='margin-bottom: 6mm;'><div style='margin-left: 5mm; margin-right: 5mm;'>The access parameter determines what levels of protection this call can access.</div></div></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 a summary that describes the active view.</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='#set_active_view_doc'>set_active_view</a></div><div style='margin-left: 5mm; margin-right: 5mm;'><a href='#Access_Flag_doc'>Access_Flag</a></div></div><hr><div id='open_view_doc' style='margin-bottom: 1cm;'><h4>&sect;3.3.26: open_view</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;'>View_Summary app->open_view(<div style='margin-left: 4mm;'>Application_Links *app,<br>View_Summary *view_location,<br>View_Split_Position position<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;'>view_location</div><div style='margin-bottom: 6mm;'><div style='margin-left: 5mm; margin-right: 5mm;'>The view_location parameter specifies the view to split to open the new view.</div></div></div><div><div style='font-weight: 600;'>position</div><div style='margin-bottom: 6mm;'><div style='margin-left: 5mm; margin-right: 5mm;'>The position parameter specifies how to split the view and where to place the new view.</div></div></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;'>If this call succeeds it returns a View_Summary describing the newly created view, if it fails it
returns a null summary.</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;'>4coder is built with a limit of 16 views. If 16 views are already open when this is called the
call will fail.<br><br></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='#View_Split_Position_doc'>View_Split_Position</a></div></div><hr><div id='close_view_doc' style='margin-bottom: 1cm;'><h4>&sect;3.3.27: close_view</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->close_view(<div style='margin-left: 4mm;'>Application_Links *app,<br>View_Summary *view<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;'>view</div><div style='margin-bottom: 6mm;'><div style='margin-left: 5mm; margin-right: 5mm;'>The view parameter specifies which view to close.</div></div></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 style='margin-top: 3mm; margin-bottom: 3mm; color: #309030;'><b><i>Description</i></b></div><div style='margin-left: 5mm; margin-right: 5mm;'>If the given view is open and is not the last view, it will be closed.
returns a null summary.</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;'>4coder is built with a limit of 16 views. If 16 views are already open when this is called the call will fail.<br><br></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='#View_Split_Position_doc'>View_Split_Position</a></div></div><hr><div id='close_view_doc' style='margin-bottom: 1cm;'><h4>&sect;3.3.27: close_view</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->close_view(<div style='margin-left: 4mm;'>Application_Links *app,<br>View_Summary *view<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;'>view</div><div style='margin-bottom: 6mm;'><div style='margin-left: 5mm; margin-right: 5mm;'>The view parameter specifies which view to close.</div></div></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 style='margin-top: 3mm; margin-bottom: 3mm; color: #309030;'><b><i>Description</i></b></div><div style='margin-left: 5mm; margin-right: 5mm;'>If the given view is open and is not the last view, it will be closed.
If the given view is the active view, the next active view in the global
order of view will be made active. If the given view is the last open view
in the system, the call will fail.<br><br></div></div><hr><div id='set_active_view_doc' style='margin-bottom: 1cm;'><h4>&sect;3.3.28: set_active_view</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->set_active_view(<div style='margin-left: 4mm;'>Application_Links *app,<br>View_Summary *view<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;'>view</div><div style='margin-bottom: 6mm;'><div style='margin-left: 5mm; margin-right: 5mm;'>The view parameter specifies which view to make active.</div></div></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 style='margin-top: 3mm; margin-bottom: 3mm; color: #309030;'><b><i>Description</i></b></div><div style='margin-left: 5mm; margin-right: 5mm;'>If the given view is open, it is set as the

View File

@ -1171,8 +1171,13 @@ DOC_SEE(set_active_view)
DOC_SEE(Access_Flag)
*/{
Command_Data *cmd = (Command_Data*)app->cmd_context;
Panel *panel = cmd->models->layout.panels + cmd->models->layout.active_panel;
Assert(panel->view != 0);
View_Summary view = {0};
fill_view_summary(&view, cmd->view, &cmd->vars->live_set, &cmd->models->working_set);
fill_view_summary(&view, panel->view, &cmd->vars->live_set, &cmd->models->working_set);
if (!access_test(view.lock_flags, access)){
view = null_view_summary;
}
@ -1185,8 +1190,7 @@ DOC_PARAM(view_location, The view_location parameter specifies the view to split
DOC_PARAM(position, The position parameter specifies how to split the view and where to place the new view.)
DOC_RETURN(If this call succeeds it returns a View_Summary describing the newly created view, if it fails it
returns a null summary.)
DOC(4coder is built with a limit of 16 views. If 16 views are already open when this is called the
call will fail.)
DOC(4coder is built with a limit of 16 views. If 16 views are already open when this is called the call will fail.)
DOC_SEE(View_Split_Position)
*/{
Command_Data *cmd = (Command_Data*)app->cmd_context;
@ -1260,83 +1264,87 @@ in the system, the call will fail.)
System_Functions *system = cmd->system;
Models *models = cmd->models;
View *vptr = imp_get_view(cmd, view);
Panel *panel = vptr->panel;
bool32 result = false;
Divider_And_ID div, parent_div, child_div;
i32 child;
i32 parent;
i32 which_child;
i32 active;
bool32 result = 0;
if (models->layout.panel_count > 1){
live_set_free_view(system, models->live_set, vptr);
panel->view = 0;
if (vptr){
if (models->layout.panel_count > 1){
Panel *panel = vptr->panel;
div = layout_get_divider(&models->layout, panel->parent);
Divider_And_ID div, parent_div, child_div;
i32 child;
i32 parent;
i32 which_child;
i32 active;
// This divider cannot have two child dividers.
Assert(div.divider->child1 == -1 || div.divider->child2 == -1);
live_set_free_view(system, models->live_set, vptr);
panel->view = 0;
// Get the child who needs to fill in this node's spot
child = div.divider->child1;
if (child == -1) child = div.divider->child2;
div = layout_get_divider(&models->layout, panel->parent);
parent = div.divider->parent;
which_child = div.divider->which_child;
// This divider cannot have two child dividers.
Assert(div.divider->child1 == -1 || div.divider->child2 == -1);
// Fill the child in the slot this node use to hold
if (parent == -1){
Assert(models->layout.root == div.id);
models->layout.root = child;
}
else{
parent_div = layout_get_divider(&models->layout, parent);
if (which_child == -1){
parent_div.divider->child1 = child;
// Get the child who needs to fill in this node's spot
child = div.divider->child1;
if (child == -1) child = div.divider->child2;
parent = div.divider->parent;
which_child = div.divider->which_child;
// Fill the child in the slot this node use to hold
if (parent == -1){
Assert(models->layout.root == div.id);
models->layout.root = child;
}
else{
parent_div.divider->child2 = child;
}
}
// If there was a child divider, give it information about it's new parent.
if (child != -1){
child_div = layout_get_divider(&models->layout, child);
child_div.divider->parent = parent;
child_div.divider->which_child = div.divider->which_child;
}
// What is the new active panel?
active = -1;
if (child == -1){
Panel *panel_ptr = 0;
Panel *used_panels = &models->layout.used_sentinel;
for (dll_items(panel_ptr, used_panels)){
if (panel_ptr != panel && panel_ptr->parent == div.id){
panel_ptr->parent = parent;
panel_ptr->which_child = which_child;
active = (i32)(panel_ptr - models->layout.panels);
break;
parent_div = layout_get_divider(&models->layout, parent);
if (which_child == -1){
parent_div.divider->child1 = child;
}
else{
parent_div.divider->child2 = child;
}
}
}
else{
Panel *panel_ptr = panel->next;
if (panel_ptr == &models->layout.used_sentinel) panel_ptr = panel_ptr->next;
Assert(panel_ptr != panel);
active = (i32)(panel_ptr - models->layout.panels);
}
Assert(active != -1 && panel != models->layout.panels + active);
// If the panel we're closing was previously active, we have to switch to it's sibling.
if (models->layout.active_panel == (i32)(panel - models->layout.panels)){
models->layout.active_panel = active;
}
// If there was a child divider, give it information about it's new parent.
if (child != -1){
child_div = layout_get_divider(&models->layout, child);
child_div.divider->parent = parent;
child_div.divider->which_child = div.divider->which_child;
}
layout_free_divider(&models->layout, div.divider);
layout_free_panel(&models->layout, panel);
layout_fix_all_panels(&models->layout);
// What is the new active panel?
active = -1;
if (child == -1){
Panel *panel_ptr = 0;
Panel *used_panels = &models->layout.used_sentinel;
for (dll_items(panel_ptr, used_panels)){
if (panel_ptr != panel && panel_ptr->parent == div.id){
panel_ptr->parent = parent;
panel_ptr->which_child = which_child;
active = (i32)(panel_ptr - models->layout.panels);
break;
}
}
}
else{
Panel *panel_ptr = panel->next;
if (panel_ptr == &models->layout.used_sentinel) panel_ptr = panel_ptr->next;
Assert(panel_ptr != panel);
active = (i32)(panel_ptr - models->layout.panels);
}
Assert(active != -1 && panel != models->layout.panels + active);
// If the panel we're closing was previously active, we have to switch to it's sibling.
if (models->layout.active_panel == (i32)(panel - models->layout.panels)){
models->layout.active_panel = active;
}
layout_free_divider(&models->layout, div.divider);
layout_free_panel(&models->layout, panel);
layout_fix_all_panels(&models->layout);
}
}
return(result);
@ -1346,12 +1354,11 @@ API_EXPORT bool32
Set_Active_View(Application_Links *app, View_Summary *view)/*
DOC_PARAM(view, The view parameter specifies which view to make active.)
DOC_RETURN(This call returns non-zero on success.)
DOC
(
If the given view is open, it is set as the
DOC(If the given view is open, it is set as the
active view, and takes subsequent commands and is returned
from get_active_view.
)
from get_active_view.)
DOC_SEE(get_active_view)
*/{
Command_Data *cmd = (Command_Data*)app->cmd_context;

View File

@ -682,9 +682,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