/* PItemSet: parse and item set appending items to ilist */ static void PItemSet(ILink *ilist, char *type, HMMSet *hset) { ILink models = NULL; /* list of hmms in item set */ ILink p; PHName(&models,hset); /* parse hname and get list of models */ SkipSpaces(); if (ch == '.') { /* look for subcomponents */ ReadCh(); switch (GetKey()) { case TRANSP_KEY: AddTransP(models,ilist,type); break; case STATE_KEY: PState(models,ilist,type,hset); break; default: EdError("State or TransP expected"); } FreeItems(&models); } else { /* append just the list of models to ilist */ ChkType('h',type); p = *ilist; if (p==NULL) *ilist = models; else { while (p->next != NULL) p = p->next; p->next = models; } } }
void HisBase::DoInternalLoad(xmlNodePtr & node) { if (node!=NULL) { if (!xmlStrcmp(node->name,GetNodeName())) { string strtemp; xmlChar* prop; if (xmlHasProp(node,BAD_CAST PROP_NAME)) { prop = xmlGetProp(node,BAD_CAST PROP_NAME); name = (const char*)prop; xmlFree(prop); } if (xmlHasProp(node,BAD_CAST PROP_MODIFY_DATE)) { prop = xmlGetProp(node,BAD_CAST PROP_MODIFY_DATE); strtemp = (const char*)prop; xmlFree(prop); DateTime::TryParse(strtemp,modifyDate); } if (xmlHasProp(node,BAD_CAST PROP_CREATE_DATE)) { prop = xmlGetProp(node,BAD_CAST PROP_CREATE_DATE); strtemp = (const char*)prop; xmlFree(prop); DateTime::TryParse(strtemp,createDate); } if (xmlHasProp(node,BAD_CAST PROP_RECORDID)) { prop = xmlGetProp(node,BAD_CAST PROP_RECORDID); recordId = CUUID::Parse((const char*)prop);//Converter::stoi((const char*)prop); xmlFree(prop); } FreeItems(); xmlNodePtr cur = node->children; xmlNodePtr next; IHisBase *pitem = NULL; while(cur) { next = cur->next; pitem = factory->Create(cur); if (pitem!=NULL) { pitem->SetParent(this); pitem->Load(); items.push_back(pitem); } cur = next; } } } }
DatabaseList::~DatabaseList() { FreeItems(); }
static LONG_PTR WINAPI InfoMenuProc(HANDLE hDlg,int Msg,int Param1,LONG_PTR Param2) { InfoMenuData *DlgParams=(InfoMenuData *)Info.SendDlgMessage(hDlg,DM_GETDLGDATA,0,0); switch(Msg) { case DN_DRAGGED: return FALSE; case DN_CTLCOLORDIALOG: return Info.AdvControl(Info.ModuleNumber,ACTL_GETCOLOR,(void *)COL_MENUTEXT); case DN_CTLCOLORDLGLIST: if(Param1==0) { FarListColors *Colors=(FarListColors *)Param2; int ColorIndex[]={COL_MENUTEXT,COL_MENUTEXT,COL_MENUTITLE,COL_MENUTEXT,COL_MENUHIGHLIGHT,COL_MENUTEXT,COL_MENUSELECTEDTEXT,COL_MENUSELECTEDHIGHLIGHT,COL_MENUSCROLLBAR,COL_MENUDISABLEDTEXT}; int Count=sizeofa(ColorIndex); if(Count>Colors->ColorCount) Count=Colors->ColorCount; for(int i=0;i<Count;i++) Colors->Colors[i]=(BYTE)Info.AdvControl(Info.ModuleNumber,ACTL_GETCOLOR,(void *)(INT_PTR)(ColorIndex[i])); return TRUE; } break; case DN_INITDIALOG: { FarListTitles titles; titles.Title=(TCHAR *)GetMsg(mName); titles.TitleLen=(int)_tcslen(titles.Title); titles.Bottom=(TCHAR *)GetMsg(mInfoBottom); titles.BottomLen=(int)_tcslen(titles.Bottom); Info.SendDlgMessage(hDlg,DM_LISTSETTITLES,0,(LONG_PTR)&titles); } break; case DN_DRAWDIALOG: if(DlgParams->firsttime) { Info.SendDlgMessage(hDlg,DN_TIMER,0,0); Info.SendDlgMessage(hDlg,DN_TIMER,0,0); } break; case DN_TIMER: { HANDLE console=CreateFileW(L"CONOUT$",GENERIC_READ,FILE_SHARE_READ|FILE_SHARE_WRITE,NULL,OPEN_EXISTING,0,NULL); if(console!=INVALID_HANDLE_VALUE) { DWORD size,height=0,width=0,path_width,length; SmallInfoRec *receive; if(GetJobList(&size,&receive)||DlgParams->firsttime) { bool refresh=true; if(!DlgParams->forcerefresh) { if(DlgParams->count==size) { refresh=false; for(DWORD i=0;i<size;i++) if(DlgParams->id[i].ThreadId!=receive[i].ThreadId) { refresh=true; break; } } } if(refresh) { DWORD old_pos=0; bool restore_pos=false; if(DlgParams->count) { DWORD pos=(DWORD)Info.SendDlgMessage(hDlg,DM_LISTGETCURPOS,0,(LONG_PTR)NULL); if(pos<DlgParams->count) { old_pos=DlgParams->id[pos].ThreadId; restore_pos=true; } } free(DlgParams->id); DlgParams->id=receive; DlgParams->count=size; Info.SendDlgMessage(hDlg,DM_ENABLEREDRAW,FALSE,0); for(DWORD i=0;i<size;i++) { length=(DWORD)wcslen(receive[i].Src); if(length>width) width=length; } width+=(DWORD)_tcslen(GetMsg(mInfoCopy)); width+=(DWORD)(2*_tcslen(GetMsg(mInfoSep)))-1+4; // -1 for headers, 4 for percents length=(DWORD)_tcslen(GetMsg(mName)); if(length>width) width=length; length=(DWORD)_tcslen(GetMsg(mInfoBottom)); if(length>width) width=length; width+=12; height=size+4; { //normalize according console size COORD console_size={80,25}; #ifdef UNICODE SMALL_RECT console_rect; if(Info.AdvControl(Info.ModuleNumber,ACTL_GETFARRECT,(void*)&console_rect)) { console_size.X=console_rect.Right-console_rect.Left+1; console_size.Y=console_rect.Bottom-console_rect.Top+1; } #else CONSOLE_SCREEN_BUFFER_INFO console_info; if(GetConsoleScreenBufferInfo(console,&console_info)) { console_size=console_info.dwSize; } #endif if(width>(DWORD)(console_size.X-4)) width=console_size.X-4; if(height>(DWORD)(console_size.Y-2)) height=console_size.Y-2; } //calculate path width path_width=WidthToPathWidth(width); { //minimize listbox SMALL_RECT listbox_size={3,1,4,2}; Info.SendDlgMessage(hDlg,DM_SETITEMPOSITION,0,(LONG_PTR)&listbox_size); } { //resize and move dialog COORD dialog_size={(SHORT)width,(SHORT)height}; Info.SendDlgMessage(hDlg,DM_RESIZEDIALOG,0,(LONG_PTR)&dialog_size); COORD position={-1,-1}; Info.SendDlgMessage(hDlg,DM_MOVEDIALOG,TRUE,(LONG_PTR)&position); } { //resize listbox SMALL_RECT listbox_size={3,1,(SHORT)(width-4),(SHORT)(height-2)}; Info.SendDlgMessage(hDlg,DM_SETITEMPOSITION,0,(LONG_PTR)&listbox_size); } { //refresh listbox FarListPos new_pos={0,-1}; FarListDelete clear={0,0}; FarListItem *list_items=(FarListItem *)malloc(sizeof(FarListItem)*size); FarList list={(int)size,list_items}; if(list_items) { Info.SendDlgMessage(hDlg,DM_LISTDELETE,0,(LONG_PTR)&clear); for(DWORD i=0;i<size;i++) { UpdateItem(list_items+i,receive+i,path_width); if(restore_pos&&receive[i].ThreadId==old_pos) new_pos.SelectPos=i; } Info.SendDlgMessage(hDlg,DM_LISTADD,0,(LONG_PTR)&list); FreeItems(list_items,size); free(list_items); if(restore_pos) Info.SendDlgMessage(hDlg,DM_LISTSETCURPOS,0,(LONG_PTR)&new_pos); } } Info.SendDlgMessage(hDlg,DM_ENABLEREDRAW,TRUE,0); if(DlgParams->firsttime) { DlgParams->firsttime=false; if((PlgOpt.InfoMenu&INFO_MENU_ALT_1)&&(DlgParams->count==1)) Info.SendDlgMessage(hDlg,DM_CLOSE,-1,0); } else { DlgParams->forcerefresh=false; if((DlgParams->count==0)&&(!(PlgOpt.InfoMenu&INFO_MENU_ALT_0))) Info.SendDlgMessage(hDlg,DM_CLOSE,-1,0); } } else { SMALL_RECT in; Info.SendDlgMessage(hDlg,DM_GETDLGRECT,0,(LONG_PTR)&in); path_width=WidthToPathWidth(in.Right-in.Left+1); for(DWORD i=0;i<size;i++) { if(receive[i].pause!=DlgParams->id[i].pause||receive[i].Ask!=DlgParams->id[i].Ask||receive[i].percent!=DlgParams->id[i].percent) { FarListGetItem item; item.ItemIndex=i; Info.SendDlgMessage(hDlg,DM_LISTGETITEM,0,(LONG_PTR)&item); UpdateItem(&(item.Item),receive+i,path_width); Info.SendDlgMessage(hDlg,DM_LISTUPDATE,0,(LONG_PTR)&item); FreeItems(&(item.Item),1); } } free(DlgParams->id); DlgParams->id=receive; } } CloseHandle(console); } } break; case DN_RESIZECONSOLE: DlgParams->forcerefresh=true; Info.SendDlgMessage(hDlg,DN_TIMER,0,0); break; case DN_CLOSE: { DWORD pos=(DWORD)Info.SendDlgMessage(hDlg,DM_LISTGETCURPOS,0,0); if((Param1==0)&&(DlgParams->id)&&(pos<DlgParams->count)) { Info.SendDlgMessage(hDlg,DM_SHOWDIALOG,FALSE,0); SuspendThread(DlgParams->CommonData.Thread); ShowInfoDialog(DlgParams->id+pos); ResumeThread(DlgParams->CommonData.Thread); Info.SendDlgMessage(hDlg,DM_SHOWDIALOG,TRUE,0); Info.SendDlgMessage(hDlg,DN_ENTERIDLE,0,0); return FALSE; } else Redraw_Close(DlgParams->CommonData.Thread); } break; } return FastRedrawDefDlgProc(hDlg,Msg,Param1,Param2); }
RegFolderCache::~RegFolderCache() { FreeItems(); }
HisBase::~HisBase() { FreeItems(); xmlUnlinkNode(node); xmlFreeNode(node); }