예제 #1
0
 public void ShowHideLoupe()
 {
     if (loupe == null)
     {
         loupe            = new Loupe(this);
         loupe.Destroyed += HandleLoupeDestroy;
         loupe.Show();
     }
     else
     {
         loupe.Destroy();
     }
 }
예제 #2
0
        private void HandleKeyPressEvent(object sender, Gtk.KeyPressEventArgs args)
        {
            // FIXME I really need to figure out why overriding is not working
            // for any of the default handlers.
            args.RetVal = true;

            // Check for KeyPad arrow keys, which scroll the window when zoomed in
            // but should go to the next/previous photo when not zoomed (no scrollbars)
            if (this.Fit)
            {
                switch (args.Event.Key)
                {
                case Gdk.Key.Up:
                case Gdk.Key.Left:
                case Gdk.Key.KP_Up:
                case Gdk.Key.KP_Left:
                    this.Item.MovePrevious();
                    return;

                case Gdk.Key.Down:
                case Gdk.Key.Right:
                case Gdk.Key.KP_Down:
                case Gdk.Key.KP_Right:
                    this.Item.MoveNext();
                    return;
                }
            }

            switch (args.Event.Key)
            {
            case Gdk.Key.Up:
            case Gdk.Key.Left:
            case Gdk.Key.Page_Up:
            case Gdk.Key.KP_Page_Up:
                this.Item.MovePrevious();
                break;

            case Gdk.Key.Home:
            case Gdk.Key.KP_Home:
                this.Item.Index = 0;
                break;

            case Gdk.Key.End:
            case Gdk.Key.KP_End:
                this.Item.Index = this.Query.Count - 1;
                break;

            case Gdk.Key.Down:
            case Gdk.Key.Right:
            case Gdk.Key.Page_Down:
            case Gdk.Key.KP_Page_Down:
            case Gdk.Key.space:
            case Gdk.Key.KP_Space:
                this.Item.MoveNext();
                break;

            case Gdk.Key.Key_0:
            case Gdk.Key.KP_0:
                this.Fit = true;
                break;

            case Gdk.Key.Key_1:
            case Gdk.Key.KP_1:
                this.Zoom = 1.0;
                break;

            case Gdk.Key.Key_2:
            case Gdk.Key.KP_2:
                this.Zoom = 2.0;
                break;

            case Gdk.Key.minus:
            case Gdk.Key.KP_Subtract:
                ZoomOut();
                break;

            case Gdk.Key.s:
                if (sharpener == null)
                {
                    sharpener            = new Sharpener(this);
                    sharpener.Destroyed += HandleLoupeDestroy;
                }

                sharpener.Show();
                break;

            case Gdk.Key.v:
                if (loupe == null)
                {
                    loupe            = new Loupe(this);
                    loupe.Destroyed += HandleLoupeDestroy;
                    loupe.Show();
                }
                else
                {
                    loupe.Destroy();
                }
                break;

            case Gdk.Key.e:
                Editor = new FSpot.Editors.SoftFocus(this);
                break;

            case Gdk.Key.equal:
            case Gdk.Key.plus:
            case Gdk.Key.KP_Add:
                ZoomIn();
                break;

            default:
                args.RetVal = false;
                return;
            }

            return;
        }