Mike Ryan Posted August 3, 2008 Share Posted August 3, 2008 Feature Request: Since CodeLab forces an Amount1, Amount2, etc for UI Elements, could you please include a find and replace feature? This would be extremely helpful for when dealing with reording of the UI Elements. Thanks! Quote Link to comment Share on other sites More sharing options...
Ego Eram Reputo Posted August 4, 2008 Share Posted August 4, 2008 Feature Request: Since CodeLab forces an Amount1, Amount2, etc for UI Elements, could you please include a find and replace feature? This would be extremely helpful for when dealing with reording of the UI Elements. Thanks! Mike have you seen PSPad? Have a look at this: http://www.pspad.com I use this to do most of the "grunt" work (like cutting and pasting code from other source files - as you can open multiple files at once). Then I call up CodeLab to polish my code (& make it run - hopefully ). I generally start with an effect template (heavily commented) which tells me how to use the new UI features in CodeLab, so I don't have to keep logging on to figure them out :!: Note: As CodeLab becomes more powerful I am using it more and more to write entire effects, but as you have noticed it has no find & replace (yet...,). Just a thought..., Quote ebook: Mastering Paint.NET | resources: Plugin Index | Stereogram Tut | proud supporter of Codelab plugins: EER's Plugin Pack | Planetoid | StickMan | WhichSymbol+ | Dr Scott's Markup Renderer | CSV Filetype | dwarf horde plugins: Plugin Browser | ShapeMaker Link to comment Share on other sites More sharing options...
BoltBait Posted August 4, 2008 Share Posted August 4, 2008 Thanks Ego Eram Reputo for supplying sample code for this control on this page: http://www.boltbait.com/pdn/codelab/hel ... html#Fonts That might be my code :wink: , but the idea to draw directly to the canvas using drawing routines definitely came from MadJik when he and I were discussing a plugin which later became Random Mazes: http://paintdotnet.forumer.com/viewtopic.php?p=148303#p148303. MadJik used g.DrawLine to draw the walls of his maze and I adapted this to work with g.DrawString. I would not have figured this out by myself and simply ran with his idea. That's OK. Everything MadJik knows he learned from me anyway. BTW, I use Notepad++ for my external editor. I highly recommend it. But, I'll look into adding some sort of refactoring... AND search/replace to CodeLab. Quote Download: BoltBait's Plugin Pack | CodeLab | and a Computer Dominos Game Link to comment Share on other sites More sharing options...
Mike Ryan Posted August 4, 2008 Share Posted August 4, 2008 I have been using Notepad++ for quite sometime, but thanks Ego and BB for the suggestions Quote Link to comment Share on other sites More sharing options...
pyrochild Posted August 5, 2008 Share Posted August 5, 2008 Hey BoltBait, type (not copy-paste) this line into Render in the default CodeLab script: invertcolorseffect.Render(new Rectangle[]{rect},0,1); now try it again but removing the indent first. Quote ambigram signature by Kemaru [i write plugins and stuff] If you like a post, upvote it! Link to comment Share on other sites More sharing options...
BoltBait Posted August 5, 2008 Share Posted August 5, 2008 Hmmm... Pressing } is causing a match in the wrong spot which is messing up your editor text. My advice: don't do that. Quote Download: BoltBait's Plugin Pack | CodeLab | and a Computer Dominos Game Link to comment Share on other sites More sharing options...
pyrochild Posted August 5, 2008 Share Posted August 5, 2008 And my advice: fix the bug. Quote ambigram signature by Kemaru [i write plugins and stuff] If you like a post, upvote it! Link to comment Share on other sites More sharing options...
BoltBait Posted August 5, 2008 Share Posted August 5, 2008 I know which one's easier. Quote Download: BoltBait's Plugin Pack | CodeLab | and a Computer Dominos Game Link to comment Share on other sites More sharing options...
pyrochild Posted August 5, 2008 Share Posted August 5, 2008 And I know which one will cause more headaches in the long run. Quote ambigram signature by Kemaru [i write plugins and stuff] If you like a post, upvote it! Link to comment Share on other sites More sharing options...
Spikehead777 Posted August 20, 2008 Share Posted August 20, 2008 I noticed a tiny bug in your plug-in. First of all, I'm using v1.2, and just downloaded it from your site. When you have indented text and you have sections of code separated by "{" and "}", if you add a new line between "{" and "}", first, it will indent the text to be flush with existing text, and then add 4,8,12,16,etc. depending on how many open brackets there are...I don't think I explained that well, so here's an example. 1. First, open CodeLab, and delete whatever script is in there. There should be absolutely nothing. 2. Type "text" without the quotes, and hit enter. Repeat this step a few times. 3. Hit End on your keyboard, type "{" without the quotes, and hit enter. 4. Hit End on your keyboard, type "text" without the quotes, and hit enter. Repeat this step a few times. 5. Repeat Steps 3 and 4 a few times. The text after the first "{" should ideally all be flush, but in the end, you have something that looks like this: text text text { text text text { text text text { text text Quote Wii Friend Codes (PM me with yours if you use mine): Super Smash Bros. Brawl: 0087-3452-9356 Mario Kart Wii: 2234-8268-1808 Guitar Hero World Tour: 403891994256 Link to comment Share on other sites More sharing options...
BoltBait Posted August 20, 2008 Share Posted August 20, 2008 Yeah, it's a mess right now. The problem is that both Curtis and I put in code to handle indenting... Curtis already fixed that kind of stuff for the next release for me by removing his indent handling. Give me a couple of days to finish my updates... Quote Download: BoltBait's Plugin Pack | CodeLab | and a Computer Dominos Game Link to comment Share on other sites More sharing options...
Ego Eram Reputo Posted August 29, 2008 Share Posted August 29, 2008 I'm having trouble with CodeLabs Double Vector UI control. I have pasted the sample UI code from BoltBaits website into CodeLab, but it generates an error when I build the *.dll. Here's the code I'm using...., /* ========================================================================== */ /* */ /* UI - Double Vector.cs */ /* Author: Curtis (via boltBaits Website) */ /* */ /* Description: How to use double Vector UI elements */ /* */ /* ========================================================================== */ #region UICode Pair Amount1=Pair.Create(0.0,0.0); // Position #endregion void Render(Surface dst, Surface src, Rectangle rect) { Rectangle selection = this.EnvironmentParameters.GetSelection(src.Bounds).GetBoundsInt(); ColorBgra PrimaryColor = (ColorBgra)EnvironmentParameters.PrimaryColor; int width = selection.Right - selection.Left; int height = selection.Bottom - selection.Top; // converts the Pair values to between 0 and 1 // where 0 is the left/top and 1 is the right/bottom. double px = (Amount1.First + 1) / 2; double py = (Amount1.Second + 1) / 2; // we can now convert these to actual pixel co-ordinates. int column = (int)Math.Round(px * width); int row = (int)Math.Round(py * height); for (int y = rect.Top; y { for (int x = rect.Left; x { if (x == column || y == row) { dst[x,y] = PrimaryColor; } else { dst[x,y] = src[x,y]; } } } } And the error is....., Error at line 119: Cannot implicitly convert type 'int' to 'PaintDotNet.Pair' (CS0029) [edit] Using the Interface Designer, I get this line, which works fine: Pair Amount1 = Pair.Create( 0.0 , 0.0 ); // Control Description But this one doesn't. Pair Amount2=Pair.Create(0.0,0.0); // Position Is the whitespace critical? [/edit] Quote ebook: Mastering Paint.NET | resources: Plugin Index | Stereogram Tut | proud supporter of Codelab plugins: EER's Plugin Pack | Planetoid | StickMan | WhichSymbol+ | Dr Scott's Markup Renderer | CSV Filetype | dwarf horde plugins: Plugin Browser | ShapeMaker Link to comment Share on other sites More sharing options...
BoltBait Posted August 29, 2008 Share Posted August 29, 2008 Oops! Yup. There's a bug in CodeLab. You can see the bug in line 119 of the source code if you "View Source", paste into Notepad++, and delete the first (comment) line. It is trying to build the control as an integer slider. That'll never work! EDIT: Yes, :oops: the space after the comma (here "Pair") is critical because CodeLab is trying to find an exact string in order to know what kind of control you want. I forgot to include possible spaces in the search string. I have fixed the example on the web site. If you use the built-in UI editor it generates the proper code. Quote Download: BoltBait's Plugin Pack | CodeLab | and a Computer Dominos Game Link to comment Share on other sites More sharing options...
BoltBait Posted September 16, 2008 Share Posted September 16, 2008 CodeLab 1.3 Release - Added Radio Button List control type [HELP] - Added Reseed Button control type [HELP] - Improved syntax highlighting (by Curtis) - Icons added to the editor UI (by Curtis) - Added editor commands for commenting/uncommenting a selection - Bug fixes Go get it here: http://boltbait.com/pdn/codelab/ Quote Download: BoltBait's Plugin Pack | CodeLab | and a Computer Dominos Game Link to comment Share on other sites More sharing options...
halyavin Posted September 17, 2008 Share Posted September 17, 2008 How to use several layers in the effect? For example, user must made selection in zero layer and effect adds first layer to it with respect to transparency. Or the effect blurs the first image with the radius determined by the first layer intensity. There are a lot of interesting ideas involving more than one layer. Quote Link to comment Share on other sites More sharing options...
BoltBait Posted September 17, 2008 Share Posted September 17, 2008 How to use several layers in the effect? For example, user must made selection in zero layer and effect adds first layer to it with respect to transparency. Or the effect blurs the first image with the radius determined by the first layer intensity. There are a lot of interesting ideas involving more than one layer. Paint.NET effects do not have access to data on other layers. This is a limitation of the Paint.NET effect system. Believe me, you are not the first person to ask for this type of access and Rick is considering it for a future version of Paint.NET. Quote Download: BoltBait's Plugin Pack | CodeLab | and a Computer Dominos Game Link to comment Share on other sites More sharing options...
Rick Brewster Posted September 25, 2008 Author Share Posted September 25, 2008 I updated the update date in the subject line. (say that 3x fast) Quote The Paint.NET Blog: https://blog.getpaint.net/ Donations are always appreciated! https://www.getpaint.net/donate.html Link to comment Share on other sites More sharing options...
MJW Posted December 4, 2008 Share Posted December 4, 2008 I have two questions about the Angle Chooser. First (which is sort of a request disguised as a question), why can't the default angle be set to any angle, not just 45 degrees? Second (which is mostly curiosity), how does CodeLab tell the difference between an Angle Chooser and a Double Slider? I assumed it used the data type and inline comments in the UICode region to decide on the control type, but a Double Slider with a range [-180,180] seems to be identical to an Angle Chooser. I'm probably overlooking something obvious. Quote Link to comment Share on other sites More sharing options...
BoltBait Posted December 4, 2008 Share Posted December 4, 2008 I have two questions about the Angle Chooser.First (which is sort of a request disguised as a question), why can't the default angle be set to any angle, not just 45 degrees? You'll see in a minute. Second (which is mostly curiosity), how does CodeLab tell the difference between an Angle Chooser and a Double Slider? I assumed it used the data type and inline comments in the UICode region to decide on the control type, but a Double Slider with a range [-180,180] seems to be identical to an Angle Chooser. I'm probably overlooking something obvious. CodeLab parses the UI block to determine what types of controls you want. Normally, it looks at the type that is required. However, in the case of a double slider and a double angle chooser, there is no difference between them. If you want to confused CodeLab, try this: Run CodeLab Press Ctrl-I Delete the 3 default controls. Change the control type to double slider. Change the defaults to -180, 45, 180. Click Add button. Notice that a double slider was added. Click OK. Run CodeLab again. Press Ctrl-I to rerun the UI designer. Notice that it is now an angle chooser. The fact is, CodeLab can't tell the difference between the two types of controls EXCEPT for the default angle. The reason for this is simple. I wanted to keep the system as simple as possible. This does cause a few problems, but overall, most people don't really notice and it has saved me a ton of programming. Now, if you really want to change the default angle of the angle chooser, you can either recompile CodeLab (source is available on my site) or "View Source" when building a dll, copy that source to another VS2005 project and change it there. Quote Download: BoltBait's Plugin Pack | CodeLab | and a Computer Dominos Game Link to comment Share on other sites More sharing options...
MJW Posted December 4, 2008 Share Posted December 4, 2008 Thanks for the quick response. Interesting that the answers to the questions were so closely related. Quote Link to comment Share on other sites More sharing options...
Tillerman Posted December 22, 2008 Share Posted December 22, 2008 I was wondering, does CodeLab support Classes and Interface structs? For example, if I write something in Visual Studio, and then import it into CodeLab, will it function? Quote My Internet Explorer 8 Concept.... My Deviant Art My Forum Link to comment Share on other sites More sharing options...
Simon Brown Posted December 26, 2008 Share Posted December 26, 2008 I have one request: Make the UI part of the saved file. Quote Link to comment Share on other sites More sharing options...
Simon Brown Posted January 20, 2009 Share Posted January 20, 2009 Do you mind a n00b taking a second to comment on the structure of a function in the source? :oops: In saveAsDLLToolStripMenuItem_Click you perform a series of checks on the name: // See if the file name is valid if (FileName.Trim() != "") { if (FileName.Trim().IndexOfAny(Path.GetInvalidFileNameChars()) >= 0) { MessageBox.Show("Name box includes one or more invalid characters:\r\n\r\n\\ / : * ? \" < > |", "Valid Name Required"); //txtScriptName.Focus(); } else { Uri location = new Uri(System.Reflection.Assembly.GetEntryAssembly().CodeBase); string fullPath = Uri.UnescapeDataString(System.IO.Path.GetDirectoryName(location.AbsolutePath)); fullPath = Path.Combine(fullPath, "Effects"); fullPath = Path.Combine(fullPath, FileName); fullPath = Path.ChangeExtension(fullPath, ".dll"); if (File.Exists(fullPath)) { MessageBox.Show("File " + fullPath + " already exists. Please choose another name for your DLL.", "File Exists"); //txtScriptName.Focus(); } else { // Let the user pick the submenu, menu name, and icon BuildForm myBuildForm = new BuildForm(FileName.Trim(), txtCode.Text); if (myBuildForm.ShowDialog() == DialogResult.OK) { // Everything is OK, BUILD IT! if (Build(true, myBuildForm.SubMenuStr, myBuildForm.MenuStr, myBuildForm.IconPathStr, myBuildForm.Author, myBuildForm.MajorVer, myBuildForm.MinorVer, myBuildForm.Support, myBuildForm.isAdjustment, myBuildForm.ViewSource)) { MessageBox.Show("Build succeeded!\r\n\r\nFile \"" + FileName.Trim() + ".DLL\" created.\r\n\r\nYou will need to restart Paint.NET to see it in the Effects menu.", "Build Finished"); } else { MessageBox.Show("I'm sorry, I was not able to build the DLL.\r\n\r\nPerhaps the file already exists and is in use by Paint.NET or there may be other build errors listed in the box below.", "Build Error"); } } } } } else { MessageBox.Show("Please enter a name for your effect before building a DLL.", "Name Required"); //txtScriptName.Focus(); } Surely the code would look cleaner like this? // See if the file name is valid if (FileName.Trim() == "") { MessageBox.Show("Please enter a name for your effect before building a DLL.", "Name Required"); return; } // Ensure that the name contains no invalid chars if (FileName.Trim().IndexOfAny(Path.GetInvalidFileNameChars()) >= 0) { MessageBox.Show("Name box includes one or more invalid characters:\r\n\r\n\\ / : * ? \" < > |", "Valid Name Required"); return; } Uri location = new Uri(System.Reflection.Assembly.GetEntryAssembly().CodeBase); string fullPath = Uri.UnescapeDataString(System.IO.Path.GetDirectoryName(location.AbsolutePath)); fullPath = Path.Combine(fullPath, "Effects"); fullPath = Path.Combine(fullPath, FileName); fullPath = Path.ChangeExtension(fullPath, ".dll"); // Check whether the file already exists if (File.Exists(fullPath)) { MessageBox.Show("File " + fullPath + " already exists. Please choose another name for your DLL.", "File Exists"); return; } // Let the user pick the submenu, menu name, and icon BuildForm myBuildForm = new BuildForm(FileName.Trim(), txtCode.Text); if (myBuildForm.ShowDialog() == DialogResult.OK) { // Everything is OK, BUILD IT! if (Build(true, myBuildForm.SubMenuStr, myBuildForm.MenuStr, myBuildForm.IconPathStr, myBuildForm.Author, myBuildForm.MajorVer, myBuildForm.MinorVer, myBuildForm.Support, myBuildForm.isAdjustment, myBuildForm.ViewSource)) { MessageBox.Show("Build succeeded!\r\n\r\nFile \"" + FileName.Trim() + ".DLL\" created.\r\n\r\nYou will need to restart Paint.NET to see it in the Effects menu.", "Build Finished"); } else { MessageBox.Show("I'm sorry, I was not able to build the DLL.\r\n\r\nPerhaps the file already exists and is in use by Paint.NET or there may be other build errors listed in the box below.", "Build Error"); } } So that the entire function's code isn't enclosed in more than a few layers of curly-brackets. Just my 20 pence. :wink: Quote Link to comment Share on other sites More sharing options...
ernow Posted March 13, 2009 Share Posted March 13, 2009 First of all: thanks for making CodeLab! I am playing with it and ran into a couple of things: The Build button doesn't respond. The entire image is being used as the background of the Vector widget while I expected the selection to be used. The Vector widget can't be given a default which causes the effect to default to something silly. Am I right that these are missing? Quote Link to comment Share on other sites More sharing options...
Axle Posted August 24, 2009 Share Posted August 24, 2009 how did you guys learn how to do the scripting?? Quote My Deviant Art | My Gallery Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.