Пример #1
0
        public void UpdateRulerRange()
        {
            Gtk.Main.Iteration();              //Force update of scrollbar upper before recenter

            Cairo.PointD lower = new Cairo.PointD(0, 0);
            Cairo.PointD upper = new Cairo.PointD(0, 0);

            if (PintaCore.Workspace.HasOpenDocuments)
            {
                if (PintaCore.Workspace.Offset.X > 0)
                {
                    lower.X = -PintaCore.Workspace.Offset.X / PintaCore.Workspace.Scale;
                    upper.X = PintaCore.Workspace.ImageSize.Width - lower.X;
                }
                else
                {
                    lower.X = sw.Hadjustment.Value / PintaCore.Workspace.Scale;
                    upper.X = (sw.Hadjustment.Value + sw.Hadjustment.PageSize) / PintaCore.Workspace.Scale;
                }
                if (PintaCore.Workspace.Offset.Y > 0)
                {
                    lower.Y = -PintaCore.Workspace.Offset.Y / PintaCore.Workspace.Scale;
                    upper.Y = PintaCore.Workspace.ImageSize.Height - lower.Y;
                }
                else
                {
                    lower.Y = sw.Vadjustment.Value / PintaCore.Workspace.Scale;
                    upper.Y = (sw.Vadjustment.Value + sw.Vadjustment.PageSize) / PintaCore.Workspace.Scale;
                }
            }

            hruler.SetRange(lower.X, upper.X, 0, upper.X);
            vruler.SetRange(lower.Y, upper.Y, 0, upper.Y);
        }
Пример #2
0
        public void UpdateRulerRange()
        {
            Gtk.Main.Iteration();  //Force update of scrollbar upper before recenter

            var lower = new Cairo.PointD(0, 0);
            var upper = new Cairo.PointD(0, 0);

            if (scrolled_window.Hadjustment == null || scrolled_window.Vadjustment == null)
            {
                return;
            }

            if (PintaCore.Workspace.HasOpenDocuments)
            {
                if (PintaCore.Workspace.Offset.X > 0)
                {
                    lower.X = -PintaCore.Workspace.Offset.X / PintaCore.Workspace.Scale;
                    upper.X = PintaCore.Workspace.ImageSize.Width - lower.X;
                }
                else
                {
                    lower.X = scrolled_window.Hadjustment.Value / PintaCore.Workspace.Scale;
                    upper.X = (scrolled_window.Hadjustment.Value + scrolled_window.Hadjustment.PageSize) / PintaCore.Workspace.Scale;
                }
                if (PintaCore.Workspace.Offset.Y > 0)
                {
                    lower.Y = -PintaCore.Workspace.Offset.Y / PintaCore.Workspace.Scale;
                    upper.Y = PintaCore.Workspace.ImageSize.Height - lower.Y;
                }
                else
                {
                    lower.Y = scrolled_window.Vadjustment.Value / PintaCore.Workspace.Scale;
                    upper.Y = (scrolled_window.Vadjustment.Value + scrolled_window.Vadjustment.PageSize) / PintaCore.Workspace.Scale;
                }
            }

            horizontal_ruler.SetRange(lower.X, upper.X, 0, upper.X);
            vertical_ruler.SetRange(lower.Y, upper.Y, 0, upper.Y);
        }