added zoom support

This commit is contained in:
Artem Anufrij 2017-08-16 19:25:01 +02:00
parent 0067bb9f8d
commit c2ea31129f

View file

@ -84,6 +84,7 @@ namespace Webpin {
var width = info.get_string ("WebpinWindowWidth");
var height = info.get_string ("WebpinWindowHeight");
var state = info.get_string ("WebpinWindowMaximized");
var zoom = info.get_string ("WebpinWindowZoom");
if (width != null && height != null) {
set_default_size (int.parse(width), int.parse(height));
@ -95,6 +96,10 @@ namespace Webpin {
this.maximize ();
}
if (zoom != null) {
web_app.app_view.zoom_level = double.parse (zoom);
}
this.delete_event.connect (() => {
update_window_state(this.get_allocated_width (), this.get_allocated_height (), this.is_maximized);
return false;
@ -162,6 +167,27 @@ namespace Webpin {
case Gdk.Key.F11:
toggle_fullscreen();
break;
case Gdk.Key.KP_Add:
case Gdk.Key.plus:
if (Gdk.ModifierType.CONTROL_MASK in event.state) {
web_app.app_view.zoom_level += 0.1;
web_app.get_desktop_file().edit_propertie ("WebpinWindowZoom", web_app.app_view.zoom_level.to_string ());
}
break;
case Gdk.Key.KP_Subtract:
case Gdk.Key.minus:
if (Gdk.ModifierType.CONTROL_MASK in event.state) {
web_app.app_view.zoom_level -= 0.1;
web_app.get_desktop_file().edit_propertie ("WebpinWindowZoom", web_app.app_view.zoom_level.to_string ());
}
break;
case Gdk.Key.KP_0:
case Gdk.Key.@0:
if (Gdk.ModifierType.CONTROL_MASK in event.state) {
web_app.app_view.zoom_level = 1;
web_app.get_desktop_file().edit_propertie ("WebpinWindowZoom", web_app.app_view.zoom_level.to_string ());
}
break;
case Gdk.Key.F5:
if (Gdk.ModifierType.CONTROL_MASK in event.state) {
web_app.app_view.reload ();