// Received Mouse events: bool nuiKnob::MouseClicked(nuiSize X, nuiSize Y, nglMouseInfo::Flags Button) { mClickX = X; mClickY = Y; if ((Button & nglMouseInfo::ButtonLeft) && (Button & nglMouseInfo::ButtonDoubleClick)) { return false; } else if (Button & nglMouseInfo::ButtonLeft) { mClicked = true; Grab(); Invalidate(); mClickValue = mRange.GetValue(); return true; } else if (Button & nglMouseInfo::ButtonWheelUp) { if (IsKeyDown(mFineSensitivityKey)) { mRange.SetValue(mRange.GetValue() + mRange.GetIncrement() / mFineSensitivityRatio); } else { mRange.Increment(); } InteractiveValueChanged(); ActivateToolTip(this, true); return true; } else if (Button & nglMouseInfo::ButtonWheelDown) { if (IsKeyDown(mFineSensitivityKey)) { mRange.SetValue(mRange.GetValue() - mRange.GetIncrement() / mFineSensitivityRatio); } else { mRange.Decrement(); } InteractiveValueChanged(); ActivateToolTip(this, true); return true; } return false; }
BOOL COptionsBackup::OnInitDialog() { COptions_PropertyPage::OnInitDialog(); m_chkbox.SetTextColour(CR_DATABASE_OPTIONS); m_chkbox.ResetBkgColour(); //Use current window's background if (!GetMainDlg()->IsDBReadOnly()) GetDlgItem(IDC_STATIC_DB_PREFS_RO_WARNING)->ShowWindow(SW_HIDE); if (m_backupsuffix_cbox.GetCount() == 0) { // add the strings in alphabetical order CString cs_text(MAKEINTRESOURCE(IDS_NONE)); int nIndex; nIndex = m_backupsuffix_cbox.AddString(cs_text); m_backupsuffix_cbox.SetItemData(nIndex, PWSprefs::BKSFX_None); m_BKSFX_to_Index[PWSprefs::BKSFX_None] = nIndex; cs_text.LoadString(IDS_DATETIMESTRING); nIndex = m_backupsuffix_cbox.AddString(cs_text); m_backupsuffix_cbox.SetItemData(nIndex, PWSprefs::BKSFX_DateTime); m_BKSFX_to_Index[PWSprefs::BKSFX_DateTime] = nIndex; cs_text.LoadString(IDS_INCREMENTNUM); nIndex = m_backupsuffix_cbox.AddString(cs_text); m_backupsuffix_cbox.SetItemData(nIndex, PWSprefs::BKSFX_IncNumber); m_BKSFX_to_Index[PWSprefs::BKSFX_IncNumber] = nIndex; } m_backupsuffix_cbox.SetCurSel(m_BKSFX_to_Index[m_BackupSuffix]); GetDlgItem(IDC_BACKUPEXAMPLE)->SetWindowText(L""); CSpinButtonCtrl* pspin = (CSpinButtonCtrl *)GetDlgItem(IDC_BKPMAXINCSPIN); pspin->SetBuddy(GetDlgItem(IDC_BACKUPMAXINC)); pspin->SetRange(1, 999); pspin->SetBase(10); pspin->SetPos(m_MaxNumIncBackups); OnComboChanged(); OnBackupBeforeSave(); InitToolTip(TTS_BALLOON | TTS_NOPREFIX, 4); // Note naming convention: string IDS_xxx corresponds to control IDC_xxx AddTool(IDC_BACKUPBEFORESAVE, IDS_BACKUPBEFORESAVE); AddTool(IDC_USERBACKUPOTHERLOCATION, IDS_USERBACKUPOTHERLOCATION); ActivateToolTip(); return TRUE; }
BOOL COptionsMisc::OnInitDialog() { COptions_PropertyPage::OnInitDialog(); for (int i = 0; i < 2; i++) { m_chkbox[i].SetTextColour(CR_DATABASE_OPTIONS); m_chkbox[i].ResetBkgColour();//Use current window's background } OnUseDefUser(); // For some reason, MFC calls us twice when initializing. // Populate the combo box only once. if (m_dblclk_cbox.GetCount() == 0) { SetupCombo(&m_dblclk_cbox); } if (m_shiftdblclk_cbox.GetCount() == 0) { SetupCombo(&m_shiftdblclk_cbox); } m_dblclk_cbox.SetCurSel(m_DCA_to_Index[m_DoubleClickAction]); m_shiftdblclk_cbox.SetCurSel(m_DCA_to_Index[m_ShiftDoubleClickAction]); GetDlgItem(IDC_OTHERBROWSERLOCATION)->SetWindowText(m_OtherBrowserLocation); GetDlgItem(IDC_OTHEREDITORLOCATION)->SetWindowText(m_OtherEditorLocation); CSpinButtonCtrl* pspin = (CSpinButtonCtrl *)GetDlgItem(IDC_DADSPIN); pspin->SetBuddy(GetDlgItem(IDC_DB_DEF_AUTOTYPE_DELAY)); pspin->SetRange32(1, 60000); pspin->SetBase(10); pspin->SetPos(m_AutotypeDelay); InitToolTip(); // Note naming convention: string IDS_xxx corresponds to control IDC_xxx AddTool(IDC_MAINTAINDATETIMESTAMPS, IDS_MAINTAINDATETIMESTAMPS); AddTool(IDC_OTHERBROWSERLOCATION, IDS_OTHERBROWSERLOCATION); AddTool(IDC_OTHEREDITORLOCATION, IDS_OTHEREDITORLOCATION); ActivateToolTip(); return TRUE; }
// Keyboard events: bool nuiKnob::KeyDown(const nglKeyEvent& rEvent) { if (IsKeyDown(mFineSensitivityKey)) { if (rEvent.mKey == NK_DOWN || rEvent.mKey == NK_LEFT) { mRange.SetValue(mRange.GetValue() - mRange.GetIncrement() / mFineSensitivityRatio); InteractiveValueChanged(); ActivateToolTip(this, true); return true; } if (rEvent.mKey == NK_UP || rEvent.mKey == NK_RIGHT) { mRange.SetValue(mRange.GetValue() + mRange.GetIncrement() / mFineSensitivityRatio); InteractiveValueChanged(); ActivateToolTip(this, true); return true; } } else { if (rEvent.mKey == NK_DOWN || rEvent.mKey == NK_LEFT) { mRange.Decrement(); InteractiveValueChanged(); ActivateToolTip(this, true); return true; } if (rEvent.mKey == NK_UP || rEvent.mKey == NK_RIGHT) { mRange.Increment(); InteractiveValueChanged(); ActivateToolTip(this, true); return true; } } if (rEvent.mKey == NK_PAGEDOWN) { mRange.PageIncrement(); InteractiveValueChanged(); ActivateToolTip(this, true); return true; } if (rEvent.mKey == NK_PAGEDOWN) { mRange.PageDecrement(); InteractiveValueChanged(); ActivateToolTip(this, true); return true; } if (rEvent.mKey == NK_HOME) { double v = mRange.GetMinimum(); mRange.SetValue(v); InteractiveValueChanged(); ActivateToolTip(this, true); return true; } if (rEvent.mKey == NK_END) { double v = mRange.GetMaximum(); mRange.SetValue(v); InteractiveValueChanged(); ActivateToolTip(this, true); return true; } return false; }
BOOL COptionsBackup::OnInitDialog() { COptions_PropertyPage::OnInitDialog(); m_chkbox.SetTextColour(CR_DATABASE_OPTIONS); m_chkbox.ResetBkgColour(); //Use current window's background if (GetMainDlg()->IsDBOpen() && !GetMainDlg()->IsDBReadOnly()) { GetDlgItem(IDC_STATIC_DB_PREFS_RO_WARNING)->ShowWindow(SW_HIDE); } // Database preferences - can't change in R/O mode of if no DB is open if (!GetMainDlg()->IsDBOpen() || GetMainDlg()->IsDBReadOnly()) { CString cs_Preference_Warning; CString cs_temp(MAKEINTRESOURCE(GetMainDlg()->IsDBOpen() ? IDS_DB_READ_ONLY : IDS_NO_DB)); cs_Preference_Warning.Format(IDS_STATIC_DB_PREFS_RO_WARNING, static_cast<LPCWSTR>(cs_temp)); GetDlgItem(IDC_STATIC_DB_PREFS_RO_WARNING)->SetWindowText(cs_Preference_Warning); GetDlgItem(IDC_SAVEIMMEDIATELY)->EnableWindow(FALSE); } if (m_backupsuffix_cbox.GetCount() == 0) { // add the strings in alphabetical order CString cs_text(MAKEINTRESOURCE(IDS_NONE)); int nIndex; nIndex = m_backupsuffix_cbox.AddString(cs_text); m_backupsuffix_cbox.SetItemData(nIndex, PWSprefs::BKSFX_None); m_BKSFX_to_Index[PWSprefs::BKSFX_None] = nIndex; cs_text.LoadString(IDS_DATETIMESTRING); nIndex = m_backupsuffix_cbox.AddString(cs_text); m_backupsuffix_cbox.SetItemData(nIndex, PWSprefs::BKSFX_DateTime); m_BKSFX_to_Index[PWSprefs::BKSFX_DateTime] = nIndex; cs_text.LoadString(IDS_INCREMENTNUM); nIndex = m_backupsuffix_cbox.AddString(cs_text); m_backupsuffix_cbox.SetItemData(nIndex, PWSprefs::BKSFX_IncNumber); m_BKSFX_to_Index[PWSprefs::BKSFX_IncNumber] = nIndex; } m_backupsuffix_cbox.SetCurSel(m_BKSFX_to_Index[m_BackupSuffix]); GetDlgItem(IDC_BACKUPEXAMPLE)->SetWindowText(L""); CSpinButtonCtrl* pspin = (CSpinButtonCtrl *)GetDlgItem(IDC_BKPMAXINCSPIN); pspin->SetBuddy(GetDlgItem(IDC_BACKUPMAXINC)); pspin->SetRange(1, 999); pspin->SetBase(10); pspin->SetPos(m_MaxNumIncBackups); OnComboChanged(); OnBackupBeforeSave(); if (m_BackupLocation == 1) { ExpandBackupPath(); } if (InitToolTip(TTS_BALLOON | TTS_NOPREFIX, 0)) { m_Help1.Init(IDB_QUESTIONMARK); m_Help2.Init(IDB_QUESTIONMARK); m_Help3.Init(IDB_QUESTIONMARK); m_Help4.Init(IDB_QUESTIONMARK); // Note naming convention: string IDS_xxx corresponds to control IDC_xxx_HELP AddTool(IDC_BACKUPBEFORESAVEHELP, IDS_BACKUPBEFORESAVE); AddTool(IDC_USERBACKUPOTHERLOCATIONHELP, IDS_USERBACKUPOTHERLOCATION); AddTool(IDC_USERBACKUPOTHERLOCATIONHELP2, IDS_USERBACKUPOTHERLOCATION2); AddTool(IDC_SAVEIMMEDIATELYHELP, IDS_SAVEIMMEDIATELY); ActivateToolTip(); } else { m_Help1.EnableWindow(FALSE); m_Help1.ShowWindow(SW_HIDE); m_Help2.EnableWindow(FALSE); m_Help2.ShowWindow(SW_HIDE); m_Help3.EnableWindow(FALSE); m_Help3.ShowWindow(SW_HIDE); m_Help4.EnableWindow(FALSE); m_Help4.ShowWindow(SW_HIDE); } return TRUE; }
BOOL COptionsSystem::OnInitDialog() { COptions_PropertyPage::OnInitDialog(); PWSprefs *prefs = PWSprefs::GetInstance(); if (!m_bShowConfigFile) { GetDlgItem(IDC_STATIC_CONFIGFILE)->ShowWindow(SW_HIDE); GetDlgItem(IDC_STATIC_RWSTATUS)->ShowWindow(SW_HIDE); GetDlgItem(IDC_CONFIGFILE)->ShowWindow(SW_HIDE); } else { PWSprefs::ConfigOption configoption; std::wstring wsCF = prefs->GetConfigFile(configoption); std::wstring wsCO(L""); switch (configoption) { case PWSprefs::CF_NONE: LoadAString(wsCF, IDS_NONE); break; case PWSprefs::CF_REGISTRY: LoadAString(wsCF, IDS_REGISTRY); break; case PWSprefs::CF_FILE_RO: LoadAString(wsCO, IDS_READ_ONLY); break; case PWSprefs::CF_FILE_RW: case PWSprefs::CF_FILE_RW_NEW: LoadAString(wsCO, IDS_READ_WRITE); break; default: ASSERT(0); } GetDlgItem(IDC_CONFIGFILE)->SetWindowText(wsCF.c_str()); GetDlgItem(IDC_STATIC_RWSTATUS)->SetWindowText(wsCO.c_str()); } bool bofferdeleteregistry = prefs->OfferDeleteRegistry(); bool boffermigrate2appdata = OfferConfigMigration(); if (!bofferdeleteregistry) { GetDlgItem(IDC_REGDEL)->ShowWindow(SW_HIDE); GetDlgItem(IDC_REGDEL)->EnableWindow(FALSE); } if (!boffermigrate2appdata) { GetDlgItem(IDC_MIGRATETOAPPDATA)->ShowWindow(SW_HIDE); GetDlgItem(IDC_MIGRATETOAPPDATA)->EnableWindow(FALSE); } if (!bofferdeleteregistry && !boffermigrate2appdata) { GetDlgItem(IDC_CONFIG_GRP)->ShowWindow(SW_HIDE); GetDlgItem(IDC_APPLYCONFIGCHANGES)->ShowWindow(SW_HIDE); } else { GetDlgItem(IDC_APPLYCONFIGCHANGES)->ShowWindow(SW_SHOW); } GetDlgItem(IDC_APPLYCONFIGCHANGES)->EnableWindow(FALSE); CSpinButtonCtrl *pspin = (CSpinButtonCtrl *)GetDlgItem(IDC_RESPIN); pspin->SetBuddy(GetDlgItem(IDC_MAXREITEMS)); pspin->SetRange(0, ID_TRAYRECENT_ENTRYMAX - ID_TRAYRECENT_ENTRY1 + 1); pspin->SetBase(10); pspin->SetPos(m_MaxREItems); pspin = (CSpinButtonCtrl *)GetDlgItem(IDC_MRUSPIN); pspin->SetBuddy(GetDlgItem(IDC_MAXMRUITEMS)); pspin->SetRange(0, ID_FILE_MRU_ENTRYMAX - ID_FILE_MRU_ENTRY1 + 1); pspin->SetBase(10); pspin->SetPos(m_MaxMRUItems); OnUseSystemTray(); InitToolTip(TTS_BALLOON | TTS_NOPREFIX, 2); AddTool(IDC_REGDEL, IDS_REGDEL); AddTool(IDC_MIGRATETOAPPDATA, IDS_MIGRATETOAPPDATA); ActivateToolTip(); return TRUE; // return TRUE unless you set the focus to a control // EXCEPTION: OCX Property Pages should return FALSE }
BOOL COptionsSystem::OnInitDialog() { COptions_PropertyPage::OnInitDialog(); PWSprefs *prefs = PWSprefs::GetInstance(); PWSprefs::ConfigOption configoption; StringX sx_CF = prefs->GetConfigFile(configoption).c_str(); std::wstring wsCO(L""); switch (configoption) { case PWSprefs::CF_NONE: LoadAString(sx_CF, IDS_NONE); break; case PWSprefs::CF_REGISTRY: LoadAString(sx_CF, IDS_REGISTRY); break; case PWSprefs::CF_FILE_RO: LoadAString(wsCO, IDS_READ_ONLY); break; case PWSprefs::CF_FILE_RW: case PWSprefs::CF_FILE_RW_NEW: LoadAString(wsCO, IDS_READ_WRITE); break; default: ASSERT(0); } CString cs_text; // R/W status GetDlgItem(IDC_STATIC_RWSTATUS)->SetWindowText(wsCO.c_str()); // Config file name & location cs_text = PWSUtil::NormalizeTTT(sx_CF, 60).c_str(); GetDlgItem(IDC_CONFIGFILE)->SetWindowText(cs_text); // Effective host & user used in config file if (configoption == PWSprefs::CF_FILE_RO || configoption == PWSprefs::CF_FILE_RW || configoption == PWSprefs::CF_FILE_RW_NEW) { stringT hn = SysInfo::GetInstance()->GetEffectiveHost(); PWSprefs::XMLify(charT('H'), hn); stringT un = SysInfo::GetInstance()->GetEffectiveUser(); PWSprefs::XMLify(charT('u'), un); cs_text.Format(IDS_HOSTUSER, static_cast<LPCWSTR>(hn.c_str()), static_cast<LPCWSTR>(un.c_str())); GetDlgItem(IDC_STATIC_HOSTUSER)->SetWindowText(cs_text); } bool bofferdeleteregistry = prefs->OfferDeleteRegistry(); bool boffermigrate2appdata = OfferConfigMigration(); if (!bofferdeleteregistry) { GetDlgItem(IDC_REGDEL)->ShowWindow(SW_HIDE); GetDlgItem(IDC_REGDEL)->EnableWindow(FALSE); } if (!boffermigrate2appdata) { GetDlgItem(IDC_MIGRATETOAPPDATA)->ShowWindow(SW_HIDE); GetDlgItem(IDC_MIGRATETOAPPDATA)->EnableWindow(FALSE); } if (!bofferdeleteregistry && !boffermigrate2appdata) { GetDlgItem(IDC_CONFIG_GRP)->ShowWindow(SW_HIDE); GetDlgItem(IDC_APPLYCONFIGCHANGES)->ShowWindow(SW_HIDE); } else { GetDlgItem(IDC_APPLYCONFIGCHANGES)->ShowWindow(SW_SHOW); } GetDlgItem(IDC_APPLYCONFIGCHANGES)->EnableWindow(FALSE); CSpinButtonCtrl *pspin = (CSpinButtonCtrl *)GetDlgItem(IDC_RESPIN); pspin->SetBuddy(GetDlgItem(IDC_MAXREITEMS)); pspin->SetRange(M_prefminREItems(), M_prefmaxREItems()); pspin->SetBase(10); pspin->SetPos(m_MaxREItems); pspin = (CSpinButtonCtrl *)GetDlgItem(IDC_MRUSPIN); pspin->SetBuddy(GetDlgItem(IDC_MAXMRUITEMS)); pspin->SetRange(M_prefminMRU(), M_prefmaxMRU()); pspin->SetBase(10); pspin->SetPos(m_MaxMRUItems); OnUseSystemTray(); if (InitToolTip(TTS_BALLOON | TTS_NOPREFIX, 0)) { m_Help1.Init(IDB_QUESTIONMARK); m_Help2.Init(IDB_QUESTIONMARK); // Note naming convention: string IDS_xxx corresponds to control IDC_xxx_HELP AddTool(IDC_REGDELHELP, IDS_REGDEL); AddTool(IDC_MIGRATETOAPPDATAHELP, IDS_MIGRATETOAPPDATA); ActivateToolTip(); } else { m_Help1.EnableWindow(FALSE); m_Help1.ShowWindow(SW_HIDE); m_Help2.EnableWindow(FALSE); m_Help2.ShowWindow(SW_HIDE); } if (!bofferdeleteregistry) { m_Help1.EnableWindow(FALSE); m_Help1.ShowWindow(SW_HIDE); } if (!boffermigrate2appdata) { m_Help2.EnableWindow(FALSE); m_Help2.ShowWindow(SW_HIDE); } return TRUE; // return TRUE unless you set the focus to a control }
BOOL COptionsMisc::OnInitDialog() { COptions_PropertyPage::OnInitDialog(); for (int i = 0; i < 2; i++) { m_chkbox[i].SetTextColour(CR_DATABASE_OPTIONS); m_chkbox[i].ResetBkgColour(); // Use current window's background } // Database preferences - can't change in R/O mode of if no DB is open if (!GetMainDlg()->IsDBOpen() || GetMainDlg()->IsDBReadOnly()) { GetDlgItem(IDC_DEFUSERNAME)->EnableWindow(FALSE); GetDlgItem(IDC_STATIC_USERNAME)->EnableWindow(FALSE); GetDlgItem(IDC_STATIC_DEFAUTOTYPE)->EnableWindow(FALSE); GetDlgItem(IDC_DB_DEF_AUTOTYPE_TEXT)->EnableWindow(FALSE); GetDlgItem(IDC_MAINTAINDATETIMESTAMPS)->EnableWindow(FALSE); GetDlgItem(IDC_USEDEFUSER)->EnableWindow(FALSE); } OnUseDefUser(); // For some reason, MFC calls us twice when initializing. // Populate the combo box only once. if (m_dblclk_cbox.GetCount() == 0) { SetupCombo(&m_dblclk_cbox); } if (m_shiftdblclk_cbox.GetCount() == 0) { SetupCombo(&m_shiftdblclk_cbox); } m_dblclk_cbox.SetCurSel(m_DCA_to_Index[m_DoubleClickAction]); m_shiftdblclk_cbox.SetCurSel(m_DCA_to_Index[m_ShiftDoubleClickAction]); GetDlgItem(IDC_OTHERBROWSERLOCATION)->SetWindowText(m_OtherBrowserLocation); GetDlgItem(IDC_OTHEREDITORLOCATION)->SetWindowText(m_OtherEditorLocation); CSpinButtonCtrl *pspin = (CSpinButtonCtrl *)GetDlgItem(IDC_DADSPIN); pspin->SetBuddy(GetDlgItem(IDC_DB_DEF_AUTOTYPE_DELAY)); pspin->SetRange32(M_prefminAutotypeDelay(), M_prefmaxAutotypeDelay()); pspin->SetBase(10); pspin->SetPos(m_AutotypeDelay); if (InitToolTip(TTS_BALLOON | TTS_NOPREFIX, 0)) { m_Help1.Init(IDB_QUESTIONMARK); m_Help2.Init(IDB_QUESTIONMARK); m_Help3.Init(IDB_QUESTIONMARK); // Note naming convention: string IDS_xxx corresponds to control IDC_xxx_HELP AddTool(IDC_MAINTAINDATETIMESTAMPSHELP, IDS_MAINTAINDATETIMESTAMPS); AddTool(IDC_OTHERBROWSERLOCATIONHELP, IDS_OTHERBROWSERLOCATION); AddTool(IDC_OTHEREDITORLOCATIONHELP, IDS_OTHEREDITORLOCATION); ActivateToolTip(); } else { m_Help1.EnableWindow(FALSE); m_Help1.ShowWindow(SW_HIDE); m_Help2.EnableWindow(FALSE); m_Help2.ShowWindow(SW_HIDE); m_Help3.EnableWindow(FALSE); m_Help3.ShowWindow(SW_HIDE); } return TRUE; // return TRUE unless you set the focus to a control }