+ /* values displayed in statusbar */
+ short xRel = xNow - startX;
+ short yRel = yNow - startY;
+ /* freesel, rectsel and text tools always show numbers limited to fit into image area */
+ if ((activeTool == TOOL_FREESEL) || (activeTool == TOOL_RECTSEL) || (activeTool == TOOL_TEXT))
+ {
+ if (xRel < 0)
+ xRel = (xNow < 0) ? -startX : xRel;
+ else if (xNow > imgXRes)
+ xRel = imgXRes-startX;
+ if (yRel < 0)
+ yRel = (yNow < 0) ? -startY : yRel;
+ else if (yNow > imgYRes)
+ yRel = imgYRes-startY;
+ }
+ /* rectsel and shape tools always show non-negative numbers when drawing */
+ if ((activeTool == TOOL_RECTSEL) || (activeTool == TOOL_SHAPE))
+ {
+ if (xRel < 0)
+ xRel = -xRel;
+ if (yRel < 0)
+ yRel = -yRel;
+ }
+ /* while drawing, update cursor coordinates only for tools 3, 7, 8, 9, 14 */
+ switch(activeTool)
+ {
+ case TOOL_RUBBER:
+ case TOOL_PEN:
+ case TOOL_BRUSH:
+ case TOOL_AIRBRUSH:
+ case TOOL_SHAPE:
+ {
+ TCHAR coordStr[100];
+ _stprintf(coordStr, _T("%d, %d"), xNow, yNow);
+ SendMessage(hStatusBar, SB_SETTEXT, 1, (LPARAM) coordStr);
+ break;
+ }
+ }