exit hook ready
parent
5b2077c6d7
commit
aea67fa68b
|
@ -33,6 +33,7 @@ typedef struct Offset_String{
|
||||||
enum Hook_ID{
|
enum Hook_ID{
|
||||||
hook_start,
|
hook_start,
|
||||||
hook_file_out_of_sync,
|
hook_file_out_of_sync,
|
||||||
|
hook_exit,
|
||||||
// never below this
|
// never below this
|
||||||
hook_type_count
|
hook_type_count
|
||||||
};
|
};
|
||||||
|
|
|
@ -153,6 +153,11 @@ HOOK_SIG(my_start){
|
||||||
return(0);
|
return(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
HOOK_SIG(my_exit){
|
||||||
|
// if this returns zero it cancels the exit.
|
||||||
|
return(1);
|
||||||
|
}
|
||||||
|
|
||||||
CUSTOM_COMMAND_SIG(newline_or_goto_position){
|
CUSTOM_COMMAND_SIG(newline_or_goto_position){
|
||||||
View_Summary view = app->get_active_view(app, AccessProtected);
|
View_Summary view = app->get_active_view(app, AccessProtected);
|
||||||
Buffer_Summary buffer = app->get_buffer(app, view.buffer_id, AccessProtected);
|
Buffer_Summary buffer = app->get_buffer(app, view.buffer_id, AccessProtected);
|
||||||
|
@ -412,6 +417,7 @@ get_bindings(void *data, int32_t size){
|
||||||
// NOTE(allen|a3.1): Hooks have no loyalties to maps. All hooks are global
|
// NOTE(allen|a3.1): Hooks have no loyalties to maps. All hooks are global
|
||||||
// and once set they always apply, regardless of what map is active.
|
// and once set they always apply, regardless of what map is active.
|
||||||
set_hook(context, hook_start, my_start);
|
set_hook(context, hook_start, my_start);
|
||||||
|
set_hook(context, hook_exit, my_exit);
|
||||||
|
|
||||||
set_open_file_hook(context, my_file_settings);
|
set_open_file_hook(context, my_file_settings);
|
||||||
set_command_caller(context, default_command_caller);
|
set_command_caller(context, default_command_caller);
|
||||||
|
|
|
@ -182,7 +182,8 @@ ENUM(uint32_t, Buffer_Create_Flag){
|
||||||
cleared to empty even if it's associated file already has content.) */
|
cleared to empty even if it's associated file already has content.) */
|
||||||
BufferCreate_AlwaysNew = 0x2,
|
BufferCreate_AlwaysNew = 0x2,
|
||||||
/* DOC(When BufferCreate_NeverNew is set it indicates that the buffer should
|
/* DOC(When BufferCreate_NeverNew is set it indicates that the buffer should
|
||||||
only be created if it is an existing file or an open buffer.) */
|
only be created if it is an existing file or if a buffer with the given name
|
||||||
|
is already open.) */
|
||||||
BufferCreate_NeverNew = 0x4,
|
BufferCreate_NeverNew = 0x4,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
7
4ed.cpp
7
4ed.cpp
|
@ -2680,6 +2680,13 @@ App_Step_Sig(app_step){
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// NOTE(allen): if this is the last frame, run the exit hook
|
||||||
|
if (!models->keep_playing && models->hooks[hook_exit]){
|
||||||
|
if (!models->hooks[hook_exit](&models->app_links)){
|
||||||
|
models->keep_playing = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// NOTE(allen): rendering
|
// NOTE(allen): rendering
|
||||||
{
|
{
|
||||||
begin_render_section(target, system);
|
begin_render_section(target, system);
|
||||||
|
|
|
@ -979,12 +979,11 @@ DOC_PARAM(buffer, The buffer parameter specifies the buffer to try to kill.)
|
||||||
DOC_PARAM(view_id, The view_id parameter specifies the view that will contain the "are you sure" dialogue if the buffer is dirty.)
|
DOC_PARAM(view_id, The view_id parameter specifies the view that will contain the "are you sure" dialogue if the buffer is dirty.)
|
||||||
DOC_PARAM(flags, The flags parameter specifies behaviors for the buffer kill.)
|
DOC_PARAM(flags, The flags parameter specifies behaviors for the buffer kill.)
|
||||||
DOC_RETURN(This call returns non-zero if the buffer is killed.)
|
DOC_RETURN(This call returns non-zero if the buffer is killed.)
|
||||||
DOC
|
|
||||||
(
|
DOC(Tries to kill the idenfied buffer. If the buffer is dirty and the "are you sure"
|
||||||
Tries to kill the idenfied buffer. If the buffer is dirty and the "are you sure"
|
|
||||||
dialogue needs to be displayed the provided view is used to show the dialogue.
|
dialogue needs to be displayed the provided view is used to show the dialogue.
|
||||||
If the view is not open the kill fails.
|
If the view is not open the kill fails.)
|
||||||
)
|
|
||||||
DOC_SEE(Buffer_Kill_Flag)
|
DOC_SEE(Buffer_Kill_Flag)
|
||||||
DOC_SEE(Buffer_Identifier)
|
DOC_SEE(Buffer_Identifier)
|
||||||
*/{
|
*/{
|
||||||
|
|
|
@ -58,6 +58,14 @@ struct Models{
|
||||||
Hook_Function *hooks[hook_type_count];
|
Hook_Function *hooks[hook_type_count];
|
||||||
Application_Links app_links;
|
Application_Links app_links;
|
||||||
|
|
||||||
|
Custom_API config_api;
|
||||||
|
|
||||||
|
Open_File_Hook_Function *hook_open_file;
|
||||||
|
Open_File_Hook_Function *hook_new_file;
|
||||||
|
Command_Caller_Hook_Function *command_caller;
|
||||||
|
Input_Filter_Function *input_filter;
|
||||||
|
Scroll_Rule_Function *scroll_rule;
|
||||||
|
|
||||||
Font_Set *font_set;
|
Font_Set *font_set;
|
||||||
Style_Font global_font;
|
Style_Font global_font;
|
||||||
Style_Library styles;
|
Style_Library styles;
|
||||||
|
@ -75,14 +83,6 @@ struct Models{
|
||||||
|
|
||||||
Panel *prev_mouse_panel;
|
Panel *prev_mouse_panel;
|
||||||
|
|
||||||
Custom_API config_api;
|
|
||||||
|
|
||||||
Open_File_Hook_Function *hook_open_file;
|
|
||||||
Open_File_Hook_Function *hook_new_file;
|
|
||||||
Command_Caller_Hook_Function *command_caller;
|
|
||||||
Input_Filter_Function *input_filter;
|
|
||||||
Scroll_Rule_Function *scroll_rule;
|
|
||||||
|
|
||||||
b32 keep_playing;
|
b32 keep_playing;
|
||||||
|
|
||||||
Debug_Data debug;
|
Debug_Data debug;
|
||||||
|
|
32
TODO.txt
32
TODO.txt
|
@ -72,43 +72,37 @@
|
||||||
; [X] clean whitespace doesn't appear to be cleaning trailing whitespace anymore???
|
; [X] clean whitespace doesn't appear to be cleaning trailing whitespace anymore???
|
||||||
; [X] problem with end of line comments
|
; [X] problem with end of line comments
|
||||||
; [X] paths with parens in them
|
; [X] paths with parens in them
|
||||||
|
; [X] killing compilation panel changes active panel
|
||||||
;
|
;
|
||||||
; [] indication on failure to save
|
; [] indication on failure to save
|
||||||
; [] history is broken, revist the entire system
|
; [] history is broken, revist the entire system
|
||||||
; [] 8.0\Include\um\dsound.h (not reproduced, get more info)
|
; [] 8.0\Include\um\dsound.h (not reproduced, get more info)
|
||||||
; [] paste external text from bug report (in email) (not reproduced, get more info)
|
; [] paste external text from bug report (in email) (not reproduced, get more info)
|
||||||
;
|
;
|
||||||
|
; [] view fails to follow cursor when the view is shrunk
|
||||||
|
; [] view fails to follow cursor after deleting long line
|
||||||
|
;
|
||||||
;
|
;
|
||||||
|
|
||||||
; BEFORE I SHIP
|
; BEFORE I SHIP
|
||||||
;
|
;
|
||||||
; [X] killing compilation panel changes active panel
|
|
||||||
; [X] tokens in the custom API
|
; [X] tokens in the custom API
|
||||||
; [X] token seeking on custom side
|
; [X] token seeking on custom side
|
||||||
; [X] auto indent on the custom side
|
; [X] auto indent on the custom side
|
||||||
|
; [] indent whole comments
|
||||||
|
; [] inserting lines at end of block comment
|
||||||
; [] clean up and comment the auto indent code to allow for customizations
|
; [] clean up and comment the auto indent code to allow for customizations
|
||||||
; [] more built in options for auto indenting
|
; [] more built in options for auto indenting
|
||||||
; [] expose dirty flags
|
; [] expose dirty flags
|
||||||
; [] make panel resizing not whacky with child panels
|
; [] make panel resizing not whacky with child panels
|
||||||
; [] mouse down/up distinction
|
; [] mouse down/up distinction
|
||||||
; [] hook on exit
|
|
||||||
; [] occasionally missing the (!) mark on files on windows
|
; [] occasionally missing the (!) mark on files on windows
|
||||||
; [] case insensitive interactive switch buffer
|
; [] case insensitive interactive switch buffer
|
||||||
; [] scroll down on compilation buffer durring compilation
|
; [] scroll down on compilation buffer durring compilation
|
||||||
|
; [] why are command line files not loading any more?
|
||||||
;
|
;
|
||||||
;
|
;
|
||||||
|
|
||||||
; [] commands for resizing panels
|
|
||||||
; [] user file bar string
|
|
||||||
; [] option to not open *messages* every startup
|
|
||||||
; [] API docs as text file
|
|
||||||
; [] read only files
|
|
||||||
; [] tab to complete folder names in the new file dialogue
|
|
||||||
; [] option to hide hidden files
|
|
||||||
; [] view fails to follow cursor when the view is shrunk
|
|
||||||
; [] view fails to follow cursor after deleting long line
|
|
||||||
; [] control over how mouse effects panel focus
|
|
||||||
|
|
||||||
; TODOS
|
; TODOS
|
||||||
; [X] success message when compiler works
|
; [X] success message when compiler works
|
||||||
; [X] auto-complete
|
; [X] auto-complete
|
||||||
|
@ -145,6 +139,18 @@
|
||||||
; [X] add to APIs
|
; [X] add to APIs
|
||||||
; [X] try to make win32 version better
|
; [X] try to make win32 version better
|
||||||
; [X] don't execute frames on events dealing only with ctrl/alt/shift
|
; [X] don't execute frames on events dealing only with ctrl/alt/shift
|
||||||
|
; [X] hook on exit
|
||||||
|
|
||||||
|
;
|
||||||
|
; [] binary buffers
|
||||||
|
; [] commands for resizing panels
|
||||||
|
; [] user file bar string
|
||||||
|
; [] API docs as text file
|
||||||
|
; [] read only files
|
||||||
|
; [] tab to complete folder names in the new file dialogue
|
||||||
|
; [] option to hide hidden files
|
||||||
|
; [] control over how mouse effects panel focus
|
||||||
|
; [] option to not open *messages* every startup
|
||||||
;
|
;
|
||||||
; [] support full length unicode file names
|
; [] support full length unicode file names
|
||||||
; [] switch based word complete
|
; [] switch based word complete
|
||||||
|
|
16
build.c
16
build.c
|
@ -679,18 +679,16 @@ metagen(char *cdir){
|
||||||
|
|
||||||
static void
|
static void
|
||||||
do_buildsuper(char *cdir){
|
do_buildsuper(char *cdir){
|
||||||
{
|
BEGIN_TIME_SECTION();
|
||||||
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)
|
#if defined(IS_WINDOWS)
|
||||||
buildsuper(cdir, BUILD_DIR, "../code/internal_4coder_tests.cpp");
|
//buildsuper(cdir, BUILD_DIR, "../code/internal_4coder_tests.cpp");
|
||||||
#else
|
#else
|
||||||
buildsuper(cdir, BUILD_DIR, "../code/power/4coder_experiments.cpp");
|
buildsuper(cdir, BUILD_DIR, "../code/power/4coder_experiments.cpp");
|
||||||
#endif
|
#endif
|
||||||
//buildsuper(cdir, BUILD_DIR, "../code/power/4coder_casey.cpp");
|
//buildsuper(cdir, BUILD_DIR, "../code/power/4coder_casey.cpp");
|
||||||
//buildsuper(cdir, BUILD_DIR, "../4vim/4coder_chronal.cpp");
|
//buildsuper(cdir, BUILD_DIR, "../4vim/4coder_chronal.cpp");
|
||||||
END_TIME_SECTION("build custom");
|
END_TIME_SECTION("build custom");
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|
|
@ -343,8 +343,7 @@ HOOK_SIG(experimental_start){
|
||||||
|
|
||||||
if (!file){
|
if (!file){
|
||||||
char module_path[512];
|
char module_path[512];
|
||||||
int len;
|
int len = app->get_4ed_path(app, module_path, 448);
|
||||||
len = app->get_4ed_path(app, module_path, 448);
|
|
||||||
memcpy(module_path+len, SETTINGS_FILE, sizeof(SETTINGS_FILE));
|
memcpy(module_path+len, SETTINGS_FILE, sizeof(SETTINGS_FILE));
|
||||||
file = fopen(module_path, "rb");
|
file = fopen(module_path, "rb");
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue