public ActionManager() { File = new FileActions (); Edit = new EditActions (); View = new ViewActions (); Image = new ImageActions (); Layers = new LayerActions (); Adjustments = new AdjustmentsActions (); Help = new HelpActions (); }
public ActionManager() { AccelGroup = new AccelGroup(); File = new FileActions(); Edit = new EditActions(); View = new ViewActions(); Image = new ImageActions(); Layers = new LayerActions(); Adjustments = new AdjustmentsActions(); Effects = new EffectsActions(); Window = new WindowActions(); Help = new HelpActions(); }
public ActionManager() { AccelGroup = new AccelGroup (); File = new FileActions (); Edit = new EditActions (); View = new ViewActions (); Image = new ImageActions (); Layers = new LayerActions (); Adjustments = new AdjustmentsActions (); Effects = new EffectsActions (); Addins = new AddinActions (); Window = new WindowActions (); Help = new HelpActions (); }
public void ZoomToRectangle(Cairo.Rectangle rect) { double ratio; if (document.ImageSize.Width / rect.Width <= document.ImageSize.Height / rect.Height) { ratio = document.ImageSize.Width / rect.Width; } else { ratio = document.ImageSize.Height / rect.Height; } PintaCore.Actions.View.ZoomComboBox.ComboBox.Entry.Text = ViewActions.ToPercent(ratio); Gtk.Main.Iteration(); //Force update of scrollbar upper before recenter RecenterView(rect.X + rect.Width / 2, rect.Y + rect.Height / 2); }
private void ZoomAndRecenterView(ZoomType zoomType, Cairo.PointD point) { if (zoomType == ZoomType.ZoomOut && (CanvasSize.Width == 1 || CanvasSize.Height == 1)) { return; //Can't zoom in past a 1x1 px canvas } double zoom; if (!ViewActions.TryParsePercent(PintaCore.Actions.View.ZoomComboBox.ComboBox.ActiveText, out zoom)) { zoom = Scale * 100; } zoom = Math.Min(zoom, 3600); PintaCore.Chrome.Canvas.GdkWindow.FreezeUpdates(); PintaCore.Actions.View.SuspendZoomUpdate(); Gtk.Viewport view = (Gtk.Viewport)PintaCore.Chrome.Canvas.Parent; bool adjustOnMousePosition = point.X >= 0.0 && point.Y >= 0.0; double center_x = adjustOnMousePosition ? point.X : view.Hadjustment.Value + (view.Hadjustment.PageSize / 2.0); double center_y = adjustOnMousePosition ? point.Y : view.Vadjustment.Value + (view.Vadjustment.PageSize / 2.0); center_x = (center_x - Offset.X) / Scale; center_y = (center_y - Offset.Y) / Scale; if (zoomType == ZoomType.ZoomIn || zoomType == ZoomType.ZoomOut) { int i = 0; Predicate <string> UpdateZoomLevel = zoomInList => { switch (zoomType) { case ZoomType.ZoomIn: if (zoomInList == Catalog.GetString("Window") || int.Parse(zoomInList.Trim('%')) <= zoom) { PintaCore.Actions.View.ZoomComboBox.ComboBox.Active = i - 1; return(true); } break; case ZoomType.ZoomOut: if (zoomInList == Catalog.GetString("Window")) { return(true); } if (int.Parse(zoomInList.Trim('%')) < zoom) { PintaCore.Actions.View.ZoomComboBox.ComboBox.Active = i; return(true); } break; } return(false); }; foreach (string item in PintaCore.Actions.View.ZoomCollection) { if (UpdateZoomLevel(item)) { break; } i++; } } PintaCore.Actions.View.UpdateCanvasScale(); // Quick fix : need to manually update Upper limit because the value is not changing after updating the canvas scale. // TODO : I think there is an event need to be fired so that those values updated automatically. view.Hadjustment.Upper = CanvasSize.Width < view.Hadjustment.PageSize ? view.Hadjustment.PageSize : CanvasSize.Width; view.Vadjustment.Upper = CanvasSize.Height < view.Vadjustment.PageSize ? view.Vadjustment.PageSize : CanvasSize.Height; RecenterView(center_x, center_y); PintaCore.Actions.View.ResumeZoomUpdate(); PintaCore.Chrome.Canvas.GdkWindow.ThawUpdates(); }