Merge pull request #1652 from slevenbits/stringValue-fix

stringValue fix
Merge pull request #1364 from walisser/master

Doc-modal/window-modal sheets and other sheet issues [+1]
Refs #1364. Add an `index-debug.html` to test app.
Refs #1364. Formatting, don't shadow `window` global.
Refs #1364. Fix CPTextField test to work with new sheet changes.
Refs #1364. Fixed: incorrect key window change when displaying a sheet.

When the key window changes the previous window's resignKeyWindow must be called.
Refs #1364. Don't orderFront: sheet parent view twice.

The sheet's orderFront: already calls the parent window's orderFront:, no need to call it by hand.
Refs #1364. Avoid repeated makeFirstResponder: calls within sheet parent.

If a window contained a text field which was the initial first responder, and the window was displaying a sheet, clicking on the window would cause the text field to alternate between being the first responder and not.

This was caused by the window `orderFront:` setting its first responder to the initial responder if there wasn't any responder yet. This would cause the text field to focus, even that the window wasn't the key window, and then on the next click the text field would blur which would make the text field automatically resign its first responder status.

The solution is to leave the first responder status alone if a window which isn't the key window is `orderFront:`ed. This appears to be more sensible UX in general. You don't expect the first responder of non-key windows to change when you click it's background.
Fixed: non-key window text fields tried to receive input, looked active.

Only the first responder of the key window should receive text input. This is important in multi-window apps or windows with sheets.

In the multi window case it should be possible to switch between two windows with first responder text fields and keep right on typing. First responder status should not be lost, but new typing should always go into the first responder text field of the key window.

For sheets, a text field which was active when the sheet opened should not receive input nor look active while the sheet is open.
Fixed: in recent revisions vertical text centring was off by 1 upwards, including window titles.

This was caused by making text display generally 1 px taller to allow for fractional pixels at the bottom to show. This should however not be allowed to affect positioning (even if there is a fractional pixel below vertically centred text the text should not move up 0.5 px.)
Inactive window title, start on window theming support.

Now the key window can be recognised by the window title.
Pull up window title code to a superclass for reuse.
Inactive HUD window title.

Also fix close and title positioning.
Merge pull request #1654 from slevenbits/key-window-style

Inactive (non-key) window titles. Layout tweaks.
Refs #1654. Fix up missing bits.
Fixed: the size with string fix broke `metricsOfFont:`.
Fixed: in Firefox the text of edited text fields would "jump" down 1 px.

Locking down the line height and vertical alignment explicitly seems to work in Safari 6, Chrome 21, Firefox 14 and IE 8 (although Chrome and IE exhibit some unrelated horizontal jumping.)
Fixed: text field font size while editing was wrong in Internet Explorer.

Tested in Internet Explorer 8 and 9.
Fixed: horizontal text jump when editing text fields in some browsers.

We were compensating for a bug in Safari, older versions of Chrome and Firefox in our input placement. But new Chrome and neither IE 8 nor IE 9 needed it which resulted in the text being off in those browsers.
Test text fields with various sizes.