I put the code at line 867, but it has been disabled until i could work back on it.
case WM_LBUTTONDOWN:
if (lstrlen(gT.zTex)) {
DisplayMouseXY(hWnd, LOINT(lParam), HIINT(lParam)); // This is there that gT.x and gT.y are being set
//// Stack clear/release
//if (gT.URidx > -1) {
// UB = UBOUND(g_UR) -1;
// for (K = UB; K >= gT.URidx; K--) {
// if (g_UR[K].action == UR_UNDO) {
// g_UR.erase(g_UR.begin() + K);
// }
// }
//}
gT.UpDown = IS_DOWN;
MouseMap();
if (gT.wasIndex > -1) {
if (ZI_GetObjectFocusID() != ID_DOT) {
ZI_SetObjectFocusID(ID_DOT);
}
if (ZI_IsLButtonDown()) {
DotMove = TRUE;
}
}
}
break;
see also line 1823 and 1842
case TOR_UNDO:
UB = UBOUND(g_UR);
if (gT.URidx < 0) { gT.URidx = UB - 1; }
gT.URidx = max(gT.URidx - 1, -1);
if (gT.URidx > -1) {
g_UR[gT.URidx + 1].action = UR_UNDO; // Stack clear/release
ZI_GetImageSizeFromControl(gT.hZoomCtrl, nW, nH);
idx = g_UR[gT.URidx].idx;
gtm_vertexBuffer[idx].texCoord[0] = g_UR[gT.URidx].rx;
gtm_vertexBuffer[idx].texCoord[1] = g_UR[gT.URidx].ry;
gT.wasX = g_UR[gT.URidx].wasX;
gT.wasY = g_UR[gT.URidx].wasY;
gT.wasIndex = g_UR[gT.URidx].index;;
UpdateUVMAP(TRUE);
if (!IsWindowEnabled(GetDlgItem(gT.hPanel, TOR_REDO))) { EnableRedo(TRUE); }
if (gT.URidx == 0) { EnableUndo(FALSE); }
}
SetFocus(gT.hZoomCtrl);
break;
case TOR_REDO:
UB = UBOUND(g_UR);
if (gT.URidx < UB - 1) {
gT.URidx++;
g_UR[gT.URidx].action = UR_REDO; // Stack clear/release
ZI_GetImageSizeFromControl(gT.hZoomCtrl, nW, nH);
idx = g_UR[gT.URidx].idx;
gtm_vertexBuffer[idx].texCoord[0] = g_UR[gT.URidx].rx;
gtm_vertexBuffer[idx].texCoord[1] = g_UR[gT.URidx].ry;
gT.wasX = g_UR[gT.URidx].wasX;
gT.wasY = g_UR[gT.URidx].wasY;
gT.wasIndex = g_UR[gT.URidx].index;;
UpdateUVMAP(TRUE);
if (!IsWindowEnabled(GetDlgItem(gT.hPanel, TOR_UNDO))) { EnableUndo(TRUE); }
if (gT.URidx == UB - 1) { EnableRedo(FALSE); }
}
SetFocus(gT.hZoomCtrl);
break;