tResult cJuryModule::Init() { // connect the widgets and methods connect(m_pWidget->m_btnFileSelection, SIGNAL(released()), this, SLOT(OnManeuverListButton())); connect(m_pWidget->m_btnFileSelectionDescr, SIGNAL(released()), this, SLOT(OnDescriptionFileButton())); connect(m_pWidget->m_edtManeuverFile, SIGNAL(returnPressed()), this, SLOT(OnManeuverListSelected())); connect(m_pWidget->m_edtManeuverFile, SIGNAL(editingFinished()), this, SLOT(OnManeuverListSelected())); connect(m_pWidget->m_btnEmergencyStop, SIGNAL(released()), this, SLOT(OnEmergencyStop())); connect(m_pWidget->m_btnStart, SIGNAL(released()), this, SLOT(OnStart())); connect(m_pWidget->m_btnStop, SIGNAL(released()), this, SLOT(OnStop())); connect(m_pWidget->m_btnRequest, SIGNAL(released()), this, SLOT(OnRequestReady())); connect(m_pWidget->m_btnConnectDisconnect, SIGNAL(released()), this, SLOT(OnConnectDisconnect())); connect(m_pWidget->m_btnManeuverlist, SIGNAL(released()), this, SLOT(SendManeuverList())); connect(this, SIGNAL(SetDriverState(int, int)), this, SLOT(OnDriverState(int, int))); connect(this, SIGNAL(SetLogText(QString)), this, SLOT(OnAppendText(QString))); connect(this, SIGNAL(SetConnectionState()), this, SLOT(OnConnectionStateChange())); connect(this, SIGNAL(SetControlState()), this, SLOT(OnControlState())); connect(m_pWidget->m_comboSector, SIGNAL(currentIndexChanged(int)), this, SLOT(OnComboSectionBoxChanged(int))); connect(m_pWidget->m_comboManeuver, SIGNAL(currentIndexChanged(int)), this, SLOT(OnComboActionBoxChanged(int))); connect(m_pWidget->m_cbxLocalHost, SIGNAL(stateChanged(int)), this, SLOT(OnLocalhostCheckChanged(int))); connect(m_pWidget->m_btnOpenTerminal, SIGNAL(released()), this, SLOT(OnOpenTerminalProcess())); connect(&m_oTerminalProcess, SIGNAL(started()), this, SLOT(OnProcessStarted())); connect(&m_oTerminalProcess, SIGNAL(finished(int,QProcess::ExitStatus)), this, SLOT(OnProcessFinished(int,QProcess::ExitStatus))); connect(&m_oTerminalProcess, SIGNAL(error(QProcess::ProcessError)), this, SLOT(OnProcessError(QProcess::ProcessError))); // set the connection and control state SetConnectionState(); SetControlState(); RETURN_NOERROR; }
void CFileDlg::OnSelectDsn() { // TODO: Add your control notification handler code here try { CString strDsn; if (SelectFileDataSource (strDsn, this) && (strDsn != m_strDsn)) { m_strDsn = strDsn; // speichern UpdateData (FALSE); // anzeigen SetControlState (); // Control-State akt. // Parent benachrichtigen DataSourceInfo Info; Info.tType = m_tType; Info.pName = m_strDsn; :: SendMessage (GetParent () -> m_hWnd, WM_COMMAND, IDM_SELECT_DSN, (LPARAM)&Info); } } catch (CMemoryException *m) { m -> ReportError (); m -> Delete (); } }
void CManualTransfer::Show(wxWindow* pParent, CState* pState) { if (!Load(pParent, _T("ID_MANUALTRANSFER"))) return; m_pState = pState; wxChoice *pProtocol = XRCCTRL(*this, "ID_PROTOCOL", wxChoice); pProtocol->Append(CServer::GetProtocolName(FTP)); pProtocol->Append(CServer::GetProtocolName(SFTP)); pProtocol->Append(CServer::GetProtocolName(FTPS)); pProtocol->Append(CServer::GetProtocolName(FTPES)); //pProtocol->Append(CServer::GetProtocolName(INSECURE_FTP)); wxChoice* pChoice = XRCCTRL(*this, "ID_LOGONTYPE", wxChoice); wxASSERT(pChoice); for (int i = 0; i < LOGONTYPE_MAX; ++i) pChoice->Append(CServer::GetNameFromLogonType((enum LogonType)i)); if (m_pState->GetServer()) { m_pServer = new CServer(*m_pState->GetServer()); XRCCTRL(*this, "ID_SERVER_CURRENT", wxRadioButton)->SetValue(true); DisplayServer(); } else { XRCCTRL(*this, "ID_SERVER_CUSTOM", wxRadioButton)->SetValue(true); XRCCTRL(*this, "ID_SERVER_CURRENT", wxRadioButton)->Disable(); DisplayServer(); } wxString localPath = m_pState->GetLocalDir().GetPath(); XRCCTRL(*this, "ID_LOCALFILE", wxTextCtrl)->ChangeValue(localPath); XRCCTRL(*this, "ID_REMOTEPATH", wxTextCtrl)->ChangeValue(m_pState->GetRemotePath().GetPath()); SetControlState(); switch(COptions::Get()->GetOptionVal(OPTION_ASCIIBINARY)) { case 1: XRCCTRL(*this, "ID_TYPE_ASCII", wxRadioButton)->SetValue(true); break; case 2: XRCCTRL(*this, "ID_TYPE_BINARY", wxRadioButton)->SetValue(true); break; default: XRCCTRL(*this, "ID_TYPE_AUTO", wxRadioButton)->SetValue(true); break; } wxSize minSize = GetSizer()->GetMinSize(); SetClientSize(minSize); ShowModal(); }
///////////////////////////////////////////////////////////////////////////// // CFileDlg message handlers BOOL CFileDlg::OnInitDialog() { CDialog::OnInitDialog(); // TODO: Add extra initialization here SetControlState (); return TRUE; // return TRUE unless you set the focus to a control // EXCEPTION: OCX Property Pages should return FALSE }
LRESULT DropTargetControllerDialog::setEffect(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled) { DWORD effect = DROPEFFECT_NONE; LRESULT state = SendDlgItemMessage(IDC_CHECK_COPY, BM_GETCHECK, (WPARAM)0, (LPARAM)0); if (state) effect |= DROPEFFECT_COPY; state = SendDlgItemMessage(IDC_CHECK_MOVE, BM_GETCHECK, (WPARAM)0, (LPARAM)0); if (state) effect |= DROPEFFECT_MOVE; state = SendDlgItemMessage(IDC_CHECK_LINK, BM_GETCHECK, (WPARAM)0, (LPARAM)0); if (state) effect |= DROPEFFECT_LINK; ((IDropTargetController*)pController)->put_Effect(effect); SetControlState(); return 1; }
void CBranchPage::DoDataExchange(CDataExchange* pDX) { CPropertyPage::DoDataExchange(pDX); //{{AFX_DATA_MAP(CBranchPage) DDX_Control(pDX, IDB_CHANGE, m_btChange); DDX_Control(pDX, IDE_NUMMER, m_edNummer); DDX_Control(pDX, IDE_NAME, m_edName); //}}AFX_DATA_MAP ASSERT (g_pErzSet != NULL); DDX_FieldText (pDX, IDE_NUMMER, g_pErzSet -> m_Branchennummer, g_pErzSet); // lese ggf. zugeh. Namen if (!pDX -> m_bSaveAndValidate) // Daten lesen { OutputName (g_pErzSet -> m_Branchennummer); SetControlState (); } }
BOOL CFileDlg::SelectDataSource (const char *pDsn) { try { ASSERT (NULL != pDsn && AfxIsValidString (pDsn)); m_strDsn = pDsn; UpdateData (FALSE); SetControlState (); return TRUE; } catch (CMemoryException *m) { m -> ReportError (); m -> Delete (); } return FALSE; }
void cJuryModule::OnConnectionStateChange() { if(m_pWidget) { // control the button text and background if (m_bConnected) { m_pWidget->m_btnConnectDisconnect->setText("disconnect"); m_pWidget->m_btnConnectDisconnect->setStyleSheet("background:green"); } else { m_pWidget->m_btnConnectDisconnect->setText("connect"); m_pWidget->m_btnConnectDisconnect->setStyleSheet(""); } SetControlState(); } }
BOOL CDsnPage::OnInitDialog() { CPropertyPage::OnInitDialog(); // TODO: Add extra initialization here // ODBC-Data-Sources lesen CWaitCursor wc; CString strCaption; VERIFY (strCaption.LoadString (IDS_USER_DSN_CAPT)); m_dlgUserDsn.m_tType = UserDataSource; VERIFY (0 == m_tbDsn.AddDialog (&m_dlgUserDsn, IDD_USER_DSN_MEDIUM, strCaption)); VERIFY (strCaption.LoadString (IDS_SYSTEM_DSN_CAPT)); m_dlgSystemDsn.m_tType = SystemDataSource; VERIFY (1 == m_tbDsn.AddDialog (&m_dlgSystemDsn, IDD_USER_DSN_MEDIUM, strCaption)); VERIFY (strCaption.LoadString (IDS_FILE_DSN_CAPT)); m_dlgFileDsn.m_tType = FileDataSource; VERIFY (2 == m_tbDsn.AddDialog (&m_dlgFileDsn, IDD_FILE_DSN_MEDIUM, strCaption)); m_tbDsn.SetActiveDialog (0); // TRiAS-Namen austauschen FakeName(GetDlgItem(IDB_DSN_ON_TRIAS)); FakeName(GetDlgItem(IDB_DSN_ON_TABLE)); #ifndef WIN32 if (!ReadParams ()) { GetParent () -> EndDialog (IDCANCEL); return TRUE; } SetControlState (); if (!ModifyButtonsText ()) { GetParent () -> EndDialog (IDCANCEL); return TRUE; } UpdateWindow (); PostMessage (IDM_SETFOCUS, 0, 0L); #endif return TRUE; // return TRUE unless you set the focus to a control // EXCEPTION: OCX Property Pages should return FALSE }
// Sets the state of [control] on all currently active input devices API_INLINE void SetControlState(Enums::PlayerControl control, int32 state) { SetControlState(SettingsGetDevice(control), SettingsGetType(control), SettingsGetIndex(control), state); }
void InitOLED() { InitOLEDLines(); /* get ready for communication */ SetControlState(); /* give OLED a little time to react to power on */ WaitMs(20); /* send reset */ ResetLow(); /* docs don't specify time required for reset, but parallel comms interface indicates that it generally only needs 60ns at level (1 op = 62.5ns at 16 MHz) */ asm("nop"); asm("nop"); ResetHigh(); WaitMs(10); // wait for reset to complete WriteCmd(ocLock); // make sure not locked WriteData(0x12); WriteCmd(ocConfig); WriteData(0x8e); // 1000 1110 -- external Vcc, internal Vcomh, Vpa/b/c /* settings command bit values, descriptions from low to high (see OLED driver doc for details): cc11 d100 -- increment horiz, SEG0=col0, reverse color CBA (RGB), [d = data bus size] COM n-1 to 0 (0 row top), enable COM split, [c = color depth] note that reversing colors is helpful for the 256-color case since that means that blue (not red) gets the 2-bit section (R/G are 3-bit) */ WriteCmd(ocSettings); #if defined(COLOR_262k) // 262k color (9-bit): 1011 1100 WriteData(0xbc); #elif defined(COLOR_65k) // 65k color (8-bit): 0111 0100 WriteData(0x74); #elif defined(COLOR_256) // 256 color (8-bit): 0011 0100 WriteData(0x34); #else #error 'color depth not defined; see OLED.h' #endif WriteCmd(ocPowerSaving); // WriteData(0x15); // external VSL, power saving WriteData(0x12); // internal VSL, power saving // WriteData(0x05); // external VSL, normal // WriteData(0); // internal VSL, normal [default] /* set the start line for the display; the code in this project uses this property to adjust so that the first row displayed is row 0; scrolling should be done using the Offset property */ WriteCmd(ocStartLine); WriteData(128); // otherwise the first row is 4... (131 => -1, so 132 - 4 = 128) #ifdef DEFAULTS /* the documented default values should be fine for these, so we don't need to set them specifically; they're listed here since they are assumed to be set to the defaults */ WriteCmd(ocMUXRatio); WriteData(131); WriteCmd(ocOffset); WriteData(0); WriteCmd(ocDispNormal); #endif /* clear screen */ ClearScreen(); /* make sure display is on */ Sleep(false); }
tResult cJuryModule::LoadManeuverList() { // load the maneuver list // clear old list m_strManeuverList.clear(); // use QDom for parsing QDomDocument oDoc("maneuver_list"); QFile oFile(m_strManeuverFile); // open file if(!oFile.open(QIODevice::ReadOnly)) { RETURN_ERROR(ERR_FILE_NOT_FOUND); } if (!oDoc.setContent(&oFile)) { oFile.close(); RETURN_ERROR(ERR_INVALID_FILE); } // get the root element QDomElement oRoot = oDoc.documentElement(); // get all sectors from DOM QDomNodeList lstSectors = oRoot.elementsByTagName("AADC-Sector"); // iterate over all sectors for (int nIdxSectors = 0; nIdxSectors < lstSectors.size(); ++nIdxSectors) { // get the ids and maneuver from sector QDomNode oNodeSector = lstSectors.item(nIdxSectors); QDomElement oElementSector = oNodeSector.toElement(); QString strIdSector = oElementSector.attribute("id"); tSector sSector; sSector.id = strIdSector.toInt(); QDomNodeList lstManeuver = oElementSector.elementsByTagName("AADC-Maneuver"); // iterate over all maneuver for (int nIdxManeuver = 0; nIdxManeuver < lstManeuver.size(); ++nIdxManeuver) { // get the id and the action QDomNode oNodeManeuver = lstManeuver.item(nIdxManeuver); QDomElement oElementManeuver = oNodeManeuver.toElement(); QString strIdManeuver = oElementManeuver.attribute("id"); tAADC_Maneuver sManeuver; sManeuver.nId = strIdManeuver.toInt(); sManeuver.action = oElementManeuver.attribute("action").toStdString(); // fill the internal maneuver list sSector.lstManeuvers.push_back(sManeuver); } // fill the internal sector list m_lstSections.push_back(sSector); } // check sector list if (m_lstSections.size() > 0) { SetLogText("Jury Module: Loaded Maneuver file successfully."); } else { SetLogText("Jury Module: no valid Maneuver Data found!"); } // fill the combo boxes FillComboBoxes(); // get the xml string for transmission m_strManeuverList = oDoc.toString().toStdString(); // set the controls (enable/disable) SetControlState(); RETURN_NOERROR; }