1125 "move inside - stop autoscroll if any" |
1121 "move inside - stop autoscroll if any" |
1126 autoScrollBlock notNil ifTrue:[ |
1122 autoScrollBlock notNil ifTrue:[ |
1127 self stopScrollSelect |
1123 self stopScrollSelect |
1128 ]. |
1124 ]. |
1129 |
1125 |
1130 movedVisibleLine := self visibleLineOfY:y. |
1126 self extendSelectionToX:x y:y. |
1131 movedLine := self visibleLineToAbsoluteLine:movedVisibleLine. |
|
1132 |
|
1133 (x < leftMargin) ifTrue:[ |
|
1134 movedCol := 0 |
|
1135 ] ifFalse:[ |
|
1136 movedCol := self colOfX:x inVisibleLine:movedVisibleLine |
|
1137 ]. |
|
1138 y < 0 ifTrue:[ |
|
1139 movedCol := 0 |
|
1140 ]. |
|
1141 ((movedLine == clickLine) and:[movedCol == clickCol]) ifTrue:[ |
|
1142 selectionStartLine notNil ifTrue:[ |
|
1143 ^ self |
|
1144 ]. |
|
1145 (clickPos isNil |
|
1146 or:[(clickPos x - x) abs < 3 |
|
1147 and:[(clickPos y - y) abs < 3]]) ifTrue:[ |
|
1148 ^ self |
|
1149 ]. |
|
1150 selectionStartLine := clickLine. |
|
1151 selectionStartCol := clickCol. |
|
1152 selectionEndLine := selectionStartLine. |
|
1153 selectionEndCol := selectionStartCol. |
|
1154 |
|
1155 oldStartLine := selectionStartLine. |
|
1156 oldEndLine := selectionEndLine. |
|
1157 oldStartCol := selectionStartCol. |
|
1158 oldEndCol := selectionEndCol-1. |
|
1159 ] ifFalse:[ |
|
1160 selectionStartLine isNil ifTrue:[ |
|
1161 selectionStartLine := clickLine. |
|
1162 selectionStartCol := clickCol. |
|
1163 selectionEndLine := selectionStartLine. |
|
1164 selectionEndCol := selectionStartCol |
|
1165 ]. |
|
1166 oldStartLine := selectionStartLine. |
|
1167 oldEndLine := selectionEndLine. |
|
1168 oldStartCol := selectionStartCol. |
|
1169 oldEndCol := selectionEndCol. |
|
1170 ]. |
|
1171 |
|
1172 "find out if we are before or after initial click" |
|
1173 movedUp := false. |
|
1174 (movedLine < clickStartLine) ifTrue:[ |
|
1175 movedUp := true |
|
1176 ] ifFalse:[ |
|
1177 (movedLine == clickStartLine) ifTrue:[ |
|
1178 (movedCol < clickStartCol) ifTrue:[ |
|
1179 movedUp := true |
|
1180 ] |
|
1181 ] |
|
1182 ]. |
|
1183 |
|
1184 movedUp ifTrue:[ |
|
1185 "change selectionStart" |
|
1186 selectionStartCol := movedCol. |
|
1187 selectionStartLine := movedLine. |
|
1188 selectionEndCol := clickStartCol. |
|
1189 selectionEndLine := clickStartLine. |
|
1190 selectStyle notNil ifTrue:[ |
|
1191 selectionEndCol := wordEndCol. |
|
1192 selectionEndLine := wordEndLine. |
|
1193 ] |
|
1194 ] ifFalse:[ |
|
1195 "change selectionEnd" |
|
1196 selectionEndCol := movedCol. |
|
1197 selectionEndLine := movedLine. |
|
1198 selectionStartCol := clickStartCol. |
|
1199 selectionStartLine := clickStartLine. |
|
1200 selectStyle notNil ifTrue:[ |
|
1201 selectionStartCol := wordStartCol. |
|
1202 selectionStartLine := wordStartLine. |
|
1203 ] |
|
1204 ]. |
|
1205 |
|
1206 selectionStartLine isNil ifTrue:[^ self]. |
|
1207 |
|
1208 (selectionStartCol == 0) ifTrue:[ |
|
1209 selectionStartCol := 1 |
|
1210 ]. |
|
1211 |
|
1212 " |
|
1213 if in word-select, just catch the rest of the word |
|
1214 " |
|
1215 (selectStyle notNil and:[selectStyle startsWith:'word']) ifTrue:[ |
|
1216 movedUp ifTrue:[ |
|
1217 selectionStartCol := self findBeginOfWordAtLine:selectionStartLine col:selectionStartCol |
|
1218 ] ifFalse:[ |
|
1219 selectionEndCol := self findEndOfWordAtLine:selectionEndLine col:selectionEndCol. |
|
1220 selectionEndCol == 0 ifTrue:[ |
|
1221 selectionEndLine := selectionEndLine + 1 |
|
1222 ] |
|
1223 ]. |
|
1224 ]. |
|
1225 |
|
1226 selectStyle == #line ifTrue:[ |
|
1227 movedUp ifTrue:[ |
|
1228 selectionStartCol := 1. |
|
1229 ] ifFalse:[ |
|
1230 selectionEndCol := 0. |
|
1231 selectionEndLine := selectionEndLine + 1 |
|
1232 ] |
|
1233 ]. |
|
1234 |
|
1235 self validateNewSelection. |
|
1236 |
|
1237 self clearSearchAction. |
|
1238 |
|
1239 (oldStartLine == selectionStartLine) ifTrue:[ |
|
1240 (oldStartCol ~~ selectionStartCol) ifTrue:[ |
|
1241 self redrawLine:oldStartLine |
|
1242 from:((selectionStartCol min:oldStartCol) max:1) |
|
1243 to:((selectionStartCol max:oldStartCol) max:1) |
|
1244 ] |
|
1245 ] ifFalse:[ |
|
1246 self redrawFromLine:(oldStartLine min:selectionStartLine) |
|
1247 to:(oldStartLine max:selectionStartLine) |
|
1248 ]. |
|
1249 |
|
1250 (oldEndLine == selectionEndLine) ifTrue:[ |
|
1251 (oldEndCol ~~ selectionEndCol) ifTrue:[ |
|
1252 self redrawLine:oldEndLine |
|
1253 from:((selectionEndCol min:oldEndCol) max:1) |
|
1254 to:((selectionEndCol max:oldEndCol) max:1) |
|
1255 ] |
|
1256 ] ifFalse:[ |
|
1257 selectionStartLine notNil ifTrue:[ |
|
1258 self redrawFromLine:(oldEndLine min:selectionEndLine) |
|
1259 to:(oldEndLine max:selectionEndLine) |
|
1260 ] |
|
1261 ]. |
|
1262 clickLine := movedLine. |
|
1263 clickCol := movedCol |
|
1264 |
1127 |
1265 "Modified: / 28.7.1998 / 16:02:18 / cg" |
1128 "Modified: / 28.7.1998 / 16:02:18 / cg" |
1266 ! |
1129 ! |
1267 |
1130 |
1268 buttonMultiPress:button x:x y:y |
1131 buttonMultiPress:button x:x y:y |
1511 wordEndCol := selectionEndCol |
1373 wordEndCol := selectionEndCol |
1512 ] |
1374 ] |
1513 |
1375 |
1514 "Created: 11.9.1997 / 04:12:55 / cg" |
1376 "Created: 11.9.1997 / 04:12:55 / cg" |
1515 "Modified: 19.9.1997 / 06:43:10 / cg" |
1377 "Modified: 19.9.1997 / 06:43:10 / cg" |
|
1378 ! |
|
1379 |
|
1380 extendSelectionToX:x y:y |
|
1381 "mouse-move while button was pressed - handle selection changes" |
|
1382 |
|
1383 |movedVisibleLine movedLine movedCol |
|
1384 movedUp |
|
1385 oldStartLine oldEndLine oldStartCol oldEndCol| |
|
1386 |
|
1387 movedVisibleLine := self visibleLineOfY:y. |
|
1388 movedLine := self visibleLineToAbsoluteLine:movedVisibleLine. |
|
1389 |
|
1390 (x < leftMargin) ifTrue:[ |
|
1391 movedCol := 0 |
|
1392 ] ifFalse:[ |
|
1393 movedCol := self colOfX:x inVisibleLine:movedVisibleLine |
|
1394 ]. |
|
1395 y < 0 ifTrue:[ |
|
1396 movedCol := 0 |
|
1397 ]. |
|
1398 ((movedLine == clickLine) and:[movedCol == clickCol]) ifTrue:[ |
|
1399 selectionStartLine notNil ifTrue:[ |
|
1400 ^ self |
|
1401 ]. |
|
1402 (clickPos isNil |
|
1403 or:[(clickPos x - x) abs < 3 |
|
1404 and:[(clickPos y - y) abs < 3]]) ifTrue:[ |
|
1405 ^ self |
|
1406 ]. |
|
1407 selectionStartLine := clickLine. |
|
1408 selectionStartCol := clickCol. |
|
1409 selectionEndLine := selectionStartLine. |
|
1410 selectionEndCol := selectionStartCol. |
|
1411 |
|
1412 oldStartLine := selectionStartLine. |
|
1413 oldEndLine := selectionEndLine. |
|
1414 oldStartCol := selectionStartCol. |
|
1415 oldEndCol := selectionEndCol-1. |
|
1416 ] ifFalse:[ |
|
1417 selectionStartLine isNil ifTrue:[ |
|
1418 selectionStartLine := clickLine. |
|
1419 selectionStartCol := clickCol. |
|
1420 selectionEndLine := selectionStartLine. |
|
1421 selectionEndCol := selectionStartCol |
|
1422 ]. |
|
1423 oldStartLine := selectionStartLine. |
|
1424 oldEndLine := selectionEndLine. |
|
1425 oldStartCol := selectionStartCol. |
|
1426 oldEndCol := selectionEndCol. |
|
1427 ]. |
|
1428 |
|
1429 "find out if we are before or after initial click" |
|
1430 movedUp := false. |
|
1431 (movedLine < clickStartLine) ifTrue:[ |
|
1432 movedUp := true |
|
1433 ] ifFalse:[ |
|
1434 (movedLine == clickStartLine) ifTrue:[ |
|
1435 (movedCol < clickStartCol) ifTrue:[ |
|
1436 movedUp := true |
|
1437 ] |
|
1438 ] |
|
1439 ]. |
|
1440 |
|
1441 movedUp ifTrue:[ |
|
1442 "change selectionStart" |
|
1443 selectionStartCol := movedCol. |
|
1444 selectionStartLine := movedLine. |
|
1445 selectionEndCol := clickStartCol. |
|
1446 selectionEndLine := clickStartLine. |
|
1447 selectStyle notNil ifTrue:[ |
|
1448 selectionEndCol := wordEndCol. |
|
1449 selectionEndLine := wordEndLine. |
|
1450 ] |
|
1451 ] ifFalse:[ |
|
1452 "change selectionEnd" |
|
1453 selectionEndCol := movedCol. |
|
1454 selectionEndLine := movedLine. |
|
1455 selectionStartCol := clickStartCol. |
|
1456 selectionStartLine := clickStartLine. |
|
1457 selectStyle notNil ifTrue:[ |
|
1458 selectionStartCol := wordStartCol. |
|
1459 selectionStartLine := wordStartLine. |
|
1460 ] |
|
1461 ]. |
|
1462 |
|
1463 selectionStartLine isNil ifTrue:[^ self]. |
|
1464 |
|
1465 (selectionStartCol == 0) ifTrue:[ |
|
1466 selectionStartCol := 1 |
|
1467 ]. |
|
1468 |
|
1469 " |
|
1470 if in word-select, just catch the rest of the word |
|
1471 " |
|
1472 (selectStyle notNil and:[selectStyle startsWith:'word']) ifTrue:[ |
|
1473 movedUp ifTrue:[ |
|
1474 selectionStartCol := self findBeginOfWordAtLine:selectionStartLine col:selectionStartCol |
|
1475 ] ifFalse:[ |
|
1476 selectionEndCol := self findEndOfWordAtLine:selectionEndLine col:selectionEndCol. |
|
1477 selectionEndCol == 0 ifTrue:[ |
|
1478 selectionEndLine := selectionEndLine + 1 |
|
1479 ] |
|
1480 ]. |
|
1481 ]. |
|
1482 |
|
1483 selectStyle == #line ifTrue:[ |
|
1484 movedUp ifTrue:[ |
|
1485 selectionStartCol := 1. |
|
1486 ] ifFalse:[ |
|
1487 selectionEndCol := 0. |
|
1488 selectionEndLine := selectionEndLine + 1 |
|
1489 ] |
|
1490 ]. |
|
1491 |
|
1492 self validateNewSelection. |
|
1493 |
|
1494 self clearSearchAction. |
|
1495 |
|
1496 (oldStartLine == selectionStartLine) ifTrue:[ |
|
1497 (oldStartCol ~~ selectionStartCol) ifTrue:[ |
|
1498 self redrawLine:oldStartLine |
|
1499 from:((selectionStartCol min:oldStartCol) max:1) |
|
1500 to:((selectionStartCol max:oldStartCol) max:1) |
|
1501 ] |
|
1502 ] ifFalse:[ |
|
1503 self redrawFromLine:(oldStartLine min:selectionStartLine) |
|
1504 to:(oldStartLine max:selectionStartLine) |
|
1505 ]. |
|
1506 |
|
1507 (oldEndLine == selectionEndLine) ifTrue:[ |
|
1508 (oldEndCol ~~ selectionEndCol) ifTrue:[ |
|
1509 self redrawLine:oldEndLine |
|
1510 from:((selectionEndCol min:oldEndCol) max:1) |
|
1511 to:((selectionEndCol max:oldEndCol) max:1) |
|
1512 ] |
|
1513 ] ifFalse:[ |
|
1514 selectionStartLine notNil ifTrue:[ |
|
1515 self redrawFromLine:(oldEndLine min:selectionEndLine) |
|
1516 to:(oldEndLine max:selectionEndLine) |
|
1517 ] |
|
1518 ]. |
|
1519 clickLine := movedLine. |
|
1520 clickCol := movedCol |
|
1521 |
|
1522 "Modified: / 28.7.1998 / 16:02:18 / cg" |
1516 ! |
1523 ! |
1517 |
1524 |
1518 keyPress:key x:x y:y |
1525 keyPress:key x:x y:y |
1519 "handle some keyboard input (there is not much to be done here)" |
1526 "handle some keyboard input (there is not much to be done here)" |
1520 |
1527 |