Commit ef5ff04d authored by Luis de Bethencourt's avatar Luis de Bethencourt

ui: controls clamped to a max pixel size

parent a534aebd
......@@ -654,10 +654,6 @@ load_controls (UserInterface * ui)
clutter_actor_add_child (CLUTTER_ACTOR (ui->control_box),
CLUTTER_ACTOR (ui->main_box));
clutter_actor_add_constraint (CLUTTER_ACTOR (ui->main_box),
clutter_align_constraint_new (ui->stage, CLUTTER_ALIGN_X_AXIS, 0.03));
clutter_actor_add_constraint (CLUTTER_ACTOR (ui->main_box),
clutter_align_constraint_new (ui->stage, CLUTTER_ALIGN_Y_AXIS, 0.03));
// Controls title
ui->control_title = clutter_text_new_full ("Clear Sans Bold 32px",
......@@ -716,10 +712,6 @@ load_controls (UserInterface * ui)
(ui->media_height * CONTROLS_HEIGHT_RATIO) / 5);
ui->control_seekbar = clutter_actor_new ();
clutter_actor_set_content (ui->control_seekbar, ui->seek_canvas);
clutter_actor_add_constraint (ui->control_seekbar,
clutter_align_constraint_new (ui->stage, CLUTTER_ALIGN_X_AXIS, 0));
clutter_actor_add_constraint (ui->control_seekbar,
clutter_align_constraint_new (ui->stage, CLUTTER_ALIGN_Y_AXIS, 0));
g_signal_connect (ui->seek_canvas, "draw", G_CALLBACK (draw_progressbar), ui);
clutter_content_invalidate (ui->seek_canvas);
......@@ -770,10 +762,6 @@ load_controls (UserInterface * ui)
(ui->media_height * CONTROLS_HEIGHT_RATIO) / 5);
ui->vol_int = clutter_actor_new ();
clutter_actor_set_content (ui->vol_int, ui->vol_int_canvas);
clutter_actor_add_constraint (ui->vol_int,
clutter_align_constraint_new (ui->stage, CLUTTER_ALIGN_X_AXIS, 0));
clutter_actor_add_constraint (ui->vol_int,
clutter_align_constraint_new (ui->stage, CLUTTER_ALIGN_Y_AXIS, 0));
g_signal_connect (ui->vol_int_canvas, "draw", G_CALLBACK (draw_progressbar),
ui);
......@@ -1015,11 +1003,7 @@ size_change (ClutterStage * stage,
stage_width = clutter_actor_get_width (ui->stage);
stage_height = clutter_actor_get_height (ui->stage);
ui->stage_width = stage_width;
ui->stage_height = stage_height;
stage_ar = stage_width / stage_height;
new_width = stage_width;
new_height = stage_height;
......@@ -1040,6 +1024,9 @@ size_change (ClutterStage * stage,
media_height);
}
ui->stage_width = new_width;
ui->stage_height = new_height;
clutter_actor_set_size (CLUTTER_ACTOR (ui->texture), new_width, new_height);
update_controls_size (ui);
......@@ -1136,6 +1123,8 @@ update_controls_size (UserInterface * ui)
gfloat ctl_width, ctl_height;
gfloat icon_size;
gfloat control_box_width;
gfloat main_box_width, main_box_height;
gfloat main_box_horiz_pos, main_box_vert_pos;
// g_print ("Updating controls size for stage: %ux%u\n", ui->stage_width,
// ui->stage_height);
......@@ -1149,6 +1138,11 @@ update_controls_size (UserInterface * ui)
ctl_height = ctl_width / CONTROLS_ASPECT_RATIO;
}
if (ctl_width > CONTROLS_MAX_WIDTH) {
ctl_width = CONTROLS_MAX_WIDTH;
ctl_height = ctl_width / CONTROLS_ASPECT_RATIO;
}
icon_size = ctl_height * PLAY_TOGGLE_RATIO;
if (ui->subtitles_available) {
......@@ -1209,6 +1203,14 @@ update_controls_size (UserInterface * ui)
clutter_actor_set_size (ui->audio_stream_toggle, icon_size, icon_size);
}
clutter_actor_get_size (CLUTTER_ACTOR (ui->main_box),
&main_box_width, &main_box_height);
main_box_horiz_pos = (control_box_width - main_box_width) / 2;
main_box_vert_pos = (ctl_height - main_box_height) / 2;
clutter_actor_set_position (CLUTTER_ACTOR (ui->main_box),
main_box_horiz_pos, main_box_vert_pos);
update_volume (ui, -1);
}
......
......@@ -34,6 +34,7 @@
#define CONTROLS_WIDTH_RATIO 0.48f
#define CONTROLS_HEIGHT_RATIO 0.20f
#define CONTROLS_ASPECT_RATIO 4.0f
#define CONTROLS_MAX_WIDTH 480.0f
#define MAIN_BOX_W 0.95f
#define MAIN_BOX_H 0.8f
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment