bool XRefTable::NextGroup(int first, int* num, int* nof) { int n = GetSize(); while (first < n && !HasChanged(first)) first ++; bool found = first < n; if (found) { *num = first; do { first ++; } while (first < n && HasChanged(first)); *nof = first - *num; } return found; }
//__________________________________________________________________________________ void _Variable::PreMarkChanged (void) { if (varFormula) { varFlags &= HY_DEP_V_INSPECTED_CLR; if (HasChanged(false)) { varFlags |= HY_DEP_V_MODIFIED; } if (HasChanged(true)) { varFlags |= HY_DEP_V_MODIFIED_CATS; } varFlags |= HY_DEP_V_INSPECTED; } }
bool ASSISTANT::Document::Close(bool bAskForSave) { if (HasChanged() && bAskForSave) { CString csMessage; csMessage.Format(IDS_SAVE_DOCUMENT, m_csDocumentName); CString csCaption; csCaption.LoadString(IDS_CONFIRM_CLOSE); int iAnswer = MessageBox(NULL, csMessage, csCaption, MB_YESNOCANCEL | MB_TOPMOST); if (iAnswer == IDCANCEL) return false; if (iAnswer == IDYES) { CString docFilename; docFilename = m_csDocumentPath; docFilename += _T("\\"); docFilename += m_csDocumentName; if (!Save()) { CString csError; csError.Format(IDS_ERROR_SAVE_DOCUMENT, m_csDocumentName); MessageBox(NULL, csError, NULL, MB_OK | MB_TOPMOST); return false; } } } UnLoad(); return true; }
//------------------------------------------------------------------------------ void CUIEdProjectUI::CheckSave(bool force) { if (!HasChanged() && !force) return; wxTextFile fp(m_FileName); m_Group.m_Inst->SaveExtra(fp); SetChanged(false); }
BOOL Date::MaybePostChangedStuff(LONG how) //defaults = AEVT_ATMARK|AEVT_KILLDUPLICATES { BOOL rVal=FALSE; if (HasChanged()) { AEvtPostStandard(m_oiSelf, AEVENT_OBJECTCHANGED, 0, AEvtGetObjectChangedPriority(how) ); AEvtPostSignalAtTail(m_oiSelf, DT_SignalChanged); SetHasChanged(FALSE); rVal = TRUE; } return rVal; }
t_uint32 CDialogPref::get_state() { t_uint32 state = preferences_state::resettable; if (HasChanged()) { state |= preferences_state::changed; if ((uButton_GetCheck(m_hWnd, IDC_CHECK_SAFE_MODE) != g_cfg_safe_mode)) state |= preferences_state::needs_restart; } return state; }
LRESULT CDialogPref::OnPropNMDblClk(LPNMHDR pnmh) { //for ListView - (LPNMITEMACTIVATE)pnmh //for StatusBar - (LPNMMOUSE)pnmh LPNMITEMACTIVATE pniv = (LPNMITEMACTIVATE)pnmh; if (pniv->iItem >= 0) { t_sci_prop_set_list & prop_sets = g_sci_prop_sets.val(); pfc::string8 key, val; uGetItemText(pniv->iItem, 0, key); uGetItemText(pniv->iItem, 1, val); modal_dialog_scope scope; if (!scope.can_create()) return false; scope.initialize(m_hWnd); CNameValueEdit dlg(key, val); if (IDOK == dlg.DoModal(m_hWnd)) { dlg.GetValue(val); // Save for (t_size i = 0; i < prop_sets.get_count(); ++i) { if (strcmp(prop_sets[i].key, key) == 0) { prop_sets[i].val = val; break; } } // Update list m_props.SetItemText(pniv->iItem, 1, pfc::stringcvt::string_wide_from_utf8_fast(val)); DoDataExchange(); HasChanged(); } } return 0; }
void Value::Update() { if (HasChanged()) { InternalUpdate(); } }
t_uint32 CMyPreferences::get_state() { t_uint32 state = preferences_state::resettable; if (HasChanged()) state |= preferences_state::changed; return state; }
void AttributeTextControl::Revert() { if (HasChanged()) SetText(fOriginalValue); }
bool Config::Write() { //If this is a config with a pre-set of values, can't parse! if (configName.length() == 0) return false; //Open the configuration file fstream file(BH::path + configName); if (!file.is_open()) return false; //Read in the configuration value vector<string> configLines; char line[2048]; while (!file.eof()) { file.getline(line, 2048); configLines.push_back(line); } file.close(); map<ConfigEntry, string> changed; for (map<string, ConfigEntry>::iterator it = contents.begin(); it != contents.end(); ++it) { string newValue; if (!HasChanged((*it).second, newValue)) continue; pair<ConfigEntry, string> change; change.first = (*it).second; change.second = newValue.c_str(); changed.insert(change); } if (changed.size() == 0) return true; for (vector<string>::iterator it = configLines.begin(); it < configLines.end(); it++) { //Remove any comments from the config string comment; if ((*it).find_first_of("//") != string::npos) { comment = (*it).substr((*it).find_first_of("//")); (*it) = (*it).erase((*it).find_first_of("//")); } //Insure we have something in the line now. if ((*it).length() == 0) { *it = comment; continue; } string key = Trim((*it).substr(0, (*it).find_first_of(":"))); *it = *it + comment; for (map<ConfigEntry, string>::iterator cit = changed.begin(); cit != changed.end(); ++cit) { if ((*cit).first.key.compare(key) != 0) continue; if ((*cit).second.size() == 0) { *it = "//Purge"; contents[key].value = ""; changed.erase((*cit).first); break; } stringstream newLine; newLine << key << ":" << (*cit).first.comment << (*cit).second << comment; *it = newLine.str(); contents[key].value = (*cit).second; changed.erase((*cit).first); break; } } for (map<ConfigEntry, string>::iterator cit = changed.begin(); cit != changed.end(); ++cit) { stringstream newConfig; newConfig << (*cit).first.key << ": " << (*cit).second; configLines.push_back(newConfig.str()); } ofstream outFile(BH::path + configName); for (vector<string>::iterator it = configLines.begin(); it < configLines.end(); it++) { if ((*it).compare("//Purge") == 0) continue; if (std::next(it) == configLines.end()) outFile << (*it); else outFile << (*it) << endl; } outFile.close(); return true; }
cString cVideoDiskUsage::String(void) { HasChanged(state); return cString::sprintf("%s %d%% - %2d:%02d %s", tr("Disk"), usedPercent, freeMinutes / 60, freeMinutes % 60, tr("free")); }