← Back to team overview

linuxdcpp-team team mailing list archive

[Branch ~dcplusplus-team/dcplusplus/trunk] Rev 2755: better shell menu seed creation

 

------------------------------------------------------------
revno: 2755
committer: poy <poy@xxxxxxxxxx>
branch nick: trunk
timestamp: Mon 2011-12-26 15:23:59 +0100
message:
  better shell menu seed creation
modified:
  win32/DirectoryListingFrame.cpp
  win32/FinishedFrameBase.h
  win32/ShellMenu.cpp
  win32/ShellMenu.h
  win32/SystemFrame.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 'win32/DirectoryListingFrame.cpp'
--- win32/DirectoryListingFrame.cpp	2011-12-25 18:48:06 +0000
+++ win32/DirectoryListingFrame.cpp	2011-12-26 14:23:59 +0000
@@ -537,7 +537,7 @@
 }
 
 ShellMenuPtr DirectoryListingFrame::makeSingleMenu(ItemInfo* ii) {
-	ShellMenuPtr menu = addChild(ShellMenu::Seed());
+	auto menu = addChild(ShellMenu::Seed(WinUtil::Seeds::menu));
 
 	menu->setTitle(escapeMenu(ii->getText(COLUMN_FILENAME)), WinUtil::fileImages->getIcon(ii->getImage(0)));
 
@@ -563,7 +563,7 @@
 }
 
 ShellMenuPtr DirectoryListingFrame::makeMultiMenu() {
-	ShellMenuPtr menu = addChild(ShellMenu::Seed());
+	auto menu = addChild(ShellMenu::Seed(WinUtil::Seeds::menu));
 
 	size_t sel = files->countSelected();
 	menu->setTitle(str(TF_("%1% items") % sel), getParent()->getIcon(this));
@@ -576,7 +576,7 @@
 }
 
 ShellMenuPtr DirectoryListingFrame::makeDirMenu(ItemInfo* ii) {
-	ShellMenuPtr menu = addChild(ShellMenu::Seed());
+	auto menu = addChild(ShellMenu::Seed(WinUtil::Seeds::menu));
 
 	menu->setTitle(escapeMenu(ii ? ii->getText(COLUMN_FILENAME) : getText()),
 		ii ? WinUtil::fileImages->getIcon(ii->getImage(0)) : getParent()->getIcon(this));

=== modified file 'win32/FinishedFrameBase.h'
--- win32/FinishedFrameBase.h	2011-12-25 18:48:06 +0000
+++ win32/FinishedFrameBase.h	2011-12-26 14:23:59 +0000
@@ -451,7 +451,7 @@
 			FileChecker checker = files->forEachSelectedT(FileChecker());
 			auto selData = (sel == 1) ? files->getSelectedData() : 0;
 
-			ShellMenuPtr menu = filesWindow->addChild(ShellMenu::Seed());
+			auto menu = filesWindow->addChild(ShellMenu::Seed(WinUtil::Seeds::menu));
 			menu->setTitle(selData ? escapeMenu(selData->getText(FILES_COLUMN_FILE)) : str(TF_("%1% files") % sel),
 				selData ? WinUtil::fileImages->getIcon(selData->getImage(0)) : tabs->getIcon(filesWindow));
 			menu->appendItem(T_("&View as text"), [this] { this->handleViewAsText(); }, dwt::IconPtr(), checker.allFilesExist && !checker.isBz2);

=== modified file 'win32/ShellMenu.cpp'
--- win32/ShellMenu.cpp	2011-12-22 22:14:45 +0000
+++ win32/ShellMenu.cpp	2011-12-26 14:23:59 +0000
@@ -28,14 +28,6 @@
 
 using dwt::util::escapeMenu;
 
-ShellMenu::Seed::Seed() :
-BaseType::Seed()
-{
-	/// @todo find a better way to directly use styles set in WinUtil (see TypedTable/TypedTree)...
-	ownerDrawn = WinUtil::Seeds::menu.ownerDrawn;
-	font = WinUtil::Seeds::menu.font;
-}
-
 ShellMenu::ShellMenu(dwt::Widget* parent) :
 BaseType(parent),
 handler(0),

=== modified file 'win32/ShellMenu.h'
--- win32/ShellMenu.h	2011-11-07 22:11:39 +0000
+++ win32/ShellMenu.h	2011-12-26 14:23:59 +0000
@@ -39,7 +39,8 @@
 	struct Seed : public BaseType::Seed {
 		typedef ThisType WidgetType;
 
-		Seed();
+		Seed(const BaseType::Seed& seed) : BaseType::Seed(seed) {
+		}
 	};
 
 	explicit ShellMenu(dwt::Widget* parent);

=== modified file 'win32/SystemFrame.cpp'
--- win32/SystemFrame.cpp	2011-12-25 18:51:17 +0000
+++ win32/SystemFrame.cpp	2011-12-26 14:23:59 +0000
@@ -121,7 +121,7 @@
 	tstring path = log->textUnderCursor(pt, true);
 	string path_a = Text::fromT(path);
 	if(File::getSize(path_a) != -1) {
-		ShellMenuPtr menu = addChild(ShellMenu::Seed());
+		auto menu = addChild(ShellMenu::Seed(WinUtil::Seeds::menu));
 		menu->setTitle(escapeMenu(path), WinUtil::fileImages->getIcon(WinUtil::getFileIcon(path_a)));
 		menu->appendItem(T_("&Open"), [this, path_a] { openFile(path_a); }, dwt::IconPtr(), true, true);
 		menu->appendItem(T_("Open &folder"), [path] { WinUtil::openFolder(path); });