Esempio n. 1
0
bool LfpDisplayCanvas::checkBounds(int chan)
{
    bool isVisible;

    int lowerBound = (chan+1)*(interplotDistance)+plotHeight/2;//(chan+1)*(plotHeight+yBuffer);
    int upperBound = chan*(interplotDistance)-plotHeight/2;

    if (getScrollAmount() < lowerBound && getScrollAmount() + getHeight() > upperBound)
        isVisible = true;
    else
        isVisible = false;

    return isVisible;

}
Esempio n. 2
0
void LfpDisplayCanvas::setViewport(int chan)
{
	glViewport(xBuffer,
			   getHeight()-(chan+1)*(plotHeight+yBuffer)+getScrollAmount(),
	           getWidth()-2*xBuffer,
	           plotHeight);
}
Esempio n. 3
0
void LfpDisplayCanvas::setInfoViewport(int chan)
{
    int y = (chan+1)*(interplotDistance); //interplotDistance - plotHeight/2);

    glViewport(yBuffer,
               getHeight()-y+getScrollAmount()- headerHeight - interplotDistance/2 - yBuffer,
               xBuffer-yBuffer,
               interplotDistance - yBuffer*2);
}
Esempio n. 4
0
void LfpDisplayCanvas::setViewport(int chan)
{
    int y = (chan+1)*(interplotDistance); //interplotDistance - plotHeight/2);

    glViewport(xBuffer,
               getHeight()-y+getScrollAmount()- headerHeight - plotHeight/2,
               getWidth()-xBuffer,
               plotHeight);
}
Esempio n. 5
0
void InfoLabel::drawLabel()
{
	
	glViewport(xBuffer,
		 	   getHeight()-getTotalHeight()-yBuffer + getScrollAmount(),
		 	   getWidth()-2*xBuffer,
		 	   getTotalHeight());

	glColor4f(0.3,0.3,0.3,1.0);

	glRasterPos2f(15.0/float(getWidth()),0.05f);
	getFont(String("miso-regular"))->FaceSize(18.0f);
	layout.Render(infoString, -1, FTPoint(), FTGL::RENDER_FRONT);

}
Esempio n. 6
0
ProcessorListItem* ProcessorList::getListItemForYPos(int y)
{
    int bottom = (yBuffer + itemHeight) - getScrollAmount();

    //std::cout << "Bottom: " << bottom << std::endl;
    //std::cout << "Y coordinate: " << y << std::endl;

    if (y < bottom)
    {
        return baseItem;

    }
    else
    {

        if (baseItem->isOpen())
        {
            for (int n = 0; n < baseItem->getNumSubItems(); n++)
            {
                bottom += (yBuffer + itemHeight);

                if (y < bottom)
                {
                    return baseItem->getSubItem(n);
                }

                if (baseItem->getSubItem(n)->isOpen())
                {
                    for (int m = 0; m < baseItem->getSubItem(n)->getNumSubItems(); m++)
                    {
                        bottom += (yBuffer + subItemHeight);

                        if (y < bottom)
                        {
                            return baseItem->getSubItem(n)->getSubItem(m);
                        }

                    }
                }
            }
        }

    }

    return 0;

}
Esempio n. 7
0
void LfpDisplayCanvas::mouseDown(const MouseEvent& e) 
{

	Point<int> pos = e.getPosition();
	int xcoord = pos.getX();

	if (xcoord < getWidth()-getScrollBarWidth())
	{
		int chan = (e.getMouseDownY() + getScrollAmount())/(yBuffer+plotHeight);

			selectedChan = chan;

		repaint();
	}

	mouseDownInCanvas(e);
}
Esempio n. 8
0
void LfpDisplayCanvas::mouseDownInCanvas(const MouseEvent& e)
{

    Point<int> pos = e.getPosition();
    int xcoord = pos.getX();
    int ycoord = pos.getY();

    if (xcoord < getWidth()-getScrollBarWidth() && ycoord > headerHeight)
    {
        int ycoord = e.getMouseDownY() - headerHeight - interplotDistance/2;// - interplotDistance/2;// - interplotDistance;
        int chan = (ycoord + getScrollAmount())/(yBuffer+interplotDistance);

        selectedChan = chan;

        repaint();
    }

}
Esempio n. 9
0
void ProcessorList::setViewport(bool hasSubItems)
{

	int height;

	if (hasSubItems)
	{
		height = itemHeight;
	} else {
		height = subItemHeight;
	}

	glViewport(xBuffer,
			   getHeight()-(totalHeight) - height + getScrollAmount(),
	           getWidth()-2*xBuffer,
	           height);

	totalHeight += yBuffer + height;
}
Esempio n. 10
0
void SpikeDisplayCanvas::repositionSpikePlots(){
	
	int canvasWidth = getWidth();
	int gridSize = canvasWidth / nCols;
    
    gridSize = (gridSize > MIN_GRID_SIZE) ? gridSize : MIN_GRID_SIZE;
    gridSize = (gridSize < MAX_GRID_SIZE) ? gridSize : MAX_GRID_SIZE;
        
    
    
    int x = xBuffer;
    int y = getHeight() - yBuffer;
    int p = 0;
    int w,h;
    int yIncrement = 0;
    bool loopCheck = false;
    //std::cout<<"Positioning Spike Plots"<<std::endl;
    while (p < plots.size()){
        
        // Ask the current plot for its desired dims
        plots[p]->getBestDimensions(&w, &h);
        w *= gridSize;
        h *= gridSize;
        
        // Check to see if plot exceeds width of canvas, if yes, set x back to 0 and go to the bottom most plot on the canvas
        if ( (x + w + xBuffer > canvasWidth - xBuffer) && !loopCheck){
            //std::cout<<"Collision with the edge of the canvas, going down a row"<<std::endl;
            x = xBuffer;
            y = y - yIncrement - yBuffer;
            yIncrement = 0;
            loopCheck = true;
            continue;
        }
        // else place the plot
        else{
            //std::cout<<"Positioning p:"<<p<<" at "<<x<<","<<y - h<<"  "<<w<<","<<h<<std::endl;
            plots[p]->setPosition(x, y - h + getScrollAmount(), w, h);
            x = x + w + xBuffer;

            // set a new minimum
            if (h > yIncrement)
                yIncrement = h;
            
            // increment p
            p++;
            loopCheck = false;
        }
    }

//  int plotWidth =  (totalWidth - yBuffer * ( nCols+1)) / nCols + .99;
//	int plotHeight = plotWidth / 2 + .5;
//	int rowCount = 0;

//	for (int i=0; i < plots.size(); i++)
//	{
//
//		plots[i]->setPosition(	xBuffer + i%nCols * (plotWidth + xBuffer) , 
//								getHeight() - ( yBuffer + plotHeight + rowCount * (plotHeight + yBuffer)) + getScrollAmount(), 
//								plotWidth, 
//								plotHeight); // deprecated conversion from string constant to char
//
//		if (i%nCols == nCols-1)
//			rowCount++;	
//	 }

	// Set the total height of the Canvas to the top of the top most plot
//	totalHeight = (rowCount + 1) * (plotHeight + yBuffer) + yBuffer;
    totalHeight = getHeight() + (y + yIncrement);
}