If you watch the ‘Timesheet’ screencast, you see at the end I delete the hours for one day because it’s a holiday. Thinking about it, that’s really dumb. Horizon should know it’s a holiday, and just skip over it. So, I finally have a use for User Preferences: storing holidays. Now, there are basically two types of holidays, fixed holidays that occur on the same date every year, like Christmas, and ‘floating holidays’ that obey a set of rules, like Easter.
Now I figure for a first pass, I should just let the user enter the days they want used as holidays, with the option to repeat that date every year. So this is what i came up with:
The TableView will contain the name of the holiday and the date, with something like ‘XX’ to indicate repeating year. The name will be displayed on the main calendar, so the user knows why the repeat is skipping that date.
The Problem is, this process seems cumbersome. You have to add a new row, name it, select the date, set the year flag, and add it to the table. Does anyone have any better ideas? (Please?)
At least, I hope this is the final beta. 😛 Changing the date navigation was nearly as bad as I thought. You can thank either Cocoa, Objected-Oriented Programming, or my own brilliant code design.
The existing calendar navigation is a bit ugly and clunky, it was one of the first things I built, and the segmented control made sense at the time. This new concept is based on a suggestion from someone on IRC (I can’t remember who it was, apologies for that, and pipe up if you know who you are!)
And here it is with one of the navigation arrows highlighted with mouse-over:
Now, what I’d like to do is hang a menu off each button, that is activated by click-and-hold. The menu for the left button will have the previous 12 months, and the right button the next 12 months.
Somewhere in one of these two menus, I want to highlight the current month somehow, to give the user a quick way to return to today. I might be able to put a little icon to the left of the current month, I’ll have to read up on menus a bit.
I found this Determining Ideal Text Colors and figured it couldn’t be too hard to convert to Cocoa. This is the result:
- (NSColor *)idealTextColor:(NSColor *) bkgrdColor
float threshold = 0.411765;
float red, green, blue, alpha;
[bkgrdColor getRed:&red green:&green blue:&blue alpha:&alpha];
float bgDelta = (red * 0.299 + green * 0.587 + blue * 0.114);
return 1.0 - bgDelta < threshold ? [[NSColor blackColor] autorelease] : [[NSColor whiteColor] autorelease];
Just give it the color of the background, and it returns an NSColor (either white or black) that gives the best text contrast. I'm going to and this to Horizon real soon now, it should make the cells easier to read.
If I've done something dumb in the code, please let me know. 😛
Here it is: Horizon1.1-Beta.zip. Please download and play.
The major changes are the toolbar, and the single-click cell activation. Since they’re just re-using existing functionality, I don’t expect major problems, but you never know. I’ve also reset the expiration date, and changed the expiration period to 30 days.
Let me know of any issues through any of the usual channels, including #macsb.
(BTW, I’m still updating the help files. But nobody ever looks at those anyway, right?)
I’ve been working (feverishly) on adding the toolbar to Horizon, and this is what I’ve got so far.
The ‘Add Cell’ and ‘Delete Cell’ buttons are contextual. So if you have a calendar box highlighted, the ‘Add Cell’ button is enabled.
Also, if there is already a cell in that date, the ‘Add Cell’ caption changes to ‘Edit Cell’ and the ‘Delete Cell’ button becomes active.
The ‘Category Properties’ button just brings up the ‘Category Properties’ sheet, the same as the item on the ‘Gear’ menu at the bottom.
Let me know what you think. Feedback, please! 😉
So here’s the thing, I’m trying to figure out what behaviour the user would most likely expect when they click on a calendar cell that already has a value in it. Right now, it’s set to abort the creation of a new cell, since one already exists, but it could just as easily edit the existing cell.
So, in this screenshot, there’s already a cell at May 16. If the user double-clicks on May 16, or clicks the ‘Add Cell’ button on the toolbar, what should happen? Should they get a message that there’s already a cell there, or should it just drop into edit mode, putting the value of the cell in the Cell Value text field?