removed kill from the dact system
This commit is contained in:
parent
bc15f0ed3c
commit
37e0b17e7c
30
4ed.cpp
30
4ed.cpp
|
@ -907,8 +907,7 @@ COMMAND_DECL(save){
|
||||||
if (file){
|
if (file){
|
||||||
if (name.str){
|
if (name.str){
|
||||||
if (!file->state.is_dummy && file_is_ready(file)){
|
if (!file->state.is_dummy && file_is_ready(file)){
|
||||||
view_save_file(system, &models->mem, &models->working_set,
|
view_save_file(system, models, file, 0, name, 1);
|
||||||
file, 0, name, 1);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
|
@ -929,13 +928,11 @@ COMMAND_DECL(save){
|
||||||
if (name.size != 0){
|
if (name.size != 0){
|
||||||
if (file){
|
if (file){
|
||||||
if (!file->state.is_dummy && file_is_ready(file)){
|
if (!file->state.is_dummy && file_is_ready(file)){
|
||||||
view_save_file(system, &models->mem, &models->working_set,
|
view_save_file(system, models, file, 0, name, 0);
|
||||||
file, 0, name, 0);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
view_save_file(system, &models->mem, &models->working_set,
|
view_save_file(system, models, 0, 0, name, 0);
|
||||||
0, 0, name, 0);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -992,7 +989,7 @@ COMMAND_DECL(kill_buffer){
|
||||||
if (buffer_id != 0){
|
if (buffer_id != 0){
|
||||||
file = working_set_get_active_file(&models->working_set, buffer_id);
|
file = working_set_get_active_file(&models->working_set, buffer_id);
|
||||||
if (file){
|
if (file){
|
||||||
delayed_kill(delay, file);
|
kill_file(system, models, file, string_zero());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (file){
|
else if (file){
|
||||||
|
@ -4382,20 +4379,12 @@ App_Step_Sig(app_step){
|
||||||
}
|
}
|
||||||
}break;
|
}break;
|
||||||
|
|
||||||
|
#if 0
|
||||||
case DACT_KILL:
|
case DACT_KILL:
|
||||||
{
|
{
|
||||||
if (!file && string.str){
|
|
||||||
file = working_set_lookup_file(working_set, string);
|
|
||||||
if (!file){
|
|
||||||
file = working_set_contains(system, working_set, string);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (file && !file->settings.never_kill){
|
|
||||||
working_set_remove(system, working_set, file->name.source_path);
|
|
||||||
kill_file(system, exchange, models, file);
|
|
||||||
}
|
|
||||||
}break;
|
}break;
|
||||||
|
#endif
|
||||||
|
|
||||||
case DACT_TRY_KILL:
|
case DACT_TRY_KILL:
|
||||||
{
|
{
|
||||||
|
@ -4416,13 +4405,14 @@ App_Step_Sig(app_step){
|
||||||
|
|
||||||
if (file && !file->settings.never_kill){
|
if (file && !file->settings.never_kill){
|
||||||
if (buffer_needs_save(file)){
|
if (buffer_needs_save(file)){
|
||||||
copy(&view->dest, file->name.live_name);
|
|
||||||
view_show_interactive(system, view, &models->map_ui,
|
view_show_interactive(system, view, &models->map_ui,
|
||||||
IAct_Sure_To_Kill, IInt_Sure_To_Kill, make_lit_string("Are you sure?"));
|
IAct_Sure_To_Kill, IInt_Sure_To_Kill,
|
||||||
|
make_lit_string("Are you sure?"));
|
||||||
|
copy(&view->dest, file->name.live_name);
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
working_set_remove(system, working_set, file->name.source_path);
|
working_set_remove(system, working_set, file->name.source_path);
|
||||||
kill_file(system, exchange, models, file);
|
kill_file(system, models, file, string_zero());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}break;
|
}break;
|
||||||
|
|
|
@ -2,7 +2,6 @@ enum Action_Type{
|
||||||
DACT_SET_LINE,
|
DACT_SET_LINE,
|
||||||
DACT_SWITCH,
|
DACT_SWITCH,
|
||||||
DACT_TRY_KILL,
|
DACT_TRY_KILL,
|
||||||
DACT_KILL,
|
|
||||||
DACT_TOUCH_FILE,
|
DACT_TOUCH_FILE,
|
||||||
DACT_CLOSE,
|
DACT_CLOSE,
|
||||||
};
|
};
|
||||||
|
@ -125,6 +124,5 @@ delayed_action_repush(Delay *delay, Delayed_Action *act){
|
||||||
#define delayed_set_line(delay, ...) delayed_action_(delay, DACT_SET_LINE, ##__VA_ARGS__)
|
#define delayed_set_line(delay, ...) delayed_action_(delay, DACT_SET_LINE, ##__VA_ARGS__)
|
||||||
#define delayed_switch(delay, ...) delayed_action_(delay, DACT_SWITCH, ##__VA_ARGS__)
|
#define delayed_switch(delay, ...) delayed_action_(delay, DACT_SWITCH, ##__VA_ARGS__)
|
||||||
#define delayed_try_kill(delay, ...) delayed_action_(delay, DACT_TRY_KILL, ##__VA_ARGS__)
|
#define delayed_try_kill(delay, ...) delayed_action_(delay, DACT_TRY_KILL, ##__VA_ARGS__)
|
||||||
#define delayed_kill(delay, ...) delayed_action_(delay, DACT_KILL, ##__VA_ARGS__)
|
|
||||||
#define delayed_touch_file(delay, ...) delayed_action_(delay, DACT_TOUCH_FILE, ##__VA_ARGS__)
|
#define delayed_touch_file(delay, ...) delayed_action_(delay, DACT_TOUCH_FILE, ##__VA_ARGS__)
|
||||||
#define delayed_close(delay, ...) delayed_action_(delay, DACT_CLOSE, ##__VA_ARGS__)
|
#define delayed_close(delay, ...) delayed_action_(delay, DACT_CLOSE, ##__VA_ARGS__)
|
||||||
|
|
|
@ -3023,8 +3023,11 @@ view_show_file(View *view){
|
||||||
}
|
}
|
||||||
|
|
||||||
internal void
|
internal void
|
||||||
view_save_file(System_Functions *system, Mem_Options *mem, Working_Set *working_set,
|
view_save_file(System_Functions *system, Models *models,
|
||||||
Editing_File *file, View *view, String filename, b32 save_as){
|
Editing_File *file, View *view, String filename, b32 save_as){
|
||||||
|
Mem_Options *mem = &models->mem;
|
||||||
|
Working_Set *working_set = &models->working_set;
|
||||||
|
|
||||||
if (!file){
|
if (!file){
|
||||||
if (view){
|
if (view){
|
||||||
file = view->file_data.file;
|
file = view->file_data.file;
|
||||||
|
@ -3131,6 +3134,41 @@ view_open_file(System_Functions *system, Models *models,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
internal void
|
||||||
|
kill_file(System_Functions *system, Models *models,
|
||||||
|
Editing_File *file, String string){
|
||||||
|
Working_Set *working_set = &models->working_set;
|
||||||
|
|
||||||
|
if (!file && string.str){
|
||||||
|
file = working_set_lookup_file(working_set, string);
|
||||||
|
if (!file){
|
||||||
|
file = working_set_contains(system, working_set, string);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (file && !file->settings.never_kill){
|
||||||
|
working_set_remove(system, working_set, file->name.source_path);
|
||||||
|
file_close(system, &models->mem.general, file);
|
||||||
|
working_set_free_file(&models->working_set, file);
|
||||||
|
|
||||||
|
File_Node *used = &models->working_set.used_sentinel;
|
||||||
|
File_Node *node = used->next;
|
||||||
|
for (View_Iter iter = file_view_iter_init(&models->layout, file, 0);
|
||||||
|
file_view_iter_good(iter);
|
||||||
|
iter = file_view_iter_next(iter)){
|
||||||
|
if (node != used){
|
||||||
|
iter.view->file_data.file = 0;
|
||||||
|
view_set_file(iter.view, (Editing_File*)node, models);
|
||||||
|
node = node->next;
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
iter.view->file_data.file = 0;
|
||||||
|
view_set_file(iter.view, 0, models);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
internal void
|
internal void
|
||||||
interactive_view_complete(System_Functions *system, View *view, String dest, i32 user_action){
|
interactive_view_complete(System_Functions *system, View *view, String dest, i32 user_action){
|
||||||
Models *models = view->persistent.models;
|
Models *models = view->persistent.models;
|
||||||
|
@ -3144,8 +3182,7 @@ interactive_view_complete(System_Functions *system, View *view, String dest, i32
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case IAct_Save_As:
|
case IAct_Save_As:
|
||||||
view_save_file(system, &models->mem, &models->working_set,
|
view_save_file(system, models, 0, view, dest, 1);
|
||||||
0, view, dest, 1);
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case IAct_New:
|
case IAct_New:
|
||||||
|
@ -3182,16 +3219,15 @@ interactive_view_complete(System_Functions *system, View *view, String dest, i32
|
||||||
case IAct_Sure_To_Kill:
|
case IAct_Sure_To_Kill:
|
||||||
switch (user_action){
|
switch (user_action){
|
||||||
case 0:
|
case 0:
|
||||||
delayed_kill(&models->delay1, dest);
|
kill_file(system, models, 0, dest);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 1:
|
case 1:
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 2:
|
case 2:
|
||||||
view_save_file(system, &models->mem, &models->working_set,
|
view_save_file(system, models, 0, 0, dest, 0);
|
||||||
0, 0, dest, 0);
|
kill_file(system, models, 0, dest);;
|
||||||
delayed_kill(&models->delay1, dest);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -5266,36 +5302,11 @@ do_render_file_view(System_Functions *system, Exchange *exchange,
|
||||||
}
|
}
|
||||||
|
|
||||||
draw_pop_clip(target);
|
draw_pop_clip(target);
|
||||||
}
|
}
|
||||||
|
|
||||||
return(result);
|
return(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
internal void
|
|
||||||
kill_file(System_Functions *system, Exchange *exchange, Models *models, Editing_File *file){
|
|
||||||
File_Node *node, *used;
|
|
||||||
|
|
||||||
file_close(system, &models->mem.general, file);
|
|
||||||
working_set_free_file(&models->working_set, file);
|
|
||||||
|
|
||||||
used = &models->working_set.used_sentinel;
|
|
||||||
node = used->next;
|
|
||||||
|
|
||||||
for (View_Iter iter = file_view_iter_init(&models->layout, file, 0);
|
|
||||||
file_view_iter_good(iter);
|
|
||||||
iter = file_view_iter_next(iter)){
|
|
||||||
if (node != used){
|
|
||||||
iter.view->file_data.file = 0;
|
|
||||||
view_set_file(iter.view, (Editing_File*)node, models);
|
|
||||||
node = node->next;
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
iter.view->file_data.file = 0;
|
|
||||||
view_set_file(iter.view, 0, models);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
inline void
|
inline void
|
||||||
file_view_free_buffers(View *view){
|
file_view_free_buffers(View *view){
|
||||||
General_Memory *general = &view->persistent.models->mem.general;
|
General_Memory *general = &view->persistent.models->mem.general;
|
||||||
|
|
|
@ -158,8 +158,11 @@ char *daction_enum[] = {
|
||||||
#endif
|
#endif
|
||||||
"SWITCH",
|
"SWITCH",
|
||||||
"TRY_KILL",
|
"TRY_KILL",
|
||||||
|
#if 0
|
||||||
"KILL",
|
"KILL",
|
||||||
|
#endif
|
||||||
"TOUCH_FILE",
|
"TOUCH_FILE",
|
||||||
|
|
||||||
"CLOSE",
|
"CLOSE",
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue