Summary: | quicklauncher, more then 2 rows/columns | ||
---|---|---|---|
Product: | [Plasma] kicker | Reporter: | J <dad> |
Component: | quicklauncher | Assignee: | Bill Nagel <bn> |
Status: | RESOLVED FIXED | ||
Severity: | wishlist | ||
Priority: | NOR | ||
Version: | unspecified | ||
Target Milestone: | --- | ||
Platform: | Compiled Sources | ||
OS: | Linux | ||
Latest Commit: | Version Fixed In: | ||
Attachments: | patch |
Description
J
2003-03-23 19:55:39 UTC
Created attachment 1227 [details]
patch
Subject: kdebase/kicker/applets/launcher CVS commit by wheeler: Applying Joerg's patch from #56283 with minor cleanups to make it possible for the quick launcher to have more than two rows. Of course you have to make Kicker friggin' huge before this kicks in, but... CCMAIL:56283-done@bugs.kde.org M +35 -15 quicklauncher.cpp 1.8 --- kdebase/kicker/applets/launcher/quicklauncher.cpp #1.7:1.8 @@ -87,15 +87,25 @@ int QuickLauncher :: widthForHeight(int { int n = buttonList.count(); - if (!n) n++; - if (h < 2 * iconSize) return n * iconSize + 4; - else return (n / 2 + n % 2) * iconSize + 4; + int size = iconSize; + int cols = 0; + + size += ( iconSize < 24 ) ? 1 : 2; + + int iconsPerRow = int( h / size ); + if ( iconsPerRow <= 0 ) + iconsPerRow = 1; + + while ( n > 0 ) { + cols++; + n -= iconsPerRow; + } + + return cols * size; } int QuickLauncher :: heightForWidth(int w) const { - int n = buttonList.count(); - if (!n) n++; - if (w < 2 * iconSize) return n * iconSize + 4; - else return (n / 2 + n % 2) * iconSize + 4; + // counterintuitive though it seems, this was actually the same code + return widthForHeight( w ); } @@ -204,20 +214,30 @@ void QuickLauncher :: arrangeIcons() if (orientation() == Vertical) { + int x = padding; for (button = buttonList.first(); button; button = buttonList.next()) { - if ((buttonList.count() == 1) || width() < 2*iconSize) - button->move(width() / 2 - iconSize/2, 2 + i * iconSize); + if ( buttonList.count() == 1 || width() < 2 * iconSize ) + button->move(width() / 2 - iconSize / 2, 2 + i * iconSize); else { - button->move(((i % 2) == 0) ? padding : width() - iconSize - padding, 2 + row * iconSize); - if (i % 2) row++; + if (x + iconSize > width() && i) { + x = padding; + row++; + } + button->move(x, padding + row * iconSize); + x += iconSize + padding; } i++; } } else { + int y = padding; for (button = buttonList.first(); button; button = buttonList.next()) { - if ((buttonList.count() == 1) || height() < 2*iconSize) - button->move(2 + i * iconSize, height() / 2 - iconSize/2); + if (buttonList.count() == 1 || height() < 2 * iconSize) + button->move(2 + i * iconSize, height() / 2 - iconSize / 2); else { - button->move(2 + col * iconSize, ((i % 2) == 0) ? padding : height() - iconSize - padding); - if (i % 2) col++; + if (y + iconSize > height() && i) { + y = padding; + col++; + } + button->move(2 + col * iconSize, y); + y += iconSize + padding; } i++; |