1
0
Fork 0
mirror of https://github.com/eliboa/TegraRcmGUI.git synced 2024-11-24 19:22:04 +00:00
This commit is contained in:
eliboa 2018-06-28 20:33:30 +02:00
parent 79a937965f
commit a6a6b12e18
25 changed files with 427 additions and 22 deletions

View file

@ -53,30 +53,38 @@ DialogTab01::~DialogTab01()
BOOL DialogTab01::OnInitDialog() BOOL DialogTab01::OnInitDialog()
{ {
CDialog::OnInitDialog(); CDialog::OnInitDialog();
CRect rc;
string pfile = m_TegraRcm->GetPreset("PAYLOAD_FILE"); string pfile = m_TegraRcm->GetPreset("PAYLOAD_FILE");
CString file(pfile.c_str()); CString file(pfile.c_str());
this->GetDlgItem(PAYLOAD_PATH)->SetWindowTextW(file); this->GetDlgItem(PAYLOAD_PATH)->SetWindowTextW(file);
CButton* pBtn = (CButton*)GetDlgItem(IDC_BROWSE); CButton* pBtn = (CButton*)GetDlgItem(IDC_BROWSE);
pBtn->GetWindowRect(rc);
int height = rc.Height() * 0.8;
pBtn->ModifyStyle(0, BS_ICON); pBtn->ModifyStyle(0, BS_ICON);
HICON hIcn = (HICON)LoadImage( HICON hIcn = (HICON)LoadImage(
AfxGetApp()->m_hInstance, AfxGetApp()->m_hInstance,
MAKEINTRESOURCE(ID_BROWSE_ICON), MAKEINTRESOURCE(ID_BROWSE_ICON),
IMAGE_ICON, IMAGE_ICON,
24, 24, // use actual size height, height, // use actual size
LR_DEFAULTCOLOR LR_DEFAULTCOLOR
); );
pBtn->SetIcon(hIcn); pBtn->SetIcon(hIcn);
pBtn = (CButton*)GetDlgItem(ID_ADD_FAV); pBtn = (CButton*)GetDlgItem(ID_ADD_FAV);
pBtn->GetWindowRect(rc);
height = rc.Height() * 0.8;
pBtn->ModifyStyle(0, BS_ICON); pBtn->ModifyStyle(0, BS_ICON);
hIcn = (HICON)LoadImage( hIcn = (HICON)LoadImage(
AfxGetApp()->m_hInstance, AfxGetApp()->m_hInstance,
MAKEINTRESOURCE(ID_ADD_ICON), MAKEINTRESOURCE(ID_ADD_ICON),
IMAGE_ICON, IMAGE_ICON,
24, 24, // use actual size height, height, // use actual size
LR_DEFAULTCOLOR LR_DEFAULTCOLOR
); );
pBtn->SetIcon(hIcn); pBtn->SetIcon(hIcn);
@ -87,12 +95,14 @@ BOOL DialogTab01::OnInitDialog()
AfxGetApp()->m_hInstance, AfxGetApp()->m_hInstance,
MAKEINTRESOURCE(ID_DELETE_ICON), MAKEINTRESOURCE(ID_DELETE_ICON),
IMAGE_ICON, IMAGE_ICON,
24, 24, // use actual size height, height, // use actual size
LR_DEFAULTCOLOR LR_DEFAULTCOLOR
); );
pBtn->SetIcon(hIcn); pBtn->SetIcon(hIcn);
PREVENT_AUTOINJECT = FALSE; PREVENT_AUTOINJECT = FALSE;
m_TegraRcm->AppendLog("Add favorites to listbox");
for (int i = 0; i < m_TegraRcm->Favorites.GetCount(); i++) for (int i = 0; i < m_TegraRcm->Favorites.GetCount(); i++)
{ {
@ -106,6 +116,11 @@ BOOL DialogTab01::OnInitDialog()
csPath = m_TegraRcm->Favorites[i].Left(nIndex); csPath = m_TegraRcm->Favorites[i].Left(nIndex);
Item = csFilename + _T(" (") + csPath + _T(")"); Item = csFilename + _T(" (") + csPath + _T(")");
pListBox->AddString(_tcsdup(Item)); pListBox->AddString(_tcsdup(Item));
wstring wcsPath(csPath);
string scsPath(wcsPath.begin(), wcsPath.end());
m_TegraRcm->AppendLog("Add favorites to listbox");
m_TegraRcm->AppendLog(scsPath);
} }
} }
@ -258,12 +273,25 @@ void DialogTab01::OnBnClickedAddFav()
int nIndex = csPathf.ReverseFind(_T('\\')); int nIndex = csPathf.ReverseFind(_T('\\'));
if (nIndex > 0) csFilename = csPathf.Right(csPathf.GetLength() - nIndex - 1); if (nIndex > 0) csFilename = csPathf.Right(csPathf.GetLength() - nIndex - 1);
else return; else return;
for (int i = 0; i < m_TegraRcm->Favorites.GetCount(); i++)
{
if (m_TegraRcm->Favorites[i] == csPathf)
{
m_TegraRcm->SendUserMessage("Favorite already exists", INVALID);
return;
}
}
csPath = csPathf.Left(nIndex); csPath = csPathf.Left(nIndex);
Item = csFilename + _T(" (") + csPath + _T(")"); Item = csFilename + _T(" (") + csPath + _T(")");
pListBox->AddString(_tcsdup(Item)); pListBox->AddString(_tcsdup(Item));
m_ListBox.Add(csPathf); m_ListBox.Add(csPathf);
m_TegraRcm->Favorites.Add(csPathf); m_TegraRcm->Favorites.Add(csPathf);
m_TegraRcm->SaveFavorites(); m_TegraRcm->SaveFavorites();
m_TegraRcm->SendUserMessage("Favorite added", VALID);
return;
} }
@ -277,7 +305,9 @@ void DialogTab01::OnBnClickedDelFav()
pListBox->DeleteString(i); pListBox->DeleteString(i);
m_TegraRcm->Favorites.RemoveAt(i); m_TegraRcm->Favorites.RemoveAt(i);
m_TegraRcm->SaveFavorites(); m_TegraRcm->SaveFavorites();
m_TegraRcm->SendUserMessage("Favorite removed", VALID);
} }
return;
} }

View file

@ -66,14 +66,17 @@ END_MESSAGE_MAP()
BOOL DialogTab02::OnInitDialog() BOOL DialogTab02::OnInitDialog()
{ {
CDialogEx::OnInitDialog(); CDialogEx::OnInitDialog();
CRect rc;
CButton* pBtn = (CButton*)GetDlgItem(IDC_MOUNT_SD); CButton* pBtn = (CButton*)GetDlgItem(IDC_MOUNT_SD);
pBtn->GetWindowRect(rc);
int height = rc.Height() * 0.8;
pBtn->ModifyStyle(0, BS_ICON); pBtn->ModifyStyle(0, BS_ICON);
HICON hIcn = (HICON)LoadImage( HICON hIcn = (HICON)LoadImage(
AfxGetApp()->m_hInstance, AfxGetApp()->m_hInstance,
MAKEINTRESOURCE(ID_UMSTOOL_ICON), MAKEINTRESOURCE(ID_UMSTOOL_ICON),
IMAGE_ICON, IMAGE_ICON,
32, 32, // use actual size height, height, // use actual size
LR_DEFAULTCOLOR LR_DEFAULTCOLOR
); );
pBtn->SetIcon(hIcn); pBtn->SetIcon(hIcn);
@ -84,7 +87,7 @@ BOOL DialogTab02::OnInitDialog()
AfxGetApp()->m_hInstance, AfxGetApp()->m_hInstance,
MAKEINTRESOURCE(ID_LINUX_ICON), MAKEINTRESOURCE(ID_LINUX_ICON),
IMAGE_ICON, IMAGE_ICON,
32, 32, // use actual size height, height, // use actual size
LR_DEFAULTCOLOR LR_DEFAULTCOLOR
); );
pBtn->SetIcon(hIcn); pBtn->SetIcon(hIcn);

View file

@ -130,3 +130,4 @@ void DialogTab03::OnBnClickedInstallDriver()
{ {
m_TegraRcm->InstallDriver(); m_TegraRcm->InstallDriver();
} }

View file

@ -141,6 +141,83 @@ void TegraRcm::ShowContextMenu(HWND hWnd)
{ {
if (m_RC == 0) if (m_RC == 0)
{ {
HMENU hSubmenu = CreatePopupMenu();
UINT uID = 0;
for (int i = 0; i < Favorites.GetCount(); i++)
{
if (i < 9)
{
uID++;
int swm;
switch (i)
{
case 0:
swm = SWM_FAV01;
break;
case 1:
swm = SWM_FAV02;
break;
case 2:
swm = SWM_FAV03;
break;
case 3:
swm = SWM_FAV04;
break;
case 4:
swm = SWM_FAV05;
break;
case 5:
swm = SWM_FAV06;
break;
case 6:
swm = SWM_FAV07;
break;
case 7:
swm = SWM_FAV08;
break;
case 8:
swm = SWM_FAV09;
break;
case 9:
swm = SWM_FAV10;
break;
default:
break;
}
int nIndex = Favorites[i].ReverseFind(_T('\\'));
if (nIndex > 0)
{
CString csFilename, csPath, Item;
csFilename = Favorites[i].Right(Favorites[i].GetLength() - nIndex - 1);
csPath = Favorites[i].Left(nIndex);
if (csPath.GetLength() > 30)
{
csPath = csPath.Left(30);
Item = csFilename + _T(" (") + csPath + _T("...)");
}
else
{
Item = csFilename + _T(" (") + csPath + _T(")");
}
InsertMenu(hSubmenu, -1, MF_BYPOSITION, swm, Item);
}
else
{
InsertMenu(hSubmenu, -1, MF_BYPOSITION, swm, Favorites[i]);
}
}
}
MENUITEMINFO mii = { sizeof(MENUITEMINFO) };
mii.fMask = MIIM_SUBMENU | MIIM_STRING | MIIM_ID;
mii.wID = uID;
mii.hSubMenu = hSubmenu;
mii.dwTypeData = _T("Favorites");
CString csPathf, csFilename, payload; CString csPathf, csFilename, payload;
m_Ctrltb1->GetDlgItem(PAYLOAD_PATH)->GetWindowTextW(csPathf); m_Ctrltb1->GetDlgItem(PAYLOAD_PATH)->GetWindowTextW(csPathf);
int nIndex = csPathf.ReverseFind(_T('\\')); int nIndex = csPathf.ReverseFind(_T('\\'));
@ -150,10 +227,13 @@ void TegraRcm::ShowContextMenu(HWND hWnd)
payload = _T("Inject ") + csFilename; payload = _T("Inject ") + csFilename;
InsertMenu(hMenu, -1, MF_BYPOSITION, SWM_INJECT, payload); InsertMenu(hMenu, -1, MF_BYPOSITION, SWM_INJECT, payload);
} }
//InsertMenu(hMenu, -1, MF_BYPOSITION, SWM_BROWSE, _T("Browse..."));
InsertMenuItem(hMenu, -1, TRUE, &mii);
InsertMenu(hMenu, -1, MF_SEPARATOR | MF_BYPOSITION, 0, NULL);
InsertMenu(hMenu, -1, MF_BYPOSITION, SWM_MOUNT, _T("Mount SD")); InsertMenu(hMenu, -1, MF_BYPOSITION, SWM_MOUNT, _T("Mount SD"));
InsertMenu(hMenu, -1, MF_BYPOSITION, SWM_LINUX, _T("Linux")); InsertMenu(hMenu, -1, MF_BYPOSITION, SWM_LINUX, _T("Linux"));
InsertMenu(hMenu, -1, MF_BYPOSITION, SWM_BROWSE, _T("Browse..."));
} }
InsertMenu(hMenu, -1, MF_SEPARATOR | MF_BYPOSITION, 0, NULL);
if (IsWindowVisible(hWnd)) if (IsWindowVisible(hWnd))
InsertMenu(hMenu, -1, MF_BYPOSITION, SWM_HIDE, _T("Hide")); InsertMenu(hMenu, -1, MF_BYPOSITION, SWM_HIDE, _T("Hide"));
else else
@ -277,18 +357,32 @@ void TegraRcm::SetPreset(string param, string value)
} }
void TegraRcm::GetFavorites() void TegraRcm::GetFavorites()
{ {
Favorites.RemoveAll(); Favorites.RemoveAll();
TCHAR *rfile = GetAbsolutePath(TEXT("favorites.conf"), CSIDL_APPDATA); TCHAR *rfile = GetAbsolutePath(TEXT("favorites.conf"), CSIDL_APPDATA);
CT2A rfile_c(rfile, CP_UTF8); CT2A rfile_c(rfile, CP_UTF8);
TRACE(_T("UTF8: %S\n"), rfile_c.m_psz); TRACE(_T("UTF8: %S\n"), rfile_c.m_psz);
string readout; string readout;
AppendLog("Reading favorites.conf");
wstring wfilename(rfile);
string filename(wfilename.begin(), wfilename.end());
AppendLog(filename);
ifstream readFile(rfile_c); ifstream readFile(rfile_c);
if (readFile.is_open()) { if (readFile.is_open()) {
AppendLog("Reading values from favorites.conf");
while (getline(readFile, readout)) { while (getline(readFile, readout)) {
CString fav(readout.c_str(), readout.length()); CString fav(readout.c_str(), readout.length());
wstring wfav = fav;
string sfav(wfav.begin(), wfav.end());
AppendLog("Append new favorite : ");
AppendLog(sfav);
Favorites.Add(fav); Favorites.Add(fav);
} }
} }
else {
AppendLog("Error reading favorites.conf");
}
} }
void TegraRcm::AddFavorite(CString value) void TegraRcm::AddFavorite(CString value)
{ {
@ -316,6 +410,11 @@ void TegraRcm::SaveFavorites()
// //
void TegraRcm::AppendLog(string message) void TegraRcm::AppendLog(string message)
{ {
// DISABLED
return;
// Get time // Get time
char str[32]; char str[32];
struct tm time_info; struct tm time_info;
@ -416,6 +515,7 @@ BOOL TegraRcm::LookForAPXDevice()
void TegraRcm::BitmapDisplay(int IMG) void TegraRcm::BitmapDisplay(int IMG)
{ {
// Init & bitmap pointers // Init & bitmap pointers
CStatic*pRcm_not_detected = (CStatic*)AfxGetMainWnd()->GetDlgItem(RCM_PIC_1); CStatic*pRcm_not_detected = (CStatic*)AfxGetMainWnd()->GetDlgItem(RCM_PIC_1);
CStatic*pDriverKO = (CStatic*)AfxGetMainWnd()->GetDlgItem(RCM_PIC_2); CStatic*pDriverKO = (CStatic*)AfxGetMainWnd()->GetDlgItem(RCM_PIC_2);
@ -508,8 +608,8 @@ void TegraRcm::LookUp()
if (rc != m_RC) if (rc != m_RC)
{ {
m_RC = rc; m_RC = rc;
CStatic*pCtrl0 = (CStatic*) m_Parent->GetDlgItem(RCM_PIC_4); //CStatic*pCtrl0 = (CStatic*) m_Parent->GetDlgItem(RCM_PIC_4);
pCtrl0->ShowWindow(SW_HIDE); //pCtrl0->ShowWindow(SW_HIDE);
// Status changed to "RCM Detected" // Status changed to "RCM Detected"
if (rc == 0) if (rc == 0)
@ -682,8 +782,8 @@ TCHAR* TegraRcm::GetAbsolutePath(TCHAR* relative_path, DWORD dwFlags)
csPath2 += TEXT("\\"); csPath2 += TEXT("\\");
csPath2 += relative_path; csPath2 += relative_path;
return _tcsdup(csPath2); return _tcsdup(csPath2);
*/ */
// USE THIS INSTEAD TO BUILD FOR MSI PACKAGER // USE THIS INSTEAD TO BUILD FOR MSI PACKAGER
TCHAR szPath[MAX_PATH]; TCHAR szPath[MAX_PATH];

Binary file not shown.

View file

@ -252,15 +252,22 @@
<Image Include="res\browse.ico" /> <Image Include="res\browse.ico" />
<Image Include="res\delete.ico" /> <Image Include="res\delete.ico" />
<Image Include="res\driver_ko.bmp" /> <Image Include="res\driver_ko.bmp" />
<Image Include="res\driver_ko_2.bmp" />
<Image Include="res\error.bmp" /> <Image Include="res\error.bmp" />
<Image Include="res\error_2.bmp" />
<Image Include="res\icon1.ico" /> <Image Include="res\icon1.ico" />
<Image Include="res\init_log.bmp" /> <Image Include="res\init_log.bmp" />
<Image Include="res\init_logo.bmp" /> <Image Include="res\init_logo.bmp" />
<Image Include="res\init_logo_2.bmp" />
<Image Include="res\linux_icon.ico" /> <Image Include="res\linux_icon.ico" />
<Image Include="res\loaded.bmp" /> <Image Include="res\loaded.bmp" />
<Image Include="res\loaded_2.bmp" />
<Image Include="res\loading.bmp" /> <Image Include="res\loading.bmp" />
<Image Include="res\loading_2.bmp" />
<Image Include="res\rcm_detected.bmp" /> <Image Include="res\rcm_detected.bmp" />
<Image Include="res\rcm_detected_2.bmp" />
<Image Include="res\rcm_undetected.bmp" /> <Image Include="res\rcm_undetected.bmp" />
<Image Include="res\rcm_undetected_2.bmp" />
<Image Include="res\status.ico" /> <Image Include="res\status.ico" />
<Image Include="res\TegraRcmGUI.ico" /> <Image Include="res\TegraRcmGUI.ico" />
<Image Include="res\tray_ico_connected.ico" /> <Image Include="res\tray_ico_connected.ico" />

View file

@ -0,0 +1,198 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="Source Files">
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
</Filter>
<Filter Include="Header Files">
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
<Extensions>h;hh;hpp;hxx;hm;inl;inc;xsd</Extensions>
</Filter>
<Filter Include="Resource Files">
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
</Filter>
</ItemGroup>
<ItemGroup>
<Text Include="ReadMe.txt" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="TegraRcmGUI.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="TegraRcmGUIDlg.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="stdafx.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="targetver.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="Resource.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="libusbk_int.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="ScopeGuard.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="TegraRcmSmash.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="Types.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="Win32Def.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="WinHandle.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="res\BitmapPicture.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="MyTabCtrl.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="DialogTab01.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="DialogTab02.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="DialogTab03.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="TegraRcm.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ClCompile Include="TegraRcmGUI.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="TegraRcmGUIDlg.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="stdafx.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="TegraRcmSmash.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="res\BitmapPicture.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="MyTabCtrl.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="DialogTab01.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="DialogTab02.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="DialogTab03.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="TegraRcm.cpp">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="TegraRcmGUI.rc">
<Filter>Resource Files</Filter>
</ResourceCompile>
</ItemGroup>
<ItemGroup>
<None Include="res\TegraRcmGUI.rc2">
<Filter>Resource Files</Filter>
</None>
</ItemGroup>
<ItemGroup>
<Image Include="res\TegraRcmGUI.ico">
<Filter>Resource Files</Filter>
</Image>
<Image Include="res\driver_ko.bmp">
<Filter>Resource Files</Filter>
</Image>
<Image Include="res\init_logo.bmp">
<Filter>Resource Files</Filter>
</Image>
<Image Include="res\rcm_detected.bmp">
<Filter>Resource Files</Filter>
</Image>
<Image Include="res\rcm_undetected.bmp">
<Filter>Resource Files</Filter>
</Image>
<Image Include="..\..\..\..\..\..\Visual Studio 2015\Projects\TegraRcmGUI\TegraRcmGUI\res\TegraRcmGUI.ico">
<Filter>Resource Files</Filter>
</Image>
<Image Include="res\bitmap2.bmp">
<Filter>Resource Files</Filter>
</Image>
<Image Include="res\init_log.bmp">
<Filter>Resource Files</Filter>
</Image>
<Image Include="res\error.bmp">
<Filter>Resource Files</Filter>
</Image>
<Image Include="res\loaded.bmp">
<Filter>Resource Files</Filter>
</Image>
<Image Include="res\loading.bmp">
<Filter>Resource Files</Filter>
</Image>
<Image Include="res\icon1.ico">
<Filter>Resource Files</Filter>
</Image>
<Image Include="res\tray_ico_connected.ico">
<Filter>Resource Files</Filter>
</Image>
<Image Include="res\tray_ico_not_connected.ico">
<Filter>Resource Files</Filter>
</Image>
<Image Include="res\browse.ico">
<Filter>Resource Files</Filter>
</Image>
<Image Include="res\status.ico">
<Filter>Resource Files</Filter>
</Image>
<Image Include="res\linux_icon.ico">
<Filter>Resource Files</Filter>
</Image>
<Image Include="res\usb_icon.ico">
<Filter>Resource Files</Filter>
</Image>
<Image Include="res\add.ico">
<Filter>Resource Files</Filter>
</Image>
<Image Include="res\delete.ico">
<Filter>Resource Files</Filter>
</Image>
<Image Include="res\rcm_undetected_2.bmp">
<Filter>Resource Files</Filter>
</Image>
<Image Include="res\driver_ko_2.bmp">
<Filter>Resource Files</Filter>
</Image>
<Image Include="res\rcm_detected_2.bmp">
<Filter>Resource Files</Filter>
</Image>
<Image Include="res\loaded_2.bmp">
<Filter>Resource Files</Filter>
</Image>
<Image Include="res\loading_2.bmp">
<Filter>Resource Files</Filter>
</Image>
<Image Include="res\error_2.bmp">
<Filter>Resource Files</Filter>
</Image>
<Image Include="res\init_logo_2.bmp">
<Filter>Resource Files</Filter>
</Image>
</ItemGroup>
</Project>

View file

@ -55,14 +55,14 @@ CTegraRcmGUIDlg::CTegraRcmGUIDlg(CWnd* pParent /*=NULL*/)
} }
void CTegraRcmGUIDlg::DoDataExchange(CDataExchange* pDX) void CTegraRcmGUIDlg::DoDataExchange(CDataExchange* pDX)
{ {
CDialog::DoDataExchange(pDX); CDialog::DoDataExchange(pDX);
DDX_Control(pDX, RCM_PIC_1, RCM_BITMAP1); DDX_Control(pDX, RCM_PIC_1, RCM_BITMAP1);
DDX_Control(pDX, RCM_PIC_2, RCM_BITMAP2); DDX_Control(pDX, RCM_PIC_2, RCM_BITMAP2);
DDX_Control(pDX, RCM_PIC_3, RCM_BITMAP3); DDX_Control(pDX, RCM_PIC_3, RCM_BITMAP3);
DDX_Control(pDX, RCM_PIC_4, RCM_BITMAP0); DDX_Control(pDX, RCM_PIC_4, RCM_BITMAP0);
DDX_Control(pDX, RCM_PIC_5, RCM_BITMAP4); DDX_Control(pDX, RCM_PIC_5, RCM_BITMAP4);
DDX_Control(pDX, RCM_PIC_6, RCM_BITMAP5); DDX_Control(pDX, RCM_PIC_6, RCM_BITMAP5);
DDX_Control(pDX, RCM_PIC_7, RCM_BITMAP6); DDX_Control(pDX, RCM_PIC_7, RCM_BITMAP6);
DDX_Control(pDX, IDC_TAB_CONTROL, m_tbCtrl); DDX_Control(pDX, IDC_TAB_CONTROL, m_tbCtrl);
} }
BEGIN_MESSAGE_MAP(CTegraRcmGUIDlg, CDialog) BEGIN_MESSAGE_MAP(CTegraRcmGUIDlg, CDialog)
@ -82,6 +82,16 @@ BEGIN_MESSAGE_MAP(CTegraRcmGUIDlg, CDialog)
ON_COMMAND(SWM_BROWSE, BrowseCommand) ON_COMMAND(SWM_BROWSE, BrowseCommand)
ON_COMMAND(SWM_LINUX, LinuxCommand) ON_COMMAND(SWM_LINUX, LinuxCommand)
ON_COMMAND(SWM_MOUNT, MountCommand) ON_COMMAND(SWM_MOUNT, MountCommand)
ON_COMMAND(SWM_FAV01, InjectFav01Command)
ON_COMMAND(SWM_FAV02, InjectFav02Command)
ON_COMMAND(SWM_FAV03, InjectFav03Command)
ON_COMMAND(SWM_FAV04, InjectFav04Command)
ON_COMMAND(SWM_FAV05, InjectFav05Command)
ON_COMMAND(SWM_FAV06, InjectFav06Command)
ON_COMMAND(SWM_FAV07, InjectFav07Command)
ON_COMMAND(SWM_FAV08, InjectFav08Command)
ON_COMMAND(SWM_FAV09, InjectFav09Command)
ON_COMMAND(SWM_FAV10, InjectFav10Command)
END_MESSAGE_MAP() END_MESSAGE_MAP()
// //
@ -103,13 +113,34 @@ BOOL CTegraRcmGUIDlg::OnInitDialog()
else csPath.Empty(); else csPath.Empty();
// Initialize bitmap // Initialize bitmap
RCM_BITMAP0.SetBitmap(INIT_LOGO);
RCM_BITMAP1.SetBitmap(RCM_NOT_DETECTED);
RCM_BITMAP2.SetBitmap(DRIVER_KO);
RCM_BITMAP3.SetBitmap(RCM_DETECTED); CRect rc;
RCM_BITMAP4.SetBitmap(LOADING); AfxGetMainWnd()->GetWindowRect(rc);
RCM_BITMAP5.SetBitmap(LOADED); int width = rc.Width();
RCM_BITMAP6.SetBitmap(LOAD_ERROR);
if (width < 400)
{
RCM_BITMAP0.SetBitmap(INIT_LOGO_2);
RCM_BITMAP1.SetBitmap(RCM_NOT_DETECTED_2);
RCM_BITMAP2.SetBitmap(DRIVER_KO_2);
RCM_BITMAP3.SetBitmap(RCM_DETECTED_2);
RCM_BITMAP4.SetBitmap(LOADING_2);
RCM_BITMAP5.SetBitmap(LOADED_2);
RCM_BITMAP6.SetBitmap(LOAD_ERROR_2);
}
else
{
RCM_BITMAP0.SetBitmap(INIT_LOGO);
RCM_BITMAP1.SetBitmap(RCM_NOT_DETECTED);
RCM_BITMAP2.SetBitmap(DRIVER_KO);
RCM_BITMAP3.SetBitmap(RCM_DETECTED);
RCM_BITMAP4.SetBitmap(LOADING);
RCM_BITMAP5.SetBitmap(LOADED);
RCM_BITMAP6.SetBitmap(LOAD_ERROR);
}
// Menu // Menu
ASSERT((IDM_ABOUTBOX & 0xFFF0) == IDM_ABOUTBOX); ASSERT((IDM_ABOUTBOX & 0xFFF0) == IDM_ABOUTBOX);
@ -161,9 +192,7 @@ BOOL CTegraRcmGUIDlg::OnInitDialog()
m_TegraRcm->SetTrayIconTipText(TEXT("TegraRcmGUI")); m_TegraRcm->SetTrayIconTipText(TEXT("TegraRcmGUI"));
// Start timer to check RCM status every second // Start timer to check RCM status every second
CTegraRcmGUIDlg::StartTimer(); CTegraRcmGUIDlg::StartTimer();
return TRUE; return TRUE;
} }
@ -197,6 +226,10 @@ HBRUSH CTegraRcmGUIDlg::OnCtlColor(CDC* pDC, CWnd *pWnd, UINT nCtlColor)
{ {
return (HBRUSH)CreateSolidBrush(WhiteRGB); return (HBRUSH)CreateSolidBrush(WhiteRGB);
} }
if (GetDlgItem(RCM_BITMAP)->GetSafeHwnd() == pWnd->GetSafeHwnd())
{
return (HBRUSH)CreateSolidBrush(WhiteRGB);
}
default: default:
return CDialog::OnCtlColor(pDC, pWnd, nCtlColor); return CDialog::OnCtlColor(pDC, pWnd, nCtlColor);
} }
@ -310,6 +343,27 @@ void CTegraRcmGUIDlg::MountCommand()
pt->OnBnClickedMountSd(); pt->OnBnClickedMountSd();
} }
} }
void CTegraRcmGUIDlg::InjectFav01Command() { InjectFavCommand(0); }
void CTegraRcmGUIDlg::InjectFav02Command() { InjectFavCommand(1); }
void CTegraRcmGUIDlg::InjectFav03Command() { InjectFavCommand(2); }
void CTegraRcmGUIDlg::InjectFav04Command() { InjectFavCommand(3); }
void CTegraRcmGUIDlg::InjectFav05Command() { InjectFavCommand(4); }
void CTegraRcmGUIDlg::InjectFav06Command() { InjectFavCommand(5); }
void CTegraRcmGUIDlg::InjectFav07Command() { InjectFavCommand(6); }
void CTegraRcmGUIDlg::InjectFav08Command() { InjectFavCommand(7); }
void CTegraRcmGUIDlg::InjectFav09Command() { InjectFavCommand(8); }
void CTegraRcmGUIDlg::InjectFav10Command() { InjectFavCommand(9); }
void CTegraRcmGUIDlg::InjectFavCommand(int i)
{
if (m_TegraRcm != NULL)
{
DialogTab01 *pt = (DialogTab01*)m_TegraRcm->m_Ctrltb1;
CString fav = m_TegraRcm->Favorites.GetAt(i);
pt->GetDlgItem(PAYLOAD_PATH)->SetWindowTextW(fav);
pt->GetDlgItem(PAYLOAD_PATH)->GetFocus();
pt->InjectPayload();
}
}
void CTegraRcmGUIDlg::StartTimer() void CTegraRcmGUIDlg::StartTimer()

View file

@ -106,6 +106,18 @@ public:
void BrowseCommand(); void BrowseCommand();
void LinuxCommand(); void LinuxCommand();
void MountCommand(); void MountCommand();
void InjectFavCommand(int i);
void InjectFav01Command();
void InjectFav02Command();
void InjectFav03Command();
void InjectFav04Command();
void InjectFav05Command();
void InjectFav06Command();
void InjectFav07Command();
void InjectFav08Command();
void InjectFav09Command();
void InjectFav10Command();
CTegraRcmGUIDlg *m_pMainWnd = this; CTegraRcmGUIDlg *m_pMainWnd = this;
private: private:
MyTabCtrl m_tbCtrl; MyTabCtrl m_tbCtrl;

BIN
TegraRcmGUI/res/bitmap2.bmp Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 84 KiB

After

Width:  |  Height:  |  Size: 82 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 30 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 84 KiB

After

Width:  |  Height:  |  Size: 82 KiB

BIN
TegraRcmGUI/res/error_2.bmp Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 30 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 29 KiB

After

Width:  |  Height:  |  Size: 28 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 84 KiB

After

Width:  |  Height:  |  Size: 82 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 30 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 84 KiB

After

Width:  |  Height:  |  Size: 82 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 30 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 84 KiB

After

Width:  |  Height:  |  Size: 82 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 30 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 84 KiB

After

Width:  |  Height:  |  Size: 82 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 30 KiB

Binary file not shown.