mirror of
https://github.com/gnustep/apps-gorm.git
synced 2025-02-24 03:51:22 +00:00
* GormBoxEditor.m: removed NSLogs.
* GormViewEditor.m: neater display of intelligent placement hints. * GormControlEditor.m: intelligent placement take minsize into account. * GormViewWithContentEditor.m: fixed display problem when moving selection. git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/apps/gorm/trunk@14274 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
1452b805da
commit
3b8f69f231
5 changed files with 638 additions and 221 deletions
|
@ -1,7 +1,12 @@
|
|||
2002-08-14 Pierre-Yves Rivaille <pyrivail@ens-lyon.fr>
|
||||
|
||||
* GormSplitViewEditor.m: removean extra ; that was breaking gcc 2.*
|
||||
|
||||
* GormSplitViewEditor.m: removed an extra ; that was breaking gcc 2.*.
|
||||
* GormBoxEditor.m: removed NSLogs.
|
||||
* GormViewEditor.m: neater display of intelligent placement hints.
|
||||
* GormControlEditor.m: intelligent placement take minsize into account.
|
||||
* GormViewWithContentEditor.m: fixed display problem when moving
|
||||
selection.
|
||||
|
||||
2002-08-14 Pierre-Yves Rivaille <pyrivail@ens-lyon.fr>
|
||||
|
||||
* Major changes in editing widgets.
|
||||
|
|
|
@ -174,7 +174,7 @@
|
|||
|
||||
if (opened == NO)
|
||||
{
|
||||
NSLog(@"GormBoxEditor not opened");
|
||||
// NSLog(@"GormBoxEditor not opened");
|
||||
[super mouseDown: theEvent];
|
||||
return;
|
||||
}
|
||||
|
@ -183,14 +183,14 @@
|
|||
if ([[_EO hitTest: [theEvent locationInWindow]]
|
||||
isDescendantOf: contentViewEditor])
|
||||
{
|
||||
NSLog(@"md %@ descendant of", self);
|
||||
// NSLog(@"md %@ descendant of", self);
|
||||
if ([contentViewEditor isOpened] == NO)
|
||||
[contentViewEditor setOpened: YES];
|
||||
[contentViewEditor mouseDown: theEvent];
|
||||
}
|
||||
else
|
||||
{
|
||||
NSLog(@"md %@ not descendant of sending to %@", self, _EO);
|
||||
// NSLog(@"md %@ not descendant of sending to %@", self, _EO);
|
||||
if ([contentViewEditor isOpened] == YES)
|
||||
[contentViewEditor setOpened: NO];
|
||||
|
||||
|
|
|
@ -203,17 +203,278 @@
|
|||
gpi->oldRect.size.height += 2;
|
||||
}
|
||||
|
||||
// - (void) _displayFrameWithHint: (NSRect) frame
|
||||
// withPlacementInfo: (GormPlacementInfo*)gpi
|
||||
// {
|
||||
// float leftOfFrame = NSMinX(frame);
|
||||
// float rightOfFrame = NSMaxX(frame);
|
||||
// float topOfFrame = NSMaxY(frame);
|
||||
// float bottomOfFrame = NSMinY(frame);
|
||||
// int i;
|
||||
// int count;
|
||||
// int lastDistance;
|
||||
// int minimum = 10;
|
||||
// NSMutableArray *bests;
|
||||
// if (gpi->hintInitialized == NO)
|
||||
// {
|
||||
// [self _initializeHintWithInfo: gpi];
|
||||
// }
|
||||
|
||||
// {
|
||||
// if (gpi->firstPass == NO)
|
||||
// [gpi->resizingIn displayRect: gpi->oldRect];
|
||||
// else
|
||||
// gpi->firstPass = NO;
|
||||
// }
|
||||
// {
|
||||
// [gpi->resizingIn setNeedsDisplayInRect: gpi->lastLeftRect];
|
||||
// [[self window] displayIfNeeded];
|
||||
// gpi->lastLeftRect = NSZeroRect;
|
||||
// }
|
||||
// {
|
||||
// [gpi->resizingIn setNeedsDisplayInRect: gpi->lastRightRect];
|
||||
// [[self window] displayIfNeeded];
|
||||
// gpi->lastRightRect = NSZeroRect;
|
||||
// }
|
||||
// {
|
||||
// [gpi->resizingIn setNeedsDisplayInRect: gpi->lastTopRect];
|
||||
// [[self window] displayIfNeeded];
|
||||
// gpi->lastTopRect = NSZeroRect;
|
||||
// }
|
||||
// {
|
||||
// [gpi->resizingIn setNeedsDisplayInRect: gpi->lastBottomRect];
|
||||
// [[self window] displayIfNeeded];
|
||||
// gpi->lastBottomRect = NSZeroRect;
|
||||
// }
|
||||
|
||||
|
||||
// if (gpi->knob == IBTopLeftKnobPosition
|
||||
// || gpi->knob == IBMiddleLeftKnobPosition
|
||||
// || gpi->knob == IBBottomLeftKnobPosition)
|
||||
// {
|
||||
// bests = [NSMutableArray arrayWithCapacity: 4];
|
||||
// minimum = 6;
|
||||
// count = [gpi->leftHints count];
|
||||
// for ( i = 0; i < count; i++ )
|
||||
// {
|
||||
// lastDistance = [[gpi->leftHints objectAtIndex: i]
|
||||
// distanceToFrame: frame];
|
||||
// if (lastDistance < minimum)
|
||||
// {
|
||||
// bests = [NSMutableArray arrayWithCapacity: 4];
|
||||
// [bests addObject: [gpi->leftHints objectAtIndex: i]];
|
||||
// minimum = lastDistance;
|
||||
// }
|
||||
// else if (lastDistance == minimum)
|
||||
// [bests addObject: [gpi->leftHints objectAtIndex: i]];
|
||||
// }
|
||||
|
||||
// count = [bests count];
|
||||
|
||||
|
||||
// if (count >= 1)
|
||||
// {
|
||||
// float start, end, position;
|
||||
// position = [[bests objectAtIndex: 0] position];
|
||||
|
||||
// start = NSMinY(frame);
|
||||
// end = NSMaxY(frame);
|
||||
// for ( i = 0; i < count; i++ )
|
||||
// {
|
||||
// start = MIN(NSMinY([[bests objectAtIndex: i] frame]), start);
|
||||
// end = MAX(NSMaxY([[bests objectAtIndex: i] frame]), end);
|
||||
// }
|
||||
|
||||
// [[NSColor redColor] set];
|
||||
// NSRectFill(NSMakeRect(position - 1, start, 2, end - start));
|
||||
// gpi->lastLeftRect = NSMakeRect(position - 1, start, 2, end - start);
|
||||
// leftOfFrame = position;
|
||||
// }
|
||||
// }
|
||||
|
||||
// if (gpi->knob == IBTopRightKnobPosition
|
||||
// || gpi->knob == IBMiddleRightKnobPosition
|
||||
// || gpi->knob == IBBottomRightKnobPosition)
|
||||
// {
|
||||
// bests = [NSMutableArray arrayWithCapacity: 4];
|
||||
// minimum = 6;
|
||||
// count = [gpi->rightHints count];
|
||||
// for ( i = 0; i < count; i++ )
|
||||
// {
|
||||
// lastDistance = [[gpi->rightHints objectAtIndex: i]
|
||||
// distanceToFrame: frame];
|
||||
// if (lastDistance < minimum)
|
||||
// {
|
||||
// bests = [NSMutableArray arrayWithCapacity: 4];
|
||||
// [bests addObject: [gpi->rightHints objectAtIndex: i]];
|
||||
// minimum = lastDistance;
|
||||
// }
|
||||
// else if (lastDistance == minimum)
|
||||
// [bests addObject: [gpi->rightHints objectAtIndex: i]];
|
||||
// }
|
||||
|
||||
// count = [bests count];
|
||||
|
||||
|
||||
// if (count >= 1)
|
||||
// {
|
||||
// float start, end, position;
|
||||
// position = [[bests objectAtIndex: 0] position];
|
||||
|
||||
// start = NSMinY(frame);
|
||||
// end = NSMaxY(frame);
|
||||
// for ( i = 0; i < count; i++ )
|
||||
// {
|
||||
// start = MIN(NSMinY([[bests objectAtIndex: i] frame]), start);
|
||||
// end = MAX(NSMaxY([[bests objectAtIndex: i] frame]), end);
|
||||
// }
|
||||
|
||||
// [[NSColor redColor] set];
|
||||
// NSRectFill(NSMakeRect(position - 1, start, 2, end - start));
|
||||
// gpi->lastRightRect = NSMakeRect(position - 1, start, 2, end - start);
|
||||
// rightOfFrame = position;
|
||||
// }
|
||||
// }
|
||||
|
||||
// if (gpi->knob == IBTopRightKnobPosition
|
||||
// || gpi->knob == IBTopLeftKnobPosition
|
||||
// || gpi->knob == IBTopMiddleKnobPosition)
|
||||
// {
|
||||
// bests = [NSMutableArray arrayWithCapacity: 4];
|
||||
// minimum = 6;
|
||||
// count = [gpi->topHints count];
|
||||
// for ( i = 0; i < count; i++ )
|
||||
// {
|
||||
// lastDistance = [[gpi->topHints objectAtIndex: i]
|
||||
// distanceToFrame: frame];
|
||||
// if (lastDistance < minimum)
|
||||
// {
|
||||
// bests = [NSMutableArray arrayWithCapacity: 4];
|
||||
// [bests addObject: [gpi->topHints objectAtIndex: i]];
|
||||
// minimum = lastDistance;
|
||||
// }
|
||||
// else if (lastDistance == minimum)
|
||||
// [bests addObject: [gpi->topHints objectAtIndex: i]];
|
||||
// }
|
||||
|
||||
// count = [bests count];
|
||||
|
||||
|
||||
// if (count >= 1)
|
||||
// {
|
||||
// float start, end, position;
|
||||
// position = [[bests objectAtIndex: 0] position];
|
||||
|
||||
// start = NSMinX(frame);
|
||||
// end = NSMaxX(frame);
|
||||
// for ( i = 0; i < count; i++ )
|
||||
// {
|
||||
// start = MIN(NSMinX([[bests objectAtIndex: i] frame]), start);
|
||||
// end = MAX(NSMaxX([[bests objectAtIndex: i] frame]), end);
|
||||
// }
|
||||
|
||||
// [[NSColor redColor] set];
|
||||
// NSRectFill(NSMakeRect(start, position - 1, end - start, 2));
|
||||
// gpi->lastTopRect = NSMakeRect(start, position - 1, end - start, 2);
|
||||
// topOfFrame = position;
|
||||
// }
|
||||
// }
|
||||
|
||||
// if (gpi->knob == IBBottomRightKnobPosition
|
||||
// || gpi->knob == IBBottomLeftKnobPosition
|
||||
// || gpi->knob == IBBottomMiddleKnobPosition)
|
||||
// {
|
||||
// bests = [NSMutableArray arrayWithCapacity: 4];
|
||||
// minimum = 6;
|
||||
// count = [gpi->bottomHints count];
|
||||
// for ( i = 0; i < count; i++ )
|
||||
// {
|
||||
// lastDistance = [[gpi->bottomHints objectAtIndex: i]
|
||||
// distanceToFrame: frame];
|
||||
// if (lastDistance < minimum)
|
||||
// {
|
||||
// bests = [NSMutableArray arrayWithCapacity: 4];
|
||||
// [bests addObject: [gpi->bottomHints objectAtIndex: i]];
|
||||
// minimum = lastDistance;
|
||||
// }
|
||||
// else if (lastDistance == minimum)
|
||||
// [bests addObject: [gpi->bottomHints objectAtIndex: i]];
|
||||
// }
|
||||
|
||||
// count = [bests count];
|
||||
|
||||
|
||||
// if (count >= 1)
|
||||
// {
|
||||
// float start, end, position;
|
||||
// position = [[bests objectAtIndex: 0] position];
|
||||
|
||||
// start = NSMinX(frame);
|
||||
// end = NSMaxX(frame);
|
||||
// for ( i = 0; i < count; i++ )
|
||||
// {
|
||||
// start = MIN(NSMinX([[bests objectAtIndex: i] frame]), start);
|
||||
// end = MAX(NSMaxX([[bests objectAtIndex: i] frame]), end);
|
||||
// }
|
||||
|
||||
// [[NSColor redColor] set];
|
||||
// NSRectFill(NSMakeRect(start, position - 1, end - start, 2));
|
||||
// gpi->lastBottomRect = NSMakeRect(start, position - 1, end - start, 2);
|
||||
// bottomOfFrame = position;
|
||||
// }
|
||||
// }
|
||||
|
||||
// gpi->hintFrame = NSMakeRect (leftOfFrame, bottomOfFrame,
|
||||
// rightOfFrame - leftOfFrame,
|
||||
// topOfFrame - bottomOfFrame);
|
||||
|
||||
// GormShowFrameWithKnob(gpi->hintFrame, gpi->knob);
|
||||
// gpi->oldRect = GormExtBoundsForRect(gpi->hintFrame);
|
||||
// gpi->oldRect.origin.x--;
|
||||
// gpi->oldRect.origin.y--;
|
||||
// gpi->oldRect.size.width += 2;
|
||||
// gpi->oldRect.size.height += 2;
|
||||
|
||||
// }
|
||||
|
||||
#undef MIN
|
||||
#undef MAX
|
||||
|
||||
#define MIN(a,b) (a>b?b:a)
|
||||
#define MAX(a,b) (a>b?a:b)
|
||||
|
||||
|
||||
- (void) _displayFrameWithHint: (NSRect) frame
|
||||
withPlacementInfo: (GormPlacementInfo*)gpi
|
||||
{
|
||||
float leftOfFrame = NSMinX(frame);
|
||||
float rightOfFrame = NSMaxX(frame);
|
||||
float topOfFrame = NSMaxY(frame);
|
||||
float bottomOfFrame = NSMinY(frame);
|
||||
float leftOfFrame;
|
||||
float rightOfFrame;
|
||||
float topOfFrame;
|
||||
float bottomOfFrame;
|
||||
int i;
|
||||
int count;
|
||||
int lastDistance;
|
||||
int minimum = 10;
|
||||
BOOL leftEmpty = YES;
|
||||
BOOL rightEmpty = YES;
|
||||
BOOL topEmpty = YES;
|
||||
BOOL bottomEmpty = YES;
|
||||
float bestLeftPosition;
|
||||
float bestRightPosition;
|
||||
float bestTopPosition;
|
||||
float bestBottomPosition;
|
||||
float leftStart;
|
||||
float rightStart;
|
||||
float topStart;
|
||||
float bottomStart;
|
||||
float leftEnd;
|
||||
float rightEnd;
|
||||
float topEnd;
|
||||
float bottomEnd;
|
||||
NSSize minSize;
|
||||
|
||||
minSize = [[_EO cell] cellSize];
|
||||
|
||||
NSMutableArray *bests;
|
||||
if (gpi->hintInitialized == NO)
|
||||
{
|
||||
|
@ -248,47 +509,94 @@
|
|||
}
|
||||
|
||||
|
||||
if (frame.size.width < minSize.width)
|
||||
{
|
||||
switch (gpi->knob)
|
||||
{
|
||||
case IBBottomLeftKnobPosition:
|
||||
case IBMiddleLeftKnobPosition:
|
||||
case IBTopLeftKnobPosition:
|
||||
frame.origin.x = NSMaxX([self frame]) - minSize.width;
|
||||
frame.size.width = minSize.width;
|
||||
break;
|
||||
case IBTopRightKnobPosition:
|
||||
case IBMiddleRightKnobPosition:
|
||||
case IBBottomRightKnobPosition:
|
||||
frame.size.width = minSize.width;
|
||||
break;
|
||||
case IBTopMiddleKnobPosition:
|
||||
case IBBottomMiddleKnobPosition:
|
||||
case IBNoneKnobPosition:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (frame.size.height < minSize.height)
|
||||
{
|
||||
switch (gpi->knob)
|
||||
{
|
||||
case IBBottomLeftKnobPosition:
|
||||
case IBBottomRightKnobPosition:
|
||||
case IBBottomMiddleKnobPosition:
|
||||
frame.origin.y = NSMaxY([self frame]) - minSize.height;
|
||||
frame.size.height = minSize.height;
|
||||
break;
|
||||
case IBTopMiddleKnobPosition:
|
||||
case IBTopRightKnobPosition:
|
||||
case IBTopLeftKnobPosition:
|
||||
frame.size.height = minSize.height;
|
||||
break;
|
||||
case IBMiddleLeftKnobPosition:
|
||||
case IBMiddleRightKnobPosition:
|
||||
case IBNoneKnobPosition:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
leftOfFrame = NSMinX(frame);
|
||||
rightOfFrame = NSMaxX(frame);
|
||||
topOfFrame = NSMaxY(frame);
|
||||
bottomOfFrame = NSMinY(frame);
|
||||
|
||||
|
||||
if (gpi->knob == IBTopLeftKnobPosition
|
||||
|| gpi->knob == IBMiddleLeftKnobPosition
|
||||
|| gpi->knob == IBBottomLeftKnobPosition)
|
||||
{
|
||||
bests = [NSMutableArray arrayWithCapacity: 4];
|
||||
minimum = 10;
|
||||
minimum = 6;
|
||||
count = [gpi->leftHints count];
|
||||
for ( i = 0; i < count; i++ )
|
||||
{
|
||||
lastDistance = [[gpi->leftHints objectAtIndex: i]
|
||||
distanceToFrame: frame];
|
||||
if (lastDistance < minimum)
|
||||
if ((lastDistance < minimum)
|
||||
&& (rightOfFrame - [[gpi->leftHints objectAtIndex: i] position]
|
||||
>= minSize.width))
|
||||
{
|
||||
bests = [NSMutableArray arrayWithCapacity: 4];
|
||||
[bests addObject: [gpi->leftHints objectAtIndex: i]];
|
||||
minimum = lastDistance;
|
||||
bestLeftPosition = [[gpi->leftHints objectAtIndex: i] position];
|
||||
leftEmpty = NO;
|
||||
}
|
||||
else if (lastDistance == minimum)
|
||||
else if ((lastDistance == minimum) && (leftEmpty == NO)
|
||||
&& ([[gpi->leftHints objectAtIndex: i] position] == bestLeftPosition))
|
||||
[bests addObject: [gpi->leftHints objectAtIndex: i]];
|
||||
}
|
||||
|
||||
count = [bests count];
|
||||
|
||||
|
||||
if (count >= 1)
|
||||
{
|
||||
float start, end, position;
|
||||
position = [[bests objectAtIndex: 0] position];
|
||||
|
||||
start = NSMinY(frame);
|
||||
end = NSMaxY(frame);
|
||||
for ( i = 0; i < count; i++ )
|
||||
leftStart = NSMinY([[bests objectAtIndex: 0] frame]);
|
||||
leftEnd = NSMaxY([[bests objectAtIndex: 0] frame]);
|
||||
|
||||
for ( i = 1; i < count; i++ )
|
||||
{
|
||||
start = MIN(NSMinY([[bests objectAtIndex: i] frame]), start);
|
||||
end = MAX(NSMaxY([[bests objectAtIndex: i] frame]), end);
|
||||
leftStart = MIN(NSMinY([[bests objectAtIndex: i] frame]), leftStart);
|
||||
leftEnd = MAX(NSMaxY([[bests objectAtIndex: i] frame]), leftEnd);
|
||||
}
|
||||
|
||||
[[NSColor redColor] set];
|
||||
NSRectFill(NSMakeRect(position - 1, start, 2, end - start));
|
||||
gpi->lastLeftRect = NSMakeRect(position - 1, start, 2, end - start);
|
||||
leftOfFrame = position;
|
||||
leftOfFrame = bestLeftPosition;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -297,42 +605,39 @@
|
|||
|| gpi->knob == IBBottomRightKnobPosition)
|
||||
{
|
||||
bests = [NSMutableArray arrayWithCapacity: 4];
|
||||
minimum = 10;
|
||||
minimum = 6;
|
||||
count = [gpi->rightHints count];
|
||||
for ( i = 0; i < count; i++ )
|
||||
{
|
||||
lastDistance = [[gpi->rightHints objectAtIndex: i]
|
||||
distanceToFrame: frame];
|
||||
if (lastDistance < minimum)
|
||||
if (lastDistance < minimum
|
||||
&& ([[gpi->rightHints objectAtIndex: i] position] - leftOfFrame
|
||||
>= minSize.width))
|
||||
{
|
||||
bests = [NSMutableArray arrayWithCapacity: 4];
|
||||
[bests addObject: [gpi->rightHints objectAtIndex: i]];
|
||||
minimum = lastDistance;
|
||||
bestRightPosition = [[gpi->rightHints objectAtIndex: i] position];
|
||||
rightEmpty = NO;
|
||||
}
|
||||
else if (lastDistance == minimum)
|
||||
else if ((lastDistance == minimum) && (rightEmpty == NO)
|
||||
&& ([[gpi->rightHints objectAtIndex: i] position] == bestRightPosition))
|
||||
[bests addObject: [gpi->rightHints objectAtIndex: i]];
|
||||
}
|
||||
|
||||
count = [bests count];
|
||||
|
||||
|
||||
if (count >= 1)
|
||||
{
|
||||
float start, end, position;
|
||||
position = [[bests objectAtIndex: 0] position];
|
||||
|
||||
start = NSMinY(frame);
|
||||
end = NSMaxY(frame);
|
||||
for ( i = 0; i < count; i++ )
|
||||
rightStart = NSMinY([[bests objectAtIndex: 0] frame]);
|
||||
rightEnd = NSMaxY([[bests objectAtIndex: 0] frame]);
|
||||
|
||||
for ( i = 1; i < count; i++ )
|
||||
{
|
||||
start = MIN(NSMinY([[bests objectAtIndex: i] frame]), start);
|
||||
end = MAX(NSMaxY([[bests objectAtIndex: i] frame]), end);
|
||||
rightStart = MIN(NSMinY([[bests objectAtIndex: i] frame]), rightStart);
|
||||
rightEnd = MAX(NSMaxY([[bests objectAtIndex: i] frame]), rightEnd);
|
||||
}
|
||||
|
||||
[[NSColor redColor] set];
|
||||
NSRectFill(NSMakeRect(position - 1, start, 2, end - start));
|
||||
gpi->lastRightRect = NSMakeRect(position - 1, start, 2, end - start);
|
||||
rightOfFrame = position;
|
||||
rightOfFrame = bestRightPosition;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -341,42 +646,39 @@
|
|||
|| gpi->knob == IBTopMiddleKnobPosition)
|
||||
{
|
||||
bests = [NSMutableArray arrayWithCapacity: 4];
|
||||
minimum = 10;
|
||||
minimum = 6;
|
||||
count = [gpi->topHints count];
|
||||
for ( i = 0; i < count; i++ )
|
||||
{
|
||||
lastDistance = [[gpi->topHints objectAtIndex: i]
|
||||
distanceToFrame: frame];
|
||||
if (lastDistance < minimum)
|
||||
if (lastDistance < minimum
|
||||
&& ([[gpi->topHints objectAtIndex: i] position] - bottomOfFrame
|
||||
>= minSize.height))
|
||||
|
||||
{
|
||||
bests = [NSMutableArray arrayWithCapacity: 4];
|
||||
[bests addObject: [gpi->topHints objectAtIndex: i]];
|
||||
minimum = lastDistance;
|
||||
bestTopPosition = [[gpi->topHints objectAtIndex: i] position];
|
||||
topEmpty = NO;
|
||||
}
|
||||
else if (lastDistance == minimum)
|
||||
else if ((lastDistance == minimum) && (topEmpty == NO)
|
||||
&& ([[gpi->topHints objectAtIndex: i] position] == bestTopPosition))
|
||||
[bests addObject: [gpi->topHints objectAtIndex: i]];
|
||||
}
|
||||
|
||||
count = [bests count];
|
||||
|
||||
|
||||
if (count >= 1)
|
||||
{
|
||||
float start, end, position;
|
||||
position = [[bests objectAtIndex: 0] position];
|
||||
|
||||
start = NSMinX(frame);
|
||||
end = NSMaxX(frame);
|
||||
for ( i = 0; i < count; i++ )
|
||||
topStart = NSMinX([[bests objectAtIndex: 0] frame]);
|
||||
topEnd = NSMaxX([[bests objectAtIndex: 0] frame]);
|
||||
for ( i = 1; i < count; i++ )
|
||||
{
|
||||
start = MIN(NSMinX([[bests objectAtIndex: i] frame]), start);
|
||||
end = MAX(NSMaxX([[bests objectAtIndex: i] frame]), end);
|
||||
topStart = MIN(NSMinX([[bests objectAtIndex: i] frame]), topStart);
|
||||
topEnd = MAX(NSMaxX([[bests objectAtIndex: i] frame]), topEnd);
|
||||
}
|
||||
|
||||
[[NSColor redColor] set];
|
||||
NSRectFill(NSMakeRect(start, position - 1, end - start, 2));
|
||||
gpi->lastTopRect = NSMakeRect(start, position - 1, end - start, 2);
|
||||
topOfFrame = position;
|
||||
topOfFrame = bestTopPosition;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -385,48 +687,82 @@
|
|||
|| gpi->knob == IBBottomMiddleKnobPosition)
|
||||
{
|
||||
bests = [NSMutableArray arrayWithCapacity: 4];
|
||||
minimum = 10;
|
||||
minimum = 6;
|
||||
count = [gpi->bottomHints count];
|
||||
for ( i = 0; i < count; i++ )
|
||||
{
|
||||
lastDistance = [[gpi->bottomHints objectAtIndex: i]
|
||||
distanceToFrame: frame];
|
||||
if (lastDistance < minimum)
|
||||
if (lastDistance < minimum
|
||||
&& (topOfFrame - [[gpi->bottomHints objectAtIndex: i] position]
|
||||
>= minSize.height))
|
||||
{
|
||||
bests = [NSMutableArray arrayWithCapacity: 4];
|
||||
[bests addObject: [gpi->bottomHints objectAtIndex: i]];
|
||||
minimum = lastDistance;
|
||||
bestBottomPosition = [[gpi->bottomHints objectAtIndex: i] position];
|
||||
bottomEmpty = NO;
|
||||
}
|
||||
else if (lastDistance == minimum)
|
||||
else if ((lastDistance == minimum) && (bottomEmpty == NO)
|
||||
&& ([[gpi->bottomHints objectAtIndex: i] position] == bestBottomPosition))
|
||||
[bests addObject: [gpi->bottomHints objectAtIndex: i]];
|
||||
}
|
||||
|
||||
count = [bests count];
|
||||
|
||||
|
||||
if (count >= 1)
|
||||
{
|
||||
float start, end, position;
|
||||
position = [[bests objectAtIndex: 0] position];
|
||||
|
||||
start = NSMinX(frame);
|
||||
end = NSMaxX(frame);
|
||||
for ( i = 0; i < count; i++ )
|
||||
bottomStart = NSMinX([[bests objectAtIndex: 0] frame]);
|
||||
bottomEnd = NSMaxX([[bests objectAtIndex: 0] frame]);
|
||||
for ( i = 1; i < count; i++ )
|
||||
{
|
||||
start = MIN(NSMinX([[bests objectAtIndex: i] frame]), start);
|
||||
end = MAX(NSMaxX([[bests objectAtIndex: i] frame]), end);
|
||||
bottomStart = MIN(NSMinX([[bests objectAtIndex: i] frame]), bottomStart);
|
||||
bottomEnd = MAX(NSMaxX([[bests objectAtIndex: i] frame]), bottomEnd);
|
||||
}
|
||||
|
||||
[[NSColor redColor] set];
|
||||
NSRectFill(NSMakeRect(start, position - 1, end - start, 2));
|
||||
gpi->lastBottomRect = NSMakeRect(start, position - 1, end - start, 2);
|
||||
bottomOfFrame = position;
|
||||
bottomOfFrame = bestBottomPosition;
|
||||
}
|
||||
}
|
||||
|
||||
gpi->hintFrame = NSMakeRect (leftOfFrame, bottomOfFrame,
|
||||
rightOfFrame - leftOfFrame,
|
||||
topOfFrame - bottomOfFrame);
|
||||
{
|
||||
[[NSColor redColor] set];
|
||||
if (!leftEmpty)
|
||||
{
|
||||
leftStart = MIN(NSMinY(gpi->hintFrame), leftStart);
|
||||
leftEnd = MAX(NSMaxY(gpi->hintFrame), leftEnd);
|
||||
gpi->lastLeftRect = NSMakeRect(bestLeftPosition - 1, leftStart,
|
||||
2, leftEnd - leftStart);
|
||||
NSRectFill(gpi->lastLeftRect);
|
||||
}
|
||||
if (!rightEmpty)
|
||||
{
|
||||
rightStart = MIN(NSMinY(gpi->hintFrame), rightStart);
|
||||
rightEnd = MAX(NSMaxY(gpi->hintFrame), rightEnd);
|
||||
gpi->lastRightRect = NSMakeRect(bestRightPosition - 1, rightStart,
|
||||
2, rightEnd - rightStart);
|
||||
NSRectFill(gpi->lastRightRect);
|
||||
}
|
||||
if (!topEmpty)
|
||||
{
|
||||
topStart = MIN(NSMinX(gpi->hintFrame), topStart);
|
||||
topEnd = MAX(NSMaxX(gpi->hintFrame), topEnd);
|
||||
gpi->lastTopRect = NSMakeRect(topStart, bestTopPosition - 1,
|
||||
topEnd - topStart, 2);
|
||||
NSRectFill(gpi->lastTopRect);
|
||||
}
|
||||
if (!bottomEmpty)
|
||||
{
|
||||
bottomStart = MIN(NSMinX(gpi->hintFrame), bottomStart);
|
||||
bottomEnd = MAX(NSMaxX(gpi->hintFrame), bottomEnd);
|
||||
gpi->lastBottomRect = NSMakeRect(bottomStart, bestBottomPosition - 1,
|
||||
bottomEnd - bottomStart, 2);
|
||||
NSRectFill(gpi->lastBottomRect);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
GormShowFrameWithKnob(gpi->hintFrame, gpi->knob);
|
||||
gpi->oldRect = GormExtBoundsForRect(gpi->hintFrame);
|
||||
|
@ -437,6 +773,7 @@
|
|||
|
||||
}
|
||||
|
||||
|
||||
- (void) updateResizingWithFrame: (NSRect) frame
|
||||
andEvent: (NSEvent *)theEvent
|
||||
andPlacementInfo: (GormPlacementInfo*) gpi
|
||||
|
|
338
GormViewEditor.m
338
GormViewEditor.m
|
@ -98,33 +98,21 @@
|
|||
|
||||
- (int) distanceToFrame: (NSRect) frame
|
||||
{
|
||||
NSRect rect = [self rectWithHalfDistance: 5];
|
||||
NSRect rect = [self rectWithHalfDistance: 6];
|
||||
if (NSIntersectsRect(frame, rect) == NO)
|
||||
return 20;
|
||||
return 10;
|
||||
switch (_border)
|
||||
{
|
||||
case Top:
|
||||
if (_position >= NSMaxY(frame))
|
||||
return 2 * (_position - NSMaxY(frame));
|
||||
else
|
||||
return 2 * (- _position + NSMaxY(frame)) + 1;
|
||||
return abs (_position - NSMaxY(frame));
|
||||
case Bottom:
|
||||
if (_position >= NSMinY(frame))
|
||||
return 2 * (_position - NSMinY(frame));
|
||||
else
|
||||
return 2 * (- _position + NSMinY(frame)) + 1;
|
||||
return abs (_position - NSMinY(frame));
|
||||
case Left:
|
||||
if (_position >= NSMinX(frame))
|
||||
return 2 * (_position - NSMinX(frame));
|
||||
else
|
||||
return 2 * (- _position + NSMinX(frame)) + 1;
|
||||
return abs (_position - NSMinX(frame));
|
||||
case Right:
|
||||
if (_position >= NSMaxX(frame))
|
||||
return 2 * (_position - NSMaxX(frame));
|
||||
else
|
||||
return 2 * (- _position + NSMaxX(frame)) + 1;
|
||||
return abs (_position - NSMaxX(frame));
|
||||
default:
|
||||
return 20;
|
||||
return 10;
|
||||
}
|
||||
}
|
||||
@end
|
||||
|
@ -527,6 +515,23 @@ static BOOL currently_displaying = NO;
|
|||
int count;
|
||||
int lastDistance;
|
||||
int minimum = 10;
|
||||
BOOL leftEmpty = YES;
|
||||
BOOL rightEmpty = YES;
|
||||
BOOL topEmpty = YES;
|
||||
BOOL bottomEmpty = YES;
|
||||
float bestLeftPosition;
|
||||
float bestRightPosition;
|
||||
float bestTopPosition;
|
||||
float bestBottomPosition;
|
||||
float leftStart;
|
||||
float rightStart;
|
||||
float topStart;
|
||||
float bottomStart;
|
||||
float leftEnd;
|
||||
float rightEnd;
|
||||
float topEnd;
|
||||
float bottomEnd;
|
||||
|
||||
NSMutableArray *bests;
|
||||
if (gpi->hintInitialized == NO)
|
||||
{
|
||||
|
@ -566,7 +571,7 @@ static BOOL currently_displaying = NO;
|
|||
|| gpi->knob == IBBottomLeftKnobPosition)
|
||||
{
|
||||
bests = [NSMutableArray arrayWithCapacity: 4];
|
||||
minimum = 10;
|
||||
minimum = 6;
|
||||
count = [gpi->leftHints count];
|
||||
for ( i = 0; i < count; i++ )
|
||||
{
|
||||
|
@ -577,31 +582,26 @@ static BOOL currently_displaying = NO;
|
|||
bests = [NSMutableArray arrayWithCapacity: 4];
|
||||
[bests addObject: [gpi->leftHints objectAtIndex: i]];
|
||||
minimum = lastDistance;
|
||||
bestLeftPosition = [[gpi->leftHints objectAtIndex: i] position];
|
||||
leftEmpty = NO;
|
||||
}
|
||||
else if (lastDistance == minimum)
|
||||
else if ((lastDistance == minimum) && (leftEmpty == NO)
|
||||
&& ([[gpi->leftHints objectAtIndex: i] position] == bestLeftPosition))
|
||||
[bests addObject: [gpi->leftHints objectAtIndex: i]];
|
||||
}
|
||||
|
||||
count = [bests count];
|
||||
|
||||
|
||||
if (count >= 1)
|
||||
{
|
||||
float start, end, position;
|
||||
position = [[bests objectAtIndex: 0] position];
|
||||
|
||||
start = NSMinY(frame);
|
||||
end = NSMaxY(frame);
|
||||
for ( i = 0; i < count; i++ )
|
||||
leftStart = NSMinY([[bests objectAtIndex: 0] frame]);
|
||||
leftEnd = NSMaxY([[bests objectAtIndex: 0] frame]);
|
||||
|
||||
for ( i = 1; i < count; i++ )
|
||||
{
|
||||
start = MIN(NSMinY([[bests objectAtIndex: i] frame]), start);
|
||||
end = MAX(NSMaxY([[bests objectAtIndex: i] frame]), end);
|
||||
leftStart = MIN(NSMinY([[bests objectAtIndex: i] frame]), leftStart);
|
||||
leftEnd = MAX(NSMaxY([[bests objectAtIndex: i] frame]), leftEnd);
|
||||
}
|
||||
|
||||
[[NSColor redColor] set];
|
||||
NSRectFill(NSMakeRect(position - 1, start, 2, end - start));
|
||||
gpi->lastLeftRect = NSMakeRect(position - 1, start, 2, end - start);
|
||||
leftOfFrame = position;
|
||||
leftOfFrame = bestLeftPosition;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -610,7 +610,7 @@ static BOOL currently_displaying = NO;
|
|||
|| gpi->knob == IBBottomRightKnobPosition)
|
||||
{
|
||||
bests = [NSMutableArray arrayWithCapacity: 4];
|
||||
minimum = 10;
|
||||
minimum = 6;
|
||||
count = [gpi->rightHints count];
|
||||
for ( i = 0; i < count; i++ )
|
||||
{
|
||||
|
@ -621,31 +621,26 @@ static BOOL currently_displaying = NO;
|
|||
bests = [NSMutableArray arrayWithCapacity: 4];
|
||||
[bests addObject: [gpi->rightHints objectAtIndex: i]];
|
||||
minimum = lastDistance;
|
||||
bestRightPosition = [[gpi->rightHints objectAtIndex: i] position];
|
||||
rightEmpty = NO;
|
||||
}
|
||||
else if (lastDistance == minimum)
|
||||
else if ((lastDistance == minimum) && (rightEmpty == NO)
|
||||
&& ([[gpi->rightHints objectAtIndex: i] position] == bestRightPosition))
|
||||
[bests addObject: [gpi->rightHints objectAtIndex: i]];
|
||||
}
|
||||
|
||||
count = [bests count];
|
||||
|
||||
|
||||
if (count >= 1)
|
||||
{
|
||||
float start, end, position;
|
||||
position = [[bests objectAtIndex: 0] position];
|
||||
|
||||
start = NSMinY(frame);
|
||||
end = NSMaxY(frame);
|
||||
for ( i = 0; i < count; i++ )
|
||||
rightStart = NSMinY([[bests objectAtIndex: 0] frame]);
|
||||
rightEnd = NSMaxY([[bests objectAtIndex: 0] frame]);
|
||||
|
||||
for ( i = 1; i < count; i++ )
|
||||
{
|
||||
start = MIN(NSMinY([[bests objectAtIndex: i] frame]), start);
|
||||
end = MAX(NSMaxY([[bests objectAtIndex: i] frame]), end);
|
||||
rightStart = MIN(NSMinY([[bests objectAtIndex: i] frame]), rightStart);
|
||||
rightEnd = MAX(NSMaxY([[bests objectAtIndex: i] frame]), rightEnd);
|
||||
}
|
||||
|
||||
[[NSColor redColor] set];
|
||||
NSRectFill(NSMakeRect(position - 1, start, 2, end - start));
|
||||
gpi->lastRightRect = NSMakeRect(position - 1, start, 2, end - start);
|
||||
rightOfFrame = position;
|
||||
rightOfFrame = bestRightPosition;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -654,7 +649,7 @@ static BOOL currently_displaying = NO;
|
|||
|| gpi->knob == IBTopMiddleKnobPosition)
|
||||
{
|
||||
bests = [NSMutableArray arrayWithCapacity: 4];
|
||||
minimum = 10;
|
||||
minimum = 6;
|
||||
count = [gpi->topHints count];
|
||||
for ( i = 0; i < count; i++ )
|
||||
{
|
||||
|
@ -665,31 +660,25 @@ static BOOL currently_displaying = NO;
|
|||
bests = [NSMutableArray arrayWithCapacity: 4];
|
||||
[bests addObject: [gpi->topHints objectAtIndex: i]];
|
||||
minimum = lastDistance;
|
||||
bestTopPosition = [[gpi->topHints objectAtIndex: i] position];
|
||||
topEmpty = NO;
|
||||
}
|
||||
else if (lastDistance == minimum)
|
||||
else if ((lastDistance == minimum) && (topEmpty == NO)
|
||||
&& ([[gpi->topHints objectAtIndex: i] position] == bestTopPosition))
|
||||
[bests addObject: [gpi->topHints objectAtIndex: i]];
|
||||
}
|
||||
|
||||
count = [bests count];
|
||||
|
||||
|
||||
if (count >= 1)
|
||||
{
|
||||
float start, end, position;
|
||||
position = [[bests objectAtIndex: 0] position];
|
||||
|
||||
start = NSMinX(frame);
|
||||
end = NSMaxX(frame);
|
||||
for ( i = 0; i < count; i++ )
|
||||
topStart = NSMinX([[bests objectAtIndex: 0] frame]);
|
||||
topEnd = NSMaxX([[bests objectAtIndex: 0] frame]);
|
||||
for ( i = 1; i < count; i++ )
|
||||
{
|
||||
start = MIN(NSMinX([[bests objectAtIndex: i] frame]), start);
|
||||
end = MAX(NSMaxX([[bests objectAtIndex: i] frame]), end);
|
||||
topStart = MIN(NSMinX([[bests objectAtIndex: i] frame]), topStart);
|
||||
topEnd = MAX(NSMaxX([[bests objectAtIndex: i] frame]), topEnd);
|
||||
}
|
||||
|
||||
[[NSColor redColor] set];
|
||||
NSRectFill(NSMakeRect(start, position - 1, end - start, 2));
|
||||
gpi->lastTopRect = NSMakeRect(start, position - 1, end - start, 2);
|
||||
topOfFrame = position;
|
||||
topOfFrame = bestTopPosition;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -698,7 +687,7 @@ static BOOL currently_displaying = NO;
|
|||
|| gpi->knob == IBBottomMiddleKnobPosition)
|
||||
{
|
||||
bests = [NSMutableArray arrayWithCapacity: 4];
|
||||
minimum = 10;
|
||||
minimum = 6;
|
||||
count = [gpi->bottomHints count];
|
||||
for ( i = 0; i < count; i++ )
|
||||
{
|
||||
|
@ -709,37 +698,69 @@ static BOOL currently_displaying = NO;
|
|||
bests = [NSMutableArray arrayWithCapacity: 4];
|
||||
[bests addObject: [gpi->bottomHints objectAtIndex: i]];
|
||||
minimum = lastDistance;
|
||||
bestBottomPosition = [[gpi->bottomHints objectAtIndex: i] position];
|
||||
bottomEmpty = NO;
|
||||
}
|
||||
else if (lastDistance == minimum)
|
||||
else if ((lastDistance == minimum) && (bottomEmpty == NO)
|
||||
&& ([[gpi->bottomHints objectAtIndex: i] position] == bestBottomPosition))
|
||||
[bests addObject: [gpi->bottomHints objectAtIndex: i]];
|
||||
}
|
||||
|
||||
count = [bests count];
|
||||
|
||||
|
||||
if (count >= 1)
|
||||
{
|
||||
float start, end, position;
|
||||
position = [[bests objectAtIndex: 0] position];
|
||||
|
||||
start = NSMinX(frame);
|
||||
end = NSMaxX(frame);
|
||||
for ( i = 0; i < count; i++ )
|
||||
bottomStart = NSMinX([[bests objectAtIndex: 0] frame]);
|
||||
bottomEnd = NSMaxX([[bests objectAtIndex: 0] frame]);
|
||||
for ( i = 1; i < count; i++ )
|
||||
{
|
||||
start = MIN(NSMinX([[bests objectAtIndex: i] frame]), start);
|
||||
end = MAX(NSMaxX([[bests objectAtIndex: i] frame]), end);
|
||||
bottomStart = MIN(NSMinX([[bests objectAtIndex: i] frame]), bottomStart);
|
||||
bottomEnd = MAX(NSMaxX([[bests objectAtIndex: i] frame]), bottomEnd);
|
||||
}
|
||||
|
||||
[[NSColor redColor] set];
|
||||
NSRectFill(NSMakeRect(start, position - 1, end - start, 2));
|
||||
gpi->lastBottomRect = NSMakeRect(start, position - 1, end - start, 2);
|
||||
bottomOfFrame = position;
|
||||
bottomOfFrame = bestBottomPosition;
|
||||
}
|
||||
}
|
||||
|
||||
gpi->hintFrame = NSMakeRect (leftOfFrame, bottomOfFrame,
|
||||
rightOfFrame - leftOfFrame,
|
||||
topOfFrame - bottomOfFrame);
|
||||
{
|
||||
[[NSColor redColor] set];
|
||||
if (!leftEmpty)
|
||||
{
|
||||
leftStart = MIN(NSMinY(gpi->hintFrame), leftStart);
|
||||
leftEnd = MAX(NSMaxY(gpi->hintFrame), leftEnd);
|
||||
gpi->lastLeftRect = NSMakeRect(bestLeftPosition - 1, leftStart,
|
||||
2, leftEnd - leftStart);
|
||||
NSRectFill(gpi->lastLeftRect);
|
||||
}
|
||||
if (!rightEmpty)
|
||||
{
|
||||
rightStart = MIN(NSMinY(gpi->hintFrame), rightStart);
|
||||
rightEnd = MAX(NSMaxY(gpi->hintFrame), rightEnd);
|
||||
gpi->lastRightRect = NSMakeRect(bestRightPosition - 1, rightStart,
|
||||
2, rightEnd - rightStart);
|
||||
NSRectFill(gpi->lastRightRect);
|
||||
}
|
||||
if (!topEmpty)
|
||||
{
|
||||
topStart = MIN(NSMinX(gpi->hintFrame), topStart);
|
||||
topEnd = MAX(NSMaxX(gpi->hintFrame), topEnd);
|
||||
gpi->lastTopRect = NSMakeRect(topStart, bestTopPosition - 1,
|
||||
topEnd - topStart, 2);
|
||||
NSRectFill(gpi->lastTopRect);
|
||||
}
|
||||
if (!bottomEmpty)
|
||||
{
|
||||
bottomStart = MIN(NSMinX(gpi->hintFrame), bottomStart);
|
||||
bottomEnd = MAX(NSMaxX(gpi->hintFrame), bottomEnd);
|
||||
gpi->lastBottomRect = NSMakeRect(bottomStart, bestBottomPosition - 1,
|
||||
bottomEnd - bottomStart, 2);
|
||||
NSRectFill(gpi->lastBottomRect);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
GormShowFrameWithKnob(gpi->hintFrame, gpi->knob);
|
||||
gpi->oldRect = GormExtBoundsForRect(gpi->hintFrame);
|
||||
|
@ -797,6 +818,22 @@ static BOOL currently_displaying = NO;
|
|||
int count;
|
||||
int lastDistance;
|
||||
int minimum = 10;
|
||||
BOOL leftEmpty = YES;
|
||||
BOOL rightEmpty = YES;
|
||||
BOOL topEmpty = YES;
|
||||
BOOL bottomEmpty = YES;
|
||||
float bestLeftPosition;
|
||||
float bestRightPosition;
|
||||
float bestTopPosition;
|
||||
float bestBottomPosition;
|
||||
float leftStart;
|
||||
float rightStart;
|
||||
float topStart;
|
||||
float bottomStart;
|
||||
float leftEnd;
|
||||
float rightEnd;
|
||||
float topEnd;
|
||||
float bottomEnd;
|
||||
|
||||
if (gpi->hintInitialized == NO)
|
||||
{
|
||||
|
@ -826,10 +863,11 @@ static BOOL currently_displaying = NO;
|
|||
|
||||
|
||||
{
|
||||
BOOL empty = YES;
|
||||
float bestPosition;
|
||||
NSMutableArray *leftBests;
|
||||
NSMutableArray *rightBests;
|
||||
minimum = 10;
|
||||
minimum = 6;
|
||||
count = [gpi->leftHints count];
|
||||
|
||||
leftBests = [NSMutableArray arrayWithCapacity: 4];
|
||||
|
@ -843,8 +881,10 @@ static BOOL currently_displaying = NO;
|
|||
[leftBests addObject: [gpi->leftHints objectAtIndex: i]];
|
||||
minimum = lastDistance;
|
||||
bestPosition = [[gpi->leftHints objectAtIndex: i] position];
|
||||
empty = NO;
|
||||
}
|
||||
else if (lastDistance == minimum)
|
||||
else if ((lastDistance == minimum) && (empty == NO)
|
||||
&& ([[gpi->leftHints objectAtIndex: i] position] == bestPosition))
|
||||
[leftBests addObject: [gpi->leftHints objectAtIndex: i]];
|
||||
}
|
||||
|
||||
|
@ -862,8 +902,9 @@ static BOOL currently_displaying = NO;
|
|||
minimum = lastDistance;
|
||||
bestPosition = [[gpi->rightHints objectAtIndex: i] position]
|
||||
- widthOfFrame;
|
||||
empty = NO;
|
||||
}
|
||||
else if (lastDistance == minimum
|
||||
else if ((lastDistance == minimum) && (empty == NO)
|
||||
&& ([[gpi->rightHints objectAtIndex: i] position] - bestPosition
|
||||
== widthOfFrame))
|
||||
[rightBests addObject: [gpi->rightHints objectAtIndex: i]];
|
||||
|
@ -872,20 +913,18 @@ static BOOL currently_displaying = NO;
|
|||
count = [leftBests count];
|
||||
if (count >= 1)
|
||||
{
|
||||
float start, end, position;
|
||||
float position;
|
||||
leftEmpty = NO;
|
||||
position = [[leftBests objectAtIndex: 0] position];
|
||||
|
||||
start = NSMinY(frame);
|
||||
end = NSMaxY(frame);
|
||||
for ( i = 0; i < count; i++ )
|
||||
leftStart = NSMinY([[leftBests objectAtIndex: 0] frame]);
|
||||
leftEnd = NSMaxY([[leftBests objectAtIndex: 0] frame]);
|
||||
for ( i = 1; i < count; i++ )
|
||||
{
|
||||
start = MIN(NSMinY([[leftBests objectAtIndex: i] frame]), start);
|
||||
end = MAX(NSMaxY([[leftBests objectAtIndex: i] frame]), end);
|
||||
leftStart = MIN(NSMinY([[leftBests objectAtIndex: i] frame]), leftStart);
|
||||
leftEnd = MAX(NSMaxY([[leftBests objectAtIndex: i] frame]), leftEnd);
|
||||
}
|
||||
|
||||
[[NSColor redColor] set];
|
||||
NSRectFill(NSMakeRect(position - 1, start, 2, end - start));
|
||||
gpi->lastLeftRect = NSMakeRect(position - 1, start, 2, end - start);
|
||||
leftOfFrame = position;
|
||||
rightOfFrame = position + widthOfFrame;
|
||||
}
|
||||
|
@ -893,30 +932,29 @@ static BOOL currently_displaying = NO;
|
|||
count = [rightBests count];
|
||||
if (count >= 1)
|
||||
{
|
||||
float start, end, position;
|
||||
float position;
|
||||
rightEmpty = NO;
|
||||
position = [[rightBests objectAtIndex: 0] position];
|
||||
|
||||
start = NSMinY(frame);
|
||||
end = NSMaxY(frame);
|
||||
for ( i = 0; i < count; i++ )
|
||||
rightStart = NSMinY([[rightBests objectAtIndex: 0] frame]);
|
||||
rightEnd = NSMaxY([[rightBests objectAtIndex: 0] frame]);
|
||||
for ( i = 1; i < count; i++ )
|
||||
{
|
||||
start = MIN(NSMinY([[rightBests objectAtIndex: i] frame]), start);
|
||||
end = MAX(NSMaxY([[rightBests objectAtIndex: i] frame]), end);
|
||||
rightStart = MIN(NSMinY([[rightBests objectAtIndex: i] frame]), rightStart);
|
||||
rightEnd = MAX(NSMaxY([[rightBests objectAtIndex: i] frame]), rightEnd);
|
||||
}
|
||||
|
||||
[[NSColor redColor] set];
|
||||
NSRectFill(NSMakeRect(position - 1, start, 2, end - start));
|
||||
gpi->lastRightRect = NSMakeRect(position - 1, start, 2, end - start);
|
||||
rightOfFrame = position;
|
||||
leftOfFrame = position - widthOfFrame;
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
BOOL empty = YES;
|
||||
float bestPosition;
|
||||
NSMutableArray *bottomBests;
|
||||
NSMutableArray *topBests;
|
||||
minimum = 10;
|
||||
minimum = 6;
|
||||
count = [gpi->bottomHints count];
|
||||
|
||||
bottomBests = [NSMutableArray arrayWithCapacity: 4];
|
||||
|
@ -930,8 +968,10 @@ static BOOL currently_displaying = NO;
|
|||
[bottomBests addObject: [gpi->bottomHints objectAtIndex: i]];
|
||||
minimum = lastDistance;
|
||||
bestPosition = [[gpi->bottomHints objectAtIndex: i] position];
|
||||
empty = NO;
|
||||
}
|
||||
else if (lastDistance == minimum)
|
||||
else if ((lastDistance == minimum) && (empty == NO)
|
||||
&& ([[gpi->bottomHints objectAtIndex: i] position] == bestPosition))
|
||||
[bottomBests addObject: [gpi->bottomHints objectAtIndex: i]];
|
||||
}
|
||||
|
||||
|
@ -949,8 +989,9 @@ static BOOL currently_displaying = NO;
|
|||
minimum = lastDistance;
|
||||
bestPosition = [[gpi->topHints objectAtIndex: i] position]
|
||||
- heightOfFrame;
|
||||
empty = NO;
|
||||
}
|
||||
else if (lastDistance == minimum
|
||||
else if (lastDistance == minimum && (empty == NO)
|
||||
&& ([[gpi->topHints objectAtIndex: i] position] - bestPosition
|
||||
== heightOfFrame))
|
||||
[topBests addObject: [gpi->topHints objectAtIndex: i]];
|
||||
|
@ -959,20 +1000,18 @@ static BOOL currently_displaying = NO;
|
|||
count = [bottomBests count];
|
||||
if (count >= 1)
|
||||
{
|
||||
float start, end, position;
|
||||
float position;
|
||||
bottomEmpty = NO;
|
||||
position = [[bottomBests objectAtIndex: 0] position];
|
||||
|
||||
start = NSMinX(frame);
|
||||
end = NSMaxX(frame);
|
||||
for ( i = 0; i < count; i++ )
|
||||
bottomStart = NSMinX([[bottomBests objectAtIndex: 0] frame]);
|
||||
bottomEnd = NSMaxX([[bottomBests objectAtIndex: 0] frame]);
|
||||
for ( i = 1; i < count; i++ )
|
||||
{
|
||||
start = MIN(NSMinX([[bottomBests objectAtIndex: i] frame]), start);
|
||||
end = MAX(NSMaxX([[bottomBests objectAtIndex: i] frame]), end);
|
||||
bottomStart = MIN(NSMinX([[bottomBests objectAtIndex: i] frame]), bottomStart);
|
||||
bottomEnd = MAX(NSMaxX([[bottomBests objectAtIndex: i] frame]), bottomEnd);
|
||||
}
|
||||
|
||||
[[NSColor redColor] set];
|
||||
NSRectFill(NSMakeRect(start, position - 1, end - start, 2));
|
||||
gpi->lastBottomRect = NSMakeRect(start, position - 1, end - start, 2);
|
||||
bottomOfFrame = position;
|
||||
topOfFrame = position + heightOfFrame;
|
||||
}
|
||||
|
@ -980,28 +1019,67 @@ static BOOL currently_displaying = NO;
|
|||
count = [topBests count];
|
||||
if (count >= 1)
|
||||
{
|
||||
float start, end, position;
|
||||
float position;
|
||||
topEmpty = NO;
|
||||
position = [[topBests objectAtIndex: 0] position];
|
||||
|
||||
start = NSMinX(frame);
|
||||
end = NSMaxX(frame);
|
||||
for ( i = 0; i < count; i++ )
|
||||
topStart = NSMinX([[topBests objectAtIndex: 0] frame]);
|
||||
topEnd = NSMaxX([[topBests objectAtIndex: 0] frame]);
|
||||
for ( i = 1; i < count; i++ )
|
||||
{
|
||||
start = MIN(NSMinX([[topBests objectAtIndex: i] frame]), start);
|
||||
end = MAX(NSMaxX([[topBests objectAtIndex: i] frame]), end);
|
||||
topStart = MIN(NSMinX([[topBests objectAtIndex: i] frame]), topStart);
|
||||
topEnd = MAX(NSMaxX([[topBests objectAtIndex: i] frame]), topEnd);
|
||||
}
|
||||
|
||||
[[NSColor redColor] set];
|
||||
NSRectFill(NSMakeRect(start, position - 1, end - start, 2));
|
||||
gpi->lastTopRect = NSMakeRect(start, position - 1, end - start, 2);
|
||||
topOfFrame = position;
|
||||
bottomOfFrame = position - heightOfFrame;
|
||||
}
|
||||
}
|
||||
|
||||
return NSMakeRect (leftOfFrame, bottomOfFrame,
|
||||
gpi->hintFrame = NSMakeRect (leftOfFrame, bottomOfFrame,
|
||||
rightOfFrame - leftOfFrame,
|
||||
topOfFrame - bottomOfFrame);
|
||||
|
||||
{
|
||||
[[NSColor redColor] set];
|
||||
if (!leftEmpty)
|
||||
{
|
||||
leftStart = MIN(NSMinY(gpi->hintFrame), leftStart);
|
||||
leftEnd = MAX(NSMaxY(gpi->hintFrame), leftEnd);
|
||||
gpi->lastLeftRect = NSMakeRect(leftOfFrame - 1, leftStart,
|
||||
2, leftEnd - leftStart);
|
||||
NSRectFill(gpi->lastLeftRect);
|
||||
}
|
||||
|
||||
if (!rightEmpty)
|
||||
{
|
||||
rightStart = MIN(NSMinY(gpi->hintFrame), rightStart);
|
||||
rightEnd = MAX(NSMaxY(gpi->hintFrame), rightEnd);
|
||||
gpi->lastRightRect = NSMakeRect(rightOfFrame - 1, rightStart,
|
||||
2, rightEnd - rightStart);
|
||||
NSRectFill(gpi->lastRightRect);
|
||||
}
|
||||
|
||||
if (!topEmpty)
|
||||
{
|
||||
topStart = MIN(NSMinX(gpi->hintFrame), topStart);
|
||||
topEnd = MAX(NSMaxX(gpi->hintFrame), topEnd);
|
||||
gpi->lastTopRect = NSMakeRect(topStart, topOfFrame - 1,
|
||||
topEnd - topStart, 2);
|
||||
NSRectFill(gpi->lastTopRect);
|
||||
}
|
||||
|
||||
if (!bottomEmpty)
|
||||
{
|
||||
bottomStart = MIN(NSMinX(gpi->hintFrame), bottomStart);
|
||||
bottomEnd = MAX(NSMaxX(gpi->hintFrame), bottomEnd);
|
||||
gpi->lastBottomRect = NSMakeRect(bottomStart, bottomOfFrame - 1,
|
||||
bottomEnd - bottomStart, 2);
|
||||
NSRectFill(gpi->lastBottomRect);
|
||||
}
|
||||
}
|
||||
|
||||
return gpi->hintFrame;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -527,16 +527,13 @@
|
|||
|
||||
if ([selection count] == 1)
|
||||
{
|
||||
{
|
||||
NSRect tempFrame = [[selection objectAtIndex: 0] frame];
|
||||
[[selection objectAtIndex: 0]
|
||||
setFrameOrigin:
|
||||
NSMakePoint(NSMaxX([self bounds]),
|
||||
NSMaxY([self bounds]))];
|
||||
[superview display];
|
||||
[[selection objectAtIndex: 0]
|
||||
setFrameOrigin: tempFrame.origin];
|
||||
}
|
||||
NSRect tempFrame = [[selection objectAtIndex: 0] frame];
|
||||
[[selection objectAtIndex: 0]
|
||||
setFrameOrigin:
|
||||
NSMakePoint(NSMaxX([self bounds]),
|
||||
NSMaxY([self bounds]))];
|
||||
[superview display];
|
||||
|
||||
r = oldMovingFrame;
|
||||
r.origin.x += xDiff;
|
||||
r.origin.y += yDiff;
|
||||
|
|
Loading…
Reference in a new issue