Ejemplo n.º 1
0
 public DropShadowSettingsForm(DropShadowEffect effect)
 {
     this.effect = effect;
     InitializeComponent();
     this.Icon = GreenshotResources.getGreenshotIcon();
     ShowSettings();
 }
Ejemplo n.º 2
0
        public SettingsForm(string [] languages, OCRConfiguration config)
        {
            //
            // The InitializeComponent() call is required for Windows Forms designer support.
            //
            this.config = config;
            InitializeComponent();
            AcceptButton = buttonOK;
            CancelButton = buttonCancel;
            this.Icon    = GreenshotResources.getGreenshotIcon();

            comboBox_languages.Items.Clear();
            int index = 0;

            // Preventing Tracker #3234560, although this should not happen...
            string languageFromConfig = "ENGLISH";

            if (config.Language != null)
            {
                languageFromConfig = config.Language;
            }
            foreach (string availableLanguage in languages)
            {
                string displayLanguage = availableLanguage.Substring(0, 1).ToUpper() + availableLanguage.Substring(1).ToLower();
                comboBox_languages.Items.Add(displayLanguage);
                if (availableLanguage.Equals(languageFromConfig, StringComparison.CurrentCultureIgnoreCase))
                {
                    comboBox_languages.SelectedIndex = index;
                }
                index++;
            }
        }
Ejemplo n.º 3
0
 public TornEdgeSettingsForm(TornEdgeEffect effect)
 {
     this.effect = effect;
     InitializeComponent();
     this.Icon = GreenshotResources.getGreenshotIcon();
     ShowSettings();
 }
Ejemplo n.º 4
0
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);
            Icon = GreenshotResources.getGreenshotIcon();

            // Fix for Vista/XP differences
            if (Environment.OSVersion.Version.Major >= 6)
            {
                trackBarJpegQuality.BackColor = SystemColors.Window;
            }
            else
            {
                trackBarJpegQuality.BackColor = SystemColors.Control;
            }

            // This makes it possible to still capture the settings screen
            fullscreen_hotkeyControl.Enter += EnterHotkeyControl;
            fullscreen_hotkeyControl.Leave += LeaveHotkeyControl;
            window_hotkeyControl.Enter     += EnterHotkeyControl;
            window_hotkeyControl.Leave     += LeaveHotkeyControl;
            region_hotkeyControl.Enter     += EnterHotkeyControl;
            region_hotkeyControl.Leave     += LeaveHotkeyControl;
            ie_hotkeyControl.Enter         += EnterHotkeyControl;
            ie_hotkeyControl.Leave         += LeaveHotkeyControl;
            lastregion_hotkeyControl.Enter += EnterHotkeyControl;
            lastregion_hotkeyControl.Leave += LeaveHotkeyControl;

            DisplayPluginTab();
            UpdateUI();
            ExpertSettingsEnableState(false);
            DisplaySettings();
            CheckSettings();
        }
Ejemplo n.º 5
0
 public PleaseWaitForm()
 {
     //
     // The InitializeComponent() call is required for Windows Forms designer support.
     //
     InitializeComponent();
     Icon = GreenshotResources.getGreenshotIcon();
 }
Ejemplo n.º 6
0
        public AboutForm()
        {
            InitializeComponent();
            Icon            = GreenshotResources.getGreenshotIcon();
            lblLicense.Text = @"Copyright (C) 2007-2014 Thomas Braun, Jens Klingen, Robin Krom
Greenshot comes with ABSOLUTELY NO WARRANTY. This is free software, and you are welcome to redistribute it under certain conditions.
Details about the GNU General Public License:";
        }
Ejemplo n.º 7
0
 private BugReportForm()
 {
     //
     // The InitializeComponent() call is required for Windows Forms designer support.
     //
     InitializeComponent();
     Icon = GreenshotResources.getGreenshotIcon();
     WindowDetails.ToForeground(Handle);
 }
Ejemplo n.º 8
0
 public DropShadowSettingsForm(DropShadowEffect effect)
 {
     this.effect = effect;
     InitializeComponent();
     this.Icon       = GreenshotResources.getGreenshotIcon();
     trackBar1.Value = (int)(effect.Darkness * 40);
     offsetX.Value   = effect.ShadowOffset.X;
     offsetY.Value   = effect.ShadowOffset.Y;
 }
Ejemplo n.º 9
0
 public PrintOptionsDialog()
 {
     //
     // The InitializeComponent() call is required for Windows Forms designer support.
     //
     InitializeComponent();
     Icon = GreenshotResources.getGreenshotIcon();
     checkbox_dontaskagain.Checked = false;
 }
Ejemplo n.º 10
0
 public SettingsForm(FlickrConfiguration config)
 {
     //
     // The InitializeComponent() call is required for Windows Forms designer support.
     //
     InitializeComponent();
     Icon         = GreenshotResources.getGreenshotIcon();
     CancelButton = buttonCancel;
     AcceptButton = buttonOK;
 }
Ejemplo n.º 11
0
 private LanguageDialog()
 {
     //
     // The InitializeComponent() call is required for Windows Forms designer support.
     //
     InitializeComponent();
     Icon         = GreenshotResources.getGreenshotIcon();
     Load        += FormLoad;
     FormClosing += PreventFormClose;
 }
Ejemplo n.º 12
0
 public TornEdgeSettingsForm(TornEdgeEffect effect)
 {
     this.effect = effect;
     InitializeComponent();
     this.Icon                  = GreenshotResources.getGreenshotIcon();
     trackBar1.Value            = (int)(effect.Darkness * 40);
     offsetX.Value              = effect.ShadowOffset.X;
     offsetY.Value              = effect.ShadowOffset.Y;
     toothsize.Value            = effect.ToothHeight;
     verticaltoothrange.Value   = effect.VerticalToothRange;
     horizontaltoothrange.Value = effect.HorizontalToothRange;
 }
Ejemplo n.º 13
0
 public BackgroundForm(string title, string text)
 {
     //
     // The InitializeComponent() call is required for Windows Forms designer support.
     //
     InitializeComponent();
     Icon                  = GreenshotResources.getGreenshotIcon();
     shouldClose           = false;
     Text                  = title;
     label_pleasewait.Text = text;
     FormClosing          += PreventFormClose;
     timer_checkforclose.Start();
 }
Ejemplo n.º 14
0
        public QualityDialog(SurfaceOutputSettings outputSettings)
        {
            Settings = outputSettings;
            //
            // The InitializeComponent() call is required for Windows Forms designer support.
            //
            InitializeComponent();
            Icon = GreenshotResources.getGreenshotIcon();

            checkBox_reduceColors.Checked = Settings.ReduceColors;
            trackBarJpegQuality.Enabled   = OutputFormat.jpg.Equals(outputSettings.Format);
            trackBarJpegQuality.Value     = Settings.JPGQuality;
            textBoxJpegQuality.Enabled    = OutputFormat.jpg.Equals(outputSettings.Format);
            textBoxJpegQuality.Text       = Settings.JPGQuality.ToString();
        }
Ejemplo n.º 15
0
        public OAuthLoginForm(string browserTitle, Size size, string authorizationLink, string callbackUrl)
        {
            _callbackUrl = callbackUrl;
            InitializeComponent();
            ClientSize           = size;
            Icon                 = GreenshotResources.getGreenshotIcon();
            Text                 = browserTitle;
            _addressTextBox.Text = authorizationLink;

            // The script errors are suppressed by using the ExtendedWebBrowser
            _browser.ScriptErrorsSuppressed = false;
            _browser.DocumentCompleted     += Browser_DocumentCompleted;
            _browser.Navigated  += Browser_Navigated;
            _browser.Navigating += Browser_Navigating;
            _browser.Navigate(new Uri(authorizationLink));
        }
Ejemplo n.º 16
0
        public OAuthLoginForm(string browserTitle, Size size, string authorizationLink, string callbackUrl)
        {
            this.callbackUrl = callbackUrl;
            InitializeComponent();
            ClientSize          = size;
            Icon                = GreenshotResources.getGreenshotIcon();
            Text                = browserTitle;
            addressTextBox.Text = authorizationLink;

            // The script errors are suppressed by using the ExtendedWebBrowser
            browser.ScriptErrorsSuppressed = false;
            browser.DocumentCompleted     += new WebBrowserDocumentCompletedEventHandler(browser_DocumentCompleted);
            browser.Navigate(new Uri(authorizationLink));

            WindowDetails.ToForeground(Handle);
        }
Ejemplo n.º 17
0
 protected override void OnLoad(EventArgs e)
 {
     // Every GreenshotForm should have it's default icon
     // And it might not ne needed for a Tool Window, but still for the task manager / switcher it's important
     Icon = GreenshotResources.getGreenshotIcon();
     if (!DesignMode)
     {
         FillFields();
         base.OnLoad(e);
     }
     else
     {
         LOG.Info("OnLoad called from designer.");
         InitializeForDesigner();
         base.OnLoad(e);
     }
 }
Ejemplo n.º 18
0
 public TornEdgeSettingsForm(TornEdgeEffect effect)
 {
     this.effect = effect;
     InitializeComponent();
     this.Icon = GreenshotResources.getGreenshotIcon();
     shadowCheckbox.Checked     = effect.GenerateShadow;
     shadowDarkness.Value       = (int)(effect.Darkness * 40);
     offsetX.Value              = effect.ShadowOffset.X;
     offsetY.Value              = effect.ShadowOffset.Y;
     toothsize.Value            = effect.ToothHeight;
     verticaltoothrange.Value   = effect.VerticalToothRange;
     horizontaltoothrange.Value = effect.HorizontalToothRange;
     top.Checked    = effect.Edges[0];
     right.Checked  = effect.Edges[1];
     bottom.Checked = effect.Edges[2];
     left.Checked   = effect.Edges[3];
 }
Ejemplo n.º 19
0
        public JiraForm(JiraConnector jiraConnector)
        {
            InitializeComponent();
            Icon         = GreenshotResources.getGreenshotIcon();
            AcceptButton = uploadButton;
            CancelButton = cancelButton;

            InitializeComponentText();

            _columnSorter = new GreenshotColumnSorter();
            jiraListView.ListViewItemSorter = _columnSorter;

            _jiraConnector = jiraConnector;

            ChangeModus(false);

            uploadButton.Enabled = false;
            Load += OnLoad;
        }
Ejemplo n.º 20
0
        public ResizeSettingsForm(ResizeEffect effect)
        {
            this.effect = effect;
            InitializeComponent();
            this.Icon     = GreenshotResources.getGreenshotIcon();
            value_pixel   = "Pixels";
            value_percent = "Percent";
            combobox_width.Items.Add(value_pixel);
            combobox_width.Items.Add(value_percent);
            combobox_width.SelectedItem = value_pixel;
            combobox_height.Items.Add(value_pixel);
            combobox_height.Items.Add(value_percent);
            combobox_height.SelectedItem = value_pixel;

            textbox_width.Text  = effect.Width.ToString();
            textbox_height.Text = effect.Height.ToString();
            newWidth            = effect.Width;
            newHeight           = effect.Height;
            combobox_width.SelectedIndexChanged  += new System.EventHandler(this.combobox_SelectedIndexChanged);
            combobox_height.SelectedIndexChanged += new System.EventHandler(this.combobox_SelectedIndexChanged);

            checkbox_aspectratio.Checked = effect.MaintainAspectRatio;
        }
Ejemplo n.º 21
0
        public OAuthLoginForm(string browserTitle, Size size, string authorizationLink, string callbackUrl)
        {
            // Make sure Greenshot uses the correct browser version
            IEHelper.FixBrowserVersion(false);

            _callbackUrl = callbackUrl;
            // Fix for BUG-2071
            if (callbackUrl.EndsWith("/"))
            {
                _callbackUrl = callbackUrl.Substring(0, callbackUrl.Length - 1);
            }
            InitializeComponent();
            ClientSize           = size;
            Icon                 = GreenshotResources.getGreenshotIcon();
            Text                 = browserTitle;
            _addressTextBox.Text = authorizationLink;

            // The script errors are suppressed by using the ExtendedWebBrowser
            _browser.ScriptErrorsSuppressed = false;
            _browser.DocumentCompleted     += Browser_DocumentCompleted;
            _browser.Navigated  += Browser_Navigated;
            _browser.Navigating += Browser_Navigating;
            _browser.Navigate(new Uri(authorizationLink));
        }
Ejemplo n.º 22
0
        /// <summary>
        /// Constructor
        /// </summary>
        public AboutForm()
        {
            // Make sure our resources are removed again.
            Disposed    += Cleanup;
            FormClosing += Cleanup;

            // Enable animation for this form, when we don't set this the timer doesn't start as soon as the form is loaded.
            EnableAnimation = true;
            //
            // The InitializeComponent() call is required for Windows Forms designer support.
            //
            InitializeComponent();

            // Only use double-buffering when we are NOT in a Terminal Server session
            DoubleBuffered = !isTerminalServerSession;

            // Not needed for a Tool Window, but still for the task manager it's important
            Icon = GreenshotResources.getGreenshotIcon();

            // Use the self drawn image, first we create the background to be the backcolor (as we animate from this)
            gBitmap           = ImageHelper.CreateEmpty(90, 90, PixelFormat.Format24bppRgb, BackColor, 96, 96);
            pictureBox1.Image = gBitmap;
            Version v = Assembly.GetExecutingAssembly().GetName().Version;

            // Format is like this:  AssemblyVersion("Major.Minor.Build.Revision")]
            lblTitle.Text = "Greenshot " + v.Major + "." + v.Minor + "." + v.Build + " Build " + v.Revision + (IniConfig.IsPortable ? " Portable" : "") + (" (" + OSInfo.Bits + " bit)");

            //Random rand = new Random();

            // Number of frames the pixel animation takes
            int frames = FramesForMillis(2000);

            // The number of frames the color-cycle waits before it starts
            waitFrames = FramesForMillis(6000);

            // Every pixel is created after pixelWaitFrames frames, which is increased in the loop.
            int pixelWaitFrames = FramesForMillis(2000);

            // Create pixels
            for (int index = 0; index < gSpots.Count; index++)
            {
                // Read the pixels in the order of the flow
                Point gSpot = gSpots[flowOrder[index]];
                // Create the animation, first we do nothing (on the final destination)
                RectangleAnimator pixelAnimation;

                // Make the pixel grom from the middle, if this offset isn't used it looks like it's shifted
                int offset = (w - 2) / 2;

                // If the optimize for Terminal Server is set we make the animation without much ado
                if (isTerminalServerSession)
                {
                    // No animation
                    pixelAnimation = new RectangleAnimator(new Rectangle(gSpot.X, gSpot.Y, w - 2, w - 2), new Rectangle(gSpot.X, gSpot.Y, w - 2, w - 2), 1, EasingType.Cubic, EasingMode.EaseIn);
                }
                else
                {
                    // Create the animation, first we do nothing (on the final destination)
                    Rectangle standingStill = new Rectangle(gSpot.X + offset, gSpot.Y + offset, 0, 0);
                    pixelAnimation = new RectangleAnimator(standingStill, standingStill, pixelWaitFrames, EasingType.Quintic, EasingMode.EaseIn);
                    // And than we size to the wanted size.
                    pixelAnimation.QueueDestinationLeg(new Rectangle(gSpot.X, gSpot.Y, w - 2, w - 2), frames);
                }
                // Increase the wait frames
                pixelWaitFrames += FramesForMillis(100);
                // Add to the list of to be animated pixels
                pixels.Add(pixelAnimation);
                // Add a color to the list for this pixel.
                pixelColors.Add(pixelColor);
            }
            // Make sure the frame "loop" knows we have to animate
            hasAnimationsLeft = true;

            // Pixel Color cycle colors, here we use a pre-animated loop which stores the values.
            ColorAnimator pixelColorAnimator = new ColorAnimator(pixelColor, Color.FromArgb(255, 255, 255), 6, EasingType.Quadratic, EasingMode.EaseIn);

            pixelColorAnimator.QueueDestinationLeg(pixelColor, 6, EasingType.Quadratic, EasingMode.EaseOut);
            do
            {
                colorFlow.Add(pixelColorAnimator.Current);
                pixelColorAnimator.Next();
            } while (pixelColorAnimator.hasNext);

            // color animation for the background
            backgroundAnimation = new ColorAnimator(BackColor, backColor, FramesForMillis(5000), EasingType.Linear, EasingMode.EaseIn);
        }
Ejemplo n.º 23
0
        /// <summary>
        /// Share the screenshot with a windows app
        /// </summary>
        /// <param name="manuallyInitiated"></param>
        /// <param name="surface"></param>
        /// <param name="captureDetails"></param>
        /// <returns>ExportInformation</returns>
        public override ExportInformation ExportCapture(bool manuallyInitiated, ISurface surface, ICaptureDetails captureDetails)
        {
            var exportInformation = new ExportInformation(Designation, Description);

            try
            {
                var handle = PluginUtils.Host.GreenshotForm.Handle;

                var exportTarget = Task.Run(async() =>
                {
                    var taskCompletionSource = new TaskCompletionSource <string>();

                    using (var imageStream = new MemoryRandomAccessStream())
                        using (var logoStream = new MemoryRandomAccessStream())
                            using (var thumbnailStream = new MemoryRandomAccessStream())
                            {
                                var outputSettings = new SurfaceOutputSettings();
                                outputSettings.PreventGreenshotFormat();

                                // Create capture for export
                                ImageOutput.SaveToStream(surface, imageStream, outputSettings);
                                imageStream.Position = 0;
                                Log.Info("Created RandomAccessStreamReference for the image");
                                var imageRandomAccessStreamReference = RandomAccessStreamReference.CreateFromStream(imageStream);
                                RandomAccessStreamReference thumbnailRandomAccessStreamReference;
                                RandomAccessStreamReference logoRandomAccessStreamReference;

                                // Create thumbnail
                                using (var tmpImageForThumbnail = surface.GetImageForExport())
                                {
                                    using (var thumbnail = ImageHelper.CreateThumbnail(tmpImageForThumbnail, 240, 160))
                                    {
                                        ImageOutput.SaveToStream(thumbnail, null, thumbnailStream, outputSettings);
                                        thumbnailStream.Position             = 0;
                                        thumbnailRandomAccessStreamReference = RandomAccessStreamReference.CreateFromStream(thumbnailStream);
                                        Log.Info("Created RandomAccessStreamReference for the thumbnail");
                                    }
                                }
                                // Create logo
                                using (var logo = GreenshotResources.getGreenshotIcon().ToBitmap())
                                {
                                    using (var logoThumbnail = ImageHelper.CreateThumbnail(logo, 30, 30))
                                    {
                                        ImageOutput.SaveToStream(logoThumbnail, null, logoStream, outputSettings);
                                        logoStream.Position             = 0;
                                        logoRandomAccessStreamReference = RandomAccessStreamReference.CreateFromStream(logoStream);
                                        Log.Info("Created RandomAccessStreamReference for the logo");
                                    }
                                }
                                string applicationName        = null;
                                var dataTransferManagerHelper = new DataTransferManagerHelper(handle);
                                dataTransferManagerHelper.DataTransferManager.TargetApplicationChosen += (dtm, args) =>
                                {
                                    Log.InfoFormat("Trying to share with {0}", args.ApplicationName);
                                    applicationName = args.ApplicationName;
                                };
                                var filename    = FilenameHelper.GetFilename(OutputFormat.png, captureDetails);
                                var storageFile = await StorageFile.CreateStreamedFileAsync(filename, async streamedFileDataRequest =>
                                {
                                    // Information on how was found here: https://socialeboladev.wordpress.com/2013/03/15/how-to-use-createstreamedfileasync/
                                    Log.DebugFormat("Creating deferred file {0}", filename);
                                    try
                                    {
                                        using (var deferredStream = streamedFileDataRequest.AsStreamForWrite())
                                        {
                                            await imageStream.CopyToAsync(deferredStream).ConfigureAwait(false);
                                            await imageStream.FlushAsync().ConfigureAwait(false);
                                        }
                                        // Signal that the stream is ready
                                        streamedFileDataRequest.Dispose();
                                    }
                                    catch (Exception)
                                    {
                                        streamedFileDataRequest.FailAndClose(StreamedFileFailureMode.Incomplete);
                                    }
                                    // Signal transfer ready to the await down below
                                    taskCompletionSource.TrySetResult(applicationName);
                                }, imageRandomAccessStreamReference).AsTask().ConfigureAwait(false);

                                dataTransferManagerHelper.DataTransferManager.DataRequested += (sender, args) =>
                                {
                                    var deferral = args.Request.GetDeferral();
                                    args.Request.Data.OperationCompleted += (dp, eventArgs) =>
                                    {
                                        Log.DebugFormat("OperationCompleted: {0}, shared with", eventArgs.Operation);
                                        taskCompletionSource.TrySetResult(applicationName);
                                    };
                                    var dataPackage = args.Request.Data;
                                    dataPackage.Properties.Title               = captureDetails.Title;
                                    dataPackage.Properties.ApplicationName     = "Greenshot";
                                    dataPackage.Properties.Description         = "Share a screenshot";
                                    dataPackage.Properties.Thumbnail           = thumbnailRandomAccessStreamReference;
                                    dataPackage.Properties.Square30x30Logo     = logoRandomAccessStreamReference;
                                    dataPackage.Properties.LogoBackgroundColor = Color.FromArgb(0xff, 0x3d, 0x3d, 0x3d);
                                    dataPackage.SetStorageItems(new List <IStorageItem> {
                                        storageFile
                                    });
                                    dataPackage.SetBitmap(imageRandomAccessStreamReference);
                                    dataPackage.Destroyed += (dp, o) =>
                                    {
                                        Log.Debug("Destroyed.");
                                    };
                                    deferral.Complete();
                                };
                                dataTransferManagerHelper.ShowShareUi();
                                return(await taskCompletionSource.Task.ConfigureAwait(false));
                            }
                }).Result;
                if (string.IsNullOrWhiteSpace(exportTarget))
                {
                    exportInformation.ExportMade = false;
                }
                else
                {
                    exportInformation.ExportMade             = true;
                    exportInformation.DestinationDescription = exportTarget;
                }
            }
            catch (Exception ex)
            {
                exportInformation.ExportMade   = false;
                exportInformation.ErrorMessage = ex.Message;
            }

            ProcessExport(exportInformation, surface);
            return(exportInformation);
        }
Ejemplo n.º 24
0
 public EditorSettingsForm()
 {
     InitializeComponent();
     Icon = GreenshotResources.getGreenshotIcon();
     LoadSettings();
 }