[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    kdeartwork/kwin-styles/cde
From:       Luciano Montanaro <mikelima () virgilio ! it>
Date:       2003-10-10 9:25:43
[Download RAW message or body]

CVS commit by montanaro: 

CCMAIL: kwin@kde.org, fredrik@kde.org
Added scaling of the close window button graphics. It is adequate, if not
really beautiful. On the other hand, the real CDE didn't have the button at
all. The help button graphics is not so easy to scale, with the possible
exception of doubling it if there is enough space. The decoration is also
missing a sticky button.  I'd do it if I had an idea on how to represent a pin
with only horizontal and vertical lines...
Any suggestion?


  M +19 -8     cdeclient.cpp   1.15


--- kdeartwork/kwin-styles/cde/cdeclient.cpp  #1.14:1.15
@@ -63,5 +63,5 @@ static const QCOORD closeLLinesTemplate[
 static const int NUM_CLOSED_COORDS = 2 * 18;
 static const QCOORD closeDLinesTemplate[NUM_CLOSED_COORDS] =
-    { 6,4, 8,6,  14,4, 14,5,  14,5, 11,8,  11,9, 14,12,  14,12, 14,14,
+    { 5,3, 8,6,  14,4, 14,5,  14,5, 11,8,  11,9, 14,12,  14,12, 14,14,
       14,14, 12,14,  12,14, 9,11,  8,11, 5,14,  5,14, 4,14 };
 
@@ -128,5 +128,5 @@ static void fixColorGroup(QColorGroup & 
     }
 
-    QColor dark = colorGroup.light();
+    QColor dark = colorGroup.dark();
 
     dark.hsv(&hue, &saturation, &value);
@@ -139,4 +139,13 @@ static void fixColorGroup(QColorGroup & 
 }
 
+// scaling helper function used to scale the close 'X' glyph
+
+static int scaleCoord(int c)
+{
+    if (c < 6) return c;
+    if (c <= 11) return c + (s_buttonSize - 19) / 2;
+    return c + s_buttonSize - 19;
+}
+
 static void readConfig(CdeClientFactory *f)
 {
@@ -176,4 +185,5 @@ static void readConfig(CdeClientFactory 
     if (s_buttonSize < 19) s_buttonSize = 19;
     if (s_buttonSize < s_frameWidth) s_buttonSize = s_frameWidth;
+    s_buttonSize |= 1; // Be sure the button size is odd.
 
     // Calculate widths and offsets for the button icons
@@ -183,12 +193,13 @@ static void readConfig(CdeClientFactory 
     s_w2 = s_buttonSize - 2 * s_o2;
 
-    // Copy and center the button icons
+    // Copy and scale the close icon
     int offset = (s_buttonSize - 19) / 2;
     for (int i = 0; i < NUM_CLOSEL_COORDS; i++) {
-        closeLLines[i] = closeLLinesTemplate[i] + offset;
+        closeLLines[i] = scaleCoord(closeLLinesTemplate[i]);
     }
     for (int i = 0; i < NUM_CLOSED_COORDS; i++) {
-        closeDLines[i] = closeDLinesTemplate[i] + offset;
+        closeDLines[i] = scaleCoord(closeDLinesTemplate[i]);
     }
+    // Copy and center the help icon
     for (int i = 0; i < NUM_HELPL_COORDS; i++) {
         helpLLines[i] = helpLLinesTemplate[i] + offset;
@@ -284,8 +295,8 @@ void CdeButton::drawButton( QPainter* p 
         break;
         case (BtnClose):
-            p->setPen( colorGroup.light() );
-            p->drawLineSegments( QPointArray(15, closeLLines) );
             p->setPen( colorGroup.dark() );
             p->drawLineSegments( QPointArray(18, closeDLines) );
+            p->setPen( colorGroup.light() );
+            p->drawLineSegments( QPointArray(15, closeLLines) );
         break;
     }


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic