Newer
Older
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
{
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;
3dsman
committed
void OE_display::showSelection()
{
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){};