/***** * Name: freeImageMap * Return Type: void * Description: frees the given imagemap and all areas defined for it. * In: * map: imagemap to free * Returns: * nothing *****/ static void freeImageMap(XmHTMLImageMap *map) { mapArea *area, *area_list; area_list = map->areas; while(area_list) { area = area_list->next; deleteArea(area_list); area_list = area; } if(map->name) free(map->name); free(map); map = NULL; }
static void onCutAndCopy(bool cut) { TrackViewInfo* viewInfo = getTrackViewInfo(); const int selectLeft = mini(viewInfo->selectStartTrack, viewInfo->selectStopTrack); const int selectRight = maxi(viewInfo->selectStartTrack, viewInfo->selectStopTrack); const int selectTop = mini(viewInfo->selectStartRow, viewInfo->selectStopRow); const int selectBottom = maxi(viewInfo->selectStartRow, viewInfo->selectStopRow); if (!cut) { copySelection(getRowPos(), getActiveTrack(), selectLeft, selectRight, selectTop, selectBottom); } else { copySelection(getRowPos(), getActiveTrack(), selectLeft, selectRight, selectTop, selectBottom); deleteArea(selectTop, selectLeft, s_copyData.bufferWidth, s_copyData.bufferHeight); } }
int processInventoryRdr(SaHpiSessionIdT sessionId, SaHpiResourceIdT resourceId, SaHpiRdrT * rdr, SaHpiInventoryRecT * inventoryRec) { SaErrorT status; int retval; int response; SaHpiEntryIdT AreaId, NextAreaId; SaHpiIdrAreaHeaderT Header; SaHpiIdrIdT idrId = inventoryRec->IdrId; status = saHpiIdrAreaHeaderGet(sessionId, resourceId, idrId, SAHPI_IDR_AREATYPE_UNSPECIFIED, SAHPI_FIRST_ENTRY, &NextAreaId, &Header); if (status == SA_OK) { retval = runTest(sessionId, resourceId, idrId, Header.AreaId); } else if (status == SA_ERR_HPI_NOT_PRESENT) { response = addArea(sessionId, resourceId, idrId, &AreaId); if (response != SAF_TEST_PASS) { retval = response; } else { retval = runTest(sessionId, resourceId, idrId, AreaId); deleteArea(sessionId, resourceId, idrId, AreaId); } } else { retval = SAF_TEST_UNRESOLVED; e_print(saHpiIdrAreaHeaderGet, SA_OK, status); } return retval; }
static void onPaste() { const int buffer_width = s_copyData.bufferWidth; const int buffer_height = s_copyData.bufferHeight; const int buffer_size = s_copyData.count; const int track_count = getTrackCount(); const int row_pos = getRowPos(); const int active_track = getActiveTrack(); int i, trackPos; if (!s_copyData.entries) return; // First clear the paste area deleteArea(row_pos, active_track, buffer_width, buffer_height); Commands_beginMulti("pasteArea"); for (i = 0; i < buffer_size; ++i) { const CopyEntry* ce = &s_copyData.entries[i]; trackPos = active_track + ce->track; if (trackPos < track_count) { size_t trackIndex = trackPos; struct track_key key = ce->keyFrame; key.row += row_pos; Commands_addOrUpdateKey(trackIndex, &key); } } Commands_endMulti(); updateNeedsSaving(); }
/***** * Name: _XmHTMLAddAreaToMap * Return Type: void * Description: adds the given area specification to the given imagemap * In: * map: XmHTMLImageMap * object: raw area data * Returns: * nothing *****/ void _XmHTMLAddAreaToMap(XmHTMLWidget html, XmHTMLImageMap *map, XmHTMLObject *object) { static mapArea *area; mapArea *tmp; String chPtr; /* sanity */ if(map == NULL || object->attributes == NULL) return; area = (mapArea*)malloc(sizeof(mapArea)); (void)memset(area, 0, sizeof(mapArea)); area->url = _XmHTMLTagGetValue(object->attributes, "href"); area->alt = _XmHTMLTagGetValue(object->attributes, "alt"); area->nohref = _XmHTMLTagCheck(object->attributes, "nohref"); chPtr = _XmHTMLTagGetValue(object->attributes, "shape"); /* get specified coordinates */ area->coords = getCoordinates(object->attributes, &area->ncoords); /* * No shape given, try to figure it out using the number of specified * coordinates */ if(chPtr == NULL) { switch(area->ncoords) { case 0: /* no coords given => default area */ area->shape = MAP_DEFAULT; break; case 3: /* 3 coords => circle */ area->shape = MAP_CIRCLE; break; case 4: /* 4 coords => assume rectangle */ area->shape = MAP_RECT; break; default: /* assume poly */ area->shape = MAP_POLY; } } else { switch(tolower(chPtr[0])) { case 'c': area->shape = MAP_CIRCLE; break; case 'r': area->shape = MAP_RECT; break; case 'p': area->shape = MAP_POLY; break; default: area->shape = MAP_DEFAULT; } free(chPtr); } /* check if all coordinates specs are valid for the given shape */ switch(area->shape) { case MAP_RECT: /* too bad if coords are bad */ if(area->ncoords != 4) { _XmHTMLWarning(__WFUNC__(html, "_XmHTMLAddAreaToImagemap"), XMHTML_MSG_81, area->ncoords, object->line); /* too many coordinates, drop the excessive ones */ if(area->ncoords > 4) area->ncoords = 4; else { /***** * Less than required, do a complex rescan of the * attributes (any sequence of non-digits is considered * a separator). *****/ free(area->coords); area->coords = getComplexCoordinates(object->attributes, &area->ncoords); /* too many coordinates, drop the excessive ones */ if(area->ncoords > 4) area->ncoords = 4; else { String chPtr = _XmHTMLTagGetValue(object->attributes, "coords"); _XmHTMLWarning(__WFUNC__(html, "_XmHTMLAddAreaToImagemap"), XMHTML_MSG_82, chPtr); free(chPtr); deleteArea(area); return; } } } break; case MAP_CIRCLE: /* too bad if coords are bad */ if(area->ncoords != 3) { _XmHTMLWarning(__WFUNC__(html, "_XmHTMLAddAreaToImagemap"), XMHTML_MSG_83, area->ncoords, object->line); deleteArea(area); return; } break; case MAP_POLY: if(!area->coords) { _XmHTMLWarning(__WFUNC__(html, "_XmHTMLAddAreaToImagemap"), XMHTML_MSG_84, area->ncoords, object->line); deleteArea(area); return; } if(area->ncoords % 2) { _XmHTMLWarning(__WFUNC__(html, "_XmHTMLAddAreaToImagemap"), XMHTML_MSG_85, area->ncoords, object->line); area->ncoords--; } area->region = createPoly(area->ncoords, area->coords); break; default: break; } /* gets automagically added to the list of anchors for this widget */ if(!area->nohref) area->anchor = _XmHTMLNewAnchor(html, object); /* add this area to the list of areas for this imagemap */ if(map->areas == NULL) { map->nareas = 1; map->areas = area; return; } for(tmp = map->areas; tmp != NULL && tmp->next != NULL ; tmp = tmp->next); map->nareas++; tmp->next = area; _XmHTMLDebug(10, ("map.c: _XmHTMLAddAreaToMap, stored href %s, map now " "contains %i areas.\n", area->url, map->nareas)); }
static void onDeleteKey() { deleteArea(getRowPos(), getActiveTrack(), 1, 1); }