Permalink
Browse files

Explicit height request for the overview

In this way it can be centered vertically
  • Loading branch information...
1 parent a7c67d4 commit e75fdd77b998f4730252604e2719d4f7655f8804 @davvil davvil committed May 24, 2012
Showing with 12 additions and 4 deletions.
  1. +11 −3 src/classes/window/overview.vala
  2. +1 −1 src/classes/window/presenter.vala
@@ -195,13 +195,15 @@ namespace org.westhoffswelt.pdfpresenter.Window {
if (this.max_width == -1)
return;
+ this.slides_view.set_margin(0);
+
var margin = this.slides_view.get_margin();
var padding = this.slides_view.get_item_padding() + 1; // Additional mystery pixel
var row_spacing = this.slides_view.get_row_spacing();
var col_spacing = this.slides_view.get_column_spacing();
-
- var eff_max_width = this.max_width - 2 * margin + col_spacing - 25; // -20 for the scroll bar
- var eff_max_height = this.max_height - 2 * margin + row_spacing;
+
+ var eff_max_width = this.max_width - 2 * margin;
+ var eff_max_height = this.max_height - 2 * margin;
int cols = eff_max_width / (Options.min_overview_width + 2 * padding + col_spacing);
int widthx, widthy, min_width, rows;
int tc = 0;
@@ -239,6 +241,12 @@ namespace org.westhoffswelt.pdfpresenter.Window {
}
this.set_policy(PolicyType.NEVER, PolicyType.AUTOMATIC);
this.target_height = (int)Math.round(this.target_width / this.aspect_ratio);
+ rows = (int)Math.ceil((float)this.n_slides / this.slides_view.columns);
+ int full_height = rows*(this.target_height + 2*padding + 2*row_spacing) + 2*margin;
+ if (full_height > this.max_height)
+ full_height = this.max_height;
+ this.set_size_request(-1, full_height);
+
this.last_structure_n_slides = this.n_slides;
this.slides.clear();
@@ -365,7 +365,7 @@ namespace org.westhoffswelt.pdfpresenter.Window {
this.add( fullLayout );
this.overview = new Overview( this.metadata, this.presentation_controller, this );
- this.centered_overview = new Alignment(0.5f, 0.5f, 0, 1);
+ this.centered_overview = new Alignment(0.5f, 0.5f, 0, 0);
this.centered_overview.add(this.overview);
//this.centered_overview.no_show_all = true;
this.overview.set_n_slides( this.presentation_controller.get_user_n_slides() );

0 comments on commit e75fdd7

Please sign in to comment.