BOOL CLangModelsDoc::OnNewDocument() { if(!theApp.getProject()) return FALSE; if (!CTabbedTreeDoc::OnNewDocument()) return FALSE; ASSERTX(m_pCurrentInterface); /* if(gsNewLangAbrev.GetLength()) // invoked by the projectdoc import code { m_pLang = new CCarlaLanguage(gsNewLangAbrev); ASSERTX(gsDirContainingCarlaSet.GetLength()); m_pLang->m_sDirContainingCarlaSet = gsDirContainingCarlaSet; } else // invoked by the user and the File menu { */ m_pLang = new CCarlaLanguage(this); // create a new language or import one from files? CDlgNewLanguage dlg; if(IDCANCEL == dlg.DoModal()) { MessageBox( NULL, "Language creation cancelled.", "Note:", MB_OK); return FALSE; } if(dlg.m_iCreationMethod ==0) { // to do: put up new language wizard CWizNewFromScratch wiz(m_pLang->getMFS()->getRootDicList()); if(IDCANCEL == wiz.DoModal()) { MessageBox( NULL, "Language creation cancelled.", "Note:", MB_OK); return FALSE; } wiz.m_dictRootUnifiedPage.OnOK(); // dump the list into the mfs m_pLang->getMFS()->setUnifiedDictMode(wiz.m_dictRootUnifiedPage.m_bUnifiedMode); m_pLang->getMFS()->exchangeAffixDictPaths( wiz.m_dictAffixesPage.m_sPrefixPath, wiz.m_dictAffixesPage.m_sInfixPath, wiz.m_dictAffixesPage.m_sSuffixPath, TRUE); // read the page m_pLang->populateWithDefaults(); m_pLang->readLangDisplayPage(wiz.m_langDisplayPage); // m_pLang->setAbrev(wiz.m_langDisplayPage.m_sAbrev); // m_pLang->setName(wiz.m_langDisplayPage.m_sName); // m_pLang->setFont(&wiz.m_langDisplayPage.m_logFont); // cast is because it is normally const (shame, shame) // ((CTextDisplayInfo*)m_pLang->getDisplayInfo())->m_bShowMorphnamesInLangFont = wiz.m_langDisplayPage.m_bShowMorphnamesInLangFont; m_pLang->getAnalysisModel().processTestPropertyPages(&wiz.m_affixesPage, &wiz.m_categoryPropogationPage, &wiz.m_finalCatTestPage); m_pLang->getCommonModel().readWizPages(&wiz.m_finalCatTestPage); m_pLang->addDefaultListOfProcessors(); } else // import from files { CWizNewFromFiles* pWiz = new CWizNewFromFiles(m_pLang->getMFS()->getRootDicList()); if(IDCANCEL == pWiz->DoModal()) { MessageBox( NULL, "Language creation cancelled.", "Note:", MB_OK); return FALSE; } pWiz->m_dictRootUnifiedPage.OnOK(); // dump the list into the mfs m_pLang->getMFS()->setUnifiedDictMode(pWiz->m_dictRootUnifiedPage.m_bUnifiedMode); m_pLang->getMFS()->exchangeAffixDictPaths(pWiz->m_dictAffixesPage.m_sPrefixPath, pWiz->m_dictAffixesPage.m_sInfixPath, pWiz->m_dictAffixesPage.m_sSuffixPath, TRUE); // read the page //m_pLang->OnEditProperties(FALSE); m_pLang->readLangDisplayPage(pWiz->m_langDisplayPage); m_pLang->m_pFilesWiz = pWiz; // now when it saves, it will read the dlg, // do the conversion, and delete this dialog. } m_pFunctionalInterface->setupForLang(m_pLang); m_pCarlaMenuInterface->setupForLang(m_pLang); SetModifiedFlag(TRUE); // tell the project that this lang is available getProject()->registerLangDoc(this); // OnSaveDocument(getProject()->getProjectDir()); return TRUE; }
void CIpmCtrl::OnRefreshFrequencyChanged() { theApp.SetRefreshFrequency(m_refreshFrequency); NotifySettingChange(IPMMASK_BKREFRESH); SetModifiedFlag(); }
void CIpmCtrl::OnUnitChanged() { NotifySettingChange(IPMMASK_BKREFRESH); SetModifiedFlag(); }
/// <summary>Inserts current selection with text.</summary> /// <param name="txt">The text.</param> void ScriptDocument::Replace(const wstring& txt) { SetModifiedFlag(TRUE); GetView()->Replace(txt); }
// initialize (clear out) the mission, so it's empty and ready to use. void CFREDDoc::editor_init_mission() { reset_mission(); SetModifiedFlag(FALSE); }
void CRScrlBarCtrl::SetScrollPos(long nNewValue) { m_iScrollPos=nNewValue; InvalidateControl(); SetModifiedFlag(); }
void CRScrlBarCtrl::SetFileNumOffset(long nNewValue) { m_FileNumOffset=nNewValue; SetModifiedFlag(); }
long CMUSHclientDoc::SetAlphaOptionItem (const int iItem, LPCTSTR sValue, const bool bDoSpecial, const bool bInclude) { CString strValue = sValue; if (AlphaOptionsTable [iItem].iFlags & OPT_COMMAND_STACK) { if (strValue.GetLength () > 1) return eOptionOutOfRange; if (strValue.IsEmpty ()) { m_enable_command_stack = false; return eOptionOutOfRange; } if (!isprint (strValue [0]) || isspace (strValue [0])) { m_enable_command_stack = false; return eOptionOutOfRange; } } // end of command stack character if (AlphaOptionsTable [iItem].iFlags & OPT_WORLD_ID) { if (!strValue.IsEmpty ()) if (strValue.GetLength () != PLUGIN_UNIQUE_ID_LENGTH) return eOptionOutOfRange; // make sure hex characters const char * p = strValue; for ( ; *p ; p++) if (!isxdigit (*p)) return eOptionOutOfRange; strValue.MakeLower (); } // end of world id bool bChanged; long iResult = SetBaseAlphaOptionItem (iItem, AlphaOptionsTable, NUMITEMS (AlphaOptionsTable), (char *) this, strValue, bChanged); if (iResult != eOK) return iResult; if (bChanged) SetModifiedFlag (); if (bInclude) { m_AlphaConfiguration [iItem]->bInclude = true; m_AlphaConfiguration [iItem]->sValue = strValue; } // specials wanted? if (!bDoSpecial) return eOK; // any special tests here ... if (AlphaOptionsTable [iItem].iFlags & OPT_UPDATE_INPUT_FONT) ChangeInputFont (m_input_font_height, m_input_font_name, m_input_font_weight, m_input_font_charset, m_input_font_italic); if (AlphaOptionsTable [iItem].iFlags & OPT_UPDATE_OUTPUT_FONT) ChangeFont (m_font_height, m_font_name, m_font_weight, m_font_charset, m_bShowBold, m_bShowItalic, m_bShowUnderline, m_iLineSpacing); if (AlphaOptionsTable [iItem].iFlags & OPT_UPDATE_VIEWS) UpdateAllViews (NULL); return eOK; } // end of CMUSHclientDoc:SetAlphaOptionItem
// COpenHoldemDoc serialization void COpenHoldemDoc::Serialize(CArchive& ar) { // Extra caution, in case we want to load a formula, // while the autoplayer is engaged. // This currently can only happen via the MRU-list. // The alternative way would be to disable that list... // // MainFrame.cpp: // ON_UPDATE_COMMAND_UI_RANGE(ID_FILE_MRU_FILE1, ID_FILE_MRU_FILE16, &CMainFrame::OnUpdateLRUList) // // void CMainFrame::OnUpdateLRUList(CCmdUI *pCmdUI) // { // pCmdUI->Enable(!p_autoplayer->autoplayer_engaged()); // } // // Unfortunatelly this does not work, // but removes the list and replaces it once with the default: "Recent file". // // And there's very little information about both // ON_UPDATE_COMMAND_UI_RANGE and temporary disabling of MRU-lists. // // So we decided to go that route. // if (p_autoplayer->autoplayer_engaged()) { // This error can happen only in interactive mode, // so there's no need to turn that Messagebox off // depending on prefs.disable_msgbox() OH_MessageBox("Can't load a formula while autoplayer engaged.", "ERROR", 0); return; } CMainFrame *pMyMainWnd = (CMainFrame *) (theApp.m_pMainWnd); // Writing a file if (ar.IsStoring()) { // Store archive in the new OpenHoldem format bool use_new_OHF_format = !IsWinHoldemFormat(ar.GetFile()->GetFileName()); p_formula->WriteFormula(ar); // Do not close this archive here. // It's expected to stay open at this point! if (IsWinHoldemFormat(ar.GetFile()->GetFileName())) { // If the file was in the old WHF format, // store it also in the new OHF format. CString the_new_FileName = GetPathName(); the_new_FileName.Replace("whf", "ohf"); // Notification OH_MessageBox_Interactive("Converting file formats\n{whf, whx} -> {ohf}", "File Conversion", MB_OK | MB_ICONINFORMATION); // Open new style formula (OHF) CFile OHF_File; OHF_File.Open(the_new_FileName, CFile::modeCreate | CFile::modeWrite); CArchive OHF_Archive(&OHF_File, CArchive::store); // Write new style formula (OHF) in any case p_formula->WriteFormula(OHF_Archive); // Close archive and file OHF_Archive.Close(); OHF_File.Close(); } } // Reading a file else { // Kill the formula dialog, if it is open if(m_formulaScintillaDlg) { delete m_formulaScintillaDlg; m_formulaScintillaDlg = NULL; pMyMainWnd->m_MainToolBar.GetToolBarCtrl().CheckButton(ID_MAIN_TOOLBAR_FORMULA, false); } // Read ohf / whf file ReadFormula(ar); SetModifiedFlag(false); p_formula->set_formula_name(ar.GetFile()->GetFileName()); // Try to unload dll p_dll_extension->UnloadDll(); // Create hand list matrices p_formula->CreateHandListMatrices(); // Create parse trees for newly loaded formula p_formula->ParseAllFormula(pMyMainWnd->GetSafeHwnd(), prefs.disable_msgbox()); // Load dll, if set in preferences if (prefs.dll_load_on_startup()) p_dll_extension->LoadDll(""); if (prefs.simple_window_title() && theApp.m_pMainWnd) theApp.m_pMainWnd->PostMessage(WMA_SETWINDOWTEXT, 0, (LPARAM)NULL); } }
long CMUSHclientDoc::SetTriggerOption(LPCTSTR TriggerName, LPCTSTR OptionName, LPCTSTR Value) { CString strTriggerName = TriggerName; CString strValue = Value; CTrigger * trigger_item; // trim spaces from name, make lower-case CheckObjectName (strTriggerName, false); if (!GetTriggerMap ().Lookup (strTriggerName, trigger_item)) return eTriggerNotFound; CString strOptionName = OptionName; strOptionName.MakeLower(); strOptionName.TrimLeft (); strOptionName.TrimRight (); int iItem; int iResult = FindBaseOption (strOptionName, TriggerOptionsTable, iItem); bool bChanged; if (iResult == eOK) { // this is a numeric option // for boolean options, accept "y" or "n" if (TriggerOptionsTable [iItem].iMinimum == 0 && TriggerOptionsTable [iItem].iMaximum == 0) { if (strValue == "Y" || strValue == "y") Value = "1"; else if (strValue == "N" || strValue == "n") Value = "0"; } if (!IsNumber (Value, true)) return eOptionOutOfRange; long iValue = atol (Value); if (m_CurrentPlugin && (TriggerOptionsTable [iItem].iFlags & OPT_PLUGIN_CANNOT_WRITE)) return ePluginCannotSetOption; // not available to plugin if (TriggerOptionsTable [iItem].iFlags & OPT_CANNOT_WRITE) return ePluginCannotSetOption; // not available for writing at all iResult = SetBaseOptionItem (iItem, TriggerOptionsTable, NUMITEMS (TriggerOptionsTable), (char *) trigger_item, iValue, bChanged); if (bChanged) { if (!m_CurrentPlugin) // plugin mods don't really count SetModifiedFlag (TRUE); // document has changed trigger_item->nUpdateNumber = App.GetUniqueNumber (); // for concurrency checks } if (strOptionName == "sequence") SortTriggers (); return iResult; } // end of found else { // not numeric option, try alpha int iResult = FindBaseAlphaOption (strOptionName, TriggerAlphaOptionsTable, iItem); if (iResult == eOK) { // alpha option if (m_CurrentPlugin && (TriggerAlphaOptionsTable [iItem].iFlags & OPT_PLUGIN_CANNOT_WRITE)) return ePluginCannotSetOption; // not available to plugin if (TriggerAlphaOptionsTable [iItem].iFlags & OPT_CANNOT_WRITE) return ePluginCannotSetOption; // not available for writing at all // ------ preliminary validation before setting the option // cannot have null match text if (strOptionName == "match" || strOptionName == "ignore_case" || strOptionName == "multi_line") { if (strValue.IsEmpty ()) return eTriggerCannotBeEmpty; t_regexp * regexp = NULL; CString strRegexp; if (trigger_item->bRegexp) strRegexp = strValue; else strRegexp = ConvertToRegularExpression (strValue); // compile regular expression try { regexp = regcomp (strRegexp, (trigger_item->ignore_case ? PCRE_CASELESS : 0) | (trigger_item->bMultiLine ? PCRE_MULTILINE : 0) | (m_bUTF_8 ? PCRE_UTF8 : 0) ); } // end of try catch(CException* e) { e->Delete (); return eBadRegularExpression; } // end of catch delete trigger_item->regexp; // get rid of old one trigger_item->regexp = regexp; } // end of option "match" else if (strOptionName == "script") { // get trigger dispatch ID if (GetScriptEngine () && !strValue.IsEmpty ()) { DISPID dispid = DISPID_UNKNOWN; CString strMessage; dispid = GetProcedureDispid (strValue, "trigger", TriggerName, strMessage); if (dispid == DISPID_UNKNOWN) return eScriptNameNotLocated; trigger_item->dispid = dispid; // update dispatch ID } } // end of option "script" // set the option now iResult = SetBaseAlphaOptionItem (iItem, TriggerAlphaOptionsTable, NUMITEMS (TriggerAlphaOptionsTable), (char *) trigger_item, strValue, bChanged); if (bChanged) { if (!m_CurrentPlugin) // plugin mods don't really count SetModifiedFlag (TRUE); // document has changed trigger_item->nUpdateNumber = App.GetUniqueNumber (); // for concurrency checks } return iResult; } // end of found alpha option } // end of not numeric option return eUnknownOption; } // end of SetTriggerOption
long CMUSHclientDoc::SetOptionItem (const int iItem, long Value, const bool bDoSpecial, const bool bInclude) { bool bChanged; long iResult = SetBaseOptionItem (iItem, OptionsTable, NUMITEMS (OptionsTable), (char *) this, Value, bChanged); if (iResult != eOK) return iResult; if (bChanged) SetModifiedFlag (); if (bInclude) { m_NumericConfiguration [iItem]->bInclude = true; m_NumericConfiguration [iItem]->iValue = Value; } // specials wanted? if (!bDoSpecial) return eOK; // some special handling if (OptionsTable [iItem].iFlags & OPT_FIX_OUTPUT_BUFFER) if (m_pCurrentLine) // a new world might not have a line yet FixUpOutputBuffer (Value); if (OptionsTable [iItem].iFlags & OPT_FIX_INPUT_WRAP) FixInputWrap(); if (OptionsTable [iItem].iFlags & OPT_FIX_WRAP_COLUMN) { if (m_pCurrentLine) // a new world might not have a line yet { // save current line text CString strLine = CString (m_pCurrentLine->text, m_pCurrentLine->len); #ifdef USE_REALLOC m_pCurrentLine->text = (char *) realloc (m_pCurrentLine->text, MAX (m_pCurrentLine->len, Value) * sizeof (char)); #else delete [] m_pCurrentLine->text; m_pCurrentLine->text = new char [MAX (m_pCurrentLine->len, Value)]; #endif // put text back memcpy (m_pCurrentLine->text, (LPCTSTR) strLine, m_pCurrentLine->len); ASSERT (m_pCurrentLine->text); } // end of having a current line SendWindowSizes (Value); } if (OptionsTable [iItem].iFlags & OPT_FIX_SPEEDWALK_DELAY) SetSpeedWalkDelay ((short) Value); POSITION pos; if (OptionsTable [iItem].iFlags & OPT_FIX_TOOLTIP_VISIBLE) { for(pos = GetFirstViewPosition(); pos != NULL;) { CView* pView = GetNextView(pos); if (pView->IsKindOf(RUNTIME_CLASS(CMUSHView))) { CMUSHView* pmyView = (CMUSHView*)pView; if (pmyView->m_ToolTip.m_hWnd) pmyView->m_ToolTip.SendMessage(TTM_SETDELAYTIME, TTDT_AUTOPOP, Value - 1); // zero will be default (-1) } // end if } // end for } // end of OPT_FIX_TOOLTIP_VISIBLE if (OptionsTable [iItem].iFlags & OPT_FIX_TOOLTIP_START) { for(pos = GetFirstViewPosition (); pos != NULL;) { CView* pView = GetNextView(pos); if (pView->IsKindOf(RUNTIME_CLASS(CMUSHView))) { CMUSHView* pmyView = (CMUSHView*)pView; if (pmyView->m_ToolTip.m_hWnd) pmyView->m_ToolTip.SendMessage(TTM_SETDELAYTIME, TTDT_INITIAL, Value - 1); // zero will be default (-1) } // end if } // end for } // end of OPT_FIX_TOOLTIP_START if (OptionsTable [iItem].iFlags & OPT_USE_MXP) { if (m_iUseMXP == eNoMXP && m_bMXP) MXP_Off (true); else if (m_iUseMXP == eUseMXP && !m_bMXP) MXP_On (false, true); // not pueblo, manually on } if (OptionsTable [iItem].iFlags & OPT_UPDATE_INPUT_FONT) ChangeInputFont (m_input_font_height, m_input_font_name, m_input_font_weight, m_input_font_charset, m_input_font_italic); if (OptionsTable [iItem].iFlags & OPT_UPDATE_OUTPUT_FONT) ChangeFont (m_font_height, m_font_name, m_font_weight, m_font_charset, m_bShowBold, m_bShowItalic, m_bShowUnderline, m_iLineSpacing); if (OptionsTable [iItem].iFlags & OPT_UPDATE_VIEWS) UpdateAllViews (NULL); return eOK; } // end of CMUSHclientDoc::SetOptionItem
long CMUSHclientDoc::AddTriggerEx(LPCTSTR TriggerName, LPCTSTR MatchText, LPCTSTR ResponseText, long Flags, short Colour, short Wildcard, LPCTSTR SoundFileName, LPCTSTR ScriptName, short SendTo, short Sequence) { CString strTriggerName = TriggerName; CTrigger * trigger_item; DISPID dispid = DISPID_UNKNOWN; long nStatus; bool bReplace = false; // allow blank names, assign one :) if (strTriggerName.IsEmpty ()) strTriggerName.Format ("*trigger%s", (LPCTSTR) App.GetUniqueString ()); else // return if bad name if (nStatus = CheckObjectName (strTriggerName)) return nStatus; // if it already exists, error if (GetTriggerMap ().Lookup (strTriggerName, trigger_item)) if (Flags & eReplace) bReplace = true; else return eTriggerAlreadyExists; // cannot have null match text if (strlen (MatchText) == 0) return eTriggerCannotBeEmpty; // check sequence if (Sequence < 0 || Sequence > 10000) return eTriggerSequenceOutOfRange; // check send to if (SendTo < 0 || SendTo >= eSendToLast) return eTriggerSendToInvalid; // must have a label for 'send to label' if (SendTo == eSendToVariable) if (CheckObjectName (strTriggerName)) return eTriggerLabelNotSpecified; // get trigger dispatch ID if (GetScriptEngine () && strlen (ScriptName) != 0) { CString strMessage; dispid = GetProcedureDispid (ScriptName, "trigger", TriggerName, strMessage); if (dispid == DISPID_UNKNOWN) return eScriptNameNotLocated; } t_regexp * regexp = NULL; CString strRegexp; if (Flags & eTriggerRegularExpression) strRegexp = MatchText; else strRegexp = ConvertToRegularExpression (MatchText); // compile regular expression try { regexp = regcomp (strRegexp, (Flags & eIgnoreCase ? PCRE_CASELESS : 0) | (m_bUTF_8 ? PCRE_UTF8 : 0)); } // end of try catch(CException* e) { e->Delete (); return eBadRegularExpression; } // end of catch // trigger replacement wanted if (bReplace) { // the trigger seems to exist - delete its pointer delete trigger_item; // now delete its entry GetTriggerMap ().RemoveKey (strTriggerName); } // create new trigger item and insert in trigger map GetTriggerMap ().SetAt (strTriggerName, trigger_item = new CTrigger); if ((Flags & eTemporary) == 0) if (!m_CurrentPlugin) // plugin mods don't really count SetModifiedFlag (TRUE); trigger_item->nUpdateNumber = App.GetUniqueNumber (); // for concurrency checks trigger_item->strInternalName = strTriggerName; // for deleting one-shot triggers trigger_item->trigger = MatchText; trigger_item->contents = ResponseText; trigger_item->colour = Colour; trigger_item->ignore_case = (Flags & eIgnoreCase) != 0; trigger_item->bOmitFromOutput = (Flags & eOmitFromOutput) != 0; trigger_item->bKeepEvaluating = (Flags & eKeepEvaluating) != 0; trigger_item->omit_from_log = (Flags & eOmitFromLog) != 0; trigger_item->bEnabled = (Flags & eEnabled) != 0; trigger_item->bRegexp = (Flags & eTriggerRegularExpression) != 0; trigger_item->bExpandVariables = (Flags & eExpandVariables) != 0; trigger_item->bTemporary = (Flags & eTemporary) != 0; trigger_item->bLowercaseWildcard = (Flags & eLowercaseWildcard) != 0; trigger_item->bOneShot = (Flags & eTriggerOneShot) != 0; trigger_item->strProcedure = ScriptName; trigger_item->strLabel = TriggerName; trigger_item->iClipboardArg = Wildcard; trigger_item->sound_to_play = SoundFileName; trigger_item->dispid = dispid; trigger_item->regexp = regexp; trigger_item->iSendTo = SendTo; trigger_item->iSequence = Sequence; trigger_item->strVariable = TriggerName; // kludge if (Colour < 0 || Colour >= MAX_CUSTOM) trigger_item->colour = SAMECOLOUR; if (Wildcard < 0 || Wildcard > 10) trigger_item->iClipboardArg = 0; SortTriggers (); return eOK; } // end of CMUSHclientDoc::AddTriggerEx
void CSimPetriDoc::OnLockZones() { lockZonesMode = !lockZonesMode; SetModifiedFlag(); UpdateAllViews(NULL); }
void CSimPetriDoc::OnGridMode() { gridMode = !gridMode; SetModifiedFlag(); UpdateAllViews(NULL); }
void CRScrlBarCtrl::SetParentPointer(long nNewValue) { m_parent=(CWnd*)nNewValue; SetModifiedFlag(); }
void CSTEditorDoc::OnUpdateModified () { SetModifiedFlag (m_Edit.GetModified ()); }
void CRScrlBarCtrl::SetPageSize(long nNewValue) { m_pagesize=nNewValue; InvalidateControl(); SetModifiedFlag(); }
// save mission to a file BOOL CFREDDoc::OnSaveDocument(LPCTSTR pathname) { CFred_mission_save save; char name[1024]; int len; DWORD attrib; FILE *fp; len = strlen(pathname); strcpy(name, pathname); if (name[len - 4] == '.') len -= 4; name[len] = 0; // drop extension while (len--) if ((name[len] == '\\') || (name[len] == ':')) break; strcpy(Mission_filename, name + len + 1); Fred_view_wnd->global_error_check(); if (Briefing_dialog) { Briefing_dialog->update_data(1); Briefing_dialog->save_editor_state(); } if (Event_editor_dlg) Fred_main_wnd->MessageBox("Event editor dialog is still open, so changes there won't be saved"); if (Message_editor_dlg) Fred_main_wnd->MessageBox("Message editor dialog is still open, so changes there won't be saved"); fp = fopen(pathname, "r"); if (fp) { fclose(fp); attrib = GetFileAttributes(pathname); if (attrib & FILE_ATTRIBUTE_READONLY) { Fred_main_wnd->MessageBox("File is read-only. You need to check it out before saving to it"); return FALSE; } } if (save.save_mission_file((char *) pathname)) { Fred_main_wnd->MessageBox("An error occured while saving!", NULL, MB_OK | MB_ICONEXCLAMATION); return FALSE; } SetModifiedFlag(FALSE); if (load_mission((char *) pathname)) Fred_main_wnd->MessageBox("Failed attempted to reload mission after saving. Report this bug now!"); // Error(LOCATION, "Failed attempting to reload mission after saving. Report this bug now!"); if (Briefing_dialog) { Briefing_dialog->restore_editor_state(); Briefing_dialog->update_data(1); } AddToRecentFileList(pathname); return TRUE; // return CDocument::OnSaveDocument(pathname); }
void CRScrlBarCtrl::SetUseMessagesInsteadOfEvents(BOOL bNewValue) { m_bUseMessagesInsteadOfEvents=bNewValue; SetModifiedFlag(); }
void CDrawDoc::Add(CDrawObj* pObj) { m_objects.AddTail(pObj); pObj->m_pDocument = this; SetModifiedFlag(); }
/// <summary>Replaces the current match</summary> /// <param name="m">Match data</param> /// <returns>True if replaced, false if match was no longer selected</returns> bool ScriptDocument::Replace(MatchData& m) { SetModifiedFlag(TRUE); return GetView()->Replace(m); }
// ************************************************************* // SetLayerLabels() // ************************************************************* void CMapView::SetLayerLabels(LONG LayerHandle, ILabels* pVal) { AFX_MANAGE_STATE(AfxGetStaticModuleState()); SetModifiedFlag(); }
/// <summary>Saves the document</summary> /// <param name="szPath">The new/existing path.</param> /// <returns></returns> BOOL ScriptDocument::OnSaveDocument(LPCTSTR szPath) { WorkerData data(Operation::LoadSaveDocument); try { REQUIRED(szPath); // Clear output pane theApp.GetMainWindow()->ClearOutputPane(Operation::LoadSaveDocument, true); // Feedback Console << Cons::UserAction << "Saving script: " << Path(szPath) << ENDL; data.SendFeedback(ProgressType::Operation, 0, VString(L"Saving script '%s'", szPath)); // Parse script ScriptParser parser(Script, Edit->GetAllLines(), Script.Game); // Compile if (parser.Successful) parser.Compile(); // Verified/Compiled OK: if (parser.Successful) { // IncrementVersion: if (PrefsLib.IncrementOnSave) Script.Version++; // Disable change detection DetectChanges(false, GetView()); // Write script ScriptFileWriter w(XFileInfo(szPath).OpenWrite()); w.Write(Script); w.Close(); // Re-Enable change detection DetectChanges(true, GetView()); // Remove 'Modified' flag SetModifiedFlag(FALSE); // Feedback data.SendFeedback(ProgressType::Succcess, 0, L"Script saved successfully"); // Auto-Commit: Commit if document part of project if (auto proj = ProjectDocument::GetActive()) if (PrefsLib.CommitOnSave && proj->Contains(FullPath)) OnCommitDocument(L"Automatic commit"); return TRUE; } else { // Display compiler output window theApp.GetMainWindow()->ActivateOutputPane(Operation::LoadSaveDocument, true); // DEBUG: Print tree //parser.Print(); // Feedback messages in output window for (const auto& err : parser.Errors) { Console << err << ENDL; // Feedback to output VString msg(L"%d: %s '%s'", err.Line, err.Message.c_str(), err.Text.c_str()); data.SendFeedback(ProgressType::Error, 1, msg); } // Feedback data.SendFeedback(Cons::Error, ProgressType::Failure, 0, L"Failed to save script"); return FALSE; } } catch (ExceptionBase& e) { Console.Log(HERE, e, VString(L"Failed to save script '%s'", szPath)); data.SendFeedback(Cons::Error, ProgressType::Failure, 0, L"Failed to save script"); return FALSE; } }
void CRScrlBarCtrl::SetMinValue(long nNewValue) { m_lMinValue=nNewValue; SetModifiedFlag(); }
void CIpmCtrl::OnTimeOutChanged() { NotifySettingChange(IPMMASK_TIMEOUT); SetModifiedFlag(); }
void CRScrlBarCtrl::SetStepSize(long nNewValue) { m_lStepSize=nNewValue; SetModifiedFlag(); }
void CIpmCtrl::OnShowGridChanged() { NotifySettingChange(IPMMASK_SHOWGRID); SetModifiedFlag(); }
void CRScrlBarCtrl::SetHorzAlign(BOOL bNewValue) { m_bHorzAlign=bNewValue; InvalidateControl(); SetModifiedFlag(); }
void CIpmCtrl::OnMaxSessionChanged() { NotifySettingChange(IPMMASK_MAXSESSION); SetModifiedFlag(); }
void CLangModelsDoc::OnLangInterlinearSeq() { if(m_pLang->OnEditInterlinearSeq()) SetModifiedFlag(TRUE); }