Exemplo n.º 1
0
SyncProfile::~SyncProfile()
{
  if (mUtb) {
    utb__release_sync_buffer(mUtb);
  }
  Sampler::FreePlatformData(GetPlatformData());
}
Exemplo n.º 2
0
void PlotDefC::DoCallback(int reason)
{
    static double zooms[] = {0.9091, 0.5, 0.2, 1.1, 2.0, 5.0};
    if (reason < 6)
    {
        ChangeView(zooms[reason]);
    }
    else if (reason == 6)
    {
        SetAxesFromExtents();
        SetViewFromAxes();
        ResetView();
    }
    else if (reason == 7)
    {
        ChangeView(1.0);
    }
    else
    {
        PC_Platform* currPlatform = GetPlatformData();
        if (currPlatform)
            currPlatform->CopyToClipboard(true);
        return;
    }

    if (IsSubPlot())
        masterPlot->RedrawPlot();
}
Exemplo n.º 3
0
void PlotDefC::ClearPlatformRectangle(const PC_ObjLimitRect&     rectToClear)
{
    PC_ObjLimitRect currRect = rectToClear;
    if (IsSubPlot())
    {
        currRect.Adjust(plotUOffset, masterPlot->plotVheight - (plotVOffset + plotVheight));
    }

    GetPlatformData()->ClearPlatformRectangle(currRect);
};
Exemplo n.º 4
0
void PlotDefC::DrawPlatformRectangle(const PC_ObjLimitRect&     rectToDraw,
                                           bool                 useSelectColor)
{
    PC_ObjLimitRect currRect = rectToDraw;
    if (IsSubPlot())
    {
        currRect.Adjust(plotUOffset, masterPlot->plotVheight - (plotVOffset + plotVheight));
    }

    GetPlatformData()->DrawPlatformRectangle(currRect, useSelectColor);

};
Exemplo n.º 5
0
void PlotDefC::PointerRelease(int   xpos,
                              int   ypos,
                              bool  shifted)

{
    GetPlatformData()->DisplayNormalCursor();
    if ((selectedAnno == 0) && (!rubberbandDrag))
        return;

    // clear existing
    ClearPlatformRectangle(draggedObjectRect);

    if (rubberbandDrag)
    {
        bool viewChanged = ProcessRubberbandRegion(draggedObjectRect);
        rubberbandDrag = false;
        selectedAnno = 0;
//      if (viewChanged && IsSubPlot())
//          GetMasterPlot().RedrawPlot();
        return;
    }

    //  has it moved ??
    int dx = xpos - dragStartX;
    int dy = ypos - dragStartY;
    if ((dx != 0) || (dy != 0))
    {
        int newX, newY;
        AdjustAnnoSelection(dx, dy, newX, newY);

        Point2D newULloc;
        PixelXYtoAnnoXY(newX, newY, newULloc);

        selectedAnno->UpdateULlocation(newULloc);

        // replot
        GetMasterPlot().RedrawPlot();
    }

    // clear it
    selectedAnno = 0;
}
Exemplo n.º 6
0
void PlotDefC::PointerSelect(int    xpos,
                             int    ypos,
                             bool   shifted)
{
    // cant think why this would happen ...
    if (((selectedAnno != 0) || rubberbandDrag) && (draggedObjectRect.NotNull()))
    {
        ClearPlatformRectangle(draggedObjectRect);
    }

    selectedAnno = 0;
    rubberbandDrag = false;

    for (int i = 0; i < annoObjList.Size(); i++)
    {
        AnnoObjC& currAnno = annoObjList.GetRef(i);
        if (currAnno.doPlot)
        {
            PC_ObjLimitRect& currRect = currAnno.rectLimits;
            if (currRect.NotNull()  && currRect.InRect(xpos, ypos))
            {
                // nothing selected
                if (selectedAnno == 0)
                {
                    selectedAnno = &currAnno;
                    continue;
                }

                //  already selected, see if current is better
                PC_ObjLimitRect& selRect = selectedAnno->rectLimits;

                // easy case for nested
                if (selRect.InRect(currRect.ulXpos, currRect.ulYpos) &&
                    selRect.InRect(currRect.lrXpos, currRect.lrYpos))
                {
                    selectedAnno = &currAnno;
                    continue;
                }

                //  based on distance from center to cursor when overlapping
                if (selRect.DistFromCenter(xpos, ypos) > currRect.DistFromCenter(xpos, ypos))
                    selectedAnno = &currAnno;
            }
        }
    }
    dragStartX = xpos;
    dragStartY = ypos;
    if (selectedAnno != 0)
    {
        draggedObjectRect = selectedAnno->rectLimits;
        DrawPlatformRectangle(draggedObjectRect, true);
        GetPlatformData()->DisplayGrabCursor();
    }
    else
        if (rubberbandOKrect.InRect(xpos, ypos))
        {
            draggedObjectRect = PC_ObjLimitRect();
            rubberbandDrag = true;
            GetPlatformData()->DisplayZoomCursor();
        }
}