Permalink
Browse files

Overview: Clean up some cruft

  • Loading branch information...
rschroll committed May 20, 2012
1 parent a31887e commit e579b98f4658a6f1158b39d1ab9fded2ab6e0ede
Showing with 15 additions and 24 deletions.
  1. +2 −2 src/classes/presentation_controller.vala
  2. +12 −21 src/classes/window/overview.vala
  3. +1 −1 src/classes/window/presenter.vala
@@ -396,7 +396,7 @@ namespace org.westhoffswelt.pdfpresenter {
* Set the last slide as defined by the user
*/
public void set_end_user_slide_overview() {
- int user_selected = this.overview.get_current_button();
+ int user_selected = this.overview.get_current_slide();
this.metadata.set_end_user_slide(user_selected + 1);
}
@@ -717,7 +717,7 @@ namespace org.westhoffswelt.pdfpresenter {
* Toggle skip for current slide in overview mode
*/
protected void toggle_skip_overview() {
- int user_selected = this.overview.get_current_button();
+ int user_selected = this.overview.get_current_slide();
int slide_number = this.metadata.user_slide_to_real_slide(user_selected);
this.metadata.toggle_skip( slide_number, user_selected );
this.overview.set_n_slides( this.get_user_n_slides() );
@@ -123,16 +123,11 @@ namespace org.westhoffswelt.pdfpresenter.Window {
Color white;
Color.parse("black", out black);
Color.parse("white", out white);
- //this.table.modify_bg(StateType.NORMAL, black);
- //this.table.modify_bg(StateType.ACTIVE, black);
this.slides_view.modify_base(StateType.NORMAL, black);
- //this.modify_bg(StateType.NORMAL, black);
Gtk.Scrollbar vscrollbar = (Gtk.Scrollbar) this.get_vscrollbar();
- //this.scrolledWindow.set_shadow_type(Gtk.ShadowType.NONE);
vscrollbar.modify_bg(StateType.NORMAL, white);
vscrollbar.modify_bg(StateType.ACTIVE, black);
vscrollbar.modify_bg(StateType.PRELIGHT, white);
- //this.scrolledWindow.get_vscrollbar().modify_fg(StateType.NORMAL, black);
this.metadata = metadata;
this.presentation_controller = presentation_controller;
@@ -217,10 +212,9 @@ namespace org.westhoffswelt.pdfpresenter.Window {
protected bool fill_previews() {
if (this.cache == null || !this.shown || this.next_undone_preview >= this.n_slides)
return false;
+
// We get the dimensions from the first button and first slide,
// should be the same for all
-
- //var thisButton = button[this.next_undone_preview];
int pixmap_width, pixmap_height;
this.cache.retrieve(0).get_size(out pixmap_width, out pixmap_height);
var pixbuf = new Gdk.Pixbuf(Gdk.Colorspace.RGB, true, 8, pixmap_width, pixmap_height);
@@ -229,15 +223,12 @@ namespace org.westhoffswelt.pdfpresenter.Window {
null, 0, 0, 0, 0, pixmap_width, pixmap_height);
var pixbuf_scaled = pixbuf.scale_simple(this.target_width, this.target_height,
Gdk.InterpType.BILINEAR);
- //thisButton.set_label("");
- //thisButton.set_image(image);
+
var iter = TreeIter();
this.slides.get_iter_from_string(out iter, @"$(this.next_undone_preview)");
this.slides.set_value(iter, 0, pixbuf_scaled);
- ++this.next_undone_preview;
-
- return (this.next_undone_preview < this.n_slides);
+ return (++this.next_undone_preview < this.n_slides);
}
/**
@@ -264,14 +255,14 @@ namespace org.westhoffswelt.pdfpresenter.Window {
*/
public void set_n_slides(int n) {
if ( n != this.n_slides ) {
- var currently_selected = this.get_current_button();
+ var currently_selected = this.get_current_slide();
this.invalidate();
this.n_slides = n;
if ( this.shown ) {
this.fill_structure();
if ( currently_selected >= this.n_slides )
currently_selected = this.n_slides - 1;
- this.set_current_button(currently_selected);
+ this.set_current_slide(currently_selected);
}
}
}
@@ -289,7 +280,7 @@ namespace org.westhoffswelt.pdfpresenter.Window {
/**
* Set the current highlighted button (and deselect the previous one)
*/
- public void set_current_button(int b) {
+ public void set_current_slide(int b) {
var path = new TreePath.from_indices(b);
this.slides_view.select_path(path);
this.slides_view.set_cursor(path, null, false);
@@ -298,7 +289,7 @@ namespace org.westhoffswelt.pdfpresenter.Window {
/**
* Which is the current highlighted button/slide?
*/
- public int get_current_button() {
+ public int get_current_slide() {
return this.current_slide;
}
@@ -309,18 +300,18 @@ namespace org.westhoffswelt.pdfpresenter.Window {
*/
public bool on_key_press(Gtk.Widget source, EventKey key) {
bool handled = false;
- var currently_selected = this.get_current_button();
+ var currently_selected = this.get_current_slide();
switch ( key.keyval ) {
//case 0xff51: /* Cursor left */
case 0xff55: /* Page Up */
if ( currently_selected > 0)
- this.set_current_button( currently_selected - 1 );
+ this.set_current_slide( currently_selected - 1 );
handled = true;
break;
//case 0xff53: /* Cursor right */
case 0xff56: /* Page down */
if ( currently_selected < this.n_slides - 1 )
- this.set_current_button( currently_selected + 1 );
+ this.set_current_slide( currently_selected + 1 );
handled = true;
break;
case 0xff0d: /* Return */
@@ -340,13 +331,13 @@ namespace org.westhoffswelt.pdfpresenter.Window {
if (ltp != null) {
var tp = ltp.data;
if (tp.get_indices() != null) { // Seg fault if we save tp.get_indices locally
- this.current_slide = tp.get_indices()[0];
+ this.current_slide = tp.get_indices()[0];
this.presenter.custom_slide_count(this.current_slide + 1);
return;
}
}
// If there's no selection, reset the old one
- this.set_current_button(this.current_slide);
+ this.set_current_slide(this.current_slide);
}
}
@@ -575,7 +575,7 @@ namespace org.westhoffswelt.pdfpresenter.Window {
public void show_overview() {
this.slideViews.hide();
this.overview.show();
- this.overview.set_current_button(this.presentation_controller.get_current_user_slide_number());
+ this.overview.set_current_slide(this.presentation_controller.get_current_user_slide_number());
}
public void hide_overview() {

0 comments on commit e579b98

Please sign in to comment.