From 3ed852c240c5315a173cc0eb955a55f99988544e Mon Sep 17 00:00:00 2001 From: luigi__ Date: Sun, 28 Dec 2008 12:13:19 +0000 Subject: [PATCH] The recent ROM names are now compacted using PathCompactPath, instead of being cut to 128 characters. --- desmume/src/windows/DeSmuME_2008.vcproj | 4 ++-- desmume/src/windows/main.cpp | 32 +++++++------------------ 2 files changed, 10 insertions(+), 26 deletions(-) diff --git a/desmume/src/windows/DeSmuME_2008.vcproj b/desmume/src/windows/DeSmuME_2008.vcproj index 8cd505d69..7ebf5e544 100644 --- a/desmume/src/windows/DeSmuME_2008.vcproj +++ b/desmume/src/windows/DeSmuME_2008.vcproj @@ -1,7 +1,7 @@ #include +#include #include #include #include @@ -548,35 +549,16 @@ void UpdateRecentRomsMenu() EnableMenuItem(GetSubMenu(recentromsmenu, 0), clearid, MF_ENABLED); DeleteMenu(GetSubMenu(recentromsmenu, 0), baseid, MF_BYCOMMAND); - /* If there's no ROM available, add a greyed "None" item */ - /* Otherwise, let's fill the menu */ -/* if (RecentRoms.size() == 0) - { - EnableMenuItem(GetSubMenu(recentromsmenu, 0), clearid, MF_GRAYED); - - moo.cbSize = sizeof(moo); - moo.fMask = MIIM_DATA | MIIM_ID | MIIM_STATE | MIIM_TYPE; - - moo.cch = 5; - moo.fType = 0; - moo.wID = 0; - moo.dwTypeData = "None"; - moo.fState = MF_GRAYED; - - InsertMenuItem(GetSubMenu(recentromsmenu, 0), 0, TRUE, &moo); - } - else - {*/ - + HDC dc = GetDC(MainWindow->getHWnd()); //----------------------------------------------------------------------- //Update the list using RecentRoms vector for(int x = RecentRoms.size()-1; x >= 0; x--) //Must loop in reverse order since InsertMenuItem will insert as the first on the list { - //Let's Limit the Displayed Rom name to 128 characters string tmp = RecentRoms[x]; - if(tmp.size()>128) - tmp = tmp.substr(0,128); + LPSTR tmp2 = (LPSTR)tmp.c_str(); + + PathCompactPath(dc, tmp2, 500); moo.cbSize = sizeof(moo); moo.fMask = MIIM_DATA | MIIM_ID | MIIM_TYPE; @@ -584,10 +566,12 @@ void UpdateRecentRomsMenu() moo.cch = tmp.size(); moo.fType = 0; moo.wID = baseid + x; - moo.dwTypeData = (LPSTR)tmp.c_str(); + moo.dwTypeData = tmp2; //LOG("Inserting: %s\n",tmp.c_str()); //Debug InsertMenuItem(GetSubMenu(recentromsmenu, 0), 0, 1, &moo); } + + ReleaseDC(MainWindow->getHWnd(), dc); //----------------------------------------------------------------------- HWND temp = MainWindow->getHWnd();