aboutsummaryrefslogtreecommitdiff
path: root/src/gui/FileChooser.cpp
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2024-10-26 11:37:52 +0200
committerdec05eba <dec05eba@protonmail.com>2024-10-26 11:37:52 +0200
commit1d2fc77cfcd3d40c3a382d3f5f8e6c28e8b38da9 (patch)
treeccca52a56efa7421e44c96594f42bc08c06c2497 /src/gui/FileChooser.cpp
parent57977f29e10c8c2a8ba58c25e9ab653aed7cc0a9 (diff)
Make the ui the daemon instead, add hotkey for recording/pause
Diffstat (limited to 'src/gui/FileChooser.cpp')
-rw-r--r--src/gui/FileChooser.cpp39
1 files changed, 24 insertions, 15 deletions
diff --git a/src/gui/FileChooser.cpp b/src/gui/FileChooser.cpp
index 8ec498f..d445ccf 100644
--- a/src/gui/FileChooser.cpp
+++ b/src/gui/FileChooser.cpp
@@ -223,15 +223,36 @@ namespace gsr {
current_directory_padding_top_scale * get_theme().window_height + current_directory_padding_bottom_scale * get_theme().window_height
);
- mgl::vec2f current_directory_background_size = mgl::vec2f(size.x, current_directory_text.get_bounds().size.y + current_directory_padding.y).floor();
+ const float current_directory_background_height = (int)(current_directory_text.get_bounds().size.y + current_directory_padding.y);
+
+ draw_pos += mgl::vec2f(0.0f, current_directory_background_height + spacing_between_current_directory_and_content * get_theme().window_height);
+ const mgl::vec2f body_size = mgl::vec2f(size.x, size.y - (draw_pos.y - draw_pos_start.y)).floor();
+ scrollable_page.set_size(body_size);
+ file_chooser_body_ptr->set_size(scrollable_page.get_inner_size());
+ mgl::Rectangle content_background(scrollable_page.get_inner_size().floor());
+ content_background.set_position(draw_pos.floor());
+ content_background.set_color(mgl::Color(0, 0, 0, 120));
+ window.draw(content_background);
+
+ draw_navigation(window, draw_pos_start);
+
+ scrollable_page.draw(window, draw_pos.floor());
+ }
+
+ void FileChooser::draw_navigation(mgl::Window &window, mgl::vec2f draw_pos) {
+ const mgl::vec2f current_directory_padding(
+ current_directory_padding_left_scale * get_theme().window_height + current_directory_padding_right_scale * get_theme().window_height,
+ current_directory_padding_top_scale * get_theme().window_height + current_directory_padding_bottom_scale * get_theme().window_height
+ );
+ mgl::vec2f current_directory_background_size = mgl::vec2f(size.x, current_directory_text.get_bounds().size.y + current_directory_padding.y).floor();
up_arrow_sprite.set_height((int)(current_directory_background_size.y * 0.8f));
- up_arrow_sprite.set_position((draw_pos + mgl::vec2f(size.x - up_arrow_sprite.get_size().x, current_directory_background_size.y * 0.5f - up_arrow_sprite.get_size().y * 0.5f)).floor());
+ up_arrow_sprite.set_position((draw_pos + mgl::vec2f(file_chooser_body_ptr->get_size().x - up_arrow_sprite.get_size().x, current_directory_background_size.y * 0.5f - up_arrow_sprite.get_size().y * 0.5f)).floor());
const bool mouse_inside_up_arrow = mgl::FloatRect(up_arrow_sprite.get_position(), up_arrow_sprite.get_size()).contains(window.get_mouse_position().to_vec2f()) && !has_parent_with_selected_child_widget();
up_arrow_sprite.set_color(mouse_inside_up_arrow ? get_theme().tint_color : mgl::Color(255, 255, 255));
window.draw(up_arrow_sprite);
- current_directory_background_size.x -= (up_arrow_sprite.get_size().x + up_button_spacing_scale * get_theme().window_height);
+ current_directory_background_size.x = file_chooser_body_ptr->get_size().x - up_arrow_sprite.get_size().x - up_button_spacing_scale * get_theme().window_height;
mgl::Rectangle current_directory_background(current_directory_background_size.floor());
current_directory_background.set_color(mgl::Color(0, 0, 0, 120));
current_directory_background.set_position(draw_pos.floor());
@@ -240,18 +261,6 @@ namespace gsr {
current_directory_text.set_color(get_theme().text_color);
current_directory_text.set_position((draw_pos + mgl::vec2f(current_directory_padding.x, current_directory_background_size.y * 0.5f - current_directory_text.get_bounds().size.y * 0.5f)).floor());
window.draw(current_directory_text);
-
- draw_pos += mgl::vec2f(0.0f, current_directory_background_size.y + spacing_between_current_directory_and_content * get_theme().window_height);
- const mgl::vec2f body_size = mgl::vec2f(size.x, size.y - (draw_pos.y - draw_pos_start.y)).floor();
- scrollable_page.set_size(body_size);
- file_chooser_body_ptr->set_size(scrollable_page.get_inner_size());
-
- mgl::Rectangle content_background(scrollable_page.get_inner_size().floor());
- content_background.set_position(draw_pos.floor());
- content_background.set_color(mgl::Color(0, 0, 0, 120));
- window.draw(content_background);
-
- scrollable_page.draw(window, draw_pos.floor());
}
mgl::vec2f FileChooser::get_size() {