PRIVATE HTMLHelpParseObj * net_ParseHTMLHelpInit(char *url_to_map_file, char *id) { HTMLHelpParseObj *rv = XP_NEW(HTMLHelpParseObj); if(!rv) return(NULL); XP_ASSERT(url_to_map_file && id); if(!url_to_map_file || !id) return(NULL); XP_MEMSET(rv, 0, sizeof(HTMLHelpParseObj)); rv->url_to_map_file = XP_STRDUP(url_to_map_file); rv->id = XP_STRDUP(id); rv->helpVersion = 1; rv->window_height = DEFAULT_HELP_WINDOW_HEIGHT; rv->window_width = DEFAULT_HELP_WINDOW_WIDTH; rv->frame_group_stack = XP_ListNew(); return(rv); }
/* Constructs a URL_Struct from the the specified URL to the prefetch_list based on the value of the pre subtag. */ PUBLIC void PRE_AddToList(MWContext* context, char* url, double value) { /* Construct a new URL_Struct with this url, and Prefetch priority */ URL_Struct* urls; PrefetchURLStruct *pus = XP_NEW(PrefetchURLStruct); if (!pre_enabled || !value || !pus || !pre_OKToPrefetch(url)) return; urls = NET_CreateURLStruct(url, NET_DONT_RELOAD); if (!urls) return; urls->priority = Prefetch_priority; urls->load_background = TRUE; if (prefetch_list == NULL) { prefetch_list = XP_ListNew(); } pus->prevalue = value; pus->URL_s = urls; XP_ListAddObjectToEnd(prefetch_list, pus); }
void CSlaveWindow::WindowProc(UINT uMsg, WPARAM wParam, LPARAM lParam) { if(m_pHandlers) { // Go through list of handlers, see if anyone wanted this // message. // Keep a seperate list, so callbacks can add and remove // themselves via the registration and not cause a // crash. // This also has the side effect of calling the callbacks // in the order of registration, instead of in the // reverse order. XP_List *pTraverse = m_pHandlers; XP_List *pTemp = NULL; SlaveStruct *pSlave = NULL; while(pSlave = (SlaveStruct *)XP_ListNextObject(pTraverse)) { if(pSlave->m_msg == uMsg) { if(NULL == pTemp) { pTemp = XP_ListNew(); } if(pTemp) { XP_ListAddObject(pTemp, (void *)pSlave); } } } if(pTemp) { pTraverse = pTemp; while(pSlave = (SlaveStruct *)XP_ListNextObject(pTraverse)) { // Fire. pSlave->m_swc(uMsg, wParam, lParam); } XP_ListDestroy(pTemp); pTemp = NULL; } } }
CSlaveWindow::CSlaveWindow() { m_hWnd = NULL; m_hInstance = NULL; m_pHandlers = XP_ListNew(); }
XP_List * XFE_FrameListMenu::getShownFrames() { XP_List * frame_list = XFE_MozillaApp::theApp()->getAllFrameList(); Cardinal frame_count = XP_ListCount(frame_list); XP_List * shown_frame_list = NULL; Cardinal i; // Find the shown frames and add them to a list for (i = 0; i < frame_count; i++) { // Get the next frame XFE_Frame * frame = (XFE_Frame*) XP_ListNextObject(frame_list); // Add it to list if valid and shown if (frame && XfeIsAlive(frame->getBaseWidget()) && frame->isShown()) { // Create a new list as soon as we find the first shown item if (!shown_frame_list) { shown_frame_list = XP_ListNew(); } XP_ListAddObject(shown_frame_list,frame); } } return shown_frame_list; }
/* cx_AddChildContext * Adds child context to the parents children list * NULL-safe */ void cx_AddChildContext(MWContext *parent, MWContext * child) { if ((parent == NULL) || (child == NULL)) return; if (parent->grid_children == NULL) parent->grid_children = XP_ListNew(); if (parent->grid_children == NULL) return; XP_ListAddObject(parent->grid_children, child); }
void CContentView::AddChildSizeInfo(NAVCENTPOS *pPreference) { if(m_pChildSizeInfo == NULL) { m_pChildSizeInfo = XP_ListNew(); } NAVCENTPOS *pNew = (NAVCENTPOS *)XP_ALLOC(sizeof(NAVCENTPOS)); memcpy(pNew, pPreference, sizeof(NAVCENTPOS)); XP_ListAddObject(m_pChildSizeInfo, pNew); }
/* * The passed context is added to the global context list */ void XP_AddContextToList(MWContext *context) { if (context == NULL) return; if (xp_GlobalContextList == NULL) xp_GlobalContextList = XP_ListNew(); if (xp_GlobalContextList == NULL) return; XP_ListRemoveObject(xp_GlobalContextList, context); /* No dups */ XP_ListAddObject(xp_GlobalContextList, context); cx_AddChildContext(context->grid_parent, context); }
// hacked constructor. should go away soon... XFE_MozillaApp::XFE_MozillaApp() { // only allow one XFE_MozillaApp to be created. XP_ASSERT(_app == NULL); m_frameList = XP_ListNew(); m_editorFrameList = XP_ListNew(); m_composeFrameList = XP_ListNew(); m_msgFrameList = XP_ListNew(); m_threadFrameList = XP_ListNew(); m_folderFrameList = XP_ListNew(); m_browserFrameList = XP_ListNew(); m_addressbookFrameList = XP_ListNew(); m_bookmarkFrameList = XP_ListNew(); m_mailfilterFrameList = XP_ListNew(); m_searchFrameList = XP_ListNew(); m_ldapFrameList = XP_ListNew(); m_maildownloadFrameList = XP_ListNew(); m_historyFrameList = XP_ListNew(); m_downloadFrameList = XP_ListNew(); m_htmldialogFrameList = XP_ListNew(); m_navcenterFrameList = XP_ListNew(); m_isbusy = FALSE; m_exiting = FALSE; m_exitstatus = 0; m_actioninstalled = FALSE; m_exitwindowcount = 0; fe_MNWindowCount = 0; session_frame = NULL; _app = this; theApp()->registerInterest(XFE_MozillaApp::appBusyCallback, this, (XFE_FunctionNotification)updateBusyState_cb, (void*)True); theApp()->registerInterest(XFE_MozillaApp::appNotBusyCallback, this, (XFE_FunctionNotification)updateBusyState_cb, (void*)False); }
/* * Take a block of memory formatted by HOT_ConvertSelectionsToBlock and insert * the items it represents into the hotlist following 'item'. If item is * NULL insert at the beginning of the hotlist. */ PUBLIC void HOT_InsertBlockAt(char * pOriginalBlock, HotlistStruct * item, int bLongFormat, int32 lTotalLen) { int16 sVal; /* 16-bit scratch variable */ int32 lBytesEaten = 0; /* total number of bytes eaten */ int32 lEat; /* number of bytes eaten on this item */ char * pCurrentPos; char * pBlock; HotlistStruct * pParent = HOT_GetHotlist(); if(!pOriginalBlock) return; /* make a copy of the string we can write into */ pCurrentPos = pBlock = (char *) XP_ALLOC(lTotalLen + 1); if(!pBlock) return; /* copy the data over and make sure we are NULL terminated to make life easier */ XP_MEMCPY(pBlock, pOriginalBlock, lTotalLen); pBlock[lTotalLen] = '\0'; /* * if our very first element is a header then we really want to insert * everything into the header and not after it --- I think. */ if(item && item->type == HOT_HeaderType) { pParent = item; item = NULL; /* * gack! if we are inserting under a header make sure its set up * to accept children */ if(!pParent->children) pParent->children = XP_ListNew(); } /* long format can have all kinds of different types of things in it */ if(bLongFormat) { while(lBytesEaten < lTotalLen) { /* determine the type of the next entry */ sVal = 0; XP_MEMCPY(&sVal, pCurrentPos, 2); pCurrentPos += 2; lBytesEaten += 2; switch(sVal) { case HOT_URLType: item = hot_read_URL(pCurrentPos, pParent, item, bLongFormat, &lEat); lBytesEaten += lEat; pCurrentPos += lEat; break; case HOT_HeaderType: item = hot_read_Header(pCurrentPos, pParent, item, bLongFormat, &lEat); lBytesEaten += lEat; pCurrentPos += lEat; break; case HOT_SeparatorType: item = hot_read_Separator(pCurrentPos, pParent, item, bLongFormat, &lEat); lBytesEaten += lEat; pCurrentPos += lEat; break; default: /* bogus type. Who knows whats going on. Just quit and get out */ return; break; } } } else { /* short format is just a list of URLs separated by \n's */ while(lBytesEaten < lTotalLen) { item = hot_read_URL(pCurrentPos, pParent, item, bLongFormat, &lEat); lBytesEaten += lEat; pCurrentPos += lEat; /* if we just walked over a \0 we are done */ if(pOriginalBlock[lBytesEaten - 1] == '\0') lBytesEaten = lTotalLen; } } /* mark the bookmark list as changed and clean up */ HOT_SetModified(); XP_FREE(pBlock); }
/* * Take a header and children packed in a block the way hot_write_Header * packs it. Return the new header item if we created one */ PRIVATE HotlistStruct * hot_read_Header(char * buffer, HotlistStruct * pListParent, HotlistStruct * item, int bLongFormat, int32 * lBytesEaten) { int32 kids = 0; int16 sVal; HotlistStruct * new_item = NULL; if(!buffer) return(NULL); /* can only read long format headers */ if(bLongFormat) { int32 addition; /* get the name */ char * name = buffer; char * ptr = strchr(name, '\n'); char * description = NULL; if(!ptr) return(NULL); /* skip over the \n but change it to a \0 so strcpy() will work */ *ptr++ = '\0'; /* addition date */ XP_MEMCPY(&addition, ptr, 4); ptr += 4; /* number of children to read */ XP_MEMCPY(&kids, ptr, 4); ptr += 4; /* get the description (it should be NULL terminated) */ description = ptr; /* we should really strip leading whitespace */ new_item = HOT_CreateEntry(HOT_HeaderType, name, NULL, 0, 0); new_item->addition_date = addition; new_item->description = XP_STRDUP(description); *lBytesEaten = XP_STRLEN(description) + (description - buffer) + 1; /* handle all of the kids now */ if(kids) { int i; HotlistStruct * kid = NULL; new_item->children = XP_ListNew(); buffer += *lBytesEaten; for(i = 0; i < kids; i++) { int32 lEat; /* determine the type of the next entry */ sVal = 0; XP_MEMCPY(&sVal, buffer, 2); buffer += 2; *lBytesEaten += 2; switch(sVal) { case HOT_URLType: kid = hot_read_URL(buffer, new_item, kid, bLongFormat, &lEat); *lBytesEaten += lEat; buffer += lEat; break; case HOT_HeaderType: kid = hot_read_Header(buffer, new_item, kid, bLongFormat, &lEat); *lBytesEaten += lEat; buffer += lEat; break; case HOT_SeparatorType: kid = hot_read_Separator(buffer, new_item, kid, bLongFormat, &lEat); *lBytesEaten += lEat; buffer += lEat; break; default: /* bogus type. Who knows whats going on. Just quit and get out */ break; } } } else { /* no kids */ new_item->children = NULL; } } if(item) HOT_InsertItemAfter(item, new_item); else HOT_InsertItemInHeaderOrAfterItem(pListParent, new_item); return(new_item); }