← Back to team overview

linuxdcpp-team team mailing list archive

[Branch ~dcplusplus-team/dcplusplus/trunk] Rev 2313: Make sure menus are not too wide

 

------------------------------------------------------------
revno: 2313
committer: poy <poy@xxxxxxxxxx>
branch nick: trunk
timestamp: Tue 2010-11-30 19:55:29 +0100
message:
  Make sure menus are not too wide
modified:
  changelog.txt
  dwt/src/widgets/Menu.cpp


--
lp:dcplusplus
https://code.launchpad.net/~dcplusplus-team/dcplusplus/trunk

Your team Dcplusplus-team is subscribed to branch lp:dcplusplus.
To unsubscribe from this branch go to https://code.launchpad.net/~dcplusplus-team/dcplusplus/trunk/+edit-subscription
=== modified file 'changelog.txt'
--- changelog.txt	2010-11-30 18:21:53 +0000
+++ changelog.txt	2010-11-30 18:55:29 +0000
@@ -39,6 +39,7 @@
 * [L#674545] Add magnet keyword search (thanks flow84)
 * [L#506288] Save settings periodically (poy)
 * Add titles to various menus (poy)
+* [L#535556] Make sure menus are not too wide (poy)
 
 -- 0.770 2010-07-05 --
 * [L#550300] Catch more potential file corruptions (thanks bigmuscle)

=== modified file 'dwt/src/widgets/Menu.cpp'
--- dwt/src/widgets/Menu.cpp	2010-11-30 18:21:53 +0000
+++ dwt/src/widgets/Menu.cpp	2010-11-30 18:55:29 +0000
@@ -56,7 +56,7 @@
 const int Menu::pointerGap = 5;
 const int Menu::textIconGap = 8;
 const int Menu::textBorderGap = 4;
-const unsigned Menu::minWidth = 100;
+const unsigned Menu::minWidth = 150;
 
 /// @todo menus should re-init the cached default colors on WM_SYSCOLORCHANGE
 
@@ -616,7 +616,7 @@
 				drawTextFormat |= DT_HIDEPREFIX;
 			unsigned drawAccelFormat = drawTextFormat | DT_RIGHT;
 			drawTextFormat |= (popup && !wrapper->isTitle) ? DT_LEFT : DT_CENTER;
-			if(wrapper->isTitle)
+			if(getRootMenu()->popup) // menus not in the menu bar may get cropped
 				drawTextFormat |= DT_WORD_ELLIPSIS;
 
 			if(theme) {
@@ -758,8 +758,9 @@
 	if(drawSidebar)
 		itemWidth += getTextSize(getText(0), itsTitleFont).y; // 0 is the title index
 
-	// make sure the calculated size is not too small
-	if(popup) {
+	// make sure the calculated size is acceptable
+	if(getRootMenu()->popup) {
+		itemWidth = std::min(itemWidth, static_cast<unsigned>(getParent()->getWindowSize().x / 2));
 		itemWidth = std::max(itemWidth, minWidth);
 	}
 	itemHeight = std::max(itemHeight, static_cast<UINT>(::GetSystemMetrics(SM_CYMENU)));