void PDeleteInteraction::HandleDeleteKey (PlotDataBase *inXData, PlotDataBase *inYData, PlotDataSelection *inPlotDataSelection, int inIndex) {
  vector<int> theDeleteList (inPlotDataSelection->GetSelectedCount ());
  long theIndex = 0;
  for (int theI=0;theI<inYData->GetSize ();theI++) {
    if (inPlotDataSelection->IsSelected (theI)) {
      if (DeleteNotify(inIndex, theI, inXData, inYData))
      {
        theDeleteList[theIndex] = theI;
        theIndex++;
      }
    }
  }

  if (inXData->IsString())
  {
    StringPlotData *theXData = (StringPlotData*)(inXData);
    PlotData *theYData = (PlotData*)(inYData);
    Erase (theDeleteList, theXData->mRealPlotData);
    Erase (theDeleteList, theXData->mStringPlotData);
    Erase (theDeleteList, *theYData);
    Erase (theDeleteList, *inPlotDataSelection);
  }
  else
  {
    PlotData *theXData = (PlotData*)(inXData);
    PlotData *theYData = (PlotData*)(inYData);
    Erase (theDeleteList, *theXData);
    Erase (theDeleteList, *theYData);
    Erase (theDeleteList, *inPlotDataSelection);
  }
}
Пример #2
0
/*
 *  ======== NTFY_Delete ========
 *  Purpose:
 *      Free resources allocated in NTFY_Create.
 */
void NTFY_Delete(struct NTFY_OBJECT *hNtfy)
{
	struct NOTIFICATION *pNotify;

	DBC_Require(MEM_IsValidHandle(hNtfy, NTFY_SIGNATURE));

	/* Remove any elements remaining in list */
	if (hNtfy->notifyList) {

		(void) SYNC_EnterCS(hNtfy->hSync);
	
		while ((pNotify = (struct NOTIFICATION *)LST_GetHead(hNtfy->
								notifyList))) {
			DeleteNotify(pNotify);
		}
		DBC_Assert(LST_IsEmpty(hNtfy->notifyList));
		kfree(hNtfy->notifyList);

		(void) SYNC_LeaveCS(hNtfy->hSync);
	}

	
	if (hNtfy->hSync)
		(void)SYNC_DeleteCS(hNtfy->hSync);

	MEM_FreeObject(hNtfy);
}
Пример #3
0
void PhotoInfoStorage::Remove(PhotoInfoPtr photo)
{
	DeleteNotify(photo);

	CSingleLock lock(&impl_->access_ctrl_, true);

	Path path= photo->GetPhysicalPath();

	Erase(impl_->storage_, photo);

#ifdef USE_MAP
	impl_->map_.erase(path);
#endif
}
bool PDeleteInteraction::Impl_Calculate (Painter &inPainter, PPlot& inPPlot) {

  PlotDataContainer &theContainer = inPPlot.mPlotDataContainer;
  long thePlotCount = theContainer.GetPlotCount ();

  if (!DeleteNotify(-1, 0, NULL, NULL))
    return true;

  for (long theI=0;theI<thePlotCount;theI++) {
    PlotDataBase *theXData = theContainer.GetXData (theI);
    PlotDataBase *theYData = theContainer.GetYData (theI);
    DataDrawerBase *theDataDrawer = theContainer.GetDataDrawer (theI);
    PlotDataSelection *thePlotDataSelection = theContainer.GetPlotDataSelection (theI);

    if (mKeyEvent.IsDelete () ) {
      HandleDeleteKey (theXData, theYData, thePlotDataSelection, theI);
    }
  }

  DeleteNotify(-2, 0, NULL, NULL);

  return true;
}
Пример #5
0
void PhotoInfoStorage::Remove(const VectPhotoInfo& selected)
{
	DeleteNotify(selected);

	CSingleLock lock(&impl_->access_ctrl_, true);

	for (VectPhotoInfo::const_iterator it= selected.begin(); it != selected.end(); ++it)
	{
		PhotoInfoPtr photo= *it;
		Path path= photo->GetPhysicalPath();

		//TODO: this is expensive!
		Erase(impl_->storage_, photo);

#ifdef USE_MAP
		impl_->map_.erase(path);
#endif
	}
}
Пример #6
0
/*
 *  ======== NTFY_Register ========
 *  Purpose:
 *      Add a notification element to the list. If the notification is already
 *      registered, and uEventMask != 0, the notification will get posted for
 *      events specified in the new event mask. If the notification is already
 *      registered and uEventMask == 0, the notification will be unregistered.
 */
DSP_STATUS NTFY_Register(struct NTFY_OBJECT *hNtfy,
			 struct DSP_NOTIFICATION *hNotification,
			 u32 uEventMask, u32 uNotifyType)
{
	struct NOTIFICATION *pNotify;
	struct SYNC_ATTRS syncAttrs;
	DSP_STATUS status = DSP_SOK;

	DBC_Require(MEM_IsValidHandle(hNtfy, NTFY_SIGNATURE));

	if (hNotification == NULL)
		status = DSP_EHANDLE;

	/* Return DSP_ENOTIMPL if uNotifyType is not supported */
	if (DSP_SUCCEEDED(status)) {
		if (!IsValidNotifyMask(uNotifyType))
			status = DSP_ENOTIMPL;

	}

	if (DSP_FAILED(status))
		return status;

	(void)SYNC_EnterCS(hNtfy->hSync);

	pNotify = (struct NOTIFICATION *)LST_First(hNtfy->notifyList);
	while (pNotify != NULL) {
		/* If there is more than one notification type, each
		 * type may require its own handler code.  */

		if (hNotification->handle == pNotify->hSync) {
			/* found */
			break;
		}
		pNotify = (struct NOTIFICATION *)LST_Next(hNtfy->notifyList,
			  (struct list_head *)pNotify);
	}
	if (pNotify == NULL) {
		/* Not registered */
		if (uEventMask == 0) {
			status = DSP_EVALUE;
		} else {
			/* Allocate NOTIFICATION object, add to list */
			pNotify = MEM_Calloc(sizeof(struct NOTIFICATION),
					     MEM_PAGED);
			if (pNotify == NULL)
				status = DSP_EMEMORY;

		}
		if (DSP_SUCCEEDED(status)) {
			LST_InitElem((struct list_head *)pNotify);
			 /* If there is more than one notification type, each
			 * type may require its own handler code. */
			status = SYNC_OpenEvent(&pNotify->hSync, &syncAttrs);
			hNotification->handle = pNotify->hSync;

			if (DSP_SUCCEEDED(status)) {
				pNotify->uEventMask = uEventMask;
				pNotify->uNotifyType = uNotifyType;
				LST_PutTail(hNtfy->notifyList,
					   (struct list_head *)pNotify);
			} else {
				DeleteNotify(pNotify);
			}
		}
	} else {
		/* Found in list */
		if (uEventMask == 0) {
			/* Remove from list and free */
			LST_RemoveElem(hNtfy->notifyList,
				      (struct list_head *)pNotify);
			DeleteNotify(pNotify);
		} else {
			/* Update notification mask (type shouldn't change) */
			pNotify->uEventMask = uEventMask;
		}
	}
	(void)SYNC_LeaveCS(hNtfy->hSync);
	return status;
}