|
@@ -39,6 +39,9 @@ static char THIS_FILE[] = __FILE__;
|
|
// 下拉框控件id;
|
|
// 下拉框控件id;
|
|
#define ID_COMBOBOX_SIGNAL_FILE 6
|
|
#define ID_COMBOBOX_SIGNAL_FILE 6
|
|
extern CMainFrame* g_pMainFrame;
|
|
extern CMainFrame* g_pMainFrame;
|
|
|
|
+
|
|
|
|
+#define RGB_TW RGB(0,162,232)
|
|
|
|
+#define RGB_RR RGB(255,255,128)
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
// CResourceViewBar
|
|
// CResourceViewBar
|
|
|
|
|
|
@@ -147,6 +150,18 @@ int CIRControlWnd::CreateCtrl()
|
|
return -1; // 未能创建
|
|
return -1; // 未能创建
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ // 设置透明false以显示背景色
|
|
|
|
+ m_btnSwitchRemote.m_bTransparent = FALSE;
|
|
|
|
+ m_btnSwitchRemote.m_bDontUseWinXPTheme = TRUE;
|
|
|
|
+ // 设置背景色;
|
|
|
|
+ m_btnSwitchRemote.SetFaceColor(Global::g_Config.useTW ? RGB_TW :RGB_RR , TRUE);
|
|
|
|
+ // 消除单击时黑色内圈;
|
|
|
|
+ m_btnSwitchRemote.m_bDrawFocus = FALSE;
|
|
|
|
+ // 设置按钮扁平样式;
|
|
|
|
+ m_btnSwitchRemote.m_nFlatStyle = CMFCButton::FlatStyle::BUTTONSTYLE_FLAT;
|
|
|
|
+ // 设置鼠标形状;
|
|
|
|
+ m_btnSwitchRemote.SetMouseCursorHand();
|
|
|
|
+
|
|
return 0;
|
|
return 0;
|
|
}
|
|
}
|
|
|
|
|
|
@@ -982,7 +997,7 @@ void CIRControlWnd::OnSwitchRemoteClicked()
|
|
{
|
|
{
|
|
m_btnSwitchRemote.SetWindowText(GlobalString::g_strSwitchRemote);
|
|
m_btnSwitchRemote.SetWindowText(GlobalString::g_strSwitchRemote);
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+ m_btnSwitchRemote.SetFaceColor(Global::g_Config.useTW ? RGB_TW : RGB_RR, TRUE);
|
|
WritePrivateProfileString(_T("SATHelper"), _T("useTW"), Global::g_Config.useTW ? _T("1") : _T("0"), Global::g_szConfig);
|
|
WritePrivateProfileString(_T("SATHelper"), _T("useTW"), Global::g_Config.useTW ? _T("1") : _T("0"), Global::g_szConfig);
|
|
// 同时写入resource_run.cfg中:[devices].[rcudevice_selected]
|
|
// 同时写入resource_run.cfg中:[devices].[rcudevice_selected]
|
|
WritePrivateProfileString(_T("devices"), _T("rcudevice_selected"), Global::g_Config.useTW ? _T("tw") : _T("redrat4"), g_pMainFrame->m_szRsCfgPath);
|
|
WritePrivateProfileString(_T("devices"), _T("rcudevice_selected"), Global::g_Config.useTW ? _T("tw") : _T("redrat4"), g_pMainFrame->m_szRsCfgPath);
|
|
@@ -996,6 +1011,47 @@ void CIRControlWnd::OnUpdateFindFindinfraRed(CCmdUI* pCmdUI)
|
|
|
|
|
|
void CIRControlWnd::OnFindFindinfraRedClicked()
|
|
void CIRControlWnd::OnFindFindinfraRedClicked()
|
|
{
|
|
{
|
|
|
|
+ std::thread t([](CIRControlWnd* p) {
|
|
|
|
+ p->m_btnFindinfraRed.EnableWindow(FALSE);
|
|
|
|
+
|
|
|
|
+ CCallPython pycall;
|
|
|
|
+ TCHAR szPath[MAX_PATH] = { 0 };
|
|
|
|
+ _stprintf_s(szPath, _T("%sscripts\\FindRC.py"), Global::g_szCurModuleDir);
|
|
|
|
+ PyObject* pRet = pycall.CallPython(szPath, _T("API_FindIRRC"), 1, _variant_t(Global::g_Config.useTW ? Global::g_Config.twSignaldir.c_str() : Global::g_Config.signaldir.c_str()) );
|
|
|
|
+ if (pRet == NULL)
|
|
|
|
+ {
|
|
|
|
+ if (Global::g_Config.nLanguage)
|
|
|
|
+ AfxMessageBox("Running error, please check the script!");
|
|
|
|
+ else
|
|
|
|
+ AfxMessageBox("运行出错,请检查脚本!");
|
|
|
|
+ }
|
|
|
|
+ else
|
|
|
|
+ {
|
|
|
|
+ filehelper fh;
|
|
|
|
+ std::string file = pycall.GetUTF8String(pRet);
|
|
|
|
+ if (Global::g_Config.useTW) {
|
|
|
|
+ TW::LoadXml(file.c_str());
|
|
|
|
+ Global::g_Config.twUseSignal = file;
|
|
|
|
+ p->m_wndSignalCombo.SelectString(0, fh.getfilename(file).c_str());
|
|
|
|
+ WritePrivateProfileString("TestWizard", "useSignal", file.c_str(), Global::g_szConfig);
|
|
|
|
+ }
|
|
|
|
+ else
|
|
|
|
+ {
|
|
|
|
+ Global::g_Config.use_signal = file;
|
|
|
|
+ WritePrivateProfileString("ir-device", "use-signal", file.c_str(), Global::g_szConfig);
|
|
|
|
+ // 切换通用类型时用到;
|
|
|
|
+ p->m_wndSignalCombo.SelectString(0, Global::g_Config.use_signal.c_str());
|
|
|
|
+ // 加载指定目录的xml信号集文件;
|
|
|
|
+ RedRat::g_loadSignalDataSet(file.c_str());
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if (pRet)
|
|
|
|
+ Py_DECREF(pRet);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ p->m_btnFindinfraRed.EnableWindow();
|
|
|
|
+ }, this);
|
|
|
|
+ t.detach();
|
|
}
|
|
}
|
|
|
|
|
|
void CIRControlWnd::OnUpdateFindBluetooth(CCmdUI* pCmdUI)
|
|
void CIRControlWnd::OnUpdateFindBluetooth(CCmdUI* pCmdUI)
|
|
@@ -1004,6 +1060,47 @@ void CIRControlWnd::OnUpdateFindBluetooth(CCmdUI* pCmdUI)
|
|
|
|
|
|
void CIRControlWnd::OnFindBluetoothClicked()
|
|
void CIRControlWnd::OnFindBluetoothClicked()
|
|
{
|
|
{
|
|
|
|
+ std::thread t([](CIRControlWnd* p) {
|
|
|
|
+ p->m_btnFindBluetooth.EnableWindow(FALSE);
|
|
|
|
+
|
|
|
|
+ CCallPython pycall;
|
|
|
|
+ TCHAR szPath[MAX_PATH] = { 0 };
|
|
|
|
+ _stprintf_s(szPath, _T("%sscripts\\FindRC.py"), Global::g_szCurModuleDir);
|
|
|
|
+ PyObject* pRet = pycall.CallPython(szPath, _T("API_FindBLRC"), 1, _variant_t(Global::g_Config.useTW ? Global::g_Config.twSignaldir.c_str() : Global::g_Config.signaldir.c_str()));
|
|
|
|
+ if (pRet == NULL)
|
|
|
|
+ {
|
|
|
|
+ if (Global::g_Config.nLanguage)
|
|
|
|
+ AfxMessageBox("Running error, please check the script!");
|
|
|
|
+ else
|
|
|
|
+ AfxMessageBox("运行出错,请检查脚本!");
|
|
|
|
+ }
|
|
|
|
+ else
|
|
|
|
+ {
|
|
|
|
+ filehelper fh;
|
|
|
|
+ std::string file = pycall.GetUTF8String(pRet);
|
|
|
|
+ if (Global::g_Config.useTW) {
|
|
|
|
+ TW::LoadXml(file.c_str());
|
|
|
|
+ Global::g_Config.twUseSignal = file;
|
|
|
|
+ p->m_wndSignalCombo.SelectString(0, fh.getfilename(file).c_str());
|
|
|
|
+ WritePrivateProfileString("TestWizard", "useSignal", file.c_str(), Global::g_szConfig);
|
|
|
|
+ }
|
|
|
|
+ else
|
|
|
|
+ {
|
|
|
|
+ Global::g_Config.use_signal = file;
|
|
|
|
+ WritePrivateProfileString("ir-device", "use-signal", file.c_str(), Global::g_szConfig);
|
|
|
|
+ // 切换通用类型时用到;
|
|
|
|
+ p->m_wndSignalCombo.SelectString(0, Global::g_Config.use_signal.c_str());
|
|
|
|
+ // 加载指定目录的xml信号集文件;
|
|
|
|
+ RedRat::g_loadSignalDataSet(file.c_str());
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if (pRet)
|
|
|
|
+ Py_DECREF(pRet);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ p->m_btnFindBluetooth.EnableWindow();
|
|
|
|
+ }, this);
|
|
|
|
+ t.detach();
|
|
}
|
|
}
|
|
|
|
|
|
void CIRControlWnd::UpdateSignalBtnStatus()
|
|
void CIRControlWnd::UpdateSignalBtnStatus()
|