Illnab1024 Posted October 13, 2006 Share Posted October 13, 2006 Take a look: I spent 30 to 40 minutes "debugging" that... :? EDIT: And Rick, before you say anything, I have the 2.6x source, and haven't bothered to get 2.72 Quote ~~ Link to comment Share on other sites More sharing options...
Rick Brewster Posted October 13, 2006 Share Posted October 13, 2006 You know, you can just do something simpler PrimaryColor = EnvironmentParameters.ForeColor; // P.S. why were you casting to ColorBgra? SecondaryColor = EnvironmentParameters.BackColor; if (token.Invert) { Swap(ref PrimaryColor, ref SecondaryColor); } ... void Swap(ref T a, ref T { T temp = a; a = b; b = temp; } It may seem heavyweight, but it makes the logic simpler to write, and clearer to read. And don't worry about it too much, sometimes it just takes a fresh night of sleep, or 3 seconds of anyone else looking at the code ("What am I doing wrong here!?"). I've personally helped out on the latter type of situation in way more times than I can recollect -- usually times with developers much more senior than myself Not that I'm trying to boast about my "l33tness", just pointing out that it happens to everyone. Actually my favorite conversation recently went something like this: Other dev, over IM: Hey Rick is there a function that you can use to get which window has the focus? (emphasis added by me) (myself: spends 3 seconds pawing through MSDN) Me: Yeah. Me: It's called GetFocus(). Other dev: Thanks we spent an hour trying to find it ... 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...
Illnab1024 Posted October 13, 2006 Author Share Posted October 13, 2006 To your comment...I dunno...ask BoltBait...I just had to Mock everything up for the GUI... (Although I think it has something to do with problems earlier in the code, or something to that effect, and the wrinkle was never pushed out). In addition, Nice idea, but I figure it would be better just to throw the if statmenets in there and try not to do it around midnight Love that example...just makes me feel better as a beginner myself... Funny thing is, after that "bug", I went and fixed a crack in the UI radio buttons, and the thing was ready to compile...completely functional... (Expect a download on the new Gradient plugin tomorrow) Quote ~~ Link to comment Share on other sites More sharing options...
carbonize Posted October 13, 2006 Share Posted October 13, 2006 No you know you've been coding to much when you dream that the world is made of code and you can see how it all works. Scary thing is it all makes perfect sense at the time as well. I think that was th day I'd spent something stupid like 12 hours working on a project. Quote C A R B O N I Z E Link to comment Share on other sites More sharing options...
Illnab1024 Posted October 14, 2006 Author Share Posted October 14, 2006 Oh my...yeah...there is a sign. Sounds fun...I just wish you could type in your sleep... Quote ~~ Link to comment Share on other sites More sharing options...
nukemdomis Posted October 16, 2006 Share Posted October 16, 2006 That's a great example and SS of sleep deprivision. Some of us have been there time and time again. I call it "pixel vision". By the way I love the colors of whatever you were using to write code with. You'd really believe me if you saw my first site. Quote Link to comment Share on other sites More sharing options...
aatwo Posted October 16, 2006 Share Posted October 16, 2006 I dont get it Quote Deviant Art Gallery Link to comment Share on other sites More sharing options...
BoltBait Posted October 16, 2006 Share Posted October 16, 2006 The code was fine when I sent it to you... what happened? Quote Click to play: Download: BoltBait's Plugin Pack | CodeLab | and how about a Computer Dominos Game Link to comment Share on other sites More sharing options...
Illnab1024 Posted October 17, 2006 Author Share Posted October 17, 2006 I had to change the Primary and Secondary to Fore and Back. (I guess it is a 3.0 thing) Quote ~~ Link to comment Share on other sites More sharing options...
Rick Brewster Posted October 18, 2006 Share Posted October 18, 2006 ForeColor and BackColor are marked as [Obsolete] in 3.0. The terminology was changed to Primary and Secondary, and I finally went and made sure all the code was caught up to that fact. DLL's compiled for 2.xx that reference Fore/Back will still work. New DLL's compiled against 3.0 will not be able to use those properties. 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...
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.