[Project64] Remove SelColorBrush from ROM_INFO
This commit is contained in:
parent
5b5d30cb69
commit
3007139446
|
@ -122,7 +122,8 @@ private:
|
||||||
NoOfSortKeys = 3
|
NoOfSortKeys = 3
|
||||||
};
|
};
|
||||||
|
|
||||||
void AllocateBrushs(void);
|
typedef std::map<int32_t, HBRUSH> HBRUSH_MAP;
|
||||||
|
|
||||||
void RomListReset(void);
|
void RomListReset(void);
|
||||||
void RomListLoaded(void);
|
void RomListLoaded(void);
|
||||||
void RomAddedToList(int32_t ListPos);
|
void RomAddedToList(int32_t ListPos);
|
||||||
|
@ -156,5 +157,6 @@ private:
|
||||||
bool m_ShowingRomBrowser;
|
bool m_ShowingRomBrowser;
|
||||||
bool m_AllowSelectionLastRom;
|
bool m_AllowSelectionLastRom;
|
||||||
static std::wstring m_UnknownGoodName;
|
static std::wstring m_UnknownGoodName;
|
||||||
|
HBRUSH_MAP m_Brushes;
|
||||||
std::string m_LastRom;
|
std::string m_LastRom;
|
||||||
};
|
};
|
||||||
|
|
|
@ -253,8 +253,6 @@ int32_t CRomBrowser::CalcSortPosition(uint32_t lParam)
|
||||||
|
|
||||||
void CRomBrowser::RomAddedToList(int32_t ListPos)
|
void CRomBrowser::RomAddedToList(int32_t ListPos)
|
||||||
{
|
{
|
||||||
m_RomInfo[ListPos].SelColorBrush = NULL;
|
|
||||||
|
|
||||||
LVITEMW lvItem;
|
LVITEMW lvItem;
|
||||||
memset(&lvItem, 0, sizeof(lvItem));
|
memset(&lvItem, 0, sizeof(lvItem));
|
||||||
lvItem.mask = LVIF_TEXT | LVIF_PARAM;
|
lvItem.mask = LVIF_TEXT | LVIF_PARAM;
|
||||||
|
@ -277,21 +275,6 @@ void CRomBrowser::RomAddedToList(int32_t ListPos)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CRomBrowser::AllocateBrushs(void)
|
|
||||||
{
|
|
||||||
for (size_t count = 0; count < m_RomInfo.size(); count++)
|
|
||||||
{
|
|
||||||
if (m_RomInfo[count].SelColor == -1)
|
|
||||||
{
|
|
||||||
m_RomInfo[count].SelColorBrush = (uint32_t)((HBRUSH)(COLOR_HIGHLIGHT + 1));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
m_RomInfo[count].SelColorBrush = (uint32_t)CreateSolidBrush(m_RomInfo[count].SelColor);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void CRomBrowser::RomListReset(void)
|
void CRomBrowser::RomListReset(void)
|
||||||
{
|
{
|
||||||
WriteTrace(TraceUserInterface, TraceDebug, "1");
|
WriteTrace(TraceUserInterface, TraceDebug, "1");
|
||||||
|
@ -313,23 +296,15 @@ void CRomBrowser::CreateRomListControl(void)
|
||||||
|
|
||||||
void CRomBrowser::DeallocateBrushs(void)
|
void CRomBrowser::DeallocateBrushs(void)
|
||||||
{
|
{
|
||||||
for (size_t count = 0; count < m_RomInfo.size(); count++)
|
for (HBRUSH_MAP::iterator itr = m_Brushes.begin(); itr != m_Brushes.end(); itr++)
|
||||||
{
|
{
|
||||||
if (m_RomInfo[count].SelColor == -1)
|
DeleteObject(itr->second);
|
||||||
{
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
if (m_RomInfo[count].SelColorBrush)
|
|
||||||
{
|
|
||||||
DeleteObject((HBRUSH)m_RomInfo[count].SelColorBrush);
|
|
||||||
m_RomInfo[count].SelColorBrush = NULL;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
m_Brushes.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CRomBrowser::RomListLoaded(void)
|
void CRomBrowser::RomListLoaded(void)
|
||||||
{
|
{
|
||||||
AllocateBrushs();
|
|
||||||
RomList_SortList();
|
RomList_SortList();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -498,7 +473,7 @@ bool CRomBrowser::RomListDrawItem(int32_t idCtrl, uint32_t lParam)
|
||||||
RECT rcItem, rcDraw;
|
RECT rcItem, rcDraw;
|
||||||
wchar_t String[300];
|
wchar_t String[300];
|
||||||
LVITEMW lvItem;
|
LVITEMW lvItem;
|
||||||
HBRUSH hBrush;
|
HBRUSH hBrush = (HBRUSH)(COLOR_WINDOW + 1);
|
||||||
LV_COLUMN lvc;
|
LV_COLUMN lvc;
|
||||||
int32_t nColumn;
|
int32_t nColumn;
|
||||||
|
|
||||||
|
@ -519,12 +494,20 @@ bool CRomBrowser::RomListDrawItem(int32_t idCtrl, uint32_t lParam)
|
||||||
}
|
}
|
||||||
if (bSelected)
|
if (bSelected)
|
||||||
{
|
{
|
||||||
hBrush = (HBRUSH)pRomInfo->SelColorBrush;
|
HBRUSH_MAP::iterator itr = m_Brushes.find(pRomInfo->SelColor);
|
||||||
|
if (itr != m_Brushes.end())
|
||||||
|
{
|
||||||
|
hBrush = itr->second;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
std::pair<HBRUSH_MAP::iterator, bool> res = m_Brushes.insert(HBRUSH_MAP::value_type(pRomInfo->SelColor, CreateSolidBrush(pRomInfo->SelColor)));
|
||||||
|
hBrush = res.first->second;
|
||||||
|
}
|
||||||
SetTextColor(ditem->hDC, pRomInfo->SelTextColor);
|
SetTextColor(ditem->hDC, pRomInfo->SelTextColor);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
hBrush = (HBRUSH)(COLOR_WINDOW + 1);
|
|
||||||
SetTextColor(ditem->hDC, pRomInfo->TextColor);
|
SetTextColor(ditem->hDC, pRomInfo->TextColor);
|
||||||
}
|
}
|
||||||
FillRect(ditem->hDC, &ditem->rcItem, hBrush);
|
FillRect(ditem->hDC, &ditem->rcItem, hBrush);
|
||||||
|
|
|
@ -148,10 +148,6 @@ void CRomList::FillRomList(strlist & FileList, const CPath & BaseDirectory, cons
|
||||||
|
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
uint8_t ext_ID;
|
|
||||||
int8_t new_list_entry = 0;
|
|
||||||
const uint8_t exts = sizeof(ROM_extensions) / sizeof(ROM_extensions[0]);
|
|
||||||
|
|
||||||
WriteTrace(TraceRomList, TraceVerbose, "Found: \"%s\" m_StopRefresh = %s", (const char *)SearchPath, m_StopRefresh ? "true" : "false");
|
WriteTrace(TraceRomList, TraceVerbose, "Found: \"%s\" m_StopRefresh = %s", (const char *)SearchPath, m_StopRefresh ? "true" : "false");
|
||||||
if (m_StopRefresh)
|
if (m_StopRefresh)
|
||||||
{
|
{
|
||||||
|
@ -314,14 +310,6 @@ void CRomList::FillRomList(strlist & FileList, const CPath & BaseDirectory, cons
|
||||||
WriteTrace(TraceUserInterface, TraceDebug, "16");
|
WriteTrace(TraceUserInterface, TraceDebug, "16");
|
||||||
FillRomExtensionInfo(&RomInfo);
|
FillRomExtensionInfo(&RomInfo);
|
||||||
|
|
||||||
if (RomInfo.SelColor == -1)
|
|
||||||
{
|
|
||||||
RomInfo.SelColorBrush = (uint32_t)((HBRUSH)(COLOR_HIGHLIGHT + 1));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
RomInfo.SelColorBrush = (uint32_t)CreateSolidBrush(RomInfo.SelColor);
|
|
||||||
}
|
|
||||||
WriteTrace(TraceUserInterface, TraceDebug, "17");
|
WriteTrace(TraceUserInterface, TraceDebug, "17");
|
||||||
int32_t ListPos = m_RomInfo.size();
|
int32_t ListPos = m_RomInfo.size();
|
||||||
m_RomInfo.push_back(RomInfo);
|
m_RomInfo.push_back(RomInfo);
|
||||||
|
@ -469,18 +457,7 @@ bool CRomList::FillRomInfo(ROM_INFO * pRomInfo)
|
||||||
pRomInfo->CRC1 = *(uint32_t *)(RomData + 0x10);
|
pRomInfo->CRC1 = *(uint32_t *)(RomData + 0x10);
|
||||||
pRomInfo->CRC2 = *(uint32_t *)(RomData + 0x14);
|
pRomInfo->CRC2 = *(uint32_t *)(RomData + 0x14);
|
||||||
pRomInfo->CicChip = GetCicChipID(RomData);
|
pRomInfo->CicChip = GetCicChipID(RomData);
|
||||||
|
|
||||||
FillRomExtensionInfo(pRomInfo);
|
FillRomExtensionInfo(pRomInfo);
|
||||||
|
|
||||||
if (pRomInfo->SelColor == -1)
|
|
||||||
{
|
|
||||||
pRomInfo->SelColorBrush = (uint32_t)((HBRUSH)(COLOR_HIGHLIGHT + 1));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
pRomInfo->SelColorBrush = (uint32_t)CreateSolidBrush(pRomInfo->SelColor);
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -39,7 +39,6 @@ public:
|
||||||
uint32_t TextColor;
|
uint32_t TextColor;
|
||||||
int32_t SelColor;
|
int32_t SelColor;
|
||||||
uint32_t SelTextColor;
|
uint32_t SelTextColor;
|
||||||
uint32_t SelColorBrush;
|
|
||||||
int32_t RomSize;
|
int32_t RomSize;
|
||||||
uint8_t Manufacturer;
|
uint8_t Manufacturer;
|
||||||
uint8_t Country;
|
uint8_t Country;
|
||||||
|
|
Loading…
Reference in New Issue