void CMultiLineTriggerDlg::DoDataExchange(CDataExchange* pDX) { CDialog::DoDataExchange(pDX); //{{AFX_DATA_MAP(CMultiLineTriggerDlg) DDX_Control(pDX, IDC_TRIGGER_TEXT, m_ctlTriggerText); DDX_Text(pDX, IDC_TRIGGER_TEXT, m_strTriggerText); DDX_Check(pDX, IDC_MATCH_CASE, m_bMatchCase); //}}AFX_DATA_MAP if(pDX->m_bSaveAndValidate) { // can't make an empty trigger if (m_strTriggerText.IsEmpty ()) { ::TMessageBox("The trigger match text cannot be empty.", MB_ICONSTOP); DDX_Text(pDX, IDC_TRIGGER_TEXT, m_strTriggerText); pDX->Fail(); } // end of text being blank int iCount = 1; const char * p; for (p = m_strTriggerText; *p; p++) if (*p == '\n') iCount++; if (iCount < 1) { ::TMessageBox("Multi-line triggers must match at least 2 lines.", MB_ICONSTOP); DDX_Text(pDX, IDC_TRIGGER_TEXT, m_strTriggerText); pDX->Fail(); } // end of text being blank if (iCount > MAX_RECENT_LINES) { ::UMessageBox( TFormat ("Multi-line triggers can match a maximum of %i lines.", MAX_RECENT_LINES), MB_ICONSTOP); DDX_Text(pDX, IDC_TRIGGER_TEXT, m_strTriggerText); pDX->Fail(); } // end of text being blank CString strText = ::Replace (m_strTriggerText, ENDLINE, "\\n"); // check they haven't put crap into the regular expression if (!CheckRegularExpression (strText, PCRE_MULTILINE)) { // failed check DDX_Text(pDX, IDC_TRIGGER_TEXT, m_strTriggerText); pDX->Fail(); } } // end of save and validate else FixFont (m_font, m_ctlTriggerText, "Courier New", 9, FW_NORMAL, DEFAULT_CHARSET); }
void CMenuButton::OnDraw(CDC* pDC, const CRect& rect, UINT uiState) { if (m_bMenuIsActive && !m_bRealMenuIsActive && !m_bAlwaysShowArrow) CMFCButton::OnDraw(pDC, rect, uiState); else CMFCMenuButton::OnDraw(pDC, rect, uiState); if (m_Font.m_hObject == nullptr) FixFont(); }
void CEditMultiLine::DoDataExchange(CDataExchange* pDX) { CDialog::DoDataExchange(pDX); //{{AFX_DATA_MAP(CEditMultiLine) DDX_Control(pDX, IDC_GOTO_LINE, m_ctlGoToLineButton); DDX_Control(pDX, IDC_COMPLETE_WORD, m_ctlCompleteFunctionButton); DDX_Control(pDX, IDC_FUNCTION_LIST, m_ctlFunctionListButton); DDX_Control(pDX, IDOK, m_ctlOK); DDX_Control(pDX, IDCANCEL, m_ctlCancel); DDX_Control(pDX, IDC_TEXT, m_ctlText); DDX_Text(pDX, IDC_TEXT, m_strText); //}}AFX_DATA_MAP if(!pDX->m_bSaveAndValidate && App.m_bFixedFontForEditing) FixFont (m_font, m_ctlText, App.m_strFixedPitchFont, App.m_iFixedPitchFontSize, FW_NORMAL, DEFAULT_CHARSET); if(!pDX->m_bSaveAndValidate) m_ctlText.SetTabStops(10); }
BOOL CALLBACK DialogProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) { switch (message) { case WM_INITDIALOG: FixFont(hwnd); break; case WM_CLOSE: EndDialog(hwnd, 0); PostQuitMessage(0); return FALSE; case WM_COMMAND: switch (LOWORD(wParam)) { case IDC_BUTTONROLL: { NumberzLogic(hwnd); } } default: return FALSE; } }
void CAliasDlg::DoDataExchange(CDataExchange* pDX) { CDialog::DoDataExchange(pDX); if(!pDX->m_bSaveAndValidate) { if (m_current_alias && m_current_alias->bIncluded) m_strIncluded = "(included)"; else m_strIncluded.Empty (); } //{{AFX_DATA_MAP(CAliasDlg) DDX_Control(pDX, IDC_SEND_TO, m_ctlSendTo); DDX_Control(pDX, IDC_VARIABLE, m_ctlVariable); DDX_Control(pDX, IDC_REGEXP, m_ctlRegexp); DDX_Control(pDX, IDC_ALIAS_CONTENTS, m_ctlAliasContents); DDX_Control(pDX, IDC_ALIAS_NAME, m_ctlAliasName); DDX_Text(pDX, IDC_ALIAS_CONTENTS, m_contents); DDX_Text(pDX, IDC_ALIAS_NAME, m_name); DDX_Text(pDX, IDC_ALIAS_LABEL, m_strLabel); DDX_Check(pDX, IDC_ENABLED, m_bEnabled); DDX_Text(pDX, IDC_SCRIPT_NAME, m_strProcedure); DDX_Check(pDX, IDC_IGNORE_CASE, m_bIgnoreCase); DDX_Check(pDX, IDC_EXPAND_VARIABLES, m_bExpandVariables); DDX_Check(pDX, IDC_OMIT_FROM_LOG, m_bOmitFromLogFile); DDX_Check(pDX, IDC_REGEXP, m_bRegexp); DDX_Check(pDX, IDC_OMIT_FROM_OUTPUT, m_bOmitFromOutput); DDX_Check(pDX, IDC_ALIAS_MENU, m_bMenu); DDX_Check(pDX, IDC_TEMPORARY_ALIAS, m_bTemporary); DDX_Text(pDX, IDC_GROUP, m_strGroup); DDX_Text(pDX, IDC_VARIABLE, m_strVariable); DDX_CBIndex(pDX, IDC_SEND_TO, m_iSendTo); DDX_Check(pDX, IDC_KEEP_EVALUATING, m_bKeepEvaluating); DDX_Text(pDX, IDC_SEQUENCE, m_iSequence); DDV_MinMaxInt(pDX, m_iSequence, 0, 10000); DDX_Check(pDX, IDC_ECHO_ALIAS, m_bEchoAlias); DDX_Check(pDX, IDC_OMIT_FROM_COMMAND_HISTORY, m_bOmitFromCommandHistory); DDX_Text(pDX, IDC_INCLUDED, m_strIncluded); DDX_Text(pDX, IDC_REGEXP_ERROR, m_strRegexpError); DDX_Check(pDX, IDC_ONE_SHOT, m_bOneShot); //}}AFX_DATA_MAP if(pDX->m_bSaveAndValidate) { POSITION pos; CAlias * alias_item; m_strLabel.TrimLeft (); m_strLabel.TrimRight (); m_strProcedure.TrimLeft (); m_strProcedure.TrimRight (); m_strGroup.TrimLeft (); m_strGroup.TrimRight (); m_strVariable.TrimLeft (); m_strVariable.TrimRight (); if (m_name.IsEmpty ()) { ::TMessageBox("The alias cannot be blank."); DDX_Text(pDX, IDC_ALIAS_NAME, m_name); pDX->Fail(); } // end of alias being blank // check for foolishly using ** in a non-regular expression if (m_name.Find ("**") != -1 && !m_bRegexp) { CCreditsDlg dlg; dlg.m_iResourceID = IDR_MULTIPLE_ASTERISKS; dlg.m_strTitle = "Warning"; dlg.DoModal (); DDX_Text(pDX, IDC_ALIAS_NAME, m_name); pDX->Fail(); } int iInvalidPos = m_name.FindOneOf ("\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0A\x0B\x0C\x0D\x0E\x0F"); if (iInvalidPos != -1) { char c = m_name [iInvalidPos]; ::UMessageBox(TFormat ( "The alias 'match' text contains an invalid non-printable character (hex %02X) at position %i.", c, iInvalidPos + 1), MB_ICONSTOP); DDX_Text(pDX, IDC_ALIAS_NAME, m_name); pDX->Fail(); } // end of alias match having weird characters in it // we allow carriage-return, linefeed, tab here iInvalidPos = m_contents.FindOneOf ("\x01\x02\x03\x04\x05\x06\x07\x08\x0B\x0C\x0E\x0F"); if (iInvalidPos != -1) { char c = m_contents [iInvalidPos]; ::UMessageBox(TFormat ( "The alias 'send' text contains an invalid non-printable character (hex %02X) at position %i.", c, iInvalidPos + 1), MB_ICONSTOP); DDX_Text(pDX, IDC_ALIAS_CONTENTS, m_contents); pDX->Fail(); } // end of alias send having weird characters in it // compile regular expression to check it if (m_bRegexp) { if (!CheckRegularExpression (m_name, (m_bIgnoreCase ? 0 : PCRE_CASELESS) | (m_pDoc->m_bUTF_8 ? PCRE_UTF8 : 0) #if ALIASES_USE_UTF8 | (m_pDoc->m_bUTF_8 ? PCRE_UTF8 : 0) #endif // ALIASES_USE_UTF8 )) { // failed check DDX_Text(pDX, IDC_ALIAS_NAME, m_name); pDX->Fail(); } } // end of checking regular expression CString strAliasName; for (pos = m_pAliasMap->GetStartPosition (); pos; ) { m_pAliasMap->GetNextAssoc (pos, strAliasName, alias_item); // don't compare against itself if (alias_item == m_current_alias) continue; /* bool bDuplicate = false; // if either one is case-insensitive, compare insensitive if ((alias_item->bIgnoreCase || m_bIgnoreCase) && alias_item->name.CompareNoCase (m_name) == 0) bDuplicate = true; // if both are case-sensitive, compare exactly else if (alias_item->name == m_name) bDuplicate = true; // we won't consider it a match if they send to different places if (alias_item->iSendTo != m_iSendTo) bDuplicate = false; if (bDuplicate) { ::TMessageBox("This alias is already in the list of aliases."); DDX_Text(pDX, IDC_ALIAS_NAME, m_name); pDX->Fail(); } */ // now check the label for duplicates if (!m_strLabel.IsEmpty ()) // we can have duplicate blank names if (m_strLabel.CompareNoCase (alias_item->strLabel) == 0) { CString strMsg; strMsg = TFormat ("The alias label \"%s\" is already in the list of aliases.", (LPCTSTR) m_strLabel); ::UMessageBox(strMsg); DDX_Text(pDX, IDC_ALIAS_LABEL, m_strLabel); pDX->Fail(); } } // end of checking each alias if (!m_strLabel.IsEmpty ()) // we can have blank labels { // check label is valid if (CheckLabel (m_strLabel)) { ::TMessageBox("The label must start with a letter and consist of letters" ", numbers or the underscore character."); DDX_Text(pDX, IDC_ALIAS_LABEL, m_strLabel); pDX->Fail(); } } // end of having non-blank label if (m_strVariable.IsEmpty ()) // we can have blank variables { if (m_iSendTo == eSendToVariable) { ::TMessageBox("When sending to a variable you must specify a variable name. ", MB_ICONSTOP); DDX_Text(pDX, IDC_VARIABLE, m_strVariable); pDX->Fail(); } } else { // check variable name is valid if (CheckLabel (m_strVariable)) { ::TMessageBox("The variable name must start with a letter and consist of letters" ", numbers or the underscore character."); DDX_Text(pDX, IDC_VARIABLE, m_strVariable); pDX->Fail(); } } // end of having non-blank variable // check for speed walking OK, unless they are substituting if (!m_bExpandVariables || m_contents.Find ('@') == -1) if (m_iSendTo == eSendToSpeedwalk && m_contents.Find ('%') == -1) { CString strResult = m_pDoc->DoEvaluateSpeedwalk (m_contents); if (!strResult.IsEmpty ()) { if (strResult [0] == '*') // error in speedwalk string? { ::UMessageBox (strResult.Mid (1)); DDX_Text(pDX, IDC_ALIAS_CONTENTS, m_contents); pDX->Fail(); } // end of error message } // end of non-empty speedwalk } // end of speed walking wanted if(m_contents.IsEmpty () && m_strProcedure.IsEmpty ()) { ::TMessageBox("The alias contents cannot be blank unless you specify a script subroutine."); DDX_Text(pDX, IDC_ALIAS_CONTENTS, m_contents); pDX->Fail(); } // end of contents being blank if (!m_strProcedure.IsEmpty ()) // blank procedure is OK { // check procedure is valid if (CheckLabel (m_strProcedure, true)) { ::TMessageBox("The script subroutine name must start with a letter and consist of letters" ", numbers or the underscore character."); DDX_Text(pDX, IDC_SCRIPT_NAME, m_strProcedure); pDX->Fail(); } } // end of having non-blank procedure } // end of saving and validating else if (App.m_bFixedFontForEditing) { FixFont (m_font, m_ctlAliasName, App.m_strFixedPitchFont, App.m_iFixedPitchFontSize, FW_NORMAL, DEFAULT_CHARSET); FixFont (m_font2, m_ctlAliasContents, App.m_strFixedPitchFont, App.m_iFixedPitchFontSize, FW_NORMAL, DEFAULT_CHARSET); } }
void CTimerDlg::DoDataExchange(CDataExchange* pDX) { CDialog::DoDataExchange(pDX); if(!pDX->m_bSaveAndValidate) { if (m_current_timer && m_current_timer->bIncluded) m_strIncluded = "(included)"; else m_strIncluded.Empty (); } //{{AFX_DATA_MAP(CTimerDlg) DDX_Control(pDX, IDC_SEND_TO, m_ctlSendTo); DDX_Control(pDX, IDC_SCRIPT_NAME, m_ctlProcedure); DDX_Control(pDX, IDC_TIMER_CONTENTS, m_ctlContents); DDX_Control(pDX, IDC_BUTTON_AT, m_ctlButtonAt); DDX_Check(pDX, IDC_ENABLED, m_bEnabled); DDX_Text(pDX, IDC_TIMER_LABEL, m_strLabel); DDX_Text(pDX, IDC_AT_HOUR, m_iAtHour); DDV_MinMaxInt(pDX, m_iAtHour, 0, 23); DDX_Text(pDX, IDC_AT_MINUTE, m_iAtMinute); DDV_MinMaxInt(pDX, m_iAtMinute, 0, 59); DDX_Text(pDX, IDC_INTERVAL_HOUR, m_iEveryHour); DDV_MinMaxInt(pDX, m_iEveryHour, 0, 23); DDX_Text(pDX, IDC_INTERVAL_MINUTE, m_iEveryMinute); DDV_MinMaxInt(pDX, m_iEveryMinute, 0, 59); DDX_Text(pDX, IDC_OFFSET_HOUR, m_iOffsetHour); DDV_MinMaxInt(pDX, m_iOffsetHour, 0, 23); DDX_Text(pDX, IDC_OFFSET_MINUTE, m_iOffsetMinute); DDV_MinMaxInt(pDX, m_iOffsetMinute, 0, 59); DDX_MinMaxString(pDX, IDC_TIMER_CONTENTS, m_strContents); DDV_MinMaxString(pDX, m_strContents, 0, 32000); DDX_Radio(pDX, IDC_BUTTON_EVERY, m_iType); DDX_Text(pDX, IDC_SCRIPT_NAME, m_strProcedure); DDX_Check(pDX, IDC_ONE_SHOT_TIMER, m_bOneShot); DDX_Check(pDX, IDC_TEMPORARY, m_bTemporary); DDX_Check(pDX, IDC_ACTIVE_WHEN_CLOSED, m_bActiveWhenClosed); DDX_Text(pDX, IDC_GROUP, m_strGroup); DDX_CBIndex(pDX, IDC_SEND_TO, m_iSendTo); DDX_Text(pDX, IDC_VARIABLE, m_strVariable); DDX_Text(pDX, IDC_INCLUDED, m_strIncluded); DDX_Check(pDX, IDC_OMIT_FROM_OUTPUT, m_bOmitFromOutput); DDX_Check(pDX, IDC_OMIT_FROM_LOG, m_bOmitFromLog); DDX_Text(pDX, IDC_AT_SECOND, m_fAtSecond); DDV_MinMaxDouble(pDX, m_fAtSecond, 0., 59.99999); DDX_Text(pDX, IDC_INTERVAL_SECOND, m_fEverySecond); DDV_MinMaxDouble(pDX, m_fEverySecond, 0., 59.99999); DDX_Text(pDX, IDC_OFFSET_SECOND, m_fOffsetSecond); DDV_MinMaxDouble(pDX, m_fOffsetSecond, 0., 59.99999); //}}AFX_DATA_MAP if(pDX->m_bSaveAndValidate) { m_strLabel.TrimLeft (); m_strLabel.TrimRight (); m_strProcedure.TrimLeft (); m_strProcedure.TrimRight (); m_strGroup.TrimLeft (); m_strGroup.TrimRight (); if (m_iType == CTimer::eInterval) { CmcDateTimeSpan ts1 (0, m_iEveryHour, m_iEveryMinute, m_fEverySecond); CmcDateTimeSpan ts2 (0, m_iOffsetHour, m_iOffsetMinute, m_fOffsetSecond); if (ts1 <= CmcDateTimeSpan (0, 0, 0, 0)) { ::TMessageBox("The timer interval must be greater than zero."); DDX_Text(pDX, IDC_INTERVAL_HOUR, m_iEveryHour); pDX->Fail(); } // end of interval <= 0 if(ts2 >= ts1) { ::TMessageBox("The timer offset must be less than the timer period."); DDX_Text(pDX, IDC_OFFSET_HOUR, m_iOffsetHour); pDX->Fail(); } // end of offset >= period } // end of doing a periodical timer CString strTimerName; CTimer * timer_item; POSITION pos; for (pos = m_pTimerMap->GetStartPosition (); pos; ) { m_pTimerMap->GetNextAssoc (pos, strTimerName, timer_item); // don't compare against itself if (timer_item == m_current_timer) continue; // now check the label for duplicates if (!m_strLabel.IsEmpty ()) // we can have duplicate blank names if (m_strLabel.CompareNoCase (timer_item->strLabel) == 0) { CString strMsg; strMsg = TFormat ("The timer label \"%s\" is already in the list of timers.", (LPCTSTR) m_strLabel); ::UMessageBox(strMsg); DDX_Text(pDX, IDC_TIMER_LABEL, m_strLabel); pDX->Fail(); } } // end of checking each Timer if (!m_strLabel.IsEmpty ()) // we can have blank labels { // check label is valid if (CheckLabel (m_strLabel)) { ::TMessageBox ("The label must start with a letter and consist of letters" ", numbers or the underscore character."); DDX_Text(pDX, IDC_TIMER_LABEL, m_strLabel); pDX->Fail(); } } // end of having non-blank label if (m_strVariable.IsEmpty ()) // we can have blank variables { if (m_iSendTo == eSendToVariable) { ::TMessageBox("When sending to a variable you must specify a variable name. ", MB_ICONSTOP); DDX_Text(pDX, IDC_VARIABLE, m_strVariable); pDX->Fail(); } } else { // check variable name is valid if (CheckLabel (m_strVariable)) { ::TMessageBox("The variable name must start with a letter and consist of letters" ", numbers or the underscore character."); DDX_Text(pDX, IDC_VARIABLE, m_strVariable); pDX->Fail(); } } // end of having non-blank variable // check for speed walking OK, unless they are substituting if (m_iSendTo == eSendToSpeedwalk) { CString strResult = m_pDoc->DoEvaluateSpeedwalk (m_strContents); if (!strResult.IsEmpty ()) { if (strResult [0] == '*') // error in speedwalk string? { ::UMessageBox (strResult.Mid (1)); // already translated, I think DDX_Text(pDX, IDC_TIMER_CONTENTS, m_strContents); pDX->Fail(); } // end of error message } // end of non-empty speedwalk } // end of speed walking wanted if(m_strContents.IsEmpty () && m_strProcedure.IsEmpty ()) { ::TMessageBox("The timer contents cannot be blank unless you specify a script subroutine."); DDX_Text(pDX, IDC_TIMER_CONTENTS, m_strContents); pDX->Fail(); } // end of contents being blank if (!m_strProcedure.IsEmpty ()) // blank procedure is OK { // check procedure is valid if (CheckLabel (m_strProcedure, true)) { ::TMessageBox("The script subroutine name must start with a letter and consist of letters" ", numbers or the underscore character."); DDX_Text(pDX, IDC_SCRIPT_NAME, m_strProcedure); pDX->Fail(); } } // end of having non-blank procedure } // end of saving and validating else { if (App.m_bFixedFontForEditing) { FixFont(m_font, m_ctlContents, App.m_strFixedPitchFont, App.m_iFixedPitchFontSize, FW_NORMAL, DEFAULT_CHARSET); } } }