Ejemplo n.º 1
0
 ///<summary>
 ///  Executes action on left left rich-textbox
 ///</summary>
 ///<param name="action"> <see cref="ViewActions" /> </param>
 ///<returns> <code>true</code> if view active, <code>false</code> otherwise </returns>
 public static bool ExecuteActionOnView(ViewActions action)
 {
     if (_this != null)
       {
     switch (action)
     {
       case ViewActions.NextSong:
     _this.MoveNext_Handler(_this, EventArgs.Empty);
     break;
       case ViewActions.PreviewsSong:
     _this.MovePrevious_Handler(_this, EventArgs.Empty);
     break;
       case ViewActions.ScrollUp:
     _this._richTextBox1.ScrollUp();
     break;
       case ViewActions.ScrollDown:
     _this._richTextBox1.ScrollDown();
     break;
       case ViewActions.ScrollPageUp:
     _this._richTextBox1.ScrollPageUp();
     break;
       case ViewActions.ScrollPageDown:
     _this._richTextBox1.ScrollPageDown();
     break;
       case ViewActions.ScrollToTop:
     _this._richTextBox1.ScrollToTop();
     break;
       case ViewActions.ScrollToEnd:
     _this._richTextBox1.ScrollToBottom();
     break;
       default:
     break;
     }
     return true;
       }
       return false;
 }
Ejemplo n.º 2
0
        private void ZoomToWindow_Activated(object sender, EventArgs e)
        {
            // The image is small enough to fit in the window
            if (PintaCore.Workspace.ImageFitsInWindow)
            {
                PintaCore.Actions.View.ActualSize.Activate();
            }
            else
            {
                int image_x = PintaCore.Workspace.ImageSize.Width;
                int image_y = PintaCore.Workspace.ImageSize.Height;

                var canvas_window = PintaCore.Workspace.ActiveWorkspace.Canvas.Parent;

                var window_x = canvas_window.Allocation.Width;
                var window_y = canvas_window.Allocation.Height;

                double ratio;

                // The image is more constrained by width than height
                if ((double)image_x / (double)window_x >= (double)image_y / (double)window_y)
                {
                    ratio = (double)(window_x - 20) / (double)image_x;
                }
                else
                {
                    ratio = (double)(window_y - 20) / (double)image_y;
                }

                PintaCore.Workspace.Scale = ratio;
                PintaCore.Actions.View.SuspendZoomUpdate();
                (PintaCore.Actions.View.ZoomComboBox.ComboBox as ComboBoxEntry).Entry.Text = ViewActions.ToPercent(PintaCore.Workspace.Scale);
                PintaCore.Actions.View.ResumeZoomUpdate();
            }

            PintaCore.Actions.View.ZoomToWindowActivated = true;
        }
Ejemplo n.º 3
0
        private void ActiveDocumentChanged(object sender, EventArgs e)
        {
            if (PintaCore.Workspace.HasOpenDocuments)
            {
                PintaCore.Actions.View.SuspendZoomUpdate();
                (PintaCore.Actions.View.ZoomComboBox.ComboBox as Gtk.ComboBoxEntry).Entry.Text = ViewActions.ToPercent(PintaCore.Workspace.Scale);
                PintaCore.Actions.View.ResumeZoomUpdate();

                var doc = PintaCore.Workspace.ActiveDocument;
                var tab = FindTabWithCanvas((PintaCanvas)doc.Workspace.Canvas);

                if (tab != null)
                {
                    // We need to suppress because ActivateTab changes both the notebook
                    // and the tab, and we handle both events, so when it fires the notebook
                    // changed event, the tab has not been changed yet.
                    suppress_active_notebook_change = true;
                    dock_container.ActivateTab(tab);
                    suppress_active_notebook_change = false;
                }

                doc.Workspace.Canvas.GrabFocus();
            }
        }
Ejemplo n.º 4
0
        private void ActiveDocumentChanged(object sender, EventArgs e)
        {
            if (PintaCore.Workspace.HasOpenDocuments)
            {
                PintaCore.Actions.View.SuspendZoomUpdate();
                (PintaCore.Actions.View.ZoomComboBox.ComboBox as Gtk.ComboBoxEntry).Entry.Text = ViewActions.ToPercent(PintaCore.Workspace.Scale);
                PintaCore.Actions.View.ResumeZoomUpdate();

                PintaCore.Workspace.OnCanvasSizeChanged();
            }

            PintaCore.Workspace.Invalidate();
        }