4coder»Forums
23 posts
Changing position of the compilation buffer
Edited by Joystick on Reason: Initial post
Hey everyone!
I'd appreciate it very much if you could tell me how can I get the compilation buffer to always appear on the bottom rather than on the left or the right sides of the editor.
John
46 posts
Changing position of the compilation buffer
I have a slightly similar setup to what you want. The position of my build panel is at the bottom, but is initially "hidden" (actually, it's only a couple of pixels tall). When i press ALT + M to compile, it expands from the bottom and stays visible. If I want to hide it again, I've another key combo that does that. It's these 2 commands:
 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
bool toggle_build_panel_expanded = false;

CUSTOM_COMMAND_SIG(toggle_build_panel)
CUSTOM_DOC("Toggles the build panel")
{
    if (!toggle_build_panel_expanded)
    {
        View_Summary special_view = get_view(app, build_footer_panel_view_id, AccessAll);
        view_set_split_proportion( app, &special_view, 0.18f );
    }
    else
    {
        View_Summary special_view = get_view(app, build_footer_panel_view_id, AccessAll);
        view_set_split_proportion( app, &special_view, 0.001f );
    }
    
    toggle_build_panel_expanded = !toggle_build_panel_expanded;
}

CUSTOM_COMMAND_SIG(build_in_build_panel_expanded)
CUSTOM_DOC("Looks for a build.bat, build.sh, or makefile in the current and parent directories.  Runs the first that it finds and prints the output to *compilation*.  Puts the *compilation* buffer in a panel at the footer of the current view.")
{
    uint32_t access = AccessAll;
    View_Summary view = get_active_view(app, access);
    Buffer_Summary buffer = get_buffer(app, view.buffer_id, access);
    
    View_Summary build_view = get_or_open_build_panel(app);
    view_set_split_proportion( app, &build_view, 0.18f );
    toggle_build_panel_expanded = true;

    execute_standard_build(app, &build_view, &buffer);
    set_fancy_compilation_buffer_font(app);
    
    memset(&prev_location, 0, sizeof(prev_location));
    lock_jump_buffer(literal("*compilation*"));
}


I hope you get some ideas for your implementation.
23 posts
Changing position of the compilation buffer
Great, thank you so much!
Could you tell in which source file you put this code in?
John
46 posts
Changing position of the compilation buffer
This goes to "4coder_default_bindings.cpp".
Additionally, if you want to show/hide the compilation buffer as explained in the previous post, you'll have to bind it to a key combination.
In my case I have it set up like this
1
bind(context, '`', MDFR_ALT, toggle_build_panel);

This goes in to the function "void custom_keys(Bind_Helper *context)" which you'll find on the same file if you scroll further down.