aboutsummaryrefslogtreecommitdiffstats
path: root/Frameworks/PSMTabBar
diff options
context:
space:
mode:
authorrowanbeentje <rowan@beent.je>2012-12-13 00:14:06 +0000
committerrowanbeentje <rowan@beent.je>2012-12-13 00:14:06 +0000
commit3b5642c68f57865888b60a1f846fed3810333dae (patch)
tree8d76fa2dda27594b369421cb5099b5b8dd8726c6 /Frameworks/PSMTabBar
parent9c0184ce97a1e158d926afb8e4be034c61999563 (diff)
downloadsequelpro-3b5642c68f57865888b60a1f846fed3810333dae.tar.gz
sequelpro-3b5642c68f57865888b60a1f846fed3810333dae.tar.bz2
sequelpro-3b5642c68f57865888b60a1f846fed3810333dae.zip
- Add Retina versions of the tab close buttons
- Recompress other PSMTabBar images where necessary - Improve drawing of the tab bar in response to window state change, allowing better colour display in edge cases and particularly when sheets are open
Diffstat (limited to 'Frameworks/PSMTabBar')
-rw-r--r--Frameworks/PSMTabBar/Images/AddTabButton.pngbin1063 -> 160 bytes
-rw-r--r--Frameworks/PSMTabBar/Images/AddTabButtonPushed.pngbin1038 -> 160 bytes
-rw-r--r--Frameworks/PSMTabBar/Images/AddTabButtonRollover.pngbin1047 -> 160 bytes
-rw-r--r--Frameworks/PSMTabBar/Images/AdiumGradient.pngbin93 -> 84 bytes
-rw-r--r--Frameworks/PSMTabBar/Images/AquaTabCloseDirty_Front.pngbin292 -> 271 bytes
-rw-r--r--Frameworks/PSMTabBar/Images/AquaTabCloseDirty_Front_Pressed.pngbin292 -> 271 bytes
-rw-r--r--Frameworks/PSMTabBar/Images/AquaTabCloseDirty_Front_Rollover.pngbin297 -> 276 bytes
-rw-r--r--Frameworks/PSMTabBar/Images/AquaTabClose_Front.pngbin307 -> 286 bytes
-rw-r--r--Frameworks/PSMTabBar/Images/AquaTabClose_Front_Pressed.pngbin310 -> 289 bytes
-rw-r--r--Frameworks/PSMTabBar/Images/AquaTabClose_Front_Rollover.pngbin317 -> 296 bytes
-rw-r--r--Frameworks/PSMTabBar/Images/AquaTabsBackground.pngbin380 -> 344 bytes
-rw-r--r--Frameworks/PSMTabBar/Images/AquaTabsDown.pngbin192 -> 153 bytes
-rw-r--r--Frameworks/PSMTabBar/Images/AquaTabsDownNonKey.pngbin182 -> 166 bytes
-rw-r--r--Frameworks/PSMTabBar/Images/AquaTabsSeparator.pngbin159 -> 106 bytes
-rw-r--r--Frameworks/PSMTabBar/Images/AquaTabsSeparatorDown.pngbin175 -> 149 bytes
-rw-r--r--Frameworks/PSMTabBar/Images/SequelProTabClose.pngbin463 -> 305 bytes
-rw-r--r--Frameworks/PSMTabBar/Images/SequelProTabClose@2x.pngbin0 -> 754 bytes
-rw-r--r--Frameworks/PSMTabBar/Images/SequelProTabClose_Pressed.pngbin468 -> 309 bytes
-rw-r--r--Frameworks/PSMTabBar/Images/SequelProTabClose_Pressed@2x.pngbin0 -> 726 bytes
-rw-r--r--Frameworks/PSMTabBar/Images/SequelProTabClose_Rollover.pngbin465 -> 309 bytes
-rw-r--r--Frameworks/PSMTabBar/Images/SequelProTabClose_Rollover@2x.pngbin0 -> 736 bytes
-rw-r--r--Frameworks/PSMTabBar/Images/SequelProTabDirty.pngbin428 -> 282 bytes
-rw-r--r--Frameworks/PSMTabBar/Images/SequelProTabDirty@2x.pngbin0 -> 717 bytes
-rw-r--r--Frameworks/PSMTabBar/Images/SequelProTabDirty_Pressed.pngbin410 -> 276 bytes
-rw-r--r--Frameworks/PSMTabBar/Images/SequelProTabDirty_Pressed@2x.pngbin0 -> 666 bytes
-rw-r--r--Frameworks/PSMTabBar/Images/SequelProTabDirty_Rollover.pngbin421 -> 275 bytes
-rw-r--r--Frameworks/PSMTabBar/Images/SequelProTabDirty_Rollover@2x.pngbin0 -> 685 bytes
-rw-r--r--Frameworks/PSMTabBar/Images/TabClose_Dirty.pngbin327 -> 262 bytes
-rw-r--r--Frameworks/PSMTabBar/Images/TabClose_Dirty_Pressed.pngbin320 -> 255 bytes
-rw-r--r--Frameworks/PSMTabBar/Images/TabClose_Dirty_Rollover.pngbin320 -> 255 bytes
-rw-r--r--Frameworks/PSMTabBar/Images/TabClose_Front.pngbin309 -> 288 bytes
-rw-r--r--Frameworks/PSMTabBar/Images/TabClose_Front_Pressed.pngbin310 -> 289 bytes
-rw-r--r--Frameworks/PSMTabBar/Images/TabClose_Front_Rollover.pngbin308 -> 287 bytes
-rw-r--r--Frameworks/PSMTabBar/Images/TabNewMetalRollover.pngbin384 -> 380 bytes
-rw-r--r--Frameworks/PSMTabBar/Images/overflowImage.pngbin256 -> 235 bytes
-rw-r--r--Frameworks/PSMTabBar/Images/overflowImagePressed.pngbin250 -> 229 bytes
-rw-r--r--Frameworks/PSMTabBar/Images/pi.pngbin564 -> 559 bytes
-rw-r--r--Frameworks/PSMTabBar/PSMTabBarControl.m18
-rw-r--r--Frameworks/PSMTabBar/Styles/PSMSequelProTabStyle.m6
39 files changed, 14 insertions, 10 deletions
diff --git a/Frameworks/PSMTabBar/Images/AddTabButton.png b/Frameworks/PSMTabBar/Images/AddTabButton.png
index 0ed2bc26..3818b106 100644
--- a/Frameworks/PSMTabBar/Images/AddTabButton.png
+++ b/Frameworks/PSMTabBar/Images/AddTabButton.png
Binary files differ
diff --git a/Frameworks/PSMTabBar/Images/AddTabButtonPushed.png b/Frameworks/PSMTabBar/Images/AddTabButtonPushed.png
index 9f370a0d..d78febb1 100644
--- a/Frameworks/PSMTabBar/Images/AddTabButtonPushed.png
+++ b/Frameworks/PSMTabBar/Images/AddTabButtonPushed.png
Binary files differ
diff --git a/Frameworks/PSMTabBar/Images/AddTabButtonRollover.png b/Frameworks/PSMTabBar/Images/AddTabButtonRollover.png
index 6138f3ed..ced6a993 100644
--- a/Frameworks/PSMTabBar/Images/AddTabButtonRollover.png
+++ b/Frameworks/PSMTabBar/Images/AddTabButtonRollover.png
Binary files differ
diff --git a/Frameworks/PSMTabBar/Images/AdiumGradient.png b/Frameworks/PSMTabBar/Images/AdiumGradient.png
index d410a88a..bad81b86 100644
--- a/Frameworks/PSMTabBar/Images/AdiumGradient.png
+++ b/Frameworks/PSMTabBar/Images/AdiumGradient.png
Binary files differ
diff --git a/Frameworks/PSMTabBar/Images/AquaTabCloseDirty_Front.png b/Frameworks/PSMTabBar/Images/AquaTabCloseDirty_Front.png
index 77d22050..82c37150 100644
--- a/Frameworks/PSMTabBar/Images/AquaTabCloseDirty_Front.png
+++ b/Frameworks/PSMTabBar/Images/AquaTabCloseDirty_Front.png
Binary files differ
diff --git a/Frameworks/PSMTabBar/Images/AquaTabCloseDirty_Front_Pressed.png b/Frameworks/PSMTabBar/Images/AquaTabCloseDirty_Front_Pressed.png
index 197ea95c..01570fbd 100644
--- a/Frameworks/PSMTabBar/Images/AquaTabCloseDirty_Front_Pressed.png
+++ b/Frameworks/PSMTabBar/Images/AquaTabCloseDirty_Front_Pressed.png
Binary files differ
diff --git a/Frameworks/PSMTabBar/Images/AquaTabCloseDirty_Front_Rollover.png b/Frameworks/PSMTabBar/Images/AquaTabCloseDirty_Front_Rollover.png
index 2dfe5777..55db6531 100644
--- a/Frameworks/PSMTabBar/Images/AquaTabCloseDirty_Front_Rollover.png
+++ b/Frameworks/PSMTabBar/Images/AquaTabCloseDirty_Front_Rollover.png
Binary files differ
diff --git a/Frameworks/PSMTabBar/Images/AquaTabClose_Front.png b/Frameworks/PSMTabBar/Images/AquaTabClose_Front.png
index 02b72d39..17c88d3d 100644
--- a/Frameworks/PSMTabBar/Images/AquaTabClose_Front.png
+++ b/Frameworks/PSMTabBar/Images/AquaTabClose_Front.png
Binary files differ
diff --git a/Frameworks/PSMTabBar/Images/AquaTabClose_Front_Pressed.png b/Frameworks/PSMTabBar/Images/AquaTabClose_Front_Pressed.png
index f81125a0..8050f582 100644
--- a/Frameworks/PSMTabBar/Images/AquaTabClose_Front_Pressed.png
+++ b/Frameworks/PSMTabBar/Images/AquaTabClose_Front_Pressed.png
Binary files differ
diff --git a/Frameworks/PSMTabBar/Images/AquaTabClose_Front_Rollover.png b/Frameworks/PSMTabBar/Images/AquaTabClose_Front_Rollover.png
index 4f6b865f..3612b28e 100644
--- a/Frameworks/PSMTabBar/Images/AquaTabClose_Front_Rollover.png
+++ b/Frameworks/PSMTabBar/Images/AquaTabClose_Front_Rollover.png
Binary files differ
diff --git a/Frameworks/PSMTabBar/Images/AquaTabsBackground.png b/Frameworks/PSMTabBar/Images/AquaTabsBackground.png
index b9cd1d0f..1303779f 100644
--- a/Frameworks/PSMTabBar/Images/AquaTabsBackground.png
+++ b/Frameworks/PSMTabBar/Images/AquaTabsBackground.png
Binary files differ
diff --git a/Frameworks/PSMTabBar/Images/AquaTabsDown.png b/Frameworks/PSMTabBar/Images/AquaTabsDown.png
index 6fed84c6..65f3ccb9 100644
--- a/Frameworks/PSMTabBar/Images/AquaTabsDown.png
+++ b/Frameworks/PSMTabBar/Images/AquaTabsDown.png
Binary files differ
diff --git a/Frameworks/PSMTabBar/Images/AquaTabsDownNonKey.png b/Frameworks/PSMTabBar/Images/AquaTabsDownNonKey.png
index df2c1365..96e54aec 100644
--- a/Frameworks/PSMTabBar/Images/AquaTabsDownNonKey.png
+++ b/Frameworks/PSMTabBar/Images/AquaTabsDownNonKey.png
Binary files differ
diff --git a/Frameworks/PSMTabBar/Images/AquaTabsSeparator.png b/Frameworks/PSMTabBar/Images/AquaTabsSeparator.png
index be82692d..60f38a21 100644
--- a/Frameworks/PSMTabBar/Images/AquaTabsSeparator.png
+++ b/Frameworks/PSMTabBar/Images/AquaTabsSeparator.png
Binary files differ
diff --git a/Frameworks/PSMTabBar/Images/AquaTabsSeparatorDown.png b/Frameworks/PSMTabBar/Images/AquaTabsSeparatorDown.png
index 72b7878b..5f40dfc2 100644
--- a/Frameworks/PSMTabBar/Images/AquaTabsSeparatorDown.png
+++ b/Frameworks/PSMTabBar/Images/AquaTabsSeparatorDown.png
Binary files differ
diff --git a/Frameworks/PSMTabBar/Images/SequelProTabClose.png b/Frameworks/PSMTabBar/Images/SequelProTabClose.png
index 442f1fdf..1b68f75f 100644
--- a/Frameworks/PSMTabBar/Images/SequelProTabClose.png
+++ b/Frameworks/PSMTabBar/Images/SequelProTabClose.png
Binary files differ
diff --git a/Frameworks/PSMTabBar/Images/SequelProTabClose@2x.png b/Frameworks/PSMTabBar/Images/SequelProTabClose@2x.png
new file mode 100644
index 00000000..da429832
--- /dev/null
+++ b/Frameworks/PSMTabBar/Images/SequelProTabClose@2x.png
Binary files differ
diff --git a/Frameworks/PSMTabBar/Images/SequelProTabClose_Pressed.png b/Frameworks/PSMTabBar/Images/SequelProTabClose_Pressed.png
index 61c786dc..520cfb0b 100644
--- a/Frameworks/PSMTabBar/Images/SequelProTabClose_Pressed.png
+++ b/Frameworks/PSMTabBar/Images/SequelProTabClose_Pressed.png
Binary files differ
diff --git a/Frameworks/PSMTabBar/Images/SequelProTabClose_Pressed@2x.png b/Frameworks/PSMTabBar/Images/SequelProTabClose_Pressed@2x.png
new file mode 100644
index 00000000..a81b9b4b
--- /dev/null
+++ b/Frameworks/PSMTabBar/Images/SequelProTabClose_Pressed@2x.png
Binary files differ
diff --git a/Frameworks/PSMTabBar/Images/SequelProTabClose_Rollover.png b/Frameworks/PSMTabBar/Images/SequelProTabClose_Rollover.png
index 6744b7fc..9ee43e19 100644
--- a/Frameworks/PSMTabBar/Images/SequelProTabClose_Rollover.png
+++ b/Frameworks/PSMTabBar/Images/SequelProTabClose_Rollover.png
Binary files differ
diff --git a/Frameworks/PSMTabBar/Images/SequelProTabClose_Rollover@2x.png b/Frameworks/PSMTabBar/Images/SequelProTabClose_Rollover@2x.png
new file mode 100644
index 00000000..dcc764d5
--- /dev/null
+++ b/Frameworks/PSMTabBar/Images/SequelProTabClose_Rollover@2x.png
Binary files differ
diff --git a/Frameworks/PSMTabBar/Images/SequelProTabDirty.png b/Frameworks/PSMTabBar/Images/SequelProTabDirty.png
index b9bb0595..e5269d34 100644
--- a/Frameworks/PSMTabBar/Images/SequelProTabDirty.png
+++ b/Frameworks/PSMTabBar/Images/SequelProTabDirty.png
Binary files differ
diff --git a/Frameworks/PSMTabBar/Images/SequelProTabDirty@2x.png b/Frameworks/PSMTabBar/Images/SequelProTabDirty@2x.png
new file mode 100644
index 00000000..0b2c0796
--- /dev/null
+++ b/Frameworks/PSMTabBar/Images/SequelProTabDirty@2x.png
Binary files differ
diff --git a/Frameworks/PSMTabBar/Images/SequelProTabDirty_Pressed.png b/Frameworks/PSMTabBar/Images/SequelProTabDirty_Pressed.png
index 5d113e50..ed074ef9 100644
--- a/Frameworks/PSMTabBar/Images/SequelProTabDirty_Pressed.png
+++ b/Frameworks/PSMTabBar/Images/SequelProTabDirty_Pressed.png
Binary files differ
diff --git a/Frameworks/PSMTabBar/Images/SequelProTabDirty_Pressed@2x.png b/Frameworks/PSMTabBar/Images/SequelProTabDirty_Pressed@2x.png
new file mode 100644
index 00000000..14e5b566
--- /dev/null
+++ b/Frameworks/PSMTabBar/Images/SequelProTabDirty_Pressed@2x.png
Binary files differ
diff --git a/Frameworks/PSMTabBar/Images/SequelProTabDirty_Rollover.png b/Frameworks/PSMTabBar/Images/SequelProTabDirty_Rollover.png
index 031dffad..7966b7e9 100644
--- a/Frameworks/PSMTabBar/Images/SequelProTabDirty_Rollover.png
+++ b/Frameworks/PSMTabBar/Images/SequelProTabDirty_Rollover.png
Binary files differ
diff --git a/Frameworks/PSMTabBar/Images/SequelProTabDirty_Rollover@2x.png b/Frameworks/PSMTabBar/Images/SequelProTabDirty_Rollover@2x.png
new file mode 100644
index 00000000..bff7efac
--- /dev/null
+++ b/Frameworks/PSMTabBar/Images/SequelProTabDirty_Rollover@2x.png
Binary files differ
diff --git a/Frameworks/PSMTabBar/Images/TabClose_Dirty.png b/Frameworks/PSMTabBar/Images/TabClose_Dirty.png
index 60a25ba3..5899b737 100644
--- a/Frameworks/PSMTabBar/Images/TabClose_Dirty.png
+++ b/Frameworks/PSMTabBar/Images/TabClose_Dirty.png
Binary files differ
diff --git a/Frameworks/PSMTabBar/Images/TabClose_Dirty_Pressed.png b/Frameworks/PSMTabBar/Images/TabClose_Dirty_Pressed.png
index 978dc1c7..eb286a01 100644
--- a/Frameworks/PSMTabBar/Images/TabClose_Dirty_Pressed.png
+++ b/Frameworks/PSMTabBar/Images/TabClose_Dirty_Pressed.png
Binary files differ
diff --git a/Frameworks/PSMTabBar/Images/TabClose_Dirty_Rollover.png b/Frameworks/PSMTabBar/Images/TabClose_Dirty_Rollover.png
index 7b8924da..599d4753 100644
--- a/Frameworks/PSMTabBar/Images/TabClose_Dirty_Rollover.png
+++ b/Frameworks/PSMTabBar/Images/TabClose_Dirty_Rollover.png
Binary files differ
diff --git a/Frameworks/PSMTabBar/Images/TabClose_Front.png b/Frameworks/PSMTabBar/Images/TabClose_Front.png
index e7bf88e7..192b6991 100644
--- a/Frameworks/PSMTabBar/Images/TabClose_Front.png
+++ b/Frameworks/PSMTabBar/Images/TabClose_Front.png
Binary files differ
diff --git a/Frameworks/PSMTabBar/Images/TabClose_Front_Pressed.png b/Frameworks/PSMTabBar/Images/TabClose_Front_Pressed.png
index feaf7281..68ebd583 100644
--- a/Frameworks/PSMTabBar/Images/TabClose_Front_Pressed.png
+++ b/Frameworks/PSMTabBar/Images/TabClose_Front_Pressed.png
Binary files differ
diff --git a/Frameworks/PSMTabBar/Images/TabClose_Front_Rollover.png b/Frameworks/PSMTabBar/Images/TabClose_Front_Rollover.png
index 865bd1fb..ce45746e 100644
--- a/Frameworks/PSMTabBar/Images/TabClose_Front_Rollover.png
+++ b/Frameworks/PSMTabBar/Images/TabClose_Front_Rollover.png
Binary files differ
diff --git a/Frameworks/PSMTabBar/Images/TabNewMetalRollover.png b/Frameworks/PSMTabBar/Images/TabNewMetalRollover.png
index b1308164..208c9640 100644
--- a/Frameworks/PSMTabBar/Images/TabNewMetalRollover.png
+++ b/Frameworks/PSMTabBar/Images/TabNewMetalRollover.png
Binary files differ
diff --git a/Frameworks/PSMTabBar/Images/overflowImage.png b/Frameworks/PSMTabBar/Images/overflowImage.png
index 2b762555..4cf35e4e 100644
--- a/Frameworks/PSMTabBar/Images/overflowImage.png
+++ b/Frameworks/PSMTabBar/Images/overflowImage.png
Binary files differ
diff --git a/Frameworks/PSMTabBar/Images/overflowImagePressed.png b/Frameworks/PSMTabBar/Images/overflowImagePressed.png
index b3918b34..f6916837 100644
--- a/Frameworks/PSMTabBar/Images/overflowImagePressed.png
+++ b/Frameworks/PSMTabBar/Images/overflowImagePressed.png
Binary files differ
diff --git a/Frameworks/PSMTabBar/Images/pi.png b/Frameworks/PSMTabBar/Images/pi.png
index 4d598dc7..9cd57539 100644
--- a/Frameworks/PSMTabBar/Images/pi.png
+++ b/Frameworks/PSMTabBar/Images/pi.png
Binary files differ
diff --git a/Frameworks/PSMTabBar/PSMTabBarControl.m b/Frameworks/PSMTabBar/PSMTabBarControl.m
index 2a92a2b1..6a062efe 100644
--- a/Frameworks/PSMTabBar/PSMTabBarControl.m
+++ b/Frameworks/PSMTabBar/PSMTabBarControl.m
@@ -244,8 +244,8 @@
- (void)viewWillMoveToWindow:(NSWindow *)aWindow {
NSNotificationCenter *center = [NSNotificationCenter defaultCenter];
- [center removeObserver:self name:NSWindowDidBecomeKeyNotification object:nil];
- [center removeObserver:self name:NSWindowDidResignKeyNotification object:nil];
+ [center removeObserver:self name:NSWindowDidBecomeMainNotification object:nil];
+ [center removeObserver:self name:NSWindowDidResignMainNotification object:nil];
[center removeObserver:self name:NSWindowDidUpdateNotification object:nil];
[center removeObserver:self name:NSWindowDidMoveNotification object:nil];
@@ -262,6 +262,9 @@
}
}
+/**
+ * Allow a window to be redrawn in response to changes in position or focus level.
+ */
- (void)windowStatusDidChange:(NSNotification *)notification
{
[self setNeedsDisplay:YES];
@@ -1747,7 +1750,8 @@
{
// hide? must readjust things if I'm not supposed to be showing
// this block of code only runs when the app launches
- if ([self hideForSingleTab] && ([_cells count] <= 1) && !_awakenedFromNib) {
+ if (!_awakenedFromNib && [self hideForSingleTab] && ([_cells count] <= 1)) {
+
// must adjust frames now before display
NSRect myFrame = [self frame];
if ([self orientation] == PSMTabBarHorizontalOrientation) {
@@ -1801,12 +1805,12 @@
[[self delegate] tabView:[self tabView] tabBarDidHide:self];
}
}
-
+
+ // The above tasks only needs to be run once, so set a flag to ensure that
_awakenedFromNib = YES;
+
+ // Allow the tab bar to redraw itself in result to window ordering/sheet/etc changes
[self setNeedsDisplay:YES];
-
- //we only need to do this once
- [[NSNotificationCenter defaultCenter] removeObserver:self name:NSWindowDidUpdateNotification object:nil];
}
#pragma mark -
diff --git a/Frameworks/PSMTabBar/Styles/PSMSequelProTabStyle.m b/Frameworks/PSMTabBar/Styles/PSMSequelProTabStyle.m
index b0a96ccd..6feb49a4 100644
--- a/Frameworks/PSMTabBar/Styles/PSMSequelProTabStyle.m
+++ b/Frameworks/PSMTabBar/Styles/PSMSequelProTabStyle.m
@@ -414,7 +414,7 @@
float shadowAlpha = 0.4f;
// When the window is in the background, tone down the colours
- if (![[tabBar window] isMainWindow] || ![NSApp isActive]) {
+ if ((![[tabBar window] isMainWindow] && ![[[tabBar window] attachedSheet] isMainWindow]) || ![NSApp isActive]) {
backgroundCalibratedWhite = 0.73f;
if (systemVersion >= 0x1070) backgroundCalibratedWhite = 0.79f;
lineCalibratedWhite = 0.49f;
@@ -505,7 +505,7 @@
}
// Set up colours
- if ([[tabBar window] isMainWindow] && [NSApp isActive]) {
+ if (([[tabBar window] isMainWindow] || [[[tabBar window] attachedSheet] isMainWindow]) && [NSApp isActive]) {
lineColor = [NSColor darkGrayColor];
if ([cell state] == NSOnState) {
fillColor = [NSColor colorWithCalibratedWhite:(systemVersion >= 0x1070)?0.63f:0.59f alpha:1.0f];
@@ -609,7 +609,7 @@
CGContextRef context = (CGContextRef)[[NSGraphicsContext currentContext] graphicsPort];
CGContextSaveGState(context);
NSPoint topLeft, topRight;
- CGFloat drawAlpha = ([[tabBar window] isMainWindow] && [NSApp isActive])? 1.0f : 0.7f;
+ CGFloat drawAlpha = (([[tabBar window] isMainWindow] || [[[tabBar window] attachedSheet] isMainWindow]) && [NSApp isActive])? 1.0f : 0.7f;
outlineBezier = [NSBezierPath bezierPath];
// Calculate the endpoints of the line