Jump to content

De-bug Plugin's


Andrew D

Recommended Posts

First off, how do you de-bug your plug-in in VS Express 2005, because Rick's tutorial on how to do it on the full version dosen't apply to the express version.

Secondly, how do you choose what sub-menu you want your plug-in to go into, and thirdly, how do you create hyperlinks, like in pyrochild's plug-in's?

Link to comment
Share on other sites

1. Edit your title to help the search engine! "debug plugins" please!

2. Some debug instruction (search could help) here:

viewtopic.php?f=6&t=4920

3.For myself, I can't find a link to install VS 2005 C++ Express, so I can't go further in debug mode :(

I only use VS 2005 C# Express. So I would appreciate if someone points me to a working link to VS 2005 C++ Express.

4.For the label with a link you could find example here

viewtopic.php?f=16&t=2302

or here

viewtopic.php?f=16&t=4879

Link to comment
Share on other sites

1. Edit your title to help the search engine! "debug plugins" please!

2. Some debug instruction (search could help) here:

viewtopic.php?f=6&t=4920

3.For myself, I can't find a link to install VS 2005 C++ Express, so I can't go further in debug mode :(

I only use VS 2005 C# Express. So I would appreciate if someone points me to a working link to VS 2005 C++ Express.

4.For the label with a link you could find example here

viewtopic.php?f=16&t=2302

or here

viewtopic.php?f=16&t=4879

Ok, I've managed a way in effect to de-bug them, I now know (I guess) how to create hyperlinks, now I just need to know how to put it in a sub menu.

Link to comment
Share on other sites

using System;

using System.Drawing;

using System.Drawing.Drawing2D;

using System.Windows.Forms;

namespace PaintDotNet.Effects {

public sealed class MotionBlurEffect : Effect {

public MotionBlurEffect() : base(PdnResources.GetString("MotionBlurEffect.Name"),

PdnResources.GetImage("Icons.MotionBlurEffect.png"),

SubmenuNames.Blurs,

EffectDirectives.None,

true)

{

No. Way. I've just seen Bob. And... *poof!*—just like that—he disappears into the mist again. ~Helio

Link to comment
Share on other sites

In the CodeLab code I'm using, that isn't in there at all, anywhere where I can define the Sub-Menu. Any idea on how I can?

using System;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Reflection;
using System.IO;
using Microsoft.CSharp;

namespace PaintDotNet.Effects
{
   public class CodeLab : Effect
   {
       public static Image StaticImage
       {
           get
           {
               Assembly ourAssembly = Assembly.GetExecutingAssembly();
               Stream imageStream = ourAssembly.GetManifestResourceStream("PaintDotNet.Effects.Icons.CodeLab.png");
               Image image = Image.FromStream(imageStream);
          return image;

           }
       }

       public CodeLab()
           : base("Code Lab", StaticImage, true)
       {
       }

       public override EffectConfigDialog CreateConfigDialog()
       {
           CodeLabConfigDialog secd = new CodeLabConfigDialog();
           return secd;
       }

       public override void Render(EffectConfigToken parameters, RenderArgs dstArgs, RenderArgs srcArgs, Rectangle[] rois, int startIndex, int length)
       {
           CodeLabConfigToken sect = (CodeLabConfigToken)parameters;
           Effect userEffect = sect.UserScriptObject;

           if (userEffect != null)
           {
               userEffect.EnvironmentParameters = this.EnvironmentParameters;

               try
               {
                   userEffect.Render(null, dstArgs, srcArgs, rois, startIndex, length);
               }

               catch (Exception exc)
               {
                   sect.LastExceptions.Add(exc);
                   dstArgs.Surface.CopySurface(srcArgs.Surface);
                   sect.UserScriptObject = null;
               }
           }

           {

           }
       }
   }
}

I believe this is the part of the CodeLab script which needs to contain the sub-menu data. Right?

Link to comment
Share on other sites

I don't understand why you want to redo the codelab... :roll:

This is the beginning of the code for the GridMaker. Look at the lines with //§§§ for the submenu name!

using System;
using System.Resources;
using System.Drawing;
using PaintDotNet;
using System.Drawing.Imaging;
using PaintDotNet.Effects;

namespace GridMaker
{
 public class EffectPlugin
     : PaintDotNet.Effects.Effect
 {
   public static string StaticSubMenuName //§§§
   { get { return PdnResources.GetString("RenderSubmenu.Name"); } } //§§§ for the submenu Render
  //§§§ you could also create a new menu or a menu PDN doesn't know if you put a string directly, ex:
  //§§§ { get { return "My_SubMenu"); } } 

   public static string StaticName
   { get { return "Grid/CheckerBoard Maker "; } }   // This is the text that shows in the menu

   public static Bitmap StaticIcon
   { get { return new Bitmap(typeof(EffectPlugin), "EffectPluginIcon.png"); } }   // Here is the icon

   public EffectPlugin()
     : base(EffectPlugin.StaticName, EffectPlugin.StaticIcon, EffectPlugin.StaticSubMenuName, true) //§§§
   {
   }
 . . .

But next version(s) should provide something different IMO :roll:

Link to comment
Share on other sites

I don't understand why you want to redo the codelab... :roll:

This is the beginning of the code for the GridMaker. Look at the lines with //§§§ for the submenu name!

using System;
using System.Resources;
using System.Drawing;
using PaintDotNet;
using System.Drawing.Imaging;
using PaintDotNet.Effects;

namespace GridMaker
{
 public class EffectPlugin
     : PaintDotNet.Effects.Effect
 {
   public static string StaticSubMenuName //§§§
   { get { return PdnResources.GetString("RenderSubmenu.Name"); } } //§§§ for the submenu Render
  //§§§ you could also create a new menu or a menu PDN doesn't know if you put a string directly, ex:
  //§§§ { get { return "My_SubMenu"); } } 

   public static string StaticName
   { get { return "Grid/CheckerBoard Maker "; } }   // This is the text that shows in the menu

   public static Bitmap StaticIcon
   { get { return new Bitmap(typeof(EffectPlugin), "EffectPluginIcon.png"); } }   // Here is the icon

   public EffectPlugin()
     : base(EffectPlugin.StaticName, EffectPlugin.StaticIcon, EffectPlugin.StaticSubMenuName, true) //§§§
   {
   }
 . . .

But next version(s) should provide something different IMO :roll:

I'm not re-doing it really, just skinning it.

Link to comment
Share on other sites

using System;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Reflection;
using System.IO;
using Microsoft.CSharp;

namespace PaintDotNet.Effects
{
   public class CodeLab : Effect
   {
       public static string StaticSubMenuName //§§§
       { get { return PdnResources.GetString("AdvancedSubmenu.Name"); } } //§§§ for the submenu Render
       //§§§ you could also create a new menu or a menu PDN doesn't know if you put a string directly, ex:
       //§§§ { get { return "My_SubMenu"); } } 
       public static Image StaticImage
       {
           get
           {
               Assembly ourAssembly = Assembly.GetExecutingAssembly();
               Stream imageStream = ourAssembly.GetManifestResourceStream("PaintDotNet.Effects.Icons.CodeLab.png");
               Image image = Image.FromStream(imageStream);
          return image;

           }
       }

       public CodeLab()
           : base("Code Lab", StaticImage, true)
       {
       }

       public override EffectConfigDialog CreateConfigDialog()
       {
           CodeLabConfigDialog secd = new CodeLabConfigDialog();
           return secd;
       }

       public override void Render(EffectConfigToken parameters, RenderArgs dstArgs, RenderArgs srcArgs, Rectangle[] rois, int startIndex, int length)
       {
           CodeLabConfigToken sect = (CodeLabConfigToken)parameters;
           Effect userEffect = sect.UserScriptObject;

           if (userEffect != null)
           {
               userEffect.EnvironmentParameters = this.EnvironmentParameters;

               try
               {
                   userEffect.Render(null, dstArgs, srcArgs, rois, startIndex, length);
               }

               catch (Exception exc)
               {
                   sect.LastExceptions.Add(exc);
                   dstArgs.Surface.CopySurface(srcArgs.Surface);
                   sect.UserScriptObject = null;
               }
           }

           {

           }
       }
   }
}

Ok, I filtered the code you just posted and set the submenu to Advanced, yet when I built it, it was just where CodeLab usually is. How can I get around this?

Link to comment
Share on other sites

So...

For example change the line :

     public CodeLab()
           : base("Code Lab", StaticImage, true)
       {
       }

to :

    public CodeLab()
     : base("Code Lab", StaticImage, "Advanced", true)
   {
   }

This will move the codelab to the advanced submenu (with the scriptlab)...

Thank you.

This can be closed now.

Link to comment
Share on other sites

Actually, I'll take that back for now at least. When I had the skin done, and I found it worked, I deleted the old CodeLab .dll. But now when I open up the new one, this error message appears saying that it can't find the original CodeLab file, and now it dosen't apply anything to the canvas.

How? And if so, how can I stop this from happening?

Download VS 2005 Project Here

Link to comment
Share on other sites

I just took the CodeLabConfigDialog.cs and CodeLabConfigDialog.resx from your project to the original project and it seems to be Ok.

I prefer the original UI, but I move the CodeLab to Advanced submenu...

The thing is which I don't get is that it needs the original file to act as a metadata file, otherwise it messes up....Strange is a understatement.

I'll remove the sub-menu option and then see if it works.

EDIT: Nope, still dosen't work without the original. I'm going to have a look and see if I can remove that fault from the error libary....then it might work....

EDIT 2: Which isn't possible....I'm stumped. I need to be able to find a way to either allow the skinned version to work by itself, or make the original CodeLab be hidden and act as a libary for the plug-in...... Huh, if I can't solve it, I may aswell just give up on it......

Link to comment
Share on other sites

So...

Change the code again to give it another menu name for example change the line :

     public CodeLab()
     : base("Code Lab", StaticImage, "Advanced", true)
       {
       }

to :

    public CodeLab()
     : base("Code Lab AD", StaticImage, "Advanced", true)
   {
   }

Rename as well the DLL to something else (like CodeLabAD.dll)...

Link to comment
Share on other sites

So...

Change the code again to give it another menu name for example change the line :

     public CodeLab()
     : base("Code Lab", StaticImage, "Advanced", true)
       {
       }

to :

    public CodeLab()
     : base("Code Lab AD", StaticImage, "Advanced", true)
   {
   }

Rename as well the DLL to something else (like CodeLabAD.dll)...

I've renamed it so it isn't called CodeLab, but it still says that error message when it can't find the original CodeLab file.

Link to comment
Share on other sites

I don't understand why you want to re-skin CodeLab.

It was basically just to help myself learning C#, I'm not saying there's anything wrong with the normal CodeLab UI, I mainly done it to help advance my learning, and now I know how to do several other plug-in things which I wouldn't know, and then if I made a plug-in I'd be stumbling around mindlessy like I was today, I guess.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...