Skip to content
This repository has been archived by the owner on Jun 14, 2020. It is now read-only.

Commit

Permalink
1.1.0. - Fix page numbering // Fix page zoom
Browse files Browse the repository at this point in the history
  • Loading branch information
Lains committed Aug 2, 2019
1 parent ac4621b commit c118b91
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 18 deletions.
9 changes: 9 additions & 0 deletions data/com.github.lainsce.aesop.appdata.xml.in
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,15 @@
</screenshot>
</screenshots>
<releases>
<release version="1.1.0" date="2019-08-05">
<description>
<p>Release: Flourish</p>
<ul>
<li>Fixed: Page button now displays correct page number, and the page on app opening is also correct.</li>
<li>Fixed: Page size now takes advantage of the window to size itself.</li>
</ul>
</description>
</release>
<release version="1.0.7" date="2019-04-26">
<description>
<p>Release: Guillemet</p>
Expand Down
2 changes: 1 addition & 1 deletion meson.build
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Name our project
project('com.github.lainsce.aesop', ['vala', 'c'],
version: '1.0.6'
version: '1.1.0'
)

# Import main lib files
Expand Down
39 changes: 22 additions & 17 deletions src/MainWindow.vala
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@ namespace Aesop {
public Gtk.Image image;
public Gtk.ScrolledWindow page;
public Gtk.Stack stack;
public Gtk.Box page_box;
public Gtk.Box page_button_box;
public Gtk.Grid page_box;
public Gtk.Grid page_button_box;
public Poppler.Document document;
public double zoom = 1.00;
public double zoom = 1.25;
public double SIZE_MAX = 2.00;
public double SIZE_MIN = 0.25;
public string filename;
Expand Down Expand Up @@ -117,14 +117,15 @@ namespace Aesop {

image = new Gtk.Image ();
page = new Gtk.ScrolledWindow (null, null);
page.expand = true;
page_vertical_adjustment = page.get_vadjustment ();
page.add (image);
var page_context = page.get_style_context ();
page_context.add_class ("aesop-page");

page_box = new Gtk.Box (Gtk.Orientation.VERTICAL, 0);
page_box.pack_start (page, false, false, 0);
page_box.set_valign (Gtk.Align.CENTER);
page_box = new Gtk.Grid ();
page_box.expand = true;
page_box.add (page);

stack = new Gtk.Stack ();
stack.add_named (welcome, "welcome");
Expand Down Expand Up @@ -181,17 +182,20 @@ namespace Aesop {
page_button.set_value (page_count);
page_button.has_focus = false;
page_button.valign = Gtk.Align.CENTER;
page_button.set_value (settings.last_page);

page_button.value_changed.connect (() => {
int val = page_button.get_value_as_int ();
page_count = val;
render_page.begin ();
});

page_button_box = new Gtk.Box (Gtk.Orientation.HORIZONTAL, 0);
page_button_box = new Gtk.Grid ();
page_button_box.column_spacing = 6;
page_button_box.set_sensitive (false);
page_button_box.pack_start (page_label, false, false, 0);
page_button_box.pack_start (page_button, false, false, 6);
page_button_box.valign = Gtk.Align.CENTER;
page_button_box.add (page_label);
page_button_box.add (page_button);

var print_button = new Gtk.ModelButton ();
print_button.text = (_("Print…"));
Expand Down Expand Up @@ -387,7 +391,7 @@ namespace Aesop {
if (dialog.run () == Gtk.ResponseType.ACCEPT) {
filename = dialog.get_filename ();
settings.last_file = filename;
settings.last_page = this.total;
settings.pages_total = this.total;
render_page.begin ();
}
dialog.destroy ();
Expand Down Expand Up @@ -441,18 +445,18 @@ namespace Aesop {
var pages = document.get_page (page_count - 1);
pages.get_size (out page_width, out page_height);
this.total = document.get_n_pages ();
settings.last_page = this.total;
settings.pages_total = this.total;
Gtk.Allocation ac;
this.get_allocation (out ac);

int width = (int)(settings.zoom * page_width);
int height = (int)(settings.zoom * page_height);

// 20 here is margins.
page.width_request = (int) page_width + 20;
page.height_request = (int) page_height + 20;
this.width_request = width / 2;
this.height_request = height / 2;
page.set_halign (Gtk.Align.CENTER);
page.set_valign (Gtk.Align.CENTER);
page.width_request = (int) ac.width / 2;
page.height_request = (int) ac.height / 2;
this.width_request = width;
this.height_request = height;

if (settings.invert) {
debug ("Get dark!");
Expand Down Expand Up @@ -497,6 +501,7 @@ namespace Aesop {
mode_switch.set_sensitive (true);

settings.last_file = filename;
settings.last_page = page_count;
} else {
welcome.show ();
page_box.hide ();
Expand Down

0 comments on commit c118b91

Please sign in to comment.