Rick Brewster

CodeLab v5.2 (for advanced users) Released January 31, 2020

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

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

CodeLab 5.0 Released

This is only for Paint.NET 4.2+!

 

HUGE update today...

 

Changes:
▪ Added TXT file support (toe_head2001)
▪ Added File Type plugin development support (toe_head2001)
▪ Added Shape (xaml) editing support (toe_head2001)
▪ File New Templates completely rewritten to allow multi-effect pipeline (BoltBait)
▪ Lots of bug fixes, refactorings, and optimizations


Grab the CodeLab DLL here:

 

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

 

Screenshots:
 

How to access the new features we added to CodeLab:

NewMenu.png

 

New Effect screen:

 

FileNewUI.png

It is now possible to string together as many Effects, Pixel Ops, Blend Modes, Surface Fills, and Surface Copies as you want. CodeLab will then write the code for you to combine all this into an effect.

 

Now, we understand that this is going to lead to an explosion of new plugins that just throw everything together into one UI.  As mods, we will be reviewing plugins posted in the Plugin Forum and deleting those that just aren't up to standards.  We don't want to discourage everyone from making their own plugins for their own machine. But, let's keep the quality up in our plugin forum. (Remember, noobs should be using plugins, not writing them.)

 

New Shape screen:

 

NewShapeUI.png

This is not an inclusion of the Shape Maker plugin. This is simply an editor for the actual .xaml shape files that Paint.NET uses.

It includes syntax highlighting and code completion.  CodeLab is now a complete replacement for the KAXAML editor in this tutorial.

 

 

Editing text files (nothing special, no syntax highlighting, just a place to keep notes, etc.):

 

NewTextUI.png

 

Designing and Implementing File Type Plugins:

 

FileTypeEditing.png

 

And, with this release, MY wish list for CodeLab is complete.

 

Enjoy! 😎 :beer: 

 

  • Like 2
  • Upvote 4

Share this post


Link to post
Share on other sites

Grandly!!! Due to a chronic lack of time, I am not ready to publish the Russian version now - it will take 4-5 days.

Share this post


Link to post
Share on other sites

Action sequence
File -> New -> Effect -> Category: Blend, Mode: User selected -> Add -> Generate Code
causes an error in the script because it does not create a control in #region UICode.

Share this post


Link to post
Share on other sites

OK, I checked in a fix for this.  As this is pretty minor, let's see if anything else needs fixing before publishing a new release.

Share this post


Link to post
Share on other sites

Try

File -> New -> Effect -> Fill -> Primary (or Secondary) -> Add -> Generate Code

and we have another error in the script.

Share this post


Link to post
Share on other sites
27 minutes ago, ReMake said:

we have another error

 

Yes we do!

 

Thanks, I will fix it right now.

 

Keep looking for errors!  When I rewrote the File New screen it was over 2,000 lines of all new code. So, finding an error or two in that section is not surprising.

Share this post


Link to post
Share on other sites
1 hour ago, ReMake said:

Try

File -> New -> Effect -> Fill -> Primary (or Secondary) -> Add -> Generate Code

and we have another error in the script.

 

OK, that's fixed.

 

Anything else?

Share this post


Link to post
Share on other sites
7 minutes ago, Ego Eram Reputo said:

I still want them to write a book on it....

 

With a potential audience of at most a dozen people... I'll get right on that!

Share this post


Link to post
Share on other sites
On 1/13/2020 at 5:26 AM, Ego Eram Reputo said:

Working title  "learn to code in C# using...Codelab and paint.net!" :mrgreen:

 

 

On 1/13/2020 at 12:57 PM, lynxster4 said:

 

I'd read it @BoltBait

 

Me too. Any good explanation of coding is a welcome.

 

Best

Share this post


Link to post
Share on other sites

The new version removed the ability to open a file and build a dll. Now the only way to do it is to copy the file content into the editor and save it to a file to be allowed to build a dll, preview the plugin and etc.

Is there possibility to be added character for identation and space width of it (like 1 tab with width of 2 spaces)? Could you add ability to save the dll directly and to a directory instead to zipping it to the desktop? Can you allow reloading of a tab if you edit it from outside the editor, because now reopening it will cause a creation of a new tab? The last one is a bit tricky probably, but I see the generated code in the region "User Entered Code". Can you add ability to see the full source in the editor and directly change it. It can be done easily with user regions inside the generated code or vice versa.

Share this post


Link to post
Share on other sites
1 hour ago, anon3 said:

The new version removed the ability to open a file and build a dll. Now the only way to do it is to copy the file content into the editor and save it to a file to be allowed to build a dll, preview the plugin and etc.

 

It works for me.  Can you give the specific steps that demonstrate the issue?

 

1 hour ago, anon3 said:

Is there possibility to be added character for identation and space width of it (like 1 tab with width of 2 spaces)?

 

A tab width of 2 spaces instead of 4 spaces?  Yes, it would be very easy to add that option.

 

1 hour ago, anon3 said:

Could you add ability to save the dll directly and to a directory instead to zipping it to the desktop?

 

Possible? Yes.

Please explain why you would want to do that.

 

1 hour ago, anon3 said:

Can you allow reloading of a tab if you edit it from outside the editor, because now reopening it will cause a creation of a new tab?

 

Maybe.

 

1 hour ago, anon3 said:

The last one is a bit tricky probably, but I see the generated code in the region "User Entered Code". Can you add ability to see the full source in the editor and directly change it. It can be done easily with user regions inside the generated code or vice versa.

 

Absolutely not. That would defeat the purpose of using CodeLab. If you want the full source code, you should be using Visual Studio.

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.