Jump to content

Signs you have been coding too much and/or deprived of sleep


Illnab1024
 Share

Recommended Posts

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 ...

;)

The Paint.NET Blog: https://blog.getpaint.net/

Donations are always appreciated! https://www.getpaint.net/donate.html

forumSig_bmwE60.jpg

Link to comment
Share on other sites

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... :P

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)

~~

Link to comment
Share on other sites

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.

The Paint.NET Blog: https://blog.getpaint.net/

Donations are always appreciated! https://www.getpaint.net/donate.html

forumSig_bmwE60.jpg

Link to comment
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.

 Share

×
×
  • Create New...