added coroutines, fixed _YET_ another scroll bug
This commit is contained in:
parent
8cf1447714
commit
8d2b575b68
|
@ -337,13 +337,14 @@ struct Theme_Color{
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
#define VIEW_ROUTINE_SIG(name) void name(int view_id)
|
||||||
#define GET_BINDING_DATA(name) int name(void *data, int size)
|
#define GET_BINDING_DATA(name) int name(void *data, int size)
|
||||||
#define CUSTOM_COMMAND_SIG(name) void name(struct Application_Links *app)
|
#define CUSTOM_COMMAND_SIG(name) void name(struct Application_Links *app)
|
||||||
#define HOOK_SIG(name) int name(struct Application_Links *app)
|
#define HOOK_SIG(name) int name(struct Application_Links *app)
|
||||||
#define SCROLL_RULE_SIG(name) int name(float target_x, float target_y, float *scroll_x, float *scroll_y, int view_id, int is_new_target)
|
#define SCROLL_RULE_SIG(name) int name(float target_x, float target_y, float *scroll_x, float *scroll_y, int view_id, int is_new_target)
|
||||||
|
|
||||||
extern "C"{
|
extern "C"{
|
||||||
|
typedef VIEW_ROUTINE_SIG(View_Routine_Function);
|
||||||
typedef CUSTOM_COMMAND_SIG(Custom_Command_Function);
|
typedef CUSTOM_COMMAND_SIG(Custom_Command_Function);
|
||||||
typedef GET_BINDING_DATA(Get_Binding_Data_Function);
|
typedef GET_BINDING_DATA(Get_Binding_Data_Function);
|
||||||
typedef HOOK_SIG(Hook_Function);
|
typedef HOOK_SIG(Hook_Function);
|
||||||
|
@ -576,6 +577,7 @@ extern "C" _GET_VERSION_SIG(get_alpha_4coder_version){
|
||||||
}
|
}
|
||||||
|
|
||||||
struct Custom_API{
|
struct Custom_API{
|
||||||
|
View_Routine_Function *view_routine;
|
||||||
Get_Binding_Data_Function *get_bindings;
|
Get_Binding_Data_Function *get_bindings;
|
||||||
_Get_Version_Function *get_alpha_4coder_version;
|
_Get_Version_Function *get_alpha_4coder_version;
|
||||||
};
|
};
|
||||||
|
|
29
4ed.cpp
29
4ed.cpp
|
@ -2510,6 +2510,13 @@ command_caller(Coroutine *coroutine){
|
||||||
view->mode = view->next_mode;
|
view->mode = view->next_mode;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
internal void
|
||||||
|
view_caller(Coroutine *coroutine){
|
||||||
|
View *view = (View*)coroutine->in;
|
||||||
|
|
||||||
|
view->view_routine(view->id);
|
||||||
|
}
|
||||||
|
|
||||||
internal void
|
internal void
|
||||||
app_links_init(System_Functions *system, Application_Links *app_links, void *data, int size){
|
app_links_init(System_Functions *system, Application_Links *app_links, void *data, int size){
|
||||||
app_links->memory = data;
|
app_links->memory = data;
|
||||||
|
@ -3162,6 +3169,28 @@ App_Init_Sig(app_init){
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
Panel *panel = 0, *used_panels = 0;
|
||||||
|
View *view = 0;
|
||||||
|
|
||||||
|
used_panels = &models->layout.used_sentinel;
|
||||||
|
for (dll_items(panel, used_panels)){
|
||||||
|
view = panel->view;
|
||||||
|
|
||||||
|
view->view_routine = models->config_api.view_routine;
|
||||||
|
view->coroutine =
|
||||||
|
system->create_coroutine(view_caller);
|
||||||
|
|
||||||
|
view->coroutine =
|
||||||
|
system->launch_coroutine(view->coroutine, view, view);
|
||||||
|
|
||||||
|
if (!view->coroutine){
|
||||||
|
// TODO(allen): Error message and recover
|
||||||
|
NotImplemented;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
Command_Map *global;
|
Command_Map *global;
|
||||||
i32 wanted_size = 0;
|
i32 wanted_size = 0;
|
||||||
|
|
|
@ -206,13 +206,16 @@ context_eq(Scroll_Context a, Scroll_Context b){
|
||||||
|
|
||||||
struct View{
|
struct View{
|
||||||
View *next, *prev;
|
View *next, *prev;
|
||||||
|
Panel *panel;
|
||||||
b32 in_use;
|
b32 in_use;
|
||||||
i32 id;
|
i32 id;
|
||||||
|
|
||||||
|
Coroutine *coroutine;
|
||||||
|
View_Routine_Function *view_routine;
|
||||||
|
|
||||||
// TODO(allen): eliminate this models pointer: explicitly parameterize.
|
// TODO(allen): eliminate this models pointer: explicitly parameterize.
|
||||||
Models *models;
|
Models *models;
|
||||||
|
|
||||||
Panel *panel;
|
|
||||||
Command_Map *map;
|
Command_Map *map;
|
||||||
|
|
||||||
File_Viewing_Data file_data;
|
File_Viewing_Data file_data;
|
||||||
|
@ -1520,6 +1523,7 @@ view_set_file(View *view, Editing_File *file, Models *models){
|
||||||
if (file_is_ready(file)){
|
if (file_is_ready(file)){
|
||||||
view_measure_wraps(&models->mem.general, view);
|
view_measure_wraps(&models->mem.general, view);
|
||||||
view->recent->cursor = view_compute_cursor_from_pos(view, view->recent->cursor.pos);
|
view->recent->cursor = view_compute_cursor_from_pos(view, view->recent->cursor.pos);
|
||||||
|
view->recent->scroll.max_y = 1000000000.f;
|
||||||
view_move_view_to_cursor(view, &view->recent->scroll);
|
view_move_view_to_cursor(view, &view->recent->scroll);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -91,6 +91,7 @@ _OutDbgStr(u8*);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define TentativeAssert(c) Assert(c)
|
#define TentativeAssert(c) Assert(c)
|
||||||
|
#define NotImplemented Assert(!"This is not implemented yet!")
|
||||||
|
|
||||||
#define FatalError(message) system_fatal_error((u8*)message)
|
#define FatalError(message) system_fatal_error((u8*)message)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue