Rick Brewster

CodeLab v4.2 (for advanced users) Released March 18, 2019

Recommended Posts

Thanks for your hard work.
Is there any chance to Format Document and Find/Replace icons to be added to the toolbar?
 

Share this post


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

Thanks for your hard work.

 

You're welcome!

 

1 hour ago, xod said:

Is there any chance to Format Document

 

Easy.  Do you really use it that often?

 

1 hour ago, xod said:

and Find/Replace icons to be added to the toolbar?

 

Hmmm... not as easy.  We would need to highlight the icon if the Find window is open and close the window if clicked again...

 

 

Share this post


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

We would need to highlight the icon if the Find window is open and close the window if clicked again...

 

Would we though? Most programs don't do that with their find buttons.

 

Share this post


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

Easy.  Do you really use it that often?

 

Yes, I use it very often. But I think I could get used to the CTRL + Q combination.

 

Now, CodeLab became very confuse for me. What version I need to use?


ARWrKPN.png
 

Share this post


Link to post
Share on other sites

Normally, you would just start CodeLab using the top entry, "CodeLab...".  However,

 

On 3/18/2019 at 9:59 PM, BoltBait said:

When developing a CodeLab script that utilizes special rendering commands, CodeLab now has the ability to run under those conditions while you are developing your script:

CodeLabMenu.png

 

Share this post


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

 

Would we though? Most programs don't do that with their find buttons.

 

 

It's not absolutely necessary.

 

Are we as good as everyone else... or are we BETTER? :D 

  • Upvote 1

Share this post


Link to post
Share on other sites

If I run older scripts in Single Render Call or Legacy ROI mode, CodeLab freezes and I'm forced to close Paint.Net from Task Manager.

 

Edit:

Sorry, there was something wrong with my script.
CodeLab works perfectly.

Edited by xod

Share this post


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

If I run older scripts in Single Render Call or Legacy ROI mode, CodeLab freezes and I'm forced to close Paint.Net from Task Manager.

 

You'll need to give us more information.  I'm not seeing any lockups.  I am able to run older scripts in all 4 of the CodeLab modes.

 

EDIT:  How old is "older"?  I mean, you can't run scripts designed for CodeLab 1.0... but, more modern previous versions (CodeLab 2.0+) should be fine.

Share this post


Link to post
Share on other sites

CodeLab 4.2 in Russian

 

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

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

Share this post


Link to post
Share on other sites
On 3/20/2019 at 8:40 PM, xod said:

If I run older scripts in Single Render Call or Legacy ROI mode, CodeLab freezes and I'm forced to close Paint.Net from Task Manager.

 

Edit:

Sorry, there was something wrong with my script.

 

If your script is causing CodeLab to freeze, that's an issue.

Can you share the script with us, so we can investigate?

Share this post


Link to post
Share on other sites
On 3/25/2019 at 7:37 PM, toe_head2001 said:

 

If your script is causing CodeLab to freeze, that's an issue.

Can you share the script with us, so we can investigate?

 

Spoiler

// Name: Test
// Author: 
// Submenu: 
// URL:
// Title: 

#region UICode
ListBoxControl Amount1 = 0; // Options|Move X, Y|Diagonals
IntSliderControl Amount2 = 20; // [0,800] {Amount1} X
IntSliderControl Amount3 = 20; // [0,800] {Amount1} Y
IntSliderControl Amount4 = 20; // [0,800] {!Amount1} Step
CheckboxControl Amount5 = false; // [0,1] {Amount1} Show coordinates
#endregion

void Render(Surface dst, Surface src, Rectangle rect)
{
    Rectangle selection = this.EnvironmentParameters.GetSelection(src.Bounds).GetBoundsInt();
    dst.CopySurface(src, rect.Location, rect);

    float selTop = selection.Top;
    float selBot = selection.Bottom;
    float selLeft = selection.Left;
    float selRight = selection.Right;
    int step = Amount4;
    float fontSize = selection.Right/100;

    using (RenderArgs ra = new RenderArgs(dst))
    {
        Graphics gr = ra.Graphics;
        gr.Clip = new Region(rect);
        gr.SmoothingMode = SmoothingMode.AntiAlias;

        StringFormat format = new StringFormat();
        using(Pen pen = new Pen(Color.Black,1))
        using (Font txtFont = new Font("Tahoma", fontSize, FontStyle.Regular))
        using (SolidBrush txtBrush = new SolidBrush(Color.Blue))
        {
            switch(Amount1)
            {
                case 0: // Move Lines
                    PointF left = new PointF(selLeft - 1f, selTop + Amount2);
                    PointF rite = new PointF(selRight, selTop + Amount2);
                    PointF top = new PointF(Amount3 + selLeft, selTop - 1f);
                    PointF bot = new PointF(Amount3 + selLeft, selBot);
                    gr.DrawLine(pen, top, bot);
                    gr.DrawLine(pen, left, rite);
                    if (Amount5)
                    {
                        txtBrush.Color = Color.Blue;
                        format.Alignment = StringAlignment.Near;
                        format.LineAlignment = StringAlignment.Far;
                        gr.DrawString(Amount2.ToString(), txtFont, txtBrush, selLeft, selTop + Amount2, format);
                        txtBrush.Color = Color.Red;
                        format.Alignment = StringAlignment.Far;
                        format.LineAlignment = StringAlignment.Center;
                        gr.DrawString(Amount3.ToString(), txtFont, txtBrush, selLeft + Amount3, selTop + fontSize, format);
                    }
                    break;
                case 1: // Diagonals
                    for (int i = 1; i < selRight; i+=step) // if step (Amount4) = 0 CodeLab freezes. Logic Amount4 must be > 0. [1,800]
                    {
                        PointF topleft = new PointF(selLeft, selTop - i + 1f);
                        PointF botrite = new PointF(selRight + i - 1f, selBot);
                        gr.DrawLine(pen, topleft, botrite);
                        PointF topleft2 = new PointF(selLeft - i + 1f, selTop);
                        PointF botrite2 = new PointF(selRight, selBot + i - 1f );
                        gr.DrawLine(pen, topleft2, botrite2);
                    }
                    break;
            }
        }
    }
}

 

 

Edited by xod

Share this post


Link to post
Share on other sites
44 minutes ago, xod said:

if step (Amount4) = 0 CodeLab freezes.

 

Well, of course it does--you've created an endless loop.

Share this post


Link to post
Share on other sites

Here's a little sneak peek of what I'm working on.

Disclaimer: It's half broken, and a work-in-progress.

 

vs2019-colors.png

 

Visual Studio 2019 colors:

Yellow for Methods

Aquamarine for Structs

Purple for certain Keywords

Light Blue for Parameters and Local Variables

  • Like 1
  • Upvote 3

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.