| 1209 | } |
| 1210 | |
| 1211 | void PiuCode_locate(xsMachine *the) |
| 1212 | { |
| 1213 | PiuCode* self = PIU(Code, xsThis); |
| 1214 | if ((*self)->application) { |
| 1215 | xsStringValue string = PiuToString((*self)->string); |
| 1216 | PiuStyle* style = (*self)->computedStyle; |
| 1217 | int32_t offset = fxUnicodeToUTF8Offset(string, xsToInteger(xsArg(0))); |
| 1218 | int32_t column, line; |
| 1219 | PiuCodeOffsetToColumnLine(self, offset, &column, &line); |
| 1220 | xsResult = xsNewObject(); |
| 1221 | xsDefine(xsResult, xsID_x, xsPiuCoordinate((xsIntegerValue)c_floor((*style)->margins.left + (column * (*self)->columnWidth))), xsDefault); |
| 1222 | xsDefine(xsResult, xsID_y, xsPiuCoordinate((xsIntegerValue)c_floor((*style)->margins.top + (line * (*self)->lineHeight))), xsDefault); |
| 1223 | xsDefine(xsResult, xsID_width, xsPiuDimension((xsIntegerValue)c_ceil((*self)->columnWidth)), xsDefault); |
| 1224 | xsDefine(xsResult, xsID_height, xsPiuDimension((xsIntegerValue)c_ceil((*self)->lineHeight)), xsDefault); |
| 1225 | } |
| 1226 | } |
| 1227 | |
| 1228 | void PiuCode_select(xsMachine *the) |
| 1229 | { |
nothing calls this directly
no test coverage detected