[Date Prev][Date Next][Thread Prev][Thread Next][Thread Index]

[XaraXtreme-commits] Commit Complete



Commit by  : alex
Repository : xara
Revision   : 1685
Date       : Wed Aug  9 20:25:42 BST 2006

Changed paths:
   M /Trunk/XaraLX/Kernel/coldlog.cpp

Made sliders get thinner on colour editor


Diff:
Index: Trunk/XaraLX/Kernel/coldlog.cpp
===================================================================
--- Trunk/XaraLX/Kernel/coldlog.cpp	(revision 1684)
+++ Trunk/XaraLX/Kernel/coldlog.cpp	(revision 1685)
@@ -487,7 +487,25 @@
 };
 
 
+// Two utility functions to get slider sizing right
 
+INT32 GetSliderHeight(INT32 RectHeight, INT32 Num)
+{
+	INT32 AvailableHeight = (RectHeight / Num) - 4000; // subtract the minimum gap size
+	if (AvailableHeight<2000)
+		AvailableHeight = 2000;	// minimum height
+	return (AvailableHeight>18000)?18000:AvailableHeight;
+}
+
+INT32 GetSliderGap(INT32 RectHeight, INT32 Num)
+{
+	INT32 SliderGap = (RectHeight / Num) - GetSliderHeight(RectHeight, Num);
+	if (SliderGap < 4000)
+		SliderGap = 4000;
+	return SliderGap;
+}
+
+
 /********************************************************************************************
 
 >	void ColourEditDlg::LoseKeyboardFocus(void)
@@ -6307,10 +6325,8 @@
 	}
 
 	// Calculate slider sizes and spacing
-	const INT32 SliderHeight = 18000;
-	INT32 SliderGap = (SliderRect.Height() / NumComponents) - SliderHeight;
-	if (SliderGap < 4000)
-		SliderGap = 4000;
+	INT32 SliderHeight = GetSliderHeight(SliderRect.Height(), NumComponents);
+	INT32 SliderGap = GetSliderGap(SliderRect.Height(), NumComponents);
 
 	// And move the top down by half a SliderGap, so the sliders are centered vertically
 	SliderRect.hi.y -= SliderGap / 2;
@@ -8723,10 +8739,8 @@
 	}
 
 	// Calculate slider sizes and spacing
-	const INT32 SliderHeight = 18000;
-	INT32 SliderGap = (SliderRect.Height() / NumComponents) - SliderHeight;
-	if (SliderGap < 4000)
-		SliderGap = 4000;
+	INT32 SliderHeight = GetSliderHeight(SliderRect.Height(), NumComponents);
+	INT32 SliderGap = GetSliderGap(SliderRect.Height(), NumComponents);
 
 	// And move the top down by half a SliderGap, so the sliders are centered vertically
 	SliderRect.hi.y -= SliderGap / 2;
@@ -9735,10 +9749,8 @@
 	}
 
 	// Calculate slider sizes and spacing
-	const INT32 SliderHeight = 18000;
-	INT32 SliderGap = (SliderRect.Height() / NumComponents) - SliderHeight;
-	if (SliderGap < 4000)
-		SliderGap = 4000;
+	INT32 SliderHeight = GetSliderHeight(SliderRect.Height(), NumComponents);
+	INT32 SliderGap = GetSliderGap(SliderRect.Height(), NumComponents);
 
 	// And move the top down by half a SliderGap, so the sliders are centered vertically
 	SliderRect.hi.y -= SliderGap / 2;


Xara