void CToDoCtrlReminders::SaveAndRemoveReminders(const CFilteredToDoCtrl& tdc) { CPreferences prefs; // nRem is the total number of reminders for all tasklists // nRemCount is the number of reminders for 'tdc' int nRemCount = 0, nRem = m_aReminders.GetSize(); CString sFileKey = tdc.GetPreferencesKey(_T("Reminders")); while (nRem--) { TDCREMINDER rem = m_aReminders[nRem]; if (rem.pTDC == &tdc) { // verify that the task for this reminder still exists if (!tdc.HasTask(rem.dwTaskID)) continue; CString sKey = sFileKey + Misc::MakeKey(_T("\\Reminder%d"), nRemCount); rem.Save(&prefs, sKey); nRemCount++; m_aReminders.RemoveAt(nRem); } } prefs.WriteProfileInt(sFileKey, _T("NumReminders"), nRemCount); // kill timer if no reminders if (GetSafeHwnd() && m_aReminders.GetSize() == 0) KillTimer(1); }
BOOL CTDLTaskIconDlg::OnInitDialog() { CDialog::OnInitDialog(); ListView_SetImageList(m_lcIcons, m_ilIcons, LVSIL_SMALL); CPreferences prefs; for (int nImage = 0; nImage < m_ilIcons.GetImageCount(); nImage++) { CString sImage, sKey; sKey.Format(_T("Icon%d"), nImage + 1); sImage = prefs.GetProfileString(_T("TaskIcons"), sKey); if (sImage.IsEmpty()) { sImage.Format(_T("%d"), nImage + 1); } m_lcIcons.InsertItem(nImage, sImage, nImage); } if (m_nIconIndex >= 0) { m_lcIcons.SetItemState(m_nIconIndex, LVIS_SELECTED | LVIS_FOCUSED, LVIS_SELECTED | LVIS_FOCUSED); } // disable OK button if nothing selected GetDlgItem(IDOK)->EnableWindow(m_nIconIndex >= 0); m_lcIcons.SetFocus(); return FALSE; // return TRUE unless you set the focus to a control // EXCEPTION: OCX Property Pages should return FALSE }
void CPreferencesDlgBase::SavePreferences(CPreferences& prefs) { // cycle the page saving the preferences for each one int nPage = m_pphost.GetPageCount(); while (nPage--) { CPreferencesPageBase* pPage = (CPreferencesPageBase*)m_pphost.GetPage(nPage); if (pPage->IsKindOf(RUNTIME_CLASS(CPreferencesPageBase))) pPage->SavePreferences(prefs); } if (GetSafeHwnd()) { CRect rWindow; GetWindowRect(rWindow); prefs.WriteProfileInt(_T("Preferences\\DialogState"), _T("Height"), rWindow.Height()); prefs.WriteProfileInt(_T("Preferences\\DialogState"), _T("Width"), rWindow.Width()); prefs.WriteProfileInt(_T("Preferences\\DialogState"), _T("StartPage"), m_pphost.GetActiveIndex()); } prefs.Save(); }
BOOL CMainWindow::Create() { newWindowX = newWindowY = 0; BOOL retval = LoadFrame( IDR_MAINWINDOW ); userListWnd = NULL; if ( retval ) { retval = toolbar.Create( this, WS_CHILD | WS_VISIBLE | CBRS_TOP | CBRS_FLYBY | CBRS_TOOLTIPS ); } if ( retval ) { retval = toolbar.LoadToolBar( IDR_MAINWINDOW ); } if ( retval ) { status.Create( this ); UINT indicator = ID_SEPARATOR; status.SetIndicators( &indicator, 1 ); } if ( retval ) { chooser = new CStudentChooserWnd(); retval = chooser->Create( this ); } chooser->ShowWindow( preferences.GetInt( "ChooserWindowState" ) ); if ( !preferences.GetBool( "ShowStudentChooser" ) ) { chooser->ShowWindow( SW_HIDE ); } return retval; }
void CTDLFindResultsListCtrl::RefreshUserPreferences() { CPreferences prefs; // update user completed tasks colour if (prefs.GetProfileInt(_T("Preferences"), _T("SpecifyDoneColor"), FALSE)) { m_crDone = (COLORREF)prefs.GetProfileInt(_T("Preferences\\Colors"), _T("TaskDone"), -1); } else { m_crDone = (COLORREF)-1; } // update strike thru font if (prefs.GetProfileInt(_T("Preferences"), _T("StrikethroughDone"), FALSE)) { if (!m_fontStrike.GetSafeHandle()) { GraphicsMisc::CreateFont(m_fontStrike, (HFONT)SendMessage(WM_GETFONT), MFS_STRIKETHRU); } } else { m_fontStrike.DeleteObject(); } if (IsWindowVisible()) { Invalidate(); } }
void CMainWindow::OnToolsQueryWizard() { string qwPath = preferences.GetHomePath() + "QueryBuilder.exe"; if ( GetFileAttributes( qwPath.c_str() ) == -1 ) { MessageBox( "QueryBuilder is not installed.", "StudentInfo" ); } else { if ( (int)ShellExecute( NULL, "open", qwPath.c_str(), NULL, preferences.GetHomePath().c_str(), SW_SHOWNORMAL ) <= 32 ) { MessageBox( "Unable to execute QueryBuilder.", "StudentInfo" ); } } }
BOOL CToDoCtrlReminders::ToDoCtrlHasReminders(const CString& sFilePath) { if (sFilePath.IsEmpty()) return FALSE; CPreferences prefs; CString sFileKey = CFilteredToDoCtrl::GetPreferencesKey(sFilePath, _T("Reminders")); return (!sFileKey.IsEmpty() && prefs.GetProfileInt(sFileKey, _T("NumReminders")) > 0); }
void CTDLTransformDialog::OnOK() { CDialog::OnOK(); CPreferences prefs; prefs.WriteProfileString(_T("Transform"), _T("Stylesheet"), m_sStylesheet); prefs.WriteProfileInt(_T("Transform"), _T("WantDate"), m_bDate); // share same title history as print dialog m_cbTitle.Save(&prefs, _T("Print")); }
BOOL CConnectionOptionsDlg::OnInitDialog() { if ( !CDialog::OnInitDialog() ) { return FALSE; } SetDlgItemText( IDC_DSN, preferences.GetString("DSNDatabase").c_str() ); SetDlgItemText( IDC_ACCESS, preferences.GetString("AccessDatabase").c_str() ); SetDlgItemText( IDC_SQLSERVER, preferences.GetString("SQLServer").c_str() ); SetDlgItemText( IDC_SQLADDRESS, preferences.GetString("SQLAddress").c_str() ); SetDlgItemText( IDC_SQLDATABASE, preferences.GetString("SQLDatabase").c_str() ); CheckDlgButton( IDC_PREFIX, ( preferences.GetBool("UsePrefix") ? 1 : 0 ) ); if ( preferences.GetString("ConnectionType")=="SQL" ) { CheckDlgButton( IDC_SQLRADIO, 1 ); OnSQLRadio(); } else { if ( preferences.GetString("ConnectionType")=="Access" ) { CheckDlgButton( IDC_ACCESSRADIO, 1 ); OnAccessRadio(); } else { CheckDlgButton( IDC_DSNRADIO, 1 ); OnDSNRadio(); } } return TRUE; }
void MainWindow::OnMenuPreferences() { CPreferences *pDialog = NULL; builder->get_widget_derived("zzz_preferences", pDialog); pDialog->Init(this->s); if(pDialog) { pDialog->set_transient_for(*this); pDialog->run(); pDialog->hide(); // trim all modules, maybe history length changed this->s->Trim(NULL); } }
void CTDLImportDialog::OnOK() { CDialog::OnOK(); CPreferences prefs; prefs.WriteProfileInt(_T("Importing"), _T("ImportOption"), m_bFromClipboard); prefs.WriteProfileString(_T("Importing"), _T("ImportFilePath"), m_sFromFilePath); prefs.WriteProfileInt(_T("Importing"), _T("ImportToWhere"), m_nImportTo); prefs.WriteProfileInt(_T("Importing"), _T("ImportFormat"), m_nFormatOption); // retrieve clipboard text if (CurImporterHasFilter()) GetDlgItem(IDC_FROMCLIPBOARDTEXT)->GetWindowText(m_sClipboardText); }
CTDLImportDialog::CTDLImportDialog(const CImportExportMgr& mgr, CWnd* pParent /*=NULL*/) : CDialog(CTDLImportDialog::IDD, pParent), m_mgrImportExport(mgr), m_sizeMin(0, 0) { //{{AFX_DATA_INIT(CTDLImportDialog) //}}AFX_DATA_INIT CPreferences prefs; m_bFromClipboard = prefs.GetProfileInt(_T("Importing"), _T("ImportOption"), FALSE); m_sFromFilePath = prefs.GetProfileString(_T("Importing"), _T("ImportFilePath")); m_nImportTo = prefs.GetProfileInt(_T("Importing"), _T("ImportToWhere"), TDIT_SELECTEDTASK); m_nFormatOption = prefs.GetProfileInt(_T("Importing"), _T("ImportFormat"), 0); m_nFormatOption = min(m_nFormatOption, mgr.GetNumImporters()); }
void CStudentChooserDlg::DoDataExchange( CDataExchange* pDX ) { CDialog::DoDataExchange( pDX ); DDX_Control( pDX, IDC_SEARCHFIRSTNAME, searchFirstName ); DDX_Control( pDX, IDC_SEARCHLASTNAME, searchLastName ); DDX_Control( pDX, IDC_SEARCHSSN, searchSSN ); DDX_Control( pDX, IDC_SEARCHCHECK, searchCheck ); DDX_Control( pDX, IDC_STUDENTLIST, studentList ); DDX_Control( pDX, IDC_NEWSTUDENT, newButton ); DDX_Control( pDX, IDC_OPENSTUDENT, openButton ); DDX_Control( pDX, IDC_SEARCHBUTTON, searchButton ); DDX_Control( pDX, IDC_SEARCHSCHOOLYEAR, schoolYearList ); searchCheck.SetCheck( 1 ); schoolYearList.DisableNull(); schoolYearList.SetList( storage.GetSchoolYearList() ); RefreshStudentList(); searchLastName.SetFocus(); if ( !user.CanWrite() ) { newButton.EnableWindow( FALSE ); } try { schoolYearList.Select( preferences.GetInt( "CurrentSchoolYear" ) ); RefreshStudentList(); } catch (...) {} }
void CStudentChooserDlg::OnNewStudentButtonClicked() { if ( preferences.GetBool( "ShowNewStudentOptions" ) ) { CNewStudentOptionsDlg dialog; dialog.DoModal(); } else { mainWnd->NewStudent( schoolYearList.GetSelectedIndex() ); } }
void CTDLImportOutlookObjectsDlg::BuildMasterMapping() { // restore last state from preferences CString sSection; sSection.Format(_T("OutlookFieldMapping\\%s"), COutlookHelper::GetItemClass(m_refItem)); CPreferences prefs; m_bHideUnmapped = prefs.GetProfileInt(sSection, _T("HideUnmapped"), TRUE); m_bHideConfidential = prefs.GetProfileInt(sSection, _T("HideConfidential"), TRUE); // initialize the mapped reference data COutlookHelper::GetItemData(m_refItem, m_mapRefData, !m_bHideConfidential); // recheck the confidential status because the call to COutlookHelper::GetItemData // may have been denied if (!m_bHideConfidential) m_bHideConfidential = COutlookHelper::HasDenyConfidential(); // build the master mapping first time only if (m_aMasterMapping.GetSize() == 0) { for (int nField = 0; nField < NUM_FIELDS; nField++) { const OUTLOOK_FIELD& oaField = FIELDS[nField]; CEnString sFieldAndData = FormatFieldAndData(oaField); m_aMasterMapping.Add(CSVCOLUMNMAPPING(sFieldAndData, oaField.nTDCAttrib, oaField.nFieldType)); } } ASSERT(m_aMasterMapping.GetSize() == NUM_FIELDS); // restore last state from preferences for (int nField = 0; nField < NUM_FIELDS; nField++) { CString sKey = Misc::MakeKey(_T("Field%d"), nField); OUTLOOK_FIELDTYPE nFieldType = (OUTLOOK_FIELDTYPE)prefs.GetProfileInt(sSection, sKey, -1); sKey = Misc::MakeKey(_T("Attrib%d"), nField); TDC_ATTRIBUTE nAttrib = (TDC_ATTRIBUTE)prefs.GetProfileInt(sSection, sKey, TDCA_NONE); if (nFieldType != -1) m_aMasterMapping[nField].nTDCAttrib = nAttrib; } }
void CTDLImportOutlookObjectsDlg::SaveMasterMapping() const { CString sSection; sSection.Format(_T("OutlookFieldMapping\\%s"), COutlookHelper::GetItemClass(m_refItem)); CPreferences prefs; prefs.WriteProfileInt(sSection, _T("HideUnmapped"), m_bHideUnmapped); prefs.WriteProfileInt(sSection, _T("HideConfidential"), m_bHideConfidential); for (int nField = 0; nField < NUM_FIELDS; nField++) { CString sKey = Misc::MakeKey(_T("Field%d"), nField); prefs.WriteProfileInt(sSection, sKey, m_aMasterMapping[nField].dwItemData); sKey = Misc::MakeKey(_T("Attrib%d"), nField); prefs.WriteProfileInt(sSection, sKey, m_aMasterMapping[nField].nTDCAttrib); } }
void CPreferencesExportPage::SavePreferences(CPreferences& prefs) { // save settings prefs.WriteProfileString(_T("Preferences"), _T("HtmlFont"), m_sHtmlFont); prefs.WriteProfileInt(_T("Preferences"), _T("HtmlFontSize"), m_nHtmlFontSize); prefs.WriteProfileInt(_T("Preferences"), _T("PreviewSaveAs"), m_bPreviewExport); prefs.WriteProfileInt(_T("Preferences"), _T("TextIndent"), m_nTextIndent); prefs.WriteProfileInt(_T("Preferences"), _T("LineSpaces"), m_nLineSpaces); prefs.WriteProfileInt(_T("Preferences"), _T("ExportVisibleOnly"), m_bExportVisibleOnly); prefs.WriteProfileInt(_T("Preferences"), _T("ExportParentTitleCommentsOnly"), m_bExportParentTitleCommentsOnly); prefs.WriteProfileInt(_T("Preferences"), _T("ExportSpaceForNotes"), m_bExportSpaceForNotes); prefs.WriteProfileString(_T("Preferences"), _T("HtmlCharSet"), m_sHtmlCharSet); prefs.WriteProfileInt(_T("Preferences"), _T("UseSpaceIndents"), m_bUseSpaceIndents); // prefs.WriteProfileInt(_T("Preferences"), _T(""), m_b); }
void CPreferencesExportPage::LoadPreferences(const CPreferences& prefs) { m_sHtmlFont = prefs.GetProfileString(_T("Preferences"), _T("HtmlFont"), _T("Verdana")); m_bPreviewExport = prefs.GetProfileInt(_T("Preferences"), _T("PreviewSaveAs"), TRUE); m_nHtmlFontSize = prefs.GetProfileInt(_T("Preferences"), _T("HtmlFontSize"), 2); m_nTextIndent = prefs.GetProfileInt(_T("Preferences"), _T("TextIndent"), 2); m_nLineSpaces = prefs.GetProfileInt(_T("Preferences"), _T("LineSpaces"), 8); m_bExportVisibleOnly = prefs.GetProfileInt(_T("Preferences"), _T("ExportVisibleOnly"), FALSE); m_bExportParentTitleCommentsOnly = prefs.GetProfileInt(_T("Preferences"), _T("ExportParentTitleCommentsOnly"), FALSE); m_bExportSpaceForNotes = prefs.GetProfileInt(_T("Preferences"), _T("ExportSpaceForNotes"), FALSE); m_bUseSpaceIndents = prefs.GetProfileInt(_T("Preferences"), _T("UseSpaceIndents"), TRUE); CString sDefCharset = "Windows-" + Misc::GetDefCharset(); m_sHtmlCharSet = prefs.GetProfileString(_T("Preferences"), _T("HtmlCharSet"), sDefCharset); // m_b = prefs.GetProfileInt(_T("Preferences"), _T(""), FALSE); }
void CToDoCtrlReminders::LoadReminders(const CFilteredToDoCtrl& tdc) { CPreferences prefs; CString sFileKey = tdc.GetPreferencesKey(_T("Reminders")); int nRemCount = prefs.GetProfileInt(sFileKey, _T("NumReminders")); for (int nRem = 0; nRem < nRemCount; nRem++) { CString sKey = Misc::MakeKey(_T("\\Reminder%d"), nRem, sFileKey); TDCREMINDER rem; rem.pTDC = &tdc; rem.Load(&prefs, sKey); m_aReminders.Add(rem); } // start timer if some reminders and not using Stickies if (!m_stickies.IsValid()) StartTimer(); }
void CTDLFindResultsListCtrl::RefreshUserPreferences() { CPreferences prefs; // update user completed tasks colour if (prefs.GetProfileInt(_T("Preferences"), _T("SpecifyDoneColor"), FALSE)) m_crDone = (COLORREF)prefs.GetProfileInt(_T("Preferences\\Colors"), _T("TaskDone"), -1); else m_crDone = CLR_NONE; // update user reference tasks colour if (prefs.GetProfileInt(_T("Preferences"), _T("ReferenceColor"), FALSE)) m_crRef = (COLORREF)prefs.GetProfileInt(_T("Preferences\\Colors"), _T("Reference"), -1); else m_crRef = CLR_NONE; // update strike thru font BOOL bWasStrikeThru = m_bStrikeThruDone; m_bStrikeThruDone = prefs.GetProfileInt(_T("Preferences"), _T("StrikethroughDone"), FALSE); // clear the font cache if 'strike thru' has changed if (m_bStrikeThruDone != bWasStrikeThru) m_fonts.Clear(); if (IsWindowVisible()) Invalidate(); }
void CMainWindow::OnClose() { CWnd* child = GetWindow( GW_CHILD )->GetWindow( GW_CHILD ); vector< CStudentEditWnd* > children; while ( child ) { if ( child->IsKindOf( RUNTIME_CLASS( CStudentEditWnd ) ) ) { children.push_back( (CStudentEditWnd*)child ); } child = child->GetWindow( GW_HWNDNEXT ); } for ( int i=0; i<children.size(); i++ ) { if ( !children[i]->AttemptClose() ) { return; } } if ( chooser->IsZoomed() ) { preferences.SetInt( "ChooserWindowState", SW_SHOWMAXIMIZED ); } else { preferences.SetInt( "ChooserWindowState", SW_NORMAL ); } chooser->ShowWindow( SW_NORMAL ); if ( IsZoomed() ) { preferences.SetInt( "MainWindowState", SW_SHOWMAXIMIZED ); } else { preferences.SetInt( "MainWindowState", SW_NORMAL ); } ShowWindow( SW_NORMAL ); CRect area; GetWindowRect( area ); preferences.SetRect( "MainWindowRect", area ); toolbar.ShowWindow( SW_HIDE ); RecalcLayout(); preferences.SetBool( "ShowStudentChooser", ( chooser->IsWindowVisible() ? true : false ) ); CRect chooserArea; chooser->GetWindowRect( chooserArea ); ScreenToClient( chooserArea ); chooserArea.bottom-=2; chooserArea.left-=2; chooserArea.right-=2; chooserArea.top-=2; preferences.SetRect( "StudentChooserRect", chooserArea ); preferences.SetInt( "CurrentSchoolYear", chooser->GetSchoolYearID() ); CMDIFrameWnd::OnClose(); }
void CPreferencesToolPage::LoadPreferences(const CPreferences& prefs) { // load tools int nToolCount = prefs.GetProfileInt(_T("Tools"), _T("ToolCount"), 0); for (int nTool = 1; nTool <= nToolCount; nTool++) { CString sKey = Misc::MakeKey(_T("Tools\\Tool%d"), nTool); USERTOOL ut; ut.sToolName = prefs.GetProfileString(sKey, _T("Name"), _T("")); ut.sToolPath = prefs.GetProfileString(sKey, _T("Path"), _T("")); ut.sCmdline = prefs.GetProfileString(sKey, _T("CmdLine"), _T("")); ut.bRunMinimized = prefs.GetProfileInt(sKey, _T("RunMinimized"), FALSE); ut.sIconPath = prefs.GetProfileString(sKey, _T("IconPath"), _T("")); // replace safe quotes with real quotes ut.sCmdline.Replace(SAFEQUOTE, REALQUOTE); m_aTools.Add(ut); } }
void CTDLTaskIconDlg::OnDestroy() { CDialog::OnDestroy(); // save off any saved names to the preferences CPreferences prefs; for (int nImage = 0; nImage < m_ilIcons.GetImageCount(); nImage++) { CString sImage, sKey, sText; // only save the ones thsat have been modified sImage.Format(_T("%d"), nImage + 1); sText = m_lcIcons.GetItemText(nImage, 0); if (sText != sImage) { sKey.Format(_T("Icon%d"), nImage + 1); prefs.WriteProfileString(_T("TaskIcons"), sKey, sText); } } }
CTDLTransformDialog::CTDLTransformDialog(LPCTSTR szTitle, FTC_VIEW nView, CWnd* pParent /*=NULL*/) : CDialog(IDD_TRANSFORM_DIALOG, pParent), m_taskSel(_T("Transform"), nView), m_sTitle(szTitle), m_eStylesheet(FES_COMBOSTYLEBTN | FES_RELATIVEPATHS, CEnString(IDS_XSLFILEFILTER)) { //{{AFX_DATA_INIT(CTDLTransformDialog) //}}AFX_DATA_INIT // see what we had last time CPreferences prefs; // init the stylesheet folder to point to the resource folder CString sFolder = FileMisc::GetAppResourceFolder() + _T("\\Stylesheets"); m_eStylesheet.SetCurrentFolder(sFolder); m_eStylesheet.SetBrowseTitle(CEnString(IDS_SELECTSTYLESHEET_TITLE)); m_sStylesheet = prefs.GetProfileString(_T("Transform"), _T("Stylesheet")); m_sStylesheet = FileMisc::GetRelativePath(m_sStylesheet, sFolder, FALSE); m_bDate = prefs.GetProfileInt(_T("Transform"), _T("WantDate"), TRUE); // share same title history as print dialog m_cbTitle.Load(&prefs, _T("Print")); }
void CPreferencesToolPage::SavePreferences(CPreferences& prefs) { // save tools to registry and m_aTools int nToolCount = m_aTools.GetSize(); for (int nTool = 0; nTool < nToolCount; nTool++) { USERTOOL ut = m_aTools[nTool]; CString sKey = Misc::MakeKey(_T("Tools\\Tool%d"), nTool + 1); prefs.WriteProfileString(sKey, _T("Name"), ut.sToolName); prefs.WriteProfileString(sKey, _T("Path"), ut.sToolPath); prefs.WriteProfileString(sKey, _T("IconPath"), ut.sIconPath); prefs.WriteProfileInt(sKey, _T("RunMinimized"), ut.bRunMinimized); // GetPrivateProfileString strips a leading/trailing quote pairs if // it finds them so we replace quotes with safe quotes ut.sCmdline.Replace(REALQUOTE, SAFEQUOTE); prefs.WriteProfileString(sKey, _T("Cmdline"), ut.sCmdline); } prefs.WriteProfileInt(_T("Tools"), _T("ToolCount"), nToolCount); }
COffsetDatesDlg::COffsetDatesDlg(CWnd* pParent /*=NULL*/): CDialog(COffsetDatesDlg::IDD, pParent) { //{{AFX_DATA_INIT(COffsetDatesDlg) m_bOffsetSubtasks = FALSE; //}}AFX_DATA_INIT // restore state CPreferences prefs; m_bOffsetStartDate = prefs.GetProfileInt(_T("OffsetDates"), _T("StartDate"), FALSE); m_bOffsetDueDate = prefs.GetProfileInt(_T("OffsetDates"), _T("DueDate"), FALSE); m_bOffsetDoneDate = prefs.GetProfileInt(_T("OffsetDates"), _T("DoneDate"), FALSE); m_bForward = prefs.GetProfileInt(_T("OffsetDates"), _T("Forward"), 1); m_nOffsetBy = prefs.GetProfileInt(_T("OffsetDates"), _T("Amount"), 1); m_nOffsetByUnits = prefs.GetProfileInt(_T("OffsetDates"), _T("AmountUnits"), 0); m_bOffsetSubtasks = prefs.GetProfileInt(_T("OffsetDates"), _T("Subtasks"), 1); }
void CPreferencesDlgBase::LoadPreferences(CPreferences& prefs) { // cycle the page loading the preferences for each one int nPage = m_pphost.GetPageCount(); while (nPage--) { CPreferencesPageBase* pPage = (CPreferencesPageBase*)m_pphost.GetPage(nPage); if (pPage->IsKindOf(RUNTIME_CLASS(CPreferencesPageBase))) pPage->LoadPreferences(prefs); } // initial page if (m_nInitPage < 0 || m_nInitPage >= m_pphost.GetPageCount()) m_nInitPage = prefs.GetProfileInt(_T("Preferences\\DialogState"), _T("StartPage"), 0); }
void COffsetDatesDlg::OnOK() { CDialog::OnOK(); // save state CPreferences prefs; prefs.WriteProfileInt(_T("OffsetDates"), _T("StartDate"), m_bOffsetStartDate); prefs.WriteProfileInt(_T("OffsetDates"), _T("DueDate"), m_bOffsetDueDate); prefs.WriteProfileInt(_T("OffsetDates"), _T("DoneDate"), m_bOffsetDoneDate); prefs.WriteProfileInt(_T("OffsetDates"), _T("Forward"), m_bForward); prefs.WriteProfileInt(_T("OffsetDates"), _T("Amount"), m_nOffsetBy); prefs.WriteProfileInt(_T("OffsetDates"), _T("AmountUnits"), m_nOffsetByUnits); prefs.WriteProfileInt(_T("OffsetDates"), _T("Subtasks"), m_bOffsetSubtasks); }
void CNewStudentOptionsDlg::OnOK() { if ( !((CButton*)GetDlgItem(IDC_SHOWNEWOPTIONS))->GetCheck() ) { preferences.SetBool( "ShowNewStudentOptions", false ); } if ( GetCheckedRadioButton( IDC_CREATENEW, IDC_IMPORT ) == IDC_IMPORT ) { importSSN.ValidateData(); if ( storage.StudentExists( importSSN.GetString() ) ) { mainWnd->EditStudent( importSSN.GetString(), chooser->GetSchoolYearID() ); } else { MessageBox( "No student exists with that SSN.", "Student Info" ); return; } } else { chooser->CreateStudent(); } CDialog::OnOK(); }
void CPreferencesUIVisibilityPage::SavePreferences(CPreferences& prefs) { TDCCOLEDITFILTERVISIBILITY vis; m_lcVisibility.GetVisibility(vis); // columns int nCol = vis.GetVisibleColumns().GetSize(); prefs.WriteProfileInt(_T("Preferences\\ColumnVisibility"), _T("Count"), nCol); while (nCol--) { CString sKey = Misc::MakeKey(_T("Col%d"), nCol); prefs.WriteProfileInt(_T("Preferences\\ColumnVisibility"), sKey, vis.GetVisibleColumns()[nCol]); } // show attributes mode prefs.WriteProfileInt(_T("Preferences"), _T("ShowAttributes"), vis.GetShowEditsAndFilters()); if (vis.GetShowEditsAndFilters() == TDLSA_ANY) { // edit fields int nEdit = vis.GetVisibleEditFields().GetSize(); prefs.WriteProfileInt(_T("Preferences\\EditVisibility"), _T("Count"), nEdit); while (nEdit--) { CString sKey = Misc::MakeKey(_T("Edit%d"), nEdit); prefs.WriteProfileInt(_T("Preferences\\EditVisibility"), sKey, vis.GetVisibleEditFields()[nEdit]); } // filters int nFilter = vis.GetVisibleFilterFields().GetSize(); prefs.WriteProfileInt(_T("Preferences\\FilterVisibility"), _T("Count"), nFilter); while (nFilter--) { CString sKey = Misc::MakeKey(_T("Filter%d"), nFilter); prefs.WriteProfileInt(_T("Preferences\\FilterVisibility"), sKey, vis.GetVisibleFilterFields()[nFilter]); } } }