Exemple #1
0
        /// <summary>
        /// Helper method to add a plugin MenuItem to the Greenshot context menu
        /// </summary>
        /// <param name="imageEditor"></param>
        /// <param name="item"></param>
        public static void AddToContextMenu(IGreenshotHost host, ToolStripMenuItem item)
        {
            // Here we can hang ourselves to the main context menu!
            ContextMenuStrip contextMenu = host.MainMenu;
            bool addedItem = false;

            // Try to find a separator, so we insert ourselves after it
            for (int i = 0; i < contextMenu.Items.Count; i++)
            {
                if (contextMenu.Items[i].GetType() == typeof(ToolStripSeparator))
                {
                    // Check if we need to add a new separator, which is done if the first found has a Tag with the value "PluginsAreAddedBefore"
                    if ("PluginsAreAddedBefore".Equals(contextMenu.Items[i].Tag))
                    {
                        ToolStripSeparator separator = new ToolStripSeparator();
                        separator.Tag = "PluginsAreAddedAfter";
                        separator.Size = new Size(305, 6);
                        contextMenu.Items.Insert(i, separator);
                    }
                    else if (!"PluginsAreAddedAfter".Equals(contextMenu.Items[i].Tag))
                    {
                        continue;
                    }
                    contextMenu.Items.Insert(i + 1, item);
                    addedItem = true;
                    break;
                }
            }
            // If we didn't insert the item, we just add it...
            if (!addedItem)
            {
                contextMenu.Items.Add(item);
            }
        }
Exemple #2
0
		/// <summary>
		/// Implementation of the IGreenshotPlugin.Initialize
		/// </summary>
		/// <param name="pluginHost">Use the IGreenshotPluginHost interface to register events</param>
		/// <param name="captureHost">Use the ICaptureHost interface to register in the MainContextMenu</param>
		/// <param name="pluginAttribute">My own attributes</param>
		/// <returns>true if plugin is initialized, false if not (doesn't show)</returns>
		public virtual bool Initialize(IGreenshotHost pluginHost, PluginAttribute myAttributes) {
			LOG.Debug("Initialize called of " + myAttributes.Name);
			
			this.host = pluginHost;
			this.myAttributes = myAttributes;
			return true;
		}
Exemple #3
0
        /// <summary>
        /// Implementation of the IGreenshotPlugin.Initialize
        /// </summary>
        /// <param name="host">Use the IGreenshotPluginHost interface to register events</param>
        /// <param name="metadata">IDictionary<string, object></param>
        /// <returns>true if plugin is initialized, false if not (doesn't show)</returns>
        public override bool Initialize(IGreenshotHost pluginHost, IDictionary <string, object> metadata)
        {
            this.host = pluginHost;

            // Register configuration (don't need the configuration itself)
            config    = IniConfig.GetIniSection <DropboxPluginConfiguration>();
            resources = new ComponentResourceManager(typeof(DropboxPlugin));

            // Register our configuration
            SettingsWindow.RegisterSettingsPage <DropboxSettingsPage>("settings_plugins,dropbox.settings_title");
            return(true);
        }
        public bool Initialize(IGreenshotHost host, PluginAttribute pluginAttribute)
        {
            _config = IniConfig.GetIniSection<OovgConfiguration>();

            _ctxMenu = new ToolStripMenuItem();
            _ctxMenu.Text = "Configure oo.vg";
            _ctxMenu.Tag = host;
            _ctxMenu.Click += _ctxMenu_Click;

            PluginUtils.AddToContextMenu(host, _ctxMenu);

            return true;
        }
Exemple #5
0
        /// <summary>
        /// Implementation of the IGreenshotPlugin.Initialize
        /// </summary>
        /// <param name="host">Use the IGreenshotPluginHost interface to register events</param>
        /// <param name="metadata">IDictionary<string, object></param>
        /// <returns>true if plugin is initialized, false if not (doesn't show)</returns>
        public override bool Initialize(IGreenshotHost pluginHost, IDictionary <string, object> metadata)
        {
            host = pluginHost;

            // Register configuration (don't need the configuration itself)
            config = IniConfig.GetIniSection <ConfluenceConfiguration>();
            if (config.IsDirty)
            {
                IniConfig.Save();
            }
            // Register our configuration
            SettingsWindow.RegisterSettingsPage <ConfluenceSettingsPage>("settings_plugins,confluence.plugin_settings");
            return(true);
        }
Exemple #6
0
        /// <summary>
        /// Implementation of the IGreenshotPlugin.Initialize
        /// </summary>
        /// <param name="host">Use the IGreenshotPluginHost interface to register events</param>
        /// <param name="metadata">IDictionary<string, object></param>
        /// <returns>true if plugin is initialized, false if not (doesn't show)</returns>
        public override bool Initialize(IGreenshotHost pluginHost, IDictionary <string, object> metadata)
        {
            host = pluginHost;

            OCR_COMMAND = Path.Combine(Path.GetDirectoryName(Assembly.GetAssembly(typeof(OcrPlugin)).Location), "greenshotocrcommand.exe");

            if (!HasMODI())
            {
                LOG.Warn("No MODI found!");
                //return false;
            }
            // Register our configuration
            SettingsWindow.RegisterSettingsPage <OCRSettingsPage>("settings_plugins,ocr.settings_title");
            return(true);
        }
Exemple #7
0
        /// <summary>
        /// Implementation of the IGreenshotPlugin.Initialize
        /// </summary>
        /// <param name="pluginHost">Use the IGreenshotPluginHost interface to register events</param>
        /// <param name="myAttributes">My own attributes</param>
        /// <returns>true if plugin is initialized, false if not (doesn't show)</returns>
        public bool Initialize(IGreenshotHost pluginHost, PluginAttribute myAttributes)
        {
            // Register configuration (don't need the configuration itself)
            _config = IniConfig.GetIniSection <JiraConfiguration>();

            // Make sure the loggin is enable for the corect level.
            if (Log.IsDebugEnabled)
            {
                LogSettings.RegisterDefaultLogger <Log4NetLogger>(LogLevels.Verbose);
            }
            else if (Log.IsInfoEnabled)
            {
                LogSettings.RegisterDefaultLogger <Log4NetLogger>(LogLevels.Info);
            }
            else if (Log.IsWarnEnabled)
            {
                LogSettings.RegisterDefaultLogger <Log4NetLogger>(LogLevels.Warn);
            }
            else if (Log.IsErrorEnabled)
            {
                LogSettings.RegisterDefaultLogger <Log4NetLogger>(LogLevels.Error);
            }
            else if (Log.IsErrorEnabled)
            {
                LogSettings.RegisterDefaultLogger <Log4NetLogger>(LogLevels.Error);
            }
            else
            {
                LogSettings.RegisterDefaultLogger <Log4NetLogger>(LogLevels.Fatal);
            }

            // Add a SVG converter, although it doesn't fit to the Jira plugin there is currently no other way
            ImageHelper.StreamConverters["svg"] = (stream, s) =>
            {
                stream.Position = 0;
                try
                {
                    return(SvgImage.FromStream(stream).Image);
                }
                catch (Exception ex)
                {
                    Log.Error("Can't load SVG", ex);
                }
                return(null);
            };

            return(true);
        }
Exemple #8
0
		/// <summary>
		/// Implementation of the IGreenshotPlugin.Initialize
		/// </summary>
		/// <param name="host">Use the IGreenshotPluginHost interface to register events</param>
		/// <param name="captureHost">Use the ICaptureHost interface to register in the MainContextMenu</param>
		/// <param name="pluginAttribute">My own attributes</param>
		public virtual bool Initialize(IGreenshotHost pluginHost, PluginAttribute myAttributes) {
			this.host = (IGreenshotHost)pluginHost;
			Attributes = myAttributes;

			// Get configuration
			config = IniConfig.GetIniSection<PicasaConfiguration>();
			resources = new ComponentResourceManager(typeof(PicasaPlugin));

			itemPlugInRoot = new ToolStripMenuItem();
			itemPlugInRoot.Text = Language.GetString("picasa", LangKey.Configure);
			itemPlugInRoot.Tag = host;
			itemPlugInRoot.Image = (Image)resources.GetObject("Picasa");
			itemPlugInRoot.Click += new System.EventHandler(ConfigMenuClick);
			PluginUtils.AddToContextMenu(host, itemPlugInRoot);
			Language.LanguageChanged += new LanguageChangedHandler(OnLanguageChanged);
			return true;
		}
Exemple #9
0
 /// <summary>
 /// Implementation of the IGreenshotPlugin.Initialize
 /// </summary>
 /// <param name="pluginHost">Use the IGreenshotPluginHost interface to register events</param>
 /// <param name="myAttributes">My own attributes</param>
 public virtual bool Initialize(IGreenshotHost pluginHost, PluginAttribute myAttributes)
 {
     // Register configuration (don't need the configuration itself)
     _config = IniConfig.GetIniSection <ConfluenceConfiguration>();
     if (_config.IsDirty)
     {
         IniConfig.Save();
     }
     try {
         TranslationManager.Instance.TranslationProvider = new LanguageXMLTranslationProvider();
         //resources = new ComponentResourceManager(typeof(ConfluencePlugin));
     } catch (Exception ex) {
         LOG.ErrorFormat("Problem in ConfluencePlugin.Initialize: {0}", ex.Message);
         return(false);
     }
     return(true);
 }
Exemple #10
0
        /// <summary>
        /// Implementation of the IGreenshotPlugin.Initialize
        /// </summary>
        /// <param name="pluginHost">Use the IGreenshotPluginHost interface to register events</param>
        /// <param name="myAttributes">My own attributes</param>
        /// <returns>true if plugin is initialized, false if not (doesn't show)</returns>
        public virtual bool Initialize(IGreenshotHost pluginHost, PluginAttribute myAttributes)
        {
            _host      = pluginHost;
            Attributes = myAttributes;

            // Get configuration
            _config    = IniConfig.GetIniSection <ImgurConfiguration>();
            _resources = new ComponentResourceManager(typeof(ImgurPlugin));

            ToolStripMenuItem itemPlugInRoot = new ToolStripMenuItem("Imgur")
            {
                Image = (Image)_resources.GetObject("Imgur")
            };

            _historyMenuItem = new ToolStripMenuItem(Language.GetString("imgur", LangKey.history))
            {
                Tag = _host
            };
            _historyMenuItem.Click += delegate {
                ImgurHistory.ShowHistory();
            };
            itemPlugInRoot.DropDownItems.Add(_historyMenuItem);

            _itemPlugInConfig = new ToolStripMenuItem(Language.GetString("imgur", LangKey.configure))
            {
                Tag = _host
            };
            _itemPlugInConfig.Click += delegate {
                _config.ShowConfigDialog();
            };
            itemPlugInRoot.DropDownItems.Add(_itemPlugInConfig);

            PluginUtils.AddToContextMenu(_host, itemPlugInRoot);
            Language.LanguageChanged += OnLanguageChanged;

            // retrieve history in the background
            Thread backgroundTask = new Thread(CheckHistory)
            {
                Name         = "Imgur History",
                IsBackground = true
            };

            backgroundTask.SetApartmentState(ApartmentState.STA);
            backgroundTask.Start();
            return(true);
        }
Exemple #11
0
		/// <summary>
		/// Implementation of the IGreenshotPlugin.Initialize
		/// </summary>
		/// <param name="pluginHost">Use the IGreenshotPluginHost interface to register events</param>
		/// <param name="pluginAttribute">My own attributes</param>
		public virtual bool Initialize(IGreenshotHost pluginHost, PluginAttribute pluginAttribute) {
			_host = pluginHost;
			Attributes = pluginAttribute;

			// Register configuration (don't need the configuration itself)
			_config = IniConfig.GetIniSection<BoxConfiguration>();
			_resources = new ComponentResourceManager(typeof(BoxPlugin));

			_itemPlugInConfig = new ToolStripMenuItem {
				Image = (Image) _resources.GetObject("Box"),
				Text = Language.GetString("box", LangKey.Configure)
			};
			_itemPlugInConfig.Click += ConfigMenuClick;

			PluginUtils.AddToContextMenu(_host, _itemPlugInConfig);
			Language.LanguageChanged += OnLanguageChanged;
			return true;
		}
Exemple #12
0
		/// <summary>
		/// Implementation of the IGreenshotPlugin.Initialize
		/// </summary>
		/// <param name="host">Use the IGreenshotPluginHost interface to register events</param>
		/// <param name="pluginAttribute">My own attributes</param>
		public virtual bool Initialize(IGreenshotHost pluginHost, PluginAttribute myAttributes) {
			this.host = (IGreenshotHost)pluginHost;
			Attributes = myAttributes;

			// Register configuration (don't need the configuration itself)
			config = IniConfig.GetIniSection<DropboxPluginConfiguration>();
			resources = new ComponentResourceManager(typeof(DropboxPlugin));

			itemPlugInConfig = new ToolStripMenuItem();
			itemPlugInConfig.Text = Language.GetString("dropbox", LangKey.Configure);
			itemPlugInConfig.Tag = host;
			itemPlugInConfig.Click += new System.EventHandler(ConfigMenuClick);
			itemPlugInConfig.Image = (Image)resources.GetObject("Dropbox");

			PluginUtils.AddToContextMenu(host, itemPlugInConfig);
			Language.LanguageChanged += new LanguageChangedHandler(OnLanguageChanged);
			return true;
		}
        /// <summary>
        /// Implementation of the IGreenshotPlugin.Initialize
        /// </summary>
        /// <param name="host">Use the IGreenshotPluginHost interface to register events</param>
        /// <param name="captureHost">Use the ICaptureHost interface to register in the MainContextMenu</param>
        /// <param name="pluginAttribute">My own attributes</param>
        public virtual bool Initialize(IGreenshotHost pluginHost, PluginAttribute myAttributes)
        {
            this.host  = (IGreenshotHost)pluginHost;
            Attributes = myAttributes;

            // Get configuration
            config    = IniConfig.GetIniSection <PicasaConfiguration>();
            resources = new ComponentResourceManager(typeof(PicasaPlugin));

            itemPlugInRoot        = new ToolStripMenuItem();
            itemPlugInRoot.Text   = Language.GetString("picasa", LangKey.Configure);
            itemPlugInRoot.Tag    = host;
            itemPlugInRoot.Image  = (Image)resources.GetObject("Picasa");
            itemPlugInRoot.Click += new System.EventHandler(ConfigMenuClick);
            PluginUtils.AddToContextMenu(host, itemPlugInRoot);
            Language.LanguageChanged += new LanguageChangedHandler(OnLanguageChanged);
            return(true);
        }
Exemple #14
0
		/// <summary>
		/// Implementation of the IGreenshotPlugin.Initialize
		/// </summary>
		/// <param name="host">Use the IGreenshotPluginHost interface to register events</param>
		/// <param name="captureHost">Use the ICaptureHost interface to register in the MainContextMenu</param>
		/// <param name="pluginAttribute">My own attributes</param>
		/// <returns>true if plugin is initialized, false if not (doesn't show)</returns>
		public virtual bool Initialize(IGreenshotHost pluginHost, PluginAttribute myAttributes) {
			this.host = (IGreenshotHost)pluginHost;
			Attributes = myAttributes;

			// Get configuration
			config = IniConfig.GetIniSection<PhotobucketConfiguration>();
			resources = new ComponentResourceManager(typeof(PhotobucketPlugin));
			
			itemPlugInConfig = new ToolStripMenuItem(Language.GetString("photobucket", LangKey.configure));
			itemPlugInConfig.Tag = host;
			itemPlugInConfig.Click += delegate {
				config.ShowConfigDialog();
			};
			itemPlugInConfig.Image = (Image)resources.GetObject("Photobucket");

			PluginUtils.AddToContextMenu(host, itemPlugInConfig);
			Language.LanguageChanged += new LanguageChangedHandler(OnLanguageChanged);
			return true;
		}
Exemple #15
0
        /// <summary>
        /// Implementation of the IGreenshotPlugin.Initialize
        /// </summary>
        /// <param name="pluginHost">Use the IGreenshotPluginHost interface to register events</param>
        /// <param name="pluginAttribute">My own attributes</param>
        public virtual bool Initialize(IGreenshotHost pluginHost, PluginAttribute pluginAttribute)
        {
            _host      = pluginHost;
            Attributes = pluginAttribute;

            // Register configuration (don't need the configuration itself)
            _config    = IniConfig.GetIniSection <BoxConfiguration>();
            _resources = new ComponentResourceManager(typeof(BoxPlugin));

            _itemPlugInConfig = new ToolStripMenuItem {
                Image = (Image)_resources.GetObject("Box"),
                Text  = Language.GetString("box", LangKey.Configure)
            };
            _itemPlugInConfig.Click += ConfigMenuClick;

            PluginUtils.AddToContextMenu(_host, _itemPlugInConfig);
            Language.LanguageChanged += OnLanguageChanged;
            return(true);
        }
        /// <summary>
        /// Helper method to add a MenuItem to the Greenshot context menu
        /// </summary>
        /// <param name="imageEditor"></param>
        /// <param name="item"></param>
        public static void AddToContextMenu(IGreenshotHost host, ToolStripMenuItem item)
        {
            // Here we can hang ourselves to the main context menu!
            ContextMenuStrip contextMenu = host.MainMenu;
            bool addedItem = false;

            // Try to find a separator, so we insert ourselves after it
            for(int i=0; i < contextMenu.Items.Count; i++) {
                if (contextMenu.Items[i].GetType() == typeof(ToolStripSeparator)) {
                    contextMenu.Items.Insert(i+1, item);
                    addedItem = true;
                    break;
                }
            }
            // If we didn't insert the item, we just add it...
            if (!addedItem) {
                contextMenu.Items.Add(item);
            }
        }
Exemple #17
0
        /// <summary>
        /// Implementation of the IGreenshotPlugin.Initialize
        /// </summary>
        /// <param name="host">Use the IGreenshotPluginHost interface to register events</param>
        /// <param name="pluginAttribute">My own attributes</param>
        public virtual bool Initialize(IGreenshotHost pluginHost, PluginAttribute myAttributes)
        {
            this.host  = (IGreenshotHost)pluginHost;
            Attributes = myAttributes;

            // Register configuration (don't need the configuration itself)
            config    = IniConfig.GetIniSection <DropboxPluginConfiguration>();
            resources = new ComponentResourceManager(typeof(DropboxPlugin));

            itemPlugInConfig        = new ToolStripMenuItem();
            itemPlugInConfig.Text   = Language.GetString("dropbox", LangKey.Configure);
            itemPlugInConfig.Tag    = host;
            itemPlugInConfig.Click += new System.EventHandler(ConfigMenuClick);
            itemPlugInConfig.Image  = (Image)resources.GetObject("Dropbox");

            PluginUtils.AddToContextMenu(host, itemPlugInConfig);
            Language.LanguageChanged += new LanguageChangedHandler(OnLanguageChanged);
            return(true);
        }
Exemple #18
0
        /// <summary>
        /// Implementation of the IGreenshotPlugin.Initialize
        /// </summary>
        /// <param name="pluginHost">Use the IGreenshotPluginHost interface to register events</param>
        /// <param name="myAttributes">My own attributes</param>
        public virtual bool Initialize(IGreenshotHost pluginHost, PluginAttribute myAttributes)
        {
            _host      = pluginHost;
            Attributes = myAttributes;

            // Get configuration
            _config    = IniConfig.GetIniSection <PicasaConfiguration>();
            _resources = new ComponentResourceManager(typeof(PicasaPlugin));

            _itemPlugInRoot = new ToolStripMenuItem
            {
                Text  = Language.GetString("picasa", LangKey.Configure),
                Tag   = _host,
                Image = (Image)_resources.GetObject("Picasa")
            };
            _itemPlugInRoot.Click += ConfigMenuClick;
            PluginUtils.AddToContextMenu(_host, _itemPlugInRoot);
            Language.LanguageChanged += OnLanguageChanged;
            return(true);
        }
        /// <summary>
        /// Implementation of the IGreenshotPlugin.Initialize
        /// </summary>
        /// <param name="host">Use the IGreenshotPluginHost interface to register events</param>
        /// <param name="captureHost">Use the ICaptureHost interface to register in the MainContextMenu</param>
        /// <param name="pluginAttribute">My own attributes</param>
        /// <returns>true if plugin is initialized, false if not (doesn't show)</returns>
        public virtual bool Initialize(IGreenshotHost pluginHost, PluginAttribute myAttributes)
        {
            this.host  = (IGreenshotHost)pluginHost;
            Attributes = myAttributes;

            // Get configuration
            config    = IniConfig.GetIniSection <FogBugzConfiguration>();
            resources = new ComponentResourceManager(typeof(FogBugzPlugin));

            itemPlugInRoot        = new ToolStripMenuItem(Language.GetString("fogbugz", LangKey.fogbugz_configure));
            itemPlugInRoot.Image  = (Image)resources.GetObject("FogBugz");
            itemPlugInRoot.Tag    = host;
            itemPlugInRoot.Click += delegate {
                config.ShowConfigDialog();
            };

            PluginUtils.AddToContextMenu(host, itemPlugInRoot);
            Language.LanguageChanged += new LanguageChangedHandler(OnLanguageChanged);
            return(true);
        }
        /// <summary>
        /// Implementation of the IGreenshotPlugin.Initialize
        /// </summary>
        /// <param name="host">Use the IGreenshotPluginHost interface to register events</param>
        /// <param name="captureHost">Use the ICaptureHost interface to register in the MainContextMenu</param>
        /// <param name="pluginAttribute">My own attributes</param>
        /// <returns>true if plugin is initialized, false if not (doesn't show)</returns>
        public virtual bool Initialize(IGreenshotHost greenshotHost, PluginAttribute myAttributes)
        {
            LOG.Debug("Initialize called of " + myAttributes.Name);
            host = greenshotHost;
            this.myAttributes = myAttributes;

            OCR_COMMAND = Path.Combine(Path.GetDirectoryName(myAttributes.DllFile), "greenshotocrcommand.exe");

            if (!HasMODI())
            {
                LOG.Warn("No MODI found!");
                return(false);
            }
            // Load configuration
            config = IniConfig.GetIniSection <OCRConfiguration>();

            if (config.Language != null)
            {
                config.Language = config.Language.Replace("miLANG_", "").Replace("_", " ");
            }
            return(true);
        }
Exemple #21
0
        /// <summary>
        /// Implementation of the IGreenshotPlugin.Initialize
        /// </summary>
        /// <param name="pluginHost">Use the IGreenshotPluginHost interface to register events</param>
        /// <param name="myAttributes">My own attributes</param>
        /// <returns>true if plugin is initialized, false if not (doesn't show)</returns>
        public virtual bool Initialize(IGreenshotHost pluginHost, PluginAttribute myAttributes)
        {
            _host      = pluginHost;
            Attributes = myAttributes;

            // Get configuration
            _config    = IniConfig.GetIniSection <PhotobucketConfiguration>();
            _resources = new ComponentResourceManager(typeof(PhotobucketPlugin));

            _itemPlugInConfig = new ToolStripMenuItem(Language.GetString("photobucket", LangKey.configure))
            {
                Tag   = _host,
                Image = (Image)_resources.GetObject("Photobucket")
            };
            _itemPlugInConfig.Click += delegate {
                _config.ShowConfigDialog();
            };

            PluginUtils.AddToContextMenu(_host, _itemPlugInConfig);
            Language.LanguageChanged += OnLanguageChanged;
            return(true);
        }
Exemple #22
0
        /// <summary>
        /// Implementation of the IGreenshotPlugin.Initialize
        /// </summary>
        /// <param name="host">Use the IGreenshotPluginHost interface to register events</param>
        /// <param name="captureHost">Use the ICaptureHost interface to register in the MainContextMenu</param>
        /// <param name="pluginAttribute">My own attributes</param>
        public virtual bool Initialize(IGreenshotHost pluginHost, PluginAttribute myAttributes)
        {
            try
            {
                this.host  = (IGreenshotHost)pluginHost;
                Attributes = myAttributes;

                // Get configuration
                config    = IniConfig.GetIniSection <TFSConfiguration>();
                resources = new ComponentResourceManager(typeof(TFSPlugin));

                ToolStripMenuItem itemPlugInRoot = new ToolStripMenuItem();
                itemPlugInRoot.Text = "TFS";
                itemPlugInRoot.Tag  = host;
                //itemPlugInRoot.Image = (Image)resources.GetObject("TFS");

                ToolStripMenuItem itemPlugInHistory = new ToolStripMenuItem();
                itemPlugInHistory.Text   = Language.GetString("tfs", LangKey.History);
                itemPlugInHistory.Tag    = host;
                itemPlugInHistory.Click += new System.EventHandler(HistoryMenuClick);
                itemPlugInRoot.DropDownItems.Add(itemPlugInHistory);

                ToolStripMenuItem itemPlugInConfig = new ToolStripMenuItem();

                itemPlugInConfig.Text   = Language.GetString("tfs", LangKey.Configure);
                itemPlugInConfig.Tag    = host;
                itemPlugInConfig.Click += new System.EventHandler(ConfigMenuClick);
                itemPlugInRoot.DropDownItems.Add(itemPlugInConfig);

                PluginUtils.AddToContextMenu(host, itemPlugInRoot);

                return(true);
            }
            catch (Exception eError)
            {
                MessageBox.Show("Error init : " + eError.ToString());
                return(false);
            }
        }
        /// <summary>
        /// Helper method to add a MenuItem to the Greenshot context menu
        /// </summary>
        /// <param name="imageEditor"></param>
        /// <param name="item"></param>
        public static void AddToContextMenu(IGreenshotHost host, ToolStripMenuItem item)
        {
            // Here we can hang ourselves to the main context menu!
            ContextMenuStrip contextMenu = host.MainMenu;
            bool             addedItem   = false;

            // Try to find a separator, so we insert ourselves after it
            for (int i = 0; i < contextMenu.Items.Count; i++)
            {
                if (contextMenu.Items[i].GetType() == typeof(ToolStripSeparator))
                {
                    contextMenu.Items.Insert(i + 1, item);
                    addedItem = true;
                    break;
                }
            }
            // If we didn't insert the item, we just add it...
            if (!addedItem)
            {
                contextMenu.Items.Add(item);
            }
        }
Exemple #24
0
        /// <summary>
        /// Implementation of the IGreenshotPlugin.Initialize
        /// </summary>
        /// <param name="pluginHost">Use the IGreenshotPluginHost interface to register events</param>
        /// <param name="myAttributes">My own attributes</param>
        /// <returns>true if plugin is initialized, false if not (doesn't show)</returns>
        public bool Initialize(IGreenshotHost pluginHost, PluginAttribute myAttributes)
        {
            _host      = pluginHost;
            Attributes = myAttributes;

            // Get configuration
            _config    = IniConfig.GetIniSection <ImgurConfiguration>();
            _resources = new ComponentResourceManager(typeof(ImgurPlugin));

            ToolStripMenuItem itemPlugInRoot = new ToolStripMenuItem("Imgur")
            {
                Image = (Image)_resources.GetObject("Imgur")
            };

            _historyMenuItem = new ToolStripMenuItem(Language.GetString("imgur", LangKey.history))
            {
                Tag = _host
            };
            _historyMenuItem.Click += delegate {
                ImgurHistory.ShowHistory();
            };
            itemPlugInRoot.DropDownItems.Add(_historyMenuItem);

            _itemPlugInConfig = new ToolStripMenuItem(Language.GetString("imgur", LangKey.configure))
            {
                Tag = _host
            };
            _itemPlugInConfig.Click += delegate {
                _config.ShowConfigDialog();
            };
            itemPlugInRoot.DropDownItems.Add(_itemPlugInConfig);

            PluginUtils.AddToContextMenu(_host, itemPlugInRoot);
            Language.LanguageChanged += OnLanguageChanged;

            // Enable history if there are items available
            UpdateHistoryMenuItem();
            return(true);
        }
Exemple #25
0
        /// <summary>
        /// Implementation of the IGreenshotPlugin.Initialize
        /// </summary>
        /// <param name="host">Use the IGreenshotPluginHost interface to register events</param>
        /// <param name="captureHost">Use the ICaptureHost interface to register in the MainContextMenu</param>
        /// <param name="pluginAttribute">My own attributes</param>
        public virtual bool Initialize(IGreenshotHost pluginHost, PluginAttribute myAttributes)
        {
            LOG.DebugFormat("Initialize called of {0}", myAttributes.Name);

            List <string> commandsToDelete = new List <string>();

            // Check configuration
            foreach (string command in config.commands)
            {
                if (!isCommandValid(command))
                {
                    commandsToDelete.Add(command);
                }
            }

            // cleanup
            foreach (string command in commandsToDelete)
            {
                config.runInbackground.Remove(command);
                config.commandlines.Remove(command);
                config.arguments.Remove(command);
                config.commands.Remove(command);
            }

            this.host         = pluginHost;
            this.myAttributes = myAttributes;


            itemPlugInRoot     = new ToolStripMenuItem();
            itemPlugInRoot.Tag = host;
            OnIconSizeChanged(this, new PropertyChangedEventArgs("IconSize"));
            OnLanguageChanged(this, null);
            itemPlugInRoot.Click += new System.EventHandler(ConfigMenuClick);

            PluginUtils.AddToContextMenu(host, itemPlugInRoot);
            Language.LanguageChanged   += OnLanguageChanged;
            coreConfig.PropertyChanged += OnIconSizeChanged;
            return(true);
        }
Exemple #26
0
        /// <summary>
        ///     Helper method to add a plugin MenuItem to the Greenshot context menu
        /// </summary>
        /// <param name="host">IGreenshotHost</param>
        /// <param name="item">ToolStripMenuItem</param>
        public static void AddToContextMenu(IGreenshotHost host, ToolStripMenuItem item)
        {
            // Here we can hang ourselves to the main context menu!
            var contextMenu = host.MainMenu;
            var addedItem   = false;

            // Try to find a separator, so we insert ourselves after it
            for (var i = 0; i < contextMenu.Items.Count; i++)
            {
                if (contextMenu.Items[i].GetType() != typeof(ToolStripSeparator))
                {
                    continue;
                }

                // Check if we need to add a new separator, which is done if the first found has a Tag with the value "PluginsAreAddedBefore"
                if ("PluginsAreAddedBefore".Equals(contextMenu.Items[i].Tag))
                {
                    var separator = new ToolStripSeparator
                    {
                        Tag  = "PluginsAreAddedAfter",
                        Size = new Size(305, 6)
                    };
                    contextMenu.Items.Insert(i, separator);
                }
                else if (!"PluginsAreAddedAfter".Equals(contextMenu.Items[i].Tag))
                {
                    continue;
                }
                contextMenu.Items.Insert(i + 1, item);
                addedItem = true;
                break;
            }
            // If we didn't insert the item, we just add it...
            if (!addedItem)
            {
                contextMenu.Items.Add(item);
            }
        }
        /// <summary>
        /// Implementation of the IGreenshotPlugin.Initialize
        /// </summary>
        /// <param name="pluginHost">Use the IGreenshotPluginHost interface to register events</param>
        /// <param name="myAttributes">My own attributes</param>
        public virtual bool Initialize(IGreenshotHost pluginHost, PluginAttribute myAttributes)
        {
            Log.DebugFormat("Initialize called of {0}", myAttributes.Name);

            List <string> commandsToDelete = new List <string>();

            // Check configuration
            foreach (string command in ExternalCommandConfig.Commands)
            {
                if (!IsCommandValid(command))
                {
                    commandsToDelete.Add(command);
                }
            }

            // cleanup
            foreach (string command in commandsToDelete)
            {
                ExternalCommandConfig.Delete(command);
            }

            _host         = pluginHost;
            _myAttributes = myAttributes;


            _itemPlugInRoot = new ToolStripMenuItem {
                Tag = _host
            };
            OnIconSizeChanged(this, new PropertyChangedEventArgs("IconSize"));
            OnLanguageChanged(this, null);
            _itemPlugInRoot.Click += ConfigMenuClick;

            PluginUtils.AddToContextMenu(_host, _itemPlugInRoot);
            Language.LanguageChanged   += OnLanguageChanged;
            CoreConfig.PropertyChanged += OnIconSizeChanged;
            return(true);
        }
Exemple #28
0
        /// <summary>
        /// Implementation of the IGreenshotPlugin.Initialize
        /// </summary>
        /// <param name="host">Use the IGreenshotPluginHost interface to register events</param>
        /// <param name="pluginAttribute">My own attributes</param>
        public virtual bool Initialize(IGreenshotHost pluginHost, PluginAttribute myAttributes)
        {
            this.host  = (IGreenshotHost)pluginHost;
            Attributes = myAttributes;

            // Register configuration (don't need the configuration itself)
            config    = IniConfig.GetIniSection <DropboxConfiguration>();
            resources = new ComponentResourceManager(typeof(DropboxPlugin));

            // load DropboxAccessToken from file
            DropboxUtils.LoadAccessToken();

            ToolStripMenuItem itemPlugInRoot = new ToolStripMenuItem();

            itemPlugInRoot.Text  = "Dropbox";
            itemPlugInRoot.Tag   = host;
            itemPlugInRoot.Image = (Image)resources.GetObject("Dropbox");

            ToolStripMenuItem itemPlugInHistory = new ToolStripMenuItem();

            itemPlugInHistory.Text   = lang.GetString(LangKey.History);
            itemPlugInHistory.Tag    = host;
            itemPlugInHistory.Click += new System.EventHandler(HistoryMenuClick);
            itemPlugInRoot.DropDownItems.Add(itemPlugInHistory);

            ToolStripMenuItem itemPlugInConfig = new ToolStripMenuItem();

            itemPlugInConfig.Text   = lang.GetString(LangKey.Configure);
            itemPlugInConfig.Tag    = host;
            itemPlugInConfig.Click += new System.EventHandler(ConfigMenuClick);
            itemPlugInRoot.DropDownItems.Add(itemPlugInConfig);

            PluginUtils.AddToContextMenu(host, itemPlugInRoot);

            return(true);
        }
Exemple #29
0
		/// <summary>
		/// Implementation of the IGreenshotPlugin.Initialize
		/// </summary>
		/// <param name="host">Use the IGreenshotPluginHost interface to register events</param>
		/// <param name="captureHost">Use the ICaptureHost interface to register in the MainContextMenu</param>
		/// <param name="pluginAttribute">My own attributes</param>
		/// <returns>true if plugin is initialized, false if not (doesn't show)</returns>
		public virtual bool Initialize(IGreenshotHost pluginHost, PluginAttribute myAttributes) {
			this.host = (IGreenshotHost)pluginHost;
			Attributes = myAttributes;

			// Get configuration
			config = IniConfig.GetIniSection<ImgurConfiguration>();
			resources = new ComponentResourceManager(typeof(ImgurPlugin));
			
			ToolStripMenuItem itemPlugInRoot = new ToolStripMenuItem("Imgur");
			itemPlugInRoot.Image = (Image)resources.GetObject("Imgur");

			historyMenuItem = new ToolStripMenuItem(Language.GetString("imgur", LangKey.history));
			historyMenuItem.Tag = host;
			historyMenuItem.Click += delegate {
				ImgurHistory.ShowHistory();
			};
			itemPlugInRoot.DropDownItems.Add(historyMenuItem);

			itemPlugInConfig = new ToolStripMenuItem(Language.GetString("imgur", LangKey.configure));
			itemPlugInConfig.Tag = host;
			itemPlugInConfig.Click += delegate {
				config.ShowConfigDialog();
			};
			itemPlugInRoot.DropDownItems.Add(itemPlugInConfig);

			PluginUtils.AddToContextMenu(host, itemPlugInRoot);
			Language.LanguageChanged += new LanguageChangedHandler(OnLanguageChanged);

			// retrieve history in the background
			Thread backgroundTask = new Thread (new ThreadStart(CheckHistory));
			backgroundTask.Name = "Imgur History";
			backgroundTask.IsBackground = true;
			backgroundTask.SetApartmentState(ApartmentState.STA);
			backgroundTask.Start();
			return true;
		}
Exemple #30
0
 public GreyscaleProcessor(IGreenshotHost host)
 {
     this.host = host;
 }
		public GreyscaleProcessor(IGreenshotHost host) {
			this.host = host;
		}
Exemple #32
0
		/// <summary>
		/// Implementation of the IGreenshotPlugin.Initialize
		/// </summary>
		/// <param name="host">Use the IGreenshotPluginHost interface to register events</param>
		/// <param name="captureHost">Use the ICaptureHost interface to register in the MainContextMenu</param>
		/// <param name="pluginAttribute">My own attributes</param>
		/// <returns>true if plugin is initialized, false if not (doesn't show)</returns>
		public virtual bool Initialize(IGreenshotHost greenshotHost, PluginAttribute myAttributes) {
			LOG.Debug("Initialize called of " + myAttributes.Name);
			host = greenshotHost;
			this.myAttributes = myAttributes;
			
			OCR_COMMAND = Path.Combine(Path.GetDirectoryName(myAttributes.DllFile), "greenshotocrcommand.exe");

			if (!HasMODI()) {
				LOG.Warn("No MODI found!");
				return false;
			}
			// Load configuration
			config = IniConfig.GetIniSection<OCRConfiguration>();
			
			if (config.Language != null) {
				config.Language = config.Language.Replace("miLANG_","").Replace("_"," ");
			}
			return true;
		}
        /// <summary>
        /// Implementation of the IGreenshotPlugin.Initialize
        /// </summary>
        /// <param name="host">Use the IGreenshotPluginHost interface to register events</param>
        /// <param name="captureHost">Use the ICaptureHost interface to register in the MainContextMenu</param>
        /// <param name="pluginAttribute">My own attributes</param>
        public virtual bool Initialize(IGreenshotHost pluginHost, PluginAttribute myAttributes)
        {
            try
            {

                this.host = (IGreenshotHost)pluginHost;
                Attributes = myAttributes;

                // Get configuration
                config = IniConfig.GetIniSection<TFSConfiguration>();
                resources = new ComponentResourceManager(typeof(TFSPlugin));

                ToolStripMenuItem itemPlugInRoot = new ToolStripMenuItem();
                itemPlugInRoot.Text = "TFS";
                itemPlugInRoot.Tag = host;
                //itemPlugInRoot.Image = (Image)resources.GetObject("TFS");

                ToolStripMenuItem itemPlugInHistory = new ToolStripMenuItem();
                itemPlugInHistory.Text = Language.GetString("tfs",LangKey.History);
                itemPlugInHistory.Tag = host;
                itemPlugInHistory.Click += new System.EventHandler(HistoryMenuClick);
                itemPlugInRoot.DropDownItems.Add(itemPlugInHistory);

                ToolStripMenuItem itemPlugInConfig = new ToolStripMenuItem();

                itemPlugInConfig.Text = Language.GetString("tfs",LangKey.Configure);
                itemPlugInConfig.Tag = host;
                itemPlugInConfig.Click += new System.EventHandler(ConfigMenuClick);
                itemPlugInRoot.DropDownItems.Add(itemPlugInConfig);

                PluginUtils.AddToContextMenu(host, itemPlugInRoot);

                return true;
            }
            catch (Exception eError)
            {
                MessageBox.Show("Error init : " + eError.ToString());
                return false;
            }
        }
Exemple #34
0
 /// <summary>
 /// Implementation of the IGreenshotPlugin.Initialize
 /// </summary>
 /// <param name="pluginHost">Use the IGreenshotPluginHost interface to register events</param>
 /// <param name="myAttributes">My own attributes</param>
 /// <returns>true if plugin is initialized, false if not (doesn't show)</returns>
 public bool Initialize(IGreenshotHost pluginHost, PluginAttribute myAttributes)
 {
     return(true);
 }
 public SplashViewModel(IGreenshotHost mainForm)
 {
     _mainForm = mainForm;
 }
 public bool Initialize(IGreenshotHost pluginHost, PluginAttribute plugin)
 {
     return Initialize(pluginHost, new Dictionary<string, object>());
 }
Exemple #37
0
 public SimpleOutputDestination(IGreenshotHost host)
 {
     this.host = host;
 }
Exemple #38
0
 /// <summary>
 /// Implementation of the IGreenshotPlugin.Initialize
 /// </summary>
 /// <param name="host">Use the IGreenshotPluginHost interface to register events</param>
 /// <param name="captureHost">Use the ICaptureHost interface to register in the MainContextMenu</param>
 /// <param name="pluginAttribute">My own attributes</param>
 /// <returns>true if plugin is initialized, false if not (doesn't show)</returns>
 public virtual bool Initialize(IGreenshotHost pluginHost, PluginAttribute myAttributes)
 {
     this.host = (IGreenshotHost)pluginHost;
     Attributes = myAttributes;
     return true;
 }
        /// <summary>
        /// Implementation of the IGreenshotPlugin.Initialize
        /// </summary>
        /// <param name="host">Use the IGreenshotPluginHost interface to register events</param>
        /// <param name="pluginAttribute">My own attributes</param>
        public virtual bool Initialize(IGreenshotHost pluginHost, PluginAttribute myAttributes)
        {
            this.host = (IGreenshotHost)pluginHost;
            Attributes = myAttributes;

            // Register configuration (don't need the configuration itself)
            config = IniConfig.GetIniSection<BoxConfiguration>();
            resources = new ComponentResourceManager(typeof(BoxPlugin));

            ToolStripMenuItem itemPlugInRoot = new ToolStripMenuItem();
            itemPlugInRoot.Text = "Box";
            itemPlugInRoot.Tag = host;
            itemPlugInRoot.Image = (Image)resources.GetObject("Box");

            ToolStripMenuItem itemPlugInHistory = new ToolStripMenuItem();
            itemPlugInHistory.Text = lang.GetString(LangKey.History);
            itemPlugInHistory.Tag = host;
            itemPlugInHistory.Click += new System.EventHandler(HistoryMenuClick);
            itemPlugInRoot.DropDownItems.Add(itemPlugInHistory);

            ToolStripMenuItem itemPlugInConfig = new ToolStripMenuItem();
            itemPlugInConfig.Text = lang.GetString(LangKey.Configure);
            itemPlugInConfig.Tag = host;
            itemPlugInConfig.Click += new System.EventHandler(ConfigMenuClick);
            itemPlugInRoot.DropDownItems.Add(itemPlugInConfig);

            PluginUtils.AddToContextMenu(host, itemPlugInRoot);

            return true;
        }
Exemple #40
0
		/// <summary>
		/// Implementation of the IGreenshotPlugin.Initialize
		/// </summary>
		/// <param name="host">Use the IGreenshotPluginHost interface to register events</param>
		/// <param name="captureHost">Use the ICaptureHost interface to register in the MainContextMenu</param>
		/// <param name="pluginAttribute">My own attributes</param>
		/// <returns>true if plugin is initialized, false if not (doesn't show)</returns>
		public virtual bool Initialize(IGreenshotHost pluginHost, PluginAttribute myAttributes) {
			this.host = (IGreenshotHost)pluginHost;
			jiraPluginAttributes = myAttributes;

			// Register configuration (don't need the configuration itself)
			config = IniConfig.GetIniSection<JiraConfiguration>();
			resources = new ComponentResourceManager(typeof(JiraPlugin));
			return true;
		}
		/// <summary>
		/// Implementation of the IGreenshotPlugin.Initialize
		/// </summary>
		/// <param name="host">Use the IGreenshotPluginHost interface to register events</param>
		/// <param name="captureHost">Use the ICaptureHost interface to register in the MainContextMenu</param>
		/// <param name="pluginAttribute">My own attributes</param>
		public virtual bool Initialize(IGreenshotHost pluginHost, PluginAttribute myAttributes) {
			LOG.DebugFormat("Initialize called of {0}", myAttributes.Name);

			List<string> commandsToDelete = new List<string>();
			// Check configuration
			foreach(string command in config.commands) {
				if (!isCommandValid(command)) {
					commandsToDelete.Add(command);
				}
			}

			// cleanup
			foreach (string command in commandsToDelete) {
				config.runInbackground.Remove(command);
				config.commandlines.Remove(command);
				config.arguments.Remove(command);
				config.commands.Remove(command);
			}

			this.host = pluginHost;
			this.myAttributes = myAttributes;


			itemPlugInRoot = new ToolStripMenuItem();
			itemPlugInRoot.Tag = host;
			OnIconSizeChanged(this, new PropertyChangedEventArgs("IconSize"));
			OnLanguageChanged(this, null);
			itemPlugInRoot.Click += new System.EventHandler(ConfigMenuClick);

			PluginUtils.AddToContextMenu(host, itemPlugInRoot);
			Language.LanguageChanged += OnLanguageChanged;
			coreConfig.PropertyChanged += OnIconSizeChanged;
			return true;
		}
Exemple #42
0
 /// <summary>
 /// Implementation of the IGreenshotPlugin.Initialize
 /// </summary>
 /// <param name="host">Use the IGreenshotPluginHost interface to register events</param>
 /// <param name="captureHost">Use the ICaptureHost interface to register in the MainContextMenu</param>
 /// <param name="pluginAttribute">My own attributes</param>
 /// <returns>true if plugin is initialized, false if not (doesn't show)</returns>
 public virtual bool Initialize(IGreenshotHost pluginHost, PluginAttribute myAttributes)
 {
     this.host  = (IGreenshotHost)pluginHost;
     Attributes = myAttributes;
     return(true);
 }
Exemple #43
0
		public AnnotateProcessor(IGreenshotHost host) {
			this.host = host;
		}
		public SimpleOutputDestination(IGreenshotHost host) {
			this.host = host;
		}
 public AnnotateProcessor(IGreenshotHost host)
 {
     this.host = host;
 }
Exemple #46
0
 /// <summary>
 /// Implementation of the IGreenshotPlugin.Initialize
 /// </summary>
 /// <param name="host">Use the IGreenshotPluginHost interface to register events</param>
 /// <param name="metadata">IDictionary<string, string></param>
 public abstract bool Initialize(IGreenshotHost pluginHost, IDictionary <string, object> metadata);
 public ExternalCommandPlugin(IGreenshotHost greenshotGreenshotHost, IExternalCommandConfiguration externalCommandConfiguration)
 {
     _greenshotHost         = greenshotGreenshotHost;
     _externalCommandConfig = externalCommandConfiguration;
 }
Exemple #48
0
		/// <summary>
		/// Implementation of the IGreenshotPlugin.Initialize
		/// </summary>
		/// <param name="pluginHost">Use the IGreenshotPluginHost interface to register events</param>
		/// <param name="myAttributes">My own attributes</param>
		public virtual bool Initialize(IGreenshotHost pluginHost, PluginAttribute myAttributes) {
			// Register configuration (don't need the configuration itself)
			_config = IniConfig.GetIniSection<ConfluenceConfiguration>();
			if(_config.IsDirty) {
				IniConfig.Save();
			}
			try {
				TranslationManager.Instance.TranslationProvider = new LanguageXMLTranslationProvider();
				//resources = new ComponentResourceManager(typeof(ConfluencePlugin));
			} catch (Exception ex) {
				LOG.ErrorFormat("Problem in ConfluencePlugin.Initialize: {0}", ex.Message);
				return false;
			}
			return true;
		}
        /// <summary>
        /// Implementation of the IGreenshotPlugin.Initialize
        /// </summary>
        /// <param name="pluginHost">Use the IGreenshotPluginHost interface to register events</param>
        /// <param name="metadata">IDictionary&lt;string, object&gt;</param>
        /// <returns>true if plugin is initialized, false if not (doesn't show)</returns>
        public bool Initialize(IGreenshotHost pluginHost, IDictionary<string, object> metadata)
        {
            host = pluginHost;

            // Get configuration
            config = IniConfig.GetIniSection<FacebookConfiguration>();
            resources = new ComponentResourceManager(typeof(FacebookPlugin));

            itemPlugInConfig = new ToolStripMenuItem(Language.GetString("facebook", LangKey.configure)) {Tag = host};
            itemPlugInConfig.Click += delegate {
                config.ShowConfigDialog();
            };
            itemPlugInConfig.Image = (Image)resources.GetObject("Facebook");

            PluginUtils.AddToContextMenu(host, itemPlugInConfig);
            Language.LanguageChanged += OnLanguageChanged;
            return true;
        }
Exemple #50
0
 /// <summary>
 /// Implementation of the IGreenshotPlugin.Initialize
 /// </summary>
 /// <param name="host">Use the IGreenshotPluginHost interface to register events</param>
 /// <param name="metadata">IDictionary<string, object></param>
 /// <returns>true if plugin is initialized, false if not (doesn't show)</returns>
 public override bool Initialize(IGreenshotHost pluginHost, IDictionary <string, object> metadata)
 {
     this.host = pluginHost;
     SettingsWindow.RegisterSettingsPage <ExternalCommandSettingsPage>("settings_plugins,externalcommand.settings_title");
     return(true);
 }