Jump to content
How to Install Plugins ×

CodeLab v6.12 for Paint.NET 5.0.12 (Updated February 11, 2024)


Recommended Posts

  • 2 weeks later...
17 hours ago, Pratyush said:

... can tabs be supported in Codelab?

 

Yes, tabs could be supported in CodeLab. You might be the only person who would use such a feature though.

Personally, I have no interest in putting in the work to add tabs. It really wouldn't be difficult to implement though. It would mostly consist of making sure all the user interface buttons get mapped to the active tab.

(September 25th, 2023)  Sorry about any broken images in my posts. I am aware of the issue.

bp-sig.png
My Gallery  |  My Plugin Pack

Layman's Guide to CodeLab

Link to comment
Share on other sites

  • 2 months later...

CodeLab crashes if we use the slash character in the UI.

Same for any mathematical symbol.

 

oP8qyyJ.png

 

Exception details:
System.FormatException: Input string was not in a correct format.
   at System.Number.StringToNumber(String str, NumberStyles options, NumberBuffer& number, NumberFormatInfo info, Boolean parseDecimal)
   at System.Number.ParseInt32(String s, NumberStyles style, NumberFormatInfo info)
   at PaintDotNet.Effects.UIBuilder.ControlType_SelectedIndexChanged(Object sender, EventArgs e)
   at System.Windows.Forms.ComboBox.OnSelectedIndexChanged(EventArgs e)
   at System.Windows.Forms.ComboBox.set_SelectedIndex(Int32 value)
   at System.Windows.Forms.ComboBox.set_Text(String value)
   at PaintDotNet.Effects.UIBuilder.ControlListView_SelectedIndexChanged(Object sender, EventArgs e)
   at System.Windows.Forms.ListView.OnSelectedIndexChanged(EventArgs e)
   at System.Windows.Forms.ListView.WmReflectNotify(Message& m)
   at System.Windows.Forms.ListView.WndProc(Message& m)
   at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)

Edited by xod
Added image.
Link to comment
Share on other sites

3 hours ago, xod said:

CodeLab crashes if we use the slash character in the UI. Same for any mathematical symbol. 

 

Slashes seem to work fine.

The crash is actually caused by the 0.6 in the Default box.  When switching to the Checkbox, CodeLab attempts to Parse the 0.6 as an integer. :/

 

Fixed for the next release:

if (int.TryParse(ControlDef.Text, out int result) && result > 0)

 

  • Upvote 1

(September 25th, 2023)  Sorry about any broken images in my posts. I am aware of the issue.

bp-sig.png
My Gallery  |  My Plugin Pack

Layman's Guide to CodeLab

Link to comment
Share on other sites

  • 1 month later...
On 3/25/2018 at 6:22 AM, Pratyush said:

Hi, can tabs be supported in Codelab? if there would be 3 or 4 tabs, it would be quite helpful in copying and testing different versions together.

 

This would be even easier than I original thought. A whole lot easier.

Scintilla can actually handle multiple documents natively, so we wouldn't even need to spawn additional editor controls (which was my main concern).

 

Therefore, I am reconsidering adding tabs, as my older assessment of "not worth the effort" is no longer accurate.

  • Like 2
  • Upvote 1

(September 25th, 2023)  Sorry about any broken images in my posts. I am aware of the issue.

bp-sig.png
My Gallery  |  My Plugin Pack

Layman's Guide to CodeLab

Link to comment
Share on other sites

  • 1 month later...

CodeLab 4.0 Released

This is only for Paint.NET 4.1+!

 

Big update today...

 

Changes:

▪ Editor has tabs and can edit more than one file at a time. (toe_head2001)
▪ Generate VS Project function on Build screen. (toe_head2001)
▪ Separate Save and Save As functions. (toe_head2001)
▪ The autocomplete function now does matching initials. (toe_head2001)
▪ Indicator Map (Ctrl+M) now integrated with scroll bar. (toe_head2001)
▪ Building to DLL now saves to Desktop in a ZIP file all ready for posting. (BoltBait)
▪ Install.BAT files now work for both the Classic and Store versions of PdN. (BoltBait)
▪ Colorwheel control now has Alpha style option. (BoltBait)
▪ Colorwheel control reset button can now be hidden. (BoltBait)
▪ Filename control added. (BoltBait)
▪ File>New templates have a "non-looping" style for GDI+ plugins. (BoltBait)

 

Grab the CodeLab DLL here:

 

http://www.boltbait.com/pdn/CodeLab/

 

Screenshot(s):

 

Check out this new UI feature, tabs:

 

CodeLab40UI.png:LeftArrowBlue:Indicator Map scrollbar

 

How to access the new Colorwheel with Alpha:

UIDesigner.png:RightArrowBlue:  ColorWheelSizes.png

 

How to generate a script for using GDI+ commands:

NewTemplate.png

  

 

Example Scripts:

 

Here is a CodeLab script for using the new FilenameControl:

 

Spoiler

// Name: Fill from file
// Author: BoltBait
#region UICode
FilenameControl Amount1 = @""; // Open Image|jpg|png|gif|bmp
#endregion

Surface wrk = null;

protected override void OnDispose(bool disposing)
{
    if (wrk != null) wrk.Dispose();
    wrk = null;
    base.OnDispose(disposing);
}

void PreRender(Surface dst, Surface src)
{
    if (wrk == null)
    {
        wrk = new Surface(src.Size);
    }

    try
    {
        // Use your FilenameControl to load an image for use
        wrk = Surface.CopyFromBitmap((Bitmap)Bitmap.FromFile(Amount1));
    }
    catch
    {
        wrk.Clear(ColorBgra.Transparent);
    }
}

void Render(Surface dst, Surface src, Rectangle rect)
{
    for (int y = rect.Top; y < rect.Bottom; y++)
    {
        if (IsCancelRequested) return;
        for (int x = rect.Left; x < rect.Right; x++)
        {
            ColorBgra CurrentPixel = wrk.GetBilinearSampleWrapped(x,y);
            dst[x,y] = CurrentPixel;
        }
    }
}

 

Notice in the definition of the control, in the comment we have the title of the control followed by the file types allowed:

 


FilenameControl Amount1 = @""; // Open Image|jpg|png|gif|bmp

So, in this example, the prompt will be "Open Image" and the allowed file types will be .jpg, .png, .gif, and .bmp.

 

For tinkering inside of CodeLab, between the quotes you can place a path to a file.  (Notice that the @ sign before the first quote allows you to use the backslash character "\" without escaping it (doubling them).

 

Here is an example GDI+ script:

 

Spoiler

On the File > New (Templates) screen, you can now choose a looping style of "None".  This will generate a script like this:

 


// Name: GDI+ Example
// Author: BoltBait
#region UICode
#endregion

// Working surface
Surface wrk = null;

// Setup for using Normal blend op
private BinaryPixelOp normalOp = LayerBlendModeUtil.CreateCompositionOp(LayerBlendMode.Normal);

protected override void OnDispose(bool disposing)
{
    // Release any surfaces or effects you've created.
    if (wrk != null) wrk.Dispose();
    wrk = null;
    base.OnDispose(disposing);
}

void PreRender(Surface dst, Surface src)
{
    if (wrk == null)
    {
        wrk = new Surface(src.Size);
    }

    wrk.Clear(ColorBgra.Transparent);
}

// Here is the main render loop function
void Render(Surface dst, Surface src, Rectangle rect)
{
    using (Graphics g = new RenderArgs(wrk).Graphics)
    using (Region gClipRegion = new Region(rect))
    using (Pen pen = new Pen(ColorBgra.Black, 1))
    using (GraphicsPath path = new GraphicsPath())
    using (SolidBrush brush = new SolidBrush(ColorBgra.Black))
    using (Font font = new Font("Arial", 12))
    {
        g.Clip = gClipRegion;
        g.SmoothingMode = SmoothingMode.AntiAlias;
        g.TextRenderingHint = TextRenderingHint.AntiAlias;
        pen.LineJoin = LineJoin.Round;

        // add additional GDI+ commands here

    }
    normalOp.Apply(dst, src, wrk, rect);
}

 

Notice that there are no loops in the Render method.

 

In the Render method, CodeLab generates several "using" blocks. Just delete the ones you won't be using yourself.  You'll probably want to modify the remaining "using" statements with user controls to make the various colors and sizes adjustable in your plugin.

 

Finally, you can add additional GDI+ commands to render text, lines, and shapes to the wrk canvas which will then be combined with the source canvas to create your result.

 

 

Questions and Answers:

 

"Building to DLL now saves to Desktop in a ZIP file.Why would you do that?!

 

Quote

Well, now that we have live preview in CodeLab itself, there really isn't as much of a need to "build to dll, install dll, run Paint.NET" to test your plugin.

 

AND, people keep posting zipped DLL files to the forum without including the install.bat file that goes with them.

 

So... I thought it would be convenient to just prepare the zip file for you.  This way, it is all ready for you to post to the forum. 

 

PLUS, the new install.bat file that is built for you supports both the Classic version and the Store version of Paint.NET.

 

"Matching of Initials in the AutoComplete box filter."  What's that?!

 

Quote

db - DrawBezier

memAbrev.png

 

isc - IntSliderControl

(and of course IsCancelRequested is still listed, since it starts with isc)

iscAbrev.png


 

  • Like 1
  • Upvote 4
Link to comment
Share on other sites

  • BoltBait changed the title to CodeLab v4.0 (for advanced users) Released September 5, 2018

I think that with the launch of the new version of paint.net 4.1.1 CodeLab should also be revised.

 

Color Wheel Control does not behave properly.

 

As shown in the image below, I chose the Default style but the chosen color has Alpha = 0 although I do not have a slider for Alpha.

 

wk5IEdT.png

Link to comment
Share on other sites

2 hours ago, xod said:

Color Wheel Control does not behave properly. 

 

This is just visual issue in the control itself. The ColorBgra from the control will still have an Alpha channel value 255.

The issue is in paint.net v4.1.1; not CodeLab.

Edited by toe_head2001

(September 25th, 2023)  Sorry about any broken images in my posts. I am aware of the issue.

bp-sig.png
My Gallery  |  My Plugin Pack

Layman's Guide to CodeLab

Link to comment
Share on other sites

On 9/12/2018 at 8:21 AM, xod said:

Color Wheel Control does not behave properly.

 

Thanks for the bug report.  It was definitely a bug in Paint.NET.  Sorry about that.

 

I submitted a code fix.  When Rick approves the fix, it will show up in the next build of Paint.NET.

 

EDIT: It has been approved.

  • Like 2
  • Upvote 1
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...