I haven't worked with the last version of 4coder so I may not be aware of changes in that version.
Here is a article in the wiki about
getting started with 4coder custom layer, but be aware that it's for version before 4.1.7. Most notably the way bindings work has changed (the old way might still work, but as I said, I haven't tried it yet).
Did you compile your platform layer after doing the change ?
You should keep the
default_framework_init (defined in
4coder_default_framework.cpp) because it's initializing 4coder systems, it's not responsible for the "layout" of the UI.
You've copied the code for the
open_panel_hsplit command there, but if you just want to split the view horizontally you just need to call the command. It's also not the right place to do that. You need the
custom_layer_init function to stay mostly the same, but change the startup hook. The default startup hook is defined in
4coder_default_hook.cpp, you can modify it, or create a different one and setting it up to be called. In the
default_startup hook, the function that sets up the default panels is
default_4coder_side_by_side_panels (from
4coder_default_framework.cpp). You can look at that and modify it to do what you want.
Don't forget to compile the custom layer (with 4coder closed) afterward.
Here is a small example. I didn't compile it so it might just not work.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89 | /*
4coder_default_bidings.cpp - Supplies the default bindings used for default 4coder behavior.
*/
// TOP
#if !defined(FCODER_DEFAULT_BINDINGS_CPP)
#define FCODER_DEFAULT_BINDINGS_CPP
#include "4coder_default_include.cpp"
// NOTE(allen): Users can declare their own managed IDs here.
#if !defined(META_PASS)
#include "generated/managed_id_metadata.cpp"
#endif
CUSTOM_COMMAND_SIG(custom_startup)
CUSTOM_DOC("Custom startup hook")
{
ProfileScope(app, "custom startup");
User_Input input = get_current_input(app);
if (match_core_code(&input, CoreCode_Startup)){
String_Const_u8_Array file_names = input.event.core.file_names;
load_themes_default_folder(app);
default_4coder_initialize(app, file_names);
default_4coder_side_by_side_panels(app, file_names);
b32 auto_load = def_get_config_b32(vars_save_string_lit("automatically_load_project"));
if (auto_load){
load_project(app);
}
}
{
def_audio_init();
Scratch_Block scratch(app);
FILE *file = def_search_normal_fopen(scratch, "audio_test/raygun_zap.wav", "rb");
if (file != 0){
Audio_Clip test_clip = audio_clip_from_wav_FILE(&global_permanent_arena, file);
fclose(file);
local_persist Audio_Control test_control = {};
test_control.channel_volume[0] = 1.f;
test_control.channel_volume[1] = 1.f;
def_audio_play_clip(test_clip, &test_control);
}
}
{
def_enable_virtual_whitespace = def_get_config_b32(vars_save_string_lit("enable_virtual_whitespace"));
clear_all_layouts(app);
}
/* This is the only change I made. */
open_panel_hsplit(app);
}
void
custom_layer_init(Application_Links *app){
Thread_Context *tctx = get_thread_context(app);
// NOTE(allen): setup for default framework
default_framework_init(app);
// NOTE(allen): default hooks and command maps
set_all_default_hooks(app);
mapping_init(tctx, &framework_mapping);
String_ID global_map_id = vars_save_string_lit("keys_global");
String_ID file_map_id = vars_save_string_lit("keys_file");
String_ID code_map_id = vars_save_string_lit("keys_code");
#if OS_MAC
setup_mac_mapping(&framework_mapping, global_map_id, file_map_id, code_map_id);
#else
setup_default_mapping(&framework_mapping, global_map_id, file_map_id, code_map_id);
#endif
setup_essential_mapping(&framework_mapping, global_map_id, file_map_id, code_map_id);
/* Change the default hook to the custom one. */
MappingScope();
SelectMapping(&framework_mapping);
SelectMap(global_id);
BindCore(custom_startup, CoreCode_Startup);
}
#endif //FCODER_DEFAULT_BINDINGS
// BOTTOM
|