- windowWidth = ( SW_PAD + imageWidth + SW_SPACE + dataWidth + SW_PAD );
- windowHeight = ( SW_PAD + contentHeight + SW_PAD );
- [self setFrame:NSMakeRect(SW_BORDER, SW_BORDER, windowWidth, windowHeight) display:YES];
- [[[self contentView] subviews] makeObjectsPerformSelector:@selector(removeFromSuperview)];
+ windowWidth = ( (SW_PAD / divisor) + imageWidth + ((dataWidth > 0) ? (SW_SPACE / divisor) + dataWidth : 0) + (SW_PAD / divisor) );
+ windowHeight = ( (SW_PAD / divisor) + contentHeight + (SW_PAD / divisor) );
+
+// Constrain size to max limits. Adjust data sizes accordingly.
+ excessWidth = (windowWidth - maxWidth );
+ excessHeight = (windowHeight - maxHeight);
+
+ if ( excessWidth > 0.0 ) {
+ windowWidth = maxWidth;
+ dataWidth -= excessWidth;
+ }
+
+ if ( excessHeight > 0.0 ) {
+ windowHeight = maxHeight;
+ dataHeight -= excessHeight;
+ }
+
+ if ( [self horizontalPosition] == ITWindowPositionLeft ) {
+ windowOrigin.x = ( SW_BORDER + screenOrigin.x );
+ } else if ( [self horizontalPosition] == ITWindowPositionCenter ) {
+ windowOrigin.x = ( screenOrigin.x + (screenWidth / 2) - (windowWidth / 2) );
+ } else if ( [self horizontalPosition] == ITWindowPositionRight ) {
+ windowOrigin.x = ( screenOrigin.x + screenWidth - (windowWidth + SW_BORDER) );
+ }
+
+ if ( [self verticalPosition] == ITWindowPositionTop ) {
+ windowOrigin.y = ( screenOrigin.y + screenHeight - (windowHeight + SW_BORDER) );
+ } else if ( [self verticalPosition] == ITWindowPositionMiddle ) {
+// Middle-oriented windows should be slightly proud of the screen's middle.
+ windowOrigin.y = ( (screenOrigin.y + (screenHeight / 2) - (windowHeight / 2)) + (screenHeight / 8) );
+ } else if ( [self verticalPosition] == ITWindowPositionBottom ) {
+ windowOrigin.y = ( SW_BORDER + screenOrigin.y );
+ }
+
+ [self setFrame:NSMakeRect( windowOrigin.x,
+ windowOrigin.y,
+ windowWidth,
+ windowHeight) display:YES animate:shouldAnimate];