Newer
Older
glVertex2f(zero.x,zero.y);
glEnd();
glPopName();
*/
glPushName(1); //id of the move tool
drawSelectionTools(true);
glPopName();
//if (changeDpi)
refreshAll();
if(style->selectStitches)
{
glLoadName(1); //id of the stitches
index = 0;
glPushName(index); //init the stitches index
stitch = selectedStitches.begin();
while (stitch != selectedStitches.end())
{
drawStitchControl((*stitch), true);
stitch++;
index++;
glLoadName(index);
}
glPopName();
}
if(style->selectCurves)
{
glLoadName(2); //id of the curves
index = 0;
glPushName(index); //init the curves index
curve = selectedCurves.begin();
while (curve != selectedCurves.end())
{
drawCurveControl((*curve), true);
curve++;
index++;
glLoadName(index);
}
glPopName();
}
if(style->selectStitches)
{
glLoadName(1); //id of the stitches
index = 0;
glPushName(index); //init the stitches index
int curpoint = document->curPoint;
stitch = document->stitchs.begin();
while (stitch != document->stitchs.end())
{
drawStitch((*stitch),curpoint);
curpoint -= (*stitch)->getPoints().size();
stitch++;
index++;
glLoadName(index);
}
glPopName();
}
if(style->selectCurves)
{
glLoadName(2); //id of the curves
index = 0;
glPushName(index); //init the curves index
curve = document->curves.begin();
while (curve != document->curves.end())
{
drawCurve((*curve));
curve++;
index++;
glLoadName(index);
}
glPopName();
}
}
/** \brief move and zoom to see the entire document
*/
void OE_display::showAll()
{
if (document)
BoundingBox bound = document->getBound();
viewPos.x = (bound.getMax().x + bound.getMin().x)/2;
viewPos.y = (bound.getMax().y + bound.getMin().y)/2;
zoom = maxf((bound.getMax().x - bound.getMin().x )/width/1.5,(bound.getMax().y - bound.getMin().y)/height/1.5);
changeDpi = true;
void OE_display::zoomSelection()
3dsman
committed
{
if (document&&controller)
{
float xMin,yMin,xMax,yMax;
BoundingBox bound = controller->getSelectionBoundingBox();
viewPos.x = (bound.getMax().x + bound.getMin().x)/2;
viewPos.y = (bound.getMax().y + bound.getMin().y)/2;
zoom = maxf((bound.getMax().x - bound.getMin().x )/width/1.5,(bound.getMax().y - bound.getMin().y)/height/1.5);
changeDpi = true;
3dsman
committed
}
}
void OE_display::mouse_Pos(double x, double y)
{
if (pan)
viewPos = viewPos + (mouse-vector_2d(x,y))*zoom;
mouse.x = x;
mouse.y = y;
absMouse = viewPos+(mouse-vector_2d(width,height)/2)*zoom*2;
}
void OE_display::mouse_Button(int button, int action, int mods)
{
if (button == GLFW_MOUSE_BUTTON_MIDDLE)
{
if (action == GLFW_PRESS)
pan = true;
else
pan = false;
}
}
void OE_display::scroll(double xoffset, double yoffset)
{
if(!pan){
if (yoffset>0)
zoom = zoom/1.1;
else
zoom = zoom*1.1;
changeDpi = true;
}
void OE_display::resize(int width, int height)
{
this->width = width;
this->height = height;
}
void OE_display::key(int key, int scancode, int action, int mods){};