Rick Brewster

CodeLab v6.0 (for advanced users) Released June 25, 2020

Recommended Posts

Well, CodeLab can offer suggestion for everything that was valid as of the last successful compile.  So, it is still quite useful.

 

I think you've just stumbled upon an interesting paradox with "out" variables.

Share this post


Link to post
Share on other sites

It's not just the out variables. For instance, if I intend to define new variables at class level, meaning to type "double a, b;", when I get to the point of typing the "b", it unhelpfully replaces the "b" with "double" unless I left click or press escape. Because I'm not much of a typist, I spend most of my time looking at the keyboard, so I end up with all kinds of senseless stuff due to autocomplete.

Share this post


Link to post
Share on other sites
13 minutes ago, BoltBait said:

Well, CodeLab can offer suggestion for everything that was valid as of the last successful compile.

 

But that doesn't help much when I'm initially entering a new program, so there isn't yet a compilation.

Share this post


Link to post
Share on other sites

Back when I used CodeLab, I actually did struggled with autocomplete at times. Most of the time, I would like to have it disabled as it is a struggle at times. I don't look at keyboard when typing in.

Edited by Reptillian

Share this post


Link to post
Share on other sites

CodeLab 6.0 Released

This is only for Paint.NET 4.2.12+!

 

HUGE update today...

 

Changes:
 Switch to the Roslyn compiler to support C# 7.3 syntax (toe_head2001)
Added new Settings screen (BoltBait)
Build can now be executed by pressing F6 (BoltBait)
Syntax highlighting for Escape characters in strings is now enabled (toe_head2001)
Compiler Warning Level can now be changed (0-4) (toe_head2001)
Individual compiler warnings can be ignored (toe_head2001)
Added support for Extended Color syntax highlighting (VS '19 colors) (toe_head2001)
Added Spellchecking. Checks strings and comments in C# code, and plain text documents (toe_head2001)
Other new Settings include: Indent Spaces (2 or 4) and Current Line Frame (toe_head2001)
Minor code refactoring and bug fixes (toe_head2001 and BoltBait)

 


Grab the CodeLab DLL here:

 

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

 

 

File New Template Improvements:

 

(This feature was fixed in CodeLab v5.4, but I wanted to remind you of this change here as this was going to be saved for the 6.0 release. I did tweak it a bit for this release just to finish it.)

 

When I completely rewrote the File New Templates in CodeLab 5.0, I was under the assumption that it was OK to use the DST surface as a scratch surface during the calculation of your final results.  This is OK under some very narrow circumstances, but generally this should be avoided.  (This could cause your effects to have different results when previewing your effect and when clicking OK to finalize your image.)  In this release, I have removed this capability and replaced it with a second scratch surface called AUX.  So, now you have access to the source surface (SRC) which is your layer before any changes are made, a working surface (WRK) to use as a scratch surface if necessary, a second working surface (AUX) to use if necessary, and of course the destination surface (DST) where you store your final calculated pixels.

 

NewComplexUI.png

 

 

New Features:

 

  • Spellchecking:  

 

The Spellcheck feature does not work on Windows 7, since the required Windows Spellcheck competent is not present there.

Additional language dictionaries can be added in the Windows Settings. Languages that display an ABC✓ icon are compatible with Spellcheck.

Misspelled words can be ignored via the light bulb menu.  The ignore list can be managed on the Settings screen.

 

image.png

 

How to add additional spellcheck enabled languages from your Windows Settings screen:

 

Win10-Langs.png

 

  • Roslyn Compiler:

 

By switching to the Roslyn compiler, we now support up to C# 7.3 syntax.  So, EER will be happy to know that the following script will compile without error in CodeLab v6.0:

// Name: Roslyn Test
#region UICode
#endregion

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

            // Roslyn C# v7.0 syntax:
            switch (x)
            {
                case int n when (n >= 0 && n <= 25):
                    CurrentPixel = ColorBgra.Yellow;
                    break;
                case int n when (n >= 26 && n <= 50 ):
                    CurrentPixel = ColorBgra.Brown;
                    break;
                default:
                    CurrentPixel = ColorBgra.Gray;
                    break;
            }
            // End Test

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

It is not required to have Visual Studio on your system in order to take advantage of the Roslyn compiler... we are shipping a copy built-in to CodeLab, just like Visual Studio does.

 

As a side benefit to using the Roslyn compiler, we get better location information for syntax errors.  So, look for more accurate placing of those red underlines.

 

(BTW, we do not support C# 8.0 language features yet as that requires the Core library.  But, that will be easy for us to add once Paint.NET switches over to Core.)

 

  • Settings Screen:

 

In previous versions of CodeLab, there was lots of stuff in the View menu.  I have moved all of those settings into the new Settings screen.  Toe_head2001 moved his Snippets Manager in here as well.

 

image.png

 

 

  • Compiler Warnings:

 

Compiler warnings are now underlined in green. If you wish to ignore specific warning messages, right-click on one of those warnings and choose "Ignore this Warning" from the context menu. 

 

image.png

 

You can manage your ignore list on the settings screen:

 

image.png

 

Enjoy! 😎 :beer:

 

  • Like 1
  • Upvote 5

Share this post


Link to post
Share on other sites

CodeLab 6.0 in Russian

 

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

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

  • Upvote 1

Share this post


Link to post
Share on other sites
#region UICode
MultiLineTextboxControl text = "Some text here"; // [32767]
#endregion

In Preview Effect mode ► MultiLineTextboxControl is initialized with the empty string.
It is possible to keep the entered text?

Share this post


Link to post
Share on other sites
3 hours ago, NSD said:

#region UICode
MultiLineTextboxControl text = "Some text here"; // [32767]
#endregion

In Preview Effect mode ► MultiLineTextboxControl is initialized with the empty string.
It is possible to keep the entered text?

 

You can easily do this by converting your CodeLab script to a Visual Studio project.

 

We will consider this for the next release of CodeLab. But, barring a catastrophic error, the plan is for CodeLab v6.0 to live for a long time.  This will give us time to focus on other things, like update our individual plugin packs and tutorials, and develop new plugins, etc.

  • Upvote 2

Share this post


Link to post
Share on other sites

Couple of questions, maybe someone can redirect where to ask this if this isn't the right place.

 

Would anyone be interested in helping me port my Nuget package DataJuggler.PixelDatabase to a plug in for Paint.Net.

 

I installed Code Lab, but the examples I have seen all use sliders, I need a text box, and a button, not a slider, and I gave up when I hit a 'What do I know'.

 

Currently the most up to date version of my library is the .Net Core version that powers my site built in Blazor called PixelDatabase.Net.

 

I have a .Net Framework version, but I stopped support it due to everything is moving to .Net Core in VNext.

 

Is a .Net Framework the only Nuget I can link to?

 

I tried and didn't get very far due to sliders. Can someone recommend a plug in project that uses a text box instead of a slider?

 

Users all like controls such as sliders, but text is more powerful to me as you don't have to change your GUI to add new features.

 

PixelDatabase uses Bitmap Query Language, and I think some Paint.Net users will find it useful because I sure do.

 

Thanks

Share this post


Link to post
Share on other sites
On 3/11/2006 at 6:59 PM, BuzzKill said:

Thanks for the post!

For advanced users is correct! I myself have no idea how to write code.

However, there are some cool effects in the "Samples" folder included in the .zip file that you can fool around with. If for nothing else, grab this plugin for the included effects!

I know exactly how you feel BuzzKill. I know how to write code, even C# image processing code, but I don't know how to write this code, yet.

 

I did my first plug in, but it doesn't do what the tutorial said it would do.

 

The problem with computers is, they don't what you tell them. This is not to be confused with what you want it do.

Share this post


Link to post
Share on other sites
On 6/26/2020 at 3:47 PM, BoltBait said:

Thank you. How do I convert the CodeLab project to a VS project? I read that somewhere.

Edit: Here is the link, I found it: https://boltbait.com/pdn/CodeLab/help/tutorial5.asp

FYI this page still mentions: 'I am using Visual Studio 2010 Express.' It is 2020 now and VS 2019 has been out for a quite a while.

 

 

Quote

 

You can easily do this by converting your CodeLab script to a Visual Studio project.

 

We will consider this for the next release of CodeLab. But, barring a catastrophic error, the plan is for CodeLab v6.0 to live for a long time.  This will give us time to focus on other things, like update our individual plugin packs and tutorials, and develop new plugins, etc.

 

Edited by DataJuggler

Share this post


Link to post
Share on other sites
20 minutes ago, toe_head2001 said:

 

Don't waste your time with that. The process was automated a few years ago. Just the click on the 'Generate VS Solution' in CodeLab.

Just so you are aware my vision is not very good, but that being said, I do not see a 'Generate VS Solution' in CodeLab.

 

This is an old adage, but a picture is worth a thousand words here, and I will add 3 more. Please Show Me.

 

I found it. You have to click Build DLL, and at the bottom there is a Generate VS Solution. Sorry, I am new to all this.

 

Thanks

 

Generate VS Solution.png

 

Edited by DataJuggler

Share this post


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

Don't waste your time with that. The process was automated a few years ago.

 

This is exactly why we want v6.0 to live for a long time so we can have time to update all of the outdated tutorials.

 

1 hour ago, DataJuggler said:

I found it. You have to click Build DLL, and at the bottom there is a Generate VS Solution.

 

I'm glad you found it. Yes, that's exactly it.  Just be sure to fill out the form completely before pressing that button so that the info on that form makes it's way to the new project.

Share this post


Link to post
Share on other sites

It is possible to set this in CodeLab?

new EffectOptions () {Flags = EffectFlags.Configurable, RenderingSchedule = EffectRenderingSchedule.Tiles1024x1024})

This seems to offer the highest rendering speed on my system.

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.