void HighscoreSaver::AddToList(string name, int score) { int count = 0; while (count < maxNum && score <= HighscoreSaver::score[count]) count++; //our score should go in score[count] //shift all from count downward by one. if (count != maxNum) { for (int i = maxNum - 1; i>count; i--) { HighscoreSaver::name[i] = HighscoreSaver::name[i - 1]; HighscoreSaver::score[i] = HighscoreSaver::score[i - 1]; } HighscoreSaver::name[count] = name; HighscoreSaver::score[count] = score; } if (numOfEntries != maxNum) numOfEntries++; newEntry = count; lowest = HighscoreSaver::score[maxNum - 1]; SaveList(); }
int Phrasing( ChewingData *pgdata ) { TreeDataType treeData; InitPhrasing( &treeData ); FindInterval( pgdata, &treeData ); SetInfo( pgdata->nPhoneSeq, &treeData ); Discard1( &treeData ); Discard2( &treeData ); SaveList( &treeData ); CountMatchCnnct( &treeData, pgdata->bUserArrCnnct, pgdata->nPhoneSeq ); SortListByScore( &treeData ); NextCut( &treeData, &pgdata->phrOut ); #ifdef ENABLE_DEBUG ShowList( &treeData ); DEBUG_FLUSH; #endif /* set phrasing output */ OutputRecordStr( pgdata, pgdata->phrOut.chiBuf, sizeof(pgdata->phrOut.chiBuf), ( treeData.phList )->arrIndex, ( treeData.phList )->nInter, pgdata->phoneSeq, pgdata->nPhoneSeq, pgdata->selectStr, pgdata->selectInterval, pgdata->nSelect, &treeData ); SaveDispInterval( &pgdata->phrOut, &treeData ); /* free "phrase" */ CleanUpMem( &treeData ); return 0; }
void ProjectDepsDlg::FillList() { wxChoice* cmb = XRCCTRL(*this, "cmbProject", wxChoice); wxCheckListBox* lst = XRCCTRL(*this, "lstDeps", wxCheckListBox); int idx = cmb->GetSelection(); if (m_LastSel != idx && m_LastSel != -1) { // save old list SaveList(); } m_LastSel = idx; if (idx == -1) return; cbProject* thisprj = static_cast<cbProject*>(cmb->GetClientData(idx)); if (!thisprj) return; const ProjectsArray* arr = Manager::Get()->GetProjectManager()->GetDependenciesForProject(thisprj); lst->Clear(); ProjectsArray* mainarr = Manager::Get()->GetProjectManager()->GetProjects(); for (size_t i = 0; i < mainarr->GetCount(); ++i) { cbProject* prj = mainarr->Item(i); if (prj == thisprj) continue; lst->Append(prj->GetTitle()); // check dependency lst->Check(lst->GetCount() - 1, arr && arr->Index(prj) != wxNOT_FOUND); } }
//You can add a friend without a IP to allow the IRC to trade links with lowID users. bool CFriendList::AddFriend(const uchar* abyUserhash, uint32 dwLastSeen, uint32 dwLastUsedIP, uint16 nLastUsedPort, uint32 dwLastChatted, LPCTSTR pszName, uint32 dwHasHash){ // client must have an IP (HighID) or a hash // TODO: check if this can be switched to a hybridID so clients with *.*.*.0 can be added.. if (IsLowID(dwLastUsedIP) && dwHasHash==0) return false; if (SearchFriend(abyUserhash, dwLastUsedIP, nLastUsedPort) != NULL) return false; CFriend* Record = new CFriend( abyUserhash, dwLastSeen, dwLastUsedIP, nLastUsedPort, dwLastChatted, pszName, dwHasHash ); m_listFriends.AddTail(Record); ShowFriends(); SaveList(); // Mighty Knife: log friend activities if (thePrefs.GetLogFriendlistActivities ()) { #ifdef MIGHTY_TWEAKS AddLogLine(false, GetResString(IDS_NEWFRIEND)+_T(" '%s', ip %i.%i.%i.%i:%i, ")+GetResString(IDS_CD_UHASH)+_T(" %s"), Record->m_strName, (uint8)Record->m_dwLastUsedIP, (uint8)(Record->m_dwLastUsedIP>>8), (uint8)(Record->m_dwLastUsedIP>>16),(uint8)(Record->m_dwLastUsedIP>>24), Record->m_nLastUsedPort, md4str(Record->m_abyUserhash)); #else AddLogLine(false, GetResString(IDS_NEWFRIEND)+_T(" '%s', ")+GetResString(IDS_CD_UHASH)+_T(" %s"), Record->m_strName, md4str(Record->m_abyUserhash)); #endif }
bool CFriendList::AddFriend(CUpDownClient* toadd){ if (toadd->IsFriend()) return false; // client must have an IP (HighID) or a hash if (toadd->HasLowID() && !toadd->HasValidHash()) return false; //>>> WiZaRd - FriendFiX POSITION pos = m_listFriends.GetHeadPosition(); while (pos){ CFriend* cur_friend = m_listFriends.GetNext(pos); if (cur_friend->m_dwHasHash){ // check for a friend which has the same userhash as the specified one if ( toadd->HasValidHash() && !md4cmp(cur_friend->m_abyUserhash, toadd->GetUserHash())) return false; } else{ if (cur_friend->m_dwLastUsedIP == toadd->GetIP() && (cur_friend->m_nLastUsedPort == toadd->GetUserPort())) return false; } } //<<< WiZaRd - FriendFiX CFriend* NewFriend = new CFriend(toadd); toadd->m_Friend = NewFriend; m_listFriends.AddTail(NewFriend); if (m_wndOutput){ m_wndOutput->AddFriend(NewFriend); m_wndOutput->UpdateList(); } SaveList(); return true; }
CFriend* CFriendList::FindFriend(const CMD4Hash& userhash, uint32 dwIP, uint16 nPort) { for(FriendList::iterator it = m_FriendList.begin(); it != m_FriendList.end(); ++it) { CFriend* cur_friend = *it; // to avoid that unwanted clients become a friend, we have to distinguish between friends with // a userhash and of friends which are identified by IP+port only. if ( !userhash.IsEmpty() && cur_friend->HasHash() ) { // check for a friend which has the same userhash as the specified one if (cur_friend->GetUserHash() == userhash) { return cur_friend; } } else if (cur_friend->GetIP() == dwIP && cur_friend->GetPort() == nPort) { if (!userhash.IsEmpty() && !cur_friend->HasHash() ) { // Friend without hash (probably IP entered through dialog) // -> save the hash cur_friend->SetUserHash(userhash); SaveList(); } return cur_friend; } } return NULL; }
void main() { int nMenu = 0; LoadList(DATA_FILE_NAME); // 메인 이벤트 반복문 while ((nMenu = PrintUI()) != 0) { switch (nMenu) { case 1: // Add Add(); break; case 2: // Search Search(); break; case 3: // Print all PrintAll(); break; case 4: // Remove Remove(); break; } } // 종료 전에 파일로 저장하고 메모리를 해제한다. SaveList(DATA_FILE_NAME); ReleaseList(); }
void CFriendList::AddFriend(CFriend* toadd, bool notify) { m_FriendList.push_back(toadd); SaveList(); if (notify) { Notify_ChatUpdateFriend(toadd); } }
//You can add a friend without a IP to allow the IRC to trade links with lowID users. bool CFriendList::AddFriend(const uchar* abyUserhash, uint32 dwLastSeen, uint32 dwLastUsedIP, uint16 nLastUsedPort, uint32 dwLastChatted, LPCTSTR pszName, uint32 dwHasHash){ // client must have an IP (HighID) or a hash // TODO: check if this can be switched to a hybridID so clients with *.*.*.0 can be added.. if (IsLowID(dwLastUsedIP) && dwHasHash==0) return false; if( dwLastUsedIP && IsAlreadyFriend(dwLastUsedIP, nLastUsedPort)) return false; CFriend* Record = new CFriend( abyUserhash, dwLastSeen, dwLastUsedIP, nLastUsedPort, dwLastChatted, pszName, dwHasHash ); m_listFriends.AddTail(Record); ShowFriends(); SaveList(); return true; }
// // The user clicked OK. // Save the user's changes to the access spec. // void CAccessDialog::OnOK() { int line_index; // Set the focus to the OK button, to force any appropriate Killfocus handler to run // (handles the case that the user modifies a control and then hits ENTER). m_BOk.SetFocus(); if (SaveList()) { // Delete all working copies of Access_Spec list items. for (line_index = 0; line_index < m_LAccess.GetItemCount(); line_index++) delete(Access_Spec *) m_LAccess.GetItemData(line_index); CDialog::OnOK(); } }
bool CFriendList::AddFriend(CUpDownClient* toadd){ if (toadd->IsFriend()) return false; // client must have an IP (HighID) or a hash if (toadd->HasLowID() && !toadd->HasValidHash()) return false; CFriend* NewFriend = new CFriend(toadd); toadd->m_Friend = NewFriend; m_listFriends.AddTail(NewFriend); if (m_wndOutput){ m_wndOutput->AddFriend(NewFriend); m_wndOutput->UpdateList(); } SaveList(); return true; }
void CFriendList::RemoveFriend(CFriend* toremove) { if (toremove) { CClientRef client = toremove->GetLinkedClient(); if (client.IsLinked()) { client.SetFriendSlot(false); client.SetFriend(NULL); toremove->UnLinkClient(); } m_FriendList.remove(toremove); SaveList(); Notify_ChatRemoveFriend(toremove); // this deletes the friend } }
/*--------------------------------------------------------------------------- CmdSaveAs ---------------------------------------------------------------------------*/ void CmdSaveAs( WNDATTR *wndattr ) { char *filename; FileDlg.cbSize = sizeof( FILEDLG ); FileDlg.fl = FDS_CENTER | FDS_SAVEAS_DIALOG | FDS_ENABLEFILELB; WinFileDlg( HWND_DESKTOP, wndattr->Client, &FileDlg ); filename = &( FileDlg.szFullFile ); if (*filename == '\0' || FileDlg.lReturn != DID_OK) return; SaveList( filename, wndattr->list, FALSE, TRUE ); return; }
void CFriendList::RemoveFriend(CFriend* todel){ POSITION pos = m_listFriends.Find(todel); if (!pos){ ASSERT ( false ); return; } todel->SetLinkedClient(NULL); if (m_wndOutput) m_wndOutput->RemoveFriend(todel); m_listFriends.RemoveAt(pos); delete todel; SaveList(); if (m_wndOutput) m_wndOutput->UpdateList(); }
int Phrasing( ChewingData *pgdata, /* FIXME: Remove other parameters since they are all in pgdata. */ PhrasingOutput *ppo, uint16_t phoneSeq[], int nPhoneSeq, char selectStr[][ MAX_PHONE_SEQ_LEN * MAX_UTF8_SIZE + 1 ], IntervalType selectInterval[], int nSelect, int bArrBrkpt[], int bUserArrCnnct[] ) { TreeDataType treeData; InitPhrasing( &treeData ); FindInterval( pgdata, phoneSeq, nPhoneSeq, selectStr, selectInterval, nSelect, bArrBrkpt, &treeData ); SetInfo( nPhoneSeq, &treeData ); Discard1( &treeData ); Discard2( &treeData ); SaveList( &treeData ); CountMatchCnnct( &treeData, bUserArrCnnct, nPhoneSeq ); SortListByScore( &treeData ); NextCut( &treeData, ppo ); #ifdef ENABLE_DEBUG ShowList( &treeData ); DEBUG_FLUSH; #endif /* set phrasing output */ OutputRecordStr( pgdata, ppo->chiBuf, sizeof(ppo->chiBuf), ( treeData.phList )->arrIndex, ( treeData.phList )->nInter, phoneSeq, nPhoneSeq, selectStr, selectInterval, nSelect, &treeData ); SaveDispInterval( ppo, &treeData ); /* free "phrase" */ CleanUpMem( &treeData ); return 0; }
//保存信息 void function(int sig){ if(sig == SIGINT){ printf("正在保存文件!\n"); SaveList("./server_usr.txt"); savedaliyList("./daily_usr.txt"); sleep(2); printf("文件保存完毕!\n"); Node *cur=head->next; clientinfo *cur1=ihead->next; sever_menu(); while(1){ int ch=0; scanf("%d",&ch); switch(ch){ case 1: server_browse(); break; case 2: while(cur!=head){ cur->state=0; //printf("u:%d\n",cur->state); cur=cur->next; } while(cur1!=ihead){ cur1->state=0; cur1=cur1->next; } DestrayList(head); DestraydailyList(dhead); DestrayinfoList(ihead); free(head); free(ihead); free(dhead); exit(0); } } } }
void CShaderPrecache::OnCommand(const char* pcCommand) { if ( !Q_stricmp( pcCommand, "addshader" ) ) { OpenFileBrowser(); return; } else if ( !Q_stricmp( pcCommand, "close" ) ) { SaveList(); pEditorRoot->m_bAutoPrecacheUpdate = m_pCheck_ReloadCache->IsSelected(); if ( pEditorRoot->ShouldAutoUpdatePrecache() ) { LoadGameShaders(); QuickRefreshEditorShader(); GetPPCache()->RefreshAllPPEMaterials(); } } BaseClass::OnCommand(pcCommand); }
int MrRipper::ProcessKey(int Key, unsigned int ControlState) { switch (ControlState) { case (PKF_CONTROL|PKF_SHIFT): if (Key==VK_F3) ConvView = (Opt.DoConv)?FALSE:TRUE; return Key==VK_F4?TRUE:FALSE; break; case (PKF_SHIFT): if (Key == VK_F4){ AddDummy(); Info.Control(INVALID_HANDLE_VALUE, FCTL_UPDATEPANEL, (void*)1); Info.Control(INVALID_HANDLE_VALUE, FCTL_REDRAWPANEL, NULL); return TRUE; } if (Key == VK_F3){ SplitFile(); Info.Control(INVALID_HANDLE_VALUE, FCTL_UPDATEPANEL, (void*)1); Info.Control(INVALID_HANDLE_VALUE, FCTL_REDRAWPANEL, NULL); return TRUE; } if (Key == VK_F1){ Opt.UseLists = !Opt.UseLists; Free_shownfiles(); Free_copyfiles(); Free_dirs(); Free_dummyfiles(); FAT.ReInitFAT(); Info.Control(INVALID_HANDLE_VALUE, FCTL_UPDATEPANEL, (void*)1); Info.Control(INVALID_HANDLE_VALUE, FCTL_REDRAWPANEL, NULL); SetRegKey(HKEY_CURRENT_USER,"",StrUseLists, Opt.UseLists); return TRUE; } if (Key == VK_F2){ SaveList(FALSE); return TRUE; } return (Key==VK_F5)|| (Key==VK_F6)|| (Key==VK_F7)|| (Key==VK_F8)?TRUE:FALSE; break; case (PKF_ALT): return (Key==VK_F6)?TRUE:FALSE; break; case (PKF_CONTROL): if (Key==VK_F9) { if (DefineRange(Opt.StartOffset, Opt.EndOffset)) { Opt.UserScanRange = TRUE; FAT.ReInitFAT(); Free_shownfiles(); Free_dirs(); Free_copyfiles(); Info.Control(INVALID_HANDLE_VALUE, FCTL_UPDATEPANEL, (void*)1); Info.Control(INVALID_HANDLE_VALUE, FCTL_REDRAWPANEL, NULL); return TRUE; } } if (Key==VK_F8) { Opt.UserScanRange = FALSE; FAT.ReInitFAT(); Free_shownfiles(); Free_dirs(); Free_copyfiles(); Info.Control(INVALID_HANDLE_VALUE, FCTL_UPDATEPANEL, (void*)1); Info.Control(INVALID_HANDLE_VALUE, FCTL_REDRAWPANEL, NULL); return TRUE; } if (Key==VK_F5) { FAT.ReInitFAT(); Free_shownfiles(); Free_copyfiles(); Free_dirs(); Info.Control(INVALID_HANDLE_VALUE, FCTL_UPDATEPANEL, (void*)1); Info.Control(INVALID_HANDLE_VALUE, FCTL_REDRAWPANEL, NULL); return TRUE; } return (Key==VK_F11)?TRUE:FALSE; break; default: if (Key==VK_F3) ConvView = (Opt.DoConv)?TRUE:FALSE; if (Key==VK_F5) ConvView = Opt.DoConv; if (Key==VK_F6) { if (bPluginManager) return SavePlugins(); } if (Key==VK_F7){ if (!bPluginManager) { DelDup = !DelDup; Info.Control(INVALID_HANDLE_VALUE, FCTL_UPDATEPANEL, (void*)1); Info.Control(INVALID_HANDLE_VALUE, FCTL_REDRAWPANEL, NULL); return TRUE; } else { CreateSheme(); return TRUE; } } if (Key==VK_F8) if (bPluginManager) { LoadSheme(); return TRUE; } return (Key==VK_F4)?TRUE:FALSE; break; } return FALSE; }
CFriendList::~CFriendList() { SaveList(); DeleteContents(m_FriendList); }
BOOL FTP::ShowFilesList(FP_SizeItemList* il) { int cn,n,i,w, num; int Breaks[] = { VK_INSERT, VK_F2, 0 }, BNumber; char str[ 500 ]; PluginPanelItem *p; FarMenuItem *mi = NULL; char *m,*nm; if(!il || !il->Count()) return FALSE; //Create|Recreate mi = (FarMenuItem *)realloc(mi,il->Count()*sizeof(FarMenuItem)); memset(mi, 0, il->Count()*sizeof(FarMenuItem)); //Scan number of items w = cn = 0; for(i = n = 0; n < il->Count(); n++) { p = il->Item(n); p->NumberOfLinks = StrSlashCount(FTP_FILENAME(p)); p->FindData.dwReserved1 = 0; w = Max(w,static_cast<int>(strlen(PointToName(FTP_FILENAME(p)))) + (int)p->NumberOfLinks + 1); cn++; MNUM(mi[i++]) = n; } w = Min(Max(60,Min(w,MSZ)),FP_ConWidth()-8); if(!cn) return FALSE; //Calc length of size and count digits int szSize = 0, szCount = 0; for(n = 0; n < cn; n++) { p = il->Item(MNUM(mi[n])); FDigit(str, ((__int64)p->FindData.nFileSizeHigh) << 32 | p->FindData.nFileSizeLow, -1); szSize = Max(static_cast<int>(strlen(str)),szSize); if(IS_FLAG(p->FindData.dwFileAttributes,FILE_ATTRIBUTE_DIRECTORY)) { FDigit(str,p->FindData.dwReserved0,-1); szCount = Max(static_cast<int>(strlen(str)),szCount); } } //Filename width w -= szSize + szCount + 6; //Set menu item text for(n = 0; n < cn; n++) { p = il->Item(MNUM(mi[n])); m = mi[n].Text; for(i = 0; i < (int)p->NumberOfLinks; i++) { *(m++) = ' '; *(m++) = ' '; } nm = PointToName(FTP_FILENAME(p)); for(i = (int)(m - mi[n].Text); i < w; i++) if(*nm) *(m++) = *(nm++); else *(m++) = ' '; *(m++) = (*nm) ? FAR_SBMENU_CHAR : ' '; if(szSize) { *(m++) = ' '; *(m++) = FAR_VERT_CHAR; *(m++) = ' '; FDigit(str, ((__int64)p->FindData.nFileSizeHigh) << 32 | p->FindData.nFileSizeLow, -1); m += sprintf(m,"%*s",szSize,str); } if(szCount) { *(m++) = ' '; *(m++) = FAR_VERT_CHAR; *(m++) = ' '; if(IS_FLAG(p->FindData.dwFileAttributes,FILE_ATTRIBUTE_DIRECTORY)) FDigit(str,p->FindData.dwReserved0,-1); else str[0] = 0; m += sprintf(m,"%*s",szCount,str); } *m = 0; } num = -1; do { //Set selected for(n = 0; n < cn; n++) mi[n].Checked = il->Items()[ MNUM(mi[n])].FindData.dwReserved1 != MAX_DWORD; //Title __int64 tsz = 0,tcn = 0; for(n = 0; n < cn; n++) { p = il->Item(MNUM(mi[n])); if(p->FindData.dwReserved1 != MAX_DWORD && !IS_FLAG(p->FindData.dwFileAttributes,FILE_ATTRIBUTE_DIRECTORY)) { tsz += ((__int64)p->FindData.nFileSizeHigh) << 32 | p->FindData.nFileSizeLow; tcn++; } } StrCpy(str,FP_GetMsg(FMSG(MListTitle)),ARRAYSIZE(str)); StrCat(str," (",ARRAYSIZE(str)); StrCat(str,FDigit(NULL,tsz,-1),ARRAYSIZE(str)); if(il->TotalFullSize != tsz) { StrCat(str,"{",ARRAYSIZE(str)); StrCat(str,FDigit(NULL,il->TotalFullSize,-1),ARRAYSIZE(str)); StrCat(str,"}",ARRAYSIZE(str)); } StrCat(str,"/",ARRAYSIZE(str)); StrCat(str,FDigit(NULL,tcn,-1),ARRAYSIZE(str)); if(tcn != il->TotalFiles) { StrCat(str,"{",ARRAYSIZE(str)); StrCat(str,FDigit(NULL,il->TotalFiles,-1),ARRAYSIZE(str)); StrCat(str,"}",ARRAYSIZE(str)); } StrCat(str,")",ARRAYSIZE(str)); //Menu n = FP_Info->Menu(FP_Info->ModuleNumber,-1,-1,0,FMENU_SHOWAMPERSAND, str, FP_GetMsg(FMSG(MListFooter)), "FTPFilesList", Breaks, &BNumber, mi,cn); //key ESC if(n == -1) { num = FALSE; break; } //key Enter if(BNumber == -1) { num = TRUE; break; } //Set selected if(num != -1) mi[num].Selected = FALSE; num = n; mi[num].Selected = TRUE; //Process keys bool set; switch(BNumber) { /*INS*/ case 0: //Current p = il->Item(MNUM(mi[num])); //Next item n = num+1; //Switch selected set = p->FindData.dwReserved1 != MAX_DWORD; p->FindData.dwReserved1 = set ? MAX_DWORD : 0; //Switch all nested if(IS_FLAG(p->FindData.dwFileAttributes,FILE_ATTRIBUTE_DIRECTORY)) { i = StrSlashCount(FTP_FILENAME(p)); for(; n < cn; n++) { p = il->Item(MNUM(mi[n])); if(StrSlashCount(FTP_FILENAME(p)) <= i) break; p->FindData.dwReserved1 = set ? MAX_DWORD : 0; } } //INS-moves-down if(n < cn) { mi[num].Selected = FALSE; mi[n].Selected = TRUE; num = n; } break; /*F2*/ case 1: SaveList(il); break; } } while(true); free(mi); if(!num) return FALSE; return TRUE; }
void CFriendList::Process() { if (::GetTickCount() - m_nLastSaved > MIN2MS(19)) SaveList(); }// MORPH START - Added by Commander, Friendlinks [emulEspaña]
static BOOL CALLBACK DlgProcTypeOptions(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) { static HANDLE hItemNew, hItemUnknown; switch (msg) { case WM_INITDIALOG: TranslateDialogDefault(hwndDlg); { CLCINFOITEM cii = { 0 }; cii.cbSize = sizeof(cii); cii.flags = CLCIIF_GROUPFONT | CLCIIF_CHECKBOX; cii.pszText = Translate("** New contacts **"); hItemNew = (HANDLE) SendDlgItemMessage(hwndDlg, IDC_CLIST, CLM_ADDINFOITEM, 0, (LPARAM) & cii); cii.pszText = Translate("** Unknown contacts **"); hItemUnknown = (HANDLE) SendDlgItemMessage(hwndDlg, IDC_CLIST, CLM_ADDINFOITEM, 0, (LPARAM) & cii); } SetWindowLong(GetDlgItem(hwndDlg, IDC_CLIST), GWL_STYLE, GetWindowLong(GetDlgItem(hwndDlg, IDC_CLIST), GWL_STYLE) | (CLS_SHOWHIDDEN) | (CLS_NOHIDEOFFLINE)); ResetCList(hwndDlg); RebuildList(hwndDlg, hItemNew, hItemUnknown); CheckDlgButton(hwndDlg, IDC_SHOWNOTIFY, DBGetContactSettingByte(NULL, SRMMMOD, SRMSGSET_SHOWTYPING, SRMSGDEFSET_SHOWTYPING)); CheckDlgButton(hwndDlg, IDC_TYPEWIN, DBGetContactSettingByte(NULL, SRMMMOD, SRMSGSET_SHOWTYPINGWIN, SRMSGDEFSET_SHOWTYPINGWIN)); CheckDlgButton(hwndDlg, IDC_TYPETRAY, DBGetContactSettingByte(NULL, SRMMMOD, SRMSGSET_SHOWTYPINGNOWIN, SRMSGDEFSET_SHOWTYPINGNOWIN)); CheckDlgButton(hwndDlg, IDC_NOTIFYTRAY, DBGetContactSettingByte(NULL, SRMMMOD, SRMSGSET_SHOWTYPINGCLIST, SRMSGDEFSET_SHOWTYPINGCLIST)); CheckDlgButton(hwndDlg, IDC_NOTIFYBALLOON, !DBGetContactSettingByte(NULL, SRMMMOD, SRMSGSET_SHOWTYPINGCLIST, SRMSGDEFSET_SHOWTYPINGCLIST)); EnableWindow(GetDlgItem(hwndDlg, IDC_TYPEWIN), IsDlgButtonChecked(hwndDlg, IDC_SHOWNOTIFY)); EnableWindow(GetDlgItem(hwndDlg, IDC_TYPETRAY), IsDlgButtonChecked(hwndDlg, IDC_SHOWNOTIFY)); EnableWindow(GetDlgItem(hwndDlg, IDC_NOTIFYTRAY), IsDlgButtonChecked(hwndDlg, IDC_TYPETRAY)); EnableWindow(GetDlgItem(hwndDlg, IDC_NOTIFYBALLOON), IsDlgButtonChecked(hwndDlg, IDC_TYPETRAY)); if (!ServiceExists(MS_CLIST_SYSTRAY_NOTIFY)) { EnableWindow(GetDlgItem(hwndDlg, IDC_NOTIFYBALLOON), FALSE); CheckDlgButton(hwndDlg, IDC_NOTIFYTRAY, BST_CHECKED); SetWindowTextA(GetDlgItem(hwndDlg, IDC_NOTIFYBALLOON), Translate("Show balloon popup (unsupported system)")); } break; case WM_COMMAND: switch (LOWORD(wParam)) { case IDC_TYPETRAY: if (IsDlgButtonChecked(hwndDlg, IDC_TYPETRAY)) { if (!ServiceExists(MS_CLIST_SYSTRAY_NOTIFY)) { EnableWindow(GetDlgItem(hwndDlg, IDC_NOTIFYTRAY), TRUE); } else { EnableWindow(GetDlgItem(hwndDlg, IDC_NOTIFYTRAY), TRUE); EnableWindow(GetDlgItem(hwndDlg, IDC_NOTIFYBALLOON), TRUE); } } else { EnableWindow(GetDlgItem(hwndDlg, IDC_NOTIFYTRAY), FALSE); EnableWindow(GetDlgItem(hwndDlg, IDC_NOTIFYBALLOON), FALSE); } SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0); break; case IDC_SHOWNOTIFY: EnableWindow(GetDlgItem(hwndDlg, IDC_TYPEWIN), IsDlgButtonChecked(hwndDlg, IDC_SHOWNOTIFY)); EnableWindow(GetDlgItem(hwndDlg, IDC_TYPETRAY), IsDlgButtonChecked(hwndDlg, IDC_SHOWNOTIFY)); EnableWindow(GetDlgItem(hwndDlg, IDC_NOTIFYTRAY), IsDlgButtonChecked(hwndDlg, IDC_SHOWNOTIFY)); EnableWindow(GetDlgItem(hwndDlg, IDC_NOTIFYBALLOON), IsDlgButtonChecked(hwndDlg, IDC_SHOWNOTIFY) && ServiceExists(MS_CLIST_SYSTRAY_NOTIFY)); //fall-thru case IDC_TYPEWIN: case IDC_NOTIFYTRAY: case IDC_NOTIFYBALLOON: SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0); break; } break; case WM_NOTIFY: switch (((NMHDR *) lParam)->idFrom) { case IDC_CLIST: switch (((NMHDR *) lParam)->code) { case CLN_OPTIONSCHANGED: ResetCList(hwndDlg); break; case CLN_CHECKCHANGED: SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0); break; } break; case 0: switch (((LPNMHDR) lParam)->code) { case PSN_APPLY: { SaveList(hwndDlg, hItemNew, hItemUnknown); DBWriteContactSettingByte(NULL, SRMMMOD, SRMSGSET_SHOWTYPING, (BYTE) IsDlgButtonChecked(hwndDlg, IDC_SHOWNOTIFY)); DBWriteContactSettingByte(NULL, SRMMMOD, SRMSGSET_SHOWTYPINGWIN, (BYTE) IsDlgButtonChecked(hwndDlg, IDC_TYPEWIN)); DBWriteContactSettingByte(NULL, SRMMMOD, SRMSGSET_SHOWTYPINGNOWIN, (BYTE) IsDlgButtonChecked(hwndDlg, IDC_TYPETRAY)); DBWriteContactSettingByte(NULL, SRMMMOD, SRMSGSET_SHOWTYPINGCLIST, (BYTE) IsDlgButtonChecked(hwndDlg, IDC_NOTIFYTRAY)); ReloadGlobals(); WindowList_Broadcast(g_dat->hMessageWindowList, DM_OPTIONSAPPLIED, 0, 0); } } break; } break; } return FALSE; }
void ProjectDepsDlg::EndModal(int retCode) { if (SaveList()) return wxScrollingDialog::EndModal(retCode); }
void DThinker::SerializeAll(FArchive &arc, bool hubLoad) { DThinker *thinker; BYTE stat; int statcount; int i; // Save lists of thinkers, but not by storing the first one and letting // the archiver catch the rest. (Which leads to buttloads of recursion // and makes the file larger.) Instead, we explicitly save each thinker // in sequence. When restoring an archive, we also have to maintain // the thinker lists here instead of relying on the archiver to do it // for us. if (arc.IsStoring()) { for (statcount = i = 0; i <= MAX_STATNUM; i++) { statcount += (!Thinkers[i].IsEmpty() || !FreshThinkers[i].IsEmpty()); } arc << statcount; for (i = 0; i <= MAX_STATNUM; i++) { if (!Thinkers[i].IsEmpty() || !FreshThinkers[i].IsEmpty()) { stat = i; arc << stat; SaveList(arc, Thinkers[i].GetHead()); SaveList(arc, FreshThinkers[i].GetHead()); thinker = NULL; arc << thinker; // Save a final NULL for this list } } } else { if (hubLoad) DestroyMostThinkers(); else DestroyAllThinkers(); // Prevent the constructor from inserting thinkers into a list. bSerialOverride = true; try { arc << statcount; while (statcount > 0) { arc << stat << thinker; while (thinker != NULL) { // This may be a player stored in their ancillary list. Remove // them first before inserting them into the new list. if (thinker->NextThinker != NULL) { thinker->Remove(); } // Thinkers with the OF_JustSpawned flag set go in the FreshThinkers // list. Anything else goes in the regular Thinkers list. if (thinker->ObjectFlags & OF_EuthanizeMe) { // This thinker was destroyed during the loading process. Do // not link it in to any list. } else if (thinker->ObjectFlags & OF_JustSpawned) { FreshThinkers[stat].AddTail(thinker); } else { Thinkers[stat].AddTail(thinker); } arc << thinker; } statcount--; } } catch (class CDoomError &err) { bSerialOverride = false; // DestroyAllThinkers cannot be called here. It will try to delete the corrupted // object table left behind by the serializer and crash. // Trying to continue is not an option here because the garbage collector will // crash the next time it runs. // Even making this a fatal error will crash but at least the message can be seen // before the crash - which is not the case with all other options. //DestroyAllThinkers(); I_FatalError("%s", err.GetMessage()); throw; } bSerialOverride = false; } }
CFriendList::~CFriendList() { SaveList(); for (POSITION pos = m_listFriends.GetHeadPosition();pos != 0;) delete m_listFriends.GetNext(pos); }
void CFriendList::Process() { if (::GetTickCount() - m_nLastSaved > MIN2MS(19)) SaveList(); }
ModelBankControl::~ModelBankControl() { SaveList(); bankList.clear(); }
void DThinker::SerializeAll(FArchive &arc, bool hubLoad) { DThinker *thinker; BYTE stat; int statcount; int i; // Save lists of thinkers, but not by storing the first one and letting // the archiver catch the rest. (Which leads to buttloads of recursion // and makes the file larger.) Instead, we explicitly save each thinker // in sequence. When restoring an archive, we also have to maintain // the thinker lists here instead of relying on the archiver to do it // for us. if (arc.IsStoring()) { for (statcount = i = 0; i <= MAX_STATNUM; i++) { statcount += (!Thinkers[i].IsEmpty() || !FreshThinkers[i].IsEmpty()); } arc << statcount; for (i = 0; i <= MAX_STATNUM; i++) { if (!Thinkers[i].IsEmpty() || !FreshThinkers[i].IsEmpty()) { stat = i; arc << stat; SaveList(arc, Thinkers[i].GetHead()); SaveList(arc, FreshThinkers[i].GetHead()); thinker = NULL; arc << thinker; // Save a final NULL for this list } } } else { if (hubLoad) DestroyMostThinkers(); else DestroyAllThinkers(); // Prevent the constructor from inserting thinkers into a list. bSerialOverride = true; try { arc << statcount; while (statcount > 0) { arc << stat << thinker; while (thinker != NULL) { // This may be a player stored in their ancillary list. Remove // them first before inserting them into the new list. if (thinker->NextThinker != NULL) { thinker->Remove(); } // Thinkers with the OF_JustSpawned flag set go in the FreshThinkers // list. Anything else goes in the regular Thinkers list. if (thinker->ObjectFlags & OF_EuthanizeMe) { // This thinker was destroyed during the loading process. Do // not link it in to any list. } else if (thinker->ObjectFlags & OF_JustSpawned) { FreshThinkers[stat].AddTail(thinker); } else { Thinkers[stat].AddTail(thinker); } arc << thinker; } statcount--; } } catch (class CDoomError &) { bSerialOverride = false; DestroyAllThinkers(); throw; } bSerialOverride = false; } }