void PlayerWinLevel(byte w, byte l, byte isSecret) { if (!player.levelPassed[w][l]) { player.complete[w] += 100; // get some percentage points if (!isSecret) player.levelsPassed++; // secret levels aren't counted in this (it's for triggering specials) if (w == 4 && l == 6 && opt.wonGame == 0) { opt.wonGame = 1; SaveOptions(); SendMessageToGame(MSG_NEWFEATURE, 0); } } else PlayerResetScore(); // you can't get points for a level you've already passed if (opt.gotAllSecrets == 0 && PlayerGetGamePercent() > 0.999) { opt.gotAllSecrets = 1; SaveOptions(); SendMessageToGame(MSG_NEWFEATURE, 0); } player.levelPassed[w][l] = 1; }
void FarPlugin::Config() { FarDialog& dlg = Dialogs()["SetupDialog"]; dlg.ResetControls(); dlg.LoadState(options); rep: int res = dlg.Execute(); switch(res) { case 0: dlg.SaveState(options); SaveOptions(); break; case 1: KeyConfig(); goto rep; case 2: About(); goto rep; case 3: static int bn = 0; beep(bn); if (++bn > 2) { bn = 0; } goto rep; } }
void FarPlugin::Config() { FarDialog & dlg = Dialogs()[L"SetupDialog"]; dlg.ResetControls(); dlg.LoadState(options); bool Repeat = true; while (Repeat) { Repeat = false; intptr_t res = dlg.Execute(); switch (res) { case 0: dlg.SaveState(options); SaveOptions(); Repeat = false; break; case 1: KeyConfig(); break; case 2: About(); break; case 3: SoundConfig(); break; } } }
int ModulesLoaded(WPARAM wParam, LPARAM lParam) { InitUtils(); lib_cs_lock(); otr_user_state = otrl_userstate_create(); lib_cs_unlock(); // this calls ReadPrivkeyFiles (above) to set filename values (also called on ME_FOLDERS_PATH_CHANGED) InitOptions(); InitDBFilter(); InitIcons(); InitMenu(); InitSRMM(); hEventWindow = HookEvent(ME_MSG_WINDOWEVENT, WindowEvent); if (options.bHaveSecureIM && !db_get_b(0, MODULENAME, "sim_warned", 0)) { db_set_b(0, MODULENAME, "sim_warned", 1); options.default_policy = OTRL_POLICY_MANUAL_MOD; SaveOptions(); MessageBox(0, TranslateT(LANG_OTR_SECUREIM_TEXT), TranslateT(LANG_OTR_SECUREIM_TITLE), 0x30); } return 0; }
void OptionsMenu::Unload() { // Save GUI to options SaveOptions(); // Remove ALL tab sections for(int i = 0; i < m_vpGameplayComponents.size(); i++) { m_pOptionsWindow->RemoveComponent(m_vpGameplayComponents[i]); } for(int i = 0; i < m_vpGraphicsComponents.size(); i++) { m_pOptionsWindow->RemoveComponent(m_vpGraphicsComponents[i]); } for(int i = 0; i < m_vpSoundComponents.size(); i++) { m_pOptionsWindow->RemoveComponent(m_vpSoundComponents[i]); } for(int i = 0; i < m_vpControlsComponents.size(); i++) { m_pOptionsWindow->RemoveComponent(m_vpControlsComponents[i]); } for(int i = 0; i < m_vpInterfaceComponents.size(); i++) { m_pOptionsWindow->RemoveComponent(m_vpInterfaceComponents[i]); } m_pGUI->RemoveWindow(m_pOptionsWindow); m_loaded = false; }
bool GameMenu::signal_ok() { SaveOptions(); play_ok_sound(); Game::UpdateGameRules()->Start(); return true; }
int CWordPadApp::ExitInstance() { m_pszHelpFilePath = NULL; FreeLibrary(GetModuleHandle(_T("RICHED32.DLL"))); SaveOptions(); return CWinAppEx::ExitInstance(); }
void CColorsPP::OnOK() { if (m_bNeedsUpdating) { m_bSomethingChanged = TRUE; SaveOptions(); } CPropertyPage::OnOK(); }
void DialogOptions::ApplyChange() { if (SaveOptions()) { } else { } }
void DialogOptions::QuitWithChange() { if (SaveOptions()) { } else { } this->close(); }
int CWordPadApp::ExitInstance() { m_pszHelpFilePath = NULL; HMODULE h = GetModuleHandle(_T("RICHED32.DLL")); if (h != NULL) { FreeLibrary(h); } SaveOptions(); return CWinAppEx::ExitInstance(); }
static void SaveModemSetting(HWND hWnd) { int n; char string[MAX_NUM_LEN]; char ipaddr[4][4]; gOptions.ModemEnable = SendMessage(ModemWnd[0], CB_GETCURSEL, 0, 0); if (module_type != MODEM_MODULE_EM660) { memset(string, 0, sizeof(string)); GetWindowText(ModemWnd[1], string, sizeof(string)); SaveStr("APN", string, 1); } memset(string, 0, sizeof(string)); GetWindowText(ModemWnd[2], string, sizeof(string)); SaveStr("ModemDialNumber", string, 1); memset(string, 0, sizeof(string)); GetWindowText(ModemWnd[3], string, sizeof(string)); SaveStr("ModemUserName", string, 1); memset(string, 0, sizeof(string)); GetWindowText(ModemWnd[4], string, sizeof(string)); SaveStr("ModemPassword", string, 1); GetWindowText(ModemWnd[5], ipaddr[0], sizeof(ipaddr[0])); GetWindowText(ModemWnd[6], ipaddr[1], sizeof(ipaddr[1])); GetWindowText(ModemWnd[7], ipaddr[2], sizeof(ipaddr[2])); GetWindowText(ModemWnd[8], ipaddr[3], sizeof(ipaddr[3])); if (CheckIP(ipaddr[0], ipaddr[1], ipaddr[2], ipaddr[3], 1) || ((strcmp(ipaddr[0], "0")==0) && (strcmp(ipaddr[1], "0")==0) &&(strcmp(ipaddr[2], "0")==0) && (strcmp(ipaddr[3], "0")==0))) { n = sprintf(string, "%d.%d.%d.%d", atoi(ipaddr[0]), atoi(ipaddr[1]), atoi(ipaddr[2]), atoi(ipaddr[3])); string[n] = '\0'; SaveStr("HeartBeatServer", string, 1); } SaveOptions(&gOptions); reload_modem_configuration(); modem_reconnect(); if (gOptions.ModemEnable == 0) { modem_thread_exit(); } else { modem_thread_init(); } MessageBox1 (hWnd ,LoadStrByID(HID_RESTART) ,LoadStrByID(HIT_RUN),MB_OK | MB_ICONINFORMATION); }
int WeatherShutdown(WPARAM, LPARAM) { KillTimer(NULL, timerId); // kill update timer SaveOptions(); // save options once more status = ID_STATUS_OFFLINE; // set status to offline CallService(MS_NETLIB_SHUTDOWN, (WPARAM)hNetlibHttp, 0); WindowList_Broadcast(hWindowList, WM_CLOSE, 0, 0); WindowList_Broadcast(hDataWindowList, WM_CLOSE, 0, 0); SendMessage(hWndSetup, WM_CLOSE, 0, 0); return 0; }
// Displays the exporter options dialog to allow the user to change the options. bool Options::ShowDialog() { LoadOptions(); // Prompt the user with our dialogbox, and get all the options. bool doExport = DialogBoxParam(hInstance, MAKEINTRESOURCE(IDD_EXPORT_OPTIONS), mMaxInterface->GetMAXHWnd(), ExportOptionsDlgProcS, (LPARAM)this) != FALSE; if (!doExport) return false; // Save the export options to the configuration file SaveOptions(); return true; }
//UM_EVENT: void TfrmMain::UMevent(WPARAM wParam, LPARAM lParam) { //HWND hWnd = (HWND)wParam; switch (lParam) { case EVT_CaptureDone: if (!m_Screenshot) { TCHAR *err = TranslateT("Can't create a Screenshot"); MessageBox(m_hWnd,err,ERROR_TITLE,MB_OK|MB_ICONWARNING); Show(); return; } if (m_opt_chkEditor) { /* TfrmEdit *frmEdit=new TfrmEdit(this); m_bFormEdit = true; frmEdit->mniClose->Enabled = !chkJustSaveIt->Checked; frmEdit->mniCloseSend->Enabled = frmEdit->mniClose->Enabled; frmEdit->OnClose = OnCloseEditWindow; frmEdit->InitEditor(Screenshot); // Screenshot is copied to another in-memory bitmap inside this method frmEdit->Show(); delete Screenshot; // This way we can delete it after the method returns Screenshot = NULL; */ return; } else { FormClose(); } break; case EVT_SendFileDone: break; case EVT_CheckOpenAgain: if (m_opt_chkOpenAgain) { if (m_Screenshot) { FIP->FI_Unload(m_Screenshot); m_Screenshot = NULL; } /* m_hTargetWindow = */m_hLastWin = NULL; Show(); } else { // Saving Options and close SaveOptions(); Close(); } break; default: break; } }
void ReasoningKernel :: Save ( SaveLoadManager& m ) { TsProcTimer t; t.Start(); m.checkStream(); SaveHeader(m); m.checkStream(); SaveOptions(m); m.checkStream(); SaveKB(m); m.checkStream(); SaveIncremental(m); m.checkStream(); t.Stop(); std::cout << "Reasoner internal state saved in " << t << " sec" << std::endl; }
/* Release menu resources */ void TrashMenu() { TrashEmulator(); /* Save options */ SaveOptions(); /* Trash menus */ pl_menu_destroy(&SystemUiMenu.Menu); pl_menu_destroy(&OptionUiMenu.Menu); pl_menu_destroy(&ControlUiMenu.Menu); pl_menu_destroy(&SaveStateGallery.Menu); /* Trash images */ if (Background) pspImageDestroy(Background); if (NoSaveIcon) pspImageDestroy(NoSaveIcon); }
static int PhotoOptOK(HWND hWnd, HWND Item[], int Size) { int count; char c1[5]; GetWindowText(AttPhotoItemWnd[7], c1, 4); count = atoi(c1); if(count != gOptions.DelPictureCnt) { gOptions.DelPictureCnt = count; SaveOptions(&gOptions); return 1; } else { return 0; } }
//--------------------------------------------------------------------------------------------------------------------- void VAbstractTool::SaveOption(QSharedPointer<VGObject> &obj) { QDomElement oldDomElement = doc->elementById(QString().setNum(id)); if (oldDomElement.isElement()) { QDomElement newDomElement = oldDomElement.cloneNode().toElement(); SaveOptions(newDomElement, obj); SaveToolOptions *saveOptions = new SaveToolOptions(oldDomElement, newDomElement, doc, id); connect(saveOptions, &SaveToolOptions::NeedLiteParsing, doc, &VPattern::LiteParseTree); qApp->getUndoStack()->push(saveOptions); } else { qDebug()<<"Can't find tool with id ="<< id << Q_FUNC_INFO; } }
bool CPdpManager::SaveOptionsFile(const std::string& projFile) { string opt = projFile; int fileEnd = projFile.rfind('.'); if (fileEnd != -1) opt = opt.substr(0, fileEnd); opt += ".opt"; ofstream fOpts(opt.c_str()); if (!fOpts.is_open()) return false; fOpts << "<?xml version=\"1.0\" ?>\n"; fOpts << "<project>\n"; SaveOptions(fOpts); fOpts << "</project>\n"; fOpts.flush(); fOpts.close(); return true; }
static void SaveDuressParameter(HWND hWnd) { int i; int tmpvalue[5]; char tmpchar[10]; for(i=0; i<5; i++) { //Liaozz 20081008 fix bug third 6 if (gOptions.IsOnlyRFMachine && (i == 1 || i == 2)) continue; //Liaozz end if(i!=4) { tmpvalue[i] = SendMessage(EdDAM[i], CB_GETCURSEL, 0, 0); } else { memset(tmpchar,0,10); GetWindowText(EdDAM[i],tmpchar,10); tmpvalue[i] = atoi(tmpchar); } } gOptions.DuressHelpKeyOn=tmpvalue[0]; //Liaozz 20081008 fix bug third 6 if (!gOptions.IsOnlyRFMachine) { gOptions.Duress1To1=tmpvalue[1]; gOptions.Duress1ToN=tmpvalue[2]; } //Liaozz end gOptions.DuressPwd=tmpvalue[3]; gOptions.DuressAlarmDelay=tmpvalue[4]; SaveOptions(&gOptions); LoadOptions(&gOptions); }
static INT_PTR CALLBACK DlgProcOpts1(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) { switch ( msg ) { case WM_INITDIALOG: TranslateDialogDefault( hwndDlg ); SendDlgItemMessage(hwndDlg, IDC_CMB_PLACEMENT, CB_ADDSTRING, 0, (LPARAM)TranslateT("Bottom right")); SendDlgItemMessage(hwndDlg, IDC_CMB_PLACEMENT, CB_ADDSTRING, 0, (LPARAM)TranslateT("Bottom left")); SendDlgItemMessage(hwndDlg, IDC_CMB_PLACEMENT, CB_ADDSTRING, 0, (LPARAM)TranslateT("Top right")); SendDlgItemMessage(hwndDlg, IDC_CMB_PLACEMENT, CB_ADDSTRING, 0, (LPARAM)TranslateT("Top left")); SendDlgItemMessage(hwndDlg, IDC_CMB_PLACEMENT, CB_SETCURSEL, (int)options.location, 0); SendDlgItemMessage(hwndDlg, IDC_CMB_ICON, CB_ADDSTRING, 0, (LPARAM)TranslateT("Icon on left")); SendDlgItemMessage(hwndDlg, IDC_CMB_ICON, CB_ADDSTRING, 0, (LPARAM)TranslateT("Icon on right")); SendDlgItemMessage(hwndDlg, IDC_CMB_ICON, CB_SETCURSEL, (options.right_icon ? 1 : 0), 0); SendDlgItemMessage(hwndDlg, IDC_CMB_TIME, CB_ADDSTRING, 0, (LPARAM)TranslateT("No time")); SendDlgItemMessage(hwndDlg, IDC_CMB_TIME, CB_ADDSTRING, 0, (LPARAM)TranslateT("Time on left")); SendDlgItemMessage(hwndDlg, IDC_CMB_TIME, CB_ADDSTRING, 0, (LPARAM)TranslateT("Time on right")); if (ServiceExists(MS_AV_DRAWAVATAR)) SendDlgItemMessage(hwndDlg, IDC_CMB_TIME, CB_ADDSTRING, 0, (LPARAM)TranslateT("Time above avatar")); SendDlgItemMessage(hwndDlg, IDC_CMB_TIME, CB_SETCURSEL, (int)options.time_layout, 0); SendDlgItemMessage(hwndDlg, IDC_CMB_AV, CB_ADDSTRING, 0, (LPARAM)TranslateT("No avatar")); if (ServiceExists(MS_AV_DRAWAVATAR)) { SendDlgItemMessage(hwndDlg, IDC_CMB_AV, CB_ADDSTRING, 0, (LPARAM)TranslateT("Left avatar")); SendDlgItemMessage(hwndDlg, IDC_CMB_AV, CB_ADDSTRING, 0, (LPARAM)TranslateT("Right avatar")); } else { HWND hw = GetDlgItem(hwndDlg, IDC_CMB_AV); EnableWindow(hw, FALSE); hw = GetDlgItem(hwndDlg, IDC_SPIN_AVSIZE); EnableWindow(hw, FALSE); hw = GetDlgItem(hwndDlg, IDC_ED_AVSIZE); EnableWindow(hw, FALSE); } SendDlgItemMessage(hwndDlg, IDC_CMB_AV, CB_SETCURSEL, (int)options.av_layout, 0); CheckDlgButton(hwndDlg, IDC_CHK_GLOBALHOVER, options.global_hover ? TRUE : FALSE); { // initialise and fill listbox HWND hwndList = GetDlgItem(hwndDlg, IDC_LST_STATUS); ListView_DeleteAllItems(hwndList); SendMessage(hwndList,LVM_SETEXTENDEDLISTVIEWSTYLE, 0,LVS_EX_FULLROWSELECT | LVS_EX_CHECKBOXES); LVCOLUMN lvc = {0}; // Initialize the LVCOLUMN structure. // The mask specifies that the format, width, text, and // subitem members of the structure are valid. lvc.mask = LVCF_FMT | LVCF_WIDTH | LVCF_TEXT | LVCF_SUBITEM; lvc.fmt = LVCFMT_LEFT; lvc.iSubItem = 0; lvc.pszText = TranslateT("Status"); lvc.cx = 200; // width of column in pixels ListView_InsertColumn(hwndList, 0, &lvc); LVITEM lvI = {0}; // Some code to create the list-view control. // Initialize LVITEM members that are common to all // items. lvI.mask = LVIF_TEXT; int i = 0; for (; i < 10; i++) { lvI.pszText = (TCHAR*)CallService(MS_CLIST_GETSTATUSMODEDESCRIPTION, ID_STATUS_OFFLINE + i, GSMDF_TCHAR); lvI.iItem = i; ListView_InsertItem(hwndList, &lvI); ListView_SetCheckState(hwndList, i, options.disable_status[i]); } lvI.pszText = TranslateT("Full-screen app running"); lvI.iItem = i; ListView_InsertItem(hwndList, &lvI); ListView_SetCheckState(hwndList, i, options.disable_full_screen); } SendDlgItemMessage(hwndDlg, IDC_SPIN_TIMEOUT, UDM_SETRANGE, 0, (LPARAM)MAKELONG(360, 1)); SendDlgItemMessage(hwndDlg, IDC_SPIN_WIDTH, UDM_SETRANGE, 0, (LPARAM)MAKELONG(2048, 16)); SendDlgItemMessage(hwndDlg, IDC_SPIN_MAXHEIGHT, UDM_SETRANGE, 0, (LPARAM)MAKELONG(2048, 16)); SendDlgItemMessage(hwndDlg, IDC_SPIN_TRANS, UDM_SETRANGE, 0, (LPARAM)MAKELONG(100, 1)); SendDlgItemMessage(hwndDlg, IDC_SPIN_AVSIZE, UDM_SETRANGE, 0, (LPARAM)MAKELONG(100, 16)); SendDlgItemMessage(hwndDlg, IDC_SPIN_INDENT, UDM_SETRANGE, 0, (LPARAM)MAKELONG(400, 0)); SendDlgItemMessage(hwndDlg, IDC_SPIN_SBWIDTH, UDM_SETRANGE, 0, (LPARAM)MAKELONG(2048, 0)); SendDlgItemMessage(hwndDlg, IDC_SPIN_PADDING, UDM_SETRANGE, 0, (LPARAM)MAKELONG(400, 0)); if (options.default_timeout == -1) { CheckDlgButton(hwndDlg, IDC_RAD_NOTIMEOUT, TRUE); HWND hw = GetDlgItem(hwndDlg, IDC_ED_TIMEOUT); EnableWindow(hw, FALSE); SetDlgItemInt(hwndDlg, IDC_ED_TIMEOUT, 7, FALSE); } else { CheckDlgButton(hwndDlg, IDC_RAD_TIMEOUT, TRUE); SetDlgItemInt(hwndDlg, IDC_ED_TIMEOUT, options.default_timeout, FALSE); } if (options.right_icon) CheckDlgButton(hwndDlg, IDC_RAD_RIGHTICON, TRUE); else CheckDlgButton(hwndDlg, IDC_RAD_LEFTICON, TRUE); if (ServiceExists(MS_AV_DRAWAVATAR)) { switch(options.av_layout) { case PAV_NONE: CheckDlgButton(hwndDlg, IDC_RAD_NOAV, TRUE); break; case PAV_RIGHT: CheckDlgButton(hwndDlg, IDC_RAD_RIGHTAV, TRUE); break; case PAV_LEFT: CheckDlgButton(hwndDlg, IDC_RAD_LEFTAV, TRUE); break; } } else { CheckDlgButton(hwndDlg, IDC_RAD_NOAV, TRUE); HWND hw = GetDlgItem(hwndDlg, IDC_RAD_RIGHTAV); EnableWindow(hw, FALSE); hw = GetDlgItem(hwndDlg, IDC_RAD_LEFTAV); EnableWindow(hw, FALSE); } SetDlgItemInt(hwndDlg, IDC_ED_WIDTH, options.win_width, FALSE); SetDlgItemInt(hwndDlg, IDC_ED_MAXHEIGHT, options.win_max_height, FALSE); SetDlgItemInt(hwndDlg, IDC_ED_AVSIZE, options.av_size, FALSE); SetDlgItemInt(hwndDlg, IDC_ED_INDENT, options.text_indent, FALSE); SetDlgItemInt(hwndDlg, IDC_ED_SBWIDTH, options.sb_width, FALSE); SetDlgItemInt(hwndDlg, IDC_ED_PADDING, options.padding, FALSE); switch(options.location) { case PL_BOTTOMRIGHT: CheckDlgButton(hwndDlg, IDC_RAD_BOTTOMRIGHT, TRUE); break; case PL_BOTTOMLEFT: CheckDlgButton(hwndDlg, IDC_RAD_BOTTOMLEFT, TRUE); break; case PL_TOPRIGHT: CheckDlgButton(hwndDlg, IDC_RAD_TOPRIGHT, TRUE); break; case PL_TOPLEFT: CheckDlgButton(hwndDlg, IDC_RAD_TOPLEFT, TRUE); break; } SetDlgItemInt(hwndDlg, IDC_ED_TRANS, options.opacity, FALSE); CheckDlgButton(hwndDlg, IDC_CHK_BORDER, options.border); CheckDlgButton(hwndDlg, IDC_CHK_ROUNDCORNERS, options.round); CheckDlgButton(hwndDlg, IDC_CHK_ROUNDCORNERSAV, options.av_round); SendDlgItemMessage(hwndDlg, IDC_CMB_ANIMATE, CB_ADDSTRING, 0, (LPARAM)TranslateT("No animate")); SendDlgItemMessage(hwndDlg, IDC_CMB_ANIMATE, CB_ADDSTRING, 0, (LPARAM)TranslateT("Horizontal animate")); SendDlgItemMessage(hwndDlg, IDC_CMB_ANIMATE, CB_ADDSTRING, 0, (LPARAM)TranslateT("Vertical animate")); SendDlgItemMessage(hwndDlg, IDC_CMB_ANIMATE, CB_SETCURSEL, options.animate, 0); CheckDlgButton(hwndDlg, IDC_CHK_TRANSBG, options.trans_bg); return FALSE; case WM_COMMAND: if ( HIWORD(wParam) == CBN_SELCHANGE) SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0); else if ( HIWORD(wParam) == EN_CHANGE && (HWND)lParam == GetFocus()) SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0); else if ( HIWORD(wParam) == BN_CLICKED ) { if (LOWORD(wParam) == IDC_BTN_PREVIEW) ShowExamplePopups(); else { HWND hw = GetDlgItem(hwndDlg, IDC_ED_TIMEOUT); switch( LOWORD(wParam)) { case IDC_RAD_NOTIMEOUT: EnableWindow(hw, IsDlgButtonChecked(hwndDlg, IDC_RAD_TIMEOUT)); break; case IDC_RAD_TIMEOUT: EnableWindow(hw, IsDlgButtonChecked(hwndDlg, IDC_RAD_TIMEOUT)); break; } SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0); } } break; case WM_NOTIFY: if (IsWindowVisible(hwndDlg) && ((LPNMHDR) lParam)->hwndFrom == GetDlgItem(hwndDlg, IDC_LST_STATUS)) { switch (((LPNMHDR) lParam)->code) { case LVN_ITEMCHANGED: NMLISTVIEW *nmlv = (NMLISTVIEW *)lParam; if ((nmlv->uNewState ^ nmlv->uOldState) & LVIS_STATEIMAGEMASK) SendMessage( GetParent( hwndDlg ), PSM_CHANGED, 0, 0); break; } } else if (((LPNMHDR)lParam)->code == (unsigned)PSN_APPLY ) { BOOL trans; int new_val; if (IsDlgButtonChecked(hwndDlg, IDC_RAD_NOTIMEOUT)) options.default_timeout = -1; else { new_val = GetDlgItemInt(hwndDlg, IDC_ED_TIMEOUT, &trans, FALSE); if (trans) options.default_timeout = new_val; } if (options.default_timeout == 0) { SetDlgItemInt(hwndDlg, IDC_ED_TIMEOUT, options.default_timeout, FALSE); MessageBox(hwndDlg, TranslateT("You cannot set a default timeout of 0.\nValue has been reset."), TranslateT("Error"), MB_OK | MB_ICONWARNING); options.default_timeout = 7; // prevent instant timeout } new_val = GetDlgItemInt(hwndDlg, IDC_ED_WIDTH, &trans, FALSE); if (trans) options.win_width = new_val; new_val = GetDlgItemInt(hwndDlg, IDC_ED_MAXHEIGHT, &trans, FALSE); if (trans) options.win_max_height = new_val; new_val = GetDlgItemInt(hwndDlg, IDC_ED_AVSIZE, &trans, FALSE); if (trans) options.av_size = new_val; new_val = GetDlgItemInt(hwndDlg, IDC_ED_INDENT, &trans, FALSE); if (trans) options.text_indent = new_val; new_val = GetDlgItemInt(hwndDlg, IDC_ED_SBWIDTH, &trans, FALSE); if (trans) options.sb_width = new_val; new_val = GetDlgItemInt(hwndDlg, IDC_ED_PADDING, &trans, FALSE); if (trans) options.padding = new_val; options.location = (PopupLocation)SendDlgItemMessage(hwndDlg, IDC_CMB_PLACEMENT, CB_GETCURSEL, 0, 0); options.right_icon = (SendDlgItemMessage(hwndDlg, IDC_CMB_ICON, CB_GETCURSEL, 0, 0) == 1); options.av_layout = (PopupAvLayout)SendDlgItemMessage(hwndDlg, IDC_CMB_AV, CB_GETCURSEL, 0, 0); options.time_layout = (PopupTimeLayout)SendDlgItemMessage(hwndDlg, IDC_CMB_TIME, CB_GETCURSEL, 0, 0); new_val = GetDlgItemInt(hwndDlg, IDC_ED_TRANS, &trans, FALSE); if (trans) options.opacity = new_val; options.border = IsDlgButtonChecked(hwndDlg, IDC_CHK_BORDER) && IsWindowEnabled(GetDlgItem(hwndDlg, IDC_CHK_BORDER)) ? true : false; options.round = IsDlgButtonChecked(hwndDlg, IDC_CHK_ROUNDCORNERS) && IsWindowEnabled(GetDlgItem(hwndDlg, IDC_CHK_ROUNDCORNERS)) ? true : false; options.av_round = IsDlgButtonChecked(hwndDlg, IDC_CHK_ROUNDCORNERSAV) && IsWindowEnabled(GetDlgItem(hwndDlg, IDC_CHK_ROUNDCORNERSAV)) ? true : false; options.animate = SendDlgItemMessage(hwndDlg, IDC_CMB_ANIMATE, CB_GETCURSEL, 0, 0); options.trans_bg = IsDlgButtonChecked(hwndDlg, IDC_CHK_TRANSBG) ? true : false; options.global_hover = IsDlgButtonChecked(hwndDlg, IDC_CHK_GLOBALHOVER) ? true : false; int i = 0; for (; i < 10; i++) options.disable_status[i] = (ListView_GetCheckState(GetDlgItem(hwndDlg, IDC_LST_STATUS), i) == 1); options.disable_full_screen = (ListView_GetCheckState(GetDlgItem(hwndDlg, IDC_LST_STATUS), i) == 1); SaveOptions(); return TRUE; } break; } return 0; }
static INT_PTR CALLBACK DlgProcMirOTROpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) { static bool bInit = true; TCHAR *prefix; switch ( msg ) { case WM_INITDIALOG: bInit = false; TranslateDialogDefault( hwndDlg ); // set default policy radio switch(options.default_policy) { case OTRL_POLICY_OPPORTUNISTIC: CheckDlgButton(hwndDlg, IDC_RAD_OPP, BST_CHECKED); break; case OTRL_POLICY_MANUAL_MOD: CheckDlgButton(hwndDlg, IDC_RAD_MANUAL, BST_CHECKED); break; case OTRL_POLICY_ALWAYS: CheckDlgButton(hwndDlg, IDC_RAD_ALWAYS, BST_CHECKED); break; case OTRL_POLICY_NEVER: CheckDlgButton(hwndDlg, IDC_RAD_NEVER, BST_CHECKED); break; } CheckDlgButton(hwndDlg, IDC_CHK_PREFIX, options.prefix_messages ? BST_CHECKED : BST_UNCHECKED); CheckDlgButton(hwndDlg, IDC_CHK_MSGINLINE, options.msg_inline ? BST_CHECKED : BST_UNCHECKED); CheckDlgButton(hwndDlg, IDC_CHK_MSGPOPUP, options.msg_popup ? BST_CHECKED : BST_UNCHECKED); CheckDlgButton(hwndDlg, IDC_CHK_PREVENTSAVE, options.delete_history ? BST_CHECKED : BST_UNCHECKED); CheckDlgButton(hwndDlg, IDC_CHK_PREVENTSYSSAVE, options.delete_systeminfo ? BST_CHECKED : BST_UNCHECKED); CheckDlgButton(hwndDlg, IDC_CHK_AUTOSHOW_VERIFY, options.autoshow_verify ? BST_CHECKED : BST_UNCHECKED); CheckDlgButton(hwndDlg, IDC_CHK_ENDOFFLINE, options.end_offline ? BST_CHECKED : BST_UNCHECKED); CheckDlgButton(hwndDlg, IDC_CHK_ENDCLOSE, options.end_window_close ? BST_CHECKED : BST_UNCHECKED); prefix = mir_utf8decodeT(options.prefix); SetDlgItemText(hwndDlg, IDC_ED_PREFIX, prefix); mir_free(prefix); bInit = true; return FALSE; case WM_COMMAND: switch ( HIWORD( wParam )) { case BN_CLICKED: switch ( LOWORD( wParam )) { case IDC_RAD_OPP: case IDC_RAD_MANUAL: case IDC_RAD_ALWAYS: case IDC_RAD_NEVER: case IDC_CHK_PREFIX: case IDC_CHK_MSGINLINE: case IDC_CHK_MSGPOPUP: case IDC_CHK_PREVENTSAVE: case IDC_CHK_AUTOSHOW_VERIFY: case IDC_CHK_ENDOFFLINE: case IDC_CHK_ENDCLOSE: if (bInit) SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0); } break; case EN_CHANGE: if ((LOWORD( wParam ) == IDC_ED_PREFIX) && bInit) SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0); break; } break; case WM_NOTIFY: if (((LPNMHDR)lParam)->code == (UINT) PSN_APPLY ) { // handle apply if (IsDlgButtonChecked(hwndDlg, IDC_RAD_OPP)) options.default_policy = OTRL_POLICY_OPPORTUNISTIC; else if (IsDlgButtonChecked(hwndDlg, IDC_RAD_MANUAL)) options.default_policy = OTRL_POLICY_MANUAL_MOD; else if (IsDlgButtonChecked(hwndDlg, IDC_RAD_ALWAYS)) options.default_policy = OTRL_POLICY_ALWAYS; else options.default_policy = OTRL_POLICY_NEVER; options.prefix_messages = (TRUE==IsDlgButtonChecked(hwndDlg, IDC_CHK_PREFIX)); options.msg_inline = (TRUE==IsDlgButtonChecked(hwndDlg, IDC_CHK_MSGINLINE)); options.msg_popup = (TRUE==IsDlgButtonChecked(hwndDlg, IDC_CHK_MSGPOPUP)); options.delete_history = (TRUE==IsDlgButtonChecked(hwndDlg, IDC_CHK_PREVENTSAVE)); options.delete_systeminfo = (TRUE==IsDlgButtonChecked(hwndDlg, IDC_CHK_PREVENTSYSSAVE)); options.autoshow_verify = (TRUE==IsDlgButtonChecked(hwndDlg, IDC_CHK_AUTOSHOW_VERIFY)); options.end_offline = (TRUE==IsDlgButtonChecked(hwndDlg, IDC_CHK_ENDOFFLINE)); options.end_window_close = (TRUE==IsDlgButtonChecked(hwndDlg, IDC_CHK_ENDCLOSE)); prefix = (TCHAR*)_alloca(sizeof(TCHAR)*OPTIONS_PREFIXLEN); GetDlgItemText(hwndDlg, IDC_ED_PREFIX, prefix, OPTIONS_PREFIXLEN); T2Utf prefix_utf(prefix); if (!mir_strlen(prefix_utf)) { SetDlgItemTextA(hwndDlg, IDC_ED_PREFIX, OPTIONS_DEFAULT_PREFIX); mir_strncpy(options.prefix, OPTIONS_DEFAULT_PREFIX, OPTIONS_PREFIXLEN); } else mir_strncpy(options.prefix, prefix_utf, OPTIONS_PREFIXLEN); SaveOptions(); return TRUE; } break; } return FALSE; }
// main ping options static INT_PTR CALLBACK DlgProcOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) { switch ( msg ) { case WM_INITDIALOG: { TranslateDialogDefault( hwndDlg ); if(ServiceExists(MS_CLIST_FRAMES_ADDFRAME)) EnableWindow(GetDlgItem(hwndDlg, IDC_CHK_ATTACH), FALSE); CheckDlgButton(hwndDlg, IDC_CHK_ATTACH, options.attach_to_clist); SetDlgItemInt(hwndDlg, IDC_PPM, options.ping_period, FALSE); SetDlgItemInt(hwndDlg, IDC_PT, options.ping_timeout, FALSE); CheckDlgButton(hwndDlg, IDC_CHECKPOPUP, options.show_popup); CheckDlgButton(hwndDlg, IDC_CHECKPOPUP2, options.show_popup2); CheckDlgButton(hwndDlg, IDC_CHK_BLOCK, options.block_reps); CheckDlgButton(hwndDlg, IDC_CHK_LOG, options.logging); CheckDlgButton(hwndDlg, IDC_CHK_LOGCSV, options.log_csv); CheckDlgButton(hwndDlg, IDC_CHK_NOTESTICON, options.no_test_icon); SendDlgItemMessage(hwndDlg, IDC_SP_INDENT, UDM_SETRANGE, 0, (LPARAM)MAKELONG(500, 0)); SendDlgItemMessage(hwndDlg, IDC_SP_INDENT, UDM_SETPOS, 0, options.indent); SendDlgItemMessage(hwndDlg, IDC_SP_ROWHEIGHT, UDM_SETRANGE, 0, (LPARAM)MAKELONG(500, 6)); SendDlgItemMessage(hwndDlg, IDC_SP_ROWHEIGHT, UDM_SETPOS, 0, options.row_height); SetDlgItemInt(hwndDlg, IDC_RPT, options.retries, FALSE); SetDlgItemText(hwndDlg, IDC_ED_FILENAME, options.log_filename); if(!options.logging) { EnableWindow(GetDlgItem(hwndDlg, IDC_ED_FILENAME), FALSE); EnableWindow(GetDlgItem(hwndDlg, IDC_BTN_LOGBROWSE), FALSE); EnableWindow(GetDlgItem(hwndDlg, IDC_CHK_LOGCSV), FALSE); } if( !ServiceExists( MS_POPUP_ADDPOPUPT )) { EnableWindow(GetDlgItem(hwndDlg, IDC_CHECKPOPUP), FALSE); EnableWindow(GetDlgItem(hwndDlg, IDC_CHECKPOPUP2), FALSE); EnableWindow(GetDlgItem(hwndDlg, IDC_CHK_BLOCK), FALSE); } return TRUE; } case WM_COMMAND: if ( HIWORD( wParam ) == EN_CHANGE && ( HWND )lParam == GetFocus()) { switch( LOWORD( wParam )) { case IDC_PPM: case IDC_PT: case IDC_ED_FILENAME: case IDC_RPT: SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0); } break; } if (HIWORD( wParam ) == CBN_SELCHANGE) { SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0); break; } if ( HIWORD( wParam ) == BN_CLICKED ) { switch( LOWORD( wParam )) { case IDC_CHK_LOG: EnableWindow(GetDlgItem(hwndDlg, IDC_ED_FILENAME), IsDlgButtonChecked(hwndDlg, IDC_CHK_LOG)); EnableWindow(GetDlgItem(hwndDlg, IDC_BTN_LOGBROWSE), IsDlgButtonChecked(hwndDlg, IDC_CHK_LOG)); EnableWindow(GetDlgItem(hwndDlg, IDC_CHK_LOGCSV), IsDlgButtonChecked(hwndDlg, IDC_CHK_LOG)); // drop through case IDC_CHK_LOGCSV: case IDC_CHECKPOPUP: case IDC_CHECKPOPUP2: case IDC_CHK_BLOCK: case IDC_CHK_MINMAX: case IDC_CHK_NOTESTICON: case IDC_CHK_ATTACH: SendMessage( GetParent( hwndDlg ), PSM_CHANGED, 0, 0 ); break; case IDC_BTN_VIEWLOG: CallService(PLUG "/ViewLogData", 0, 0); break; case IDC_BTN_LOGBROWSE: { OPENFILENAME ofn = {0}; ofn.lStructSize = sizeof(ofn); ofn.lpstrFile = options.log_filename; ofn.hwndOwner = hwndDlg; ofn.nMaxFile = SIZEOF(options.log_filename); ofn.lpstrTitle = TranslateT("Open log file"); ofn.lpstrFilter = LPGENT("All\0*.*\0Text\0*.TXT\0"); ofn.nFilterIndex = 1; ofn.lpstrFileTitle = NULL; ofn.nMaxFileTitle = 0; ofn.lpstrInitialDir = NULL; ofn.Flags = OFN_PATHMUSTEXIST; if(GetOpenFileName(&ofn) == TRUE) { SetDlgItemText(hwndDlg, IDC_ED_FILENAME, ofn.lpstrFile); SendMessage( GetParent( hwndDlg ), PSM_CHANGED, 0, 0 ); } } break; } break; } break; case WM_NOTIFY: if (((LPNMHDR)lParam)->code == UDN_DELTAPOS ) { SendMessage( GetParent( hwndDlg ), PSM_CHANGED, 0, 0 ); } if (((LPNMHDR)lParam)->code == PSN_APPLY ) { BOOL trans_success; DWORD new_ping_period = GetDlgItemInt( hwndDlg, IDC_PPM, &trans_success, FALSE); if(trans_success) { options.ping_period = new_ping_period; } DWORD new_ping_timeout = GetDlgItemInt( hwndDlg, IDC_PT, &trans_success, FALSE); if(trans_success) { options.ping_timeout = new_ping_timeout; } options.show_popup = IsDlgButtonChecked(hwndDlg, IDC_CHECKPOPUP) == BST_CHECKED; options.show_popup2 = IsDlgButtonChecked(hwndDlg, IDC_CHECKPOPUP2) == BST_CHECKED; options.block_reps = IsDlgButtonChecked(hwndDlg, IDC_CHK_BLOCK) == BST_CHECKED; options.logging = IsDlgButtonChecked(hwndDlg, IDC_CHK_LOG) == BST_CHECKED; options.log_csv = IsDlgButtonChecked(hwndDlg, IDC_CHK_LOGCSV) == BST_CHECKED; GetDlgItemText(hwndDlg, IDC_ED_FILENAME, options.log_filename, MAX_PATH); options.no_test_icon = IsDlgButtonChecked(hwndDlg, IDC_CHK_NOTESTICON) == BST_CHECKED; options.indent = SendMessage(GetDlgItem(hwndDlg, IDC_SP_INDENT), UDM_GETPOS, 0, 0); options.row_height = SendMessage(GetDlgItem(hwndDlg, IDC_SP_ROWHEIGHT), UDM_GETPOS, 0, 0); DWORD new_retries = GetDlgItemInt( hwndDlg, IDC_RPT, &trans_success, FALSE); if(trans_success) { options.retries = new_retries; } bool new_attach = (IsDlgButtonChecked(hwndDlg, IDC_CHK_ATTACH) == BST_CHECKED); if(!ServiceExists(MS_CLIST_FRAMES_ADDFRAME) && options.attach_to_clist != new_attach) AttachToClist(new_attach); options.attach_to_clist = new_attach; SaveOptions(); RefreshWindow(0, 0); if(options.logging) CallService(PLUG "/Log", (WPARAM)_T("options changed"), 0); if(hWakeEvent) SetEvent(hWakeEvent); return TRUE; } break; } return FALSE; }
INT_PTR CALLBACK DlgProcOptions(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) { TCHAR folder_buff[MAX_PATH] = { 0 }; switch (msg) { case WM_INITDIALOG: TranslateDialogDefault(hwndDlg); memcpy(&new_options, &options, sizeof(Options)); if (ServiceExists(MS_FOLDERS_GET_PATH)) { ShowWindow(GetDlgItem(hwndDlg, IDC_ED_FOLDER), SW_HIDE); ShowWindow(GetDlgItem(hwndDlg, IDC_BUT_BROWSE), SW_HIDE); ShowWindow(GetDlgItem(hwndDlg, IDC_LNK_FOLDERS), SW_SHOW); } else { TCHAR tszTooltipText[4096]; mir_sntprintf(tszTooltipText, _countof(tszTooltipText), _T("%s - %s\n%s - %s\n%s - %s\n%s - %s\n%s - %s\n%s - %s\n%s - %s\n%s - %s\n%s - %s"), _T("%miranda_path%"), TranslateT("path to Miranda root folder"), _T("%miranda_profilesdir%"), TranslateT("path to folder containing Miranda profiles"), _T("%miranda_profilename%"), TranslateT("name of current Miranda profile (filename, without extension)"), _T("%miranda_userdata%"), TranslateT("will return parsed string %miranda_profilesdir%\\%miranda_profilename%"), _T("%appdata%"), TranslateT("same as environment variable %APPDATA% for currently logged-on Windows user"), _T("%username%"), TranslateT("username for currently logged-on Windows user"), _T("%mydocuments%"), TranslateT("\"My Documents\" folder for currently logged-on Windows user"), _T("%desktop%"), TranslateT("\"Desktop\" folder for currently logged-on Windows user"), _T("%xxxxxxx%"), TranslateT("any environment variable defined in current Windows session (like %systemroot%, %allusersprofile%, etc.)") ); hPathTip = CreateToolTip(GetDlgItem(hwndDlg, IDC_ED_FOLDER), tszTooltipText, TranslateT("Variables")); } SetDlgState(hwndDlg); SendDlgItemMessage(hwndDlg, IDC_PT, CB_ADDSTRING, 0, (LPARAM)TranslateT("days")); SendDlgItemMessage(hwndDlg, IDC_PT, CB_ADDSTRING, 0, (LPARAM)TranslateT("hours")); SendDlgItemMessage(hwndDlg, IDC_PT, CB_ADDSTRING, 0, (LPARAM)TranslateT("minutes")); switch (new_options.period_type) { case PT_DAYS: SendDlgItemMessage(hwndDlg, IDC_PT, CB_SETCURSEL, 0, 0); break; case PT_HOURS: SendDlgItemMessage(hwndDlg, IDC_PT, CB_SETCURSEL, 1, 0); break; case PT_MINUTES: SendDlgItemMessage(hwndDlg, IDC_PT, CB_SETCURSEL, 2, 0); break; } if (hPathTip) SetTimer(hwndDlg, 0, 3000, NULL); return TRUE; case WM_COMMAND: if (HIWORD(wParam) == EN_CHANGE && (HWND)lParam == GetFocus()) { switch (LOWORD(wParam)) { case IDC_ED_PERIOD: case IDC_ED_FOLDER: case IDC_ED_NUMBACKUPS: SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0); } } if (HIWORD(wParam) == CBN_SELCHANGE) SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0); if (HIWORD(wParam) == BN_CLICKED) { switch (LOWORD(wParam)) { case IDC_RAD_DISABLED: if (IsDlgButtonChecked(hwndDlg, IDC_RAD_DISABLED)) new_options.backup_types = BT_DISABLED; SetDlgState(hwndDlg); SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0); break; case IDC_RAD_START: if (IsDlgButtonChecked(hwndDlg, IDC_RAD_START)) new_options.backup_types |= BT_START; else new_options.backup_types &= ~BT_START; SetDlgState(hwndDlg); SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0); break; case IDC_RAD_EXIT: if (IsDlgButtonChecked(hwndDlg, IDC_RAD_EXIT)) new_options.backup_types |= BT_EXIT; else new_options.backup_types &= ~BT_EXIT; SetDlgState(hwndDlg); SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0); break; case IDC_RAD_PERIODIC: if (IsDlgButtonChecked(hwndDlg, IDC_RAD_PERIODIC)) new_options.backup_types |= BT_PERIODIC; else new_options.backup_types &= ~BT_PERIODIC; SetDlgState(hwndDlg); SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0); break; case IDC_BUT_BROWSE: { BROWSEINFO bi; bi.hwndOwner = hwndDlg; bi.pidlRoot = 0; bi.pszDisplayName = folder_buff; bi.lpszTitle = TranslateT("Select backup folder"); bi.ulFlags = BIF_NEWDIALOGSTYLE; bi.lpfn = BrowseProc; bi.lParam = 0; bi.iImage = 0; LPCITEMIDLIST pidl = SHBrowseForFolder(&bi); if (pidl != 0) { SHGetPathFromIDList(pidl, folder_buff); SetDlgItemText(hwndDlg, IDC_ED_FOLDER, folder_buff); SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0); CoTaskMemFree((void *)pidl); } break; } case IDC_BUT_NOW: BackupStart(NULL); break; case IDC_CHK_NOPROG: new_options.disable_progress = IsDlgButtonChecked(hwndDlg, IDC_CHK_NOPROG); SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0); break; case IDC_CHK_NOPOPUP: new_options.disable_popups = IsDlgButtonChecked(hwndDlg, IDC_CHK_NOPOPUP); SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0); break; case IDC_CHK_USEZIP: new_options.use_zip = IsDlgButtonChecked(hwndDlg, IDC_CHK_USEZIP); SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0); break; case IDC_LNK_FOLDERS: { OPENOPTIONSDIALOG ood = { 0 }; ood.cbSize = sizeof(ood); ood.pszGroup = "Customize"; ood.pszPage = "Folders"; Options_Open(&ood); break; } } } break; case WM_TIMER: if (IsWindow(hPathTip)) KillTimer(hPathTip, 4); // It will prevent tooltip autoclosing break; case WM_NOTIFY: if (((LPNMHDR)lParam)->code == PSN_APPLY) { TCHAR buff[10]; GetDlgItemText(hwndDlg, IDC_ED_PERIOD, buff, _countof(buff)); new_options.period = _ttoi(buff); GetDlgItemText(hwndDlg, IDC_ED_NUMBACKUPS, buff, _countof(buff)); new_options.num_backups = _ttoi(buff); switch (SendDlgItemMessage(hwndDlg, IDC_PT, CB_GETCURSEL, 0, 0)) { case 0: new_options.period_type = PT_DAYS; break; case 1: new_options.period_type = PT_HOURS; break; case 2: new_options.period_type = PT_MINUTES; break; } GetDlgItemText(hwndDlg, IDC_ED_FOLDER, folder_buff, _countof(folder_buff)); { TCHAR backupfolder[MAX_PATH] = { 0 }; BOOL folder_ok = TRUE; TCHAR *tmp = Utils_ReplaceVarsT(folder_buff); if (mir_tstrlen(tmp) >= 2 && tmp[1] == ':') _tcsncpy_s(backupfolder, tmp, _TRUNCATE); else mir_sntprintf(backupfolder, _countof(backupfolder), _T("%s\\%s"), profilePath, tmp); mir_free(tmp); int err = CreateDirectoryTreeT(backupfolder); if (err != ERROR_ALREADY_EXISTS && err != 0) { TCHAR msg_buff[512]; FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM, 0, err, 0, msg_buff, 512, 0); MessageBox(0, msg_buff, TranslateT("Error creating backup folder"), MB_OK | MB_ICONERROR); folder_ok = FALSE; } if (folder_ok) { _tcsncpy_s(new_options.folder, folder_buff, _TRUNCATE); memcpy(&options, &new_options, sizeof(Options)); SaveOptions(); } else { memcpy(&new_options, &options, sizeof(Options)); SetDlgState(hwndDlg); } } return TRUE; } break; case WM_DESTROY: if (hPathTip) { KillTimer(hwndDlg, 0); DestroyWindow(hPathTip); hPathTip = 0; } return FALSE; } return FALSE; }
//----------------------------------------------------------------------------- // Purpose: Saves the splitter setup for next time. //----------------------------------------------------------------------------- void CChildFrame::OnClose(void) { SaveOptions(); CFrameWnd::OnClose(); }
BOOL COptions::ParseOptionsCommand(unsigned char *pData, DWORD dwDataLength, BOOL bFromLocal /*=FALSE*/) { unsigned char *p = pData; int num = *p * 256 + p[1]; p+=2; if (num!=OPTIONS_NUM) return FALSE; int i; for (i = 0; i < num; ++i) { if ((DWORD)(p-pData)>=dwDataLength) return FALSE; int nType = *p++; if (!nType) { if ((DWORD)(p-pData+3) >= dwDataLength) return 2; int len = *p * 256 * 256 + p[1] * 256 + p[2]; p += 3; if ((DWORD)(p - pData + len) > dwDataLength) return FALSE; char *pBuffer = new char[len + 1]; memcpy(pBuffer, p, len); pBuffer[len]=0; if (!m_Options[i].bOnlyLocal || bFromLocal) //Do not change admin interface settings from remote connections SetOption(i+1, ConvFromNetwork(pBuffer), false); delete [] pBuffer; p+=len; } else if (nType == 1) { if ((DWORD)(p-pData+8)>dwDataLength) return FALSE; if (!m_Options[i].bOnlyLocal || bFromLocal) //Do not change admin interface settings from remote connections SetOption(i+1, GET64(p), false); p+=8; } else return FALSE; } SPEEDLIMITSLIST dl; SPEEDLIMITSLIST ul; if ((DWORD)(p-pData+2)>dwDataLength) return FALSE; num = *p++ << 8; num |= *p++; simple_lock lock(m_mutex); for (i=0; i<num; ++i) { CSpeedLimit limit; p = limit.ParseBuffer(p, dwDataLength - (p - pData)); if (!p) { return FALSE; } dl.push_back(limit); } if ((DWORD)(p-pData+2)>dwDataLength) { return FALSE; } num = *p++ << 8; num |= *p++; for (i=0; i<num; i++) { CSpeedLimit limit; p = limit.ParseBuffer(p, dwDataLength - (p - pData)); if (!p) { return FALSE; } ul.push_back(limit); } m_sSpeedLimits[0] = dl; m_sSpeedLimits[1] = ul; SaveOptions(); UpdateInstances(); return TRUE; }
int OnMenuItemChanged(const struct PspUiMenu *uimenu, pl_menu_item* item, const pl_menu_option* option) { if (uimenu == &ControlUiMenu) { ControlsModified = 1; ActiveConfig.ButtonMap[item->id] = (unsigned int)option->value; } else { switch(item->id) { case SYSTEM_VERT_STRIP: Options.VertStrip = (int)option->value; break; case OPTION_DISPLAY_MODE: Options.DisplayMode = (int)option->value; break; case OPTION_SYNC_FREQ: Options.UpdateFreq = (int)option->value; break; case OPTION_FRAMESKIP: Options.Frameskip = (int)option->value; break; case OPTION_VSYNC: Options.VSync = (int)option->value; break; case OPTION_CLOCK_FREQ: Options.ClockFreq = (int)option->value; break; case OPTION_SHOW_FPS: Options.ShowFps = (int)option->value; break; case OPTION_CONTROL_MODE: Options.ControlMode = (int)option->value; UiMetric.OkButton = (!(int)option->value) ? PSP_CTRL_CROSS : PSP_CTRL_CIRCLE; UiMetric.CancelButton = (!(int)option->value) ? PSP_CTRL_CIRCLE : PSP_CTRL_CROSS; break; case OPTION_ANIMATE: UiMetric.Animate = (int)option->value; break; case OPTION_AUTOFIRE: Options.AutoFire = (int)option->value; break; case OPTION_REWIND_SAVE_RATE: Options.RewindSaveRate = (int)option->value; break; case OPTION_REWIND_REPLAY_DELAY: Options.RewindReplayDelay = (int)option->value; break; } SaveOptions(); } return 1; }
HeightMap::~HeightMap() { SaveOptions(); }
// main ping options static BOOL CALLBACK DlgProcOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) { HWND hw; OPENFILENAME ofn = {0}; //char *strptr; switch ( msg ) { case WM_INITDIALOG: { TranslateDialogDefault( hwndDlg ); SetDlgItemInt(hwndDlg, IDC_PPM, options.ping_period, FALSE); SetDlgItemInt(hwndDlg, IDC_PT, options.ping_timeout, FALSE); CheckDlgButton(hwndDlg, IDC_CHECKPOPUP, options.show_popup); CheckDlgButton(hwndDlg, IDC_CHECKPOPUP2, options.show_popup2); CheckDlgButton(hwndDlg, IDC_CHK_BLOCK, options.block_reps); CheckDlgButton(hwndDlg, IDC_CHK_LOG, options.logging); CheckDlgButton(hwndDlg, IDC_CHK_NOTESTSTATUS, options.no_test_status); CheckDlgButton(hwndDlg, IDC_CHK_HIDEPROTO, options.hide_proto); CheckDlgButton(hwndDlg, IDC_CHK_USESTATUSMSG, options.use_status_msg); hw = GetDlgItem(hwndDlg, IDC_TSTATUS); EnableWindow(hw, options.no_test_status? FALSE : TRUE); /* for(int i = ID_STATUS_OFFLINE; i != ID_STATUS_OUTTOLUNCH; i++) { strptr = (char *)CallService(MS_CLIST_GETSTATUSMODEDESCRIPTION, (WPARAM)i, (LPARAM)0); hw = GetDlgItem(hwndDlg, IDC_RSTATUS); SendMessage(hw, CB_INSERTSTRING, (WPARAM)-1, (LPARAM)strptr); hw = GetDlgItem(hwndDlg, IDC_NRSTATUS); SendMessage(hw, CB_INSERTSTRING, (WPARAM)-1, (LPARAM)strptr); hw = GetDlgItem(hwndDlg, IDC_TSTATUS); SendMessage(hw, CB_INSERTSTRING, (WPARAM)-1, (LPARAM)strptr); hw = GetDlgItem(hwndDlg, IDC_DSTATUS); SendMessage(hw, CB_INSERTSTRING, (WPARAM)-1, (LPARAM)strptr); } hw = GetDlgItem(hwndDlg, IDC_RSTATUS); SendMessage(hw, CB_SETCURSEL, (WPARAM)(options.rstatus - ID_STATUS_OFFLINE), 0); hw = GetDlgItem(hwndDlg, IDC_NRSTATUS); SendMessage(hw, CB_SETCURSEL, (WPARAM)(options.nrstatus - ID_STATUS_OFFLINE), 0); hw = GetDlgItem(hwndDlg, IDC_TSTATUS); SendMessage(hw, CB_SETCURSEL, (WPARAM)(options.tstatus - ID_STATUS_OFFLINE), 0); hw = GetDlgItem(hwndDlg, IDC_DSTATUS); SendMessage(hw, CB_SETCURSEL, (WPARAM)(options.off_status - ID_STATUS_OFFLINE), 0); */ SetDlgItemInt(hwndDlg, IDC_RPT, options.retries, FALSE); SetDlgItemText(hwndDlg, IDC_ED_FILENAME, options.log_filename); if(!options.logging) { hw = GetDlgItem(hwndDlg, IDC_ED_FILENAME); EnableWindow(hw, FALSE); hw = GetDlgItem(hwndDlg, IDC_BTN_LOGBROWSE); EnableWindow(hw, FALSE); } if(!ServiceExists( MS_POPUP_ADDPOPUP )) { hw = GetDlgItem(hwndDlg, IDC_CHECKPOPUP); EnableWindow(hw, FALSE); hw = GetDlgItem(hwndDlg, IDC_CHECKPOPUP2); EnableWindow(hw, FALSE); hw = GetDlgItem(hwndDlg, IDC_CHK_BLOCK); EnableWindow(hw, FALSE); } return TRUE; } case WM_COMMAND: if ( HIWORD( wParam ) == EN_CHANGE && ( HWND )lParam == GetFocus()) { switch( LOWORD( wParam )) { case IDC_PPM: case IDC_PT: case IDC_ED_FILENAME: case IDC_RPT: SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0); } } if (HIWORD( wParam ) == CBN_SELCHANGE) { SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0); } if ( HIWORD( wParam ) == BN_CLICKED ) { switch( LOWORD( wParam )) { case IDC_CHK_LOG: hw = GetDlgItem(hwndDlg, IDC_ED_FILENAME); EnableWindow(hw, IsDlgButtonChecked(hwndDlg, IDC_CHK_LOG)); hw = GetDlgItem(hwndDlg, IDC_BTN_LOGBROWSE); EnableWindow(hw, IsDlgButtonChecked(hwndDlg, IDC_CHK_LOG)); // drop through case IDC_CHECKPOPUP: case IDC_CHECKPOPUP2: case IDC_CHK_BLOCK: case IDC_CHK_MINMAX: case IDC_CHK_HIDEPROTO: case IDC_CHK_USESTATUSMSG: SendMessage( GetParent( hwndDlg ), PSM_CHANGED, 0, 0 ); break; case IDC_BTN_VIEWLOG: CallService(PROTO "/ViewLogData", 0, 0); break; case IDC_BTN_LOGBROWSE: ofn.lStructSize = sizeof(ofn); ofn.lpstrFile = options.log_filename; ofn.hwndOwner = hwndDlg; ofn.Flags = CC_FULLOPEN; //ofn.lpstrFile[0] = '\0'; ofn.nMaxFile = sizeof(options.log_filename); ofn.lpstrFilter = "All\0*.*\0Text\0*.TXT\0"; ofn.nFilterIndex = 1; ofn.lpstrFileTitle = NULL; ofn.nMaxFileTitle = 0; ofn.lpstrInitialDir = NULL; ofn.Flags = OFN_PATHMUSTEXIST; if(GetOpenFileName(&ofn) == TRUE) { SetDlgItemText(hwndDlg, IDC_ED_FILENAME, ofn.lpstrFile); SendMessage( GetParent( hwndDlg ), PSM_CHANGED, 0, 0 ); } break; case IDC_CHK_NOTESTSTATUS: hw = GetDlgItem(hwndDlg, IDC_TSTATUS); EnableWindow(hw, IsDlgButtonChecked(hwndDlg, IDC_CHK_NOTESTSTATUS) ? FALSE : TRUE); SendMessage( GetParent( hwndDlg ), PSM_CHANGED, 0, 0 ); break; } } break; case WM_NOTIFY: if (((LPNMHDR)lParam)->code == (unsigned)PSN_APPLY ) { /* { int sel1, sel2, sel3, sel4; hw = GetDlgItem(hwndDlg, IDC_RSTATUS); sel1 = SendMessage(hw, CB_GETCURSEL, 0, 0); hw = GetDlgItem(hwndDlg, IDC_NRSTATUS); sel2 = SendMessage(hw, CB_GETCURSEL, 0, 0); hw = GetDlgItem(hwndDlg, IDC_TSTATUS); sel3 = SendMessage(hw, CB_GETCURSEL, 0, 0); hw = GetDlgItem(hwndDlg, IDC_DSTATUS); sel4 = SendMessage(hw, CB_GETCURSEL, 0, 0); if(sel1 == sel4 || sel2 == sel4 || sel3 == sel4) { MessageBox(hwndDlg, Translate("You cannot set any status to the same as 'disabled'"), Translate("Error"), MB_OK | MB_ICONWARNING); SetWindowLong(hwndDlg, DWL_MSGRESULT, PSNRET_INVALID); return TRUE; } if(sel1 != -1) options.rstatus = ID_STATUS_OFFLINE + sel1; if(sel2 != -1) options.nrstatus = ID_STATUS_OFFLINE + sel2; if(sel4 != -1) options.off_status = ID_STATUS_OFFLINE + sel4; if(sel3 != -1) options.tstatus = ID_STATUS_OFFLINE + sel3; } */ BOOL trans_success; DWORD new_ping_period = GetDlgItemInt( hwndDlg, IDC_PPM, &trans_success, FALSE); if(trans_success) { options.ping_period = new_ping_period; } DWORD new_ping_timeout = GetDlgItemInt( hwndDlg, IDC_PT, &trans_success, FALSE); if(trans_success) { options.ping_timeout = new_ping_timeout; } options.show_popup = IsDlgButtonChecked(hwndDlg, IDC_CHECKPOPUP) == BST_CHECKED; options.show_popup2 = IsDlgButtonChecked(hwndDlg, IDC_CHECKPOPUP2) == BST_CHECKED; options.block_reps = IsDlgButtonChecked(hwndDlg, IDC_CHK_BLOCK) == BST_CHECKED; options.logging = IsDlgButtonChecked(hwndDlg, IDC_CHK_LOG) == BST_CHECKED; GetDlgItemText(hwndDlg, IDC_ED_FILENAME, options.log_filename, MAX_PATH); options.no_test_status = IsDlgButtonChecked(hwndDlg, IDC_CHK_NOTESTSTATUS) == BST_CHECKED; options.hide_proto = IsDlgButtonChecked(hwndDlg, IDC_CHK_HIDEPROTO) == BST_CHECKED; options.use_status_msg = IsDlgButtonChecked(hwndDlg, IDC_CHK_USESTATUSMSG) == BST_CHECKED; DWORD new_retries = GetDlgItemInt( hwndDlg, IDC_RPT, &trans_success, FALSE); if(trans_success) { options.retries = new_retries; } SaveOptions(); if(options.use_status_msg) reset_myhandle(); if(options.logging) CallService(PROTO "/Log", (WPARAM)"options changed", 0); if(hWakeEvent) SetEvent(hWakeEvent); return TRUE; } break; } return FALSE; }