Rick Brewster

CodeLab v4.4 (for advanced users) Released November 23, 2019

Recommended Posts

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.

 

 

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

CodeLab 4.4 in Russian

 

You can find the new version of CodeLab in Russian here.

Вы можете найти новую версию CodeLab на русском языке здесь.

Share this post


Link to post
Share on other sites

Here's some commentary for the items that may not be obvious:

 

Snippet Manager

 

This can be accessed from the toolbar. The icon for it is on the far right.

 

Snippets can be shared. They are Imported and Exported in the JSON format.

Here's an example you can import:

{
  "preRender": "void PreRender(Surface dst, Surface src)\r\n{\r\n    $\r\n}",
  "dw": "Debug.WriteLine($);",
  "curPal": "IReadOnlyList<ColorBgra> currentPallete = Services.GetService<IPalettesService>().CurrentPalette;"
}

 

A dollar sign ($) can used to control the placement of the text caret.

 

RadioButtonControl<TEnum> and ListBoxControlControl<TEnum>

 

This is kind of a hidden feature, since the UI Designer doesn't generate them for you.  If you want to take advantage of this feature, you just need to know it exists and how to use it.

Here's an example:

#region UICode
RadioButtonControl<Positions> position = Positions.Center; // 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);
}

 

Q. Doesn't this just add more code to my plugin, since it now has to include an extra Enum and the RadioButtonControl<TEnum> generic class?

A. No.

1) CodeLab would have to generated an Enum behind-the-scenes anyway. Your user-defined Enum negates the need for CodeLab to generate one.

2) A RadioButtonControl<TEnum> generic class doesn't exist. This is implemented as "syntax sugar". When the code is compiled, RadioButtonControl<> is stripped away leaving just your enum.

 

Argument Constraints for Generics in Tooltips

 

Not too many of the Generics you see in CodeLab have constraints, so here's a screenshot:

constraints.png

 

Edited by toe_head2001
typos
  • Upvote 3

Share this post


Link to post
Share on other sites

Thanks for this update!

 

Maybe in a later version this message will be resized on two lines of text to avoid the appearance of this extremely long window.

 

NqVSZx6.png

Share this post


Link to post
Share on other sites
2 hours ago, xod said:

Maybe in a later version this message will be resized on two lines of text to avoid the appearance of this extremely long window.

 

Yes, it's a run-on sentence, and needs a rewrite.

Share this post


Link to post
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.