Register
4coder»Forums»Set Build Panel Position and Size?
2 posts
Set Build Panel Position and Size?
6 months, 3 weeks ago Edited by Zevern on April 9, 2020, 9:23 p.m.
Hi everyone,


Really enjoying 4coder so far! My apologies if someone has previously answered this question, but I almost never use the right panel for code, and instead, I would like to have the build panel/*compilation* buffer open (using the build command Alt+M) on the right side with it being full-size like a normal buffer. Currently, the build panel opens below the active panel. Is there a way to change this currently, or by modifying the custom layer? I took a quick glance at the API but I wasn't able to really find anything. Thank you!
Corentin Godeau
4 posts

French engineering student.

Set Build Panel Position and Size?
6 months, 3 weeks ago
Hi,

If I'm not mistaken you can set the right panel view to show the *compilation* buffer like in the following screenshot:



The only downside is that when you hit Alt+M, the panel won't open on the right side directly. However, once you compiled at least one time, the buffer has been created so you can split the view and switch to the right buffer.

Hope that helps !

PS: if you really want to open the panel on the right directly, I think you'll have to edit the code.
Simon Anciaux
900 posts
Set Build Panel Position and Size?
6 months, 3 weeks ago
In 4coder_build_commands.cpp there is a function called "get_or_open_build_panel" that function calls "open_build_footer_panel" which will create the bottom panel. If you comment that call and replace it by a function that returns the right panel it will display the result in that panel.

I'm not familiar with the new 4coder API so I can't tell you exactly what to do but it shouldn't be too difficult to figure out. I suppose you just need to use get_view_next but I'm not sure.
Corentin Godeau
4 posts

French engineering student.

Set Build Panel Position and Size?
6 months, 3 weeks ago
Hi,

I just tried very quickly based on the hint from mrmixer, and the following piece of code is a quick hack effectively:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
// Added this function
function View_ID
open_right_panel(Application_Links *app, View_ID view){
    View_ID special_view = open_view(app, view, ViewSplit_Right);
    new_view_settings(app, special_view);
    Buffer_ID buffer = view_get_buffer(app, special_view, Access_Always);
    Face_ID face_id = get_face_id(app, buffer);
    Face_Metrics metrics = get_face_metrics(app, face_id);
    view_set_split_pixel_size(app, special_view, (i32)(metrics.line_height*14.f));
    view_set_passive(app, special_view, true);
    return(special_view);
}

function View_ID
open_build_footer_panel(Application_Links *app){
    if (!view_exists(app, build_footer_panel_view_id)){
        View_ID view = get_active_view(app, Access_Always);
        build_footer_panel_view_id = open_right_panel(app, view); // Changed this line
        view_set_active(app, view);
    }
    return(build_footer_panel_view_id);
}


This is very hacky but you got the idea if you want to open it directly in the right panel.
2 posts
Set Build Panel Position and Size?
6 months, 3 weeks ago Edited by Zevern on April 10, 2020, 4:28 a.m.
Thank you both for the replies! I tried the suggestion that you both provided and it works perfectly! :)

I do have one followup question though (so sorry), is there a way in the API to change the startup behavior of 4coder, so that I could get rid of the *messages* buffer that starts up every time I start the application, or at least minimize it?


EDIT: Nevermind! I figured it out, I simply had to go to the default_startup COMMAND_SIG in 4coder_default_hooks.cpp and comment out the "default_4coder_side_by_side_panels" line, and that got rid of the side-by-side panels. Thank you both for your help!