Jump to content
How to Install Plugins ×

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


Recommended Posts

This error sometimes appears in the Show Error List panel.
Errors do not occur all at once but one at a time as I open the .cs files.
I may have some broken registers because I was infected with malware Mail.Ru.

Thank you for your patience.

Link to comment
Share on other sites

Sounds like something is interfering with your %temp% directory.  If you aren't deleting those .DLL files in %temp%, then maybe your malware is deleting them. Or maybe your anti-malware software deletes them. I don't know.

 

If that's the case, there's really nothing we can fix up in CodeLab to resolve your issue.

 

Under normal circumstances, restarting Paint.NET will fix that error.

(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

izAW177.png

This error occurs after I build a CodeLab plugin.

1. Choose the icon you want to appear in your plugin(16x16px).
2. Build the plugin
3. Close CodeLab
4. Open the icon and try to save it

The icon it can only be saved as SaveAs under another name.
Maybe something is broken in my OS?
Anyone else can reproduce this error?

Otherwise, everything works correctly.

Link to comment
Share on other sites

CodeLab 4.3 Released

This is only for Paint.NET 4.2+!

 

Big update today...

 

Changes:
▪ Redesign File > New screen (BoltBait)
▪ HighDPI icons (toe_head2001)
▪ Add Format, Find, and Replace toolbar buttons (toe_head2001)
▪ Add snippet for Try/Catch (toe_head2001)
▪ Bug fixes to Quick Format (toe_head2001)
▪ Added flexible, themeable, customizable message boxes (BoltBait)
▪ Allow arbitrary names for UI fields, also removed UI Elements Renumber command (toe_head2001)
▪ Added light bulb renaming of fields defined in user's script (toe_head2001)
▪ Redesigned UI Builder screen (BoltBait)
▪ Added support for the new Uri Control (BoltBait)
▪ Update clipboard template code (null54)
▪ Improvements to code completion (toe_head2001)
▪ Intelligent Assistance improvements for Extension Methods, Generic Methods, and Generic Types (toe_head2001)
▪ Fixed build screen to not hold the icon file open (BoltBait)
▪ Various code cleanups and improvements (toe_head2001 and BoltBait)


Grab the CodeLab DLL here:

 

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


Screenshots:

 

File > New screen redesign:

FileNew.png

 

 

New high resolution icons:

 

NewIcons.png

 

 

Themeable message boxes that can have custom buttons:

 

MsgBoxes.png

 

I was tired of MessageBox being displayed with white backgrounds when running the dark theme.  So, I found FlexibleMessageBox source code and fixed it up for use in Paint.NET... added a few features, like customizable buttons and themes... fixed a few bugs.  I think they look awesome.

 

 

UI Designer redesign and new Web Link control:

UIDesigner.png

 

Notice that the Variables can be specified--you no longer need to use Amount1, Amount2, ...

You can, if you want, but it is not necessary as the defaults are the same as before.

 

We also have the new Web Link control type. This gives IndirectUI the ability to have a clickable link that opens a browser to a specified URL.  If a Display Name is specified it is linked.  If no Display Name is specified, the URL is displayed and linked.

 

Rename Variables:

 

Select the variable you wish to rename and start typing... a light bulb will appear.  Click on that and you can rename your variable everywhere in the script where it appears.

 

RenameVar.png

 

 

New Clipboard Code:

 

Paint.NET v4.2 has a new helper class for accessing the clipboard.  CodeLab has been updated to take advantage of this new service.

 

On the File > New screen, when selecting "Clipboard" in the sample code drop-down box, the following code is now generated:

// Name:
// Submenu:
// Author:
// Title:
// Version:
// Desc:
// Keywords:
// URL:
// Help:
#region UICode
#endregion

private Surface clipboardSurface = null;
private bool readClipboard = false;

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

    base.OnDispose(disposing);
}

void PreRender(Surface dst, Surface src)
{
    if (!readClipboard)
    {
        readClipboard = true;
        clipboardSurface = Services.GetService<IClipboardService>().TryGetSurface();
    }
}

// Here is the main render loop function
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 = src[x,y];
            if (IsCancelRequested) return;
            // If clipboard has an image, get it
            if (clipboardSurface != null)
            {
                CurrentPixel = clipboardSurface.GetBilinearSampleWrapped(x, y);
            }

            // TODO: Add additional pixel processing code here



            dst[x,y] = CurrentPixel;
        }
    }
}

This clipboard code is way faster than the older code CodeLab used to generate.  Notice that the try/catch blocks are gone. That speeds up our code a lot.

 

  • Like 2
  • Upvote 3
Link to comment
Share on other sites

  • BoltBait changed the title to CodeLab v4.3 (for advanced users) Released July 13, 2019

What a shame. I liked the new features of renaming the AmountX variables.
I wonder if it's possible to do the same thing with the RadioButtonList or DropDownList options so that using 'switch variableX' we can use 'case variableX.name:' instead of 'case 0 :, case 1:' etc.

Link to comment
Share on other sites

28 minutes ago, xod said:

I wonder if it's possible to do the same thing with the RadioButtonList or DropDownList options so that using 'switch variableX' we can use 'case variableX.name:'

 

Possibly, but it would probably be a bit clumsy.  But using numbers is clumsy too...

I do have idea on how to do it though, and it would require you to define an enum for each RadioButtonList or DropDownList. (right now, CodeLab generates these enums for you)

 

In Visual Studio it's much easier to use enums with RadioButtonList and DropDownList.

In CodeLab, the values are just cast to numbers, because that's the easiest thing to do.  (Because CodeLab generates the enums for you "behind the scenes", you have no way of knowing what they're named when you're working in the CodeLab editor.)

(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

9 minutes ago, toe_head2001 said:

...it would probably be a bit clumsy.

 

Starting from the beginning (the very first build of CodeLab that I worked on), I have tried to avoid "clumsy" at all costs.

 

I haven't always been successful, of course, but that's always been my goal--that, and ease of use.

  • Like 1
Link to comment
Share on other sites

Here's one possible solution, and it would retain the easier way too.

#region UICode
RadioButtonControl<Positions> position = 0; // [1] Image Position|On the Left|In the Center|On the Right
#endregion

enum Positions
{
    Left,
    Center,
    Right
}

void Render(Surface dst, Surface src, Rectangle rect)
{
    switch (position)
    {
        case Positions.Left:
            // Code Here
            break;
        case Positions.Center:
            // Code Here
            break;
        case Positions.Right:
            // Code Here
            break;
    }

    dst.CopySurface(src, rect.Location, rect);
}

 

If RadioButtonControl<TEnum> is too clumsy or confusing, a person could just continue using RadioButtonControl.

  • Like 1
  • Upvote 2

(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...

I've been using Snippets more and more in Visual Studio.

I wanted to add a bunch of them to CodeLab, but I don't think people want the same snippets that I do.

So... I'm thinking CodeLab could benefit from a Snippet Manager where you can add your own custom snippets.

 

For example, say you're working on your script, and you realize you need to retrieve the current palette.

You can have a snippet called curPal (or whatever), and it would expand into:

IReadOnlyList<ColorBgra> CurrentColors = Services.GetService<IPalettesService>().CurrentPalette; 

 

SnippetManager.png

 

 

As it stands, you have to open the Templates (File -> New), and generate a whole new file. Then you have to copy and paste the relevant line of code from one tab to another.  Unless of course you have that palette code memorized, and are willing to type it out.

 

Who wants this? Or is it just me?

  • Like 1
  • Upvote 3

(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 7/13/2019 at 5:57 PM, BoltBait said:

Rename Variables:

 

Select the variable you wish to rename and start typing... a light bulb will appear.  Click on that and you can rename your variable everywhere in the script where it appears.

 

Fantastic! That was the one thing that drove me crazy when I was reading the source code.  I was confused as heck as to figuring out what Amount1, Amount2, etc, meant without a well described variable name.  This is a great change to CodeLab.

Link to comment
Share on other sites

  • 3 weeks later...
  • 2 weeks later...

Here's an idea for a potentially annoying feature.

 

startPage.png

 

- It would only show when there's no saved Effect Token. Meaning you haven't opened CodeLab and clicked OK.

- There would be an option to completely disable it. See the CheckBox in the lower-right.

- It could speed up the time it takes to open CodeLab, since a few things would be deferred (the Scintilla control, the Intelligent Assistive initialization, and code compiling).  Although, the next version of CodeLab will already have some improvements to startup time, so the impact may not be grand.

- It would (hopefully) make CodeLab easier to use for first-time users.

 

 

So, a few questions for everyone using Codelab:

If this feature was implemented, would you would disable it?

How often do you use the default code when CodeLab opens? or do you usually Open an existing file or create a New file?

(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

I like this idea.

 

5 hours ago, toe_head2001 said:

If this feature was implemented, would you would disable it?

Probably Yes, because that will accumulate the experience in coding. But in any case, it should be possible to re-enable this feature.

 

5 hours ago, toe_head2001 said:

How often do you use the default code when CodeLab opens? or do you usually Open an existing file or create a New file?

I use all three methods equally.

Link to comment
Share on other sites

5 hours ago, toe_head2001 said:

If this feature was implemented, would you would disable it?

 

Nope. I like the hotlist of recent files - VS has something similar and I'll use it in 80% of cases.

 

5 hours ago, toe_head2001 said:

How often do you use the default code when CodeLab opens?

 

Very rarely these days. I used it a lot in the past.

 

5 hours ago, toe_head2001 said:

or do you usually Open an existing file or create a New file?

 

I'm more often opening an existing file.

 

 

Link to comment
Share on other sites

  • 2 weeks later...

CodeLab 4.4 Released

This is only for Paint.NET 4.2+!

 

Small update today...

 

(This was all @toe_head2001 as I've been super busy with a new job.)

 

Changes:
▪ Added a Snippet Manager
▪ Added suggested names to autocomplete
▪ Added keyboard shortcut ( Ctrl+] ) to go to matching brace
▪ Added option to specify an Enum on RadioButtonControl and ListBoxControlControl
▪ Added argument constraints to tooltips for generic methods and classes
▪ Improved method overload detection: detection of method parameter modifiers (out, ref, params); detection of inferred generic methods
▪ Lots of bug fixes, refactorings, and optimizations


Grab the CodeLab DLL here:

 

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

 

  • Upvote 4
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...